Platform SDK: DLLs, Processes, and Threads

WOWCallback16Ex

Use the WOWCallback16Ex function in 32-bit code called from 16-bit code (through generic thunks) to call back to the 16-bit side (generic callback).

BOOL WINAPI WOWCallback16Ex(
  DWORD vpfn16,      // pointer to callback function
  DWORD dwFlags,     // flags
  DWORD cbArgs,      // byte count of arguments for callback
  PVOID pArgs,       // arguments for callback function
  PDWORD pdwRetCode  // callback function return code
);

Parameters

vpfn16
[in] A 16:16 pointer to 16-bit callback routine, passed from the 16-bit side.
dwFlags
[in] Specifies the calling convention. This parameter can be one of the following values.
Value Description
WCB16_CDECL Calls a _cdecl callback routine.
WCB16_PASCAL Calls a _pascal callback routine (default).

cbArgs
[in] Count of bytes in arguments (used to properly clean the 16-bit stack).
pArgs
[in] Arguments for the callback routine.
pdwRetCode
[out] Receives the return code from the callback routine.

Return Values

If cbArgs is larger than the WCB16_MAX_ARGS bytes that the system supports, the return value is FALSE and the GetLastError function returns the ERROR_INVALID_PARAMETER value. Otherwise, the return value is TRUE and the DWORD pointed to by pdwRetCode contains the return code from the callback routine. If the callback routine returns a WORD type instead of a DWORD type, the upper 16 bits of the return code are undefined and should be ignored by using LOWORD(dwRetCode).

Remarks

WOWCallback16Ex allows any combination of arguments up to WCB16_MAX_CBARGS bytes total to be passed to the 16-bit callback routine. Regardless of the value of cbArgs, WCB16_MAX_CBARGS bytes will always be copied from pArgs to the 16-bit stack. If pArgs is less than WCB16_MAX_CBARGS bytes from the end of a page and the next page is inaccessible, WOWCallback16Ex will incur an access violation.

The arguments pointed to by pArgs must be in the correct order for the callback routine's calling convention. For example, to call a Pascal routine, place the arguments in the pArgs array in reverse order, with the least significant word first for DWORD types and offset first for FAR pointers.

When you call a _cdecl routine, place the arguments in the pArgs array in the order listed in the function prototype with the least significant word first for DWORD types and offset first for FAR pointers.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Wownt32.h.
  Library: Included as a resource in Wow32.dll.

See Also

Generic Thunks Overview, 32-bit Generic Thunk Functions, LOWORD