mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-11-27 17:00:59 +01:00
Made FindPattern a non-inline function.
This should help reduce the code size as I continue to add more patterns.
This commit is contained in:
parent
2450a5d284
commit
3cb3ace48a
@ -1916,6 +1916,7 @@ DWORD FixTaskbarAutohide(DWORD unused)
|
||||
|
||||
|
||||
#pragma region "Allow enabling XAML sounds"
|
||||
#ifdef _WIN64
|
||||
void ForceEnableXamlSounds(HMODULE hWindowsUIXaml)
|
||||
{
|
||||
MODULEINFO mi;
|
||||
@ -1949,6 +1950,7 @@ BOOL IsXamlSoundsEnabled()
|
||||
RegGetValueW(HKEY_CURRENT_USER, TEXT(REGPATH_OLD), L"XamlSounds", RRF_RT_DWORD, NULL, &dwRes, &dwSize);
|
||||
return dwRes != 0;
|
||||
}
|
||||
#endif
|
||||
#pragma endregion
|
||||
|
||||
|
||||
|
@ -1655,3 +1655,31 @@ BOOL ExtractMonitorByIndex(HMONITOR hMonitor, HDC hDC, LPRECT lpRect, MonitorOve
|
||||
mod->cbIndex++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#ifdef _WIN64
|
||||
inline BOOL MaskCompare(PVOID pBuffer, LPCSTR lpPattern, LPCSTR lpMask)
|
||||
{
|
||||
for (PBYTE value = (PBYTE)pBuffer; *lpMask; ++lpPattern, ++lpMask, ++value)
|
||||
{
|
||||
if (*lpMask == 'x' && *(LPCBYTE)lpPattern != *value)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PVOID FindPattern(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lpMask)
|
||||
{
|
||||
dwSize -= strlen(lpMask);
|
||||
|
||||
for (SIZE_T index = 0; index < dwSize; ++index)
|
||||
{
|
||||
PBYTE pAddress = (PBYTE)pBase + index;
|
||||
|
||||
if (MaskCompare(pAddress, lpPattern, lpMask))
|
||||
return pAddress;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
@ -794,31 +794,9 @@ typedef struct _MonitorOverrideData
|
||||
|
||||
BOOL ExtractMonitorByIndex(HMONITOR hMonitor, HDC hDC, LPRECT lpRect, MonitorOverrideData* mod);
|
||||
|
||||
inline BOOL MaskCompare(PVOID pBuffer, LPCSTR lpPattern, LPCSTR lpMask)
|
||||
{
|
||||
for (PBYTE value = (PBYTE)pBuffer; *lpMask; ++lpPattern, ++lpMask, ++value)
|
||||
{
|
||||
if (*lpMask == 'x' && *(LPCBYTE)lpPattern != *value)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
inline PVOID FindPattern(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lpMask)
|
||||
{
|
||||
dwSize -= strlen(lpMask);
|
||||
|
||||
for (SIZE_T index = 0; index < dwSize; ++index)
|
||||
{
|
||||
PBYTE pAddress = (PBYTE)pBase + index;
|
||||
|
||||
if (MaskCompare(pAddress, lpPattern, lpMask))
|
||||
return pAddress;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#ifdef _WIN64
|
||||
PVOID FindPattern(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lpMask);
|
||||
#endif
|
||||
|
||||
inline HMODULE LoadGuiModule()
|
||||
{
|
||||
@ -828,8 +806,9 @@ inline HMODULE LoadGuiModule()
|
||||
wcscat_s(epGuiPath, MAX_PATH, _T(APP_RELATIVE_PATH) L"\\ep_gui.dll");
|
||||
return LoadLibraryExW(epGuiPath, NULL, LOAD_LIBRARY_AS_DATAFILE);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user