ReactOS 0.4.16-dev-597-gdbf7844
gdidbg.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS win32 kernel mode subsystem
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: win32ss/gdi/ntgdi/gdidbg.c
5 * PURPOSE: Special debugging functions for GDI
6 * PROGRAMMERS: Timo Kreuzer
7 */
8
11#if DBG
12#include <win32k.h>
13#define NDEBUG
14#include <debug.h>
15
16extern ULONG gulFirstFree;
18extern PENTRY gpentHmgr;
19
20ULONG gulLogUnique = 0;
21
22/* Note: the following values need to be sorted */
23DBG_CHANNEL DbgChannels[DbgChCount] = {
24 {L"EngBlt", DbgChEngBlt},
25 {L"EngBrush", DbgChEngBrush},
26 {L"EngClip", DbgChEngClip},
27 {L"EngCursor", DbgChEngCursor},
28 {L"EngDev", DbgChEngDev},
29 {L"EngErr", DbgChEngErr},
30 {L"EngEvent", DbgChEngEvent},
31 {L"EngGrad", DbgChEngGrad},
32 {L"EngLDev", DbgChEngLDev},
33 {L"EngLine", DbgChEngLine},
34 {L"EngMapping", DbgChEngMapping},
35 {L"EngMDev", DbgChEngMDev},
36 {L"EngPDev", DbgChEngPDev},
37 {L"EngSurface", DbgChEngSurface},
38 {L"EngWnd", DbgChEngWnd},
39 {L"EngXlate", DbgChEngXlate},
40 {L"GdiBitmap", DbgChGdiBitmap},
41 {L"GdiBlt", DbgChGdiBlt},
42 {L"GdiBrush", DbgChGdiBrush},
43 {L"GdiClipRgn", DbgChGdiClipRgn},
44 {L"GdiCoord", DbgChGdiCoord},
45 {L"GdiDC", DbgChGdiDC},
46 {L"GdiDCAttr", DbgChGdiDCAttr},
47 {L"GdiDCState", DbgChGdiDCState},
48 {L"GdiDev", DbgChGdiDev},
49 {L"GdiDib", DbgChGdiDib},
50 {L"GdiFont", DbgChGdiFont},
51 {L"GdiLine", DbgChGdiLine},
52 {L"GdiObj", DbgChGdiObj},
53 {L"GdiPalette", DbgChGdiPalette},
54 {L"GdiPath", DbgChGdiPath},
55 {L"GdiPen", DbgChGdiPen},
56 {L"GdiPool", DbgChGdiPool},
57 {L"GdiRgn", DbgChGdiRgn},
58 {L"GdiText", DbgChGdiText},
59 {L"GdiXFormObj", DbgChGdiXFormObj},
60 {L"UserAccel", DbgChUserAccel},
61 {L"UserCallback", DbgChUserCallback},
62 {L"UserCallProc", DbgChUserCallProc},
63 {L"UserCaret", DbgChUserCaret},
64 {L"UserClass", DbgChUserClass},
65 {L"UserClipbrd", DbgChUserClipbrd},
66 {L"UserCsr", DbgChUserCsr},
67 {L"UserDce", DbgChUserDce},
68 {L"UserDefwnd", DbgChUserDefwnd},
69 {L"UserDesktop", DbgChUserDesktop},
70 {L"UserDisplay",DbgChUserDisplay},
71 {L"UserEvent", DbgChUserEvent},
72 {L"UserFocus", DbgChUserFocus},
73 {L"UserHook", DbgChUserHook},
74 {L"UserHotkey", DbgChUserHotkey},
75 {L"UserIcon", DbgChUserIcon},
76 {L"UserInput", DbgChUserInput},
77 {L"UserKbd", DbgChUserKbd},
78 {L"UserKbdLayout", DbgChUserKbdLayout},
79 {L"UserMenu", DbgChUserMenu},
80 {L"UserMetric", DbgChUserMetric},
81 {L"UserMisc", DbgChUserMisc},
82 {L"UserMonitor", DbgChUserMonitor},
83 {L"UserMsg", DbgChUserMsg},
84 {L"UserMsgQ", DbgChUserMsgQ},
85 {L"UserObj", DbgChUserObj},
86 {L"UserPainting", DbgChUserPainting},
87 {L"UserProcess", DbgChUserProcess},
88 {L"UserPowerManager", DbgChUserPowerManager},
89 {L"UserProp", DbgChUserProp},
90 {L"UserScrollbar", DbgChUserScrollbar},
91 {L"UserSecurity", DbgChUserSecurity},
92 {L"UserShutdown", DbgChUserShutdown},
93 {L"UserSysparams", DbgChUserSysparams},
94 {L"UserTimer", DbgChUserTimer},
95 {L"UserThread", DbgChUserThread},
96 {L"UserWinpos", DbgChUserWinpos},
97 {L"UserWinsta", DbgChUserWinsta},
98 {L"UserWnd", DbgChUserWnd}
99};
100
101ULONG
102NTAPI
104 _Out_writes_(cFramesToCapture) PVOID* ppvFrames,
105 _In_ ULONG cFramesToSkip,
106 _In_ ULONG cFramesToCapture)
107{
108 ULONG cFrameCount;
109 PVOID apvTemp[30];
110 NT_ASSERT(cFramesToCapture <= _countof(apvTemp));
111
112 /* Zero it out */
113 RtlZeroMemory(ppvFrames, cFramesToCapture * sizeof(PVOID));
114
115 /* Capture kernel stack */
116 cFrameCount = RtlWalkFrameChain(apvTemp, _countof(apvTemp), 0);
117
118 /* If we should skip more than we have, we are done */
119 if (cFramesToSkip > cFrameCount)
120 return 0;
121
122 /* Copy, but skip frames */
123 cFrameCount -= cFramesToSkip;
124 cFrameCount = min(cFrameCount, cFramesToCapture);
125 RtlCopyMemory(ppvFrames, &apvTemp[cFramesToSkip], cFrameCount * sizeof(PVOID));
126
127 /* Check if there is still space left */
128 if (cFrameCount < cFramesToCapture)
129 {
130 /* Capture user stack */
131 cFrameCount += RtlWalkFrameChain(&ppvFrames[cFrameCount],
132 cFramesToCapture - cFrameCount,
133 1);
134 }
135
136 return cFrameCount;
137}
138
139#if DBG_ENABLE_GDIOBJ_BACKTRACES
140
141static
142BOOL
143CompareBacktraces(
144 USHORT idx1,
145 USHORT idx2)
146{
147 POBJ pobj1, pobj2;
148 ULONG iLevel;
149
150 /* Get the objects */
151 pobj1 = gpentHmgr[idx1].einfo.pobj;
152 pobj2 = gpentHmgr[idx2].einfo.pobj;
153
154 /* Loop all stack levels */
155 for (iLevel = 0; iLevel < GDI_OBJECT_STACK_LEVELS; iLevel++)
156 {
157 /* If one level doesn't match we are done */
158 if (pobj1->apvBackTrace[iLevel] != pobj2->apvBackTrace[iLevel])
159 {
160 return FALSE;
161 }
162 }
163
164 return TRUE;
165}
166
167typedef struct
168{
169 USHORT idx;
170 USHORT iCount;
171} GDI_DBG_HANDLE_BT;
172
173VOID
174NTAPI
175DbgDumpGdiHandleTableWithBT(void)
176{
177 static BOOL bLeakReported = FALSE;
178 ULONG idx, j;
179 BOOL bAlreadyPresent;
180 GDI_DBG_HANDLE_BT aBacktraceTable[GDI_DBG_MAX_BTS];
181 USHORT iCount;
183 POBJ pobj;
184 ULONG iLevel, ulObj;
185
186 /* Only report once */
187 if (bLeakReported)
188 {
189 DPRINT1("GDI handle abusers already reported!\n");
190 return;
191 }
192
193 bLeakReported = TRUE;
194 DPRINT1("Reporting GDI handle abusers:\n");
195
196 /* Zero out the table */
197 RtlZeroMemory(aBacktraceTable, sizeof(aBacktraceTable));
198
199 /* We've got serious business to do */
201
202 /* Step through GDI handle table and find out who our culprit is... */
204 {
205 /* If the handle is free, continue */
206 if (gpentHmgr[idx].einfo.pobj == 0) continue;
207
208 /* Check if this backtrace is already covered */
209 bAlreadyPresent = FALSE;
210 for (j = RESERVE_ENTRIES_COUNT; j < idx; j++)
211 {
212 if (CompareBacktraces(idx, j))
213 {
214 bAlreadyPresent = TRUE;
215 break;
216 }
217 }
218
219 if (bAlreadyPresent) continue;
220
221 /* We don't have this BT yet, count how often it is present */
222 iCount = 1;
223 for (j = idx + 1; j < GDI_HANDLE_COUNT; j++)
224 {
225 if (CompareBacktraces(idx, j))
226 {
227 iCount++;
228 }
229 }
230
231 /* Now add this backtrace */
232 for (j = 0; j < GDI_DBG_MAX_BTS; j++)
233 {
234 /* Insert it below the next smaller count */
235 if (aBacktraceTable[j].iCount < iCount)
236 {
237 /* Check if there are entries above */
238 if (j < GDI_DBG_MAX_BTS - 1)
239 {
240 /* Move the following entries up by 1 */
241 RtlMoveMemory(&aBacktraceTable[j],
242 &aBacktraceTable[j + 1],
243 GDI_DBG_MAX_BTS - j - 1);
244 }
245
246 /* Set this entry */
247 aBacktraceTable[j].idx = idx;
248 aBacktraceTable[j].iCount = iCount;
249
250 /* We are done here */
251 break;
252 }
253 }
254 }
255
256 /* Print the worst offenders... */
257 DbgPrint("Count Handle Backtrace\n");
258 DbgPrint("------------------------------------------------\n");
259 for (j = 0; j < GDI_DBG_MAX_BTS; j++)
260 {
261 idx = aBacktraceTable[j].idx;
262 if (idx == 0)
263 break;
264
265 ulObj = ((ULONG)gpentHmgr[idx].FullUnique << 16) | idx;
266 pobj = gpentHmgr[idx].einfo.pobj;
267
268 DbgPrint("%5d %08lx ", aBacktraceTable[j].iCount, ulObj);
269 for (iLevel = 0; iLevel < GDI_OBJECT_STACK_LEVELS; iLevel++)
270 {
271 DbgPrint("%p,", pobj->apvBackTrace[iLevel]);
272 }
273 DbgPrint("\n");
274 }
275
276 __debugbreak();
277
279}
280
281#endif /* DBG_ENABLE_GDIOBJ_BACKTRACES */
282
283#if DBG
284
285BOOL
286NTAPI
288{
289 ULONG i, nDeleted = 0, nFree = 0, nUsed = 0;
291 BOOL r = 1;
292
294
295 /* FIXME: Check reserved entries */
296
297 /* Now go through the deleted objects */
298 i = gulFirstFree & 0xffff;
299 while (i)
300 {
301 pEntry = &GdiHandleTable->Entries[i];
302 if (i >= GDI_HANDLE_COUNT)
303 {
304 DPRINT1("nDeleted=%lu\n", nDeleted);
305 ASSERT(FALSE);
306 }
307
308 nDeleted++;
309
310 /* Check the entry */
311 if ((pEntry->Type & GDI_ENTRY_BASETYPE_MASK) != 0)
312 {
313 r = 0;
314 DPRINT1("Deleted Entry has a type != 0\n");
315 }
316 if ((ULONG_PTR)pEntry->KernelData >= GDI_HANDLE_COUNT)
317 {
318 r = 0;
319 DPRINT1("Deleted entries KernelPointer too big\n");
320 }
321 if (pEntry->UserData != NULL)
322 {
323 r = 0;
324 DPRINT1("Deleted entry has UserData != 0\n");
325 }
326 if (pEntry->ProcessId != 0)
327 {
328 r = 0;
329 DPRINT1("Deleted entry has ProcessId != 0\n");
330 }
331
332 i = (ULONG_PTR)pEntry->KernelData & 0xffff;
333 };
334
335 for (i = gulFirstUnused;
337 i++)
338 {
339 pEntry = &GdiHandleTable->Entries[i];
340
341 if ((pEntry->Type) != 0)
342 {
343 r = 0;
344 DPRINT1("Free Entry has a type != 0\n");
345 }
346 if ((ULONG_PTR)pEntry->KernelData != 0)
347 {
348 r = 0;
349 DPRINT1("Free entries KernelPointer != 0\n");
350 }
351 if (pEntry->UserData != NULL)
352 {
353 r = 0;
354 DPRINT1("Free entry has UserData != 0\n");
355 }
356 if (pEntry->ProcessId != 0)
357 {
358 r = 0;
359 DPRINT1("Free entry has ProcessId != 0\n");
360 }
361 nFree++;
362 }
363
365 {
367 ULONG Type;
368
369 pEntry = &GdiHandleTable->Entries[i];
370 Type = pEntry->Type;
372
374 {
375 if (pEntry->KernelData == NULL)
376 {
377 r = 0;
378 DPRINT1("Used entry has KernelData == 0\n");
379 }
380 else if (pEntry->KernelData <= MmHighestUserAddress)
381 {
382 r = 0;
383 DPRINT1("Used entry invalid KernelData\n");
384 }
385 else if (((POBJ)(pEntry->KernelData))->hHmgr != Handle)
386 {
387 r = 0;
388 DPRINT1("Used entry %lu, has invalid hHmg %p (expected: %p)\n",
389 i, ((POBJ)(pEntry->KernelData))->hHmgr, Handle);
390 }
391 nUsed++;
392 }
393 }
394
395 if (RESERVE_ENTRIES_COUNT + nDeleted + nFree + nUsed != GDI_HANDLE_COUNT)
396 {
397 r = 0;
398 DPRINT1("Number of all entries incorrect: RESERVE_ENTRIES_COUNT = %lu, nDeleted = %lu, nFree = %lu, nUsed = %lu\n",
399 RESERVE_ENTRIES_COUNT, nDeleted, nFree, nUsed);
400 }
401
403
404 return r;
405}
406
407#endif /* DBG */
408
409
410#if DBG_ENABLE_EVENT_LOGGING
411
412VOID
413NTAPI
414DbgLogEvent(PSLIST_HEADER pslh, LOG_EVENT_TYPE nEventType, LPARAM lParam)
415{
416 PLOGENTRY pLogEntry;
417
418 /* Log a maximum of 100 events */
419 if (QueryDepthSList(pslh) >= 1000) return;
420
421 /* Allocate a logentry */
422 pLogEntry = EngAllocMem(0, sizeof(LOGENTRY), 'golG');
423 if (!pLogEntry) return;
424
425 /* Set type */
426 pLogEntry->nEventType = nEventType;
427 pLogEntry->ulUnique = InterlockedIncrement((LONG*)&gulLogUnique);
428 pLogEntry->dwProcessId = HandleToUlong(PsGetCurrentProcessId());
429 pLogEntry->dwThreadId = HandleToUlong(PsGetCurrentThreadId());
430 pLogEntry->lParam = lParam;
431
432 /* Capture a backtrace */
433 DbgCaptureStackBackTace(pLogEntry->apvBackTrace, 1, 20);
434
435 switch (nEventType)
436 {
437 case EVENT_ALLOCATE:
438 case EVENT_CREATE_HANDLE:
439 case EVENT_REFERENCE:
440 case EVENT_DEREFERENCE:
441 case EVENT_LOCK:
442 case EVENT_UNLOCK:
443 case EVENT_DELETE:
444 case EVENT_FREE:
445 case EVENT_SET_OWNER:
446 default:
447 break;
448 }
449
450 /* Push it on the list */
451 InterlockedPushEntrySList(pslh, &pLogEntry->sleLink);
452}
453
454#define REL_ADDR(va) ((ULONG_PTR)va - (ULONG_PTR)&__ImageBase)
455
456VOID
457NTAPI
458DbgPrintEvent(PLOGENTRY pLogEntry)
459{
460 PSTR pstr;
461
462 switch (pLogEntry->nEventType)
463 {
464 case EVENT_ALLOCATE: pstr = "Allocate"; break;
465 case EVENT_CREATE_HANDLE: pstr = "CreatHdl"; break;
466 case EVENT_REFERENCE: pstr = "Ref"; break;
467 case EVENT_DEREFERENCE: pstr = "Deref"; break;
468 case EVENT_LOCK: pstr = "Lock"; break;
469 case EVENT_UNLOCK: pstr = "Unlock"; break;
470 case EVENT_DELETE: pstr = "Delete"; break;
471 case EVENT_FREE: pstr = "Free"; break;
472 case EVENT_SET_OWNER: pstr = "SetOwner"; break;
473 default: pstr = "Unknown"; break;
474 }
475
476 DbgPrint("[%lu] %03x:%03x %.8s val=%p <%lx,%lx,%lx,%lx>\n",
477 pLogEntry->ulUnique,
478 pLogEntry->dwProcessId,
479 pLogEntry->dwThreadId,
480 pstr,
481 (PVOID)pLogEntry->lParam,
482 REL_ADDR(pLogEntry->apvBackTrace[2]),
483 REL_ADDR(pLogEntry->apvBackTrace[3]),
484 REL_ADDR(pLogEntry->apvBackTrace[4]),
485 REL_ADDR(pLogEntry->apvBackTrace[5]));
486}
487
488VOID
489NTAPI
490DbgDumpEventList(PSLIST_HEADER pslh)
491{
492 PSLIST_ENTRY psle;
493 PLOGENTRY pLogEntry;
494
495 while ((psle = InterlockedPopEntrySList(pslh)))
496 {
497 pLogEntry = CONTAINING_RECORD(psle, LOGENTRY, sleLink);
498 DbgPrintEvent(pLogEntry);
499 }
500}
501
502VOID
503NTAPI
504DbgCleanupEventList(PSLIST_HEADER pslh)
505{
506 PSLIST_ENTRY psle;
507 PLOGENTRY pLogEntry;
508
509 while ((psle = InterlockedPopEntrySList(pslh)))
510 {
511 pLogEntry = CONTAINING_RECORD(psle, LOGENTRY, sleLink);
512 EngFreeMem(pLogEntry);
513 }
514}
515
516#endif /* DBG_ENABLE_EVENT_LOGGING */
517
518#if 1 || DBG_ENABLE_SERVICE_HOOKS
519
520VOID
521NTAPI
523{
524 ULONG i;
525
527 {
528 PENTRY pentry = &gpentHmgr[i];
529
530 if (pentry->Objt)
531 {
532 POBJ pobj = pentry->einfo.pobj;
533 if (pobj->cExclusiveLock > 0)
534 {
535 DPRINT1("Locked object: %lx, type = %lx. allocated from:\n",
536 i, pentry->Objt);
537 DBG_DUMP_EVENT_LIST(&pobj->slhLog);
538 }
539 }
540 }
541}
542
543void
544NTAPI
545GdiDbgPreServiceHook(ULONG ulSyscallId, PULONG_PTR pulArguments)
546{
548 if (pti && pti->cExclusiveLocks != 0)
549 {
550 DbgPrint("FATAL: Win32DbgPreServiceHook(0x%lx): There are %lu exclusive locks!\n",
551 ulSyscallId, pti->cExclusiveLocks);
553 ASSERT(FALSE);
554 }
555
556}
557
559NTAPI
560GdiDbgPostServiceHook(ULONG ulSyscallId, ULONG_PTR ulResult)
561{
563 if (pti && pti->cExclusiveLocks != 0)
564 {
565 DbgPrint("FATAL: Win32DbgPostServiceHook(0x%lx): There are %lu exclusive locks!\n",
566 ulSyscallId, pti->cExclusiveLocks);
568 ASSERT(FALSE);
569 }
570 return ulResult;
571}
572
573#endif /* DBG_ENABLE_SERVICE_HOOKS */
574
575
577QueryEnvironmentVariable(PUNICODE_STRING Name,
579{
581 PWSTR wcs;
583 PWSTR val;
584 PPEB Peb;
586
587 /* Ugly HACK for ReactOS system threads */
588 if(!NtCurrentTeb())
589 {
591 }
592
593 Peb = NtCurrentPeb();
594
595 if (Peb == NULL)
596 {
598 }
599
601
602 if (Environment == NULL)
603 {
605 }
606
607 Value->Length = 0;
608
610 while (*wcs)
611 {
612 var.Buffer = wcs++;
613 wcs = wcschr(wcs, L'=');
614 if (wcs == NULL)
615 {
616 wcs = var.Buffer + wcslen(var.Buffer);
617 }
618 if (*wcs)
619 {
620 var.Length = var.MaximumLength = (wcs - var.Buffer) * sizeof(WCHAR);
621 val = ++wcs;
622 wcs += wcslen(wcs);
623
625 {
626 Value->Length = (wcs - val) * sizeof(WCHAR);
627 if (Value->Length <= Value->MaximumLength)
628 {
629 memcpy(Value->Buffer, val,
630 min(Value->Length + sizeof(WCHAR), Value->MaximumLength));
632 }
633 else
634 {
636 }
637
638 return(Status);
639 }
640 }
641 wcs++;
642 }
643
645}
646
647static int __cdecl
648DbgCompareChannels(const void * a, const void * b)
649{
650 return wcscmp((WCHAR*)a, ((DBG_CHANNEL*)b)->Name);
651}
652
653static BOOL
654DbgAddDebugChannel(PPROCESSINFO ppi, WCHAR* channel, WCHAR* level, WCHAR op)
655{
656 DBG_CHANNEL *ChannelEntry;
657 UINT iLevel, iChannel;
658
659 /* Special treatment for the "all" channel */
660 if (wcscmp(channel, L"all") == 0)
661 {
662 for (iChannel = 0; iChannel < DbgChCount; iChannel++)
663 {
664 DbgAddDebugChannel(ppi, DbgChannels[iChannel].Name, level, op);
665 }
666 return TRUE;
667 }
668
669 ChannelEntry = (DBG_CHANNEL*)bsearch(channel,
670 DbgChannels,
671 DbgChCount,
672 sizeof(DBG_CHANNEL),
673 DbgCompareChannels);
674 if(ChannelEntry == NULL)
675 {
676 return FALSE;
677 }
678
679 iChannel = ChannelEntry->Id;
680 ASSERT(iChannel < DbgChCount);
681
682 if(level == NULL || *level == L'\0' ||wcslen(level) == 0 )
683 iLevel = MAX_LEVEL;
684 else if(wcsncmp(level, L"err", 3) == 0)
685 iLevel = ERR_LEVEL;
686 else if(wcsncmp(level, L"fixme", 5) == 0)
687 iLevel = FIXME_LEVEL;
688 else if(wcsncmp(level, L"warn", 4) == 0)
689 iLevel = WARN_LEVEL;
690 else if (wcsncmp(level, L"trace", 4) == 0)
691 iLevel = TRACE_LEVEL;
692 else
693 return FALSE;
694
695 if(op==L'+')
696 {
697 DBG_ENABLE_CHANNEL(ppi, iChannel, iLevel);
698 }
699 else
700 {
701 DBG_DISABLE_CHANNEL(ppi, iChannel, iLevel);
702 }
703
704 return TRUE;
705}
706
707static BOOL
709{
710 WCHAR *str, *separator, *c, op;
711
712 str = Value->Buffer;
713
714 do
715 {
716 separator = wcschr(str, L',');
717 if(separator != NULL)
718 *separator = L'\0';
719
720 c = wcschr(str, L'+');
721 if(c == NULL)
722 c = wcschr(str, L'-');
723
724 if(c != NULL)
725 {
726 op = *c;
727 *c = L'\0';
728 c++;
729
730 DbgAddDebugChannel(ppi, c, str, op);
731 }
732
733 str = separator + 1;
734 }while(separator != NULL);
735
736 return TRUE;
737}
738
740{
741 WCHAR valBuffer[100];
743 UNICODE_STRING Name = RTL_CONSTANT_STRING(L"DEBUGCHANNEL");
745 PPROCESSINFO ppi;
746 BOOL ret;
747
748 /* Initialize all channels to ERROR */
750 RtlFillMemory( ppi->DbgChannelLevel,
751 sizeof(ppi->DbgChannelLevel),
752 ERR_LEVEL);
753
754 /* Find DEBUGCHANNEL env var */
755 Value.Buffer = valBuffer;
756 Value.Length = 0;
757 Value.MaximumLength = sizeof(valBuffer);
758 Status = QueryEnvironmentVariable(&Name, &Value);
759
760 /* It does not exist */
762 {
763 /* There is nothing more to do */
764 return TRUE;
765 }
766
767 /* If the buffer in the stack is not enough allocate it */
769 {
770 Value.Buffer = ExAllocatePool(PagedPool, Value.MaximumLength);
771 if(Value.Buffer == NULL)
772 {
773 return FALSE;
774 }
775
776 /* Get the env var again */
777 Status = QueryEnvironmentVariable(&Name, &Value);
778 }
779
780 /* Check for error */
781 if(!NT_SUCCESS(Status))
782 {
783 if(Value.Buffer != valBuffer)
784 {
785 ExFreePool(Value.Buffer);
786 }
787
788 return FALSE;
789 }
790
791 /* Parse the variable */
793
794 /* Clean up */
795 if(Value.Buffer != valBuffer)
796 {
797 ExFreePool(Value.Buffer);
798 }
799
800 return ret;
801}
802
803
804#endif // DBG
805
806/* EOF */
#define NtCurrentPeb()
Definition: FLS.c:22
Type
Definition: Type.h:7
#define __cdecl
Definition: accygwin.h:79
#define InterlockedIncrement
Definition: armddk.h:53
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define HandleToUlong(h)
Definition: basetsd.h:79
#define DbgParseDebugChannels(val)
Definition: debug.h:124
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
UINT op
Definition: effect.c:236
unsigned int idx
Definition: utils.c:41
ULONG NTAPI RtlWalkFrameChain(OUT PVOID *Callers, IN ULONG Count, IN ULONG Flags)
Definition: libsupp.c:229
#define wcschr
Definition: compat.h:17
static const WCHAR separator[]
Definition: asmname.c:65
PPEB Peb
Definition: dllmain.c:27
#define ULONG_PTR
Definition: config.h:101
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define PagedPool
Definition: env_spec_w32.h:308
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
PsGetCurrentThreadId
Definition: CrNtStubs.h:8
unsigned int BOOL
Definition: ntddk_ex.h:94
PLIST_ENTRY pEntry
Definition: fxioqueue.cpp:4484
ULONG Handle
Definition: gdb_input.c:15
#define GDI_HANDLE_COUNT
Definition: gdi.h:12
#define DBG_DUMP_EVENT_LIST(pslh)
Definition: gdidebug.h:111
BOOL NTAPI DbgGdiHTIntegrityCheck(VOID)
#define GDI_DBG_MAX_BTS
Definition: gdidebug.h:3
ULONG NTAPI DbgCaptureStackBackTace(_Out_writes_(cFramesToCapture) PVOID *ppvFrames, _In_ ULONG cFramesToSkip, _In_ ULONG cFramesToCapture)
VOID NTAPI DbgDumpLockedGdiHandles(VOID)
PENTRY gpentHmgr
Definition: gdiobj.c:149
ULONG gulFirstUnused
Definition: gdiobj.c:152
#define GDI_OBJECT_STACK_LEVELS
Definition: gdiobj.h:8
static const unsigned RESERVE_ENTRIES_COUNT
Definition: gdiobj.h:11
Status
Definition: gdiplustypes.h:25
GLint level
Definition: gl.h:1546
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
const GLubyte * c
Definition: glext.h:8905
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLuint GLfloat * val
Definition: glext.h:7180
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define DbgPrint
Definition: hal.h:12
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:599
void __cdecl __debugbreak(void)
Definition: intrin_ppc.h:698
#define NtCurrentTeb
#define c
Definition: ke_i.h:80
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ASSERT(a)
Definition: mode.c:44
PVOID PVOID PWCHAR PVOID Environment
Definition: env.c:47
const char * var
Definition: shader.c:5666
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
#define _Out_writes_(s)
Definition: no_sal2.h:176
#define _In_
Definition: no_sal2.h:158
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
#define GDI_ENTRY_BASETYPE_MASK
Definition: ntgdihdl.h:34
#define GDI_ENTRY_UPPER_SHIFT
Definition: ntgdihdl.h:35
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
HANDLE NTAPI PsGetCurrentProcessId(VOID)
Definition: process.c:1123
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define STATUS_VARIABLE_NOT_FOUND
Definition: ntstatus.h:492
#define L(x)
Definition: ntvdm.h:50
struct _THREADINFO * PTHREADINFO
Definition: ntwin32.h:6
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
#define EngFreeMem
Definition: polytest.cpp:56
void * EngAllocMem(int zero, unsigned long size, int tag=0)
Definition: polytest.cpp:70
const WCHAR * str
PVOID MmHighestUserAddress
Definition: rtlcompat.c:29
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Check_return_ _CRTIMP int __cdecl wcsncmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define _countof(array)
Definition: sndvol32.h:70
USHORT cExclusiveLock
Definition: gdiobj.h:45
Definition: ntgdihdl.h:218
UCHAR Objt
Definition: ntgdihdl.h:236
union _ENTRY::_EINFO einfo
Definition: gdi.h:2
PRTL_USER_PROCESS_PARAMETERS ProcessParameters
Definition: btrfs_drv.h:1913
ULONG cExclusiveLocks
Definition: win32.h:158
#define bsearch
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
uint16_t * PWSTR
Definition: typedefs.h:56
uint32_t * PULONG_PTR
Definition: typedefs.h:65
char * PSTR
Definition: typedefs.h:51
#define NTAPI
Definition: typedefs.h:36
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
struct _BASEOBJECT * pobj
Definition: ntgdihdl.h:221
int ret
wchar_t wcs[5]
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
BOOL DbgInitDebugChannels()
#define DBG_ENABLE_CHANNEL(ppi, ch, level)
Definition: win32kdebug.h:165
#define DBG_DISABLE_CHANNEL(ppi, ch, level)
Definition: win32kdebug.h:166
#define GdiHandleTable
Definition: win32nt.h:37
volatile ULONG gulFirstFree
Definition: gdiobj.c:151
LONG_PTR LPARAM
Definition: windef.h:208
void * HGDIOBJ
Definition: windef.h:252
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
#define NT_ASSERT
Definition: rtlfuncs.h:3327
#define QueryDepthSList(SListHead)
Definition: rtlfuncs.h:3417
#define InterlockedPushEntrySList(SListHead, SListEntry)
Definition: rtlfuncs.h:3406
#define InterlockedPopEntrySList(SListHead)
Definition: rtlfuncs.h:3409
#define PSLIST_ENTRY
Definition: rtltypes.h:134
__wchar_t WCHAR
Definition: xmlstorage.h:180