mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-12-18 02:16:00 +01:00
Used built-in function for checking HKCU and then HKLM
This commit is contained in:
parent
fff4520ca0
commit
75260bbb32
@ -1102,62 +1102,19 @@ LRESULT CALLBACK OpenStartOnCurentMonitorThreadHook(
|
||||
MSG* msg = (MSG*)lParam;
|
||||
if (GetSystemMetrics(SM_CMONITORS) >= 2 && msg->message == WM_SYSCOMMAND && (msg->wParam & 0xFFF0) == SC_TASKLIST)
|
||||
{
|
||||
BOOL bShouldCheckHKLM = FALSE;
|
||||
HKEY hKey;
|
||||
if (RegOpenKeyEx(
|
||||
HKEY_CURRENT_USER,
|
||||
TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StartPage"),
|
||||
0,
|
||||
KEY_READ,
|
||||
&hKey
|
||||
) != ERROR_SUCCESS)
|
||||
{
|
||||
bShouldCheckHKLM = TRUE;
|
||||
}
|
||||
DWORD dwStatus = 0;
|
||||
DWORD dwSize = sizeof(DWORD);
|
||||
if (RegGetValue(
|
||||
hKey,
|
||||
NULL,
|
||||
TEXT("MonitorOverride"),
|
||||
RRF_RT_REG_DWORD,
|
||||
NULL,
|
||||
&dwStatus,
|
||||
(LPDWORD)(&dwSize)
|
||||
) != ERROR_SUCCESS)
|
||||
{
|
||||
bShouldCheckHKLM = TRUE;
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
if (bShouldCheckHKLM)
|
||||
{
|
||||
if (RegOpenKeyEx(
|
||||
HKEY_LOCAL_MACHINE,
|
||||
HMODULE hModule = GetModuleHandle(TEXT("Shlwapi"));
|
||||
FARPROC SHRegGetValueFromHKCUHKLMFunc = GetProcAddress(hModule, "SHRegGetValueFromHKCUHKLM");
|
||||
LSTATUS x = 0;
|
||||
if (!SHRegGetValueFromHKCUHKLMFunc || SHRegGetValueFromHKCUHKLMFunc(
|
||||
TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StartPage"),
|
||||
0,
|
||||
KEY_READ,
|
||||
&hKey
|
||||
) != ERROR_SUCCESS)
|
||||
{
|
||||
goto finish;
|
||||
}
|
||||
dwStatus = 0;
|
||||
dwSize = sizeof(DWORD);
|
||||
if (RegGetValue(
|
||||
hKey,
|
||||
NULL,
|
||||
TEXT("MonitorOverride"),
|
||||
RRF_RT_REG_DWORD,
|
||||
SRRF_RT_REG_DWORD,
|
||||
NULL,
|
||||
&dwStatus,
|
||||
(LPDWORD)(&dwSize)
|
||||
) != ERROR_SUCCESS)
|
||||
{
|
||||
goto finish;
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
if (dwStatus == 1)
|
||||
) != ERROR_SUCCESS || dwStatus == 1)
|
||||
{
|
||||
goto finish;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user