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.

218 lines
5.3 KiB

  1. ; Copyright (c) Microsoft Corporation. All rights reserved.
  2. [Macros]
  3. ; Generate an api call, passing the name of the variable to use for the return
  4. ; value and the name of the API to call.
  5. ; eg. @CallApi(ApiName, RetVal)
  6. MacroName=CallApi
  7. NumArgs=2
  8. Begin=
  9. @IfApiRet(@MArg(2)=)@MArg(1)(@IfArgs(@ArgList(@ListCol@ArgName@ArgMore(,)))); @NL
  10. End=
  11. ; Expand all parameters into local variables
  12. MacroName=ApiLocals
  13. Begin= @NL
  14. @IfArgs(@ListCol@ArgList(@ArgLocal;))
  15. End=
  16. ; Generate the epilog for a thunked API.
  17. MacroName=ApiEpilog
  18. Begin=
  19. return @IfApiRet(RetVal); @NL @NL @NL
  20. @NL
  21. End=
  22. ; Generate the exit for a thunked API.
  23. MacroName=ApiExit
  24. Begin=
  25. } @NL
  26. End=
  27. MacroName=GenApiThunk
  28. NumArgs=1
  29. Begin=
  30. @NL
  31. @IfApiCode(Header)
  32. @NL
  33. @ApiProlog
  34. // @NL
  35. // Begin: IfApiCode(ApiEntry) @NL
  36. @NL
  37. @IfApiCode(ApiEntry)
  38. @NL
  39. @Indent(
  40. @NL
  41. @IfApiRet(@ApiFnRet RetVal;) @NL
  42. @NL
  43. // @NL
  44. // Begin: ApiLocals @NL
  45. @NL
  46. @ApiLocals
  47. @NL
  48. // @NL
  49. // Begin: Types(Locals) @NL
  50. @NL
  51. @Types(Locals)
  52. @NL
  53. // @NL
  54. // Begin: IfApiCode(Locals) @NL
  55. @IfApiCode(Locals)
  56. @NL
  57. APIPROFILE(@ApiNum); @NL
  58. @NL
  59. // @NL
  60. //Begin: Types(PreCall) @NL
  61. @NL
  62. @Types(PreCall)
  63. @NL
  64. // @NL
  65. // Begin: IfApiCode(PreCall) @NL
  66. @NL
  67. @IfApiCode(PreCall)
  68. @NL
  69. // @NL
  70. // Begin: CallApi(MArg(1), RetVal) @NL
  71. @NL
  72. @CallApi(@MArg(1), RetVal)
  73. @NL
  74. // @NL
  75. // Begin: Types(PostCall) @NL
  76. @NL
  77. @Types(PostCall)
  78. @NL
  79. // @NL
  80. // Begin: ApiCode(PostCall) @NL
  81. @IfApiCode(PostCall)
  82. @NL
  83. @NL
  84. // @NL
  85. // Begin: ApiEpilog @NL
  86. @ApiEpilog
  87. @NL
  88. )
  89. // @NL
  90. // Begin: IfApiCode(ApiExit) @NL
  91. @NL
  92. @IfApiCode(ApiExit)
  93. @NL
  94. //
  95. // Begin: ApiExit @NL
  96. @ApiExit
  97. @NL
  98. @NL
  99. End=
  100. MacroName=GenPlaceHolderThunk
  101. NumArgs=1
  102. Begin=
  103. // @NL
  104. @ApiProlog @NL
  105. // Placeholder Thunk @NL
  106. @Indent(
  107. @IfApiRet(@ApiFnRet RetVal;@NL@NL)
  108. @IfArgs(@ListCol@ArgList(@ArgLocal = (@ArgType)@ArgNameHost;))
  109. APIPROFILE(@ApiNum); @NL
  110. LOGPRINT((TRACELOG, "wh@ApiName(@ApiNum) placeholder: @IfArgs(@ArgList(@ArgName: %x@ArgMore(,)))\n"@IfArgs(, @ArgList((@ArgName)@ArgMore(,))))); @NL
  111. WOWASSERT(FALSE); @NL
  112. @IfApiCode(PreCall)
  113. @CallApi(@MArg(1), RetVal)
  114. @IfApiCode(PostCall)
  115. LOGPRINT((TRACELOG, "wh@ApiName(@ApiNum) end: @IfApiRet(retval: %x)\n"@IfApiRet(,RetVal))); @NL
  116. return @IfApiRet(RetVal); @NL
  117. )
  118. }@NL
  119. @NL
  120. End=
  121. MacroName=GenUnsupportedNtApiThunk
  122. NumArgs=0
  123. Begin=
  124. @ApiProlog @NL
  125. // Unsupported NT Api Thunk @NL
  126. @NL
  127. @Indent(
  128. APIPROFILE(@ApiNum); @NL
  129. LOGPRINT((TRACELOG, "wh@ApiName(@ApiNum) unsupported nt api thunk: @IfArgs(@ArgList(@ArgName: %x@ArgMore(,)))\n"@IfArgs(, @ArgList((@ArgNameHost)@ArgMore(,))))); @NL
  130. WOWASSERT(FALSE); @NL
  131. RtlRaiseStatus(STATUS_NOT_IMPLEMENTED); @NL
  132. return @IfApiRet((@ApiFnRet)0); @NL
  133. )
  134. }@NL
  135. @NL
  136. End=
  137. MacroName=GenDispatchTable
  138. NumArgs=1
  139. Begin=
  140. @NL
  141. ULONG_PTR @MArg(1)JumpTable[] = { @NL
  142. @ApiList(
  143. @Indent(
  144. (ULONG_PTR)wh@ApiName,@NL
  145. )
  146. )
  147. }; @NL
  148. @NL
  149. UCHAR @MArg(1)Number[] = { @NL
  150. @ApiList(
  151. @Indent(
  152. (@ArgSize/4) * ARGSIZE /*@ApiName*/, @NL
  153. )
  154. )
  155. }; @NL
  156. #if !defined(WOW64_DEFAULT_ERROR_ACTION) || !defined(WOW64_DEFAULT_ERROR_PARAM) || !defined(WOW64_API_ERROR_CASES) @NL
  157. #error Thunk must define error handling macros for error handling table. @NL
  158. #endif @NL
  159. WOW64SERVICE_TABLE_DESCRIPTOR @MArg(1) = {@MArg(1)JumpTable, NULL, 1000,@NL
  160. #if defined(_IA64_) @NL
  161. (LONG)0,@NL
  162. #endif @NL
  163. @MArg(1)Number, @NL
  164. WOW64_DEFAULT_ERROR_ACTION, // Defined by thunks to set default action. @NL
  165. WOW64_DEFAULT_ERROR_PARAM, // Defined by thunks to set default action param. @NL
  166. WOW64_API_ERROR_CASES // Defined by thunks to set the default error cases(may be NULL) @NL
  167. }; @NL
  168. @NL
  169. End=
  170. [IFunc]
  171. TemplateName=Thunks
  172. Header=
  173. End=
  174. ApiEntry=
  175. End=
  176. Begin=
  177. @GenApiThunk(@CallNameFromApiName(@ApiName))
  178. End=
  179. ApiExit=
  180. End=
  181. [IFunc]
  182. TemplateName=PlaceHolderThunks
  183. ApiEntry=
  184. End=
  185. Begin=
  186. @GenPlaceHolderThunk
  187. End=
  188. ApiExit=
  189. End=
  190. [Code]
  191. TemplateName=PlaceHolderThunk
  192. Begin=
  193. @GenPlaceHolderThunk(@CallNameFromApiName(@ApiName))
  194. End=
  195. [Code]
  196. TemplateName=Thunk
  197. Begin=
  198. @GenApiThunk(@ApiName)
  199. End=