Author: weiden
Date: Fri Jul 27 23:23:22 2007
New Revision: 27935
URL:
http://svn.reactos.org/svn/reactos?rev=27935&view=rev
Log:
- Search for user32 window classes before searching for system classes
- Register the user32 base address with win32k. Technically this is not really neccessary
because user32's base address is fixed
Modified:
trunk/reactos/dll/win32/user32/include/user32p.h
trunk/reactos/dll/win32/user32/misc/dllmain.c
trunk/reactos/include/reactos/win32k/ntuser.h
trunk/reactos/subsystems/win32/win32k/ntuser/class.c
trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
Modified: trunk/reactos/dll/win32/user32/include/user32p.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/u…
==============================================================================
--- trunk/reactos/dll/win32/user32/include/user32p.h (original)
+++ trunk/reactos/dll/win32/user32/include/user32p.h Fri Jul 27 23:23:22 2007
@@ -75,6 +75,9 @@
#define NtUserSetCaretBlinkTime(uMSeconds) \
(BOOL)NtUserCallOneParam((DWORD)uMSeconds, ONEPARAM_ROUTINE_SETCARETBLINKTIME)
+
+#define NtUserRegisterUserModule(hInstance) \
+ (BOOL)NtUserCallOneParam((DWORD)hInstance, ONEPARAM_ROUTINE_REGISTERUSERMODULE)
/*
#define NtUserEnumClipboardFormats(format) \
Modified: trunk/reactos/dll/win32/user32/misc/dllmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/dllm…
==============================================================================
--- trunk/reactos/dll/win32/user32/misc/dllmain.c (original)
+++ trunk/reactos/dll/win32/user32/misc/dllmain.c Fri Jul 27 23:23:22 2007
@@ -93,6 +93,9 @@
{
case DLL_PROCESS_ATTACH:
User32Instance = hInstanceDll;
+ if (!NtUserRegisterUserModule(hInstanceDll))
+ return FALSE;
+
hProcessHeap = RtlGetProcessHeap();
if (!Init())
return FALSE;
Modified: trunk/reactos/include/reactos/win32k/ntuser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
==============================================================================
--- trunk/reactos/include/reactos/win32k/ntuser.h (original)
+++ trunk/reactos/include/reactos/win32k/ntuser.h Fri Jul 27 23:23:22 2007
@@ -60,6 +60,7 @@
typedef struct _W32PROCESSINFO
{
PVOID UserHandleTable;
+ HINSTANCE hModUser;
PWINDOWCLASS LocalClassList;
PWINDOWCLASS GlobalClassList;
PWINDOWCLASS SystemClassList;
@@ -458,7 +459,8 @@
#define ONEPARAM_ROUTINE_MSQSETWAKEMASK 0x27
#define ONEPARAM_ROUTINE_GETKEYBOARDTYPE 0x28
#define ONEPARAM_ROUTINE_GETKEYBOARDLAYOUT 0x29
-#define ONEPARAM_ROUTINE_SHOWCURSOR 0x30
+#define ONEPARAM_ROUTINE_SHOWCURSOR 0x30
+#define ONEPARAM_ROUTINE_REGISTERUSERMODULE 0x31
DWORD
NTAPI
NtUserCallOneParam(
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/class.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/class.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/class.c Fri Jul 27 23:23:22 2007
@@ -592,7 +592,7 @@
while (*PrevLink != BaseClass)
{
- ASSERT(BaseClass != NULL);
+ ASSERT(*PrevLink != NULL);
PrevLink = &BaseClass->Next;
}
@@ -1112,7 +1112,27 @@
goto FoundClass;
}
- /* Step 3: try to find a system class */
+ /* Step 3: try to find any local class registered by user32 */
+ Class = IntFindClass(Atom,
+ pi->hModUser,
+ &pi->LocalClassList,
+ Link);
+ if (Class != NULL)
+ {
+ goto FoundClass;
+ }
+
+ /* Step 4: try to find any global class registered by user32 */
+ Class = IntFindClass(Atom,
+ pi->hModUser,
+ &pi->GlobalClassList,
+ Link);
+ if (Class != NULL)
+ {
+ goto FoundClass;
+ }
+
+ /* Step 5: try to find a system class */
Class = IntFindClass(Atom,
NULL,
&pi->SystemClassList,
@@ -1771,10 +1791,13 @@
IN BOOL Ansi,
HINSTANCE hInstance)
{
+ PW32PROCESSINFO pi;
+
lpwcx->style = Class->Style;
+ pi = GetW32ProcessInfo();
lpwcx->lpfnWndProc = IntGetClassWndProc(Class,
- GetW32ProcessInfo(),
+ pi,
Ansi,
FALSE);
@@ -1789,9 +1812,7 @@
else
lpwcx->lpszMenuName = Class->MenuName;
- if (hInstance)
- lpwcx->hInstance = hInstance;
- else if (Class->Global)
+ if (Class->hInstance == pi->hModUser)
lpwcx->hInstance = NULL;
else
lpwcx->hInstance = Class->hInstance;
@@ -2119,7 +2140,7 @@
/* probe the paramters */
CapturedClassName = ProbeForReadUnicodeString(ClassName);
- if (IS_ATOM(CapturedClassName.Buffer))
+ if (CapturedClassName.Length == 0)
TRACE("hInst %p atom %04X lpWndClassEx %p Ansi %d\n", hInstance,
CapturedClassName.Buffer, lpWndClassEx, Ansi);
else
TRACE("hInst %p class %wZ lpWndClassEx %p Ansi %d\n", hInstance,
&CapturedClassName, lpWndClassEx, Ansi);
@@ -2162,6 +2183,9 @@
NULL);
if (ClassAtom != (RTL_ATOM)0)
{
+ if (hInstance == NULL)
+ hInstance = pi->hModUser;
+
Ret = UserGetClassInfo(Class,
lpWndClassEx,
Ansi,
@@ -2186,7 +2210,10 @@
if (!(Class->Global || Class->System) && hInstance ==
NULL)
{
- WARN("Tried to get information of a non-existing
class\n");
+ if (CapturedClassName.Length == 0)
+ WARN("Tried to get information of a non-existing class atom
0x%p\n", CapturedClassName.Buffer);
+ else
+ WARN("Tried to get information of a non-existing class
\"%wZ\"\n", &CapturedClassName);
SetLastWin32Error(ERROR_CLASS_DOES_NOT_EXIST);
Ret = FALSE;
}
@@ -2194,7 +2221,10 @@
}
else
{
- WARN("Tried to get information of a non-existing class\n");
+ if (CapturedClassName.Length == 0)
+ WARN("Tried to get information of a non-existing class atom
0x%p\n", CapturedClassName.Buffer);
+ else
+ WARN("Tried to get information of a non-existing class
\"%wZ\"\n", &CapturedClassName);
SetLastWin32Error(ERROR_CLASS_DOES_NOT_EXIST);
}
}
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/misc.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/misc.c Fri Jul 27 23:23:22 2007
@@ -407,6 +407,26 @@
case ONEPARAM_ROUTINE_GETKEYBOARDLAYOUT:
RETURN( (DWORD)UserGetKeyboardLayout(Param));
+
+ case ONEPARAM_ROUTINE_REGISTERUSERMODULE:
+ {
+ PW32THREADINFO ti;
+
+ ti = GetW32ThreadInfo();
+ if (ti == NULL)
+ {
+ DPRINT1("Cannot register user32 module instance!\n");
+ SetLastWin32Error(ERROR_INVALID_PARAMETER);
+ RETURN(FALSE);
+ }
+
+ if (InterlockedCompareExchangePointer(&ti->kpi->hModUser,
+ (HINSTANCE)Param,
+ NULL) == NULL)
+ {
+ RETURN(TRUE);
+ }
+ }
}
DPRINT1("Calling invalid routine number 0x%x in NtUserCallOneParam(),
Param=0x%x\n",
Routine, Param);