Sample Thunk Scripts

Many functions have pointers in their parameter lists. Some pointers are used for input only, some are used for output only, and some are used for both input and output. For example, the following function takes a pointer to an input string, updates a second string, and produces a third string as output:

BOOL WINAPI ThunkIt(LPSTR lpstrInput, LPSTR lpstrInOut, 
    LPSTR lpstrOutput);
 

The corresponding thunk script for this function follows.

enablemapdirect1632=true;

typedef char *LPSTR;
 
BOOL ThunkIt(LPSTR lpstrInput, LPSTR lpstrInOut, LPSTR lpstrOutput) 
{ 
    lpstrInput = input;   // Optional, as input is the default. 
    lpstrInOut = inout;   // Pointer for input and output. 
    lpstrOutput = output; // Pointer for output. 
}
 

The following thunk script uses a nested structure as an input-output parameter:

enablemapdirect1632=true;

typedef unsigned int UINT;
typedef char *LPSTR;

typedef struct _POINT
{
    UINT x;
    UINT y;
} POINT;
typedef POINT *LPPOINT;

typedef struct _CIRCLE
{
    POINT center;
    UINT radius;
} CIRCLE, *LPCIRCLE;

void MyThunk32( LPCIRCLE lpCircleInOut )
{
    lpCircleInOut = inout;
}