ReactOS 0.4.17-dev-806-gffa4164
object.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * PURPOSE: User handle manager
5 * FILE: win32ss/user/ntuser/object.c
6 * PROGRAMER: Copyright (C) 2001 Alexandre Julliard
7 */
8
9#include <win32k.h>
11
12//int usedHandles=0;
14
15/* Forward declarations */
17static PVOID AllocThreadObject(
18 _In_ PDESKTOP pDesk,
19 _In_ PTHREADINFO pti,
21 _Out_ PVOID* HandleOwner)
22{
23 PTHROBJHEAD ObjHead;
24
26
27 ASSERT(Size > sizeof(*ObjHead));
28 ASSERT(pti != NULL);
29
30 ObjHead = UserHeapAlloc(Size);
31 if (!ObjHead)
32 return NULL;
33
34 RtlZeroMemory(ObjHead, Size);
35
36 ObjHead->pti = pti;
38 *HandleOwner = pti;
39 /* It's a thread object, but it still count as one for the process */
40 pti->ppi->UserHandleCount++;
41
42 return ObjHead;
43}
44
45static void FreeThreadObject(
47{
49 PTHREADINFO pti = ObjHead->pti;
50
51 UserHeapFree(ObjHead);
52
53 pti->ppi->UserHandleCount--;
55}
56
57_Success_(return!=NULL)
58static PVOID AllocDeskThreadObject(
59 _In_ PDESKTOP pDesk,
60 _In_ PTHREADINFO pti,
62 _Out_ PVOID* HandleOwner)
63{
64 PTHRDESKHEAD ObjHead;
65
66 ASSERT(Size > sizeof(*ObjHead));
67 ASSERT(pti != NULL);
68
69 if (!pDesk)
70 pDesk = pti->rpdesk;
71
72 ObjHead = DesktopHeapAlloc(pDesk, Size);
73 if (!ObjHead)
74 return NULL;
75
76 RtlZeroMemory(ObjHead, Size);
77
78 ObjHead->pSelf = ObjHead;
79 ObjHead->rpdesk = pDesk;
80 ObjHead->pti = pti;
82 *HandleOwner = pti;
83 /* It's a thread object, but it still count as one for the process */
84 pti->ppi->UserHandleCount++;
85
86 return ObjHead;
87}
88
91{
93 PDESKTOP pDesk = ObjHead->rpdesk;
94 PTHREADINFO pti = ObjHead->pti;
95
96 DesktopHeapFree(pDesk, Object);
97
98 pti->ppi->UserHandleCount--;
100}
101
102_Success_(return!=NULL)
103static PVOID AllocDeskProcObject(
104 _In_ PDESKTOP pDesk,
105 _In_ PTHREADINFO pti,
107 _Out_ PVOID* HandleOwner)
108{
109 PPROCDESKHEAD ObjHead;
110 PPROCESSINFO ppi;
111
112 ASSERT(Size > sizeof(*ObjHead));
113 ASSERT(pDesk != NULL);
114 ASSERT(pti != NULL);
115
116 ObjHead = DesktopHeapAlloc(pDesk, Size);
117 if (!ObjHead)
118 return NULL;
119
120 RtlZeroMemory(ObjHead, Size);
121
122 ppi = pti->ppi;
123
124 ObjHead->pSelf = ObjHead;
125 ObjHead->rpdesk = pDesk;
126 ObjHead->hTaskWow = (DWORD_PTR)ppi;
127 ppi->UserHandleCount++;
129 *HandleOwner = ppi;
130
131 return ObjHead;
132}
133
136{
138 PDESKTOP pDesk = ObjHead->rpdesk;
139 PPROCESSINFO ppi = (PPROCESSINFO)ObjHead->hTaskWow;
140
141 ppi->UserHandleCount--;
143
144 DesktopHeapFree(pDesk, Object);
145}
146
147_Success_(return!=NULL)
148static PVOID AllocProcMarkObject(
149 _In_ PDESKTOP pDesk,
150 _In_ PTHREADINFO pti,
152 _Out_ PVOID* HandleOwner)
153{
154 PPROCMARKHEAD ObjHead;
155 PPROCESSINFO ppi = pti->ppi;
156
158
159 ASSERT(Size > sizeof(*ObjHead));
160
161 ObjHead = UserHeapAlloc(Size);
162 if (!ObjHead)
163 return NULL;
164
165 RtlZeroMemory(ObjHead, Size);
166
167 ObjHead->ppi = ppi;
169 *HandleOwner = ppi;
170 ppi->UserHandleCount++;
171
172 return ObjHead;
173}
174
177{
178 PPROCESSINFO ppi = ((PPROCMARKHEAD)Object)->ppi;
179
181
182 ppi->UserHandleCount--;
184}
185
186_Success_(return!=NULL)
187static PVOID AllocSysObject(
188 _In_ PDESKTOP pDesk,
189 _In_ PTHREADINFO pti,
191 _Out_ PVOID* ObjectOwner)
192{
194
197
198 ASSERT(Size > sizeof(HEAD));
199
201 if (!Object)
202 return NULL;
203
204 *ObjectOwner = NULL;
205
207 return Object;
208}
209
210_Success_(return!=NULL)
211static PVOID AllocSysObjectCB(
212 _In_ PDESKTOP pDesk,
213 _In_ PTHREADINFO pti,
215 _Out_ PVOID* ObjectOwner)
216{
218
221 ASSERT(Size > sizeof(HEAD));
222
223 /* Allocate the clipboard data */
224 // FIXME: This allocation should be done on the current session pool;
225 // however ReactOS' MM doesn't support session pool yet.
226 Object = ExAllocatePoolZero(/* SESSION_POOL_MASK | */ PagedPool, Size, USERTAG_CLIPBOARD);
227 if (!Object)
228 {
229 ERR("ExAllocatePoolZero failed. No object created.\n");
230 return NULL;
231 }
232
233 *ObjectOwner = NULL;
234 return Object;
235}
236
237static void FreeSysObject(
239{
241}
242
243static void FreeSysObjectCB(
245{
247}
248
249static const struct
250{
255{
256 { NULL, NULL, NULL }, /* TYPE_FREE */
257 { AllocDeskThreadObject, co_UserDestroyWindow, FreeDeskThreadObject }, /* TYPE_WINDOW */
258 { AllocDeskProcObject, UserDestroyMenuObject, FreeDeskProcObject }, /* TYPE_MENU */
259 { AllocProcMarkObject, IntDestroyCurIconObject, FreeCurIconObject }, /* TYPE_CURSOR */
260 { AllocSysObject, /*UserSetWindowPosCleanup*/NULL, FreeSysObject }, /* TYPE_SETWINDOWPOS */
261 { AllocDeskThreadObject, IntRemoveHook, FreeDeskThreadObject }, /* TYPE_HOOK */
262 { AllocSysObjectCB, /*UserClipDataCleanup*/NULL,FreeSysObjectCB }, /* TYPE_CLIPDATA */
263 { AllocDeskProcObject, DestroyCallProc, FreeDeskProcObject }, /* TYPE_CALLPROC */
264 { AllocProcMarkObject, UserDestroyAccelTable, FreeProcMarkObject }, /* TYPE_ACCELTABLE */
265 { NULL, NULL, NULL }, /* TYPE_DDEACCESS */
266 { NULL, NULL, NULL }, /* TYPE_DDECONV */
267 { NULL, NULL, NULL }, /* TYPE_DDEXACT */
268 { AllocSysObject, /*UserMonitorCleanup*/NULL, FreeSysObject }, /* TYPE_MONITOR */
269 { AllocSysObject, /*UserKbdLayoutCleanup*/NULL,FreeSysObject }, /* TYPE_KBDLAYOUT */
270 { AllocSysObject, /*UserKbdFileCleanup*/NULL, FreeSysObject }, /* TYPE_KBDFILE */
271 { AllocThreadObject, IntRemoveEvent, FreeThreadObject }, /* TYPE_WINEVENTHOOK */
272 { AllocSysObject, /*UserTimerCleanup*/NULL, FreeSysObject }, /* TYPE_TIMER */
274 { NULL, NULL, NULL }, /* TYPE_HIDDATA */
275 { NULL, NULL, NULL }, /* TYPE_DEVICEINFO */
276 { NULL, NULL, NULL }, /* TYPE_TOUCHINPUTINFO */
277 { NULL, NULL, NULL }, /* TYPE_GESTUREINFOOBJ */
279
280#if DBG
281
283{
284 int HandleCounts[TYPE_CTYPES];
285 PPROCESSINFO ppiList;
286 int i;
287 PWCHAR TypeNames[] = {L"Free",L"Window",L"Menu", L"CursorIcon", L"SMWP", L"Hook", L"ClipBoardData", L"CallProc",
288 L"Accel", L"DDEaccess", L"DDEconv", L"DDExact", L"Monitor", L"KBDlayout", L"KBDfile",
289 L"Event", L"Timer", L"InputContext", L"HidData", L"DeviceInfo", L"TouchInput",L"GestureInfo"};
290
291 ERR("Total handles count: %lu\n", gpsi->cHandleEntries);
292
293 memset(HandleCounts, 0, sizeof(HandleCounts));
294
295 /* First of all count the number of handles per type */
296 ppiList = gppiList;
297 while (ppiList)
298 {
299 ERR("Process %s (%p) handles count: %d\n\t", ppiList->peProcess->ImageFileName, ppiList->peProcess->UniqueProcessId, ppiList->UserHandleCount);
300
301 for (i = 1 ;i < TYPE_CTYPES; i++)
302 {
303 HandleCounts[i] += ppiList->DbgHandleCount[i];
304
305 DbgPrint("%S: %lu, ", TypeNames[i], ppiList->DbgHandleCount[i]);
306 if (i % 6 == 0)
307 DbgPrint("\n\t");
308 }
309 DbgPrint("\n");
310
311 ppiList = ppiList->ppiNext;
312 }
313
314 /* Print total type counts */
315 ERR("Total handles of the running processes: \n\t");
316 for (i = 1 ;i < TYPE_CTYPES; i++)
317 {
318 DbgPrint("%S: %d, ", TypeNames[i], HandleCounts[i]);
319 if (i % 6 == 0)
320 DbgPrint("\n\t");
321 }
322 DbgPrint("\n");
323
324 /* Now count the handle counts that are allocated from the handle table */
325 memset(HandleCounts, 0, sizeof(HandleCounts));
326 for (i = 0; i < gHandleTable->nb_handles; i++)
327 HandleCounts[gHandleTable->handles[i].type]++;
328
329 ERR("Total handles count allocated: \n\t");
330 for (i = 1 ;i < TYPE_CTYPES; i++)
331 {
332 DbgPrint("%S: %d, ", TypeNames[i], HandleCounts[i]);
333 if (i % 6 == 0)
334 DbgPrint("\n\t");
335 }
336 DbgPrint("\n");
337}
338
339#endif
340
342{
343 unsigned short generation;
344 int index = (LOWORD(handle) - FIRST_USER_HANDLE) >> 1;
345 if (index < 0 || index >= ht->nb_handles)
346 return NULL;
347 if (!ht->handles[index].type)
348 return NULL;
350 if (generation == ht->handles[index].generation || !generation || generation == 0xffff)
351 return &ht->handles[index];
352 return NULL;
353}
354
356{
357 int index = ptr - ht->handles;
358 return (HANDLE)((((INT_PTR)index << 1) + FIRST_USER_HANDLE) + (ptr->generation << 16));
359}
360
362{
364 TRACE("handles used %lu\n", gpsi->cHandleEntries);
365
366 if (ht->freelist)
367 {
368 entry = ht->freelist;
369 ht->freelist = entry->ptr;
370
372 return entry;
373 }
374
375 if (ht->nb_handles >= ht->allocated_handles) /* Need to grow the array */
376 {
377 ERR("Out of user handles! Used -> %lu, NM_Handle -> %d\n", gpsi->cHandleEntries, ht->nb_handles);
378
379#if DBG
381#endif
382
383 return NULL;
384#if 0
385 PUSER_HANDLE_ENTRY new_handles;
386 /* Grow array by 50% (but at minimum 32 entries) */
387 int growth = max( 32, ht->allocated_handles / 2 );
388 int new_size = min( ht->allocated_handles + growth, (LAST_USER_HANDLE-FIRST_USER_HANDLE+1) >> 1 );
389 if (new_size <= ht->allocated_handles)
390 return NULL;
391 if (!(new_handles = UserHeapReAlloc( ht->handles, new_size * sizeof(*ht->handles) )))
392 return NULL;
393 ht->handles = new_handles;
394 ht->allocated_handles = new_size;
395#endif
396 }
397
398 entry = &ht->handles[ht->nb_handles++];
399
400 entry->generation = 1;
401
403
404 return entry;
405}
406
408{
409 ht->freelist = NULL;
410 ht->handles = mem;
411
412 ht->nb_handles = 0;
413 ht->allocated_handles = bytes / sizeof(USER_HANDLE_ENTRY);
414}
415
416
418{
419 void *ret;
420
421#if DBG
422 {
423 PPROCESSINFO ppi;
424 switch (entry->type)
425 {
426 case TYPE_WINDOW:
427 case TYPE_HOOK:
429 ppi = ((PTHREADINFO)entry->pi)->ppi;
430 break;
431 case TYPE_MENU:
432 case TYPE_CURSOR:
433 case TYPE_CALLPROC:
434 case TYPE_ACCELTABLE:
435 ppi = entry->pi;
436 break;
437 default:
438 ppi = NULL;
439 }
440 if (ppi)
441 ppi->DbgHandleCount[entry->type]--;
442 }
443#endif
444
445 /* The slot is about to be reused, so no job may keep a grant on it */
446 if (entry->flags & HANDLEENTRY_GRANTED)
447 IntCleanupGrantedHandle(entry_to_handle(ht, entry));
448
449 ret = entry->ptr;
450 entry->ptr = ht->freelist;
451 entry->type = 0;
452 entry->flags = 0;
453 entry->pi = NULL;
454 ht->freelist = entry;
455
457
458 return ret;
459}
460
461/* allocate a user handle for a given object */
464 _In_ PVOID object,
466 _In_ PVOID HandleOwner)
467{
469 if (!entry)
470 return 0;
471 entry->ptr = object;
472 entry->type = type;
473 entry->flags = 0;
474 entry->pi = HandleOwner;
475 if (++entry->generation >= 0xffff)
476 entry->generation = 1;
477
478 /* We have created a handle, which is a reference! */
479 UserReferenceObject(object);
480
481 return entry_to_handle(ht, entry );
482}
483
484/* return a pointer to a user object from its handle without setting an error */
486{
488
489 ASSERT(ht);
490
491 if (!(entry = handle_to_entry(ht, handle )) || entry->type != type)
492 {
493 return NULL;
494 }
495 return entry->ptr;
496}
497
498/* return a pointer to a user object from its handle */
500{
502
503 ASSERT(ht);
504
505 if (!(entry = handle_to_entry(ht, handle )) || entry->type != type)
506 {
508 return NULL;
509 }
510 return entry->ptr;
511}
512
513
514/* Get the full handle (32bit) for a possibly truncated (16bit) handle */
516{
518
519 if ((ULONG_PTR)handle >> 16)
520 return handle;
521 if (!(entry = handle_to_entry(ht, handle )))
522 return handle;
523 return entry_to_handle( ht, entry );
524}
525
526
527/* Same as get_user_object plus set the handle to the full 32-bit value */
529{
531
532 if (!(entry = handle_to_entry(ht, *handle )) || entry->type != type)
533 return NULL;
535 return entry->ptr;
536}
537
538
539
541{
542 PVOID mem;
543 INT HandleCount = 1024 * 4;
544
545 // FIXME: Don't alloc all at once! Must be mapped into umode also...
547 if (!mem)
548 {
549 ERR("Failed creating handle table\n");
550 return FALSE;
551 }
552
554 if (gHandleTable == NULL)
555 {
557 ERR("Failed creating handle table\n");
558 return FALSE;
559 }
560
561 // FIXME: Make auto growable
563
564 return TRUE;
565}
566
567//
568// New
569//
570PVOID
573 PDESKTOP pDesktop,
574 PTHREADINFO pti,
575 HANDLE* h,
577 ULONG size)
578{
579 HANDLE hi;
581 PVOID ObjectOwner;
582
583 /* Some sanity checks. Other checks will be made in the allocator */
586 ASSERT(ht != NULL);
587
588 /* Allocate the object */
590 Object = ObjectCallbacks[type].ObjectAlloc(pDesktop, pti, size, &ObjectOwner);
591 if (!Object)
592 {
593 ERR("User object allocation failed. Out of memory!\n");
594 return NULL;
595 }
596
597 hi = UserAllocHandle(ht, Object, type, ObjectOwner);
598 if (hi == NULL)
599 {
600 ERR("Out of user handles!\n");
601 ObjectCallbacks[type].ObjectFree(Object);
602 return NULL;
603 }
604
605#if DBG
606 if (pti)
607 pti->ppi->DbgHandleCount[type]++;
608#endif
609
610 /* Give this object its identity. */
611 ((PHEAD)Object)->h = hi;
612
613 /* The caller will get a locked object.
614 * Note: with the reference from the handle, that makes two */
616
617 if (h)
618 *h = hi;
619 return Object;
620}
621
622BOOL
625{
627 PHEAD ObjHead = Object;
628
629 entry = handle_to_entry(gHandleTable, ObjHead->h);
630
631 ASSERT(entry != NULL);
632
633 entry->flags |= HANDLEENTRY_DESTROY;
634
635 if (ObjHead->cLockObj > 1)
636 {
637 entry->flags &= ~HANDLEENTRY_INDESTROY;
638 TRACE("Count %d\n",ObjHead->cLockObj);
639 return FALSE;
640 }
641
642 return TRUE;
643}
644
645BOOL
648{
649 PHEAD ObjHead = Object;
650
651 ASSERT(ObjHead->cLockObj >= 1);
652 ASSERT(ObjHead->cLockObj < 0x10000);
653
654 if (--ObjHead->cLockObj == 0)
655 {
658
659 entry = handle_to_entry(gHandleTable, ObjHead->h);
660
661 ASSERT(entry != NULL);
662 /* The entry should be marked as in deletion */
664
665 type = entry->type;
668
669 /* We can now get rid of everything */
671
672#if 0
673 /* Call the object destructor */
674 ASSERT(ObjectCallbacks[type].ObjectCleanup != NULL);
675 ObjectCallbacks[type].ObjectCleanup(Object);
676#endif
677
678 /* And free it */
680 ObjectCallbacks[type].ObjectFree(Object);
681
682 return TRUE;
683 }
684 return FALSE;
685}
686
687BOOL
690{
692
693 if (!(entry = handle_to_entry( ht, handle )))
694 {
696 return FALSE;
697 }
698
699 /* HANDLEENTRY_GRANTED has to survive for free_user_entry */
701
702 return UserDereferenceObject(entry->ptr);
703}
704
705BOOL
708{
710
711 if (!(entry = handle_to_entry( gHandleTable, h )))
712 {
714 return TRUE;
715 }
716 return (entry->flags & HANDLEENTRY_INDESTROY);
717}
718
719/*
720 * Validates a USER handle that is about to be granted to a job, and marks it
721 * so that freeing it withdraws the grant again. The mark is not cleared on
722 * revoke; it only says the granted lists are worth sweeping.
723 */
724BOOL
727{
729
731 if (entry == NULL)
732 return FALSE;
733
734 entry->flags |= HANDLEENTRY_GRANTED;
735 return TRUE;
736}
737
738BOOL
741{
743
744 if (!body) return FALSE;
745
746 ASSERT( ((PHEAD)body)->cLockObj >= 1);
747 ASSERT( ((PHEAD)body)->cLockObj < 0x10000);
748
750}
751
752VOID
755{
756 PHEAD ObjHead = obj;
757 ASSERT(ObjHead->cLockObj < 0x10000);
758
759 ObjHead->cLockObj++;
760}
761
762PVOID
765{
767
769 if (object)
770 {
771 UserReferenceObject(object);
772 }
773 return object;
774}
775
778{
779 int i;
781 BOOLEAN Ret = TRUE;
782
783 /* Sweep the whole handle table */
784 for (i = 0; i < Table->allocated_handles; i++)
785 {
786 Entry = &Table->handles[i];
787
788 if (Entry->pi != Owner)
789 continue;
790
791 /* Do not destroy if it's already been done */
792 if (Entry->flags & HANDLEENTRY_INDESTROY)
793 continue;
794
795 /* Call destructor */
796 if (!ObjectCallbacks[Entry->type].ObjectDestroy(Entry->ptr))
797 {
798 ERR("Failed destructing object %p, type %u.\n", Entry->ptr, Entry->type);
799 /* Don't return immediately, we must continue destroying the other objects */
800 Ret = FALSE;
801 }
802 }
803
804 return Ret;
805}
806
807/*
808 *
809 * Status
810 * @implemented
811 */
812
813BOOL
817{
818 UINT uType;
819 PPROCESSINFO ppi;
821 BOOL Ret = FALSE;
822
824
826 {
828 goto Exit; // Return FALSE
829 }
830 uType = entry->type;
831 switch (uType)
832 {
833 case TYPE_WINDOW:
835 ppi = ((PTHREADINFO)entry->pi)->ppi;
836 break;
837 case TYPE_MENU:
838 case TYPE_ACCELTABLE:
839 case TYPE_CURSOR:
840 case TYPE_HOOK:
841 case TYPE_CALLPROC:
843 ppi = entry->pi;
844 break;
845 default:
846 ppi = NULL;
847 break;
848 }
849
850 if (!ppi)
851 goto Exit; // Return FALSE
852
853 // Same process job returns TRUE.
854 if (gptiCurrent->ppi->pW32Job == ppi->pW32Job) Ret = TRUE;
855
856Exit:
857 UserLeave();
858 return Ret;
859}
860
862{
863 PVOID pvOld = *ppvObj;
864 *ppvObj = pvNew;
865
866 if (pvOld && pvOld == pvNew)
867 return pvOld;
868
869 if (pvNew)
870 UserReferenceObject(pvNew);
871
872 if (pvOld)
873 {
874 if (UserDereferenceObject(pvOld))
875 pvOld = NULL;
876 }
877
878 return pvOld;
879}
880
882{
883 PVOID pvOld = *ppvObj;
884 *ppvObj = NULL;
885
886 if (pvOld)
887 {
888 if (UserDereferenceObject(pvOld))
889 pvOld = NULL;
890 }
891
892 return pvOld;
893}
#define __inline
Definition: _wctype.cpp:15
unsigned char BOOLEAN
Definition: actypes.h:127
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
#define index(s, c)
Definition: various.h:29
#define ERR(fmt,...)
Definition: precomp.h:57
#define DBG_DEFAULT_CHANNEL(ch)
Definition: debug.h:106
BOOLEAN DestroyCallProc(_Inout_ PVOID Object)
Definition: callproc.c:22
#define STATUS_INVALID_HANDLE
Definition: d3dkmdt.h:40
struct _DESKTOP * PDESKTOP
static __inline PVOID DesktopHeapAlloc(IN PDESKTOP Desktop, IN SIZE_T Bytes)
Definition: desktop.h:206
static __inline BOOL DesktopHeapFree(IN PDESKTOP Desktop, IN PVOID lpMem)
Definition: desktop.h:217
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define APIENTRY
Definition: api.h:79
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
_In_ uint64_t _In_ uint64_t _In_ uint64_t generation
Definition: btrfs.c:2996
#define PagedPool
Definition: env_spec_w32.h:308
size_t const new_size
Definition: expand.cpp:66
unsigned int BOOL
Definition: ntddk_ex.h:94
ASMGENDATA Table[]
Definition: genincdata.c:61
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLuint index
Definition: glext.h:6031
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
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
#define DbgPrint
Definition: hal.h:12
unsigned int UINT
Definition: sysinfo.c:13
static const struct newhuff ht[]
Definition: huffman.h:296
PSERVERINFO gpsi
Definition: imm.c:18
#define LAST_USER_HANDLE
Definition: ntuser.h:11
struct _USER_HANDLE_ENTRY USER_HANDLE_ENTRY
#define HANDLEENTRY_INDESTROY
Definition: ntuser.h:14
struct _PROCMARKHEAD * PPROCMARKHEAD
struct _PROCDESKHEAD * PPROCDESKHEAD
#define HANDLEENTRY_GRANTED
Definition: ntuser.h:17
struct _HEAD * PHEAD
enum _HANDLE_TYPE HANDLE_TYPE
@ TYPE_HOOK
Definition: ntuser.h:48
@ TYPE_CTYPES
Definition: ntuser.h:65
@ TYPE_CALLPROC
Definition: ntuser.h:50
@ TYPE_WINEVENTHOOK
Definition: ntuser.h:58
@ TYPE_CURSOR
Definition: ntuser.h:46
@ TYPE_WINDOW
Definition: ntuser.h:44
@ TYPE_ACCELTABLE
Definition: ntuser.h:51
@ TYPE_MENU
Definition: ntuser.h:45
@ TYPE_SETWINDOWPOS
Definition: ntuser.h:47
@ TYPE_INPUTCONTEXT
Definition: ntuser.h:60
#define HANDLEENTRY_DESTROY
Definition: ntuser.h:13
struct _THRDESKHEAD * PTHRDESKHEAD
struct _THROBJHEAD * PTHROBJHEAD
#define FIRST_USER_HANDLE
Definition: ntuser.h:10
uint32_t entry
Definition: isohybrid.c:63
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
static PVOID ptr
Definition: dispmode.c:27
static PVOID ExAllocatePoolZero(ULONG PoolType, SIZE_T NumberOfBytes, ULONG Tag)
Definition: precomp.h:45
#define min(a, b)
Definition: monoChain.cc:55
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ SaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ OwnerSize PSID Owner
Definition: rtlfuncs.h:1629
#define _Inout_
Definition: no_sal2.h:162
#define _Success_(c)
Definition: no_sal2.h:84
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define FASTCALL
Definition: nt_native.h:50
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
BOOLEAN IntRemoveHook(PVOID Object)
Definition: hook.c:1036
PVOID AllocInputContextObject(_In_ PDESKTOP pDesk, _In_ PTHREADINFO pti, _In_ SIZE_T Size, _Out_ PVOID *HandleOwner)
Definition: ime.c:1517
BOOLEAN UserDestroyInputContext(_In_opt_ PVOID Object)
Definition: ime.c:1576
VOID UserFreeInputContext(_In_opt_ PVOID Object)
Definition: ime.c:1548
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
PTHREADINFO gptiCurrent
Definition: ntuser.c:15
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
struct _THREADINFO * PTHREADINFO
Definition: ntwin32.h:6
struct _PROCESSINFO * PPROCESSINFO
Definition: ntwin32.h:5
void DbgUserDumpHandleTable()
#define LOWORD(l)
Definition: pedump.c:82
#define BOOLEAN
Definition: pedump.c:73
static const void * body(MD5_CTX *ctx, const void *data, unsigned long size)
Definition: md5.c:100
#define memset(x, y, z)
Definition: compat.h:39
Entry
Definition: section.c:5216
static void Exit(void)
Definition: sock.c:1330
#define TRACE(s)
Definition: solgame.cpp:4
Definition: ntuser.h:183
DWORD cLockObj
Definition: ntuser.h:185
HANDLE h
Definition: ntuser.h:184
struct _DESKTOP * rpdesk
Definition: ntuser.h:222
DWORD_PTR hTaskWow
Definition: ntuser.h:221
PVOID pSelf
Definition: ntuser.h:223
PPROCESSINFO ppiNext
Definition: win32.h:263
struct _JOBINFO * pW32Job
Definition: win32.h:277
struct _PROCESSINFO * ppi
Definition: ntuser.h:230
struct _DESKTOP * rpdesk
Definition: ntuser.h:197
PVOID pSelf
Definition: ntuser.h:198
PPROCESSINFO ppi
Definition: win32.h:89
struct _THREADINFO * pti
Definition: ntuser.h:191
Definition: ntuser.h:20
unsigned char type
Definition: ntuser.h:28
PUSER_HANDLE_ENTRY handles
Definition: ntuser.h:35
Definition: mem.c:349
ULONG_PTR cHandleEntries
Definition: ntuser.h:1056
#define TYPE_FREE
Definition: sunlabel.h:176
#define max(a, b)
Definition: svc.c:63
#define DWORD_PTR
Definition: treelist.c:76
int32_t INT_PTR
Definition: typedefs.h:64
void * PVOID
Definition: typedefs.h:50
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
static ULONG HandleCount
Definition: uefidisk.c:67
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2857
static __inline PVOID UserHeapAlloc(SIZE_T Bytes)
Definition: usrheap.h:34
static __inline BOOL UserHeapFree(PVOID lpMem)
Definition: usrheap.h:44
static __inline PVOID UserHeapReAlloc(PVOID lpMem, SIZE_T Bytes)
Definition: usrheap.h:54
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
#define IntDereferenceThreadInfo(pti)
Definition: win32.h:173
#define IntReferenceProcessInfo(ppi)
Definition: win32.h:183
#define IntReferenceThreadInfo(pti)
Definition: win32.h:168
#define IntDereferenceProcessInfo(ppi)
Definition: win32.h:188
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
Definition: error.c:30
BOOLEAN UserDestroyAccelTable(PVOID Object)
Definition: accelerator.c:324
VOID FreeCurIconObject(_In_ PVOID Object)
Definition: cursoricon.c:336
BOOLEAN IntDestroyCurIconObject(_In_ PVOID Object)
Definition: cursoricon.c:317
BOOLEAN IntRemoveEvent(PVOID Object)
Definition: event.c:126
PPROCESSINFO gppiList
Definition: main.c:31
BOOLEAN UserDestroyMenuObject(PVOID Object)
Definition: menu.c:311
static __inline PUSER_HANDLE_ENTRY alloc_user_entry(PUSER_HANDLE_TABLE ht)
Definition: object.c:361
PVOID UserGetObject(PUSER_HANDLE_TABLE ht, HANDLE handle, HANDLE_TYPE type)
Definition: object.c:499
BOOLEAN UserDestroyObjectsForOwner(PUSER_HANDLE_TABLE Table, PVOID Owner)
Definition: object.c:777
BOOL FASTCALL UserMarkObjectDestroy(PVOID Object)
Definition: object.c:624
PVOID FASTCALL UserAssignmentLock(PVOID *ppvObj, PVOID pvNew)
Definition: object.c:861
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:647
PVOID FASTCALL UserReferenceObjectByHandle(HANDLE handle, HANDLE_TYPE type)
Definition: object.c:764
BOOL FASTCALL UserDeleteObject(HANDLE h, HANDLE_TYPE type)
Definition: object.c:740
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13
VOID UserInitHandleTable(PUSER_HANDLE_TABLE ht, PVOID mem, ULONG bytes)
Definition: object.c:407
BOOLEAN(* ObjectDestroy)(PVOID)
Definition: object.c:252
BOOL FASTCALL UserObjectInDestroy(HANDLE h)
Definition: object.c:707
void FreeProcMarkObject(_In_ PVOID Object)
Definition: object.c:175
BOOL FASTCALL UserCreateHandleTable(VOID)
Definition: object.c:540
void * get_user_object_handle(PUSER_HANDLE_TABLE ht, HANDLE *handle, HANDLE_TYPE type)
Definition: object.c:528
static void FreeDeskThreadObject(_In_ PVOID Object)
Definition: object.c:89
HANDLE get_user_full_handle(PUSER_HANDLE_TABLE ht, HANDLE handle)
Definition: object.c:515
HANDLE UserAllocHandle(_Inout_ PUSER_HANDLE_TABLE ht, _In_ PVOID object, _In_ HANDLE_TYPE type, _In_ PVOID HandleOwner)
Definition: object.c:462
PVOID(* ObjectAlloc)(PDESKTOP, PTHREADINFO, SIZE_T, PVOID *)
Definition: object.c:251
PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, PDESKTOP pDesktop, PTHREADINFO pti, HANDLE *h, HANDLE_TYPE type, ULONG size)
Definition: object.c:572
BOOL APIENTRY NtUserValidateHandleSecure(HANDLE handle)
Definition: object.c:815
static void FreeSysObject(_In_ PVOID Object)
Definition: object.c:237
PVOID FASTCALL UserAssignmentUnlock(PVOID *ppvObj)
Definition: object.c:881
void(* ObjectFree)(PVOID)
Definition: object.c:253
static void FreeSysObjectCB(_In_ PVOID Object)
Definition: object.c:243
BOOL FASTCALL UserMarkHandleGranted(HANDLE h)
Definition: object.c:726
static void FreeThreadObject(_In_ PVOID Object)
Definition: object.c:45
static __inline HANDLE entry_to_handle(PUSER_HANDLE_TABLE ht, PUSER_HANDLE_ENTRY ptr)
Definition: object.c:355
BOOL FASTCALL UserFreeHandle(PUSER_HANDLE_TABLE ht, HANDLE handle)
Definition: object.c:689
static __inline void * free_user_entry(PUSER_HANDLE_TABLE ht, PUSER_HANDLE_ENTRY entry)
Definition: object.c:417
PVOID UserGetObjectNoErr(PUSER_HANDLE_TABLE ht, HANDLE handle, HANDLE_TYPE type)
Definition: object.c:485
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:754
PUSER_HANDLE_ENTRY handle_to_entry(PUSER_HANDLE_TABLE ht, HANDLE handle)
Definition: object.c:341
static const struct @5774 ObjectCallbacks[TYPE_CTYPES]
static void FreeDeskProcObject(_In_ PVOID Object)
Definition: object.c:134
#define USERTAG_CLIPBOARD
Definition: tags.h:200
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:21