11#include < Windows.h>
22#include < Psapi.h>
33
4+ void WINAPI load_api (LPVOID* destination, LPCSTR api_name) noexcept
5+ {
6+ if (*destination)
7+ return ;
8+
9+ const auto h_mod{ ::LoadLibraryA (" _chrome_elf.dll" ) };
10+
11+ if (!h_mod)
12+ return ;
13+
14+ *destination = ::GetProcAddress (h_mod, api_name);
15+ }
16+
17+ #define API_EXPORT_ORIG (N ) \
18+ static LPVOID _##N = NULL ; \
19+ char S_##N[] = " " # N; \
20+ extern " C" __declspec(dllexport) __declspec(naked) void N ## () \
21+ { \
22+ __asm pushad \
23+ __asm push offset S_##N \
24+ __asm push offset _##N \
25+ __asm call load_api \
26+ __asm popad \
27+ __asm jmp [_##N] \
28+ } \
29+
30+ API_EXPORT_ORIG (ClearReportsBetween_ExportThunk)
31+ API_EXPORT_ORIG(CrashForException_ExportThunk)
32+ API_EXPORT_ORIG(DisableHook)
33+ API_EXPORT_ORIG(DrainLog)
34+ API_EXPORT_ORIG(DumpHungProcessWithPtype_ExportThunk)
35+ API_EXPORT_ORIG(DumpProcessWithoutCrash)
36+ API_EXPORT_ORIG(GetApplyHookResult)
37+ API_EXPORT_ORIG(GetBlockedModulesCount)
38+ API_EXPORT_ORIG(GetCrashReports_ExportThunk)
39+ API_EXPORT_ORIG(GetCrashpadDatabasePath_ExportThunk)
40+ API_EXPORT_ORIG(GetHandleVerifier)
41+ API_EXPORT_ORIG(GetInstallDetailsPayload)
42+ API_EXPORT_ORIG(GetUniqueBlockedModulesCount)
43+ API_EXPORT_ORIG(GetUserDataDirectoryThunk)
44+ API_EXPORT_ORIG(InjectDumpForHungInput_ExportThunk)
45+ API_EXPORT_ORIG(IsBrowserProcess)
46+ API_EXPORT_ORIG(IsCrashReportingEnabledImpl)
47+ API_EXPORT_ORIG(IsThirdPartyInitialized)
48+ API_EXPORT_ORIG(RegisterLogNotification)
49+ API_EXPORT_ORIG(RequestSingleCrashUpload_ExportThunk)
50+ API_EXPORT_ORIG(SetCrashKeyValueImpl)
51+ API_EXPORT_ORIG(SetMetricsClientId)
52+ API_EXPORT_ORIG(SetUploadConsent_ExportThunk)
53+ API_EXPORT_ORIG(SignalChromeElf)
54+ API_EXPORT_ORIG(SignalInitializeCrashReporting)
55+
456bool DataCompare(char * pData, const char * bSig, const char * szMask) noexcept
557{
658 for (; *szMask; ++szMask, ++pData, ++bSig) {
@@ -12,7 +64,7 @@ bool DataCompare(char* pData, const char* bSig, const char* szMask) noexcept
1264
1365char * FindPattern (char * dwAddress, DWORD dwSize, const char * pbSig, const char * szMask) noexcept
1466{
15- DWORD length{ strlen (szMask) };
67+ DWORD length{ :: strlen (szMask) };
1668
1769 for (DWORD i{ 0 }; i < dwSize - length; ++i) {
1870 __try {
@@ -28,21 +80,21 @@ char* FindPattern(char* dwAddress, DWORD dwSize, const char* pbSig, const char*
2880
2981char * scan (const char * pattern, const char * mask, MODULEINFO m) noexcept
3082{
31- const auto hModule{ GetModuleHandleA (nullptr ) };
83+ const auto hModule{ :: GetModuleHandleA (nullptr ) };
3284 return FindPattern ((char *)hModule, m.SizeOfImage , pattern, mask);
3385}
3486
3587void removeAds (char * fn) noexcept
3688{
3789 DWORD oldProtect;
3890
39- VirtualProtect (fn + 5 , 1 , PAGE_EXECUTE_READWRITE, &oldProtect);
40- memset (fn + 5 , 0x90 , 1 );
41- VirtualProtect (fn + 5 , 1 , oldProtect, &oldProtect);
91+ :: VirtualProtect (fn + 5 , 1 , PAGE_EXECUTE_READWRITE, &oldProtect);
92+ :: memset (fn + 5 , 0x90 , 1 );
93+ :: VirtualProtect (fn + 5 , 1 , oldProtect, &oldProtect);
4294
43- VirtualProtect (fn + 6 , 1 , PAGE_EXECUTE_READWRITE, &oldProtect);
44- memset (fn + 6 , 0xE9 , 1 );
45- VirtualProtect (fn + 6 , 1 , oldProtect, &oldProtect);
95+ :: VirtualProtect (fn + 6 , 1 , PAGE_EXECUTE_READWRITE, &oldProtect);
96+ :: memset (fn + 6 , 0xE9 , 1 );
97+ :: VirtualProtect (fn + 6 , 1 , oldProtect, &oldProtect);
4698}
4799
48100void APIENTRY main () noexcept
0 commit comments