/**************************************************************************** * UTRegister (KERNEL32.@) */ BOOL WINAPI UTRegister( HMODULE hModule, LPSTR lpsz16BITDLL, LPSTR lpszInitName, LPSTR lpszProcName, FARPROC *ppfn32Thunk, FARPROC pfnUT32CallBack, LPVOID lpBuff ) { UTINFO *ut; HMODULE16 hModule16; FARPROC16 target16, init16; /* Load 16-bit DLL and get UTProc16 entry point */ if ( (hModule16 = LoadLibrary16( lpsz16BITDLL )) <= 32 || (target16 = GetProcAddress16( hModule16, lpszProcName )) == 0 ) return FALSE; /* Allocate UTINFO struct */ RtlAcquirePebLock(); if ( (ut = UTFind( hModule )) != NULL ) ut = NULL; else ut = UTAlloc( hModule, hModule16, target16, pfnUT32CallBack ); RtlReleasePebLock(); if ( !ut ) { FreeLibrary16( hModule16 ); return FALSE; } /* Call UTInit16 if present */ if ( lpszInitName && (init16 = GetProcAddress16( hModule16, lpszInitName )) != 0 ) { SEGPTR callback = MapLS( &ut->ut16 ); SEGPTR segBuff = MapLS( lpBuff ); WORD args[4]; DWORD ret; args[3] = SELECTOROF(callback); args[2] = OFFSETOF(callback); args[1] = SELECTOROF(segBuff); args[0] = OFFSETOF(segBuff); WOWCallback16Ex( (DWORD)init16, WCB16_PASCAL, sizeof(args), args, &ret ); UnMapLS( segBuff ); UnMapLS( callback ); if (!ret) { UTUnRegister( hModule ); return FALSE; } } /* Return 32-bit thunk */ *ppfn32Thunk = (FARPROC) &ut->ut32; return TRUE; }
/*********************************************************************** * WSACleanup (WINSOCK.116) */ INT WINAPI WSACleanup16(void) { if (num_startup) { if (!--num_startup) { /* delete scratch buffers */ UnMapLS( he_buffer_seg ); UnMapLS( se_buffer_seg ); UnMapLS( pe_buffer_seg ); UnMapLS( dbuffer_seg ); he_buffer_seg = 0; se_buffer_seg = 0; pe_buffer_seg = 0; dbuffer_seg = 0; HeapFree( GetProcessHeap(), 0, he_buffer ); HeapFree( GetProcessHeap(), 0, se_buffer ); HeapFree( GetProcessHeap(), 0, pe_buffer ); he_buffer = NULL; se_buffer = NULL; pe_buffer = NULL; } } return WSACleanup(); }
/*********************************************************************** * EnumObjects (GDI.71) */ INT16 WINAPI EnumObjects16( HDC16 hdc, INT16 nObjType, GOBJENUMPROC16 lpEnumFunc, LPARAM lParam ) { INT16 i, retval = 0; LOGPEN16 pen; LOGBRUSH16 brush; SEGPTR segptr; TRACE("%04x %d %08lx %08lx\n", hdc, nObjType, (DWORD)lpEnumFunc, lParam ); switch(nObjType) { case OBJ_PEN: /* Enumerate solid pens */ segptr = MapLS( &pen ); for (i = 0; i < sizeof(solid_colors)/sizeof(solid_colors[0]); i++) { pen.lopnStyle = PS_SOLID; pen.lopnWidth.x = 1; pen.lopnWidth.y = 0; pen.lopnColor = solid_colors[i]; retval = GDI_CallTo16_word_ll( lpEnumFunc, segptr, lParam ); TRACE("solid pen %08lx, ret=%d\n", solid_colors[i], retval); if (!retval) break; } UnMapLS( segptr ); break; case OBJ_BRUSH: /* Enumerate solid brushes */ segptr = MapLS( &brush ); for (i = 0; i < sizeof(solid_colors)/sizeof(solid_colors[0]); i++) { brush.lbStyle = BS_SOLID; brush.lbColor = solid_colors[i]; brush.lbHatch = 0; retval = GDI_CallTo16_word_ll( lpEnumFunc, segptr, lParam ); TRACE("solid brush %08lx, ret=%d\n", solid_colors[i], retval); if (!retval) break; } /* Now enumerate hatched brushes */ if (retval) for (i = HS_HORIZONTAL; i <= HS_DIAGCROSS; i++) { brush.lbStyle = BS_HATCHED; brush.lbColor = RGB(0,0,0); brush.lbHatch = i; retval = GDI_CallTo16_word_ll( lpEnumFunc, segptr, lParam ); TRACE("hatched brush %d, ret=%d\n", i, retval); if (!retval) break; } UnMapLS( segptr ); break; default: WARN("(%d): Invalid type\n", nObjType ); break; } return retval; }
/**************************************************************************** * UTGlue32 */ static DWORD WINAPI UTGlue32( FARPROC16 target, LPVOID lpBuff, DWORD dwUserDefined, LPVOID translationList[] ) { SEGPTR segBuff, *segptrList = NULL; INT i, nList = 0; DWORD retv; WORD args[4]; /* Convert arguments to SEGPTRs */ if ( translationList ) for ( nList = 0; translationList[nList]; nList++ ) ; if ( nList ) { segptrList = HeapAlloc( GetProcessHeap(), 0, sizeof(SEGPTR)*nList ); if ( !segptrList ) { FIXME("Unable to allocate segptrList!\n" ); return 0; } for ( i = 0; i < nList; i++ ) segptrList[i] = *(SEGPTR *)translationList[i] = MapLS( *(LPVOID *)translationList[i] ); } segBuff = MapLS( lpBuff ); /* Call 16-bit routine */ args[3] = SELECTOROF(segBuff); args[2] = OFFSETOF(segBuff); args[1] = HIWORD(dwUserDefined); args[0] = LOWORD(dwUserDefined); WOWCallback16Ex( (DWORD)target, WCB16_PASCAL, sizeof(args), args, &retv ); /* Free temporary selectors */ UnMapLS( segBuff ); if ( nList ) { for ( i = 0; i < nList; i++ ) UnMapLS( segptrList[i] ); HeapFree( GetProcessHeap(), 0, segptrList ); } return retv; }
/****************************************************************** * IC_Callback3216 * * */ static LRESULT CALLBACK IC_Callback3216(DWORD pfn16, HIC hic, HDRVR hdrv, UINT msg, LPARAM lp1, LPARAM lp2) { WORD args[8]; DWORD ret = 0; switch (msg) { case DRV_OPEN: lp2 = (DWORD)MapLS((void*)lp2); break; } args[7] = HIWORD(hic); args[6] = LOWORD(hic); args[5] = HDRVR_16(hdrv); args[4] = msg; args[3] = HIWORD(lp1); args[2] = LOWORD(lp1); args[1] = HIWORD(lp2); args[0] = LOWORD(lp2); WOWCallback16Ex( pfn16, WCB16_PASCAL, sizeof(args), args, &ret ); switch (msg) { case DRV_OPEN: UnMapLS(lp2); break; } return ret; }
/****************************************************************** * IC_Callback3216 * * */ static LRESULT CALLBACK IC_Callback3216(HIC hic, HDRVR hdrv, UINT msg, DWORD lp1, DWORD lp2) { WINE_HIC* whic; WORD args[8]; whic = MSVIDEO_GetHicPtr(hic); if (whic) { DWORD ret = 0; switch (msg) { case DRV_OPEN: lp2 = (DWORD)MapLS((void*)lp2); break; } args[7] = HIWORD(hic); args[6] = LOWORD(hic); args[5] = HDRVR_16(whic->hdrv); args[4] = msg; args[3] = HIWORD(lp1); args[2] = LOWORD(lp1); args[1] = HIWORD(lp2); args[0] = LOWORD(lp2); WOWCallback16Ex( whic->driverproc16, WCB16_PASCAL, sizeof(args), args, &ret ); switch (msg) { case DRV_OPEN: UnMapLS(lp2); break; } return ret; } else return ICERR_BADHANDLE; }
/*********************************************************************** * _ICCompress [MSVIDEO.224] */ DWORD VFWAPIV ICCompress16(HIC16 hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiOutput, LPVOID lpData, LPBITMAPINFOHEADER lpbiInput, LPVOID lpBits, LPDWORD lpckid, LPDWORD lpdwFlags, LONG lFrameNum, DWORD dwFrameSize, DWORD dwQuality, LPBITMAPINFOHEADER lpbiPrev, LPVOID lpPrev) { DWORD ret; ICCOMPRESS iccmp; SEGPTR seg_iccmp; TRACE("(0x%08x,%d,%p,%p,%p,%p,...)\n", (DWORD) hic, dwFlags, lpbiOutput, lpData, lpbiInput, lpBits); iccmp.dwFlags = dwFlags; iccmp.lpbiOutput = lpbiOutput; iccmp.lpOutput = lpData; iccmp.lpbiInput = lpbiInput; iccmp.lpInput = lpBits; iccmp.lpckid = lpckid; iccmp.lpdwFlags = lpdwFlags; iccmp.lFrameNum = lFrameNum; iccmp.dwFrameSize = dwFrameSize; iccmp.dwQuality = dwQuality; iccmp.lpbiPrev = lpbiPrev; iccmp.lpPrev = lpPrev; seg_iccmp = MapLS(&iccmp); ret = ICSendMessage16(hic, ICM_COMPRESS, seg_iccmp, sizeof(ICCOMPRESS)); UnMapLS(seg_iccmp); return ret; }
/***************************************************************************** * CloseComm (USER.207) */ INT16 WINAPI CloseComm16(INT16 cid) { struct DosDeviceStruct *ptr; TRACE("cid=%d\n", cid); if ((ptr = GetDeviceStruct(cid)) == NULL) { FIXME("no cid=%d found!\n", cid); return -1; } if (!(cid&FLAG_LPT)) { /* COM port */ UnMapLS( COM[cid].seg_unknown ); USER16_AlertableWait--; CancelIo(ptr->handle); /* free buffers */ HeapFree( GetProcessHeap(), 0, ptr->outbuf); HeapFree( GetProcessHeap(), 0, ptr->inbuf); /* reset modem lines */ SetCommState16(&COM[cid].dcb); } if (!CloseHandle(ptr->handle)) { ptr->commerror = WinError(); /* FIXME: should we clear ptr->handle here? */ return -1; } else { ptr->commerror = 0; ptr->handle = 0; return 0; } }
/****************************************************************************** * IMalloc16_Free [COMPOBJ.505] */ VOID CDECL IMalloc16_fnFree(IMalloc16* iface,SEGPTR pv) { void *ptr = MapSL(pv); IMalloc16Impl *This = impl_from_IMalloc16(iface); TRACE("(%p)->Free(%08x)\n",This,pv); UnMapLS(pv); HeapFree( GetProcessHeap(), 0, ptr ); }
/*********************************************************************** * call_WH_MSGFILTER */ static LRESULT CALLBACK call_WH_MSGFILTER( INT code, WPARAM wp, LPARAM lp ) { MSG *msg32 = (MSG *)lp; MSG16 msg16; LRESULT ret; map_msg_32_to_16( msg32, &msg16 ); lp = MapLS( &msg16 ); ret = call_hook_16( WH_MSGFILTER, code, wp, lp ); UnMapLS( lp ); return ret; }
static SEGPTR get_buffer_se(int size) { static int se_len; if (se_buffer) { if (se_len >= size ) return se_buffer_seg; UnMapLS( se_buffer_seg ); HeapFree( GetProcessHeap(), 0, se_buffer ); } se_buffer = HeapAlloc( GetProcessHeap(), 0, (se_len = size) ); se_buffer_seg = MapLS( se_buffer ); return se_buffer_seg; }
static SEGPTR get_buffer_pe(int size) { static int pe_len; if (pe_buffer) { if (pe_len >= size ) return pe_buffer_seg; UnMapLS( pe_buffer_seg ); HeapFree( GetProcessHeap(), 0, pe_buffer ); } pe_buffer = HeapAlloc( GetProcessHeap(), 0, (pe_len = size) ); pe_buffer_seg = MapLS( pe_buffer ); return pe_buffer_seg; }
static SEGPTR get_buffer_he(int size) { static int he_len; if (he_buffer) { if (he_len >= size ) return he_buffer_seg; UnMapLS( he_buffer_seg ); HeapFree( GetProcessHeap(), 0, he_buffer ); } he_buffer = HeapAlloc( GetProcessHeap(), 0, (he_len = size) ); he_buffer_seg = MapLS( he_buffer ); return he_buffer_seg; }
/****************************************************************** * WDML_InvokeCallback16 * * */ static HDDEDATA CALLBACK WDML_InvokeCallback16(DWORD pfn16, UINT uType, UINT uFmt, HCONV hConv, HSZ hsz1, HSZ hsz2, HDDEDATA hdata, ULONG_PTR dwData1, ULONG_PTR dwData2) { DWORD d1 = 0; HDDEDATA ret; CONVCONTEXT16 cc16; WORD args[16]; switch (uType) { case XTYP_CONNECT: case XTYP_WILDCONNECT: if (dwData1) { map3216_conv_context(&cc16, (const CONVCONTEXT*)dwData1); d1 = MapLS(&cc16); } else break; default: d1 = dwData1; break; } args[15] = HIWORD(uType); args[14] = LOWORD(uType); args[13] = HIWORD(uFmt); args[12] = LOWORD(uFmt); args[11] = HIWORD(hConv); args[10] = LOWORD(hConv); args[9] = HIWORD(hsz1); args[8] = LOWORD(hsz1); args[7] = HIWORD(hsz2); args[6] = LOWORD(hsz2); args[5] = HIWORD(hdata); args[4] = LOWORD(hdata); args[3] = HIWORD(d1); args[2] = LOWORD(d1); args[1] = HIWORD(dwData2); args[0] = LOWORD(dwData2); WOWCallback16Ex(pfn16, WCB16_PASCAL, sizeof(args), args, (DWORD *)&ret); switch (uType) { case XTYP_CONNECT: case XTYP_WILDCONNECT: if (d1 != 0) UnMapLS(d1); break; } return ret; }
/*********************************************************************** * call_WH_GETMESSAGE */ static LRESULT CALLBACK call_WH_GETMESSAGE( INT code, WPARAM wp, LPARAM lp ) { MSG *msg32 = (MSG *)lp; MSG16 msg16; LRESULT ret; map_msg_32_to_16( msg32, &msg16 ); lp = MapLS( &msg16 ); ret = call_hook_16( WH_GETMESSAGE, code, wp, lp ); UnMapLS( lp ); map_msg_16_to_32( &msg16, msg32 ); return ret; }
/**************************************************************** * MMIO_UnMap32To16 [INTERNAL] */ static LRESULT MMIO_UnMap32To16(DWORD wMsg, LPARAM lParam1, LPARAM lParam2, LPARAM lp1, LPARAM lp2) { switch (wMsg) { case MMIOM_CLOSE: case MMIOM_SEEK: /* nothing to do */ break; case MMIOM_OPEN: case MMIOM_READ: case MMIOM_WRITE: case MMIOM_WRITEFLUSH: UnMapLS( lp1 ); break; case MMIOM_RENAME: UnMapLS( lp1 ); UnMapLS( lp2 ); break; default: if (wMsg < MMIOM_USER) TRACE("Not a mappable message (%d)\n", wMsg); } return MMSYSERR_NOERROR; }
/* helper for SendMessage16 */ void call_WH_CALLWNDPROC_hook( HWND16 hwnd, UINT16 msg, WPARAM16 wp, LPARAM lp ) { CWPSTRUCT16 cwp; struct hook16_queue_info *info = get_hook_info( FALSE ); if (!info || !info->proc[WH_CALLWNDPROC - WH_MINHOOK]) return; cwp.hwnd = hwnd; cwp.message = msg; cwp.wParam = wp; cwp.lParam = lp; lp = MapLS( &cwp ); call_hook_16( WH_CALLWNDPROC, HC_ACTION, 1, lp ); UnMapLS( lp ); }
/*********************************************************************** * _ICDrawBegin [MSVIDEO.232] */ DWORD VFWAPIV ICDrawBegin16(HIC16 hic, /* [in] */ DWORD dwFlags, /* [in] flags */ HPALETTE16 hpal, /* [in] palette to draw with */ HWND16 hwnd, /* [in] window to draw to */ HDC16 hdc, /* [in] HDC to draw to */ INT16 xDst, /* [in] destination rectangle */ INT16 yDst, /* [in] */ INT16 dxDst, /* [in] */ INT16 dyDst, /* [in] */ LPBITMAPINFOHEADER lpbi, /* [in] format of frame to draw NOTE: SEGPTR */ INT16 xSrc, /* [in] source rectangle */ INT16 ySrc, /* [in] */ INT16 dxSrc, /* [in] */ INT16 dySrc, /* [in] */ DWORD dwRate, /* [in] frames/second = (dwRate/dwScale) */ DWORD dwScale) /* [in] */ { DWORD ret; ICDRAWBEGIN16 icdb; SEGPTR seg_icdb; TRACE ("(0x%08x,%d,0x%08x,0x%08x,0x%08x,%u,%u,%u,%u,%p,%u,%u,%u,%u,%d,%d)\n", (DWORD) hic, dwFlags, (DWORD) hpal, (DWORD) hwnd, (DWORD) hdc, xDst, yDst, dxDst, dyDst, lpbi, xSrc, ySrc, dxSrc, dySrc, dwRate, dwScale); icdb.dwFlags = dwFlags; icdb.hpal = hpal; icdb.hwnd = hwnd; icdb.hdc = hdc; icdb.xDst = xDst; icdb.yDst = yDst; icdb.dxDst = dxDst; icdb.dyDst = dyDst; icdb.lpbi = lpbi; /* Keep this as SEGPTR for the mapping code to deal with */ icdb.xSrc = xSrc; icdb.ySrc = ySrc; icdb.dxSrc = dxSrc; icdb.dySrc = dySrc; icdb.dwRate = dwRate; icdb.dwScale = dwScale; seg_icdb = MapLS(&icdb); ret = (DWORD) ICSendMessage16(hic, ICM_DRAW_BEGIN, seg_icdb, sizeof(ICDRAWBEGIN16)); UnMapLS(seg_icdb); return ret; }
/* * freeSelectors */ static void freeSelectors( void ) { LPSELLIST psel; LPSELLIST link; psel = lpSelList; while( psel != NULL ) { link = psel->link; DPF( 2, "$$$$$$ Freeing selector %04x", psel->sel ); UnMapLS( ((DWORD)psel->sel) << 16l ); HeapFree( hHeap, 0, psel ); psel = link; } lpSelList = NULL; } /* freeSelectors */
/*********************************************************************** * call_WH_MOUSE */ static LRESULT CALLBACK call_WH_MOUSE( INT code, WPARAM wp, LPARAM lp ) { MOUSEHOOKSTRUCT *ms32 = (MOUSEHOOKSTRUCT *)lp; MOUSEHOOKSTRUCT16 ms16; LRESULT ret; ms16.pt.x = ms32->pt.x; ms16.pt.y = ms32->pt.y; ms16.hwnd = HWND_16( ms32->hwnd ); ms16.wHitTestCode = ms32->wHitTestCode; ms16.dwExtraInfo = ms32->dwExtraInfo; lp = MapLS( &ms16 ); ret = call_hook_16( WH_MOUSE, code, wp, lp ); UnMapLS( lp ); return ret; }
/****************************************************************************** * IMalloc16_Realloc [COMPOBJ.504] */ SEGPTR CDECL IMalloc16_fnRealloc(IMalloc16* iface,SEGPTR pv,DWORD cb) { SEGPTR ret; IMalloc16Impl *This = impl_from_IMalloc16(iface); TRACE("(%p)->Realloc(%08x,%d)\n",This,pv,cb); if (!pv) ret = IMalloc16_fnAlloc(iface, cb); else if (cb) { ret = MapLS( HeapReAlloc( GetProcessHeap(), 0, MapSL(pv), cb ) ); UnMapLS(pv); } else { IMalloc16_fnFree(iface, pv); ret = 0; } return ret; }
/************************************************************************* * RunDLL_CallEntry16 * * Only exported from shell32 on Windows, probably imported * from shell through the 16/32 thunks. */ void WINAPI RunDLL_CallEntry16( DWORD proc, HWND hwnd, HINSTANCE inst, LPCSTR cmdline, INT cmdshow ) { WORD args[5]; SEGPTR cmdline_seg; TRACE( "proc %x hwnd %p inst %p cmdline %s cmdshow %d\n", proc, hwnd, inst, debugstr_a(cmdline), cmdshow ); cmdline_seg = MapLS( cmdline ); args[4] = HWND_16(hwnd); args[3] = MapHModuleLS(inst); args[2] = SELECTOROF(cmdline_seg); args[1] = OFFSETOF(cmdline_seg); args[0] = cmdshow; WOWCallback16Ex( proc, WCB16_PASCAL, sizeof(args), args, NULL ); UnMapLS( cmdline_seg ); }
/* callback for WINPROC_Call32ATo16 */ static LRESULT wndproc_hook_callback16( HWND16 hwnd, UINT16 msg, WPARAM16 wp, LPARAM lp, LRESULT *result, void *arg ) { struct wndproc_hook_params *params = arg; CWPSTRUCT16 cwp; LRESULT ret; cwp.hwnd = hwnd; cwp.message = msg; cwp.wParam = wp; cwp.lParam = lp; lp = MapLS( &cwp ); ret = call_hook_16( WH_CALLWNDPROC, params->code, params->wparam, lp ); UnMapLS( lp ); *result = 0; return ret; }
/************************************************************************** * mmioSetBuffer [MMSYSTEM.1217] */ MMRESULT16 WINAPI mmioSetBuffer16(HMMIO16 hmmio, LPSTR pchBuffer, LONG cchBuffer, UINT16 uFlags) { MMRESULT ret = mmioSetBuffer(HMMIO_32(hmmio), MapSL((DWORD)pchBuffer), cchBuffer, uFlags); if (ret == MMSYSERR_NOERROR) { struct mmio_thunk* thunk; if ((thunk = MMIO_HasThunk(HMMIO_32(hmmio))) == NULL) { FIXME("really ?\n"); return MMSYSERR_INVALHANDLE; } MMIO_SetSegmentedBuffer(thunk, (DWORD)pchBuffer, TRUE); } else UnMapLS((DWORD)pchBuffer); return ret; }
/*********************************************************************** * _ICDraw [MSVIDEO.234] */ DWORD VFWAPIV ICDraw16(HIC16 hic, DWORD dwFlags, LPVOID lpFormat, /* [???] NOTE: SEGPTR */ LPVOID lpData, /* [???] NOTE: SEGPTR */ DWORD cbData, LONG lTime) { DWORD ret; ICDRAW icd; SEGPTR seg_icd; TRACE("(0x%08x,0x%08x,%p,%p,%d,%d)\n", (DWORD) hic, dwFlags, lpFormat, lpData, cbData, lTime); icd.dwFlags = dwFlags; icd.lpFormat = lpFormat; icd.lpData = lpData; icd.cbData = cbData; icd.lTime = lTime; seg_icd = MapLS(&icd); ret = ICSendMessage16(hic, ICM_DRAW, seg_icd, sizeof(ICDRAW)); UnMapLS(seg_icd); return ret; }
/*********************************************************************** * _ICDecompress [MSVIDEO.230] */ DWORD VFWAPIV ICDecompress16(HIC16 hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiFormat, LPVOID lpData, LPBITMAPINFOHEADER lpbi, LPVOID lpBits) { ICDECOMPRESS icd; SEGPTR segptr; DWORD ret; TRACE("(0x%08x,%d,%p,%p,%p,%p)\n", (DWORD) hic, dwFlags, lpbiFormat, lpData, lpbi, lpBits); icd.dwFlags = dwFlags; icd.lpbiInput = lpbiFormat; icd.lpInput = lpData; icd.lpbiOutput = lpbi; icd.lpOutput = lpBits; icd.ckid = 0; segptr = MapLS(&icd); ret = ICSendMessage16(hic, ICM_DECOMPRESS, segptr, sizeof(ICDECOMPRESS)); UnMapLS(segptr); return ret; }
/*********************************************************************** * _ICMessage [MSVIDEO.207] */ LRESULT VFWAPIV ICMessage16( HIC16 hic, UINT16 msg, UINT16 cb, VA_LIST16 valist ) { LPWORD lpData; SEGPTR segData; LRESULT ret; UINT16 i; lpData = HeapAlloc(GetProcessHeap(), 0, cb); TRACE("0x%08x, %u, %u, ...)\n", (DWORD) hic, msg, cb); for (i = 0; i < cb / sizeof(WORD); i++) { lpData[i] = VA_ARG16(valist, WORD); } segData = MapLS(lpData); ret = ICSendMessage16(hic, msg, segData, (DWORD) cb); UnMapLS(segData); HeapFree(GetProcessHeap(), 0, lpData); return ret; }
/****************************************************************** * MMIO_Callback3216 * * */ static LRESULT MMIO_Callback3216(SEGPTR cb16, LPMMIOINFO lpmmioinfo, UINT uMessage, LPARAM lParam1, LPARAM lParam2) { DWORD result; MMIOINFO16 mmioInfo16; SEGPTR segmmioInfo16; LPARAM lp1 = lParam1, lp2 = lParam2; WORD args[7]; if (!cb16) return MMSYSERR_INVALPARAM; memset(&mmioInfo16, 0, sizeof(MMIOINFO16)); mmioInfo16.lDiskOffset = lpmmioinfo->lDiskOffset; mmioInfo16.adwInfo[0] = lpmmioinfo->adwInfo[0]; mmioInfo16.adwInfo[1] = lpmmioinfo->adwInfo[1]; mmioInfo16.adwInfo[2] = lpmmioinfo->adwInfo[2]; /* map (lParam1, lParam2) into (lp1, lp2) 32=>16 */ if ((result = MMIO_Map32To16(uMessage, &lp1, &lp2)) != MMSYSERR_NOERROR) return result; segmmioInfo16 = MapLS(&mmioInfo16); args[6] = HIWORD(segmmioInfo16); args[5] = LOWORD(segmmioInfo16); args[4] = uMessage; args[3] = HIWORD(lp1); args[2] = LOWORD(lp1); args[1] = HIWORD(lp2); args[0] = LOWORD(lp2); WOWCallback16Ex( cb16, WCB16_PASCAL, sizeof(args), args, &result ); UnMapLS(segmmioInfo16); MMIO_UnMap32To16(uMessage, lParam1, lParam2, lp1, lp2); lpmmioinfo->lDiskOffset = mmioInfo16.lDiskOffset; lpmmioinfo->adwInfo[0] = mmioInfo16.adwInfo[0]; lpmmioinfo->adwInfo[1] = mmioInfo16.adwInfo[1]; lpmmioinfo->adwInfo[2] = mmioInfo16.adwInfo[2]; return result; }
/************************************************************************* * RunDLL_CallEntry16 [SHELL32.122] * the name is probably wrong */ EXTERN_C void WINAPI RunDLL_CallEntry16( DWORD proc, HWND hwnd, HINSTANCE inst, LPCSTR cmdline, INT cmdshow ) { #if !defined(__CYGWIN__) && !defined (__MINGW32__) && !defined(_MSC_VER) WORD args[5]; SEGPTR cmdline_seg; TRACE( "proc %x hwnd %p inst %p cmdline %s cmdshow %d\n", proc, hwnd, inst, debugstr_a(cmdline), cmdshow ); cmdline_seg = MapLS( cmdline ); args[4] = HWND_16(hwnd); args[3] = MapHModuleLS(inst); args[2] = SELECTOROF(cmdline_seg); args[1] = OFFSETOF(cmdline_seg); args[0] = cmdshow; WOWCallback16Ex( proc, WCB16_PASCAL, sizeof(args), args, NULL ); UnMapLS( cmdline_seg ); #else FIXME( "proc %lx hwnd %p inst %p cmdline %s cmdshow %d\n", proc, hwnd, inst, debugstr_a(cmdline), cmdshow ); #endif }
/*********************************************************************** * call_WH_CBT */ static LRESULT CALLBACK call_WH_CBT( INT code, WPARAM wp, LPARAM lp ) { LRESULT ret = 0; switch (code) { case HCBT_CREATEWND: { CBT_CREATEWNDA *cbtcw32 = (CBT_CREATEWNDA *)lp; CBT_CREATEWND16 cbtcw16; CREATESTRUCT16 cs16; cs16.lpCreateParams = (SEGPTR)cbtcw32->lpcs->lpCreateParams; cs16.hInstance = HINSTANCE_16(cbtcw32->lpcs->hInstance); cs16.hMenu = HMENU_16(cbtcw32->lpcs->hMenu); cs16.hwndParent = HWND_16(cbtcw32->lpcs->hwndParent); cs16.cy = cbtcw32->lpcs->cy; cs16.cx = cbtcw32->lpcs->cx; cs16.y = cbtcw32->lpcs->y; cs16.x = cbtcw32->lpcs->x; cs16.style = cbtcw32->lpcs->style; cs16.lpszName = MapLS( cbtcw32->lpcs->lpszName ); cs16.lpszClass = MapLS( cbtcw32->lpcs->lpszClass ); cs16.dwExStyle = cbtcw32->lpcs->dwExStyle; cbtcw16.lpcs = (CREATESTRUCT16 *)MapLS( &cs16 ); cbtcw16.hwndInsertAfter = HWND_16( cbtcw32->hwndInsertAfter ); lp = MapLS( &cbtcw16 ); ret = call_hook_16( WH_CBT, code, wp, lp ); UnMapLS( cs16.lpszName ); UnMapLS( cs16.lpszClass ); cbtcw32->hwndInsertAfter = WIN_Handle32( cbtcw16.hwndInsertAfter ); UnMapLS( (SEGPTR)cbtcw16.lpcs ); UnMapLS( lp ); break; } case HCBT_ACTIVATE: { CBTACTIVATESTRUCT *cas32 = (CBTACTIVATESTRUCT *)lp; CBTACTIVATESTRUCT16 cas16; cas16.fMouse = cas32->fMouse; cas16.hWndActive = HWND_16( cas32->hWndActive ); lp = MapLS( &cas16 ); ret = call_hook_16( WH_CBT, code, wp, lp ); UnMapLS( lp ); break; } case HCBT_CLICKSKIPPED: { MOUSEHOOKSTRUCT *ms32 = (MOUSEHOOKSTRUCT *)lp; MOUSEHOOKSTRUCT16 ms16; ms16.pt.x = ms32->pt.x; ms16.pt.y = ms32->pt.y; ms16.hwnd = HWND_16( ms32->hwnd ); ms16.wHitTestCode = ms32->wHitTestCode; ms16.dwExtraInfo = ms32->dwExtraInfo; lp = MapLS( &ms16 ); ret = call_hook_16( WH_CBT, code, wp, lp ); UnMapLS( lp ); break; } case HCBT_MOVESIZE: { RECT *rect32 = (RECT *)lp; RECT16 rect16; rect16.left = rect32->left; rect16.top = rect32->top; rect16.right = rect32->right; rect16.bottom = rect32->bottom; lp = MapLS( &rect16 ); ret = call_hook_16( WH_CBT, code, wp, lp ); UnMapLS( lp ); break; } } return ret; }