I am dynamically loading several registry API's from the library Advapi32.dll. Under Windows XP and Vista everything is OK. Under Windows 7 I keep getting the error The parameter is incorrect and in some cases (like RegCloseKey) my application crashes.
The code I am using is the usual:
// RegCreateKeyEx
typedef LONG (WINAPI *MyRegCreateKeyEx)(HKEY, LPCTSTR, DWORD, LPTSTR, DWORD, REGSAM, LPSECURITY_ATTRIBUTES, PHKEY, LPDWORD);
MyRegCreateKeyEx LoadedRegCreateKeyEx;
then I use LoadLibrary to load Advapi.dll and GetProcAddress to find the address to RegCreateKeyEx. Like:
LoadedRegCreateKeyEx = (MyRegCreateKeyEx)GetProcAddress(LibHandle, "RegCreateKeyEx");
Everything returns OK, there are no errors and the pointers seem to be correct, yet it doesn't work under Windows 7. Any ideas? Did anything change? Is there a different way to do this for Windows 7?
Thank you jess.
EDIT: It seems that this problem extends to all kind of API's on windows 7. Any idea?