Skip to content

Commit

Permalink
update code.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrpond committed Sep 5, 2022
1 parent 4f96d18 commit 36e7037
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
19 changes: 10 additions & 9 deletions src/BlockTheSpot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@
//

#include "stdafx.h"
#include <map>

void __stdcall LoadAPI (LPVOID* destination, LPCSTR apiName)
void __stdcall LoadAPI (LPVOID* destination, const char* apiName)
{
if (*destination)
return;

char path[MAX_PATH];
//wchar_t windows[MAX_PATH];
//GetSystemDirectoryW(windows, MAX_PATH);
//wsprintf(path, L"%s\\netutils.dll", windows);
wsprintf (path, ".\\chrome_elf_bak.dll");
HMODULE hModule = GetModuleHandle (path);
if (!hModule && !(hModule = LoadLibrary (path)))
static std::string_view path{ ".\\chrome_elf_bak.dll" };
static HMODULE hModule = GetModuleHandle (path.data ());
static std::map<std::string,FARPROC> function_map;
if (!hModule && !(hModule = LoadLibrary (path.data ())))
return;
*destination = GetProcAddress (hModule, apiName);
if (function_map[apiName] == nullptr) {
function_map[apiName] = GetProcAddress (hModule, apiName);
}
*destination = function_map[apiName];
}

#define API_EXPORT_ORIG(N) \
Expand Down
6 changes: 3 additions & 3 deletions src/BlockTheSpot.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
Expand Down Expand Up @@ -84,7 +84,7 @@
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<ExceptionHandling>Sync</ExceptionHandling>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down
4 changes: 2 additions & 2 deletions src/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class Logger {
private:
auto current_datetime ()
static const auto& current_datetime ()
{
static struct tm newtime;
static __time64_t long_time;
Expand All @@ -13,7 +13,7 @@ class Logger {
}

std::ofstream log_stream;
const bool read (std::string_view app, std::string_view key, int def_value = 0) {
const bool read (std::string_view app, std::string_view key,const int def_value = 0) {
if (1 == GetPrivateProfileInt (app.data (), key.data (), def_value, "./config.ini")) {
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Modify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ cef_urlrequest_t* cef_urlrequest_create_hook (struct _cef_request_t* request,
*/

// https://www.unknowncheats.me/forum/1064672-post23.html
bool DataCompare (BYTE* pData, BYTE* bSig, char* szMask)
bool DataCompare (BYTE* pData, BYTE* bSig,const char* szMask)
{
for (; *szMask; ++szMask, ++pData, ++bSig)
{
Expand All @@ -62,7 +62,7 @@ bool DataCompare (BYTE* pData, BYTE* bSig, char* szMask)
return (*szMask) == NULL;
}

BYTE* FindPattern (BYTE* dwAddress, const DWORD dwSize, BYTE* pbSig, char* szMask)
BYTE* FindPattern (BYTE* dwAddress, const DWORD dwSize, BYTE* pbSig,const char* szMask)
{
DWORD length = strlen (szMask);
for (DWORD i = NULL; i < dwSize - length; i++)
Expand Down

0 comments on commit 36e7037

Please sign in to comment.