Use MapLS/UnMapLS instead of SEGPTR_* macros.

This commit is contained in:
Alexandre Julliard 2001-12-20 00:19:40 +00:00
parent 6f011c0847
commit d7b76822ef
16 changed files with 307 additions and 516 deletions

View File

@ -20,7 +20,6 @@
#include "vfw16.h" #include "vfw16.h"
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "debugtools.h" #include "debugtools.h"
#include "heap.h"
#include "stackframe.h" #include "stackframe.h"
DEFAULT_DEBUG_CHANNEL(msvideo); DEFAULT_DEBUG_CHANNEL(msvideo);
@ -220,19 +219,20 @@ HIC VFWAPI ICOpen(DWORD fccType,DWORD fccHandler,UINT wMode) {
HIC MSVIDEO_OpenFunc(DWORD fccType, DWORD fccHandler, UINT wMode, FARPROC lpfnHandler, BOOL bFrom32) { HIC MSVIDEO_OpenFunc(DWORD fccType, DWORD fccHandler, UINT wMode, FARPROC lpfnHandler, BOOL bFrom32) {
char type[5],handler[5],codecname[20]; char type[5],handler[5],codecname[20];
HIC16 hic; HIC16 hic;
ICOPEN* icopen = SEGPTR_NEW(ICOPEN); ICOPEN icopen;
SEGPTR seg_icopen;
WINE_HIC *whic; WINE_HIC *whic;
memcpy(type,&fccType,4);type[4]=0; memcpy(type,&fccType,4);type[4]=0;
memcpy(handler,&fccHandler,4);handler[4]=0; memcpy(handler,&fccHandler,4);handler[4]=0;
TRACE("(%s,%s,%d,%p,%d)\n",type,handler,wMode,lpfnHandler,bFrom32?32:16); TRACE("(%s,%s,%d,%p,%d)\n",type,handler,wMode,lpfnHandler,bFrom32?32:16);
icopen->fccType = fccType; icopen.fccType = fccType;
icopen->fccHandler = fccHandler; icopen.fccHandler = fccHandler;
icopen->dwSize = sizeof(ICOPEN); icopen.dwSize = sizeof(ICOPEN);
icopen->dwFlags = wMode; icopen.dwFlags = wMode;
sprintf(codecname,"%s.%s",type,handler); sprintf(codecname,"%s.%s",type,handler);
hic = GlobalAlloc16(GHND,sizeof(WINE_HIC)); hic = GlobalAlloc16(GHND,sizeof(WINE_HIC));
if (!hic) if (!hic)
@ -253,7 +253,9 @@ HIC MSVIDEO_OpenFunc(DWORD fccType, DWORD fccHandler, UINT wMode, FARPROC lpfnHa
/* return value is not checked */ /* return value is not checked */
MSVIDEO_SendMessage(hic,DRV_ENABLE,0L,0L,bFrom32); MSVIDEO_SendMessage(hic,DRV_ENABLE,0L,0L,bFrom32);
whic->hdrv = MSVIDEO_SendMessage(hic,DRV_OPEN,0,(LPARAM)(SEGPTR_GET(icopen)),FALSE); seg_icopen = MapLS( &icopen );
whic->hdrv = MSVIDEO_SendMessage(hic,DRV_OPEN,0,seg_icopen,FALSE);
UnMapLS( seg_icopen );
if (whic->hdrv == 0) { if (whic->hdrv == 0) {
WARN("DRV_OPEN failed for hic 0x%08lx\n",(DWORD)hic); WARN("DRV_OPEN failed for hic 0x%08lx\n",(DWORD)hic);
GlobalFree16(hic); GlobalFree16(hic);
@ -504,26 +506,28 @@ DWORD VFWAPIV ICCompress16(HIC16 hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiOutp
LPBITMAPINFOHEADER lpbiPrev, LPVOID lpPrev) { LPBITMAPINFOHEADER lpbiPrev, LPVOID lpPrev) {
DWORD ret; DWORD ret;
ICCOMPRESS *iccmp = SEGPTR_NEW(ICCOMPRESS); ICCOMPRESS iccmp;
SEGPTR seg_iccmp;
TRACE("(0x%08lx,%ld,%p,%p,%p,%p,...)\n",(DWORD)hic,dwFlags,lpbiOutput,lpData,lpbiInput,lpBits); TRACE("(0x%08lx,%ld,%p,%p,%p,%p,...)\n",(DWORD)hic,dwFlags,lpbiOutput,lpData,lpbiInput,lpBits);
iccmp->dwFlags = dwFlags; iccmp.dwFlags = dwFlags;
iccmp->lpbiOutput = lpbiOutput; iccmp.lpbiOutput = lpbiOutput;
iccmp->lpOutput = lpData; iccmp.lpOutput = lpData;
iccmp->lpbiInput = lpbiInput; iccmp.lpbiInput = lpbiInput;
iccmp->lpInput = lpBits; iccmp.lpInput = lpBits;
iccmp->lpckid = lpckid; iccmp.lpckid = lpckid;
iccmp->lpdwFlags = lpdwFlags; iccmp.lpdwFlags = lpdwFlags;
iccmp->lFrameNum = lFrameNum; iccmp.lFrameNum = lFrameNum;
iccmp->dwFrameSize = dwFrameSize; iccmp.dwFrameSize = dwFrameSize;
iccmp->dwQuality = dwQuality; iccmp.dwQuality = dwQuality;
iccmp->lpbiPrev = lpbiPrev; iccmp.lpbiPrev = lpbiPrev;
iccmp->lpPrev = lpPrev; iccmp.lpPrev = lpPrev;
ret = ICSendMessage16(hic,ICM_COMPRESS,(DWORD)SEGPTR_GET(iccmp),sizeof(ICCOMPRESS)); seg_iccmp = MapLS( &iccmp );
SEGPTR_FREE(iccmp); ret = ICSendMessage16(hic,ICM_COMPRESS,seg_iccmp,sizeof(ICCOMPRESS));
UnMapLS( seg_iccmp );
return ret; return ret;
} }
@ -560,23 +564,23 @@ DWORD VFWAPIV ICDecompress(HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiFormat,
* _ICDecompress [MSVIDEO.230] * _ICDecompress [MSVIDEO.230]
*/ */
DWORD VFWAPIV ICDecompress16(HIC16 hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiFormat, DWORD VFWAPIV ICDecompress16(HIC16 hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiFormat,
LPVOID lpData, LPBITMAPINFOHEADER lpbi, LPVOID lpBits) { LPVOID lpData, LPBITMAPINFOHEADER lpbi, LPVOID lpBits)
{
ICDECOMPRESS *icd = SEGPTR_NEW(ICDECOMPRESS); ICDECOMPRESS icd;
SEGPTR segptr;
DWORD ret; DWORD ret;
TRACE("(0x%08lx,%ld,%p,%p,%p,%p)\n",(DWORD)hic,dwFlags,lpbiFormat,lpData,lpbi,lpBits); TRACE("(0x%08lx,%ld,%p,%p,%p,%p)\n",(DWORD)hic,dwFlags,lpbiFormat,lpData,lpbi,lpBits);
icd->dwFlags = dwFlags; icd.dwFlags = dwFlags;
icd->lpbiInput = lpbiFormat; icd.lpbiInput = lpbiFormat;
icd->lpInput = lpData; icd.lpInput = lpData;
icd->lpbiOutput = lpbi; icd.lpbiOutput = lpbi;
icd->lpOutput = lpBits; icd.lpOutput = lpBits;
icd->ckid = 0; icd.ckid = 0;
segptr = MapLS( &icd );
ret = ICSendMessage16(hic,ICM_DECOMPRESS,(DWORD)SEGPTR_GET(icd),sizeof(ICDECOMPRESS)); ret = ICSendMessage16(hic,ICM_DECOMPRESS,segptr,sizeof(ICDECOMPRESS));
UnMapLS( segptr );
SEGPTR_FREE(icd);
return ret; return ret;
} }
@ -996,6 +1000,7 @@ LRESULT VFWAPIV ICMessage16(void) {
UINT16 msg; UINT16 msg;
UINT16 cb; UINT16 cb;
LPWORD lpData; LPWORD lpData;
SEGPTR segData;
LRESULT ret; LRESULT ret;
UINT16 i; UINT16 i;
@ -1006,7 +1011,7 @@ LRESULT VFWAPIV ICMessage16(void) {
msg = VA_ARG16(valist, UINT16); msg = VA_ARG16(valist, UINT16);
cb = VA_ARG16(valist, UINT16); cb = VA_ARG16(valist, UINT16);
lpData = SEGPTR_ALLOC(cb); lpData = HeapAlloc( GetProcessHeap(), 0, cb );
TRACE("0x%08lx, %u, %u, ...)\n",(DWORD)hic,msg,cb); TRACE("0x%08lx, %u, %u, ...)\n",(DWORD)hic,msg,cb);
@ -1015,9 +1020,10 @@ LRESULT VFWAPIV ICMessage16(void) {
} }
VA_END16(valist); VA_END16(valist);
ret = ICSendMessage16(hic, msg, (DWORD)(SEGPTR_GET(lpData)), (DWORD)cb); segData = MapLS( lpData );
ret = ICSendMessage16(hic, msg, segData, (DWORD)cb);
SEGPTR_FREE(lpData); UnMapLS( segData );
HeapFree( GetProcessHeap(), 0, lpData );
return ret; return ret;
} }
@ -1089,30 +1095,31 @@ DWORD VFWAPIV ICDrawBegin16(
DWORD dwScale) /* [in] */ DWORD dwScale) /* [in] */
{ {
DWORD ret; DWORD ret;
ICDRAWBEGIN16* icdb = SEGPTR_NEW(ICDRAWBEGIN16); /* SEGPTR for mapper to deal with */ ICDRAWBEGIN16 icdb;
SEGPTR seg_icdb;
TRACE("(0x%08lx,%ld,0x%08lx,0x%08lx,0x%08lx,%u,%u,%u,%u,%p,%u,%u,%u,%u,%ld,%ld)\n", TRACE("(0x%08lx,%ld,0x%08lx,0x%08lx,0x%08lx,%u,%u,%u,%u,%p,%u,%u,%u,%u,%ld,%ld)\n",
(DWORD)hic, dwFlags, (DWORD)hpal, (DWORD)hwnd, (DWORD)hdc, xDst, yDst, dxDst, dyDst, (DWORD)hic, dwFlags, (DWORD)hpal, (DWORD)hwnd, (DWORD)hdc, xDst, yDst, dxDst, dyDst,
lpbi, xSrc, ySrc, dxSrc, dySrc, dwRate, dwScale); lpbi, xSrc, ySrc, dxSrc, dySrc, dwRate, dwScale);
icdb->dwFlags = dwFlags; icdb.dwFlags = dwFlags;
icdb->hpal = hpal; icdb.hpal = hpal;
icdb->hwnd = hwnd; icdb.hwnd = hwnd;
icdb->hdc = hdc; icdb.hdc = hdc;
icdb->xDst = xDst; icdb.xDst = xDst;
icdb->yDst = yDst; icdb.yDst = yDst;
icdb->dxDst = dxDst; icdb.dxDst = dxDst;
icdb->dyDst = dyDst; icdb.dyDst = dyDst;
icdb->lpbi = lpbi; /* Keep this as SEGPTR for the mapping code to deal with */ icdb.lpbi = lpbi; /* Keep this as SEGPTR for the mapping code to deal with */
icdb->xSrc = xSrc; icdb.xSrc = xSrc;
icdb->ySrc = ySrc; icdb.ySrc = ySrc;
icdb->dxSrc = dxSrc; icdb.dxSrc = dxSrc;
icdb->dySrc = dySrc; icdb.dySrc = dySrc;
icdb->dwRate = dwRate; icdb.dwRate = dwRate;
icdb->dwScale = dwScale; icdb.dwScale = dwScale;
seg_icdb = MapLS( &icdb );
ret = (DWORD)ICSendMessage16(hic,ICM_DRAW_BEGIN,(DWORD)SEGPTR_GET(icdb),sizeof(ICDRAWBEGIN16)); ret = (DWORD)ICSendMessage16(hic,ICM_DRAW_BEGIN,seg_icdb,sizeof(ICDRAWBEGIN16));
SEGPTR_FREE(icdb); UnMapLS( seg_icdb );
return ret; return ret;
} }
@ -1144,16 +1151,20 @@ DWORD VFWAPIV ICDraw16(
DWORD cbData, DWORD cbData,
LONG lTime) LONG lTime)
{ {
ICDRAW* icd = SEGPTR_NEW(ICDRAW); /* SEGPTR for mapper to deal with */ DWORD ret;
ICDRAW icd;
SEGPTR seg_icd;
TRACE("(0x%08lx,0x%08lx,%p,%p,%ld,%ld)\n",(DWORD)hic,dwFlags,lpFormat,lpData,cbData,lTime); TRACE("(0x%08lx,0x%08lx,%p,%p,%ld,%ld)\n",(DWORD)hic,dwFlags,lpFormat,lpData,cbData,lTime);
icd->dwFlags = dwFlags; icd.dwFlags = dwFlags;
icd->lpFormat = lpFormat; icd.lpFormat = lpFormat;
icd->lpData = lpData; icd.lpData = lpData;
icd->cbData = cbData; icd.cbData = cbData;
icd->lTime = lTime; icd.lTime = lTime;
seg_icd = MapLS( &icd );
return ICSendMessage16(hic,ICM_DRAW,(DWORD)SEGPTR_GET(icd),sizeof(ICDRAW)); ret = ICSendMessage16(hic,ICM_DRAW,seg_icd,sizeof(ICDRAW));
UnMapLS( seg_icd );
return ret;
} }
/*********************************************************************** /***********************************************************************

View File

@ -8,6 +8,7 @@
#include <string.h> #include <string.h>
#include "wine/windef16.h"
#include "ole2.h" #include "ole2.h"
#include "oleauto.h" #include "oleauto.h"
#include "windef.h" #include "windef.h"
@ -16,7 +17,6 @@
#include "wingdi.h" #include "wingdi.h"
#include "winuser.h" #include "winuser.h"
#include "heap.h"
#include "ole2disp.h" #include "ole2disp.h"
#include "olectl.h" #include "olectl.h"
@ -33,8 +33,8 @@ DEFAULT_DEBUG_CHANNEL(ole);
*/ */
static BSTR16 BSTR_AllocBytes(int n) static BSTR16 BSTR_AllocBytes(int n)
{ {
void *ptr = SEGPTR_ALLOC(n); void *ptr = HeapAlloc( GetProcessHeap(), 0, n );
return (BSTR16)SEGPTR_GET(ptr); return (BSTR16)MapLS(ptr);
} }
/****************************************************************************** /******************************************************************************
@ -42,7 +42,9 @@ static BSTR16 BSTR_AllocBytes(int n)
*/ */
static void BSTR_Free(BSTR16 in) static void BSTR_Free(BSTR16 in)
{ {
SEGPTR_FREE( MapSL((SEGPTR)in) ); void *ptr = MapSL( (SEGPTR)in );
UnMapLS( (SEGPTR)in );
HeapFree( GetProcessHeap(), 0, ptr );
} }
/****************************************************************************** /******************************************************************************

View File

@ -6,7 +6,6 @@
#include "wine/winuser16.h" #include "wine/winuser16.h"
#include "winerror.h" #include "winerror.h"
#include "heap.h"
#include "hook.h" #include "hook.h"
#include "message.h" #include "message.h"
#include "spy.h" #include "spy.h"
@ -34,25 +33,24 @@ LRESULT WINAPI SendMessage16( HWND16 hwnd16, UINT16 msg, WPARAM16 wparam, LPARAM
/* first the WH_CALLWNDPROC hook */ /* first the WH_CALLWNDPROC hook */
if (HOOK_IsHooked( WH_CALLWNDPROC )) if (HOOK_IsHooked( WH_CALLWNDPROC ))
{ {
CWPSTRUCT16 *cwp; CWPSTRUCT16 cwp;
SEGPTR seg_cwp;
if ((cwp = SEGPTR_NEW(CWPSTRUCT16))) cwp.hwnd = hwnd16;
cwp.message = msg;
cwp.wParam = wparam;
cwp.lParam = lparam;
seg_cwp = MapLS( &cwp );
HOOK_CallHooks16( WH_CALLWNDPROC, HC_ACTION, 1, seg_cwp );
UnMapLS( seg_cwp );
if (cwp.hwnd != hwnd16)
{ {
cwp->hwnd = hwnd16; hwnd16 = cwp.hwnd;
cwp->message = msg; hwnd = WIN_Handle32( hwnd16 );
cwp->wParam = wparam;
cwp->lParam = lparam;
HOOK_CallHooks16( WH_CALLWNDPROC, HC_ACTION, 1, SEGPTR_GET(cwp) );
if (cwp->hwnd != hwnd16)
{
hwnd16 = cwp->hwnd;
hwnd = WIN_Handle32( hwnd16 );
}
msg = cwp->message;
wparam = cwp->wParam;
lparam = cwp->lParam;
SEGPTR_FREE( cwp );
} }
msg = cwp.message;
wparam = cwp.wParam;
lparam = cwp.lParam;
} }
if (!(winproc = (WNDPROC16)GetWindowLong16( hwnd16, GWL_WNDPROC ))) return 0; if (!(winproc = (WNDPROC16)GetWindowLong16( hwnd16, GWL_WNDPROC ))) return 0;

View File

@ -10,7 +10,6 @@
#include "wingdi.h" #include "wingdi.h"
#include "wine/winuser16.h" #include "wine/winuser16.h"
#include "wine/server.h" #include "wine/server.h"
#include "heap.h"
/* size of buffer needed to store an atom string */ /* size of buffer needed to store an atom string */
#define ATOM_BUFFER_SIZE 256 #define ATOM_BUFFER_SIZE 256
@ -289,19 +288,20 @@ INT16 WINAPI EnumProps16( HWND16 hwnd, PROPENUMPROC16 func )
if (list) if (list)
{ {
char *string = SEGPTR_ALLOC( ATOM_BUFFER_SIZE ); char string[ATOM_BUFFER_SIZE];
SEGPTR segptr = MapLS( string );
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
if (list[i].string) /* it was a string originally */ if (list[i].string) /* it was a string originally */
{ {
if (!GlobalGetAtomNameA( list[i].atom, string, ATOM_BUFFER_SIZE )) continue; if (!GlobalGetAtomNameA( list[i].atom, string, ATOM_BUFFER_SIZE )) continue;
ret = PROP_CallTo16_word_wlw( func, hwnd, SEGPTR_GET(string), list[i].handle ); ret = PROP_CallTo16_word_wlw( func, hwnd, segptr, list[i].handle );
} }
else else
ret = PROP_CallTo16_word_wlw( func, hwnd, list[i].atom, list[i].handle ); ret = PROP_CallTo16_word_wlw( func, hwnd, list[i].atom, list[i].handle );
if (!ret) break; if (!ret) break;
} }
SEGPTR_FREE( string ); UnMapLS( segptr );
HeapFree( GetProcessHeap(), 0, list ); HeapFree( GetProcessHeap(), 0, list );
} }
return ret; return ret;

View File

@ -6,7 +6,6 @@
#include <stdlib.h> #include <stdlib.h>
#include "win16drv.h" #include "win16drv.h"
#include "heap.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(win16drv); DEFAULT_DEBUG_CHANNEL(win16drv);
@ -32,7 +31,7 @@ HBRUSH WIN16DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush )
{ {
nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_BRUSH, nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_BRUSH,
&lBrush16, 0, 0); &lBrush16, 0, 0);
physDev->BrushInfo = SEGPTR_ALLOC( nSize ); physDev->BrushInfo = HeapAlloc( GetProcessHeap(), 0, nSize );
} }

View File

@ -10,7 +10,6 @@
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "win16drv.h" #include "win16drv.h"
#include "font.h" #include "font.h"
#include "heap.h"
#include "gdi.h" #include "gdi.h"
#include "debugtools.h" #include "debugtools.h"
@ -97,12 +96,12 @@ HFONT WIN16DRV_FONT_SelectObject( DC * dc, HFONT hfont)
if( physDev->FontInfo && if( physDev->FontInfo &&
HeapSize( GetProcessHeap(), 0, physDev->FontInfo ) < nSize ) HeapSize( GetProcessHeap(), 0, physDev->FontInfo ) < nSize )
{ {
SEGPTR_FREE( physDev->FontInfo ); HeapFree( GetProcessHeap(), 0, physDev->FontInfo );
physDev->FontInfo = NULL; physDev->FontInfo = NULL;
} }
if( !physDev->FontInfo ) if( !physDev->FontInfo )
physDev->FontInfo = SEGPTR_ALLOC( nSize ); physDev->FontInfo = HeapAlloc( GetProcessHeap(), 0, nSize );
nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, DRVOBJ_FONT, nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, DRVOBJ_FONT,

View File

@ -13,7 +13,6 @@
#include "win16drv.h" #include "win16drv.h"
#include "gdi.h" #include "gdi.h"
#include "bitmap.h" #include "bitmap.h"
#include "heap.h"
#include "font.h" #include "font.h"
#include "debugtools.h" #include "debugtools.h"

View File

@ -5,7 +5,6 @@
*/ */
#include "win16drv.h" #include "win16drv.h"
#include "heap.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(win16drv); DEFAULT_DEBUG_CHANNEL(win16drv);
@ -35,7 +34,7 @@ HPEN WIN16DRV_PEN_SelectObject( DC * dc, HPEN hpen )
{ {
nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_PEN, nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_PEN,
&lPen16, 0, 0); &lPen16, 0, 0);
physDev->PenInfo = SEGPTR_ALLOC( nSize ); physDev->PenInfo = HeapAlloc( GetProcessHeap(), 0, nSize );
} }
nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, DRVOBJ_PEN, nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, DRVOBJ_PEN,

View File

@ -13,7 +13,6 @@
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "winuser.h" #include "winuser.h"
#include "win16drv.h" #include "win16drv.h"
#include "heap.h"
#include "debugtools.h" #include "debugtools.h"
#include "bitmap.h" #include "bitmap.h"
@ -253,8 +252,8 @@ WORD PRTDRV_Enable(LPVOID lpDevInfo, WORD wStyle, LPCSTR lpDestDevType,
pLPD = FindPrinterDriverFromName((char *)lpDeviceName); pLPD = FindPrinterDriverFromName((char *)lpDeviceName);
if (pLPD != NULL) { if (pLPD != NULL) {
LONG lP5; LONG lP5;
DeviceCaps *lP1; DeviceCaps devcaps;
LPSTR lP3,lP4; SEGPTR lP1, lP3,lP4;
WORD wP2; WORD wP2;
if (!pLPD->fn[FUNC_ENABLE]) { if (!pLPD->fn[FUNC_ENABLE]) {
@ -263,30 +262,25 @@ WORD PRTDRV_Enable(LPVOID lpDevInfo, WORD wStyle, LPCSTR lpDestDevType,
} }
if (wStyle == INITPDEVICE) if (wStyle == INITPDEVICE)
lP1 = (DeviceCaps*)lpDevInfo;/* 16 bit segmented ptr already */ lP1 = (SEGPTR)lpDevInfo;/* 16 bit segmented ptr already */
else else
lP1 = SEGPTR_NEW(DeviceCaps); lP1 = MapLS(&devcaps);
wP2 = wStyle; wP2 = wStyle;
/* SEGPTR_STRDUP handles NULL like a charm ... */ /* MapLS handles NULL like a charm ... */
lP3 = SEGPTR_STRDUP(lpDestDevType); lP3 = MapLS(lpDestDevType);
lP4 = SEGPTR_STRDUP(lpOutputFile); lP4 = MapLS(lpOutputFile);
lP5 = (LONG)lpData; lP5 = (LONG)lpData;
wRet = PRTDRV_CallTo16_word_lwlll(pLPD->fn[FUNC_ENABLE], wRet = PRTDRV_CallTo16_word_lwlll(pLPD->fn[FUNC_ENABLE], lP1, wP2, lP3, lP4, lP5);
(wStyle==INITPDEVICE)?(SEGPTR)lP1:SEGPTR_GET(lP1), UnMapLS(lP3);
wP2, UnMapLS(lP4);
SEGPTR_GET(lP3),
SEGPTR_GET(lP4),
lP5);
SEGPTR_FREE(lP3);
SEGPTR_FREE(lP4);
/* Get the data back */ /* Get the data back */
if (lP1 != 0 && wStyle != INITPDEVICE) { if (lP1 != 0 && wStyle != INITPDEVICE) {
memcpy(lpDevInfo,lP1,sizeof(DeviceCaps)); memcpy(lpDevInfo,&devcaps,sizeof(DeviceCaps));
SEGPTR_FREE(lP1); UnMapLS(lP1);
} }
} }
TRACE("return %x\n", wRet); TRACE("return %x\n", wRet);
@ -308,8 +302,7 @@ WORD PRTDRV_EnumDFonts(LPPDEVICE lpDestDev, LPSTR lpFaceName,
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL) if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
{ {
LONG lP1, lP4; SEGPTR lP1, lP2, lP4;
LPBYTE lP2;
if (pLPD->fn[FUNC_ENUMDFONTS] == NULL) { if (pLPD->fn[FUNC_ENUMDFONTS] == NULL) {
WARN("Not supported by driver\n"); WARN("Not supported by driver\n");
@ -317,16 +310,11 @@ WORD PRTDRV_EnumDFonts(LPPDEVICE lpDestDev, LPSTR lpFaceName,
} }
lP1 = (SEGPTR)lpDestDev; lP1 = (SEGPTR)lpDestDev;
if(lpFaceName) lP2 = MapLS(lpFaceName);
lP2 = SEGPTR_STRDUP(lpFaceName);
else
lP2 = NULL;
lP4 = (LONG)lpClientData; lP4 = (LONG)lpClientData;
wRet = PRTDRV_CallTo16_word_llll( pLPD->fn[FUNC_ENUMDFONTS], wRet = PRTDRV_CallTo16_word_llll( pLPD->fn[FUNC_ENUMDFONTS], lP1, lP2,
lP1, SEGPTR_GET(lP2), (LONG)lpCallbackFunc,lP4);
(LONG)lpCallbackFunc,lP4); UnMapLS(lP2);
if(lpFaceName)
SEGPTR_FREE(lP2);
} else } else
WARN("Failed to find device\n"); WARN("Failed to find device\n");
@ -395,11 +383,8 @@ WORD PRTDRV_Output(LPPDEVICE lpDestDev,
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL) if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
{ {
LONG lP1, lP5, lP6, lP7; LONG lP1, lP4, lP5, lP6, lP7, lP8;
LPPOINT16 lP4;
LPRECT16 lP8;
WORD wP2, wP3; WORD wP2, wP3;
int nSize;
if (pLPD->fn[FUNC_OUTPUT] == NULL) if (pLPD->fn[FUNC_OUTPUT] == NULL)
{ {
WARN("Not supported by driver\n"); WARN("Not supported by driver\n");
@ -409,11 +394,9 @@ WORD PRTDRV_Output(LPPDEVICE lpDestDev,
lP1 = lpDestDev; lP1 = lpDestDev;
wP2 = wStyle; wP2 = wStyle;
wP3 = wCount; wP3 = wCount;
nSize = sizeof(POINT16) * wCount; lP4 = MapLS( points );
lP4 = (LPPOINT16 )SEGPTR_ALLOC(nSize); lP5 = MapLS( lpPen );
memcpy(lP4,points,nSize); lP6 = MapLS( lpBrush );
lP5 = SEGPTR_GET( lpPen );
lP6 = SEGPTR_GET( lpBrush );
lP7 = lpDrawMode; lP7 = lpDrawMode;
if (hClipRgn) if (hClipRgn)
@ -432,41 +415,39 @@ WORD PRTDRV_Output(LPPDEVICE lpDestDev,
if( clip->rdh.nCount == 0 ) if( clip->rdh.nCount == 0 )
{ {
wRet = PRTDRV_CallTo16_word_lwwlllll(pLPD->fn[FUNC_OUTPUT], wRet = PRTDRV_CallTo16_word_lwwlllll(pLPD->fn[FUNC_OUTPUT],
lP1, wP2, wP3, lP1, wP2, wP3, lP4,
SEGPTR_GET(lP4),
lP5, lP6, lP7, lP5, lP6, lP7,
(SEGPTR) NULL); (SEGPTR) NULL);
} }
else else
{ {
RECT *pRect; RECT *pRect;
lP8 = SEGPTR_NEW(RECT16); RECT16 r16;
lP8 = MapLS(&r16);
for(pRect = (RECT *)clip->Buffer; for(pRect = (RECT *)clip->Buffer;
pRect < (RECT *)clip->Buffer + clip->rdh.nCount; pRect++) pRect < (RECT *)clip->Buffer + clip->rdh.nCount; pRect++)
{ {
CONV_RECT32TO16( pRect, lP8 ); CONV_RECT32TO16( pRect, &r16 );
TRACE("rect = %d,%d - %d,%d\n", TRACE("rect = %d,%d - %d,%d\n", r16.left, r16.top, r16.right, r16.bottom );
lP8->left, lP8->top, lP8->right, lP8->bottom );
wRet = PRTDRV_CallTo16_word_lwwlllll(pLPD->fn[FUNC_OUTPUT], wRet = PRTDRV_CallTo16_word_lwwlllll(pLPD->fn[FUNC_OUTPUT],
lP1, wP2, wP3, lP1, wP2, wP3, lP4,
SEGPTR_GET(lP4), lP5, lP6, lP7, lP8);
lP5, lP6, lP7,
SEGPTR_GET(lP8));
} }
SEGPTR_FREE(lP8); UnMapLS(lP8);
} }
HeapFree( GetProcessHeap(), 0, clip ); HeapFree( GetProcessHeap(), 0, clip );
} }
else else
{ {
wRet = PRTDRV_CallTo16_word_lwwlllll(pLPD->fn[FUNC_OUTPUT], wRet = PRTDRV_CallTo16_word_lwwlllll(pLPD->fn[FUNC_OUTPUT],
lP1, wP2, wP3, lP1, wP2, wP3, lP4,
SEGPTR_GET(lP4),
lP5, lP6, lP7, (SEGPTR) NULL); lP5, lP6, lP7, (SEGPTR) NULL);
} }
SEGPTR_FREE(lP4); UnMapLS( lP4 );
UnMapLS( lP5 );
UnMapLS( lP6 );
} }
TRACE("PRTDRV_Output return %d\n", wRet); TRACE("PRTDRV_Output return %d\n", wRet);
return wRet; return wRet;
@ -489,8 +470,6 @@ DWORD PRTDRV_RealizeObject(LPPDEVICE lpDestDev, WORD wStyle,
{ {
LONG lP1, lP3, lP4, lP5; LONG lP1, lP3, lP4, lP5;
WORD wP2; WORD wP2;
LPBYTE lpBuf = NULL;
unsigned int nSize;
if (pLPD->fn[FUNC_REALIZEOBJECT] == NULL) if (pLPD->fn[FUNC_REALIZEOBJECT] == NULL)
{ {
@ -500,51 +479,15 @@ DWORD PRTDRV_RealizeObject(LPPDEVICE lpDestDev, WORD wStyle,
lP1 = lpDestDev; lP1 = lpDestDev;
wP2 = wStyle; wP2 = wStyle;
lP3 = MapLS( lpInObj );
switch ((INT16)wStyle) lP4 = MapLS( lpOutObj );
{
case DRVOBJ_BRUSH:
nSize = sizeof (LOGBRUSH16);
break;
case DRVOBJ_FONT:
nSize = sizeof(LOGFONT16);
break;
case DRVOBJ_PEN:
nSize = sizeof(LOGPEN16);
break;
case -DRVOBJ_BRUSH:
case -DRVOBJ_FONT:
case -DRVOBJ_PEN:
nSize = -1;
break;
case DRVOBJ_PBITMAP:
default:
WARN("Object type %d not supported\n", wStyle);
nSize = 0;
}
if(nSize != -1)
{
lpBuf = SEGPTR_ALLOC(nSize);
memcpy(lpBuf, lpInObj, nSize);
lP3 = SEGPTR_GET(lpBuf);
}
else
lP3 = SEGPTR_GET( lpInObj );
lP4 = SEGPTR_GET( lpOutObj );
lP5 = lpTextXForm; lP5 = lpTextXForm;
TRACE("Calling Realize %08lx %04x %08lx %08lx %08lx\n", TRACE("Calling Realize %08lx %04x %08lx %08lx %08lx\n",
lP1, wP2, lP3, lP4, lP5); lP1, wP2, lP3, lP4, lP5);
dwRet = PRTDRV_CallTo16_long_lwlll(pLPD->fn[FUNC_REALIZEOBJECT], dwRet = PRTDRV_CallTo16_long_lwlll(pLPD->fn[FUNC_REALIZEOBJECT],
lP1, wP2, lP3, lP4, lP5); lP1, wP2, lP3, lP4, lP5);
if(lpBuf) UnMapLS( lP3 );
SEGPTR_FREE(lpBuf); UnMapLS( lP4 );
} }
TRACE("return %x\n", dwRet); TRACE("return %x\n", dwRet);
return dwRet; return dwRet;
@ -572,7 +515,7 @@ DWORD PRTDRV_StretchBlt(LPPDEVICE lpDestDev,
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL) if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
{ {
LONG lP1,lP6, lP11, lP12, lP13; LONG lP1,lP6, lP11, lP12, lP13;
LPRECT16 lP14; SEGPTR lP14;
WORD wP2, wP3, wP4, wP5, wP7, wP8, wP9, wP10; WORD wP2, wP3, wP4, wP5, wP7, wP8, wP9, wP10;
if (pLPD->fn[FUNC_STRETCHBLT] == NULL) if (pLPD->fn[FUNC_STRETCHBLT] == NULL)
@ -591,22 +534,15 @@ DWORD PRTDRV_StretchBlt(LPPDEVICE lpDestDev,
wP9 = wSrcXext; wP9 = wSrcXext;
wP10 = wSrcYext; wP10 = wSrcYext;
lP11 = Rop3; lP11 = Rop3;
lP12 = SEGPTR_GET( lpBrush ); lP12 = MapLS( lpBrush );
lP13 = lpDrawMode; lP13 = lpDrawMode;
if (lpClipRect != NULL) lP14 = MapLS(lpClipRect);
{
lP14 = SEGPTR_NEW(RECT16);
memcpy(lP14,lpClipRect,sizeof(RECT16));
}
else
lP14 = 0L;
wRet = PRTDRV_CallTo16_word_lwwwwlwwwwllll(pLPD->fn[FUNC_STRETCHBLT], wRet = PRTDRV_CallTo16_word_lwwwwlwwwwllll(pLPD->fn[FUNC_STRETCHBLT],
lP1, wP2, wP3, wP4, wP5, lP1, wP2, wP3, wP4, wP5,
lP6, wP7, wP8, wP9, wP10, lP6, wP7, wP8, wP9, wP10,
lP11, lP12, lP13, lP11, lP12, lP13, lP14);
SEGPTR_GET(lP14)); UnMapLS(lP12);
SEGPTR_FREE(lP14); UnMapLS(lP14);
TRACE("Called StretchBlt ret %d\n",wRet); TRACE("Called StretchBlt ret %d\n",wRet);
} }
return wRet; return wRet;
@ -625,12 +561,9 @@ DWORD PRTDRV_ExtTextOut(LPPDEVICE lpDestDev, WORD wDestXOrg, WORD wDestYOrg,
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL) if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
{ {
LONG lP1, lP7, lP8, lP9, lP10; LONG lP1, lP4, lP5, lP7, lP8, lP9, lP10, lP11;
LPSTR lP5;
LPRECT16 lP4,lP11;
WORD wP2, wP3, wP12; WORD wP2, wP3, wP12;
INT16 iP6; INT16 iP6;
unsigned int nSize = -1;
if (pLPD->fn[FUNC_EXTTEXTOUT] == NULL) if (pLPD->fn[FUNC_EXTTEXTOUT] == NULL)
{ {
@ -641,56 +574,30 @@ DWORD PRTDRV_ExtTextOut(LPPDEVICE lpDestDev, WORD wDestXOrg, WORD wDestYOrg,
lP1 = lpDestDev; lP1 = lpDestDev;
wP2 = wDestXOrg; wP2 = wDestXOrg;
wP3 = wDestYOrg; wP3 = wDestYOrg;
lP4 = MapLS( lpClipRect );
if (lpClipRect != NULL) { lP5 = MapLS( lpString );
lP4 = SEGPTR_NEW(RECT16);
TRACE("Adding lpClipRect\n");
memcpy(lP4,lpClipRect,sizeof(RECT16));
} else
lP4 = 0L;
if (lpString != NULL) {
nSize = strlen(lpString);
if (nSize>abs(wCount))
nSize = abs(wCount);
lP5 = SEGPTR_ALLOC(nSize+1);
TRACE("Adding lpString (nSize is %d)\n",nSize);
memcpy(lP5,lpString,nSize);
*((char *)lP5 + nSize) = '\0';
} else
lP5 = 0L;
iP6 = wCount; iP6 = wCount;
/* This should be realized by the driver, so in 16bit data area */ /* This should be realized by the driver, so in 16bit data area */
lP7 = SEGPTR_GET( lpFontInfo ); lP7 = MapLS( lpFontInfo );
lP8 = lpDrawMode; lP8 = lpDrawMode;
lP9 = lpTextXForm; lP9 = lpTextXForm;
if (lpCharWidths != NULL) if (lpCharWidths != NULL)
FIXME("Char widths not supported\n"); FIXME("Char widths not supported\n");
lP10 = 0; lP10 = 0;
lP11 = MapLS( lpOpaqueRect );
if (lpOpaqueRect != NULL) {
lP11 = SEGPTR_NEW(RECT16);
TRACE("Adding lpOpaqueRect\n");
memcpy(lP11,lpOpaqueRect,sizeof(RECT16));
} else
lP11 = 0L;
wP12 = wOptions; wP12 = wOptions;
TRACE("Calling ExtTextOut 0x%lx 0x%x 0x%x %p\n", TRACE("Calling ExtTextOut 0x%lx 0x%x 0x%x 0x%lx\n", lP1, wP2, wP3, lP4);
lP1, wP2, wP3, lP4); TRACE("%s 0x%x 0x%lx 0x%lx\n", lpString, iP6, lP7, lP8);
TRACE("%*s 0x%x 0x%lx 0x%lx\n", TRACE("0x%lx 0x%lx 0x%lx 0x%x\n",
nSize,lP5, iP6, lP7, lP8);
TRACE("0x%lx 0x%lx %p 0x%x\n",
lP9, lP10, lP11, wP12); lP9, lP10, lP11, wP12);
dwRet = PRTDRV_CallTo16_long_lwwllwlllllw(pLPD->fn[FUNC_EXTTEXTOUT], dwRet = PRTDRV_CallTo16_long_lwwllwlllllw(pLPD->fn[FUNC_EXTTEXTOUT], lP1, wP2, wP3,
lP1, wP2, wP3, lP4, lP5, iP6, lP7, lP8, lP9, lP10, lP11, wP12);
SEGPTR_GET(lP4), UnMapLS( lP4 );
SEGPTR_GET(lP5), iP6, lP7, UnMapLS( lP5 );
lP8, lP9, lP10, UnMapLS( lP7 );
SEGPTR_GET(lP11), wP12); UnMapLS( lP11 );
} }
TRACE("return %lx\n", dwRet); TRACE("return %lx\n", dwRet);
return dwRet; return dwRet;
@ -800,9 +707,8 @@ WORD PRTDRV_GetCharWidth(LPPDEVICE lpDestDev, LPINT lpBuffer,
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL) if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
{ {
LONG lP1, lP5, lP6, lP7; LONG lP1, lP2, lP5, lP6, lP7;
LPWORD lP2; WORD wP3, wP4;
WORD wP3, wP4, i;
if (pLPD->fn[FUNC_GETCHARWIDTH] == NULL) if (pLPD->fn[FUNC_GETCHARWIDTH] == NULL)
{ {
@ -811,21 +717,18 @@ WORD PRTDRV_GetCharWidth(LPPDEVICE lpDestDev, LPINT lpBuffer,
} }
lP1 = lpDestDev; lP1 = lpDestDev;
lP2 = SEGPTR_ALLOC( (wLastChar - wFirstChar + 1) * sizeof(WORD) ); lP2 = MapLS( lpBuffer );
wP3 = wFirstChar; wP3 = wFirstChar;
wP4 = wLastChar; wP4 = wLastChar;
lP5 = SEGPTR_GET( lpFontInfo ); lP5 = MapLS( lpFontInfo );
lP6 = lpDrawMode; lP6 = lpDrawMode;
lP7 = lpTextXForm; lP7 = lpTextXForm;
wRet = PRTDRV_CallTo16_word_llwwlll(pLPD->fn[FUNC_GETCHARWIDTH], wRet = PRTDRV_CallTo16_word_llwwlll(pLPD->fn[FUNC_GETCHARWIDTH],
lP1, SEGPTR_GET(lP2), wP3, lP1, lP2, wP3, wP4, lP5, lP6, lP7 );
wP4, lP5, lP6, lP7 );
for(i = 0; i <= wLastChar - wFirstChar; i++) UnMapLS( lP2 );
lpBuffer[i] = (INT) lP2[i]; UnMapLS( lP5 );
SEGPTR_FREE(lP2);
} }
return wRet; return wRet;
} }
@ -840,10 +743,8 @@ INT WIN16DRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd, LPDEVMODEA lpdmOutput,
DWORD dwMode) DWORD dwMode)
{ {
LOADED_PRINTER_DRIVER *pLPD = LoadPrinterDriver(lpszDriver); LOADED_PRINTER_DRIVER *pLPD = LoadPrinterDriver(lpszDriver);
LPDEVMODEA lpSegOut = NULL, lpSegIn = NULL; SEGPTR lpSegOut, lpSegIn, lpSegDevice, lpSegPort, lpSegProfile;
LPSTR lpSegDevice, lpSegPort, lpSegProfile;
INT16 wRet; INT16 wRet;
WORD wOutSize = 0, wInSize = 0;
if(!pLPD) return -1; if(!pLPD) return -1;
@ -851,42 +752,19 @@ INT WIN16DRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd, LPDEVMODEA lpdmOutput,
WARN("No EXTDEVICEMODE\n"); WARN("No EXTDEVICEMODE\n");
return -1; return -1;
} }
lpSegDevice = SEGPTR_STRDUP(lpszDevice); lpSegDevice = MapLS(lpszDevice);
lpSegPort = SEGPTR_STRDUP(lpszPort); lpSegPort = MapLS(lpszPort);
lpSegProfile = SEGPTR_STRDUP(lpszProfile); lpSegProfile = MapLS(lpszProfile);
if(lpdmOutput) { lpSegOut = MapLS(lpdmOutput);
/* We don't know how big this will be so we call the driver's lpSegIn = MapLS(lpdmInput);
ExtDeviceMode to find out */ wRet = PRTDRV_CallTo16_word_wwlllllw( pLPD->fn[FUNC_EXTDEVICEMODE], hwnd, pLPD->hInst,
wOutSize = PRTDRV_CallTo16_word_wwlllllw( lpSegOut, lpSegDevice, lpSegPort, lpSegIn,
pLPD->fn[FUNC_EXTDEVICEMODE], hwnd, pLPD->hInst, 0, lpSegProfile, dwMode );
SEGPTR_GET(lpSegDevice), SEGPTR_GET(lpSegPort), 0, UnMapLS(lpSegOut);
SEGPTR_GET(lpSegProfile), 0 ); UnMapLS(lpSegIn);
lpSegOut = SEGPTR_ALLOC(wOutSize); UnMapLS(lpSegDevice);
} UnMapLS(lpSegPort);
if(lpdmInput) { UnMapLS(lpSegProfile);
/* This time we get the information from the fields */
wInSize = lpdmInput->dmSize + lpdmInput->dmDriverExtra;
lpSegIn = SEGPTR_ALLOC(wInSize);
memcpy(lpSegIn, lpdmInput, wInSize);
}
wRet = PRTDRV_CallTo16_word_wwlllllw( pLPD->fn[FUNC_EXTDEVICEMODE],
hwnd, pLPD->hInst,
SEGPTR_GET(lpSegOut),
SEGPTR_GET(lpSegDevice),
SEGPTR_GET(lpSegPort),
SEGPTR_GET(lpSegIn),
SEGPTR_GET(lpSegProfile),
dwMode );
if(lpSegOut) {
memcpy(lpdmOutput, lpSegOut, wOutSize);
SEGPTR_FREE(lpSegOut);
}
if(lpSegIn) {
SEGPTR_FREE(lpSegIn);
}
SEGPTR_FREE(lpSegDevice);
SEGPTR_FREE(lpSegPort);
SEGPTR_FREE(lpSegProfile);
return wRet; return wRet;
} }
@ -902,10 +780,8 @@ DWORD WIN16DRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice,
LPSTR lpszOutput, LPDEVMODEA lpDevMode) LPSTR lpszOutput, LPDEVMODEA lpDevMode)
{ {
LOADED_PRINTER_DRIVER *pLPD = LoadPrinterDriver(lpszDriver); LOADED_PRINTER_DRIVER *pLPD = LoadPrinterDriver(lpszDriver);
LPVOID lpSegdm = NULL, lpSegOut = NULL; SEGPTR lpSegdm, lpSegOut, lpSegDevice, lpSegPort;
LPSTR lpSegDevice, lpSegPort;
DWORD dwRet; DWORD dwRet;
INT OutputSize;
TRACE("%s,%s,%s,%d,%p,%p\n", lpszDriver, lpszDevice, lpszPort, TRACE("%s,%s,%s,%d,%p,%p\n", lpszDriver, lpszDevice, lpszPort,
fwCapability, lpszOutput, lpDevMode); fwCapability, lpszOutput, lpDevMode);
@ -916,107 +792,15 @@ DWORD WIN16DRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice,
WARN("No DEVICECAPABILITES\n"); WARN("No DEVICECAPABILITES\n");
return -1; return -1;
} }
lpSegDevice = SEGPTR_STRDUP(lpszDevice); lpSegDevice = MapLS(lpszDevice);
lpSegPort = SEGPTR_STRDUP(lpszPort); lpSegPort = MapLS(lpszPort);
lpSegdm = MapLS(lpDevMode);
if(lpDevMode) { lpSegOut = MapLS(lpszOutput);
lpSegdm = SEGPTR_ALLOC(lpDevMode->dmSize + lpDevMode->dmDriverExtra); dwRet = PRTDRV_CallTo16_long_llwll( pLPD->fn[FUNC_DEVICECAPABILITIES],
memcpy(lpSegdm, lpDevMode, lpDevMode->dmSize + lpSegDevice, lpSegPort, fwCapability, lpSegOut, lpSegdm );
lpDevMode->dmDriverExtra); UnMapLS(lpSegOut);
} UnMapLS(lpSegdm);
UnMapLS(lpSegDevice);
dwRet = PRTDRV_CallTo16_long_llwll( UnMapLS(lpSegPort);
pLPD->fn[FUNC_DEVICECAPABILITIES],
SEGPTR_GET(lpSegDevice), SEGPTR_GET(lpSegPort),
fwCapability, 0, SEGPTR_GET(lpSegdm) );
if(dwRet == -1) return -1;
switch(fwCapability) {
case DC_BINADJUST:
case DC_COLLATE:
case DC_COLORDEVICE:
case DC_COPIES:
case DC_DRIVER:
case DC_DUPLEX:
case DC_EMF_COMPLIANT:
case DC_EXTRA:
case DC_FIELDS:
case DC_MANUFACTURER:
case DC_MAXEXTENT:
case DC_MINEXTENT:
case DC_MODEL:
case DC_ORIENTATION:
case DC_PRINTERMEM:
case DC_PRINTRATEUNIT:
case DC_SIZE:
case DC_TRUETYPE:
case DC_VERSION:
OutputSize = 0;
break;
case DC_BINNAMES:
OutputSize = 24 * dwRet;
break;
case DC_BINS:
case DC_PAPERS:
OutputSize = sizeof(WORD) * dwRet;
break;
case DC_DATATYPE_PRODUCED:
OutputSize = dwRet;
FIXME("%ld DataTypes supported. Don't know how long to make buffer!\n",
dwRet);
break;
case DC_ENUMRESOLUTIONS:
OutputSize = 2 * sizeof(LONG) * dwRet;
break;
case DC_FILEDEPENDENCIES:
case DC_MEDIAREADY:
case DC_PAPERNAMES:
OutputSize = 64 * dwRet;
break;
case DC_NUP:
OutputSize = sizeof(DWORD) * dwRet;
break;
case DC_PAPERSIZE:
OutputSize = sizeof(POINT16) * dwRet;
break;
case DC_PERSONALITY:
OutputSize = 32 * dwRet;
break;
default:
FIXME("Unsupported capability %d\n", fwCapability);
OutputSize = 0;
break;
}
if(OutputSize && lpszOutput) {
lpSegOut = SEGPTR_ALLOC(OutputSize);
dwRet = PRTDRV_CallTo16_long_llwll(
pLPD->fn[FUNC_DEVICECAPABILITIES],
SEGPTR_GET(lpSegDevice),
SEGPTR_GET(lpSegPort),
fwCapability,
SEGPTR_GET(lpSegOut),
SEGPTR_GET(lpSegdm) );
memcpy(lpszOutput, lpSegOut, OutputSize);
SEGPTR_FREE(lpSegOut);
}
if(lpSegdm) {
memcpy(lpDevMode, lpSegdm, lpDevMode->dmSize +
lpDevMode->dmDriverExtra);
SEGPTR_FREE(lpSegdm);
}
SEGPTR_FREE(lpSegDevice);
SEGPTR_FREE(lpSegPort);
return dwRet; return dwRet;
} }

View File

@ -804,13 +804,13 @@ HINSTANCE16 WINAPI WinExec16( LPCSTR lpCmdLine, UINT16 nCmdShow )
{ {
args++; args++;
arglen = strlen(args); arglen = strlen(args);
cmdline = SEGPTR_ALLOC( 2 + arglen ); cmdline = HeapAlloc( GetProcessHeap(), 0, 2 + arglen );
cmdline[0] = (BYTE)arglen; cmdline[0] = (BYTE)arglen;
strcpy( cmdline + 1, args ); strcpy( cmdline + 1, args );
} }
else else
{ {
cmdline = SEGPTR_ALLOC( 2 ); cmdline = HeapAlloc( GetProcessHeap(), 0, 2 );
cmdline[0] = cmdline[1] = 0; cmdline[0] = cmdline[1] = 0;
} }
@ -819,22 +819,22 @@ HINSTANCE16 WINAPI WinExec16( LPCSTR lpCmdLine, UINT16 nCmdShow )
if (SearchPathA( NULL, name, ".exe", sizeof(buffer), buffer, NULL )) if (SearchPathA( NULL, name, ".exe", sizeof(buffer), buffer, NULL ))
{ {
LOADPARAMS16 params; LOADPARAMS16 params;
WORD *showCmd = SEGPTR_ALLOC( 2*sizeof(WORD) ); WORD showCmd[2];
showCmd[0] = 2; showCmd[0] = 2;
showCmd[1] = nCmdShow; showCmd[1] = nCmdShow;
params.hEnvironment = 0; params.hEnvironment = 0;
params.cmdLine = SEGPTR_GET(cmdline); params.cmdLine = MapLS( cmdline );
params.showCmd = SEGPTR_GET(showCmd); params.showCmd = MapLS( showCmd );
params.reserved = 0; params.reserved = 0;
ret = LoadModule16( buffer, &params ); ret = LoadModule16( buffer, &params );
UnMapLS( params.cmdLine );
SEGPTR_FREE( showCmd ); UnMapLS( params.showCmd );
SEGPTR_FREE( cmdline );
} }
else ret = GetLastError(); else ret = GetLastError();
HeapFree( GetProcessHeap(), 0, cmdline );
if (name != lpCmdLine) HeapFree( GetProcessHeap(), 0, name ); if (name != lpCmdLine) HeapFree( GetProcessHeap(), 0, name );
if (ret == 21) /* 32-bit module */ if (ret == 21) /* 32-bit module */

View File

@ -10,8 +10,8 @@
#include <assert.h> #include <assert.h>
#include "winerror.h" #include "winerror.h"
#include "winnls.h" #include "winnls.h"
#include "wine/unicode.h"
#include "font.h" #include "font.h"
#include "heap.h"
#include "options.h" #include "options.h"
#include "debugtools.h" #include "debugtools.h"
#include "gdi.h" #include "gdi.h"
@ -694,31 +694,23 @@ INT16 WINAPI EnumFontFamiliesEx16( HDC16 hDC, LPLOGFONT16 plf,
if (enum_func) if (enum_func)
{ {
LPNEWTEXTMETRICEX16 lptm16 = SEGPTR_ALLOC( sizeof(NEWTEXTMETRICEX16) ); NEWTEXTMETRICEX16 tm16;
if( lptm16 ) ENUMLOGFONTEX16 lf16;
{ fontEnum16 fe16;
LPENUMLOGFONTEX16 lplf16 = SEGPTR_ALLOC( sizeof(ENUMLOGFONTEX16) ); LOGFONTW lfW;
if( lplf16 ) FONT_LogFont16ToW(plf, &lfW);
{
fontEnum16 fe16;
LOGFONTW lfW;
FONT_LogFont16ToW(plf, &lfW);
fe16.lpLogFontParam = plf; fe16.lpLogFontParam = plf;
fe16.lpEnumFunc = efproc; fe16.lpEnumFunc = efproc;
fe16.lpData = lParam; fe16.lpData = lParam;
fe16.lpTextMetric = &tm16;
fe16.lpTextMetric = lptm16; fe16.lpLogFont = &lf16;
fe16.lpLogFont = lplf16; fe16.segTextMetric = MapLS( &tm16 );
fe16.segTextMetric = SEGPTR_GET(lptm16); fe16.segLogFont = MapLS( &lf16 );
fe16.segLogFont = SEGPTR_GET(lplf16);
retVal = enum_func( hDC, &lfW, FONT_EnumInstance16, retVal = enum_func( hDC, &lfW, FONT_EnumInstance16, (LPARAM)&fe16 );
(LPARAM)&fe16 ); UnMapLS( fe16.segTextMetric );
SEGPTR_FREE(lplf16); UnMapLS( fe16.segLogFont );
}
SEGPTR_FREE(lptm16);
}
} }
return retVal; return retVal;
} }

View File

@ -19,7 +19,6 @@
#include "bitmap.h" #include "bitmap.h"
#include "brush.h" #include "brush.h"
#include "font.h" #include "font.h"
#include "heap.h"
#include "local.h" #include "local.h"
#include "palette.h" #include "palette.h"
#include "pen.h" #include "pen.h"
@ -873,8 +872,9 @@ INT16 WINAPI EnumObjects16( HDC16 hdc, INT16 nObjType,
}; };
INT16 i, retval = 0; INT16 i, retval = 0;
LOGPEN16 *pen; LOGPEN16 pen;
LOGBRUSH16 *brush = NULL; LOGBRUSH16 brush;
SEGPTR segptr;
TRACE("%04x %d %08lx %08lx\n", TRACE("%04x %d %08lx %08lx\n",
hdc, nObjType, (DWORD)lpEnumFunc, lParam ); hdc, nObjType, (DWORD)lpEnumFunc, lParam );
@ -882,47 +882,44 @@ INT16 WINAPI EnumObjects16( HDC16 hdc, INT16 nObjType,
{ {
case OBJ_PEN: case OBJ_PEN:
/* Enumerate solid pens */ /* Enumerate solid pens */
if (!(pen = SEGPTR_NEW(LOGPEN16))) break; segptr = MapLS( &pen );
for (i = 0; i < sizeof(solid_colors)/sizeof(solid_colors[0]); i++) for (i = 0; i < sizeof(solid_colors)/sizeof(solid_colors[0]); i++)
{ {
pen->lopnStyle = PS_SOLID; pen.lopnStyle = PS_SOLID;
pen->lopnWidth.x = 1; pen.lopnWidth.x = 1;
pen->lopnWidth.y = 0; pen.lopnWidth.y = 0;
pen->lopnColor = solid_colors[i]; pen.lopnColor = solid_colors[i];
retval = GDI_CallTo16_word_ll( lpEnumFunc, SEGPTR_GET(pen), lParam ); retval = GDI_CallTo16_word_ll( lpEnumFunc, segptr, lParam );
TRACE("solid pen %08lx, ret=%d\n", TRACE("solid pen %08lx, ret=%d\n", solid_colors[i], retval);
solid_colors[i], retval);
if (!retval) break; if (!retval) break;
} }
SEGPTR_FREE(pen); UnMapLS( segptr );
break; break;
case OBJ_BRUSH: case OBJ_BRUSH:
/* Enumerate solid brushes */ /* Enumerate solid brushes */
if (!(brush = SEGPTR_NEW(LOGBRUSH16))) break; segptr = MapLS( &brush );
for (i = 0; i < sizeof(solid_colors)/sizeof(solid_colors[0]); i++) for (i = 0; i < sizeof(solid_colors)/sizeof(solid_colors[0]); i++)
{ {
brush->lbStyle = BS_SOLID; brush.lbStyle = BS_SOLID;
brush->lbColor = solid_colors[i]; brush.lbColor = solid_colors[i];
brush->lbHatch = 0; brush.lbHatch = 0;
retval = GDI_CallTo16_word_ll( lpEnumFunc, SEGPTR_GET(brush), lParam ); retval = GDI_CallTo16_word_ll( lpEnumFunc, segptr, lParam );
TRACE("solid brush %08lx, ret=%d\n", TRACE("solid brush %08lx, ret=%d\n", solid_colors[i], retval);
solid_colors[i], retval);
if (!retval) break; if (!retval) break;
} }
/* Now enumerate hatched brushes */ /* Now enumerate hatched brushes */
if (retval) for (i = HS_HORIZONTAL; i <= HS_DIAGCROSS; i++) if (retval) for (i = HS_HORIZONTAL; i <= HS_DIAGCROSS; i++)
{ {
brush->lbStyle = BS_HATCHED; brush.lbStyle = BS_HATCHED;
brush->lbColor = RGB(0,0,0); brush.lbColor = RGB(0,0,0);
brush->lbHatch = i; brush.lbHatch = i;
retval = GDI_CallTo16_word_ll( lpEnumFunc, SEGPTR_GET(brush), lParam ); retval = GDI_CallTo16_word_ll( lpEnumFunc, segptr, lParam );
TRACE("hatched brush %d, ret=%d\n", TRACE("hatched brush %d, ret=%d\n", i, retval);
i, retval);
if (!retval) break; if (!retval) break;
} }
SEGPTR_FREE(brush); UnMapLS( segptr );
break; break;
default: default:

View File

@ -8,7 +8,6 @@
#include <sys/types.h> #include <sys/types.h>
#include "ntddk.h" #include "ntddk.h"
#include "syslevel.h" #include "syslevel.h"
#include "heap.h"
#include "stackframe.h" #include "stackframe.h"
#include "debugtools.h" #include "debugtools.h"
@ -33,12 +32,13 @@ VOID WINAPI GetpWin16Lock(SYSLEVEL **lock)
*/ */
SEGPTR WINAPI GetpWin16Lock16(void) SEGPTR WINAPI GetpWin16Lock16(void)
{ {
static SYSLEVEL *w16Mutex;
static SEGPTR segpWin16Mutex; static SEGPTR segpWin16Mutex;
if (!segpWin16Mutex) if (!segpWin16Mutex)
{ {
SYSLEVEL **w16Mutex = SEGPTR_ALLOC(sizeof(SYSLEVEL *)); w16Mutex = &Win16Mutex;
*w16Mutex = &Win16Mutex; segpWin16Mutex = MapLS( &w16Mutex );
segpWin16Mutex = SEGPTR_GET(w16Mutex);
} }
return segpWin16Mutex; return segpWin16Mutex;
} }

View File

@ -24,7 +24,6 @@
#include "wingdi.h" #include "wingdi.h"
#include "wine/winuser16.h" #include "wine/winuser16.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "heap.h"
#include "win.h" #include "win.h"
#include "user.h" #include "user.h"
#include "controls.h" #include "controls.h"
@ -45,6 +44,7 @@ typedef struct tagCLASS
INT cbClsExtra; /* Class extra bytes */ INT cbClsExtra; /* Class extra bytes */
INT cbWndExtra; /* Window extra bytes */ INT cbWndExtra; /* Window extra bytes */
LPWSTR menuName; /* Default menu name (Unicode followed by ASCII) */ LPWSTR menuName; /* Default menu name (Unicode followed by ASCII) */
SEGPTR segMenuName; /* Default menu name as SEGPTR */
struct tagDCE *dce; /* Class DCE (if CS_CLASSDC) */ struct tagDCE *dce; /* Class DCE (if CS_CLASSDC) */
HINSTANCE hInstance; /* Module that created the task */ HINSTANCE hInstance; /* Module that created the task */
HICON hIcon; /* Default icon */ HICON hIcon; /* Default icon */
@ -162,6 +162,20 @@ inline static LPSTR CLASS_GetMenuNameA( CLASS *classPtr )
} }
/***********************************************************************
* CLASS_GetMenuName16
*
* Get the menu name as a SEGPTR.
*/
inline static SEGPTR CLASS_GetMenuName16( CLASS *classPtr )
{
if (!HIWORD(classPtr->menuName)) return (SEGPTR)classPtr->menuName;
if (!classPtr->segMenuName)
classPtr->segMenuName = MapLS( CLASS_GetMenuNameA(classPtr) );
return classPtr->segMenuName;
}
/*********************************************************************** /***********************************************************************
* CLASS_GetMenuNameW * CLASS_GetMenuNameW
* *
@ -180,12 +194,14 @@ inline static LPWSTR CLASS_GetMenuNameW( CLASS *classPtr )
*/ */
static void CLASS_SetMenuNameA( CLASS *classPtr, LPCSTR name ) static void CLASS_SetMenuNameA( CLASS *classPtr, LPCSTR name )
{ {
if (HIWORD(classPtr->menuName)) SEGPTR_FREE( classPtr->menuName ); UnMapLS( classPtr->segMenuName );
classPtr->segMenuName = 0;
if (HIWORD(classPtr->menuName)) HeapFree( GetProcessHeap(), 0, classPtr->menuName );
if (HIWORD(name)) if (HIWORD(name))
{ {
DWORD lenA = strlen(name) + 1; DWORD lenA = strlen(name) + 1;
DWORD lenW = MultiByteToWideChar( CP_ACP, 0, name, lenA, NULL, 0 ); DWORD lenW = MultiByteToWideChar( CP_ACP, 0, name, lenA, NULL, 0 );
classPtr->menuName = SEGPTR_ALLOC( lenA + lenW*sizeof(WCHAR) ); classPtr->menuName = HeapAlloc( GetProcessHeap(), 0, lenA + lenW*sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, name, lenA, classPtr->menuName, lenW ); MultiByteToWideChar( CP_ACP, 0, name, lenA, classPtr->menuName, lenW );
memcpy( classPtr->menuName + lenW, name, lenA ); memcpy( classPtr->menuName + lenW, name, lenA );
} }
@ -200,12 +216,14 @@ static void CLASS_SetMenuNameA( CLASS *classPtr, LPCSTR name )
*/ */
static void CLASS_SetMenuNameW( CLASS *classPtr, LPCWSTR name ) static void CLASS_SetMenuNameW( CLASS *classPtr, LPCWSTR name )
{ {
if (HIWORD(classPtr->menuName)) SEGPTR_FREE( classPtr->menuName ); UnMapLS( classPtr->segMenuName );
classPtr->segMenuName = 0;
if (HIWORD(classPtr->menuName)) HeapFree( GetProcessHeap(), 0, classPtr->menuName );
if (HIWORD(name)) if (HIWORD(name))
{ {
DWORD lenW = strlenW(name) + 1; DWORD lenW = strlenW(name) + 1;
DWORD lenA = WideCharToMultiByte( CP_ACP, 0, name, lenW, NULL, 0, NULL, NULL ); DWORD lenA = WideCharToMultiByte( CP_ACP, 0, name, lenW, NULL, 0, NULL, NULL );
classPtr->menuName = SEGPTR_ALLOC( lenA + lenW*sizeof(WCHAR) ); classPtr->menuName = HeapAlloc( GetProcessHeap(), 0, lenA + lenW*sizeof(WCHAR) );
memcpy( classPtr->menuName, name, lenW*sizeof(WCHAR) ); memcpy( classPtr->menuName, name, lenW*sizeof(WCHAR) );
WideCharToMultiByte( CP_ACP, 0, name, lenW, WideCharToMultiByte( CP_ACP, 0, name, lenW,
(char *)(classPtr->menuName + lenW), lenA, NULL, NULL ); (char *)(classPtr->menuName + lenW), lenA, NULL, NULL );
@ -245,6 +263,7 @@ static BOOL CLASS_FreeClass( CLASS *classPtr )
GlobalDeleteAtom( classPtr->atomName ); GlobalDeleteAtom( classPtr->atomName );
WINPROC_FreeProc( classPtr->winprocA, WIN_PROC_CLASS ); WINPROC_FreeProc( classPtr->winprocA, WIN_PROC_CLASS );
WINPROC_FreeProc( classPtr->winprocW, WIN_PROC_CLASS ); WINPROC_FreeProc( classPtr->winprocW, WIN_PROC_CLASS );
UnMapLS( classPtr->segMenuName );
HeapFree( GetProcessHeap(), 0, classPtr->menuName ); HeapFree( GetProcessHeap(), 0, classPtr->menuName );
HeapFree( GetProcessHeap(), 0, classPtr ); HeapFree( GetProcessHeap(), 0, classPtr );
return TRUE; return TRUE;
@ -789,8 +808,10 @@ LONG WINAPI GetClassLong16( HWND16 hwnd16, INT16 offset )
release_class_ptr( class ); release_class_ptr( class );
return ret; return ret;
case GCL_MENUNAME: case GCL_MENUNAME:
ret = GetClassLongA( hwnd, offset ); if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
return (LONG)SEGPTR_GET( (void *)ret ); ret = (LONG)CLASS_GetMenuName16( class );
release_class_ptr( class );
return ret;
default: default:
return GetClassLongA( hwnd, offset ); return GetClassLongA( hwnd, offset );
} }
@ -1094,9 +1115,7 @@ BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASS16 *wc
wc->hCursor = classPtr->hCursor; wc->hCursor = classPtr->hCursor;
wc->hbrBackground = classPtr->hbrBackground; wc->hbrBackground = classPtr->hbrBackground;
wc->lpszClassName = name; wc->lpszClassName = name;
wc->lpszMenuName = (SEGPTR)CLASS_GetMenuNameA( classPtr ); wc->lpszMenuName = CLASS_GetMenuName16( classPtr );
if (HIWORD(wc->lpszMenuName)) /* Make it a SEGPTR */
wc->lpszMenuName = SEGPTR_GET( (LPSTR)wc->lpszMenuName );
return TRUE; return TRUE;
} }
@ -1206,10 +1225,8 @@ BOOL16 WINAPI GetClassInfoEx16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASSEX16
wc->hCursor = classPtr->hCursor; wc->hCursor = classPtr->hCursor;
wc->hbrBackground = classPtr->hbrBackground; wc->hbrBackground = classPtr->hbrBackground;
wc->lpszClassName = (SEGPTR)0; wc->lpszClassName = (SEGPTR)0;
wc->lpszMenuName = (SEGPTR)CLASS_GetMenuNameA( classPtr ); wc->lpszMenuName = CLASS_GetMenuName16( classPtr );
if (HIWORD(wc->lpszMenuName)) /* Make it a SEGPTR */ wc->lpszClassName = name;
wc->lpszMenuName = SEGPTR_GET( (LPSTR)wc->lpszMenuName );
wc->lpszClassName = name;
/* We must return the atom of the class here instead of just TRUE. */ /* We must return the atom of the class here instead of just TRUE. */
return atom; return atom;

View File

@ -42,10 +42,10 @@ typedef struct
INT16 y; INT16 y;
INT16 cx; INT16 cx;
INT16 cy; INT16 cy;
UINT id; UINT id;
LPCSTR className; LPCSTR className;
LPCSTR windowName; LPCSTR windowName;
LPVOID data; LPCVOID data;
} DLG_CONTROL_INFO; } DLG_CONTROL_INFO;
/* Dialog template */ /* Dialog template */
@ -296,26 +296,21 @@ static LPCSTR DIALOG_GetControl16( LPCSTR p, DLG_CONTROL_INFO *info )
p += strlen(p) + 1; p += strlen(p) + 1;
} }
if (*p) if (*p) info->data = p + 1;
{
/* Additional CTLDATA available for this control. */
info->data = SEGPTR_ALLOC(*p);
memcpy( info->data, p + 1, *p );
}
else info->data = NULL; else info->data = NULL;
p += *p + 1; p += *p + 1;
if(int_id) if(int_id)
TRACE(" %s %04x %d, %d, %d, %d, %d, %08lx, %08lx\n", TRACE(" %s %04x %d, %d, %d, %d, %d, %08lx, %p\n",
info->className, LOWORD(info->windowName), info->className, LOWORD(info->windowName),
info->id, info->x, info->y, info->cx, info->cy, info->id, info->x, info->y, info->cx, info->cy,
info->style, (DWORD)SEGPTR_GET(info->data) ); info->style, info->data );
else else
TRACE(" %s '%s' %d, %d, %d, %d, %d, %08lx, %08lx\n", TRACE(" %s '%s' %d, %d, %d, %d, %d, %08lx, %p\n",
info->className, info->windowName, info->className, info->windowName,
info->id, info->x, info->y, info->cx, info->cy, info->id, info->x, info->y, info->cx, info->cy,
info->style, (DWORD)SEGPTR_GET(info->data) ); info->style, info->data );
return p; return p;
} }
@ -414,7 +409,7 @@ static const WORD *DIALOG_GetControl32( const WORD *p, DLG_CONTROL_INFO *info,
DPRINTF("\n"); DPRINTF("\n");
TRACE(" END\n" ); TRACE(" END\n" );
} }
info->data = (LPVOID)(p + 1); info->data = p + 1;
p += GET_WORD(p) / sizeof(WORD); p += GET_WORD(p) / sizeof(WORD);
} }
else info->data = NULL; else info->data = NULL;
@ -444,6 +439,8 @@ static BOOL DIALOG_CreateControls( HWND hwnd, LPCSTR template, const DLG_TEMPLAT
if (!win32) if (!win32)
{ {
HINSTANCE16 instance; HINSTANCE16 instance;
SEGPTR segptr;
template = DIALOG_GetControl16( template, &info ); template = DIALOG_GetControl16( template, &info );
if (HIWORD(info.className) && !strcmp( info.className, "EDIT") && if (HIWORD(info.className) && !strcmp( info.className, "EDIT") &&
!(GetWindowLongW( hwnd, GWL_STYLE ) & DS_LOCALEDIT)) !(GetWindowLongW( hwnd, GWL_STYLE ) & DS_LOCALEDIT))
@ -462,6 +459,7 @@ static BOOL DIALOG_CreateControls( HWND hwnd, LPCSTR template, const DLG_TEMPLAT
} }
else instance = (HINSTANCE16)hInst; else instance = (HINSTANCE16)hInst;
segptr = MapLS( info.data );
hwndCtrl = WIN_Handle32( CreateWindowEx16( info.exStyle | WS_EX_NOPARENTNOTIFY, hwndCtrl = WIN_Handle32( CreateWindowEx16( info.exStyle | WS_EX_NOPARENTNOTIFY,
info.className, info.windowName, info.className, info.windowName,
info.style | WS_CHILD, info.style | WS_CHILD,
@ -470,9 +468,8 @@ static BOOL DIALOG_CreateControls( HWND hwnd, LPCSTR template, const DLG_TEMPLAT
MulDiv(info.cx, dlgInfo->xBaseUnit, 4), MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
MulDiv(info.cy, dlgInfo->yBaseUnit, 8), MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
WIN_Handle16(hwnd), (HMENU16)info.id, WIN_Handle16(hwnd), (HMENU16)info.id,
instance, (LPVOID)SEGPTR_GET(info.data) )); instance, (LPVOID)segptr ));
UnMapLS( segptr );
if (info.data) SEGPTR_FREE(info.data);
} }
else else
{ {
@ -493,7 +490,7 @@ static BOOL DIALOG_CreateControls( HWND hwnd, LPCSTR template, const DLG_TEMPLAT
MulDiv(info.cx, dlgInfo->xBaseUnit, 4), MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
MulDiv(info.cy, dlgInfo->yBaseUnit, 8), MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
hwnd, (HMENU)info.id, hwnd, (HMENU)info.id,
hInst, info.data ); hInst, (LPVOID)info.data );
} }
if (!hwndCtrl) return FALSE; if (!hwndCtrl) return FALSE;

View File

@ -544,24 +544,21 @@ static HWND MDICreateChild( HWND parent, MDICLIENTINFO *ci,
} }
else else
{ {
MDICREATESTRUCT16 *cs16; MDICREATESTRUCT16 cs16;
LPSTR title, cls; SEGPTR title, cls, seg_cs16;
WIN_ReleaseWndPtr( wndParent ); WIN_ReleaseWndPtr( wndParent );
cs16 = SEGPTR_NEW(MDICREATESTRUCT16); STRUCT32_MDICREATESTRUCT32Ato16( cs, &cs16 );
STRUCT32_MDICREATESTRUCT32Ato16( cs, cs16 ); cs16.szTitle = title = MapLS( cs->szTitle );
title = SEGPTR_STRDUP( cs->szTitle ); cs16.szClass = cls = MapLS( cs->szClass );
cls = SEGPTR_STRDUP( cs->szClass ); seg_cs16 = MapLS( &cs16 );
cs16->szTitle = SEGPTR_GET(title);
cs16->szClass = SEGPTR_GET(cls);
hwnd = WIN_Handle32( CreateWindow16( cs->szClass, cs->szTitle, style, hwnd = WIN_Handle32( CreateWindow16( cs->szClass, cs->szTitle, style,
cs16->x, cs16->y, cs16->cx, cs16->cy, cs16.x, cs16.y, cs16.cx, cs16.cy,
WIN_Handle16(parent), (HMENU)wIDmenu, WIN_Handle16(parent), (HMENU)wIDmenu,
cs16->hOwner, (LPVOID)SEGPTR_GET(cs16) )); cs16.hOwner, (LPVOID)seg_cs16 ));
SEGPTR_FREE( title ); UnMapLS( seg_cs16 );
SEGPTR_FREE( cls ); UnMapLS( title );
SEGPTR_FREE( cs16 ); UnMapLS( cls );
} }
/* MDI windows are WS_CHILD so they won't be activated by CreateWindow */ /* MDI windows are WS_CHILD so they won't be activated by CreateWindow */