A wrapper function is, by definition, a function call that encompasses a call to a secondary function. Any parameters passed to the wrapper are passed to the secondary call and the return value from the secondary call is returned to the original caller.
// wrapper for the CPlApplet function exported by each control panel applet
DWORD WINAPI __export CPlApplet16(DWORD *lpfnCPlApplet,
DWORD *hWndCPL,
DWORD *uMsg,
LONG *lParam1,
LONG *lParam2)
{
APPLET_PROC lpAppletProc = (APPLET_PROC) *lpfnCPlApplet;
if (lpAppletProc != NULL)
return lpAppletProc((HWND) *hWndCPL, (UINT) *uMsg, *lParam1, *lParam2);
else
return 0;
}
// wrapper for the 16bit LoadString function
DWORD WINAPI __export LoadString16(DWORD *hInst,
DWORD *idResource,
DWORD *lpszBuffer,
DWORD *cbBuffer)
{
return (DWORD) LoadString( (HINSTANCE) *hInst, (UINT) *idResource, (LPSTR) *lpszBuffer, (int) *cbBuffer );
}
// wrapper for the 16bit LoadLibrary function
DWORD WINAPI __export LoadLibrary16(LPSTR lpszLibFileName)
{
return (DWORD) LoadLibrary( lpszLibFileName );
}
// wrapper for the 16bit FreeLibrary function
DWORD WINAPI __export FreeLibrary16(DWORD *hInst)
{
FreeLibrary( (HINSTANCE) *hInst );
return 1;
}
// wrapper for the 16bit GetProcAddress function
DWORD WINAPI __export GetProcAddress16(DWORD *hInst)
{
return (DWORD) GetProcAddress( (HINSTANCE) *hInst, "CPlApplet" );
}