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.

67 lines
1.5 KiB

  1. /*++
  2. Copyright (c) 1996,1997 Microsoft Corporation
  3. Module Name:
  4. HANDLES.H
  5. Abstract:
  6. Handle Table
  7. Author:
  8. Aaron Ogus (aarono)
  9. Environment:
  10. Win32
  11. Revision History:
  12. Date Author Description
  13. ====== ====== ============================================================
  14. 2/16/98 aarono Original
  15. --*/
  16. #ifndef _MYHANDLE_H_
  17. #define _MYHANDLE_H_
  18. #define LIST_END 0xFFFFFFFF
  19. #define MYHANDLE_DEFAULT_GROWSIZE 16
  20. #define N_UNIQUE_BITS 16
  21. #define UNIQUE_ADD (1<<(32-N_UNIQUE_BITS))
  22. #define CONTEXT_INDEX_MASK (UNIQUE_ADD-1)
  23. #define CONTEXT_UNIQUE_MASK (0xFFFFFFFF-CONTEXT_INDEX_MASK)
  24. typedef struct _myhandle {
  25. LPVOID lpv;
  26. union {
  27. UINT nUnique;
  28. UINT iNext;
  29. };
  30. } MYHANDLE, *LPMYHANDLE;
  31. typedef struct _myhandletable {
  32. UINT nUnique;
  33. UINT nTableSize;
  34. UINT nTableGrowSize;
  35. UINT iNext;
  36. MYHANDLE Table[0];
  37. } MYHANDLETABLE, *LPMYHANDLETABLE;
  38. typedef volatile LPMYHANDLETABLE VOLLPMYHANDLETABLE, *LPVOLLPMYHANDLETABLE;
  39. extern VOLLPMYHANDLETABLE InitHandleTable(UINT nSize, CRITICAL_SECTION *pcs, UINT nGrowSize);
  40. extern VOID FiniHandleTable(LPMYHANDLETABLE lpTable, CRITICAL_SECTION *pcs);
  41. extern DWORD AllocHandleTableEntry(LPVOLLPMYHANDLETABLE lplpTable, CRITICAL_SECTION *pcs, LPVOID lpv);
  42. extern LPVOID ReadHandleTableEntry(LPVOLLPMYHANDLETABLE lplpTable, CRITICAL_SECTION *pcs, UINT handle);
  43. extern HRESULT FreeHandleTableEntry(LPVOLLPMYHANDLETABLE lplpTable, CRITICAL_SECTION *pcs, UINT handle);
  44. #endif