home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Compilers / digital marsC compier / dm / include / win32 / Wownt16.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-08  |  4.3 KB  |  121 lines

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