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