Platform SDK: DLLs, Processes, and Threads

CallProcEx32W

Use the CallProcEx32W function in 16-bit code to call an entry-point function in a Win32 DLL.

DWORD FAR CallProcEx32W(
  DWORD nParams,          // number of parameters passed
  DWORD fAddressConvert,  // bit mask
  DWORD lpProcAddress,    // the DLL function to be called
  DWORD param1            // parameter for DLL function
  ...                     // up to 32 function parameters
);

Parameters

nParams
[in] Number of DWORD parameters to be passed to the DLL function (param1 through paramN). For functions that take no parameters, this parameter will be zero. You can also specify the calling convention by using the OR operator to combine this value with one of the following values.
Value Meaning
CPEX_DEST_STDCALL The function uses the standard-call calling convention. This is the default.
CPEX_DEST_CDECL The function uses the C calling convention.

fAddressConvert
[in] Bit mask representing which parameters will be treated as 16:16 pointers and translated into flat linear pointers before being passed to the 32-bit procedure. The lowest bit in the mask represents the first parameter specified (param1), the second lowest bit represents the second to the last parameter specified (param2), and so on, so that the highest bit in the mask represents paramN.
lpProcAddress
[in] A value corresponding to the procedure to be called, which is returned by the GetProcAddress32W function.
param1 through param32
[in] Parameters for the 32-bit procedure represented by lpProcAddress

Return Values

Returns the return value from the 32-bit entry-point function represented by lpProcAddress. The return value can also be zero under the following conditions:

Remarks

CallProcEx32W does not automatically fix global memory handles that are translated to 0:32 pointers. Therefore, you must call the GlobalFix or GlobalWire function on the handle first and GlobalUnfix and GlobalUnwire afterward.

Windows 95/98: Global compaction can move memory blocks at any time while the current thread is executing 32-bit code. Because of this, not fixing segments before calling the target function works in Windows NT/Windows 2000, but may cause race conditions in Windows 95 or Windows 98.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Wownt16.h.

See Also

Generic Thunks Overview, 16-bit Generic Thunk Functions, GetProcAddress32W