mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-11-28 01:10:55 +01:00
Corrected registry access calls
This commit is contained in:
parent
958a9a6b20
commit
061f85f402
@ -629,6 +629,10 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
|
||||
&hKey,
|
||||
&dwDisposition
|
||||
);
|
||||
if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
hKey = NULL;
|
||||
}
|
||||
RegQueryValueExW(
|
||||
hKey,
|
||||
name,
|
||||
@ -651,6 +655,10 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
|
||||
KEY_READ | (hDC ? 0 : KEY_WRITE),
|
||||
&hKey
|
||||
);
|
||||
if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
hKey = NULL;
|
||||
}
|
||||
value = hKey;
|
||||
}
|
||||
if (bInvert || bBool || bJustCheck)
|
||||
@ -744,6 +752,10 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
|
||||
&hKey,
|
||||
&dwDisposition
|
||||
);
|
||||
if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
hKey = NULL;
|
||||
}
|
||||
if (d[1] == '"')
|
||||
{
|
||||
wchar_t* p = wcschr(d + 2, L'"');
|
||||
@ -1173,6 +1185,10 @@ __declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLin
|
||||
&hKey,
|
||||
&dwDisposition
|
||||
);
|
||||
if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
hKey = NULL;
|
||||
}
|
||||
DWORD bAllocConsole = FALSE;
|
||||
RegQueryValueExW(
|
||||
hKey,
|
||||
|
@ -55,11 +55,20 @@ DWORD MonitorSettingsChanges(SettingsChangeParameters* params)
|
||||
KEY_READ,
|
||||
&hKeyCU
|
||||
);
|
||||
if (hKeyCU == NULL || hKeyCU == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
hKeyCU = NULL;
|
||||
}
|
||||
if (lRes != ERROR_SUCCESS)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
HANDLE hEvHKCU = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
if (hEvHKCU == NULL || hEvHKCU == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
hEvHKCU = NULL;
|
||||
return 0;
|
||||
}
|
||||
RegNotifyChangeKeyValue(
|
||||
hKeyCU,
|
||||
FALSE,
|
||||
@ -75,11 +84,20 @@ DWORD MonitorSettingsChanges(SettingsChangeParameters* params)
|
||||
KEY_READ,
|
||||
&hKeyLM
|
||||
);
|
||||
if (hKeyLM == NULL || hKeyLM == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
hKeyLM = NULL;
|
||||
}
|
||||
if (lRes != ERROR_SUCCESS)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
HANDLE hEvHKLM = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
if (hEvHKLM == NULL || hEvHKLM == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
hEvHKLM = NULL;
|
||||
return 0;
|
||||
}
|
||||
RegNotifyChangeKeyValue(
|
||||
hKeyLM,
|
||||
FALSE,
|
||||
@ -309,10 +327,10 @@ DWORD MonitorSettingsChanges(SettingsChangeParameters* params)
|
||||
}
|
||||
}
|
||||
|
||||
CloseHandle(hEvHKCU);
|
||||
CloseHandle(hEvHKLM);
|
||||
RegCloseKey(hKeyCU);
|
||||
RegCloseKey(hKeyLM);
|
||||
if (hEvHKCU) CloseHandle(hEvHKCU);
|
||||
if (hEvHKLM) CloseHandle(hEvHKLM);
|
||||
if (hKeyCU) RegCloseKey(hKeyCU);
|
||||
if (hKeyLM) RegCloseKey(hKeyLM);
|
||||
}
|
||||
}
|
||||
}
|
@ -1356,7 +1356,8 @@ __declspec(dllexport) DWORD WINAPI main(
|
||||
{
|
||||
funchook = funchook_create();
|
||||
printf("funchook create %d\n", funchook != 0);
|
||||
HKEY hKey;
|
||||
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwDisposition;
|
||||
DWORD dwSize = sizeof(DWORD);
|
||||
|
||||
@ -1373,6 +1374,10 @@ __declspec(dllexport) DWORD WINAPI main(
|
||||
&hKey,
|
||||
&dwDisposition
|
||||
);
|
||||
if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
hKey = NULL;
|
||||
}
|
||||
DWORD bAllocConsole = FALSE;
|
||||
RegQueryValueExW(
|
||||
hKey,
|
||||
@ -1760,6 +1765,12 @@ __declspec(dllexport) DWORD WINAPI main(
|
||||
{
|
||||
printf("Failed to register taskbar update notification.\n");
|
||||
}
|
||||
|
||||
|
||||
if (hKey)
|
||||
{
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ L"</toast>\r\n";
|
||||
|
||||
DWORD DownloadSymbols(DownloadSymbolsParams* params)
|
||||
{
|
||||
HKEY hKey;
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwDisposition;
|
||||
|
||||
HMODULE hModule = params->hModule;
|
||||
@ -224,7 +224,7 @@ DWORD DownloadSymbols(DownloadSymbolsParams* params)
|
||||
&hKey,
|
||||
&dwDisposition
|
||||
);
|
||||
if (!hKey)
|
||||
if (!hKey || hKey == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
FreeLibraryAndExitThread(
|
||||
hModule,
|
||||
@ -296,7 +296,7 @@ DWORD DownloadSymbols(DownloadSymbolsParams* params)
|
||||
&(symbols_PTRS.twinui_pcshell_PTRS[7]),
|
||||
sizeof(DWORD)
|
||||
);
|
||||
RegCloseKey(hKey);
|
||||
if (hKey) RegCloseKey(hKey);
|
||||
|
||||
|
||||
|
||||
@ -364,7 +364,7 @@ DWORD DownloadSymbols(DownloadSymbolsParams* params)
|
||||
&hKey,
|
||||
&dwDisposition
|
||||
);
|
||||
if (!hKey)
|
||||
if (!hKey || hKey == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
FreeLibraryAndExitThread(
|
||||
hModule,
|
||||
@ -412,7 +412,7 @@ DWORD DownloadSymbols(DownloadSymbolsParams* params)
|
||||
&(symbols_PTRS.startdocked_PTRS[4]),
|
||||
sizeof(DWORD)
|
||||
);
|
||||
RegCloseKey(hKey);
|
||||
if (hKey) RegCloseKey(hKey);
|
||||
|
||||
|
||||
|
||||
@ -430,7 +430,7 @@ DWORD DownloadSymbols(DownloadSymbolsParams* params)
|
||||
&hKey,
|
||||
&dwDisposition
|
||||
);
|
||||
if (!hKey)
|
||||
if (!hKey || hKey == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
FreeLibraryAndExitThread(
|
||||
hModule,
|
||||
@ -446,7 +446,7 @@ DWORD DownloadSymbols(DownloadSymbolsParams* params)
|
||||
szReportedVersion,
|
||||
wcslen(szReportedVersion) * sizeof(TCHAR)
|
||||
);
|
||||
RegCloseKey(hKey);
|
||||
if (hKey) RegCloseKey(hKey);
|
||||
|
||||
|
||||
if (symbols_PTRS.twinui_pcshell_PTRS[0])
|
||||
@ -503,9 +503,9 @@ DWORD DownloadSymbols(DownloadSymbolsParams* params)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
BOOL LoadSymbols(symbols_addr* symbols_PTRS)
|
||||
BOOL LoadSymbols(symbols_addr* symbols_PTRS, HMODULE hModule)
|
||||
{
|
||||
HKEY hKey;
|
||||
HKEY hKey = NULL;
|
||||
DWORD dwDisposition;
|
||||
DWORD dwSize = sizeof(DWORD);
|
||||
|
||||
@ -520,6 +520,14 @@ BOOL LoadSymbols(symbols_addr* symbols_PTRS)
|
||||
&hKey,
|
||||
&dwDisposition
|
||||
);
|
||||
if (!hKey || hKey == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
FreeLibraryAndExitThread(
|
||||
hModule,
|
||||
1
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
RegQueryValueExW(
|
||||
hKey,
|
||||
TEXT(TWINUI_PCSHELL_SB_0),
|
||||
@ -637,7 +645,7 @@ BOOL LoadSymbols(symbols_addr* symbols_PTRS)
|
||||
&(symbols_PTRS->startdocked_PTRS[4]),
|
||||
&dwSize
|
||||
);
|
||||
RegCloseKey(hKey);
|
||||
if (hKey) RegCloseKey(hKey);
|
||||
|
||||
BOOL bNeedToDownload = FALSE;
|
||||
for (UINT i = 0; i < sizeof(symbols_addr) / sizeof(DWORD); ++i)
|
||||
|
Loading…
Reference in New Issue
Block a user