mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-29 15:23:02 +05:00
Increased safety of INI path query
This commit is contained in:
parent
91d14c80b7
commit
8254c1da58
1 changed files with 6 additions and 24 deletions
|
@ -1985,14 +1985,8 @@ BOOL InjectDelayedPatches_10()
|
|||
|
||||
// Obtain a path to the ASI
|
||||
wchar_t wcModulePath[MAX_PATH];
|
||||
|
||||
GetModuleFileNameW(hDLLModule, wcModulePath, MAX_PATH);
|
||||
|
||||
// ASI -> INI
|
||||
size_t nLen = wcslen(wcModulePath);
|
||||
wcModulePath[nLen-1] = L'i';
|
||||
wcModulePath[nLen-2] = L'n';
|
||||
wcModulePath[nLen-3] = L'i';
|
||||
GetModuleFileNameW(hDLLModule, wcModulePath, _countof(wcModulePath) - 3); // Minus max required space for extension
|
||||
PathRenameExtensionW(wcModulePath, L".ini");
|
||||
|
||||
bool bHasImVehFt = GetModuleHandle("ImVehFt.asi") != nullptr;
|
||||
bool bSAMP = GetModuleHandle("samp") != nullptr;
|
||||
|
@ -2213,14 +2207,8 @@ BOOL InjectDelayedPatches_11()
|
|||
|
||||
// Obtain a path to the ASI
|
||||
wchar_t wcModulePath[MAX_PATH];
|
||||
|
||||
GetModuleFileNameW(hDLLModule, wcModulePath, MAX_PATH);
|
||||
|
||||
// ASI -> INI
|
||||
size_t nLen = wcslen(wcModulePath);
|
||||
wcModulePath[nLen-1] = L'i';
|
||||
wcModulePath[nLen-2] = L'n';
|
||||
wcModulePath[nLen-3] = L'i';
|
||||
GetModuleFileNameW(hDLLModule, wcModulePath, _countof(wcModulePath) - 3); // Minus max required space for extension
|
||||
PathRenameExtensionW(wcModulePath, L".ini");
|
||||
|
||||
bool bHasImVehFt = GetModuleHandle("ImVehFt.asi") != nullptr;
|
||||
bool bSAMP = GetModuleHandle("samp") != nullptr;
|
||||
|
@ -2438,14 +2426,8 @@ BOOL InjectDelayedPatches_Steam()
|
|||
|
||||
// Obtain a path to the ASI
|
||||
wchar_t wcModulePath[MAX_PATH];
|
||||
|
||||
GetModuleFileNameW(hDLLModule, wcModulePath, MAX_PATH);
|
||||
|
||||
// ASI -> INI
|
||||
size_t nLen = wcslen(wcModulePath);
|
||||
wcModulePath[nLen-1] = L'i';
|
||||
wcModulePath[nLen-2] = L'n';
|
||||
wcModulePath[nLen-3] = L'i';
|
||||
GetModuleFileNameW(hDLLModule, wcModulePath, _countof(wcModulePath) - 3); // Minus max required space for extension
|
||||
PathRenameExtensionW(wcModulePath, L".ini");
|
||||
|
||||
bool bHasImVehFt = GetModuleHandle("ImVehFt.asi") != nullptr;
|
||||
bool bSAMP = GetModuleHandle("samp") != nullptr;
|
||||
|
|
Loading…
Reference in a new issue