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.

162 lines
4.9 KiB

  1. /*++
  2. Copyright (c) 1998-2000 Microsoft Corporation
  3. Module Name:
  4. ia64bt.h
  5. Abstract:
  6. Header for calling IA32 Execution layer if it exists
  7. Author:
  8. 22-Aug-2000 v-cspira (charles spirakis)
  9. --*/
  10. #ifndef _BINTRANS_INCLUDE
  11. #define _BINTRANS_INCLUDE
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. //
  16. // Create the typedefs for the functions we can import from the IA32 Execution
  17. // layer. These functions are duplicates of the wow64cpu export list for both
  18. // what they do and the parameters they take. Any changes to the wow64cpu
  19. // list should also update these typedefs
  20. //
  21. //
  22. // Cache manipulation functions and Dll notification
  23. //
  24. typedef VOID (*PFNCPUFLUSHINSTRUCTIONCACHE)( HANDLE ProcessHandle, PVOID BaseAddress, ULONG Length, WOW64_FLUSH_REASON Reason );
  25. typedef VOID (*PFNCPUNOTIFYDLLLOAD)( LPWSTR DllName, PVOID DllBase, ULONG DllSize );
  26. typedef VOID (*PFNCPUNOTIFYDLLUNLOAD)( PVOID DllBase );
  27. //
  28. // Init and term APIs
  29. //
  30. typedef NTSTATUS (*PFNCPUPROCESSINIT)(PWSTR pImageName, PSIZE_T pCpuThreadDataSize);
  31. typedef NTSTATUS (*PFNCPUPROCESSTERM)(HANDLE ProcessHandle);
  32. typedef NTSTATUS (*PFNCPUTHREADINIT)(PVOID pPerThreadData);
  33. typedef NTSTATUS (*PFNCPUTHREADTERM)(VOID);
  34. //
  35. // Execution
  36. //
  37. typedef VOID (*PFNCPUSIMULATE)(VOID);
  38. //
  39. // Exception handling, context manipulation
  40. //
  41. typedef VOID (*PFNCPURESETTOCONSISTENTSTATE)(PEXCEPTION_POINTERS pExecptionPointers);
  42. typedef ULONG (*PFNCPUGETSTACKPOINTER)(VOID);
  43. typedef VOID (*PFNCPUSETSTACKPOINTER)(ULONG Value);
  44. typedef VOID (*PFNCPUSETINSTRUCTIONPOINTER)(ULONG Value);
  45. typedef VOID (*PFNCPUSETFLOATINGPOINT)(VOID);
  46. typedef NTSTATUS (*PFNCPUSUSPENDTHREAD)( IN HANDLE ThreadHandle, IN HANDLE ProcessHandle, IN PTEB Teb, OUT PULONG PreviousSuspendCount OPTIONAL);
  47. typedef NTSTATUS (*PFNCPUGETCONTEXT)( IN HANDLE ThreadHandle, IN HANDLE ProcessHandle, IN PTEB Teb, OUT PCONTEXT32 Context);
  48. typedef NTSTATUS (*PFNCPUSETCONTEXT)( IN HANDLE ThreadHandle, IN HANDLE ProcessHandle, IN PTEB Teb, PCONTEXT32 Context);
  49. typedef BOOLEAN (*PFNCPUPROCESSDEBUGEVENT)(IN LPDEBUG_EVENT DebugEvent);
  50. //
  51. // Need the entry point names as well
  52. // This is what needs to be exported from the binary translation dll
  53. // The LdrGetProcedureAddress() uses Ansi, so these are ansi too
  54. //
  55. // NOTE: the order of these strings must match the order
  56. // of the corresponding functions in the _bintrans structure below
  57. //
  58. PUCHAR BtImportList[] = {
  59. "BTCpuProcessInit",
  60. "BTCpuProcessTerm",
  61. "BTCpuThreadInit",
  62. "BTCpuThreadTerm",
  63. "BTCpuSimulate",
  64. "BTCpuGetStackPointer",
  65. "BTCpuSetStackPointer",
  66. "BTCpuSetInstructionPointer",
  67. "BTCpuResetFloatingPoint",
  68. "BTCpuSuspendThread",
  69. "BTCpuGetContext",
  70. "BTCpuSetContext",
  71. "BTCpuResetToConsistentState",
  72. "BTCpuFlushInstructionCache",
  73. "BTCpuNotifyDllLoad",
  74. "BTCpuNotifyDllUnload",
  75. "BTCpuProcessDebugEvent"
  76. };
  77. //
  78. // NOTE: The order of entries in this structure MUST match the
  79. // order of entries listed above. This structure gets cast
  80. // into a PVOID struction to be filled in and we iterate though the
  81. // names above to do it...
  82. //
  83. typedef struct _bintrans {
  84. PFNCPUPROCESSINIT BtProcessInit;
  85. PFNCPUPROCESSTERM BtProcessTerm;
  86. PFNCPUTHREADINIT BtThreadInit;
  87. PFNCPUTHREADTERM BtThreadTerm;
  88. PFNCPUSIMULATE BtSimulate;
  89. PFNCPUGETSTACKPOINTER BtGetStack;
  90. PFNCPUSETSTACKPOINTER BtSetStack;
  91. PFNCPUSETINSTRUCTIONPOINTER BtSetEip;
  92. PFNCPUSETFLOATINGPOINT BtResetFP;
  93. PFNCPUSUSPENDTHREAD BtSuspend;
  94. PFNCPUGETCONTEXT BtGetContext;
  95. PFNCPUSETCONTEXT BtSetContext;
  96. PFNCPURESETTOCONSISTENTSTATE BtReset;
  97. PFNCPUFLUSHINSTRUCTIONCACHE BtFlush;
  98. PFNCPUNOTIFYDLLLOAD BtDllLoad;
  99. PFNCPUNOTIFYDLLUNLOAD BtDllUnload;
  100. PFNCPUPROCESSDEBUGEVENT BtProcessDebugEvent;
  101. } BINTRANS;
  102. //
  103. // The binary translator is enabled by a key in the registry
  104. // The key is in HKLM, and there are subkeys for enabling (1)
  105. //
  106. // No subkey area and/or no enable key means don't use the binary translator.
  107. //
  108. // The path must be specified and is used to load the dll. Thus, the dll can
  109. // actually have any name as long as the path is right and the export list
  110. // is correct.
  111. //
  112. // Individual apps can be listed here with a DWORD subkey. A
  113. // value of 1 says use btrans, and a value of 0 says don't. No value says
  114. // use the global enable/disable to decide
  115. //
  116. //
  117. //
  118. #define BTKEY_SUBKEY L"Software\\Microsoft\\Wow64\\IA32Exec"
  119. #define BTKEY_MACHINE_SUBKEY L"\\Registry\\Machine\\Software\\Microsoft\\Wow64\\IA32Exec"
  120. #define BTKEY_ENABLE L"Enable"
  121. #define BTKEY_PATH L"Path"
  122. #ifdef __cplusplus
  123. }
  124. #endif
  125. #endif //_BINTRANS_INCLUDE