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.

134 lines
4.4 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) 1995-1999, Microsoft Corporation
  3. Module Name:
  4. wownt16.h
  5. Abstract:
  6. Procedure declarations for functions in WOW32.DLL callable by
  7. 3rd-party 16-bit thunking code.
  8. --*/
  9. #ifndef _WOWNT16_
  10. #define _WOWNT16_
  11. #if defined(_MSC_VER)
  12. #if _MSC_VER > 1000
  13. #pragma once
  14. #endif
  15. #endif
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. //
  20. // 16:16 -> 0:32 Pointer translation.
  21. //
  22. // GetVDMPointer32W will convert the passed in 16-bit address
  23. // to the equivalent 32-bit flat pointer. The upper 16 bits
  24. // of the address are treated according to the value passed in
  25. // fMode: if fMode = 1, then the hiword of vp is used as a
  26. // protected mode selector. Otherwise it is used as a real mode
  27. // segment value.
  28. // The lower 16 bits are treated as the offset.
  29. //
  30. // The return value is 0 if the selector is invalid.
  31. //
  32. // NOTE: Limit checking is not performed in the retail build
  33. // of Windows NT. It is performed in the checked (debug) build
  34. // of WOW32.DLL, which will cause 0 to be returned when the
  35. // limit is exceeded by the supplied offset.
  36. //
  37. DWORD FAR PASCAL GetVDMPointer32W(LPVOID vp, UINT fMode);
  38. //
  39. // Win32 module management.
  40. //
  41. // The following routines accept parameters that correspond directly
  42. // to the respective Win32 API function calls that they invoke. Refer
  43. // to the Win32 reference documentation for more detail.
  44. DWORD FAR PASCAL LoadLibraryEx32W(LPCSTR lpszLibFile, DWORD hFile, DWORD dwFlags);
  45. DWORD FAR PASCAL GetProcAddress32W(DWORD hModule, LPCSTR lpszProc);
  46. DWORD FAR PASCAL FreeLibrary32W(DWORD hLibModule);
  47. //
  48. // Generic Thunk Routine:
  49. //
  50. // CallProc32W
  51. //
  52. // Transitions to 32 bits and calls specified routine
  53. //
  54. // This routine can pass a variable number of arguments, up to 32, to the
  55. // target 32-bit routine. These arguments are given to CallProc32W following
  56. // the 3 required parameters.
  57. //
  58. // DWORD cParams - Number of optional DWORD parameters (0-32)
  59. //
  60. // LPVOID fAddressConvert - Bit Field, for 16:16 address Convertion. The
  61. // optional parameters can be automatically converted
  62. // from a 16:16 address format to flat by specifying
  63. // a 1 bit in the corresponding position in this mask.
  64. // eg (bit 1 means convert parameter 1 from 16:16
  65. // to flat address before calling routine)
  66. //
  67. // DWORD lpProcAddress - 32 bit native address to call (use LoadLibraryEx32W
  68. // and GetProcAddress32W to get this address).
  69. //
  70. // Returns:
  71. // What ever the API returned on 32 bit side in AX:DX
  72. //
  73. // Error Returns:
  74. // AX = 0, more than 32 parameters.
  75. //
  76. //
  77. // The function prototype must be declared by the application source code
  78. // in the following format:
  79. //
  80. // DWORD FAR PASCAL CallProc32W( DWORD p1, ... , DWORD lpProcAddress,
  81. // DWORD fAddressConvert, DWORD cParams);
  82. //
  83. // where the value in cParams must match the actual number of optional
  84. // parameters (p1-pn) given AND the "DWORD p1, ..." must be replaced by
  85. // the correct number of parameters being passed. For example, passing 3
  86. // parameter would simply require the removal of the ... and it insertion of
  87. // "DWORD p2, DWORD p3" instead. The fAddressConvert parameter uses bit 1
  88. // for the last parameter (p3 in our example), with bit 2 for the next to last,
  89. // etc.
  90. //
  91. // Generic Thunk Routine:
  92. //
  93. // CallProcEx32W
  94. //
  95. // Transitions to 32 bits and calls specified routine
  96. //
  97. // Similar to the CallProc32W function, the CallProcEx32W is an equivalent
  98. // function that is C calling convention and allows easier and more flexible
  99. // prototyping. See the prototype below. The fAddressConvert parameter uses
  100. // bit 1 for the 1st parameter, bit 2 for the 2nd parameter, etc.
  101. //
  102. // Both CallProc32W and CallProcEx32W accept a flag OR'd with the parameter
  103. // count to indicate the calling convention of the function in 32 bits.
  104. // For example, to call a cdecl function in 32-bits with 1 parameter, it would
  105. // look like this:
  106. //
  107. // dwResult = CallProcEx32W( CPEX_DEST_CDECL | 1, 0, dwfn32, p1 );
  108. //
  109. DWORD FAR CDECL CallProcEx32W( DWORD, DWORD, DWORD, ... );
  110. #define CPEX_DEST_STDCALL 0x00000000L
  111. #define CPEX_DEST_CDECL 0x80000000L
  112. #ifdef __cplusplus
  113. }
  114. #endif
  115. #endif /* !_WOWNT16_ */