Author: tkreuzer
Date: Tue Mar 4 00:35:12 2008
New Revision: 32552
URL:
http://svn.reactos.org/svn/reactos?rev=3D32552&view=3Drev
Log:
replace a bunch of #if's with GDIDBG_... macros
Modified:
trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win3=
2k/objects/gdiobj.c?rev=3D32552&r1=3D32551&r2=3D32552&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c Tue Mar 4 00:35=
:12 2008
@@ -304,6 +304,33 @@
=
return nFrameCount;
}
+
+#define GDIDBG_TRACECALLER() \
+ DPRINT1("-> called from:\n"); \
+ KeRosDumpStackFrames(NULL, 20);
+#define GDIDBG_TRACEALLOCATOR(index)
+// DPRINT1("-> allocated from:\n");
+// KeRosDumpStackFrames(GDIHandleAllocator[index], GDI_STACK_LEVELS);
+#define GDIDBG_TRACELOCKER(index)
+// DPRINT1("-> locked from:\n");
+// KeRosDumpStackFrames(GDIHandleLocker[index], GDI_STACK_LEVELS);
+#define GDIDBG_CAPTUREALLOCATOR(index) \
+ CaptureStackBackTace((PVOID*)GDIHandleAllocator[index], GDI_STACK_LEVELS=
);
+#define GDIDBG_CAPTURELOCKER(index) \
+ CaptureStackBackTace((PVOID*)GDIHandleLocker[index], GDI_STACK_LEVELS);
+
+#define GDIDBG_DUMPHANDLETABLE() \
+ IntDumpHandleTable(GdiHandleTable)
+
+#else
+
+#define GDIDBG_TRACECALLER()
+#define GDIDBG_TRACEALLOCATOR(index)
+#define GDIDBG_TRACELOCKER(index)
+#define GDIDBG_CAPTUREALLOCATOR(index)
+#define GDIDBG_CAPTURELOCKER(index)
+#define GDIDBG_DUMPHANDLETABLE()
+
#endif /* GDI_DEBUG */
=
=
@@ -501,9 +528,7 @@
/* unlock the entry */
(void)_InterlockedExchangePointer((PVOID*)&Entry->ProcessId, Curre=
ntProcessId);
=
-#ifdef GDI_DEBUG
- CaptureStackBackTace((PVOID*)GDIHandleAllocator[Index], GDI_STACK_=
LEVELS);
-#endif /* GDI_DEBUG */
+ GDIDBG_CAPTUREALLOCATOR(Index);
=
if(W32Process !=3D NULL)
{
@@ -540,9 +565,7 @@
ExFreePool(newObject);
}
DPRINT1("Failed to insert gdi object into the handle table, no handles=
left!\n");
-#ifdef GDI_DEBUG
- IntDumpHandleTable(GdiHandleTable);
-#endif /* GDI_DEBUG */
+ GDIDBG_DUMPHANDLETABLE();
}
else
{
@@ -578,10 +601,7 @@
if(GDI_HANDLE_IS_STOCKOBJ(hObj))
{
DPRINT1("GDIOBJ_FreeObj() failed, can't delete stock object handle: 0x=
%x !!!\n", hObj);
-#ifdef GDI_DEBUG
- DPRINT1("-> called from:\n");
- KeRosDumpStackFrames(NULL, 20);
-#endif
+ GDIDBG_TRACECALLER();
return FALSE;
}
=
@@ -601,11 +621,8 @@
{
DPRINT1("Attempted to free object 0x%x of wrong type (Handle: 0x%x, ex=
pected: 0x%x)\n",
hObj, HandleType, ExpectedType);
-#ifdef GDI_DEBUG
- DPRINT1("-> called from:\n");
- KeRosDumpStackFrames(NULL, 20);
-#endif
- return FALSE;
+ GDIDBG_TRACECALLER();
+ return FALSE;
}
=
Entry =3D GDI_HANDLE_GET_ENTRY(GdiHandleTable, hObj);
@@ -669,10 +686,7 @@
* The object is currently locked, so freeing is forbidden!
*/
DPRINT1("Object->cExclusiveLock =3D %d\n",
Object->cExclusiveLock);
-#ifdef GDI_DEBUG
-// DPRINT1("Locked from:\n");
-// KeRosDumpStackFrames(GDIHandleLocker[GDI_HANDLE_GET_INDEX(hObj)]=
, GDI_STACK_LEVELS);
-#endif
+ GDIDBG_TRACELOCKER(GDI_HANDLE_GET_INDEX(hObj));
ASSERT(FALSE);
}
}
@@ -709,12 +723,8 @@
{
DPRINT1("Attempted to free foreign handle: 0x%x Owner: 0x%x from C=
aller: 0x%x\n", hObj, (ULONG_PTR)PrevProcId & ~0x1, (ULONG_PTR)ProcessId & =
~0x1);
}
-#ifdef GDI_DEBUG
- DPRINT1("-> called from:\n");
- KeRosDumpStackFrames(NULL, 20);
-// DPRINT1("Allocated from:\n");
-// KeRosDumpStackFrames(GDIHandleAllocator[GDI_HANDLE_GET_INDEX(hObj)=
], GDI_STACK_LEVELS);
-#endif
+ GDIDBG_TRACECALLER();
+ GDIDBG_TRACEALLOCATOR(GDI_HANDLE_GET_INDEX(hObj));
}
}
=
@@ -860,11 +870,8 @@
{
DPRINT1("Attempted to lock object 0x%x of wrong type (Handle: 0x%x, =
requested: 0x%x)\n",
hObj, HandleType, ExpectedType);
-#ifdef GDI_DEBUG
- KeRosDumpStackFrames(NULL, 20);
-// DPRINT1("Allocated from:\n");
-// KeRosDumpStackFrames(GDIHandleAllocator[GDI_HANDLE_GET_INDEX(hOb=
j)], GDI_STACK_LEVELS);
-#endif
+ GDIDBG_TRACECALLER();
+ GDIDBG_TRACEALLOCATOR(GDI_HANDLE_GET_INDEX(hObj));
return NULL;
}
=
@@ -874,12 +881,9 @@
/* Check for invalid owner. */
if (ProcessId !=3D HandleProcessId && HandleProcessId !=3D NULL)
{
- DPRINT1("Tried to lock object (0x%p) of wrong owner! ProcessId =3D=
%p, HandleProcessId =3D %p\n", hObj, ProcessId, HandleProcessId);
-#ifdef GDI_DEBUG
- KeRosDumpStackFrames(NULL, 20);
-// DPRINT1("Handle allocator:\n");
-// KeRosDumpStackFrames(GDIHandleAllocator[GDI_HANDLE_GET_INDEX(hOb=
j)], GDI_STACK_LEVELS);
-#endif
+ DPRINT1("Tried to lock object (0x%p) of wrong owner! ProcessId =3D %=
p, HandleProcessId =3D %p\n", hObj, ProcessId, HandleProcessId);
+ GDIDBG_TRACECALLER();
+ GDIDBG_TRACEALLOCATOR(GDI_HANDLE_GET_INDEX(hObj));
return NULL;
}
=
@@ -921,9 +925,7 @@
{
Object->Tid =3D Thread;
Object->cExclusiveLock =3D 1;
-#ifdef GDI_DEBUG
- CaptureStackBackTace((PVOID*)GDIHandleLocker[GDI_HANDLE_GET=
_INDEX(hObj)], GDI_STACK_LEVELS);
-#endif
+ GDIDBG_CAPTURELOCKER(GDI_HANDLE_GET_INDEX(hObj))
}
else
{