-//
-// Use wine hack to process extened context classes.
-//
-/***********************************************************************
- * is_comctl32_class
- */
-static BOOL is_comctl32_class( const WCHAR *name )
-{
- static const WCHAR classesW[][20] =
- {
- {'C','o','m','b','o','B','o','x','E','x','3','2',0},
- {'m','s','c','t','l','s','_','h','o','t','k','e','y','3','2',0},
- {'m','s','c','t','l','s','_','p','r','o','g','r','e','s','s','3','2',0},
- {'m','s','c','t','l','s','_','s','t','a','t','u','s','b','a','r','3','2',0},
- {'m','s','c','t','l','s','_','t','r','a','c','k','b','a','r','3','2',0},
- {'m','s','c','t','l','s','_','u','p','d','o','w','n','3','2',0},
- {'N','a','t','i','v','e','F','o','n','t','C','t','l',0},
- {'R','e','B','a','r','W','i','n','d','o','w','3','2',0},
- {'S','y','s','A','n','i','m','a','t','e','3','2',0},
- {'S','y','s','D','a','t','e','T','i','m','e','P','i','c','k','3','2',0},
- {'S','y','s','H','e','a','d','e','r','3','2',0},
- {'S','y','s','I','P','A','d','d','r','e','s','s','3','2',0},
- {'S','y','s','L','i','s','t','V','i','e','w','3','2',0},
- {'S','y','s','M','o','n','t','h','C','a','l','3','2',0},
- {'S','y','s','P','a','g','e','r',0},
- {'S','y','s','T','a','b','C','o','n','t','r','o','l','3','2',0},
- {'S','y','s','T','r','e','e','V','i','e','w','3','2',0},
- {'T','o','o','l','b','a','r','W','i','n','d','o','w','3','2',0},
- {'t','o','o','l','t','i','p','s','_','c','l','a','s','s','3','2',0},
- };
-
- int min = 0, max = (sizeof(classesW) / sizeof(classesW[0])) - 1;
-
- while (min <= max)
- {
- int res, pos = (min + max) / 2;
- if (!(res = strcmpiW( name, classesW[pos] ))) return TRUE;
- if (res < 0) max = pos - 1;
- else min = pos + 1;
- }
- return FALSE;
-}
-
-BOOL
-FASTCALL
-VersionRegisterClass(
- PCWSTR pszClass,
- LPCWSTR lpLibFileName,
- HANDLE Contex,
- HMODULE * phLibModule)
-{
- // Should be lpLibFileName.....
- static const WCHAR comctl32W[] = {'c','o','m','c','t','l','3','2','.','d','l','l',0};
- //
- PREGISTERCLASSNAMEW pRegisterClassNameW;
- UNICODE_STRING ClassName;
- WCHAR ClassNameBuf[MAX_PATH] = {0};
- BOOL Ret = FALSE;
- HMODULE hLibModule = NULL;
-
- if (!IS_ATOM(pszClass) && is_comctl32_class( pszClass ))
- {
- _SEH2_TRY
- {
- hLibModule = LoadLibraryW(comctl32W);
- if ( hLibModule )
- {
- if ((pRegisterClassNameW = (void*) GetProcAddress(hLibModule, "RegisterClassNameW")))
- {
- if (IS_ATOM(pszClass))
- {
- ClassName.Buffer = (LPWSTR)&ClassNameBuf;
- ClassName.MaximumLength = sizeof(ClassNameBuf);
- if (!NtUserGetAtomName(LOWORD((DWORD_PTR)pszClass), &ClassName))
- {
- ERR("Error while verifying ATOM\n");
- _SEH2_YIELD(goto Error_Exit);
- }
- pszClass = (PCWSTR)&ClassNameBuf;
- }
- Ret = pRegisterClassNameW(pszClass);
- }
- }
- }
- _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
- {
- }
- _SEH2_END
-
-Error_Exit:
- if ( Ret || !hLibModule )
- {
- if ( phLibModule ) *phLibModule = hLibModule;
- }
- else
- {
- DWORD save_error = GetLastError();
- FreeLibrary(hLibModule);
- SetLastError(save_error);
- }
- TRACE( "%s retrying after loading comctl32\n", debugstr_w(pszClass) );
- return Ret;
- }
- TRACE("NO ComCtl32 Class %S!\n",pszClass);
- return FALSE;
-}
-//
-//
-//
-