Commit 18f92e76 authored by Alexandre Julliard's avatar Alexandre Julliard

Release 960717

Wed Jul 17 16:10:16 1996 Alexandre Julliard <julliard@lrc.epfl.ch> * [configure.in] Generate include/config.h instead of putting everything on the command-line. Removed -with-malloc-debug option (not useful for end users anyway). Added check for memmove(). * [include/wintypes.h] [*/Makefile.in] Added definition of __WINE__ symbol when compiling Wine code (emulator or library) as opposed to user programs. * [debugger/editline.c] [debugger/readline/*] Moved all the readline code into debugger/editline.c. Removed the readline subdirectory. * [files/profile.c] Added PROFILE_GetWineIniInt(). * [include/stackframe.h] [loader/task.c] The 16-bit stackframe now also exists for Winelib (even though it only ever contains one frame). * [loader/module.c] Added function MODULE_CreateDummyModule() to create a dummy Win16 module for Winelib and Win32. * [memory/ldt.c] Make sure the ldt entry contents will be acceptable for the Linux kernel. * [memory/selector.c] Fixed SetSelectorLimit() when the limit is in pages. * [misc/port.c] Added memmove(). * [miscemu/dpmi.c] Clear the segment registers that contain the selector being freed in int31/ax=0001. Added missing break after SelectorAccessRights call. * [win32/struct32.c] Added conversions for MDICREATESTRUCT. * [windows/winproc.c] Added message conversions for WM_MDICREATE. Tue Jul 16 19:46:24 1996 Pavel Kankovsky <KAN@frode.dcit.cz> * [windows/class.c] Added GetExePtr() call in CLASS_FindClassByAtom(). Mon Jul 15 17:49:38 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [if1632/*.spec] Some more trivial specs added. * [if1632/gdi32.spec] [objects/font.c][windows/dialog.c] CreateFont32* added, changed to new naming std. * [include/windows.h] [include/mmsystem.h] [include/wintypes.h] Some defines/types added. * [win32/thread.c] TlsSetValue() returns boolean. * [win32/resource.c] [loader/pe_resource.c] [loader/resource.c] [controls/menu.c] [objects/bitmap.c] Cleanup of the resource functions, mostly changes to new naming standard and fixing of argument types so that they agree with the win16/win32 API. Thu Jul 11 15:00:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu> * [windows/winpos.c] ShowWindow() fixes. * [windows/mdi.c] Fix reversed LPARAM in WM_MDIACTIVATE. * [wine.ini] New option AllocSystemColors tells Wine how many colors to grab from the system colormap. * [objects/bitblt.c] [objects/dc.c] Fixed pink garbage over Word buttons in PseudoColor. Added optional DSTINVERT shortcut for faster text selection. * [misc/wsprintf.c] Skip bogus segmented pointers in wsvnprintf16(). * [objects/gdiobj.c] Added palette handling to UnrealizeObject(). * [objects/color.c] [objects/palette.c] [windows/dce.c] Wine gets palette manager with support for more than 20 colors. Only PseudoColor and TrueColor visuals tested so far. * [windows/winpos.c] [windows/win.c] Set X size hints for WS_EX_DLGMODALFRAME windows (no resize) and use XReconfigureWMWindows() instead of XConfigureWindow() in managed mode. * [memory/global.c] Do not allocate more than 640K of DOS memory. * [misc/main.c] Do not allow -desktop and -managed together.
parent ca22b33d
This is release 960712 of Wine, the MS Windows emulator. This is still a
This is release 960717 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-960712: (see ChangeLog for details)
- Many built-in debugger improvements.
- Some more Win32 functions.
WHAT'S NEW with Wine-960717: (see ChangeLog for details)
- New palette management.
- Changes to the configuration process.
- Lots of bug fixes.
See the README file in the distribution for installation instructions.
......@@ -16,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:
sunsite.unc.edu:/pub/Linux/ALPHA/wine/development/Wine-960712.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-960712.tar.gz
ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-960712.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-960712.tar.gz
sunsite.unc.edu:/pub/Linux/ALPHA/wine/development/Wine-960717.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-960717.tar.gz
ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-960717.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-960717.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite.
......
1. 32-bit/16-bit call translation:
- EBP and ESP are sometimes corrupted while running 16-bit code.
2. Messaging:
1. Messaging:
- Message flow is not correct for multiple tasks
- Dialog Boxes created by WM_CREATE handler aren't visible
- MDI does not send WM_GETMINMAX message.
- resizing of MDI child windows sometimes leaves them unrepainted
3. Controls:
2. Controls:
- Some features are missing (like VK_SHIFT aided multiple selection in listboxes)
4. Miscellaneous:
3. Miscellaneous:
- InitializeLoadedDLLs() can't init LZEXPAND.DLL. (cs:ip => 0:0)
- LoadCursor does not correctly handle bitmap cursors
- AllocCSToDSAlias() shouldn't alloc alias for the same segment multiple times.
- Dialogs don't support resources which are referred to as integers.
5. Where to look in source files:
4. Where to look in source files:
- grep for FIXME in the source files.
......
----------------------------------------------------------------------
Wed Jul 17 16:10:16 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [configure.in]
Generate include/config.h instead of putting everything on the
command-line.
Removed -with-malloc-debug option (not useful for end users
anyway).
Added check for memmove().
* [include/wintypes.h] [*/Makefile.in]
Added definition of __WINE__ symbol when compiling Wine code
(emulator or library) as opposed to user programs.
* [debugger/editline.c] [debugger/readline/*]
Moved all the readline code into debugger/editline.c. Removed the
readline subdirectory.
* [files/profile.c]
Added PROFILE_GetWineIniInt().
* [include/stackframe.h] [loader/task.c]
The 16-bit stackframe now also exists for Winelib (even though it
only ever contains one frame).
* [loader/module.c]
Added function MODULE_CreateDummyModule() to create a dummy Win16
module for Winelib and Win32.
* [memory/ldt.c]
Make sure the ldt entry contents will be acceptable for the Linux
kernel.
* [memory/selector.c]
Fixed SetSelectorLimit() when the limit is in pages.
* [misc/port.c]
Added memmove().
* [miscemu/dpmi.c]
Clear the segment registers that contain the selector being freed
in int31/ax=0001.
Added missing break after SelectorAccessRights call.
* [win32/struct32.c]
Added conversions for MDICREATESTRUCT.
* [windows/winproc.c]
Added message conversions for WM_MDICREATE.
Tue Jul 16 19:46:24 1996 Pavel Kankovsky <KAN@frode.dcit.cz>
* [windows/class.c]
Added GetExePtr() call in CLASS_FindClassByAtom().
Mon Jul 15 17:49:38 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [if1632/*.spec]
Some more trivial specs added.
* [if1632/gdi32.spec] [objects/font.c][windows/dialog.c]
CreateFont32* added, changed to new naming std.
* [include/windows.h] [include/mmsystem.h] [include/wintypes.h]
Some defines/types added.
* [win32/thread.c]
TlsSetValue() returns boolean.
* [win32/resource.c] [loader/pe_resource.c] [loader/resource.c]
[controls/menu.c] [objects/bitmap.c]
Cleanup of the resource functions, mostly changes to new naming
standard and fixing of argument types so that they agree with the
win16/win32 API.
Thu Jul 11 15:00:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu>
* [windows/winpos.c]
ShowWindow() fixes.
* [windows/mdi.c]
Fix reversed LPARAM in WM_MDIACTIVATE.
* [wine.ini]
New option AllocSystemColors tells Wine how many colors to grab
from the system colormap.
* [objects/bitblt.c] [objects/dc.c]
Fixed pink garbage over Word buttons in PseudoColor. Added
optional DSTINVERT shortcut for faster text selection.
* [misc/wsprintf.c]
Skip bogus segmented pointers in wsvnprintf16().
* [objects/gdiobj.c]
Added palette handling to UnrealizeObject().
* [objects/color.c] [objects/palette.c] [windows/dce.c]
Wine gets palette manager with support for more than 20 colors.
Only PseudoColor and TrueColor visuals tested so far.
* [windows/winpos.c] [windows/win.c]
Set X size hints for WS_EX_DLGMODALFRAME windows (no resize) and
use XReconfigureWMWindows() instead of XConfigureWindow() in
managed mode.
* [memory/global.c]
Do not allocate more than 640K of DOS memory.
* [misc/main.c]
Do not allow -desktop and -managed together.
----------------------------------------------------------------------
Fri Jul 12 17:43:05 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [controls/scroll.c]
......
......@@ -6,8 +6,8 @@
SHELL = /bin/sh
CC = @CC@
CPP = @CPP@
CFLAGS = @CFLAGS@
DEFS = @DEFS@
CFLAGS = @CFLAGS@
OPTIONS = @OPTIONS@
X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
XPM_LIB = -lXpm
......@@ -17,13 +17,13 @@ YACC = @YACC@
LEX = @LEX@
LEXLIB = @LEXLIB@
DIVINCL = -I$(TOPSRC)/include
ALLCFLAGS = $(CFLAGS) $(DEFS) $(DIVINCL) $(X_CFLAGS) $(EXTRA_DEFS)
ALLCFLAGS = $(CFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) $(X_CFLAGS)
LDCOMBINE = ld -r
RM = rm -f
BUILD = $(TOPSRC)/tools/build
WINERC = $(TOPSRC)/rc/winerc
WINELIB = $(TOPSRC)/libwine.a
SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'DEFS=$(DEFS)'
SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)'
@SET_MAKE@
OBJS = $(C_SRCS:.c=.o) $(ASM_SRCS:.S=.o) $(EXTRA_OBJS)
......@@ -43,14 +43,14 @@ 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) $(DEFS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) -c -o $* -p $*
$(CPP) $(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) $(DEFS) $(DIVINCL) -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) -c -o $* -p $*
$(CPP) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) -c -o $* -p $*
$(RM) winerctmp.c
......
......@@ -13,20 +13,17 @@
SHELL = /bin/sh
CC = @CC@
CPP = @CPP@
CFLAGS = @CFLAGS@
DEFS = @DEFS@ -DWINE_INI_GLOBAL=\"$(WINE_INI_GLOBAL)\"
X_CFLAGS = @X_CFLAGS@
CFLAGS = @CFLAGS@
OPTIONS = @OPTIONS@
X_LIBS = @X_LIBS@
TOPSRC = @top_srcdir@
DIVINCL = -I$(TOPSRC)/include
XPM_LIB = -lXpm
XLIB = @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@
LDLIBS = @LDLIBS@
XPM_LIB = -lXpm
XLIB = @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@
LDLIBS = @LDLIBS@
AR = ar rc
RANLIB = @RANLIB@
RM = rm -f
SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'DEFS=$(DEFS)'
SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)'
@SET_MAKE@
# Installation infos
......@@ -38,10 +35,8 @@ prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
sysconfdir = @sysconfdir@
mandir = @mandir@/man1
manext = .1
WINE_INI_GLOBAL = $(sysconfdir)/wine.conf
# Main target to build
......@@ -64,7 +59,6 @@ COMMONSUBDIRS = \
EMUSUBDIRS = \
tools \
debugger \
debugger/readline \
if1632 \
miscemu
......@@ -89,7 +83,6 @@ COMMONOBJS = \
EMUOBJS = \
debugger/debugger.o \
debugger/readline/readline.o \
if1632/if1632.o \
miscemu/miscemu.o
......@@ -141,7 +134,7 @@ clean:
(cd include; $(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc)
distclean: clean
$(RM) config.* Make.rules
$(RM) config.* Make.rules include/config.h
$(RM) `find . \( -name Makefile -o -size 0 \) -print`
dummy:
......@@ -3,6 +3,7 @@ dnl Author: Michael Patra <micky@marie.physik.tu-berlin.de>
dnl <patra@itp1.physik.tu-berlin.de>
AC_REVISION([configure.in 1.00])
AC_INIT(controls/edit.c)
AC_CONFIG_HEADER(include/config.h)
AC_CONFIG_AUX_DIR(tools)
# We want these before the checks, so the checks can modify their values.
......@@ -14,21 +15,19 @@ dnl **** Command-line arguments ****
AC_ARG_WITH(library,
[ --with-library build Wine as a library instead of an emulator],
[AC_DEFINE(WINELIB) MAIN_TARGET="libwine.a"],[MAIN_TARGET="wine"])
[OPTIONS="-DWINELIB" MAIN_TARGET="libwine.a"],
[OPTIONS="" MAIN_TARGET="wine"])
AC_ARG_WITH(dll,
[ --with-dll build Wine as a DLL instead of an emulator],
[AC_DEFINE(WINELIB) AC_DEFINE(WINELIBDLL)
MAIN_TARGET="libwine.so.1.0" CFLAGS="$CFLAGS -fPIC"])
AC_SUBST(MAIN_TARGET)
[OPTIONS="-DWINELIB -DWINELIBDLL" MAIN_TARGET="libwine.so.1.0" CFLAGS="$CFLAGS -fPIC"])
AC_ARG_WITH(ipc,
[ --with-ipc use inter-process communication for DDE],
[AC_DEFINE(CONFIG_IPC)])
[OPTIONS="$OPTIONS -DCONFIG_IPC"])
AC_ARG_WITH(malloc-debug,
[ --with-malloc-debug enable malloc() debugging],
[AC_DEFINE(MALLOC_DEBUGGING)])
AC_SUBST(MAIN_TARGET)
AC_SUBST(OPTIONS)
dnl **** Check for some programs and libraries ****
......@@ -69,8 +68,7 @@ fi
dnl **** Check for functions and header files ****
AC_CHECK_FUNCS(tcgetattr usleep)
AC_CHECK_HEADERS(stdlib.h)
AC_CHECK_FUNCS(memmove tcgetattr usleep)
AC_HEADER_STAT()
AC_C_CONST()
AC_TYPE_SIZE_T()
......@@ -85,7 +83,6 @@ Make.rules
Makefile
controls/Makefile
debugger/Makefile
debugger/readline/Makefile
files/Makefile
if1632/Makefile
ipc/Makefile
......
TOPSRC = @top_srcdir@
MODULE = controls
DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = controls
C_SRCS = \
button.c \
......
......@@ -98,7 +98,7 @@ LRESULT ButtonWndProc(HWND32 hWnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
if (!hbitmapCheckBoxes)
{
BITMAP16 bmp;
hbitmapCheckBoxes = LoadBitmap(0, MAKEINTRESOURCE(OBM_CHECKBOXES));
hbitmapCheckBoxes = LoadBitmap16(0, MAKEINTRESOURCE(OBM_CHECKBOXES));
GetObject16( hbitmapCheckBoxes, sizeof(bmp), &bmp );
checkBoxWidth = bmp.bmWidth / 4;
checkBoxHeight = bmp.bmHeight / 3;
......
......@@ -51,7 +51,7 @@ static int COMBO_Init()
BITMAP16 bm;
dprintf_combo(stddeb, "COMBO_Init\n");
hComboBit = LoadBitmap(0, MAKEINTRESOURCE(OBM_COMBO));
hComboBit = LoadBitmap16(0, MAKEINTRESOURCE(OBM_COMBO));
GetObject16( hComboBit, sizeof(bm), &bm );
CBitHeight = bm.bmHeight;
CBitWidth = bm.bmWidth;
......
......@@ -154,7 +154,7 @@ LRESULT DesktopWndProc( HWND32 hwnd, UINT32 message,
ExitWindows( 0, 0 );
case WM_SETCURSOR:
return (LRESULT)SetCursor( LoadCursor( 0, IDC_ARROW ) );
return (LRESULT)SetCursor( LoadCursor16( 0, IDC_ARROW ) );
}
return 0;
......
......@@ -617,7 +617,7 @@ static INT EDIT_CallWordBreakProc(WND *wndPtr, char *s, INT index, INT count, IN
EDITWORDBREAKPROC wbp = (EDITWORDBREAKPROC)EDIT_EM_GetWordBreakProc(wndPtr, 0, 0L);
if (wbp) {
return CallWordBreakProc((FARPROC)wbp,
return CallWordBreakProc((FARPROC16)wbp,
(LONG)MAKE_SEGPTR(s), index, count, action);
} else
return EDIT_WordBreakProc(s, index, count, action);
......@@ -2107,7 +2107,7 @@ static LRESULT EDIT_EM_Undo(WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT EDIT_WM_Char(WND *wndPtr, WPARAM wParam, LPARAM lParam)
{
char str[2];
char c = (char)wParam;
unsigned char c = (unsigned char)wParam;
switch (c) {
case '\r':
......@@ -2739,7 +2739,7 @@ static LRESULT EDIT_WM_Paste(WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT EDIT_WM_SetCursor(WND *wndPtr, WPARAM wParam, LPARAM lParam)
{
if (LOWORD(lParam) == HTCLIENT) {
SetCursor(LoadCursor(0, IDC_IBEAM));
SetCursor(LoadCursor16(0, IDC_IBEAM));
return -1L;
} else
return 0L;
......
......@@ -136,12 +136,12 @@ BOOL MENU_Init()
/* Load bitmaps */
if (!(hStdCheck = LoadBitmap( 0, MAKEINTRESOURCE(OBM_CHECK) )))
if (!(hStdCheck = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_CHECK) )))
return FALSE;
GetObject16( hStdCheck, sizeof(bm), &bm );
check_bitmap_width = bm.bmWidth;
check_bitmap_height = bm.bmHeight;
if (!(hStdMnArrow = LoadBitmap( 0, MAKEINTRESOURCE(OBM_MNARROW) )))
if (!(hStdMnArrow = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_MNARROW) )))
return FALSE;
GetObject16( hStdMnArrow, sizeof(bm), &bm );
arrow_bitmap_width = bm.bmWidth;
......@@ -2514,11 +2514,11 @@ HMENU LookupMenuHandle( HMENU hmenu, INT id )
/**********************************************************************
* LoadMenu (USER.150)
*/
HMENU LoadMenu( HINSTANCE instance, SEGPTR name )
HMENU16 LoadMenu16( HINSTANCE16 instance, SEGPTR name )
{
HRSRC hRsrc;
HGLOBAL handle;
HMENU hMenu;
HRSRC16 hRsrc;
HGLOBAL16 handle;
HMENU16 hMenu;
if (HIWORD(name))
{
......@@ -2534,16 +2534,38 @@ HMENU LoadMenu( HINSTANCE instance, SEGPTR name )
/* check for Win32 module */
instance = GetExePtr( instance );
if (MODULE_GetPtr(instance)->flags & NE_FFLAGS_WIN32)
return WIN32_LoadMenuA(instance,PTR_SEG_TO_LIN(name));
return LoadMenu32A(instance,PTR_SEG_TO_LIN(name));
if (!(hRsrc = FindResource( instance, name, RT_MENU ))) return 0;
if (!(handle = LoadResource( instance, hRsrc ))) return 0;
hMenu = LoadMenuIndirect16( LockResource(handle) );
FreeResource( handle );
if (!(hRsrc = FindResource16( instance, name, RT_MENU ))) return 0;
if (!(handle = LoadResource16( instance, hRsrc ))) return 0;
hMenu = LoadMenuIndirect16(LockResource16(handle));
FreeResource16( handle );
return hMenu;
}
/*****************************************************************
* LoadMenu32A (USER32.370)
*/
HMENU32 LoadMenu32A( HINSTANCE32 instance, LPCSTR name )
{
HRSRC32 hrsrc = FindResource32A( instance, name, (LPSTR)RT_MENU );
if (!hrsrc) return 0;
return LoadMenuIndirect32A( (LPCVOID)LoadResource32( instance, hrsrc ));
}
/*****************************************************************
* LoadMenu32W (USER32.372)
*/
HMENU32 LoadMenu32W( HINSTANCE32 instance, LPCWSTR name )
{
HRSRC32 hrsrc = FindResource32W( instance, name, (LPWSTR)RT_MENU );
if (!hrsrc) return 0;
return LoadMenuIndirect32W( (LPCVOID)LoadResource32( instance, hrsrc ));
}
/**********************************************************************
* LoadMenuIndirect16 (USER.220)
*/
......
......@@ -79,18 +79,18 @@ static UINT uTrackingPos = 0;
*/
static void SCROLL_LoadBitmaps(void)
{
hUpArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROW));
hDnArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROW));
hLfArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROW));
hRgArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROW));
hUpArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROWD));
hDnArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROWD));
hLfArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROWD));
hRgArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROWD));
hUpArrowI = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROWI));
hDnArrowI = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROWI));
hLfArrowI = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROWI));
hRgArrowI = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROWI));
hUpArrow = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROW));
hDnArrow = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROW));
hLfArrow = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROW));
hRgArrow = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROW));
hUpArrowD = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROWD));
hDnArrowD = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROWD));
hLfArrowD = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROWD));
hRgArrowD = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROWD));
hUpArrowI = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROWI));
hDnArrowI = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROWI));
hLfArrowI = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROWI));
hRgArrowI = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROWI));
}
......
......@@ -87,9 +87,9 @@ LRESULT StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
CREATESTRUCT16 *cs = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam);
if (cs->lpszName)
{
HICON hicon = LoadIcon( cs->hInstance, cs->lpszName );
HICON16 hicon = LoadIcon16( cs->hInstance, cs->lpszName );
if (!hicon) /* Try OEM icon (FIXME: is this right?) */
hicon = LoadIcon( 0, cs->lpszName );
hicon = LoadIcon16( 0, cs->lpszName );
STATIC_SetIcon( wndPtr, hicon );
}
return 1;
......@@ -136,7 +136,7 @@ LRESULT StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_SETTEXT:
if (style == SS_ICON)
/* FIXME : should we also return the previous hIcon here ??? */
STATIC_SetIcon( wndPtr, LoadIcon( wndPtr->hInstance,
STATIC_SetIcon( wndPtr, LoadIcon16( wndPtr->hInstance,
(SEGPTR)lParam ));
else
DEFWND_SetText( wndPtr, (LPSTR)PTR_SEG_TO_LIN(lParam) );
......
......@@ -15,32 +15,35 @@
#include "module.h"
#include "heap.h"
static WNDCLASS16 WIDGETS_BuiltinClasses16[] =
typedef struct
{
UINT16 style;
INT16 wndExtra;
HBRUSH16 background;
LPCSTR procName;
LPCSTR className;
} BUILTIN_CLASS_INFO16;
static const BUILTIN_CLASS_INFO16 WIDGETS_BuiltinClasses16[] =
{
{ CS_GLOBALCLASS | CS_PARENTDC,
(WNDPROC16)"StaticWndProc", 0, sizeof(STATICINFO),
0, 0, 0, 0, 0, (SEGPTR)"STATIC" },
sizeof(STATICINFO), 0, "StaticWndProc", "STATIC" },
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
(WNDPROC16)"ScrollBarWndProc", 0, sizeof(SCROLLINFO),
0, 0, 0, 0, 0, (SEGPTR)"SCROLLBAR" },
sizeof(SCROLLINFO), 0, "ScrollBarWndProc", "SCROLLBAR" },
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
(WNDPROC16)"ListBoxWndProc", 0, 8,
0, 0, 0, 0, 0, (SEGPTR)"LISTBOX" },
8, 0, "ListBoxWndProc", "LISTBOX" },
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
(WNDPROC16)"ComboBoxWndProc", 0, 8,
0, 0, 0, 0, 0, (SEGPTR)"COMBOBOX" },
8, 0, "ComboBoxWndProc", "COMBOBOX" },
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS,
(WNDPROC16)"ComboLBoxWndProc", 0, 8,
0, 0, 0, 0, 0, (SEGPTR)"COMBOLBOX" },
8, 0, "ComboLBoxWndProc", "COMBOLBOX" },
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
(WNDPROC16)"EditWndProc", 0, sizeof(DWORD),
0, 0, 0, 0, 0, (SEGPTR)"EDIT" },
{ CS_GLOBALCLASS | CS_SAVEBITS, (WNDPROC16)"PopupMenuWndProc", 0, 8,
0, 0, 0, 0, 0, (SEGPTR)POPUPMENU_CLASS_NAME },
{ CS_GLOBALCLASS | CS_SAVEBITS, (WNDPROC16)"DefDlgProc", 0, DLGWINDOWEXTRA,
0, 0, 0, 0, 0, (SEGPTR)DIALOG_CLASS_NAME },
{ CS_GLOBALCLASS, (WNDPROC16)"MDIClientWndProc", 0, sizeof(MDICLIENTINFO),
0, 0, 0, STOCK_LTGRAY_BRUSH, 0, (SEGPTR)"MDICLIENT" }
sizeof(DWORD), 0, "EditWndProc", "EDIT" },
{ CS_GLOBALCLASS | CS_SAVEBITS,
sizeof(HMENU32), 0, "PopupMenuWndProc", POPUPMENU_CLASS_NAME },
{ CS_GLOBALCLASS | CS_SAVEBITS,
DLGWINDOWEXTRA, 0, "DefDlgProc", DIALOG_CLASS_NAME },
{ CS_GLOBALCLASS, sizeof(MDICLIENTINFO),
STOCK_LTGRAY_BRUSH, "MDIClientWndProc", "MDICLIENT" }
};
#define NB_BUILTIN_CLASSES16 \
......@@ -67,20 +70,28 @@ BOOL WIDGETS_Init(void)
{
int i;
char *name;
WNDCLASS16 *class16 = WIDGETS_BuiltinClasses16;
const BUILTIN_CLASS_INFO16 *info16 = WIDGETS_BuiltinClasses16;
WNDCLASS16 class16;
WNDCLASS32A *class32 = WIDGETS_BuiltinClasses32;
if (!(name = SEGPTR_ALLOC( 20 * sizeof(char) ))) return FALSE;
/* Create 16-bit classes */
for (i = 0; i < NB_BUILTIN_CLASSES16; i++, class16++)
class16.cbClsExtra = 0;
class16.hInstance = 0;
class16.hIcon = 0;
class16.hCursor = LoadCursor16( 0, IDC_ARROW );
class16.lpszMenuName = (SEGPTR)0;
class16.lpszClassName = SEGPTR_GET(name);
for (i = 0; i < NB_BUILTIN_CLASSES16; i++, info16++)
{
strcpy( name, (char *)class16->lpszClassName );
class16->lpszClassName = SEGPTR_GET(name);
class16->hCursor = LoadCursor( 0, IDC_ARROW );
class16->lpfnWndProc = MODULE_GetWndProcEntry16( (char *)class16->lpfnWndProc );
if (!RegisterClass16( class16 )) return FALSE;
class16.style = info16->style;
class16.lpfnWndProc = (WNDPROC16)MODULE_GetWndProcEntry16( info16->procName );
class16.cbWndExtra = info16->wndExtra;
class16.hbrBackground = info16->background;
strcpy( name, info16->className );
if (!RegisterClass16( &class16 )) return FALSE;
}
/* Create 32-bit classes */
......@@ -90,7 +101,7 @@ BOOL WIDGETS_Init(void)
/* Just to make sure the string is > 0x10000 */
strcpy( name, (char *)class32->lpszClassName );
class32->lpszClassName = name;
class32->hCursor = LoadCursor( 0, IDC_ARROW );
class32->hCursor = LoadCursor16( 0, IDC_ARROW );
if (!RegisterClass32A( class32 )) return FALSE;
}
......
TOPSRC = @top_srcdir@
EXTRA_DEFS = -DUSE_READLINE
DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = debugger
C_SRCS = \
break.c \
db_disasm.c \
editline.c \
hash.c \
info.c \
memory.c \
......
......@@ -205,7 +205,7 @@ expr:
void
issue_prompt(){
#ifndef USE_READLINE
#ifdef DONT_USE_READLINE
fprintf(stderr,"Wine-dbg>");
#endif
}
......
/* Lexical scanner for command line parsing in the Wine debugger
/*
* Lexical scanner for command line parsing
*
* Version 1.0
* Eric Youngdale
* 9/93
* Copyright 1993 Eric Youngdale
*/
%{
......@@ -13,18 +12,20 @@
#include "xmalloc.h"
#include "y.tab.h"
#ifdef USE_READLINE
#ifndef DONT_USE_READLINE
#undef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
if ( (result = dbg_read((char *) buf, max_size )) < 0 ) \
YY_FATAL_ERROR( "read() in flex scanner failed" );
#endif
extern char * readline(char *);
extern void add_history(char *);
static int dbg_read(char * buf, int size);
static char * make_symbol(char *);
void flush_symbols();
#endif /* DONT_USE_READLINE */
static int syntax_error;
%}
......@@ -136,7 +137,8 @@ mode { return tMODE; }
int yywrap(void) { return 1; }
#endif
#ifdef USE_READLINE
#ifndef DONT_USE_READLINE
#ifndef whitespace
#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
#endif
......@@ -216,10 +218,10 @@ char * make_symbol(char * symbol){
return local_symbols[next_symbol++] = xstrdup(symbol);
}
void
flush_symbols(){
void flush_symbols()
{
while(--next_symbol>= 0) free(local_symbols[next_symbol]);
next_symbol = 0;
}
#endif
#endif /* DONT_USE_READLINE */
TOPSRC = @top_srcdir@
EXTRA_DEFS = -DHIDE -DANSI_ARROWS
MODULE = readline
C_SRCS = editline.c sysunix.c
all: $(MODULE).o
@MAKE_RULES@
### Dependencies:
$Revision: 1.5 $
This is a line-editing library. It can be linked into almost any
program to provide command-line editing and recall.
It is call-compatible with the FSF readline library, but it is a
fraction of the size (and offers fewer features). It does not use
standard I/O. It is distributed under a "C News-like" copyright.
Configuration is done in the Makefile. Type "make testit" to get
a small slow shell for testing.
An earlier version was distributed with Byron's rc. Principal
changes over that version include:
Faster.
Is eight-bit clean (thanks to brendan@cs.widener.edu)
Written in K&R C, but ANSI compliant (gcc all warnings)
Propagates EOF properly; rc trip test now passes
Doesn't need or use or provide memmove.
More robust
Calling sequence changed to be compatible with readline.
Test program, new manpage, better configuration
More system-independant; includes Unix and OS-9 support.
Enjoy,
Rich $alz
<rsalz@osf.org>
Copyright 1992 Simmule Turner and Rich Salz. All rights reserved.
This software is not subject to any license of the American Telephone
and Telegraph Company or of the Regents of the University of California.
Permission is granted to anyone to use this software for any purpose on
any computer system, and to alter it and redistribute it freely, subject
to the following restrictions:
1. The authors are not responsible for the consequences of use of this
software, no matter how awful, even if they arise from flaws in it.
2. The origin of this software must not be misrepresented, either by
explicit claim or by omission. Since few users ever read sources,
credits must appear in the documentation.
3. Altered versions must be plainly marked as such, and must not be
misrepresented as being the original software. Since few users
ever read sources, credits must appear in the documentation.
4. This notice may not be removed or altered.
.\" $Revision: 1.1 $
.TH EDITLINE 3
.SH NAME
editline \- command-line editing library with history
.SH SYNOPSIS
.nf
.B "char *"
.B "readline(prompt)"
.B " char *prompt;"
.B "void"
.B "add_history(line)"
.B " char *line;"
.fi
.SH DESCRIPTION
.I Editline
is a library that provides an line-editing interface with text recall.
It is intended to be compatible with the
.I readline
library provided by the Free Software Foundation, but much smaller.
The bulk of this manual page describes the user interface.
.PP
The
.I readline
routine returns a line of text with the trailing newline removed.
The data is returned in a buffer allocated with
.IR malloc (3),
so the space should be released with
.IR free (3)
when the calling program is done with it.
Before accepting input from the user, the specified
.I prompt
is displayed on the terminal.
.PP
The
.I add_history
routine makes a copy of the specified
.I line
and adds it to the internal history list.
.SS "User Interface"
A program that uses this library provides a simple emacs-like editing
interface to its users.
A line may be edited before it is sent to the calling program by typing either
control characters or escape sequences.
A control character, shown as a caret followed by a letter, is typed by
holding down the ``control'' key while the letter is typed.
For example, ``^A'' is a control-A.
An escape sequence is entered by typing the ``escape'' key followed by one or
more characters.
The escape key is abbreviated as ``ESC.''
Note that unlike control keys, case matters in escape sequences; ``ESC\ F''
is not the same as ``ESC\ f''.
.PP
An editing command may be typed anywhere on the line, not just at the
beginning.
In addition, a return may also be typed anywhere on the line, not just at
the end.
.PP
Most editing commands may be given a repeat count,
.IR n ,
where
.I n
is a number.
To enter a repeat count, type the escape key, the number, and then
the command to execute.
For example, ``ESC\ 4\ ^f'' moves forward four characters.
If a command may be given a repeat count then the text ``[n]'' is given at the
end of its description.
.PP
The following control characters are accepted:
.RS
.nf
.ta \w'ESC DEL 'u
^A Move to the beginning of the line
^B Move left (backwards) [n]
^D Delete character [n]
^E Move to end of line
^F Move right (forwards) [n]
^G Ring the bell
^H Delete character before cursor (backspace key) [n]
^I Complete filename (tab key); see below
^J Done with line (return key)
^K Kill to end of line (or column [n])
^L Redisplay line
^M Done with line (alternate return key)
^N Get next line from history [n]
^P Get previous line from history [n]
^R Search backward (forward if [n]) through history for text;
\& must start line if text begins with an uparrow
^T Transpose characters
^V Insert next character, even if it is an edit command
^W Wipe to the mark
^X^X Exchange current location and mark
^Y Yank back last killed text
^[ Start an escape sequence (escape key)
^]c Move forward to next character ``c''
^? Delete character before cursor (delete key) [n]
.fi
.RE
.PP
The following escape sequences are provided.
.RS
.nf
.ta \w'ESC DEL 'u
ESC\ ^H Delete previous word (backspace key) [n]
ESC\ DEL Delete previous word (delete key) [n]
ESC\ SP Set the mark (space key); see ^X^X and ^Y above
ESC\ \. Get the last (or [n]'th) word from previous line
ESC\ \? Show possible completions; see below
ESC\ < Move to start of history
ESC\ > Move to end of history
ESC\ b Move backward a word [n]
ESC\ d Delete word under cursor [n]
ESC\ f Move forward a word [n]
ESC\ l Make word lowercase [n]
ESC\ u Make word uppercase [n]
ESC\ y Yank back last killed text
ESC\ v Show library version
ESC\ w Make area up to mark yankable
ESC\ nn Set repeat count to the number nn
ESC\ C Read from environment variable ``_C_'', where C is
\& an uppercase letter
.fi
.RE
.PP
The
.I editline
library has a small macro facility.
If you type the escape key followed by an uppercase letter,
.IR C ,
then the contents of the environment variable
.I _C_
are read in as if you had typed them at the keyboard.
For example, if the variable
.I _L_
contains the following:
.RS
^A^Kecho '^V^[[H^V^[[2J'^M
.RE
Then typing ``ESC L'' will move to the beginning of the line, kill the
entire line, enter the echo command needed to clear the terminal (if your
terminal is like a VT-100), and send the line back to the shell.
.PP
The
.I editline
library also does filename completion.
Suppose the root directory has the following files in it:
.RS
.nf
.ta \w'core 'u
bin vmunix
core vmunix.old
.fi
.RE
If you type ``rm\ /v'' and then the tab key.
.I Editline
will then finish off as much of the name as possible by adding ``munix''.
Because the name is not unique, it will then beep.
If you type the escape key and a question mark, it will display the
two choices.
If you then type a period and a tab, the library will finish off the filename
for you:
.RS
.nf
.RI "rm /v[TAB]" munix .TAB old
.fi
.RE
The tab key is shown by ``[TAB]'' and the automatically-entered text
is shown in italics.
.SH "BUGS AND LIMITATIONS"
Cannot handle lines more than 80 columns.
.SH AUTHORS
Simmule R. Turner <uunet.uu.net!capitol!sysgo!simmy>
and Rich $alz <rsalz@osf.org>.
Original manual page by DaviD W. Sanderson <dws@ssec.wisc.edu>.
/* $Revision: 1.3 $
**
** Internal header file for editline library.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#define CRLF "\r\n"
#define SIZE_T size_t
#define CONST const
typedef unsigned char CHAR;
#if defined(HIDE)
#define STATIC static
#else
#define STATIC /* NULL */
#endif /* !defined(HIDE) */
#define MEM_INC 64
#define SCREEN_INC 256
#define DISPOSE(p) free((char *)(p))
#define NEW(T, c) \
((T *)malloc((unsigned int)(sizeof (T) * (c))))
#define RENEW(p, T, c) \
(p = (T *)realloc((char *)(p), (unsigned int)(sizeof (T) * (c))))
#define COPYFROMTO(new, p, len) \
(void)memcpy((char *)(new), (char *)(p), (int)(len))
/*
** Variables and routines internal to this package.
*/
extern int rl_eof;
extern int rl_erase;
extern int rl_intr;
extern int rl_kill;
extern int rl_quit;
extern char *rl_complete();
extern int rl_list_possib();
extern void rl_ttyset();
extern void rl_add_slash();
/* $Revision: 1.1 $
**
** Unix system-dependant routines for editline library.
*/
#include "editline.h"
#if defined(HAVE_TCGETATTR)
#include <termios.h>
void
rl_ttyset(Reset)
int Reset;
{
static struct termios old;
struct termios new;
if (Reset == 0) {
(void)tcgetattr(0, &old);
rl_erase = old.c_cc[VERASE];
rl_kill = old.c_cc[VKILL];
rl_eof = old.c_cc[VEOF];
rl_intr = old.c_cc[VINTR];
rl_quit = old.c_cc[VQUIT];
new = old;
new.c_cc[VINTR] = -1;
new.c_cc[VQUIT] = -1;
new.c_lflag &= ~(ECHO | ICANON);
new.c_iflag &= ~(ISTRIP | INPCK);
new.c_cc[VMIN] = 1;
new.c_cc[VTIME] = 0;
(void)tcsetattr(0, TCSANOW, &new);
}
else
(void)tcsetattr(0, TCSANOW, &old);
}
#else
#include <sgtty.h>
void
rl_ttyset(Reset)
int Reset;
{
static struct sgttyb old_sgttyb;
static struct tchars old_tchars;
struct sgttyb new_sgttyb;
struct tchars new_tchars;
if (Reset == 0) {
(void)ioctl(0, TIOCGETP, &old_sgttyb);
rl_erase = old_sgttyb.sg_erase;
rl_kill = old_sgttyb.sg_kill;
(void)ioctl(0, TIOCGETC, &old_tchars);
rl_eof = old_tchars.t_eofc;
rl_intr = old_tchars.t_intrc;
rl_quit = old_tchars.t_quitc;
new_sgttyb = old_sgttyb;
new_sgttyb.sg_flags &= ~ECHO;
new_sgttyb.sg_flags |= RAW;
#if defined(PASS8)
new_sgttyb.sg_flags |= PASS8;
#endif /* defined(PASS8) */
(void)ioctl(0, TIOCSETP, &new_sgttyb);
new_tchars = old_tchars;
new_tchars.t_intrc = -1;
new_tchars.t_quitc = -1;
(void)ioctl(0, TIOCSETC, &new_tchars);
}
else {
(void)ioctl(0, TIOCSETP, &old_sgttyb);
(void)ioctl(0, TIOCSETC, &old_tchars);
}
}
#endif /* defined(HAVE_TCGETATTR) */
void
rl_add_slash(path, p)
char *path;
char *p;
{
struct stat Sb;
if (stat(path, &Sb) >= 0)
(void)strcat(p, S_ISDIR(Sb.st_mode) ? "/" : " ");
}
TOPSRC = @top_srcdir@
MODULE = files
prefix = @prefix@
sysconfdir = @sysconfdir@
DEFS = -D__WINE__ -DETCDIR=\"$(sysconfdir)\"
TOPSRC = @top_srcdir@
MODULE = files
C_SRCS = \
directory.c \
......
......@@ -848,7 +848,7 @@ HFILE _lcreat( LPCSTR path, INT32 attr )
/***********************************************************************
* _lcreat_uniq (Not a Windows API)
*/
HFILE _lcreat_uniq( LPCSTR path, INT attr )
HFILE _lcreat_uniq( LPCSTR path, INT32 attr )
{
DOS_FILE *file;
HFILE handle;
......
......@@ -53,6 +53,7 @@ static const char PROFILE_WineIniName[] = "/.winerc";
/* Check for comments in profile */
#define IS_ENTRY_COMMENT(str) ((str)[0] == ';')
#define WINE_INI_GLOBAL ETCDIR "/wine.conf"
/***********************************************************************
* PROFILE_CopyEntry
......@@ -562,6 +563,26 @@ int PROFILE_GetWineIniString( const char *section, const char *key_name,
/***********************************************************************
* PROFILE_GetWineIniInt
*
* Get a config integer from the wine.ini file.
*/
int PROFILE_GetWineIniInt( const char *section, const char *key_name, int def )
{
char buffer[20];
char *p;
long result;
PROFILEKEY *key = PROFILE_Find( &WineProfile, section, key_name, FALSE );
if (!key || !key->value) return def;
PROFILE_CopyEntry( buffer, key->value, sizeof(buffer), TRUE );
result = strtol( buffer, &p, 0 );
if (p == buffer) return 0; /* No digits at all */
return (int)result;
}
/***********************************************************************
* PROFILE_LoadWineIni
*
* Load the wine.ini file.
......
DEFS = -D__WINE__ -DNO_TRANSITION_TYPES
TOPSRC = @top_srcdir@
MODULE = if1632
DLLS = \
......
......@@ -17,7 +17,7 @@ base 2
12 stub LBItemFromPt
13 stub DrawInsert
14 stub CreateUpDownControl
15 stub InitCommonControls
15 return InitCommonControls 4 0
16 stub CreateStatusWindowW
17 stub CreateToolbarEx
18 stub DestroyPropertySheetPage
......
......@@ -64,7 +64,7 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects)
54 pascal16 CreateEllipticRgn(s_word s_word s_word s_word) CreateEllipticRgn
55 pascal16 CreateEllipticRgnIndirect(ptr) CreateEllipticRgnIndirect16
56 pascal16 CreateFont(s_word s_word s_word s_word s_word word word word
word word word word word ptr) CreateFont
word word word word word ptr) CreateFont16
57 pascal16 CreateFontIndirect(ptr) CreateFontIndirect16
58 pascal16 CreateHatchBrush(word long) CreateHatchBrush
60 pascal16 CreatePatternBrush(word) CreatePatternBrush
......@@ -241,12 +241,12 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects)
354 stub ShrinkGDIHeap
355 stub FTrapping0
360 pascal16 CreatePalette(ptr) CreatePalette
361 pascal16 GDISelectPalette(word word) GDISelectPalette
361 pascal16 GDISelectPalette(word word word) GDISelectPalette
362 pascal16 GDIRealizePalette(word) GDIRealizePalette
363 pascal16 GetPaletteEntries(word word word ptr) GetPaletteEntries
364 pascal16 SetPaletteEntries(word word word ptr) SetPaletteEntries
365 pascal16 RealizeDefaultPalette(word) RealizeDefaultPalette
366 stub UpdateColors
366 pascal16 UpdateColors(word) UpdateColors
367 pascal16 AnimatePalette(word word word ptr) AnimatePalette
368 pascal16 ResizePalette(word word) ResizePalette
370 pascal16 GetNearestPaletteIndex(word long) GetNearestPaletteIndex
......@@ -271,7 +271,7 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects)
409 stub CREATEUSERDISCARDABLEBITMAP
410 stub ISVALIDMETAFILE
411 pascal16 GetCurLogFont(word) GetCurLogFont
412 stub IsDCCurrentPalette
412 pascal16 IsDCCurrentPalette(word) IsDCCurrentPalette
439 pascal16 StretchDIBits (word s_word s_word word word word word
word word ptr ptr word long) StretchDIBits
440 pascal16 SetDIBits(word word word word ptr ptr word) SetDIBits
......
......@@ -45,17 +45,19 @@ base 1
0040 stdcall CreateEllipticRgnIndirect(ptr) CreateEllipticRgnIndirect32
0041 stub CreateEnhMetaFileA
0042 stub CreateEnhMetaFileW
0043 stub CreateFontA
0043 stdcall CreateFontA(long long long long long long long long
long long long long long ptr) CreateFont32A
0044 stdcall CreateFontIndirectA(ptr) CreateFontIndirect32A
0045 stdcall CreateFontIndirectW(ptr) CreateFontIndirect32W
0046 stub CreateFontW
0046 stdcall CreateFontW(long long long long long long long long
long long long long long ptr) CreateFont32W
0047 stub CreateHalftonePalette
0048 stub CreateHatchBrush
0049 stdcall CreateICA(ptr ptr ptr ptr) CreateIC
0050 stub CreateICW
0051 stub CreateMetaFileA
0052 stub CreateMetaFileW
0053 stub CreatePalette
0053 stdcall CreatePalette(ptr) CreatePalette
0054 stub CreatePatternBrush
0055 stdcall CreatePen(long long long) CreatePen
0056 stub CreatePenIndirect
......@@ -282,7 +284,7 @@ base 1
0277 stub PolylineTo
0278 stdcall PtInRegion(long long long) PtInRegion
0279 stub PtVisible
0280 stdcall RealizePalette(long) RealizePalette32
0280 stdcall RealizePalette(long) RealizePalette
0281 stdcall RectInRegion(long ptr) RectInRegion32
0282 stdcall RectVisible(long ptr) RectVisible32
0283 stdcall Rectangle(long long long long long) Rectangle
......@@ -302,7 +304,7 @@ base 1
0297 stub SelectClipRgn
0298 stub SelectFontLocal
0299 stdcall SelectObject(long long) SelectObject
0300 stdcall SelectPalette(long long long) SelectPalette32
0300 stdcall SelectPalette(long long long) SelectPalette
0301 stub SetAbortProc
0302 stub SetArcDirection
0303 stdcall SetBitmapBits(long long ptr) SetBitmapBits
......@@ -334,7 +336,7 @@ base 1
0328 stub SetPixelFormat
0329 stub SetPixelV
0330 stub SetPolyFillMode
0331 stub SetROP2
0331 stdcall SetROP2(long long) SetROP2
0332 stdcall SetRectRgn(long long long long long) SetRectRgn
0333 stub SetRelAbs
0334 stub SetStretchBltMode
......
......@@ -56,13 +56,13 @@ type win16
57 pascal16 GetProfileInt(ptr ptr s_word) GetProfileInt
58 pascal16 GetProfileString(ptr ptr ptr ptr word) GetProfileString
59 pascal16 WriteProfileString(ptr ptr ptr) WriteProfileString
60 pascal16 FindResource(word segptr segptr) FindResource
61 pascal16 LoadResource(word word) LoadResource
62 pascal LockResource(word) WIN16_LockResource
63 pascal16 FreeResource(word) FreeResource
64 pascal16 AccessResource(word word) AccessResource
65 pascal SizeofResource(word word) SizeofResource
66 pascal16 AllocResource(word word long) AllocResource
60 pascal16 FindResource(word segptr segptr) FindResource16
61 pascal16 LoadResource(word word) LoadResource16
62 pascal LockResource(word) WIN16_LockResource16
63 pascal16 FreeResource(word) FreeResource16
64 pascal16 AccessResource(word word) AccessResource16
65 pascal SizeofResource(word word) SizeofResource16
66 pascal16 AllocResource(word word long) AllocResource16
67 stub SetResourceHandler
68 pascal16 InitAtomTable(word) InitAtomTable
69 pascal16 FindAtom(segptr) FindAtom
......
......@@ -524,7 +524,7 @@ base 1
0519 stub SetVolumeLabelW
0520 stub SetupComm
0521 stub ShowConsoleCursor
0522 stdcall SizeofResource(long long) SizeofResource
0522 stdcall SizeofResource(long long) SizeofResource32
0523 stdcall Sleep(long) Sleep
0524 stub SleepEx
0525 stub SuspendThread
......
......@@ -19,22 +19,11 @@
dprintf_relay
#endif
/* Saved 16-bit stack for current process (Win16 only) */
WORD IF1632_Saved16_ss = 0;
WORD IF1632_Saved16_sp = 0;
/* Saved 32-bit stack for current process (Win16 only) */
DWORD IF1632_Saved32_esp = 0;
SEGPTR IF1632_Stack32_base = 0;
/* Original Unix stack */
DWORD IF1632_Original32_esp;
/***********************************************************************
* RELAY_Init
*/
BOOL RELAY_Init(void)
BOOL32 RELAY_Init(void)
{
WORD codesel;
......@@ -127,7 +116,7 @@ void RELAY_DebugCallFrom16( int func_type, char *args,
/***********************************************************************
* RELAY_DebugCallFrom16Ret
*/
void RELAY_DebugCallFrom16Ret( int func_type, int ret_val, int args32 )
void RELAY_DebugCallFrom16Ret( int func_type, int ret_val, SIGCONTEXT *context)
{
STACK16FRAME *frame;
WORD ordinal;
......@@ -156,13 +145,10 @@ void RELAY_DebugCallFrom16Ret( int func_type, int ret_val, int args32 )
case 2: /* regs */
printf( "retval=none ret=%04x:%04x ds=%04x\n",
frame->cs, frame->ip, frame->ds );
{
SIGCONTEXT *context = (SIGCONTEXT *)&args32;
printf( " AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n",
AX_reg(context), BX_reg(context), CX_reg(context),
DX_reg(context), SI_reg(context), DI_reg(context),
ES_reg(context), EFL_reg(context) );
}
printf( " AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n",
AX_reg(context), BX_reg(context), CX_reg(context),
DX_reg(context), SI_reg(context), DI_reg(context),
ES_reg(context), EFL_reg(context) );
break;
}
}
......@@ -274,7 +260,7 @@ void RELAY_DebugCallTo32( unsigned int func, int nbargs, unsigned int arg1 )
/**********************************************************************
* Catch (KERNEL.55)
*/
INT Catch( LPCATCHBUF lpbuf )
INT16 Catch( LPCATCHBUF lpbuf )
{
STACK16FRAME *pFrame = CURRENT_STACK16;
......@@ -298,7 +284,7 @@ INT Catch( LPCATCHBUF lpbuf )
/**********************************************************************
* Throw (KERNEL.56)
*/
int Throw( LPCATCHBUF lpbuf, int retval )
INT16 Throw( LPCATCHBUF lpbuf, INT16 retval )
{
STACK16FRAME *pFrame;
......
......@@ -10,7 +10,7 @@ base 1
0005 stub DllGetClassObject
0006 stub DoEnvironmentSubstA
0007 stub DoEnvironmentSubstW
0008 stub DragAcceptFiles
0008 stdcall DragAcceptFiles(long long) DragAcceptFiles
0009 stub DragFinish
0010 stub DragQueryFile
0011 stub DragQueryFileA
......
......@@ -149,7 +149,7 @@ heap 65520
147 pascal16 SetClipboardViewer(word) SetClipboardViewer
148 pascal16 GetClipboardViewer() GetClipboardViewer
149 pascal16 ChangeClipboardChain(word ptr) ChangeClipboardChain
150 pascal16 LoadMenu(word segptr) LoadMenu
150 pascal16 LoadMenu(word segptr) LoadMenu16
151 pascal16 CreateMenu() CreateMenu
152 pascal16 DestroyMenu(word) DestroyMenu
153 pascal16 ChangeMenu(word word segptr word word) ChangeMenu16
......@@ -172,11 +172,11 @@ heap 65520
170 pascal16 ArrangeIconicWindows(word) ArrangeIconicWindows
171 pascal16 WinHelp(word ptr word long) WinHelp
172 stub SwitchToThisWindow
173 pascal16 LoadCursor(word segptr) LoadCursor
174 pascal16 LoadIcon(word segptr) LoadIcon
175 pascal16 LoadBitmap(word segptr) LoadBitmap
176 pascal16 LoadString(word word ptr s_word) LoadString
177 pascal16 LoadAccelerators(word segptr) LoadAccelerators
173 pascal16 LoadCursor(word segptr) LoadCursor16
174 pascal16 LoadIcon(word segptr) LoadIcon16
175 pascal16 LoadBitmap(word segptr) LoadBitmap16
176 pascal16 LoadString(word word ptr s_word) LoadString16
177 pascal16 LoadAccelerators(word segptr) LoadAccelerators16
178 pascal16 TranslateAccelerator(word word ptr) TranslateAccelerator
179 pascal16 GetSystemMetrics(word) GetSystemMetrics
180 pascal GetSysColor(word) GetSysColor
......@@ -187,8 +187,8 @@ heap 65520
185 pascal16 GrayString(word word segptr segptr s_word s_word s_word s_word s_word) GrayString
186 pascal16 SwapMouseButton(word) SwapMouseButton
187 pascal16 EndMenu() EndMenu
188 pascal16 SetSysModalWindow(word) SetSysModalWindow
189 pascal16 GetSysModalWindow() GetSysModalWindow
188 pascal16 SetSysModalWindow(word) SetSysModalWindow16
189 pascal16 GetSysModalWindow() GetSysModalWindow16
190 pascal16 GetUpdateRect(word ptr word) GetUpdateRect16
191 pascal16 ChildWindowFromPoint(word long) ChildWindowFromPoint16
192 pascal16 InSendMessage() InSendMessage
......
......@@ -137,7 +137,7 @@ base 1
0130 stdcall DestroyCaret() DestroyCaret
0131 stub DestroyCursor
0132 stub DestroyIcon
0133 stub DestroyMenu
0133 stdcall DestroyMenu(long) DestroyMenu
0134 stdcall DestroyWindow(long) DestroyWindow
0135 stdcall DialogBoxIndirectParamA(long ptr long ptr long) DialogBoxIndirectParam32A
0136 stub DialogBoxIndirectParamAorW
......@@ -358,28 +358,28 @@ base 1
0351 stub IsZoomed
0352 stdcall KillSystemTimer(long long) KillSystemTimer32
0353 stdcall KillTimer(long long) KillTimer32
0354 stdcall LoadAcceleratorsA(long ptr) WIN32_LoadAcceleratorsA
0355 stdcall LoadAcceleratorsW(long ptr) WIN32_LoadAcceleratorsW
0356 stdcall LoadBitmapA(long ptr) WIN32_LoadBitmapA
0357 stdcall LoadBitmapW(long ptr) WIN32_LoadBitmapW
0358 stdcall LoadCursorA(long ptr) WIN32_LoadCursorA
0354 stdcall LoadAcceleratorsA(long ptr) LoadAccelerators32A
0355 stdcall LoadAcceleratorsW(long ptr) LoadAccelerators32W
0356 stdcall LoadBitmapA(long ptr) LoadBitmap32A
0357 stdcall LoadBitmapW(long ptr) LoadBitmap32W
0358 stdcall LoadCursorA(long ptr) LoadCursor32A
0359 stub LoadCursorFromFileA
0360 stub LoadCursorFromFileW
0361 stdcall LoadCursorW(long ptr) WIN32_LoadCursorW
0362 stdcall LoadIconA(long ptr) WIN32_LoadIconA
0363 stdcall LoadIconW(long ptr) WIN32_LoadIconW
0361 stdcall LoadCursorW(long ptr) LoadCursor32W
0362 stdcall LoadIconA(long ptr) LoadIcon32A
0363 stdcall LoadIconW(long ptr) LoadIcon32W
0364 stub LoadImageA
0365 stub LoadImageW
0366 stub LoadKeyboardLayoutA
0367 stub LoadKeyboardLayoutW
0368 stub LoadLocalFonts
0369 stdcall LoadMenuA(long ptr) WIN32_LoadMenuA
0369 stdcall LoadMenuA(long ptr) LoadMenu32A
0370 stdcall LoadMenuIndirectA(ptr) LoadMenuIndirect32A
0371 stdcall LoadMenuIndirectW(ptr) LoadMenuIndirect32W
0372 stdcall LoadMenuW(long ptr) WIN32_LoadMenuW
0372 stdcall LoadMenuW(long ptr) LoadMenu32W
0373 stub LoadRemoteFonts
0374 stdcall LoadStringA(long long ptr long) WIN32_LoadStringA
0375 stdcall LoadStringW(long long ptr long) WIN32_LoadStringW
0374 stdcall LoadStringA(long long ptr long) LoadString32A
0375 stdcall LoadStringW(long long ptr long) LoadString32W
0376 stub LockWindowStation
0377 stub LockWindowUpdate
0378 stub LookupIconIdFromDirectory
......@@ -434,7 +434,7 @@ base 1
0427 stdcall RegisterClassExA(ptr) RegisterClassEx32A
0428 stdcall RegisterClassExW(ptr) RegisterClassEx32W
0429 stdcall RegisterClassW(ptr) RegisterClass32W
0430 stub RegisterClipboardFormatA
0430 stdcall RegisterClipboardFormatA(ptr) RegisterClipboardFormat
0431 stub RegisterClipboardFormatW
0432 stub RegisterHotKey
0433 stub RegisterLogonProcess
......
......@@ -49,7 +49,7 @@ type win32
0048 stub mciLoadCommandResource
0049 stub mciSendCommandA
0050 stub mciSendCommandW
0051 stub mciSendStringA
0051 stdcall mciSendStringA(ptr ptr long long) mciSendString
0052 stub mciSendStringW
0053 stub mciSetDriverData
0054 stub mciSetYieldProc
......
......@@ -123,7 +123,7 @@ extern LONG CallTo32_4( FARPROC32, DWORD, DWORD, DWORD, DWORD );
#define CallEnumObjectsProc( func, lpobj, lParam ) \
(*func)( lpobj, lParam )
#define CallEnumPropProc( func, hwnd, lpstr, data ) \
(*func)( hwnd, (LPCTSTR)(lpstr), data )
(*func)( hwnd, lpstr, data )
#define CallEnumTaskWndProc( func, hwnd, lParam ) \
(*func)( hwnd, lParam )
#define CallEnumWindowsProc16( func, hwnd, lParam ) \
......
#ifndef __WINE_COLOR_H
#define __WINE_COLOR_H
#include "palette.h"
#include "gdi.h"
extern HPALETTE16 COLOR_Init(void);
extern int COLOR_ToPhysical( DC *dc, COLORREF color );
extern void COLOR_SetMapping( DC *dc, HANDLE map, HANDLE revMap, WORD size );
extern BOOL COLOR_IsSolid( COLORREF color );
#define COLOR_FIXED 0x0001 /* read-only colormap - have to use XAllocColor (if not virtual)*/
#define COLOR_VIRTUAL 0x0002 /* no mapping needed - pixel == pixel color */
extern Colormap COLOR_WinColormap;
extern int COLOR_mapEGAPixel[16];
extern int* COLOR_PaletteToPixel;
extern int* COLOR_PixelToPalette;
extern int COLOR_ColormapSize;
#define COLOR_PRIVATE 0x1000 /* private colormap, identity mapping */
#define PC_SYS_USED 0x80 /* system peFlags */
#define PC_SYS_RESERVED 0x40
extern HPALETTE16 COLOR_Init(void);
extern COLORREF COLOR_ToLogical(int pixel);
extern int COLOR_ToPhysical( DC *dc, COLORREF color );
extern int COLOR_SetMapping( PALETTEOBJ* pal, BOOL mapOnly );
extern BOOL COLOR_IsSolid( COLORREF color );
extern Colormap COLOR_GetColormap();
extern UINT16 COLOR_GetSystemPaletteSize();
extern UINT16 COLOR_GetSystemPaletteFlags();
extern int COLOR_mapEGAPixel[16];
extern int* COLOR_PaletteToPixel;
extern int* COLOR_PixelToPalette;
extern int COLOR_ColormapSize;
#endif /* __WINE_COLOR_H */
/* include/config.h.in. Generated automatically from configure.in by autoheader. */
/* Define to empty if the keyword does not work. */
#undef const
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
#undef STAT_MACROS_BROKEN
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you have the memmove function. */
#undef HAVE_MEMMOVE
/* Define if you have the tcgetattr function. */
#undef HAVE_TCGETATTR
/* Define if you have the usleep function. */
#undef HAVE_USLEEP
......@@ -21,6 +21,6 @@ extern int FILE_Fstat( HFILE hFile, BYTE *pattr, DWORD *psize,
extern HFILE FILE_Dup( HFILE hFile );
extern HFILE FILE_Dup2( HFILE hFile1, HFILE hFile2 );
extern INT32 FILE_Read( HFILE hFile, LPVOID buffer, UINT32 count );
extern INT _lcreat_uniq( LPCSTR path, INT attr );
extern HFILE _lcreat_uniq( LPCSTR path, INT32 attr );
#endif /* __WINE_FILE_H */
......@@ -152,14 +152,6 @@ typedef struct
TEXTMETRIC16 metrics;
} X_PHYSFONT;
/* X physical palette information */
typedef struct
{
HANDLE16 hMapping; /* Color mapping table (or 0 for identity) */
HANDLE16 hRevMapping; /* Reverse color mapping table */
WORD mappingSize;
} X_PHYSPALETTE;
/* X-specific DC information */
typedef struct
{
......@@ -168,7 +160,6 @@ typedef struct
X_PHYSFONT font;
X_PHYSPEN pen;
X_PHYSBRUSH brush;
X_PHYSPALETTE pal;
} X_DC_INFO;
......
......@@ -17,8 +17,8 @@
typedef struct
{
HANDLE16 next; /* 00 Next hook in chain */
HOOKPROC proc WINE_PACKED; /* 02 Hook procedure */
short id; /* 06 Hook id (WH_xxx) */
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 */
......@@ -28,9 +28,9 @@ typedef struct
#define HOOK_MAGIC ((int)'H' | (int)'K' << 8) /* 'HK' */
extern HANDLE HOOK_GetHook( short id , HQUEUE hQueue );
extern DWORD HOOK_CallHooks( short id, short code,
WPARAM wParam, LPARAM lParam );
extern HANDLE16 HOOK_GetHook( INT16 id , HQUEUE16 hQueue );
extern LRESULT HOOK_CallHooks( INT16 id, INT16 code,
WPARAM16 wParam, LPARAM lParam );
extern void HOOK_FreeModuleHooks( HMODULE16 hModule );
extern void HOOK_FreeQueueHooks( HQUEUE16 hQueue );
......
......@@ -19,7 +19,7 @@ enum seg_type
typedef struct
{
unsigned long base; /* base address */
unsigned long limit; /* segment limit */
unsigned long limit; /* segment limit (in pages or bytes) */
int seg_32bit; /* is segment 32-bit? */
int read_only; /* is segment read-only? */
int limit_in_pages; /* is the limit in pages or bytes? */
......
......@@ -11,11 +11,11 @@
extern INT LIBRES_AccessResource( HINSTANCE hModule, HRSRC hRsrc );
extern HGLOBAL LIBRES_AllocResource( HINSTANCE hModule, HRSRC hRsrc, DWORD size );
extern HRSRC LIBRES_FindResource( HINSTANCE hModule, LPCSTR name, LPCSTR type );
extern HRSRC32 LIBRES_FindResource( HINSTANCE hModule, LPCSTR name, LPCSTR type );
extern BOOL LIBRES_FreeResource( HGLOBAL handle );
extern HGLOBAL LIBRES_LoadResource( HINSTANCE hModule, HRSRC hRsrc );
extern LPVOID LIBRES_LockResource( HGLOBAL handle );
extern DWORD LIBRES_SizeofResource( HINSTANCE hModule, HRSRC hRsrc );
extern HGLOBAL32 LIBRES_LoadResource( HINSTANCE hModule, HRSRC32 hRsrc );
extern LPVOID LIBRES_LockResource( HGLOBAL32 handle );
extern DWORD LIBRES_SizeofResource( HINSTANCE hModule, HRSRC32 hRsrc );
#endif /* WINELIB */
......
......@@ -1457,6 +1457,20 @@ typedef struct {
#define MCI_CONSTANT 8
#define MCI_END_CONSTANT 9
/* Mixer flags */
#define MIXER_OBJECTF_HANDLE 0x80000000L
#define MIXER_OBJECTF_MIXER 0x00000000L
#define MIXER_OBJECTF_HMIXER (MIXER_OBJECTF_HANDLE|MIXER_OBJECTF_MIXER)
#define MIXER_OBJECTF_WAVEOUT 0x10000000L
#define MIXER_OBJECTF_HWAVEOUT (MIXER_OBJECTF_HANDLE|MIXER_OBJECTF_WAVEOUT)
#define MIXER_OBJECTF_WAVEIN 0x20000000L
#define MIXER_OBJECTF_HWAVEIN (MIXER_OBJECTF_HANDLE|MIXER_OBJECTF_WAVEIN)
#define MIXER_OBJECTF_MIDIOUT 0x30000000L
#define MIXER_OBJECTF_HMIDIOUT (MIXER_OBJECTF_HANDLE|MIXER_OBJECTF_MIDIOUT)
#define MIXER_OBJECTF_MIDIIN 0x40000000L
#define MIXER_OBJECTF_HMIDIIN (MIXER_OBJECTF_HANDLE|MIXER_OBJECTF_MIDIIN)
#define MIXER_OBJECTF_AUX 0x50000000L
#define MAKEMCIRESOURCE(wRet, wRes) MAKELRESULT((wRet), (wRes))
typedef struct {
......
......@@ -49,6 +49,7 @@ struct options
int ipc; /* Use IPC mechanisms */
WINE_LANGUAGE language; /* Current language */
int managed; /* Managed windows */
int perfectGraphics; /* Favor correctness over speed for graphics */
};
extern struct options Options;
......@@ -58,5 +59,7 @@ extern struct options Options;
extern int PROFILE_LoadWineIni(void);
extern int PROFILE_GetWineIniString( const char *section, const char *key_name,
const char *def, char *buffer, int len );
extern int PROFILE_GetWineIniInt( const char *section, const char *key_name,
int def );
#endif
......@@ -16,10 +16,13 @@ typedef struct
{
GDIOBJHDR header;
LOGPALETTE logpalette WINE_PACKED;
int *mapping;
} PALETTEOBJ;
#pragma pack(4)
extern int PALETTE_GetObject( PALETTEOBJ * palette, int count, LPSTR buffer );
extern BOOL PALETTE_DeleteObject( HPALETTE16 hpalette, PALETTEOBJ *palette );
extern BOOL PALETTE_UnrealizeObject( HPALETTE16 hpalette, PALETTEOBJ *palette);
#endif /* __WINE_PALETTE_H */
......@@ -14,7 +14,6 @@ struct pe_data {
int base_addr;
int load_addr;
int vma_size;
int resource_offset; /* offset to resource typedirectory in file */
};
typedef struct pe_data PE_MODULE;
......
......@@ -43,13 +43,13 @@ extern void LIBRES_RegisterResources(const struct resource* const * Res);
#define WINE_CONSTRUCTOR
#endif
extern int NE_AccessResource( HMODULE hModule, HRSRC hRsrc );
extern BOOL NE_FreeResource( HMODULE hModule, HGLOBAL handle );
extern HRSRC NE_FindResource( HMODULE hModule, SEGPTR typeId, SEGPTR resId );
extern DWORD NE_SizeofResource( HMODULE hModule, HRSRC hRsrc );
extern SEGPTR NE_LockResource( HMODULE hModule, HGLOBAL handle );
extern HGLOBAL NE_AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size );
extern HGLOBAL NE_LoadResource( HMODULE hModule, HRSRC hRsrc );
extern int NE_AccessResource( HMODULE16 hModule, HRSRC hRsrc );
extern BOOL NE_FreeResource( HMODULE16 hModule, HGLOBAL handle );
extern HRSRC NE_FindResource( HMODULE16 hModule, SEGPTR typeId, SEGPTR resId );
extern DWORD NE_SizeofResource( HMODULE16 hModule, HRSRC hRsrc );
extern SEGPTR NE_LockResource( HMODULE16 hModule, HGLOBAL handle );
extern HGLOBAL NE_AllocResource( HMODULE16 hModule, HRSRC hRsrc, DWORD size );
extern HGLOBAL NE_LoadResource( HMODULE16 hModule, HRSRC hRsrc );
extern HANDLE SYSRES_LoadResource( SYSTEM_RESOURCE id );
extern void SYSRES_FreeResource( HANDLE handle );
......
......@@ -10,16 +10,6 @@
#include <stddef.h>
HANDLE32 FindResource32A( HINSTANCE hModule, LPCSTR name, LPCSTR type );
HANDLE32 FindResource32W( HINSTANCE hModule, LPCWSTR name, LPCWSTR type );
HANDLE32 LoadResource32( HINSTANCE hModule, HANDLE32 hRsrc );
LPVOID LockResource32( HANDLE32 handle );
BOOL FreeResource32( HANDLE32 handle );
INT AccessResource32( HINSTANCE hModule, HRSRC hRsrc );
DWORD SizeofResource32( HINSTANCE hModule, HRSRC hRsrc );
int WIN32_LoadStringW(HINSTANCE instance, DWORD resource_id, LPWSTR buffer, int buflen);
int WIN32_LoadStringA(HINSTANCE instance, DWORD resource_id, LPSTR buffer, int buflen);
typedef struct _IMAGE_RESOURCE_DIRECTORY {
DWORD Characteristics;
DWORD TimeDateStamp;
......@@ -46,9 +36,4 @@ typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
WCHAR NameString[1];
} IMAGE_RESOURCE_DIR_STRING_U, *PIMAGE_RESOURCE_DIR_STRING_U;
HMENU WIN32_LoadMenuIndirectW(void *menu);
HMENU WIN32_LoadMenuW(HANDLE instance, LPCWSTR name);
HMENU WIN32_LoadMenuIndirectA(void *menu);
HMENU WIN32_LoadMenuA(HANDLE instance,LPCSTR name);
#endif /* __WINE_RESOURCE32_H */
......@@ -56,12 +56,12 @@ extern SEGPTR IF1632_Stack32_base;
/* Original Unix stack */
extern DWORD IF1632_Original32_esp;
#ifndef WINELIB
#define CURRENT_STACK16 \
((STACK16FRAME *)PTR_SEG_OFF_TO_LIN(IF1632_Saved16_ss,IF1632_Saved16_sp))
#define CURRENT_DS (CURRENT_STACK16->ds)
#ifndef WINELIB
/* Make a segmented pointer from a pointer to a variable located */
/* on the 32-bit stack for the current task. */
#if 0
......@@ -71,8 +71,6 @@ extern DWORD IF1632_Original32_esp;
#endif
SEGPTR MAKE_SEGPTR(void *ptr);
#else
#define CURRENT_STACK16 error.error
#define CURRENT_DS ((WORD)GetTaskDS())
#define MAKE_SEGPTR(ptr) ((SEGPTR)ptr)
#endif
......
......@@ -25,6 +25,10 @@ void STRUCT32_MSG32to16(const MSG32 *msg32,MSG16 *msg16);
void STRUCT32_CREATESTRUCT32Ato16(const CREATESTRUCT32A*,CREATESTRUCT16*);
void STRUCT32_CREATESTRUCT16to32A(const CREATESTRUCT16*,CREATESTRUCT32A*);
void STRUCT32_MDICREATESTRUCT32Ato16( const MDICREATESTRUCT32A*,
MDICREATESTRUCT16*);
void STRUCT32_MDICREATESTRUCT16to32A( const MDICREATESTRUCT16*,
MDICREATESTRUCT32A*);
#pragma pack(1)
......
......@@ -51,51 +51,51 @@ typedef struct
/* Task database. See 'Windows Internals' p. 226 */
typedef struct
{
HTASK hNext; /* Selector of next TDB */
WORD sp; /* Stack pointer of task */
WORD ss; /* Stack segment of task */
WORD nEvents; /* Events for this task */
char priority; /* Task priority, between -32 and 15 */
BYTE unused1;
HGLOBAL hStack32; /* Handle to 32-bit stack */
HTASK hSelf; /* Selector of this TDB */
HANDLE hPrevInstance; /* Previous instance of the module */
DWORD esp; /* 32-bit stack pointer */
WORD ctrlword8087; /* 80x87 control word */
WORD flags; /* Task flags */
UINT error_mode; /* Error mode (see SetErrorMode) */
WORD version; /* Expected Windows version */
HANDLE hInstance; /* Instance handle for this task */
HMODULE hModule; /* Module handle */
HQUEUE hQueue; /* Selector of task message queue */
HTASK hParent; /* Selector of TDB of parent task */
WORD signal_flags; /* Flags related to signal handler */
DWORD sighandler WINE_PACKED; /* Signal handler */
DWORD userhandler WINE_PACKED; /* USER signal handler */
DWORD discardhandler WINE_PACKED; /* Handler for GlobalDiscard() */
DWORD int0 WINE_PACKED; /* int 0 (divide by zero) handler */
DWORD int2 WINE_PACKED; /* int 2 (NMI) handler */
DWORD int4 WINE_PACKED; /* int 4 (INTO) handler */
DWORD int6 WINE_PACKED; /* int 6 (invalid opcode) handler */
DWORD int7 WINE_PACKED; /* int 7 (coprocessor) handler */
DWORD int3e WINE_PACKED; /* int 3e (80x87 emulator) handler */
DWORD int75 WINE_PACKED; /* int 75 (80x87 error) handler */
DWORD compat_flags WINE_PACKED; /* Compatibility flags */
BYTE unused4[14];
HANDLE hPDB; /* Selector of PDB (i.e. PSP) */
SEGPTR dta WINE_PACKED; /* Current DTA */
BYTE curdrive; /* Current drive */
BYTE curdir[65]; /* Current directory */
WORD nCmdShow; /* cmdShow parameter to WinMain */
HTASK hYieldTo; /* Next task to schedule */
DWORD dlls_to_init; /* Ptr to list of DLL to initialize */
HANDLE hCSAlias; /* Code segment alias for this TDB */
THUNKS thunks WINE_PACKED; /* Make proc instance thunks */
WORD more_thunks[6*4]; /* Space for 6 more thunks */
BYTE module_name[8]; /* Module name for task */
WORD magic; /* TDB signature */
DWORD unused7;
PDB pdb; /* PDB for this task */
HTASK16 hNext; /* 00 Selector of next TDB */
WORD sp; /* 02 Stack pointer of task */
WORD ss; /* 04 Stack segment of task */
WORD nEvents; /* 06 Events for this task */
char priority; /* 08 Task priority, -32..15 */
BYTE unused1; /* 09 */
HGLOBAL16 hStack32; /* 0a Handle to 32-bit stack */
HTASK16 hSelf; /* 0c Selector of this TDB */
HANDLE16 hPrevInstance; /* 0e Previous instance of module */
DWORD esp; /* 10 32-bit stack pointer */
WORD ctrlword8087; /* 14 80x87 control word */
WORD flags; /* 16 Task flags */
UINT16 error_mode; /* 18 Error mode (see SetErrorMode)*/
WORD version; /* 1a Expected Windows version */
HANDLE16 hInstance; /* 1c Instance handle for task */
HMODULE16 hModule; /* 1e Module handle */
HQUEUE16 hQueue; /* 20 Selector of task queue */
HTASK16 hParent; /* 22 Selector of TDB of parent */
WORD signal_flags; /* 24 Flags for signal handler */
DWORD sighandler WINE_PACKED; /* 26 Signal handler */
DWORD userhandler WINE_PACKED; /* 2a USER signal handler */
DWORD discardhandler WINE_PACKED; /* 2e Handler for GlobalDiscard() */
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 */
DWORD int6 WINE_PACKED; /* 3e int 6 (invalid opc) handler */
DWORD int7 WINE_PACKED; /* 42 int 7 (coprocessor) handler */
DWORD int3e WINE_PACKED; /* 46 int 3e (80x87 emu) handler */
DWORD int75 WINE_PACKED; /* 4a int 75 (80x87 error) handler */
DWORD compat_flags WINE_PACKED; /* 4e Compatibility flags */
BYTE unused4[14]; /* 52 */
HANDLE16 hPDB; /* 60 Selector of PDB (i.e. PSP) */
SEGPTR dta WINE_PACKED; /* 62 Current DTA */
BYTE curdrive; /* 66 Current drive */
BYTE curdir[65]; /* 67 Current directory */
WORD nCmdShow; /* a8 cmdShow parameter to WinMain */
HTASK16 hYieldTo; /* aa Next task to schedule */
DWORD dlls_to_init; /* ac Ptr to DLLs to initialize */
HANDLE16 hCSAlias; /* b0 Code segment for this TDB */
THUNKS thunks WINE_PACKED; /* b2 Make proc instance thunks */
WORD more_thunks[6*4]; /* c2 Space for 6 more thunks */
BYTE module_name[8]; /* f2 Module name for task */
WORD magic; /* fa TDB signature */
DWORD unused7; /* fc */
PDB pdb; /* 100 PDB for this task */
} TDB;
#define TDB_MAGIC ('T' | ('D' << 8))
......@@ -107,10 +107,11 @@ typedef struct
#pragma pack(4)
extern BOOL TASK_Init(void);
extern HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance,
HANDLE hPrevInstance, HANDLE hEnvironment,
char *cmdLine, WORD cmdShow );
extern void TASK_KillCurrentTask( int exitCode );
extern BOOL32 TASK_Init(void);
extern HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance,
HINSTANCE16 hPrevInstance,
HANDLE16 hEnvironment, LPCSTR cmdLine,
UINT16 cmdShow );
extern void TASK_KillCurrentTask( INT16 exitCode );
#endif /* _WINE_TASK_H */
......@@ -196,7 +196,7 @@ void WSASetLastError(INT iError);
INT WSAGetLastError(void);
BOOL WSAIsBlocking(void);
INT WSAUnhookBlockingHook(void);
FARPROC WSASetBlockingHook(FARPROC lpBlockFunc);
FARPROC16 WSASetBlockingHook(FARPROC16 lpBlockFunc);
INT WSACancelBlockingCall(void);
HANDLE WSAAsyncGetServByName(HWND hWnd, u_int wMsg,
LPCSTR name, LPCSTR proto,
......
......@@ -7,6 +7,15 @@
#ifndef __WINE_WINTYPES_H
#define __WINE_WINTYPES_H
#ifdef __WINE__
#include "config.h"
#endif
#if !defined(__WINE__) && !defined(WINELIB)
/* If we are not compiling Wine, then we are using Winelib */
#define WINELIB
#endif
#ifdef WINELIB
# ifdef WINELIB16
# undef WINELIB32
......@@ -28,7 +37,10 @@
/* Macros to map Winelib names to the correct implementation name */
/* depending on WINELIB16, WINELIB32 and UNICODE macros. */
#ifdef WINELIB
#ifdef __WINE__
# define WINELIB_NAME(func) this is a syntax error
# define WINELIB_NAME_AW(func) this is a syntax error
#else /* __WINE__ */
# ifdef WINELIB32
# define WINELIB_NAME(func) func##32
# ifdef UNICODE
......@@ -40,18 +52,15 @@
# define WINELIB_NAME(func) func##16
# define WINELIB_NAME_AW(func) func##16
# endif /* WINELIB32 */
#else /* WINELIB */
# define WINELIB_NAME(func) this is a syntax error
# define WINELIB_NAME_AW(func) this is a syntax error
#endif /* WINELIB */
#endif /* __WINE__ */
#ifdef WINELIB
# define DECL_WINELIB_TYPE(type) typedef WINELIB_NAME(type) type
# define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type
#else /* WINELIB */
#ifdef __WINE__
# define DECL_WINELIB_TYPE(type) /* nothing */
# define DECL_WINELIB_TYPE_AW(type) /* nothing */
#endif /* WINELIB */
#else /* __WINE__ */
# define DECL_WINELIB_TYPE(type) typedef WINELIB_NAME(type) type
# define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type
#endif /* __WINE__ */
/* Standard data types. These are the same for emulator and library. */
......@@ -86,6 +95,7 @@ typedef ACCESS_MASK REGSAM;
typedef INT16 HFILE;
typedef HANDLE32 HHOOK;
typedef HANDLE32 HKEY;
typedef HANDLE32 HMIXEROBJ;
/* Pointers types. These are the same for emulator and library. */
......@@ -104,6 +114,7 @@ typedef UINT16 *LPUINT16;
typedef INT32 *LPINT32;
typedef UINT32 *LPUINT32;
typedef HKEY *LPHKEY;
typedef HMIXEROBJ *LPHMIXEROBJ;
/* Special case: a segmented pointer is just a pointer in the library. */
......@@ -153,6 +164,7 @@ DECLARE_HANDLE(HWND);
typedef LRESULT (*DLGPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
typedef LRESULT (*FARPROC16)();
typedef LRESULT (*HOOKPROC16)(INT16,WPARAM16,LPARAM);
typedef VOID (*TIMERPROC16)(HWND16,UINT16,UINT16,DWORD);
typedef LRESULT (*WNDENUMPROC16)(HWND16,LPARAM);
typedef LRESULT (*WNDPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
......@@ -161,6 +173,7 @@ typedef LRESULT (*WNDPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
typedef LRESULT (*DLGPROC32)(HWND32,UINT32,WPARAM32,LPARAM);
typedef LRESULT (*FARPROC32)();
typedef LRESULT (*HOOKPROC32)(INT32,WPARAM32,LPARAM);
typedef VOID (*TIMERPROC32)(HWND32,UINT32,UINT32,DWORD);
typedef LRESULT (*WNDENUMPROC32)(HWND32,LPARAM);
typedef LRESULT (*WNDPROC32)(HWND32,UINT32,WPARAM32,LPARAM);
......@@ -169,7 +182,7 @@ typedef LRESULT (*WNDPROC32)(HWND32,UINT32,WPARAM32,LPARAM);
/* These types are _not_ defined for the emulator, because they */
/* depend on the UNICODE macro that only exists in user's code. */
#ifdef WINELIB
#ifndef __WINE__
# if defined(WINELIB32) && defined(UNICODE)
typedef WCHAR TCHAR;
typedef LPWSTR LPTSTR;
......@@ -179,7 +192,7 @@ typedef CHAR TCHAR;
typedef LPSTR LPTSTR;
typedef LPCSTR LPCTSTR;
# endif /* WINELIB32 && UNICODE */
#endif /* WINELIB */
#endif /* __WINE__ */
/* Data types specific to the library. These do _not_ exist in the emulator. */
......@@ -247,7 +260,7 @@ DECL_WINELIB_TYPE(WNDPROC);
/* Define some empty macros for compatibility with Windows code. */
#ifdef WINELIB
#ifndef __WINE__
#define CALLBACK
#define NEAR
#define FAR
......@@ -257,15 +270,15 @@ DECL_WINELIB_TYPE(WNDPROC);
#define _near
#define _pascal
#define __export
#endif /* WINELIB */
#endif /* __WINE__ */
/* Macro for structure packing. */
#ifdef WINELIB
#define WINE_PACKED
#else
#ifdef __GNUC__
#define WINE_PACKED __attribute__ ((packed))
#endif /* WINELIB */
#else
#define WINE_PACKED /* nothing */
#endif
/* Macros to split words and longs. */
......@@ -289,7 +302,7 @@ DECL_WINELIB_TYPE(WNDPROC);
/* Macros to access unaligned or wrong-endian WORDs and DWORDs. */
#if !defined(WINELIB) || defined(__i386__)
#ifdef __i386__
#define PUT_WORD(ptr,w) (*(WORD *)(ptr) = (w))
#define GET_WORD(ptr) (*(WORD *)(ptr))
#define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw))
......@@ -303,7 +316,7 @@ DECL_WINELIB_TYPE(WNDPROC);
PUT_WORD((WORD *)(ptr)+1,HIWORD(dw)))
#define GET_DWORD(ptr) ((DWORD)(GET_WORD(ptr) | \
((DWORD)GET_WORD((WORD *)(ptr)+1) << 16)))
#endif /* !WINELIB || __i386__ */
#endif /* __i386__ */
/* MIN and MAX macros */
......
......@@ -40,6 +40,8 @@ typedef struct
LPCWSTR lpszClassName;
} WNDCLASS32W, *LPWNDCLASS32W;
#pragma pack(1)
typedef struct
{
UINT16 style;
......@@ -54,6 +56,8 @@ typedef struct
SEGPTR lpszClassName WINE_PACKED;
} WNDCLASS16, *LPWNDCLASS16;
#pragma pack(4)
typedef struct
{
UINT32 cbSize;
......
DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = ipc
......
DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = library
......
......@@ -32,7 +32,7 @@ void LIBRES_RegisterResources(const struct resource* const * Res)
/**********************************************************************
* LIBRES_FindResource
*/
HRSRC LIBRES_FindResource( HINSTANCE hModule, LPCSTR name, LPCSTR type )
HRSRC32 LIBRES_FindResource( HINSTANCE hModule, LPCSTR name, LPCSTR type )
{
int nameid=0,typeid;
ResListE* ResBlock;
......@@ -68,12 +68,12 @@ HRSRC LIBRES_FindResource( HINSTANCE hModule, LPCSTR name, LPCSTR type )
for(Res=ResBlock->Resources; *Res; Res++)
if(name)
{
if((*Res)->type==typeid && !lstrcmpi((*Res)->name,name))
return (HRSRC)*Res;
if((*Res)->type==typeid && !lstrcmpi32A((*Res)->name,name))
return (HRSRC32)*Res;
}
else
if((*Res)->type==typeid && (*Res)->id==nameid)
return (HRSRC)*Res;
return (HRSRC32)*Res;
return 0;
}
......@@ -81,16 +81,16 @@ HRSRC LIBRES_FindResource( HINSTANCE hModule, LPCSTR name, LPCSTR type )
/**********************************************************************
* LIBRES_LoadResource
*/
HGLOBAL LIBRES_LoadResource( HINSTANCE hModule, HRSRC hRsrc )
HGLOBAL32 LIBRES_LoadResource( HINSTANCE hModule, HRSRC32 hRsrc )
{
return (HGLOBAL)(((struct resource*)hRsrc)->bytes);
return (HGLOBAL32)(((struct resource*)hRsrc)->bytes);
}
/**********************************************************************
* LIBRES_LockResource
*/
LPVOID LIBRES_LockResource( HGLOBAL handle )
LPVOID LIBRES_LockResource( HGLOBAL32 handle )
{
return (LPVOID)handle;
}
......@@ -118,7 +118,7 @@ INT LIBRES_AccessResource( HINSTANCE hModule, HRSRC hRsrc )
/**********************************************************************
* LIBRES_SizeofResource
*/
DWORD LIBRES_SizeofResource( HINSTANCE hModule, HRSRC hRsrc )
DWORD LIBRES_SizeofResource( HINSTANCE hModule, HRSRC32 hRsrc )
{
return (DWORD)(((struct resource*)hRsrc)->size);
}
......
......@@ -41,7 +41,7 @@ int CallTo32_LargeStack( int (*func)(), int nbargs, ...)
}
}
WORD CallTo16_word_ ( FARPROC func, WORD arg ) { return func(arg); }
WORD CallTo16_word_ ( FARPROC16 func, WORD arg ) { return func(arg); }
extern LRESULT AboutDlgProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT ColorDlgProc(HWND,UINT,WPARAM,LPARAM);
......@@ -60,22 +60,16 @@ extern LRESULT ReplaceTextDlgProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT ScrollBarWndProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT StaticWndProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT SystemMessageBoxProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT TASK_Reschedule(HWND,UINT,WPARAM,LPARAM);
LRESULT ErrorProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
fprintf(stderr,"ERROR: ErrorProc() called!\n");
return 0;
}
extern LRESULT TASK_Reschedule(void);
/***********************************************************************
* MODULE_GetWndProcEntry16 (not a Windows API function)
*
* Return an entry point from the WPROCS dll.
*/
WNDPROC MODULE_GetWndProcEntry16( char *name )
FARPROC16 MODULE_GetWndProcEntry16( char *name )
{
#define MAP_STR_TO_PROC(str,proc) if(!strcmp(name,str))return proc
#define MAP_STR_TO_PROC(str,proc) if(!strcmp(name,str))return (FARPROC16)proc
MAP_STR_TO_PROC("AboutDlgProc",AboutDlgProc);
MAP_STR_TO_PROC("ColorDlgProc",ColorDlgProc);
MAP_STR_TO_PROC("ComboBoxWndProc",ComboBoxWndProc);
......@@ -96,7 +90,7 @@ WNDPROC MODULE_GetWndProcEntry16( char *name )
MAP_STR_TO_PROC("SystemMessageBoxProc",SystemMessageBoxProc);
MAP_STR_TO_PROC("TASK_Reschedule",TASK_Reschedule);
fprintf(stderr,"warning: No mapping for %s(), add one in library/miscstubs.c\n",name);
return ErrorProc;
return NULL;
}
void DEBUG_EnterDebugger(void)
......
DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = loader
......
......@@ -199,7 +199,7 @@ BOOL16 BUILTIN_Init(void)
*/
HMODULE16 BUILTIN_LoadModule( LPCSTR name, BOOL16 force )
{
HMODULE hModule;
HMODULE16 hModule;
NE_MODULE *pModule;
BUILTIN_DLL *table;
char dllname[16], *p;
......
......@@ -194,7 +194,7 @@ void MODULE_DumpModule( HMODULE16 hmodule )
*/
void MODULE_WalkModules(void)
{
HMODULE hModule = hFirstModule;
HMODULE16 hModule = hFirstModule;
fprintf( stderr, "Module Flags Name\n" );
while (hModule)
{
......@@ -369,6 +369,84 @@ HINSTANCE16 MODULE_CreateInstance( HMODULE16 hModule, LOADPARAMS *params )
/***********************************************************************
* MODULE_CreateDummyModule
*
* Create a dummy NE module for Win32 or Winelib.
*/
HMODULE16 MODULE_CreateDummyModule( const OFSTRUCT *ofs )
{
HMODULE16 hModule;
NE_MODULE *pModule;
SEGTABLEENTRY *pSegment;
char *pStr;
INT32 of_size = sizeof(OFSTRUCT) - sizeof(ofs->szPathName)
+ strlen(ofs->szPathName) + 1;
INT32 size = sizeof(NE_MODULE) +
/* loaded file info */
of_size +
/* segment table: DS,CS */
2 * sizeof(SEGTABLEENTRY) +
/* name table */
9 +
/* several empty tables */
8;
hModule = GlobalAlloc16( GMEM_MOVEABLE | GMEM_ZEROINIT, size );
if (!hModule) return (HMODULE16)11; /* invalid exe */
FarSetOwner( hModule, hModule );
pModule = (NE_MODULE *)GlobalLock16( hModule );
/* Set all used entries */
pModule->magic = NE_SIGNATURE;
pModule->count = 1;
pModule->next = 0;
pModule->flags = 0;
pModule->dgroup = 1;
pModule->ss = 1;
pModule->cs = 2;
pModule->heap_size = 0xe000;
pModule->stack_size = 0x1000;
pModule->seg_count = 2;
pModule->modref_count = 0;
pModule->nrname_size = 0;
pModule->fileinfo = sizeof(NE_MODULE);
pModule->os_flags = NE_OSFLAGS_WINDOWS;
pModule->expected_version = 0x030a;
pModule->self = hModule;
/* Set loaded file information */
memcpy( pModule + 1, ofs, of_size );
((OFSTRUCT *)(pModule+1))->cBytes = of_size - 1;
pSegment = (SEGTABLEENTRY*)((char*)(pModule + 1) + of_size);
pModule->seg_table = pModule->dgroup_entry = (int)pSegment - (int)pModule;
/* Data segment */
pSegment->size = 0;
pSegment->flags = NE_SEGFLAGS_DATA;
pSegment->minsize = 0x1000;
pSegment++;
/* Code segment */
pSegment->flags = 0;
pSegment++;
/* Module name */
pStr = (char *)pSegment;
pModule->name_table = (int)pStr - (int)pModule;
strcpy( pStr, "\x08W32SXXXX" );
pStr += 9;
/* All tables zero terminated */
pModule->res_table = pModule->import_table = pModule->entry_table =
(int)pStr - (int)pModule;
MODULE_RegisterModule( pModule );
return hModule;
}
/***********************************************************************
* MODULE_LoadExeHeader
*/
static HMODULE16 MODULE_LoadExeHeader( HFILE hFile, OFSTRUCT *ofs )
......@@ -932,6 +1010,7 @@ HINSTANCE LoadModule( LPCSTR name, LPVOID paramBlock )
HANDLE hInstance, hPrevInstance;
NE_MODULE *pModule;
LOADPARAMS *params = (LOADPARAMS *)paramBlock;
OFSTRUCT ofs;
#ifndef WINELIB
WORD *pModRef, *pDLLs;
HFILE hFile;
......@@ -941,8 +1020,6 @@ HINSTANCE LoadModule( LPCSTR name, LPVOID paramBlock )
if (!hModule) /* We have to load the module */
{
OFSTRUCT ofs;
/* Try to load the built-in first if not disabled */
if ((hModule = BUILTIN_LoadModule( name, FALSE ))) return hModule;
......@@ -1134,13 +1211,11 @@ HINSTANCE LoadModule( LPCSTR name, LPVOID paramBlock )
pModule->count++;
}
#else
hModule = GlobalAlloc16( GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(NE_MODULE));
lstrcpyn32A( ofs.szPathName, name, sizeof(ofs.szPathName) );
if ((hModule = MODULE_CreateDummyModule( &ofs )) < 32) return hModule;
pModule = (NE_MODULE *)GlobalLock16( hModule );
pModule->count = 1;
pModule->magic = NE_SIGNATURE;
pModule->self = hModule;
hPrevInstance = 0;
hInstance = MODULE_CreateInstance( hModule, (LOADPARAMS*)paramBlock );
hInstance = MODULE_CreateInstance( hModule, params );
#endif /* WINELIB */
/* Create a task for this instance */
......
......@@ -30,13 +30,13 @@
/***********************************************************************
* NE_LoadSegment
*/
BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
BOOL NE_LoadSegment( HMODULE16 hModule, WORD segnum )
{
NE_MODULE *pModule;
SEGTABLEENTRY *pSegTable, *pSeg;
WORD *pModuleTable;
WORD count, i, offset;
HMODULE module;
HMODULE16 module;
FARPROC16 address;
int fd;
struct relocation_entry_s *rep, *reloc_entries;
......@@ -449,7 +449,7 @@ void NE_FixupPrologs( NE_MODULE *pModule )
*
* Call the DLL initialization code
*/
static BOOL NE_InitDLL( HMODULE hModule )
static BOOL NE_InitDLL( HMODULE16 hModule )
{
#ifndef WINELIB
int cs_reg, ds_reg, ip_reg, cx_reg, di_reg, bp_reg;
......@@ -498,7 +498,7 @@ static BOOL NE_InitDLL( HMODULE hModule )
pModule->cs = 0; /* Don't initialize it twice */
dprintf_dll( stddeb, "Calling LibMain, cs:ip=%04x:%04x ds=%04x di=%04x cx=%04x\n",
cs_reg, ip_reg, ds_reg, di_reg, cx_reg );
return CallTo16_regs_( (FARPROC)(cs_reg << 16 | ip_reg), ds_reg,
return CallTo16_regs_( (FARPROC16)(cs_reg << 16 | ip_reg), ds_reg,
0 /*es*/, 0 /*bp*/, 0 /*ax*/, 0 /*bx*/,
cx_reg, 0 /*dx*/, 0 /*si*/, di_reg );
#else
......@@ -513,10 +513,10 @@ static BOOL NE_InitDLL( HMODULE hModule )
*
* Initialize the loaded DLLs.
*/
void NE_InitializeDLLs( HMODULE hModule )
void NE_InitializeDLLs( HMODULE16 hModule )
{
NE_MODULE *pModule;
HMODULE *pDLL;
HMODULE16 *pDLL;
if (!(pModule = MODULE_GetPtr( hModule ))) return;
if (pModule->flags & NE_FFLAGS_WIN32)
......@@ -528,7 +528,7 @@ void NE_InitializeDLLs( HMODULE hModule )
{
HANDLE to_init = pModule->dlls_to_init;
pModule->dlls_to_init = 0;
for (pDLL = (HMODULE *)GlobalLock16( to_init ); *pDLL; pDLL++)
for (pDLL = (HMODULE16 *)GlobalLock16( to_init ); *pDLL; pDLL++)
{
NE_InitializeDLLs( *pDLL );
NE_InitDLL( *pDLL );
......
......@@ -30,7 +30,7 @@
* Find the type and resource id from their names.
* Return value is MAKELONG( typeId, resId ), or 0 if not found.
*/
static DWORD NE_FindNameTableId( HMODULE hModule, SEGPTR typeId, SEGPTR resId )
static DWORD NE_FindNameTableId( HMODULE16 hModule, SEGPTR typeId, SEGPTR resId )
{
NE_MODULE *pModule;
NE_TYPEINFO *pTypeInfo;
......@@ -52,9 +52,9 @@ static DWORD NE_FindNameTableId( HMODULE hModule, SEGPTR typeId, SEGPTR resId )
{
dprintf_resource( stddeb, "NameTable entry: type=%04x id=%04x\n",
pTypeInfo->type_id, pNameInfo->id );
handle = LoadResource( hModule,
handle = LoadResource16( hModule,
(HANDLE)((int)pNameInfo - (int)pModule) );
for(p = (WORD*)LockResource(handle); p && *p; p = (WORD *)((char*)p+*p))
for(p = (WORD*)LockResource16(handle); p && *p; p = (WORD *)((char*)p+*p))
{
dprintf_resource( stddeb," type=%04x '%s' id=%04x '%s'\n",
p[1], (char *)(p+3), p[2],
......@@ -88,7 +88,7 @@ static DWORD NE_FindNameTableId( HMODULE hModule, SEGPTR typeId, SEGPTR resId )
ret = MAKELONG( p[1], p[2] );
break;
}
FreeResource( handle );
FreeResource16( handle );
if (ret) return ret;
}
}
......@@ -134,7 +134,7 @@ static HRSRC NE_FindResourceFromType( NE_MODULE *pModule,
/***********************************************************************
* NE_FindResource
*/
HRSRC NE_FindResource( HMODULE hModule, SEGPTR typeId, SEGPTR resId )
HRSRC NE_FindResource( HMODULE16 hModule, SEGPTR typeId, SEGPTR resId )
{
NE_TYPEINFO *pTypeInfo;
HRSRC hRsrc;
......@@ -211,7 +211,7 @@ HRSRC NE_FindResource( HMODULE hModule, SEGPTR typeId, SEGPTR resId )
/***********************************************************************
* NE_AllocResource
*/
HGLOBAL NE_AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size )
HGLOBAL NE_AllocResource( HMODULE16 hModule, HRSRC hRsrc, DWORD size )
{
NE_NAMEINFO *pNameInfo=NULL;
WORD sizeShift;
......@@ -231,7 +231,7 @@ HGLOBAL NE_AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size )
/***********************************************************************
* NE_AccessResource
*/
int NE_AccessResource( HMODULE hModule, HRSRC hRsrc )
int NE_AccessResource( HMODULE16 hModule, HRSRC hRsrc )
{
NE_NAMEINFO *pNameInfo=NULL;
int fd;
......@@ -254,7 +254,7 @@ int NE_AccessResource( HMODULE hModule, HRSRC hRsrc )
/***********************************************************************
* NE_SizeofResource
*/
DWORD NE_SizeofResource( HMODULE hModule, HRSRC hRsrc )
DWORD NE_SizeofResource( HMODULE16 hModule, HRSRC hRsrc )
{
NE_NAMEINFO *pNameInfo=NULL;
WORD sizeShift;
......@@ -272,7 +272,7 @@ DWORD NE_SizeofResource( HMODULE hModule, HRSRC hRsrc )
/***********************************************************************
* NE_LoadResource
*/
HGLOBAL NE_LoadResource( HMODULE hModule, HRSRC hRsrc )
HGLOBAL NE_LoadResource( HMODULE16 hModule, HRSRC hRsrc )
{
NE_NAMEINFO *pNameInfo=NULL;
WORD sizeShift;
......@@ -307,7 +307,7 @@ HGLOBAL NE_LoadResource( HMODULE hModule, HRSRC hRsrc )
/***********************************************************************
* NE_LockResource
*/
SEGPTR NE_LockResource( HMODULE hModule, HGLOBAL handle )
SEGPTR NE_LockResource( HMODULE16 hModule, HGLOBAL handle )
{
/* May need to reload the resource if discarded */
......@@ -318,7 +318,7 @@ SEGPTR NE_LockResource( HMODULE hModule, HGLOBAL handle )
/***********************************************************************
* NE_FreeResource
*/
BOOL NE_FreeResource( HMODULE hModule, HGLOBAL handle )
BOOL NE_FreeResource( HMODULE16 hModule, HGLOBAL handle )
{
NE_TYPEINFO *pTypeInfo;
NE_NAMEINFO *pNameInfo;
......@@ -346,7 +346,7 @@ BOOL NE_FreeResource( HMODULE hModule, HGLOBAL handle )
}
pTypeInfo = (NE_TYPEINFO *)pNameInfo;
}
fprintf( stderr, "FreeResource: %04x %04x not found!\n", hModule, handle );
fprintf( stderr, "NE_FreeResource: %04x %04x not found!\n", hModule, handle );
return handle;
}
#endif /* WINELIB */
......@@ -122,7 +122,7 @@ FARPROC32 PE_FindExportedFunction(struct pe_data *pe, LPCSTR funcName)
if(strcmp(ename,funcName)==0)
return (FARPROC32)(load_addr + *function);
}else{
if(funcName == (int)*ordinal + exports->Base)
if((int)funcName == (int)*ordinal + exports->Base)
return (FARPROC32)(load_addr + *function);
}
function++;
......@@ -132,14 +132,14 @@ FARPROC32 PE_FindExportedFunction(struct pe_data *pe, LPCSTR funcName)
return NULL;
}
void fixup_imports(struct pe_data *pe, HMODULE hModule)
void fixup_imports(struct pe_data *pe, HMODULE16 hModule)
{
struct PE_Import_Directory * pe_imp;
int fixup_failed=0;
unsigned int load_addr = pe->load_addr;
int i;
NE_MODULE *ne_mod;
HMODULE *mod_ptr;
HMODULE16 *mod_ptr;
/* OK, now dump the import list */
dprintf_win32(stddeb, "\nDumping imports list\n");
......@@ -151,7 +151,7 @@ void fixup_imports(struct pe_data *pe, HMODULE hModule)
/* Now, allocate memory for dlls_to_init */
ne_mod = GlobalLock16(hModule);
ne_mod->dlls_to_init = GLOBAL_Alloc(GMEM_ZEROINIT,(i+1) * sizeof(HMODULE),
ne_mod->dlls_to_init = GLOBAL_Alloc(GMEM_ZEROINIT,(i+1) * sizeof(HMODULE16),
hModule, FALSE, FALSE, FALSE );
mod_ptr = GlobalLock16(ne_mod->dlls_to_init);
/* load the modules and put their handles into the list */
......@@ -159,7 +159,7 @@ void fixup_imports(struct pe_data *pe, HMODULE hModule)
{
char *name = (char*)load_addr+pe_imp->ModuleName;
mod_ptr[i] = LoadModule(name,(LPVOID)-1);
if(mod_ptr[i]<=(HMODULE)32)
if(mod_ptr[i]<=(HMODULE16)32)
{
char *p, buffer[256];
......@@ -169,7 +169,7 @@ void fixup_imports(struct pe_data *pe, HMODULE hModule)
strcpy( p + 1, name );
mod_ptr[i] = LoadModule( buffer, (LPVOID)-1 );
}
if(mod_ptr[i]<=(HMODULE)32)
if(mod_ptr[i]<=(HMODULE16)32)
{
fprintf(stderr,"Module %s not found\n",name);
exit(0);
......@@ -349,7 +349,7 @@ static void do_relocations(struct pe_data *pe)
* PE_LoadImage
* Load one PE format executable into memory
*/
static struct pe_data *PE_LoadImage( int fd, HMODULE hModule, WORD offset )
static struct pe_data *PE_LoadImage( int fd, HMODULE16 hModule, WORD offset )
{
struct pe_data *pe;
int i, result;
......@@ -433,16 +433,9 @@ static struct pe_data *PE_LoadImage( int fd, HMODULE hModule, WORD offset )
if(strcmp(pe->pe_seg[i].Name, ".edata") == 0)
pe->pe_export = (struct PE_Export_Directory *) result;
if(strcmp(pe->pe_seg[i].Name, ".rsrc") == 0) {
if(strcmp(pe->pe_seg[i].Name, ".rsrc") == 0)
pe->pe_resource = (struct PE_Resource_Directory *) result;
#if 0
/* FIXME pe->resource_offset should be deleted from structure if this
ifdef doesn't break anything */
/* save offset for PE_FindResource */
pe->resource_offset = pe->pe_seg[i].Virtual_Address -
pe->pe_seg[i].PointerToRawData;
#endif
}
if(strcmp(pe->pe_seg[i].Name, ".reloc") == 0)
pe->pe_reloc = (struct PE_Reloc_Block *) result;
......@@ -522,113 +515,45 @@ static struct pe_data *PE_LoadImage( int fd, HMODULE hModule, WORD offset )
return pe;
}
HINSTANCE MODULE_CreateInstance(HMODULE hModule,LOADPARAMS *params);
HINSTANCE MODULE_CreateInstance(HMODULE16 hModule,LOADPARAMS *params);
void InitTask( SIGCONTEXT *context );
HINSTANCE PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params )
{
PE_MODULE *pe;
int size, of_size;
NE_MODULE *pModule;
SEGTABLEENTRY *pSegment;
char *pStr;
DWORD cts;
HMODULE hModule;
HINSTANCE hInstance;
struct mz_header_s mz_header;
lseek(fd,0,SEEK_SET);
read( fd, &mz_header, sizeof(mz_header) );
of_size = sizeof(OFSTRUCT) - sizeof(ofs->szPathName)
+ strlen(ofs->szPathName) + 1;
size = sizeof(NE_MODULE) +
/* loaded file info */
of_size +
/* segment table: DS,CS */
2 * sizeof(SEGTABLEENTRY) +
/* name table */
9 +
/* several empty tables */
8;
hModule = GlobalAlloc16( GMEM_MOVEABLE | GMEM_ZEROINIT, size );
if (!hModule) return (HINSTANCE)11; /* invalid exe */
FarSetOwner( hModule, hModule );
pModule = (NE_MODULE*)GlobalLock16(hModule);
/* Set all used entries */
pModule->magic=NE_SIGNATURE;
pModule->count=1;
pModule->next=0;
pModule->flags=NE_FFLAGS_WIN32;
pModule->dgroup=1;
pModule->ss=1;
pModule->cs=2;
/* Who wants to LocalAlloc for a PE Module? */
pModule->heap_size=0x1000;
pModule->stack_size=0xF000;
pModule->seg_count=1;
pModule->modref_count=0;
pModule->nrname_size=0;
pModule->fileinfo=sizeof(NE_MODULE);
pModule->os_flags=NE_OSFLAGS_WINDOWS;
pModule->expected_version=0x30A;
pModule->self = hModule;
/* Set loaded file information */
memcpy( pModule + 1, ofs, of_size );
((OFSTRUCT *)(pModule+1))->cBytes = of_size - 1;
pSegment=(SEGTABLEENTRY*)((char*)(pModule + 1) + of_size);
pModule->seg_table=pModule->dgroup_entry=(int)pSegment-(int)pModule;
pSegment->size=0;
pSegment->flags=NE_SEGFLAGS_DATA;
pSegment->minsize=0x1000;
pSegment++;
cts=(DWORD)MODULE_GetWndProcEntry16("Win32CallToStart");
#ifdef WINELIB32
pSegment->selector=(void*)cts;
pModule->ip=0;
#else
pSegment->selector=cts>>16; /* FIXME!! */
pModule->ip=cts & 0xFFFF;
#endif
pSegment++;
HMODULE16 hModule;
HINSTANCE16 hInstance;
NE_MODULE *pModule;
SEGTABLEENTRY *pSegment;
FARPROC16 startup;
struct mz_header_s mz_header;
pStr=(char*)pSegment;
pModule->name_table=(int)pStr-(int)pModule;
strcpy(pStr,"\x08W32SXXXX");
pStr+=9;
if ((hModule = MODULE_CreateDummyModule( ofs )) < 32) return hModule;
pModule = (NE_MODULE *)GlobalLock16( hModule );
pModule->flags = NE_FFLAGS_WIN32;
/* All tables zero terminated */
pModule->res_table=pModule->import_table=pModule->entry_table=
(int)pStr-(int)pModule;
lseek( fd, 0, SEEK_SET );
read( fd, &mz_header, sizeof(mz_header) );
MODULE_RegisterModule( pModule );
/* Set the startup address */
pe = PE_LoadImage( fd, hModule, mz_header.ne_offset );
startup = MODULE_GetWndProcEntry16("Win32CallToStart");
pSegment = NE_SEG_TABLE(pModule) + pModule->cs - 1;
pSegment->selector = SELECTOROF(startup); /* FIXME */
pModule->ip = OFFSETOF(startup);
pModule->pe_module = pe;
pModule->heap_size=0x1000;
pModule->stack_size=0xE000;
pModule->pe_module = PE_LoadImage( fd, hModule, mz_header.ne_offset );
/* CreateInstance allocates now 64KB */
hInstance=MODULE_CreateInstance(hModule,NULL /* FIX: NULL? really? */);
hInstance = MODULE_CreateInstance( hModule, params );
/* FIXME: Is this really the correct place to initialise the DLL? */
if ((pe->pe_header->coff.Characteristics & IMAGE_FILE_DLL)) {
/* PE_InitDLL(hModule); */
} else {
TASK_CreateTask(hModule,hInstance,0,
params->hEnvironment,(LPSTR)PTR_SEG_TO_LIN(params->cmdLine),
*((WORD*)PTR_SEG_TO_LIN(params->showCmd)+1));
PE_InitializeDLLs(hModule);
}
return hInstance;
if (!(pModule->pe_module->pe_header->coff.Characteristics & IMAGE_FILE_DLL))
{
TASK_CreateTask( hModule, hInstance, 0,
params->hEnvironment,
(LPSTR)PTR_SEG_TO_LIN( params->cmdLine ),
*((WORD*)PTR_SEG_TO_LIN(params->showCmd) + 1) );
PE_InitializeDLLs( hModule );
}
return hInstance;
}
int USER_InitApp(HINSTANCE hInstance);
......@@ -637,29 +562,29 @@ void PE_InitTEB(int hTEB);
void PE_Win32CallToStart( SIGCONTEXT *context )
{
int fs;
HMODULE hModule;
HMODULE16 hModule;
NE_MODULE *pModule;
dprintf_win32(stddeb,"Going to start Win32 program\n");
InitTask( &context );
InitTask( context );
hModule = GetExePtr( GetCurrentTask() );
pModule = MODULE_GetPtr( hModule );
USER_InitApp( hModule );
fs=(int)GlobalAlloc16( GMEM_FIXED | GMEM_ZEROINIT, 0x10000 );
PE_InitTEB(fs);
__asm__ __volatile__("movw %w0,%%fs"::"r" (fs));
CallTaskStart32( (FARPROC)(pModule->pe_module->load_addr +
CallTaskStart32( (FARPROC32)(pModule->pe_module->load_addr +
pModule->pe_module->pe_header->opt_coff.AddressOfEntryPoint) );
}
int PE_UnloadImage( HMODULE hModule )
int PE_UnloadImage( HMODULE16 hModule )
{
printf("PEunloadImage() called!\n");
/* free resources, image, unmap */
return 1;
}
static void PE_InitDLL(HMODULE hModule)
static void PE_InitDLL(HMODULE16 hModule)
{
NE_MODULE *pModule;
PE_MODULE *pe;
......@@ -675,7 +600,7 @@ static void PE_InitDLL(HMODULE hModule)
if (pe->pe_header->coff.Characteristics & IMAGE_FILE_DLL)
{
printf("InitPEDLL() called!\n");
CallDLLEntryProc32( (FARPROC)(pe->load_addr +
CallDLLEntryProc32( (FARPROC32)(pe->load_addr +
pe->pe_header->opt_coff.AddressOfEntryPoint),
hModule, 0, 0 );
}
......@@ -708,16 +633,16 @@ void PE_InitTEB(int hTEB)
pTEB->taskid = getpid();
}
void PE_InitializeDLLs(HMODULE hModule)
void PE_InitializeDLLs(HMODULE16 hModule)
{
NE_MODULE *pModule;
HMODULE *pDLL;
HMODULE16 *pDLL;
pModule = MODULE_GetPtr( GetExePtr(hModule) );
if (pModule->dlls_to_init)
{
HANDLE to_init = pModule->dlls_to_init;
pModule->dlls_to_init = 0;
for (pDLL = (HMODULE *)GlobalLock16( to_init ); *pDLL; pDLL++)
for (pDLL = (HMODULE16 *)GlobalLock16( to_init ); *pDLL; pDLL++)
{
PE_InitializeDLLs( *pDLL );
PE_InitDLL( *pDLL );
......
......@@ -38,19 +38,27 @@
#define STACK32_SIZE 0x10000
extern void USER_AppExit(HTASK, HINSTANCE, HQUEUE );
/* ------ Internal variables ------ */
static HTASK hFirstTask = 0;
static HTASK hCurrentTask = 0;
static HTASK hTaskToKill = 0;
static HTASK hLockedTask = 0;
/* Saved 16-bit stack for current process (Win16 only) */
WORD IF1632_Saved16_ss = 0;
WORD IF1632_Saved16_sp = 0;
/* Saved 32-bit stack for current process (Win16 only) */
DWORD IF1632_Saved32_esp = 0;
SEGPTR IF1632_Stack32_base = 0;
/* Original Unix stack */
DWORD IF1632_Original32_esp;
static HTASK16 hFirstTask = 0;
static HTASK16 hCurrentTask = 0;
static HTASK16 hTaskToKill = 0;
static HTASK16 hLockedTask = 0;
static WORD nTaskCount = 0;
static HANDLE hDOSEnvironment = 0;
/* ------ Internal declarations ------ */
/* TASK_Reschedule() 16-bit entry point */
static FARPROC TASK_RescheduleProc;
static FARPROC16 TASK_RescheduleProc;
#ifdef WINELIB
#define TASK_SCHEDULE() TASK_Reschedule();
......@@ -63,7 +71,7 @@ static HANDLE TASK_CreateDOSEnvironment(void);
/***********************************************************************
* TASK_Init
*/
BOOL TASK_Init(void)
BOOL32 TASK_Init(void)
{
TASK_RescheduleProc = MODULE_GetWndProcEntry16( "TASK_Reschedule" );
if (!(hDOSEnvironment = TASK_CreateDOSEnvironment()))
......@@ -196,9 +204,9 @@ static HANDLE TASK_CreateDOSEnvironment(void)
/***********************************************************************
* TASK_LinkTask
*/
static void TASK_LinkTask( HTASK hTask )
static void TASK_LinkTask( HTASK16 hTask )
{
HTASK *prevTask;
HTASK16 *prevTask;
TDB *pTask;
if (!(pTask = (TDB *)GlobalLock16( hTask ))) return;
......@@ -218,9 +226,9 @@ static void TASK_LinkTask( HTASK hTask )
/***********************************************************************
* TASK_UnlinkTask
*/
static void TASK_UnlinkTask( HTASK hTask )
static void TASK_UnlinkTask( HTASK16 hTask )
{
HTASK *prevTask;
HTASK16 *prevTask;
TDB *pTask;
prevTask = &hFirstTask;
......@@ -369,7 +377,7 @@ static void TASK_CallToStart(void)
cs_reg, ip_reg, ds_reg,
IF1632_Saved16_ss, IF1632_Saved16_sp);
CallTo16_regs_( (FARPROC)(cs_reg << 16 | ip_reg), ds_reg,
CallTo16_regs_( (FARPROC16)(cs_reg << 16 | ip_reg), ds_reg,
pTask->hPDB /*es*/, 0 /*bp*/, 0 /*ax*/,
pModule->stack_size /*bx*/, pModule->heap_size /*cx*/,
0 /*dx*/, 0 /*si*/, ds_reg /*di*/ );
......@@ -384,8 +392,9 @@ static void TASK_CallToStart(void)
/***********************************************************************
* TASK_CreateTask
*/
HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
HANDLE hEnvironment, char *cmdLine, WORD cmdShow )
HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance,
HINSTANCE16 hPrevInstance, HANDLE16 hEnvironment,
LPCSTR cmdLine, UINT16 cmdShow )
{
HTASK hTask;
TDB *pTask;
......@@ -394,10 +403,10 @@ HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
SEGTABLEENTRY *pSegTable;
LPSTR name;
char filename[256];
#ifndef WINELIB32
char *stack16Top, *stack32Top;
STACK16FRAME *frame16;
STACK32FRAME *frame32;
#ifndef WINELIB32
extern DWORD CALLTO16_RetAddr_word;
#endif
......@@ -466,17 +475,16 @@ HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
/* Fill the PDB */
pTask->pdb.int20 = 0x20cd;
#ifndef WINELIB
pTask->pdb.dispatcher[0] = 0x9a; /* ljmp */
#ifndef WINELIB
*(FARPROC16 *)&pTask->pdb.dispatcher[1] = MODULE_GetEntryPoint( GetModuleHandle("KERNEL"), 102 ); /* KERNEL.102 is DOS3Call() */
pTask->pdb.savedint22 = INT_GetHandler( 0x22 );
pTask->pdb.savedint23 = INT_GetHandler( 0x23 );
pTask->pdb.savedint24 = INT_GetHandler( 0x24 );
pTask->pdb.fileHandlesPtr = (SEGPTR)MAKELONG( 0x18,
GlobalHandleToSel(pTask->hPDB) );
#else
pTask->pdb.fileHandlesPtr = pTask->pdb.fileHandles;
#endif
pTask->pdb.fileHandlesPtr =
PTR_SEG_OFF_TO_SEGPTR( GlobalHandleToSel(pTask->hPDB),
(int)&((PDB *)0)->fileHandles );
memset( pTask->pdb.fileHandles, 0xff, sizeof(pTask->pdb.fileHandles) );
pTask->pdb.environment = hEnvironment;
pTask->pdb.nbFiles = 20;
......@@ -504,7 +512,6 @@ HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
/* Allocate the 32-bit stack */
#ifndef WINELIB
pTask->hStack32 = GLOBAL_Alloc( GMEM_FIXED, STACK32_SIZE, pTask->hPDB,
FALSE, FALSE, FALSE );
......@@ -520,8 +527,10 @@ HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
frame32->ecx = 0;
frame32->ebx = 0;
frame32->ebp = 0;
#ifndef WINELIB
frame32->retaddr = (DWORD)TASK_CallToStart;
frame32->codeselector = WINE_CODE_SELECTOR;
#endif
pTask->esp = (DWORD)frame32;
/* Create the 16-bit stack frame */
......@@ -531,15 +540,17 @@ HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
pSegTable[pModule->ss-1].minsize + pModule->stack_size) & ~1;
stack16Top = (char *)PTR_SEG_OFF_TO_LIN( pTask->ss, pTask->sp );
frame16 = (STACK16FRAME *)stack16Top - 1;
frame16->saved_ss = 0; /*pTask->ss;*/
frame16->saved_sp = 0; /*pTask->sp;*/
frame16->saved_ss = 0;
frame16->saved_sp = 0;
frame16->ds = frame16->es = pTask->hInstance;
frame16->entry_point = 0;
frame16->entry_ip = OFFSETOF(TASK_RescheduleProc) + 14;
frame16->entry_cs = SELECTOROF(TASK_RescheduleProc);
frame16->bp = 0;
#ifndef WINELIB
frame16->ip = LOWORD( CALLTO16_RetAddr_word );
frame16->cs = HIWORD( CALLTO16_RetAddr_word );
#endif /* WINELIB */
pTask->sp -= sizeof(STACK16FRAME);
/* If there's no 16-bit stack yet, use a part of the new task stack */
......@@ -554,6 +565,7 @@ HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
/* Add a breakpoint at the start of the task */
#ifndef WINELIB
if (Options.debug)
{
if (pModule->flags & NE_FFLAGS_WIN32)
......@@ -570,7 +582,7 @@ HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
DEBUG_AddBreakpoint( &addr );
}
}
#endif
#endif /* WINELIB */
/* Add the task to the linked list */
......@@ -626,7 +638,7 @@ static void TASK_DeleteTask( HTASK hTask )
* be killed when either TASK_Reschedule or this function is called again
* in the context of another task.
*/
void TASK_KillCurrentTask( int exitCode )
void TASK_KillCurrentTask( INT16 exitCode )
{
extern void EXEC_ExitWindows( int retCode );
......@@ -731,7 +743,6 @@ void TASK_Reschedule(void)
/* Save the stacks of the previous task (if any) */
#ifndef WINELIB /* FIXME: JBP: IF1632 not allowed in libwine.a */
if (pOldTask)
{
pOldTask->ss = IF1632_Saved16_ss;
......@@ -739,7 +750,6 @@ void TASK_Reschedule(void)
pOldTask->esp = IF1632_Saved32_esp;
}
else IF1632_Original32_esp = IF1632_Saved32_esp;
#endif
/* Make the task the last in the linked list (round-robin scheduling) */
......@@ -751,12 +761,10 @@ void TASK_Reschedule(void)
/* Switch to the new stack */
hCurrentTask = hTask;
#ifndef WINELIB /* FIXME: JBP: IF1632 not allowed in libwine.a */
IF1632_Saved16_ss = pNewTask->ss;
IF1632_Saved16_sp = pNewTask->sp;
IF1632_Saved32_esp = pNewTask->esp;
IF1632_Stack32_base = WIN16_GlobalLock16( pNewTask->hStack32 );
#endif
}
......@@ -965,7 +973,7 @@ FARPROC16 MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
SEGPTR thunkaddr;
thunkaddr = TASK_AllocThunk( hCurrentTask );
if (!thunkaddr) return (FARPROC)0;
if (!thunkaddr) return (FARPROC16)0;
thunk = PTR_SEG_TO_LIN( thunkaddr );
dprintf_task( stddeb, "MakeProcInstance(%08lx,%04x): got thunk %08lx\n",
......@@ -976,7 +984,7 @@ FARPROC16 MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
*thunk++ = (BYTE)(hInstance >> 8);
*thunk++ = 0xea; /* ljmp func */
*(DWORD *)thunk = (DWORD)func;
return (FARPROC)thunkaddr;
return (FARPROC16)thunkaddr;
#endif
}
......@@ -996,7 +1004,7 @@ void FreeProcInstance16( FARPROC16 func )
/**********************************************************************
* GetCodeHandle (KERNEL.93)
*/
HANDLE GetCodeHandle( FARPROC proc )
HANDLE GetCodeHandle( FARPROC16 proc )
{
#ifndef WINELIB32
HANDLE handle;
......@@ -1109,7 +1117,7 @@ int GetInstanceData( HANDLE instance, WORD buffer, int len )
char *ptr = (char *)GlobalLock16( instance );
if (!ptr || !len) return 0;
if ((int)buffer + len >= 0x10000) len = 0x10000 - buffer;
memcpy( ptr + buffer, (char *)GlobalLock16( CURRENT_DS ) + buffer, len );
memcpy( (char *)GlobalLock16(CURRENT_DS) + buffer, ptr + buffer, len );
return len;
}
......@@ -1178,11 +1186,11 @@ BOOL IsTask( HTASK hTask )
/***********************************************************************
* GetExePtr (KERNEL.133)
*/
HMODULE GetExePtr( HANDLE handle )
HMODULE16 GetExePtr( HANDLE16 handle )
{
char *ptr;
HTASK hTask;
HANDLE owner;
HTASK16 hTask;
HANDLE16 owner;
/* Check for module handle */
......
DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = memory
......
......@@ -46,6 +46,8 @@ typedef struct
static GLOBALARENA *pGlobalArena = NULL;
static int globalArenaSize = 0;
static DWORD globalDOSfree = 655350;
#define GLOBAL_MAX_ALLOC_SIZE 0x00ff0000 /* Largest allocation is 16M - 64K */
#define GET_ARENA_PTR(handle) (pGlobalArena + ((handle) >> __AHSHIFT))
......@@ -550,11 +552,21 @@ BOOL16 GlobalUnWire( HGLOBAL16 handle )
/***********************************************************************
* GlobalDOSAlloc (KERNEL.184)
*
* Some programs rely on failure to allocate > 640K total with this function
*/
DWORD GlobalDOSAlloc( DWORD size )
{
WORD sel = GlobalAlloc16( GMEM_FIXED, size );
WORD sel;
if (size > globalDOSfree) return 0;
sel = GlobalAlloc16( GMEM_FIXED, size );
dprintf_global( stddeb, "GlobalDOSAlloc: %08lx -> returning %04x\n",
size, sel );
if (!sel) return 0;
globalDOSfree -= size;
return MAKELONG( sel, sel /* this one ought to be a real-mode segment */ );
}
......@@ -564,7 +576,12 @@ DWORD GlobalDOSAlloc( DWORD size )
*/
WORD GlobalDOSFree( WORD sel )
{
return GlobalFree16( GlobalHandle16(sel) ) ? sel : 0;
GLOBALARENA *pArena = GET_ARENA_PTR(sel);
if (!pArena) return sel;
globalDOSfree += pArena->size;
GlobalFree16( pArena->handle );
return 0;
}
......@@ -652,7 +669,7 @@ void GlobalUnfix( HGLOBAL16 handle )
/***********************************************************************
* FarSetOwner (KERNEL.403)
*/
void FarSetOwner( HANDLE16 handle, HANDLE16 hOwner )
void FarSetOwner( HGLOBAL16 handle, HANDLE16 hOwner )
{
GET_ARENA_PTR(handle)->hOwner = hOwner;
}
......@@ -661,7 +678,7 @@ void FarSetOwner( HANDLE16 handle, HANDLE16 hOwner )
/***********************************************************************
* FarGetOwner (KERNEL.404)
*/
HANDLE16 FarGetOwner( HANDLE16 handle )
HANDLE16 FarGetOwner( HGLOBAL16 handle )
{
return GET_ARENA_PTR(handle)->hOwner;
}
......
......@@ -95,6 +95,7 @@ int LDT_GetEntry( int entry, ldt_entry *content )
content->seg_32bit = (ldt_flags_copy[entry] & LDT_FLAGS_32BIT) != 0;
content->read_only = (ldt_flags_copy[entry] & LDT_FLAGS_READONLY) !=0;
content->limit_in_pages = (ldt_flags_copy[entry] & LDT_FLAGS_BIG) !=0;
if (content->limit_in_pages) content->limit >>= 12;
return ret;
}
......@@ -134,7 +135,34 @@ int LDT_SetEntry( int entry, const ldt_entry *content )
ldt_info.contents = content->type;
ldt_info.read_exec_only = content->read_only != 0;
ldt_info.limit_in_pages = content->limit_in_pages != 0;
ret = modify_ldt(1, &ldt_info, sizeof(ldt_info));
/* Make sure the info will be accepted by the kernel */
/* This is ugly, but what can I do? */
if (content->type == SEGMENT_STACK)
{
/* FIXME */
}
else
{
if (ldt_info.base_addr >= 0xc0000000)
{
fprintf( stderr, "LDT_SetEntry: invalid base addr %08lx\n",
ldt_info.base_addr );
return -1;
}
if (content->limit_in_pages)
{
if ((ldt_info.limit << 12) + 0xfff >
0xc0000000 - ldt_info.base_addr)
ldt_info.limit = (0xc0000000 - 0xfff - ldt_info.base_addr) >> 12;
}
else
{
if (ldt_info.limit > 0xc0000000 - ldt_info.base_addr)
ldt_info.limit = 0xc0000000 - ldt_info.base_addr;
}
}
if ((ret = modify_ldt(1, &ldt_info, sizeof(ldt_info))) < 0)
perror( "modify_ldt" );
}
#endif /* linux */
......@@ -223,10 +251,9 @@ void LDT_Print( int start, int length )
flags[1] = (ldt_flags_copy[i] & LDT_FLAGS_READONLY) ? '-' : 'w';
flags[2] = '-';
}
printf("%04x: sel=%04x base=%08lx limit=%05lx %s %d-bit %c%c%c\n",
printf("%04x: sel=%04x base=%08lx limit=%08lx %d-bit %c%c%c\n",
i, ENTRY_TO_SELECTOR(i),
ldt_copy[i].base, ldt_copy[i].limit,
ldt_flags_copy[i] & LDT_FLAGS_BIG ? "(pages)" : "(bytes)",
ldt_flags_copy[i] & LDT_FLAGS_32BIT ? 32 : 16,
flags[0], flags[1], flags[2] );
}
......
......@@ -26,10 +26,6 @@
#include "stddebug.h"
#include "debug.h"
#ifndef WINELIB
#pragma pack(1)
#endif
typedef struct
{
/* Arena header */
......@@ -61,6 +57,8 @@ typedef struct
BYTE lock; /* Lock count */
} LOCALHANDLEENTRY;
#pragma pack(1)
typedef struct
{
WORD check; /* 00 Heap checking flag */
......@@ -85,9 +83,7 @@ typedef struct
WORD magic; /* 28 Magic number */
} LOCALHEAPINFO;
#ifndef WINELIB
#pragma pack(4)
#endif
#define LOCAL_HEAP_MAGIC 0x484c /* 'LH' */
......
......@@ -82,7 +82,6 @@ WORD FreeSelector( WORD sel )
}
/* Clear the saved 16-bit selector */
#ifndef WINELIB
frame = CURRENT_STACK16;
while (frame)
{
......@@ -90,7 +89,6 @@ WORD FreeSelector( WORD sel )
if ((frame->es >= sel) && (frame->es < nextsel)) frame->es = 0;
frame = PTR_SEG_OFF_TO_LIN(frame->saved_ss, frame->saved_sp);
}
#endif
return 0;
}
......@@ -297,7 +295,9 @@ WORD SetSelectorLimit( WORD sel, DWORD limit )
{
ldt_entry entry;
LDT_GetEntry( SELECTOR_TO_ENTRY(sel), &entry );
entry.limit = limit;
entry.limit_in_pages = (limit >= 0x100000);
if (entry.limit_in_pages) entry.limit = limit >> 12;
else entry.limit = limit;
LDT_SetEntry( SELECTOR_TO_ENTRY(sel), &entry );
return sel;
}
......
......@@ -357,25 +357,7 @@ VOID RtlFillMemory( LPVOID ptr, UINT32 len, UINT32 fill )
*/
VOID RtlMoveMemory( LPVOID dst, LPCVOID src, UINT32 len )
{
/* memcpy does not support overlapped copies, */
/* and memmove is not portable. */
if (((BYTE *)dst + len <= (BYTE *)src) ||
((BYTE *)src + len <= (BYTE *)dst))
{
memcpy( dst, src, len );
return;
}
/* do it the hard way (FIXME: could do better than this) */
if (dst < src)
{
while (len--) *((BYTE *)dst)++ = *((BYTE *)src)++;
}
else
{
dst = (BYTE *)dst + len - 1;
src = (BYTE *)src + len - 1;
while (len--) *((BYTE *)dst)-- = *((BYTE *)src)--;
}
memmove( dst, src, len );
}
......
DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = misc
......
......@@ -38,11 +38,11 @@ static BOOL FileDlg_Init()
static BOOL initialized = 0;
if (!initialized) {
if (!hFolder) hFolder = LoadBitmap(0, MAKEINTRESOURCE(OBM_FOLDER));
if (!hFolder2) hFolder2 = LoadBitmap(0, MAKEINTRESOURCE(OBM_FOLDER2));
if (!hFloppy) hFloppy = LoadBitmap(0, MAKEINTRESOURCE(OBM_FLOPPY));
if (!hHDisk) hHDisk = LoadBitmap(0, MAKEINTRESOURCE(OBM_HDISK));
if (!hCDRom) hCDRom = LoadBitmap(0, MAKEINTRESOURCE(OBM_CDROM));
if (!hFolder) hFolder = LoadBitmap16(0, MAKEINTRESOURCE(OBM_FOLDER));
if (!hFolder2) hFolder2 = LoadBitmap16(0, MAKEINTRESOURCE(OBM_FOLDER2));
if (!hFloppy) hFloppy = LoadBitmap16(0, MAKEINTRESOURCE(OBM_FLOPPY));
if (!hHDisk) hHDisk = LoadBitmap16(0, MAKEINTRESOURCE(OBM_HDISK));
if (!hCDRom) hCDRom = LoadBitmap16(0, MAKEINTRESOURCE(OBM_CDROM));
if (hFolder == 0 || hFolder2 == 0 || hFloppy == 0 ||
hHDisk == 0 || hCDRom == 0)
{
......@@ -68,13 +68,13 @@ BOOL GetOpenFileName(LPOPENFILENAME lpofn)
if (lpofn->Flags & OFN_ENABLETEMPLATEHANDLE) hDlgTmpl = lpofn->hInstance;
else if (lpofn->Flags & OFN_ENABLETEMPLATE)
{
if (!(hResInfo = FindResource( lpofn->hInstance,
lpofn->lpTemplateName, RT_DIALOG)))
if (!(hResInfo = FindResource16(lpofn->hInstance,
lpofn->lpTemplateName, RT_DIALOG)))
{
CommDlgLastError = CDERR_FINDRESFAILURE;
return FALSE;
}
hDlgTmpl = LoadResource( lpofn->hInstance, hResInfo );
hDlgTmpl = LoadResource16( lpofn->hInstance, hResInfo );
}
else hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_OPEN_FILE );
if (!hDlgTmpl)
......@@ -90,7 +90,7 @@ BOOL GetOpenFileName(LPOPENFILENAME lpofn)
if (!(lpofn->Flags & OFN_ENABLETEMPLATEHANDLE))
{
if (lpofn->Flags & OFN_ENABLETEMPLATE) FreeResource( hDlgTmpl );
if (lpofn->Flags & OFN_ENABLETEMPLATE) FreeResource16( hDlgTmpl );
else SYSRES_FreeResource( hDlgTmpl );
}
......@@ -115,13 +115,13 @@ BOOL GetSaveFileName(LPOPENFILENAME lpofn)
else if (lpofn->Flags & OFN_ENABLETEMPLATE)
{
hInst = lpofn->hInstance;
if (!(hResInfo = FindResource( lpofn->hInstance,
lpofn->lpTemplateName, RT_DIALOG )))
if (!(hResInfo = FindResource16(lpofn->hInstance,
lpofn->lpTemplateName, RT_DIALOG )))
{
CommDlgLastError = CDERR_FINDRESFAILURE;
return FALSE;
}
hDlgTmpl = LoadResource( lpofn->hInstance, hResInfo );
hDlgTmpl = LoadResource16( lpofn->hInstance, hResInfo );
}
else hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_SAVE_FILE );
......@@ -131,7 +131,7 @@ BOOL GetSaveFileName(LPOPENFILENAME lpofn)
(DWORD)lpofn);
if (!(lpofn->Flags & OFN_ENABLETEMPLATEHANDLE))
{
if (lpofn->Flags & OFN_ENABLETEMPLATE) FreeResource( hDlgTmpl );
if (lpofn->Flags & OFN_ENABLETEMPLATE) FreeResource16( hDlgTmpl );
else SYSRES_FreeResource( hDlgTmpl );
}
......@@ -375,7 +375,7 @@ static LONG FILEDLG_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
SetDlgItemText32A( hWnd, edt1, tmpstr );
/* get drive list */
*tmpstr = 0;
DlgDirListComboBox16(hWnd, tmpstr, cmb2, 0, 0xC000);
DlgDirListComboBox16(hWnd, (LPSTR)MAKE_SEGPTR(tmpstr), cmb2, 0, 0xC000);
/* read initial directory */
if (PTR_SEG_TO_LIN(lpofn->lpstrInitialDir) != NULL)
{
......@@ -1101,13 +1101,13 @@ BOOL ChooseColor(LPCHOOSECOLOR lpChCol)
if (lpChCol->Flags & CC_ENABLETEMPLATEHANDLE) hDlgTmpl = lpChCol->hInstance;
else if (lpChCol->Flags & CC_ENABLETEMPLATE)
{
if (!(hResInfo = FindResource( lpChCol->hInstance,
lpChCol->lpTemplateName, RT_DIALOG)))
if (!(hResInfo = FindResource16(lpChCol->hInstance,
lpChCol->lpTemplateName, RT_DIALOG)))
{
CommDlgLastError = CDERR_FINDRESFAILURE;
return FALSE;
}
hDlgTmpl = LoadResource( lpChCol->hInstance, hResInfo );
hDlgTmpl = LoadResource16( lpChCol->hInstance, hResInfo );
}
else hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_CHOOSE_COLOR );
if (!hDlgTmpl)
......@@ -1121,7 +1121,7 @@ BOOL ChooseColor(LPCHOOSECOLOR lpChCol)
(DWORD)lpChCol );
if (!(lpChCol->Flags & CC_ENABLETEMPLATEHANDLE))
{
if (lpChCol->Flags & CC_ENABLETEMPLATE) FreeResource( hDlgTmpl );
if (lpChCol->Flags & CC_ENABLETEMPLATE) FreeResource16( hDlgTmpl );
else SYSRES_FreeResource( hDlgTmpl );
}
return bRet;
......@@ -1576,7 +1576,7 @@ static void CC_PrepareColorGraph(HWND hDlg)
HBRUSH hbrush;
HDC hdc ;
RECT16 rect,client;
HCURSOR hcursor=SetCursor(LoadCursor(0,IDC_WAIT));
HCURSOR hcursor=SetCursor(LoadCursor16(0,IDC_WAIT));
GetClientRect16(hwnd,&client);
hdc=GetDC(hwnd);
......@@ -2182,13 +2182,13 @@ BOOL ChooseFont(LPCHOOSEFONT lpChFont)
if (lpChFont->Flags & CF_ENABLETEMPLATEHANDLE) hDlgTmpl = lpChFont->hInstance;
else if (lpChFont->Flags & CF_ENABLETEMPLATE)
{
if (!(hResInfo = FindResource( lpChFont->hInstance,
lpChFont->lpTemplateName, RT_DIALOG)))
if (!(hResInfo = FindResource16(lpChFont->hInstance,
lpChFont->lpTemplateName, RT_DIALOG)))
{
CommDlgLastError = CDERR_FINDRESFAILURE;
return FALSE;
}
hDlgTmpl = LoadResource( lpChFont->hInstance, hResInfo );
hDlgTmpl = LoadResource16( lpChFont->hInstance, hResInfo );
}
else hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_CHOOSE_FONT );
if (!hDlgTmpl)
......@@ -2202,7 +2202,7 @@ BOOL ChooseFont(LPCHOOSEFONT lpChFont)
(DWORD)lpChFont );
if (!(lpChFont->Flags & CF_ENABLETEMPLATEHANDLE))
{
if (lpChFont->Flags & CF_ENABLETEMPLATE) FreeResource( hDlgTmpl );
if (lpChFont->Flags & CF_ENABLETEMPLATE) FreeResource16( hDlgTmpl );
else SYSRES_FreeResource( hDlgTmpl );
}
return bRet;
......@@ -2381,9 +2381,9 @@ LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam)
HDC hdc;
int i,j,res,init=0;
long l;
FARPROC enumCallback = MODULE_GetWndProcEntry16("FontFamilyEnumProc");
FARPROC16 enumCallback = MODULE_GetWndProcEntry16("FontFamilyEnumProc");
LPLOGFONT16 lpxx;
HCURSOR hcursor=SetCursor(LoadCursor(0,IDC_WAIT));
HCURSOR hcursor=SetCursor(LoadCursor16(0,IDC_WAIT));
LPCHOOSEFONT lpcf;
SetWindowLong32A(hDlg, DWL_USER, lParam);
......@@ -2398,7 +2398,7 @@ LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam)
return FALSE;
}
if (!hBitmapTT)
hBitmapTT = LoadBitmap(0, MAKEINTRESOURCE(OBM_TRTYPE));
hBitmapTT = LoadBitmap16(0, MAKEINTRESOURCE(OBM_TRTYPE));
if (!(lpcf->Flags & CF_SHOWHELP) || !IsWindow(lpcf->hwndOwner))
ShowWindow(GetDlgItem(hDlg,pshHelp),SW_HIDE);
......@@ -2495,7 +2495,7 @@ LRESULT CFn_WMMeasureItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
BITMAP16 bm;
LPMEASUREITEMSTRUCT16 lpmi=PTR_SEG_TO_LIN((LPMEASUREITEMSTRUCT16)lParam);
if (!hBitmapTT)
hBitmapTT = LoadBitmap(0, MAKEINTRESOURCE(OBM_TRTYPE));
hBitmapTT = LoadBitmap16(0, MAKEINTRESOURCE(OBM_TRTYPE));
GetObject16( hBitmapTT, sizeof(bm), &bm );
lpmi->itemHeight=bm.bmHeight;
/* FIXME: use MAX of bm.bmHeight and tm.tmHeight .*/
......@@ -2615,7 +2615,7 @@ LRESULT CFn_WMCtlColor(HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam)
{
char buffer[200];
FARPROC enumCallback;
FARPROC16 enumCallback;
HFONT hFont/*,hFontOld*/;
int i,j;
long l;
......@@ -2636,7 +2636,7 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam)
i=SendDlgItemMessage16(hDlg,cmb1,CB_GETCURSEL,0,0);
if (i!=CB_ERR)
{
HCURSOR hcursor=SetCursor(LoadCursor(0,IDC_WAIT));
HCURSOR hcursor=SetCursor(LoadCursor16(0,IDC_WAIT));
SendDlgItemMessage16(hDlg,cmb1,CB_GETLBTEXT,i,(LPARAM)MAKE_SEGPTR(buffer));
dprintf_commdlg(stddeb,"WM_COMMAND/cmb1 =>%s\n",buffer);
enumCallback = MODULE_GetWndProcEntry16("FontStyleEnumProc");
......
......@@ -195,7 +195,7 @@ LRESULT CloseDriver(HDRVR16 hDrvr, LPARAM lParam1, LPARAM lParam2)
HMODULE16 GetDriverModuleHandle(HDRVR16 hDrvr)
{
LPDRIVERITEM lpdrv;
HMODULE hModule = 0;
HMODULE16 hModule = 0;
dprintf_driver( stddeb, "GetDriverModuleHandle(%04x);\n", hDrvr);
......
......@@ -111,7 +111,8 @@ struct options Options =
#else
LANG_En,
#endif
FALSE /* Managed windows */
FALSE, /* Managed windows */
FALSE /* Perfect graphics */
};
......@@ -125,6 +126,7 @@ static XrmOptionDescRec optionsTable[] =
{ "-ipc", ".ipc", XrmoptionNoArg, (caddr_t)"off"},
{ "-language", ".language", XrmoptionSepArg, (caddr_t)"En" },
{ "-name", ".name", XrmoptionSepArg, (caddr_t)NULL },
{ "-perfect", ".perfect", XrmoptionNoArg, (caddr_t)"on" },
{ "-privatemap", ".privatemap", XrmoptionNoArg, (caddr_t)"on" },
{ "-fixedmap", ".fixedmap", XrmoptionNoArg, (caddr_t)"on" },
{ "-synchronous", ".synchronous", XrmoptionNoArg, (caddr_t)"on" },
......@@ -158,6 +160,7 @@ static XrmOptionDescRec optionsTable[] =
" -managed Allow the window manager to manage created windows\n" \
" -mode mode Start Wine in a particular mode (standard or enhanced)\n" \
" -name name Set the application name\n" \
" -perfect Favor correctness over speed for graphical operations\n" \
" -privatemap Use a private color map\n" \
" -synchronous Turn on synchronous display mode\n" \
" -winver Version to imitate (one of win31,win95,nt351)\n"
......@@ -407,6 +410,8 @@ static void MAIN_ParseOptions( int *argc, char *argv[] )
Options.allowReadOnly = TRUE;
if (MAIN_GetResource( db, ".ipc", &value ))
Options.ipc = TRUE;
if (MAIN_GetResource( db, ".perfect", &value ))
Options.perfectGraphics = TRUE;
if (MAIN_GetResource( db, ".depth", &value))
screenDepth = atoi( value.addr );
if (MAIN_GetResource( db, ".desktop", &value))
......@@ -615,6 +620,13 @@ int main( int argc, char *argv[] )
MAIN_ParseOptions( &argc, argv );
if (Options.desktopGeometry && Options.managed)
{
fprintf( stderr, "%s: -managed and -desktop options cannot be used together\n",
Options.programName );
exit(1);
}
screen = DefaultScreenOfDisplay( display );
screenWidth = WidthOfScreen( screen );
screenHeight = HeightOfScreen( screen );
......@@ -1175,7 +1187,7 @@ BOOL SwapMouseButton(BOOL fSwap)
/***********************************************************************
* FileCDR (KERNEL.130)
*/
void FileCDR(FARPROC x)
void FileCDR(FARPROC16 x)
{
printf("FileCDR(%8x)\n", (int) x);
}
......
/*
* Misc. functions for systems that don't have them
*
* Copyright 1996 Alexandre Julliard
*/
#include "config.h"
#include <sys/types.h>
#include <sys/time.h>
#ifndef HAVE_USLEEP
unsigned int usleep (unsigned int useconds)
{
struct timeval delay;
......@@ -13,8 +19,28 @@ unsigned int usleep (unsigned int useconds)
select( 0, 0, 0, 0, &delay );
return 0;
}
#endif /* HAVE_USLEEP */
#ifndef HAVE_MEMMOVE
void *memmove( void *dst, const void *src, unsigned int len )
{
/* Use memcpy if not overlapping */
if (((char *)dst + len <= (char *)src) ||
((char *)src + len <= (char *)dst))
{
memcpy( dst, src, len );
}
/* Otherwise do it the hard way (FIXME: could do better than this) */
else if (dst < src)
{
while (len--) *((char *)dst)++ = *((char *)src)++;
}
else
{
dst = (char *)dst + len - 1;
src = (char *)src + len - 1;
while (len--) *((char *)dst)-- = *((char *)src)--;
}
return dst;
}
#endif /* HAVE_MEMMOVE */
......@@ -359,7 +359,7 @@ INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon)
else *AppMisc = 0;
AppMisc[sizeof(AppMisc)-1]=0;
if (!hIcon) hIcon = LoadIcon(0,MAKEINTRESOURCE(OIC_WINEICON));
if (!hIcon) hIcon = LoadIcon16(0,MAKEINTRESOURCE(OIC_WINEICON));
handle = SYSRES_LoadResource( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX );
if (!handle) return FALSE;
bRet = DialogBoxIndirectParam16( WIN_GetWindowInstance( hWnd ),
......@@ -552,9 +552,9 @@ HICON ExtractIcon(HINSTANCE hInstance, LPCSTR lpszExeFileName, WORD nIconIndex)
* Return icon for given file (either from file itself or from associated
* executable) and patch parameters if needed.
*/
HICON ExtractAssociatedIcon(HINSTANCE hInst,LPSTR lpIconPath, LPWORD lpiIcon)
HICON16 ExtractAssociatedIcon(HINSTANCE16 hInst,LPSTR lpIconPath,LPWORD lpiIcon)
{
HICON hIcon = ExtractIcon(hInst, lpIconPath, *lpiIcon);
HICON16 hIcon = ExtractIcon(hInst, lpIconPath, *lpiIcon);
if( hIcon < 2 )
{
......@@ -580,7 +580,7 @@ HICON ExtractAssociatedIcon(HINSTANCE hInst,LPSTR lpIconPath, LPWORD lpiIcon)
*lpiIcon = 6; /* generic icon - found nothing */
GetModuleFileName(hInst, lpIconPath, 0x80);
hIcon = LoadIcon( hInst, MAKEINTRESOURCE(*lpiIcon));
hIcon = LoadIcon16( hInst, MAKEINTRESOURCE(*lpiIcon));
}
return hIcon;
......
......@@ -23,7 +23,7 @@
static struct notify
{
HTASK htask;
FARPROC lpfnCallback;
FARPROC16 lpfnCallback;
WORD wFlags;
} *notifys = NULL;
......
......@@ -37,7 +37,7 @@
static WORD wsa_errno;
static int wsa_initted;
static key_t wine_key = 0;
static FARPROC BlockFunction;
static FARPROC16 BlockFunction;
static fd_set fd_in_use;
extern int h_errno;
......@@ -1423,7 +1423,7 @@ BOOL WSAIsBlocking(void)
return 0;
}
FARPROC WSASetBlockingHook(FARPROC lpBlockFunc)
FARPROC16 WSASetBlockingHook(FARPROC16 lpBlockFunc)
{
dprintf_winsock(stddeb, "WSA_SetBlockHook %8lx, STUB!\n", (unsigned long) lpBlockFunc);
......@@ -1434,7 +1434,7 @@ FARPROC WSASetBlockingHook(FARPROC lpBlockFunc)
BlockFunction = lpBlockFunc;
return (FARPROC) lpBlockFunc;
return (FARPROC16) lpBlockFunc;
}
INT WSAUnhookBlockingHook(void)
......
......@@ -254,7 +254,8 @@ INT16 wvsnprintf16( LPSTR buffer, UINT16 maxlen, LPCSTR spec, LPCVOID args )
break;
case WPR_WSTRING: /* No Unicode in Win16 */
case WPR_STRING:
cur_arg = (DWORD)PTR_SEG_TO_LIN( *(SEGPTR *)args );
if (IsBadReadPtr( *(SEGPTR *)args, 1 )) cur_arg = (DWORD)"";
else cur_arg = (DWORD)PTR_SEG_TO_LIN( *(SEGPTR *)args );
args = (SEGPTR *)args + 1;
break;
case WPR_HEXA:
......@@ -498,16 +499,14 @@ INT16 wsprintf16( LPSTR buffer, LPCSTR spec, ... )
}
/* Emulator version */
#ifndef WINELIB
INT16 WIN16_wsprintf16(void)
{
SEGPTR *win_stack = (DWORD *)CURRENT_STACK16->args;
SEGPTR *win_stack = (SEGPTR *)CURRENT_STACK16->args;
LPSTR buffer = (LPSTR)PTR_SEG_TO_LIN(win_stack[0]);
LPCSTR spec = (LPCSTR)PTR_SEG_TO_LIN(win_stack[1]);
return wvsprintf16( buffer, spec, &win_stack[2] );
}
#endif /* WINELIB */
/***********************************************************************
......
DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = miscemu
......
......@@ -6,9 +6,9 @@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include "windows.h"
#include "heap.h"
#include "ldt.h"
#include "module.h"
#include "miscemu.h"
......@@ -68,6 +68,19 @@ void INT_Int31Handler( SIGCONTEXT *context )
AX_reg(context) = 0x8022; /* invalid selector */
SET_CFLAG(context);
}
else
{
/* If a segment register contains the selector being freed, */
/* set it to zero. */
if (!((DS_reg(context)^BX_reg(context)) & ~3)) DS_reg(context) = 0;
if (!((ES_reg(context)^BX_reg(context)) & ~3)) ES_reg(context) = 0;
#ifdef FS_reg
if (!((FS_reg(context)^BX_reg(context)) & ~3)) FS_reg(context) = 0;
#endif
#ifdef GS_reg
if (!((GS_reg(context)^BX_reg(context)) & ~3)) GS_reg(context) = 0;
#endif
}
break;
case 0x0002: /* Real mode segment to descriptor */
......@@ -135,6 +148,7 @@ void INT_Int31Handler( SIGCONTEXT *context )
case 0x0009: /* Set selector access rights */
SelectorAccessRights( BX_reg(context), 1, CX_reg(context) );
break;
case 0x000a: /* Allocate selector alias */
if (!(AX_reg(context) = AllocCStoDSAlias( BX_reg(context) )))
......@@ -199,8 +213,9 @@ void INT_Int31Handler( SIGCONTEXT *context )
if ((BL_reg(context) == 0x2f) && ((p->eax & 0xFF00) == 0x1500))
{
do_mscdex( context );
break;
}
else SET_CFLAG(context);
SET_CFLAG(context);
}
break;
......@@ -242,8 +257,8 @@ void INT_Int31Handler( SIGCONTEXT *context )
break;
case 0x0501: /* Allocate memory block */
if (!(ptr = (BYTE *)malloc( MAKELONG( CX_reg(context),
BX_reg(context) ) )))
if (!(ptr = (BYTE *)HeapAlloc( SystemHeap, 0,MAKELONG( CX_reg(context),
BX_reg(context) ))))
{
AX_reg(context) = 0x8012; /* linear memory not available */
SET_CFLAG(context);
......@@ -256,12 +271,14 @@ void INT_Int31Handler( SIGCONTEXT *context )
break;
case 0x0502: /* Free memory block */
free( (void *)MAKELONG( DI_reg(context), SI_reg(context) ) );
HeapFree( SystemHeap, 0,
(void *)MAKELONG( DI_reg(context), SI_reg(context) ) );
break;
case 0x0503: /* Resize memory block */
if (!(ptr = (BYTE *)realloc( (void *)MAKELONG(DI_reg(context),SI_reg(context)),
MAKELONG(CX_reg(context),BX_reg(context)))))
if (!(ptr = (BYTE *)HeapReAlloc( SystemHeap, 0,
(void *)MAKELONG(DI_reg(context),SI_reg(context)),
MAKELONG(CX_reg(context),BX_reg(context)))))
{
AX_reg(context) = 0x8012; /* linear memory not available */
SET_CFLAG(context);
......
DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = multimedia
......
......@@ -27,7 +27,7 @@ static MMTIME mmSysTimeSMPTE;
typedef struct tagTIMERENTRY {
WORD wDelay;
WORD wResol;
FARPROC lpFunc;
FARPROC16 lpFunc;
HINSTANCE hInstance;
DWORD dwUser;
WORD wFlags;
......@@ -52,7 +52,7 @@ static VOID TIME_MMSysTimeCallback( HWND32 hwnd, UINT32 msg,
lpTimer->wCurTime--;
if (lpTimer->wCurTime == 0) {
lpTimer->wCurTime = lpTimer->wDelay;
if (lpTimer->lpFunc != (FARPROC) NULL) {
if (lpTimer->lpFunc != (FARPROC16) NULL) {
dprintf_mmtime(stddeb, "MMSysTimeCallback // before CallBack16 !\n");
dprintf_mmtime(stddeb, "MMSysTimeCallback // lpFunc=%p wTimerID=%04X dwUser=%08lX !\n",
lpTimer->lpFunc, lpTimer->wTimerID, lpTimer->dwUser);
......@@ -151,7 +151,7 @@ WORD timeSetEvent(WORD wDelay, WORD wResol, LPTIMECALLBACK lpFunc,
lpNewTimer->wCurTime = wDelay;
lpNewTimer->wDelay = wDelay;
lpNewTimer->wResol = wResol;
lpNewTimer->lpFunc = (FARPROC) lpFunc;
lpNewTimer->lpFunc = (FARPROC16) lpFunc;
lpNewTimer->hInstance = GetTaskDS();
dprintf_mmtime(stddeb, "timeSetEvent // hInstance=%04X !\n", lpNewTimer->hInstance);
dprintf_mmtime(stddeb, "timeSetEvent // PTR_SEG_TO_LIN(lpFunc)=%p !\n",
......
DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = objects
......
......@@ -1106,15 +1106,25 @@ BOOL BITBLT_InternalStretchBlt( DC *dcDst, short xDst, short yDst,
visRectDst.left, visRectDst.top, width, height );
return TRUE;
case DSTINVERT: /* 0x55 */
if ((dcDst->w.bitsPerPixel == 1) || !COLOR_PaletteToPixel ||
!Options.perfectGraphics)
{
XSetFunction( display, dcDst->u.x.gc, GXinvert );
XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
visRectDst.left, visRectDst.top, width, height );
return TRUE;
}
break;
case PATINVERT: /* 0x5a */
/* FIXME: This is not really correct, but for now PATINVERT is */
/* used to draw the window moving frame, so it has to be fast. */
if (Options.perfectGraphics) break;
if (!DC_SetupGCForBrush( dcDst )) return TRUE;
XSetFunction( display, dcDst->u.x.gc, GXxor );
XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
visRectDst.left, visRectDst.top, width, height );
return TRUE;
case SRCCOPY: /* 0xcc */
if (dcSrc->w.bitsPerPixel == dcDst->w.bitsPerPixel)
{
......@@ -1155,8 +1165,8 @@ BOOL BITBLT_InternalStretchBlt( DC *dcDst, short xDst, short yDst,
else
{
XSetFunction( display, dcDst->u.x.gc, GXcopy );
XSetForeground( display, dcDst->u.x.gc,
COLOR_PaletteToPixel[COLOR_ColormapSize-1] );
XSetForeground( display, dcDst->u.x.gc,
COLOR_PaletteToPixel[COLOR_GetSystemPaletteSize() - 1]);
XSetFillStyle( display, dcDst->u.x.gc, FillSolid );
}
XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
......
......@@ -12,6 +12,8 @@
#include "callback.h"
#include "dc.h"
#include "bitmap.h"
#include "heap.h"
#include "string32.h"
#include "stddebug.h"
#include "debug.h"
......@@ -227,24 +229,24 @@ LONG SetBitmapBits( HBITMAP32 hbitmap, LONG count, LPCVOID buffer )
/**********************************************************************
* LoadBitmap (USER.175)
* LoadBitmap16 (USER.175)
*/
HBITMAP LoadBitmap( HANDLE instance, SEGPTR name )
HBITMAP16 LoadBitmap16( HINSTANCE16 instance, SEGPTR name )
{
HBITMAP hbitmap = 0;
HBITMAP16 hbitmap = 0;
HDC hdc;
HRSRC hRsrc;
HGLOBAL handle;
HRSRC16 hRsrc;
HGLOBAL16 handle;
BITMAPINFO *info;
if (HIWORD(name))
{
char *str = (char *)PTR_SEG_TO_LIN( name );
dprintf_bitmap( stddeb, "LoadBitmap(%04x,'%s')\n", instance, str );
dprintf_bitmap( stddeb, "LoadBitmap16(%04x,'%s')\n", instance, str );
if (str[0] == '#') name = (SEGPTR)(DWORD)(WORD)atoi( str + 1 );
}
else
dprintf_bitmap( stddeb, "LoadBitmap(%04x,%04x)\n",
dprintf_bitmap( stddeb, "LoadBitmap16(%04x,%04x)\n",
instance, LOWORD(name) );
if (!instance) /* OEM bitmap */
......@@ -253,10 +255,10 @@ HBITMAP LoadBitmap( HANDLE instance, SEGPTR name )
return OBM_LoadBitmap( LOWORD((int)name) );
}
if (!(hRsrc = FindResource( instance, name, RT_BITMAP ))) return 0;
if (!(handle = LoadResource( instance, hRsrc ))) return 0;
if (!(hRsrc = FindResource16( instance, name, RT_BITMAP ))) return 0;
if (!(handle = LoadResource16( instance, hRsrc ))) return 0;
info = (BITMAPINFO *)LockResource( handle );
info = (BITMAPINFO *)LockResource16( handle );
if ((hdc = GetDC(0)) != 0)
{
char *bits = (char *)info + DIB_BitmapInfoSize( info, DIB_RGB_COLORS );
......@@ -264,10 +266,59 @@ HBITMAP LoadBitmap( HANDLE instance, SEGPTR name )
bits, info, DIB_RGB_COLORS );
ReleaseDC( 0, hdc );
}
FreeResource( handle );
FreeResource16( handle );
return hbitmap;
}
/**********************************************************************
* LoadBitmap32W (USER32.357)
*/
HBITMAP32 LoadBitmap32W( HINSTANCE32 instance, LPCWSTR name )
{
HBITMAP32 hbitmap = 0;
HDC hdc;
HRSRC32 hRsrc;
HGLOBAL32 handle;
BITMAPINFO *info;
if (!instance) /* OEM bitmap */
{
if (HIWORD((int)name)) return 0;
return OBM_LoadBitmap( LOWORD((int)name) );
}
if (!(hRsrc = FindResource32W( instance, name,
(LPWSTR)RT_BITMAP ))) return 0;
if (!(handle = LoadResource32( instance, hRsrc ))) return 0;
info = (BITMAPINFO *)LockResource32( handle );
if ((hdc = GetDC(0)) != 0)
{
char *bits = (char *)info + DIB_BitmapInfoSize( info, DIB_RGB_COLORS );
hbitmap = CreateDIBitmap( hdc, &info->bmiHeader, CBM_INIT,
bits, info, DIB_RGB_COLORS );
ReleaseDC( 0, hdc );
}
return hbitmap;
}
/**********************************************************************
* LoadBitmap32A (USER32.356)
*/
HBITMAP32 LoadBitmap32A( HINSTANCE32 instance, LPCSTR name )
{
HBITMAP32 res;
if (!HIWORD(name)) res = LoadBitmap32W(instance,(LPWSTR)name);
else
{
LPWSTR uni = STRING32_DupAnsiToUni(name);
res = LoadBitmap32W(instance,uni);
free(uni);
}
return res;
}
/***********************************************************************
* BITMAP_DeleteObject
......
......@@ -198,20 +198,20 @@ static CURSORDIRENTRY *CURSORICON_FindBestCursor( CURSORICONDIR *dir,
* Load the icon/cursor directory for a given resource name and find the
* best matching entry.
*/
static BOOL CURSORICON_LoadDirEntry(HANDLE hInstance, SEGPTR name,
static BOOL CURSORICON_LoadDirEntry(HINSTANCE32 hInstance, SEGPTR name,
int width, int height, int colors,
BOOL fCursor, CURSORICONDIRENTRY *dirEntry)
{
HRSRC hRsrc;
HANDLE hMem;
HRSRC16 hRsrc;
HGLOBAL16 hMem;
CURSORICONDIR *dir;
CURSORICONDIRENTRY *entry = NULL;
if (!(hRsrc = FindResource( hInstance, name,
if (!(hRsrc = FindResource16( hInstance, name,
fCursor ? RT_GROUP_CURSOR : RT_GROUP_ICON )))
return FALSE;
if (!(hMem = LoadResource( hInstance, hRsrc ))) return FALSE;
if ((dir = (CURSORICONDIR *)LockResource( hMem )))
if (!(hMem = LoadResource16( hInstance, hRsrc ))) return FALSE;
if ((dir = (CURSORICONDIR *)LockResource16( hMem )))
{
if (fCursor)
entry = (CURSORICONDIRENTRY *)CURSORICON_FindBestCursor( dir,
......@@ -221,7 +221,7 @@ static BOOL CURSORICON_LoadDirEntry(HANDLE hInstance, SEGPTR name,
width, height, colors );
if (entry) *dirEntry = *entry;
}
FreeResource( hMem );
FreeResource16( hMem );
return (entry != NULL);
}
......@@ -245,11 +245,11 @@ HANDLE CURSORICON_LoadHandler( HANDLE handle, HINSTANCE hInstance,
if (fCursor) /* If cursor, get the hotspot */
{
POINT16 *pt = (POINT16 *)LockResource( handle );
POINT16 *pt = (POINT16 *)LockResource16( handle );
hotspot = *pt;
bmi = (BITMAPINFO *)(pt + 1);
}
else bmi = (BITMAPINFO *)LockResource( handle );
else bmi = (BITMAPINFO *)LockResource16( handle );
/* Create a copy of the bitmap header */
......@@ -391,13 +391,13 @@ static HANDLE CURSORICON_Load( HANDLE hInstance, SEGPTR name, int width,
/* Load the resource */
if (!(hRsrc = FindResource( hInstance,
if (!(hRsrc = FindResource16( hInstance,
MAKEINTRESOURCE( dirEntry.icon.wResId ),
fCursor ? RT_CURSOR : RT_ICON ))) return 0;
if (!(handle = LoadResource( hInstance, hRsrc ))) return 0;
if (!(handle = LoadResource16( hInstance, hRsrc ))) return 0;
hRet = CURSORICON_LoadHandler( handle, hInstance, fCursor );
FreeResource(handle);
FreeResource16(handle);
return hRet;
}
......@@ -463,13 +463,13 @@ HCURSOR CURSORICON_IconToCursor(HICON hIcon)
/***********************************************************************
* LoadCursor (USER.173)
*/
HCURSOR LoadCursor( HANDLE hInstance, SEGPTR name )
HCURSOR16 LoadCursor16( HINSTANCE16 hInstance, SEGPTR name )
{
if (HIWORD(name))
dprintf_cursor( stddeb, "LoadCursor: %04x '%s'\n",
dprintf_cursor( stddeb, "LoadCursor16: %04x '%s'\n",
hInstance, (char *)PTR_SEG_TO_LIN( name ) );
else
dprintf_cursor( stddeb, "LoadCursor: %04x %04x\n",
dprintf_cursor( stddeb, "LoadCursor16: %04x %04x\n",
hInstance, LOWORD(name) );
return CURSORICON_Load( hInstance, name,
......@@ -480,7 +480,7 @@ HCURSOR LoadCursor( HANDLE hInstance, SEGPTR name )
/***********************************************************************
* LoadIcon (USER.174)
*/
HICON LoadIcon( HANDLE hInstance, SEGPTR name )
HICON16 LoadIcon16(HINSTANCE16 hInstance,SEGPTR name)
{
if (HIWORD(name))
dprintf_icon( stddeb, "LoadIcon: %04x '%s'\n",
......@@ -935,7 +935,7 @@ void GetClipCursor32( RECT32 *rect )
*/
WORD GetIconID( HANDLE hResource, DWORD resType )
{
CURSORICONDIR *lpDir = LockResource(hResource);
CURSORICONDIR *lpDir = LockResource16(hResource);
if (!lpDir || lpDir->idReserved ||
((lpDir->idType != 1) && (lpDir->idType != 2)))
......
......@@ -334,8 +334,8 @@ BOOL DC_SetupGCForText( DC * dc )
*/
BOOL DC_CallHookProc(DC* dc, WORD code, LPARAM lParam)
{
BOOL bRet = 0;
FARPROC ptr = GDI_GetDefDCHook();
BOOL bRet = FALSE;
FARPROC16 ptr = GDI_GetDefDCHook();
dprintf_dc(stddeb,"CallDCHook: code %04x\n", code);
......@@ -379,8 +379,6 @@ HDC GetDCState( HDC hdc )
newdc->w.hClipRgn = CreateRectRgn( 0, 0, 0, 0 );
CombineRgn( newdc->w.hClipRgn, dc->w.hClipRgn, 0, RGN_COPY );
}
COLOR_SetMapping( newdc, dc->u.x.pal.hMapping,
dc->u.x.pal.hRevMapping, dc->u.x.pal.mappingSize );
return handle;
}
......@@ -421,8 +419,6 @@ void SetDCState( HDC hdc, HDC hdcs )
SelectObject( hdc, dcs->w.hBrush );
SelectObject( hdc, dcs->w.hFont );
COLOR_SetMapping( dc, dcs->u.x.pal.hMapping,
dcs->u.x.pal.hRevMapping, dcs->u.x.pal.mappingSize );
}
......
......@@ -430,22 +430,56 @@ HFONT32 CreateFontIndirect32W( const LOGFONT32W *font )
/***********************************************************************
* CreateFont (GDI.56)
* CreateFont16 (GDI.56)
*/
HFONT CreateFont( INT height, INT width, INT esc, INT orient, INT weight,
BYTE italic, BYTE underline, BYTE strikeout, BYTE charset,
BYTE outpres, BYTE clippres, BYTE quality, BYTE pitch,
LPCSTR name )
HFONT16 CreateFont16( INT16 height, INT16 width, INT16 esc, INT16 orient,
INT16 weight, BYTE italic, BYTE underline,
BYTE strikeout, BYTE charset, BYTE outpres,
BYTE clippres, BYTE quality, BYTE pitch, LPCSTR name )
{
LOGFONT16 logfont = {height, width, esc, orient, weight, italic, underline,
strikeout, charset, outpres, clippres, quality, pitch, };
dprintf_font(stddeb,"CreateFont(%d,%d)\n", height, width);
dprintf_font(stddeb,"CreateFont16(%d,%d)\n", height, width);
if (name) lstrcpyn32A(logfont.lfFaceName,name,sizeof(logfont.lfFaceName));
else logfont.lfFaceName[0] = '\0';
return CreateFontIndirect16( &logfont );
}
/*************************************************************************
* CreateFont32A (GDI32.43)
*/
HFONT32 CreateFont32A( INT32 height, INT32 width, INT32 esc, INT32 orient,
INT32 weight, DWORD italic, DWORD underline,
DWORD strikeout, DWORD charset, DWORD outpres,
DWORD clippres, DWORD quality, DWORD pitch, LPCSTR name)
{
return (HFONT32)CreateFont16( height, width, esc, orient, weight, italic,
underline, strikeout, charset, outpres,
clippres, quality, pitch, name );
}
/*************************************************************************
* CreateFont32W (GDI32.46)
*/
HFONT32 CreateFont32W( INT32 height, INT32 width, INT32 esc, INT32 orient,
INT32 weight, DWORD italic, DWORD underline,
DWORD strikeout, DWORD charset, DWORD outpres,
DWORD clippres, DWORD quality, DWORD pitch,
LPCWSTR name )
{
LPSTR namea = name ? STRING32_DupUniToAnsi(name) : NULL;
HFONT32 ret = (HFONT32)CreateFont16( height, width, esc, orient, weight,
italic, underline, strikeout, charset,
outpres, clippres, quality, pitch,
namea );
free(namea);
return ret;
}
/***********************************************************************
* FONT_GetObject
*/
......@@ -483,7 +517,7 @@ HFONT FONT_SelectObject( DC * dc, HFONT hfont, FONTOBJ * font )
{
HFONT hnewfont;
hnewfont = CreateFont(10, 7, 0, 0, FW_DONTCARE,
hnewfont = CreateFont16(10, 7, 0, 0, FW_DONTCARE,
FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
DEFAULT_QUALITY, FF_DONTCARE, "*" );
font = (FONTOBJ *) GDI_HEAP_LIN_ADDR( hnewfont );
......
......@@ -27,10 +27,6 @@ WORD GDI_HeapSel = 0;
#define OBJ_PEN 1
#define OBJ_BRUSH 2
#define MAX_OBJ 1024
HANDLE *lpPenBrushList = NULL;
/***********************************************************************
* GDI stock objects
*/
......@@ -277,7 +273,7 @@ BOOL DeleteObject( HGDIOBJ16 obj )
case PEN_MAGIC: return GDI_FreeObject( obj );
case BRUSH_MAGIC: return BRUSH_DeleteObject( obj, (BRUSHOBJ*)header );
case FONT_MAGIC: return GDI_FreeObject( obj );
case PALETTE_MAGIC: return GDI_FreeObject( obj );
case PALETTE_MAGIC: return PALETTE_DeleteObject(obj,(PALETTEOBJ*)header);
case BITMAP_MAGIC: return BITMAP_DeleteObject( obj, (BITMAPOBJ*)header);
case REGION_MAGIC: return REGION_DeleteObject( obj, (RGNOBJ*)header );
}
......@@ -412,9 +408,26 @@ HANDLE SelectObject( HDC hdc, HANDLE handle )
/***********************************************************************
* UnrealizeObject (GDI.150)
*/
BOOL UnrealizeObject( HANDLE handle )
BOOL UnrealizeObject( HANDLE obj )
{
dprintf_gdi(stdnimp, "UnrealizeObject: %04x\n", handle );
/* Check if object is valid */
GDIOBJHDR * header = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( obj );
if (!header) return FALSE;
dprintf_gdi( stddeb, "UnrealizeObject: %04x\n", obj );
/* Unrealize object */
switch(header->wMagic)
{
case PALETTE_MAGIC:
return PALETTE_UnrealizeObject( obj, (PALETTEOBJ *)header );
case BRUSH_MAGIC:
/* Windows resets the brush origin. We don't need to. */
break;
}
return TRUE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment