handle unimplemented function stubs

nessi at nessi-online.de nessi at nessi-online.de
Mon Dec 3 06:55:59 CST 2007


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




More information about the wine-devel mailing list