mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 22:36:23 +00:00
[CTFMON] Unlink RegNotifyChangeKeyValue (#6232)
Dynamic load advapi32!RegNotifyChangeKeyValue function. Output log if RegNotifyChangeKeyValue failed. CORE-19362
This commit is contained in:
parent
69a925cae8
commit
4293704ecb
1 changed files with 34 additions and 5 deletions
|
@ -83,6 +83,31 @@ CRegWatcher::Uninit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// advapi32!RegNotifyChangeKeyValue
|
||||||
|
typedef LONG (WINAPI *FN_RegNotifyChangeKeyValue)(HKEY, BOOL, DWORD, HANDLE, BOOL);
|
||||||
|
|
||||||
|
LONG WINAPI
|
||||||
|
DelayedRegNotifyChangeKeyValue(
|
||||||
|
HKEY hKey,
|
||||||
|
BOOL bWatchSubtree,
|
||||||
|
DWORD dwNotifyFilter,
|
||||||
|
HANDLE hEvent,
|
||||||
|
BOOL fAsynchronous)
|
||||||
|
{
|
||||||
|
static FN_RegNotifyChangeKeyValue s_fnRegNotifyChangeKeyValue = NULL;
|
||||||
|
|
||||||
|
if (!s_fnRegNotifyChangeKeyValue)
|
||||||
|
{
|
||||||
|
HINSTANCE hAdvApi32 = cicGetSystemModuleHandle(TEXT("advapi32.dll"), FALSE);
|
||||||
|
s_fnRegNotifyChangeKeyValue =
|
||||||
|
(FN_RegNotifyChangeKeyValue)GetProcAddress(hAdvApi32, "RegNotifyChangeKeyValue");
|
||||||
|
if (!s_fnRegNotifyChangeKeyValue)
|
||||||
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return s_fnRegNotifyChangeKeyValue(hKey, bWatchSubtree, dwNotifyFilter, hEvent, fAsynchronous);
|
||||||
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
CRegWatcher::InitEvent(
|
CRegWatcher::InitEvent(
|
||||||
_In_ SIZE_T iEvent,
|
_In_ SIZE_T iEvent,
|
||||||
|
@ -112,11 +137,15 @@ CRegWatcher::InitEvent(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start registry watching
|
// Start registry watching
|
||||||
error = ::RegNotifyChangeKeyValue(entry.hKey,
|
error = DelayedRegNotifyChangeKeyValue(entry.hKey,
|
||||||
TRUE,
|
TRUE,
|
||||||
REG_NOTIFY_CHANGE_LAST_SET | REG_NOTIFY_CHANGE_NAME,
|
REG_NOTIFY_CHANGE_LAST_SET | REG_NOTIFY_CHANGE_NAME,
|
||||||
s_ahWatchEvents[iEvent],
|
s_ahWatchEvents[iEvent],
|
||||||
TRUE);
|
TRUE);
|
||||||
|
#ifndef NDEBUG
|
||||||
|
if (error != ERROR_SUCCESS)
|
||||||
|
OutputDebugStringA("RegNotifyChangeKeyValue failed\n");
|
||||||
|
#endif
|
||||||
return error == ERROR_SUCCESS;
|
return error == ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue