- 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.

svn path=/trunk/; revision=23571
This commit is contained in:
Aleksey Bragin
2006-08-13 21:43:53 +00:00
parent 48ed6cd4d0
commit 75b35d0b0f
2 changed files with 24 additions and 6 deletions
+15 -3
View File
@@ -30,8 +30,8 @@
#include <w32k.h>
#define NDEBUG
#include <debug.h>
//#define YDEBUG
#include <wine/debug.h>
/* WINDOWCLASS ***************************************************************/
@@ -827,6 +827,9 @@ IntCreateClass(IN CONST WNDCLASSEXW* lpwcx,
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 @@ NtUserGetClassInfo(
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 @@ NtUserGetClassInfo(
{
if (!IS_ATOM(CapturedClassName.Buffer))
{
ERR("NtUserGetClassInfo() got ClassName instead of Atom!\n");
goto InvalidParameter;
}
}
@@ -2151,7 +2162,6 @@ InvalidParameter:
if (Ret)
{
lpWndClassEx->lpszClassName = CapturedClassName.Buffer;
/* FIXME - handle Class->Desktop == NULL!!!!! */
if (Class->MenuName != NULL &&
@@ -2168,6 +2178,7 @@ InvalidParameter:
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 @@ InvalidParameter:
}
else
{
WARN("Tried to get information of a non-existing class\n");
SetLastWin32Error(ERROR_CLASS_DOES_NOT_EXIST);
}
}
@@ -31,8 +31,8 @@
#include <w32k.h>
#define NDEBUG
#include <debug.h>
//#define YDEBUG
#include <wine/debug.h>
static
VOID
@@ -1694,6 +1694,8 @@ IntUnmapDesktopView(IN PDESKTOP_OBJECT DesktopObject)
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 @@ IntMapDesktopView(IN PDESKTOP_OBJECT DesktopObject)
}
/* 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 @@ IntMapDesktopView(IN PDESKTOP_OBJECT DesktopObject)
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 @@ IntMapDesktopView(IN PDESKTOP_OBJECT DesktopObject)
{
MmUnmapViewOfSection(PsGetCurrentProcess(),
UserBase);
DPRINT1("UserHeapAlloc() failed!\n");
return STATUS_NO_MEMORY;
}
@@ -1786,6 +1790,7 @@ IntMapDesktopView(IN PDESKTOP_OBJECT DesktopObject)
HeapMapping->KernelMapping = (PVOID)DesktopObject->hDesktopHeap;
HeapMapping->UserMapping = UserBase;
HeapMapping->Count = 1;
*PrevLink = HeapMapping;
ObReferenceObject(DesktopObject);
@@ -1812,6 +1817,7 @@ IntSetThreadDesktop(IN PDESKTOP_OBJECT DesktopObject,
NTSTATUS Status;
BOOL MapHeap;
DPRINT("IntSetThreadDesktop() DO=%p, FOF=%d\n", DesktopObject, FreeOnFailure);
MapHeap = (PsGetCurrentProcess() != PsInitialSystemProcess);
W32Thread = PsGetCurrentThreadWin32Thread();