It seems like I'm the only one on the plant (Earth) who is having this problem...
I wrote a very simple method which dynamically loads and executes RegCreateKeyExA and I get the following error from "GetProcAddress(Avapi32,RegCreateKeyExA)"
Error 1150. The specified program requires a newer version of Windows.
The same code works fine on Windows 7, so I went back to WINXP and opened advapi32.dll with notepad, and sure enough, RegCreateKeyExA was there.... what am I missing here :confused:
Here is the method:
UINT
regDyFunc::DyRegCreateKeyEx(HKEY hMainKey,
LPCTSTR lpSubKey,
PHKEY phkResult,
LPDWORD lpdwDisposition )
{
typedef UINT (CALLBACK* REGFUNCCreateKeyEx)(
HKEY,
LPCTSTR,
DWORD,
LPTSTR,
DWORD,
REGSAM,
LPSECURITY_ATTRIBUTES ,
PHKEY,
LPDWORD
);
REGFUNCCreateKeyEx regFuncCreateKeyEx;
long lResult = ERROR_SUCCESS;
if (lpSubKey == NULL)
lResult = ERROR_INVALID_ADDRESS;
if (lResult == ERROR_SUCCESS){
regFuncCreateKeyEx =
(REGFUNCCreateKeyEx)GetProcAddress(
hAvapi32,
(LPCSTR)"RegCreateKeyExA" );
regDyFunc::csLastCall = "GetProcAddress(Avapi32,RegCreateKeyExA)";
lResult = GetLastError();
}
if (lResult == ERROR_SUCCESS)
{
regDyFunc::csLastCall = "RegCreateKeyExA";
lResult = regFuncCreateKeyEx(
hMainKey,
lpSubKey,
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,NULL,
phkResult,
lpdwDisposition);
}
return lResult;
}
And the function to load the library:
bool
regDyFunc::openModules(void)
{
bool bRet = true;
regDyFunc::hAvapi32 = LoadLibrary("Advapi32");
if (regDyFunc::hAvapi32 == NULL){
_tprintf(_T("Unable to load Advapi32\n"));
bRet = false;
}
if (bRet){
regDyFunc::hKtmW32 = LoadLibrary("KtmW32");
if ((regDyFunc::hKtmW32 == NULL) && (regDyFunc::Is_Vista_or_Later())) {
_tprintf(_T("Unable to load KtmW32\n"));
bRet = false;
}
}
return bRet;
}
Thanks in advance