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.

190 lines
5.0 KiB

  1. /*++
  2. Copyright (c) 1998-2000 Microsoft Corporation
  3. Module Name:
  4. wow64cpu.h
  5. Abstract:
  6. Public header for wow64.dll
  7. Author:
  8. 24-May-1998 BarryBo
  9. Revision History:
  10. 8-9-99 [askhalid] added CpuNotifyDllLoad and CpuNotifyDllUnload.
  11. --*/
  12. #ifndef _WOW64CPU_INCLUDE
  13. #define _WOW64CPU_INCLUDE
  14. #include <windows.h>
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. //
  19. // Make wow64cpu.dll exports __declspec(dllimport) when this header is included
  20. // by non-wow64cpu components
  21. //
  22. #if !defined(_WOW64CPUAPI_)
  23. #define WOW64CPUAPI DECLSPEC_IMPORT
  24. #else
  25. #define WOW64CPUAPI
  26. #endif
  27. #if !defined(_WOW64CPUDBGAPI_)
  28. #define WOW64CPUDBGAPI DECLSPEC_IMPORT
  29. #else
  30. #define WOW64CPUDBGAPI
  31. #endif
  32. typedef enum {
  33. WOW64_FLUSH_FORCE,
  34. WOW64_FLUSH_FREE,
  35. WOW64_FLUSH_ALLOC,
  36. WOW64_FLUSH_PROTECT
  37. } WOW64_FLUSH_REASON;
  38. //
  39. // Cache manipulation functions and Dll notification
  40. //
  41. WOW64CPUAPI VOID CpuFlushInstructionCache ( HANDLE ProcessHandle, PVOID BaseAddress, ULONG Length, WOW64_FLUSH_REASON Reason);
  42. WOW64CPUAPI VOID CpuNotifyDllLoad ( LPWSTR DllName, PVOID DllBase, ULONG DllSize );
  43. WOW64CPUAPI VOID CpuNotifyDllUnload ( PVOID DllBase );
  44. //
  45. // Init and term APIs
  46. //
  47. WOW64CPUAPI NTSTATUS CpuProcessInit(PWSTR pImageName, PSIZE_T pCpuThreadDataSize);
  48. WOW64CPUAPI NTSTATUS CpuProcessTerm(HANDLE ProcessHandle);
  49. WOW64CPUAPI NTSTATUS CpuThreadInit(PVOID pPerThreadData);
  50. WOW64CPUAPI NTSTATUS CpuThreadTerm(VOID);
  51. //
  52. // Execution
  53. //
  54. WOW64CPUAPI VOID CpuSimulate(VOID);
  55. //
  56. // Exception handling, context manipulation
  57. //
  58. WOW64CPUAPI VOID CpuResetToConsistentState(PEXCEPTION_POINTERS pExecptionPointers);
  59. WOW64CPUAPI ULONG CpuGetStackPointer(VOID);
  60. WOW64CPUAPI VOID CpuSetStackPointer(ULONG Value);
  61. WOW64CPUAPI VOID CpuSetInstructionPointer(ULONG Value);
  62. WOW64CPUAPI VOID CpuResetFloatingPoint(VOID);
  63. WOW64CPUAPI
  64. NTSTATUS
  65. CpuSuspendThread(
  66. IN HANDLE ThreadHandle,
  67. IN HANDLE ProcessHandle,
  68. IN PTEB Teb,
  69. OUT PULONG PreviousSuspendCount OPTIONAL);
  70. WOW64CPUAPI
  71. NTSTATUS
  72. CpuGetContext(
  73. IN HANDLE ThreadHandle,
  74. IN HANDLE ProcessHandle,
  75. IN PTEB Teb,
  76. OUT PCONTEXT32 Context);
  77. WOW64CPUAPI
  78. NTSTATUS
  79. CpuSetContext(
  80. IN HANDLE ThreadHandle,
  81. IN HANDLE ProcessHandle,
  82. IN PTEB Teb,
  83. PCONTEXT32 Context);
  84. WOW64CPUAPI
  85. BOOLEAN
  86. CpuProcessDebugEvent(
  87. IN LPDEBUG_EVENT DebugEvent);
  88. #if defined(DECLARE_CPU_DEBUGGER_INTERFACE)
  89. //
  90. // APIs required to be exported from a CPU debugger extension DLL. The
  91. // extension DLL may also export other NTSD extension exports which
  92. // may be called directly from NTSD. The APIs below are called from
  93. // wow64exts.dll as worker routines to help the common debugging code.
  94. //
  95. // The CPU extension DLL must be named w64cpuex.dll.
  96. //
  97. typedef PVOID (*PWOW64GETCPUDATA)(HANDLE hProcess, HANDLE hThread);
  98. WOW64CPUDBGAPI VOID CpuDbgInitEngapi(PWOW64GETCPUDATA lpGetCpuData);
  99. WOW64CPUDBGAPI BOOL CpuDbgGetRemoteContext(PDEBUG_CLIENT Client, PVOID CpuData);
  100. WOW64CPUDBGAPI BOOL CpuDbgSetRemoteContext(PDEBUG_CLIENT Client); // push local context back remote
  101. WOW64CPUDBGAPI BOOL CpuDbgGetLocalContext(PDEBUG_CLIENT Client, PCONTEXT32 Context); // fetch context from the cache
  102. WOW64CPUDBGAPI BOOL CpuDbgSetLocalContext(PDEBUG_CLIENT Client, PCONTEXT32 Context); // push context to the cache
  103. WOW64CPUDBGAPI VOID CpuDbgFlushInstructionCache(PDEBUG_CLIENT Client, PVOID Addr, DWORD Length);
  104. WOW64CPUDBGAPI VOID CpuDbgFlushInstructionCacheWithHandle(HANDLE Process,PVOID Addr,DWORD Length);
  105. typedef struct tagCpuRegFuncs {
  106. LPCSTR RegName;
  107. void (*SetReg)(ULONG);
  108. ULONG (*GetReg)(VOID);
  109. } CPUREGFUNCS, *PCPUREGFUNCS;
  110. WOW64CPUDBGAPI PCPUREGFUNCS CpuDbgGetRegisterFuncs(void);
  111. #endif // DECLARE_CPU_DEBUGGER_INTERFACE
  112. #if defined(WOW64_HISTORY)
  113. //
  114. // The service history is enabled via a key in the registry.
  115. //
  116. // The key is in HKLM, and there are subkeys for enabling (1)
  117. //
  118. // No subkey area and/or no enable key means don't use the binary translator.
  119. //
  120. // Individual apps can be listed here with a DWORD subkey. A
  121. // value of 1 says use history, and a value of 0 says don't. No value says
  122. // use the global enable/disable to decide
  123. //
  124. //
  125. //
  126. #define CPUHISTORY_SUBKEY L"Software\\Microsoft\\Wow64\\ServiceHistory"
  127. #define CPUHISTORY_MACHINE_SUBKEY L"\\Registry\\Machine\\Software\\Microsoft\\Wow64\\ServiceHistory"
  128. #define CPUHISTORY_ENABLE L"Enable"
  129. #define CPUHISTORY_SIZE L"Size"
  130. #define CPUHISTORY_MIN_SIZE 5
  131. //
  132. // Args are spelled out this way so the dt command in the debugger will show
  133. // all args
  134. //
  135. typedef struct _Wow64Service_Buf {
  136. DWORD Api;
  137. DWORD RetAddr;
  138. DWORD Arg0;
  139. DWORD Arg1;
  140. DWORD Arg2;
  141. DWORD Arg3;
  142. } WOW64SERVICE_BUF, *PWOW64SERVICE_BUF;
  143. extern ULONG HistoryLength;
  144. #endif
  145. #ifdef __cplusplus
  146. }
  147. #endif
  148. #endif //_WOW64CPU_INCLUDE