Hope somebody can help me with this. I think its an easy one.
I want to hook RegSetValueExW so I wrote this code:
Code: Select all
//"Next" function definition:
LONG (WINAPI *RegSetValueExWNext)(HKEY hKey, LPCWSTR lpValueName, DWORD Reserved, DWORD dwType, const BYTE *lpData, DWORD cbData);
//Callback function:
LONG WINAPI RegSetValueExWCallback(HKEY hKey, LPCWSTR lpValueName, DWORD Reserved, DWORD dwType, const BYTE *lpData, DWORD cbData){
if( lpValueName != NULL && _wcsicmp(L"TWAMSvrAutoRun", lpValueName) == 0)
return ERROR_ACCESS_DENIED;
else
return RegSetValueExWNext(hKey, lpValueName, Reserved, dwType, lpData, cbData);
}
//Hook installation:
HookAPI("Advapi32.dll", "RegSetValueExW", RegSetValueExWCallback, (PVOID*) &RegSetValueExWNext);
Am I doing something wrong?
Thanks for any help!