Commit d7b76822 authored by Alexandre Julliard's avatar Alexandre Julliard

Use MapLS/UnMapLS instead of SEGPTR_* macros.

parent 6f011c08
......@@ -20,7 +20,6 @@
#include "vfw16.h"
#include "wine/winbase16.h"
#include "debugtools.h"
#include "heap.h"
#include "stackframe.h"
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) {
char type[5],handler[5],codecname[20];
HIC16 hic;
ICOPEN* icopen = SEGPTR_NEW(ICOPEN);
ICOPEN icopen;
SEGPTR seg_icopen;
WINE_HIC *whic;
memcpy(type,&fccType,4);type[4]=0;
memcpy(handler,&fccHandler,4);handler[4]=0;
TRACE("(%s,%s,%d,%p,%d)\n",type,handler,wMode,lpfnHandler,bFrom32?32:16);
icopen->fccType = fccType;
icopen->fccHandler = fccHandler;
icopen->dwSize = sizeof(ICOPEN);
icopen->dwFlags = wMode;
sprintf(codecname,"%s.%s",type,handler);
icopen.fccType = fccType;
icopen.fccHandler = fccHandler;
icopen.dwSize = sizeof(ICOPEN);
icopen.dwFlags = wMode;
sprintf(codecname,"%s.%s",type,handler);
hic = GlobalAlloc16(GHND,sizeof(WINE_HIC));
if (!hic)
......@@ -253,7 +253,9 @@ HIC MSVIDEO_OpenFunc(DWORD fccType, DWORD fccHandler, UINT wMode, FARPROC lpfnHa
/* return value is not checked */
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) {
WARN("DRV_OPEN failed for hic 0x%08lx\n",(DWORD)hic);
GlobalFree16(hic);
......@@ -504,26 +506,28 @@ DWORD VFWAPIV ICCompress16(HIC16 hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiOutp
LPBITMAPINFOHEADER lpbiPrev, LPVOID lpPrev) {
DWORD ret;
ICCOMPRESS *iccmp = SEGPTR_NEW(ICCOMPRESS);
TRACE("(0x%08lx,%ld,%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;
ret = ICSendMessage16(hic,ICM_COMPRESS,(DWORD)SEGPTR_GET(iccmp),sizeof(ICCOMPRESS));
SEGPTR_FREE(iccmp);
ICCOMPRESS iccmp;
SEGPTR seg_iccmp;
TRACE("(0x%08lx,%ld,%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;
}
......@@ -560,23 +564,23 @@ DWORD VFWAPIV ICDecompress(HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiFormat,
* _ICDecompress [MSVIDEO.230]
*/
DWORD VFWAPIV ICDecompress16(HIC16 hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiFormat,
LPVOID lpData, LPBITMAPINFOHEADER lpbi, LPVOID lpBits) {
ICDECOMPRESS *icd = SEGPTR_NEW(ICDECOMPRESS);
LPVOID lpData, LPBITMAPINFOHEADER lpbi, LPVOID lpBits)
{
ICDECOMPRESS icd;
SEGPTR segptr;
DWORD ret;
TRACE("(0x%08lx,%ld,%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;
ret = ICSendMessage16(hic,ICM_DECOMPRESS,(DWORD)SEGPTR_GET(icd),sizeof(ICDECOMPRESS));
SEGPTR_FREE(icd);
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;
}
......@@ -996,6 +1000,7 @@ LRESULT VFWAPIV ICMessage16(void) {
UINT16 msg;
UINT16 cb;
LPWORD lpData;
SEGPTR segData;
LRESULT ret;
UINT16 i;
......@@ -1006,7 +1011,7 @@ LRESULT VFWAPIV ICMessage16(void) {
msg = 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);
......@@ -1015,9 +1020,10 @@ LRESULT VFWAPIV ICMessage16(void) {
}
VA_END16(valist);
ret = ICSendMessage16(hic, msg, (DWORD)(SEGPTR_GET(lpData)), (DWORD)cb);
SEGPTR_FREE(lpData);
segData = MapLS( lpData );
ret = ICSendMessage16(hic, msg, segData, (DWORD)cb);
UnMapLS( segData );
HeapFree( GetProcessHeap(), 0, lpData );
return ret;
}
......@@ -1089,30 +1095,31 @@ DWORD VFWAPIV ICDrawBegin16(
DWORD dwScale) /* [in] */
{
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",
(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;
ret = (DWORD)ICSendMessage16(hic,ICM_DRAW_BEGIN,(DWORD)SEGPTR_GET(icdb),sizeof(ICDRAWBEGIN16));
SEGPTR_FREE(icdb);
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;
}
......@@ -1144,16 +1151,20 @@ DWORD VFWAPIV ICDraw16(
DWORD cbData,
LONG lTime)
{
ICDRAW* icd = SEGPTR_NEW(ICDRAW); /* SEGPTR for mapper to deal with */
TRACE("(0x%08lx,0x%08lx,%p,%p,%ld,%ld)\n",(DWORD)hic,dwFlags,lpFormat,lpData,cbData,lTime);
icd->dwFlags = dwFlags;
icd->lpFormat = lpFormat;
icd->lpData = lpData;
icd->cbData = cbData;
icd->lTime = lTime;
return ICSendMessage16(hic,ICM_DRAW,(DWORD)SEGPTR_GET(icd),sizeof(ICDRAW));
DWORD ret;
ICDRAW icd;
SEGPTR seg_icd;
TRACE("(0x%08lx,0x%08lx,%p,%p,%ld,%ld)\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;
}
/***********************************************************************
......
......@@ -8,6 +8,7 @@
#include <string.h>
#include "wine/windef16.h"
#include "ole2.h"
#include "oleauto.h"
#include "windef.h"
......@@ -16,7 +17,6 @@
#include "wingdi.h"
#include "winuser.h"
#include "heap.h"
#include "ole2disp.h"
#include "olectl.h"
......@@ -33,8 +33,8 @@ DEFAULT_DEBUG_CHANNEL(ole);
*/
static BSTR16 BSTR_AllocBytes(int n)
{
void *ptr = SEGPTR_ALLOC(n);
return (BSTR16)SEGPTR_GET(ptr);
void *ptr = HeapAlloc( GetProcessHeap(), 0, n );
return (BSTR16)MapLS(ptr);
}
/******************************************************************************
......@@ -42,7 +42,9 @@ static BSTR16 BSTR_AllocBytes(int n)
*/
static void BSTR_Free(BSTR16 in)
{
SEGPTR_FREE( MapSL((SEGPTR)in) );
void *ptr = MapSL( (SEGPTR)in );
UnMapLS( (SEGPTR)in );
HeapFree( GetProcessHeap(), 0, ptr );
}
/******************************************************************************
......
......@@ -6,7 +6,6 @@
#include "wine/winuser16.h"
#include "winerror.h"
#include "heap.h"
#include "hook.h"
#include "message.h"
#include "spy.h"
......@@ -34,25 +33,24 @@ LRESULT WINAPI SendMessage16( HWND16 hwnd16, UINT16 msg, WPARAM16 wparam, LPARAM
/* first the WH_CALLWNDPROC hook */
if (HOOK_IsHooked( WH_CALLWNDPROC ))
{
CWPSTRUCT16 *cwp;
if ((cwp = SEGPTR_NEW(CWPSTRUCT16)))
CWPSTRUCT16 cwp;
SEGPTR seg_cwp;
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;
cwp->message = msg;
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 );
hwnd16 = cwp.hwnd;
hwnd = WIN_Handle32( hwnd16 );
}
msg = cwp.message;
wparam = cwp.wParam;
lparam = cwp.lParam;
}
if (!(winproc = (WNDPROC16)GetWindowLong16( hwnd16, GWL_WNDPROC ))) return 0;
......
......@@ -10,7 +10,6 @@
#include "wingdi.h"
#include "wine/winuser16.h"
#include "wine/server.h"
#include "heap.h"
/* size of buffer needed to store an atom string */
#define ATOM_BUFFER_SIZE 256
......@@ -289,19 +288,20 @@ INT16 WINAPI EnumProps16( HWND16 hwnd, PROPENUMPROC16 func )
if (list)
{
char *string = SEGPTR_ALLOC( ATOM_BUFFER_SIZE );
char string[ATOM_BUFFER_SIZE];
SEGPTR segptr = MapLS( string );
for (i = 0; i < count; i++)
{
if (list[i].string) /* it was a string originally */
{
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
ret = PROP_CallTo16_word_wlw( func, hwnd, list[i].atom, list[i].handle );
if (!ret) break;
}
SEGPTR_FREE( string );
UnMapLS( segptr );
HeapFree( GetProcessHeap(), 0, list );
}
return ret;
......
......@@ -6,7 +6,6 @@
#include <stdlib.h>
#include "win16drv.h"
#include "heap.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(win16drv);
......@@ -32,7 +31,7 @@ HBRUSH WIN16DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush )
{
nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_BRUSH,
&lBrush16, 0, 0);
physDev->BrushInfo = SEGPTR_ALLOC( nSize );
physDev->BrushInfo = HeapAlloc( GetProcessHeap(), 0, nSize );
}
......
......@@ -10,7 +10,6 @@
#include "wine/winbase16.h"
#include "win16drv.h"
#include "font.h"
#include "heap.h"
#include "gdi.h"
#include "debugtools.h"
......@@ -97,12 +96,12 @@ HFONT WIN16DRV_FONT_SelectObject( DC * dc, HFONT hfont)
if( physDev->FontInfo &&
HeapSize( GetProcessHeap(), 0, physDev->FontInfo ) < nSize )
{
SEGPTR_FREE( physDev->FontInfo );
HeapFree( GetProcessHeap(), 0, physDev->FontInfo );
physDev->FontInfo = NULL;
}
if( !physDev->FontInfo )
physDev->FontInfo = SEGPTR_ALLOC( nSize );
physDev->FontInfo = HeapAlloc( GetProcessHeap(), 0, nSize );
nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, DRVOBJ_FONT,
......
......@@ -13,7 +13,6 @@
#include "win16drv.h"
#include "gdi.h"
#include "bitmap.h"
#include "heap.h"
#include "font.h"
#include "debugtools.h"
......
......@@ -5,7 +5,6 @@
*/
#include "win16drv.h"
#include "heap.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(win16drv);
......@@ -35,7 +34,7 @@ HPEN WIN16DRV_PEN_SelectObject( DC * dc, HPEN hpen )
{
nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_PEN,
&lPen16, 0, 0);
physDev->PenInfo = SEGPTR_ALLOC( nSize );
physDev->PenInfo = HeapAlloc( GetProcessHeap(), 0, nSize );
}
nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, DRVOBJ_PEN,
......
......@@ -804,13 +804,13 @@ HINSTANCE16 WINAPI WinExec16( LPCSTR lpCmdLine, UINT16 nCmdShow )
{
args++;
arglen = strlen(args);
cmdline = SEGPTR_ALLOC( 2 + arglen );
cmdline = HeapAlloc( GetProcessHeap(), 0, 2 + arglen );
cmdline[0] = (BYTE)arglen;
strcpy( cmdline + 1, args );
}
else
{
cmdline = SEGPTR_ALLOC( 2 );
cmdline = HeapAlloc( GetProcessHeap(), 0, 2 );
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 ))
{
LOADPARAMS16 params;
WORD *showCmd = SEGPTR_ALLOC( 2*sizeof(WORD) );
WORD showCmd[2];
showCmd[0] = 2;
showCmd[1] = nCmdShow;
params.hEnvironment = 0;
params.cmdLine = SEGPTR_GET(cmdline);
params.showCmd = SEGPTR_GET(showCmd);
params.cmdLine = MapLS( cmdline );
params.showCmd = MapLS( showCmd );
params.reserved = 0;
ret = LoadModule16( buffer, &params );
SEGPTR_FREE( showCmd );
SEGPTR_FREE( cmdline );
UnMapLS( params.cmdLine );
UnMapLS( params.showCmd );
}
else ret = GetLastError();
HeapFree( GetProcessHeap(), 0, cmdline );
if (name != lpCmdLine) HeapFree( GetProcessHeap(), 0, name );
if (ret == 21) /* 32-bit module */
......
......@@ -10,8 +10,8 @@
#include <assert.h>
#include "winerror.h"
#include "winnls.h"
#include "wine/unicode.h"
#include "font.h"
#include "heap.h"
#include "options.h"
#include "debugtools.h"
#include "gdi.h"
......@@ -694,31 +694,23 @@ INT16 WINAPI EnumFontFamiliesEx16( HDC16 hDC, LPLOGFONT16 plf,
if (enum_func)
{
LPNEWTEXTMETRICEX16 lptm16 = SEGPTR_ALLOC( sizeof(NEWTEXTMETRICEX16) );
if( lptm16 )
{
LPENUMLOGFONTEX16 lplf16 = SEGPTR_ALLOC( sizeof(ENUMLOGFONTEX16) );
if( lplf16 )
{
fontEnum16 fe16;
LOGFONTW lfW;
FONT_LogFont16ToW(plf, &lfW);
fe16.lpLogFontParam = plf;
fe16.lpEnumFunc = efproc;
fe16.lpData = lParam;
fe16.lpTextMetric = lptm16;
fe16.lpLogFont = lplf16;
fe16.segTextMetric = SEGPTR_GET(lptm16);
fe16.segLogFont = SEGPTR_GET(lplf16);
retVal = enum_func( hDC, &lfW, FONT_EnumInstance16,
(LPARAM)&fe16 );
SEGPTR_FREE(lplf16);
}
SEGPTR_FREE(lptm16);
}
NEWTEXTMETRICEX16 tm16;
ENUMLOGFONTEX16 lf16;
fontEnum16 fe16;
LOGFONTW lfW;
FONT_LogFont16ToW(plf, &lfW);
fe16.lpLogFontParam = plf;
fe16.lpEnumFunc = efproc;
fe16.lpData = lParam;
fe16.lpTextMetric = &tm16;
fe16.lpLogFont = &lf16;
fe16.segTextMetric = MapLS( &tm16 );
fe16.segLogFont = MapLS( &lf16 );
retVal = enum_func( hDC, &lfW, FONT_EnumInstance16, (LPARAM)&fe16 );
UnMapLS( fe16.segTextMetric );
UnMapLS( fe16.segLogFont );
}
return retVal;
}
......
......@@ -19,7 +19,6 @@
#include "bitmap.h"
#include "brush.h"
#include "font.h"
#include "heap.h"
#include "local.h"
#include "palette.h"
#include "pen.h"
......@@ -873,8 +872,9 @@ INT16 WINAPI EnumObjects16( HDC16 hdc, INT16 nObjType,
};
INT16 i, retval = 0;
LOGPEN16 *pen;
LOGBRUSH16 *brush = NULL;
LOGPEN16 pen;
LOGBRUSH16 brush;
SEGPTR segptr;
TRACE("%04x %d %08lx %08lx\n",
hdc, nObjType, (DWORD)lpEnumFunc, lParam );
......@@ -882,47 +882,44 @@ INT16 WINAPI EnumObjects16( HDC16 hdc, INT16 nObjType,
{
case OBJ_PEN:
/* Enumerate solid pens */
if (!(pen = SEGPTR_NEW(LOGPEN16))) break;
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_GET(pen), lParam );
TRACE("solid pen %08lx, ret=%d\n",
solid_colors[i], retval);
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;
}
SEGPTR_FREE(pen);
UnMapLS( segptr );
break;
case OBJ_BRUSH:
/* Enumerate solid brushes */
if (!(brush = SEGPTR_NEW(LOGBRUSH16))) break;
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_GET(brush), lParam );
TRACE("solid brush %08lx, ret=%d\n",
solid_colors[i], retval);
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_GET(brush), lParam );
TRACE("hatched brush %d, ret=%d\n",
i, retval);
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;
}
SEGPTR_FREE(brush);
UnMapLS( segptr );
break;
default:
......
......@@ -8,7 +8,6 @@
#include <sys/types.h>
#include "ntddk.h"
#include "syslevel.h"
#include "heap.h"
#include "stackframe.h"
#include "debugtools.h"
......@@ -33,12 +32,13 @@ VOID WINAPI GetpWin16Lock(SYSLEVEL **lock)
*/
SEGPTR WINAPI GetpWin16Lock16(void)
{
static SYSLEVEL *w16Mutex;
static SEGPTR segpWin16Mutex;
if (!segpWin16Mutex)
{
SYSLEVEL **w16Mutex = SEGPTR_ALLOC(sizeof(SYSLEVEL *));
*w16Mutex = &Win16Mutex;
segpWin16Mutex = SEGPTR_GET(w16Mutex);
w16Mutex = &Win16Mutex;
segpWin16Mutex = MapLS( &w16Mutex );
}
return segpWin16Mutex;
}
......
......@@ -24,7 +24,6 @@
#include "wingdi.h"
#include "wine/winuser16.h"
#include "wine/unicode.h"
#include "heap.h"
#include "win.h"
#include "user.h"
#include "controls.h"
......@@ -45,6 +44,7 @@ typedef struct tagCLASS
INT cbClsExtra; /* Class extra bytes */
INT cbWndExtra; /* Window extra bytes */
LPWSTR menuName; /* Default menu name (Unicode followed by ASCII) */
SEGPTR segMenuName; /* Default menu name as SEGPTR */
struct tagDCE *dce; /* Class DCE (if CS_CLASSDC) */
HINSTANCE hInstance; /* Module that created the task */
HICON hIcon; /* Default icon */
......@@ -163,6 +163,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
*
* Get the menu name as a Unicode string.
......@@ -180,12 +194,14 @@ inline static LPWSTR CLASS_GetMenuNameW( CLASS *classPtr )
*/
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))
{
DWORD lenA = strlen(name) + 1;
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 );
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 )
{
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))
{
DWORD lenW = strlenW(name) + 1;
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) );
WideCharToMultiByte( CP_ACP, 0, name, lenW,
(char *)(classPtr->menuName + lenW), lenA, NULL, NULL );
......@@ -245,6 +263,7 @@ static BOOL CLASS_FreeClass( CLASS *classPtr )
GlobalDeleteAtom( classPtr->atomName );
WINPROC_FreeProc( classPtr->winprocA, WIN_PROC_CLASS );
WINPROC_FreeProc( classPtr->winprocW, WIN_PROC_CLASS );
UnMapLS( classPtr->segMenuName );
HeapFree( GetProcessHeap(), 0, classPtr->menuName );
HeapFree( GetProcessHeap(), 0, classPtr );
return TRUE;
......@@ -789,8 +808,10 @@ LONG WINAPI GetClassLong16( HWND16 hwnd16, INT16 offset )
release_class_ptr( class );
return ret;
case GCL_MENUNAME:
ret = GetClassLongA( hwnd, offset );
return (LONG)SEGPTR_GET( (void *)ret );
if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
ret = (LONG)CLASS_GetMenuName16( class );
release_class_ptr( class );
return ret;
default:
return GetClassLongA( hwnd, offset );
}
......@@ -1094,9 +1115,7 @@ BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASS16 *wc
wc->hCursor = classPtr->hCursor;
wc->hbrBackground = classPtr->hbrBackground;
wc->lpszClassName = name;
wc->lpszMenuName = (SEGPTR)CLASS_GetMenuNameA( classPtr );
if (HIWORD(wc->lpszMenuName)) /* Make it a SEGPTR */
wc->lpszMenuName = SEGPTR_GET( (LPSTR)wc->lpszMenuName );
wc->lpszMenuName = CLASS_GetMenuName16( classPtr );
return TRUE;
}
......@@ -1206,10 +1225,8 @@ BOOL16 WINAPI GetClassInfoEx16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASSEX16
wc->hCursor = classPtr->hCursor;
wc->hbrBackground = classPtr->hbrBackground;
wc->lpszClassName = (SEGPTR)0;
wc->lpszMenuName = (SEGPTR)CLASS_GetMenuNameA( classPtr );
if (HIWORD(wc->lpszMenuName)) /* Make it a SEGPTR */
wc->lpszMenuName = SEGPTR_GET( (LPSTR)wc->lpszMenuName );
wc->lpszClassName = name;
wc->lpszMenuName = CLASS_GetMenuName16( classPtr );
wc->lpszClassName = name;
/* We must return the atom of the class here instead of just TRUE. */
return atom;
......
......@@ -42,10 +42,10 @@ typedef struct
INT16 y;
INT16 cx;
INT16 cy;
UINT id;
UINT id;
LPCSTR className;
LPCSTR windowName;
LPVOID data;
LPCVOID data;
} DLG_CONTROL_INFO;
/* Dialog template */
......@@ -296,26 +296,21 @@ static LPCSTR DIALOG_GetControl16( LPCSTR p, DLG_CONTROL_INFO *info )
p += strlen(p) + 1;
}
if (*p)
{
/* Additional CTLDATA available for this control. */
info->data = SEGPTR_ALLOC(*p);
memcpy( info->data, p + 1, *p );
}
if (*p) info->data = p + 1;
else info->data = NULL;
p += *p + 1;
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->id, info->x, info->y, info->cx, info->cy,
info->style, (DWORD)SEGPTR_GET(info->data) );
info->style, info->data );
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->id, info->x, info->y, info->cx, info->cy,
info->style, (DWORD)SEGPTR_GET(info->data) );
info->style, info->data );
return p;
}
......@@ -414,7 +409,7 @@ static const WORD *DIALOG_GetControl32( const WORD *p, DLG_CONTROL_INFO *info,
DPRINTF("\n");
TRACE(" END\n" );
}
info->data = (LPVOID)(p + 1);
info->data = p + 1;
p += GET_WORD(p) / sizeof(WORD);
}
else info->data = NULL;
......@@ -444,6 +439,8 @@ static BOOL DIALOG_CreateControls( HWND hwnd, LPCSTR template, const DLG_TEMPLAT
if (!win32)
{
HINSTANCE16 instance;
SEGPTR segptr;
template = DIALOG_GetControl16( template, &info );
if (HIWORD(info.className) && !strcmp( info.className, "EDIT") &&
!(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;
segptr = MapLS( info.data );
hwndCtrl = WIN_Handle32( CreateWindowEx16( info.exStyle | WS_EX_NOPARENTNOTIFY,
info.className, info.windowName,
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.cy, dlgInfo->yBaseUnit, 8),
WIN_Handle16(hwnd), (HMENU16)info.id,
instance, (LPVOID)SEGPTR_GET(info.data) ));
if (info.data) SEGPTR_FREE(info.data);
instance, (LPVOID)segptr ));
UnMapLS( segptr );
}
else
{
......@@ -493,7 +490,7 @@ static BOOL DIALOG_CreateControls( HWND hwnd, LPCSTR template, const DLG_TEMPLAT
MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
hwnd, (HMENU)info.id,
hInst, info.data );
hInst, (LPVOID)info.data );
}
if (!hwndCtrl) return FALSE;
......
......@@ -544,24 +544,21 @@ static HWND MDICreateChild( HWND parent, MDICLIENTINFO *ci,
}
else
{
MDICREATESTRUCT16 *cs16;
LPSTR title, cls;
MDICREATESTRUCT16 cs16;
SEGPTR title, cls, seg_cs16;
WIN_ReleaseWndPtr( wndParent );
cs16 = SEGPTR_NEW(MDICREATESTRUCT16);
STRUCT32_MDICREATESTRUCT32Ato16( cs, cs16 );
title = SEGPTR_STRDUP( cs->szTitle );
cls = SEGPTR_STRDUP( cs->szClass );
cs16->szTitle = SEGPTR_GET(title);
cs16->szClass = SEGPTR_GET(cls);
STRUCT32_MDICREATESTRUCT32Ato16( cs, &cs16 );
cs16.szTitle = title = MapLS( cs->szTitle );
cs16.szClass = cls = MapLS( cs->szClass );
seg_cs16 = MapLS( &cs16 );
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,
cs16->hOwner, (LPVOID)SEGPTR_GET(cs16) ));
SEGPTR_FREE( title );
SEGPTR_FREE( cls );
SEGPTR_FREE( cs16 );
cs16.hOwner, (LPVOID)seg_cs16 ));
UnMapLS( seg_cs16 );
UnMapLS( title );
UnMapLS( cls );
}
/* MDI windows are WS_CHILD so they won't be activated by CreateWindow */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment