ReactOS 0.4.15-dev-7924-g5949c20
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"UserProp", DbgChUserProp},
89 {L"UserScrollbar", DbgChUserScrollbar},
90 {L"UserSecurity", DbgChUserSecurity},
91 {L"UserShutdown", DbgChUserShutdown},
92 {L"UserSysparams", DbgChUserSysparams},
93 {L"UserTimer", DbgChUserTimer},
94 {L"UserThread", DbgChUserThread},
95 {L"UserWinpos", DbgChUserWinpos},
96 {L"UserWinsta", DbgChUserWinsta},
97 {L"UserWnd", DbgChUserWnd}
98};
99
100ULONG
101NTAPI
103 _Out_writes_(cFramesToCapture) PVOID* ppvFrames,
104 _In_ ULONG cFramesToSkip,
105 _In_ ULONG cFramesToCapture)
106{
107 ULONG cFrameCount;
108 PVOID apvTemp[30];
109 NT_ASSERT(cFramesToCapture <= _countof(apvTemp));
110
111 /* Zero it out */
112 RtlZeroMemory(ppvFrames, cFramesToCapture * sizeof(PVOID));
113
114 /* Capture kernel stack */
115 cFrameCount = RtlWalkFrameChain(apvTemp, _countof(apvTemp), 0);
116
117 /* If we should skip more than we have, we are done */
118 if (cFramesToSkip > cFrameCount)
119 return 0;
120
121 /* Copy, but skip frames */
122 cFrameCount -= cFramesToSkip;
123 cFrameCount = min(cFrameCount, cFramesToCapture);
124 RtlCopyMemory(ppvFrames, &apvTemp[cFramesToSkip], cFrameCount * sizeof(PVOID));
125
126 /* Check if there is still space left */
127 if (cFrameCount < cFramesToCapture)
128 {
129 /* Capture user stack */
130 cFrameCount += RtlWalkFrameChain(&ppvFrames[cFrameCount],
131 cFramesToCapture - cFrameCount,
132 1);
133 }
134
135 return cFrameCount;
136}
137
138#if DBG_ENABLE_GDIOBJ_BACKTRACES
139
140static
141BOOL
142CompareBacktraces(
143 USHORT idx1,
144 USHORT idx2)
145{
146 POBJ pobj1, pobj2;
147 ULONG iLevel;
148
149 /* Get the objects */
150 pobj1 = gpentHmgr[idx1].einfo.pobj;
151 pobj2 = gpentHmgr[idx2].einfo.pobj;
152
153 /* Loop all stack levels */
154 for (iLevel = 0; iLevel < GDI_OBJECT_STACK_LEVELS; iLevel++)
155 {
156 /* If one level doesn't match we are done */
157 if (pobj1->apvBackTrace[iLevel] != pobj2->apvBackTrace[iLevel])
158 {
159 return FALSE;
160 }
161 }
162
163 return TRUE;
164}
165
166typedef struct
167{
168 USHORT idx;
169 USHORT iCount;
170} GDI_DBG_HANDLE_BT;
171
172VOID
173NTAPI
174DbgDumpGdiHandleTableWithBT(void)
175{
176 static BOOL bLeakReported = FALSE;
177 ULONG idx, j;
178 BOOL bAlreadyPresent;
179 GDI_DBG_HANDLE_BT aBacktraceTable[GDI_DBG_MAX_BTS];
180 USHORT iCount;
182 POBJ pobj;
183 ULONG iLevel, ulObj;
184
185 /* Only report once */
186 if (bLeakReported)
187 {
188 DPRINT1("GDI handle abusers already reported!\n");
189 return;
190 }
191
192 bLeakReported = TRUE;
193 DPRINT1("Reporting GDI handle abusers:\n");
194
195 /* Zero out the table */
196 RtlZeroMemory(aBacktraceTable, sizeof(aBacktraceTable));
197
198 /* We've got serious business to do */
200
201 /* Step through GDI handle table and find out who our culprit is... */
203 {
204 /* If the handle is free, continue */
205 if (gpentHmgr[idx].einfo.pobj == 0) continue;
206
207 /* Check if this backtrace is already covered */
208 bAlreadyPresent = FALSE;
209 for (j = RESERVE_ENTRIES_COUNT; j < idx; j++)
210 {
211 if (CompareBacktraces(idx, j))
212 {
213 bAlreadyPresent = TRUE;
214 break;
215 }
216 }
217
218 if (bAlreadyPresent) continue;
219
220 /* We don't have this BT yet, count how often it is present */
221 iCount = 1;
222 for (j = idx + 1; j < GDI_HANDLE_COUNT; j++)
223 {
224 if (CompareBacktraces(idx, j))
225 {
226 iCount++;
227 }
228 }
229
230 /* Now add this backtrace */
231 for (j = 0; j < GDI_DBG_MAX_BTS; j++)
232 {
233 /* Insert it below the next smaller count */
234 if (aBacktraceTable[j].iCount < iCount)
235 {
236 /* Check if there are entries above */
237 if (j < GDI_DBG_MAX_BTS - 1)
238 {
239 /* Move the following entries up by 1 */
240 RtlMoveMemory(&aBacktraceTable[j],
241 &aBacktraceTable[j + 1],
242 GDI_DBG_MAX_BTS - j - 1);
243 }
244
245 /* Set this entry */
246 aBacktraceTable[j].idx = idx;
247 aBacktraceTable[j].iCount = iCount;
248
249 /* We are done here */
250 break;
251 }
252 }
253 }
254
255 /* Print the worst offenders... */
256 DbgPrint("Count Handle Backtrace\n");
257 DbgPrint("------------------------------------------------\n");
258 for (j = 0; j < GDI_DBG_MAX_BTS; j++)
259 {
260 idx = aBacktraceTable[j].idx;
261 if (idx == 0)
262 break;
263
264 ulObj = ((ULONG)gpentHmgr[idx].FullUnique << 16) | idx;
265 pobj = gpentHmgr[idx].einfo.pobj;
266
267 DbgPrint("%5d %08lx ", aBacktraceTable[j].iCount, ulObj);
268 for (iLevel = 0; iLevel < GDI_OBJECT_STACK_LEVELS; iLevel++)
269 {
270 DbgPrint("%p,", pobj->apvBackTrace[iLevel]);
271 }
272 DbgPrint("\n");
273 }
274
275 __debugbreak();
276
278}
279
280#endif /* DBG_ENABLE_GDIOBJ_BACKTRACES */
281
282#if DBG
283
284BOOL
285NTAPI
287{
288 ULONG i, nDeleted = 0, nFree = 0, nUsed = 0;
290 BOOL r = 1;
291
293
294 /* FIXME: Check reserved entries */
295
296 /* Now go through the deleted objects */
297 i = gulFirstFree & 0xffff;
298 while (i)
299 {
300 pEntry = &GdiHandleTable->Entries[i];
301 if (i >= GDI_HANDLE_COUNT)
302 {
303 DPRINT1("nDeleted=%lu\n", nDeleted);
304 ASSERT(FALSE);
305 }
306
307 nDeleted++;
308
309 /* Check the entry */
310 if ((pEntry->Type & GDI_ENTRY_BASETYPE_MASK) != 0)
311 {
312 r = 0;
313 DPRINT1("Deleted Entry has a type != 0\n");
314 }
315 if ((ULONG_PTR)pEntry->KernelData >= GDI_HANDLE_COUNT)
316 {
317 r = 0;
318 DPRINT1("Deleted entries KernelPointer too big\n");
319 }
320 if (pEntry->UserData != NULL)
321 {
322 r = 0;
323 DPRINT1("Deleted entry has UserData != 0\n");
324 }
325 if (pEntry->ProcessId != 0)
326 {
327 r = 0;
328 DPRINT1("Deleted entry has ProcessId != 0\n");
329 }
330
331 i = (ULONG_PTR)pEntry->KernelData & 0xffff;
332 };
333
334 for (i = gulFirstUnused;
336 i++)
337 {
338 pEntry = &GdiHandleTable->Entries[i];
339
340 if ((pEntry->Type) != 0)
341 {
342 r = 0;
343 DPRINT1("Free Entry has a type != 0\n");
344 }
345 if ((ULONG_PTR)pEntry->KernelData != 0)
346 {
347 r = 0;
348 DPRINT1("Free entries KernelPointer != 0\n");
349 }
350 if (pEntry->UserData != NULL)
351 {
352 r = 0;
353 DPRINT1("Free entry has UserData != 0\n");
354 }
355 if (pEntry->ProcessId != 0)
356 {
357 r = 0;
358 DPRINT1("Free entry has ProcessId != 0\n");
359 }
360 nFree++;
361 }
362
364 {
366 ULONG Type;
367
368 pEntry = &GdiHandleTable->Entries[i];
369 Type = pEntry->Type;
371
373 {
374 if (pEntry->KernelData == NULL)
375 {
376 r = 0;
377 DPRINT1("Used entry has KernelData == 0\n");
378 }
379 else if (pEntry->KernelData <= MmHighestUserAddress)
380 {
381 r = 0;
382 DPRINT1("Used entry invalid KernelData\n");
383 }
384 else if (((POBJ)(pEntry->KernelData))->hHmgr != Handle)
385 {
386 r = 0;
387 DPRINT1("Used entry %lu, has invalid hHmg %p (expected: %p)\n",
388 i, ((POBJ)(pEntry->KernelData))->hHmgr, Handle);
389 }
390 nUsed++;
391 }
392 }
393
394 if (RESERVE_ENTRIES_COUNT + nDeleted + nFree + nUsed != GDI_HANDLE_COUNT)
395 {
396 r = 0;
397 DPRINT1("Number of all entries incorrect: RESERVE_ENTRIES_COUNT = %lu, nDeleted = %lu, nFree = %lu, nUsed = %lu\n",
398 RESERVE_ENTRIES_COUNT, nDeleted, nFree, nUsed);
399 }
400
402
403 return r;
404}
405
406#endif /* DBG */
407
408
409#if DBG_ENABLE_EVENT_LOGGING
410
411VOID
412NTAPI
413DbgLogEvent(PSLIST_HEADER pslh, LOG_EVENT_TYPE nEventType, LPARAM lParam)
414{
415 PLOGENTRY pLogEntry;
416
417 /* Log a maximum of 100 events */
418 if (QueryDepthSList(pslh) >= 1000) return;
419
420 /* Allocate a logentry */
421 pLogEntry = EngAllocMem(0, sizeof(LOGENTRY), 'golG');
422 if (!pLogEntry) return;
423
424 /* Set type */
425 pLogEntry->nEventType = nEventType;
426 pLogEntry->ulUnique = InterlockedIncrement((LONG*)&gulLogUnique);
427 pLogEntry->dwProcessId = HandleToUlong(PsGetCurrentProcessId());
428 pLogEntry->dwThreadId = HandleToUlong(PsGetCurrentThreadId());
429 pLogEntry->lParam = lParam;
430
431 /* Capture a backtrace */
432 DbgCaptureStackBackTace(pLogEntry->apvBackTrace, 1, 20);
433
434 switch (nEventType)
435 {
436 case EVENT_ALLOCATE:
437 case EVENT_CREATE_HANDLE:
438 case EVENT_REFERENCE:
439 case EVENT_DEREFERENCE:
440 case EVENT_LOCK:
441 case EVENT_UNLOCK:
442 case EVENT_DELETE:
443 case EVENT_FREE:
444 case EVENT_SET_OWNER:
445 default:
446 break;
447 }
448
449 /* Push it on the list */
450 InterlockedPushEntrySList(pslh, &pLogEntry->sleLink);
451}
452
453#define REL_ADDR(va) ((ULONG_PTR)va - (ULONG_PTR)&__ImageBase)
454
455VOID
456NTAPI
457DbgPrintEvent(PLOGENTRY pLogEntry)
458{
459 PSTR pstr;
460
461 switch (pLogEntry->nEventType)
462 {
463 case EVENT_ALLOCATE: pstr = "Allocate"; break;
464 case EVENT_CREATE_HANDLE: pstr = "CreatHdl"; break;
465 case EVENT_REFERENCE: pstr = "Ref"; break;
466 case EVENT_DEREFERENCE: pstr = "Deref"; break;
467 case EVENT_LOCK: pstr = "Lock"; break;
468 case EVENT_UNLOCK: pstr = "Unlock"; break;
469 case EVENT_DELETE: pstr = "Delete"; break;
470 case EVENT_FREE: pstr = "Free"; break;
471 case EVENT_SET_OWNER: pstr = "SetOwner"; break;
472 default: pstr = "Unknown"; break;
473 }
474
475 DbgPrint("[%lu] %03x:%03x %.8s val=%p <%lx,%lx,%lx,%lx>\n",
476 pLogEntry->ulUnique,
477 pLogEntry->dwProcessId,
478 pLogEntry->dwThreadId,
479 pstr,
480 (PVOID)pLogEntry->lParam,
481 REL_ADDR(pLogEntry->apvBackTrace[2]),
482 REL_ADDR(pLogEntry->apvBackTrace[3]),
483 REL_ADDR(pLogEntry->apvBackTrace[4]),
484 REL_ADDR(pLogEntry->apvBackTrace[5]));
485}
486
487VOID
488NTAPI
489DbgDumpEventList(PSLIST_HEADER pslh)
490{
491 PSLIST_ENTRY psle;
492 PLOGENTRY pLogEntry;
493
494 while ((psle = InterlockedPopEntrySList(pslh)))
495 {
496 pLogEntry = CONTAINING_RECORD(psle, LOGENTRY, sleLink);
497 DbgPrintEvent(pLogEntry);
498 }
499}
500
501VOID
502NTAPI
503DbgCleanupEventList(PSLIST_HEADER pslh)
504{
505 PSLIST_ENTRY psle;
506 PLOGENTRY pLogEntry;
507
508 while ((psle = InterlockedPopEntrySList(pslh)))
509 {
510 pLogEntry = CONTAINING_RECORD(psle, LOGENTRY, sleLink);
511 EngFreeMem(pLogEntry);
512 }
513}
514
515#endif /* DBG_ENABLE_EVENT_LOGGING */
516
517#if 1 || DBG_ENABLE_SERVICE_HOOKS
518
519VOID
520NTAPI
522{
523 ULONG i;
524
526 {
527 PENTRY pentry = &gpentHmgr[i];
528
529 if (pentry->Objt)
530 {
531 POBJ pobj = pentry->einfo.pobj;
532 if (pobj->cExclusiveLock > 0)
533 {
534 DPRINT1("Locked object: %lx, type = %lx. allocated from:\n",
535 i, pentry->Objt);
536 DBG_DUMP_EVENT_LIST(&pobj->slhLog);
537 }
538 }
539 }
540}
541
542void
543NTAPI
544GdiDbgPreServiceHook(ULONG ulSyscallId, PULONG_PTR pulArguments)
545{
547 if (pti && pti->cExclusiveLocks != 0)
548 {
549 DbgPrint("FATAL: Win32DbgPreServiceHook(0x%lx): There are %lu exclusive locks!\n",
550 ulSyscallId, pti->cExclusiveLocks);
552 ASSERT(FALSE);
553 }
554
555}
556
558NTAPI
559GdiDbgPostServiceHook(ULONG ulSyscallId, ULONG_PTR ulResult)
560{
562 if (pti && pti->cExclusiveLocks != 0)
563 {
564 DbgPrint("FATAL: Win32DbgPostServiceHook(0x%lx): There are %lu exclusive locks!\n",
565 ulSyscallId, pti->cExclusiveLocks);
567 ASSERT(FALSE);
568 }
569 return ulResult;
570}
571
572#endif /* DBG_ENABLE_SERVICE_HOOKS */
573
574
576QueryEnvironmentVariable(PUNICODE_STRING Name,
578{
580 PWSTR wcs;
582 PWSTR val;
583 PPEB Peb;
585
586 /* Ugly HACK for ReactOS system threads */
587 if(!NtCurrentTeb())
588 {
590 }
591
592 Peb = NtCurrentPeb();
593
594 if (Peb == NULL)
595 {
597 }
598
600
601 if (Environment == NULL)
602 {
604 }
605
606 Value->Length = 0;
607
609 while (*wcs)
610 {
611 var.Buffer = wcs++;
612 wcs = wcschr(wcs, L'=');
613 if (wcs == NULL)
614 {
615 wcs = var.Buffer + wcslen(var.Buffer);
616 }
617 if (*wcs)
618 {
619 var.Length = var.MaximumLength = (wcs - var.Buffer) * sizeof(WCHAR);
620 val = ++wcs;
621 wcs += wcslen(wcs);
622
624 {
625 Value->Length = (wcs - val) * sizeof(WCHAR);
626 if (Value->Length <= Value->MaximumLength)
627 {
628 memcpy(Value->Buffer, val,
629 min(Value->Length + sizeof(WCHAR), Value->MaximumLength));
631 }
632 else
633 {
635 }
636
637 return(Status);
638 }
639 }
640 wcs++;
641 }
642
644}
645
646static int __cdecl
647DbgCompareChannels(const void * a, const void * b)
648{
649 return wcscmp((WCHAR*)a, ((DBG_CHANNEL*)b)->Name);
650}
651
652static BOOL
653DbgAddDebugChannel(PPROCESSINFO ppi, WCHAR* channel, WCHAR* level, WCHAR op)
654{
655 DBG_CHANNEL *ChannelEntry;
656 UINT iLevel, iChannel;
657
658 /* Special treatment for the "all" channel */
659 if (wcscmp(channel, L"all") == 0)
660 {
661 for (iChannel = 0; iChannel < DbgChCount; iChannel++)
662 {
663 DbgAddDebugChannel(ppi, DbgChannels[iChannel].Name, level, op);
664 }
665 return TRUE;
666 }
667
668 ChannelEntry = (DBG_CHANNEL*)bsearch(channel,
669 DbgChannels,
670 DbgChCount,
671 sizeof(DBG_CHANNEL),
672 DbgCompareChannels);
673 if(ChannelEntry == NULL)
674 {
675 return FALSE;
676 }
677
678 iChannel = ChannelEntry->Id;
679 ASSERT(iChannel < DbgChCount);
680
681 if(level == NULL || *level == L'\0' ||wcslen(level) == 0 )
682 iLevel = MAX_LEVEL;
683 else if(wcsncmp(level, L"err", 3) == 0)
684 iLevel = ERR_LEVEL;
685 else if(wcsncmp(level, L"fixme", 5) == 0)
686 iLevel = FIXME_LEVEL;
687 else if(wcsncmp(level, L"warn", 4) == 0)
688 iLevel = WARN_LEVEL;
689 else if (wcsncmp(level, L"trace", 4) == 0)
690 iLevel = TRACE_LEVEL;
691 else
692 return FALSE;
693
694 if(op==L'+')
695 {
696 DBG_ENABLE_CHANNEL(ppi, iChannel, iLevel);
697 }
698 else
699 {
700 DBG_DISABLE_CHANNEL(ppi, iChannel, iLevel);
701 }
702
703 return TRUE;
704}
705
706static BOOL
708{
709 WCHAR *str, *separator, *c, op;
710
711 str = Value->Buffer;
712
713 do
714 {
715 separator = wcschr(str, L',');
716 if(separator != NULL)
717 *separator = L'\0';
718
719 c = wcschr(str, L'+');
720 if(c == NULL)
721 c = wcschr(str, L'-');
722
723 if(c != NULL)
724 {
725 op = *c;
726 *c = L'\0';
727 c++;
728
729 DbgAddDebugChannel(ppi, c, str, op);
730 }
731
732 str = separator + 1;
733 }while(separator != NULL);
734
735 return TRUE;
736}
737
739{
740 WCHAR valBuffer[100];
742 UNICODE_STRING Name = RTL_CONSTANT_STRING(L"DEBUGCHANNEL");
744 PPROCESSINFO ppi;
745 BOOL ret;
746
747 /* Initialize all channels to ERROR */
749 RtlFillMemory( ppi->DbgChannelLevel,
750 sizeof(ppi->DbgChannelLevel),
751 ERR_LEVEL);
752
753 /* Find DEBUGCHANNEL env var */
754 Value.Buffer = valBuffer;
755 Value.Length = 0;
756 Value.MaximumLength = sizeof(valBuffer);
757 Status = QueryEnvironmentVariable(&Name, &Value);
758
759 /* It does not exist */
761 {
762 /* There is nothing more to do */
763 return TRUE;
764 }
765
766 /* If the buffer in the stack is not enough allocate it */
768 {
769 Value.Buffer = ExAllocatePool(PagedPool, Value.MaximumLength);
770 if(Value.Buffer == NULL)
771 {
772 return FALSE;
773 }
774
775 /* Get the env var again */
776 Status = QueryEnvironmentVariable(&Name, &Value);
777 }
778
779 /* Check for error */
780 if(!NT_SUCCESS(Status))
781 {
782 if(Value.Buffer != valBuffer)
783 {
784 ExFreePool(Value.Buffer);
785 }
786
787 return FALSE;
788 }
789
790 /* Parse the variable */
792
793 /* Clean up */
794 if(Value.Buffer != valBuffer)
795 {
796 ExFreePool(Value.Buffer);
797 }
798
799 return ret;
800}
801
802
803#endif // DBG
804
805/* 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:121
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:32
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:227
#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
#define _Out_writes_(size)
Definition: ms_sal.h:348
#define _In_
Definition: ms_sal.h:308
unsigned int UINT
Definition: ndis.h:50
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:68
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:164
#define DBG_DISABLE_CHANNEL(ppi, ch, level)
Definition: win32kdebug.h:165
#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:3310
#define QueryDepthSList(SListHead)
Definition: rtlfuncs.h:3400
#define InterlockedPushEntrySList(SListHead, SListEntry)
Definition: rtlfuncs.h:3389
#define InterlockedPopEntrySList(SListHead)
Definition: rtlfuncs.h:3392
#define PSLIST_ENTRY
Definition: rtltypes.h:134
__wchar_t WCHAR
Definition: xmlstorage.h:180