Source code of Windows XP (NT5)
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.

131 lines
2.2 KiB

  1. /*++
  2. Copyright (c) 1990-1995 Microsoft Corporation
  3. Module Name:
  4. handle.h
  5. Abstract:
  6. This module contains all definitions for the handle table
  7. Author:
  8. 30-Jan-1996 Tue 16:30:15 created -by- Daniel Chou (danielc)
  9. [Environment:]
  10. NT Windows - Common Printer Driver UI DLL
  11. [Notes:]
  12. Revision History:
  13. --*/
  14. #ifndef CPSUI_HANDLE
  15. #define CPSUI_HANDLE
  16. #define HANDLE_TABLE_ID (DWORD)0x436e6144
  17. #define HANDLE_TABLE_PREFIX (WORD)0x4344
  18. #define MAX_HANDLE_TABLE_IDX 0xFFFF
  19. #define HANDLE_2_IDX(h) LOWORD((DWORD)((ULONG_PTR)(h) & 0xFFFFFFFF))
  20. #define HANDLE_2_PREFIX(h) HIWORD((DWORD)((ULONG_PTR)(h) & 0xFFFFFFFF))
  21. #define WORD_2_HANDLE(w) LongToHandle(MAKELONG((w), HANDLE_TABLE_PREFIX))
  22. #define DATATABLE_BLK_COUNT 64
  23. #define DATATABLE_MAX_COUNT (MAX_HANDLE_TABLE_IDX - DATATABLE_BLK_COUNT)
  24. #define NO_THREADID 0xFFFFFFFF
  25. #define MAX_SEM_WAIT 60000
  26. typedef struct _DATATABLE {
  27. PCPSUIPAGE pCPSUIPage;
  28. } DATATABLE, *PDATATABLE;
  29. typedef struct _CPSUIHANDLETABLE {
  30. PDATATABLE pDataTable;
  31. WORD MaxCount;
  32. WORD CurCount;
  33. DWORD ThreadID;
  34. DWORD cWait;
  35. } CPSUIHANDLETABLE, *PCPSUIHANDLETABLE;
  36. #define MK_TLSVALUE(cWait, Idx) (DWORD)MAKELONG(cWait, Idx)
  37. #define TLSVALUE_2_IDX(v) HIWORD(LODWORD(v))
  38. #define TLSVALUE_2_CWAIT(v) LOWORD(LODWORD(v))
  39. //
  40. // Function Prototypes
  41. //
  42. BOOL
  43. LOCK_CPSUI_HANDLETABLE(
  44. VOID
  45. );
  46. BOOL
  47. UNLOCK_CPSUI_HANDLETABLE(
  48. VOID
  49. );
  50. PCPSUIPAGE
  51. HANDLETABLE_GetCPSUIPage(
  52. HANDLE hTable
  53. );
  54. BOOL
  55. HANDLETABLE_UnGetCPSUIPage(
  56. PCPSUIPAGE pCPSUIPage
  57. );
  58. DWORD
  59. HANDLETABLE_LockCPSUIPage(
  60. PCPSUIPAGE pCPSUIPage
  61. );
  62. #define HANDLETABLE_UnLockCPSUIPage HANDLETABLE_UnGetCPSUIPage
  63. BOOL
  64. HANDLETABLE_IsChildPage(
  65. PCPSUIPAGE pChildPage,
  66. PCPSUIPAGE pParentPage
  67. );
  68. PCPSUIPAGE
  69. HANDLETABLE_GetRootPage(
  70. PCPSUIPAGE pCPSUIPage
  71. );
  72. HANDLE
  73. HANDLETABLE_AddCPSUIPage(
  74. PCPSUIPAGE pCPSUIPage
  75. );
  76. BOOL
  77. HANDLETABLE_DeleteHandle(
  78. HANDLE hTable
  79. );
  80. BOOL
  81. HANDLETABLE_Create(
  82. VOID
  83. );
  84. VOID
  85. HANDLETABLE_Destroy(
  86. VOID
  87. );
  88. #endif // CPSUI_HANDLE