Made all the RegisterClass and GetClassInfo variants call the

corresponding Ex function.
This commit is contained in:
Alexandre Julliard 2003-12-10 01:46:52 +00:00
parent ebf1243ec1
commit 5f32566530
1 changed files with 88 additions and 182 deletions

View File

@ -532,40 +532,21 @@ void CLASS_RemoveWindow( CLASS *cls )
*/ */
ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc ) ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc )
{ {
ATOM atom; WNDCLASSEX16 wcex;
CLASS *classPtr;
int iSmIconWidth, iSmIconHeight;
HINSTANCE hInstance = HINSTANCE_32(GetExePtr(wc->hInstance));
if (!(atom = GlobalAddAtomA( MapSL(wc->lpszClassName) ))) return 0; wcex.cbSize = sizeof(wcex);
if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, wcex.style = wc->style;
wc->cbClsExtra, wc->cbWndExtra ))) wcex.lpfnWndProc = wc->lpfnWndProc;
{ wcex.cbClsExtra = wc->cbClsExtra;
GlobalDeleteAtom( atom ); wcex.cbWndExtra = wc->cbWndExtra;
return 0; wcex.hInstance = wc->hInstance;
} wcex.hIcon = wc->hIcon;
wcex.hCursor = wc->hCursor;
TRACE("atom=%04x wndproc=%08lx hinst=%p bg=%04x style=%08x clsExt=%d winExt=%d class=%p name='%s'\n", wcex.hbrBackground = wc->hbrBackground;
atom, (DWORD)wc->lpfnWndProc, hInstance, wcex.lpszMenuName = wc->lpszMenuName;
wc->hbrBackground, wc->style, wc->cbClsExtra, wcex.lpszClassName = wc->lpszClassName;
wc->cbWndExtra, classPtr, wcex.hIconSm = 0;
HIWORD(wc->lpszClassName) ? (char *)MapSL(wc->lpszClassName) : "" ); return RegisterClassEx16( &wcex );
iSmIconWidth = GetSystemMetrics(SM_CXSMICON);
iSmIconHeight = GetSystemMetrics(SM_CYSMICON);
classPtr->hIcon = HICON_32(wc->hIcon);
classPtr->hIconSm = CopyImage(classPtr->hIcon, IMAGE_ICON,
iSmIconWidth, iSmIconHeight,
LR_COPYFROMRESOURCE);
classPtr->hCursor = HCURSOR_32(wc->hCursor);
classPtr->hbrBackground = HBRUSH_32(wc->hbrBackground);
WINPROC_SetProc( &classPtr->winprocA, (WNDPROC)wc->lpfnWndProc,
WIN_PROC_16, WIN_PROC_CLASS );
CLASS_SetMenuNameA( classPtr, MapSL(wc->lpszMenuName) );
return atom;
} }
@ -577,39 +558,21 @@ ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc )
*/ */
ATOM WINAPI RegisterClassA( const WNDCLASSA* wc ) /* [in] Address of structure with class data */ ATOM WINAPI RegisterClassA( const WNDCLASSA* wc ) /* [in] Address of structure with class data */
{ {
ATOM atom; WNDCLASSEXA wcex;
int iSmIconWidth, iSmIconHeight;
CLASS *classPtr;
if (!(atom = GlobalAddAtomA( wc->lpszClassName ))) return 0; wcex.cbSize = sizeof(wcex);
wcex.style = wc->style;
if (!(classPtr = CLASS_RegisterClass( atom, wc->hInstance, wc->style, wcex.lpfnWndProc = wc->lpfnWndProc;
wc->cbClsExtra, wc->cbWndExtra ))) wcex.cbClsExtra = wc->cbClsExtra;
{ wcex.cbWndExtra = wc->cbWndExtra;
GlobalDeleteAtom( atom ); wcex.hInstance = wc->hInstance;
return 0; wcex.hIcon = wc->hIcon;
} wcex.hCursor = wc->hCursor;
wcex.hbrBackground = wc->hbrBackground;
TRACE("atom=%04x wndproc=%p hinst=%p bg=%p style=%08x clsExt=%d winExt=%d class=%p name='%s'\n", wcex.lpszMenuName = wc->lpszMenuName;
atom, wc->lpfnWndProc, wc->hInstance, wcex.lpszClassName = wc->lpszClassName;
wc->hbrBackground, wc->style, wc->cbClsExtra, wcex.hIconSm = 0;
wc->cbWndExtra, classPtr, return RegisterClassExA( &wcex );
HIWORD(wc->lpszClassName) ? wc->lpszClassName : "" );
iSmIconWidth = GetSystemMetrics(SM_CXSMICON);
iSmIconHeight = GetSystemMetrics(SM_CYSMICON);
classPtr->hIcon = wc->hIcon;
classPtr->hIconSm = CopyImage(wc->hIcon, IMAGE_ICON,
iSmIconWidth, iSmIconHeight,
LR_COPYFROMRESOURCE);
classPtr->hCursor = wc->hCursor;
classPtr->hbrBackground = wc->hbrBackground;
WINPROC_SetProc( &classPtr->winprocA, wc->lpfnWndProc,
WIN_PROC_32A, WIN_PROC_CLASS );
CLASS_SetMenuNameA( classPtr, wc->lpszMenuName );
return atom;
} }
@ -618,38 +581,21 @@ ATOM WINAPI RegisterClassA( const WNDCLASSA* wc ) /* [in] Address of structure w
*/ */
ATOM WINAPI RegisterClassW( const WNDCLASSW* wc ) ATOM WINAPI RegisterClassW( const WNDCLASSW* wc )
{ {
ATOM atom; WNDCLASSEXW wcex;
int iSmIconWidth, iSmIconHeight;
CLASS *classPtr;
if (!(atom = GlobalAddAtomW( wc->lpszClassName ))) return 0; wcex.cbSize = sizeof(wcex);
wcex.style = wc->style;
if (!(classPtr = CLASS_RegisterClass( atom, wc->hInstance, wc->style, wcex.lpfnWndProc = wc->lpfnWndProc;
wc->cbClsExtra, wc->cbWndExtra ))) wcex.cbClsExtra = wc->cbClsExtra;
{ wcex.cbWndExtra = wc->cbWndExtra;
GlobalDeleteAtom( atom ); wcex.hInstance = wc->hInstance;
return 0; wcex.hIcon = wc->hIcon;
} wcex.hCursor = wc->hCursor;
wcex.hbrBackground = wc->hbrBackground;
TRACE("atom=%04x wndproc=%p hinst=%p bg=%p style=%08x clsExt=%d winExt=%d class=%p\n", wcex.lpszMenuName = wc->lpszMenuName;
atom, wc->lpfnWndProc, wc->hInstance, wcex.lpszClassName = wc->lpszClassName;
wc->hbrBackground, wc->style, wc->cbClsExtra, wcex.hIconSm = 0;
wc->cbWndExtra, classPtr ); return RegisterClassExW( &wcex );
iSmIconWidth = GetSystemMetrics(SM_CXSMICON);
iSmIconHeight = GetSystemMetrics(SM_CYSMICON);
classPtr->hIcon = wc->hIcon;
classPtr->hIconSm = CopyImage(wc->hIcon, IMAGE_ICON,
iSmIconWidth, iSmIconHeight,
LR_COPYFROMRESOURCE);
classPtr->hCursor = wc->hCursor;
classPtr->hbrBackground = wc->hbrBackground;
WINPROC_SetProc( &classPtr->winprocW, wc->lpfnWndProc,
WIN_PROC_32W, WIN_PROC_CLASS );
CLASS_SetMenuNameW( classPtr, wc->lpszMenuName );
return atom;
} }
@ -1125,113 +1071,73 @@ UINT WINAPI RealGetWindowClassW( HWND hwnd, LPWSTR buffer, UINT count )
*/ */
BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInst16, SEGPTR name, WNDCLASS16 *wc ) BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInst16, SEGPTR name, WNDCLASS16 *wc )
{ {
ATOM atom; WNDCLASSEX16 wcex;
CLASS *classPtr; UINT16 ret = GetClassInfoEx16( hInst16, name, &wcex );
HINSTANCE hInstance = HINSTANCE_32(GetExePtr( hInst16 ));
TRACE("%p %s %p\n",hInstance, debugstr_a(MapSL(name)), wc); if (ret)
{
if (!(atom = GlobalFindAtomA( MapSL(name) )) || wc->style = wcex.style;
!(classPtr = CLASS_FindClassByAtom( atom, hInstance ))) wc->lpfnWndProc = wcex.lpfnWndProc;
return FALSE; wc->cbClsExtra = wcex.cbClsExtra;
if ((hInstance != classPtr->hInstance) && wc->cbWndExtra = wcex.cbWndExtra;
!(classPtr->style & CS_GLOBALCLASS)) /*BWCC likes to pass hInstance=0*/ wc->hInstance = wcex.hInstance;
return FALSE; wc->hIcon = wcex.hIcon;
wc->style = (UINT16)classPtr->style; wc->hCursor = wcex.hCursor;
wc->lpfnWndProc = CLASS_GetProc( classPtr, WIN_PROC_16 ); wc->hbrBackground = wcex.hbrBackground;
wc->cbClsExtra = (INT16)classPtr->cbClsExtra; wc->lpszMenuName = wcex.lpszMenuName;
wc->cbWndExtra = (INT16)classPtr->cbWndExtra; wc->lpszClassName = wcex.lpszClassName;
wc->hInstance = classPtr->style & CS_GLOBALCLASS ? GetModuleHandle16("USER") : HINSTANCE_16(classPtr->hInstance); }
wc->hIcon = HICON_16(classPtr->hIcon); return ret;
wc->hCursor = HCURSOR_16(classPtr->hCursor);
wc->hbrBackground = HBRUSH_16(classPtr->hbrBackground);
wc->lpszClassName = name;
wc->lpszMenuName = CLASS_GetMenuName16( classPtr );
/* We must return the atom of the class here instead of just TRUE. */
return atom;
} }
/*********************************************************************** /***********************************************************************
* GetClassInfoA (USER32.@) * GetClassInfoA (USER32.@)
*/ */
BOOL WINAPI GetClassInfoA( HINSTANCE hInstance, LPCSTR name, BOOL WINAPI GetClassInfoA( HINSTANCE hInstance, LPCSTR name, WNDCLASSA *wc )
WNDCLASSA *wc )
{ {
ATOM atom; WNDCLASSEXA wcex;
CLASS *classPtr; UINT ret = GetClassInfoExA( hInstance, name, &wcex );
TRACE("%p %p %p\n",hInstance, name, wc); if (ret)
/* workaround: if hInstance=NULL you expect to get the system classes
but this classes (as example from comctl32.dll SysListView) won't be
registered with hInstance=NULL in WINE because of the late loading
of this dll. fixes file dialogs in WinWord95 (jsch)*/
if (!(atom=GlobalFindAtomA(name)) || !(classPtr=CLASS_FindClassByAtom(atom,hInstance)))
return FALSE;
if (!(classPtr->style & CS_GLOBALCLASS) &&
classPtr->hInstance &&
(hInstance != classPtr->hInstance))
{ {
if (hInstance) return FALSE; wc->style = wcex.style;
WARN("systemclass %s (hInst=0) demanded but only class with hInst!=0 found\n",name); wc->lpfnWndProc = wcex.lpfnWndProc;
wc->cbClsExtra = wcex.cbClsExtra;
wc->cbWndExtra = wcex.cbWndExtra;
wc->hInstance = wcex.hInstance;
wc->hIcon = wcex.hIcon;
wc->hCursor = wcex.hCursor;
wc->hbrBackground = wcex.hbrBackground;
wc->lpszMenuName = wcex.lpszMenuName;
wc->lpszClassName = wcex.lpszClassName;
} }
return ret;
wc->style = classPtr->style;
wc->lpfnWndProc = (WNDPROC)CLASS_GetProc( classPtr, WIN_PROC_32A );
wc->cbClsExtra = classPtr->cbClsExtra;
wc->cbWndExtra = classPtr->cbWndExtra;
wc->hInstance = hInstance;
wc->hIcon = (HICON)classPtr->hIcon;
wc->hCursor = (HCURSOR)classPtr->hCursor;
wc->hbrBackground = (HBRUSH)classPtr->hbrBackground;
wc->lpszMenuName = CLASS_GetMenuNameA( classPtr );
wc->lpszClassName = name;
/* We must return the atom of the class here instead of just TRUE. */
return atom;
} }
/*********************************************************************** /***********************************************************************
* GetClassInfoW (USER32.@) * GetClassInfoW (USER32.@)
*/ */
BOOL WINAPI GetClassInfoW( HINSTANCE hInstance, LPCWSTR name, BOOL WINAPI GetClassInfoW( HINSTANCE hInstance, LPCWSTR name, WNDCLASSW *wc )
WNDCLASSW *wc )
{ {
ATOM atom; WNDCLASSEXW wcex;
CLASS *classPtr; UINT ret = GetClassInfoExW( hInstance, name, &wcex );
TRACE("%p %p %p\n",hInstance, name, wc); if (ret)
if ( !(atom=GlobalFindAtomW(name)) ||
!(classPtr=CLASS_FindClassByAtom(atom,hInstance))
)
return FALSE;
if (!(classPtr->style & CS_GLOBALCLASS) &&
classPtr->hInstance &&
(hInstance != classPtr->hInstance))
{ {
if (hInstance) return FALSE; wc->style = wcex.style;
WARN("systemclass %s (hInst=0) demanded but only class with hInst!=0 found\n",debugstr_w(name)); wc->lpfnWndProc = wcex.lpfnWndProc;
wc->cbClsExtra = wcex.cbClsExtra;
wc->cbWndExtra = wcex.cbWndExtra;
wc->hInstance = wcex.hInstance;
wc->hIcon = wcex.hIcon;
wc->hCursor = wcex.hCursor;
wc->hbrBackground = wcex.hbrBackground;
wc->lpszMenuName = wcex.lpszMenuName;
wc->lpszClassName = wcex.lpszClassName;
} }
wc->style = classPtr->style; return ret;
wc->lpfnWndProc = (WNDPROC)CLASS_GetProc( classPtr, WIN_PROC_32W );
wc->cbClsExtra = classPtr->cbClsExtra;
wc->cbWndExtra = classPtr->cbWndExtra;
wc->hInstance = hInstance;
wc->hIcon = (HICON)classPtr->hIcon;
wc->hCursor = (HCURSOR)classPtr->hCursor;
wc->hbrBackground = (HBRUSH)classPtr->hbrBackground;
wc->lpszMenuName = CLASS_GetMenuNameW( classPtr );
wc->lpszClassName = name;
/* We must return the atom of the class here instead of just TRUE. */
return atom;
} }