Author: fireball
Date: Sat Aug 12 01:24:11 2006
New Revision: 23545
URL:
http://svn.reactos.org/svn/reactos?rev=23545&view=rev
Log:
- Remove non-needed checks from GetClassInfoA/W, because they are performed in
GetClassInfoExA/W or not performed in Windows at all
- So now GetClassInfoA/W implementations are correct and all hacks are moved to
GetClassInfoExA/W. This doesn't fix Abiword, but might fix direct calls to
GetClassInfoExA/W which might fail due to not set "cbSize" member of WNDCLASS
struct.
I marked this as HACKHACK for further investigation and removal.
Modified:
trunk/reactos/dll/win32/user32/windows/class.c
Modified: trunk/reactos/dll/win32/user32/windows/class.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/c…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/class.c (original)
+++ trunk/reactos/dll/win32/user32/windows/class.c Sat Aug 12 01:24:11 2006
@@ -21,17 +21,25 @@
BOOL
STDCALL
GetClassInfoExA(
- HINSTANCE hinst,
+ HINSTANCE hInstance,
LPCSTR lpszClass,
LPWNDCLASSEXA lpwcx)
{
UNICODE_STRING ClassName = {0};
BOOL Ret;
- TRACE("%p class/atom: %s/%04x %p\n", hinst,
+ TRACE("%p class/atom: %s/%04x %p\n", hInstance,
IS_ATOM(lpszClass) ? NULL : lpszClass,
IS_ATOM(lpszClass) ? lpszClass : 0,
lpwcx);
+
+ //HACKHACK: This is ROS-specific and should go away
+ lpwcx->cbSize = sizeof(*lpwcx);
+
+ if (hInstance == User32Instance)
+ {
+ hInstance = NULL;
+ }
if (lpszClass == NULL)
{
@@ -59,7 +67,7 @@
ControlsInitialized = ControlsInit(ClassName.Buffer);
}
- Ret = NtUserGetClassInfo(hinst,
+ Ret = NtUserGetClassInfo(hInstance,
&ClassName,
(LPWNDCLASSEXW)lpwcx,
TRUE);
@@ -79,17 +87,25 @@
BOOL
STDCALL
GetClassInfoExW(
- HINSTANCE hinst,
+ HINSTANCE hInstance,
LPCWSTR lpszClass,
LPWNDCLASSEXW lpwcx)
{
UNICODE_STRING ClassName = {0};
- TRACE("%p class/atom: %S/%04x %p\n", hinst,
+ TRACE("%p class/atom: %S/%04x %p\n", hInstance,
IS_ATOM(lpszClass) ? NULL : lpszClass,
IS_ATOM(lpszClass) ? lpszClass : 0,
lpwcx);
+ //HACKHACK: This is ROS-specific and should go away
+ lpwcx->cbSize = sizeof(*lpwcx);
+
+ if (hInstance == User32Instance)
+ {
+ hInstance = NULL;
+ }
+
if (lpszClass == NULL)
{
SetLastError(ERROR_INVALID_PARAMETER);
@@ -112,7 +128,7 @@
ControlsInitialized = ControlsInit(ClassName.Buffer);
}
- return NtUserGetClassInfo(hinst,
+ return NtUserGetClassInfo(hInstance,
&ClassName,
lpwcx,
FALSE);
@@ -129,27 +145,25 @@
LPCSTR lpClassName,
LPWNDCLASSA lpWndClass)
{
- WNDCLASSEXA w;
- BOOL retval;
-
- if ( !lpClassName || !lpWndClass )
- {
- SetLastError(ERROR_INVALID_PARAMETER);
- return FALSE;
- }
-
- if ( hInstance == User32Instance )
- {
- hInstance = NULL;
- }
-
- w.cbSize = sizeof(w);
- retval = GetClassInfoExA(hInstance,lpClassName,&w);
- if (retval)
- {
- RtlCopyMemory ( lpWndClass, &w.style, sizeof(WNDCLASSA) );
- }
- return retval;
+ WNDCLASSEXA wcex;
+ BOOL retval;
+
+ retval = GetClassInfoExA(hInstance, lpClassName, &wcex);
+ if (retval)
+ {
+ lpWndClass->style = wcex.style;
+ lpWndClass->lpfnWndProc = wcex.lpfnWndProc;
+ lpWndClass->cbClsExtra = wcex.cbClsExtra;
+ lpWndClass->cbWndExtra = wcex.cbWndExtra;
+ lpWndClass->hInstance = wcex.hInstance;
+ lpWndClass->hIcon = wcex.hIcon;
+ lpWndClass->hCursor = wcex.hCursor;
+ lpWndClass->hbrBackground = wcex.hbrBackground;
+ lpWndClass->lpszMenuName = wcex.lpszMenuName;
+ lpWndClass->lpszClassName = wcex.lpszClassName;
+ }
+
+ return retval;
}
/*
@@ -162,29 +176,25 @@
LPCWSTR lpClassName,
LPWNDCLASSW lpWndClass)
{
- WNDCLASSEXW w;
- BOOL retval;
-
- if(!lpClassName || !lpWndClass)
- {
- SetLastError(ERROR_INVALID_PARAMETER);
- return FALSE;
- }
-
- if ( hInstance == User32Instance )
- {
- hInstance = NULL;
- }
-
- w.cbSize = sizeof(w);
- retval = GetClassInfoExW(hInstance,lpClassName,&w);
- if (retval)
- {
- RtlCopyMemory (lpWndClass,&w.style,sizeof(WNDCLASSW));
- }
- return retval;
-}
-
+ WNDCLASSEXW wcex;
+ BOOL retval;
+
+ retval = GetClassInfoExW(hInstance, lpClassName, &wcex);
+ if (retval)
+ {
+ lpWndClass->style = wcex.style;
+ lpWndClass->lpfnWndProc = wcex.lpfnWndProc;
+ lpWndClass->cbClsExtra = wcex.cbClsExtra;
+ lpWndClass->cbWndExtra = wcex.cbWndExtra;
+ lpWndClass->hInstance = wcex.hInstance;
+ lpWndClass->hIcon = wcex.hIcon;
+ lpWndClass->hCursor = wcex.hCursor;
+ lpWndClass->hbrBackground = wcex.hbrBackground;
+ lpWndClass->lpszMenuName = wcex.lpszMenuName;
+ lpWndClass->lpszClassName = wcex.lpszClassName;
+ }
+ return retval;
+}
/*
* @implemented