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.

217 lines
5.6 KiB

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;
  3. ;; Copyright (c) 1998 Microsoft Corporation
  4. ;;
  5. ;; Module Name:
  6. ;;
  7. ;; whbase.tpl
  8. ;;
  9. ;; Abstract:
  10. ;;
  11. ;; This template defines the thunks for the base and NLS api set.
  12. ;; On 32-bit NT, these APIs don't exist - equivalent code calls
  13. ;; CSRSS via LPC.
  14. ;;
  15. ;; Author:
  16. ;;
  17. ;; 6-Oct-98 mzoran
  18. ;;
  19. ;; Revision History:
  20. ;;
  21. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  22. [Macros]
  23. MacroName=CallNameFromApiName
  24. NumArgs=1
  25. Begin=
  26. @ApiName
  27. End=
  28. [EFunc]
  29. TemplateName=NtWow64CsrBasepSoundSentryNotification
  30. Also=NtWow64CsrBasepRefreshIniFileMapping
  31. Also=NtWow64CsrBasepDefineDosDevice
  32. Also=NtWow64CsrBasepGetTempFile
  33. Also=NtWow64CsrBasepCreateProcess
  34. Also=NtWow64CsrBasepExitProcess
  35. Also=NtWow64CsrBasepSetProcessShutdownParam
  36. Also=NtWow64CsrBasepGetProcessShutdownParam
  37. Also=NtWow64CsrBasepSetTermsrvAppInstallMode
  38. Also=NtWow64CsrBasepSetClientTimeZoneInformation
  39. Also=NtWow64CsrBasepCreateThread
  40. Also=NtWow64CsrBasepDebugProcess
  41. Also=NtWow64CsrBasepNlsSetUserInfo
  42. Also=NtWow64CsrBasepNlsPreserveSection
  43. Also=NtWow64CsrBasepNlsCreateSection
  44. Also=NtWow64CsrBasepDebugProcessStop
  45. Also=NtWow64CsrBasepCreateActCtx
  46. Also=NtWow64CsrBasepNlsUpdateCacheCount
  47. Also=NtWow64CsrBasepNlsGetUserInfo
  48. Begin=
  49. @GenApiThunk(@ApiNameSkip(7))
  50. End=
  51. TemplateName=NtWow64CsrBaseCheckRunApp
  52. Begin=
  53. @GenApiThunk(@ApiNameSkip(10))
  54. End=
  55. TemplateName=NtWow64CsrBaseClientConnectToServer
  56. PostCall=
  57. if (!lConnectedToCsr) { @NL
  58. PPEB32 peb32; @NL
  59. lConnectedToCsr = (LONG)TRUE; @NL
  60. // Copy setting from 64Bit PEB to the 32Bit PEB @NL
  61. peb32 = (PPEB32)UlongToPtr(NtCurrentTeb32()->ProcessEnvironmentBlock); @NL
  62. peb32->ReadOnlySharedMemoryBase = PtrToUlong(NtCurrentPeb()->ReadOnlySharedMemoryBase); @NL
  63. peb32->ReadOnlySharedMemoryHeap = PtrToUlong(NtCurrentPeb()->ReadOnlySharedMemoryHeap); @NL
  64. peb32->ReadOnlyStaticServerData = PtrToUlong(NtCurrentPeb()->ReadOnlyStaticServerData); @NL
  65. } @NL
  66. End=
  67. Begin=
  68. @GenApiThunk(@ApiNameSkip(7))
  69. End=
  70. TemplateName=NtWow64CsrBasepNlsSetMultipleUserInfo
  71. PreCall=
  72. cchData = (int)cchDataHost; @NL
  73. End=
  74. Begin=
  75. @GenApiThunk(@ApiNameSkip(7))
  76. End=
  77. TemplateName=DeviceEventWorker
  78. PreCall=
  79. // This was a hack put in for the user mode PNP manager. @NL
  80. // Since the PNP manager is going to be a 64bit process and nobody else @NL
  81. // calls this, we have no need for a complex thunk here. @NL
  82. End=
  83. Begin=
  84. @GenUnsupportedNtApiThunk
  85. End=
  86. TemplateName=CreateConsoleScreenBuffer
  87. Locals=
  88. @Types(Locals,lpScreenBufferData,PCONSOLE_GRAPHICS_BUFFER_INFO)
  89. End=
  90. PreCall=
  91. @Types(PreCall,lpScreenBufferData,PCONSOLE_GRAPHICS_BUFFER_INFO)
  92. End=
  93. PostCall=
  94. @Types(PostCall,lpScreenBufferData,PCONSOLE_GRAPHICS_BUFFER_INFO)
  95. End=
  96. [Code]
  97. TemplateName=whbase
  98. CGenBegin=
  99. @NoFormat(
  100. /*
  101. * genthunk generated code: Do Not Modify
  102. * Thunks for base and NLS functions.
  103. *
  104. */
  105. #define _WOW64DLLAPI_
  106. #include "nt32.h"
  107. #include "cgenhdr.h"
  108. #include <stdio.h>
  109. #include <stdlib.h>
  110. #include <windef.h>
  111. #include <ntosdef.h>
  112. #include <procpowr.h>
  113. #if defined(_X86_)
  114. #include <v86emul.h>
  115. #include <i386.h>
  116. #elif defined(_AMD64_)
  117. #include <amd64.h>
  118. #elif defined(_IA64_)
  119. #include <v86emul.h>
  120. #include <ia64.h>
  121. #else
  122. #error "No Target Architecture"
  123. #endif
  124. #include <arc.h>
  125. #include <ke.h>
  126. #include <wow64thk.h>
  127. #include <wow64t.h>
  128. ASSERTNAME;
  129. #pragma warning(4:4312) // conversion to type of greater size
  130. #pragma warning(disable:4311) // Disable 'type cast' pointer truncation warning
  131. #if defined(WOW64DOPROFILE)
  132. #define APIPROFILE(apinum) (ptebase[(apinum)].HitCount++)
  133. #else
  134. #define APIPROFILE(apinum)
  135. #endif
  136. )
  137. @NL
  138. #if defined(WOW64DOPROFILE) @NL
  139. WOW64SERVICE_PROFILE_TABLE_ELEMENT ptebase[] = { @Indent( @NL
  140. @ApiList({L"@ApiName", 0, NULL, TRUE}, @NL)
  141. {NULL, 0, NULL, FALSE} @NL
  142. )};@NL
  143. @NL
  144. @NL
  145. WOW64SERVICE_PROFILE_TABLE ptbase = {L"WHBASE", L"BASE?NLS Thunks", ptebase,
  146. (sizeof(ptebase)/sizeof(WOW64SERVICE_PROFILE_TABLE_ELEMENT))-1}; @NL
  147. #endif @NL
  148. @NoFormat(
  149. LONG lConnectedToCsr = (LONG)FALSE;
  150. HANDLE
  151. Wow64GetConsoleHandle(
  152. VOID
  153. )
  154. {
  155. PPEB32 peb32;
  156. PRTL_USER_PROCESS_PARAMETERS32 params;
  157. peb32 = (PPEB32)UlongToPtr(NtCurrentTeb32()->ProcessEnvironmentBlock);
  158. params = (PRTL_USER_PROCESS_PARAMETERS32)UlongToPtr(peb32->ProcessParameters);
  159. return LongToHandle(params->ConsoleHandle);
  160. }
  161. VOID
  162. Wow64SetConsoleHandle(
  163. HANDLE hHandle
  164. )
  165. {
  166. PPEB32 peb32;
  167. PRTL_USER_PROCESS_PARAMETERS32 params;
  168. peb32 = (PPEB32)UlongToPtr(NtCurrentTeb32()->ProcessEnvironmentBlock);
  169. params = (PRTL_USER_PROCESS_PARAMETERS32)UlongToPtr(peb32->ProcessParameters);
  170. params->ConsoleHandle = HandleToUlong(hHandle);
  171. }
  172. VOID
  173. Wow64SetLastError(
  174. DWORD dwError
  175. )
  176. {
  177. NtCurrentTeb32()->LastErrorValue = NtCurrentTeb()->LastErrorValue = (LONG)dwError;
  178. }
  179. )
  180. @Template(Thunks)
  181. @NL
  182. // Each of the CSR NT APIs has different return values for error cases. @NL
  183. // Since no standard exists, a case list is needed.
  184. @NL
  185. // Not used. @NL
  186. #define WOW64_DEFAULT_ERROR_ACTION ApiErrorNTSTATUS @NL
  187. @NL
  188. // This parameter is unused. @NL
  189. #define WOW64_DEFAULT_ERROR_PARAM 0 @NL
  190. @NL
  191. // A case list is needed for these APIs. @NL
  192. extern WOW64_SERVICE_ERROR_CASE sdwhbaseErrorCase[]; @NL
  193. #define WOW64_API_ERROR_CASES sdwhbaseErrorCase @NL @NL
  194. @GenDispatchTable(sdwhbase)
  195. @NL
  196. CGenEnd=