Author: fireball Date: Mon Aug 14 01:43:53 2006 New Revision: 23571
URL: http://svn.reactos.org/svn/reactos?rev=23571&view=rev Log: - Change class.c to Wine-style debugging prints, add a bit of TRACEs, WARNs and ERRs (channel-based debugging output would really help a lot...) - Fix IntMapDesktopView() to actually store the created mapping in a global list of mappings. Previously, any operation to map an address from such heap resulted in a NULL. As a side-effect, "user32_winetest.exe class" went from 31 to 27 failures.
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/class.c trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/class.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/class.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/class.c Mon Aug 14 01:43:53 2006 @@ -30,8 +30,8 @@
#include <w32k.h>
-#define NDEBUG -#include <debug.h> +//#define YDEBUG +#include <wine/debug.h>
/* WINDOWCLASS ***************************************************************/
@@ -826,6 +826,9 @@ PWINDOWCLASS Class = NULL; RTL_ATOM Atom; NTSTATUS Status = STATUS_SUCCESS; + + TRACE("lpwcx=%p ClassName=%wZ MenuName=%wZ wpExtra=%p dwFlags=%08x Desktop=%p pi=%p\n", + lpwcx, ClassName, MenuName, wpExtra, dwFlags, Desktop, pi);
if (!IntRegisterClassAtom(ClassName, &Atom)) @@ -2100,12 +2103,19 @@ pi = GetW32ProcessInfo(); if (pi == NULL) { + ERR("GetW32ProcessInfo() returned NULL!\n"); goto Cleanup; } _SEH_TRY { /* probe the paramters */ CapturedClassName = ProbeForReadUnicodeString(ClassName); + + if (IS_ATOM(CapturedClassName.Buffer)) + 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); + if (CapturedClassName.Length & 1) { goto InvalidParameter; @@ -2121,6 +2131,7 @@ { if (!IS_ATOM(CapturedClassName.Buffer)) { + ERR("NtUserGetClassInfo() got ClassName instead of Atom!\n"); goto InvalidParameter; } } @@ -2151,7 +2162,6 @@ if (Ret) { lpWndClassEx->lpszClassName = CapturedClassName.Buffer; - /* FIXME - handle Class->Desktop == NULL!!!!! */
if (Class->MenuName != NULL && @@ -2168,6 +2178,7 @@
if (!(Class->Global || Class->System) && hInstance == NULL) { + WARN("Tried to get information of a non-existing class\n"); SetLastWin32Error(ERROR_CLASS_DOES_NOT_EXIST); Ret = FALSE; } @@ -2175,6 +2186,7 @@ } else { + WARN("Tried to get information of a non-existing class\n"); SetLastWin32Error(ERROR_CLASS_DOES_NOT_EXIST); } }
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c Mon Aug 14 01:43:53 2006 @@ -31,8 +31,8 @@
#include <w32k.h>
-#define NDEBUG -#include <debug.h> +//#define YDEBUG +#include <wine/debug.h>
static VOID @@ -1694,6 +1694,8 @@ PW32HEAP_USER_MAPPING HeapMapping, *PrevLink = &PsGetCurrentProcessWin32Process()->HeapMappings.Next; NTSTATUS Status = STATUS_SUCCESS;
+ TRACE("DO %p\n"); + /* unmap if we're the last thread using the desktop */ HeapMapping = *PrevLink; while (HeapMapping != NULL) @@ -1756,6 +1758,7 @@ }
/* we're the first, map the heap */ + DPRINT("Noone mapped the desktop heap %p yet, so - map it!\n", DesktopObject->hDesktopHeap); Offset.QuadPart = 0; Status = MmMapViewOfSection(DesktopObject->DesktopHeapSection, PsGetCurrentProcess(), @@ -1769,7 +1772,7 @@ PAGE_EXECUTE_READ); /* would prefer PAGE_READONLY, but thanks to RTL heaps... */ if (!NT_SUCCESS(Status)) { - DbgPrint("Failed to map desktop\n"); + DPRINT1("Failed to map desktop\n"); return Status; }
@@ -1779,6 +1782,7 @@ { MmUnmapViewOfSection(PsGetCurrentProcess(), UserBase); + DPRINT1("UserHeapAlloc() failed!\n"); return STATUS_NO_MEMORY; }
@@ -1786,6 +1790,7 @@ HeapMapping->KernelMapping = (PVOID)DesktopObject->hDesktopHeap; HeapMapping->UserMapping = UserBase; HeapMapping->Count = 1; + *PrevLink = HeapMapping;
ObReferenceObject(DesktopObject);
@@ -1812,6 +1817,7 @@ NTSTATUS Status; BOOL MapHeap;
+ DPRINT("IntSetThreadDesktop() DO=%p, FOF=%d\n", DesktopObject, FreeOnFailure); MapHeap = (PsGetCurrentProcess() != PsInitialSystemProcess); W32Thread = PsGetCurrentThreadWin32Thread();