Hello all,
I'm a Windows software developer and I'm trying to execute an application under the wine environment. Now I have a problem introduced with wine 0.9.49.
I use the function RegOverridePredefKey from the advapi32.dll. To be compatible with older windows versions, I use the following code:
LONG WINAPI (*RegOverridePredefKey)(HKEY hKey, HKEY hNewHKey); HMODULE hMod=GetModuleHandle("Advapi32"); if (hMod) (FARPROC)RegOverridePredefKey=GetProcAddress(hMod,"RegOverridePredefKey"); if (RegOverridePredefKey) RegOverridePredefKey(HKEY_CLASSES_ROOT, hKey);
In wine 0.9.49 a stub entry for this function was created, but the implementation is missing. The result is, that the GetProcAddress function is successful, but the RegOverridePredefKey call fails. I can catch the EXCEPTION_WINE_STUB exception (see code below), but the application will nevertheless closed.
if (RegOverridePredefKey) { long err = ERROR_CALL_NOT_IMPLEMENTED; try { // test for C-based structured exceptions err=RegOverridePredefKey(HKEY_CLASSES_ROOT, hKey); }
#define EXCEPTION_WINE_STUB 0x80000100 __except(GetExceptionCode()==EXCEPTION_WINE_STUB ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { RegOverridePredefKey=NULL; } }
What can I do ? I know, that I can find a workaround for this case, but this in not my problem. How can I handle, in principle, such exceptions? What is the reason for creating a function stub without an implementation ???
Thanks Nessi
Am Montag, 3. Dezember 2007 13:55:59 schrieb nessi@nessi-online.de:
The reason is often that there is an application that tries to load the function, but never calls it. It refuses to start without getting a pointer to this unused function. Or an application that refuses to run if it doesn't like the exports from a DLL. For example, copy protection systems might check the exports, and refuse if your DLL has different exports than Windows.
The @stub stubs are pretty rare nowadays, for exactly the reason you give. Usual stubs have a real implementation function which just returns an error or OK and writes a note to the FIXME channel.
The stub in question was added by patch 27e8b829a4cc56969836c0dbbb4db4b775d52a9f, which was intended to fix bug #9116.
To answer your question what to do, the usual way to fix this is to implement the function in Wine. I understand that this is most likely not a suitable solution for you, after all you're working on your application, not Wine. I do not know advapi32, so I cannot implement this function myself, but if no one steps up in the next days I can send a small patch that just adds a nicer stub that doesn't crash.