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.

197 lines
5.5 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=NtWow64CsrBaseClientConnectToServer
  52. PostCall=
  53. if (!lConnectedToCsr) { @NL
  54. PPEB32 peb32; @NL
  55. lConnectedToCsr = (LONG)TRUE; @NL
  56. // Copy setting from 64Bit PEB to the 32Bit PEB @NL
  57. peb32 = (PPEB32)UlongToPtr(NtCurrentTeb32()->ProcessEnvironmentBlock); @NL
  58. peb32->ReadOnlySharedMemoryBase = PtrToUlong(NtCurrentPeb()->ReadOnlySharedMemoryBase); @NL
  59. peb32->ReadOnlySharedMemoryHeap = PtrToUlong(NtCurrentPeb()->ReadOnlySharedMemoryHeap); @NL
  60. peb32->ReadOnlyStaticServerData = PtrToUlong(NtCurrentPeb()->ReadOnlyStaticServerData); @NL
  61. } @NL
  62. End=
  63. Begin=
  64. @GenApiThunk(@ApiNameSkip(7))
  65. End=
  66. TemplateName=NtWow64CsrBasepNlsSetMultipleUserInfo
  67. PreCall=
  68. cchData = (int)cchDataHost; @NL
  69. End=
  70. Begin=
  71. @GenApiThunk(@ApiNameSkip(7))
  72. End=
  73. TemplateName=DeviceEventWorker
  74. PreCall=
  75. // This was a hack put in for the user mode PNP manager. @NL
  76. // Since the PNP manager is going to be a 64bit process and nobody else @NL
  77. // calls this, we have no need for a complex thunk here. @NL
  78. End=
  79. Begin=
  80. @GenUnsupportedNtApiThunk
  81. End=
  82. TemplateName=CreateConsoleScreenBuffer
  83. Locals=
  84. @Types(Locals,lpScreenBufferData,PCONSOLE_GRAPHICS_BUFFER_INFO)
  85. End=
  86. PreCall=
  87. @Types(PreCall,lpScreenBufferData,PCONSOLE_GRAPHICS_BUFFER_INFO)
  88. End=
  89. PostCall=
  90. @Types(PostCall,lpScreenBufferData,PCONSOLE_GRAPHICS_BUFFER_INFO)
  91. End=
  92. [Code]
  93. TemplateName=whbase
  94. CGenBegin=
  95. @NoFormat(
  96. /*
  97. * genthunk generated code: Do Not Modify
  98. * Thunks for base and NLS functions.
  99. *
  100. */
  101. #define _WOW64DLLAPI_
  102. #include "nt32.h"
  103. #include "cgenhdr.h"
  104. #include <stdio.h>
  105. #include <stdlib.h>
  106. #include <windef.h>
  107. #include <wow64thk.h>
  108. #include <wow64t.h>
  109. ASSERTNAME;
  110. #pragma warning(4:4312) // conversion to type of greater size
  111. #pragma warning(disable:4311) // Disable 'type cast' pointer truncation warning
  112. #if defined(WOW64DOPROFILE)
  113. #define APIPROFILE(apinum) (ptebase[(apinum)].HitCount++)
  114. #else
  115. #define APIPROFILE(apinum)
  116. #endif
  117. )
  118. @NL
  119. #if defined(WOW64DOPROFILE) @NL
  120. WOW64SERVICE_PROFILE_TABLE_ELEMENT ptebase[] = { @Indent( @NL
  121. @ApiList({L"@ApiName", 0, NULL, TRUE}, @NL)
  122. {NULL, 0, NULL, FALSE} @NL
  123. )};@NL
  124. @NL
  125. @NL
  126. WOW64SERVICE_PROFILE_TABLE ptbase = {L"WHBASE", L"BASE?NLS Thunks", ptebase,
  127. (sizeof(ptebase)/sizeof(WOW64SERVICE_PROFILE_TABLE_ELEMENT))-1}; @NL
  128. #endif @NL
  129. @NoFormat(
  130. LONG lConnectedToCsr = (LONG)FALSE;
  131. HANDLE
  132. Wow64GetConsoleHandle(
  133. VOID
  134. )
  135. {
  136. PPEB32 peb32;
  137. PRTL_USER_PROCESS_PARAMETERS32 params;
  138. peb32 = (PPEB32)UlongToPtr(NtCurrentTeb32()->ProcessEnvironmentBlock);
  139. params = (PRTL_USER_PROCESS_PARAMETERS32)UlongToPtr(peb32->ProcessParameters);
  140. return LongToHandle(params->ConsoleHandle);
  141. }
  142. VOID
  143. Wow64SetConsoleHandle(
  144. HANDLE hHandle
  145. )
  146. {
  147. PPEB32 peb32;
  148. PRTL_USER_PROCESS_PARAMETERS32 params;
  149. peb32 = (PPEB32)UlongToPtr(NtCurrentTeb32()->ProcessEnvironmentBlock);
  150. params = (PRTL_USER_PROCESS_PARAMETERS32)UlongToPtr(peb32->ProcessParameters);
  151. params->ConsoleHandle = HandleToUlong(hHandle);
  152. }
  153. VOID
  154. Wow64SetLastError(
  155. DWORD dwError
  156. )
  157. {
  158. NtCurrentTeb32()->LastErrorValue = NtCurrentTeb()->LastErrorValue = (LONG)dwError;
  159. }
  160. )
  161. @Template(Thunks)
  162. @NL
  163. // Each of the CSR NT APIs has different return values for error cases. @NL
  164. // Since no standard exists, a case list is needed.
  165. @NL
  166. // Not used. @NL
  167. #define WOW64_DEFAULT_ERROR_ACTION ApiErrorNTSTATUS @NL
  168. @NL
  169. // This parameter is unused. @NL
  170. #define WOW64_DEFAULT_ERROR_PARAM 0 @NL
  171. @NL
  172. // A case list is needed for these APIs. @NL
  173. extern WOW64_SERVICE_ERROR_CASE sdwhbaseErrorCase[]; @NL
  174. #define WOW64_API_ERROR_CASES sdwhbaseErrorCase @NL @NL
  175. @GenDispatchTable(sdwhbase)
  176. @NL
  177. CGenEnd=