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.

96 lines
2.2 KiB

  1. #pragma once
  2. typedef struct _tagGENERIC_HANDLE_SLOT {
  3. USHORT usGenerationFlag;
  4. ULONG ulRefCount;
  5. union {
  6. PVOID pvThisHandle;
  7. struct _tagGENERIC_HANDLE_SLOT *pNextFree;
  8. };
  9. }
  10. GENERIC_HANDLE_SLOT, *PGENERIC_HANDLE_SLOT;
  11. typedef NTSTATUS (FASTCALL* PFNHANDLETABLEALLOC)(SIZE_T, PVOID*);
  12. typedef NTSTATUS (FASTCALL* PFNHANDLETABLEFREE)(PVOID);
  13. typedef struct _tagGENERIC_HANDLE_TABLE {
  14. ULONG ulFlags;
  15. USHORT usSlotCount;
  16. PGENERIC_HANDLE_SLOT pSlots;
  17. PGENERIC_HANDLE_SLOT pFirstFreeSlot;
  18. USHORT usInlineHandleSlots;
  19. PGENERIC_HANDLE_SLOT pInlineHandleSlots;
  20. PFNHANDLETABLEALLOC pfnAlloc;
  21. PFNHANDLETABLEFREE pfnFree;
  22. }
  23. GENERIC_HANDLE_TABLE, *PGENERIC_HANDLE_TABLE;
  24. NTSTATUS
  25. RtlDereferenceHandle(
  26. PGENERIC_HANDLE_TABLE pHandleTable,
  27. PVOID pvGenericHandle,
  28. PVOID *ppvObjectPointer
  29. );
  30. NTSTATUS
  31. RtlAddRefGenericHandle(
  32. PGENERIC_HANDLE_TABLE pHandleTable,
  33. PVOID pvGenericHandle
  34. );
  35. NTSTATUS
  36. RtlReleaseGenericHandle(
  37. PGENERIC_HANDLE_TABLE pHandleTable,
  38. PVOID pvGenericHandle
  39. );
  40. NTSTATUS
  41. RtlAddGenericHandle(
  42. PGENERIC_HANDLE_TABLE pHandleTable,
  43. ULONG ulFlags,
  44. PVOID pvObject,
  45. PVOID *ppvObjectHandle
  46. );
  47. NTSTATUS
  48. RtlRemoveGenericHandle(
  49. PGENERIC_HANDLE_TABLE pHandleTable,
  50. ULONG ulFlags,
  51. PVOID pvObjectHandle
  52. );
  53. NTSTATUS
  54. RtlCreateGenericHandleTable(
  55. ULONG ulFlags,
  56. PGENERIC_HANDLE_TABLE pCreatedTable,
  57. PFNHANDLETABLEALLOC pfnAlloc,
  58. PFNHANDLETABLEFREE pfnFree,
  59. SIZE_T cbOriginalBlob,
  60. PVOID pvOriginalBlob
  61. );
  62. NTSTATUS
  63. RtlCreateGenericHandleTableInPlace(
  64. ULONG ulFlags,
  65. SIZE_T cbInPlace,
  66. PVOID pvPlace,
  67. PFNHANDLETABLEALLOC pfnAlloc,
  68. PFNHANDLETABLEFREE pfnFree,
  69. PGENERIC_HANDLE_TABLE *ppCreatedTable
  70. );
  71. NTSTATUS
  72. RtlDestroyGenericHandleTable(
  73. PGENERIC_HANDLE_TABLE pTable
  74. );