From bf9130af10a96aa16ca9aa8658b179ff462d89d6 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sun, 13 Oct 1996 17:45:47 +0000 Subject: [PATCH] Release 961013 Sun Oct 13 15:32:32 1996 Alexandre Julliard * [Make.rules.in] [*/Makefile.in] Made it possible to compile from a directory other than the source directory. * [graphics/metafiledrv/init.c] [include/metafiledrv.h] [objects/metafile.c] [objects/dc.c] New graphics driver for metafiles. * [if1632/thunk.c] Added thunks for SetWindowsHook and SetDCHook. * [windows/dialog.c] Fixed GetNextDlgGroupItem and GetNextDlgTabItem to skip disabled items. * [*/*] Removed non Win32-clean types HANDLE, HBITMAP, HBRUSH, HFONT, HINSTANCE, HMENU, HRGN and HTASK. Wed Oct 9 14:59:45 1996 Frans van Dorsselaer * [controls/edit.c] Fixed EditWndProc() to fall back to DefWndProc() when the edit state structure is not available. Wed Oct 2 14:00:34 1996 Huw D. M. Davies * [windows/nonclient.c] [windows/mdi.c] AdjustWindowRectEx16() should only take notice of the styles WS_DLGFRAME, WS_BORDER, WS_THICKFRAME and WS_EX_DLGMODALFRAME. Thanks to Alex Korobka. * [controls/scroll.c] Fixed typo in ShowScrollBar32(). Sun Aug 25 20:18:56 1996 Jukka Iivonen * [if1632/user32.spec] [if1632/winmm.spec] Added SetParent and sndPlaySoundA. --- ANNOUNCE | 17 +- ChangeLog | 43 +++ Make.rules.in | 41 +-- Makefile.in | 2 + configure | 2 + configure.in | 1 + controls/Makefile.in | 9 +- controls/button.c | 28 +- controls/combo.c | 16 +- controls/edit.c | 31 ++- controls/listbox.c | 16 +- controls/menu.c | 186 ++++++------- controls/scroll.c | 2 +- controls/static.c | 8 +- debugger/Makefile.in | 19 +- debugger/dbg.y | 11 + files/Makefile.in | 5 +- files/drive.c | 2 +- files/file.c | 4 +- graphics/Makefile.in | 9 +- graphics/metafiledrv/Makefile.in | 15 ++ graphics/metafiledrv/init.c | 240 +++++++++++++++++ graphics/win16drv/Makefile.in | 9 +- graphics/x11drv/Makefile.in | 9 +- if1632/Makefile.in | 26 +- if1632/except.S | 2 +- if1632/gdi.spec | 50 ++-- if1632/gdi32.spec | 2 +- if1632/kernel.spec | 6 +- if1632/relay.c | 1 - if1632/thunk.c | 155 ++++++++++- if1632/user.spec | 16 +- if1632/user32.spec | 8 +- if1632/winmm.spec | 2 +- include/brush.h | 4 +- include/button.h | 4 +- include/callback.h | 12 - include/commdlg.h | 8 +- include/dc.h | 13 +- include/dialog.h | 11 +- include/gdi.h | 52 ++-- include/hook.h | 19 +- include/libres.h | 14 +- include/listbox.h | 6 +- include/mdi.h | 2 +- include/menu.h | 4 +- include/metafile.h | 37 ++- include/metafiledrv.h | 22 ++ include/mmsystem.h | 8 +- include/module.h | 8 +- include/nonclient.h | 4 +- include/ole.h | 6 +- include/task.h | 2 +- include/wincon.h | 26 +- include/windows.h | 277 ++++++++++--------- include/winsock.h | 28 +- include/wintypes.h | 3 +- ipc/Makefile.in | 9 +- library/Makefile.in | 9 +- library/libres.c | 10 +- library/winmain.c | 7 +- libtest/Makefile.in | 11 +- loader/Makefile.in | 9 +- loader/main.c | 2 +- loader/module.c | 42 ++- loader/ne_image.c | 4 +- loader/ne_resource.c | 2 +- loader/pe_image.c | 9 +- loader/pe_resource.c | 4 +- loader/resource.c | 4 +- loader/task.c | 64 +++-- memory/Makefile.in | 9 +- memory/ldt.c | 33 ++- misc/Makefile.in | 9 +- misc/clipboard.c | 4 +- misc/commdlg.c | 58 ++-- misc/crtdll.c | 4 +- misc/exec.c | 2 +- misc/network.c | 8 +- misc/olesvr.c | 2 +- misc/shell.c | 58 ++-- misc/toolhelp.c | 5 +- misc/user.c | 8 +- misc/winsocket.c | 36 +-- miscemu/Makefile.in | 9 +- multimedia/Makefile.in | 9 +- multimedia/audio.c | 14 +- multimedia/mcianim.c | 2 +- multimedia/mcicda.c | 2 +- multimedia/midi.c | 2 +- multimedia/mmsystem.c | 18 +- multimedia/time.c | 2 +- objects/Makefile.in | 9 +- objects/bitmap.c | 6 +- objects/brush.c | 46 ++-- objects/clipping.c | 26 +- objects/cursoricon.c | 41 +-- objects/dc.c | 136 +++++----- objects/dcvalues.c | 6 +- objects/dib.c | 10 +- objects/font.c | 22 +- objects/gdiobj.c | 39 +-- objects/metafile.c | 444 ++++++++++--------------------- objects/text.c | 4 +- programs/progman/Makefile.in | 46 ++-- programs/winhelp/Makefile.in | 41 +-- rc/Makefile.in | 21 +- resources/Makefile.in | 14 +- tools/Makefile.in | 7 +- win32/Makefile.in | 9 +- win32/cursoricon32.c | 19 +- win32/environment.c | 4 +- win32/init.c | 6 +- win32/newfns.c | 8 +- win32/process.c | 10 +- win32/thread.c | 4 +- win32/time.c | 2 +- windows/Makefile.in | 9 +- windows/dce.c | 20 +- windows/defdlg.c | 10 +- windows/defwnd.c | 12 +- windows/dialog.c | 158 ++++++----- windows/event.c | 4 +- windows/graphics.c | 30 +-- windows/hook.c | 56 ++-- windows/mdi.c | 20 +- windows/message.c | 7 +- windows/msgbox.c | 2 +- windows/nonclient.c | 29 +- windows/painting.c | 26 +- windows/scroll.c | 12 +- windows/win.c | 8 +- windows/winpos.c | 16 +- 133 files changed, 1925 insertions(+), 1517 deletions(-) create mode 100644 graphics/metafiledrv/Makefile.in create mode 100644 graphics/metafiledrv/init.c create mode 100644 include/metafiledrv.h diff --git a/ANNOUNCE b/ANNOUNCE index 9eb3ba970dc..0d473b4ed4c 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,14 +1,13 @@ -This is release 960928 of Wine, the MS Windows emulator. This is still a +This is release 961013 of Wine, the MS Windows emulator. This is still a developer's only release. There are many bugs and many unimplemented API features. Most applications still do not work correctly. Patches should be submitted to "julliard@lrc.epfl.ch". Please don't forget to include a ChangeLog entry. -WHAT'S NEW with Wine-960928: (see ChangeLog for details) - - Intertask messaging improved. - - Many painting fixes. - - Still more Win32 support. +WHAT'S NEW with Wine-961013: (see ChangeLog for details) + - Several non Win32-clean data types removed. + - Graphics driver for metafiles. - Lots of bug fixes. See the README file in the distribution for installation instructions. @@ -17,10 +16,10 @@ Because of lags created by using mirror, this message may reach you before the release is available at the ftp sites. The sources will be available from the following locations: - ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-960928.tar.gz - ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-960928.tar.gz - ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-960928.tar.gz - ftp://aris.com/pub/linux/ALPHA/Wine/development/Wine-960928.tar.gz + ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-961013.tar.gz + ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-961013.tar.gz + ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-961013.tar.gz + ftp://aris.com/pub/linux/ALPHA/Wine/development/Wine-961013.tar.gz It should also be available from any site that mirrors tsx-11 or sunsite. diff --git a/ChangeLog b/ChangeLog index c5086157483..03051aab3de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,46 @@ +---------------------------------------------------------------------- +Sun Oct 13 15:32:32 1996 Alexandre Julliard + + * [Make.rules.in] [*/Makefile.in] + Made it possible to compile from a directory other than the source + directory. + + * [graphics/metafiledrv/init.c] [include/metafiledrv.h] + [objects/metafile.c] [objects/dc.c] + New graphics driver for metafiles. + + * [if1632/thunk.c] + Added thunks for SetWindowsHook and SetDCHook. + + * [windows/dialog.c] + Fixed GetNextDlgGroupItem and GetNextDlgTabItem to skip disabled + items. + + * [*/*] + Removed non Win32-clean types HANDLE, HBITMAP, HBRUSH, HFONT, + HINSTANCE, HMENU, HRGN and HTASK. + +Wed Oct 9 14:59:45 1996 Frans van Dorsselaer + + * [controls/edit.c] + Fixed EditWndProc() to fall back to DefWndProc() when the + edit state structure is not available. + +Wed Oct 2 14:00:34 1996 Huw D. M. Davies + + * [windows/nonclient.c] [windows/mdi.c] + AdjustWindowRectEx16() should only take notice of the styles + WS_DLGFRAME, WS_BORDER, WS_THICKFRAME and + WS_EX_DLGMODALFRAME. Thanks to Alex Korobka. + + * [controls/scroll.c] + Fixed typo in ShowScrollBar32(). + +Sun Aug 25 20:18:56 1996 Jukka Iivonen + + * [if1632/user32.spec] [if1632/winmm.spec] + Added SetParent and sndPlaySoundA. + ---------------------------------------------------------------------- Fri Sep 27 14:18:42 1996 Alexandre Julliard diff --git a/Make.rules.in b/Make.rules.in index 41c1430e5e6..06455e142e9 100644 --- a/Make.rules.in +++ b/Make.rules.in @@ -1,5 +1,14 @@ # Global rules shared by all makefiles -# The makefile must define at least TOPSRC and MODULE +# +# Each individual makefile should define the following variables: +# TOPSRCDIR : top-level source directory +# TOPOBJDIR : top-level object directory +# SRCDIR : source directory for this module +# MODULE : name of the module being built +# C_SRCS : C sources for the module +# GEN_C_SRCS : generated C sources (optional) +# ASM_SRCS : assembly sources (optional) +# EXTRA_OBJS : extra object files (optional) # First some useful definitions @@ -10,24 +19,24 @@ CFLAGS = @CFLAGS@ OPTIONS = @OPTIONS@ X_CFLAGS = @X_CFLAGS@ X_LIBS = @X_LIBS@ -XPM_LIB = -lXpm -XLIB = @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@ -WINELIB = -L$(TOPSRC) -lwine -LDLIBS = @LDLIBS@ +XPM_LIB = -lXpm +XLIB = @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@ +WINELIB = -L$(TOPOBJDIR) -lwine +LDLIBS = @LDLIBS@ YACC = @YACC@ LEX = @LEX@ LEXLIB = @LEXLIB@ -DIVINCL = -I$(TOPSRC)/include +DIVINCL = -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include -I. ALLCFLAGS = $(CFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) $(X_CFLAGS) LDCOMBINE = ld -r RM = rm -f -BUILD = $(TOPSRC)/tools/build -WINERC = $(TOPSRC)/rc/winerc +BUILD = $(TOPOBJDIR)/tools/build +WINERC = $(TOPOBJDIR)/rc/winerc SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)' @SET_MAKE@ -OBJS = $(C_SRCS:.c=.o) $(ASM_SRCS:.S=.o) $(EXTRA_OBJS) - +OBJS = $(C_SRCS:.c=.o) $(GEN_C_SRCS:.c=.o) $(ASM_SRCS:.S=.o) $(EXTRA_OBJS) +DEPEND_SRCS = $(C_SRCS:%=$(SRCDIR)/%) $(GEN_C_SRCS:%=./%) # Implicit rules @@ -43,21 +52,21 @@ OBJS = $(C_SRCS:.c=.o) $(ASM_SRCS:.S=.o) $(EXTRA_OBJS) echo "#include \"windows.h\"" >winerctmp.c echo WINDOWS_H_ENDS_HERE >>winerctmp.c cat $< >>winerctmp.c - $(CPP) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) -c -o $* -p $* + $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) -c -o $* -p $* $(RM) winerctmp.c .rc.h: echo "#include \"windows.h\"" >winerctmp.c echo WINDOWS_H_ENDS_HERE >>winerctmp.c cat $< >>winerctmp.c - $(CPP) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) -c -o $* -p $* + $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) -c -o $* -p $* $(RM) winerctmp.c # Rule to rebuild resource compiler $(WINERC) check_winerc: - cd $(TOPSRC)/rc; $(SUBMAKE) winerc + cd $(TOPOBJDIR)/rc; $(SUBMAKE) winerc # Rule for main module @@ -68,13 +77,13 @@ $(MODULE).o: $(OBJS) # Misc. rules -depend:: $(C_SRCS) +depend:: $(C_SRCS) $(GEN_C_SRCS) sed '/\#\#\# Dependencies/q' < Makefile > tmp_make - $(CC) $(ALLCFLAGS) -MM $(C_SRCS) >> tmp_make + $(CC) $(ALLCFLAGS) -MM $(DEPEND_SRCS) >> tmp_make mv tmp_make Makefile clean:: - $(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc tmp_make winerctmp.c + $(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc tmp_make winerctmp.c $(GEN_C_SRCS) dummy: diff --git a/Makefile.in b/Makefile.in index a50864f6c99..3bfdb34ea4c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -47,6 +47,7 @@ COMMONSUBDIRS = \ controls \ files \ graphics \ + graphics/metafiledrv \ graphics/x11drv \ ipc \ loader \ @@ -75,6 +76,7 @@ COMMONOBJS = \ controls/controls.o \ files/files.o \ graphics/graphics.o \ + graphics/metafiledrv/metafiledrv.o \ graphics/x11drv/x11drv.o \ ipc/ipc.o \ loader/loader.o \ diff --git a/configure b/configure index cc2ab473588..6d3c83d9c6c 100755 --- a/configure +++ b/configure @@ -2066,6 +2066,7 @@ controls/Makefile debugger/Makefile files/Makefile graphics/Makefile +graphics/metafiledrv/Makefile graphics/win16drv/Makefile graphics/x11drv/Makefile if1632/Makefile @@ -2144,6 +2145,7 @@ controls/Makefile debugger/Makefile files/Makefile graphics/Makefile +graphics/metafiledrv/Makefile graphics/win16drv/Makefile graphics/x11drv/Makefile if1632/Makefile diff --git a/configure.in b/configure.in index 0df6d511207..e96abccf380 100644 --- a/configure.in +++ b/configure.in @@ -104,6 +104,7 @@ controls/Makefile debugger/Makefile files/Makefile graphics/Makefile +graphics/metafiledrv/Makefile graphics/win16drv/Makefile graphics/x11drv/Makefile if1632/Makefile diff --git a/controls/Makefile.in b/controls/Makefile.in index 0b997805c30..09188b5f1ba 100644 --- a/controls/Makefile.in +++ b/controls/Makefile.in @@ -1,6 +1,9 @@ -DEFS = -D__WINE__ -TOPSRC = @top_srcdir@ -MODULE = controls +DEFS = -D__WINE__ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = .. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = controls C_SRCS = \ button.c \ diff --git a/controls/button.c b/controls/button.c index d224256c964..4ccf6594958 100644 --- a/controls/button.c +++ b/controls/button.c @@ -11,7 +11,7 @@ #include "button.h" static void PB_Paint( WND *wndPtr, HDC32 hDC, WORD action ); -static void PB_PaintGrayOnGray(HDC32 hDC,HFONT hFont,RECT32 *rc,char *text); +static void PB_PaintGrayOnGray(HDC32 hDC,HFONT32 hFont,RECT32 *rc,char *text); static void CB_Paint( WND *wndPtr, HDC32 hDC, WORD action ); static void GB_Paint( WND *wndPtr, HDC32 hDC, WORD action ); static void UB_Paint( WND *wndPtr, HDC32 hDC, WORD action ); @@ -64,7 +64,7 @@ static const pfPaint btnPaintFunc[MAX_BTN_TYPE] = SendMessage32A( GetParent32((wndPtr)->hwndSelf), WM_CTLCOLORBTN, \ (hdc), (wndPtr)->hwndSelf ) -static HBITMAP hbitmapCheckBoxes = 0; +static HBITMAP16 hbitmapCheckBoxes = 0; static WORD checkBoxWidth = 0, checkBoxHeight = 0; @@ -173,7 +173,7 @@ LRESULT ButtonWndProc(HWND32 hWnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) return 0; case WM_SETFONT: - infoPtr->hFont = (HFONT) wParam; + infoPtr->hFont = (HFONT16)wParam; if (lParam) PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE ); break; @@ -253,7 +253,7 @@ static void PB_Paint( WND *wndPtr, HDC32 hDC, WORD action ) { RECT32 rc; HPEN16 hOldPen; - HBRUSH hOldBrush; + HBRUSH16 hOldBrush; BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra; GetClientRect32( wndPtr->hwndSelf, &rc ); @@ -262,7 +262,7 @@ static void PB_Paint( WND *wndPtr, HDC32 hDC, WORD action ) if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont ); BUTTON_SEND_CTLCOLOR( wndPtr, hDC ); hOldPen = (HPEN16)SelectObject(hDC, sysColorObjects.hpenWindowFrame); - hOldBrush = (HBRUSH)SelectObject(hDC, sysColorObjects.hbrushBtnFace); + hOldBrush = (HBRUSH16)SelectObject(hDC, sysColorObjects.hbrushBtnFace); SetBkMode(hDC, TRANSPARENT); Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom); if (action == ODA_DRAWENTIRE) @@ -334,13 +334,13 @@ static void PB_Paint( WND *wndPtr, HDC32 hDC, WORD action ) * using a raster brush to avoid gray text on gray background */ -void PB_PaintGrayOnGray(HDC32 hDC,HFONT hFont,RECT32 *rc,char *text) +void PB_PaintGrayOnGray(HDC32 hDC,HFONT32 hFont,RECT32 *rc,char *text) { static int Pattern[] = {0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55}; - HBITMAP hbm = CreateBitmap(8, 8, 1, 1, Pattern); + HBITMAP16 hbm = CreateBitmap(8, 8, 1, 1, Pattern); HDC hdcMem = CreateCompatibleDC(hDC); - HBITMAP hbmMem; - HBRUSH hBr; + HBITMAP16 hbmMem; + HBRUSH16 hBr; RECT32 rect,rc2; rect=*rc; @@ -370,7 +370,7 @@ void PB_PaintGrayOnGray(HDC32 hDC,HFONT hFont,RECT32 *rc,char *text) static void CB_Paint( WND *wndPtr, HDC32 hDC, WORD action ) { RECT16 rc; - HBRUSH hBrush; + HBRUSH16 hBrush; int textlen, delta, x, y; TEXTMETRIC16 tm; BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra; @@ -431,12 +431,12 @@ static void CB_Paint( WND *wndPtr, HDC32 hDC, WORD action ) */ static void BUTTON_CheckAutoRadioButton( WND *wndPtr ) { - HWND parent, sibling; + HWND32 parent, sibling; if (!(wndPtr->dwStyle & WS_CHILD)) return; parent = wndPtr->parent->hwndSelf; - for(sibling = GetNextDlgGroupItem(parent,wndPtr->hwndSelf,FALSE); + for(sibling = GetNextDlgGroupItem32( parent, wndPtr->hwndSelf, FALSE ); sibling != wndPtr->hwndSelf; - sibling = GetNextDlgGroupItem(parent,sibling,FALSE)) + sibling = GetNextDlgGroupItem32( parent, sibling, FALSE )) SendMessage32A( sibling, BM_SETCHECK32, BUTTON_UNCHECKED, 0 ); } @@ -479,7 +479,7 @@ static void GB_Paint( WND *wndPtr, HDC32 hDC, WORD action ) static void UB_Paint( WND *wndPtr, HDC32 hDC, WORD action ) { RECT16 rc; - HBRUSH hBrush; + HBRUSH16 hBrush; BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra; if (action == ODA_SELECT) return; diff --git a/controls/combo.c b/controls/combo.c index 412fb2e32e6..917ab1b9157 100644 --- a/controls/combo.c +++ b/controls/combo.c @@ -42,7 +42,7 @@ static BOOL CBCheckSize(HWND hwnd); static BOOL CBLCheckSize(HWND hwnd); -static HBITMAP hComboBit = 0; +static HBITMAP16 hComboBit = 0; static WORD CBitHeight, CBitWidth; static int COMBO_Init() @@ -175,7 +175,7 @@ static LRESULT CBCreate(HWND hwnd, WPARAM wParam, LPARAM lParam) WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | ES_LEFT, 0, 0, rect.right-6-CBitWidth, lphl->StdItemHeight+2*SYSMETRICS_CYBORDER, - hwnd, (HMENU)ID_EDIT, WIN_GetWindowInstance(hwnd), NULL ); + hwnd, (HMENU16)ID_EDIT, WIN_GetWindowInstance(hwnd), NULL ); lboxrect.top+=lphc->LBoxTop; lphc->hWndLBox = CreateWindow16( className, NULL, style | @@ -184,7 +184,7 @@ static LRESULT CBCreate(HWND hwnd, WPARAM wParam, LPARAM lParam) lboxrect.left, lboxrect.top, lboxrect.right - lboxrect.left, lboxrect.bottom - lboxrect.top, - hwndp,(HMENU)ID_CLB, WIN_GetWindowInstance(hwnd), + hwndp,(HMENU16)ID_CLB, WIN_GetWindowInstance(hwnd), (LPVOID)(HWND32)hwnd ); wndPtr->dwStyle &= ~(WS_VSCROLL | WS_HSCROLL); @@ -224,8 +224,8 @@ static LRESULT CBPaint(HWND hwnd, WPARAM wParam, LPARAM lParam) LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd); LPLISTSTRUCT lpls; PAINTSTRUCT16 ps; - HBRUSH hBrush; - HFONT hOldFont; + HBRUSH16 hBrush; + HFONT16 hOldFont; HDC16 hdc; RECT16 rect; @@ -558,7 +558,7 @@ static LRESULT CBSetFont(HWND hwnd, WPARAM wParam, LPARAM lParam) if (wParam == 0) lphl->hFont = GetStockObject(SYSTEM_FONT); else - lphl->hFont = (HFONT)wParam; + lphl->hFont = (HFONT16)wParam; if (lphc->hWndEdit) SendMessage16(lphc->hWndEdit,WM_SETFONT,lphl->hFont,0); return 0; @@ -914,8 +914,8 @@ static LRESULT CBLPaint( HWND hwnd, WPARAM wParam, LPARAM lParam ) LPHEADLIST lphl = CLBoxGetListHeader(hwnd); LPLISTSTRUCT lpls; PAINTSTRUCT16 ps; - HBRUSH hBrush; - HFONT hOldFont; + HBRUSH16 hBrush; + HFONT16 hOldFont; WND * wndPtr = WIN_FindWndPtr(hwnd); HWND combohwnd = CLBoxGetCombo(hwnd); HDC16 hdc; diff --git a/controls/edit.c b/controls/edit.c index fb87a798273..a5e811eae3c 100644 --- a/controls/edit.c +++ b/controls/edit.c @@ -49,7 +49,7 @@ typedef struct UINT TextWidth; /* width of the widest line in pixels */ HLOCAL16 hBuf; char *text; - HFONT hFont; + HFONT16 hFont; LINEDEF *LineDefs; UINT XOffset; /* offset of the viewport in pixels */ UINT FirstVisibleLine; @@ -240,6 +240,9 @@ LRESULT EditWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) LRESULT lResult = 0L; WND *wndPtr = WIN_FindWndPtr(hwnd); + if ((!EDITSTATEPTR(wndPtr)) && (msg != WM_CREATE)) + return DefWindowProc16(hwnd, msg, wParam, lParam); + switch (msg) { case EM_CANUNDO: DPRINTF_EDIT_MSG("EM_CANUNDO"); @@ -504,8 +507,8 @@ static void EDIT_BuildLineDefs(WND *wndPtr) char *text = EDIT_GetPasswordPointer(wndPtr); int ww = EDIT_GetWndWidth(wndPtr); HDC32 hdc; - HFONT hFont; - HFONT oldFont = 0; + HFONT16 hFont; + HFONT16 oldFont = 0; char *start, *cp; int prev, next; int width; @@ -513,7 +516,7 @@ static void EDIT_BuildLineDefs(WND *wndPtr) LINE_END ending; hdc = GetDC32(wndPtr->hwndSelf); - hFont = (HFONT)EDIT_WM_GetFont(wndPtr, 0, 0L); + hFont = (HFONT16)EDIT_WM_GetFont(wndPtr, 0, 0L); if (hFont) oldFont = SelectObject(hdc, hFont); @@ -1442,15 +1445,15 @@ static INT EDIT_WndXFromCol(WND *wndPtr, UINT line, UINT col) char *text = EDIT_GetPasswordPointer(wndPtr); INT ret; HDC32 hdc; - HFONT hFont; - HFONT oldFont = 0; + HFONT16 hFont; + HFONT16 oldFont = 0; UINT lc = (UINT)EDIT_EM_GetLineCount(wndPtr, 0, 0L); UINT li = (UINT)EDIT_EM_LineIndex(wndPtr, line, 0L); UINT ll = (UINT)EDIT_EM_LineLength(wndPtr, li, 0L); UINT xoff = EDIT_GetXOffset(wndPtr); hdc = GetDC32(wndPtr->hwndSelf); - hFont = (HFONT)EDIT_WM_GetFont(wndPtr, 0, 0L); + hFont = (HFONT16)EDIT_WM_GetFont(wndPtr, 0, 0L); if (hFont) oldFont = SelectObject(hdc, hFont); line = MAX(0, MIN(line, lc - 1)); @@ -2311,12 +2314,12 @@ static LRESULT EDIT_WM_Enable(WND *wndPtr, WPARAM wParam, LPARAM lParam) */ static LRESULT EDIT_WM_EraseBkGnd(WND *wndPtr, WPARAM wParam, LPARAM lParam) { - HBRUSH hBrush; + HBRUSH16 hBrush; RECT16 rc; - hBrush = (HBRUSH)EDIT_SEND_CTLCOLOR(wndPtr, wParam); + hBrush = (HBRUSH16)EDIT_SEND_CTLCOLOR(wndPtr, wParam); if (!hBrush) - hBrush = (HBRUSH)GetStockObject(WHITE_BRUSH); + hBrush = (HBRUSH16)GetStockObject(WHITE_BRUSH); GetClientRect16(wndPtr->hwndSelf, &rc); IntersectClipRect((HDC)wParam, rc.left, rc.top, rc.right, rc.bottom); @@ -2678,8 +2681,8 @@ static LRESULT EDIT_WM_Paint(WND *wndPtr, WPARAM wParam, LPARAM lParam) UINT vlc = EDIT_GetVisibleLineCount(wndPtr); UINT lc = (UINT)EDIT_EM_GetLineCount(wndPtr, 0, 0L); HDC16 hdc; - HFONT hFont; - HFONT oldFont = 0; + HFONT16 hFont; + HFONT16 oldFont = 0; RECT16 rc; RECT16 rcLine; RECT16 rcRgn; @@ -2776,9 +2779,9 @@ static LRESULT EDIT_WM_SetFont(WND *wndPtr, WPARAM wParam, LPARAM lParam) EDITSTATE *es = EDITSTATEPTR(wndPtr); LPARAM sel = EDIT_EM_GetSel(wndPtr, 0, 0L); HDC32 hdc; - HFONT oldFont = 0; + HFONT16 oldFont = 0; - es->hFont = (HFONT)wParam; + es->hFont = (HFONT16)wParam; hdc = GetDC32(wndPtr->hwndSelf); if (es->hFont) oldFont = SelectObject(hdc, es->hFont); diff --git a/controls/listbox.c b/controls/listbox.c index 4abf763f4b2..f39cfdc1e2c 100644 --- a/controls/listbox.c +++ b/controls/listbox.c @@ -430,7 +430,7 @@ int ListBoxAskCompare(LPHEADLIST lphl, int startItem, SEGPTR matchData, BOOL exa int ListBoxInsertString(LPHEADLIST lphl, UINT uIndex, LPCSTR newstr) { LPLISTSTRUCT *lppls, lplsnew, lpls; - HANDLE hStr; + HANDLE16 hStr; LPSTR str; UINT Count; @@ -1408,7 +1408,7 @@ static LONG LBSetFont(HWND hwnd, WPARAM wParam, LPARAM lParam) if (wParam == 0) lphl->hFont = GetStockObject(SYSTEM_FONT); else - lphl->hFont = (HFONT) wParam; + lphl->hFont = (HFONT16)wParam; /* a new font means possible new text height */ /* does this mean the height of each entry must be separately changed? */ @@ -1434,8 +1434,8 @@ static LONG LBPaint(HWND hwnd, WORD wParam, LONG lParam) LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd); LPLISTSTRUCT lpls; PAINTSTRUCT16 ps; - HBRUSH hBrush; - HFONT hOldFont; + HBRUSH16 hBrush; + HFONT16 hOldFont; HDC16 hdc = BeginPaint16( hwnd, &ps ); DC *dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC); RECT16 rect, paintRect, scratchRect; @@ -1454,8 +1454,8 @@ static LONG LBPaint(HWND hwnd, WORD wParam, LONG lParam) hOldFont = SelectObject(hdc, lphl->hFont); - hBrush = (HBRUSH)SendMessage32A( lphl->hParent, WM_CTLCOLORLISTBOX, - (WPARAM)hdc, (LPARAM)hwnd); + hBrush = (HBRUSH16)SendMessage32A( lphl->hParent, WM_CTLCOLORLISTBOX, + (WPARAM)hdc, (LPARAM)hwnd); if (hBrush == 0) hBrush = GetStockObject(WHITE_BRUSH); FillRect16(hdc, &rect, hBrush); @@ -1536,7 +1536,7 @@ static LONG LBSetFocus(HWND hwnd, WORD wParam, LONG lParam) if( lphl->ItemsCount && lphl->ItemFocused != -1) { HDC32 hDC = GetDC32(hwnd); - HFONT hOldFont = SelectObject(hDC, lphl->hFont); + HFONT16 hOldFont = SelectObject(hDC, lphl->hFont); LPLISTSTRUCT lpls; lpls = ListBoxGetItem(lphl,lphl->ItemFocused); @@ -1566,7 +1566,7 @@ static LONG LBKillFocus(HWND hwnd, WORD wParam, LONG lParam) if( lphl->ItemFocused != -1 ) { HDC32 hDC = GetDC32(hwnd); - HFONT hOldFont = SelectObject(hDC, lphl->hFont); + HFONT16 hOldFont = SelectObject(hDC, lphl->hFont); LPLISTSTRUCT lpls; lpls = ListBoxGetItem(lphl,lphl->ItemFocused); diff --git a/controls/menu.c b/controls/menu.c index d18b3ca320d..c01dfcb5a41 100644 --- a/controls/menu.c +++ b/controls/menu.c @@ -39,8 +39,8 @@ typedef struct UINT item_id; /* Item or popup id */ RECT16 rect; /* Item area (relative to menu window) */ WORD xTab; /* X position of text after Tab */ - HBITMAP hCheckBit; /* Bitmap for checked item */ - HBITMAP hUnCheckBit; /* Bitmap for unchecked item */ + HBITMAP16 hCheckBit; /* Bitmap for checked item */ + HBITMAP16 hUnCheckBit; /* Bitmap for unchecked item */ LPSTR text; /* Item text or bitmap handle */ } MENUITEM; @@ -49,7 +49,7 @@ typedef struct { WORD wFlags; /* Menu flags (MF_POPUP, MF_SYSMENU) */ WORD wMagic; /* Magic number */ - HANDLE hTaskQ; /* Task queue for this menu */ + HQUEUE16 hTaskQ; /* Task queue for this menu */ WORD Width; /* Width of the whole menu */ WORD Height; /* Height of the whole menu */ WORD nItems; /* Number of items in the menu */ @@ -89,11 +89,11 @@ static BOOL fEndMenuCalled = FALSE; extern void NC_DrawSysButton(HWND hwnd, HDC hdc, BOOL down); /* nonclient.c */ extern BOOL NC_GetSysPopupPos(WND* wndPtr, RECT16* rect); -extern HTASK TASK_GetNextTask(HTASK); +extern HTASK16 TASK_GetNextTask(HTASK16); -static HBITMAP hStdCheck = 0; -static HBITMAP hStdMnArrow = 0; -static HMENU MENU_DefSysMenu = 0; /* Default system menu */ +static HBITMAP16 hStdCheck = 0; +static HBITMAP16 hStdMnArrow = 0; +static HMENU16 MENU_DefSysMenu = 0; /* Default system menu */ /* we _can_ use global popup window because there's no way 2 menues can @@ -109,9 +109,9 @@ static UINT uSubPWndLevel = 0; * * Load a copy of the system menu. */ -static HMENU MENU_CopySysMenu(void) +static HMENU16 MENU_CopySysMenu(void) { - HMENU hMenu; + HMENU16 hMenu; HGLOBAL16 handle; POPUPMENU *menu; @@ -166,7 +166,7 @@ BOOL MENU_Init() * * Return the default system menu. */ -HMENU MENU_GetDefSysMenu(void) +HMENU16 MENU_GetDefSysMenu(void) { return MENU_DefSysMenu; } @@ -215,7 +215,7 @@ static BOOL MENU_IsInSysMenu( POPUPMENU *menu, POINT16 pt ) * * Grey the appropriate items in System menu. */ -void MENU_InitSysMenuPopup(HMENU hmenu, DWORD style, DWORD clsStyle) +void MENU_InitSysMenuPopup(HMENU16 hmenu, DWORD style, DWORD clsStyle) { BOOL gray; @@ -240,7 +240,7 @@ void MENU_InitSysMenuPopup(HMENU hmenu, DWORD style, DWORD clsStyle) * Find a menu item. Return a pointer on the item, and modifies *hmenu * in case the item was in a sub-menu. */ -static MENUITEM *MENU_FindItem( HMENU *hmenu, UINT *nPos, UINT wFlags ) +static MENUITEM *MENU_FindItem( HMENU16 *hmenu, UINT *nPos, UINT wFlags ) { POPUPMENU *menu; int i; @@ -263,7 +263,7 @@ static MENUITEM *MENU_FindItem( HMENU *hmenu, UINT *nPos, UINT wFlags ) } else if (item->item_flags & MF_POPUP) { - HMENU hsubmenu = (HMENU)item->item_id; + HMENU16 hsubmenu = (HMENU16)item->item_id; MENUITEM *subitem = MENU_FindItem( &hsubmenu, nPos, wFlags ); if (subitem) { @@ -311,7 +311,7 @@ static MENUITEM *MENU_FindItemByCoords( POPUPMENU *menu, int x, int y, UINT *pos * Find the menu item selected by a key press. * Return item id, -1 if none, -2 if we should close the menu. */ -static UINT MENU_FindItemByKey( HWND hwndOwner, HMENU hmenu, UINT key ) +static UINT MENU_FindItemByKey( HWND hwndOwner, HMENU16 hmenu, UINT key ) { POPUPMENU *menu; MENUITEM *item; @@ -704,7 +704,7 @@ static void MENU_DrawMenuItem( HWND hwnd, HDC hdc, MENUITEM *lpitem, * * Paint a popup menu. */ -static void MENU_DrawPopupMenu( HWND hwnd, HDC hdc, HMENU hmenu ) +static void MENU_DrawPopupMenu( HWND hwnd, HDC hdc, HMENU16 hmenu ) { POPUPMENU *menu; MENUITEM *item; @@ -731,7 +731,7 @@ UINT MENU_DrawMenuBar(HDC hDC, LPRECT16 lprect, HWND hwnd, BOOL suppress_draw) int i; WND *wndPtr = WIN_FindWndPtr( hwnd ); - lppop = (LPPOPUPMENU) USER_HEAP_LIN_ADDR( (HMENU)wndPtr->wIDmenu ); + lppop = (LPPOPUPMENU) USER_HEAP_LIN_ADDR( (HMENU16)wndPtr->wIDmenu ); if (lppop == NULL || lprect == NULL) return SYSMETRICS_CYMENU; dprintf_menu(stddeb,"MENU_DrawMenuBar(%04x, %p, %p); !\n", hDC, lprect, lppop); @@ -756,7 +756,7 @@ UINT MENU_DrawMenuBar(HDC hDC, LPRECT16 lprect, HWND hwnd, BOOL suppress_draw) /*********************************************************************** * MENU_SwitchTPWndTo */ -BOOL32 MENU_SwitchTPWndTo( HTASK hTask) +BOOL32 MENU_SwitchTPWndTo( HTASK16 hTask ) { /* This is supposed to be called when popup is hidden. * AppExit() calls with hTask == 0, so we get the next to current. @@ -789,7 +789,7 @@ BOOL32 MENU_SwitchTPWndTo( HTASK hTask) * * Display a popup menu. */ -static BOOL MENU_ShowPopup(HWND hwndOwner, HMENU hmenu, UINT id, int x, int y, +static BOOL MENU_ShowPopup(HWND hwndOwner, HMENU16 hmenu, UINT id, int x, int y, int xanchor, int yanchor) { POPUPMENU *menu; @@ -885,7 +885,7 @@ static BOOL MENU_ShowPopup(HWND hwndOwner, HMENU hmenu, UINT id, int x, int y, /*********************************************************************** * MENU_SelectItem */ -static void MENU_SelectItem( HWND hwndOwner, HMENU hmenu, UINT wIndex, +static void MENU_SelectItem( HWND hwndOwner, HMENU16 hmenu, UINT wIndex, BOOL sendMenuSelect ) { LPPOPUPMENU lppop; @@ -949,7 +949,7 @@ static void MENU_SelectItem( HWND hwndOwner, HMENU hmenu, UINT wIndex, * MENU_SelectItemRel * */ -static void MENU_SelectItemRel( HWND hwndOwner, HMENU hmenu, int offset ) +static void MENU_SelectItemRel( HWND hwndOwner, HMENU16 hmenu, int offset ) { int i, min = 0; POPUPMENU *menu; @@ -1038,7 +1038,7 @@ static BOOL MENU_SetItemData( MENUITEM *item, UINT flags, UINT id, LPCSTR str ) * * Insert a new item into a menu. */ -static MENUITEM *MENU_InsertItem( HMENU hMenu, UINT pos, UINT flags ) +static MENUITEM *MENU_InsertItem( HMENU16 hMenu, UINT pos, UINT flags ) { MENUITEM *newItems; POPUPMENU *menu; @@ -1104,7 +1104,7 @@ static MENUITEM *MENU_InsertItem( HMENU hMenu, UINT pos, UINT flags ) * Parse a standard menu resource and add items to the menu. * Return a pointer to the end of the resource. */ -static LPCSTR MENU_ParseResource( LPCSTR res, HMENU hMenu, BOOL unicode ) +static LPCSTR MENU_ParseResource( LPCSTR res, HMENU16 hMenu, BOOL unicode ) { WORD flags, id = 0; LPCSTR str; @@ -1126,7 +1126,7 @@ static LPCSTR MENU_ParseResource( LPCSTR res, HMENU hMenu, BOOL unicode ) else res += (lstrlen32W((LPCWSTR)str) + 1) * sizeof(WCHAR); if (flags & MF_POPUP) { - HMENU hSubMenu = CreatePopupMenu(); + HMENU16 hSubMenu = CreatePopupMenu(); if (!hSubMenu) return NULL; if (!(res = MENU_ParseResource( res, hSubMenu, unicode ))) return NULL; @@ -1149,7 +1149,7 @@ static LPCSTR MENU_ParseResource( LPCSTR res, HMENU hMenu, BOOL unicode ) * * Return the handle of the selected sub-popup menu (if any). */ -static HMENU MENU_GetSubPopup( HMENU hmenu ) +static HMENU16 MENU_GetSubPopup( HMENU16 hmenu ) { POPUPMENU *menu; MENUITEM *item; @@ -1162,7 +1162,7 @@ static HMENU MENU_GetSubPopup( HMENU hmenu ) item = &menu->items[menu->FocusedItem]; if (!(item->item_flags & MF_POPUP) || !(item->item_flags & MF_MOUSESELECT)) return 0; - return (HMENU)item->item_id; + return (HMENU16)item->item_id; } @@ -1171,12 +1171,12 @@ static HMENU MENU_GetSubPopup( HMENU hmenu ) * * Hide the sub-popup menus of this menu. */ -static void MENU_HideSubPopups( HWND hwndOwner, HMENU hmenu, +static void MENU_HideSubPopups( HWND hwndOwner, HMENU16 hmenu, BOOL sendMenuSelect ) { MENUITEM *item; POPUPMENU *menu, *submenu; - HMENU hsubmenu; + HMENU16 hsubmenu; if (!(menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu ))) return; if (menu->FocusedItem == NO_SELECTED_ITEM) return; @@ -1190,7 +1190,7 @@ static void MENU_HideSubPopups( HWND hwndOwner, HMENU hmenu, if (!(item->item_flags & MF_POPUP) || !(item->item_flags & MF_MOUSESELECT)) return; item->item_flags &= ~MF_MOUSESELECT; - hsubmenu = (HMENU)item->item_id; + hsubmenu = (HMENU16)item->item_id; } submenu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hsubmenu ); MENU_HideSubPopups( hwndOwner, hsubmenu, FALSE ); @@ -1214,7 +1214,8 @@ static void MENU_HideSubPopups( HWND hwndOwner, HMENU hmenu, * Display the sub-menu of the selected item of this menu. * Return the handle of the submenu, or hmenu if no submenu to display. */ -static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu, BOOL selectFirst ) +static HMENU16 MENU_ShowSubPopup( HWND hwndOwner, HMENU16 hmenu, + BOOL selectFirst ) { POPUPMENU *menu; MENUITEM *item; @@ -1239,7 +1240,7 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu, BOOL selectFirst ) item->item_flags |= MF_MOUSESELECT; if (menu->wFlags & MF_POPUP) { - MENU_ShowPopup( hwndOwner, (HMENU)item->item_id, menu->FocusedItem, + MENU_ShowPopup( hwndOwner, (HMENU16)item->item_id, menu->FocusedItem, wndPtr->rectWindow.left + item->rect.right-arrow_bitmap_width, wndPtr->rectWindow.top + item->rect.top, item->rect.left - item->rect.right + 2*arrow_bitmap_width, @@ -1247,13 +1248,13 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu, BOOL selectFirst ) } else { - MENU_ShowPopup( hwndOwner, (HMENU)item->item_id, menu->FocusedItem, + MENU_ShowPopup( hwndOwner, (HMENU16)item->item_id, menu->FocusedItem, wndPtr->rectWindow.left + item->rect.left, wndPtr->rectWindow.top + item->rect.bottom, item->rect.right - item->rect.left, item->rect.bottom - item->rect.top ); } - if (selectFirst) MENU_SelectItemRel( hwndOwner, (HMENU)item->item_id, ITEM_NEXT ); - return (HMENU)item->item_id; + if (selectFirst) MENU_SelectItemRel( hwndOwner, (HMENU16)item->item_id, ITEM_NEXT ); + return (HMENU16)item->item_id; } @@ -1262,7 +1263,7 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu, BOOL selectFirst ) * * Find the menu containing a given point (in screen coords). */ -static HMENU MENU_FindMenuByCoords( HMENU hmenu, POINT16 pt ) +static HMENU16 MENU_FindMenuByCoords( HMENU16 hmenu, POINT16 pt ) { POPUPMENU *menu; HWND hwnd; @@ -1300,8 +1301,8 @@ static HMENU MENU_FindMenuByCoords( HMENU hmenu, POINT16 pt ) * Execute a menu item (for instance when user pressed Enter). * Return TRUE if we can go on with menu tracking. */ -static BOOL MENU_ExecFocusedItem( HWND hwndOwner, HMENU hmenu, - HMENU *hmenuCurrent ) +static BOOL MENU_ExecFocusedItem( HWND hwndOwner, HMENU16 hmenu, + HMENU16 *hmenuCurrent ) { MENUITEM *item; POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu ); @@ -1333,8 +1334,8 @@ static BOOL MENU_ExecFocusedItem( HWND hwndOwner, HMENU hmenu, * hmenuCurrent is the top-most visible popup. * Return TRUE if we can go on with menu tracking. */ -static BOOL MENU_ButtonDown( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent, - POINT16 pt ) +static BOOL MENU_ButtonDown( HWND hwndOwner, HMENU16 hmenu, + HMENU16 *hmenuCurrent, POINT16 pt ) { POPUPMENU *menu; MENUITEM *item; @@ -1383,12 +1384,12 @@ static BOOL MENU_ButtonDown( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent, * hmenuCurrent is the top-most visible popup. * Return TRUE if we can go on with menu tracking. */ -static BOOL MENU_ButtonUp( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent, - POINT16 pt ) +static BOOL MENU_ButtonUp( HWND hwndOwner, HMENU16 hmenu, + HMENU16 *hmenuCurrent, POINT16 pt ) { POPUPMENU *menu; MENUITEM *item; - HMENU hsubmenu = 0; + HMENU16 hsubmenu = 0; UINT id; if (!hmenu) return FALSE; /* Outside all menus */ @@ -1409,7 +1410,7 @@ static BOOL MENU_ButtonUp( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent, { return MENU_ExecFocusedItem( hwndOwner, hmenu, hmenuCurrent ); } - hsubmenu = (HMENU)item->item_id; + hsubmenu = (HMENU16)item->item_id; } /* Select first item of sub-popup */ MENU_SelectItem( hwndOwner, hsubmenu, NO_SELECTED_ITEM, FALSE ); @@ -1425,8 +1426,8 @@ static BOOL MENU_ButtonUp( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent, * hmenuCurrent is the top-most visible popup. * Return TRUE if we can go on with menu tracking. */ -static BOOL MENU_MouseMove( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent, - POINT16 pt ) +static BOOL MENU_MouseMove( HWND hwndOwner, HMENU16 hmenu, + HMENU16 *hmenuCurrent, POINT16 pt ) { MENUITEM *item; POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu ); @@ -1458,7 +1459,8 @@ static BOOL MENU_MouseMove( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent, /*********************************************************************** * MENU_DoNextMenu */ -static LRESULT MENU_DoNextMenu( HWND* hwndOwner, HMENU* hmenu, HMENU *hmenuCurrent, UINT vk) +static LRESULT MENU_DoNextMenu( HWND* hwndOwner, HMENU16* hmenu, + HMENU16 *hmenuCurrent, UINT vk) { POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( *hmenu ); UINT id = 0; @@ -1541,10 +1543,11 @@ static LRESULT MENU_DoNextMenu( HWND* hwndOwner, HMENU* hmenu, HMENU *hmenuCurre * Handle a VK_LEFT key event in a menu. * hmenuCurrent is the top-most visible popup. */ -static void MENU_KeyLeft( HWND* hwndOwner, HMENU* hmenu, HMENU *hmenuCurrent ) +static void MENU_KeyLeft( HWND* hwndOwner, HMENU16* hmenu, + HMENU16 *hmenuCurrent ) { POPUPMENU *menu; - HMENU hmenutmp, hmenuprev; + HMENU16 hmenutmp, hmenuprev; menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( *hmenu ); hmenuprev = hmenutmp = *hmenu; @@ -1581,10 +1584,11 @@ static void MENU_KeyLeft( HWND* hwndOwner, HMENU* hmenu, HMENU *hmenuCurrent ) * Handle a VK_RIGHT key event in a menu. * hmenuCurrent is the top-most visible popup. */ -static void MENU_KeyRight( HWND* hwndOwner, HMENU* hmenu, HMENU *hmenuCurrent ) +static void MENU_KeyRight( HWND* hwndOwner, HMENU16* hmenu, + HMENU16 *hmenuCurrent ) { POPUPMENU *menu; - HMENU hmenutmp; + HMENU16 hmenutmp; menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( *hmenu ); @@ -1620,7 +1624,7 @@ static void MENU_KeyRight( HWND* hwndOwner, HMENU* hmenu, HMENU *hmenuCurrent ) } else if (*hmenuCurrent != *hmenu) /* Hide last level popup */ { - HMENU hmenuprev; + HMENU16 hmenuprev; hmenuprev = hmenutmp = *hmenu; while (hmenutmp != *hmenuCurrent) { @@ -1640,12 +1644,12 @@ static void MENU_KeyRight( HWND* hwndOwner, HMENU* hmenu, HMENU *hmenuCurrent ) * If 'x' and 'y' are not 0, we simulate a button-down event at (x,y) * before beginning tracking. This is to help menu-bar tracking. */ -static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, int x, int y, +static BOOL MENU_TrackMenu( HMENU16 hmenu, UINT wFlags, int x, int y, HWND hwnd, const RECT16 *lprect ) { MSG16 msg; POPUPMENU *menu; - HMENU hmenuCurrent = hmenu; + HMENU16 hmenuCurrent = hmenu; BOOL fClosed = FALSE, fRemove; UINT pos; @@ -1668,7 +1672,7 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, int x, int y, if ((msg.message >= WM_MOUSEFIRST) && (msg.message <= WM_MOUSELAST)) { /* Find the sub-popup for this mouse event (if any) */ - HMENU hsubmenu = MENU_FindMenuByCoords( hmenu, msg.pt ); + HMENU16 hsubmenu = MENU_FindMenuByCoords( hmenu, msg.pt ); switch(msg.message) { @@ -1822,7 +1826,7 @@ void MENU_TrackMouseMenuBar( HWND hwnd, POINT16 pt ) HideCaret(0); SendMessage16( hwnd, WM_ENTERMENULOOP, 0, 0 ); SendMessage16( hwnd, WM_INITMENU, wndPtr->wIDmenu, 0 ); - MENU_TrackMenu( (HMENU)wndPtr->wIDmenu, TPM_LEFTALIGN | TPM_LEFTBUTTON, + MENU_TrackMenu( (HMENU16)wndPtr->wIDmenu, TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, hwnd, NULL ); SendMessage16( hwnd, WM_EXITMENULOOP, 0, 0 ); ShowCaret(0); @@ -1837,7 +1841,7 @@ void MENU_TrackMouseMenuBar( HWND hwnd, POINT16 pt ) void MENU_TrackKbdMenuBar( WND* wndPtr, UINT wParam, INT vkey) { UINT uItem = NO_SELECTED_ITEM; - HMENU hTrackMenu; + HMENU16 hTrackMenu; /* find window that has a menu */ @@ -1945,7 +1949,7 @@ LRESULT PopupMenuWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) PAINTSTRUCT16 ps; BeginPaint16( hwnd, &ps ); MENU_DrawPopupMenu( hwnd, ps.hdc, - (HMENU)GetWindowLong32A( hwnd, 0 ) ); + (HMENU16)GetWindowLong32A( hwnd, 0 ) ); EndPaint16( hwnd, &ps ); return 0; } @@ -1962,7 +1966,7 @@ LRESULT PopupMenuWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) break; case WM_USER: - if (wParam) SetWindowLong32A( hwnd, 0, (HMENU)wParam ); + if (wParam) SetWindowLong32A( hwnd, 0, (HMENU16)wParam ); break; default: return DefWindowProc16(hwnd, message, wParam, lParam); @@ -1984,7 +1988,7 @@ UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth, int orgX, int orgY ) LPPOPUPMENU lppop; if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; - if (!(lppop = (LPPOPUPMENU)USER_HEAP_LIN_ADDR((HMENU)wndPtr->wIDmenu))) + if (!(lppop = (LPPOPUPMENU)USER_HEAP_LIN_ADDR((HMENU16)wndPtr->wIDmenu))) return 0; hdc = GetDCEx32( hwnd, 0, DCX_CACHE | DCX_WINDOW ); SetRect16(&rectBar, orgX, orgY, orgX+menubarWidth, orgY+SYSMETRICS_CYMENU); @@ -2063,7 +2067,7 @@ BOOL32 ChangeMenu32W( HMENU32 hMenu, UINT32 pos, LPCWSTR data, /******************************************************************* * CheckMenuItem (USER.154) */ -INT CheckMenuItem( HMENU hMenu, UINT id, UINT flags ) +INT CheckMenuItem( HMENU16 hMenu, UINT id, UINT flags ) { MENUITEM *item; INT ret; @@ -2080,7 +2084,7 @@ INT CheckMenuItem( HMENU hMenu, UINT id, UINT flags ) /********************************************************************** * EnableMenuItem [USER.155] */ -BOOL EnableMenuItem(HMENU hMenu, UINT wItemID, UINT wFlags) +BOOL EnableMenuItem(HMENU16 hMenu, UINT wItemID, UINT wFlags) { MENUITEM *item; dprintf_menu(stddeb,"EnableMenuItem (%04x, %04X, %04X) !\n", @@ -2107,7 +2111,7 @@ BOOL EnableMenuItem(HMENU hMenu, UINT wItemID, UINT wFlags) /******************************************************************* * GetMenuString (USER.161) */ -int GetMenuString( HMENU hMenu, UINT wItemID, +int GetMenuString( HMENU16 hMenu, UINT wItemID, LPSTR str, short nMaxSiz, UINT wFlags ) { MENUITEM *item; @@ -2127,7 +2131,7 @@ int GetMenuString( HMENU hMenu, UINT wItemID, /********************************************************************** * HiliteMenuItem [USER.162] */ -BOOL HiliteMenuItem(HWND hWnd, HMENU hMenu, UINT wItemID, UINT wHilite) +BOOL HiliteMenuItem(HWND hWnd, HMENU16 hMenu, UINT wItemID, UINT wHilite) { LPPOPUPMENU menu; dprintf_menu(stddeb,"HiliteMenuItem(%04x, %04x, %04x, %04x);\n", @@ -2144,7 +2148,7 @@ BOOL HiliteMenuItem(HWND hWnd, HMENU hMenu, UINT wItemID, UINT wHilite) /********************************************************************** * GetMenuState [USER.250] */ -UINT GetMenuState(HMENU hMenu, UINT wItemID, UINT wFlags) +UINT GetMenuState(HMENU16 hMenu, UINT wItemID, UINT wFlags) { MENUITEM *item; dprintf_menu(stddeb,"GetMenuState(%04x, %04x, %04x);\n", @@ -2152,7 +2156,7 @@ UINT GetMenuState(HMENU hMenu, UINT wItemID, UINT wFlags) if (!(item = MENU_FindItem( &hMenu, &wItemID, wFlags ))) return -1; if (item->item_flags & MF_POPUP) { - POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( (HMENU)item->item_id ); + POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( (HMENU16)item->item_id ); if (!menu) return -1; else return (menu->nItems << 8) | (menu->wFlags & 0xff); } @@ -2163,7 +2167,7 @@ UINT GetMenuState(HMENU hMenu, UINT wItemID, UINT wFlags) /********************************************************************** * GetMenuItemCount [USER.263] */ -INT GetMenuItemCount(HMENU hMenu) +INT GetMenuItemCount(HMENU16 hMenu) { LPPOPUPMENU menu; dprintf_menu(stddeb,"GetMenuItemCount(%04x);\n", hMenu); @@ -2178,7 +2182,7 @@ INT GetMenuItemCount(HMENU hMenu) /********************************************************************** * GetMenuItemID [USER.264] */ -UINT GetMenuItemID(HMENU hMenu, int nPos) +UINT GetMenuItemID(HMENU16 hMenu, int nPos) { LPPOPUPMENU menu; @@ -2226,7 +2230,7 @@ BOOL32 InsertMenu32A( HMENU32 hMenu, UINT32 pos, UINT32 flags, } if (flags & MF_POPUP) /* Set the MF_POPUP flag on the popup-menu */ - ((POPUPMENU *)USER_HEAP_LIN_ADDR((HMENU)id))->wFlags |= MF_POPUP; + ((POPUPMENU *)USER_HEAP_LIN_ADDR((HMENU16)id))->wFlags |= MF_POPUP; item->hCheckBit = hStdCheck; item->hUnCheckBit = 0; @@ -2283,7 +2287,7 @@ BOOL32 AppendMenu32W( HMENU32 hMenu, UINT32 flags, UINT32 id, LPCWSTR data ) /********************************************************************** * RemoveMenu [USER.412] */ -BOOL RemoveMenu(HMENU hMenu, UINT nPos, UINT wFlags) +BOOL RemoveMenu(HMENU16 hMenu, UINT nPos, UINT wFlags) { LPPOPUPMENU menu; MENUITEM *item; @@ -2319,11 +2323,11 @@ BOOL RemoveMenu(HMENU hMenu, UINT nPos, UINT wFlags) /********************************************************************** * DeleteMenu [USER.413] */ -BOOL DeleteMenu(HMENU hMenu, UINT nPos, UINT wFlags) +BOOL DeleteMenu(HMENU16 hMenu, UINT nPos, UINT wFlags) { MENUITEM *item = MENU_FindItem( &hMenu, &nPos, wFlags ); if (!item) return FALSE; - if (item->item_flags & MF_POPUP) DestroyMenu( (HMENU)item->item_id ); + if (item->item_flags & MF_POPUP) DestroyMenu( (HMENU16)item->item_id ); /* nPos is now the position of the item */ RemoveMenu( hMenu, nPos, wFlags | MF_BYPOSITION ); return TRUE; @@ -2350,7 +2354,7 @@ BOOL32 ModifyMenu32A( HMENU32 hMenu, UINT32 pos, UINT32 flags, UINT32 id, LPCSTR str ) { MENUITEM *item; - HMENU hMenu16 = hMenu; + HMENU16 hMenu16 = hMenu; UINT16 pos16 = pos; if (IS_STRING_ITEM(flags)) @@ -2392,9 +2396,9 @@ BOOL32 ModifyMenu32W( HMENU32 hMenu, UINT32 pos, UINT32 flags, /********************************************************************** * CreatePopupMenu [USER.415] */ -HMENU CreatePopupMenu() +HMENU16 CreatePopupMenu() { - HMENU hmenu; + HMENU16 hmenu; POPUPMENU *menu; if (!(hmenu = CreateMenu())) return 0; @@ -2416,8 +2420,8 @@ DWORD GetMenuCheckMarkDimensions() /********************************************************************** * SetMenuItemBitmaps [USER.418] */ -BOOL SetMenuItemBitmaps(HMENU hMenu, UINT nPos, UINT wFlags, - HBITMAP hNewUnCheck, HBITMAP hNewCheck) +BOOL SetMenuItemBitmaps(HMENU16 hMenu, UINT nPos, UINT wFlags, + HBITMAP16 hNewUnCheck, HBITMAP16 hNewCheck) { MENUITEM *item; dprintf_menu(stddeb,"SetMenuItemBitmaps(%04x, %04x, %04x, %04x, %04x)\n", @@ -2444,9 +2448,9 @@ BOOL SetMenuItemBitmaps(HMENU hMenu, UINT nPos, UINT wFlags, /********************************************************************** * CreateMenu [USER.151] */ -HMENU CreateMenu() +HMENU16 CreateMenu() { - HMENU hMenu; + HMENU16 hMenu; LPPOPUPMENU menu; dprintf_menu(stddeb,"CreateMenu !\n"); if (!(hMenu = USER_HEAP_ALLOC( sizeof(POPUPMENU) ))) @@ -2469,7 +2473,7 @@ HMENU CreateMenu() /********************************************************************** * DestroyMenu [USER.152] */ -BOOL DestroyMenu(HMENU hMenu) +BOOL DestroyMenu(HMENU16 hMenu) { LPPOPUPMENU lppop; dprintf_menu(stddeb,"DestroyMenu (%04x) !\n", hMenu); @@ -2490,7 +2494,7 @@ BOOL DestroyMenu(HMENU hMenu) for (i = lppop->nItems; i > 0; i--, item++) { if (item->item_flags & MF_POPUP) - DestroyMenu( (HMENU)item->item_id ); + DestroyMenu( (HMENU16)item->item_id ); if (IS_STRING_ITEM(item->item_flags) && item->text) HeapFree( SystemHeap, 0, item->text ); } @@ -2504,7 +2508,7 @@ BOOL DestroyMenu(HMENU hMenu) /********************************************************************** * GetSystemMenu [USER.156] */ -HMENU GetSystemMenu(HWND hWnd, BOOL bRevert) +HMENU16 GetSystemMenu(HWND hWnd, BOOL bRevert) { WND *wndPtr = WIN_FindWndPtr( hWnd ); if (!wndPtr) return 0; @@ -2524,7 +2528,7 @@ HMENU GetSystemMenu(HWND hWnd, BOOL bRevert) /******************************************************************* * SetSystemMenu (USER.280) */ -BOOL SetSystemMenu( HWND hwnd, HMENU hMenu ) +BOOL SetSystemMenu( HWND hwnd, HMENU16 hMenu ) { WND *wndPtr; @@ -2539,18 +2543,18 @@ BOOL SetSystemMenu( HWND hwnd, HMENU hMenu ) /********************************************************************** * GetMenu [USER.157] */ -HMENU GetMenu(HWND hWnd) +HMENU16 GetMenu(HWND hWnd) { WND * wndPtr = WIN_FindWndPtr(hWnd); if (wndPtr == NULL) return 0; - return (HMENU)wndPtr->wIDmenu; + return (HMENU16)wndPtr->wIDmenu; } /********************************************************************** * SetMenu [USER.158] */ -BOOL SetMenu(HWND hWnd, HMENU hMenu) +BOOL SetMenu(HWND hWnd, HMENU16 hMenu) { LPPOPUPMENU lpmenu; WND * wndPtr = WIN_FindWndPtr(hWnd); @@ -2585,7 +2589,7 @@ BOOL SetMenu(HWND hWnd, HMENU hMenu) /********************************************************************** * GetSubMenu [USER.159] */ -HMENU GetSubMenu(HMENU hMenu, short nPos) +HMENU16 GetSubMenu(HMENU16 hMenu, short nPos) { LPPOPUPMENU lppop; @@ -2593,7 +2597,7 @@ HMENU GetSubMenu(HMENU hMenu, short nPos) if (!(lppop = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu))) return 0; if ((UINT)nPos >= lppop->nItems) return 0; if (!(lppop->items[nPos].item_flags & MF_POPUP)) return 0; - return (HMENU)lppop->items[nPos].item_id; + return (HMENU16)lppop->items[nPos].item_id; } @@ -2610,7 +2614,7 @@ void DrawMenuBar(HWND hWnd) wndPtr->wIDmenu != 0) { dprintf_menu(stddeb,"DrawMenuBar wIDmenu=%04X \n", wndPtr->wIDmenu); - lppop = (LPPOPUPMENU) USER_HEAP_LIN_ADDR((HMENU)wndPtr->wIDmenu); + lppop = (LPPOPUPMENU) USER_HEAP_LIN_ADDR((HMENU16)wndPtr->wIDmenu); if (lppop == NULL) return; lppop->Height = 0; /* Make sure we call MENU_MenuBarCalcSize */ @@ -2633,7 +2637,7 @@ void EndMenu(void) /*********************************************************************** * LookupMenuHandle (USER.217) */ -HMENU LookupMenuHandle( HMENU hmenu, INT id ) +HMENU16 LookupMenuHandle( HMENU16 hmenu, INT id ) { if (!MENU_FindItem( &hmenu, &id, MF_BYCOMMAND )) return 0; else return hmenu; @@ -2700,7 +2704,7 @@ HMENU32 LoadMenu32W( HINSTANCE32 instance, LPCWSTR name ) */ HMENU16 LoadMenuIndirect16( LPCVOID template ) { - HMENU hMenu; + HMENU16 hMenu; WORD version, offset; LPCSTR p = (LPCSTR)template; @@ -2729,7 +2733,7 @@ HMENU16 LoadMenuIndirect16( LPCVOID template ) */ HMENU32 LoadMenuIndirect32A( LPCVOID template ) { - HMENU hMenu; + HMENU16 hMenu; WORD version, offset; LPCSTR p = (LPCSTR)template; @@ -2767,7 +2771,7 @@ HMENU32 LoadMenuIndirect32W( LPCVOID template ) /********************************************************************** * IsMenu (USER.358) */ -BOOL IsMenu( HMENU hmenu ) +BOOL IsMenu( HMENU16 hmenu ) { LPPOPUPMENU menu; if (!(menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR( hmenu ))) return FALSE; diff --git a/controls/scroll.c b/controls/scroll.c index 34497fc95c2..1364fc13ea0 100644 --- a/controls/scroll.c +++ b/controls/scroll.c @@ -1249,7 +1249,7 @@ BOOL32 ShowScrollBar32( HWND32 hwnd, INT32 nBar, BOOL32 fShow ) else /* hide it */ { if (!(wndPtr->dwStyle & WS_HSCROLL) - && !(wndPtr->dwStyle & WS_HSCROLL)) return TRUE; + && !(wndPtr->dwStyle & WS_VSCROLL)) return TRUE; wndPtr->dwStyle &= ~(WS_HSCROLL | WS_VSCROLL); } break; diff --git a/controls/static.c b/controls/static.c index 8f91c6f2089..88bf0b29c86 100644 --- a/controls/static.c +++ b/controls/static.c @@ -145,7 +145,7 @@ LRESULT StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_SETFONT: if (style == SS_ICON) return 0; - infoPtr->hFont = (HFONT)wParam; + infoPtr->hFont = (HFONT16)wParam; if (LOWORD(lParam)) { InvalidateRect32( hWnd, NULL, FALSE ); @@ -183,7 +183,7 @@ LRESULT StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) static void STATIC_PaintTextfn( WND *wndPtr, HDC hdc ) { RECT16 rc; - HBRUSH hBrush; + HBRUSH16 hBrush; WORD wFormat; LONG style = wndPtr->dwStyle; @@ -231,7 +231,7 @@ static void STATIC_PaintTextfn( WND *wndPtr, HDC hdc ) static void STATIC_PaintRectfn( WND *wndPtr, HDC hdc ) { RECT16 rc; - HBRUSH hBrush; + HBRUSH16 hBrush; GetClientRect16( wndPtr->hwndSelf, &rc); @@ -271,7 +271,7 @@ static void STATIC_PaintRectfn( WND *wndPtr, HDC hdc ) static void STATIC_PaintIconfn( WND *wndPtr, HDC hdc ) { RECT16 rc; - HBRUSH hbrush; + HBRUSH16 hbrush; STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra; GetClientRect16( wndPtr->hwndSelf, &rc); diff --git a/debugger/Makefile.in b/debugger/Makefile.in index d574c2ac39d..337d43d57d2 100644 --- a/debugger/Makefile.in +++ b/debugger/Makefile.in @@ -1,6 +1,9 @@ -DEFS = -D__WINE__ -DNO_TRANSITION_TYPES -TOPSRC = @top_srcdir@ -MODULE = debugger +DEFS = -D__WINE__ -DNO_TRANSITION_TYPES +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = .. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = debugger C_SRCS = \ break.c \ @@ -10,7 +13,9 @@ C_SRCS = \ info.c \ memory.c \ registers.c \ - stack.c \ + stack.c + +GEN_C_SRCS = \ y.tab.c \ lex.yy.c @@ -19,12 +24,12 @@ all: $(MODULE).o @MAKE_RULES@ y.tab.c y.tab.h: dbg.y - $(YACC) -d -t dbg.y + $(YACC) -d -t $(SRCDIR)/dbg.y lex.yy.c: debug.l - $(LEX) -8 -I debug.l + $(LEX) -8 -I $(SRCDIR)/debug.l clean:: - $(RM) y.tab.c y.tab.h lex.yy.c + $(RM) y.tab.h ### Dependencies: diff --git a/debugger/dbg.y b/debugger/dbg.y index b94dee926f3..fa505b7c4d0 100644 --- a/debugger/dbg.y +++ b/debugger/dbg.y @@ -229,6 +229,17 @@ void DEBUG_EnterDebugger(void) } +/*********************************************************************** + * DebugBreak16 (KERNEL.203) + */ +void DebugBreak16( SIGCONTEXT *regs ) +{ + const char *module = MODULE_GetModuleName( GetExePtr(GetCurrentTask()) ); + fprintf( stderr, "%s called DebugBreak\n", module ? module : "???" ); + wine_debug( SIGTRAP, regs ); +} + + void wine_debug( int signal, SIGCONTEXT *regs ) { static int loaded_symbols = 0; diff --git a/files/Makefile.in b/files/Makefile.in index ae0a95126d8..c5f236b5c5b 100644 --- a/files/Makefile.in +++ b/files/Makefile.in @@ -1,7 +1,10 @@ prefix = @prefix@ sysconfdir = @sysconfdir@ DEFS = -D__WINE__ -DETCDIR=\"$(sysconfdir)\" -TOPSRC = @top_srcdir@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = .. +SRCDIR = @srcdir@ +VPATH = @srcdir@ MODULE = files C_SRCS = \ diff --git a/files/drive.c b/files/drive.c index 8695320d4d4..9210de7b954 100644 --- a/files/drive.c +++ b/files/drive.c @@ -80,7 +80,7 @@ static const FS_DESCR DRIVE_Filesystems[] = static DOSDRIVE DOSDrives[MAX_DOS_DRIVES]; static int DRIVE_CurDrive = -1; -static HTASK DRIVE_LastTask = 0; +static HTASK16 DRIVE_LastTask = 0; /*********************************************************************** diff --git a/files/file.c b/files/file.c index 2d786f24aa8..d8b22b2d860 100644 --- a/files/file.c +++ b/files/file.c @@ -1154,7 +1154,7 @@ LONG _hwrite( HFILE hFile, LPCSTR buffer, LONG count ) */ UINT16 SetHandleCount16( UINT16 count ) { - HANDLE hPDB = GetCurrentPDB(); + HGLOBAL16 hPDB = GetCurrentPDB(); PDB *pdb = (PDB *)GlobalLock16( hPDB ); BYTE *files = PTR_SEG_TO_LIN( pdb->fileHandlesPtr ); WORD i; @@ -1198,7 +1198,7 @@ UINT16 SetHandleCount16( UINT16 count ) #ifdef WINELIB newfiles = (BYTE *)GlobalAlloc32( GMEM_FIXED, count ); #else - HANDLE newhandle = GlobalAlloc16( GMEM_MOVEABLE, count ); + HGLOBAL16 newhandle = GlobalAlloc16( GMEM_MOVEABLE, count ); if (!newhandle) { DOS_ERROR( ER_OutOfMemory, EC_OutOfResource, SA_Abort, EL_Memory ); diff --git a/graphics/Makefile.in b/graphics/Makefile.in index 7049ecad6cd..cc4635410f8 100644 --- a/graphics/Makefile.in +++ b/graphics/Makefile.in @@ -1,6 +1,9 @@ -DEFS = -D__WINE__ -DNO_TRANSITION_TYPES -TOPSRC = @top_srcdir@ -MODULE = graphics +DEFS = -D__WINE__ -DNO_TRANSITION_TYPES +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = .. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = graphics C_SRCS = \ driver.c diff --git a/graphics/metafiledrv/Makefile.in b/graphics/metafiledrv/Makefile.in new file mode 100644 index 00000000000..1e39e5bfead --- /dev/null +++ b/graphics/metafiledrv/Makefile.in @@ -0,0 +1,15 @@ +DEFS = -D__WINE__ -DNO_TRANSITION_TYPES +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = metafiledrv + +C_SRCS = \ + init.c + +all: $(MODULE).o + +@MAKE_RULES@ + +### Dependencies: diff --git a/graphics/metafiledrv/init.c b/graphics/metafiledrv/init.c new file mode 100644 index 00000000000..af5aea1223d --- /dev/null +++ b/graphics/metafiledrv/init.c @@ -0,0 +1,240 @@ +/* + * Metafile driver initialisation functions + * + * Copyright 1996 Alexandre Julliard + */ + +#include "metafiledrv.h" +#include "dc.h" +#include "heap.h" +#include "global.h" +#include "metafile.h" +#include "stddebug.h" +#include "debug.h" + +static BOOL32 MFDRV_DeleteDC( DC *dc ); + +static const DC_FUNCTIONS MFDRV_Funcs = +{ + NULL, /* pArc */ + NULL, /* pBitBlt */ + NULL, /* pChord */ + NULL, /* pCreateDC */ + MFDRV_DeleteDC, /* pDeleteDC */ + NULL, /* pDeleteObject */ + NULL, /* pEllipse */ + NULL, /* pEscape */ + NULL, /* pExcludeClipRect */ + NULL, /* pExcludeVisRect */ + NULL, /* pExtFloodFill */ + NULL, /* pExtTextOut */ + NULL, /* pFillRgn */ + NULL, /* pFloodFill */ + NULL, /* pFrameRgn */ + NULL, /* pGetTextExtentPoint */ + NULL, /* pGetTextMetrics */ + NULL, /* pIntersectClipRect */ + NULL, /* pIntersectVisRect */ + NULL, /* pInvertRgn */ + NULL, /* pLineTo */ + NULL, /* pMoveToEx */ + NULL, /* pOffsetClipRgn */ + NULL, /* pOffsetViewportOrgEx */ + NULL, /* pOffsetWindowOrgEx */ + NULL, /* pPaintRgn */ + NULL, /* pPatBlt */ + NULL, /* pPie */ + NULL, /* pPolyPolygon */ + NULL, /* pPolygon */ + NULL, /* pPolyline */ + NULL, /* pRealizePalette */ + NULL, /* pRectangle */ + NULL, /* pRestoreDC */ + NULL, /* pRoundRect */ + NULL, /* pSaveDC */ + NULL, /* pScaleViewportExtEx */ + NULL, /* pScaleWindowExtEx */ + NULL, /* pSelectClipRgn */ + NULL, /* pSelectObject */ + NULL, /* pSelectPalette */ + NULL, /* pSetBkColor */ + NULL, /* pSetBkMode */ + NULL, /* pSetDIBitsToDevice */ + NULL, /* pSetMapMode */ + NULL, /* pSetMapperFlags */ + NULL, /* pSetPixel */ + NULL, /* pSetPolyFillMode */ + NULL, /* pSetROP2 */ + NULL, /* pSetRelAbs */ + NULL, /* pSetStretchBltMode */ + NULL, /* pSetTextAlign */ + NULL, /* pSetTextCharacterExtra */ + NULL, /* pSetTextColor */ + NULL, /* pSetTextJustification */ + NULL, /* pSetViewportExtEx */ + NULL, /* pSetViewportOrgEx */ + NULL, /* pSetWindowExtEx */ + NULL, /* pSetWindowOrgEx */ + NULL, /* pStretchBlt */ + NULL, /* pStretchDIBits */ + NULL /* pTextOut */ +}; + + + +/********************************************************************** + * MFDRV_AllocMetaFile + */ +static DC *MFDRV_AllocMetaFile(void) +{ + DC *dc; + METAFILEDRV_PDEVICE *physDev; + + if (!(dc = DC_AllocDC( &MFDRV_Funcs ))) return NULL; + dc->header.wMagic = METAFILE_DC_MAGIC; + + physDev = (METAFILEDRV_PDEVICE *)HeapAlloc(SystemHeap,0,sizeof(*physDev)); + if (!physDev) + { + GDI_HEAP_FREE( dc->hSelf ); + return NULL; + } + dc->physDev = physDev; + + if (!(physDev->mh = HeapAlloc( SystemHeap, 0, sizeof(*physDev->mh) ))) + { + HeapFree( SystemHeap, 0, physDev ); + GDI_HEAP_FREE( dc->hSelf ); + return NULL; + } + + physDev->nextHandle = 0; + + physDev->mh->mtHeaderSize = sizeof(METAHEADER) / sizeof(WORD); + physDev->mh->mtVersion = 0x0300; + physDev->mh->mtSize = physDev->mh->mtHeaderSize; + physDev->mh->mtNoObjects = 0; + physDev->mh->mtMaxRecord = 0; + physDev->mh->mtNoParameters = 0; + +/* DC_InitDC( dc ); */ + return dc; +} + + +/********************************************************************** +* MFDRV_DeleteDC + */ +static BOOL32 MFDRV_DeleteDC( DC *dc ) +{ + METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dc->physDev; + + if (physDev->mh) HeapFree( SystemHeap, 0, physDev->mh ); + HeapFree( SystemHeap, 0, physDev ); + dc->physDev = NULL; + return TRUE; +} + + +/********************************************************************** + * CreateMetafile16 (GDI.125) + */ +HDC16 CreateMetaFile16( LPCSTR filename ) +{ + DC *dc; + METAFILEDRV_PDEVICE *physDev; + HFILE hFile; + + printf( "CreateMetafile16: '%s'\n", filename ); + dprintf_metafile( stddeb, "CreateMetaFile16: '%s'\n", filename ); + + if (!(dc = MFDRV_AllocMetaFile())) return 0; + physDev = (METAFILEDRV_PDEVICE *)dc->physDev; + + if (filename) /* disk based metafile */ + { + physDev->mh->mtType = METAFILE_DISK; + if ((hFile = _lcreat( filename, 0 )) == HFILE_ERROR) + { + DeleteDC( dc->hSelf ); + return 0; + } + if (_lwrite32( hFile, (LPSTR)physDev->mh, + sizeof(*physDev->mh)) == HFILE_ERROR) + { + DeleteDC( dc->hSelf ); + return 0; + } + physDev->mh->mtNoParameters = hFile; /* store file descriptor here */ + /* windows probably uses this too*/ + } + else /* memory based metafile */ + physDev->mh->mtType = METAFILE_MEMORY; + + dprintf_metafile( stddeb, "CreateMetaFile16: returning %04x\n", dc->hSelf); + return dc->hSelf; +} + + +/****************************************************************** + * CloseMetafile16 (GDI.126) + */ +HMETAFILE16 CloseMetaFile16( HDC16 hdc ) +{ + DC *dc; + HMETAFILE16 hmf; + HFILE hFile; + METAFILEDRV_PDEVICE *physDev; + + dprintf_metafile( stddeb, "CloseMetaFile(%04x)\n", hdc ); + + if (!(dc = DC_GetDCPtr( hdc ))) return 0; + physDev = (METAFILEDRV_PDEVICE *)dc->physDev; + + /* Construct the end of metafile record - this is documented + * in SDK Knowledgebase Q99334. + */ + + if (!MF_MetaParam0(dc, META_EOF)) + { + DeleteDC( hdc ); + return 0; + } + + if (physDev->mh->mtType == METAFILE_DISK) /* disk based metafile */ + { + hFile = physDev->mh->mtNoParameters; + physDev->mh->mtNoParameters = 0; + if (_llseek(hFile, 0L, 0) == HFILE_ERROR) + { + DeleteDC( hdc ); + return 0; + } + if (_lwrite32( hFile, (LPSTR)physDev->mh, + sizeof(*physDev->mh)) == HFILE_ERROR) + { + DeleteDC( hdc ); + return 0; + } + _lclose(hFile); + } + + /* Now allocate a global handle for the metafile */ + + hmf = GLOBAL_CreateBlock( GMEM_MOVEABLE, physDev->mh, + physDev->mh->mtSize * sizeof(WORD), + GetCurrentPDB(), FALSE, FALSE, FALSE, NULL ); + physDev->mh = NULL; /* So it won't be deleted */ + DeleteDC( hdc ); + return hmf; +} + + +/****************************************************************** + * DeleteMetafile16 (GDI.127) + */ +BOOL16 DeleteMetaFile16( HMETAFILE16 hmf ) +{ + return !GlobalFree16( hmf ); +} + diff --git a/graphics/win16drv/Makefile.in b/graphics/win16drv/Makefile.in index 119ab9da61e..4514382e1b8 100644 --- a/graphics/win16drv/Makefile.in +++ b/graphics/win16drv/Makefile.in @@ -1,6 +1,9 @@ -DEFS = -D__WINE__ -DNO_TRANSITION_TYPES -TOPSRC = @top_srcdir@ -MODULE = win16drv +DEFS = -D__WINE__ -DNO_TRANSITION_TYPES +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = win16drv C_SRCS = \ font.c \ diff --git a/graphics/x11drv/Makefile.in b/graphics/x11drv/Makefile.in index 255c66e0faf..841f3f787d7 100644 --- a/graphics/x11drv/Makefile.in +++ b/graphics/x11drv/Makefile.in @@ -1,6 +1,9 @@ -DEFS = -D__WINE__ -DNO_TRANSITION_TYPES -TOPSRC = @top_srcdir@ -MODULE = x11drv +DEFS = -D__WINE__ -DNO_TRANSITION_TYPES +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = x11drv C_SRCS = \ font.c \ diff --git a/if1632/Makefile.in b/if1632/Makefile.in index 6e2c87f11cf..62c579b7cb6 100644 --- a/if1632/Makefile.in +++ b/if1632/Makefile.in @@ -1,8 +1,11 @@ -DEFS = -D__WINE__ -DNO_TRANSITION_TYPES -TOPSRC = @top_srcdir@ -MODULE = if1632 +DEFS = -D__WINE__ -DNO_TRANSITION_TYPES +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = .. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = if1632 -DLLS = \ +DLLS = \ advapi32.spec \ comctl32.spec \ comdlg32.spec \ @@ -75,7 +78,7 @@ all: checkbuild $(MODULE).o $(SPEC_FILES): $(BUILD) $(BUILD) checkbuild: - cd $(TOPSRC)/tools; $(SUBMAKE) build + cd $(TOPOBJDIR)/tools; $(SUBMAKE) build callfrom16.S: $(SPEC_FILES) $(BUILD) -callfrom16 `cat $(SPEC_FILES) | grep CallFrom16_ | sed 's/.*CallFrom16_\(.*\)/\1/' | sort | uniq` > callfrom16.S @@ -83,13 +86,16 @@ callfrom16.S: $(SPEC_FILES) callfrom32.S: $(SPEC_FILES) $(BUILD) -callfrom32 `cat $(SPEC_FILES) | grep CallFrom32_ | sed 's/.*CallFrom32_\(.*\)/\1/' | sort | uniq` > callfrom32.S -callto16.S: $(TOPSRC)/include/callback.h $(BUILD) - $(BUILD) -callto16 `cat $(TOPSRC)/include/callback.h | grep "extern.*CallTo16_" | sed 's/.*CallTo16_\(.*\)(.*/\1/' | sort | uniq` > callto16.S +callto16.S: $(TOPSRCDIR)/include/callback.h $(BUILD) + $(BUILD) -callto16 `cat $(TOPSRCDIR)/include/callback.h | grep "extern.*CallTo16_" | sed 's/.*CallTo16_\(.*\)(.*/\1/' | sort | uniq` > callto16.S -callto32.S: $(TOPSRC)/include/callback.h $(BUILD) - $(BUILD) -callto32 `cat $(TOPSRC)/include/callback.h | grep "extern.*CallTo32_" | sed 's/.*CallTo32_\(.*\)(.*/\1/' | sort | uniq` > callto32.S +callto32.S: $(TOPSRCDIR)/include/callback.h $(BUILD) + $(BUILD) -callto32 `cat $(TOPSRCDIR)/include/callback.h | grep "extern.*CallTo32_" | sed 's/.*CallTo32_\(.*\)(.*/\1/' | sort | uniq` > callto32.S + +except.o: except.S $(TOPOBJDIR)/include/config.h + $(CC) -c $(DIVINCL) -o $*.o $(SRCDIR)/except.S clean:: - rm -f $(SPEC_FILES) callfrom16.S callfrom32.S callto16.S callto32.S + $(RM) $(SPEC_FILES) callfrom16.S callfrom32.S callto16.S callto32.S ### Dependencies: diff --git a/if1632/except.S b/if1632/except.S index 66fb8612657..cbe05b78662 100644 --- a/if1632/except.S +++ b/if1632/except.S @@ -4,7 +4,7 @@ * Copyright (c) 1996 Onno Hovers, (onno@stack.urc.tue.nl) * */ -#include "../include/config.h" +#include "config.h" #ifdef NEED_UNDERSCORE_PREFIX diff --git a/if1632/gdi.spec b/if1632/gdi.spec index 6ab8988f532..e131b6c1f83 100644 --- a/if1632/gdi.spec +++ b/if1632/gdi.spec @@ -121,9 +121,9 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) #122 pascal ReSurRection 123 pascal16 PlayMetaFile(word word) PlayMetaFile 124 pascal16 GetMetaFile(ptr) GetMetaFile -125 pascal16 CreateMetaFile(ptr) CreateMetaFile -126 pascal16 CloseMetaFile(word) CloseMetaFile -127 pascal16 DeleteMetaFile(word) DeleteMetaFile +125 pascal16 CreateMetaFile(ptr) CreateMetaFile16 +126 pascal16 CloseMetaFile(word) CloseMetaFile16 +127 pascal16 DeleteMetaFile(word) DeleteMetaFile16 128 pascal16 MulDiv(s_word s_word s_word) MulDiv16 129 pascal16 SaveVisRgn(word) SaveVisRgn 130 pascal16 RestoreVisRgn(word) RestoreVisRgn @@ -157,8 +157,8 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) 180 pascal16 SetDCState(word word) SetDCState 181 pascal16 RectInRegionOld(word ptr) RectInRegion16 188 stub GetTextExtentEx -190 pascal16 SetDCHook(word segptr long) SetDCHook -191 pascal GetDCHook(word ptr) GetDCHook +190 pascal16 SetDCHook(word segptr long) THUNK_SetDCHook +191 pascal GetDCHook(word ptr) THUNK_GetDCHook 192 pascal16 SetHookFlags(word word) SetHookFlags 193 stub SetBoundsRect 194 stub GetBoundsRect @@ -352,6 +352,26 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) 527 stub SetMiterLimit 528 stub GDIParametersInfo 529 stub CreateHalftonePalette +# Stubs for Hebrew version +530 pascal16 GDI_530() stub_GDI_530 +531 pascal16 GDI_531() stub_GDI_531 +532 pascal16 GDI_532() stub_GDI_532 +536 pascal16 GDI_536() stub_GDI_536 +538 pascal16 GDI_538() stub_GDI_538 +540 pascal16 GDI_540() stub_GDI_540 +543 pascal16 GDI_543() stub_GDI_543 +555 pascal16 GDI_555() stub_GDI_555 +560 pascal16 GDI_560() stub_GDI_560 +561 pascal16 GDI_561() stub_GDI_561 +564 pascal16 GDI_564() stub_GDI_564 +565 pascal16 GDI_565() stub_GDI_565 +566 pascal16 GDI_566() stub_GDI_566 +571 pascal16 GDI_571() stub_GDI_571 +572 pascal16 GDI_572() stub_GDI_572 +573 pascal16 GDI_573() stub_GDI_573 +556 pascal16 GDI_556() stub_GDI_556 +558 pascal16 GDI_558() stub_GDI_558 +569 pascal16 GDI_569() stub_GDI_569 602 stub SetDIBColorTable 603 stub GetDIBColorTable 604 stub SetSolidBrush @@ -377,23 +397,3 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) 822 stub ICMTranslateRGB 823 stub ICMTranslateRGBs 824 stub ICMCheckCOlorsInGamut -# Stubs for Hebrew version -530 pascal16 GDI_530() stub_GDI_530 -531 pascal16 GDI_531() stub_GDI_531 -532 pascal16 GDI_532() stub_GDI_532 -536 pascal16 GDI_536() stub_GDI_536 -538 pascal16 GDI_538() stub_GDI_538 -540 pascal16 GDI_540() stub_GDI_540 -543 pascal16 GDI_543() stub_GDI_543 -555 pascal16 GDI_555() stub_GDI_555 -560 pascal16 GDI_560() stub_GDI_560 -561 pascal16 GDI_561() stub_GDI_561 -564 pascal16 GDI_564() stub_GDI_564 -565 pascal16 GDI_565() stub_GDI_565 -566 pascal16 GDI_566() stub_GDI_566 -571 pascal16 GDI_571() stub_GDI_571 -572 pascal16 GDI_572() stub_GDI_572 -573 pascal16 GDI_573() stub_GDI_573 -556 pascal16 GDI_556() stub_GDI_556 -558 pascal16 GDI_558() stub_GDI_558 -569 pascal16 GDI_569() stub_GDI_569 diff --git a/if1632/gdi32.spec b/if1632/gdi32.spec index 443043b0fd0..7c00df714e3 100644 --- a/if1632/gdi32.spec +++ b/if1632/gdi32.spec @@ -213,7 +213,7 @@ base 1 0206 stdcall GetObjectW(long long ptr) GetObject32W 0207 stub GetOutlineTextMetricsA 0208 stub GetOutlineTextMetricsW -0209 stub GetPaletteEntries +0209 stdcall GetPaletteEntries(long long long ptr) GetPaletteEntries 0210 stub GetPath 0211 stdcall GetPixel(long long long) GetPixel 0212 stub GetPixelFormat diff --git a/if1632/kernel.spec b/if1632/kernel.spec index 604c87c4d0e..9b2c4c9dedd 100644 --- a/if1632/kernel.spec +++ b/if1632/kernel.spec @@ -151,9 +151,9 @@ type win16 150 pascal16 DirectedYield(word) DirectedYield 151 stub WinOldApCall 152 pascal16 GetNumTasks() GetNumTasks -154 return GlobalNotify 4 0 +154 pascal16 GlobalNotify(segptr) GlobalNotify 155 pascal16 GetTaskDS() GetTaskDS -156 stub LimitEMSPages +156 return LimitEMSPages 4 0 157 return GetCurPID 4 0 158 return IsWinOldApTask 2 0 159 stub GlobalHandleNoRIP @@ -200,7 +200,7 @@ type win16 200 stub ValidateFreeSpaces 201 stub ReplaceInst 202 stub RegisterPtrace -203 stub DebugBreak +203 register DebugBreak() DebugBreak16 204 stub SwapRecording 205 stub CVWBreak 206 pascal16 AllocSelectorArray(word) AllocSelectorArray diff --git a/if1632/relay.c b/if1632/relay.c index ce0f4dd667b..63b35091902 100644 --- a/if1632/relay.c +++ b/if1632/relay.c @@ -44,7 +44,6 @@ BOOL32 RELAY_Init(void) codesel ); CALLTO16_RetAddr_long=MAKELONG( (int)CALLTO16_Ret_long-(int)CALLTO16_Start, codesel ); - return TRUE; } diff --git a/if1632/thunk.c b/if1632/thunk.c index 48a8022abe4..e3c19834f7d 100644 --- a/if1632/thunk.c +++ b/if1632/thunk.c @@ -6,27 +6,36 @@ #include "windows.h" #include "callback.h" +#include "heap.h" +#include "hook.h" +#include "module.h" #include "stddebug.h" #include "debug.h" -#include "heap.h" typedef void (*RELAY)(); -typedef struct +#pragma pack(1) + +typedef struct tagTHUNK { - BYTE popl_eax; /* 0x58 popl %eax (return address) */ - BYTE pushl_func; /* 0x68 pushl $proc */ - FARPROC32 proc WINE_PACKED; - BYTE pushl_eax; /* 0x50 pushl %eax */ - BYTE jmp; /* 0xe9 jmp relay (relative jump)*/ - RELAY relay WINE_PACKED; + BYTE popl_eax; /* 0x58 popl %eax (return address)*/ + BYTE pushl_func; /* 0x68 pushl $proc */ + FARPROC32 proc WINE_PACKED; + BYTE pushl_eax; /* 0x50 pushl %eax */ + BYTE jmp; /* 0xe9 jmp relay (relative jump)*/ + RELAY relay WINE_PACKED; + struct tagTHUNK *next WINE_PACKED; } THUNK; +#pragma pack(4) + #define DECL_THUNK(name,proc,relay) \ THUNK name = { 0x58, 0x68, (FARPROC32)(proc), 0x50, 0xe9, \ - (RELAY)((char *)(relay) - (char *)(&(name) + 1)) } + (RELAY)((char *)(relay) - (char *)(&(name).next)), NULL } +static THUNK *firstThunk = NULL; + /*********************************************************************** * THUNK_Alloc */ @@ -40,18 +49,42 @@ static THUNK *THUNK_Alloc( FARPROC32 func, RELAY relay ) thunk->proc = func; thunk->pushl_eax = 0x50; thunk->jmp = 0xe9; - thunk->relay = relay; + thunk->relay = (RELAY)((char *)relay - (char *)(&thunk->next)); + thunk->next = firstThunk; + firstThunk = thunk; } return thunk; } +/*********************************************************************** + * THUNK_Find + */ +static THUNK *THUNK_Find( FARPROC32 func ) +{ + THUNK *thunk = firstThunk; + while (thunk && (thunk->proc != func)) thunk = thunk->next; + return thunk; +} + + /*********************************************************************** * THUNK_Free */ -static void THUNK_Free( THUNK *thunk ) +void THUNK_Free( THUNK *thunk ) { - HeapFree( SystemHeap, 0, thunk ); + if (HEAP_IsInsideHeap( SystemHeap, 0, thunk )) + { + THUNK **prev = &firstThunk; + while (*prev && (*prev != thunk)) prev = &(*prev)->next; + if (*prev) + { + *prev = thunk->next; + HeapFree( SystemHeap, 0, thunk ); + return; + } + } + fprintf( stderr, "THUNK_Free: invalid thunk addr %p\n", thunk ); } @@ -251,6 +284,104 @@ BOOL16 THUNK_GrayString16( HDC16 hdc, HBRUSH16 hbr, GRAYSTRINGPROC16 func, } +/*********************************************************************** + * THUNK_SetWindowsHook16 (USER.121) + */ +FARPROC16 THUNK_SetWindowsHook16( INT16 id, HOOKPROC16 proc ) +{ + HINSTANCE16 hInst = FarGetOwner( HIWORD(proc) ); + HTASK16 hTask = (id == WH_MSGFILTER) ? GetCurrentTask() : 0; + THUNK *thunk = THUNK_Alloc( (FARPROC16)proc, (RELAY)CallTo16_long_wwl ); + if (!thunk) return 0; + return (FARPROC16)SetWindowsHookEx16( id, (HOOKPROC16)thunk, hInst, hTask); +} + + +/*********************************************************************** + * THUNK_UnhookWindowsHook16 (USER.234) + */ +BOOL16 THUNK_UnhookWindowsHook16( INT16 id, HOOKPROC16 proc ) +{ + BOOL16 ret = FALSE; + THUNK *thunk = THUNK_Find( (FARPROC16)proc ); + if (thunk) ret = UnhookWindowsHook16( id, (HOOKPROC16)thunk ); + return ret; +} + + +/*********************************************************************** + * THUNK_SetWindowsHookEx16 (USER.291) + */ +HHOOK THUNK_SetWindowsHookEx16( INT16 id, HOOKPROC16 proc, HINSTANCE16 hInst, + HTASK16 hTask ) +{ + THUNK *thunk = THUNK_Alloc( (FARPROC16)proc, (RELAY)CallTo16_long_wwl ); + if (!thunk) return 0; + return SetWindowsHookEx16( id, (HOOKPROC16)thunk, hInst, hTask ); +} + + +/*********************************************************************** + * THUNK_UnhookWindowHookEx16 (USER.292) + */ +BOOL16 THUNK_UnhookWindowsHookEx16( HHOOK hhook ) +{ + THUNK *thunk = (THUNK *)HOOK_GetProc16( hhook ); + BOOL16 ret = UnhookWindowsHookEx16( hhook ); + THUNK_Free( thunk ); + return ret; +} + + +static FARPROC16 defDCHookProc = NULL; + +/*********************************************************************** + * THUNK_SetDCHook (GDI.190) + */ +BOOL16 THUNK_SetDCHook( HDC16 hdc, FARPROC16 proc, DWORD dwHookData ) +{ + THUNK *thunk, *oldThunk; + + if (!defDCHookProc) /* Get DCHook Win16 entry point */ + defDCHookProc = MODULE_GetEntryPoint( GetModuleHandle("USER"), 362 ); + + if (proc != defDCHookProc) + { + thunk = THUNK_Alloc( proc, (RELAY)CallTo16_word_wwll ); + if (!thunk) return FALSE; + } + else thunk = (THUNK *)DCHook; + + /* Free the previous thunk */ + GetDCHook( hdc, (FARPROC16 *)&oldThunk ); + if (oldThunk && (oldThunk != (THUNK *)DCHook)) THUNK_Free( oldThunk ); + + return SetDCHook( hdc, (FARPROC16)thunk, dwHookData ); +} + + +/*********************************************************************** + * THUNK_GetDCHook (GDI.191) + */ +DWORD THUNK_GetDCHook( HDC16 hdc, FARPROC16 *phookProc ) +{ + THUNK *thunk = NULL; + DWORD ret = GetDCHook( hdc, (FARPROC16 *)&thunk ); + if (thunk) + { + if (thunk == (THUNK *)DCHook) + { + if (!defDCHookProc) /* Get DCHook Win16 entry point */ + defDCHookProc = MODULE_GetEntryPoint( GetModuleHandle("USER"), + 362 ); + *phookProc = defDCHookProc; + } + else *phookProc = thunk->proc; + } + return ret; +} + + struct thunkstruct { char magic[4]; diff --git a/if1632/user.spec b/if1632/user.spec index b833439df30..3b40231742d 100644 --- a/if1632/user.spec +++ b/if1632/user.spec @@ -6,7 +6,7 @@ heap 65520 2 stub OldExitWindows 3 stub EnableOEMLayer 4 stub DisableOEMLayer -5 pascal16 InitApp(word) USER_InitApp +5 pascal16 InitApp(word) InitApp 6 pascal16 PostQuitMessage(word) PostQuitMessage 7 pascal16 ExitWindows(long word) ExitWindows 10 pascal16 SetTimer(word word word segptr) SetTimer16 @@ -115,12 +115,12 @@ heap 65520 113 pascal16 TranslateMessage(ptr) TranslateMessage 114 pascal DispatchMessage(ptr) DispatchMessage 115 pascal16 ReplyMessage(long) ReplyMessage -116 pascal16 PostAppMessage(word word word long) PostAppMessage +116 pascal16 PostAppMessage(word word word long) PostAppMessage16 118 pascal16 RegisterWindowMessage(segptr) RegisterWindowMessage16 117 pascal16 WindowFromDC(word) WindowFromDC16 119 pascal GetMessagePos() GetMessagePos 120 pascal GetMessageTime() GetMessageTime -121 pascal SetWindowsHook(s_word segptr) SetWindowsHook +121 pascal SetWindowsHook(s_word segptr) THUNK_SetWindowsHook16 122 pascal CallWindowProc(segptr word word word long) CallWindowProc16 123 pascal16 CallMsgFilter(segptr s_word) CallMsgFilter 124 pascal16 UpdateWindow(word) UpdateWindow @@ -227,14 +227,14 @@ heap 65520 224 pascal16 GetWindowTask(word) GetWindowTask16 225 pascal16 EnumTaskWindows(word segptr long) THUNK_EnumTaskWindows16 226 stub LockInput -227 pascal16 GetNextDlgGroupItem(word word word) GetNextDlgGroupItem -228 pascal16 GetNextDlgTabItem(word word word) GetNextDlgTabItem +227 pascal16 GetNextDlgGroupItem(word word word) GetNextDlgGroupItem16 +228 pascal16 GetNextDlgTabItem(word word word) GetNextDlgTabItem16 229 pascal16 GetTopWindow(word) GetTopWindow 230 pascal16 GetNextWindow(word word) GetNextWindow 231 stub GetSystemDebugState 232 pascal16 SetWindowPos(word word word word word word word) SetWindowPos 233 pascal16 SetParent(word word) SetParent -234 pascal16 UnhookWindowsHook(s_word segptr) UnhookWindowsHook +234 pascal16 UnhookWindowsHook(s_word segptr) THUNK_UnhookWindowsHook16 235 pascal DefHookProc(s_word word long ptr) DefHookProc 236 pascal16 GetCapture() GetCapture16 237 pascal16 GetUpdateRgn(word word word) GetUpdateRgn @@ -294,8 +294,8 @@ heap 65520 288 pascal GetMessageExtraInfo() GetMessageExtraInfo #289 KEYB_EVENT 290 pascal16 RedrawWindow(word ptr word word) RedrawWindow16 -291 pascal SetWindowsHookEx(s_word segptr word word) SetWindowsHookEx -292 pascal16 UnhookWindowsHookEx(segptr) UnhookWindowsHookEx +291 pascal SetWindowsHookEx(s_word segptr word word) THUNK_SetWindowsHookEx16 +292 pascal16 UnhookWindowsHookEx(segptr) THUNK_UnhookWindowsHookEx16 293 pascal CallNextHookEx(segptr s_word word long) CallNextHookEx 294 stub LockWindowUpdate 299 register Mouse_Event() Mouse_Event diff --git a/if1632/user32.spec b/if1632/user32.spec index 133cf02eedf..59697941018 100644 --- a/if1632/user32.spec +++ b/if1632/user32.spec @@ -132,7 +132,7 @@ base 1 0125 stdcall DefWindowProcA(long long long long) DefWindowProc32A 0126 stdcall DefWindowProcW(long long long long) DefWindowProc32W 0127 stdcall DeferWindowPos(long long long long long long long long) DeferWindowPos -0128 stdcall DeleteMenu(long) DeleteMenu +0128 stdcall DeleteMenu(long long long) DeleteMenu 0129 stub DestroyAcceleratorTable 0130 stdcall DestroyCaret() DestroyCaret 0131 stub DestroyCursor @@ -278,8 +278,8 @@ base 1 0271 stub GetMessagePos 0272 stub GetMessageTime 0273 stdcall GetMessageW(ptr long long long) USER32_GetMessageA -0274 stub GetNextDlgGroupItem -0275 stub GetNextDlgTabItem +0274 stdcall GetNextDlgGroupItem(long long long) GetNextDlgGroupItem32 +0275 stdcall GetNextDlgTabItem(long long long) GetNextDlgTabItem32 0276 stub GetOpenClipboardWindow 0277 stdcall GetParent(long) GetParent32 0278 stub GetPriorityClipboardFormat @@ -498,7 +498,7 @@ base 1 0491 stub SetMenuItemInfoW 0492 stub SetMessageExtraInfo 0493 stdcall SetMessageQueue(long) SetMessageQueue -0494 stub SetParent +0494 stdcall SetParent(long long) SetParent 0495 stub SetProcessWindowStation 0496 stdcall SetPropA(long ptr long) SetProp32A 0497 stdcall SetPropW(long ptr long) SetProp32W diff --git a/if1632/winmm.spec b/if1632/winmm.spec index 8254403bad9..570780382eb 100644 --- a/if1632/winmm.spec +++ b/if1632/winmm.spec @@ -133,7 +133,7 @@ type win32 0132 stub mmioStringToFOURCCW 0133 stub mmioWrite 0134 stub mmsystemGetVersion -0135 stub sndPlaySoundA +0135 stdcall sndPlaySoundA(ptr long) sndPlaySound 0136 stub sndPlaySoundW 0137 stub timeBeginPeriod 0138 stub timeEndPeriod diff --git a/include/brush.h b/include/brush.h index a7c02f6a507..25803e66869 100644 --- a/include/brush.h +++ b/include/brush.h @@ -18,7 +18,7 @@ typedef struct extern BOOL BRUSH_Init(void); extern int BRUSH_GetObject( BRUSHOBJ * brush, int count, LPSTR buffer ); -extern BOOL BRUSH_DeleteObject( HBRUSH hbrush, BRUSHOBJ * brush ); -extern HBRUSH BRUSH_SelectObject( DC * dc, HBRUSH hbrush, BRUSHOBJ * brush ); +extern BOOL32 BRUSH_DeleteObject( HBRUSH16 hbrush, BRUSHOBJ * brush ); +extern HBRUSH16 BRUSH_SelectObject(DC * dc, HBRUSH16 hbrush, BRUSHOBJ * brush); #endif /* __WINE_BRUSH_H */ diff --git a/include/button.h b/include/button.h index b4f7ad7849d..ae1b6fee74a 100644 --- a/include/button.h +++ b/include/button.h @@ -15,8 +15,8 @@ /* broken enough to rely on this :-) */ typedef struct { - WORD state; /* Current state */ - HFONT hFont; /* Button font (or 0 for system font) */ + WORD state; /* Current state */ + HFONT16 hFont; /* Button font (or 0 for system font) */ } BUTTONINFO; /* Button state values */ diff --git a/include/callback.h b/include/callback.h index dfd37e94a49..bf94586984b 100644 --- a/include/callback.h +++ b/include/callback.h @@ -12,7 +12,6 @@ extern int CallTo32_LargeStack( int (*func)(), int nbargs, ... ); - /* List of the 16-bit callback functions. This list is used */ /* by the build program to generate the file if1632/callto16.S */ @@ -51,12 +50,8 @@ extern LONG CallTo16_long_lwwllwlllllw( FARPROC16, LONG, WORD, WORD, LONG, extern WORD CallTo16_regs_( FARPROC16 func, WORD ds, WORD es, WORD bp, WORD ax, WORD bx, WORD cx, WORD dx, WORD si, WORD di ); -#define CallDCHookProc( func, hdc, code, data, lparam) \ - CallTo16_word_wwll( func, hdc, code, data, lparam ) #define CallDriverProc( func, dwId, msg, hdrvr, lparam1, lparam2 ) \ CallTo16_long_lwwll( func, dwId, msg, hdrvr, lparam1, lparam2 ) -#define CallHookProc( func, code, wParam, lParam ) \ - CallTo16_long_wwl( func, code, wParam, lParam ) #define CallTimeFuncProc( func, id, msg, dwUser, dw1, dw2 ) \ CallTo16_word_wwlll( func, id, msg, dwUser, dw1, dw2 ) #define CallWindowsExitProc( func, nExitType ) \ @@ -72,7 +67,6 @@ extern WORD CallTo16_regs_( FARPROC16 func, WORD ds, WORD es, WORD bp, WORD ax, style, MAKELONG(y,x), MAKELONG(cy,cx), \ MAKELONG(hmenu,hparent), instance, params, \ hwnd, msg, wParam, lParam ) -#define _InitTermProc( func ) CallTo32_0( (FARPROC32)func ) /* List of the 32-bit callback functions. This list is used */ @@ -93,12 +87,8 @@ extern LONG CallTo32_4( FARPROC32, DWORD, DWORD, DWORD, DWORD ); #else /* WINELIB */ -#define CallDCHookProc( func, hdc, code, data, lparam ) \ - (*func)( hdc, code, data, lparam ) #define CallDriverProc( func, dwId, msg, hdrvr, lparam1, lparam2 ) \ (*func)( dwId, msg, hdrvr, lparam1, lparam2 ) -#define CallHookProc( func, code, wParam, lParam ) \ - (*func)( code, wParam, lParam ) #define CallTimeFuncProc( func, id, msg, dwUser, dw1, dw2 ) \ (*func)( id, msg, dwUser, dw1, dw2 ) #define CallWindowsExitProc( func, nExitType ) \ @@ -109,8 +99,6 @@ extern LONG CallTo32_4( FARPROC32, DWORD, DWORD, DWORD, DWORD ); (*func)( hwnd, msg, wParam, lParam ) #define CallWordBreakProc( func, lpch, ichCurrent, cch, code ) \ (*func)( lpch, ichCurrent, cch, code ) -#define _InitTermProc( func ) (*func)() - #endif /* WINELIB */ diff --git a/include/commdlg.h b/include/commdlg.h index 83f794edee6..b3d3293c6e3 100644 --- a/include/commdlg.h +++ b/include/commdlg.h @@ -50,7 +50,7 @@ extern "C" { typedef struct { DWORD lStructSize; HWND hwndOwner; - HINSTANCE hInstance; + HINSTANCE16 hInstance; SEGPTR lpstrFilter; SEGPTR lpstrCustomFilter; DWORD nMaxCustFilter; @@ -96,7 +96,7 @@ typedef CHOOSECOLOR *LPCHOOSECOLOR; typedef struct { DWORD lStructSize; /* size of this struct 0x20 */ HWND hwndOwner; /* handle to owner's window */ - HINSTANCE hInstance; /* instance handle of.EXE that */ + HINSTANCE16 hInstance; /* instance handle of.EXE that */ /* contains cust. dlg. template */ DWORD Flags; /* one or more of the FR_?? */ SEGPTR lpstrFindWhat; /* ptr. to search string */ @@ -141,7 +141,7 @@ typedef struct { LPARAM lCustData; /* data passed to hook fn. */ WNDPROC16 lpfnHook; SEGPTR lpTemplateName; /* custom template name */ - HINSTANCE hInstance; /* instance handle of.EXE that */ + HINSTANCE16 hInstance; /* instance handle of.EXE that */ /* contains cust. dlg. template */ SEGPTR lpszStyle WINE_PACKED; /* return the style field here */ /* must be LF_FACESIZE or bigger */ @@ -215,7 +215,7 @@ typedef struct { UINT nMinPage; UINT nMaxPage; UINT nCopies; - HINSTANCE hInstance; + HINSTANCE16 hInstance; LPARAM lCustData; WNDPROC16 lpfnPrintHook; WNDPROC16 lpfnSetupHook; diff --git a/include/dc.h b/include/dc.h index 8f98b9c0f15..192c2a31173 100644 --- a/include/dc.h +++ b/include/dc.h @@ -14,12 +14,13 @@ #define CLIP_EXCLUDE 0x0002 #define CLIP_KEEPRGN 0x0004 -extern void DC_InitDC( DC* dc ); -extern BOOL DC_SetupGCForPatBlt( DC * dc, GC gc, BOOL fMapColors ); -extern BOOL DC_SetupGCForBrush( DC * dc ); -extern BOOL DC_SetupGCForPen( DC * dc ); -extern BOOL DC_SetupGCForText( DC * dc ); -extern BOOL DC_CallHookProc( DC * dc, WORD code, LPARAM lParam ); +extern DC * DC_AllocDC( const DC_FUNCTIONS *funcs ); +extern DC * DC_GetDCPtr( HDC32 hdc ); +extern void DC_InitDC( DC * dc ); +extern BOOL32 DC_SetupGCForPatBlt( DC * dc, GC gc, BOOL32 fMapColors ); +extern BOOL32 DC_SetupGCForBrush( DC * dc ); +extern BOOL32 DC_SetupGCForPen( DC * dc ); +extern BOOL32 DC_SetupGCForText( DC * dc ); extern const int DC_XROPfunction[]; diff --git a/include/dialog.h b/include/dialog.h index fefdc45af7a..dd01585e8ae 100644 --- a/include/dialog.h +++ b/include/dialog.h @@ -19,16 +19,15 @@ typedef struct INT32 msgResult; /* Result of EndDialog() / Default button id */ HWINDOWPROC dlgProc; /* Dialog procedure */ LONG userInfo; /* User information (for DWL_USER) */ - HWND hwndFocus; /* Current control with focus */ - HFONT hUserFont; /* Dialog font */ - HMENU hMenu; /* Dialog menu */ + HWND16 hwndFocus; /* Current control with focus */ + HFONT16 hUserFont; /* Dialog font */ + HMENU16 hMenu; /* Dialog menu */ WORD xBaseUnit; /* Dialog units (depends on the font) */ WORD yBaseUnit; WORD fEnd; /* EndDialog() called for this dialog */ - HANDLE hDialogHeap; + HGLOBAL16 hDialogHeap; } DIALOGINFO; -extern BOOL DIALOG_Init(void); -extern HWND DIALOG_GetFirstTabItem( HWND hwndDlg ); +extern BOOL32 DIALOG_Init(void); #endif /* DIALOG_H */ diff --git a/include/gdi.h b/include/gdi.h index 5e8820881ff..b58f484010b 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -75,9 +75,6 @@ typedef struct int flags; const DeviceCaps *devCaps; - HMETAFILE16 hMetaFile; - HGLOBAL16 hHT; /* Handle table for metafile */ - WORD HTLen; /* Handle table length (in entries) */ HRGN16 hClipRgn; /* Clip region (may be 0) */ HRGN16 hVisRgn; /* Visible region (must never be 0) */ HRGN16 hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */ @@ -130,7 +127,7 @@ typedef X11DRV_PDEVICE X_DC_INFO; /* Temporary */ typedef struct tagDC { GDIOBJHDR header; - HDC16 hSelf; /* Handle to this DC */ + HDC32 hSelf; /* Handle to this DC */ const struct tagDC_FUNCS *funcs; /* DC function table */ void *physDev; /* Physical device (driver-specific) */ WORD saveLevel; @@ -235,28 +232,28 @@ typedef struct tagDC_FUNCS #define NB_STOCK_OBJECTS (SYSTEM_FIXED_FONT + 1) -#define STOCK_WHITE_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+WHITE_BRUSH)) -#define STOCK_LTGRAY_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+LTGRAY_BRUSH)) -#define STOCK_GRAY_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+GRAY_BRUSH)) -#define STOCK_DKGRAY_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+DKGRAY_BRUSH)) -#define STOCK_BLACK_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+BLACK_BRUSH)) -#define STOCK_NULL_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+NULL_BRUSH)) -#define STOCK_HOLLOW_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+HOLLOW_BRUSH)) -#define STOCK_WHITE_PEN ((HPEN16)(FIRST_STOCK_HANDLE+WHITE_PEN)) -#define STOCK_BLACK_PEN ((HPEN16)(FIRST_STOCK_HANDLE+BLACK_PEN)) -#define STOCK_NULL_PEN ((HPEN16)(FIRST_STOCK_HANDLE+NULL_PEN)) -#define STOCK_OEM_FIXED_FONT ((HFONT)(FIRST_STOCK_HANDLE+OEM_FIXED_FONT)) -#define STOCK_ANSI_FIXED_FONT ((HFONT)(FIRST_STOCK_HANDLE+ANSI_FIXED_FONT)) -#define STOCK_ANSI_VAR_FONT ((HFONT)(FIRST_STOCK_HANDLE+ANSI_VAR_FONT)) -#define STOCK_SYSTEM_FONT ((HFONT)(FIRST_STOCK_HANDLE+SYSTEM_FONT)) -#define STOCK_DEVICE_DEFAULT_FONT ((HFONT)(FIRST_STOCK_HANDLE+DEVICE_DEFAULT_FONT)) -#define STOCK_DEFAULT_PALETTE ((HPALETTE16)(FIRST_STOCK_HANDLE+DEFAULT_PALETTE)) -#define STOCK_SYSTEM_FIXED_FONT ((HFONT)(FIRST_STOCK_HANDLE+SYSTEM_FIXED_FONT)) +#define STOCK_WHITE_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+WHITE_BRUSH)) +#define STOCK_LTGRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+LTGRAY_BRUSH)) +#define STOCK_GRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+GRAY_BRUSH)) +#define STOCK_DKGRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+DKGRAY_BRUSH)) +#define STOCK_BLACK_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+BLACK_BRUSH)) +#define STOCK_NULL_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+NULL_BRUSH)) +#define STOCK_HOLLOW_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+HOLLOW_BRUSH)) +#define STOCK_WHITE_PEN ((HPEN16)(FIRST_STOCK_HANDLE+WHITE_PEN)) +#define STOCK_BLACK_PEN ((HPEN16)(FIRST_STOCK_HANDLE+BLACK_PEN)) +#define STOCK_NULL_PEN ((HPEN16)(FIRST_STOCK_HANDLE+NULL_PEN)) +#define STOCK_OEM_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+OEM_FIXED_FONT)) +#define STOCK_ANSI_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+ANSI_FIXED_FONT)) +#define STOCK_ANSI_VAR_FONT ((HFONT16)(FIRST_STOCK_HANDLE+ANSI_VAR_FONT)) +#define STOCK_SYSTEM_FONT ((HFONT16)(FIRST_STOCK_HANDLE+SYSTEM_FONT)) +#define STOCK_DEVICE_DEFAULT_FONT ((HFONT16)(FIRST_STOCK_HANDLE+DEVICE_DEFAULT_FONT)) +#define STOCK_DEFAULT_PALETTE ((HPALETTE16)(FIRST_STOCK_HANDLE+DEFAULT_PALETTE)) +#define STOCK_SYSTEM_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+SYSTEM_FIXED_FONT)) -#define FIRST_STOCK_FONT STOCK_OEM_FIXED_FONT -#define LAST_STOCK_FONT STOCK_SYSTEM_FIXED_FONT +#define FIRST_STOCK_FONT STOCK_OEM_FIXED_FONT +#define LAST_STOCK_FONT STOCK_SYSTEM_FIXED_FONT -#define LAST_STOCK_HANDLE ((DWORD)STOCK_SYSTEM_FIXED_FONT) +#define LAST_STOCK_HANDLE ((DWORD)STOCK_SYSTEM_FIXED_FONT) /* Device <-> logical coords conversion */ @@ -286,10 +283,9 @@ extern WORD GDI_HeapSel; ((handle) ? PTR_SEG_OFF_TO_SEGPTR(GDI_HeapSel, (handle)) : (SEGPTR)0) extern BOOL32 GDI_Init(void); -extern HANDLE16 GDI_AllocObject( WORD, WORD ); -extern BOOL32 GDI_FreeObject( HANDLE16 ); -extern GDIOBJHDR * GDI_GetObjPtr( HANDLE16, WORD ); -extern FARPROC16 GDI_GetDefDCHook(void); +extern HGDIOBJ16 GDI_AllocObject( WORD, WORD ); +extern BOOL32 GDI_FreeObject( HGDIOBJ16 ); +extern GDIOBJHDR * GDI_GetObjPtr( HGDIOBJ16, WORD ); extern BOOL32 DRIVER_RegisterDriver( LPCSTR name, const DC_FUNCTIONS *funcs ); extern const DC_FUNCTIONS *DRIVER_FindDriver( LPCSTR name ); diff --git a/include/hook.h b/include/hook.h index 0f499883bed..535afc27d66 100644 --- a/include/hook.h +++ b/include/hook.h @@ -8,28 +8,11 @@ #define __WINE_HOOK_H #include "windows.h" -#include "ldt.h" - -#pragma pack(1) - - /* Hook data (pointed to by a HHOOK) */ -typedef struct -{ - HANDLE16 next; /* 00 Next hook in chain */ - HOOKPROC16 proc WINE_PACKED; /* 02 Hook procedure */ - INT16 id; /* 06 Hook id (WH_xxx) */ - HQUEUE16 ownerQueue; /* 08 Owner queue (0 for system hook) */ - HMODULE16 ownerModule; /* 0a Owner module */ - WORD inHookProc; /* 0c TRUE if in this->proc */ -} HOOKDATA; - -#pragma pack(4) - -#define HOOK_MAGIC ((int)'H' | (int)'K' << 8) /* 'HK' */ extern HANDLE16 HOOK_GetHook( INT16 id , HQUEUE16 hQueue ); extern LRESULT HOOK_CallHooks( INT16 id, INT16 code, WPARAM16 wParam, LPARAM lParam ); +extern HOOKPROC16 HOOK_GetProc16( HHOOK hook ); extern void HOOK_FreeModuleHooks( HMODULE16 hModule ); extern void HOOK_FreeQueueHooks( HQUEUE16 hQueue ); diff --git a/include/libres.h b/include/libres.h index f1e9628ee4e..288f5ec302c 100644 --- a/include/libres.h +++ b/include/libres.h @@ -9,13 +9,13 @@ #include "wintypes.h" #include "resource.h" -extern INT LIBRES_AccessResource( HINSTANCE hModule, HRSRC32 hRsrc ); -extern HGLOBAL32 LIBRES_AllocResource( HINSTANCE hModule, HRSRC32 hRsrc, DWORD size ); -extern HRSRC32 LIBRES_FindResource( HINSTANCE hModule, LPCSTR name, LPCSTR type ); -extern BOOL LIBRES_FreeResource( HGLOBAL32 handle ); -extern HGLOBAL32 LIBRES_LoadResource( HINSTANCE hModule, HRSRC32 hRsrc ); -extern LPVOID LIBRES_LockResource( HGLOBAL32 handle ); -extern DWORD LIBRES_SizeofResource( HINSTANCE hModule, HRSRC32 hRsrc ); +extern INT32 LIBRES_AccessResource( HINSTANCE32 hModule, HRSRC32 hRsrc ); +extern HGLOBAL32 LIBRES_AllocResource( HINSTANCE32 hModule, HRSRC32 hRsrc, DWORD size ); +extern HRSRC32 LIBRES_FindResource( HINSTANCE32 hModule, LPCSTR name, LPCSTR type ); +extern BOOL32 LIBRES_FreeResource( HGLOBAL32 handle ); +extern HGLOBAL32 LIBRES_LoadResource( HINSTANCE32 hModule, HRSRC32 hRsrc ); +extern LPVOID LIBRES_LockResource( HGLOBAL32 handle ); +extern DWORD LIBRES_SizeofResource( HINSTANCE32 hModule, HRSRC32 hRsrc ); #endif /* WINELIB */ diff --git a/include/listbox.h b/include/listbox.h index 2dd1101a7f2..af816b6252c 100644 --- a/include/listbox.h +++ b/include/listbox.h @@ -6,7 +6,7 @@ typedef struct tagLISTSTRUCT { MEASUREITEMSTRUCT16 mis; UINT itemState; RECT16 itemRect; - HANDLE hData; + HLOCAL16 hData; char *itemText; struct tagLISTSTRUCT *lpNext; } LISTSTRUCT, *LPLISTSTRUCT; @@ -27,14 +27,14 @@ typedef struct { HWND hSelf; DWORD dwStyle; /* added for COMBOLBOX style faking */ HWND hParent; - HFONT hFont; + HFONT16 hFont; BOOL bRedrawFlag; BOOL HasStrings; BOOL OwnerDrawn; WORD iNumStops; LPINT16 TabStops; BOOL needMeasure; - HANDLE HeapSel; + HGLOBAL16 HeapSel; /* MDESC *Heap; */ } HEADLIST,*LPHEADLIST; diff --git a/include/mdi.h b/include/mdi.h index 6f268247ea7..97911de8358 100644 --- a/include/mdi.h +++ b/include/mdi.h @@ -34,7 +34,7 @@ typedef struct WORD nActiveChildren; HWND hwndChildMaximized; HWND hwndActiveChild; - HMENU hWindowMenu; + HMENU16 hWindowMenu; WORD idFirstChild; WORD nTotalCreated; LPSTR frameTitle; diff --git a/include/menu.h b/include/menu.h index dfb7ec51a08..68d5ca986c5 100644 --- a/include/menu.h +++ b/include/menu.h @@ -6,8 +6,8 @@ #define __WINE_MENU_H extern BOOL MENU_Init(void); -extern HMENU MENU_GetDefSysMenu(void); -extern void MENU_InitSysMenuPopup(HMENU hmenu, DWORD style, DWORD clsStyle); +extern HMENU16 MENU_GetDefSysMenu(void); +extern void MENU_InitSysMenuPopup(HMENU16 hmenu, DWORD style, DWORD clsStyle); extern UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth, int orgX, int orgY ); extern void MENU_TrackMouseMenuBar( HWND hwnd, POINT16 pt ); diff --git a/include/metafile.h b/include/metafile.h index 5e475c126ac..a6378ddc43e 100644 --- a/include/metafile.h +++ b/include/metafile.h @@ -13,31 +13,28 @@ #define MFVERSION 0x300 #define META_EOF 0x0000 -HMETAFILE16 MF_WriteRecord(HMETAFILE16 hmf, METARECORD *mr, WORD rlen); -int MF_AddHandle(HANDLETABLE16 *ht, WORD htlen, HANDLE hobj); -int MF_AddHandleInternal(HANDLE hobj); -BOOL MF_MetaParam0(DC *dc, short func); -BOOL MF_MetaParam1(DC *dc, short func, short param1); -BOOL MF_MetaParam2(DC *dc, short func, short param1, short param2); -BOOL MF_MetaParam4(DC *dc, short func, short param1, short param2, +BOOL32 MF_MetaParam0(DC *dc, short func); +BOOL32 MF_MetaParam1(DC *dc, short func, short param1); +BOOL32 MF_MetaParam2(DC *dc, short func, short param1, short param2); +BOOL32 MF_MetaParam4(DC *dc, short func, short param1, short param2, short param3, short param4); -BOOL MF_MetaParam6(DC *dc, short func, short param1, short param2, +BOOL32 MF_MetaParam6(DC *dc, short func, short param1, short param2, short param3, short param4, short param5, short param6); -BOOL MF_MetaParam8(DC *dc, short func, short param1, short param2, +BOOL32 MF_MetaParam8(DC *dc, short func, short param1, short param2, short param3, short param4, short param5, short param6, short param7, short param8); -BOOL MF_CreateBrushIndirect(DC *dc, HBRUSH hBrush, LOGBRUSH16 *logbrush); -BOOL MF_CreatePatternBrush(DC *dc, HBRUSH hBrush, LOGBRUSH16 *logbrush); -BOOL MF_CreatePenIndirect(DC *dc, HPEN16 hPen, LOGPEN16 *logpen); -BOOL MF_CreateFontIndirect(DC *dc, HFONT hFont, LOGFONT16 *logfont); -BOOL MF_TextOut(DC *dc, short x, short y, LPCSTR str, short count); -BOOL MF_ExtTextOut(DC *dc, short x, short y, UINT16 flags, const RECT16 *rect, +BOOL32 MF_CreateBrushIndirect(DC *dc, HBRUSH16 hBrush, LOGBRUSH16 *logbrush); +BOOL32 MF_CreatePatternBrush(DC *dc, HBRUSH16 hBrush, LOGBRUSH16 *logbrush); +BOOL32 MF_CreatePenIndirect(DC *dc, HPEN16 hPen, LOGPEN16 *logpen); +BOOL32 MF_CreateFontIndirect(DC *dc, HFONT16 hFont, LOGFONT16 *logfont); +BOOL32 MF_TextOut(DC *dc, short x, short y, LPCSTR str, short count); +BOOL32 MF_ExtTextOut(DC *dc, short x, short y, UINT16 flags, const RECT16 *rect, LPCSTR str, short count, const INT16 *lpDx); -BOOL MF_MetaPoly(DC *dc, short func, LPPOINT16 pt, short count); -BOOL MF_BitBlt(DC *dcDest, short xDest, short yDest, short width, - short height, HDC hdcSrc, short xSrc, short ySrc, DWORD rop); -BOOL MF_StretchBlt(DC *dcDest, short xDest, short yDest, short widthDest, - short heightDest, HDC hdcSrc, short xSrc, short ySrc, +BOOL32 MF_MetaPoly(DC *dc, short func, LPPOINT16 pt, short count); +BOOL32 MF_BitBlt(DC *dcDest, short xDest, short yDest, short width, + short height, HDC16 hdcSrc, short xSrc, short ySrc, DWORD rop); +BOOL32 MF_StretchBlt(DC *dcDest, short xDest, short yDest, short widthDest, + short heightDest, HDC16 hdcSrc, short xSrc, short ySrc, short widthSrc, short heightSrc, DWORD rop); #endif /* METAFILE_H */ diff --git a/include/metafiledrv.h b/include/metafiledrv.h new file mode 100644 index 00000000000..519f3a584a1 --- /dev/null +++ b/include/metafiledrv.h @@ -0,0 +1,22 @@ +/* + * Metafile driver definitions + */ + +#ifndef __WINE_METAFILEDRV_H +#define __WINE_METAFILEDRV_H + +#include "windows.h" +#include "gdi.h" + +/* FIXME: SDK docs says these should be 1 and 2 */ +#define METAFILE_MEMORY 0 +#define METAFILE_DISK 1 + +/* Metafile driver physical DC */ +typedef struct +{ + METAHEADER *mh; /* Pointer to metafile header */ + UINT32 nextHandle; /* Next handle number */ +} METAFILEDRV_PDEVICE; + +#endif /* __WINE_METAFILEDRV_H */ diff --git a/include/mmsystem.h b/include/mmsystem.h index 4d35773699c..941602416d4 100644 --- a/include/mmsystem.h +++ b/include/mmsystem.h @@ -533,7 +533,7 @@ typedef struct { FOURCC fccIOProc; /* pointer to I/O procedure */ LPMMIOPROC pIOProc; /* pointer to I/O procedure */ UINT wErrorRet; /* place for error to be returned */ - HTASK htask; /* alternate local task */ + HTASK16 htask; /* alternate local task */ /* fields maintained by MMIO functions during buffered I/O */ LONG cchBuffer; /* size of I/O buffer (or 0L) */ HPSTR pchBuffer; /* start of I/O buffer (or NULL) */ @@ -661,7 +661,7 @@ BOOL mciGetErrorString (DWORD wError, LPSTR lpstrBuffer, BOOL mciSetYieldProc (UINT uDeviceID, YIELDPROC fpYieldProc, DWORD dwYieldData); -HTASK mciGetCreatorTask(UINT uDeviceID); +HTASK16 mciGetCreatorTask(UINT uDeviceID); YIELDPROC mciGetYieldProc (UINT uDeviceID, DWORD * lpdwYieldData); #define MCIERR_INVALID_DEVICE_ID (MCIERR_BASE + 1) @@ -1515,7 +1515,7 @@ BOOL mciSetDriverData(UINT uDeviceID, DWORD dwData); UINT mciDriverYield(UINT uDeviceID); BOOL mciDriverNotify(HWND hwndCallback, UINT uDeviceID, UINT uStatus); -UINT mciLoadCommandResource(HINSTANCE hInstance, +UINT mciLoadCommandResource(HINSTANCE16 hInstance, LPCSTR lpResName, UINT uType); BOOL mciFreeCommandResource(UINT uTable); @@ -1526,7 +1526,7 @@ BOOL mciFreeCommandResource(UINT uTable); #define DCB_TYPEMASK 0x0007 #define DCB_NOSWITCH 0x0008 /* don't switch stacks for callback */ -BOOL DriverCallback(DWORD dwCallBack, UINT uFlags, HANDLE hDev, +BOOL DriverCallback(DWORD dwCallBack, UINT uFlags, HANDLE16 hDev, WORD wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2); DWORD auxMessage(WORD wDevID, WORD wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2); diff --git a/include/module.h b/include/module.h index dba95d9bb54..f3a452223ec 100644 --- a/include/module.h +++ b/include/module.h @@ -85,10 +85,10 @@ typedef struct /* Parameters for LoadModule() */ typedef struct { - HANDLE16 hEnvironment; /* Environment segment */ - SEGPTR cmdLine WINE_PACKED; /* Command-line */ - SEGPTR showCmd WINE_PACKED; /* Code for ShowWindow() */ - SEGPTR reserved WINE_PACKED; + HGLOBAL16 hEnvironment; /* Environment segment */ + SEGPTR cmdLine WINE_PACKED; /* Command-line */ + SEGPTR showCmd WINE_PACKED; /* Code for ShowWindow() */ + SEGPTR reserved WINE_PACKED; } LOADPARAMS; #pragma pack(4) diff --git a/include/nonclient.h b/include/nonclient.h index fdf9bb56a5a..b2ffa02975a 100644 --- a/include/nonclient.h +++ b/include/nonclient.h @@ -11,8 +11,8 @@ extern void NC_GetMinMaxInfo( HWND hwnd, POINT16 *maxSize, POINT16 *maxPos, POINT16 *minTrack, POINT16 *maxTrack ); -extern void NC_DoNCPaint( HWND hwnd, HRGN clip, BOOL suppress_menupaint ); -extern LONG NC_HandleNCPaint( HWND hwnd , HRGN clip); +extern void NC_DoNCPaint( HWND hwnd, HRGN32 clip, BOOL suppress_menupaint ); +extern LONG NC_HandleNCPaint( HWND hwnd , HRGN32 clip); extern LONG NC_HandleNCActivate( WND *pwnd, WPARAM wParam ); extern LONG NC_HandleNCCalcSize( WND *pWnd, RECT16 *winRect ); extern LONG NC_HandleNCHitTest( HWND hwnd, POINT16 pt ); diff --git a/include/ole.h b/include/ole.h index a85f105e831..4c42776420f 100644 --- a/include/ole.h +++ b/include/ole.h @@ -208,8 +208,8 @@ typedef struct _OLEOBJECTVTBL { OLESTATUS (*Release)(LPOLEOBJECT); OLESTATUS (*Show)(LPOLEOBJECT,BOOL); OLESTATUS (*DoVerb)(LPOLEOBJECT,UINT,BOOL,BOOL); - OLESTATUS (*GetData)(LPOLEOBJECT,OLECLIPFORMAT,HANDLE *); - OLESTATUS (*SetData)(LPOLEOBJECT,OLECLIPFORMAT,HANDLE); + OLESTATUS (*GetData)(LPOLEOBJECT,OLECLIPFORMAT,HANDLE16 *); + OLESTATUS (*SetData)(LPOLEOBJECT,OLECLIPFORMAT,HANDLE16); OLESTATUS (*SetTargetDevice)(LPOLEOBJECT,HGLOBAL16); OLESTATUS (*SetBounds)(LPOLEOBJECT,LPRECT16); OLESTATUS (*EnumFormats)(LPOLEOBJECT,OLECLIPFORMAT); @@ -250,7 +250,7 @@ typedef struct _OLEOBJECT { } OLEOBJECT; -OLESTATUS OleRegisterServer(LPCSTR,LPOLESERVER,LHSERVER *,HINSTANCE,OLE_SERVER_USE); +OLESTATUS OleRegisterServer(LPCSTR,LPOLESERVER,LHSERVER *,HINSTANCE16,OLE_SERVER_USE); OLESTATUS OleUnblockServer(LHSERVER,BOOL *); OLESTATUS OleRegisterServerDoc(LHSERVER,LPCSTR,LPOLESERVERDOC,LHSERVERDOC *); OLESTATUS OleRegisterClientDoc(LPCSTR,LPCSTR,LONG,LHCLIENTDOC *); diff --git a/include/task.h b/include/task.h index f71ce81524b..b12250f1729 100644 --- a/include/task.h +++ b/include/task.h @@ -72,7 +72,7 @@ typedef struct WORD signal_flags; /* 24 Flags for signal handler */ FARPROC16 sighandler WINE_PACKED; /* 26 Signal handler */ FARPROC16 userhandler WINE_PACKED; /* 2a USER signal handler */ - DWORD discardhandler WINE_PACKED; /* 2e Handler for GlobalDiscard() */ + FARPROC16 discardhandler WINE_PACKED; /* 2e Handler for GlobalNotify() */ DWORD int0 WINE_PACKED; /* 32 int 0 (divide by 0) handler */ DWORD int2 WINE_PACKED; /* 36 int 2 (NMI) handler */ DWORD int4 WINE_PACKED; /* 3a int 4 (INTO) handler */ diff --git a/include/wincon.h b/include/wincon.h index 1c612d0a811..c295bf7dc0c 100644 --- a/include/wincon.h +++ b/include/wincon.h @@ -1,5 +1,5 @@ -#ifndef _WINECON_H_ -#define _WINECON_H_ +#ifndef __WINE_WINCON_H +#define __WINE_WINCON_H #define CTRL_C_EVENT 0 #define CTRL_BREAK_EVENT 1 @@ -46,7 +46,7 @@ typedef struct tagCONSOLE_SCREEN_BUFFER_INFO } CONSOLE_SCREEN_BUFFER_INFO,*LPCONSOLE_SCREEN_BUFFER_INFO; -#endif +#endif /* __WINE_WINCON_H */ #if 0 #ifndef _WINCON_H_ @@ -86,26 +86,6 @@ typedef struct tagCONSOLE_SCREEN_BUFFER_INFO #if 0 -typedef struct - { - int bKeyDown; - WORD wRepeatCount; - WORD wVirtualKeyCode; - WORD wVirtualScanCode; - - char AsciiChar; -char pad; -#if 0 - union - { - WCHAR UnicodeChar; - CHAR AsciiChar; - } - uChar; -#endif - DWORD dwControlKeyState; - } __attribute__ ((packed)) KEY_EVENT_RECORD; - #define RIGHT_ALT_PRESSED 0x1 diff --git a/include/windows.h b/include/windows.h index 28b9c8a9a6c..88f1cbb57b8 100644 --- a/include/windows.h +++ b/include/windows.h @@ -3211,7 +3211,18 @@ typedef struct INT16 xExt; INT16 yExt; HMETAFILE16 hMF; -} METAFILEPICT, *LPMETAFILEPICT; +} METAFILEPICT16, *LPMETAFILEPICT16; + +typedef struct +{ + INT32 mm; + INT32 xExt; + INT32 yExt; + HMETAFILE32 hMF; +} METAFILEPICT32, *LPMETAFILEPICT32; + +DECL_WINELIB_TYPE(METAFILEPICT); +DECL_WINELIB_TYPE(LPMETAFILEPICT); /* Metafile functions */ #define META_SETBKCOLOR 0x0201 @@ -3622,35 +3633,58 @@ WORD AllocDStoCSAlias(WORD); WORD AllocSelector(WORD); WORD AllocSelectorArray(WORD); INT16 Catch(LPCATCHBUF); +WORD ChangeSelector(WORD,WORD); INT16 CloseComm(INT16); +BOOL16 DCHook(HDC16,WORD,DWORD,LPARAM); +VOID DirectedYield(HTASK16); +HGLOBAL16 DirectResAlloc(HINSTANCE16,WORD,UINT16); BOOL16 EnableHardwareInput(BOOL16); HANDLE16 FarGetOwner(HGLOBAL16); VOID FarSetOwner(HGLOBAL16,HANDLE16); VOID FillWindow(HWND16,HWND16,HDC16,HBRUSH16); INT16 FlushComm(INT16,INT16); WORD FreeSelector(WORD); +void GlobalFreeAll(HGLOBAL16); +HGLOBAL16 GlobalLRUNewest(HGLOBAL16); +HGLOBAL16 GlobalLRUOldest(HGLOBAL16); +VOID GlobalNotify(FARPROC16); HANDLE16 GetAtomHandle(ATOM); DWORD GetBitmapDimension(HBITMAP16); +HANDLE16 GetCodeHandle(FARPROC16); INT16 GetCommError(INT16,LPCOMSTAT); UINT16 GetCommEventMask(INT16,UINT16); +VOID GetCodeInfo(FARPROC16,LPVOID); HANDLE16 GetCurrentPDB(void); HTASK16 GetCurrentTask(void); +DWORD GetDCHook(HDC16,FARPROC16*); HWND16 GetDesktopHwnd(void); HMODULE16 GetExePtr(HANDLE16); WORD GetExeVersion(void); +INT16 GetInstanceData(HINSTANCE16,WORD,INT16); BOOL16 GetModuleName(HINSTANCE16,LPSTR,INT16); +FARPROC16 GetMouseEventProc(void); +UINT16 GetNumTasks(void); DWORD GetSelectorBase(WORD); DWORD GetSelectorLimit(WORD); HINSTANCE16 GetTaskDS(void); HQUEUE16 GetTaskQueue(HTASK16); DWORD GlobalDOSAlloc(DWORD); WORD GlobalDOSFree(WORD); +WORD GlobalPageLock(HGLOBAL16); +WORD GlobalPageUnlock(HGLOBAL16); +INT16 InitApp(HINSTANCE16); BOOL16 IsSharedSelector(HANDLE16); +BOOL16 IsTask(HTASK16); +HTASK16 IsTaskLocked(void); BOOL16 LocalInit(HANDLE16,WORD,WORD); +HTASK16 LockCurrentTask(BOOL16); DWORD OffsetViewportOrg(HDC16,INT16,INT16); DWORD OffsetWindowOrg(HDC16,INT16,INT16); +VOID OldYield(void); INT16 OpenComm(LPCSTR,UINT16,UINT16); VOID PaintRect(HWND16,HWND16,HDC16,HBRUSH16,const RECT16*); +VOID PostEvent(HTASK16); +WORD PrestoChangoSelector(WORD,WORD); INT16 ReadComm(INT16,LPSTR,INT16); DWORD ScaleViewportExt(HDC16,INT16,INT16,INT16,INT16); DWORD ScaleWindowExt(HDC16,INT16,INT16,INT16,INT16); @@ -3658,18 +3692,26 @@ WORD SelectorAccessRights(WORD,WORD,WORD); DWORD SetBitmapDimension(HBITMAP16,INT16,INT16); DWORD SetBrushOrg(HDC16,INT16,INT16); UINT16* SetCommEventMask(INT16,UINT16); +BOOL16 SetDCHook(HDC16,FARPROC16,DWORD); BOOL16 SetDeskPattern(void); +VOID SetPriority(HTASK16,INT16); WORD SetSelectorBase(WORD,DWORD); WORD SetSelectorLimit(WORD,DWORD); +HQUEUE16 SetTaskQueue(HTASK16,HQUEUE16); FARPROC16 SetTaskSignalProc(HTASK16,FARPROC16); DWORD SetViewportExt(HDC16,INT16,INT16); DWORD SetViewportOrg(HDC16,INT16,INT16); DWORD SetWindowExt(HDC16,INT16,INT16); DWORD SetWindowOrg(HDC16,INT16,INT16); +VOID SwitchStackBack(void); +VOID SwitchStackTo(WORD,WORD,WORD); INT16 Throw(LPCATCHBUF,INT16); INT16 UngetCommChar(INT16,CHAR); +VOID UserYield(void); +BOOL16 WaitEvent(HTASK16); INT16 WriteComm(INT16,LPSTR,INT16); VOID hmemcpy(LPVOID,LPCVOID,LONG); +VOID Yield(void); /* Declarations for functions that exist only in Win32 */ @@ -3695,9 +3737,12 @@ LPCWSTR GetCommandLine32W(); #define GetCommandLine WINELIB_NAME_AW(GetCommandLine) BOOL32 GetCommTimeouts(INT32,LPCOMMTIMEOUTS); DWORD GetFileInformationByHandle(HFILE,BY_HANDLE_FILE_INFORMATION*); +VOID GetLocalTime(LPSYSTEMTIME); DWORD GetLogicalDrives(void); HANDLE32 GetProcessHeap(void); HFILE GetStdHandle(DWORD); +BOOL32 GetSystemPowerStatus(LPSYSTEM_POWER_STATUS); +VOID GetSystemTime(LPSYSTEMTIME); VOID GlobalMemoryStatus(LPMEMORYSTATUS); LPVOID HeapAlloc(HANDLE32,DWORD,DWORD); DWORD HeapCompact(HANDLE32,DWORD); @@ -3744,6 +3789,9 @@ BOOL32 SetCommTimeouts(INT32,LPCOMMTIMEOUTS); BOOL32 SetEndOfFile(HFILE); DWORD SetFilePointer(HFILE,LONG,LPLONG,DWORD); BOOL32 SetTimeZoneInformation(const LPTIME_ZONE_INFORMATION); +BOOL32 SetSystemPowerState(BOOL32,BOOL32); +BOOL32 SetSystemTime(const SYSTEMTIME*); +VOID Sleep(DWORD); LPVOID VirtualAlloc(LPVOID,DWORD,DWORD,DWORD); BOOL32 VirtualFree(LPVOID,DWORD,DWORD); BOOL32 WriteFile(HFILE,LPVOID,DWORD,LPDWORD,LPOVERLAPPED); @@ -3805,6 +3853,7 @@ VOID SetRectRgn(HRGN32,INT32,INT32,INT32,INT32); COLORREF SetTextColor(HDC32,COLORREF); WORD SetWindowWord(HWND32,INT32,WORD); BOOL16 ShowCaret(HWND32); +VOID UpdateWindow(HWND32); LONG _hread(HFILE,LPVOID,LONG); HFILE _lclose(HFILE); HFILE _lcreat(LPCSTR,INT32); @@ -3890,6 +3939,9 @@ BOOL32 ClientToScreen32(HWND32,LPPOINT32); BOOL16 ClipCursor16(const RECT16*); BOOL32 ClipCursor32(const RECT32*); #define ClipCursor WINELIB_NAME(ClipCursor) +HMETAFILE16 CloseMetaFile16(HDC16); +HMETAFILE32 CloseMetaFile32(HDC32); +#define CloseMetaFile WINELIB_NAME(CloseMetaFile) UINT16 CompareString16(DWORD,DWORD,LPCSTR,DWORD,LPCSTR,DWORD); UINT32 CompareString32A(DWORD,DWORD,LPCSTR,DWORD,LPCSTR,DWORD); UINT32 CompareString32W(DWORD,DWORD,LPCWSTR,DWORD,LPCWSTR,DWORD); @@ -3941,6 +3993,10 @@ HFONT16 CreateFontIndirect16(const LOGFONT16*); HFONT32 CreateFontIndirect32A(const LOGFONT32A*); HFONT32 CreateFontIndirect32W(const LOGFONT32W*); #define CreateFontIndirect WINELIB_NAME_AW(CreateFontIndirect) +HDC16 CreateMetaFile16(LPCSTR); +HDC32 CreateMetaFile32A(LPCSTR); +HDC32 CreateMetaFile32W(LPCWSTR); +#define CreateMetaFile WINELIB_NAME_AW(CreateMetaFile) HRGN16 CreatePolyPolygonRgn16(const POINT16*,const INT16*,INT16,INT16); HRGN32 CreatePolyPolygonRgn32(const POINT32*,const INT32*,INT32,INT32); #define CreatePolyPolygonRgn WINELIB_NAME(CreatePolyPolygonRgn) @@ -3984,6 +4040,9 @@ BOOL16 DeleteFile16(LPCSTR); BOOL32 DeleteFile32A(LPCSTR); BOOL32 DeleteFile32W(LPCWSTR); #define DeleteFile WINELIB_NAME_AW(DeleteFile) +BOOL16 DeleteMetaFile16(HMETAFILE16); +BOOL32 DeleteMetaFile32(HMETAFILE32); +#define DeleteMetaFile WINELIB_NAME(DeleteMetaFile) INT16 DialogBox16(HINSTANCE16,SEGPTR,HWND16,DLGPROC16); #define DialogBox32A(inst,template,owner,func) \ DialogBoxParam32A(inst,template,owner,func,0) @@ -4191,6 +4250,12 @@ UINT32 GetInternalWindowPos32(HWND32,LPRECT32,LPPOINT32); UINT32 GetLogicalDriveStrings32A(UINT32,LPSTR); UINT32 GetLogicalDriveStrings32W(UINT32,LPWSTR); #define GetLogicalDriveStrings WINELIB_NAME_AW(GetLogicalDriveStrings) +HWND16 GetNextDlgGroupItem16(HWND16,HWND16,BOOL16); +HWND32 GetNextDlgGroupItem32(HWND32,HWND32,BOOL32); +#define GetNextDlgGroupItem WINELIB_NAME(GetNextDlgGroupItem) +HWND16 GetNextDlgTabItem16(HWND16,HWND16,BOOL16); +HWND32 GetNextDlgTabItem32(HWND32,HWND32,BOOL32); +#define GetNextDlgTabItem WINELIB_NAME(GetNextDlgTabItem) INT16 GetObject16(HANDLE16,INT16,LPVOID); INT32 GetObject32A(HANDLE32,INT32,LPVOID); INT32 GetObject32W(HANDLE32,INT32,LPVOID); @@ -4513,6 +4578,12 @@ BOOL32 Polygon32(HDC32,LPPOINT32,INT32); BOOL16 Polyline16(HDC16,LPPOINT16,INT16); BOOL32 Polyline32(HDC32,LPPOINT32,INT32); #define Polyline WINELIB_NAME(Polyline) +BOOL16 PostAppMessage16(HTASK16,UINT16,WPARAM16,LPARAM); +#define PostAppMessage32A(thread,msg,wparam,lparam) \ + PostThreadMessage32A((DWORD)(thread),msg,wparam,lparam) +#define PostAppMessage32W(thread,msg,wparam,lparam) \ + PostThreadMessage32W((DWORD)(thread),msg,wparam,lparam) +#define PostAppMessage WINELIB_NAME_AW(PostAppMessage) BOOL16 PtInRect16(const RECT16*,POINT16); BOOL32 PtInRect32(const RECT32*,POINT32); #define PtInRect WINELIB_NAME(PtInRect) @@ -4694,6 +4765,14 @@ BOOL32 SetWindowOrgEx32(HDC32,INT32,INT32,LPPOINT32); BOOL16 SetWindowPlacement16(HWND16,const WINDOWPLACEMENT16*); BOOL32 SetWindowPlacement32(HWND32,const WINDOWPLACEMENT32*); #define SetWindowPlacement WINELIB_NAME(SetWindowPlacement) +FARPROC16 SetWindowsHook16(INT16,HOOKPROC16); +HHOOK SetWindowsHook32A(INT32,HOOKPROC32); +HHOOK SetWindowsHook32W(INT32,HOOKPROC32); +#define SetWindowsHook WINELIB_NAME_AW(SetWindowsHook) +HHOOK SetWindowsHookEx16(INT16,HOOKPROC16,HINSTANCE16,HTASK16); +HHOOK SetWindowsHookEx32A(INT32,HOOKPROC32,HINSTANCE32,DWORD); +HHOOK SetWindowsHookEx32W(INT32,HOOKPROC32,HINSTANCE32,DWORD); +#define SetWindowsHookEx WINELIB_NAME_AW(SetWindowsHookEx) void SetWindowText16(HWND16,SEGPTR); void SetWindowText32A(HWND32,LPCSTR); void SetWindowText32W(HWND32,LPCWSTR); @@ -4714,6 +4793,12 @@ BOOL32 TrackPopupMenu32(HMENU32,UINT32,INT32,INT32,INT32,HWND32,const RECT32 INT16 TransmitCommChar16(INT16,CHAR); BOOL32 TransmitCommChar32(INT32,CHAR); #define TransmitCommChar WINELIB_NAME(TransmitCommChar) +BOOL16 UnhookWindowsHook16(INT16,HOOKPROC16); +BOOL32 UnhookWindowsHook32(INT32,HOOKPROC32); +#define UnhookWindowsHook WINELIB_NAME(UnhookWindowsHook) +BOOL16 UnhookWindowsHookEx16(HHOOK); +BOOL32 UnhookWindowsHookEx32(HHOOK); +#define UnhookWindowsHookEx WINELIB_NAME(UnhookWindowsHookEx) BOOL16 UnionRect16(LPRECT16,const RECT16*,const RECT16*); BOOL32 UnionRect32(LPRECT32,const RECT32*,const RECT32*); #define UnionRect WINELIB_NAME(UnionRect) @@ -4823,30 +4908,14 @@ typedef INT32 INT; typedef UINT32 UINT; typedef BOOL32 BOOL; typedef WPARAM32 WPARAM; -typedef HANDLE32 HANDLE; -typedef HANDLE32 HBITMAP; -typedef HANDLE32 HBRUSH; typedef HANDLE32 HDC; -typedef HANDLE32 HFONT; -typedef HANDLE32 HINSTANCE; -typedef HANDLE32 HMENU; -typedef HANDLE32 HRGN; -typedef HANDLE32 HTASK; typedef HANDLE32 HWND; # else /* WINELIB32 */ typedef INT16 INT; typedef UINT16 UINT; typedef BOOL16 BOOL; typedef WPARAM16 WPARAM; -typedef HANDLE16 HANDLE; -typedef HANDLE16 HBITMAP; -typedef HANDLE16 HBRUSH; typedef HANDLE16 HDC; -typedef HANDLE16 HFONT; -typedef HANDLE16 HINSTANCE; -typedef HANDLE16 HMENU; -typedef HANDLE16 HRGN; -typedef HANDLE16 HTASK; typedef HANDLE16 HWND; # endif /* WINELIB32 */ #endif /* __WINE__ */ @@ -4882,61 +4951,54 @@ void CalcChildScroll(HWND,WORD); BOOL CallMsgFilter(SEGPTR,INT); LRESULT CallNextHookEx(HHOOK,INT,WPARAM,LPARAM); BOOL ChangeClipboardChain(HWND,HWND); -WORD ChangeSelector(WORD,WORD); -INT CheckMenuItem(HMENU,UINT,UINT); +INT CheckMenuItem(HMENU16,UINT,UINT); BOOL Chord(HDC,INT,INT,INT,INT,INT,INT,INT,INT); BOOL CloseClipboard(void); -HMETAFILE16 CloseMetaFile(HDC); void CloseSound(void); BOOL CloseWindow(HWND); int ConvertRequest(HWND,LPKANJISTRUCT); HMETAFILE16 CopyMetaFile(HMETAFILE16,LPCSTR); INT CountClipboardFormats(void); INT CountVoiceNotes(INT); -HBRUSH CreateBrushIndirect(const LOGBRUSH16*); +HBRUSH16 CreateBrushIndirect(const LOGBRUSH16*); HDC CreateCompatibleDC(HDC); -HCURSOR16 CreateCursor(HANDLE,INT,INT,INT,INT,const BYTE*,const BYTE*); -HANDLE CreateCursorIconIndirect(HANDLE,CURSORICONINFO*,const BYTE*,const BYTE*); +HCURSOR16 CreateCursor(HINSTANCE16,INT,INT,INT,INT,const BYTE*,const BYTE*); +HGLOBAL16 CreateCursorIconIndirect(HINSTANCE16,CURSORICONINFO*,const BYTE*,const BYTE*); HDC CreateDC(LPCSTR,LPCSTR,LPCSTR,const DEVMODE*); -HBRUSH CreateDIBPatternBrush(HGLOBAL16,UINT); -HBITMAP CreateDIBitmap(HDC,BITMAPINFOHEADER*,DWORD,LPVOID,BITMAPINFO*,UINT); -HBRUSH CreateHatchBrush(INT,COLORREF); +HBRUSH16 CreateDIBPatternBrush(HGLOBAL16,UINT); +HBITMAP16 CreateDIBitmap(HDC,BITMAPINFOHEADER*,DWORD,LPVOID,BITMAPINFO*,UINT); +HBRUSH16 CreateHatchBrush(INT,COLORREF); HDC CreateIC(LPCSTR,LPCSTR,LPCSTR,const DEVMODE*); -HICON16 CreateIcon(HINSTANCE,INT,INT,BYTE,BYTE,const BYTE*,const BYTE*); -HMENU CreateMenu(void); -HDC CreateMetaFile(LPCSTR); +HICON16 CreateIcon(HINSTANCE16,INT,INT,BYTE,BYTE,const BYTE*,const BYTE*); +HMENU16 CreateMenu(void); HPALETTE16 CreatePalette(const LOGPALETTE*); -HBRUSH CreatePatternBrush(HBITMAP); +HBRUSH16 CreatePatternBrush(HBITMAP16); HPEN16 CreatePen(INT,INT,COLORREF); HPEN16 CreatePenIndirect(const LOGPEN16*); -HMENU CreatePopupMenu(void); -HBRUSH CreateSolidBrush(COLORREF); -void DebugBreak(void); +HMENU16 CreatePopupMenu(void); +HBRUSH16 CreateSolidBrush(COLORREF); DWORD DefHookProc(short,WORD,DWORD,HHOOK*); HDWP16 DeferWindowPos(HDWP16,HWND,HWND,INT,INT,INT,INT,UINT); ATOM DeleteAtom(ATOM); BOOL DeleteDC(HDC); -BOOL DeleteMenu(HMENU,UINT,UINT); -BOOL DeleteMetaFile(HMETAFILE16); +BOOL DeleteMenu(HMENU16,UINT,UINT); BOOL DeleteObject(HGDIOBJ16); BOOL DestroyCursor(HCURSOR16); BOOL DestroyIcon(HICON16); -BOOL DestroyMenu(HMENU); +BOOL DestroyMenu(HMENU16); BOOL DestroyWindow(HWND); -HANDLE DirectResAlloc(HANDLE,WORD,WORD); -void DirectedYield(HTASK); LONG DispatchMessage(const MSG16*); INT DlgDirList(HWND,SEGPTR,INT,INT,UINT); BOOL DlgDirSelect(HWND,LPSTR,INT); BOOL DlgDirSelectComboBox(HWND,LPSTR,INT); BOOL16 DragDetect(HWND16,POINT16); -DWORD DragObject(HWND, HWND, WORD, HANDLE, WORD, HCURSOR16); +DWORD DragObject(HWND, HWND, WORD, HANDLE16, WORD, HCURSOR16); BOOL DrawIcon(HDC,INT,INT,HICON16); void DrawMenuBar(HWND); DWORD DumpIcon(SEGPTR,WORD*,SEGPTR*,SEGPTR*); BOOL Ellipse(HDC,INT,INT,INT,INT); BOOL EmptyClipboard(void); -BOOL EnableMenuItem(HMENU,UINT,UINT); +BOOL EnableMenuItem(HMENU16,UINT,UINT); BOOL EnableWindow(HWND,BOOL); BOOL EndDeferWindowPos(HDWP16); UINT16 EnumClipboardFormats(UINT16); @@ -4948,15 +5010,15 @@ INT Escape(HDC,INT,INT,SEGPTR,SEGPTR); int ExcludeClipRect(HDC,short,short,short,short); int ExcludeVisRect(HDC,short,short,short,short); BOOL ExitWindows(DWORD,WORD); -HICON16 ExtractIcon(HINSTANCE,LPCSTR,WORD); +HICON16 ExtractIcon(HINSTANCE16,LPCSTR,WORD); void FatalAppExit(UINT,LPCSTR); void FatalExit(int); -BOOL FillRgn(HDC,HRGN,HBRUSH); +BOOL FillRgn(HDC,HRGN32,HBRUSH16); ATOM FindAtom(SEGPTR); -HINSTANCE FindExecutable(LPCSTR,LPCSTR,LPSTR); +HINSTANCE16 FindExecutable(LPCSTR,LPCSTR,LPSTR); BOOL FlashWindow(HWND,BOOL); -BOOL FrameRgn(HDC,HRGN,HBRUSH,int,int); -void FreeLibrary(HANDLE); +BOOL FrameRgn(HDC,HRGN32,HBRUSH16,int,int); +void FreeLibrary(HINSTANCE16); UINT GDIRealizePalette(HDC); HPALETTE16 GDISelectPalette(HDC,HPALETTE16,WORD); HWND GetActiveWindow(void); @@ -4968,21 +5030,18 @@ WORD GetBkMode(HDC); DWORD GetBrushOrg(HDC); BOOL GetCharABCWidths(HDC,UINT,UINT,LPABC16); BOOL GetCharWidth(HDC,WORD,WORD,LPINT16); -HRGN GetClipRgn(HDC); -HANDLE GetClipboardData(WORD); +HRGN32 GetClipRgn(HDC); +HANDLE16 GetClipboardData(WORD); int GetClipboardFormatName(WORD,LPSTR,short); HWND GetClipboardOwner(void); HWND GetClipboardViewer(void); -HANDLE GetCodeHandle(FARPROC16); -void GetCodeInfo(FARPROC16,LPVOID); -HBRUSH GetControlBrush(HWND,HDC,WORD); +HBRUSH16 GetControlBrush(HWND,HDC,WORD); DWORD GetCurrentPosition(HDC); DWORD GetCurrentTime(void); HCURSOR16 GetCursor(void); -DWORD GetDCHook(HDC,FARPROC16*); DWORD GetDCOrg(HDC); HDC GetDCState(HDC); -int GetDIBits(HDC,HANDLE,WORD,WORD,LPSTR,LPBITMAPINFO,WORD); +int GetDIBits(HDC,HBITMAP16,WORD,WORD,LPSTR,LPBITMAPINFO,WORD); SEGPTR GetDOSEnvironment(void); int GetDeviceCaps(HDC,WORD); DWORD GetDialogBaseUnits(void); @@ -4993,7 +5052,6 @@ int GetEnvironment(LPSTR,LPSTR,WORD); DWORD GetFreeSpace(UINT16); DWORD GetHeapSpaces(HMODULE16); BOOL GetInputState(void); -int GetInstanceData(HANDLE,WORD,int); int GetKBCodePage(void); int GetKerningPairs(HDC,int,LPKERNINGPAIR16); int GetKeyNameText(LONG,LPSTR,int); @@ -5001,30 +5059,25 @@ INT GetKeyState(INT); void GetKeyboardState(BYTE*); int GetKeyboardType(int); HWND GetLastActivePopup(HWND); -VOID GetLocalTime(LPSYSTEMTIME); /* Win32 */ WORD GetMapMode(HDC); -HMENU GetMenu(HWND); +HMENU16 GetMenu(HWND); DWORD GetMenuCheckMarkDimensions(void); -INT GetMenuItemCount(HMENU); -UINT GetMenuItemID(HMENU,int); -UINT GetMenuState(HMENU,UINT,UINT); -int GetMenuString(HMENU,UINT,LPSTR,short,UINT); +INT GetMenuItemCount(HMENU16); +UINT GetMenuItemID(HMENU16,int); +UINT GetMenuState(HMENU16,UINT,UINT); +int GetMenuString(HMENU16,UINT,LPSTR,short,UINT); BOOL GetMessage(SEGPTR,HWND,UINT,UINT); LONG GetMessageExtraInfo(void); DWORD GetMessagePos(void); LONG GetMessageTime(void); HMETAFILE16 GetMetaFile(LPSTR); -HANDLE GetMetaFileBits(HMETAFILE16); -int GetModuleFileName(HANDLE,LPSTR,short); +HGLOBAL16 GetMetaFileBits(HMETAFILE16); +INT16 GetModuleFileName(HINSTANCE16,LPSTR,INT16); HMODULE16 GetModuleHandle(LPCSTR); -int GetModuleUsage(HANDLE); -FARPROC16 GetMouseEventProc(void); +INT16 GetModuleUsage(HINSTANCE16); DWORD GetNearestColor(HDC,DWORD); WORD GetNearestPaletteIndex(HPALETTE16,DWORD); -HWND GetNextDlgGroupItem(HWND,HWND,BOOL); -HWND GetNextDlgTabItem(HWND,HWND,BOOL); HWND GetNextWindow(HWND,WORD); -WORD GetNumTasks(void); HWND GetOpenClipboardWindow(void); WORD GetPaletteEntries(HPALETTE16,WORD,WORD,LPPALETTEENTRY); DWORD GetPixel(HDC,short,short); @@ -5038,15 +5091,13 @@ DWORD GetQueueStatus(UINT); BOOL GetRasterizerCaps(LPRASTERIZER_STATUS,UINT); WORD GetROP2(HDC); WORD GetRelAbs(HDC); -HANDLE GetStockObject(int); +HGDIOBJ16 GetStockObject(INT16); WORD GetStretchBltMode(HDC); -HMENU GetSubMenu(HMENU,short); -HMENU GetSystemMenu(HWND,BOOL); +HMENU16 GetSubMenu(HMENU16,short); +HMENU16 GetSystemMenu(HWND,BOOL); int GetSystemMetrics(WORD); WORD GetSystemPaletteEntries(HDC,WORD,WORD,LPPALETTEENTRY); WORD GetSystemPaletteUse(HDC); -BOOL GetSystemPowerStatus(LPSYSTEM_POWER_STATUS); -VOID GetSystemTime(LPSYSTEMTIME); /* Win32 */ DWORD GetTabbedTextExtent(HDC,LPSTR,int,int,LPINT16); BYTE GetTempDrive(BYTE); WORD GetTextAlign(HDC); @@ -5067,43 +5118,34 @@ DWORD GetWindowOrg(HDC); int GetWindowTextLength(HWND); ATOM GlobalDeleteAtom(ATOM); void GlobalFix(HGLOBAL16); -void GlobalFreeAll(HGLOBAL16); -HGLOBAL16 GlobalLRUNewest(HGLOBAL16); -HGLOBAL16 GlobalLRUOldest(HGLOBAL16); -void GlobalNotify(FARPROC16); -WORD GlobalPageLock(HGLOBAL16); -WORD GlobalPageUnlock(HGLOBAL16); BOOL16 GlobalUnWire(HGLOBAL16); void GlobalUnfix(HGLOBAL16); SEGPTR GlobalWire(HGLOBAL16); -BOOL GrayString(HDC,HBRUSH,GRAYSTRINGPROC16,LPARAM,INT,INT,INT,INT,INT); -BOOL HiliteMenuItem(HWND,HMENU,UINT,UINT); +BOOL GrayString(HDC,HBRUSH16,GRAYSTRINGPROC16,LPARAM,INT,INT,INT,INT,INT); +BOOL HiliteMenuItem(HWND,HMENU16,UINT,UINT); BOOL InSendMessage(void); WORD InitAtomTable(WORD); -HRGN InquireVisRgn(HDC); +HRGN32 InquireVisRgn(HDC); int IntersectClipRect(HDC,short,short,short,short); int IntersectVisRect(HDC,short,short,short,short); void InvalidateRgn(HWND32,HRGN32,BOOL32); -BOOL InvertRgn(HDC,HRGN); +BOOL InvertRgn(HDC,HRGN32); BOOL IsChild(HWND,HWND); BOOL IsClipboardFormatAvailable(WORD); BOOL IsDialogMessage(HWND,LPMSG16); WORD IsDlgButtonChecked(HWND,WORD); -BOOL IsGDIObject(HANDLE); +BOOL16 IsGDIObject(HGDIOBJ16); BOOL IsIconic(HWND); -BOOL IsMenu(HMENU); -BOOL IsTask(HTASK); -HTASK IsTaskLocked(void); +BOOL IsMenu(HMENU16); BOOL IsValidMetaFile(HMETAFILE16); BOOL IsWindowEnabled(HWND); BOOL IsWindowVisible(HWND); BOOL IsZoomed(HWND); -void LimitEmsPages(DWORD); BOOL LineTo(HDC,short,short); -HANDLE LoadLibrary(LPCSTR); -HANDLE LoadModule(LPCSTR,LPVOID); +HINSTANCE16 LoadLibrary(LPCSTR); +HINSTANCE16 LoadModule(LPCSTR,LPVOID); FARPROC16 LocalNotify(FARPROC16); -HMENU LookupMenuHandle(HMENU,INT); +HMENU16 LookupMenuHandle(HMENU16,INT); WORD MapVirtualKey(WORD,WORD); void MessageBeep(WORD); int MessageBox(HWND,LPCSTR,LPCSTR,WORD); @@ -5113,21 +5155,17 @@ DWORD OemKeyScan(WORD); BOOL OemToAnsi(LPCSTR,LPSTR); void OemToAnsiBuff(LPCSTR,LPSTR,INT); int OffsetClipRgn(HDC,short,short); -void OldYield(void); BOOL OpenClipboard(HWND); BOOL OpenIcon(HWND); int OpenSound(void); void OutputDebugString(LPCSTR); -BOOL PaintRgn(HDC,HRGN); +BOOL PaintRgn(HDC,HRGN32); BOOL PatBlt(HDC,short,short,short,short,DWORD); BOOL Pie(HDC,INT,INT,INT,INT,INT,INT,INT,INT); BOOL PlayMetaFile(HDC,HMETAFILE16); void PlayMetaFileRecord(HDC,LPHANDLETABLE16,LPMETARECORD,WORD); -BOOL PostAppMessage(HANDLE,WORD,WORD,LONG); -void PostEvent(HTASK); BOOL PostMessage(HWND,WORD,WORD,LONG); void PostQuitMessage(INT); -WORD PrestoChangoSelector(WORD,WORD); void ProfClear(void); void ProfFinish(void); void ProfFlush(void); @@ -5141,7 +5179,7 @@ WORD RealizeDefaultPalette(HDC); BOOL Rectangle(HDC,INT,INT,INT,INT); WORD RegisterClipboardFormat(LPCSTR); BOOL RemoveFontResource(LPSTR); -BOOL RemoveMenu(HMENU,UINT,UINT); +BOOL RemoveMenu(HMENU16,UINT,UINT); void ReplyMessage(LRESULT); HDC ResetDC(HDC,LPVOID); BOOL ResizePalette(HPALETTE16,UINT); @@ -5149,25 +5187,24 @@ BOOL RestoreDC(HDC,short); int RestoreVisRgn(HDC); BOOL RoundRect(HDC,INT,INT,INT,INT,INT,INT); int SaveDC(HDC); -HRGN SaveVisRgn(HDC); +HRGN32 SaveVisRgn(HDC); void ScrollChildren(HWND,UINT,WPARAM,LPARAM); -BOOL ScrollDC(HDC,short,short,LPRECT16,LPRECT16,HRGN,LPRECT16); +BOOL ScrollDC(HDC,short,short,LPRECT16,LPRECT16,HRGN32,LPRECT16); void ScrollWindow(HWND,short,short,LPRECT16,LPRECT16); -int ScrollWindowEx(HWND,short,short,LPRECT16,LPRECT16,HRGN,LPRECT16,WORD); -int SelectClipRgn(HDC,HRGN); -HANDLE SelectObject(HDC,HANDLE); +int ScrollWindowEx(HWND,short,short,LPRECT16,LPRECT16,HRGN32,LPRECT16,WORD); +int SelectClipRgn(HDC,HRGN32); +HGDIOBJ16 SelectObject(HDC,HGDIOBJ16); HPALETTE16 SelectPalette(HDC,HPALETTE16,BOOL); -int SelectVisRgn(HDC,HRGN); +int SelectVisRgn(HDC,HRGN32); HWND SetActiveWindow(HWND); WORD SetBkMode(HDC,WORD); -HANDLE SetClipboardData(WORD,HANDLE); +HANDLE16 SetClipboardData(WORD,HANDLE16); HWND SetClipboardViewer(HWND); void SetConvertHook(BOOL); BOOL SetConvertParams(int,int); BOOL32 SetCurrentDirectory(LPCSTR); HCURSOR16 SetCursor(HCURSOR16); void SetCursorPos(short,short); -BOOL SetDCHook(HDC,FARPROC16,DWORD); void SetDCState(HDC,HDC); void SetDoubleClickTime(WORD); int SetEnvironment(LPCSTR,LPCSTR,WORD); @@ -5176,25 +5213,22 @@ WORD SetHookFlags(HDC,WORD); void SetKeyboardState(BYTE*); WORD SetMapMode(HDC,WORD); DWORD SetMapperFlags(HDC,DWORD); -BOOL SetMenu(HWND,HMENU); -BOOL SetMenuItemBitmaps(HMENU,UINT,UINT,HBITMAP,HBITMAP); +BOOL SetMenu(HWND,HMENU16); +BOOL SetMenuItemBitmaps(HMENU16,UINT,UINT,HBITMAP16,HBITMAP16); BOOL SetMessageQueue(int); -HMETAFILE16 SetMetaFileBits(HANDLE); +HMETAFILE16 SetMetaFileBits(HGLOBAL16); WORD SetPaletteEntries(HPALETTE16,WORD,WORD,LPPALETTEENTRY); HWND SetParent(HWND,HWND); COLORREF SetPixel(HDC,short,short,COLORREF); WORD SetPolyFillMode(HDC,WORD); WORD SetROP2(HDC,WORD); WORD SetRelAbs(HDC,WORD); -FARPROC16 SetResourceHandler(HANDLE,LPSTR,FARPROC16); +FARPROC16 SetResourceHandler(HINSTANCE16,LPSTR,FARPROC16); int SetSoundNoise(int,int); WORD SetStretchBltMode(HDC,WORD); LONG SetSwapAreaSize(WORD); void SetSysColors(int,LPINT16,COLORREF*); WORD SetSystemPaletteUse(HDC,WORD); -BOOL SetSystemPowerState(BOOL, BOOL); -BOOL SetSystemTime(const SYSTEMTIME*); -HQUEUE16 SetTaskQueue(HTASK16,HQUEUE16); WORD SetTextAlign(HDC,WORD); short SetTextCharacterExtra(HDC,short); short SetTextJustification(HDC,short,short); @@ -5206,55 +5240,42 @@ int SetVoiceSound(int,LONG,int); int SetVoiceThreshold(int,int); BOOL SetWinDebugInfo(LPWINDEBUGINFO); BOOL SetWindowPos(HWND,HWND,INT,INT,INT,INT,WORD); -FARPROC16 SetWindowsHook(short,HOOKPROC16); -HHOOK SetWindowsHookEx(INT16,HOOKPROC16,HINSTANCE,HTASK); -HINSTANCE ShellExecute(HWND,LPCSTR,LPCSTR,LPSTR,LPCSTR,INT); +HINSTANCE16 ShellExecute(HWND,LPCSTR,LPCSTR,LPSTR,LPCSTR,INT); int ShowCursor(BOOL); void ShowOwnedPopups(HWND,BOOL); BOOL ShowWindow(HWND,int); DWORD SizeofResource(HMODULE16,HRSRC16); -VOID Sleep(DWORD); /* Win32 */ int StartSound(void); int StopSound(void); BOOL StretchBlt(HDC,short,short,short,short,HDC,short,short,short,short,DWORD); int StretchDIBits(HDC,WORD,WORD,WORD,WORD,WORD,WORD,WORD,WORD,LPSTR,LPBITMAPINFO,WORD,DWORD); BOOL SwapMouseButton(BOOL); void SwapRecording(WORD); -void SwitchStackBack(void); -void SwitchStackTo(WORD,WORD,WORD); int SyncAllVoices(void); BOOL SystemParametersInfo(UINT,UINT,LPVOID,UINT); LONG TabbedTextOut(HDC,short,short,LPSTR,short,short,LPINT16,short); int ToAscii(WORD,WORD,LPSTR,LPVOID,WORD); -int TranslateAccelerator(HWND,HANDLE,LPMSG16); +INT16 TranslateAccelerator(HWND,HACCEL16,LPMSG16); BOOL TranslateMDISysAccel(HWND,LPMSG16); BOOL TranslateMessage(LPMSG16); -BOOL UnhookWindowsHook(short,HOOKPROC16); -BOOL UnhookWindowsHookEx(HHOOK); -BOOL UnrealizeObject(HBRUSH); +BOOL UnrealizeObject(HGDIOBJ16); int UpdateColors(HDC); -void UpdateWindow(HWND32); -void UserYield(void); void ValidateCodeSegments(void); LPSTR ValidateFreeSpaces(void); void ValidateRgn(HWND32,HRGN32); WORD VkKeyScan(WORD); -SEGPTR WIN16_LockResource(HANDLE); -BOOL WaitEvent(HTASK); +SEGPTR WIN16_LockResource(HGLOBAL16); void WaitMessage(void); int WaitSoundState(int); -HANDLE WinExec(LPSTR,WORD); +HINSTANCE16 WinExec(LPSTR,WORD); BOOL WinHelp(HWND,LPSTR,WORD,DWORD); void WriteOutProfiles(void); BOOL WritePrivateProfileString(LPCSTR,LPCSTR,LPCSTR,LPCSTR); BOOL WriteProfileString(LPCSTR,LPCSTR,LPCSTR); -void Yield(void); #endif /* NO_TRANSITION_TYPES */ -#ifdef WINELIB #define WINELIB_UNIMP(x) fprintf (stderr, "WineLib: Unimplemented %s\n", x) -#endif #ifdef __cplusplus } diff --git a/include/winsock.h b/include/winsock.h index 0fb32026804..95482297a3e 100644 --- a/include/winsock.h +++ b/include/winsock.h @@ -198,20 +198,20 @@ BOOL WSAIsBlocking(void); INT WSAUnhookBlockingHook(void); FARPROC16 WSASetBlockingHook(FARPROC16 lpBlockFunc); INT WSACancelBlockingCall(void); -HANDLE WSAAsyncGetServByName(HWND hWnd, u_int wMsg, - LPCSTR name, LPCSTR proto, - LPSTR buf, INT buflen); -HANDLE WSAAsyncGetServByPort(HWND hWnd, u_int wMsg, INT port, - LPCSTR proto, LPSTR buf, INT buflen); -HANDLE WSAAsyncGetProtoByName(HWND hWnd, u_int wMsg, - LPCSTR name, LPSTR buf, INT buflen); -HANDLE WSAAsyncGetProtoByNumber(HWND hWnd, u_int wMsg, - INT number, LPSTR buf, INT buflen); -HANDLE WSAAsyncGetHostByName(HWND hWnd, u_int wMsg, - LPCSTR name, LPSTR buf, INT buflen); -HANDLE WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, LPCSTR addr, INT len, - INT type, LPSTR buf, INT buflen); -INT WSACancelAsyncRequest(HANDLE hAsyncTaskHandle); +HANDLE16 WSAAsyncGetServByName(HWND hWnd, u_int wMsg, + LPCSTR name, LPCSTR proto, + LPSTR buf, INT buflen); +HANDLE16 WSAAsyncGetServByPort(HWND hWnd, u_int wMsg, INT port, + LPCSTR proto, LPSTR buf, INT buflen); +HANDLE16 WSAAsyncGetProtoByName(HWND hWnd, u_int wMsg, + LPCSTR name, LPSTR buf, INT buflen); +HANDLE16 WSAAsyncGetProtoByNumber(HWND hWnd, u_int wMsg, + INT number, LPSTR buf, INT buflen); +HANDLE16 WSAAsyncGetHostByName(HWND hWnd, u_int wMsg, + LPCSTR name, LPSTR buf, INT buflen); +HANDLE16 WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, LPCSTR addr, INT len, + INT type, LPSTR buf, INT buflen); +INT WSACancelAsyncRequest(HANDLE16 hAsyncTaskHandle); INT WSAAsyncSelect(SOCKET s, HWND hWnd, u_int wMsg, long lEvent); #ifdef __cplusplus diff --git a/include/wintypes.h b/include/wintypes.h index 503bcaaf5a5..8565ad815cb 100644 --- a/include/wintypes.h +++ b/include/wintypes.h @@ -12,7 +12,8 @@ #endif #if !defined(__WINE__) && !defined(WINELIB) -/* If we are not compiling Wine, then we are using Winelib */ +/* If we are not compiling Wine, then we should be using Winelib */ +#error You must use 'configure --with-library' to build Winelib programs #define WINELIB #endif diff --git a/ipc/Makefile.in b/ipc/Makefile.in index cd5ec969d46..3d563140155 100644 --- a/ipc/Makefile.in +++ b/ipc/Makefile.in @@ -1,6 +1,9 @@ -DEFS = -D__WINE__ -TOPSRC = @top_srcdir@ -MODULE = ipc +DEFS = -D__WINE__ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = .. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = ipc C_SRCS = \ bit_array.c \ diff --git a/library/Makefile.in b/library/Makefile.in index ed3aade5fe2..37edb7b185f 100644 --- a/library/Makefile.in +++ b/library/Makefile.in @@ -1,6 +1,9 @@ -DEFS = -D__WINE__ -TOPSRC = @top_srcdir@ -MODULE = library +DEFS = -D__WINE__ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = .. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = library C_SRCS = \ arch.c \ diff --git a/library/libres.c b/library/libres.c index 2093ee91f52..c3964ec6fd4 100644 --- a/library/libres.c +++ b/library/libres.c @@ -32,7 +32,7 @@ void LIBRES_RegisterResources(const struct resource* const * Res) /********************************************************************** * LIBRES_FindResource */ -HRSRC32 LIBRES_FindResource( HINSTANCE hModule, LPCSTR name, LPCSTR type ) +HRSRC32 LIBRES_FindResource( HINSTANCE32 hModule, LPCSTR name, LPCSTR type ) { int nameid=0,typeid; ResListE* ResBlock; @@ -81,7 +81,7 @@ HRSRC32 LIBRES_FindResource( HINSTANCE hModule, LPCSTR name, LPCSTR type ) /********************************************************************** * LIBRES_LoadResource */ -HGLOBAL32 LIBRES_LoadResource( HINSTANCE hModule, HRSRC32 hRsrc ) +HGLOBAL32 LIBRES_LoadResource( HINSTANCE32 hModule, HRSRC32 hRsrc ) { return (HGLOBAL32)(((struct resource*)hRsrc)->bytes); } @@ -108,7 +108,7 @@ BOOL LIBRES_FreeResource( HGLOBAL32 handle ) /********************************************************************** * LIBRES_AccessResource */ -INT LIBRES_AccessResource( HINSTANCE hModule, HRSRC32 hRsrc ) +INT32 LIBRES_AccessResource( HINSTANCE32 hModule, HRSRC32 hRsrc ) { WINELIB_UNIMP("LIBRES_AccessResource()"); return -1; /* Obsolete in Win32 */ @@ -118,7 +118,7 @@ INT LIBRES_AccessResource( HINSTANCE hModule, HRSRC32 hRsrc ) /********************************************************************** * LIBRES_SizeofResource */ -DWORD LIBRES_SizeofResource( HINSTANCE hModule, HRSRC32 hRsrc ) +DWORD LIBRES_SizeofResource( HINSTANCE32 hModule, HRSRC32 hRsrc ) { return (DWORD)(((struct resource*)hRsrc)->size); } @@ -127,7 +127,7 @@ DWORD LIBRES_SizeofResource( HINSTANCE hModule, HRSRC32 hRsrc ) /********************************************************************** * LIBRES_AllocResource */ -HGLOBAL32 LIBRES_AllocResource( HINSTANCE hModule, HRSRC32 hRsrc, DWORD size ) +HGLOBAL32 LIBRES_AllocResource( HINSTANCE32 hModule, HRSRC32 hRsrc, DWORD size) { WINELIB_UNIMP("LIBRES_AllocResource()"); return 0; /* Obsolete in Win32 */ diff --git a/library/winmain.c b/library/winmain.c index f04806239a1..2ee677c4f7e 100644 --- a/library/winmain.c +++ b/library/winmain.c @@ -7,14 +7,13 @@ extern int MAIN_Init(void); extern BOOL WIDGETS_Init(void); extern BOOL WIN_CreateDesktopWindow(void); -extern int WinMain(HINSTANCE,HINSTANCE,LPSTR,int); +extern int WinMain(HINSTANCE16,HINSTANCE16,LPSTR,int); extern void TASK_Reschedule(void); -extern int USER_InitApp(HINSTANCE); int _WinMain (int argc, char *argv []) { - HINSTANCE hInstance; + HINSTANCE16 hInstance; LPSTR lpszCmdParam; int i, len = 0; @@ -29,7 +28,7 @@ int _WinMain (int argc, char *argv []) if(!MAIN_Init()) return 0; /* JBP: Needed for DosDrives[] structure, etc. */ hInstance = WinExec( *argv, SW_SHOWNORMAL ); TASK_Reschedule(); - USER_InitApp( hInstance ); + InitApp( hInstance ); #ifdef WINELIBDLL return (int)hInstance; diff --git a/libtest/Makefile.in b/libtest/Makefile.in index fe7dadbe292..6f050d68d4a 100644 --- a/libtest/Makefile.in +++ b/libtest/Makefile.in @@ -1,7 +1,10 @@ -TOPSRC = @top_srcdir@ -MODULE = none -PROGRAMS = hello hello2 hello3 hello4 new rolex -ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LDLIBS) +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = .. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = none +PROGRAMS = hello hello2 hello3 hello4 new rolex +ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LDLIBS) C_SRCS = \ hello.c \ diff --git a/loader/Makefile.in b/loader/Makefile.in index ba99e39ee17..2e38a37452a 100644 --- a/loader/Makefile.in +++ b/loader/Makefile.in @@ -1,6 +1,9 @@ -DEFS = -D__WINE__ -TOPSRC = @top_srcdir@ -MODULE = loader +DEFS = -D__WINE__ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = .. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = loader C_SRCS = \ builtin.c \ diff --git a/loader/main.c b/loader/main.c index 1501255749b..ada29345b87 100644 --- a/loader/main.c +++ b/loader/main.c @@ -166,7 +166,7 @@ int MAIN_Init(void) int _WinMain(int argc, char **argv) { int i; - HANDLE handle; + HINSTANCE16 handle; if (!MAIN_Init()) return 0; diff --git a/loader/module.c b/loader/module.c index c5ec62b5c03..6dadc3f1122 100644 --- a/loader/module.c +++ b/loader/module.c @@ -27,13 +27,13 @@ #include "debug.h" #include "callback.h" -extern HINSTANCE PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params ); +extern HINSTANCE16 PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params ); static HMODULE16 hFirstModule = 0; static HMODULE16 hCachedModule = 0; /* Module cached by MODULE_OpenFile */ #ifndef WINELIB -static HANDLE hInitialStack32 = 0; +static HGLOBAL16 hInitialStack32 = 0; #endif @@ -335,7 +335,7 @@ HINSTANCE16 MODULE_CreateInstance( HMODULE16 hModule, LOADPARAMS *params ) SEGTABLEENTRY *pSegment; NE_MODULE *pModule; int minsize; - HINSTANCE hNewInstance, hPrevInstance; + HINSTANCE16 hNewInstance, hPrevInstance; if (!(pModule = MODULE_GetPtr( hModule ))) return 0; if (pModule->dgroup == 0) return hModule; @@ -997,10 +997,10 @@ static void MODULE_FreeModule( HMODULE16 hModule ) /********************************************************************** * LoadModule (KERNEL.45) */ -HINSTANCE LoadModule( LPCSTR name, LPVOID paramBlock ) +HINSTANCE16 LoadModule( LPCSTR name, LPVOID paramBlock ) { HMODULE16 hModule; - HANDLE hInstance, hPrevInstance; + HINSTANCE16 hInstance, hPrevInstance; NE_MODULE *pModule; LOADPARAMS *params = (LOADPARAMS *)paramBlock; OFSTRUCT ofs; @@ -1257,7 +1257,7 @@ BOOL16 FreeModule16( HMODULE16 hModule ) */ HMODULE16 WIN16_GetModuleHandle( SEGPTR name ) { - if (HIWORD(name) == 0) return GetExePtr( (HANDLE)name ); + if (HIWORD(name) == 0) return GetExePtr( (HINSTANCE16)name ); return MODULE_FindModule( PTR_SEG_TO_LIN(name) ); } @@ -1270,7 +1270,7 @@ HMODULE16 GetModuleHandle( LPCSTR name ) /********************************************************************** * GetModuleUsage (KERNEL.48) */ -int GetModuleUsage( HANDLE hModule ) +INT16 GetModuleUsage( HINSTANCE16 hModule ) { NE_MODULE *pModule; @@ -1285,7 +1285,7 @@ int GetModuleUsage( HANDLE hModule ) /********************************************************************** * GetModuleFileName (KERNEL.49) */ -int GetModuleFileName( HANDLE hModule, LPSTR lpFileName, short nSize ) +INT16 GetModuleFileName( HINSTANCE16 hModule, LPSTR lpFileName, INT16 nSize ) { NE_MODULE *pModule; @@ -1312,14 +1312,14 @@ BOOL16 GetModuleName( HINSTANCE16 hinst, LPSTR buf, INT16 nSize ) /*********************************************************************** * LoadLibrary (KERNEL.95) */ -HANDLE LoadLibrary( LPCSTR libname ) +HINSTANCE16 LoadLibrary( LPCSTR libname ) { - HANDLE handle; + HINSTANCE16 handle; if (__winelib) { fprintf( stderr, "LoadLibrary not supported in Winelib\n" ); - return (HANDLE)0; + return 0; } dprintf_module( stddeb, "LoadLibrary: (%08x) %s\n", (int)libname, libname); @@ -1328,7 +1328,7 @@ HANDLE LoadLibrary( LPCSTR libname ) if ((handle = MODULE_FindModule( libname )) != 0) return handle; */ handle = LoadModule( libname, (LPVOID)-1 ); - if (handle == (HANDLE)2) /* file not found */ + if (handle == (HINSTANCE16)2) /* file not found */ { char buffer[256]; lstrcpyn32A( buffer, libname, 252 ); @@ -1336,7 +1336,7 @@ HANDLE LoadLibrary( LPCSTR libname ) handle = LoadModule( buffer, (LPVOID)-1 ); } #ifndef WINELIB - if (handle >= (HANDLE)32) NE_InitializeDLLs( GetExePtr(handle) ); + if (handle >= (HINSTANCE16)32) NE_InitializeDLLs( GetExePtr(handle) ); #endif return handle; } @@ -1345,7 +1345,7 @@ HANDLE LoadLibrary( LPCSTR libname ) /*********************************************************************** * FreeLibrary (KERNEL.96) */ -void FreeLibrary( HANDLE handle ) +void FreeLibrary( HINSTANCE16 handle ) { dprintf_module( stddeb,"FreeLibrary: %04x\n", handle ); FreeModule16( handle ); @@ -1355,11 +1355,11 @@ void FreeLibrary( HANDLE handle ) /*********************************************************************** * WinExec (KERNEL.166) */ -HANDLE WinExec( LPSTR lpCmdLine, WORD nCmdShow ) +HINSTANCE16 WinExec( LPSTR lpCmdLine, WORD nCmdShow ) { LOADPARAMS params; HGLOBAL16 cmdShowHandle, cmdLineHandle; - HANDLE handle; + HINSTANCE16 handle; WORD *cmdShowPtr; char *p, *cmdline, filename[256]; static int use_load_module = 1; @@ -1394,9 +1394,9 @@ HANDLE WinExec( LPSTR lpCmdLine, WORD nCmdShow ) #ifdef WINELIB /* WINELIB: Use LoadModule() only for the program itself */ use_load_module = 0; - params.hEnvironment = (HANDLE)GetDOSEnvironment(); + params.hEnvironment = (HGLOBAL16)GetDOSEnvironment(); #else - params.hEnvironment = (HANDLE)SELECTOROF( GetDOSEnvironment() ); + params.hEnvironment = (HGLOBAL16)SELECTOROF( GetDOSEnvironment() ); #endif /* WINELIB */ params.cmdLine = (SEGPTR)WIN16_GlobalLock16( cmdLineHandle ); params.showCmd = (SEGPTR)WIN16_GlobalLock16( cmdShowHandle ); @@ -1478,12 +1478,6 @@ HANDLE WinExec( LPSTR lpCmdLine, WORD nCmdShow ) GlobalFree16( cmdShowHandle ); GlobalFree16( cmdLineHandle ); - -#if 0 - if (handle < (HANDLE)32) /* Error? */ - return handle; -#endif - return handle; } diff --git a/loader/ne_image.c b/loader/ne_image.c index 720ba8991a9..3bf7849cbe2 100644 --- a/loader/ne_image.c +++ b/loader/ne_image.c @@ -529,7 +529,7 @@ void NE_InitializeDLLs( HMODULE16 hModule ) } if (pModule->dlls_to_init) { - HANDLE to_init = pModule->dlls_to_init; + HGLOBAL16 to_init = pModule->dlls_to_init; pModule->dlls_to_init = 0; for (pDLL = (HMODULE16 *)GlobalLock16( to_init ); *pDLL; pDLL++) { @@ -549,7 +549,7 @@ void NE_InitializeDLLs( HMODULE16 hModule ) */ /* It does nothing */ -void PatchCodeHandle(HANDLE hSel) +void PatchCodeHandle(HANDLE16 hSel) { } #endif /* WINELIB */ diff --git a/loader/ne_resource.c b/loader/ne_resource.c index e235131a2d9..cd184081d4b 100644 --- a/loader/ne_resource.c +++ b/loader/ne_resource.c @@ -53,7 +53,7 @@ static DWORD NE_FindNameTableId( HMODULE16 hModule, SEGPTR typeId, SEGPTR resId dprintf_resource( stddeb, "NameTable entry: type=%04x id=%04x\n", pTypeInfo->type_id, pNameInfo->id ); handle = LoadResource16( hModule, - (HANDLE)((int)pNameInfo - (int)pModule) ); + (HRSRC16)((int)pNameInfo - (int)pModule) ); for(p = (WORD*)LockResource16(handle); p && *p; p = (WORD *)((char*)p+*p)) { dprintf_resource( stddeb," type=%04x '%s' id=%04x '%s'\n", diff --git a/loader/pe_image.c b/loader/pe_image.c index 8ab35e9f595..5168949432a 100644 --- a/loader/pe_image.c +++ b/loader/pe_image.c @@ -558,10 +558,10 @@ static struct pe_data *PE_LoadImage( int fd, HMODULE16 hModule, WORD offset ) return pe; } -HINSTANCE MODULE_CreateInstance(HMODULE16 hModule,LOADPARAMS *params); +HINSTANCE16 MODULE_CreateInstance(HMODULE16 hModule,LOADPARAMS *params); void InitTask( SIGCONTEXT *context ); -HINSTANCE PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params ) +HINSTANCE16 PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params ) { HMODULE16 hModule; HINSTANCE16 hInstance; @@ -598,7 +598,6 @@ HINSTANCE PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params ) return hInstance; } -int USER_InitApp(HINSTANCE hInstance); void PE_InitTEB(int hTEB); void PE_InitializeDLLs(HMODULE16 hModule); @@ -612,7 +611,7 @@ void PE_Win32CallToStart( SIGCONTEXT *context ) InitTask( context ); hModule = GetExePtr( GetCurrentTask() ); pModule = MODULE_GetPtr( hModule ); - USER_InitApp( hModule ); + InitApp( hModule ); fs=(int)GlobalAlloc16( GMEM_FIXED | GMEM_ZEROINIT, 0x10000 ); PE_InitTEB(fs); __asm__ __volatile__("movw %w0,%%fs"::"r" (fs)); @@ -686,7 +685,7 @@ void PE_InitializeDLLs(HMODULE16 hModule) pModule = MODULE_GetPtr( GetExePtr(hModule) ); if (pModule->dlls_to_init) { - HANDLE to_init = pModule->dlls_to_init; + HGLOBAL16 to_init = pModule->dlls_to_init; pModule->dlls_to_init = 0; for (pDLL = (HMODULE16 *)GlobalLock16( to_init ); *pDLL; pDLL++) { diff --git a/loader/pe_resource.c b/loader/pe_resource.c index 1f9fa13dce4..c5a6c69b8ff 100644 --- a/loader/pe_resource.c +++ b/loader/pe_resource.c @@ -116,7 +116,7 @@ PIMAGE_RESOURCE_DIRECTORY GetResDirEntryA(PIMAGE_RESOURCE_DIRECTORY resdirptr, * PE_FindResourceEx32W */ HANDLE32 PE_FindResourceEx32W( - HINSTANCE hModule, LPCWSTR name, LPCWSTR type, WORD lang + HINSTANCE32 hModule, LPCWSTR name, LPCWSTR type, WORD lang ) { PE_MODULE *pe; @@ -152,7 +152,7 @@ HANDLE32 PE_FindResourceEx32W( /********************************************************************** * PE_LoadResource32 */ -HANDLE32 PE_LoadResource32( HINSTANCE hModule, HANDLE32 hRsrc ) +HANDLE32 PE_LoadResource32( HINSTANCE32 hModule, HANDLE32 hRsrc ) { NE_MODULE *pModule; PE_MODULE *pe; diff --git a/loader/resource.c b/loader/resource.c index 8017685c2d5..9bf8dba3507 100644 --- a/loader/resource.c +++ b/loader/resource.c @@ -376,7 +376,7 @@ HGLOBAL16 AllocResource16( HMODULE16 hModule, HRSRC16 hRsrc, DWORD size ) * * Check Schulman, p. 232 for details */ -HANDLE DirectResAlloc(HANDLE hInstance, WORD wType, WORD wSize) +HGLOBAL16 DirectResAlloc( HINSTANCE16 hInstance, WORD wType, UINT16 wSize ) { dprintf_resource(stddeb,"DirectResAlloc(%04x,%04x,%04x)\n", hInstance, wType, wSize ); @@ -507,7 +507,7 @@ HACCEL32 LoadAccelerators32A(HINSTANCE32 instance,LPCSTR lpTableName) /********************************************************************** * TranslateAccelerator [USER.178] */ -int TranslateAccelerator(HWND hWnd, HANDLE hAccel, LPMSG16 msg) +INT16 TranslateAccelerator(HWND hWnd, HACCEL16 hAccel, LPMSG16 msg) { ACCELHEADER *lpAccelTbl; int i; diff --git a/loader/task.c b/loader/task.c index 098304185b2..87b1e3753c9 100644 --- a/loader/task.c +++ b/loader/task.c @@ -54,8 +54,8 @@ static HTASK16 hFirstTask = 0; static HTASK16 hCurrentTask = 0; static HTASK16 hTaskToKill = 0; static HTASK16 hLockedTask = 0; -static WORD nTaskCount = 0; -static HANDLE hDOSEnvironment = 0; +static UINT16 nTaskCount = 0; +static HGLOBAL16 hDOSEnvironment = 0; /* TASK_Reschedule() 16-bit entry point */ static FARPROC16 TASK_RescheduleProc; @@ -66,7 +66,7 @@ static FARPROC16 TASK_RescheduleProc; #define TASK_SCHEDULE() CallTo16_word_(TASK_RescheduleProc) #endif -static HANDLE TASK_CreateDOSEnvironment(void); +static HGLOBAL16 TASK_CreateDOSEnvironment(void); /*********************************************************************** * TASK_Init @@ -83,7 +83,7 @@ BOOL32 TASK_Init(void) /*********************************************************************** * TASK_GetNextTask */ -HTASK TASK_GetNextTask( HTASK hTask ) +HTASK16 TASK_GetNextTask( HTASK16 hTask ) { TDB* pTask = (TDB*)GlobalLock16(hTask); @@ -97,12 +97,12 @@ HTASK TASK_GetNextTask( HTASK hTask ) * * Create the original DOS environment. */ -static HANDLE TASK_CreateDOSEnvironment(void) +static HGLOBAL16 TASK_CreateDOSEnvironment(void) { static const char program_name[] = "KRNL386.EXE"; char **e, *p; int initial_size, size, i, winpathlen, sysdirlen; - HANDLE handle; + HGLOBAL16 handle; extern char **environ; @@ -279,7 +279,7 @@ static void TASK_CreateThunks( HGLOBAL16 handle, WORD offset, WORD count ) * Allocate a thunk for MakeProcInstance(). */ #ifndef WINELIB32 -static SEGPTR TASK_AllocThunk( HTASK hTask ) +static SEGPTR TASK_AllocThunk( HTASK16 hTask ) { TDB *pTask; THUNKS *pThunk; @@ -316,7 +316,7 @@ static SEGPTR TASK_AllocThunk( HTASK hTask ) * Free a MakeProcInstance() thunk. */ #ifndef WINELIB32 -static BOOL TASK_FreeThunk( HTASK hTask, SEGPTR thunk ) +static BOOL TASK_FreeThunk( HTASK16 hTask, SEGPTR thunk ) { TDB *pTask; THUNKS *pThunk; @@ -396,9 +396,9 @@ HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance, HINSTANCE16 hPrevInstance, HANDLE16 hEnvironment, LPCSTR cmdLine, UINT16 cmdShow ) { - HTASK hTask; + HTASK16 hTask; TDB *pTask; - HANDLE hParentEnv; + HGLOBAL16 hParentEnv; NE_MODULE *pModule; SEGTABLEENTRY *pSegTable; LPSTR name; @@ -598,10 +598,10 @@ HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance, /*********************************************************************** * TASK_DeleteTask */ -static void TASK_DeleteTask( HTASK hTask ) +static void TASK_DeleteTask( HTASK16 hTask ) { TDB *pTask; - HANDLE hPDB; + HGLOBAL16 hPDB; if (!(pTask = (TDB *)GlobalLock16( hTask ))) return; hPDB = pTask->hPDB; @@ -711,7 +711,7 @@ void TASK_YieldToSystem(TDB* pTask) void TASK_Reschedule(void) { TDB *pOldTask = NULL, *pNewTask; - HTASK hTask = 0; + HTASK16 hTask = 0; #ifdef CONFIG_IPC dde_reschedule(); @@ -862,7 +862,7 @@ void InitTask( SIGCONTEXT *context ) /*********************************************************************** * WaitEvent (KERNEL.30) */ -BOOL WaitEvent( HTASK hTask ) +BOOL16 WaitEvent( HTASK16 hTask ) { TDB *pTask; @@ -885,7 +885,7 @@ BOOL WaitEvent( HTASK hTask ) /*********************************************************************** * PostEvent (KERNEL.31) */ -void PostEvent( HTASK hTask ) +void PostEvent( HTASK16 hTask ) { TDB *pTask; @@ -898,10 +898,10 @@ void PostEvent( HTASK hTask ) /*********************************************************************** * SetPriority (KERNEL.32) */ -void SetPriority( HTASK hTask, int delta ) +void SetPriority( HTASK16 hTask, INT16 delta ) { TDB *pTask; - int newpriority; + INT16 newpriority; if (!hTask) hTask = hCurrentTask; if (!(pTask = (TDB *)GlobalLock16( hTask ))) return; @@ -919,7 +919,7 @@ void SetPriority( HTASK hTask, int delta ) /*********************************************************************** * LockCurrentTask (KERNEL.33) */ -HTASK LockCurrentTask( BOOL bLock ) +HTASK16 LockCurrentTask( BOOL16 bLock ) { if (bLock) hLockedTask = hCurrentTask; else hLockedTask = 0; @@ -930,7 +930,7 @@ HTASK LockCurrentTask( BOOL bLock ) /*********************************************************************** * IsTaskLocked (KERNEL.122) */ -HTASK IsTaskLocked(void) +HTASK16 IsTaskLocked(void) { return hLockedTask; } @@ -953,7 +953,7 @@ void OldYield(void) /*********************************************************************** * DirectedYield (KERNEL.150) */ -void DirectedYield( HTASK hTask ) +void DirectedYield( HTASK16 hTask ) { TDB *pCurTask = (TDB *)GlobalLock16( hCurrentTask ); pCurTask->hYieldTo = hTask; @@ -1035,10 +1035,10 @@ void FreeProcInstance16( FARPROC16 func ) /********************************************************************** * GetCodeHandle (KERNEL.93) */ -HANDLE GetCodeHandle( FARPROC16 proc ) +HANDLE16 GetCodeHandle( FARPROC16 proc ) { #ifndef WINELIB32 - HANDLE handle; + HANDLE16 handle; BYTE *thunk = (BYTE *)PTR_SEG_TO_LIN( proc ); /* Return the code segment containing 'proc'. */ @@ -1052,7 +1052,7 @@ HANDLE GetCodeHandle( FARPROC16 proc ) return handle; #else - return (HANDLE)proc; + return (HANDLE16)proc; #endif } @@ -1224,7 +1224,7 @@ HANDLE16 GetCurrentPDB(void) /*********************************************************************** * GetInstanceData (KERNEL.54) */ -int GetInstanceData( HANDLE instance, WORD buffer, int len ) +INT16 GetInstanceData( HINSTANCE16 instance, WORD buffer, INT16 len ) { char *ptr = (char *)GlobalLock16( instance ); if (!ptr || !len) return 0; @@ -1276,7 +1276,7 @@ SEGPTR GetDOSEnvironment(void) /*********************************************************************** * GetNumTasks (KERNEL.152) */ -WORD GetNumTasks(void) +UINT16 GetNumTasks(void) { return nTaskCount; } @@ -1300,7 +1300,7 @@ HINSTANCE16 GetTaskDS(void) /*********************************************************************** * IsTask (KERNEL.320) */ -BOOL IsTask( HTASK hTask ) +BOOL16 IsTask( HTASK16 hTask ) { TDB *pTask; @@ -1351,6 +1351,18 @@ WORD SetSigHandler( FARPROC16 newhandler, FARPROC16* oldhandler, } +/*********************************************************************** + * GlobalNotify (KERNEL.154) + */ +VOID GlobalNotify( FARPROC16 proc ) +{ + TDB *pTask; + + if (!(pTask = (TDB *)GlobalLock16( hCurrentTask ))) return; + pTask->discardhandler = proc; +} + + /*********************************************************************** * GetExePtr (KERNEL.133) */ diff --git a/memory/Makefile.in b/memory/Makefile.in index f1a63485a66..d473cd0b247 100644 --- a/memory/Makefile.in +++ b/memory/Makefile.in @@ -1,6 +1,9 @@ -DEFS = -D__WINE__ -DNO_TRANSITION_TYPES -TOPSRC = @top_srcdir@ -MODULE = memory +DEFS = -D__WINE__ -DNO_TRANSITION_TYPES +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = .. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = memory C_SRCS = \ atom.c \ diff --git a/memory/ldt.c b/memory/ldt.c index d3659360bad..0d9200cb756 100644 --- a/memory/ldt.c +++ b/memory/ldt.c @@ -15,8 +15,18 @@ #ifdef linux #include -#include -#include + +struct modify_ldt_s +{ + unsigned int entry_number; + unsigned long base_addr; + unsigned int limit; + unsigned int seg_32bit : 1; + unsigned int contents : 2; + unsigned int read_exec_only : 1; + unsigned int limit_in_pages : 1; + unsigned int seg_not_present : 1; +}; static __inline__ _syscall3(int, modify_ldt, int, func, void *, ptr, unsigned long, bytecount); @@ -122,17 +132,16 @@ int LDT_SetEntry( int entry, const ldt_entry *content ) #ifdef linux if (!__winelib) { - struct modify_ldt_ldt_s ldt_info; + struct modify_ldt_s ldt_info; - /* Clear all unused bits (like seg_not_present) */ - memset( &ldt_info, 0, sizeof(ldt_info) ); - ldt_info.entry_number = entry; - ldt_info.base_addr = content->base; - ldt_info.limit = content->limit; - ldt_info.seg_32bit = content->seg_32bit != 0; - ldt_info.contents = content->type; - ldt_info.read_exec_only = content->read_only != 0; - ldt_info.limit_in_pages = content->limit_in_pages != 0; + ldt_info.entry_number = entry; + ldt_info.base_addr = content->base; + ldt_info.limit = content->limit; + ldt_info.seg_32bit = content->seg_32bit != 0; + ldt_info.contents = content->type; + ldt_info.read_exec_only = content->read_only != 0; + ldt_info.limit_in_pages = content->limit_in_pages != 0; + ldt_info.seg_not_present = 0; /* Make sure the info will be accepted by the kernel */ /* This is ugly, but what can I do? */ if (content->type == SEGMENT_STACK) diff --git a/misc/Makefile.in b/misc/Makefile.in index a7d7746db5c..32b5cc2ed66 100644 --- a/misc/Makefile.in +++ b/misc/Makefile.in @@ -1,6 +1,9 @@ -DEFS = -D__WINE__ -TOPSRC = @top_srcdir@ -MODULE = misc +DEFS = -D__WINE__ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = .. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = misc C_SRCS = \ clipboard.c \ diff --git a/misc/clipboard.c b/misc/clipboard.c index 03d80ca70b3..5bd3544750a 100644 --- a/misc/clipboard.c +++ b/misc/clipboard.c @@ -299,7 +299,7 @@ HWND GetClipboardOwner() /************************************************************************** * SetClipboardData [USER.141] */ -HANDLE SetClipboardData(WORD wFormat, HANDLE hData) +HANDLE16 SetClipboardData(WORD wFormat, HANDLE16 hData) { LPCLIPFORMAT lpFormat = ClipFormats; Window owner; @@ -403,7 +403,7 @@ BOOL32 CLIPBOARD_RenderText(LPCLIPFORMAT lpTarget, LPCLIPFORMAT lpSource) /************************************************************************** * GetClipboardData [USER.142] */ -HANDLE GetClipboardData(WORD wFormat) +HANDLE16 GetClipboardData(WORD wFormat) { LPCLIPFORMAT lpRender = ClipFormats; LPCLIPFORMAT lpUpdate = NULL; diff --git a/misc/commdlg.c b/misc/commdlg.c index cb243351989..aacfc818b96 100644 --- a/misc/commdlg.c +++ b/misc/commdlg.c @@ -22,12 +22,12 @@ static DWORD CommDlgLastError = 0; -static HBITMAP hFolder = 0; -static HBITMAP hFolder2 = 0; -static HBITMAP hFloppy = 0; -static HBITMAP hHDisk = 0; -static HBITMAP hCDRom = 0; -static HBITMAP hBitmapTT = 0; +static HBITMAP16 hFolder = 0; +static HBITMAP16 hFolder2 = 0; +static HBITMAP16 hFloppy = 0; +static HBITMAP16 hHDisk = 0; +static HBITMAP16 hCDRom = 0; +static HBITMAP16 hBitmapTT = 0; /*********************************************************************** * FileDlg_Init [internal] @@ -58,8 +58,8 @@ static BOOL FileDlg_Init() */ BOOL GetOpenFileName( SEGPTR ofn ) { - HINSTANCE hInst; - HANDLE hDlgTmpl, hResInfo; + HINSTANCE16 hInst; + HANDLE16 hDlgTmpl, hResInfo; BOOL bRet; LPOPENFILENAME lpofn = (LPOPENFILENAME)PTR_SEG_TO_LIN(ofn); @@ -105,8 +105,8 @@ BOOL GetOpenFileName( SEGPTR ofn ) */ BOOL GetSaveFileName( SEGPTR ofn) { - HINSTANCE hInst; - HANDLE hDlgTmpl, hResInfo; + HINSTANCE16 hInst; + HANDLE16 hDlgTmpl, hResInfo; BOOL bRet; LPOPENFILENAME lpofn = (LPOPENFILENAME)PTR_SEG_TO_LIN(ofn); @@ -218,8 +218,8 @@ static LONG FILEDLG_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam,int saved { LPDRAWITEMSTRUCT16 lpdis = (LPDRAWITEMSTRUCT16)PTR_SEG_TO_LIN(lParam); char *str; - HBRUSH hBrush; - HBITMAP hBitmap, hPrevBitmap; + HBRUSH16 hBrush; + HBITMAP16 hBitmap, hPrevBitmap; BITMAP16 bm; HDC hMemDC; @@ -706,7 +706,7 @@ LRESULT FileSaveDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam) */ BOOL FindText( SEGPTR find ) { - HANDLE hInst, hDlgTmpl; + HANDLE16 hInst, hDlgTmpl; BOOL bRet; LPCVOID ptr; LPFINDREPLACE lpFind = (LPFINDREPLACE)PTR_SEG_TO_LIN(find); @@ -736,7 +736,7 @@ BOOL FindText( SEGPTR find ) */ BOOL ReplaceText( SEGPTR find ) { - HANDLE hInst, hDlgTmpl; + HANDLE16 hInst, hDlgTmpl; BOOL bRet; LPCVOID ptr; LPFINDREPLACE lpFind = (LPFINDREPLACE)PTR_SEG_TO_LIN(find); @@ -989,7 +989,7 @@ LRESULT ReplaceTextDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam) */ BOOL PrintDlg( SEGPTR printdlg ) { - HANDLE hInst, hDlgTmpl; + HANDLE16 hInst, hDlgTmpl; BOOL bRet; LPPRINTDLG lpPrint = (LPPRINTDLG)PTR_SEG_TO_LIN(printdlg); @@ -1118,8 +1118,8 @@ short GetFileTitle(LPCSTR lpFile, LPSTR lpTitle, UINT cbBuf) */ BOOL ChooseColor(LPCHOOSECOLOR lpChCol) { - HINSTANCE hInst; - HANDLE hDlgTmpl, hResInfo; + HINSTANCE16 hInst; + HANDLE16 hDlgTmpl, hResInfo; BOOL bRet; dprintf_commdlg(stddeb,"ChooseColor\n"); @@ -1177,7 +1177,7 @@ struct CCPRIVATE LPCHOOSECOLOR lpcc; /* points to public known data structure */ int nextuserdef; /* next free place in user defined color array */ HDC hdcMem; /* color graph used for BitBlt() */ - HBITMAP hbmMem; /* color graph bitmap */ + HBITMAP16 hbmMem; /* color graph bitmap */ RECT16 fullsize; /* original dialog window size */ UINT msetrgb; /* # of SETRGBSTRING message (today not used) */ RECT16 old3angle; /* last position of l-marker */ @@ -1476,7 +1476,7 @@ static void CC_PaintSelectedColor(HWND hDlg,COLORREF cr) { RECT16 rect; HDC32 hdc; - HBRUSH hBrush; + HBRUSH16 hBrush; HWND hwnd=GetDlgItem(hDlg,0x2c5); if (IsWindowVisible(GetDlgItem(hDlg,0x2c6))) /* if full size */ { @@ -1599,7 +1599,7 @@ static void CC_PrepareColorGraph(HWND hDlg) int sdif,hdif,xdif,ydif,r,g,b,hue,sat; HWND hwnd=GetDlgItem(hDlg,0x2c6); struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong32A(hDlg, DWL_USER); - HBRUSH hbrush; + HBRUSH16 hbrush; HDC32 hdc ; RECT16 rect,client; HCURSOR16 hcursor=SetCursor(LoadCursor16(0,IDC_WAIT)); @@ -1666,7 +1666,7 @@ static void CC_PaintLumBar(HWND hDlg,int hue,int sat) HWND hwnd=GetDlgItem(hDlg,0x2be); RECT16 rect,client; int lum,ldif,ydif,r,g,b; - HBRUSH hbrush; + HBRUSH16 hbrush; HDC32 hDC; if (IsWindowVisible(hwnd)) @@ -1776,7 +1776,7 @@ static void CC_PaintPredefColorArray(HWND hDlg,int rows,int cols) HWND hwnd=GetDlgItem(hDlg,0x2d0); RECT16 rect; HDC32 hdc; - HBRUSH hBrush; + HBRUSH16 hBrush; int dx,dy,i,j,k; GetClientRect16(hwnd,&rect); @@ -1815,7 +1815,7 @@ static void CC_PaintUserColorArray(HWND hDlg,int rows,int cols,COLORREF* lpcr) HWND hwnd=GetDlgItem(hDlg,0x2d1); RECT16 rect; HDC32 hdc; - HBRUSH hBrush; + HBRUSH16 hBrush; int dx,dy,i,j,k; GetClientRect16(hwnd,&rect); @@ -2199,8 +2199,8 @@ LRESULT ColorDlgProc(HWND hDlg, UINT message, */ BOOL ChooseFont(LPCHOOSEFONT lpChFont) { - HINSTANCE hInst; - HANDLE hDlgTmpl, hResInfo; + HINSTANCE16 hInst; + HANDLE16 hDlgTmpl, hResInfo; BOOL bRet; dprintf_commdlg(stddeb,"ChooseFont\n"); @@ -2313,7 +2313,7 @@ static int SetFontStylesToCombo2(HWND hwnd, HDC hdc, LPLOGFONT16 lplf, static struct FONTSTYLE fontstyles[FSTYLES]={ { 0,FW_NORMAL,"Regular"},{0,FW_BOLD,"Bold"}, { 1,FW_NORMAL,"Italic"}, {1,FW_BOLD,"Bold Italic"}}; - HFONT hf; + HFONT16 hf; int i,j; for (i=0;ilength << sizeShift); + HGLOBAL16 handle = DirectResAlloc( hInst, 0x10, (DWORD)pNInfo->length << sizeShift); if( (ptr = (BYTE*)GlobalLock16( handle )) ) { @@ -459,16 +459,16 @@ static HANDLE SHELL_LoadResource(HINSTANCE hInst, HFILE hFile, NE_NAMEINFO* pNIn _lread32( hFile, (char*)ptr, pNInfo->length << sizeShift); return handle; } - return (HANDLE)0; + return 0; } /************************************************************************* * ICO_LoadIcon */ -static HANDLE ICO_LoadIcon(HINSTANCE hInst, HFILE hFile, LPicoICONDIRENTRY lpiIDE) +static HGLOBAL16 ICO_LoadIcon(HINSTANCE16 hInst, HFILE hFile, LPicoICONDIRENTRY lpiIDE) { BYTE* ptr; - HANDLE handle = DirectResAlloc( hInst, 0x10, lpiIDE->dwBytesInRes); + HGLOBAL16 handle = DirectResAlloc( hInst, 0x10, lpiIDE->dwBytesInRes); if( (ptr = (BYTE*)GlobalLock16( handle )) ) { @@ -476,7 +476,7 @@ static HANDLE ICO_LoadIcon(HINSTANCE hInst, HFILE hFile, LPicoICONDIRENTRY lpi _lread32( hFile, (char*)ptr, lpiIDE->dwBytesInRes); return handle; } - return (HANDLE)0; + return 0; } /************************************************************************* @@ -484,7 +484,7 @@ static HANDLE ICO_LoadIcon(HINSTANCE hInst, HFILE hFile, LPicoICONDIRENTRY lpi * * Read .ico file and build phony ICONDIR struct for GetIconID */ -static HANDLE ICO_GetIconDirectory(HINSTANCE hInst, HFILE hFile, LPicoICONDIR* lplpiID ) +static HGLOBAL16 ICO_GetIconDirectory(HINSTANCE16 hInst, HFILE hFile, LPicoICONDIR* lplpiID ) { WORD id[3]; /* idReserved, idType, idCount */ LPicoICONDIR lpiID; @@ -506,8 +506,8 @@ static HANDLE ICO_GetIconDirectory(HINSTANCE hInst, HFILE hFile, LPicoICONDIR* l if( _lread32(hFile,(char*)lpiID->idEntries,i) == i ) { - HANDLE handle = DirectResAlloc( hInst, 0x10, - id[2]*sizeof(ICONDIRENTRY) + sizeof(id) ); + HGLOBAL16 handle = DirectResAlloc( hInst, 0x10, + id[2]*sizeof(ICONDIRENTRY) + sizeof(id) ); if( handle ) { CURSORICONDIR* lpID = (CURSORICONDIR*)GlobalLock16( handle ); @@ -535,10 +535,10 @@ static HANDLE ICO_GetIconDirectory(HINSTANCE hInst, HFILE hFile, LPicoICONDIR* l * * This abortion is called directly by Progman */ -HICON16 InternalExtractIcon(HINSTANCE hInstance, LPCSTR lpszExeFileName, UINT nIconIndex, WORD n ) +HGLOBAL16 InternalExtractIcon(HINSTANCE16 hInstance, LPCSTR lpszExeFileName, UINT nIconIndex, WORD n ) { - HANDLE hRet = 0; - HICON16* RetPtr = NULL; + HGLOBAL16 hRet = 0; + HGLOBAL16* RetPtr = NULL; BYTE* pData; OFSTRUCT ofs; HFILE hFile = OpenFile( lpszExeFileName, &ofs, OF_READ ); @@ -639,9 +639,9 @@ HICON16 InternalExtractIcon(HINSTANCE hInstance, LPCSTR lpszExeFileName, UINT nI /************************************************************************* * ExtractIcon [SHELL.34] */ -HICON16 ExtractIcon(HINSTANCE hInstance, LPCSTR lpszExeFileName, WORD nIconIndex) +HICON16 ExtractIcon(HINSTANCE16 hInstance, LPCSTR lpszExeFileName, WORD nIconIndex) { - HANDLE handle = InternalExtractIcon(hInstance,lpszExeFileName,nIconIndex, 1); + HGLOBAL16 handle = InternalExtractIcon(hInstance,lpszExeFileName,nIconIndex, 1); if( handle ) { @@ -828,7 +828,7 @@ DWORD SHGetFileInfo32A(LPCSTR path,DWORD dwFileAttributes,SHFILEINFO32A *psfi, UINT32 sizeofpsfi,UINT32 flags ) { - fprintf(stdnimp,"SHGetFileInfo32A(%s,0x%08lx,%p,%ld,0x%08lx)\n", + fprintf(stdnimp,"SHGetFileInfo32A(%s,0x%08lx,%p,%d,0x%08x)\n", path,dwFileAttributes,psfi,sizeofpsfi,flags ); return TRUE; diff --git a/misc/toolhelp.c b/misc/toolhelp.c index ff4c04b3788..f5f73db589b 100644 --- a/misc/toolhelp.c +++ b/misc/toolhelp.c @@ -22,7 +22,7 @@ */ static struct notify { - HTASK htask; + HTASK16 htask; FARPROC16 lpfnCallback; WORD wFlags; } *notifys = NULL; @@ -51,8 +51,7 @@ BOOL16 NotifyRegister( HTASK16 htask, FARPROC16 lpfnCallback, WORD wFlags ) return TRUE; } -BOOL -NotifyUnregister(HTASK htask) +BOOL16 NotifyUnregister( HTASK16 htask ) { int i; diff --git a/misc/user.c b/misc/user.c index 5763a46faee..3516a78a661 100644 --- a/misc/user.c +++ b/misc/user.c @@ -21,8 +21,8 @@ WORD USER_HeapSel = 0; -extern HTASK TASK_GetNextTask(HTASK); -extern BOOL32 MENU_SwitchTPWndTo(HTASK); +extern HTASK16 TASK_GetNextTask(HTASK16); +extern BOOL32 MENU_SwitchTPWndTo(HTASK16); /*********************************************************************** * GetFreeSystemResources (USER.284) @@ -94,9 +94,9 @@ BOOL16 TimerCount( TIMERINFO *pTimerInfo ) /********************************************************************** - * USER_InitApp + * InitApp (USER.5) */ -int USER_InitApp(HINSTANCE hInstance) +INT16 InitApp( HINSTANCE16 hInstance ) { int queueSize; diff --git a/misc/winsocket.c b/misc/winsocket.c index 5cdae3d054c..5b496ce1c07 100644 --- a/misc/winsocket.c +++ b/misc/winsocket.c @@ -44,7 +44,7 @@ extern int h_errno; struct ipc_packet { long mtype; - HANDLE handle; + HANDLE16 handle; HWND hWnd; WORD wMsg; LONG lParam; @@ -114,7 +114,7 @@ struct WinSockHeap { char scratch[8192]; }; static struct WinSockHeap *Heap; -static HANDLE HeapHandle; +static HGLOBAL16 HeapHandle; #ifndef WINELIB32 static int ScratchPtr; #endif @@ -1156,9 +1156,9 @@ SEGPTR WINSOCK_getservbyport(INT port, const char *proto) /******************** winsock specific functions ************************ * */ -static HANDLE new_handle = 1; +static HANDLE16 new_handle = 1; -static HANDLE AllocWSAHandle(void) +static HANDLE16 AllocWSAHandle(void) { return new_handle++; } @@ -1198,7 +1198,7 @@ static void recv_message(int sig) } -static void send_message( HWND hWnd, u_int wMsg, HANDLE handle, long lParam) +static void send_message( HWND hWnd, u_int wMsg, HANDLE16 handle, long lParam) { struct ipc_packet message; @@ -1216,10 +1216,10 @@ static void send_message( HWND hWnd, u_int wMsg, HANDLE handle, long lParam) } -HANDLE WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, LPCSTR addr, +HANDLE16 WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, LPCSTR addr, INT len, INT type, LPSTR buf, INT buflen) { - HANDLE handle; + HANDLE16 handle; struct hostent *host; int newpid; @@ -1251,10 +1251,10 @@ HANDLE WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, LPCSTR addr, } -HANDLE WSAAsyncGetHostByName(HWND hWnd, u_int wMsg, LPCSTR name, +HANDLE16 WSAAsyncGetHostByName(HWND hWnd, u_int wMsg, LPCSTR name, LPSTR buf, INT buflen) { - HANDLE handle; + HANDLE16 handle; struct hostent *host; int newpid; @@ -1286,10 +1286,10 @@ HANDLE WSAAsyncGetHostByName(HWND hWnd, u_int wMsg, LPCSTR name, } -HANDLE WSAAsyncGetProtoByName(HWND hWnd, u_int wMsg, LPCSTR name, +HANDLE16 WSAAsyncGetProtoByName(HWND hWnd, u_int wMsg, LPCSTR name, LPSTR buf, INT buflen) { - HANDLE handle; + HANDLE16 handle; struct protoent *proto; int newpid; @@ -1321,10 +1321,10 @@ HANDLE WSAAsyncGetProtoByName(HWND hWnd, u_int wMsg, LPCSTR name, } -HANDLE WSAAsyncGetProtoByNumber(HWND hWnd, u_int wMsg, INT number, +HANDLE16 WSAAsyncGetProtoByNumber(HWND hWnd, u_int wMsg, INT number, LPSTR buf, INT buflen) { - HANDLE handle; + HANDLE16 handle; struct protoent *proto; int newpid; @@ -1356,10 +1356,10 @@ HANDLE WSAAsyncGetProtoByNumber(HWND hWnd, u_int wMsg, INT number, } -HANDLE WSAAsyncGetServByName(HWND hWnd, u_int wMsg, LPCSTR name, +HANDLE16 WSAAsyncGetServByName(HWND hWnd, u_int wMsg, LPCSTR name, LPCSTR proto, LPSTR buf, INT buflen) { - HANDLE handle; + HANDLE16 handle; struct servent *service; int newpid; @@ -1391,10 +1391,10 @@ HANDLE WSAAsyncGetServByName(HWND hWnd, u_int wMsg, LPCSTR name, } -HANDLE WSAAsyncGetServByPort(HWND hWnd, u_int wMsg, INT port, LPCSTR proto, +HANDLE16 WSAAsyncGetServByPort(HWND hWnd, u_int wMsg, INT port, LPCSTR proto, LPSTR buf, INT buflen) { - HANDLE handle; + HANDLE16 handle; struct servent *service; int newpid; @@ -1493,7 +1493,7 @@ INT WSAFDIsSet(SOCKET fd, WinSock_fd_set *set) return 0; } -INT WSACancelAsyncRequest(HANDLE hAsyncTaskHandle) +INT WSACancelAsyncRequest(HANDLE16 hAsyncTaskHandle) { dprintf_winsock(stddeb, "WSA_AsyncRequest: handle %04x\n", hAsyncTaskHandle); diff --git a/miscemu/Makefile.in b/miscemu/Makefile.in index 4fb7d5f8e25..3fd74e7ad8b 100644 --- a/miscemu/Makefile.in +++ b/miscemu/Makefile.in @@ -1,6 +1,9 @@ -DEFS = -D__WINE__ -DNO_TRANSITION_TYPES -TOPSRC = @top_srcdir@ -MODULE = miscemu +DEFS = -D__WINE__ -DNO_TRANSITION_TYPES +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = .. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = miscemu C_SRCS = \ cpu.c \ diff --git a/multimedia/Makefile.in b/multimedia/Makefile.in index d6e1c1cdf32..717bec41d5f 100644 --- a/multimedia/Makefile.in +++ b/multimedia/Makefile.in @@ -1,6 +1,9 @@ -DEFS = -D__WINE__ -TOPSRC = @top_srcdir@ -MODULE = multimedia +DEFS = -D__WINE__ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = .. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = multimedia C_SRCS = \ audio.c \ diff --git a/multimedia/audio.c b/multimedia/audio.c index 4b4cbef3659..f92a6b7df09 100644 --- a/multimedia/audio.c +++ b/multimedia/audio.c @@ -71,7 +71,7 @@ typedef struct { int nUseCount; /* Incremented for each shared open */ BOOL fShareable; /* TRUE if first open was shareable */ WORD wNotifyDeviceID; /* MCI device ID with a pending notification */ - HANDLE hCallback; /* Callback handle for pending notification */ + HANDLE16 hCallback; /* Callback handle for pending notification */ HMMIO16 hFile; /* mmio file handle open as Element */ MCI_WAVE_OPEN_PARMS openParms; PCMWAVEFORMAT WaveFormat; @@ -104,9 +104,9 @@ static DWORD WAVE_NotifyClient(UINT wDevID, WORD wMsg, * WAVE_mciOpen */ static DWORD WAVE_mciOpen(UINT wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMS lpParms) { - HANDLE hFormat; + HLOCAL16 hFormat; LPPCMWAVEFORMAT lpWaveFormat; - HANDLE hDesc; + HLOCAL16 hDesc; LPWAVEOPENDESC lpDesc; LPSTR lpstrElementName; DWORD dwRet; @@ -246,8 +246,8 @@ static DWORD WAVE_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms) { int start, end; LONG bufsize, count; - HANDLE hData; - HANDLE hWaveHdr; + HGLOBAL16 hData; + HLOCAL16 hWaveHdr; LPWAVEHDR lpWaveHdr; LPWAVEHDR lp16WaveHdr; DWORD dwRet; @@ -331,8 +331,8 @@ static DWORD WAVE_mciRecord(UINT wDevID, DWORD dwFlags, LPMCI_RECORD_PARMS lpPar { int start, end; LONG bufsize; - HANDLE hData; - HANDLE hWaveHdr; + HGLOBAL16 hData; + HLOCAL16 hWaveHdr; LPWAVEHDR lpWaveHdr; LPWAVEHDR lp16WaveHdr; DWORD dwRet; diff --git a/multimedia/mcianim.c b/multimedia/mcianim.c index ac22ac135c4..3620d7485a6 100644 --- a/multimedia/mcianim.c +++ b/multimedia/mcianim.c @@ -34,7 +34,7 @@ typedef struct { int nUseCount; /* Incremented for each shared open */ BOOL fShareable; /* TRUE if first open was shareable */ WORD wNotifyDeviceID; /* MCI device ID with a pending notification */ - HANDLE hCallback; /* Callback handle for pending notification */ + HANDLE16 hCallback; /* Callback handle for pending notification */ MCI_OPEN_PARMS openParms; DWORD dwTimeFormat; int mode; diff --git a/multimedia/mcicda.c b/multimedia/mcicda.c index f654573462b..7562e5e8e39 100644 --- a/multimedia/mcicda.c +++ b/multimedia/mcicda.c @@ -56,7 +56,7 @@ typedef struct { int nUseCount; /* Incremented for each shared open */ BOOL fShareable; /* TRUE if first open was shareable */ WORD wNotifyDeviceID; /* MCI device ID with a pending notification */ - HANDLE hCallback; /* Callback handle for pending notification */ + HANDLE16 hCallback; /* Callback handle for pending notification */ MCI_OPEN_PARMS openParms; DWORD dwTimeFormat; int unixdev; diff --git a/multimedia/midi.c b/multimedia/midi.c index 6c38c30ae1f..b86c9331aeb 100644 --- a/multimedia/midi.c +++ b/multimedia/midi.c @@ -67,7 +67,7 @@ typedef struct { int nUseCount; /* Incremented for each shared open */ BOOL fShareable; /* TRUE if first open was shareable */ WORD wNotifyDeviceID; /* MCI device ID with a pending notification */ - HANDLE hCallback; /* Callback handle for pending notification */ + HANDLE16 hCallback; /* Callback handle for pending notification */ HMMIO16 hFile; /* mmio file handle open as Element */ DWORD dwBeginData; DWORD dwTotalLen; diff --git a/multimedia/mmsystem.c b/multimedia/mmsystem.c index a1fef7788a4..c8a066a103b 100644 --- a/multimedia/mmsystem.c +++ b/multimedia/mmsystem.c @@ -52,7 +52,7 @@ LONG ANIM_DriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg, /************************************************************************** * MMSYSTEM_WEP [MMSYSTEM.1] */ -int MMSYSTEM_WEP(HANDLE hInstance, WORD wDataSeg, +int MMSYSTEM_WEP(HINSTANCE16 hInstance, WORD wDataSeg, WORD cbHeapSize, LPSTR lpCmdLine) { /* isn't WEP the Windows Exit Procedure ? */ @@ -68,16 +68,16 @@ BOOL sndPlaySound(LPCSTR lpszSoundName, UINT uFlags) HMMIO16 hmmio; MMCKINFO mmckInfo; MMCKINFO ckMainRIFF; - HANDLE hFormat; + HLOCAL16 hFormat; PCMWAVEFORMAT pcmWaveFormat; int count; int bufsize; - HANDLE hDesc; + HLOCAL16 hDesc; LPWAVEOPENDESC lpWaveDesc; - HANDLE hWaveHdr; + HLOCAL16 hWaveHdr; LPWAVEHDR lpWaveHdr; LPWAVEHDR lp16WaveHdr; - HANDLE hData; + HLOCAL16 hData; DWORD dwRet; char str[128]; LPSTR ptr; @@ -201,7 +201,7 @@ LRESULT DriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg, /************************************************************************** * DriverCallback [MMSYSTEM.31] */ -BOOL DriverCallback(DWORD dwCallBack, UINT uFlags, HANDLE hDev, +BOOL DriverCallback(DWORD dwCallBack, UINT uFlags, HANDLE16 hDev, WORD wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2) { dprintf_mmsys(stddeb, "DriverCallback(%08lX, %04X, %04X, %04X, %08lX, %08lX, %08lX); !\n", @@ -552,7 +552,7 @@ BOOL mciDriverNotify(HWND hWndCallBack, UINT wDevID, UINT wStatus) */ #define _MCI_STRDUP_TO_SEG(dest,source) {\ - HANDLE x;\ + HLOCAL16 x;\ x=USER_HEAP_ALLOC(strlen(source)+1);\ dest=(LPSTR)MAKELONG(x,USER_HeapSel);\ strcpy(PTR_SEG_TO_LIN(dest),source);\ @@ -865,7 +865,7 @@ YIELDPROC mciGetYieldProc(UINT uDeviceID, DWORD * lpdwYieldData) /************************************************************************** * mciGetCreatorTask [MMSYSTEM.717] */ -HTASK mciGetCreatorTask(UINT uDeviceID) +HTASK16 mciGetCreatorTask(UINT uDeviceID) { return 0; } @@ -2219,7 +2219,7 @@ LRESULT DrvSendMessage(HDRVR16 hDriver, WORD msg, LPARAM lParam1, LPARAM lParam2 /************************************************************************** * DrvGetModuleHandle [MMSYSTEM.1103] */ -HANDLE DrvGetModuleHandle(HDRVR16 hDrvr) +HANDLE16 DrvGetModuleHandle(HDRVR16 hDrvr) { dprintf_mmsys(stddeb, "DrvGetModuleHandle(%04X);\n", hDrvr); return 0; diff --git a/multimedia/time.c b/multimedia/time.c index 299405e1ac4..a6b47957035 100644 --- a/multimedia/time.c +++ b/multimedia/time.c @@ -28,7 +28,7 @@ typedef struct tagTIMERENTRY { WORD wDelay; WORD wResol; FARPROC16 lpFunc; - HINSTANCE hInstance; + HINSTANCE16 hInstance; DWORD dwUser; WORD wFlags; WORD wTimerID; diff --git a/objects/Makefile.in b/objects/Makefile.in index 08293120ae5..56b330732c4 100644 --- a/objects/Makefile.in +++ b/objects/Makefile.in @@ -1,6 +1,9 @@ -DEFS = -D__WINE__ -TOPSRC = @top_srcdir@ -MODULE = objects +DEFS = -D__WINE__ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = .. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = objects C_SRCS = \ bitblt.c \ diff --git a/objects/bitmap.c b/objects/bitmap.c index 53237a818e3..926f176e617 100644 --- a/objects/bitmap.c +++ b/objects/bitmap.c @@ -124,7 +124,7 @@ HBITMAP16 CreateBitmap( INT32 width, INT32 height, UINT32 planes, */ HBITMAP16 CreateCompatibleBitmap( HDC32 hdc, INT32 width, INT32 height ) { - HBITMAP hbmpRet = 0; + HBITMAP16 hbmpRet = 0; DC *dc; dprintf_gdi( stddeb, "CreateCompatibleBitmap(%04x,%d,%d) = \n", @@ -421,8 +421,8 @@ INT32 BITMAP_GetObject32( BITMAPOBJ * bmp, INT32 count, LPVOID buffer ) HBITMAP16 BITMAP_SelectObject( DC * dc, HBITMAP16 hbitmap, BITMAPOBJ * bmp ) { - HRGN hrgn; - HBITMAP prevHandle = dc->w.hBitmap; + HRGN32 hrgn; + HBITMAP16 prevHandle = dc->w.hBitmap; if (!(dc->w.flags & DC_MEMORY)) return 0; diff --git a/objects/brush.c b/objects/brush.c index 27c847fa792..38161704cf0 100644 --- a/objects/brush.c +++ b/objects/brush.c @@ -141,10 +141,10 @@ Pixmap BRUSH_DitherColor( DC *dc, COLORREF color ) /*********************************************************************** * CreateBrushIndirect (GDI.50) */ -HBRUSH CreateBrushIndirect( const LOGBRUSH16 * brush ) +HBRUSH16 CreateBrushIndirect( const LOGBRUSH16 * brush ) { BRUSHOBJ * brushPtr; - HBRUSH hbrush = GDI_AllocObject( sizeof(BRUSHOBJ), BRUSH_MAGIC ); + HBRUSH16 hbrush = GDI_AllocObject( sizeof(BRUSHOBJ), BRUSH_MAGIC ); if (!hbrush) return 0; brushPtr = (BRUSHOBJ *) GDI_HEAP_LIN_ADDR( hbrush ); memcpy( &brushPtr->logbrush, brush, sizeof(*brush) ); @@ -155,7 +155,7 @@ HBRUSH CreateBrushIndirect( const LOGBRUSH16 * brush ) /*********************************************************************** * CreateHatchBrush (GDI.58) */ -HBRUSH CreateHatchBrush( INT style, COLORREF color ) +HBRUSH16 CreateHatchBrush( INT style, COLORREF color ) { LOGBRUSH16 logbrush = { BS_HATCHED, color, style }; dprintf_gdi(stddeb, "CreateHatchBrush: %d %06lx\n", style, color ); @@ -167,7 +167,7 @@ HBRUSH CreateHatchBrush( INT style, COLORREF color ) /*********************************************************************** * CreatePatternBrush (GDI.60) */ -HBRUSH CreatePatternBrush( HBITMAP hbitmap ) +HBRUSH16 CreatePatternBrush( HBITMAP16 hbitmap ) { LOGBRUSH16 logbrush = { BS_PATTERN, 0, 0 }; BITMAPOBJ *bmp, *newbmp; @@ -179,7 +179,7 @@ HBRUSH CreatePatternBrush( HBITMAP hbitmap ) if (!(bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC ))) return 0; logbrush.lbHatch = (INT16)CreateBitmapIndirect16( &bmp->bitmap ); - newbmp = (BITMAPOBJ *) GDI_GetObjPtr( (HANDLE)logbrush.lbHatch, BITMAP_MAGIC ); + newbmp = (BITMAPOBJ *) GDI_GetObjPtr( (HGDIOBJ16)logbrush.lbHatch, BITMAP_MAGIC ); if (!newbmp) return 0; XCopyArea( display, bmp->pixmap, newbmp->pixmap, BITMAP_GC(bmp), 0, 0, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight, 0, 0 ); @@ -190,7 +190,7 @@ HBRUSH CreatePatternBrush( HBITMAP hbitmap ) /*********************************************************************** * CreateDIBPatternBrush (GDI.445) */ -HBRUSH CreateDIBPatternBrush( HGLOBAL16 hbitmap, UINT coloruse ) +HBRUSH16 CreateDIBPatternBrush( HGLOBAL16 hbitmap, UINT coloruse ) { LOGBRUSH16 logbrush = { BS_DIBPATTERN, coloruse, 0 }; BITMAPINFO *info, *newInfo; @@ -214,9 +214,9 @@ HBRUSH CreateDIBPatternBrush( HGLOBAL16 hbitmap, UINT coloruse ) GlobalUnlock16( hbitmap ); return 0; } - newInfo = (BITMAPINFO *) GlobalLock16( (HANDLE)logbrush.lbHatch ); + newInfo = (BITMAPINFO *) GlobalLock16( (HGLOBAL16)logbrush.lbHatch ); memcpy( newInfo, info, size ); - GlobalUnlock16( (HANDLE)logbrush.lbHatch ); + GlobalUnlock16( (HGLOBAL16)logbrush.lbHatch ); GlobalUnlock16( hbitmap ); return CreateBrushIndirect( &logbrush ); } @@ -225,7 +225,7 @@ HBRUSH CreateDIBPatternBrush( HGLOBAL16 hbitmap, UINT coloruse ) /*********************************************************************** * CreateSolidBrush (GDI.66) */ -HBRUSH CreateSolidBrush( COLORREF color ) +HBRUSH16 CreateSolidBrush( COLORREF color ) { LOGBRUSH16 logbrush = { BS_SOLID, color, 0 }; dprintf_gdi(stddeb, "CreateSolidBrush: %06lx\n", color ); @@ -270,7 +270,7 @@ BOOL32 SetBrushOrgEx( HDC32 hdc, INT32 x, INT32 y, LPPOINT32 oldorg ) /*********************************************************************** * GetSysColorBrush (USER.281) */ -HBRUSH GetSysColorBrush(WORD x) +HBRUSH16 GetSysColorBrush(WORD x) { fprintf( stderr, "Unimplemented stub: GetSysColorBrush(%d)\n", x ); return GetStockObject(LTGRAY_BRUSH); @@ -280,15 +280,15 @@ HBRUSH GetSysColorBrush(WORD x) /*********************************************************************** * BRUSH_DeleteObject */ -BOOL BRUSH_DeleteObject( HBRUSH hbrush, BRUSHOBJ * brush ) +BOOL32 BRUSH_DeleteObject( HBRUSH16 hbrush, BRUSHOBJ * brush ) { switch(brush->logbrush.lbStyle) { case BS_PATTERN: - DeleteObject( (HANDLE)brush->logbrush.lbHatch ); + DeleteObject( (HGDIOBJ16)brush->logbrush.lbHatch ); break; case BS_DIBPATTERN: - GlobalFree16( (HANDLE)brush->logbrush.lbHatch ); + GlobalFree16( (HGLOBAL16)brush->logbrush.lbHatch ); break; } return GDI_FreeObject( hbrush ); @@ -330,7 +330,7 @@ static void BRUSH_SelectSolidBrush( DC *dc, COLORREF color ) /*********************************************************************** * BRUSH_SelectPatternBrush */ -static BOOL BRUSH_SelectPatternBrush( DC * dc, HBITMAP hbitmap ) +static BOOL BRUSH_SelectPatternBrush( DC * dc, HBITMAP16 hbitmap ) { BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC ); if (!bmp) return FALSE; @@ -357,11 +357,11 @@ static BOOL BRUSH_SelectPatternBrush( DC * dc, HBITMAP hbitmap ) /*********************************************************************** * BRUSH_SelectObject */ -HBRUSH BRUSH_SelectObject( DC * dc, HBRUSH hbrush, BRUSHOBJ * brush ) +HBRUSH16 BRUSH_SelectObject( DC * dc, HBRUSH16 hbrush, BRUSHOBJ * brush ) { - HBITMAP hBitmap; + HBITMAP16 hBitmap; BITMAPINFO * bmpInfo; - HBRUSH prevHandle = dc->w.hBrush; + HBRUSH16 prevHandle = dc->w.hBrush; dprintf_gdi(stddeb, "Brush_SelectObject: hdc=%04x hbrush=%04x\n", dc->hSelf,hbrush); @@ -373,16 +373,16 @@ HBRUSH BRUSH_SelectObject( DC * dc, HBRUSH hbrush, BRUSHOBJ * brush ) case BS_HATCHED: case BS_HOLLOW: if (!MF_CreateBrushIndirect(dc, hbrush, &(brush->logbrush))) - return (HBRUSH)0; + return (HBRUSH16)0; break; case BS_PATTERN: case BS_DIBPATTERN: if (!MF_CreatePatternBrush(dc, hbrush, &(brush->logbrush))) - return (HBRUSH)0; + return (HBRUSH16)0; break; } - return (HBRUSH)1; + return (HBRUSH16)1; } dc->w.hBrush = hbrush; @@ -415,12 +415,12 @@ HBRUSH BRUSH_SelectObject( DC * dc, HBRUSH hbrush, BRUSHOBJ * brush ) case BS_PATTERN: dprintf_gdi( stddeb, "BS_PATTERN\n"); - BRUSH_SelectPatternBrush( dc, (HBRUSH)brush->logbrush.lbHatch ); + BRUSH_SelectPatternBrush( dc, (HBRUSH16)brush->logbrush.lbHatch ); break; case BS_DIBPATTERN: dprintf_gdi( stddeb, "BS_DIBPATTERN\n"); - if ((bmpInfo = (BITMAPINFO *) GlobalLock16( (HANDLE)brush->logbrush.lbHatch ))) + if ((bmpInfo = (BITMAPINFO *) GlobalLock16( (HGLOBAL16)brush->logbrush.lbHatch ))) { int size = DIB_BitmapInfoSize( bmpInfo, brush->logbrush.lbColor ); hBitmap = CreateDIBitmap( dc->hSelf, &bmpInfo->bmiHeader, CBM_INIT, @@ -428,7 +428,7 @@ HBRUSH BRUSH_SelectObject( DC * dc, HBRUSH hbrush, BRUSHOBJ * brush ) (WORD) brush->logbrush.lbColor ); BRUSH_SelectPatternBrush( dc, hBitmap ); DeleteObject( hBitmap ); - GlobalUnlock16( (HANDLE)brush->logbrush.lbHatch ); + GlobalUnlock16( (HGLOBAL16)brush->logbrush.lbHatch ); } break; diff --git a/objects/clipping.c b/objects/clipping.c index 29a5cb4a522..eae9dbceaba 100644 --- a/objects/clipping.c +++ b/objects/clipping.c @@ -12,7 +12,11 @@ /* #define DEBUG_CLIPPING */ #include "debug.h" -#define UpdateDirtyDC(dc) DC_CallHookProc( dc, DCHC_INVALIDVISRGN, 0 ) +#define UPDATE_DIRTY_DC(dc) \ + do { \ + if ((dc)->hookProc && !((dc)->w.flags & (DC_SAVED | DC_MEMORY))) \ + (dc)->hookProc( (dc)->hSelf, DCHC_INVALIDVISRGN, (dc)->dwHookData, 0 ); \ + } while(0) /*********************************************************************** * CLIPPING_SetDeviceClipping @@ -56,7 +60,7 @@ void CLIPPING_UpdateGCRegion( DC * dc ) if (dc->w.flags & DC_DIRTY) { - UpdateDirtyDC(dc); + UPDATE_DIRTY_DC(dc); dc->w.flags &= ~DC_DIRTY; } @@ -71,7 +75,7 @@ void CLIPPING_UpdateGCRegion( DC * dc ) /*********************************************************************** * SelectClipRgn (GDI.44) */ -int SelectClipRgn( HDC hdc, HRGN hrgn ) +int SelectClipRgn( HDC hdc, HRGN32 hrgn ) { int retval; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); @@ -99,7 +103,7 @@ int SelectClipRgn( HDC hdc, HRGN hrgn ) /*********************************************************************** * SelectVisRgn (GDI.105) */ -int SelectVisRgn( HDC hdc, HRGN hrgn ) +int SelectVisRgn( HDC hdc, HRGN32 hrgn ) { int retval; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); @@ -166,7 +170,7 @@ int OffsetVisRgn( HDC hdc, short x, short y ) int CLIPPING_IntersectClipRect( DC * dc, short left, short top, short right, short bottom, UINT16 flags) { - HRGN newRgn; + HRGN32 newRgn; int ret; if ( !(newRgn = CreateRectRgn( left, top, right, bottom )) ) return ERROR; @@ -253,7 +257,7 @@ int IntersectClipRect( HDC hdc, short left, short top, static int CLIPPING_IntersectVisRect( DC * dc, short left, short top, short right, short bottom, BOOL exclude ) { - HRGN tempRgn, newRgn; + HRGN32 tempRgn, newRgn; int ret; left = XLPTODP( dc, left ); @@ -325,7 +329,7 @@ BOOL PtVisible( HDC hdc, short x, short y ) dprintf_clipping(stddeb, "PtVisible: %04x %d,%d\n", hdc, x, y ); if (!dc->w.hGCClipRgn) return FALSE; - if( dc->w.flags & DC_DIRTY ) UpdateDirtyDC(dc); + if( dc->w.flags & DC_DIRTY ) UPDATE_DIRTY_DC(dc); dc->w.flags &= ~DC_DIRTY; return PtInRegion( dc->w.hGCClipRgn, XLPTODP(dc,x), YLPTODP(dc,y) ); @@ -392,9 +396,9 @@ INT32 GetClipBox32( HDC32 hdc, LPRECT32 rect ) /*********************************************************************** * SaveVisRgn (GDI.129) */ -HRGN SaveVisRgn( HDC hdc ) +HRGN32 SaveVisRgn( HDC hdc ) { - HRGN copy; + HRGN32 copy; RGNOBJ *obj, *copyObj; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) return 0; @@ -404,7 +408,7 @@ HRGN SaveVisRgn( HDC hdc ) fprintf( stderr, "SaveVisRgn: hVisRgn is zero. Please report this.\n" ); exit(1); } - if( dc->w.flags & DC_DIRTY ) UpdateDirtyDC(dc); + if( dc->w.flags & DC_DIRTY ) UPDATE_DIRTY_DC(dc); dc->w.flags &= ~DC_DIRTY; if (!(obj = (RGNOBJ *) GDI_GetObjPtr( dc->w.hVisRgn, REGION_MAGIC ))) @@ -424,7 +428,7 @@ HRGN SaveVisRgn( HDC hdc ) */ int RestoreVisRgn( HDC hdc ) { - HRGN saved; + HRGN32 saved; RGNOBJ *obj, *savedObj; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc || !dc->w.hVisRgn) return ERROR; diff --git a/objects/cursoricon.c b/objects/cursoricon.c index 180e1ae28fc..064d02b8a8a 100644 --- a/objects/cursoricon.c +++ b/objects/cursoricon.c @@ -232,10 +232,10 @@ static BOOL CURSORICON_LoadDirEntry(HINSTANCE32 hInstance, SEGPTR name, * * Create a cursor or icon from a resource. */ -HANDLE CURSORICON_LoadHandler( HANDLE handle, HINSTANCE hInstance, - BOOL fCursor ) +HGLOBAL16 CURSORICON_LoadHandler( HGLOBAL16 handle, HINSTANCE16 hInstance, + BOOL fCursor ) { - HANDLE hAndBits, hXorBits; + HBITMAP16 hAndBits, hXorBits; HDC32 hdc; int size, sizeAnd, sizeXor; POINT16 hotspot = { 0 ,0 }; @@ -367,10 +367,11 @@ HANDLE CURSORICON_LoadHandler( HANDLE handle, HINSTANCE hInstance, * * Load a cursor or icon. */ -static HANDLE CURSORICON_Load( HANDLE hInstance, SEGPTR name, int width, - int height, int colors, BOOL fCursor ) +static HGLOBAL16 CURSORICON_Load( HINSTANCE16 hInstance, SEGPTR name, + int width, int height, int colors, + BOOL fCursor ) { - HANDLE handle,hRet; + HGLOBAL16 handle, hRet; HRSRC16 hRsrc; CURSORICONDIRENTRY dirEntry; @@ -408,11 +409,11 @@ static HANDLE CURSORICON_Load( HANDLE hInstance, SEGPTR name, int width, * * Make a copy of a cursor or icon. */ -static HANDLE CURSORICON_Copy( HANDLE hInstance, HANDLE handle ) +static HGLOBAL16 CURSORICON_Copy( HINSTANCE16 hInstance, HGLOBAL16 handle ) { char *ptrOld, *ptrNew; int size; - HANDLE hNew; + HGLOBAL16 hNew; if (!(ptrOld = (char *)GlobalLock16( handle ))) return 0; if (!(hInstance = GetExePtr( hInstance ))) return 0; @@ -446,9 +447,7 @@ HCURSOR16 CURSORICON_IconToCursor(HICON16 hIcon) else { /* kludge */ - - HTASK hTask = GetCurrentTask(); - TDB* pTask = (TDB *)GlobalLock16(hTask); + TDB* pTask = (TDB *)GlobalLock16( GetCurrentTask() ); if(!pTask) return 0; @@ -499,7 +498,7 @@ HICON16 LoadIcon16(HINSTANCE16 hInstance,SEGPTR name) /*********************************************************************** * CreateCursor (USER.406) */ -HCURSOR16 CreateCursor( HINSTANCE hInstance, INT xHotSpot, INT yHotSpot, +HCURSOR16 CreateCursor( HINSTANCE16 hInstance, INT xHotSpot, INT yHotSpot, INT nWidth, INT nHeight, const BYTE *lpANDbits, const BYTE *lpXORbits ) { @@ -514,7 +513,7 @@ HCURSOR16 CreateCursor( HINSTANCE hInstance, INT xHotSpot, INT yHotSpot, /*********************************************************************** * CreateIcon (USER.407) */ -HICON16 CreateIcon( HINSTANCE hInstance, INT nWidth, INT nHeight, BYTE bPlanes, +HICON16 CreateIcon( HINSTANCE16 hInstance, INT nWidth, INT nHeight, BYTE bPlanes, BYTE bBitsPixel, const BYTE* lpANDbits, const BYTE* lpXORbits) { CURSORICONINFO info = { { 0, 0 }, nWidth, nHeight, 0, bPlanes, bBitsPixel }; @@ -528,10 +527,12 @@ HICON16 CreateIcon( HINSTANCE hInstance, INT nWidth, INT nHeight, BYTE bPlanes, /*********************************************************************** * CreateCursorIconIndirect (USER.408) */ -HANDLE CreateCursorIconIndirect( HANDLE hInstance, CURSORICONINFO *info, - const BYTE *lpANDbits, const BYTE *lpXORbits ) +HGLOBAL16 CreateCursorIconIndirect( HINSTANCE16 hInstance, + CURSORICONINFO *info, + const BYTE *lpANDbits, + const BYTE *lpXORbits ) { - HANDLE handle; + HGLOBAL16 handle; char *ptr; int sizeAnd, sizeXor; @@ -611,7 +612,7 @@ BOOL DrawIcon( HDC hdc, INT x, INT y, HICON16 hIcon ) { CURSORICONINFO *ptr; HDC hMemDC; - HBITMAP hXorBits, hAndBits; + HBITMAP16 hXorBits, hAndBits; COLORREF oldFg, oldBg; if (!(ptr = (CURSORICONINFO *)GlobalLock16( hIcon ))) return FALSE; @@ -625,7 +626,7 @@ BOOL DrawIcon( HDC hdc, INT x, INT y, HICON16 hIcon ) if (hXorBits && hAndBits) { - HBITMAP hBitTemp = SelectObject( hMemDC, hAndBits ); + HBITMAP16 hBitTemp = SelectObject( hMemDC, hAndBits ); BitBlt( hdc, x, y, ptr->nWidth, ptr->nHeight, hMemDC, 0, 0, SRCAND ); SelectObject( hMemDC, hXorBits ); BitBlt( hdc, x, y, ptr->nWidth, ptr->nHeight, hMemDC, 0, 0, SRCINVERT); @@ -934,7 +935,7 @@ void GetClipCursor32( RECT32 *rect ) /********************************************************************** * GetIconID (USER.455) */ -WORD GetIconID( HANDLE hResource, DWORD resType ) +WORD GetIconID( HGLOBAL16 hResource, DWORD resType ) { CURSORICONDIR *lpDir = (CURSORICONDIR *)GlobalLock16(hResource); /* LockResource16(hResource); */ @@ -973,7 +974,7 @@ WORD GetIconID( HANDLE hResource, DWORD resType ) /********************************************************************** * LoadIconHandler (USER.456) */ -HICON16 LoadIconHandler( HANDLE hResource, BOOL bNew ) +HICON16 LoadIconHandler( HGLOBAL16 hResource, BOOL bNew ) { dprintf_cursor(stddeb,"LoadIconHandler: hRes=%04x\n",hResource); diff --git a/objects/dc.c b/objects/dc.c index 76d925a7c5c..f7777798083 100644 --- a/objects/dc.c +++ b/objects/dc.c @@ -14,20 +14,15 @@ #include "color.h" #include "debug.h" #include "font.h" -#include "callback.h" #include "xmalloc.h" extern void CLIPPING_UpdateGCRegion( DC * dc ); /* objects/clipping.c */ -extern BOOL DCHook( HDC, WORD, DWORD, DWORD ); /* windows/dce.c */ /* Default DC values */ static const WIN_DC_INFO DC_defaultValues = { 0, /* flags */ NULL, /* devCaps */ - 0, /* hMetaFile */ - 0, /* hHT */ - 0, /* HTLen */ 0, /* hClipRgn */ 0, /* hVisRgn */ 0, /* hGCClipRgn */ @@ -145,6 +140,41 @@ void DC_FillDevCaps( DeviceCaps * caps ) } +/*********************************************************************** + * DC_AllocDC + */ +DC *DC_AllocDC( const DC_FUNCTIONS *funcs ) +{ + HDC16 hdc; + DC *dc; + + if (!(hdc = GDI_AllocObject( sizeof(DC), DC_MAGIC ))) return NULL; + dc = (DC *) GDI_HEAP_LIN_ADDR( hdc ); + + dc->hSelf = hdc; + dc->funcs = funcs; + dc->physDev = NULL; + dc->saveLevel = 0; + dc->dwHookData = 0L; + dc->hookProc = NULL; + + memcpy( &dc->w, &DC_defaultValues, sizeof(DC_defaultValues) ); + return dc; +} + + +/*********************************************************************** + * DC_GetDCPtr + */ +DC *DC_GetDCPtr( HDC32 hdc ) +{ + GDIOBJHDR *ptr = (GDIOBJHDR *)GDI_HEAP_LIN_ADDR( hdc ); + if ((ptr->wMagic == DC_MAGIC) || (ptr->wMagic == METAFILE_DC_MAGIC)) + return (DC *)ptr; + return NULL; +} + + /*********************************************************************** * DC_InitDC * @@ -169,7 +199,7 @@ void DC_InitDC( DC* dc ) * If fMapColors is TRUE, X pixels are mapped to Windows colors. * Return FALSE if brush is BS_NULL, TRUE otherwise. */ -BOOL DC_SetupGCForPatBlt( DC * dc, GC gc, BOOL fMapColors ) +BOOL32 DC_SetupGCForPatBlt( DC * dc, GC gc, BOOL32 fMapColors ) { XGCValues val; unsigned long mask; @@ -251,7 +281,7 @@ BOOL DC_SetupGCForPatBlt( DC * dc, GC gc, BOOL fMapColors ) * Setup dc->u.x.gc for drawing operations using current brush. * Return FALSE if brush is BS_NULL, TRUE otherwise. */ -BOOL DC_SetupGCForBrush( DC * dc ) +BOOL32 DC_SetupGCForBrush( DC * dc ) { return DC_SetupGCForPatBlt( dc, dc->u.x.gc, FALSE ); } @@ -263,7 +293,7 @@ BOOL DC_SetupGCForBrush( DC * dc ) * Setup dc->u.x.gc for drawing operations using current pen. * Return FALSE if pen is PS_NULL, TRUE otherwise. */ -BOOL DC_SetupGCForPen( DC * dc ) +BOOL32 DC_SetupGCForPen( DC * dc ) { XGCValues val; @@ -309,7 +339,7 @@ BOOL DC_SetupGCForPen( DC * dc ) * Setup dc->u.x.gc for text drawing operations. * Return FALSE if the font is null, TRUE otherwise. */ -BOOL DC_SetupGCForText( DC * dc ) +BOOL32 DC_SetupGCForText( DC * dc ) { XGCValues val; @@ -333,33 +363,13 @@ BOOL DC_SetupGCForText( DC * dc ) } -/*********************************************************************** - * DC_CallHookProc - */ -BOOL DC_CallHookProc(DC* dc, WORD code, LPARAM lParam) -{ - BOOL bRet = FALSE; - FARPROC16 ptr = GDI_GetDefDCHook(); - - dprintf_dc(stddeb,"CallDCHook: code %04x\n", code); - - /* if 16-bit callback is, in fact, a thunk to DCHook simply call DCHook */ - - if( dc->hookProc && !(dc->w.flags & (DC_SAVED | DC_MEMORY)) ) - bRet = (dc->hookProc == ptr) ? - DCHook(dc->hSelf, code, dc->dwHookData, lParam): - CallDCHookProc(dc->hookProc, dc->hSelf, code, dc->dwHookData, lParam); - - return bRet; -} - /*********************************************************************** * GetDCState (GDI.179) */ HDC GetDCState( HDC hdc ) { DC * newdc, * dc; - HANDLE handle; + HGDIOBJ16 handle; if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0; if (!(handle = GDI_AllocObject( sizeof(DC), DC_MAGIC ))) return 0; @@ -393,9 +403,9 @@ HDC GetDCState( HDC hdc ) void SetDCState( HDC hdc, HDC hdcs ) { DC * dc, * dcs; - HRGN hVisRgn, hClipRgn, hGCClipRgn; - HFONT hfont; - HBRUSH hbrush; + HRGN32 hVisRgn, hClipRgn, hGCClipRgn; + HFONT16 hfont; + HBRUSH16 hbrush; if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return; if (!(dcs = (DC *) GDI_GetObjPtr( hdcs, DC_MAGIC ))) return; @@ -489,39 +499,25 @@ BOOL RestoreDC( HDC hdc, short level ) HDC CreateDC( LPCSTR driver, LPCSTR device, LPCSTR output, const DEVMODE* initData ) { DC * dc; - HDC16 handle; const DC_FUNCTIONS *funcs; if (!(funcs = DRIVER_FindDriver( driver ))) return 0; - - handle = GDI_AllocObject( sizeof(DC), DC_MAGIC ); - if (!handle) return 0; - dc = (DC *) GDI_HEAP_LIN_ADDR( handle ); + if (!(dc = DC_AllocDC( funcs ))) return 0; + dc->w.flags = 0; dprintf_dc(stddeb, "CreateDC(%s %s %s): returning %04x\n", - driver, device, output, handle ); - - dc->hSelf = handle; - dc->funcs = funcs; - dc->physDev = NULL; - dc->saveLevel = 0; - dc->dwHookData = 0L; - dc->hookProc = (SEGPTR)0; - - memcpy( &dc->w, &DC_defaultValues, sizeof(DC_defaultValues) ); - dc->w.flags = 0; + driver, device, output, dc->hSelf ); if (dc->funcs->pCreateDC && !dc->funcs->pCreateDC( dc, driver, device, output, initData )) { dprintf_dc( stddeb, "CreateDC: creation aborted by device\n" ); - GDI_HEAP_FREE( handle ); + GDI_HEAP_FREE( dc->hSelf ); return 0; } DC_InitDC( dc ); - - return handle; + return dc->hSelf; } @@ -541,35 +537,24 @@ HDC CreateIC( LPCSTR driver, LPCSTR device, LPCSTR output, const DEVMODE* initDa HDC CreateCompatibleDC( HDC hdc ) { DC *dc, *origDC; - HDC16 handle; - HBITMAP hbitmap; + HBITMAP16 hbitmap; const DC_FUNCTIONS *funcs; if ((origDC = (DC *)GDI_GetObjPtr( hdc, DC_MAGIC ))) funcs = origDC->funcs; else funcs = DRIVER_FindDriver( "DISPLAY" ); if (!funcs) return 0; - handle = GDI_AllocObject( sizeof(DC), DC_MAGIC ); - if (!handle) return 0; - dc = (DC *) GDI_HEAP_LIN_ADDR( handle ); + if (!(dc = DC_AllocDC( funcs ))) return 0; - dprintf_dc(stddeb, "CreateCompatibleDC(%04x): returning %04x\n", hdc, handle ); + dprintf_dc(stddeb, "CreateCompatibleDC(%04x): returning %04x\n", + hdc, dc->hSelf ); /* Create default bitmap */ if (!(hbitmap = CreateBitmap( 1, 1, 1, 1, NULL ))) { - GDI_HEAP_FREE( handle ); + GDI_HEAP_FREE( dc->hSelf ); return 0; } - - memcpy( &dc->w, &DC_defaultValues, sizeof(DC_defaultValues) ); - - dc->hSelf = handle; - dc->funcs = funcs; - dc->physDev = NULL; - dc->saveLevel = 0; - dc->dwHookData = 0L; - dc->hookProc = (SEGPTR)0; dc->w.flags = DC_MEMORY; dc->w.bitsPerPixel = 1; dc->w.hBitmap = hbitmap; @@ -580,13 +565,12 @@ HDC CreateCompatibleDC( HDC hdc ) { dprintf_dc( stddeb, "CreateDC: creation aborted by device\n" ); DeleteObject( hbitmap ); - GDI_HEAP_FREE( handle ); + GDI_HEAP_FREE( dc->hSelf ); return 0; } DC_InitDC( dc ); - - return handle; + return dc->hSelf; } @@ -751,12 +735,12 @@ DWORD SetDCOrg( HDC hdc, short x, short y ) /*********************************************************************** * SetDCHook (GDI.190) */ -BOOL SetDCHook( HDC hDC, FARPROC16 hookProc, DWORD dwHookData ) +BOOL16 SetDCHook( HDC16 hdc, FARPROC16 hookProc, DWORD dwHookData ) { - DC *dc = (DC *)GDI_GetObjPtr( hDC, DC_MAGIC ); + DC *dc = (DC *)GDI_GetObjPtr( hdc, DC_MAGIC ); dprintf_dc( stddeb, "SetDCHook: hookProc %08x, default is %08x\n", - (unsigned)hookProc,(unsigned)GDI_GetDefDCHook() ); + (UINT32)hookProc, (UINT32)DCHook ); if (!dc) return FALSE; dc->hookProc = hookProc; @@ -768,9 +752,9 @@ BOOL SetDCHook( HDC hDC, FARPROC16 hookProc, DWORD dwHookData ) /*********************************************************************** * GetDCHook (GDI.191) */ -DWORD GetDCHook( HDC hDC, FARPROC16 *phookProc ) +DWORD GetDCHook( HDC16 hdc, FARPROC16 *phookProc ) { - DC *dc = (DC *)GDI_GetObjPtr( hDC, DC_MAGIC ); + DC *dc = (DC *)GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) return 0; *phookProc = dc->hookProc; return dc->dwHookData; diff --git a/objects/dcvalues.c b/objects/dcvalues.c index c330f41ae67..9ce69c5b681 100644 --- a/objects/dcvalues.c +++ b/objects/dcvalues.c @@ -84,11 +84,11 @@ DC_GET_X_Y( DWORD, GetViewportExt, VportExtX, VportExtY ) /* GDI.94 */ DC_GET_X_Y( DWORD, GetViewportOrg, VportOrgX, VportOrgY ) /* GDI.95 */ DC_GET_X_Y( DWORD, GetWindowExt, WndExtX, WndExtY ) /* GDI.96 */ DC_GET_X_Y( DWORD, GetWindowOrg, WndOrgX, WndOrgY ) /* GDI.97 */ -DC_GET_VAL( HRGN, InquireVisRgn, hVisRgn ) /* GDI.131 */ +DC_GET_VAL( HRGN32, InquireVisRgn, hVisRgn ) /* GDI.131 */ DC_GET_X_Y( DWORD, GetBrushOrg, brushOrgX, brushOrgY ) /* GDI.149 */ -DC_GET_VAL( HRGN, GetClipRgn, hClipRgn ) /* GDI.173 */ +DC_GET_VAL( HRGN32, GetClipRgn, hClipRgn ) /* GDI.173 */ DC_GET_VAL( WORD, GetTextAlign, textAlign ) /* GDI.345 */ -DC_GET_VAL( HFONT, GetCurLogFont, hFont ) /* GDI.411 */ +DC_GET_VAL( HFONT16, GetCurLogFont, hFont ) /* GDI.411 */ DC_GET_VAL_EX( GetBrushOrgEx, brushOrgX, brushOrgY ) /* GDI.469 */ DC_GET_VAL_EX( GetCurrentPositionEx, CursPosX, CursPosY ) /* GDI.470 */ DC_GET_VAL_EX( GetViewportExtEx, VportExtX, VportExtY ) /* GDI.472 */ diff --git a/objects/dib.c b/objects/dib.c index 8d2907d619d..4f8dd6c7ad0 100644 --- a/objects/dib.c +++ b/objects/dib.c @@ -626,7 +626,7 @@ int StretchDIBits( HDC hdc, WORD xSrc, WORD ySrc, WORD wSrcWidth, WORD wSrcHeight, LPSTR bits, LPBITMAPINFO info, WORD wUsage, DWORD dwRop ) { - HBITMAP hBitmap, hOldBitmap; + HBITMAP16 hBitmap, hOldBitmap; HDC hdcMem; hBitmap = CreateDIBitmap( hdc, &info->bmiHeader, CBM_INIT, @@ -724,7 +724,7 @@ INT16 SetDIBitsToDevice( HDC32 hdc, INT32 xDest, INT32 yDest, DWORD cx, /*********************************************************************** * GetDIBits (GDI.441) */ -int GetDIBits( HDC hdc, HBITMAP hbitmap, WORD startscan, WORD lines, +int GetDIBits( HDC hdc, HBITMAP16 hbitmap, WORD startscan, WORD lines, LPSTR bits, BITMAPINFO * info, WORD coloruse ) { DC * dc; @@ -792,10 +792,10 @@ int GetDIBits( HDC hdc, HBITMAP hbitmap, WORD startscan, WORD lines, /*********************************************************************** * CreateDIBitmap (GDI.442) */ -HBITMAP CreateDIBitmap( HDC hdc, BITMAPINFOHEADER * header, DWORD init, - LPVOID bits, BITMAPINFO * data, UINT coloruse ) +HBITMAP16 CreateDIBitmap( HDC hdc, BITMAPINFOHEADER * header, DWORD init, + LPVOID bits, BITMAPINFO * data, UINT coloruse ) { - HBITMAP handle; + HBITMAP16 handle; BOOL fColor; DWORD width, height; WORD bpp; diff --git a/objects/font.c b/objects/font.c index a63275457a4..aca387472f1 100644 --- a/objects/font.c +++ b/objects/font.c @@ -529,7 +529,7 @@ HFONT16 FONT_SelectObject( DC * dc, HFONT16 hfont, FONTOBJ * font ) static X_PHYSFONT stockFonts[LAST_STOCK_FONT-FIRST_STOCK_FONT+1]; static struct { - HFONT id; + HFONT16 id; LOGFONT16 logfont; int access; int used; @@ -537,7 +537,7 @@ HFONT16 FONT_SelectObject( DC * dc, HFONT16 hfont, FONTOBJ * font ) int i; X_PHYSFONT * stockPtr; - HFONT prevHandle = dc->w.hFont; + HFONT16 prevHandle = dc->w.hFont; XFontStruct * fontStruct; dprintf_font(stddeb,"FONT_SelectObject(%p, %04x, %p)\n", dc, hfont, font); @@ -545,7 +545,7 @@ HFONT16 FONT_SelectObject( DC * dc, HFONT16 hfont, FONTOBJ * font ) /* Load font if necessary */ if (!font) { - HFONT hnewfont; + HFONT16 hnewfont; hnewfont = CreateFont16(10, 7, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0, @@ -1155,10 +1155,10 @@ void InitFontsList(void) */ INT EnumFonts(HDC hDC, LPCSTR lpFaceName, FONTENUMPROC16 lpEnumFunc, LPARAM lpData) { - HANDLE hLog; - HANDLE hMet; - HFONT hFont; - HFONT hOldFont; + HLOCAL16 hLog; + HLOCAL16 hMet; + HFONT16 hFont; + HFONT16 hOldFont; LPLOGFONT16 lpLogFont; LPTEXTMETRIC16 lptm; LPSTR lpOldName; @@ -1225,10 +1225,10 @@ INT EnumFonts(HDC hDC, LPCSTR lpFaceName, FONTENUMPROC16 lpEnumFunc, LPARAM lpDa */ INT EnumFontFamilies(HDC hDC, LPCSTR lpszFamily, FONTENUMPROC16 lpEnumFunc, LPARAM lpData) { - HANDLE hLog; - HANDLE hMet; - HFONT hFont; - HFONT hOldFont; + HLOCAL16 hLog; + HLOCAL16 hMet; + HFONT16 hFont; + HFONT16 hOldFont; LPENUMLOGFONT16 lpEnumLogFont; LPTEXTMETRIC16 lptm; LPSTR lpOldName; diff --git a/objects/gdiobj.c b/objects/gdiobj.c index f196635cd59..3aae235ed2c 100644 --- a/objects/gdiobj.c +++ b/objects/gdiobj.c @@ -12,7 +12,6 @@ #include "brush.h" #include "font.h" #include "heap.h" -#include "module.h" #include "palette.h" #include "pen.h" #include "region.h" @@ -148,8 +147,6 @@ static GDIOBJHDR * StockObjects[NB_STOCK_OBJECTS] = (GDIOBJHDR *) &SystemFixedFont }; -static FARPROC16 defDCHookCallback; - /*********************************************************************** * GDI_Init @@ -165,13 +162,6 @@ BOOL32 GDI_Init(void) if (!X11DRV_Init()) return FALSE; - /* Get default hook */ - - defDCHookCallback = (FARPROC16)MODULE_GetEntryPoint(GetModuleHandle("USER"), - 362 /* DCHook */ ); - dprintf_gdi( stddeb, "DCHook: 16-bit callback is %08x\n", - (unsigned)defDCHookCallback ); - /* Create default palette */ if (!(hpalette = COLOR_Init())) return FALSE; @@ -193,23 +183,14 @@ BOOL32 GDI_Init(void) } -/*********************************************************************** - * GDI_GetDefDCHook - */ -FARPROC16 GDI_GetDefDCHook(void) -{ - return defDCHookCallback; -} - - /*********************************************************************** * GDI_AllocObject */ -HANDLE16 GDI_AllocObject( WORD size, WORD magic ) +HGDIOBJ16 GDI_AllocObject( WORD size, WORD magic ) { static DWORD count = 0; GDIOBJHDR * obj; - HANDLE handle = GDI_HEAP_ALLOC( size ); + HGDIOBJ16 handle = GDI_HEAP_ALLOC( size ); if (!handle) return 0; obj = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle ); obj->hNext = 0; @@ -222,7 +203,7 @@ HANDLE16 GDI_AllocObject( WORD size, WORD magic ) /*********************************************************************** * GDI_FreeObject */ -BOOL32 GDI_FreeObject( HANDLE16 handle ) +BOOL32 GDI_FreeObject( HGDIOBJ16 handle ) { GDIOBJHDR * object; @@ -246,7 +227,7 @@ BOOL32 GDI_FreeObject( HANDLE16 handle ) * Return a pointer to the GDI object associated to the handle. * Return NULL if the object has the wrong magic number. */ -GDIOBJHDR * GDI_GetObjPtr( HANDLE16 handle, WORD magic ) +GDIOBJHDR * GDI_GetObjPtr( HGDIOBJ16 handle, WORD magic ) { GDIOBJHDR * ptr = NULL; @@ -290,13 +271,13 @@ BOOL DeleteObject( HGDIOBJ16 obj ) /*********************************************************************** * GetStockObject (GDI.87) */ -HANDLE GetStockObject( int obj ) +HGDIOBJ16 GetStockObject( INT16 obj ) { if ((obj < 0) || (obj >= NB_STOCK_OBJECTS)) return 0; if (!StockObjects[obj]) return 0; dprintf_gdi(stddeb, "GetStockObject: returning %d\n", FIRST_STOCK_HANDLE + obj ); - return (HANDLE)(FIRST_STOCK_HANDLE + obj); + return (HGDIOBJ16)(FIRST_STOCK_HANDLE + obj); } @@ -376,7 +357,7 @@ INT32 GetObject32W( HANDLE32 handle, INT32 count, LPVOID buffer ) /*********************************************************************** * SelectObject (GDI.45) */ -HANDLE SelectObject( HDC hdc, HANDLE handle ) +HGDIOBJ16 SelectObject( HDC hdc, HGDIOBJ16 handle ) { GDIOBJHDR * ptr = NULL; DC * dc; @@ -406,7 +387,7 @@ HANDLE SelectObject( HDC hdc, HANDLE handle ) case FONT_MAGIC: return FONT_SelectObject( dc, handle, (FONTOBJ *)ptr ); case REGION_MAGIC: - return (HANDLE)SelectClipRgn( hdc, handle ); + return (HGDIOBJ16)SelectClipRgn( hdc, handle ); } return 0; } @@ -415,7 +396,7 @@ HANDLE SelectObject( HDC hdc, HANDLE handle ) /*********************************************************************** * UnrealizeObject (GDI.150) */ -BOOL UnrealizeObject( HANDLE obj ) +BOOL UnrealizeObject( HGDIOBJ16 obj ) { /* Check if object is valid */ @@ -521,7 +502,7 @@ INT EnumObjects( HDC hdc, INT nObjType, GOBJENUMPROC16 lpEnumFunc, /*********************************************************************** * IsGDIObject (GDI.462) */ -BOOL IsGDIObject(HANDLE handle) +BOOL16 IsGDIObject( HGDIOBJ16 handle ) { GDIOBJHDR *object = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle ); if (object) diff --git a/objects/metafile.c b/objects/metafile.c index 3d38d3aedd4..1b1760fcdb3 100644 --- a/objects/metafile.c +++ b/objects/metafile.c @@ -11,11 +11,48 @@ #include "gdi.h" #include "bitmap.h" #include "file.h" +#include "heap.h" #include "metafile.h" +#include "metafiledrv.h" #include "stddebug.h" #include "debug.h" -#define HTINCR 10 /* handle table allocation size increment */ +/****************************************************************** + * MF_AddHandle + * + * Add a handle to an external handle table and return the index + */ + +static int MF_AddHandle(HANDLETABLE16 *ht, WORD htlen, HGDIOBJ16 hobj) +{ + int i; + + for (i = 0; i < htlen; i++) + { + if (*(ht->objectHandle + i) == 0) + { + *(ht->objectHandle + i) = hobj; + return i; + } + } + return -1; +} + + +/****************************************************************** + * MF_AddHandleDC + * + * Note: this function assumes that we never delete objects. + * If we do someday, we'll need to maintain a table to re-use deleted + * handles. + */ +static int MF_AddHandleDC( DC *dc ) +{ + METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dc->physDev; + physDev->mh->mtNoObjects++; + return physDev->nextHandle++; +} + /****************************************************************** * GetMetafile GDI.124 By Kenny MacDonald 30 Nov 94 @@ -79,68 +116,6 @@ HMETAFILE16 GetMetaFile(LPSTR lpFilename) } -/****************************************************************** - * CreateMetafile GDI.125 - */ - -HANDLE CreateMetaFile(LPCSTR lpFilename) -{ - DC *dc; - HANDLE handle; - METAHEADER *mh; - HFILE hFile; - - dprintf_metafile(stddeb,"CreateMetaFile: %s\n", lpFilename); - - handle = GDI_AllocObject(sizeof(DC), METAFILE_DC_MAGIC); - - if (!handle) - return 0; - - dc = (DC *)GDI_HEAP_LIN_ADDR(handle); - - if (!(dc->w.hMetaFile = GlobalAlloc16(GMEM_MOVEABLE, sizeof(METAHEADER)))) { - GDI_FreeObject(handle); - return 0; - } - if (!(dc->w.hHT = GlobalAlloc16(GMEM_MOVEABLE | GMEM_ZEROINIT, - sizeof(HANDLETABLE16) * HTINCR))) { - GlobalFree16(dc->w.hMetaFile); - GDI_FreeObject(handle); - return 0; - } - dc->w.HTLen = HTINCR; - dc->w.bitsPerPixel = screenDepth; - mh = (METAHEADER *)GlobalLock16(dc->w.hMetaFile); - - mh->mtHeaderSize = MFHEADERSIZE / 2; - mh->mtVersion = MFVERSION; - mh->mtSize = MFHEADERSIZE / 2; - mh->mtNoObjects = 0; - mh->mtMaxRecord = 0; - mh->mtNoParameters = 0; - - if (lpFilename) /* disk based metafile */ - { - mh->mtType = 1; /* disk */ - hFile = _lcreat(lpFilename, 0); - if (_lwrite32(hFile, (char *)mh, MFHEADERSIZE) == -1) - { - GlobalFree16(dc->w.hHT); - GlobalFree16(dc->w.hMetaFile); - GDI_FreeObject(handle); - return 0; - } - mh->mtNoParameters = hFile; /* store file descriptor here */ - /* windows probably uses this too*/ - } - else /* memory based metafile */ - mh->mtType = 0; - - GlobalUnlock16(dc->w.hMetaFile); - dprintf_metafile(stddeb,"CreateMetaFile: returning %04x\n", handle); - return handle; -} /****************************************************************** * CopyMetafile GDI.151 Niels de Carpentier, April 1996 @@ -204,6 +179,7 @@ BOOL IsValidMetaFile(HMETAFILE16 hmf) } +#if 0 /****************************************************************** * CloseMetafile GDI.126 */ @@ -214,15 +190,14 @@ HMETAFILE16 CloseMetaFile(HDC hdc) METAHEADER *mh; HMETAFILE16 hmf; HFILE hFile; + METAFILEDRV_PDEVICE *physDev; dprintf_metafile(stddeb,"CloseMetaFile\n"); - dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC); - - if (!dc) - return 0; - - mh = (METAHEADER *)GlobalLock16(dc->w.hMetaFile); + if (!(dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC))) return 0; + + physDev = (METAFILEDRV_PDEVICE *)dc->physDev; + mh = (METAHEADER *)GlobalLock16( physDev->hMetafile ); /* Construct the end of metafile record - this is documented * in SDK Knowledgebase Q99334. @@ -230,9 +205,7 @@ HMETAFILE16 CloseMetaFile(HDC hdc) if (!MF_MetaParam0(dc, META_EOF)) { - GlobalFree16(dc->w.hHT); - GlobalFree16(dc->w.hMetaFile); - GDI_FreeObject(hdc); + DeleteDC( hdc ); return 0; } @@ -242,25 +215,21 @@ HMETAFILE16 CloseMetaFile(HDC hdc) mh->mtNoParameters = 0; if (_llseek(hFile, 0L, 0) == -1) { - GlobalFree16(dc->w.hHT); - GlobalFree16(dc->w.hMetaFile); - GDI_FreeObject(hdc); + DeleteDC( hdc ); return 0; } if (_lwrite32(hFile, (char *)mh, MFHEADERSIZE) == -1) { - GlobalFree16(dc->w.hHT); - GlobalFree16(dc->w.hMetaFile); - GDI_FreeObject(hdc); + DeleteDC( hdc ); return 0; } _lclose(hFile); } - GlobalFree16(dc->w.hHT); - hmf = dc->w.hMetaFile; - GlobalUnlock16(hmf); - GDI_FreeObject(hdc); + hmf = physDev->hMetafile; + GlobalUnlock16( hmf ); + physDev->hMetafile = 0; /* So it won't be deleted */ + DeleteDC( hdc ); return hmf; } @@ -279,7 +248,7 @@ BOOL DeleteMetaFile(HMETAFILE16 hmf) GlobalFree16(hmf); return TRUE; } - +#endif /****************************************************************** * PlayMetafile GDI.123 @@ -418,7 +387,7 @@ void PlayMetaFileRecord(HDC hdc, HANDLETABLE16 *ht, METARECORD *mr, WORD nHandles) { short s1; - HANDLE hndl; + HANDLE16 hndl; char *ptr; BITMAPINFOHEADER *infohdr; @@ -774,7 +743,7 @@ void PlayMetaFileRecord(HDC hdc, HANDLETABLE16 *ht, METARECORD *mr, * Trade in a meta file object handle for a handle to the meta file memory */ -HANDLE GetMetaFileBits(HMETAFILE16 hmf) +HGLOBAL16 GetMetaFileBits(HMETAFILE16 hmf) { dprintf_metafile(stddeb,"GetMetaFileBits: hMem out: %04x\n", hmf); @@ -787,7 +756,7 @@ HANDLE GetMetaFileBits(HMETAFILE16 hmf) * Trade in a meta file memory handle for a handle to a meta file object */ -HMETAFILE16 SetMetaFileBits(HANDLE hMem) +HMETAFILE16 SetMetaFileBits( HGLOBAL16 hMem ) { dprintf_metafile(stddeb,"SetMetaFileBits: hmf out: %04x\n", hMem); @@ -796,88 +765,38 @@ HMETAFILE16 SetMetaFileBits(HANDLE hMem) /****************************************************************** * MF_WriteRecord + * + * Warning: this function can change the metafile handle. */ -HMETAFILE16 MF_WriteRecord(HMETAFILE16 hmf, METARECORD *mr, WORD rlen) +static BOOL32 MF_WriteRecord( DC *dc, METARECORD *mr, WORD rlen) { DWORD len; - METAHEADER *mh = (METAHEADER *)GlobalLock16(hmf); - - if (mh->mtType == 0) /* memory based metafile */ + METAHEADER *mh; + METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dc->physDev; + + switch(physDev->mh->mtType) { - len = mh->mtSize * 2 + rlen; - GlobalUnlock16(hmf); - hmf = GlobalReAlloc16(hmf, len, GMEM_MOVEABLE); /* hmf can change */ - mh = (METAHEADER *)GlobalLock16(hmf); - memcpy((WORD *)mh + mh->mtSize, mr, rlen); - } - else if (mh->mtType == 1) /* disk based metafile */ - { - dprintf_metafile(stddeb,"Writing record to disk\n"); - if (_lwrite32(mh->mtNoParameters, (char *)mr, rlen) == -1) - { - GlobalUnlock16(hmf); - return 0; - } - } - else - { - GlobalUnlock16(hmf); - return 0; + case METAFILE_MEMORY: + len = physDev->mh->mtSize * 2 + rlen; + mh = HeapReAlloc( SystemHeap, 0, physDev->mh, len ); + if (!mh) return FALSE; + physDev->mh = mh; + memcpy((WORD *)physDev->mh + physDev->mh->mtSize, mr, rlen); + break; + case METAFILE_DISK: + dprintf_metafile(stddeb,"Writing record to disk\n"); + if (_lwrite32(physDev->mh->mtNoParameters, (char *)mr, rlen) == -1) + return FALSE; + break; + default: + fprintf( stderr, "Uknown metafile type %d\n", physDev->mh->mtType ); + return FALSE; } - mh->mtSize += rlen / 2; - mh->mtMaxRecord = MAX(mh->mtMaxRecord, rlen / 2); - GlobalUnlock16(hmf); - return hmf; -} - - -/****************************************************************** - * MF_AddHandle - * - * Add a handle to an external handle table and return the index - */ - -int MF_AddHandle(HANDLETABLE16 *ht, WORD htlen, HANDLE hobj) -{ - int i; - - for (i = 0; i < htlen; i++) - { - if (*(ht->objectHandle + i) == 0) - { - *(ht->objectHandle + i) = hobj; - return i; - } - } - return -1; -} - - -/****************************************************************** - * MF_AddHandleDC - * - * Add a handle to the handle table in the DC, growing table if - * necessary. Return the index - */ - -int MF_AddHandleDC(DC *dc, HANDLE hobj) -{ - int i; - HANDLETABLE16 *ht = (HANDLETABLE16 *)GlobalLock16(dc->w.hHT); - - if((i = MF_AddHandle(ht, dc->w.HTLen, hobj)) == -1) { - GlobalUnlock16(dc->w.hHT); - if(!(dc->w.hHT = GlobalReAlloc16(dc->w.hHT, (dc->w.HTLen + HTINCR) * - sizeof(HANDLETABLE16), GMEM_MOVEABLE | GMEM_ZEROINIT))) - return -1; - dc->w.HTLen += HTINCR; - ht = (HANDLETABLE16 *)GlobalLock16(dc->w.hHT); - i = MF_AddHandle(ht, dc->w.HTLen, hobj); - } - GlobalUnlock16(dc->w.hHT); - return i; + physDev->mh->mtSize += rlen / 2; + physDev->mh->mtMaxRecord = MAX(physDev->mh->mtMaxRecord, rlen / 2); + return TRUE; } @@ -885,57 +804,45 @@ int MF_AddHandleDC(DC *dc, HANDLE hobj) * MF_MetaParam0 */ -BOOL MF_MetaParam0(DC *dc, short func) +BOOL32 MF_MetaParam0(DC *dc, short func) { char buffer[8]; METARECORD *mr = (METARECORD *)&buffer; - HMETAFILE16 handle; mr->rdSize = 3; mr->rdFunction = func; - handle = MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2); - dc->w.hMetaFile = handle; - - return handle; + return MF_WriteRecord( dc, mr, mr->rdSize * 2); } /****************************************************************** * MF_MetaParam1 */ -BOOL MF_MetaParam1(DC *dc, short func, short param1) +BOOL32 MF_MetaParam1(DC *dc, short func, short param1) { char buffer[8]; METARECORD *mr = (METARECORD *)&buffer; - HMETAFILE16 handle; mr->rdSize = 4; mr->rdFunction = func; *(mr->rdParam) = param1; - handle = MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2); - dc->w.hMetaFile = handle; - - return handle; + return MF_WriteRecord( dc, mr, mr->rdSize * 2); } /****************************************************************** * MF_MetaParam2 */ -BOOL MF_MetaParam2(DC *dc, short func, short param1, short param2) +BOOL32 MF_MetaParam2(DC *dc, short func, short param1, short param2) { char buffer[10]; METARECORD *mr = (METARECORD *)&buffer; - HMETAFILE16 handle; mr->rdSize = 5; mr->rdFunction = func; *(mr->rdParam) = param2; *(mr->rdParam + 1) = param1; - handle = MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2); - dc->w.hMetaFile = handle; - - return handle; + return MF_WriteRecord( dc, mr, mr->rdSize * 2); } @@ -943,12 +850,11 @@ BOOL MF_MetaParam2(DC *dc, short func, short param1, short param2) * MF_MetaParam4 */ -BOOL MF_MetaParam4(DC *dc, short func, short param1, short param2, +BOOL32 MF_MetaParam4(DC *dc, short func, short param1, short param2, short param3, short param4) { char buffer[14]; METARECORD *mr = (METARECORD *)&buffer; - HMETAFILE16 handle; mr->rdSize = 7; mr->rdFunction = func; @@ -956,10 +862,7 @@ BOOL MF_MetaParam4(DC *dc, short func, short param1, short param2, *(mr->rdParam + 1) = param3; *(mr->rdParam + 2) = param2; *(mr->rdParam + 3) = param1; - handle = MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2); - dc->w.hMetaFile = handle; - - return handle; + return MF_WriteRecord( dc, mr, mr->rdSize * 2); } @@ -967,12 +870,11 @@ BOOL MF_MetaParam4(DC *dc, short func, short param1, short param2, * MF_MetaParam6 */ -BOOL MF_MetaParam6(DC *dc, short func, short param1, short param2, +BOOL32 MF_MetaParam6(DC *dc, short func, short param1, short param2, short param3, short param4, short param5, short param6) { char buffer[18]; METARECORD *mr = (METARECORD *)&buffer; - HMETAFILE16 handle; mr->rdSize = 9; mr->rdFunction = func; @@ -982,23 +884,19 @@ BOOL MF_MetaParam6(DC *dc, short func, short param1, short param2, *(mr->rdParam + 3) = param3; *(mr->rdParam + 4) = param2; *(mr->rdParam + 5) = param1; - handle = MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2); - dc->w.hMetaFile = handle; - - return handle; + return MF_WriteRecord( dc, mr, mr->rdSize * 2); } /****************************************************************** * MF_MetaParam8 */ -BOOL MF_MetaParam8(DC *dc, short func, short param1, short param2, +BOOL32 MF_MetaParam8(DC *dc, short func, short param1, short param2, short param3, short param4, short param5, short param6, short param7, short param8) { char buffer[22]; METARECORD *mr = (METARECORD *)&buffer; - HMETAFILE16 handle; mr->rdSize = 11; mr->rdFunction = func; @@ -1010,10 +908,7 @@ BOOL MF_MetaParam8(DC *dc, short func, short param1, short param2, *(mr->rdParam + 5) = param3; *(mr->rdParam + 6) = param2; *(mr->rdParam + 7) = param1; - handle = MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2); - dc->w.hMetaFile = handle; - - return handle; + return MF_WriteRecord( dc, mr, mr->rdSize * 2); } @@ -1021,37 +916,23 @@ BOOL MF_MetaParam8(DC *dc, short func, short param1, short param2, * MF_CreateBrushIndirect */ -BOOL MF_CreateBrushIndirect(DC *dc, HBRUSH hBrush, LOGBRUSH16 *logbrush) +BOOL32 MF_CreateBrushIndirect(DC *dc, HBRUSH16 hBrush, LOGBRUSH16 *logbrush) { int index; - HMETAFILE16 handle; char buffer[sizeof(METARECORD) - 2 + sizeof(LOGBRUSH16)]; METARECORD *mr = (METARECORD *)&buffer; - METAHEADER *mh; mr->rdSize = (sizeof(METARECORD) + sizeof(LOGBRUSH16) - 2) / 2; mr->rdFunction = META_CREATEBRUSHINDIRECT; memcpy(&(mr->rdParam), logbrush, sizeof(LOGBRUSH16)); - if (!(dc->w.hMetaFile = MF_WriteRecord(dc->w.hMetaFile, - mr, mr->rdSize * 2))) - return FALSE; + if (!(MF_WriteRecord( dc, mr, mr->rdSize * 2))) return FALSE; mr->rdSize = sizeof(METARECORD) / 2; mr->rdFunction = META_SELECTOBJECT; - if ((index = MF_AddHandleDC(dc, hBrush)) == -1) - return FALSE; - - mh = (METAHEADER *)GlobalLock16(dc->w.hMetaFile); + if ((index = MF_AddHandleDC( dc )) == -1) return FALSE; *(mr->rdParam) = index; - if (index >= mh->mtNoObjects) - mh->mtNoObjects++; - - GlobalUnlock16(dc->w.hMetaFile); - handle = MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2); - dc->w.hMetaFile = handle; - - return handle; + return MF_WriteRecord( dc, mr, mr->rdSize * 2); } @@ -1059,23 +940,21 @@ BOOL MF_CreateBrushIndirect(DC *dc, HBRUSH hBrush, LOGBRUSH16 *logbrush) * MF_CreatePatternBrush */ -BOOL MF_CreatePatternBrush(DC *dc, HBRUSH hBrush, LOGBRUSH16 *logbrush) +BOOL32 MF_CreatePatternBrush(DC *dc, HBRUSH16 hBrush, LOGBRUSH16 *logbrush) { DWORD len, bmSize, biSize; - HANDLE hmr; + HGLOBAL16 hmr; METARECORD *mr; BITMAPOBJ *bmp; BITMAPINFO *info; BITMAPINFOHEADER *infohdr; int index; - HMETAFILE16 handle; char buffer[sizeof(METARECORD)]; - METAHEADER *mh; switch (logbrush->lbStyle) { case BS_PATTERN: - bmp = (BITMAPOBJ *)GDI_GetObjPtr((HANDLE)logbrush->lbHatch, BITMAP_MAGIC); + bmp = (BITMAPOBJ *)GDI_GetObjPtr((HGDIOBJ16)logbrush->lbHatch, BITMAP_MAGIC); if (!bmp) return FALSE; len = sizeof(METARECORD) + sizeof(BITMAPINFOHEADER) + (bmp->bitmap.bmHeight * bmp->bitmap.bmWidthBytes) + 6; @@ -1099,7 +978,7 @@ BOOL MF_CreatePatternBrush(DC *dc, HBRUSH hBrush, LOGBRUSH16 *logbrush) break; case BS_DIBPATTERN: - info = (BITMAPINFO *)GlobalLock16((HANDLE)logbrush->lbHatch); + info = (BITMAPINFO *)GlobalLock16((HGLOBAL16)logbrush->lbHatch); if (info->bmiHeader.biCompression) bmSize = info->bmiHeader.biSizeImage; else @@ -1120,7 +999,7 @@ BOOL MF_CreatePatternBrush(DC *dc, HBRUSH hBrush, LOGBRUSH16 *logbrush) default: return FALSE; } - if (!(dc->w.hMetaFile = MF_WriteRecord(dc->w.hMetaFile, mr, len))) + if (!(MF_WriteRecord(dc, mr, len))) { GlobalFree16(hmr); return FALSE; @@ -1131,18 +1010,10 @@ BOOL MF_CreatePatternBrush(DC *dc, HBRUSH hBrush, LOGBRUSH16 *logbrush) mr = (METARECORD *)&buffer; mr->rdSize = sizeof(METARECORD) / 2; mr->rdFunction = META_SELECTOBJECT; - if ((index = MF_AddHandleDC(dc, hBrush)) == -1) - return FALSE; - mh = (METAHEADER *)GlobalLock16(dc->w.hMetaFile); + if ((index = MF_AddHandleDC( dc )) == -1) return FALSE; *(mr->rdParam) = index; - if (index >= mh->mtNoObjects) - mh->mtNoObjects++; - GlobalUnlock16(dc->w.hMetaFile); - handle = MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2); - dc->w.hMetaFile = handle; - - return handle; + return MF_WriteRecord( dc, mr, mr->rdSize * 2); } @@ -1150,36 +1021,23 @@ BOOL MF_CreatePatternBrush(DC *dc, HBRUSH hBrush, LOGBRUSH16 *logbrush) * MF_CreatePenIndirect */ -BOOL MF_CreatePenIndirect(DC *dc, HPEN16 hPen, LOGPEN16 *logpen) +BOOL32 MF_CreatePenIndirect(DC *dc, HPEN16 hPen, LOGPEN16 *logpen) { int index; - HMETAFILE16 handle; char buffer[sizeof(METARECORD) - 2 + sizeof(LOGPEN16)]; METARECORD *mr = (METARECORD *)&buffer; - METAHEADER *mh; mr->rdSize = (sizeof(METARECORD) + sizeof(LOGPEN16) - 2) / 2; mr->rdFunction = META_CREATEPENINDIRECT; memcpy(&(mr->rdParam), logpen, sizeof(LOGPEN16)); - if (!(dc->w.hMetaFile = MF_WriteRecord(dc->w.hMetaFile, mr, - mr->rdSize * 2))) - return FALSE; + if (!(MF_WriteRecord( dc, mr, mr->rdSize * 2))) return FALSE; mr->rdSize = sizeof(METARECORD) / 2; mr->rdFunction = META_SELECTOBJECT; - if ((index = MF_AddHandleDC(dc, hPen)) == -1) - return FALSE; - - mh = (METAHEADER *)GlobalLock16(dc->w.hMetaFile); + if ((index = MF_AddHandleDC( dc )) == -1) return FALSE; *(mr->rdParam) = index; - if (index >= mh->mtNoObjects) - mh->mtNoObjects++; - GlobalUnlock16(dc->w.hMetaFile); - handle = MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2); - dc->w.hMetaFile = handle; - - return handle; + return MF_WriteRecord( dc, mr, mr->rdSize * 2); } @@ -1187,47 +1045,34 @@ BOOL MF_CreatePenIndirect(DC *dc, HPEN16 hPen, LOGPEN16 *logpen) * MF_CreateFontIndirect */ -BOOL MF_CreateFontIndirect(DC *dc, HFONT hFont, LOGFONT16 *logfont) +BOOL32 MF_CreateFontIndirect(DC *dc, HFONT16 hFont, LOGFONT16 *logfont) { int index; - HMETAFILE16 handle; char buffer[sizeof(METARECORD) - 2 + sizeof(LOGFONT16)]; METARECORD *mr = (METARECORD *)&buffer; - METAHEADER *mh; mr->rdSize = (sizeof(METARECORD) + sizeof(LOGFONT16) - 2) / 2; mr->rdFunction = META_CREATEFONTINDIRECT; memcpy(&(mr->rdParam), logfont, sizeof(LOGFONT16)); - if (!(dc->w.hMetaFile = MF_WriteRecord(dc->w.hMetaFile, mr, - mr->rdSize * 2))) - return FALSE; + if (!(MF_WriteRecord( dc, mr, mr->rdSize * 2))) return FALSE; mr->rdSize = sizeof(METARECORD) / 2; mr->rdFunction = META_SELECTOBJECT; - if ((index = MF_AddHandleDC(dc, hFont)) == -1) - return FALSE; - - mh = (METAHEADER *)GlobalLock16(dc->w.hMetaFile); + if ((index = MF_AddHandleDC( dc )) == -1) return FALSE; *(mr->rdParam) = index; - if (index >= mh->mtNoObjects) - mh->mtNoObjects++; - GlobalUnlock16(dc->w.hMetaFile); - handle = MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2); - dc->w.hMetaFile = handle; - - return handle; + return MF_WriteRecord( dc, mr, mr->rdSize * 2); } /****************************************************************** * MF_TextOut */ -BOOL MF_TextOut(DC *dc, short x, short y, LPCSTR str, short count) +BOOL32 MF_TextOut(DC *dc, short x, short y, LPCSTR str, short count) { - HMETAFILE16 handle; + BOOL32 ret; DWORD len; - HANDLE hmr; + HGLOBAL16 hmr; METARECORD *mr; len = sizeof(METARECORD) + (((count + 1) >> 1) * 2) + 4; @@ -1242,21 +1087,20 @@ BOOL MF_TextOut(DC *dc, short x, short y, LPCSTR str, short count) memcpy(mr->rdParam + 1, str, count); *(mr->rdParam + ((count + 1) >> 1) + 1) = y; *(mr->rdParam + ((count + 1) >> 1) + 2) = x; - handle = MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2); - dc->w.hMetaFile = handle; + ret = MF_WriteRecord( dc, mr, mr->rdSize * 2); GlobalFree16(hmr); - return handle; + return ret; } /****************************************************************** * MF_ExtTextOut */ -BOOL MF_ExtTextOut(DC *dc, short x, short y, UINT16 flags, const RECT16 *rect, - LPCSTR str, short count, const INT16 *lpDx) +BOOL32 MF_ExtTextOut(DC*dc, short x, short y, UINT16 flags, const RECT16 *rect, + LPCSTR str, short count, const INT16 *lpDx) { - HMETAFILE16 handle; + BOOL32 ret; DWORD len; - HANDLE hmr; + HGLOBAL16 hmr; METARECORD *mr; len = sizeof(METARECORD) + (((count + 1) >> 1) * 2) + 2 * sizeof(short) @@ -1278,20 +1122,19 @@ BOOL MF_ExtTextOut(DC *dc, short x, short y, UINT16 flags, const RECT16 *rect, memcpy(mr->rdParam + 8, str, count); if (lpDx) memcpy(mr->rdParam + 8+ ((count + 1) >> 1),lpDx,count*sizeof(INT16)); - handle = MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2); - dc->w.hMetaFile = handle; + ret = MF_WriteRecord( dc, mr, mr->rdSize * 2); GlobalFree16(hmr); - return handle; + return ret; } /****************************************************************** * MF_MetaPoly - implements Polygon and Polyline */ -BOOL MF_MetaPoly(DC *dc, short func, LPPOINT16 pt, short count) +BOOL32 MF_MetaPoly(DC *dc, short func, LPPOINT16 pt, short count) { - HMETAFILE16 handle; + BOOL32 ret; DWORD len; - HANDLE hmr; + HGLOBAL16 hmr; METARECORD *mr; len = sizeof(METARECORD) + (count * 4); @@ -1304,22 +1147,21 @@ BOOL MF_MetaPoly(DC *dc, short func, LPPOINT16 pt, short count) mr->rdFunction = func; *(mr->rdParam) = count; memcpy(mr->rdParam + 1, pt, count * 4); - handle = MF_WriteRecord(dc->w.hMetaFile, mr, mr->rdSize * 2); - dc->w.hMetaFile = handle; + ret = MF_WriteRecord( dc, mr, mr->rdSize * 2); GlobalFree16(hmr); - return handle; + return ret; } /****************************************************************** * MF_BitBlt */ -BOOL MF_BitBlt(DC *dcDest, short xDest, short yDest, short width, - short height, HDC hdcSrc, short xSrc, short ySrc, DWORD rop) +BOOL32 MF_BitBlt(DC *dcDest, short xDest, short yDest, short width, + short height, HDC16 hdcSrc, short xSrc, short ySrc, DWORD rop) { - HMETAFILE16 handle; + BOOL32 ret; DWORD len; - HANDLE hmr; + HGLOBAL16 hmr; METARECORD *mr; DC *dcSrc; BITMAP16 BM; @@ -1347,13 +1189,12 @@ BOOL MF_BitBlt(DC *dcDest, short xDest, short yDest, short width, *(mr->rdParam + 4) = width; *(mr->rdParam + 5) = yDest; *(mr->rdParam + 6) = xDest; - handle = MF_WriteRecord(dcDest->w.hMetaFile, mr, mr->rdSize * 2); + ret = MF_WriteRecord( dcDest, mr, mr->rdSize * 2); } else - handle = 0; - dcDest->w.hMetaFile = handle; + ret = FALSE; GlobalFree16(hmr); - return handle; + return ret; } @@ -1365,13 +1206,13 @@ BOOL MF_BitBlt(DC *dcDest, short xDest, short yDest, short width, */ #define STRETCH_VIA_DIB #undef STRETCH_VIA_DIB -BOOL MF_StretchBlt(DC *dcDest, short xDest, short yDest, short widthDest, - short heightDest, HDC hdcSrc, short xSrc, short ySrc, - short widthSrc, short heightSrc, DWORD rop) +BOOL32 MF_StretchBlt(DC *dcDest, short xDest, short yDest, short widthDest, + short heightDest, HDC16 hdcSrc, short xSrc, short ySrc, + short widthSrc, short heightSrc, DWORD rop) { - HMETAFILE16 handle; + BOOL32 ret; DWORD len; - HANDLE hmr; + HGLOBAL16 hmr; METARECORD *mr; DC *dcSrc; BITMAP16 BM; @@ -1434,13 +1275,12 @@ BOOL MF_StretchBlt(DC *dcDest, short xDest, short yDest, short widthDest, *(mr->rdParam + 7) = widthDest; *(mr->rdParam + 8) = yDest; *(mr->rdParam + 9) = xDest; - handle = MF_WriteRecord(dcDest->w.hMetaFile, mr, mr->rdSize * 2); + ret = MF_WriteRecord( dcDest, mr, mr->rdSize * 2); } else - handle = 0; - dcDest->w.hMetaFile = handle; + ret = FALSE; GlobalFree16(hmr); - return handle; + return ret; } diff --git a/objects/text.c b/objects/text.c index 3d7eb81842f..acf51de951b 100644 --- a/objects/text.c +++ b/objects/text.c @@ -325,7 +325,7 @@ BOOL16 ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags, const RECT16 *lprect, LPCSTR str, UINT16 count, const INT16 *lpDx ) { - HRGN hRgnClip = 0; + HRGN32 hRgnClip = 0; int dir, ascent, descent, i; XCharStruct info; XFontStruct *font; @@ -638,7 +638,7 @@ BOOL32 TextOut32W( HDC32 hdc, INT32 x, INT32 y, LPCWSTR str, INT32 count ) /*********************************************************************** * GrayString (USER.185) */ -BOOL GrayString(HDC hdc, HBRUSH hbr, GRAYSTRINGPROC16 gsprc, LPARAM lParam, +BOOL GrayString(HDC hdc, HBRUSH16 hbr, GRAYSTRINGPROC16 gsprc, LPARAM lParam, INT cch, INT x, INT y, INT cx, INT cy) { BOOL ret; diff --git a/programs/progman/Makefile.in b/programs/progman/Makefile.in index c3194796fdf..fcc846b5755 100644 --- a/programs/progman/Makefile.in +++ b/programs/progman/Makefile.in @@ -1,7 +1,11 @@ -TOPSRC = @top_srcdir@ -MODULE = none -PROGRAMS = progman -ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LDLIBS) +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = none +PROGRAMS = progman +ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LDLIBS) +DEFS = -I$(SRCDIR) LANGUAGES = En De Fr Fi LICENSELANG = En @@ -19,27 +23,32 @@ sysconfdir = @sysconfdir@ mandir = @mandir@/man1 manext = .1 -MOSTOBJS = \ - dialog.o \ - group.o \ - grpfile.o \ - license.o \ - main.o \ - program.o +MOSTSRCS = \ + dialog.c \ + group.c \ + grpfile.c \ + license.c \ + main.c \ + program.c -STRINGOBJS = \ - accel.o \ - string.o \ - $(LANGUAGES:%=%.o) \ - $(LICENSELANG:%=License_%.o) +# Some strings need addresses >= 0x10000 +STRINGSRCS = \ + string.c \ + $(LICENSELANG:%=License_%.c) -C_SRCS = $(MOSTOBJS:.o=.c) $(STRINGOBJS:.o=.c) +GEN_C_SRCS = \ + accel.c \ + $(LANGUAGES:%=%.c) \ + +C_SRCS = $(MOSTSRCS) $(STRINGSRCS) + +MOSTOBJS = $(MOSTSRCS:.c=.o) +STRINGOBJS = $(STRINGSRCS:.c=.o) $(GEN_C_SRCS:.c=.o) all: check_winerc $(PROGRAMS) @MAKE_RULES@ -# Some strings need addresses >= 0x10000 progman: $(MOSTOBJS) $(STRINGOBJS) $(CC) -o progman $(MOSTOBJS) $(LDOPTIONS) $(ALL_LIBS) $(STRINGOBJS) @@ -50,6 +59,7 @@ clean:: $(RM) accel.c accel.h $(LANGUAGES:%=%.c) $(LANGUAGES:%=%.h) progman accel.c accel.h: $(WINERC) Xx.rc + $(LANGUAGES:%=%.c) $(LANGUAGES:%=%.h): $(WINERC) Xx.rc dummy: diff --git a/programs/winhelp/Makefile.in b/programs/winhelp/Makefile.in index 219e42e72a6..f13bf666c9a 100644 --- a/programs/winhelp/Makefile.in +++ b/programs/winhelp/Makefile.in @@ -1,7 +1,10 @@ -TOPSRC = @top_srcdir@ -MODULE = none -PROGRAMS = winhelp hlp2sgml -ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LDLIBS) +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = none +PROGRAMS = winhelp hlp2sgml +ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LDLIBS) LANGUAGES = En De Fr Fi @@ -18,18 +21,24 @@ sysconfdir = @sysconfdir@ mandir = @mandir@/man1 manext = .1 -MOSTOBJS = \ - winhelp.o \ - hlpfile.o \ - macro.o \ - y.tab.o \ - lex.yy.o +MOSTSRCS = \ + winhelp.c \ + hlpfile.c \ + macro.c -STRINGOBJS = \ - string.o \ - $(LANGUAGES:%=%.o) +# Some strings need addresses >= 0x10000 +STRINGSRCS = \ + string.c -C_SRCS = $(MOSTOBJS:.o=.c) $(STRINGOBJS:.o=.c) hlp2sgml.c +GEN_C_SRCS = \ + y.tab.c \ + lex.yy.c \ + $(LANGUAGES:%=%.c) + +C_SRCS = $(MOSTSRCS) $(STRINGSRCS) + +MOSTOBJS = $(MOSTSRCS:.c=.o) +STRINGOBJS = $(STRINGSRCS:.c=.o) $(GEN_C_SRCS:.c=.o) all: check_winerc $(PROGRAMS) @@ -51,10 +60,10 @@ clean:: $(RM) $(LANGUAGES:%=%.c) $(LANGUAGES:%=%.h) y.tab.c y.tab.h: macro.yacc.y - $(YACC) -d -t macro.yacc.y + $(YACC) -d -t $(SRCDIR)/macro.yacc.y lex.yy.c: macro.lex.l - $(LEX) -8 -i macro.lex.l + $(LEX) -8 -i $(SRCDIR)/macro.lex.l $(LANGUAGES:%=%.c) $(LANGUAGES:%=%.h): $(WINERC) Xx.rc diff --git a/rc/Makefile.in b/rc/Makefile.in index d5e9e155f76..81dd34ba3cc 100644 --- a/rc/Makefile.in +++ b/rc/Makefile.in @@ -1,10 +1,13 @@ -DEFS = -D__WINE__ -DNO_TRANSITION_TYPES -TOPSRC = @top_srcdir@ +DEFS = -D__WINE__ -DNO_TRANSITION_TYPES +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = .. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +PROGRAM = winerc +MODULE = none -PROGRAM = winerc -MODULE = none - -C_SRCS = y.tab.c lex.yy.c winerc.c +C_SRCS = winerc.c +GEN_C_SRCS = y.tab.c lex.yy.c all: $(PROGRAM) @@ -14,12 +17,12 @@ $(PROGRAM): $(OBJS) $(CC) $(CFLAGS) -o winerc $(OBJS) $(LEXLIB) y.tab.c y.tab.h: parser.y - $(YACC) -d -t parser.y + $(YACC) -d -t $(SRCDIR)/parser.y lex.yy.c: parser.l - $(LEX) -8 -I parser.l + $(LEX) -8 -I $(SRCDIR)/parser.l clean:: - $(RM) y.tab.c y.tab.h lex.yy.c $(PROGRAM) + $(RM) y.tab.h $(PROGRAM) ### Dependencies: diff --git a/resources/Makefile.in b/resources/Makefile.in index b972f818f88..5d3afd09b84 100644 --- a/resources/Makefile.in +++ b/resources/Makefile.in @@ -1,12 +1,16 @@ -DEFS = -D__WINE__ -DNO_TRANSITION_TYPES -TOPSRC = @top_srcdir@ -MODULE = resources +DEFS = -D__WINE__ -DNO_TRANSITION_TYPES +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = .. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = resources LANGUAGES = En Es De No Fr Fi Da Cz Eo It Ko SYSRES_SRCS = $(LANGUAGES:%=sysres_%.c) -C_SRCS = $(SYSRES_SRCS) sysres.c +C_SRCS = sysres.c +GEN_C_SRCS = $(SYSRES_SRCS) all: check_winerc $(MODULE).o @@ -15,6 +19,6 @@ all: check_winerc $(MODULE).o $(SYSRES_SRCS): $(WINERC) clean:: - $(RM) $(SYSRES_SRCS) $(SYSRES_SRCS:.c=.h) + $(RM) $(SYSRES_SRCS:.c=.h) ### Dependencies: diff --git a/tools/Makefile.in b/tools/Makefile.in index 303b5ec724c..ae76df151e9 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -1,5 +1,8 @@ -DEFS = -D__WINE__ -DNO_TRANSITION_TYPES -TOPSRC = @top_srcdir@ +DEFS = -D__WINE__ -DNO_TRANSITION_TYPES +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = .. +SRCDIR = @srcdir@ +VPATH = @srcdir@ PROGRAM = build MODULE = none diff --git a/win32/Makefile.in b/win32/Makefile.in index df4f9b6a891..e0c81624e00 100644 --- a/win32/Makefile.in +++ b/win32/Makefile.in @@ -1,6 +1,9 @@ -DEFS = -D__WINE__ -TOPSRC = @top_srcdir@ -MODULE = win32 +DEFS = -D__WINE__ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = .. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = win32 C_SRCS = \ advapi.c \ diff --git a/win32/cursoricon32.c b/win32/cursoricon32.c index fb8a226a29b..0fa03169f97 100644 --- a/win32/cursoricon32.c +++ b/win32/cursoricon32.c @@ -233,7 +233,7 @@ static CURSORDIRENTRY32 *CURSORICON32_FindBestCursor( CURSORICONDIR32 *dir, * Load the icon/cursor directory for a given resource name and find the * best matching entry. */ -static BOOL CURSORICON32_LoadDirEntry(HANDLE hInstance, LPCWSTR name, +static BOOL CURSORICON32_LoadDirEntry(HINSTANCE32 hInstance, LPCWSTR name, int width, int height, int colors, BOOL fCursor, CURSORICONDIRENTRY32 *dirEntry) { @@ -266,10 +266,12 @@ static BOOL CURSORICON32_LoadDirEntry(HANDLE hInstance, LPCWSTR name, * * Create a cursor or icon from a resource. */ -static HANDLE CURSORICON32_LoadHandler( HANDLE32 handle, HINSTANCE hInstance, - BOOL fCursor ) +static HGLOBAL32 CURSORICON32_LoadHandler( HANDLE32 handle, + HINSTANCE32 hInstance, + BOOL32 fCursor ) { - HANDLE hAndBits, hXorBits, hRes; + HBITMAP32 hAndBits, hXorBits; + HGLOBAL32 hRes; HDC32 hdc; int size, sizeAnd, sizeXor; POINT16 hotspot = { 0 ,0 }; @@ -402,12 +404,13 @@ static HANDLE CURSORICON32_LoadHandler( HANDLE32 handle, HINSTANCE hInstance, * * Load a cursor or icon. */ -static HANDLE CURSORICON32_Load( HANDLE hInstance, LPCWSTR name, int width, - int height, int colors, BOOL fCursor ) +static HGLOBAL32 CURSORICON32_Load( HINSTANCE32 hInstance, LPCWSTR name, + int width, int height, int colors, + BOOL fCursor ) { HANDLE32 handle; - HANDLE hRet; - HANDLE32 hRsrc; + HANDLE32 hRet; + HANDLE32 hRsrc; CURSORICONDIRENTRY32 dirEntry; if(!hInstance) /* OEM cursor/icon */ diff --git a/win32/environment.c b/win32/environment.c index 85d4083754a..248076569f9 100644 --- a/win32/environment.c +++ b/win32/environment.c @@ -51,7 +51,7 @@ LPCWSTR GetCommandLine32W(void) /*********************************************************************** * GetSystemPowerStatus (KERNEL32.621) */ -BOOL GetSystemPowerStatus(LPSYSTEM_POWER_STATUS sps_ptr) +BOOL32 GetSystemPowerStatus(LPSYSTEM_POWER_STATUS sps_ptr) { return FALSE; /* no power management support */ } @@ -60,7 +60,7 @@ BOOL GetSystemPowerStatus(LPSYSTEM_POWER_STATUS sps_ptr) /*********************************************************************** * SetSystemPowerState (KERNEL32.630) */ -BOOL SetSystemPowerState(BOOL suspend_or_hibernate, BOOL force_flag) +BOOL32 SetSystemPowerState(BOOL32 suspend_or_hibernate, BOOL32 force_flag) { /* suspend_or_hibernate flag: w95 does not support this feature anyway */ diff --git a/win32/init.c b/win32/init.c index e5e5af7c679..5fa1b3a63e8 100644 --- a/win32/init.c +++ b/win32/init.c @@ -94,9 +94,9 @@ VOID GetStartupInfoA(LPSTARTUPINFO lpStartupInfo) lpStartupInfo->cbReserved2 = 0; lpStartupInfo->lpReserved2 = NULL; /* must be NULL for VC runtime */ - lpStartupInfo->hStdInput = (HANDLE)0; - lpStartupInfo->hStdOutput = (HANDLE)1; - lpStartupInfo->hStdError = (HANDLE)2; + lpStartupInfo->hStdInput = (HANDLE32)0; + lpStartupInfo->hStdOutput = (HANDLE32)1; + lpStartupInfo->hStdError = (HANDLE32)2; } /* Initialize whatever internal data structures we need. diff --git a/win32/newfns.c b/win32/newfns.c index b114cdd0a39..e9de49a6c97 100644 --- a/win32/newfns.c +++ b/win32/newfns.c @@ -23,17 +23,17 @@ BOOL WIN32_WinHelpA(HWND hWnd,LPCSTR lpszHelp,UINT uCommand, DWORD dwData) return WinHelp(hWnd,lpszHelp,uCommand,dwData); } -HHOOK SetWindowsHookEx32A(int HookId, HOOKPROC32 hookfn, HINSTANCE hModule, +HHOOK SetWindowsHookEx32A(INT32 id, HOOKPROC32 hookfn, HINSTANCE32 hModule, DWORD ThreadId) { /* Stub for now */ - fprintf(stdnimp, "SetWindowsHookEx32A Stub called! (hook Id %d)\n", HookId); + fprintf(stdnimp, "SetWindowsHookEx32A Stub called! (hook Id %d)\n",id); return (HHOOK) NULL; } -HHOOK SetWindowsHook32A(int HookId, HOOKPROC32 hookfn) +HHOOK SetWindowsHook32A(INT32 HookId, HOOKPROC32 hookfn) { /* Stub for now */ fprintf(stdnimp, "SetWindowsHook32A Stub called! (hook Id %d)\n", HookId); @@ -41,7 +41,7 @@ HHOOK SetWindowsHook32A(int HookId, HOOKPROC32 hookfn) return (HHOOK) NULL; } -BOOL UnhookWindowsHookEx32(HHOOK hHook) +BOOL32 UnhookWindowsHookEx32(HHOOK hHook) { /* Stub for now */ diff --git a/win32/process.c b/win32/process.c index eb02e5442f7..30c23f45850 100644 --- a/win32/process.c +++ b/win32/process.c @@ -100,12 +100,12 @@ HANDLE32 GetProcessHeap(void) * copied from LoadLibrary * This does not currently support built-in libraries */ -HANDLE32 LoadLibraryA(char *libname) +HINSTANCE32 LoadLibraryA(char *libname) { - HANDLE handle; + HINSTANCE32 handle; dprintf_module( stddeb, "LoadLibrary: (%08x) %s\n", (int)libname, libname); handle = LoadModule( libname, (LPVOID)-1 ); - if (handle == (HANDLE) -1) + if (handle == (HINSTANCE32) -1) { char buffer[256]; strcpy( buffer, libname ); @@ -114,7 +114,7 @@ HANDLE32 LoadLibraryA(char *libname) } /* Obtain module handle and call initialization function */ #ifndef WINELIB - if (handle >= (HANDLE)32) PE_InitializeDLLs( GetExePtr(handle)); + if (handle >= (HINSTANCE32)32) PE_InitializeDLLs( GetExePtr(handle)); #endif return handle; } @@ -122,7 +122,7 @@ HANDLE32 LoadLibraryA(char *libname) /*********************************************************************** * FreeLibrary */ -BOOL FreeLibrary32(HINSTANCE hLibModule) +BOOL FreeLibrary32(HINSTANCE32 hLibModule) { fprintf(stderr,"FreeLibrary: empty stub\n"); return TRUE; diff --git a/win32/thread.c b/win32/thread.c index accc9f4b30f..1495f7c4563 100644 --- a/win32/thread.c +++ b/win32/thread.c @@ -26,14 +26,14 @@ int GetCurrentThreadId(void) /*********************************************************************** * GetThreadContext (KERNEL32.294) */ -BOOL GetThreadContext(HANDLE hThread, void *lpContext) +BOOL GetThreadContext(HANDLE32 hThread, void *lpContext) { return FALSE; } /*********************************************************************** * GetCurrentThread (KERNEL32.200) */ -HANDLE GetCurrentThread(void) +HANDLE32 GetCurrentThread(void) { return 0; } diff --git a/win32/time.c b/win32/time.c index 797cbe783c0..bfc26ef8bc8 100644 --- a/win32/time.c +++ b/win32/time.c @@ -63,7 +63,7 @@ VOID GetSystemTime(LPSYSTEMTIME systime) /*********************************************************************** * SetSystemTime (KERNEL32.507) */ -BOOL SetSystemTime(const SYSTEMTIME *systime) +BOOL32 SetSystemTime(const SYSTEMTIME *systime) { struct timeval tv; struct timezone tz; diff --git a/windows/Makefile.in b/windows/Makefile.in index af47d45db86..5b3343fba9f 100644 --- a/windows/Makefile.in +++ b/windows/Makefile.in @@ -1,6 +1,9 @@ -DEFS = -D__WINE__ -TOPSRC = @top_srcdir@ -MODULE = windows +DEFS = -D__WINE__ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = .. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = windows C_SRCS = \ caret.c \ diff --git a/windows/dce.c b/windows/dce.c index 7afa5f72a67..b9a0fb780ed 100644 --- a/windows/dce.c +++ b/windows/dce.c @@ -30,8 +30,6 @@ static DCE *firstDCE = 0; static HDC defaultDCstate = 0; -BOOL DCHook(HDC, WORD, DWORD, DWORD); - /*********************************************************************** * DCE_AllocDCE * @@ -49,7 +47,7 @@ DCE *DCE_AllocDCE( HWND32 hWnd, DCE_TYPE type ) /* store DCE handle in DC hook data field */ - SetDCHook(dce->hDC, GDI_GetDefDCHook(), (DWORD)dce); + SetDCHook( dce->hDC, (FARPROC16)DCHook, (DWORD)dce ); dce->hwndCurrent = hWnd; dce->hClipRgn = 0; @@ -85,7 +83,7 @@ void DCE_FreeDCE( DCE *dce ) while (*ppDCE && (*ppDCE != dce)) ppDCE = &(*ppDCE)->next; if (*ppDCE == dce) *ppDCE = dce->next; - SetDCHook(dce->hDC,(SEGPTR)NULL,0L); + SetDCHook(dce->hDC, NULL, 0L); DeleteDC( dce->hDC ); if( dce->hClipRgn && !(dce->DCXflags & DCX_KEEPCLIPRGN) ) @@ -238,10 +236,10 @@ static BOOL DCE_GetVisRect( WND *wndPtr, BOOL clientArea, RECT16 *lprect ) * is destroyed. Used to implement DCX_CLIPSIBLINGS and * DCX_CLIPCHILDREN styles. */ -static HRGN DCE_ClipWindows( WND *pWndStart, WND *pWndEnd, - HRGN hrgn, int xoffset, int yoffset ) +static HRGN32 DCE_ClipWindows( WND *pWndStart, WND *pWndEnd, + HRGN32 hrgn, int xoffset, int yoffset ) { - HRGN hrgnNew; + HRGN32 hrgnNew; if (!pWndStart) return hrgn; if (!(hrgnNew = CreateRectRgn( 0, 0, 0, 0 ))) @@ -275,10 +273,10 @@ static HRGN DCE_ClipWindows( WND *pWndStart, WND *pWndEnd, * clipped by the client area of all ancestors, and then optionally * by siblings and children. */ -HRGN DCE_GetVisRgn( HWND hwnd, WORD flags ) +HRGN32 DCE_GetVisRgn( HWND hwnd, WORD flags ) { RECT16 rect; - HRGN hrgn; + HRGN32 hrgn; int xoffset, yoffset; WND *wndPtr = WIN_FindWndPtr( hwnd ); @@ -397,7 +395,7 @@ HDC16 GetDCEx16( HWND16 hwnd, HRGN16 hrgnClip, DWORD flags ) */ HDC32 GetDCEx32( HWND32 hwnd, HRGN32 hrgnClip, DWORD flags ) { - HRGN hrgnVisible; + HRGN32 hrgnVisible; HDC hdc = 0; DCE * dce; DC * dc; @@ -644,7 +642,7 @@ INT32 ReleaseDC32( HWND32 hwnd, HDC32 hdc ) * * See "Undoc. Windows" for hints (DC, SetDCHook, SetHookFlags).. */ -BOOL DCHook(HDC hDC, WORD code, DWORD data, DWORD lParam) +BOOL16 DCHook( HDC16 hDC, WORD code, DWORD data, LPARAM lParam ) { HRGN32 hVisRgn; DCE *dce = firstDCE;; diff --git a/windows/defdlg.c b/windows/defdlg.c index d37f1bbb694..a0970a867a6 100644 --- a/windows/defdlg.c +++ b/windows/defdlg.c @@ -122,7 +122,7 @@ static LRESULT DEFDLG_Proc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam, return 0; case WM_ERASEBKGND: - FillWindow( hwnd, hwnd, (HDC)wParam, (HBRUSH)CTLCOLOR_DLG ); + FillWindow( hwnd, hwnd, (HDC)wParam, (HBRUSH16)CTLCOLOR_DLG ); return 1; case WM_NCDESTROY: @@ -188,13 +188,7 @@ static LRESULT DEFDLG_Proc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam, { HWND hwndDest = (HWND)wParam; if (!lParam) - { - HWND32 hwndPrev = GetFocus32(); - if (!hwndPrev) /* Set focus to the first item */ - hwndDest = DIALOG_GetFirstTabItem( hwnd ); - else - hwndDest = GetNextDlgTabItem( hwnd, hwndPrev, wParam ); - } + hwndDest = GetNextDlgTabItem32(hwnd, GetFocus32(), wParam); if (hwndDest) DEFDLG_SetFocus( hwnd, hwndDest ); DEFDLG_SetDefButton( hwnd, dlgInfo, hwndDest ); } diff --git a/windows/defwnd.c b/windows/defwnd.c index 7284cd1a505..46727b31798 100644 --- a/windows/defwnd.c +++ b/windows/defwnd.c @@ -78,7 +78,7 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT32 msg, WPARAM32 wParam, switch(msg) { case WM_NCPAINT: - return NC_HandleNCPaint( wndPtr->hwndSelf, (HRGN)wParam ); + return NC_HandleNCPaint( wndPtr->hwndSelf, (HRGN32)wParam ); case WM_NCHITTEST: return NC_HandleNCHitTest( wndPtr->hwndSelf, MAKEPOINT16(lParam) ); @@ -170,10 +170,10 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT32 msg, WPARAM32 wParam, (e.g for textured desktop) ? */ } - if (wndPtr->class->hbrBackground <= (HBRUSH)(COLOR_MAX+1)) + if (wndPtr->class->hbrBackground <= (HBRUSH16)(COLOR_MAX+1)) { - HBRUSH hbrush = CreateSolidBrush( - GetSysColor(((DWORD)wndPtr->class->hbrBackground)-1)); + HBRUSH16 hbrush = CreateSolidBrush( + GetSysColor(((DWORD)wndPtr->class->hbrBackground)-1)); FillWindow( GetParent16(wndPtr->hwndSelf), wndPtr->hwndSelf, (HDC)wParam, hbrush); DeleteObject (hbrush); @@ -382,7 +382,7 @@ LRESULT DefWindowProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, case WM_SETTEXT: DEFWND_SetText( wndPtr, (LPSTR)PTR_SEG_TO_LIN(lParam) ); - NC_HandleNCPaint( hwnd , (HRGN)1 ); /* Repaint caption */ + NC_HandleNCPaint( hwnd , (HRGN32)1 ); /* Repaint caption */ break; default: @@ -448,7 +448,7 @@ LRESULT DefWindowProc32A( HWND32 hwnd, UINT32 msg, WPARAM32 wParam, case WM_SETTEXT: DEFWND_SetText( wndPtr, (LPSTR)lParam ); - NC_HandleNCPaint( hwnd , (HRGN)1 ); /* Repaint caption */ + NC_HandleNCPaint( hwnd , (HRGN32)1 ); /* Repaint caption */ break; default: diff --git a/windows/dialog.c b/windows/dialog.c index fe31129ad54..d180503b755 100644 --- a/windows/dialog.c +++ b/windows/dialog.c @@ -61,7 +61,7 @@ static WORD xBaseUnit = 0, yBaseUnit = 0; * * Initialisation of the dialog manager. */ -BOOL DIALOG_Init() +BOOL32 DIALOG_Init() { TEXTMETRIC16 tm; HDC hdc; @@ -84,20 +84,6 @@ BOOL DIALOG_Init() } -/*********************************************************************** - * DIALOG_GetFirstTabItem - * - * Return the first item of the dialog that has the WS_TABSTOP style. - */ -HWND DIALOG_GetFirstTabItem( HWND hwndDlg ) -{ - WND *pWnd = WIN_FindWndPtr( hwndDlg ); - for (pWnd = pWnd->child; pWnd; pWnd = pWnd->next) - if (pWnd->dwStyle & WS_TABSTOP) return pWnd->hwndSelf; - return 0; -} - - /*********************************************************************** * DIALOG_GetControl16 * @@ -274,7 +260,7 @@ static BOOL32 DIALOG_CreateControls( WND *pWnd, LPCSTR template, INT32 items, info.y * dlgInfo->yBaseUnit / 8, info.cx * dlgInfo->xBaseUnit / 4, info.cy * dlgInfo->yBaseUnit / 8, - pWnd->hwndSelf, (HMENU)info.id, + pWnd->hwndSelf, (HMENU16)info.id, instance, info.data ); } else @@ -288,7 +274,7 @@ static BOOL32 DIALOG_CreateControls( WND *pWnd, LPCSTR template, INT32 items, info.y * dlgInfo->yBaseUnit / 8, info.cx * dlgInfo->xBaseUnit / 4, info.cy * dlgInfo->yBaseUnit / 8, - pWnd->hwndSelf, (HMENU)info.id, + pWnd->hwndSelf, (HMENU32)info.id, hInst, info.data ); } if (!hwndCtrl) return FALSE; @@ -469,12 +455,12 @@ static LPCSTR DIALOG_ParseTemplate32( LPCSTR template, DLG_TEMPLATE * result ) /*********************************************************************** * DIALOG_CreateIndirect */ -static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCSTR dlgTemplate, +static HWND DIALOG_CreateIndirect( HINSTANCE32 hInst, LPCSTR dlgTemplate, HWND owner, DLGPROC16 dlgProc, LPARAM param, WINDOWPROCTYPE procType ) { - HMENU hMenu = 0; - HFONT hFont = 0; + HMENU16 hMenu = 0; + HFONT16 hFont = 0; HWND hwnd; RECT16 rect; WND * wndPtr; @@ -513,7 +499,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCSTR dlgTemplate, if (hFont) { TEXTMETRIC16 tm; - HFONT oldFont; + HFONT16 oldFont; HDC32 hdc = GetDC32(0); oldFont = SelectObject( hdc, hFont ); @@ -594,7 +580,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCSTR dlgTemplate, /* Send initialisation messages and set focus */ - dlgInfo->hwndFocus = DIALOG_GetFirstTabItem( hwnd ); + dlgInfo->hwndFocus = GetNextDlgTabItem32( hwnd, 0, FALSE ); if (dlgInfo->hUserFont) SendMessage32A( hwnd, WM_SETFONT, (WPARAM)dlgInfo->hUserFont, 0 ); if (SendMessage32A(hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param)) @@ -905,7 +891,8 @@ BOOL IsDialogMessage( HWND hwndDlg, LPMSG16 msg ) case VK_DOWN: if (!(dlgCode & DLGC_WANTARROWS)) { - SetFocus32( GetNextDlgGroupItem(hwndDlg,GetFocus32(),FALSE) ); + SetFocus32( GetNextDlgGroupItem32( hwndDlg, GetFocus32(), + FALSE ) ); return TRUE; } break; @@ -914,7 +901,8 @@ BOOL IsDialogMessage( HWND hwndDlg, LPMSG16 msg ) case VK_UP: if (!(dlgCode & DLGC_WANTARROWS)) { - SetFocus32( GetNextDlgGroupItem(hwndDlg,GetFocus32(),TRUE) ); + SetFocus32( GetNextDlgGroupItem32( hwndDlg, GetFocus32(), + TRUE ) ); return TRUE; } break; @@ -1225,64 +1213,104 @@ void MapDialogRect32( HWND32 hwnd, LPRECT32 rect ) /*********************************************************************** - * GetNextDlgGroupItem (USER.227) + * GetNextDlgGroupItem16 (USER.227) */ -HWND GetNextDlgGroupItem( HWND hwndDlg, HWND hwndCtrl, BOOL fPrevious ) +HWND16 GetNextDlgGroupItem16(HWND16 hwndDlg, HWND16 hwndCtrl, BOOL16 fPrevious) { - WND *pWnd, *pWndStart, *pWndCtrl, *pWndDlg; - - if (!(pWndDlg = WIN_FindWndPtr( hwndDlg ))) return 0; - if (!(pWndCtrl = WIN_FindWndPtr( hwndCtrl ))) return 0; - if (pWndCtrl->parent != pWndDlg) return 0; - - if (!fPrevious && pWndCtrl->next) /* Check if next control is in group */ - { - if (!(pWndCtrl->next->dwStyle & WS_GROUP)) - return pWndCtrl->next->hwndSelf; - } - - /* Now we will have to find the start of the group */ - - for (pWnd = pWndStart = pWndDlg->child; pWnd; pWnd = pWnd->next) - { - if (pWnd->dwStyle & WS_GROUP) pWndStart = pWnd; /* Start of a group */ - if (pWnd == pWndCtrl) break; - } - - if (!pWnd) fprintf(stderr, "GetNextDlgGroupItem: hwnd not in dialog!\n"); - - /* only case left for forward search: wraparound */ - if (!fPrevious) return pWndStart->hwndSelf; - - pWnd = pWndStart->next; - while (pWnd && (pWnd != pWndCtrl)) - { - if (pWnd->dwStyle & WS_GROUP) break; - pWndStart = pWnd; - pWnd = pWnd->next; - } - return pWndStart->hwndSelf; + return (HWND16)GetNextDlgGroupItem32( hwndDlg, hwndCtrl, fPrevious ); } /*********************************************************************** - * GetNextDlgTabItem (USER.228) + * GetNextDlgGroupItem32 (USER32.274) */ -HWND GetNextDlgTabItem( HWND hwndDlg, HWND hwndCtrl, BOOL fPrevious ) +HWND32 GetNextDlgGroupItem32(HWND32 hwndDlg, HWND32 hwndCtrl, BOOL32 fPrevious) { WND *pWnd, *pWndLast, *pWndCtrl, *pWndDlg; if (!(pWndDlg = WIN_FindWndPtr( hwndDlg ))) return 0; - if (!(pWndCtrl = WIN_FindWndPtr( hwndCtrl ))) return 0; - if (pWndCtrl->parent != pWndDlg) return 0; + if (hwndCtrl) + { + if (!(pWndCtrl = WIN_FindWndPtr( hwndCtrl ))) return 0; + /* Make sure hwndCtrl is a top-level child */ + while ((pWndCtrl->dwStyle & WS_CHILD) && (pWndCtrl->parent != pWndDlg)) + pWndCtrl = pWndCtrl->parent; + if (pWndCtrl->parent != pWndDlg) return 0; + } + else + { + /* No ctrl specified -> start from the beginning */ + if (!(pWndCtrl = pWndDlg->child)) return 0; + if (fPrevious) while (pWndCtrl->next) pWndCtrl = pWndCtrl->next; + } pWndLast = pWndCtrl; pWnd = pWndCtrl->next; while (1) { - if (!pWnd) pWnd = pWndDlg->child; + if (!pWnd || (pWnd->dwStyle & WS_GROUP)) + { + /* Wrap-around to the beginning of the group */ + WND *pWndStart = pWndDlg->child; + for (pWnd = pWndStart; pWnd; pWnd = pWnd->next) + { + if (pWnd->dwStyle & WS_GROUP) pWndStart = pWnd; + if (pWnd == pWndCtrl) break; + } + pWnd = pWndStart; + } if (pWnd == pWndCtrl) break; - if ((pWnd->dwStyle & WS_TABSTOP) && (pWnd->dwStyle & WS_VISIBLE)) + if ((pWnd->dwStyle & WS_VISIBLE) && !(pWnd->dwStyle & WS_DISABLED)) + { + pWndLast = pWnd; + if (!fPrevious) break; + } + pWnd = pWnd->next; + } + return pWndLast->hwndSelf; +} + + +/*********************************************************************** + * GetNextDlgTabItem16 (USER.228) + */ +HWND16 GetNextDlgTabItem16( HWND16 hwndDlg, HWND16 hwndCtrl, BOOL16 fPrevious ) +{ + return (HWND16)GetNextDlgTabItem32( hwndDlg, hwndCtrl, fPrevious ); +} + + +/*********************************************************************** + * GetNextDlgTabItem32 (USER32.275) + */ +HWND32 GetNextDlgTabItem32( HWND32 hwndDlg, HWND32 hwndCtrl, BOOL32 fPrevious ) +{ + WND *pWnd, *pWndLast, *pWndCtrl, *pWndDlg; + + if (!(pWndDlg = WIN_FindWndPtr( hwndDlg ))) return 0; + if (hwndCtrl) + { + if (!(pWndCtrl = WIN_FindWndPtr( hwndCtrl ))) return 0; + /* Make sure hwndCtrl is a top-level child */ + while ((pWndCtrl->dwStyle & WS_CHILD) && (pWndCtrl->parent != pWndDlg)) + pWndCtrl = pWndCtrl->parent; + if (pWndCtrl->parent != pWndDlg) return 0; + } + else + { + /* No ctrl specified -> start from the beginning */ + if (!(pWndCtrl = pWndDlg->child)) return 0; + if (fPrevious) while (pWndCtrl->next) pWndCtrl = pWndCtrl->next; + } + + pWndLast = pWndCtrl; + pWnd = pWndCtrl->next; + while (1) + { + if (!pWnd) pWnd = pWndDlg->child; + if (pWnd == pWndCtrl) break; + if ((pWnd->dwStyle & WS_TABSTOP) && (pWnd->dwStyle & WS_VISIBLE) && + !(pWnd->dwStyle & WS_DISABLED)) { pWndLast = pWnd; if (!fPrevious) break; diff --git a/windows/event.c b/windows/event.c index 77532ea7805..46fc7c40c07 100644 --- a/windows/event.c +++ b/windows/event.c @@ -728,7 +728,7 @@ static void EVENT_ConfigureNotify( HWND hwnd, XConfigureEvent *event ) WND *wndPtr; WINDOWPOS16 *winpos; RECT16 newWindowRect, newClientRect; - HRGN hrgnOldPos, hrgnNewPos; + HRGN32 hrgnOldPos, hrgnNewPos; if (!(wndPtr = WIN_FindWndPtr( hwnd )) || !(wndPtr->flags & WIN_MANAGED) ) @@ -800,7 +800,7 @@ static void EVENT_SelectionRequest( WND *pWnd, XSelectionRequestEvent *event ) if(event->target == XA_STRING) { - HANDLE hText; + HANDLE16 hText; LPSTR text; int size,i,j; diff --git a/windows/graphics.c b/windows/graphics.c index aca1f6c9994..5de568a293b 100644 --- a/windows/graphics.c +++ b/windows/graphics.c @@ -456,7 +456,7 @@ BOOL RoundRect( HDC hDC, INT left, INT top, INT right, INT bottom, */ INT16 FillRect16( HDC16 hdc, const RECT16 *rect, HBRUSH16 hbrush ) { - HBRUSH prevBrush; + HBRUSH16 prevBrush; /* coordinates are logical so we cannot fast-check rectangle * - do it in PatBlt() after LPtoDP(). @@ -475,7 +475,7 @@ INT16 FillRect16( HDC16 hdc, const RECT16 *rect, HBRUSH16 hbrush ) */ INT32 FillRect32( HDC32 hdc, const RECT32 *rect, HBRUSH32 hbrush ) { - HBRUSH prevBrush; + HBRUSH16 prevBrush; if (!(prevBrush = SelectObject( hdc, (HBRUSH16)hbrush ))) return 0; PatBlt( hdc, rect->left, rect->top, @@ -510,7 +510,7 @@ void InvertRect32( HDC32 hdc, const RECT32 *rect ) */ INT16 FrameRect16( HDC16 hdc, const RECT16 *rect, HBRUSH16 hbrush ) { - HBRUSH prevBrush; + HBRUSH16 prevBrush; int left, top, right, bottom; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); @@ -626,10 +626,10 @@ COLORREF GetPixel( HDC hdc, short x, short y ) /*********************************************************************** * PaintRgn (GDI.43) */ -BOOL PaintRgn( HDC hdc, HRGN hrgn ) +BOOL PaintRgn( HDC hdc, HRGN32 hrgn ) { RECT16 box; - HRGN tmpVisRgn, prevVisRgn; + HRGN32 tmpVisRgn, prevVisRgn; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) return FALSE; @@ -663,10 +663,10 @@ BOOL PaintRgn( HDC hdc, HRGN hrgn ) /*********************************************************************** * FillRgn (GDI.40) */ -BOOL FillRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush ) +BOOL FillRgn( HDC hdc, HRGN32 hrgn, HBRUSH16 hbrush ) { BOOL retval; - HBRUSH prevBrush = SelectObject( hdc, hbrush ); + HBRUSH16 prevBrush = SelectObject( hdc, hbrush ); if (!prevBrush) return FALSE; retval = PaintRgn( hdc, hrgn ); SelectObject( hdc, prevBrush ); @@ -676,9 +676,9 @@ BOOL FillRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush ) /*********************************************************************** * FrameRgn (GDI.41) */ -BOOL FrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush, int nWidth, int nHeight ) +BOOL FrameRgn( HDC hdc, HRGN32 hrgn, HBRUSH16 hbrush, int nWidth, int nHeight ) { - HRGN tmp = CreateRectRgn( 0, 0, 0, 0 ); + HRGN32 tmp = CreateRectRgn( 0, 0, 0, 0 ); if(!REGION_FrameRgn( tmp, hrgn, nWidth, nHeight )) return 0; FillRgn( hdc, tmp, hbrush ); DeleteObject( tmp ); @@ -688,9 +688,9 @@ BOOL FrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush, int nWidth, int nHeight ) /*********************************************************************** * InvertRgn (GDI.42) */ -BOOL InvertRgn( HDC hdc, HRGN hrgn ) +BOOL InvertRgn( HDC hdc, HRGN32 hrgn ) { - HBRUSH prevBrush = SelectObject( hdc, GetStockObject(BLACK_BRUSH) ); + HBRUSH16 prevBrush = SelectObject( hdc, GetStockObject(BLACK_BRUSH) ); WORD prevROP = SetROP2( hdc, R2_NOT ); BOOL retval = PaintRgn( hdc, hrgn ); SelectObject( hdc, prevBrush ); @@ -729,7 +729,7 @@ void DrawFocusRect16( HDC16 hdc, const RECT16* rc ) SetBkMode(hdc, oldBkMode); SetROP2(hdc, oldDrawMode); - SelectObject(hdc, (HANDLE)hOldPen); + SelectObject(hdc, hOldPen); } @@ -786,7 +786,7 @@ BOOL32 GRAPH_DrawBitmap( HDC32 hdc, HBITMAP32 hbitmap, int xdest, int ydest, void GRAPH_DrawReliefRect( HDC32 hdc, const RECT32 *rect, INT32 highlight_size, INT32 shadow_size, BOOL32 pressed ) { - HBRUSH hbrushOld; + HBRUSH16 hbrushOld; int i; hbrushOld = SelectObject( hdc, pressed ? sysColorObjects.hbrushBtnShadow : @@ -881,7 +881,7 @@ BOOL16 Polygon16( HDC16 hdc, LPPOINT16 pt, INT16 count ) */ BOOL16 PolyPolygon16( HDC16 hdc, LPPOINT16 pt, LPINT16 counts, UINT16 polygons) { - HRGN hrgn; + HRGN32 hrgn; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) @@ -1088,7 +1088,7 @@ BOOL16 DrawEdge16( HDC16 hdc, LPRECT16 rc, UINT16 edge, UINT16 flags ) */ BOOL32 DrawEdge32( HDC32 hdc, LPRECT32 rc, UINT32 edge, UINT32 flags ) { - HBRUSH hbrushOld; + HBRUSH16 hbrushOld; if (flags >= BF_DIAGONAL) fprintf( stderr, "DrawEdge: unsupported flags %04x\n", flags ); diff --git a/windows/hook.c b/windows/hook.c index ce581078bf8..4deddf791db 100644 --- a/windows/hook.c +++ b/windows/hook.c @@ -15,12 +15,28 @@ #define NO_TRANSITION_TYPES /* This file is Win32-clean */ #include "hook.h" -#include "callback.h" #include "queue.h" #include "user.h" #include "stddebug.h" #include "debug.h" +#pragma pack(1) + + /* Hook data (pointed to by a HHOOK) */ +typedef struct +{ + HANDLE16 next; /* 00 Next hook in chain */ + HOOKPROC16 proc WINE_PACKED; /* 02 Hook procedure */ + INT16 id; /* 06 Hook id (WH_xxx) */ + HQUEUE16 ownerQueue; /* 08 Owner queue (0 for system hook) */ + HMODULE16 ownerModule; /* 0a Owner module */ + WORD inHookProc; /* 0c TRUE if in this->proc */ +} HOOKDATA; + +#pragma pack(4) + +#define HOOK_MAGIC ((int)'H' | (int)'K' << 8) /* 'HK' */ + /* This should probably reside in USER heap */ static HANDLE16 HOOK_systemHooks[WH_NB_HOOKS] = { 0, }; @@ -58,6 +74,16 @@ HANDLE16 HOOK_GetHook( INT16 id , HQUEUE16 hQueue ) } +/*********************************************************************** + * HOOK_GetProc16 + */ +HOOKPROC16 HOOK_GetProc16( HHOOK hhook ) +{ + HOOKDATA *data = (HOOKDATA *)USER_HEAP_LIN_ADDR( hhook ); + return data ? data->proc : NULL; +} + + /*********************************************************************** * HOOK_SetHook * @@ -197,9 +223,9 @@ static LRESULT HOOK_CallHook( HANDLE16 hook, INT16 code, queue->hCurHook = hook; data->inHookProc = 1; - dprintf_hook( stddeb, "Calling hook %04x: %d %04lx %08lx\n", - hook, code, (DWORD)wParam, lParam ); - ret = CallHookProc( data->proc, code, wParam, lParam ); + dprintf_hook( stddeb, "Calling hook %04x: proc=%p %d %04lx %08lx\n", + hook, data->proc, code, (DWORD)wParam, lParam ); + ret = data->proc( code, wParam, lParam ); dprintf_hook( stddeb, "Ret hook %04x = %08lx\n", hook, ret ); data->inHookProc = 0; @@ -280,23 +306,23 @@ void HOOK_FreeQueueHooks( HQUEUE16 hQueue ) } } + /*********************************************************************** - * SetWindowsHook (USER.121) + * SetWindowsHook16 (USER.121) */ -FARPROC16 SetWindowsHook( INT16 id, HOOKPROC16 proc ) +FARPROC16 SetWindowsHook16( INT16 id, HOOKPROC16 proc ) { - HINSTANCE16 hInst = __winelib ? 0 : FarGetOwner( HIWORD(proc) ); HTASK16 hTask = (id == WH_MSGFILTER) ? GetCurrentTask() : 0; - HANDLE16 handle = HOOK_SetHook( id, proc, hInst, hTask ); + HANDLE16 handle = HOOK_SetHook( id, proc, 0, hTask ); return (handle) ? (FARPROC16)MAKELONG( handle, HOOK_MAGIC ) : NULL; } /*********************************************************************** - * UnhookWindowsHook (USER.234) + * UnhookWindowsHook16 (USER.234) */ -BOOL16 UnhookWindowsHook( INT16 id, HOOKPROC16 proc ) +BOOL16 UnhookWindowsHook16( INT16 id, HOOKPROC16 proc ) { HANDLE16 hook = HOOK_GetHook( id , 0 ); @@ -341,10 +367,10 @@ BOOL16 CallMsgFilter( SEGPTR msg, INT16 code ) /*********************************************************************** - * SetWindowsHookEx (USER.291) + * SetWindowsHookEx16 (USER.291) */ -HHOOK SetWindowsHookEx( INT16 id, HOOKPROC16 proc, HINSTANCE16 hInst, - HTASK16 hTask ) +HHOOK SetWindowsHookEx16( INT16 id, HOOKPROC16 proc, HINSTANCE16 hInst, + HTASK16 hTask ) { HANDLE16 handle = HOOK_SetHook( id, proc, hInst, hTask ); return (handle) ? MAKELONG( handle, HOOK_MAGIC ) : NULL; @@ -352,9 +378,9 @@ HHOOK SetWindowsHookEx( INT16 id, HOOKPROC16 proc, HINSTANCE16 hInst, /*********************************************************************** - * UnhookWindowHookEx (USER.292) + * UnhookWindowHookEx16 (USER.292) */ -BOOL16 UnhookWindowsHookEx( HHOOK hhook ) +BOOL16 UnhookWindowsHookEx16( HHOOK hhook ) { if (HIWORD(hhook) != HOOK_MAGIC) return FALSE; /* Not a new format hook */ return HOOK_RemoveHook( LOWORD(hhook) ); diff --git a/windows/mdi.c b/windows/mdi.c index 40b0d4d3508..6631b940147 100644 --- a/windows/mdi.c +++ b/windows/mdi.c @@ -31,8 +31,8 @@ #include "debug.h" -static HBITMAP hBmpClose = 0; -static HBITMAP hBmpRestore = 0; +static HBITMAP16 hBmpClose = 0; +static HBITMAP16 hBmpRestore = 0; DWORD SCROLL_SetNCSbState(WND*,int,int,int,int,int,int); @@ -215,7 +215,8 @@ void MDI_CalcDefaultChildPos(WND* w, WORD n, LPPOINT16 lpPos, INT delta) /********************************************************************** * MDISetMenu */ -HMENU MDISetMenu(HWND hwnd, BOOL fRefresh, HMENU hmenuFrame, HMENU hmenuWindow) +HMENU16 MDISetMenu(HWND hwnd, BOOL fRefresh, HMENU16 hmenuFrame, + HMENU16 hmenuWindow) { WND *w = WIN_FindWndPtr(hwnd); MDICLIENTINFO *ci; @@ -228,7 +229,7 @@ HMENU MDISetMenu(HWND hwnd, BOOL fRefresh, HMENU hmenuFrame, HMENU hmenuWindow) if (!fRefresh) { HWND hwndFrame = GetParent16(hwnd); - HMENU oldFrameMenu = GetMenu(hwndFrame); + HMENU16 oldFrameMenu = GetMenu(hwndFrame); if( ci->hwndChildMaximized && hmenuFrame && hmenuFrame!=oldFrameMenu ) MDI_RestoreFrameMenu(w->parent, ci->hwndChildMaximized ); @@ -356,7 +357,7 @@ HWND MDICreateChild(WND *w, MDICLIENTINFO *ci, HWND parent, LPARAM lParam ) hwnd = CreateWindow16( (LPCSTR)PTR_SEG_TO_LIN(cs->szClass), (LPCSTR)PTR_SEG_TO_LIN(cs->szTitle), style, cs->x, cs->y, cs->cx, cs->cy, parent, - (HMENU)(DWORD)(WORD)wIDmenu, w->hInstance, + (HMENU16)wIDmenu, w->hInstance, (LPVOID)lParam); /* MDI windows are WS_CHILD so they won't be activated by CreateWindow */ @@ -406,8 +407,7 @@ void MDI_ChildGetMinMaxInfo(WND* clientWnd, HWND hwnd, MINMAXINFO16* lpMinMax ) MapWindowPoints16(clientWnd->parent->hwndSelf, ((MDICLIENTINFO*)clientWnd->wExtra)->self, (LPPOINT16)&rect, 2); - AdjustWindowRectEx16( &rect, childWnd->dwStyle & ~(WS_VSCROLL | WS_HSCROLL), - 0, childWnd->dwExStyle ); + AdjustWindowRectEx16( &rect, childWnd->dwStyle, 0, childWnd->dwExStyle ); lpMinMax->ptMaxSize.x = rect.right -= rect.left; lpMinMax->ptMaxSize.y = rect.bottom -= rect.top; @@ -664,7 +664,7 @@ MDIWCL* MDI_BuildWCL(WND* clientWnd, INT16* iTotal) /********************************************************************** * CreateMDIMenuBitmap */ -HBITMAP CreateMDIMenuBitmap(void) +HBITMAP16 CreateMDIMenuBitmap(void) { HDC hDCSrc = CreateCompatibleDC(0); HDC hDCDest = CreateCompatibleDC(hDCSrc); @@ -842,7 +842,7 @@ BOOL MDI_AugmentFrameMenu(MDICLIENTINFO* ci, WND *frame, HWND hChild) { WND* child = WIN_FindWndPtr(hChild); HGLOBAL16 handle; - HMENU hSysPopup = 0; + HMENU16 hSysPopup = 0; dprintf_mdi(stddeb,"MDI_AugmentFrameMenu: frame %p,child %04x\n",frame,hChild); @@ -1070,7 +1070,7 @@ LRESULT MDIClientWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_MDISETMENU: #ifdef WINELIB32 - return (LRESULT)MDISetMenu(hwnd, FALSE, (HMENU)wParam, (HMENU)lParam); + return (LRESULT)MDISetMenu(hwnd, FALSE, (HMENU16)wParam, (HMENU16)lParam); #else return (LRESULT)MDISetMenu(hwnd, wParam, LOWORD(lParam), HIWORD(lParam)); #endif diff --git a/windows/message.c b/windows/message.c index 2f9cae14339..27eec64011d 100644 --- a/windows/message.c +++ b/windows/message.c @@ -403,7 +403,7 @@ static int MSG_JournalPlayBackMsg(void) static BOOL MSG_PeekHardwareMsg( MSG16 *msg, HWND hwnd, WORD first, WORD last, BOOL remove ) { - SYSQ_STATUS status; + SYSQ_STATUS status = SYSQ_MSG_ACCEPT; MESSAGEQUEUE *sysMsgQueue = QUEUE_GetSysQueue(); int i, pos = sysMsgQueue->nextMessage; @@ -885,9 +885,10 @@ BOOL PostMessage( HWND hwnd, WORD message, WORD wParam, LONG lParam ) } /*********************************************************************** - * PostAppMessage (USER.116) + * PostAppMessage16 (USER.116) */ -BOOL PostAppMessage( HTASK hTask, WORD message, WORD wParam, LONG lParam ) +BOOL16 PostAppMessage16( HTASK16 hTask, UINT16 message, WPARAM16 wParam, + LPARAM lParam ) { MSG16 msg; diff --git a/windows/msgbox.c b/windows/msgbox.c index 693ccbaf56d..178e9bc33f6 100644 --- a/windows/msgbox.c +++ b/windows/msgbox.c @@ -176,7 +176,7 @@ LRESULT SystemMessageBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) int MessageBox(HWND hWnd, LPCSTR text, LPCSTR title, WORD type) { - HANDLE handle; + HANDLE16 handle; MSGBOX mbox; int ret; diff --git a/windows/nonclient.c b/windows/nonclient.c index fe3148d6429..3a9268c26e5 100644 --- a/windows/nonclient.c +++ b/windows/nonclient.c @@ -26,13 +26,13 @@ #include "options.h" -static HBITMAP hbitmapClose = 0; -static HBITMAP hbitmapMinimize = 0; -static HBITMAP hbitmapMinimizeD = 0; -static HBITMAP hbitmapMaximize = 0; -static HBITMAP hbitmapMaximizeD = 0; -static HBITMAP hbitmapRestore = 0; -static HBITMAP hbitmapRestoreD = 0; +static HBITMAP16 hbitmapClose = 0; +static HBITMAP16 hbitmapMinimize = 0; +static HBITMAP16 hbitmapMinimizeD = 0; +static HBITMAP16 hbitmapMaximize = 0; +static HBITMAP16 hbitmapMaximizeD = 0; +static HBITMAP16 hbitmapRestore = 0; +static HBITMAP16 hbitmapRestoreD = 0; #define SC_ABOUTWINE (SC_SCREENSAVE+1) @@ -64,6 +64,7 @@ static HBITMAP hbitmapRestoreD = 0; */ static void NC_AdjustRect(LPRECT16 rect, DWORD style, BOOL menu, DWORD exStyle) { + if(style & WS_ICONIC) return; /* Decide if the window will be managed (see CreateWindowEx) */ if (!(Options.managed && !(style & WS_CHILD) && ((style & (WS_DLGFRAME | WS_THICKFRAME)) || @@ -117,6 +118,8 @@ BOOL16 AdjustWindowRectEx16( LPRECT16 rect, DWORD style, if (!(style & (WS_POPUP | WS_CHILD))) /* Overlapped window */ style |= WS_CAPTION; + style &= (WS_DLGFRAME | WS_BORDER | WS_THICKFRAME); + exStyle &= WS_EX_DLGMODALFRAME; if (exStyle & WS_EX_DLGMODALFRAME) style &= ~WS_THICKFRAME; dprintf_nonclient(stddeb, "AdjustWindowRectEx: (%d,%d)-(%d,%d) %08lx %d %08lx\n", @@ -432,7 +435,7 @@ void NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down ) { RECT16 rect; HDC hdcMem; - HBITMAP hbitmap; + HBITMAP16 hbitmap; WND *wndPtr = WIN_FindWndPtr( hwnd ); if( !(wndPtr->flags & WIN_MANAGED) ) @@ -620,7 +623,7 @@ static void NC_DrawCaption( HDC hdc, RECT16 *rect, HWND hwnd, if (wndPtr->dwExStyle & WS_EX_DLGMODALFRAME) { - HBRUSH hbrushOld = SelectObject( hdc, sysColorObjects.hbrushWindow ); + HBRUSH16 hbrushOld = SelectObject( hdc, sysColorObjects.hbrushWindow ); PatBlt( hdc, r.left, r.top, 1, r.bottom-r.top+1,PATCOPY ); PatBlt( hdc, r.right-1, r.top, 1, r.bottom-r.top+1, PATCOPY ); PatBlt( hdc, r.left, r.top-1, r.right-r.left, 1, PATCOPY ); @@ -669,7 +672,7 @@ static void NC_DrawCaption( HDC hdc, RECT16 *rect, HWND hwnd, * * Paint the non-client area. clip is currently unused. */ -void NC_DoNCPaint( HWND hwnd, HRGN clip, BOOL suppress_menupaint ) +void NC_DoNCPaint( HWND hwnd, HRGN32 clip, BOOL suppress_menupaint ) { HDC32 hdc; RECT16 rect; @@ -763,7 +766,7 @@ void NC_DoNCPaint( HWND hwnd, HRGN clip, BOOL suppress_menupaint ) * * Handle a WM_NCPAINT message. Called from DefWindowProc(). */ -LONG NC_HandleNCPaint( HWND hwnd , HRGN clip) +LONG NC_HandleNCPaint( HWND hwnd , HRGN32 clip) { NC_DoNCPaint( hwnd, clip, FALSE ); return 0; @@ -790,7 +793,7 @@ LONG NC_HandleNCActivate( WND *wndPtr, WPARAM wParam ) if( wndPtr->dwStyle & WS_MINIMIZE ) PAINT_RedrawWindow( wndPtr->hwndSelf, NULL, 0, RDW_INVALIDATE | RDW_ERASE | RDW_ERASENOW, 0 ); else - NC_DoNCPaint( wndPtr->hwndSelf, (HRGN)1, FALSE ); + NC_DoNCPaint( wndPtr->hwndSelf, (HRGN32)1, FALSE ); } return TRUE; } @@ -875,7 +878,7 @@ static void NC_TrackSysMenu( HWND hwnd, HDC hdc, POINT16 pt ) RECT16 rect; WND *wndPtr = WIN_FindWndPtr( hwnd ); int iconic = wndPtr->dwStyle & WS_MINIMIZE; - HMENU hmenu; + HMENU16 hmenu; if (!(wndPtr->dwStyle & WS_SYSMENU)) return; diff --git a/windows/painting.c b/windows/painting.c index 76c5a738615..366c629e7c7 100644 --- a/windows/painting.c +++ b/windows/painting.c @@ -25,7 +25,7 @@ void WIN_UpdateNCArea(WND* wnd, BOOL bUpdate) { POINT16 pt = {0, 0}; - HRGN hClip = 1; + HRGN32 hClip = 1; dprintf_nonclient(stddeb,"NCUpdate: hwnd %04x, hrgnUpdate %04x\n", wnd->hwndSelf, wnd->hrgnUpdate ); @@ -53,7 +53,7 @@ void WIN_UpdateNCArea(WND* wnd, BOOL bUpdate) if (bUpdate) { /* exclude non-client area from update region */ - HRGN hrgn = CreateRectRgn(0, 0, wnd->rectClient.right - wnd->rectClient.left, + HRGN32 hrgn = CreateRectRgn(0, 0, wnd->rectClient.right - wnd->rectClient.left, wnd->rectClient.bottom - wnd->rectClient.top); if (hrgn && (CombineRgn(wnd->hrgnUpdate, wnd->hrgnUpdate, @@ -89,7 +89,7 @@ void WIN_UpdateNCArea(WND* wnd, BOOL bUpdate) HDC16 BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps ) { BOOL32 bIcon; - HRGN hrgnUpdate; + HRGN32 hrgnUpdate; WND *wndPtr = WIN_FindWndPtr( hwnd ); if (!wndPtr) return 0; @@ -206,9 +206,9 @@ void PaintRect( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc, if ((UINT32)hbrush <= CTLCOLOR_MAX) { if (!hwndParent) return; - hbrush = (HBRUSH)SendMessage32A( hwndParent, - WM_CTLCOLORMSGBOX + (UINT32)hbrush, - (WPARAM)hdc, (LPARAM)hwnd ); + hbrush = (HBRUSH16)SendMessage32A( hwndParent, + WM_CTLCOLORMSGBOX + (UINT32)hbrush, + (WPARAM)hdc, (LPARAM)hwnd ); } if (hbrush) FillRect16( hdc, rect, hbrush ); } @@ -217,10 +217,10 @@ void PaintRect( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc, /*********************************************************************** * GetControlBrush (USER.326) */ -HBRUSH GetControlBrush( HWND hwnd, HDC hdc, WORD control ) +HBRUSH16 GetControlBrush( HWND hwnd, HDC hdc, WORD control ) { - return (HBRUSH)SendMessage32A( GetParent32(hwnd), WM_CTLCOLOR+control, - (WPARAM)hdc, (LPARAM)hwnd ); + return (HBRUSH16)SendMessage32A( GetParent32(hwnd), WM_CTLCOLOR+control, + (WPARAM)hdc, (LPARAM)hwnd ); } @@ -238,10 +238,10 @@ HBRUSH GetControlBrush( HWND hwnd, HDC hdc, WORD control ) * HIWORD(lParam) = hwndSkip (not used; always NULL) */ BOOL32 PAINT_RedrawWindow( HWND32 hwnd, const RECT32 *rectUpdate, - HRGN32 hrgnUpdate, UINT32 flags, UINT32 control ) + HRGN32 hrgnUpdate, UINT32 flags, UINT32 control ) { BOOL32 bIcon; - HRGN hrgn; + HRGN32 hrgn; RECT32 rectClient; WND* wndPtr; @@ -564,7 +564,7 @@ BOOL32 GetUpdateRect32( HWND32 hwnd, LPRECT32 rect, BOOL32 erase ) { if (wndPtr->hrgnUpdate > 1) { - HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 ); + HRGN32 hrgn = CreateRectRgn( 0, 0, 0, 0 ); if (GetUpdateRgn( hwnd, hrgn, erase ) == ERROR) return FALSE; GetRgnBox32( hrgn, rect ); DeleteObject( hrgn ); @@ -601,7 +601,7 @@ INT16 GetUpdateRgn( HWND32 hwnd, HRGN32 hrgn, BOOL32 erase ) INT16 ExcludeUpdateRgn( HDC32 hdc, HWND32 hwnd ) { INT16 retval = ERROR; - HRGN hrgn; + HRGN32 hrgn; WND * wndPtr; if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return ERROR; diff --git a/windows/scroll.c b/windows/scroll.c index f92adf16fd5..869279265e6 100644 --- a/windows/scroll.c +++ b/windows/scroll.c @@ -30,7 +30,7 @@ static int RgnType; void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT16 rect, LPRECT16 clipRect) { HDC32 hdc; - HRGN hrgnUpdate,hrgnClip; + HRGN32 hrgnUpdate,hrgnClip; RECT16 rc, cliprc; HWND hCaretWnd = CARET_GetHwnd(); WND* wndScroll = WIN_FindWndPtr( hwnd ); @@ -102,10 +102,10 @@ void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT16 rect, LPRECT16 clipRec * */ BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT16 rc, LPRECT16 cliprc, - HRGN hrgnUpdate, LPRECT16 rcUpdate) + HRGN32 hrgnUpdate, LPRECT16 rcUpdate) { - HRGN hrgnClip = 0; - HRGN hrgnScrollClip = 0; + HRGN32 hrgnClip = 0; + HRGN32 hrgnScrollClip = 0; RECT16 rectClip; POINT16 src, dest; short width, height; @@ -179,7 +179,7 @@ BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT16 rc, LPRECT16 cliprc, if (hrgnUpdate || rcUpdate) { - HRGN hrgn1 = (hrgnUpdate)?hrgnUpdate:CreateRectRgn( 0,0,0,0 ); + HRGN32 hrgn1 = (hrgnUpdate)?hrgnUpdate:CreateRectRgn( 0,0,0,0 ); if( dc->w.hVisRgn ) { @@ -228,7 +228,7 @@ BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT16 rc, LPRECT16 cliprc, */ int ScrollWindowEx(HWND hwnd, short dx, short dy, LPRECT16 rect, LPRECT16 clipRect, - HRGN hrgnUpdate, LPRECT16 rcUpdate, WORD flags) + HRGN32 hrgnUpdate, LPRECT16 rcUpdate, WORD flags) { HDC32 hdc; RECT16 rc, cliprc; diff --git a/windows/win.c b/windows/win.c index 563c788b769..da4b5e60026 100644 --- a/windows/win.c +++ b/windows/win.c @@ -359,7 +359,7 @@ static void WIN_DestroyWindow( WND* wndPtr ) } if (!(wndPtr->dwStyle & WS_CHILD)) - if (wndPtr->wIDmenu) DestroyMenu( (HMENU)wndPtr->wIDmenu ); + if (wndPtr->wIDmenu) DestroyMenu( (HMENU16)wndPtr->wIDmenu ); if (wndPtr->hSysMenu) DestroyMenu( wndPtr->hSysMenu ); if (wndPtr->window) XDestroyWindow( display, wndPtr->window ); if (wndPtr->class->style & CS_OWNDC) DCE_FreeDCE( wndPtr->dce ); @@ -1906,7 +1906,7 @@ BOOL32 EnumWindows32( WNDENUMPROC32 lpEnumFunc, LPARAM lParam ) BOOL16 EnumTaskWindows16( HTASK16 hTask, WNDENUMPROC16 func, LPARAM lParam ) { WND **list, **ppWnd; - HANDLE hQueue = GetTaskQueue( hTask ); + HQUEUE16 hQueue = GetTaskQueue( hTask ); /* This function is the same as EnumWindows(), */ /* except for an added check on the window queue. */ @@ -2178,14 +2178,14 @@ BOOL16 DragDetect(HWND16 hWnd, POINT16 pt) * DragObject ( USER.464 ) * */ -DWORD DragObject(HWND hwndScope, HWND hWnd, WORD wObj, HANDLE hOfStruct, +DWORD DragObject(HWND hwndScope, HWND hWnd, WORD wObj, HANDLE16 hOfStruct, WORD szList , HCURSOR16 hCursor) { MSG16 msg; LPDRAGINFO lpDragInfo; SEGPTR spDragInfo; HCURSOR16 hDragCursor=0, hOldCursor=0, hBummer=0; - HANDLE hDragInfo = GlobalAlloc16( GMEM_SHARE | GMEM_ZEROINIT, 2*sizeof(DRAGINFO)); + HGLOBAL16 hDragInfo = GlobalAlloc16( GMEM_SHARE | GMEM_ZEROINIT, 2*sizeof(DRAGINFO)); WND *wndPtr = WIN_FindWndPtr(hWnd); DWORD dwRet = 0; short dragDone = 0; diff --git a/windows/winpos.c b/windows/winpos.c index 7efd791ab17..a5743f871ec 100644 --- a/windows/winpos.c +++ b/windows/winpos.c @@ -39,7 +39,7 @@ /* ----- external functions ----- */ extern void FOCUS_SwitchFocus( HWND , HWND ); -extern HRGN DCE_GetVisRgn( HWND, WORD ); +extern HRGN32 DCE_GetVisRgn( HWND, WORD ); extern HWND CARET_GetHwnd(); extern BOOL DCE_InvalidateDCE(WND*, RECT16* ); @@ -940,8 +940,8 @@ BOOL32 WINPOS_SetActiveWindow( HWND32 hWnd, BOOL32 fMouse, BOOL32 fChangeFocus) WND *wndTemp = WIN_FindWndPtr(hwndActive); CBTACTIVATESTRUCT16 *cbtStruct; WORD wIconized=0; - HANDLE hOldActiveQueue = (pActiveQueue)?pActiveQueue->self:0; - HANDLE hNewActiveQueue; + HQUEUE16 hOldActiveQueue = (pActiveQueue)?pActiveQueue->self:0; + HQUEUE16 hNewActiveQueue; /* paranoid checks */ if( hWnd == GetDesktopWindow32() || hWnd == hwndActive ) @@ -1384,10 +1384,10 @@ HWND WINPOS_ReorderOwnedPopups(HWND hwndInsertAfter, WND* wndPtr, WORD flags) * update regions are in window client coordinates * client and window rectangles are in parent client coordinates */ -static UINT WINPOS_SizeMoveClean(WND* Wnd, HRGN oldVisRgn, LPRECT16 lpOldWndRect, LPRECT16 lpOldClientRect, UINT uFlags ) +static UINT WINPOS_SizeMoveClean(WND* Wnd, HRGN32 oldVisRgn, LPRECT16 lpOldWndRect, LPRECT16 lpOldClientRect, UINT uFlags ) { - HRGN newVisRgn = DCE_GetVisRgn(Wnd->hwndSelf, DCX_WINDOW | DCX_CLIPSIBLINGS ); - HRGN dirtyRgn = CreateRectRgn(0,0,0,0); + HRGN32 newVisRgn = DCE_GetVisRgn(Wnd->hwndSelf,DCX_WINDOW | DCX_CLIPSIBLINGS); + HRGN32 dirtyRgn = CreateRectRgn(0,0,0,0); int other, my; dprintf_win(stddeb,"cleaning up...new wnd=(%i %i-%i %i) old wnd=(%i %i-%i %i)\n\ @@ -1434,7 +1434,7 @@ static UINT WINPOS_SizeMoveClean(WND* Wnd, HRGN oldVisRgn, LPRECT16 lpOldWndRect { HDC32 hDC; int update; - HRGN updateRgn; + HRGN32 updateRgn; int xfrom,yfrom,xto,yto,width,height; if( uFlags & SMC_DRAWFRAME ) @@ -1581,7 +1581,7 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, INT x, INT y, WINDOWPOS16 *winpos; WND * wndPtr; RECT16 newWindowRect, newClientRect, oldWindowRect; - HRGN visRgn = 0; + HRGN32 visRgn = 0; HWND tempInsertAfter= 0; int result = 0; UINT uFlags = 0;