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.

176 lines
5.1 KiB

  1. ;************************************************************************
  2. ;* *
  3. ;* HANDLE.H -- Handle Table Declarations *
  4. ;* *
  5. ;************************************************************************
  6. ;* Author: Gene Apperson *
  7. ;* Copyright: 1991 Microsoft *
  8. ;************************************************************************
  9. ;* File Description: *
  10. ;* *
  11. ;* *
  12. ;************************************************************************
  13. ;* Revision History: *
  14. ;* *
  15. ;* *
  16. ;************************************************************************
  17. ;* ------------------------------------------------------------ *
  18. ;* rghte[x].flFlags bits *
  19. ;* ------------------------------------------------------------ *
  20. fhteInherit EQU 80000000h ;* Is inheritable
  21. fhteDevObj EQU 40000000h ;* Device (file or console)
  22. mhteSpecific EQU 0000FFFFh ; SPECIFIC_RIGHTS_ALL
  23. mhteStandard EQU 001F0000h ; STANDARD_RIGHTS_ALL
  24. mhteSystem EQU 0FF000000h
  25. fhteStdRequire EQU 00f0000h ; STANDARD_RIGHTS_REQUIRED
  26. fhteSynch EQU 0100000h ; SYNCHRONIZE
  27. fhteDevShrRead EQU 00000001h
  28. fhteDevShrWrite EQU 00000002h
  29. fhteDevAccRead EQU 00000020h
  30. fhteDevAttrWrite EQU 00000100h
  31. fhteDevAccWrite EQU 00000110h
  32. fhteDevAccAll EQU 00000130h
  33. fhteDevAccAny EQU 00000000h
  34. fhteDevOverlapped EQU 00001000h
  35. mhteDevAcc EQU 00000130h
  36. mhteDevShr EQU 00000003h
  37. flMaskAll EQU 0FFFFFFFFh
  38. ;*
  39. ;* MapHandle argument values.
  40. ;*
  41. ;* Object type values.
  42. ;*
  43. typSemaphore EQU (1 SHL (typObjShiftAdjust + typObjSemaphore))
  44. typEvent EQU (1 SHL (typObjShiftAdjust + typObjEvent))
  45. typMutex EQU (1 SHL (typObjShiftAdjust + typObjMutex))
  46. typCrst EQU (1 SHL (typObjShiftAdjust + typObjCrst))
  47. typProcess EQU (1 SHL (typObjShiftAdjust + typObjProcess))
  48. typThread EQU (1 SHL (typObjShiftAdjust + typObjThread))
  49. typFile EQU (1 SHL (typObjShiftAdjust + typObjFile))
  50. typIO EQU (1 SHL (typObjShiftAdjust + typObjIO))
  51. typConsole EQU (1 SHL (typObjShiftAdjust + typObjConsole))
  52. typConScreenbuf EQU (1 SHL (typObjShiftAdjust + typObjConScreenbuf))
  53. typMapFile EQU (1 SHL (typObjShiftAdjust + typObjMapFile))
  54. typSerial EQU (1 SHL (typObjShiftAdjust + typObjSerial))
  55. typDevIOCtl EQU (1 SHL (typObjShiftAdjust + typObjDevIOCtl))
  56. typPipe EQU (1 SHL (typObjShiftAdjust + typObjPipe))
  57. typMailslot EQU (1 SHL (typObjShiftAdjust + typObjMailslot))
  58. typToolhelp EQU (1 SHL (typObjShiftAdjust + typObjToolhelp))
  59. typSocket EQU (1 SHL (typObjShiftAdjust + typObjSocket))
  60. typTimer EQU (1 SHL (typObjShiftAdjust + typObjTimer))
  61. typR0ObjExt EQU (1 SHL (typObjShiftAdjust + typObjR0ObjExt))
  62. typAny EQU (NOT (0ffffffffh SHL (1 + typObjShiftAdjust + typObjMaxValid)))
  63. typSTDIN EQU (typFile OR typPipe OR typSocket OR typConsole)
  64. typSTDOUT EQU (typFile OR typPipe OR typSocket OR typConScreenbuf)
  65. typNone EQU 0
  66. typMask EQU typAny
  67. ;*
  68. ;* Boolean flag to MapHandle (snuck inside objType parameter) to prevent the
  69. ;* object from being freed until UnlockObject() is called.
  70. ;*
  71. objLOCK EQU 080000000h
  72. ;* ------------------------------------------------------------ *
  73. ;* *
  74. ;* ------------------------------------------------------------ *
  75. chteInit EQU 16
  76. chteInc EQU 16
  77. hprocCur EQU 07FFFFFFFh
  78. hprocInvalid EQU 0FFFFFFFFh
  79. ;; Handles are derived by left-shifting ihte's by this many bits.
  80. ;; This corresponds to the number of low bits reserved by NT.
  81. IHTETOHANDLESHIFT equ 2
  82. ;; Maximum value for a normal handle (handles above this value
  83. ;; are either global or special.)
  84. ;;
  85. hMaxValid EQU 00FFFFFFh
  86. ihteMaxValid EQU (hMaxValid SHR IHTETOHANDLESHIFT)
  87. HTE STRUCT
  88. flFlags DWORD 0
  89. pobj LPOBJ 0
  90. HTE ENDS
  91. LPHTE TYPEDEF PTR HTE
  92. HTB STRUCT
  93. chteMax DWORD 0
  94. rghte HTE 1 DUP (<>)
  95. HTB ENDS
  96. LPHTB TYPEDEF PTR HTB
  97. ;; Handles are considered global if the high byte is equal to the high byte
  98. ;; of GLOBALHANDLEMASK.
  99. ;;
  100. ;; When handles are converted to ihtes, they are just right-shifted like
  101. ;; any other. That is, if n == IHTETOHANDLESHIFT, global ihtes have 0's
  102. ;; in the top n bits, the high byte of GLOBALHANDLEMASK in the next 8 bits.
  103. ;;
  104. ;; The low n bits of the mask must be zero because those bits are lost
  105. ;; when handles are converted to ihtes.
  106. GLOBALHANDLEMASK equ 0453a4d3ch
  107. .errnz GLOBALHANDLEMASK AND ((1 SHL IHTETOHANDLESHIFT) - 1)
  108. ;* ------------------------------------------------------------ *
  109. ;* Function Prototypes *
  110. ;* ------------------------------------------------------------ *
  111. ; VOID *
  112. MapHandle PROTO KERNENTRY,
  113. :HANDLE,
  114. :DWORD,
  115. :DWORD
  116. ; VOID *
  117. MapHandleWithContext PROTO KERNENTRY,
  118. :LPPDB,
  119. :HANDLE,
  120. :DWORD,
  121. :DWORD
  122. ; LPHTB
  123. PhtbCreate PROTO KERNENTRY,
  124. :LPPDB
  125. ; VOID
  126. CloseProcessHandles PROTO KERNENTRY,
  127. :LPPDB
  128. ; VOID
  129. CloseDOSHandles PROTO KERNENTRY
  130. ; BOOL
  131. FInheritHandles PROTO KERNENTRY,
  132. :LPPDB,
  133. :LPPDB
  134. IFNDEF IS_VXD
  135. ; LONG
  136. FlValidateSecurity PROTO KERNENTRY,
  137. :LPSECURITY_ATTRIBUTES
  138. ENDIF ;; IS_VXD
  139. ; HANDLE
  140. ConvertToGlobalHandle PROTO KERNENTRY,
  141. :HANDLE
  142. ;* ------------------------------------------------------------ *