Skip to content

Commit 36e7037

Browse files
author
mrpond
committed
update code.
1 parent 4f96d18 commit 36e7037

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

src/BlockTheSpot.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,22 @@
22
//
33

44
#include "stdafx.h"
5+
#include <map>
56

6-
void __stdcall LoadAPI (LPVOID* destination, LPCSTR apiName)
7+
void __stdcall LoadAPI (LPVOID* destination, const char* apiName)
78
{
89
if (*destination)
910
return;
1011

11-
char path[MAX_PATH];
12-
//wchar_t windows[MAX_PATH];
13-
//GetSystemDirectoryW(windows, MAX_PATH);
14-
//wsprintf(path, L"%s\\netutils.dll", windows);
15-
wsprintf (path, ".\\chrome_elf_bak.dll");
16-
HMODULE hModule = GetModuleHandle (path);
17-
if (!hModule && !(hModule = LoadLibrary (path)))
12+
static std::string_view path{ ".\\chrome_elf_bak.dll" };
13+
static HMODULE hModule = GetModuleHandle (path.data ());
14+
static std::map<std::string,FARPROC> function_map;
15+
if (!hModule && !(hModule = LoadLibrary (path.data ())))
1816
return;
19-
*destination = GetProcAddress (hModule, apiName);
17+
if (function_map[apiName] == nullptr) {
18+
function_map[apiName] = GetProcAddress (hModule, apiName);
19+
}
20+
*destination = function_map[apiName];
2021
}
2122

2223
#define API_EXPORT_ORIG(N) \

src/BlockTheSpot.vcxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
2222
<ConfigurationType>DynamicLibrary</ConfigurationType>
2323
<UseDebugLibraries>true</UseDebugLibraries>
24-
<PlatformToolset>v142</PlatformToolset>
24+
<PlatformToolset>v143</PlatformToolset>
2525
<CharacterSet>MultiByte</CharacterSet>
2626
</PropertyGroup>
2727
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
2828
<ConfigurationType>DynamicLibrary</ConfigurationType>
2929
<UseDebugLibraries>false</UseDebugLibraries>
30-
<PlatformToolset>v142</PlatformToolset>
30+
<PlatformToolset>v143</PlatformToolset>
3131
<WholeProgramOptimization>true</WholeProgramOptimization>
3232
<CharacterSet>MultiByte</CharacterSet>
3333
</PropertyGroup>
@@ -84,7 +84,7 @@
8484
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
8585
<ExceptionHandling>Sync</ExceptionHandling>
8686
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
87-
<LanguageStandard>stdcpp17</LanguageStandard>
87+
<LanguageStandard>stdcpp20</LanguageStandard>
8888
</ClCompile>
8989
<Link>
9090
<SubSystem>Windows</SubSystem>

src/Logger.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class Logger {
55
private:
6-
auto current_datetime ()
6+
static const auto& current_datetime ()
77
{
88
static struct tm newtime;
99
static __time64_t long_time;
@@ -13,7 +13,7 @@ class Logger {
1313
}
1414

1515
std::ofstream log_stream;
16-
const bool read (std::string_view app, std::string_view key, int def_value = 0) {
16+
const bool read (std::string_view app, std::string_view key,const int def_value = 0) {
1717
if (1 == GetPrivateProfileInt (app.data (), key.data (), def_value, "./config.ini")) {
1818
return true;
1919
}

src/Modify.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ cef_urlrequest_t* cef_urlrequest_create_hook (struct _cef_request_t* request,
5252
*/
5353

5454
// https://www.unknowncheats.me/forum/1064672-post23.html
55-
bool DataCompare (BYTE* pData, BYTE* bSig, char* szMask)
55+
bool DataCompare (BYTE* pData, BYTE* bSig,const char* szMask)
5656
{
5757
for (; *szMask; ++szMask, ++pData, ++bSig)
5858
{
@@ -62,7 +62,7 @@ bool DataCompare (BYTE* pData, BYTE* bSig, char* szMask)
6262
return (*szMask) == NULL;
6363
}
6464

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

0 commit comments

Comments
 (0)