Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
999 B

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name: hndlmgr.hxx
  4. Abstract:
  5. Interfaces to manage a heap of handles with a free list.
  6. All methods assume caller has serialized concurrent access.
  7. Author:
  8. Rajeev Dujari (rajeevd) 08-Nov-96
  9. Revision History:
  10. --*/
  11. struct HNDLHEAP
  12. {
  13. DWORD_PTR dwNumHandles; // current number of handles in array
  14. DWORD dwNumInUse; // number of handles in use
  15. DWORD_PTR dwMaxHandles; // lowest value returned by allocator
  16. DWORD_PTR dwFirstFree; // index of first free element in array
  17. LPVOID pvHandles[1]; // array of handle values
  18. };
  19. class HNDLMGR
  20. {
  21. HNDLHEAP* pHeap;
  22. BOOL IsValidOffset (DWORD_PTR dwp);
  23. public:
  24. HNDLMGR() {pHeap = NULL;}
  25. void Destroy (void);
  26. BOOL InUse(void) {return pHeap && pHeap->dwNumInUse;}
  27. HANDLE Alloc (DWORD cbAlloc);
  28. LPVOID Map (HANDLE h);
  29. BOOL Free (HANDLE h);
  30. VOID InvalidateAll();
  31. };