Release 971012

Sun Oct 12 15:03:01 1997  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [if1632/builtin.c] [if1632/relay.c]
	Relay debugging entry points are now generated on the fly for
	Win32 DLLs.

	* [include/stackframe.h]
	Added VA_LIST16 type and macros to access arguments on the 16-bit
	stack.

	* [memory/global.c]
	Fixed GlobalHandle32 to work with fixed blocks.

	* [misc/ddeml.c] (New file)
	Added a lot of stubs for DDEML functions.

	* [objects/dc.c]
	Added Get/SetGraphicsMode().

	* [objects/gdiobj.c] [windows/winpos.c]
	Added a few stubs.

	* [tools/build.c]
	Removed 'byte', 'word', 'long' and 'return' entry points for Win32.
	'register' functions can no longer take arguments in Win32.
 	The Win32 NE module is now generated by MODULE_CreateDummyModule.
	CallFrom32 callbacks removed except for register functions.

Fri Oct 10 18:22:18 1997  John Harvey <john@division.co.uk>

	* [graphics/win16drv/Makefile.in] [graphics/win16drv/brush.c]
	  [graphics/win16drv/graphics.c] [graphics/win16drv/init.c]
	  [graphics/win16drv/objects.c] [graphics/win16drv/pen.c]
	  [graphics/win16drv/prtdrv.c] [graphics/win16drv/text.c]
	  [include/callback.h] [include/win16drv.h]
	Added support for pens and brushes in SelectObject. Added support
	for LineTo, MoveToEx, PatBlt (very preliminary), Polygon and
	Rectangle. Text is drawn in the correct place more often. These
	changes may only work with the Windows Postscript driver since
	many other drivers now need more GDI support.

Tue Oct  7 21:06:23 1997  Kristian Nielsen  <kristian.nielsen@risoe.dk>

	* [debugger/expr.c]
	Fixed typo for the >> operator.

	* [loader/task.c]
	Fixed SwitchStackTo(); it used to return with the new stack placed
	four bytes too high in memory.

	* [loader/ne_resource.c]
	Removed problematic nametable code introduced in Wine 970914.

Tue Oct  7 02:24:12 1997  Dimitrie O. Paun  <dimi@cs.toronto.edu>

	* [controls/commctrl.c]
	Added this files to hold functions from the comctl32.dll
	Added to this files some functions scattered in different places
	(such as InitCommonControls) and added some new ones as well.

	* [include/syscolor.h] [windows/syscolor.c]
	Added proper entries for all possible COLOR_* values.

	* [objects/brush.c]
	Modified GetSysColorBrush to return the correct brush for 
	all possible COLOR_* constants.

Sat Oct  4 23:35:20 1997  U.Bonnes <bon@elektron.ikp.physik.th-darmstadt.de>

	* [loader/module.c] [scheduler/process.c] [win32/environment.c]
	Another approach to get access to an unrestricted commandline.

	* [misc/crtdll.c]
	Make fclose work again.

	* [if1632/crtdll.spec]
	Use sprintf for crtdll-sprintf again as e.g. %g is not available
	for wsprintf.

	* [misc/wsprintf.c]
	Make WPR_STRING work in more situations.
	Added debug output for the wsprintf functions.

	* [misc/crtdll.c] [misc/main.c]
	Use argv[0] as comand with CRTDLL_system.

Fri Oct  3 14:00:29 MET DST 1997  Jan Willamowius  <jan@janhh.shnet.org>

	* [*/*]
        Removed some compiler warnings.

	* [msdos/int15.c]
        New INT 15 handler.
This commit is contained in:
Alexandre Julliard 1997-10-12 16:30:17 +00:00
parent 3db94ef2ec
commit 17216f5637
90 changed files with 2477 additions and 1448 deletions

View File

@ -1,12 +1,14 @@
This is release 970928 of Wine, the MS Windows emulator. This is still a This is release 971012 of Wine, the MS Windows emulator. This is still a
developer's only release. There are many bugs and many unimplemented API developer's only release. There are many bugs and many unimplemented API
features. Most applications still do not work correctly. features. Most applications still do not work correctly.
Patches should be submitted to "julliard@lrc.epfl.ch". Please don't Patches should be submitted to "julliard@lrc.epfl.ch". Please don't
forget to include a ChangeLog entry. forget to include a ChangeLog entry.
WHAT'S NEW with Wine-970928: (see ChangeLog for details) WHAT'S NEW with Wine-971012: (see ChangeLog for details)
- More relay code changes. - Improvements to printer driver support.
- More common controls functions.
- Win32 relay code changes.
- Lots of bug fixes. - Lots of bug fixes.
See the README file in the distribution for installation instructions. See the README file in the distribution for installation instructions.
@ -15,10 +17,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 the release is available at the ftp sites. The sources will be available
from the following locations: from the following locations:
ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-970928.tar.gz ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-971012.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-970928.tar.gz ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-971012.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-970928.tar.gz ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-971012.tar.gz
ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-970928.tar.gz ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-971012.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite. It should also be available from any site that mirrors tsx-11 or sunsite.

View File

@ -1,3 +1,98 @@
----------------------------------------------------------------------
Sun Oct 12 15:03:01 1997 Alexandre Julliard <julliard@lrc.epfl.ch>
* [if1632/builtin.c] [if1632/relay.c]
Relay debugging entry points are now generated on the fly for
Win32 DLLs.
* [include/stackframe.h]
Added VA_LIST16 type and macros to access arguments on the 16-bit
stack.
* [memory/global.c]
Fixed GlobalHandle32 to work with fixed blocks.
* [misc/ddeml.c] (New file)
Added a lot of stubs for DDEML functions.
* [objects/dc.c]
Added Get/SetGraphicsMode().
* [objects/gdiobj.c] [windows/winpos.c]
Added a few stubs.
* [tools/build.c]
Removed 'byte', 'word', 'long' and 'return' entry points for Win32.
'register' functions can no longer take arguments in Win32.
The Win32 NE module is now generated by MODULE_CreateDummyModule.
CallFrom32 callbacks removed except for register functions.
Fri Oct 10 18:22:18 1997 John Harvey <john@division.co.uk>
* [graphics/win16drv/Makefile.in] [graphics/win16drv/brush.c]
[graphics/win16drv/graphics.c] [graphics/win16drv/init.c]
[graphics/win16drv/objects.c] [graphics/win16drv/pen.c]
[graphics/win16drv/prtdrv.c] [graphics/win16drv/text.c]
[include/callback.h] [include/win16drv.h]
Added support for pens and brushes in SelectObject. Added support
for LineTo, MoveToEx, PatBlt (very preliminary), Polygon and
Rectangle. Text is drawn in the correct place more often. These
changes may only work with the Windows Postscript driver since
many other drivers now need more GDI support.
Tue Oct 7 21:06:23 1997 Kristian Nielsen <kristian.nielsen@risoe.dk>
* [debugger/expr.c]
Fixed typo for the >> operator.
* [loader/task.c]
Fixed SwitchStackTo(); it used to return with the new stack placed
four bytes too high in memory.
* [loader/ne_resource.c]
Removed problematic nametable code introduced in Wine 970914.
Tue Oct 7 02:24:12 1997 Dimitrie O. Paun <dimi@cs.toronto.edu>
* [controls/commctrl.c]
Added this files to hold functions from the comctl32.dll
Added to this files some functions scattered in different places
(such as InitCommonControls) and added some new ones as well.
* [include/syscolor.h] [windows/syscolor.c]
Added proper entries for all possible COLOR_* values.
* [objects/brush.c]
Modified GetSysColorBrush to return the correct brush for
all possible COLOR_* constants.
Sat Oct 4 23:35:20 1997 U.Bonnes <bon@elektron.ikp.physik.th-darmstadt.de>
* [loader/module.c] [scheduler/process.c] [win32/environment.c]
Another approach to get access to an unrestricted commandline.
* [misc/crtdll.c]
Make fclose work again.
* [if1632/crtdll.spec]
Use sprintf for crtdll-sprintf again as e.g. %g is not available
for wsprintf.
* [misc/wsprintf.c]
Make WPR_STRING work in more situations.
Added debug output for the wsprintf functions.
* [misc/crtdll.c] [misc/main.c]
Use argv[0] as comand with CRTDLL_system.
Fri Oct 3 14:00:29 MET DST 1997 Jan Willamowius <jan@janhh.shnet.org>
* [*/*]
Removed some compiler warnings.
* [msdos/int15.c]
New INT 15 handler.
---------------------------------------------------------------------- ----------------------------------------------------------------------
Sat Sep 27 12:36:56 1997 Alexandre Julliard <julliard@lrc.epfl.ch> Sat Sep 27 12:36:56 1997 Alexandre Julliard <julliard@lrc.epfl.ch>

View File

@ -74,18 +74,18 @@ OBJS = $(C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) $(ASM_SRCS:.S=.o) \
$(CC) -c -o $*.o $< $(CC) -c -o $*.o $<
.rc.c: .rc.c:
echo "#include \"windows.h\"" >winerctmp.c echo "#include \"windows.h\"" >$*-tmp.c
echo WINDOWS_H_ENDS_HERE >>winerctmp.c echo WINDOWS_H_ENDS_HERE >>$*-tmp.c
cat $< >>winerctmp.c cat $< >>$*-tmp.c
$(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) $(RCFLAGS) -c -o $* -p $* $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P $*-tmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) $(RCFLAGS) -c -o $* -p $*
$(RM) winerctmp.c $(RM) $*-tmp.c
.rc.h: .rc.h:
echo "#include \"windows.h\"" >winerctmp.c echo "#include \"windows.h\"" >$*-tmp.c
echo WINDOWS_H_ENDS_HERE >>winerctmp.c echo WINDOWS_H_ENDS_HERE >>$*-tmp.c
cat $< >>winerctmp.c cat $< >>$*-tmp.c
$(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) $(RCFLAGS) -c -o $* -p $* $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P $*-tmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) $(RCFLAGS) -c -o $* -p $*
$(RM) winerctmp.c $(RM) $*-tmp.c
# Rule to rebuild resource compiler # Rule to rebuild resource compiler
@ -115,7 +115,7 @@ depend:: $(MAKEDEP) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
$(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS) $(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS)
clean:: clean::
$(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc winerctmp.c y.tab.c y.tab.h lex.yy.c core $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.c) $(RC_SRCS:.rc=.h) $(PROGRAMS) $(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc *-tmp.c y.tab.c y.tab.h lex.yy.c core $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.c) $(RC_SRCS:.rc=.h) $(PROGRAMS)
dummy: dummy:

View File

@ -8,6 +8,7 @@ MODULE = controls
C_SRCS = \ C_SRCS = \
button.c \ button.c \
combo.c \ combo.c \
commctrl.c \
desktop.c \ desktop.c \
edit.c \ edit.c \
icontitle.c \ icontitle.c \

164
controls/commctrl.c Normal file
View File

@ -0,0 +1,164 @@
/*
* Common controls functions
*
* Copyright 1997 Dimitrie O. Paun
*
*/
#include "win.h"
#include "heap.h"
#include "commctrl.h"
#include "progress.h"
#include "status.h"
#include "updown.h"
/* Win32 common controls */
static WNDCLASS32A WIDGETS_CommonControls32[] =
{
{ CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW, StatusWindowProc, 0,
sizeof(STATUSWINDOWINFO), 0, 0, 0, 0, 0, STATUSCLASSNAME32A },
{ CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW, UpDownWindowProc, 0,
sizeof(UPDOWN_INFO), 0, 0, 0, 0, 0, UPDOWN_CLASS32A },
{ CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW, ProgressWindowProc, 0,
sizeof(PROGRESS_INFO), 0, 0, 0, 0, 0, PROGRESS_CLASS32A }
};
#define NB_COMMON_CONTROLS32 \
(sizeof(WIDGETS_CommonControls32)/sizeof(WIDGETS_CommonControls32[0]))
/***********************************************************************
* DrawStatusText32A (COMCTL32.5)
*/
void WINAPI DrawStatusText32A( HDC32 hdc, LPRECT32 lprc, LPCSTR text,
UINT32 style )
{
RECT32 r = *lprc;
UINT32 border = BDR_SUNKENOUTER;
DrawEdge32(hdc, &r, BDR_RAISEDINNER, BF_RECT|BF_ADJUST|BF_FLAT);
if(style==SBT_POPOUT)
border = BDR_RAISEDOUTER;
else if(style==SBT_NOBORDERS)
border = 0;
DrawEdge32(hdc, &r, border, BF_RECT|BF_ADJUST|BF_MIDDLE);
/* now draw text */
if (text) {
int oldbkmode = SetBkMode32(hdc, TRANSPARENT);
r.left += 3;
DrawText32A(hdc, text, lstrlen32A(text),
&r, DT_LEFT|DT_VCENTER|DT_SINGLELINE);
if (oldbkmode != TRANSPARENT)
SetBkMode32(hdc, oldbkmode);
}
}
/***********************************************************************
* DrawStatusText32W (COMCTL32.24)
*/
void WINAPI DrawStatusText32W( HDC32 hdc, LPRECT32 lprc, LPCWSTR text,
UINT32 style )
{
LPSTR p = HEAP_strdupWtoA( GetProcessHeap(), 0, text );
DrawStatusText32A(hdc, lprc, p, style);
HeapFree( GetProcessHeap(), 0, p );
}
/***********************************************************************
* DrawStatusText16 (COMCTL32.23)
*/
void WINAPI DrawStatusText16( HDC16 hdc, LPRECT16 lprc, LPCSTR text,
UINT16 style )
{
if(!lprc)
DrawStatusText32A((HDC32)hdc, 0, text, (UINT32)style);
else{
RECT32 rect32;
CONV_RECT16TO32( lprc, &rect32 );
DrawStatusText32A((HDC32)hdc, &rect32, text, (UINT32)style);
}
}
/***********************************************************************
* CreateStatusWindow32A (COMCTL32.6)
*/
HWND32 WINAPI CreateStatusWindow32A( INT32 style, LPCSTR text, HWND32 parent,
UINT32 wid )
{
return CreateWindow32A(STATUSCLASSNAME32A, text, style,
CW_USEDEFAULT32, CW_USEDEFAULT32,
CW_USEDEFAULT32, CW_USEDEFAULT32,
parent, wid, 0, 0);
}
/***********************************************************************
* CreateStatusWindow16 (COMCTL32.18)
*/
HWND16 WINAPI CreateStatusWindow16( INT16 style, LPCSTR text, HWND16 parent,
UINT16 wid )
{
return CreateWindow16(STATUSCLASSNAME16, text, style,
CW_USEDEFAULT16, CW_USEDEFAULT16,
CW_USEDEFAULT16, CW_USEDEFAULT16,
parent, wid, 0, 0);
}
/***********************************************************************
* CreateStatusWindow32W (COMCTL32.19)
*/
HWND32 WINAPI CreateStatusWindow32W( INT32 style, LPCWSTR text, HWND32 parent,
UINT32 wid )
{
return CreateWindow32W(STATUSCLASSNAME32W, text, style,
CW_USEDEFAULT32, CW_USEDEFAULT32,
CW_USEDEFAULT32, CW_USEDEFAULT32,
parent, wid, 0, 0);
}
/***********************************************************************
* CreateUpDownControl (COMCTL32.16)
*/
HWND32 WINAPI CreateUpDownControl( DWORD style, INT32 x, INT32 y,
INT32 cx, INT32 cy, HWND32 parent,
INT32 id, HINSTANCE32 inst, HWND32 buddy,
INT32 maxVal, INT32 minVal, INT32 curVal )
{
HWND32 hUD = CreateWindow32A(UPDOWN_CLASS32A, 0, style, x, y, cx, cy,
parent, id, inst, 0);
if(hUD){
SendMessage32A(hUD, UDM_SETBUDDY, buddy, 0);
SendMessage32A(hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal));
SendMessage32A(hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0));
}
return hUD;
}
/***********************************************************************
* InitCommonControls (COMCTL32.17)
*/
void WINAPI InitCommonControls(void)
{
int i;
char name[30];
const char *old_name;
WNDCLASS32A *class32 = WIDGETS_CommonControls32;
for (i = 0; i < NB_COMMON_CONTROLS32; i++, class32++)
{
/* Just to make sure the string is > 0x10000 */
old_name = class32->lpszClassName;
strcpy( name, (char *)class32->lpszClassName );
class32->lpszClassName = name;
class32->hCursor = LoadCursor16( 0, IDC_ARROW );
RegisterClass32A( class32 );
class32->lpszClassName = old_name;
}
}

View File

@ -10,7 +10,6 @@
#include "status.h" #include "status.h"
#include "commctrl.h" #include "commctrl.h"
#include "heap.h" #include "heap.h"
#include "syscolor.h"
#include "win.h" #include "win.h"
/* /*
@ -35,49 +34,6 @@ static STATUSWINDOWINFO *GetStatusInfo(HWND32 hwnd)
return ((STATUSWINDOWINFO *) &wndPtr->wExtra[0]); return ((STATUSWINDOWINFO *) &wndPtr->wExtra[0]);
} }
/***********************************************************************
* DrawStatusText32A (COMCTL32.3)
*/
void WINAPI DrawStatusText32A( HDC32 hdc, LPRECT32 lprc, LPCSTR text,
UINT32 style )
{
RECT32 r, rt;
int oldbkmode;
UINT32 border;
r = *lprc;
if(style == SBT_OWNERDRAW){
/* FIXME for SBT_OWNERDRAW, SBT_RTLREADING */
}
else{
DrawEdge32(hdc, &r, BDR_RAISEDINNER, BF_RECT|BF_ADJUST|BF_FLAT);
if(style==SBT_POPOUT)
border = BDR_RAISEDOUTER;
else if(style==SBT_NOBORDERS)
border = 0;
else
border = BDR_SUNKENOUTER;
DrawEdge32(hdc, &r, border, BF_RECT | BF_ADJUST | BF_MIDDLE);
/* now draw text */
if (text) {
SelectObject32(hdc, sysColorObjects.hpenWindowText);
oldbkmode = SetBkMode32(hdc, TRANSPARENT);
rt = r;
rt.left += 3;
DrawText32A(hdc, text, lstrlen32A(text),
&rt, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
if (oldbkmode != TRANSPARENT)
SetBkMode32(hdc, oldbkmode);
}
}
}
static BOOL32 SW_Refresh( HWND32 hwnd, HDC32 hdc, STATUSWINDOWINFO *self ) static BOOL32 SW_Refresh( HWND32 hwnd, HDC32 hdc, STATUSWINDOWINFO *self )
{ {
int i; int i;
@ -475,23 +431,4 @@ LRESULT WINAPI StatusWindowProc( HWND32 hwnd, UINT32 msg,
} }
/***********************************************************************
* CreateStatusWindow32A (COMCTL32.4)
*/
HWND32 WINAPI CreateStatusWindow32A( INT32 style, LPCSTR text, HWND32 parent,
UINT32 wid )
{
HWND32 ret;
ATOM atom;
atom = GlobalFindAtom32A(STATUSCLASSNAME32A);
if (!atom) {
/* Some apps don't call InitCommonControls */
InitCommonControls();
}
ret = CreateWindowEx32A(0, STATUSCLASSNAME32A, "Status Window",
style, CW_USEDEFAULT32, CW_USEDEFAULT32,
CW_USEDEFAULT32, CW_USEDEFAULT32, parent, 0, 0, 0);
return (ret);
}

View File

@ -847,21 +847,3 @@ LRESULT WINAPI UpDownWindowProc(HWND32 hwnd, UINT32 message, WPARAM32 wParam,
return 0; return 0;
} }
/***********************************************************************
* CreateUpDownControl (COMCTL32.14)
*/
HWND32 WINAPI CreateUpDownControl( DWORD style, INT32 x, INT32 y,
INT32 cx, INT32 cy, HWND32 parent,
INT32 id, HINSTANCE32 inst, HWND32 buddy,
INT32 maxVal, INT32 minVal, INT32 curVal )
{
HWND32 hUD = CreateWindow32A(UPDOWN_CLASS32A, 0, style, x, y, cx, cy,
parent, id, inst, 0);
if(hUD){
SendMessage32A(hUD, UDM_SETBUDDY, buddy, 0);
SendMessage32A(hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal));
SendMessage32A(hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0));
}
return hUD;
}

View File

@ -9,12 +9,8 @@
#include "win.h" #include "win.h"
#include "commctrl.h" #include "commctrl.h"
#include "button.h" #include "button.h"
#include "progress.h"
#include "static.h" #include "static.h"
#include "status.h"
#include "updown.h"
#include "scroll.h" #include "scroll.h"
#include "updown.h"
#include "desktop.h" #include "desktop.h"
#include "mdi.h" #include "mdi.h"
#include "gdi.h" #include "gdi.h"
@ -99,22 +95,6 @@ static WNDCLASS32A WIDGETS_BuiltinClasses32[BIC32_NB_CLASSES] =
static ATOM bicAtomTable[BIC32_NB_CLASSES]; static ATOM bicAtomTable[BIC32_NB_CLASSES];
/* Win32 common controls */
static WNDCLASS32A WIDGETS_CommonControls32[] =
{
{ CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW, StatusWindowProc, 0,
sizeof(STATUSWINDOWINFO), 0, 0, 0, 0, 0, STATUSCLASSNAME32A },
{ CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW, UpDownWindowProc, 0,
sizeof(UPDOWN_INFO), 0, 0, 0, 0, 0, UPDOWN_CLASS32A },
{ CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW, ProgressWindowProc, 0,
sizeof(PROGRESS_INFO), 0, 0, 0, 0, 0, PROGRESS_CLASS32A }
};
#define NB_COMMON_CONTROLS32 \
(sizeof(WIDGETS_CommonControls32)/sizeof(WIDGETS_CommonControls32[0]))
/*********************************************************************** /***********************************************************************
* WIDGETS_Init * WIDGETS_Init
* *
@ -166,29 +146,6 @@ BOOL32 WIDGETS_Init(void)
} }
/***********************************************************************
* InitCommonControls (COMCTL32.15)
*/
void WINAPI InitCommonControls(void)
{
int i;
char name[30];
const char *old_name;
WNDCLASS32A *class32 = WIDGETS_CommonControls32;
for (i = 0; i < NB_COMMON_CONTROLS32; i++, class32++)
{
/* Just to make sure the string is > 0x10000 */
old_name = class32->lpszClassName;
strcpy( name, (char *)class32->lpszClassName );
class32->lpszClassName = name;
class32->hCursor = LoadCursor16( 0, IDC_ARROW );
RegisterClass32A( class32 );
class32->lpszClassName = old_name;
}
}
/*********************************************************************** /***********************************************************************
* WIDGETS_IsControl32 * WIDGETS_IsControl32
* *

View File

@ -548,7 +548,7 @@ DEBUG_EvalExpr(struct expr * exp)
break; break;
case EXP_OP_SHR: case EXP_OP_SHR:
rtn.seg = 0; rtn.seg = 0;
exp->un.binop.result = ((unsigned) VAL(exp1) << VAL(exp2)); exp->un.binop.result = ((unsigned) VAL(exp1) >> VAL(exp2));
break; break;
case EXP_OP_MUL: case EXP_OP_MUL:
rtn.seg = 0; rtn.seg = 0;

View File

@ -982,7 +982,6 @@ INT32 WINAPI GetPrivateProfileSection32A( LPCSTR section, LPSTR buffer,
return 0; return 0;
} }
/*********************************************************************** /***********************************************************************
* WritePrivateProfileString16 (KERNEL.129) * WritePrivateProfileString16 (KERNEL.129)
*/ */

View File

@ -6,9 +6,12 @@ VPATH = @srcdir@
MODULE = win16drv MODULE = win16drv
C_SRCS = \ C_SRCS = \
brush.c \
font.c \ font.c \
graphics.c \
init.c \ init.c \
objects.c \ objects.c \
pen.c \
prtdrv.c \ prtdrv.c \
text.c text.c

35
graphics/win16drv/brush.c Normal file
View File

@ -0,0 +1,35 @@
/*
* GDI brush objects - win16drv
*
* Copyright 1997 John Harvey
*/
#include <stdlib.h>
#include "brush.h"
#include "win16drv.h"
#include "stddebug.h"
#include "debug.h"
HBRUSH32 WIN16DRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush,
BRUSHOBJ * brush )
{
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
HBRUSH16 prevHandle = dc->w.hBrush;
int nSize;
LOGBRUSH16 lBrush16;
dc->w.hBrush = hbrush;
lBrush16.lbStyle = brush->logbrush.lbStyle;
lBrush16.lbColor = brush->logbrush.lbColor;
lBrush16.lbHatch = brush->logbrush.lbHatch;
nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, OBJ_BRUSH,
&lBrush16, NULL,
0);
/* may need to realloc segptrFOntInfo*/
physDev->segptrBrushInfo = WIN16_GlobalLock16(GlobalAlloc16(GHND, nSize));
nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, OBJ_BRUSH,
&lBrush16,
(LPVOID)physDev->segptrBrushInfo,
win16drv_SegPtr_TextXForm);
return prevHandle;
}

View File

@ -0,0 +1,105 @@
/*
* Windows 16 bit device driver graphics functions
*
* Copyright 1997 John Harvey
*/
#include "win16drv.h"
/**********************************************************************
* WIN16DRV_MoveToEx
*/
BOOL32
WIN16DRV_MoveToEx(DC *dc,INT32 x,INT32 y,LPPOINT32 pt)
{
if (pt)
{
pt->x = dc->w.CursPosX;
pt->y = dc->w.CursPosY;
}
dc->w.CursPosX = x;
dc->w.CursPosY = y;
return TRUE;
}
/***********************************************************************
* WIN16DRV_LineTo
*/
BOOL32
WIN16DRV_LineTo( DC *dc, INT32 x, INT32 y )
{
BOOL32 bRet ;
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
POINT16 points[2];
points[0].x = dc->w.DCOrgX + XLPTODP( dc, dc->w.CursPosX );
points[0].y = dc->w.DCOrgY + YLPTODP( dc, dc->w.CursPosY );
points[1].x = dc->w.DCOrgX + XLPTODP( dc, x );
points[1].y = dc->w.DCOrgY + YLPTODP( dc, y );
bRet = PRTDRV_Output(physDev->segptrPDEVICE,
OS_POLYLINE, 2, points,
physDev->segptrPenInfo,
NULL,
win16drv_SegPtr_DrawMode, NULL);
dc->w.CursPosX = x;
dc->w.CursPosY = y;
return TRUE;
}
/***********************************************************************
* WIN16DRV_Rectangle
*/
BOOL32
WIN16DRV_Rectangle(DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom)
{
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
BOOL32 bRet = 0;
POINT16 points[2];
printf("In WIN16drv_Rectangle, x %d y %d DCOrgX %d y %d\n",
left, top, dc->w.DCOrgX, dc->w.DCOrgY);
printf("In WIN16drv_Rectangle, VPortOrgX %d y %d\n",
dc->vportOrgX, dc->vportOrgY);
points[0].x = XLPTODP(dc, left);
points[0].y = YLPTODP(dc, top);
points[1].x = XLPTODP(dc, right);
points[1].y = XLPTODP(dc, bottom);
bRet = PRTDRV_Output(physDev->segptrPDEVICE,
OS_RECTANGLE, 2, points,
physDev->segptrPenInfo,
physDev->segptrBrushInfo,
win16drv_SegPtr_DrawMode, NULL);
return bRet;
}
/***********************************************************************
* WIN16DRV_Polygon
*/
BOOL32
WIN16DRV_Polygon(DC *dc, LPPOINT32 pt, INT32 count )
{
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
BOOL32 bRet = 0;
LPPOINT16 points;
int i;
points = malloc(count * sizeof(POINT16));
for (i = 0; i<count ; i++)
{
points[i].x = ((pt[i].x - dc->wndOrgX) * dc->vportExtX/ dc->wndExtX) + dc->vportOrgX;
points[i].y = ((pt[i].y - dc->wndOrgY) * dc->vportExtY/ dc->wndExtY) + dc->vportOrgY;
}
bRet = PRTDRV_Output(physDev->segptrPDEVICE,
OS_WINDPOLYGON, 2, points,
physDev->segptrPenInfo,
physDev->segptrBrushInfo,
win16drv_SegPtr_DrawMode, NULL);
return bRet;
}

View File

@ -67,8 +67,8 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
WIN16DRV_GetTextMetrics, /* pGetTextMetrics */ WIN16DRV_GetTextMetrics, /* pGetTextMetrics */
NULL, /* pIntersectClipRect */ NULL, /* pIntersectClipRect */
NULL, /* pIntersectVisRect */ NULL, /* pIntersectVisRect */
NULL, /* pLineTo */ WIN16DRV_LineTo, /* pLineTo */
NULL, /* pMoveToEx */ WIN16DRV_MoveToEx, /* pMoveToEx */
NULL, /* pOffsetClipRgn */ NULL, /* pOffsetClipRgn */
NULL, /* pOffsetViewportOrgEx */ NULL, /* pOffsetViewportOrgEx */
NULL, /* pOffsetWindowOrgEx */ NULL, /* pOffsetWindowOrgEx */
@ -76,10 +76,10 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
WIN16DRV_PatBlt, /* pPatBlt */ WIN16DRV_PatBlt, /* pPatBlt */
NULL, /* pPie */ NULL, /* pPie */
NULL, /* pPolyPolygon */ NULL, /* pPolyPolygon */
NULL, /* pPolygon */ WIN16DRV_Polygon, /* pPolygon */
NULL, /* pPolyline */ NULL, /* pPolyline */
NULL, /* pRealizePalette */ NULL, /* pRealizePalette */
NULL, /* pRectangle */ WIN16DRV_Rectangle, /* pRectangle */
NULL, /* pRestoreDC */ NULL, /* pRestoreDC */
NULL, /* pRoundRect */ NULL, /* pRoundRect */
NULL, /* pSaveDC */ NULL, /* pSaveDC */
@ -278,11 +278,11 @@ BOOL32 WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output,
/* TTD Shouldn't really do pointer arithmetic on segment points */ /* TTD Shouldn't really do pointer arithmetic on segment points */
physDev->segptrPDEVICE = WIN16_GlobalLock16(GlobalAlloc16(GHND, nPDEVICEsize))+sizeof(PDEVICE_HEADER); physDev->segptrPDEVICE = WIN16_GlobalLock16(GlobalAlloc16(GHND, nPDEVICEsize))+sizeof(PDEVICE_HEADER);
*(BYTE *)(PTR_SEG_TO_LIN(physDev->segptrPDEVICE)+0) = 'N'; *((BYTE *)PTR_SEG_TO_LIN(physDev->segptrPDEVICE)+0) = 'N';
*(BYTE *)(PTR_SEG_TO_LIN(physDev->segptrPDEVICE)+1) = 'B'; *((BYTE *)PTR_SEG_TO_LIN(physDev->segptrPDEVICE)+1) = 'B';
/* Set up the header */ /* Set up the header */
pPDH = (PDEVICE_HEADER *)(PTR_SEG_TO_LIN(physDev->segptrPDEVICE) - sizeof(PDEVICE_HEADER)); pPDH = (PDEVICE_HEADER *)((BYTE*)PTR_SEG_TO_LIN(physDev->segptrPDEVICE) - sizeof(PDEVICE_HEADER));
pPDH->pLPD = pLPD; pPDH->pLPD = pLPD;
dprintf_win16drv(stddeb, "PRTDRV_Enable: PDEVICE allocated %08lx\n",(DWORD)(physDev->segptrPDEVICE)); dprintf_win16drv(stddeb, "PRTDRV_Enable: PDEVICE allocated %08lx\n",(DWORD)(physDev->segptrPDEVICE));
@ -389,8 +389,14 @@ BOOL32 WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output,
extern BOOL32 WIN16DRV_PatBlt( struct tagDC *dc, INT32 left, INT32 top, extern BOOL32 WIN16DRV_PatBlt( struct tagDC *dc, INT32 left, INT32 top,
INT32 width, INT32 height, DWORD rop ) INT32 width, INT32 height, DWORD rop )
{ {
printf("In WIN16DRV_PatBlt\n");
return FALSE; WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
BOOL32 bRet = 0;
bRet = PRTDRV_StretchBlt( physDev->segptrPDEVICE, left, top, width, height, NULL, 0, 0, width, height,
PATCOPY, physDev->segptrBrushInfo, win16drv_SegPtr_DrawMode, NULL);
return bRet;
} }
/* /*
* Escape (GDI.38) * Escape (GDI.38)
@ -415,17 +421,17 @@ static INT32 WIN16DRV_Escape( DC *dc, INT32 nEscape, INT32 cbInput,
case NEXTBAND: case NEXTBAND:
{ {
SEGPTR newInData = WIN16_GlobalLock16(GlobalAlloc16(GHND, sizeof(POINT16))); LPPOINT16 newInData = SEGPTR_NEW(POINT16);
nRet = PRTDRV_Control(physDev->segptrPDEVICE, nEscape, nRet = PRTDRV_Control(physDev->segptrPDEVICE, nEscape,
newInData, lpOutData); SEGPTR_GET(newInData), lpOutData);
GlobalFree16(newInData); SEGPTR_FREE(newInData);
break; break;
} }
case GETEXTENDEDTEXTMETRICS: case GETEXTENDEDTEXTMETRICS:
{ {
SEGPTR newInData = WIN16_GlobalLock16(GlobalAlloc16(GHND, sizeof(EXTTEXTDATA))); EXTTEXTDATA *textData = SEGPTR_NEW(EXTTEXTDATA);
EXTTEXTDATA *textData = (EXTTEXTDATA *)(PTR_SEG_TO_LIN(newInData));
textData->nSize = cbInput; textData->nSize = cbInput;
textData->lpindata = lpInData; textData->lpindata = lpInData;
@ -433,9 +439,8 @@ static INT32 WIN16DRV_Escape( DC *dc, INT32 nEscape, INT32 cbInput,
textData->lpXForm = win16drv_SegPtr_TextXForm; textData->lpXForm = win16drv_SegPtr_TextXForm;
textData->lpDrawMode = win16drv_SegPtr_DrawMode; textData->lpDrawMode = win16drv_SegPtr_DrawMode;
nRet = PRTDRV_Control(physDev->segptrPDEVICE, nEscape, nRet = PRTDRV_Control(physDev->segptrPDEVICE, nEscape,
newInData, lpOutData); SEGPTR_GET(textData), lpOutData);
GlobalFree16(newInData); SEGPTR_FREE(textData);
} }
break; break;
case STARTDOC: case STARTDOC:
@ -443,13 +448,14 @@ static INT32 WIN16DRV_Escape( DC *dc, INT32 nEscape, INT32 cbInput,
lpInData, lpOutData); lpInData, lpOutData);
if (nRet != -1) if (nRet != -1)
{ {
SEGPTR newInData = WIN16_GlobalLock16(GlobalAlloc16(GHND, sizeof(HDC32))); HDC32 *tmpHdc = SEGPTR_NEW(HDC32);
#define SETPRINTERDC SETABORTPROC #define SETPRINTERDC SETABORTPROC
HDC32 *tmpHdc = (HDC32 *)(PTR_SEG_TO_LIN(newInData));
*tmpHdc = dc->hSelf; *tmpHdc = dc->hSelf;
PRTDRV_Control(physDev->segptrPDEVICE, SETPRINTERDC, PRTDRV_Control(physDev->segptrPDEVICE, SETPRINTERDC,
newInData, (SEGPTR)NULL); SEGPTR_GET(tmpHdc), (SEGPTR)NULL);
GlobalFree16(newInData); SEGPTR_FREE(tmpHdc);
} }
break; break;
default: default:
@ -659,7 +665,7 @@ static int FreePrintJob(HANDLE16 hJob)
HANDLE16 WINAPI OpenJob(LPSTR lpOutput, LPSTR lpTitle, HDC16 hDC) HANDLE16 WINAPI OpenJob(LPSTR lpOutput, LPSTR lpTitle, HDC16 hDC)
{ {
HANDLE16 hHandle = SP_ERROR; HANDLE16 hHandle = (HANDLE16)SP_ERROR;
PPRINTJOB pPrintJob; PPRINTJOB pPrintJob;
dprintf_win16drv(stddeb, "OpenJob: \"%s\" \"%s\" %04x\n", lpOutput, lpTitle, hDC); dprintf_win16drv(stddeb, "OpenJob: \"%s\" \"%s\" %04x\n", lpOutput, lpTitle, hDC);

View File

@ -37,11 +37,15 @@ HGDIOBJ32 WIN16DRV_SelectObject( DC *dc, HGDIOBJ32 handle )
switch(ptr->wMagic) switch(ptr->wMagic)
{ {
case PEN_MAGIC: case PEN_MAGIC:
fprintf(stderr, "WIN16DRV_SelectObject for PEN not implemented\n"); ret = WIN16DRV_PEN_SelectObject( dc, handle, (PENOBJ *)ptr );
break;
case BRUSH_MAGIC: case BRUSH_MAGIC:
fprintf(stderr, "WIN16DRV_SelectObject for BRUSH not implemented\n"); ret = WIN16DRV_BRUSH_SelectObject( dc, handle, (BRUSHOBJ *)ptr );
break;
case BITMAP_MAGIC: case BITMAP_MAGIC:
fprintf(stderr, "WIN16DRV_SelectObject for BITMAP not implemented\n"); fprintf(stderr, "WIN16DRV_SelectObject for BITMAP not implemented\n");
ret = 1;
break;
case FONT_MAGIC: case FONT_MAGIC:
ret = WIN16DRV_FONT_SelectObject( dc, handle, (FONTOBJ *)ptr ); ret = WIN16DRV_FONT_SelectObject( dc, handle, (FONTOBJ *)ptr );
break; break;

41
graphics/win16drv/pen.c Normal file
View File

@ -0,0 +1,41 @@
/*
* GDI pen objects
*
* Copyright 1997 John Harvey
*/
#include "pen.h"
#include "color.h"
#include "win16drv.h"
#include "stddebug.h"
#include "debug.h"
/***********************************************************************
* PEN_SelectObject
*/
HPEN32 WIN16DRV_PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen )
{
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
HPEN32 prevHandle = dc->w.hPen;
int nSize;
LOGPEN16 lPen16;
dc->w.hPen = hpen;
printf("In WIN16DRV_PEN_SelectObject\n");
lPen16.lopnStyle = pen->logpen.lopnStyle;
lPen16.lopnWidth.x = pen->logpen.lopnWidth.x;
lPen16.lopnWidth.y = pen->logpen.lopnWidth.y;
lPen16.lopnColor = pen->logpen.lopnColor;
nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, OBJ_PEN,
&lPen16, NULL,
0);
/* may need to realloc segptrFOntInfo*/
physDev->segptrPenInfo = WIN16_GlobalLock16(GlobalAlloc16(GHND, nSize));
nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, OBJ_PEN,
&lPen16,
(LPVOID)physDev->segptrPenInfo,
0);
return prevHandle;
}

View File

@ -1,7 +1,7 @@
/* /*
* Windows Device Context initialisation functions * Windows Device Context initialisation functions
* *
* Copyright 1996 John Harvey * Copyright 1996,1997 John Harvey
*/ */
#include <stdlib.h> #include <stdlib.h>
@ -12,7 +12,8 @@
#include <errno.h> #include <errno.h>
#include "windows.h" #include "windows.h"
#include "win16drv.h" #include "win16drv.h"
#include "heap.h"
#include "brush.h"
#include "callback.h" #include "callback.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
@ -82,7 +83,6 @@ static LOADED_PRINTER_DRIVER *FindPrinterDriverFromName(const char *pszDriver)
pLPD = ptmpLPD; pLPD = ptmpLPD;
} }
} }
if (pLPD == NULL) fprintf(stderr,"Couldn't find driver %s\n", pszDriver);
return pLPD; return pLPD;
} }
@ -142,24 +142,20 @@ LOADED_PRINTER_DRIVER *LoadPrinterDriver(const char *pszDriver)
strcat(drvName, ".DRV"); strcat(drvName, ".DRV");
hInst = LoadLibrary16(drvName); hInst = LoadLibrary16(drvName);
} }
dprintf_win16drv(stddeb, "Loaded the library\n");
if (hInst <= 32) if (hInst <= 32)
{ {
/* Failed to load driver */ /* Failed to load driver */
fprintf(stderr, "Failed to load printer driver %s\n", pszDriver); fprintf(stderr, "Failed to load printer driver %s\n", pszDriver);
} } else {
else dprintf_win16drv(stddeb, "Loaded the library\n");
{
HANDLE16 hHandle;
/* Allocate some memory for printer driver info */ /* Allocate some memory for printer driver info */
pLPD = malloc(sizeof(LOADED_PRINTER_DRIVER)); pLPD = malloc(sizeof(LOADED_PRINTER_DRIVER));
memset(pLPD, 0 , sizeof(LOADED_PRINTER_DRIVER)); memset(pLPD, 0 , sizeof(LOADED_PRINTER_DRIVER));
pLPD->hInst = hInst; pLPD->hInst = hInst;
strcpy(pLPD->szDriver,pszDriver); pLPD->szDriver = HEAP_strdupA(SystemHeap,0,pszDriver);
/* Get DS for the printer module */ /* Get DS for the printer module */
pLPD->ds_reg = hInst; pLPD->ds_reg = hInst;
@ -172,12 +168,6 @@ LOADED_PRINTER_DRIVER *LoadPrinterDriver(const char *pszDriver)
/* Set initial usage count */ /* Set initial usage count */
pLPD->nUsageCount = 1; pLPD->nUsageCount = 1;
/* Create a thunking buffer */
hHandle = GlobalAlloc16(GHND, (1024 * 8));
pLPD->hThunk = hHandle;
pLPD->ThunkBufSegPtr = WIN16_GlobalLock16(hHandle);
pLPD->ThunkBufLimit = pLPD->ThunkBufSegPtr + (1024*8);
/* Update table of loaded printer drivers */ /* Update table of loaded printer drivers */
pLPD->nIndex = nDriverSlot; pLPD->nIndex = nDriverSlot;
gapLoadedPrinterDrivers[nDriverSlot] = pLPD; gapLoadedPrinterDrivers[nDriverSlot] = pLPD;
@ -186,42 +176,6 @@ LOADED_PRINTER_DRIVER *LoadPrinterDriver(const char *pszDriver)
return pLPD; return pLPD;
} }
/*
* Thunking utility functions
*/
static BOOL32 AddData(SEGPTR *pSegPtr, const void *pData, int nSize, SEGPTR Limit)
{
BOOL32 bRet = FALSE;
char *pBuffer = PTR_SEG_TO_LIN((*pSegPtr));
char *pLimit = PTR_SEG_TO_LIN(Limit);
if ((pBuffer + nSize) < pLimit)
{
DWORD *pdw = (DWORD *)pSegPtr;
SEGPTR SegPtrOld = *pSegPtr;
SEGPTR SegPtrNew;
dprintf_win16drv(stddeb, "AddData: Copying %d from %p to %p(0x%x)\n", nSize, pData, pBuffer, (UINT32)*pSegPtr);
memcpy(pBuffer, pData, nSize);
SegPtrNew = (SegPtrOld + nSize + 1);
*pdw = (DWORD)SegPtrNew;
}
return bRet;
}
static BOOL32 GetParamData(SEGPTR SegPtrSrc,void *pDataDest, int nSize)
{
char *pSrc = PTR_SEG_TO_LIN(SegPtrSrc);
char *pDest = pDataDest;
dprintf_win16drv(stddeb, "GetParamData: Copying %d from %lx(%lx) to %lx\n", nSize, (DWORD)pSrc, (DWORD)SegPtrSrc, (DWORD)pDataDest);
memcpy(pDest, pSrc, nSize);
return TRUE;
}
/* /*
* Control (ordinal 3) * Control (ordinal 3)
*/ */
@ -273,61 +227,45 @@ WORD PRTDRV_Enable(LPVOID lpDevInfo, WORD wStyle, LPCSTR lpDestDevType,
/* Get the printer driver info */ /* Get the printer driver info */
if (wStyle == INITPDEVICE) if (wStyle == INITPDEVICE)
{
pLPD = FindPrinterDriverFromPDEVICE((SEGPTR)lpDevInfo); pLPD = FindPrinterDriverFromPDEVICE((SEGPTR)lpDevInfo);
}
else else
{
pLPD = FindPrinterDriverFromName((char *)lpDeviceName); pLPD = FindPrinterDriverFromName((char *)lpDeviceName);
} if (pLPD != NULL) {
if (pLPD != NULL) LONG lP5;
{ DeviceCaps *lP1;
LONG lP1, lP3, lP4, lP5; LPSTR lP3,lP4;
WORD wP2; WORD wP2;
SEGPTR SegPtr = pLPD->ThunkBufSegPtr;
SEGPTR Limit = pLPD->ThunkBufLimit;
int nSize;
if (pLPD->fn[FUNC_ENABLE] == NULL) if (!pLPD->fn[FUNC_ENABLE]) {
{
dprintf_win16drv(stddeb, "PRTDRV_Enable: Not supported by driver\n"); dprintf_win16drv(stddeb, "PRTDRV_Enable: Not supported by driver\n");
return 0; return 0;
} }
if (wStyle == INITPDEVICE) if (wStyle == INITPDEVICE)
{ lP1 = (DeviceCaps*)lpDevInfo;/* 16 bit segmented ptr already */
/* All ready a 16 address */
lP1 = (SEGPTR)lpDevInfo;
}
else else
{ lP1 = SEGPTR_NEW(DeviceCaps);
/* 32 bit data */
lP1 = SegPtr;
nSize = sizeof(DeviceCaps);
AddData(&SegPtr, lpDevInfo, nSize, Limit);
}
wP2 = wStyle; wP2 = wStyle;
lP3 = SegPtr; /* SEGPTR_STRDUP handles NULL like a charm ... */
nSize = strlen(lpDestDevType) + 1; lP3 = SEGPTR_STRDUP(lpDestDevType);
AddData(&SegPtr, lpDestDevType, nSize, Limit); lP4 = SEGPTR_STRDUP(lpOutputFile);
lP4 = SegPtr;
nSize = strlen(lpOutputFile) + 1;
AddData(&SegPtr, lpOutputFile, nSize, Limit);
lP5 = (LONG)lpData; lP5 = (LONG)lpData;
wRet = CallTo16_word_lwlll(pLPD->fn[FUNC_ENABLE], wRet = CallTo16_word_lwlll(pLPD->fn[FUNC_ENABLE],
lP1, wP2, lP3, lP4, lP5); (wStyle==INITPDEVICE)?lP1:SEGPTR_GET(lP1),
wP2,
SEGPTR_GET(lP3),
SEGPTR_GET(lP4),
lP5);
SEGPTR_FREE(lP3);
SEGPTR_FREE(lP4);
/* Get the data back */ /* Get the data back */
if (lP1 != 0 && wStyle != INITPDEVICE) if (lP1 != 0 && wStyle != INITPDEVICE) {
{ memcpy(lpDevInfo,lP1,sizeof(DeviceCaps));
nSize = sizeof(DeviceCaps); SEGPTR_FREE(lP1);
GetParamData(lP1, lpDevInfo, nSize);
} }
} }
dprintf_win16drv(stddeb, "PRTDRV_Enable: return %x\n", wRet); dprintf_win16drv(stddeb, "PRTDRV_Enable: return %x\n", wRet);
@ -348,39 +286,23 @@ WORD PRTDRV_EnumDFonts(LPPDEVICE lpDestDev, LPSTR lpFaceName,
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL) if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
{ {
LONG lP1, lP2, lP3, lP4; LONG lP1, lP3, lP4;
LPBYTE lP2;
SEGPTR SegPtr = pLPD->ThunkBufSegPtr; if (pLPD->fn[FUNC_ENUMDFONTS] == NULL) {
SEGPTR Limit = pLPD->ThunkBufLimit;
int nSize;
if (pLPD->fn[FUNC_ENUMDFONTS] == NULL)
{
dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts: Not supported by driver\n"); dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts: Not supported by driver\n");
return 0; return 0;
} }
lP1 = (SEGPTR)lpDestDev; lP1 = (SEGPTR)lpDestDev;
lP2 = SEGPTR_STRDUP(lpFaceName);
if (lpFaceName == NULL)
{
lP2 = 0;
}
else
{
lP2 = SegPtr;
nSize = strlen(lpFaceName) + 1;
AddData(&SegPtr, lpFaceName, nSize, Limit);
}
lP3 = (LONG)lpCallbackFunc; lP3 = (LONG)lpCallbackFunc;
lP4 = (LONG)lpClientData; lP4 = (LONG)lpClientData;
wRet = CallTo16_word_llll(pLPD->fn[FUNC_ENUMDFONTS], wRet = CallTo16_word_llll(pLPD->fn[FUNC_ENUMDFONTS],
lP1, lP2, lP3, lP4); lP1, SEGPTR_GET(lP2), lP3, lP4);
} SEGPTR_FREE(lP2);
else } else
fprintf(stderr,"Failed to find device\n"); fprintf(stderr,"Failed to find device\n");
dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts: return %x\n", wRet); dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts: return %x\n", wRet);
@ -429,6 +351,63 @@ BOOL16 PRTDRV_EnumObj(LPPDEVICE lpDestDev, WORD iStyle,
return wRet; return wRet;
} }
/*
* Output (ordinal 8)
*/
WORD PRTDRV_Output(LPPDEVICE lpDestDev,
WORD wStyle,
WORD wCount,
POINT16 **points,
SEGPTR lpPPen,
SEGPTR lpPBrush,
SEGPTR lpDrawMode,
RECT16 *lpClipRect)
{
WORD wRet = 0;
LOADED_PRINTER_DRIVER *pLPD = NULL;
dprintf_win16drv(stddeb, "PRTDRV_OUTPUT\n");
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
{
LONG lP1, lP5, lP6, lP7;
LPPOINT16 lP4;
LPRECT16 lP8;
WORD wP2, wP3;
int nSize;
if (pLPD->fn[FUNC_OUTPUT] == NULL)
{
dprintf_win16drv(stddeb, "PRTDRV_Output: Not supported by driver\n");
return 0;
}
lP1 = lpDestDev;
wP2 = wStyle;
wP3 = wCount;
nSize = sizeof(POINT16) * wCount;
lP4 = (LPPOINT16 )SEGPTR_ALLOC(nSize);
memcpy(lP4,points,nSize);
lP5 = lpPPen;
lP6 = lpPBrush;
lP7 = lpDrawMode;
if (lpClipRect != NULL)
{
lP8 = SEGPTR_NEW(RECT16);
memcpy(lP8,lpClipRect,sizeof(RECT16));
}
else
lP8 = 0L;
wRet = CallTo16_word_lwwlllll(pLPD->fn[FUNC_OUTPUT],
lP1, wP2, wP3, SEGPTR_GET(lP4), lP5,
lP6, lP7, SEGPTR_GET(lP8));
SEGPTR_FREE(lP4);
SEGPTR_FREE(lP8);
}
return wRet;
}
/* /*
* RealizeObject (ordinal 10) * RealizeObject (ordinal 10)
*/ */
@ -443,11 +422,10 @@ DWORD PRTDRV_RealizeObject(LPPDEVICE lpDestDev, WORD wStyle,
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL) if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
{ {
LONG lP1, lP3, lP4, lP5; LONG lP1, lP4, lP5;
LPBYTE lP3;
WORD wP2; WORD wP2;
SEGPTR SegPtr = pLPD->ThunkBufSegPtr; unsigned int nSize;
SEGPTR Limit = pLPD->ThunkBufLimit;
int nSize;
if (pLPD->fn[FUNC_REALIZEOBJECT] == NULL) if (pLPD->fn[FUNC_REALIZEOBJECT] == NULL)
{ {
@ -458,31 +436,99 @@ DWORD PRTDRV_RealizeObject(LPPDEVICE lpDestDev, WORD wStyle,
lP1 = lpDestDev; lP1 = lpDestDev;
wP2 = wStyle; wP2 = wStyle;
lP3 = SegPtr;
switch (wStyle) switch (wStyle)
{ {
case 3: case OBJ_BRUSH:
nSize = sizeof (LOGBRUSH16);
break;
case OBJ_FONT:
nSize = sizeof(LOGFONT16); nSize = sizeof(LOGFONT16);
break; break;
case OBJ_PEN:
nSize = sizeof(LOGPEN16);
break;
case OBJ_PBITMAP:
default: default:
fprintf(stderr, "PRTDRV_RealizeObject: Object type %d not supported\n", wStyle); fprintf(stderr, "PRTDRV_RealizeObject: Object type %d not supported\n", wStyle);
nSize = 0; nSize = 0;
} }
AddData(&SegPtr, lpInObj, nSize, Limit); lP3 = SEGPTR_ALLOC(nSize);
memcpy(lP3,lpInObj,nSize);
lP4 = (LONG)lpOutObj; lP4 = (LONG)lpOutObj;
lP5 = lpTextXForm; lP5 = lpTextXForm;
dwRet = CallTo16_long_lwlll(pLPD->fn[FUNC_REALIZEOBJECT], dwRet = CallTo16_long_lwlll(pLPD->fn[FUNC_REALIZEOBJECT],
lP1, wP2, lP3, lP4, lP5); lP1, wP2, SEGPTR_GET(lP3), lP4, lP5);
SEGPTR_FREE(lP3);
} }
dprintf_win16drv(stddeb, "PRTDRV_RealizeObject: return %x\n", dwRet); dprintf_win16drv(stddeb, "PRTDRV_RealizeObject: return %x\n", dwRet);
return dwRet; return dwRet;
} }
/*
* StretchBlt (ordinal 27)
*/
DWORD PRTDRV_StretchBlt(LPPDEVICE lpDestDev,
WORD wDestX, WORD wDestY,
WORD wDestXext, WORD wDestYext,
LPPDEVICE lpSrcDev,
WORD wSrcX, WORD wSrcY,
WORD wSrcXext, WORD wSrcYext,
DWORD Rop3,
SEGPTR lpPBrush,
SEGPTR lpDrawMode,
RECT16 *lpClipRect)
{
WORD wRet = 0;
LOADED_PRINTER_DRIVER *pLPD = NULL;
dprintf_win16drv(stddeb, "PRTDRV_StretchBlt:\n");
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
{
LONG lP1,lP6, lP11, lP12, lP13;
LPRECT16 lP14;
WORD wP2, wP3, wP4, wP5, wP7, wP8, wP9, wP10;
if (pLPD->fn[FUNC_STRETCHBLT] == NULL)
{
dprintf_win16drv(stddeb, "PRTDRV_StretchBlt: Not supported by driver\n");
return 0;
}
lP1 = lpDestDev;
wP2 = wDestX;
wP3 = wDestY;
wP4 = wDestXext;
wP5 = wDestYext;
lP6 = lpSrcDev;
wP7 = wSrcX;
wP8 = wSrcY;
wP9 = wSrcXext;
wP10 = wSrcYext;
lP11 = Rop3;
lP12 = lpPBrush;
lP13 = lpDrawMode;
if (lpClipRect != NULL)
{
lP14 = SEGPTR_NEW(RECT16);
memcpy(lP14,lpClipRect,sizeof(RECT16));
}
else
lP14 = 0L;
wRet = CallTo16_word_lwwwwlwwwwllll(pLPD->fn[FUNC_STRETCHBLT],
lP1, wP2, wP3, wP4, wP5,
lP6, wP7, wP8, wP9, wP10,
lP11, lP12, lP13, SEGPTR_GET(lP14));
SEGPTR_FREE(lP14);
printf("Called StretchBlt ret %d\n",wRet);
}
return wRet;
}
DWORD PRTDRV_ExtTextOut(LPPDEVICE lpDestDev, WORD wDestXOrg, WORD wDestYOrg, DWORD PRTDRV_ExtTextOut(LPPDEVICE lpDestDev, WORD wDestXOrg, WORD wDestYOrg,
RECT16 *lpClipRect, LPCSTR lpString, WORD wCount, RECT16 *lpClipRect, LPCSTR lpString, WORD wCount,
@ -497,13 +543,12 @@ DWORD PRTDRV_ExtTextOut(LPPDEVICE lpDestDev, WORD wDestXOrg, WORD wDestYOrg,
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL) if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
{ {
LONG lP1, lP4, lP5, lP7, lP8, lP9, lP10, lP11; LONG lP1, lP7, lP8, lP9, lP10;
LPSTR lP5;
LPRECT16 lP4,lP11;
WORD wP2, wP3, wP12; WORD wP2, wP3, wP12;
INT16 iP6; INT16 iP6;
unsigned int nSize = -1;
SEGPTR SegPtr = pLPD->ThunkBufSegPtr;
SEGPTR Limit = pLPD->ThunkBufLimit;
int nSize;
if (pLPD->fn[FUNC_EXTTEXTOUT] == NULL) if (pLPD->fn[FUNC_EXTTEXTOUT] == NULL)
{ {
@ -515,28 +560,22 @@ DWORD PRTDRV_ExtTextOut(LPPDEVICE lpDestDev, WORD wDestXOrg, WORD wDestYOrg,
wP2 = wDestXOrg; wP2 = wDestXOrg;
wP3 = wDestYOrg; wP3 = wDestYOrg;
if (lpClipRect != NULL) if (lpClipRect != NULL) {
{ lP4 = SEGPTR_NEW(RECT16);
lP4 = SegPtr;
nSize = sizeof(RECT16);
dprintf_win16drv(stddeb, "Adding lpClipRect\n"); dprintf_win16drv(stddeb, "Adding lpClipRect\n");
memcpy(lP4,lpClipRect,sizeof(RECT16));
AddData(&SegPtr, lpClipRect, nSize, Limit); } else
}
else
lP4 = 0L; lP4 = 0L;
if (lpString != NULL) if (lpString != NULL) {
{
/* TTD WARNING THIS STRING ISNT NULL TERMINATED */ /* TTD WARNING THIS STRING ISNT NULL TERMINATED */
lP5 = SegPtr;
nSize = strlen(lpString); nSize = strlen(lpString);
if (nSize>abs(wCount))
nSize = abs(wCount); nSize = abs(wCount);
dprintf_win16drv(stddeb, "Adding string size %d\n",nSize); lP5 = SEGPTR_ALLOC(nSize);
dprintf_win16drv(stddeb, "Adding lpString (nSize is %d)\n",nSize);
AddData(&SegPtr, lpString, nSize, Limit); memcpy(lP5,lpString,nSize);
} } else
else
lP5 = 0L; lP5 = 0L;
iP6 = wCount; iP6 = wCount;
@ -550,28 +589,23 @@ DWORD PRTDRV_ExtTextOut(LPPDEVICE lpDestDev, WORD wDestXOrg, WORD wDestYOrg,
dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut: Char widths not supported\n"); dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut: Char widths not supported\n");
lP10 = 0; lP10 = 0;
if (lpOpaqueRect != NULL) if (lpOpaqueRect != NULL) {
{ lP11 = SEGPTR_NEW(RECT16);
lP11 = SegPtr; dprintf_win16drv(stddeb, "Adding lpOpaqueRect\n");
nSize = sizeof(RECT16); memcpy(lP11,lpOpaqueRect,sizeof(RECT16));
dprintf_win16drv(stddeb, "Adding opaqueRect\n"); } else
AddData(&SegPtr, lpOpaqueRect, nSize, Limit);
}
else
lP11 = 0L; lP11 = 0L;
wP12 = wOptions; wP12 = wOptions;
dprintf_win16drv(stddeb, "Calling exttextout 0x%lx 0x%x 0x%x 0x%lx\n0x%lx 0x%x 0x%lx 0x%lx\n" dprintf_win16drv(stddeb, "Calling ExtTextOut 0x%lx 0x%x 0x%x %p\n%*s 0x%x 0x%lx 0x%lx\n"
"0x%lx 0x%lx 0x%lx 0x%x\n",lP1, wP2, wP3, lP4, "0x%lx 0x%lx %p 0x%x\n",lP1, wP2, wP3, lP4,
lP5, iP6, lP7, lP8, lP9, lP10, nSize,lP5, iP6, lP7, lP8, lP9, lP10,
lP11, wP12); lP11, wP12);
dwRet = CallTo16_long_lwwllwlllllw(pLPD->fn[FUNC_EXTTEXTOUT], dwRet = CallTo16_long_lwwllwlllllw(pLPD->fn[FUNC_EXTTEXTOUT],
lP1, wP2, wP3, lP4, lP1, wP2, wP3, SEGPTR_GET(lP4),
lP5, iP6, lP7, lP8, lP9, lP10, SEGPTR_GET(lP5), iP6, lP7, lP8, lP9, lP10,
lP11, wP12); SEGPTR_GET(lP11), wP12);
} }
dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut: return %lx\n", dwRet); dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut: return %lx\n", dwRet);
return dwRet; return dwRet;
} }

View File

@ -97,7 +97,7 @@ BOOL32 WIN16DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
} }
#endif #endif
dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE, x, y, dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE, XLPTODP(dc,x), XLPTODP(dc,y),
&clipRect, str, &clipRect, str,
wCount, physDev->segptrFontInfo, win16drv_SegPtr_DrawMode, wCount, physDev->segptrFontInfo, win16drv_SegPtr_DrawMode,
win16drv_SegPtr_TextXForm, NULL, lpOpaqueRect, wOptions); win16drv_SegPtr_TextXForm, NULL, lpOpaqueRect, wOptions);

View File

@ -63,8 +63,8 @@ C_SRCS = \
GEN_ASM_SRCS = \ GEN_ASM_SRCS = \
$(SPEC_FILES) \ $(SPEC_FILES) \
call32.s \
callfrom16.s \ callfrom16.s \
callfrom32.s \
callto16.s callto16.s
.SUFFIXES: .spec .SUFFIXES: .spec
@ -81,8 +81,8 @@ $(SPEC_FILES): $(BUILD)
callfrom16.s: $(SPEC_FILES) callfrom16.s: $(SPEC_FILES)
$(BUILD) -o $@ -callfrom16 `cat $(SPEC_FILES) | grep CallFrom16_ | sed 's/.*CallFrom16_\(.*\)/\1/' | sort | uniq` $(BUILD) -o $@ -callfrom16 `cat $(SPEC_FILES) | grep CallFrom16_ | sed 's/.*CallFrom16_\(.*\)/\1/' | sort | uniq`
callfrom32.s: $(SPEC_FILES) call32.s: $(BUILD)
$(BUILD) -o $@ -callfrom32 `cat $(SPEC_FILES) | grep CallFrom32_ | sed 's/.*CallFrom32_\(.*\)/\1/' | sort | uniq` $(BUILD) -o $@ -call32
callto16.s: $(TOPSRCDIR)/include/callback.h $(BUILD) callto16.s: $(TOPSRCDIR)/include/callback.h $(BUILD)
$(BUILD) -o $@ -callto16 `cat $(TOPSRCDIR)/include/callback.h | grep "extern.*CallTo16_" | sed 's/.*CallTo16_\(.*\)(.*/\1/' | sort | uniq` $(BUILD) -o $@ -callto16 `cat $(TOPSRCDIR)/include/callback.h | grep "extern.*CallTo16_" | sed 's/.*CallTo16_\(.*\)(.*/\1/' | sort | uniq`

View File

@ -74,7 +74,7 @@ type win32
0070 stub ImpersonateNamedPipeClient 0070 stub ImpersonateNamedPipeClient
0071 stub ImpersonateSelf 0071 stub ImpersonateSelf
0072 stub InitializeAcl 0072 stub InitializeAcl
0073 return InitializeSecurityDescriptor 8 1 0073 stdcall InitializeSecurityDescriptor(ptr long) InitializeSecurityDescriptor
0074 stdcall InitializeSid(ptr ptr long) InitializeSid 0074 stdcall InitializeSid(ptr ptr long) InitializeSid
0075 stub InitiateSystemShutdownA 0075 stub InitiateSystemShutdownA
0076 stub InitiateSystemShutdownW 0076 stub InitiateSystemShutdownW

View File

@ -10,6 +10,7 @@
#include "windows.h" #include "windows.h"
#include "gdi.h" #include "gdi.h"
#include "global.h" #include "global.h"
#include "heap.h"
#include "module.h" #include "module.h"
#include "miscemu.h" #include "miscemu.h"
#include "neexe.h" #include "neexe.h"
@ -23,39 +24,47 @@
typedef struct typedef struct
{ {
const char *name; /* DLL name */
void *module_start; /* 32-bit address of the module data */
int module_size; /* Size of the module data */
const BYTE *code_start; /* 32-bit address of DLL code */ const BYTE *code_start; /* 32-bit address of DLL code */
const BYTE *data_start; /* 32-bit address of DLL data */ const BYTE *data_start; /* 32-bit address of DLL data */
} WIN16_DESCRIPTOR; } WIN16_DESCRIPTOR;
typedef struct typedef struct
{ {
const char *name; /* DLL name */
int base; /* Ordinal base */ int base; /* Ordinal base */
int size; /* Number of functions */ int nb_funcs; /* Number of functions */
const void *code_start; /* Start of DLL code */ int nb_names; /* Number of function names */
const void **functions; /* Pointer to functions table */ const void **functions; /* Pointer to function table */
const void **nodbg_functions; /* Pointer to funcs without debug */
const char * const *names; /* Pointer to names table */ const char * const *names; /* Pointer to names table */
const WORD *ordinals; /* Pointer to ordinals table */
const BYTE *args; /* Pointer to argument lengths */
} WIN32_DESCRIPTOR; } WIN32_DESCRIPTOR;
typedef struct typedef union
{ {
const char *name; /* DLL name */ const char *name; /* DLL name */
void *module_start; /* 32-bit address of the module data */
int module_size; /* Size of the module data */
union
{
WIN16_DESCRIPTOR win16; /* Descriptor for Win16 DLL */ WIN16_DESCRIPTOR win16; /* Descriptor for Win16 DLL */
WIN32_DESCRIPTOR win32; /* Descriptor for Win32 DLL */ WIN32_DESCRIPTOR win32; /* Descriptor for Win32 DLL */
} u;
} DLL_DESCRIPTOR; } DLL_DESCRIPTOR;
typedef struct
{
BYTE call; /* 0xe8 call callfrom32 (relative) */
DWORD callfrom32 WINE_PACKED; /* RELAY_CallFrom32 relative addr */
BYTE ret; /* 0xc2 ret $n or 0xc3 ret */
WORD args; /* nb of args to remove from the stack */
} DEBUG_ENTRY_POINT;
typedef struct typedef struct
{ {
const DLL_DESCRIPTOR *descr; /* DLL descriptor */ const DLL_DESCRIPTOR *descr; /* DLL descriptor */
DEBUG_ENTRY_POINT *dbg_funcs; /* Relay debugging functions table */
int flags; /* flags (see below) */ int flags; /* flags (see below) */
} BUILTIN_DLL; } BUILTIN_DLL;
/* DLL flags */ /* DLL flags */
#define DLL_FLAG_NOT_USED 0x01 /* Use original Windows DLL if possible */ #define DLL_FLAG_NOT_USED 0x01 /* Use original Windows DLL if possible */
#define DLL_FLAG_ALWAYS_USED 0x02 /* Always use built-in DLL */ #define DLL_FLAG_ALWAYS_USED 0x02 /* Always use built-in DLL */
@ -117,65 +126,179 @@ extern const DLL_DESCRIPTOR WSOCK32_Descriptor;
static BUILTIN_DLL BuiltinDLLs[] = static BUILTIN_DLL BuiltinDLLs[] =
{ {
/* Win16 DLLs */ /* Win16 DLLs */
{ &KERNEL_Descriptor, DLL_FLAG_ALWAYS_USED }, { &KERNEL_Descriptor, NULL, DLL_FLAG_ALWAYS_USED },
{ &USER_Descriptor, DLL_FLAG_ALWAYS_USED }, { &USER_Descriptor, NULL, DLL_FLAG_ALWAYS_USED },
{ &GDI_Descriptor, DLL_FLAG_ALWAYS_USED }, { &GDI_Descriptor, NULL, DLL_FLAG_ALWAYS_USED },
{ &SYSTEM_Descriptor, DLL_FLAG_ALWAYS_USED }, { &SYSTEM_Descriptor, NULL, DLL_FLAG_ALWAYS_USED },
{ &WIN87EM_Descriptor, DLL_FLAG_NOT_USED }, { &WIN87EM_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &SHELL_Descriptor, 0 }, { &SHELL_Descriptor, NULL, 0 },
{ &SOUND_Descriptor, 0 }, { &SOUND_Descriptor, NULL, 0 },
{ &KEYBOARD_Descriptor, 0 }, { &KEYBOARD_Descriptor, NULL, 0 },
{ &WINSOCK_Descriptor, 0 }, { &WINSOCK_Descriptor, NULL, 0 },
{ &STRESS_Descriptor, 0 }, { &STRESS_Descriptor, NULL, 0 },
{ &MMSYSTEM_Descriptor, 0 }, { &MMSYSTEM_Descriptor, NULL, 0 },
{ &TOOLHELP_Descriptor, 0 }, { &TOOLHELP_Descriptor, NULL, 0 },
{ &MOUSE_Descriptor, 0 }, { &MOUSE_Descriptor, NULL, 0 },
{ &COMMDLG_Descriptor, DLL_FLAG_NOT_USED }, { &COMMDLG_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &OLE2_Descriptor, DLL_FLAG_NOT_USED }, { &OLE2_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &OLE2CONV_Descriptor, DLL_FLAG_NOT_USED }, { &OLE2CONV_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &OLE2DISP_Descriptor, DLL_FLAG_NOT_USED }, { &OLE2DISP_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &OLE2NLS_Descriptor, DLL_FLAG_NOT_USED }, { &OLE2NLS_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &OLE2PROX_Descriptor, DLL_FLAG_NOT_USED }, { &OLE2PROX_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &OLECLI_Descriptor, DLL_FLAG_NOT_USED }, { &OLECLI_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &OLESVR_Descriptor, DLL_FLAG_NOT_USED }, { &OLESVR_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &COMPOBJ_Descriptor, DLL_FLAG_NOT_USED }, { &COMPOBJ_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &STORAGE_Descriptor, DLL_FLAG_NOT_USED }, { &STORAGE_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &WPROCS_Descriptor, DLL_FLAG_ALWAYS_USED }, { &WPROCS_Descriptor, NULL, DLL_FLAG_ALWAYS_USED },
{ &DDEML_Descriptor, DLL_FLAG_NOT_USED }, { &DDEML_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &LZEXPAND_Descriptor, 0 }, { &LZEXPAND_Descriptor, NULL, 0 },
{ &VER_Descriptor, 0 }, { &VER_Descriptor, NULL, 0 },
{ &W32SYS_Descriptor, 0 }, { &W32SYS_Descriptor, NULL, 0 },
{ &WING_Descriptor, 0 }, { &WING_Descriptor, NULL, 0 },
/* Win32 DLLs */ /* Win32 DLLs */
{ &ADVAPI32_Descriptor, 0 }, { &ADVAPI32_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &COMCTL32_Descriptor, DLL_FLAG_NOT_USED }, { &COMCTL32_Descriptor, NULL, DLL_FLAG_WIN32 | DLL_FLAG_NOT_USED },
{ &COMDLG32_Descriptor, 0 }, { &COMDLG32_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &CRTDLL_Descriptor, 0 }, { &CRTDLL_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &OLE32_Descriptor, DLL_FLAG_NOT_USED }, { &OLE32_Descriptor, NULL, DLL_FLAG_WIN32 | DLL_FLAG_NOT_USED },
{ &GDI32_Descriptor, 0 }, { &GDI32_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &KERNEL32_Descriptor, DLL_FLAG_ALWAYS_USED }, { &KERNEL32_Descriptor, NULL, DLL_FLAG_WIN32 | DLL_FLAG_ALWAYS_USED },
{ &LZ32_Descriptor, 0 }, { &LZ32_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &MPR_Descriptor, DLL_FLAG_NOT_USED }, { &MPR_Descriptor, NULL, DLL_FLAG_WIN32 | DLL_FLAG_NOT_USED },
{ &NTDLL_Descriptor, 0 }, { &NTDLL_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &SHELL32_Descriptor, 0 }, { &SHELL32_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &USER32_Descriptor, 0 }, { &USER32_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &VERSION_Descriptor, 0 }, { &VERSION_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &WINMM_Descriptor, 0 }, { &WINMM_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &WINSPOOL_Descriptor, 0 }, { &WINSPOOL_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &WSOCK32_Descriptor, 0 }, { &WSOCK32_Descriptor, NULL, DLL_FLAG_WIN32 },
/* Last entry */ /* Last entry */
{ NULL, 0 } { NULL, NULL, 0 }
}; };
/* Ordinal number for interrupt 0 handler in WPROCS.DLL */ /* Ordinal number for interrupt 0 handler in WPROCS.DLL */
#define FIRST_INTERRUPT_ORDINAL 100 #define FIRST_INTERRUPT_ORDINAL 100
/***********************************************************************
* BUILTIN_BuildDebugEntryPoints
*
* Build the table of relay-debugging entry points for a Win32 DLL.
*/
static void BUILTIN_BuildDebugEntryPoints( BUILTIN_DLL *dll )
{
int i;
DEBUG_ENTRY_POINT *entry;
extern void RELAY_CallFrom32();
assert( !dll->dbg_funcs );
assert( dll->flags & DLL_FLAG_WIN32 );
dll->dbg_funcs = HeapAlloc( SystemHeap, 0,
dll->descr->win32.nb_funcs * sizeof(DEBUG_ENTRY_POINT) );
entry = dll->dbg_funcs;
for (i = 0; i < dll->descr->win32.nb_funcs; i++, entry++)
{
BYTE args = dll->descr->win32.args[i];
entry->call = 0xe8; /* call */
switch(args)
{
case 0xfe: /* register func */
entry->callfrom32 = (DWORD)dll->descr->win32.functions[i] -
(DWORD)&entry->ret;
entry->ret = 0x90; /* nop */
entry->args = 0;
break;
case 0xff: /* stub */
entry->args = 0xffff;
break;
default: /* normal function (stdcall or cdecl) */
entry->callfrom32 = (DWORD)RELAY_CallFrom32 - (DWORD)&entry->ret;
entry->ret = (args & 0x80) ? 0xc3 : 0xc2; /* ret / ret $n */
entry->args = (args & 0x7f) * sizeof(int);
break;
}
}
}
/***********************************************************************
* BUILTIN_DoLoadModule16
*
* Load a built-in Win16 module. Helper function for BUILTIN_LoadModule
* and BUILTIN_Init.
*/
static HMODULE16 BUILTIN_DoLoadModule16( const WIN16_DESCRIPTOR *descr )
{
NE_MODULE *pModule;
int minsize;
SEGTABLEENTRY *pSegTable;
HMODULE16 hModule = GLOBAL_CreateBlock( GMEM_MOVEABLE, descr->module_start,
descr->module_size, 0,
FALSE, FALSE, FALSE, NULL );
if (!hModule) return 0;
FarSetOwner( hModule, hModule );
dprintf_module( stddeb, "Built-in %s: hmodule=%04x\n",
descr->name, hModule );
pModule = (NE_MODULE *)GlobalLock16( hModule );
pModule->self = hModule;
/* Allocate the code segment */
pSegTable = NE_SEG_TABLE( pModule );
pSegTable->selector = GLOBAL_CreateBlock( GMEM_FIXED, descr->code_start,
pSegTable->minsize, hModule,
TRUE, TRUE, FALSE, NULL );
if (!pSegTable->selector) return 0;
pSegTable++;
/* Allocate the data segment */
minsize = pSegTable->minsize ? pSegTable->minsize : 0x10000;
minsize += pModule->heap_size;
if (minsize > 0x10000) minsize = 0x10000;
pSegTable->selector = GLOBAL_Alloc( GMEM_FIXED, minsize,
hModule, FALSE, FALSE, FALSE );
if (!pSegTable->selector) return 0;
if (pSegTable->minsize) memcpy( GlobalLock16( pSegTable->selector ),
descr->data_start, pSegTable->minsize);
if (pModule->heap_size)
LocalInit( pSegTable->selector, pSegTable->minsize, minsize );
MODULE_RegisterModule( pModule );
return hModule;
}
/***********************************************************************
* BUILTIN_DoLoadModule32
*
* Load a built-in Win32 module. Helper function for BUILTIN_LoadModule
* and BUILTIN_Init.
*/
static HMODULE16 BUILTIN_DoLoadModule32( BUILTIN_DLL *table )
{
HMODULE16 hModule;
NE_MODULE *pModule;
OFSTRUCT ofs;
sprintf( ofs.szPathName, "%s.DLL", table->descr->name );
hModule = MODULE_CreateDummyModule( &ofs );
pModule = (NE_MODULE *)GlobalLock16( hModule );
pModule->pe_module = (PE_MODULE *)table;
pModule->flags = NE_FFLAGS_SINGLEDATA | NE_FFLAGS_BUILTIN |
NE_FFLAGS_LIBMODULE | NE_FFLAGS_WIN32;
if (debugging_relay) BUILTIN_BuildDebugEntryPoints( table );
return hModule;
}
/*********************************************************************** /***********************************************************************
* BUILTIN_Init * BUILTIN_Init
* *
* Load all built-in modules marked as 'always used'. * Load all built-in modules marked as 'always used'.
*/ */
BOOL16 BUILTIN_Init(void) BOOL32 BUILTIN_Init(void)
{ {
BUILTIN_DLL *dll; BUILTIN_DLL *dll;
NE_MODULE *pModule; NE_MODULE *pModule;
@ -183,8 +306,17 @@ BOOL16 BUILTIN_Init(void)
HMODULE16 hModule; HMODULE16 hModule;
for (dll = BuiltinDLLs; dll->descr; dll++) for (dll = BuiltinDLLs; dll->descr; dll++)
if (dll->flags & DLL_FLAG_ALWAYS_USED) {
if (!BUILTIN_LoadModule(dll->descr->name, TRUE)) return FALSE; if (!(dll->flags & DLL_FLAG_ALWAYS_USED)) continue;
if (dll->flags & DLL_FLAG_WIN32)
{
if (!BUILTIN_DoLoadModule32( dll )) return FALSE;
}
else
{
if (!BUILTIN_DoLoadModule16( &dll->descr->win16 )) return FALSE;
}
}
/* Set the USER and GDI heap selectors */ /* Set the USER and GDI heap selectors */
@ -223,10 +355,8 @@ BOOL16 BUILTIN_Init(void)
* Load a built-in module. If the 'force' parameter is FALSE, we only * Load a built-in module. If the 'force' parameter is FALSE, we only
* load the module if it has not been disabled via the -dll option. * load the module if it has not been disabled via the -dll option.
*/ */
HMODULE16 BUILTIN_LoadModule( LPCSTR name, BOOL16 force ) HMODULE16 BUILTIN_LoadModule( LPCSTR name, BOOL32 force )
{ {
HMODULE16 hModule;
NE_MODULE *pModule;
BUILTIN_DLL *table; BUILTIN_DLL *table;
char dllname[16], *p; char dllname[16], *p;
@ -241,52 +371,10 @@ HMODULE16 BUILTIN_LoadModule( LPCSTR name, BOOL16 force )
if (!table->descr) return 0; if (!table->descr) return 0;
if ((table->flags & DLL_FLAG_NOT_USED) && !force) return 0; if ((table->flags & DLL_FLAG_NOT_USED) && !force) return 0;
hModule = GLOBAL_CreateBlock( GMEM_MOVEABLE, table->descr->module_start, if (table->flags & DLL_FLAG_WIN32)
table->descr->module_size, 0, return BUILTIN_DoLoadModule32( table );
FALSE, FALSE, FALSE, NULL ); else
if (!hModule) return 0; return BUILTIN_DoLoadModule16( &table->descr->win16 );
FarSetOwner( hModule, hModule );
dprintf_module( stddeb, "Built-in %s: hmodule=%04x\n",
table->descr->name, hModule );
pModule = (NE_MODULE *)GlobalLock16( hModule );
pModule->self = hModule;
if (pModule->flags & NE_FFLAGS_WIN32)
{
pModule->pe_module = (PE_MODULE *)table;
table->flags |= DLL_FLAG_WIN32;
}
else /* Win16 module */
{
const WIN16_DESCRIPTOR *descr = &table->descr->u.win16;
int minsize;
/* Allocate the code segment */
SEGTABLEENTRY *pSegTable = NE_SEG_TABLE( pModule );
pSegTable->selector = GLOBAL_CreateBlock(GMEM_FIXED, descr->code_start,
pSegTable->minsize, hModule,
TRUE, TRUE, FALSE, NULL );
if (!pSegTable->selector) return 0;
pSegTable++;
/* Allocate the data segment */
minsize = pSegTable->minsize ? pSegTable->minsize : 0x10000;
minsize += pModule->heap_size;
if (minsize > 0x10000) minsize = 0x10000;
pSegTable->selector = GLOBAL_Alloc( GMEM_FIXED, minsize,
hModule, FALSE, FALSE, FALSE );
if (!pSegTable->selector) return 0;
if (pSegTable->minsize) memcpy( GlobalLock16( pSegTable->selector ),
descr->data_start, pSegTable->minsize);
if (pModule->heap_size)
LocalInit( pSegTable->selector, pSegTable->minsize, minsize );
}
MODULE_RegisterModule( pModule );
return hModule;
} }
@ -370,35 +458,36 @@ LPCSTR BUILTIN_GetEntryPoint16( WORD cs, WORD ip, WORD *pOrd )
* *
* Return the name of the DLL entry point corresponding * Return the name of the DLL entry point corresponding
* to a relay entry point address. This is used only by relay debugging. * to a relay entry point address. This is used only by relay debugging.
*
* This function _must_ return the real entry point to call
* after the debug info is printed.
*/ */
LPCSTR BUILTIN_GetEntryPoint32( void *relay ) FARPROC32 BUILTIN_GetEntryPoint32( char *buffer, void *relay )
{ {
static char buffer[80];
BUILTIN_DLL *dll; BUILTIN_DLL *dll;
const void **funcs; int ordinal, i;
int i; const WIN32_DESCRIPTOR *descr;
/* First find the module */ /* First find the module */
for (dll = BuiltinDLLs; dll->descr; dll++) for (dll = BuiltinDLLs; dll->descr; dll++)
if ((dll->flags & DLL_FLAG_WIN32) && if ((dll->flags & DLL_FLAG_WIN32) &&
(dll->descr->u.win32.code_start <= relay) && ((void *)dll->dbg_funcs <= relay) &&
((void *)dll->descr->u.win32.functions > relay)) ((void *)(dll->dbg_funcs + dll->descr->win32.nb_funcs) > relay))
break; break;
if (!dll->descr) assert(dll->descr);
{ descr = &dll->descr->win32;
sprintf( buffer, "???.???: %08x", (UINT32)relay );
return buffer;
}
/* Now find the function */ /* Now find the function */
relay = (BYTE *)relay - 11; /* The relay entry point is 11 bytes long */ ordinal = ((DWORD)relay-(DWORD)dll->dbg_funcs) / sizeof(DEBUG_ENTRY_POINT);
funcs = dll->descr->u.win32.functions; ordinal += descr->base;
for (i = 0; i < dll->descr->u.win32.size;i++) if (*funcs++ == relay) break; for (i = 0; i < descr->nb_names; i++)
sprintf( buffer, "%s.%d: %s", dll->descr->name, if (descr->ordinals[i] == ordinal) break;
dll->descr->u.win32.base + i, dll->descr->u.win32.names[i] ); assert( i < descr->nb_names );
return buffer;
sprintf( buffer, "%s.%d: %s", descr->name, ordinal, descr->names[i] );
return (FARPROC32)descr->functions[ordinal - descr->base];
} }
@ -411,7 +500,7 @@ LPCSTR BUILTIN_GetEntryPoint32( void *relay )
FARPROC32 BUILTIN_GetProcAddress32( NE_MODULE *pModule, LPCSTR function ) FARPROC32 BUILTIN_GetProcAddress32( NE_MODULE *pModule, LPCSTR function )
{ {
BUILTIN_DLL *dll = (BUILTIN_DLL *)pModule->pe_module; BUILTIN_DLL *dll = (BUILTIN_DLL *)pModule->pe_module;
const WIN32_DESCRIPTOR *info = &dll->descr->u.win32; const WIN32_DESCRIPTOR *info = &dll->descr->win32;
WORD ordinal = 0; WORD ordinal = 0;
if (!dll) return NULL; if (!dll) return NULL;
@ -422,26 +511,24 @@ FARPROC32 BUILTIN_GetProcAddress32( NE_MODULE *pModule, LPCSTR function )
dprintf_module( stddeb, "Looking for function %s in %s\n", dprintf_module( stddeb, "Looking for function %s in %s\n",
function, dll->descr->name ); function, dll->descr->name );
for (i = 0; i < info->size; i++) for (i = 0; i < info->nb_names; i++)
if (info->names[i] && !strcmp( function, info->names[i] )) if (!strcmp( function, info->names[i] ))
{ {
ordinal = info->base + i; ordinal = info->ordinals[i];
break; break;
} }
if (i >= info->size) return NULL; /* not found */ if (i >= info->nb_names) return NULL; /* not found */
} }
else /* Find function by ordinal */ else /* Find function by ordinal */
{ {
ordinal = LOWORD(function); ordinal = LOWORD(function);
dprintf_module( stddeb, "Looking for ordinal %d in %s\n", dprintf_module( stddeb, "Looking for ordinal %d in %s\n",
ordinal, dll->descr->name ); ordinal, dll->descr->name );
if ((ordinal < info->base) || (ordinal >= info->base + info->size)) if ((ordinal < info->base) || (ordinal >= info->base + info->nb_funcs))
return NULL; /* not found */ return NULL; /* not found */
} }
#if testing if (dll->dbg_funcs && (dll->dbg_funcs[ordinal-info->base].args != 0xffff))
if (!debugging_relay) return (FARPROC32)&dll->dbg_funcs[ordinal - info->base];
return (FARPROC32)info->nodbg_functions[ordinal - info->base];
#endif
return (FARPROC32)info->functions[ordinal - info->base]; return (FARPROC32)info->functions[ordinal - info->base];
} }
@ -465,7 +552,7 @@ void BUILTIN_DefaultIntHandler( CONTEXT *context )
* *
* Set runtime DLL usage flags * Set runtime DLL usage flags
*/ */
BOOL16 BUILTIN_ParseDLLOptions( const char *str ) BOOL32 BUILTIN_ParseDLLOptions( const char *str )
{ {
BUILTIN_DLL *dll; BUILTIN_DLL *dll;
const char *p; const char *p;

View File

@ -21,13 +21,15 @@ type win32
15 stub DrawInsert 15 stub DrawInsert
16 stdcall CreateUpDownControl(long long long long long long long long long long long long) CreateUpDownControl 16 stdcall CreateUpDownControl(long long long long long long long long long long long long) CreateUpDownControl
17 stdcall InitCommonControls() InitCommonControls 17 stdcall InitCommonControls() InitCommonControls
# 18 pascal16 CreateStatusWindow(word ptr word word) CreateStatusWindow16
18 stub CreateStatusWindow 18 stub CreateStatusWindow
19 stub CreateStatusWindowW 19 stdcall CreateStatusWindowW(long ptr long long) CreateStatusWindow32W
20 stub CreateToolbarEx 20 stub CreateToolbarEx
21 stub DestroyPropertySheetPage 21 stub DestroyPropertySheetPage
22 stub DllGetVersion 22 stub DllGetVersion
# 23 pascal16 DrawStatusText(word ptr ptr word) DrawStatusText16
23 stub DrawStatusText 23 stub DrawStatusText
24 stub DrawStatusTextW 24 stdcall DrawStatusTextW(long ptr ptr long) DrawStatusText32W
25 stub ImageList_Add 25 stub ImageList_Add
26 stub ImageList_AddIcon 26 stub ImageList_AddIcon
27 stub ImageList_AddMasked 27 stub ImageList_AddMasked

View File

@ -18,8 +18,8 @@ type win32
14 stub LoadAlterBitmap 14 stub LoadAlterBitmap
15 stub PageSetupDlgA 15 stub PageSetupDlgA
16 stub PageSetupDlgW 16 stub PageSetupDlgW
17 return PrintDlgA 4 0 17 stdcall PrintDlgA(ptr) PrintDlg32A
18 return PrintDlgW 4 0 18 stdcall PrintDlgW(ptr) PrintDlg32W
19 stub ReplaceTextA 19 stub ReplaceTextA
20 stub ReplaceTextW 20 stub ReplaceTextW
21 stub WantArrows 21 stub WantArrows

View File

@ -16,7 +16,7 @@ type win16
16 pascal16 FormatCharDlgProc(word word word long) FormatCharDlgProc 16 pascal16 FormatCharDlgProc(word word word long) FormatCharDlgProc
18 pascal16 FontStyleEnumProc(ptr ptr word long) FontStyleEnumProc 18 pascal16 FontStyleEnumProc(ptr ptr word long) FontStyleEnumProc
19 pascal16 FontFamilyEnumProc(ptr ptr word long) FontFamilyEnumProc 19 pascal16 FontFamilyEnumProc(ptr ptr word long) FontFamilyEnumProc
20 pascal16 PrintDlg(segptr) PrintDlg 20 pascal16 PrintDlg(segptr) PrintDlg16
21 pascal PrintDlgProc(word word word long) PrintDlgProc 21 pascal PrintDlgProc(word word word long) PrintDlgProc
22 pascal PrintSetupDlgProc(word word word long) PrintSetupDlgProc 22 pascal PrintSetupDlgProc(word word word long) PrintSetupDlgProc
#23 pascal EDITINTEGERONLY exported, shared data #23 pascal EDITINTEGERONLY exported, shared data

View File

@ -60,7 +60,7 @@ type win32
56 stub _clearfp 56 stub _clearfp
57 cdecl _close(long) CRTDLL__close 57 cdecl _close(long) CRTDLL__close
58 stub _commit 58 stub _commit
59 long _commode_dll(0) 59 extern _commode_dll CRTDLL_commode_dll
60 stub _control87 60 stub _control87
61 stub _controlfp 61 stub _controlfp
62 stub _copysign 62 stub _copysign
@ -105,7 +105,7 @@ type win32
101 stub _finite 101 stub _finite
102 stub _flsbuf 102 stub _flsbuf
103 stub _flushall 103 stub _flushall
104 long _fmode_dll(0) 104 extern _fmode_dll CRTDLL_fmode_dll
105 stub _fpclass 105 stub _fpclass
106 stub _fpieee_flt 106 stub _fpieee_flt
107 stub _fpreset 107 stub _fpreset
@ -130,7 +130,7 @@ type win32
126 stub _getpid 126 stub _getpid
127 stub _getsystime 127 stub _getsystime
128 stub _getw 128 stub _getw
129 register _global_unwind2(ptr) CRTDLL__global_unwind2 129 register _global_unwind2() CRTDLL__global_unwind2
130 stub _heapchk 130 stub _heapchk
131 stub _heapmin 131 stub _heapmin
132 stub _heapset 132 stub _heapset
@ -174,7 +174,7 @@ type win32
170 stub _kbhit 170 stub _kbhit
171 stub _lfind 171 stub _lfind
172 stub _loaddll 172 stub _loaddll
173 register _local_unwind2(ptr long) CRTDLL__local_unwind2 173 register _local_unwind2() CRTDLL__local_unwind2
174 stub _locking 174 stub _locking
175 stub _logb 175 stub _logb
176 cdecl _lrotl (long long) CRTDLL__lrotl 176 cdecl _lrotl (long long) CRTDLL__lrotl
@ -244,7 +244,7 @@ type win32
240 cdecl _open_osfhandle(long long) CRTDLL__open_osfhandle 240 cdecl _open_osfhandle(long long) CRTDLL__open_osfhandle
241 extern _osmajor_dll CRTDLL_osmajor_dll 241 extern _osmajor_dll CRTDLL_osmajor_dll
242 extern _osminor_dll CRTDLL_osminor_dll 242 extern _osminor_dll CRTDLL_osminor_dll
243 long _osmode_dll(0) 243 extern _osmode_dll CRTDLL_osmode_dll
244 extern _osver_dll CRTDLL_osver_dll 244 extern _osver_dll CRTDLL_osver_dll
245 extern _osversion_dll CRTDLL_osversion_dll 245 extern _osversion_dll CRTDLL_osversion_dll
246 stub _pclose 246 stub _pclose
@ -459,7 +459,7 @@ type win32
455 cdecl signal(long ptr) CRTDLL_signal 455 cdecl signal(long ptr) CRTDLL_signal
456 cdecl sin(double) sin 456 cdecl sin(double) sin
457 cdecl sinh(double) sinh 457 cdecl sinh(double) sinh
458 varargs sprintf() wsprintf32A 458 varargs sprintf() sprintf
459 cdecl sqrt(double) sqrt 459 cdecl sqrt(double) sqrt
460 cdecl srand(long) CRTDLL_srand 460 cdecl srand(long) CRTDLL_srand
461 varargs sscanf() sscanf 461 varargs sscanf() sscanf

View File

@ -1,16 +1,17 @@
name ddeml name ddeml
type win16 type win16
2 stub DdeInitialize #(ptr segptr long long) DdeInitialize 2 pascal16 DdeInitialize(ptr segptr long long) DdeInitialize16
3 stub DdeUnInitialize #(long) DdeUnInitialize 3 pascal16 DdeUninitialize(long) DdeUninitialize16
4 stub DdeConnectList #(long word word word ptr) DdeConnectList 4 stub DdeConnectList #(long word word word ptr) DdeConnectList
5 stub DdeQueryNextServer #(word word) DdeQueryNextServer 5 stub DdeQueryNextServer #(word word) DdeQueryNextServer
6 stub DdeDisconnectList #(word) DdeDisconnectList 6 stub DdeDisconnectList #(word) DdeDisconnectList
7 stub DdeConnect #(long word word ptr) DdeConnect 7 pascal DdeConnect(long long long ptr) DdeConnect16
8 stub DdeDisconnect #(word) DdeDisconnect 8 pascal16 DdeDisconnect(long) DdeDisconnect16
9 stub DdeQueryConvInfo #(word long ptr) DdeQueryConvInfo 9 stub DdeQueryConvInfo #(word long ptr) DdeQueryConvInfo
10 stub DdeSetUserHandle #(word long long) DdeSetUserHandle 10 stub DdeSetUserHandle #(word long long) DdeSetUserHandle
11 stub DdeClientTransaction #(ptr long word word word word long ptr) DdeClientTransaction 11 pascal DdeClientTransaction(ptr long long long s_word s_word long ptr)
DdeClientTransaction16
12 stub DdeAbandonTransaction #(long word long) DdeAbandonTransaction 12 stub DdeAbandonTransaction #(long word long) DdeAbandonTransaction
13 stub DdePostAdvise #(long word word) DdePostAdvise 13 stub DdePostAdvise #(long word word) DdePostAdvise
14 stub DdeCreateDataHandle #(long ptr long long word word word) DdeCreateDataHandle 14 stub DdeCreateDataHandle #(long ptr long long word word word) DdeCreateDataHandle
@ -18,15 +19,15 @@ type win16
16 stub DdeGetData #(word ptr long long) DdeGetData 16 stub DdeGetData #(word ptr long long) DdeGetData
17 stub DdeAccessData #(word ptr) DdeAccessData 17 stub DdeAccessData #(word ptr) DdeAccessData
18 stub DdeUnaccessData #(word) DdeUnaccessData 18 stub DdeUnaccessData #(word) DdeUnaccessData
19 stub DdeFreeDataHandle #(word) DdeFreeDataHandle 19 pascal16 DdeFreeDataHandle(long) DdeFreeDataHandle16
20 stub DdeGetLastError #(long) DdeGetLastError 20 pascal16 DdeGetLastError(long) DdeGetLastError16
21 stub DdeCreateStringHandle #(long str word) DdeCreateStringHandle 21 pascal DdeCreateStringHandle(long str s_word) DdeCreateStringHandle16
22 stub DdeFreeStringHandle #(long word) DdeFreeStringHandle 22 pascal16 DdeFreeStringHandle(long long) DdeFreeStringHandle16
23 stub DdeQueryString #(long word ptr long word) DdeQueryString 23 stub DdeQueryString #(long word ptr long word) DdeQueryString
24 stub DdeKeepStringHandle #(long word) DdeKeepStringHandle 24 pascal16 DdeKeepStringHandle(long long) DdeKeepStringHandle16
26 stub DdeEnableCallback #(long word word) DdeEnableCallback 26 stub DdeEnableCallback #(long word word) DdeEnableCallback
27 stub DdeNameService #(long word word word) 27 pascal DdeNameService(long long long s_word) DdeNameService16
36 stub DdeCmpStringHandles #(word word) DdeCmpStringHandles 36 stub DdeCmpStringHandles #(word word) DdeCmpStringHandles
37 stub DdeReconnect #(word) DdeReconnect 37 pascal DdeReconnect(long) DdeReconnect

View File

@ -287,7 +287,7 @@ file gdi.exe
451 pascal16 CreatePolyPolygonRgn(ptr ptr word word) CreatePolyPolygonRgn16 451 pascal16 CreatePolyPolygonRgn(ptr ptr word word) CreatePolyPolygonRgn16
452 stub GDISEEGDIDO 452 stub GDISEEGDIDO
460 stub GDITASKTERMINATION 460 stub GDITASKTERMINATION
461 return SetObjectOwner 4 0 461 pascal16 SetObjectOwner(word word) SetObjectOwner16
462 pascal16 IsGDIObject(word) IsGDIObject 462 pascal16 IsGDIObject(word) IsGDIObject
463 stub MAKEOBJECTPRIVATE 463 stub MAKEOBJECTPRIVATE
464 stub FIXUPBOGUSPUBLISHERMETAFILE 464 stub FIXUPBOGUSPUBLISHERMETAFILE

View File

@ -133,7 +133,7 @@ type win32
126 stub GdiDeleteLocalDC 126 stub GdiDeleteLocalDC
127 stub GdiDeleteLocalObject 127 stub GdiDeleteLocalObject
128 stub GdiFlush 128 stub GdiFlush
129 return GdiGetBatchLimit 0 1 129 stdcall GdiGetBatchLimit() GdiGetBatchLimit
130 stub GdiGetLocalBrush 130 stub GdiGetLocalBrush
131 stub GdiGetLocalDC 131 stub GdiGetLocalDC
132 stub GdiGetLocalFont 132 stub GdiGetLocalFont
@ -143,7 +143,7 @@ type win32
136 stub GdiPlayScript 136 stub GdiPlayScript
137 stub GdiReleaseLocalDC 137 stub GdiReleaseLocalDC
138 stub GdiSetAttrs 138 stub GdiSetAttrs
139 return GdiSetBatchLimit 4 1 139 stdcall GdiSetBatchLimit(long) GdiSetBatchLimit
140 stub GdiSetServerAttr 140 stub GdiSetServerAttr
141 stub GetArcDirection 141 stub GetArcDirection
142 stub GetAspectRatioFilterEx 142 stub GetAspectRatioFilterEx
@ -192,7 +192,7 @@ type win32
185 stub GetGlyphOutline 185 stub GetGlyphOutline
186 stdcall GetGlyphOutlineA(long long long ptr long ptr ptr) GetGlyphOutline32A 186 stdcall GetGlyphOutlineA(long long long ptr long ptr ptr) GetGlyphOutline32A
187 stdcall GetGlyphOutlineW(long long long ptr long ptr ptr) GetGlyphOutline32W 187 stdcall GetGlyphOutlineW(long long long ptr long ptr ptr) GetGlyphOutline32W
188 return GetGraphicsMode 4 1 # just return 1 188 stdcall GetGraphicsMode(long) GetGraphicsMode
189 stub GetICMProfileA 189 stub GetICMProfileA
190 stub GetICMProfileW 190 stub GetICMProfileW
191 stub GetKerningPairs 191 stub GetKerningPairs
@ -248,7 +248,7 @@ type win32
241 stub GetWinMetaFileBits 241 stub GetWinMetaFileBits
242 stdcall GetWindowExtEx(long ptr) GetWindowExtEx32 242 stdcall GetWindowExtEx(long ptr) GetWindowExtEx32
243 stdcall GetWindowOrgEx(long ptr) GetWindowOrgEx32 243 stdcall GetWindowOrgEx(long ptr) GetWindowOrgEx32
244 return GetWorldTransform 8 0 244 stdcall GetWorldTransform(long ptr) GetWorldTransform
245 stdcall IntersectClipRect(long long long long long) IntersectClipRect32 245 stdcall IntersectClipRect(long long long long long) IntersectClipRect32
246 stdcall InvertRgn(long long) InvertRgn32 246 stdcall InvertRgn(long long) InvertRgn32
247 stdcall LPtoDP(long ptr long) LPtoDP32 247 stdcall LPtoDP(long ptr long) LPtoDP32
@ -322,7 +322,7 @@ type win32
314 stub SetDeviceGammaRamp 314 stub SetDeviceGammaRamp
315 stub SetEnhMetaFileBits 315 stub SetEnhMetaFileBits
316 stub SetFontEnumeration 316 stub SetFontEnumeration
317 return SetGraphicsMode 8 1 317 stdcall SetGraphicsMode(long long) SetGraphicsMode
318 stub SetICMMode 318 stub SetICMMode
319 stub SetICMProfileA 319 stub SetICMProfileA
320 stub SetICMProfileW 320 stub SetICMProfileW
@ -394,4 +394,4 @@ type win32
383 stub UpdateICMRegKeyA 383 stub UpdateICMRegKeyA
384 stub UpdateICMRegKeyW 384 stub UpdateICMRegKeyW
385 stub gdiPlaySpoolStream 385 stub gdiPlaySpoolStream
386 return SetObjectOwner 8 0 386 stdcall SetObjectOwner(long long) SetObjectOwner32

View File

@ -555,7 +555,7 @@ type win32
564 stdcall QueryPerformanceCounter(ptr) QueryPerformanceCounter 564 stdcall QueryPerformanceCounter(ptr) QueryPerformanceCounter
565 stub QueryPerformanceFrequency 565 stub QueryPerformanceFrequency
566 stub QueueUserAPC 566 stub QueueUserAPC
567 register RaiseException(long long long ptr) RaiseException 567 register RaiseException() EXC_RaiseException
568 stdcall ReadConsoleA(long ptr long ptr ptr) ReadConsole32A 568 stdcall ReadConsoleA(long ptr long ptr ptr) ReadConsole32A
569 stub ReadConsoleInputA 569 stub ReadConsoleInputA
570 stub ReadConsoleInputW 570 stub ReadConsoleInputW
@ -578,7 +578,7 @@ type win32
587 stdcall ResumeThread(long) ResumeThread 587 stdcall ResumeThread(long) ResumeThread
588 stdcall RtlFillMemory(ptr long long) RtlFillMemory 588 stdcall RtlFillMemory(ptr long long) RtlFillMemory
589 stdcall RtlMoveMemory(ptr ptr long) RtlMoveMemory 589 stdcall RtlMoveMemory(ptr ptr long) RtlMoveMemory
590 register RtlUnwind(ptr long ptr long) RtlUnwind 590 register RtlUnwind() EXC_RtlUnwind
591 stdcall RtlZeroMemory(ptr long) RtlZeroMemory 591 stdcall RtlZeroMemory(ptr long) RtlZeroMemory
592 register SMapLS() SMapLS 592 register SMapLS() SMapLS
593 register SMapLS_IP_EBP_12() SMapLS_IP_EBP_12 593 register SMapLS_IP_EBP_12() SMapLS_IP_EBP_12

View File

@ -862,7 +862,7 @@ type win32
859 stub __eFYL2XP1 859 stub __eFYL2XP1
860 stub __eGetStatusWord 860 stub __eGetStatusWord
861 stub _alloca_probe 861 stub _alloca_probe
862 return _chkstk 0 0 862 cdecl _chkstk() NTDLL_chkstk
863 stub _fltused 863 stub _fltused
864 stub _ftol 864 stub _ftol
865 stub _itoa 865 stub _itoa

View File

@ -108,7 +108,7 @@ type win32
105 stub OleGetClipboard 105 stub OleGetClipboard
106 stub OleGetIconOfClass 106 stub OleGetIconOfClass
107 stub OleGetIconOfFile 107 stub OleGetIconOfFile
108 return OleInitialize 4 0 108 stdcall OleInitialize(ptr) OleInitialize
109 stub OleInitializeWOW 109 stub OleInitializeWOW
110 stub OleIsCurrentClipboard 110 stub OleIsCurrentClipboard
111 stub OleIsRunning 111 stub OleIsRunning
@ -131,7 +131,7 @@ type win32
128 stub OleSetContainedObject 128 stub OleSetContainedObject
129 stub OleSetMenuDescriptor 129 stub OleSetMenuDescriptor
130 stub OleTranslateAccelerator 130 stub OleTranslateAccelerator
131 return OleUninitialize 0 0 131 stdcall OleUninitialize() OleUninitialize
132 stub OpenOrCreateStream 132 stub OpenOrCreateStream
133 stub ProgIDFromCLSID 133 stub ProgIDFromCLSID
134 stub ReadClassStg 134 stub ReadClassStg

View File

@ -3,6 +3,7 @@
* Copyright 1995 Alexandre Julliard * Copyright 1995 Alexandre Julliard
*/ */
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "windows.h" #include "windows.h"
@ -33,8 +34,10 @@ BOOL32 RELAY_Init(void)
/* Allocate the code selector for CallTo16 routines */ /* Allocate the code selector for CallTo16 routines */
extern void CALLTO16_Start(), CALLTO16_End(); extern void CALLTO16_Start(), CALLTO16_End();
extern void CALLTO16_Ret_word(), CALLTO16_Ret_long(); extern void CALLTO16_Ret_word(), CALLTO16_Ret_long(), CALLTO16_Ret_regs();
extern DWORD CALLTO16_RetAddr_word, CALLTO16_RetAddr_long; extern DWORD CALLTO16_RetAddr_word;
extern DWORD CALLTO16_RetAddr_long;
extern DWORD CALLTO16_RetAddr_regs;
codesel = GLOBAL_CreateBlock( GMEM_FIXED, (void *)CALLTO16_Start, codesel = GLOBAL_CreateBlock( GMEM_FIXED, (void *)CALLTO16_Start,
(int)CALLTO16_End - (int)CALLTO16_Start, (int)CALLTO16_End - (int)CALLTO16_Start,
@ -47,6 +50,8 @@ BOOL32 RELAY_Init(void)
codesel ); codesel );
CALLTO16_RetAddr_long=MAKELONG( (int)CALLTO16_Ret_long-(int)CALLTO16_Start, CALLTO16_RetAddr_long=MAKELONG( (int)CALLTO16_Ret_long-(int)CALLTO16_Start,
codesel ); codesel );
CALLTO16_RetAddr_regs=MAKELONG( (int)CALLTO16_Ret_regs-(int)CALLTO16_Start,
codesel );
/* Initialize thunking */ /* Initialize thunking */
@ -71,7 +76,7 @@ void RELAY_DebugCallFrom16( int func_type, char *args,
printf( "Call %s(", BUILTIN_GetEntryPoint16( frame->entry_cs, printf( "Call %s(", BUILTIN_GetEntryPoint16( frame->entry_cs,
frame->entry_ip, frame->entry_ip,
&ordinal )); &ordinal ));
args16 = (char *)frame->args; VA_START16( args16 );
for (i = 0; i < strlen(args); i++) for (i = 0; i < strlen(args); i++)
{ {
switch(args[i]) switch(args[i])
@ -123,6 +128,7 @@ void RELAY_DebugCallFrom16( int func_type, char *args,
if (*args) printf( "," ); if (*args) printf( "," );
} }
printf( ") ret=%04x:%04x ds=%04x\n", frame->cs, frame->ip, frame->ds ); printf( ") ret=%04x:%04x ds=%04x\n", frame->cs, frame->ip, frame->ds );
VA_END16( args16 );
if (func_type == 2) /* register function */ if (func_type == 2) /* register function */
printf( " AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n", printf( " AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n",
@ -184,22 +190,6 @@ void RELAY_Unimplemented16(void)
} }
/***********************************************************************
* RELAY_Unimplemented32
*
* This function is called for unimplemented 32-bit entry points (declared
* as 'stub' in the spec file).
* (The args are the same than for RELAY_DebugCallFrom32).
*/
void RELAY_Unimplemented32( void *relay_addr, void *entry_point,
int ebp, int ret_addr )
{
fprintf( stderr, "No handler for Win32 routine %s (called from %08x)\n",
BUILTIN_GetEntryPoint32( relay_addr ), ret_addr );
TASK_KillCurrentTask(1);
}
/*********************************************************************** /***********************************************************************
* RELAY_DebugCallTo16 * RELAY_DebugCallTo16
* *
@ -241,73 +231,191 @@ void RELAY_DebugCallTo16( int* stack, int nb_args )
/*********************************************************************** /***********************************************************************
* RELAY_DebugCallFrom32 * RELAY_CallFrom32
* *
* 'stack' points to the saved ebp on the stack. * Stack layout on entry to this function:
* ... ...
* (esp+12) arg2
* (esp+8) arg1
* (esp+4) ret_addr
* (esp) return addr to relay code
*/
int RELAY_CallFrom32( int ret_addr, ... )
{
int i, ret;
char buffer[80];
FARPROC32 func;
int *args = &ret_addr;
/* Relay addr is the return address for this function */
BYTE *relay_addr = (BYTE *)args[-1];
WORD nb_args = *(WORD *)(relay_addr + 1) / sizeof(int);
assert(debugging_relay);
func = BUILTIN_GetEntryPoint32( buffer, relay_addr - 5 );
printf( "Call %s(", buffer );
args++;
for (i = 0; i < nb_args; i++)
{
if (i) printf( "," );
printf( "%08x", args[i] );
}
printf( ") ret=%08x\n", ret_addr );
if (*relay_addr == 0xc3) /* cdecl */
{
LRESULT (*cfunc)() = (LRESULT(*)())func;
switch(nb_args)
{
case 0: ret = cfunc(); break;
case 1: ret = cfunc(args[0]); break;
case 2: ret = cfunc(args[0],args[1]); break;
case 3: ret = cfunc(args[0],args[1],args[2]); break;
case 4: ret = cfunc(args[0],args[1],args[2],args[3]); break;
case 5: ret = cfunc(args[0],args[1],args[2],args[3],args[4]); break;
case 6: ret = cfunc(args[0],args[1],args[2],args[3],args[4],
args[5]); break;
case 7: ret = cfunc(args[0],args[1],args[2],args[3],args[4],args[5],
args[6]); break;
case 8: ret = cfunc(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7]); break;
case 9: ret = cfunc(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8]); break;
case 10: ret = cfunc(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9]); break;
case 11: ret = cfunc(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9],args[10]); break;
case 12: ret = cfunc(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9],args[10],
args[11]); break;
case 13: ret = cfunc(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9],args[10],args[11],
args[12]); break;
case 14: ret = cfunc(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9],args[10],args[11],
args[12],args[13]); break;
case 15: ret = cfunc(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9],args[10],args[11],
args[12],args[13],args[14]); break;
default:
fprintf( stderr, "RELAY_CallFrom32: Unsupported nb args %d\n",
nb_args );
assert(FALSE);
}
}
else /* stdcall */
{
switch(nb_args)
{
case 0: ret = func(); break;
case 1: ret = func(args[0]); break;
case 2: ret = func(args[0],args[1]); break;
case 3: ret = func(args[0],args[1],args[2]); break;
case 4: ret = func(args[0],args[1],args[2],args[3]); break;
case 5: ret = func(args[0],args[1],args[2],args[3],args[4]); break;
case 6: ret = func(args[0],args[1],args[2],args[3],args[4],
args[5]); break;
case 7: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
args[6]); break;
case 8: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7]); break;
case 9: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8]); break;
case 10: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9]); break;
case 11: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9],args[10]); break;
case 12: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9],args[10],
args[11]); break;
case 13: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9],args[10],args[11],
args[12]); break;
case 14: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9],args[10],args[11],
args[12],args[13]); break;
case 15: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9],args[10],args[11],
args[12],args[13],args[14]); break;
default:
fprintf( stderr, "RELAY_CallFrom32: Unsupported nb args %d\n",
nb_args );
assert(FALSE);
}
}
printf( "Ret %s() retval=%08x ret=%08x\n", buffer, ret, ret_addr );
return ret;
}
/***********************************************************************
* RELAY_CallFrom32Regs
*
* 'stack' points to the relay addr on the stack.
* Stack layout: * Stack layout:
* ... ... * ... ...
* (stack+12) arg2 * (esp+216) ret_addr
* (stack+8) arg1 * (esp+212) return to relay debugging code (only when debugging_relay)
* (stack+4) ret addr * (esp+208) entry point to call
* (stack) ebp * (esp+4) CONTEXT
* (stack-4) entry point * (esp) return addr to relay code
* (stack-8) relay addr
*/ */
void RELAY_DebugCallFrom32( int *stack, int nb_args ) void RELAY_CallFrom32Regs( CONTEXT context,
void (CALLBACK *entry_point)(CONTEXT *),
BYTE *relay_addr, int ret_addr )
{ {
int *parg, i; if (!debugging_relay)
if (!debugging_relay) return;
printf( "Call %s(", BUILTIN_GetEntryPoint32( (void *)stack[-2] ));
for (i = nb_args & 0x7fffffff, parg = &stack[2]; i; parg++, i--)
{ {
printf( "%08x", *parg ); /* Simply call the entry point */
if (i > 1) printf( "," ); entry_point( &context );
} }
printf( ") ret=%08x\n", stack[1] ); else
if (nb_args & 0x80000000) /* Register function */
{ {
CONTEXT *context = (CONTEXT *)((BYTE *)stack - sizeof(CONTEXT) - 8); char buffer[80];
/* Fixup the context structure because of the extra parameter */
/* pushed by the relay debugging code */
EIP_reg(&context) = ret_addr;
ESP_reg(&context) += sizeof(int);
BUILTIN_GetEntryPoint32( buffer, relay_addr - 5 );
printf("Call %s(regs) ret=%08x\n", buffer, ret_addr );
printf(" EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx ESI=%08lx EDI=%08lx\n", printf(" EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx ESI=%08lx EDI=%08lx\n",
context->Eax, context->Ebx, context->Ecx, context->Edx, EAX_reg(&context), EBX_reg(&context), ECX_reg(&context),
context->Esi, context->Edi ); EDX_reg(&context), ESI_reg(&context), EDI_reg(&context) );
printf(" EBP=%08lx ESP=%08lx EIP=%08lx DS=%04lx ES=%04lx FS=%04lx GS=%04lx EFL=%08lx\n", printf(" EBP=%08lx ESP=%08lx EIP=%08lx DS=%04lx ES=%04lx FS=%04lx GS=%04lx EFL=%08lx\n",
context->Ebp, context->Esp, context->Eip, context->SegDs, EBP_reg(&context), ESP_reg(&context), EIP_reg(&context),
context->SegEs, context->SegFs, context->SegGs, DS_reg(&context), ES_reg(&context), FS_reg(&context),
context->EFlags ); GS_reg(&context), EFL_reg(&context) );
/* Now call the real function */
entry_point( &context );
printf("Ret %s() retval=regs ret=%08x\n", buffer, ret_addr );
printf(" EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx ESI=%08lx EDI=%08lx\n",
EAX_reg(&context), EBX_reg(&context), ECX_reg(&context),
EDX_reg(&context), ESI_reg(&context), EDI_reg(&context) );
printf(" EBP=%08lx ESP=%08lx EIP=%08lx DS=%04lx ES=%04lx FS=%04lx GS=%04lx EFL=%08lx\n",
EBP_reg(&context), ESP_reg(&context), EIP_reg(&context),
DS_reg(&context), ES_reg(&context), FS_reg(&context),
GS_reg(&context), EFL_reg(&context) );
} }
} }
/*********************************************************************** /***********************************************************************
* RELAY_DebugCallFrom32Ret * RELAY_Unimplemented32
* *
* 'stack' points to the saved ebp on the stack. * This function is called for unimplemented 32-bit entry points (declared
* Stack layout: * as 'stub' in the spec file).
* ... ...
* (stack+12) arg2
* (stack+8) arg1
* (stack+4) ret addr
* (stack) ebp
* (stack-4) entry point
* (stack-8) relay addr
*/ */
void RELAY_DebugCallFrom32Ret( int *stack, int nb_args, int ret_val ) void RELAY_Unimplemented32( const char *dll_name, int ordinal,
const char *func_name, int ret_addr )
{ {
if (!debugging_relay) return; __RESTORE_ES; /* Just in case */
printf( "Ret %s() retval=%08x ret=%08x\n", fprintf( stderr, "No handler for Win32 routine %s.%d: %s (called from %08x)\n",
BUILTIN_GetEntryPoint32( (void *)stack[-2] ), ret_val, stack[1] ); dll_name, ordinal, func_name, ret_addr );
if (nb_args & 0x80000000) /* Register function */ TASK_KillCurrentTask(1);
{
CONTEXT *context = (CONTEXT *)((BYTE *)stack - sizeof(CONTEXT) - 8);
printf( " EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx ESI=%08lx EDI=%08lx\n",
context->Eax, context->Ebx, context->Ecx, context->Edx,
context->Esi, context->Edi );
printf( " EBP=%08lx ESP=%08lx EIP=%08lx DS=%04lx ES=%04lx FS=%04lx GS=%04lx EFL=%08lx\n",
context->Ebp, context->Esp, context->Eip, context->SegDs,
context->SegEs, context->SegFs, context->SegGs,
context->EFlags );
}
} }
@ -319,8 +427,15 @@ void RELAY_DebugCallFrom32Ret( int *stack, int nb_args, int ret_val )
*/ */
void WINAPI Catch( CONTEXT *context ) void WINAPI Catch( CONTEXT *context )
{ {
VA_LIST16 valist;
SEGPTR buf;
LPCATCHBUF lpbuf;
STACK16FRAME *pFrame = CURRENT_STACK16; STACK16FRAME *pFrame = CURRENT_STACK16;
LPCATCHBUF lpbuf = (LPCATCHBUF)PTR_SEG_TO_LIN(*(SEGPTR *)pFrame->args);
VA_START16( valist );
buf = VA_ARG16( valist, SEGPTR );
lpbuf = (LPCATCHBUF)PTR_SEG_TO_LIN( buf );
VA_END16( valist );
/* Note: we don't save the current ss, as the catch buffer is */ /* Note: we don't save the current ss, as the catch buffer is */
/* only 9 words long. Hopefully no one will have the silly */ /* only 9 words long. Hopefully no one will have the silly */
@ -359,9 +474,16 @@ void WINAPI Catch( CONTEXT *context )
*/ */
void WINAPI Throw( CONTEXT *context ) void WINAPI Throw( CONTEXT *context )
{ {
STACK16FRAME *pFrame = CURRENT_STACK16; VA_LIST16 valist;
LPCATCHBUF lpbuf = (LPCATCHBUF)PTR_SEG_TO_LIN(*(SEGPTR *)&pFrame->args[1]); SEGPTR buf;
WORD retval = pFrame->args[0]; LPCATCHBUF lpbuf;
STACK16FRAME *pFrame;
VA_START16( valist );
AX_reg(context) = VA_ARG16( valist, WORD ); /* retval */
buf = VA_ARG16( valist, SEGPTR );
lpbuf = (LPCATCHBUF)PTR_SEG_TO_LIN( buf );
VA_END16( valist );
IF1632_Saved16_ss_sp = MAKELONG( lpbuf[7] - sizeof(WORD), IF1632_Saved16_ss_sp = MAKELONG( lpbuf[7] - sizeof(WORD),
HIWORD(IF1632_Saved16_ss_sp) ); HIWORD(IF1632_Saved16_ss_sp) );
@ -373,7 +495,6 @@ void WINAPI Throw( CONTEXT *context )
SI_reg(context) = lpbuf[4]; SI_reg(context) = lpbuf[4];
DI_reg(context) = lpbuf[5]; DI_reg(context) = lpbuf[5];
DS_reg(context) = lpbuf[6]; DS_reg(context) = lpbuf[6];
AX_reg(context) = retval;
if (debugging_relay) /* Make sure we have a valid entry point address */ if (debugging_relay) /* Make sure we have a valid entry point address */
{ {
@ -392,26 +513,34 @@ void WINAPI Throw( CONTEXT *context )
*/ */
DWORD WINAPI WIN16_CallProc32W() DWORD WINAPI WIN16_CallProc32W()
{ {
DWORD *win_stack = (DWORD *)CURRENT_STACK16->args; DWORD nrofargs, argconvmask;
DWORD nrofargs = win_stack[0]; FARPROC32 proc32;
DWORD argconvmask = win_stack[1];
FARPROC32 proc32 = (FARPROC32)win_stack[2];
DWORD *args, ret; DWORD *args, ret;
STACK16FRAME stf16; VA_LIST16 valist;
int i; int i;
VA_START16( valist );
nrofargs = VA_ARG16( valist, DWORD );
argconvmask = VA_ARG16( valist, DWORD );
proc32 = VA_ARG16( valist, FARPROC32 );
fprintf(stderr,"CallProc32W(%ld,%ld,%p,args[",nrofargs,argconvmask,proc32); fprintf(stderr,"CallProc32W(%ld,%ld,%p,args[",nrofargs,argconvmask,proc32);
args = (DWORD*)xmalloc(sizeof(DWORD)*nrofargs); args = (DWORD*)xmalloc(sizeof(DWORD)*nrofargs);
for (i=nrofargs;i--;) { for (i=nrofargs;i--;) {
if (argconvmask & (1<<i)) { if (argconvmask & (1<<i))
args[nrofargs-i-1] = (DWORD)PTR_SEG_TO_LIN(win_stack[3+i]); {
fprintf(stderr,"%08lx(%p),",win_stack[3+i],PTR_SEG_TO_LIN(win_stack[3+i])); SEGPTR ptr = VA_ARG16( valist, SEGPTR );
} else { args[nrofargs-i-1] = (DWORD)PTR_SEG_TO_LIN(ptr);
args[nrofargs-i-1] = win_stack[3+i]; fprintf(stderr,"%08lx(%p),",ptr,PTR_SEG_TO_LIN(ptr));
fprintf(stderr,"%ld,",win_stack[3+i]); }
else
{
args[nrofargs-i-1] = VA_ARG16( valist, DWORD );
fprintf(stderr,"%ld,",args[nrofargs-i-1]);
} }
} }
fprintf(stderr,"]) - "); fprintf(stderr,"]) - ");
VA_END16( valist );
switch (nrofargs) { switch (nrofargs) {
case 0: ret = proc32(); case 0: ret = proc32();
break; break;
@ -436,14 +565,7 @@ DWORD WINAPI WIN16_CallProc32W()
break; break;
} }
/* POP nrofargs DWORD arguments and 3 DWORD parameters */ /* POP nrofargs DWORD arguments and 3 DWORD parameters */
/* FIXME: this is a BAD hack, but I don't see any other way to STACK16_POP( (3 + nrofargs) * sizeof(DWORD) );
* pop a variable number of arguments. -MM
* The -2 in the size is for not copying WORD args[0] (which would
* overwrite the top WORD on the return stack)
*/
memcpy(&stf16,CURRENT_STACK16,sizeof(stf16)-2);
IF1632_Saved16_ss_sp += (3+nrofargs)*sizeof(DWORD);
memcpy(CURRENT_STACK16,&stf16,sizeof(stf16)-2);
fprintf(stderr,"returns %08lx\n",ret); fprintf(stderr,"returns %08lx\n",ret);
free(args); free(args);

View File

@ -55,7 +55,7 @@ type win32
185 stub SHELL32_185 185 stub SHELL32_185
186 stdcall FindExecutableA(ptr ptr ptr) FindExecutable32A 186 stdcall FindExecutableA(ptr ptr ptr) FindExecutable32A
187 stub FindExecutableW 187 stub FindExecutableW
188 return FreeIconList 4 0 188 stdcall FreeIconList(long) FreeIconList
189 stub InternalExtractIconListA 189 stub InternalExtractIconListA
190 stub InternalExtractIconListW 190 stub InternalExtractIconListW
191 stub OpenAs_RunDLL 191 stub OpenAs_RunDLL

View File

@ -143,9 +143,8 @@ static LRESULT THUNK_CallWndProc16( WNDPROC16 proc, HWND16 hwnd, UINT16 msg,
/* "Undocumented Windows" examples) want it that way. */ /* "Undocumented Windows" examples) want it that way. */
CREATESTRUCT16 *cs = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam); CREATESTRUCT16 *cs = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam);
offset = sizeof(*cs); offset = sizeof(*cs);
memcpy( (char *)CURRENT_STACK16 - offset, cs, offset ); lParam = STACK16_PUSH( offset );
IF1632_Saved16_ss_sp -= offset; memcpy( PTR_SEG_TO_LIN(lParam), cs, offset );
lParam = IF1632_Saved16_ss_sp;
} }
args = (WORD *)CURRENT_STACK16 - 7; args = (WORD *)CURRENT_STACK16 - 7;
args[0] = LOWORD(lParam); args[0] = LOWORD(lParam);
@ -156,7 +155,7 @@ static LRESULT THUNK_CallWndProc16( WNDPROC16 proc, HWND16 hwnd, UINT16 msg,
/* args[5] and args[6] are used by relay code to store the stack pointer */ /* args[5] and args[6] are used by relay code to store the stack pointer */
ret = CallTo16_regs_( &context, -(5 * sizeof(WORD)) ); ret = CallTo16_regs_( &context, -(5 * sizeof(WORD)) );
IF1632_Saved16_ss_sp += offset; if (offset) STACK16_POP(offset);
return ret; return ret;
} }

View File

@ -232,7 +232,7 @@ file user.exe
228 pascal16 GetNextDlgTabItem(word word word) GetNextDlgTabItem16 228 pascal16 GetNextDlgTabItem(word word word) GetNextDlgTabItem16
229 pascal16 GetTopWindow(word) GetTopWindow16 229 pascal16 GetTopWindow(word) GetTopWindow16
230 pascal16 GetNextWindow(word word) GetNextWindow16 230 pascal16 GetNextWindow(word word) GetNextWindow16
231 stub GetSystemDebugState 231 return GetSystemDebugState 0 0 #FIXME
232 pascal16 SetWindowPos(word word word word word word word) SetWindowPos16 232 pascal16 SetWindowPos(word word word word word word word) SetWindowPos16
233 pascal16 SetParent(word word) SetParent16 233 pascal16 SetParent(word word) SetParent16
234 pascal16 UnhookWindowsHook(s_word segptr) THUNK_UnhookWindowsHook16 234 pascal16 UnhookWindowsHook(s_word segptr) THUNK_UnhookWindowsHook16
@ -465,14 +465,14 @@ file user.exe
532 pascal16 WNetGetPropertyText(word word word ptr word) WNetGetPropertyText 532 pascal16 WNetGetPropertyText(word word word ptr word) WNetGetPropertyText
533 stub WNetInitialize 533 stub WNetInitialize
534 stub WNetLogon 534 stub WNetLogon
600 stub GetShellWindow 600 pascal16 GetShellWindow() GetShellWindow16
601 stub DoHotkeyStuff 601 stub DoHotkeyStuff
602 stub SetCheckCursorTimer 602 stub SetCheckCursorTimer
604 stub BroadcastSystemMessage 604 stub BroadcastSystemMessage
605 stub HackTaskMonitor 605 stub HackTaskMonitor
606 stub FormatMessage 606 stub FormatMessage
608 stub GetForegroundWindow 608 pascal16 GetForegroundWindow() GetForegroundWindow16
609 stub SetForegroundWindow 609 pascal16 SetForegroundWindow(word) SetForegroundWindow16
610 stub DestroyIcon32 610 stub DestroyIcon32
620 stub ChangeDisplaySettings 620 stub ChangeDisplaySettings
621 stub EnumDisplaySettings 621 stub EnumDisplaySettings

View File

@ -92,36 +92,36 @@ type win32
87 stub DdeAbandonTransaction 87 stub DdeAbandonTransaction
88 stub DdeAccessData 88 stub DdeAccessData
89 stub DdeAddData 89 stub DdeAddData
90 return DdeClientTransaction 32 0 90 stdcall DdeClientTransaction(ptr long long long long long long ptr) DdeClientTransaction32
91 stub DdeCmpStringHandles 91 stub DdeCmpStringHandles
92 return DdeConnect 16 0 92 stdcall DdeConnect(long long long ptr) DdeConnect32
93 stub DdeConnectList 93 stub DdeConnectList
94 stub DdeCreateDataHandle 94 stub DdeCreateDataHandle
95 return DdeCreateStringHandleA 12 0 95 stdcall DdeCreateStringHandleA(long ptr long) DdeCreateStringHandle32A
96 return DdeCreateStringHandleW 12 0 96 stdcall DdeCreateStringHandleW(long ptr long) DdeCreateStringHandle32W
97 return DdeDisconnect 4 0 97 stdcall DdeDisconnect(long) DdeDisconnect32
98 stub DdeDisconnectList 98 stub DdeDisconnectList
99 stub DdeEnableCallback 99 stub DdeEnableCallback
100 return DdeFreeDataHandle 4 1 100 stdcall DdeFreeDataHandle(long) DdeFreeDataHandle32
101 return DdeFreeStringHandle 8 0 101 stdcall DdeFreeStringHandle(long long) DdeFreeStringHandle32
102 stub DdeGetData 102 stub DdeGetData
103 return DdeGetLastError 4 0 103 stdcall DdeGetLastError(long) DdeGetLastError32
104 stub DdeGetQualityOfService 104 stub DdeGetQualityOfService
105 stub DdeImpersonateClient 105 stub DdeImpersonateClient
106 return DdeInitializeA 16 0 106 stdcall DdeInitializeA(ptr ptr long long) DdeInitialize32A
107 return DdeInitializeW 16 0 107 stdcall DdeInitializeW(ptr ptr long long) DdeInitialize32W
108 stub DdeKeepStringHandle 108 stdcall DdeKeepStringHandle(long long) DdeKeepStringHandle32
109 return DdeNameService 16 0 109 stdcall DdeNameService(long long long long) DdeNameService32
110 stub DdePostAdvise 110 stub DdePostAdvise
111 stub DdeQueryConvInfo 111 stub DdeQueryConvInfo
112 stub DdeQueryNextServer 112 stub DdeQueryNextServer
113 stub DdeQueryStringA 113 stub DdeQueryStringA
114 stub DdeQueryStringW 114 stub DdeQueryStringW
115 stub DdeReconnect 115 stdcall DdeReconnect(long) DdeReconnect
116 stub DdeSetQualityOfService 116 stub DdeSetQualityOfService
117 stub DdeSetUserHandle 117 stub DdeSetUserHandle
118 stub DdeUnaccessData 118 stub DdeUnaccessData
119 return DdeUninitialize 4 0 119 stdcall DdeUninitialize(long) DdeUninitialize32
120 stdcall DefDlgProcA(long long long long) DefDlgProc32A 120 stdcall DefDlgProcA(long long long long) DefDlgProc32A
121 stdcall DefDlgProcW(long long long long) DefDlgProc32W 121 stdcall DefDlgProcW(long long long long) DefDlgProc32W
122 stdcall DefFrameProcA(long long long long long) DefFrameProc32A 122 stdcall DefFrameProcA(long long long long long) DefFrameProc32A
@ -243,7 +243,7 @@ type win32
238 stdcall GetDlgItemTextW(long long ptr long) GetDlgItemText32W 238 stdcall GetDlgItemTextW(long long ptr long) GetDlgItemText32W
239 stdcall GetDoubleClickTime() GetDoubleClickTime32 239 stdcall GetDoubleClickTime() GetDoubleClickTime32
240 stdcall GetFocus() GetFocus32 240 stdcall GetFocus() GetFocus32
241 return GetForegroundWindow 0 0 #FIXME 241 stdcall GetForegroundWindow() GetForegroundWindow32
242 stub GetIconInfo 242 stub GetIconInfo
243 stub GetInputDesktop 243 stub GetInputDesktop
244 stdcall GetInputState() GetInputState32 244 stdcall GetInputState() GetInputState32
@ -289,7 +289,7 @@ type win32
284 stdcall GetScrollInfo(long long ptr) GetScrollInfo32 284 stdcall GetScrollInfo(long long ptr) GetScrollInfo32
285 stdcall GetScrollPos(long long) GetScrollPos32 285 stdcall GetScrollPos(long long) GetScrollPos32
286 stdcall GetScrollRange(long long ptr ptr) GetScrollRange32 286 stdcall GetScrollRange(long long ptr ptr) GetScrollRange32
287 return GetShellWindow 0 0 287 stdcall GetShellWindow() GetShellWindow32
288 stdcall GetSubMenu(long long) GetSubMenu32 288 stdcall GetSubMenu(long long) GetSubMenu32
289 stdcall GetSysColor(long) GetSysColor32 289 stdcall GetSysColor(long) GetSysColor32
290 stdcall GetSysColorBrush(long) GetSysColorBrush32 290 stdcall GetSysColorBrush(long) GetSysColorBrush32
@ -484,7 +484,7 @@ type win32
479 stdcall SetDlgItemTextW(long long ptr) SetDlgItemText32W 479 stdcall SetDlgItemTextW(long long ptr) SetDlgItemText32W
480 stdcall SetDoubleClickTime(long) SetDoubleClickTime32 480 stdcall SetDoubleClickTime(long) SetDoubleClickTime32
481 stdcall SetFocus(long) SetFocus32 481 stdcall SetFocus(long) SetFocus32
482 return SetForegroundWindow 4 0 482 stdcall SetForegroundWindow(long) SetForegroundWindow32
483 stdcall SetInternalWindowPos(long long ptr ptr) SetInternalWindowPos32 483 stdcall SetInternalWindowPos(long long ptr ptr) SetInternalWindowPos32
484 stdcall SetKeyboardState(ptr) SetKeyboardState 484 stdcall SetKeyboardState(ptr) SetKeyboardState
485 stdcall SetLastErrorEx(long long) SetLastErrorEx 485 stdcall SetLastErrorEx(long long) SetLastErrorEx

View File

@ -38,7 +38,7 @@ type win16
118 register INT_Int12Handler(word) INT_Int12Handler 118 register INT_Int12Handler(word) INT_Int12Handler
119 register INT_Int13Handler(word) INT_Int13Handler 119 register INT_Int13Handler(word) INT_Int13Handler
120 register INT_Int14Handler(word) BUILTIN_DefaultIntHandler 120 register INT_Int14Handler(word) BUILTIN_DefaultIntHandler
121 register INT_Int15Handler(word) BUILTIN_DefaultIntHandler 121 register INT_Int15Handler(word) INT_Int15Handler
122 register INT_Int16Handler(word) BUILTIN_DefaultIntHandler 122 register INT_Int16Handler(word) BUILTIN_DefaultIntHandler
123 register INT_Int17Handler(word) BUILTIN_DefaultIntHandler 123 register INT_Int17Handler(word) BUILTIN_DefaultIntHandler
124 register INT_Int18Handler(word) BUILTIN_DefaultIntHandler 124 register INT_Int18Handler(word) BUILTIN_DefaultIntHandler

View File

@ -1,24 +0,0 @@
/*
* Machine dependent integer conversions
*
* Copyright Miguel de Icaza, 1994
*/
#if defined (mc68000) || defined (sparc)
#define CONV_LONG(a) (((int)(a)&0xFF) << 24) | (((int)(a) & 0xFF00) << 8) | (((unsigned long)(a) & 0xFF0000) >> 8) | (((unsigned long)(a)&0xFF000000) >> 24)
#define CONV_SHORT(a) (((int)(a) & 0xFF) << 8) | (((unsigned long)(a) & 0xFF00) >> 8)
#define CONV_CHAR_TO_LONG(x) ((unsigned long)(x) >> 24)
#define CONV_SHORT_TO_LONG(x) ((unsigned long)(x) >> 16)
#define CONV_BITMAPINFO(a) ARCH_ConvBitmapInfo(a)
#define CONV_BITMAPCOREHEADER(a) ARCH_ConvCoreHeader(a)
#else
#define CONV_LONG(a) (a)
#define CONV_SHORT(a) (a)
#define CONV_CHAR_TO_LONG(a) (a)
#define CONV_SHORT_TO_LONG(a) (a)
#define CONV_BITMAPINFO(a) /* */
#define CONV_BITMAPCOREHEADER(a) /* */
#endif

View File

@ -45,9 +45,15 @@ extern WORD CALLBACK CallTo16_word_wwwww(FARPROC16,WORD,WORD,WORD,WORD,WORD);
extern WORD CALLBACK CallTo16_word_lwlll(FARPROC16,LONG,WORD,LONG,LONG,LONG); extern WORD CALLBACK CallTo16_word_lwlll(FARPROC16,LONG,WORD,LONG,LONG,LONG);
extern WORD CALLBACK CallTo16_word_llll (FARPROC16,LONG,LONG,LONG,LONG); extern WORD CALLBACK CallTo16_word_llll (FARPROC16,LONG,LONG,LONG,LONG);
extern LONG CALLBACK CallTo16_long_lwlll(FARPROC16,LONG,WORD,LONG,LONG,LONG); extern LONG CALLBACK CallTo16_long_lwlll(FARPROC16,LONG,WORD,LONG,LONG,LONG);
extern LONG CALLBACK CallTo16_word_lwwlllll(FARPROC16,LONG,WORD,WORD,LONG,LONG,
LONG,LONG,WORD);
extern LONG CALLBACK CallTo16_long_lwwllwlllllw(FARPROC16,LONG,WORD,WORD,LONG, extern LONG CALLBACK CallTo16_long_lwwllwlllllw(FARPROC16,LONG,WORD,WORD,LONG,
LONG,WORD,LONG,LONG,LONG,LONG, LONG,WORD,LONG,LONG,LONG,LONG,
LONG,WORD); LONG,WORD);
extern LONG CALLBACK CallTo16_word_lwwwwlwwwwllll(FARPROC16,LONG,WORD,WORD,
WORD,WORD,LONG,WORD,WORD,
WORD,WORD,LONG,LONG,LONG,
LONG);
#define CallDriverProc( func, dwId, msg, hdrvr, lparam1, lparam2 ) \ #define CallDriverProc( func, dwId, msg, hdrvr, lparam1, lparam2 ) \
CallTo16_long_lwwll( func, dwId, msg, hdrvr, lparam1, lparam2 ) CallTo16_long_lwwll( func, dwId, msg, hdrvr, lparam1, lparam2 )

View File

@ -13,7 +13,7 @@ void WINAPI InitCommonControls(void);
#define STATUSCLASSNAME16 "msctls_statusbar" #define STATUSCLASSNAME16 "msctls_statusbar"
#define STATUSCLASSNAME32A "msctls_statusbar32" #define STATUSCLASSNAME32A "msctls_statusbar32"
#define STATUSCLASSNAME32W "msctls_statusbar32" #define STATUSCLASSNAME32W L"msctls_statusbar32" /*FIXME*/
#define STATUSCLASSNAME WINELIB_NAME_AW(STATUSCLASSNAME) #define STATUSCLASSNAME WINELIB_NAME_AW(STATUSCLASSNAME)
#define SB_SETTEXT32A (WM_USER+1) #define SB_SETTEXT32A (WM_USER+1)
@ -43,9 +43,9 @@ void WINAPI InitCommonControls(void);
/* UpDown */ /* UpDown */
#define UPDOWN_CLASS32A "msctls_updown32"
#define UPDOWN_CLASS32W L"msctls_updown32"
#define UPDOWN_CLASS16 "msctls_updown" #define UPDOWN_CLASS16 "msctls_updown"
#define UPDOWN_CLASS32A "msctls_updown32"
#define UPDOWN_CLASS32W L"msctls_updown32" /*FIXME*/
#define UPDOWN_CLASS WINELIB_NAME_AW(UPDOWN_CLASS) #define UPDOWN_CLASS WINELIB_NAME_AW(UPDOWN_CLASS)
typedef struct tagUDACCEL typedef struct tagUDACCEL
@ -96,12 +96,14 @@ typedef struct tagUDACCEL
/* Functions prototypes */ /* Functions prototypes */
HWND16 WINAPI CreateStatusWindow16(INT16,LPCSTR,HWND16,UINT16);
HWND32 WINAPI CreateStatusWindow32A(INT32,LPCSTR,HWND32,UINT32); HWND32 WINAPI CreateStatusWindow32A(INT32,LPCSTR,HWND32,UINT32);
HWND32 WINAPI CreateStatusWindow32W(INT32,LPCWSTR,HWND32,UINT32); HWND32 WINAPI CreateStatusWindow32W(INT32,LPCWSTR,HWND32,UINT32);
#define CreateStatusWindow WINELIB_NAME_AW(CreateStatusWindow) #define CreateStatusWindow WINELIB_NAME_AW(CreateStatusWindow)
HWND32 WINAPI CreateUpDownControl(DWORD,INT32,INT32,INT32,INT32, HWND32 WINAPI CreateUpDownControl(DWORD,INT32,INT32,INT32,INT32,
HWND32,INT32,HINSTANCE32,HWND32, HWND32,INT32,HINSTANCE32,HWND32,
INT32,INT32,INT32); INT32,INT32,INT32);
VOID WINAPI DrawStatusText16(HDC16,LPRECT16,LPCSTR,UINT16);
VOID WINAPI DrawStatusText32A(HDC32,LPRECT32,LPCSTR,UINT32); VOID WINAPI DrawStatusText32A(HDC32,LPRECT32,LPCSTR,UINT32);
VOID WINAPI DrawStatusText32W(HDC32,LPRECT32,LPCWSTR,UINT32); VOID WINAPI DrawStatusText32W(HDC32,LPRECT32,LPCWSTR,UINT32);
#define DrawStatusText WINELIB_NAME_AW(DrawStatusText) #define DrawStatusText WINELIB_NAME_AW(DrawStatusText)

View File

@ -253,18 +253,19 @@ typedef CHOOSEFONT *LPCHOOSEFONT;
#define CD_LBSELSUB 1 #define CD_LBSELSUB 1
#define CD_LBSELADD 2 #define CD_LBSELADD 2
typedef struct { typedef struct
{
DWORD lStructSize; DWORD lStructSize;
HWND16 hwndOwner; HWND16 hwndOwner;
HGLOBAL16 hDevMode; HGLOBAL16 hDevMode;
HGLOBAL16 hDevNames; HGLOBAL16 hDevNames;
HDC16 hDC; HDC16 hDC;
DWORD Flags; DWORD Flags;
UINT16 nFromPage; WORD nFromPage;
UINT16 nToPage; WORD nToPage;
UINT16 nMinPage; WORD nMinPage;
UINT16 nMaxPage; WORD nMaxPage;
UINT16 nCopies; WORD nCopies;
HINSTANCE16 hInstance; HINSTANCE16 hInstance;
LPARAM lCustData; LPARAM lCustData;
WNDPROC16 lpfnPrintHook; WNDPROC16 lpfnPrintHook;
@ -273,8 +274,59 @@ typedef struct {
SEGPTR lpSetupTemplateName; SEGPTR lpSetupTemplateName;
HGLOBAL16 hPrintTemplate; HGLOBAL16 hPrintTemplate;
HGLOBAL16 hSetupTemplate; HGLOBAL16 hSetupTemplate;
} PRINTDLG; } PRINTDLG16, *LPPRINTDLG16;
typedef PRINTDLG * LPPRINTDLG;
typedef UINT32 (CALLBACK *LPPRINTHOOKPROC) (HWND32, UINT32, WPARAM32, LPARAM);
typedef UINT32 (CALLBACK *LPSETUPHOOKPROC) (HWND32, UINT32, WPARAM32, LPARAM);
typedef struct
{
DWORD lStructSize;
HWND32 hwndOwner;
HGLOBAL32 hDevMode;
HGLOBAL32 hDevNames;
HDC32 hDC;
DWORD Flags;
WORD nFromPage;
WORD nToPage;
WORD nMinPage;
WORD nMaxPage;
WORD nCopies;
HINSTANCE32 hInstance;
LPARAM lCustData;
LPPRINTHOOKPROC lpfnPrintHook;
LPSETUPHOOKPROC lpfnSetupHook;
LPCSTR lpPrintTemplateName;
LPCSTR lpSetupTemplateName;
HGLOBAL32 hPrintTemplate;
HGLOBAL32 hSetupTemplate;
} PRINTDLG32A, *LPPRINTDLG32A;
typedef struct
{
DWORD lStructSize;
HWND32 hwndOwner;
HGLOBAL32 hDevMode;
HGLOBAL32 hDevNames;
HDC32 hDC;
DWORD Flags;
WORD nFromPage;
WORD nToPage;
WORD nMinPage;
WORD nMaxPage;
WORD nCopies;
HINSTANCE32 hInstance;
LPARAM lCustData;
LPPRINTHOOKPROC lpfnPrintHook;
LPSETUPHOOKPROC lpfnSetupHook;
LPCWSTR lpPrintTemplateName;
LPCWSTR lpSetupTemplateName;
HGLOBAL32 hPrintTemplate;
HGLOBAL32 hSetupTemplate;
} PRINTDLG32W, *LPPRINTDLG32W;
DECL_WINELIB_TYPE_AW(PRINTDLG);
DECL_WINELIB_TYPE_AW(LPPRINTDLG);
#define PD_ALLPAGES 0x00000000 #define PD_ALLPAGES 0x00000000
#define PD_SELECTION 0x00000001 #define PD_SELECTION 0x00000001

85
include/ddeml.h Normal file
View File

@ -0,0 +1,85 @@
/*
* DDEML library definitions
*
* Copyright 1997 Alexandre Julliard
*/
#ifndef __WINE__DDEML_H
#define __WINE__DDEML_H
#include "wintypes.h"
typedef DWORD HCONVLIST;
typedef DWORD HCONV;
typedef DWORD HSZ;
typedef DWORD HDDEDATA;
typedef HDDEDATA (CALLBACK *PFNCALLBACK16)(UINT16,UINT16,HCONV,HSZ,HSZ,
HDDEDATA,DWORD,DWORD);
typedef HDDEDATA (CALLBACK *PFNCALLBACK32)(UINT32,UINT32,HCONV,HSZ,HSZ,
HDDEDATA,DWORD,DWORD);
DECL_WINELIB_TYPE(PFNCALLBACK);
typedef struct
{
UINT16 cb;
UINT16 wFlags;
UINT16 wCountryID;
INT16 iCodePage;
DWORD dwLangID;
DWORD dwSecurity;
} CONVCONTEXT16, *LPCONVCONTEXT16;
typedef struct
{
UINT32 cb;
UINT32 wFlags;
UINT32 wCountryID;
INT32 iCodePage;
DWORD dwLangID;
DWORD dwSecurity;
} CONVCONTEXT32, *LPCONVCONTEXT32;
DECL_WINELIB_TYPE(CONVCONTEXT);
DECL_WINELIB_TYPE(LPCONVCONTEXT);
UINT16 WINAPI DdeInitialize16(LPDWORD,PFNCALLBACK16,DWORD,DWORD);
UINT32 WINAPI DdeInitialize32A(LPDWORD,PFNCALLBACK32,DWORD,DWORD);
UINT32 WINAPI DdeInitialize32W(LPDWORD,PFNCALLBACK32,DWORD,DWORD);
#define DdeInitialize WINELIB_NAME_AW(DdeInitialize)
BOOL16 WINAPI DdeUninitialize16(DWORD);
BOOL32 WINAPI DdeUninitialize32(DWORD);
#define DdeUninitialize WINELIB_NAME(DdeUninitialize)
HCONV WINAPI DdeConnect16(DWORD,HSZ,HSZ,LPCONVCONTEXT16);
HCONV WINAPI DdeConnect32(DWORD,HSZ,HSZ,LPCONVCONTEXT32);
#define DdeConnect WINELIB_NAME(DdeConnect)
BOOL16 WINAPI DdeDisconnect16(HCONV);
BOOL32 WINAPI DdeDisconnect32(HCONV);
#define DdeDisconnect WINELIB_NAME(DdeDisconnect)
HCONV WINAPI DdeReconnect(HCONV);
HSZ WINAPI DdeCreateStringHandle16(DWORD,LPCSTR,INT16);
HSZ WINAPI DdeCreateStringHandle32A(DWORD,LPCSTR,INT32);
HSZ WINAPI DdeCreateStringHandle32W(DWORD,LPCWSTR,INT32);
#define DdeCreateStringHandle WINELIB_NAME_AW(DdeCreateStringHandle)
BOOL16 WINAPI DdeFreeStringHandle16(DWORD,HSZ);
BOOL32 WINAPI DdeFreeStringHandle32(DWORD,HSZ);
#define DdeFreeStringHandle WINELIB_NAME(DdeFreeStringHandle)
BOOL16 WINAPI DdeFreeDataHandle16(HDDEDATA);
BOOL32 WINAPI DdeFreeDataHandle32(HDDEDATA);
#define DdeFreeDataHandle WINELIB_NAME(DdeFreeDataHandle)
BOOL16 WINAPI DdeKeepStringHandle16(DWORD,HSZ);
BOOL32 WINAPI DdeKeepStringHandle32(DWORD,HSZ);
#define DdeKeepStringHandle WINELIB_NAME(DdeKeepStringHandle)
HDDEDATA WINAPI DdeClientTransaction16(LPVOID,DWORD,HCONV,HSZ,UINT16,
UINT16,DWORD,LPDWORD);
HDDEDATA WINAPI DdeClientTransaction32(LPBYTE,DWORD,HCONV,HSZ,UINT32,
UINT32,DWORD,LPDWORD);
#define DdeClientTransaction WINELIB_NAME(DdeClientTransaction)
HDDEDATA WINAPI DdeNameService16(DWORD,HSZ,HSZ,UINT16);
HDDEDATA WINAPI DdeNameService32(DWORD,HSZ,HSZ,UINT32);
#define DdeNameService WINELIB_NAME(DdeNameService)
UINT16 WINAPI DdeGetLastError16(DWORD);
UINT32 WINAPI DdeGetLastError32(DWORD);
#define DdeGetLastError WINELIB_NAME(DdeGetLastError)
#endif /* __WINE__DDEML_H */

View File

@ -108,6 +108,7 @@ typedef struct
BYTE bitsPerPixel; BYTE bitsPerPixel;
INT32 MapMode; INT32 MapMode;
INT32 GraphicsMode; /* Graphics mode */
INT32 DCOrgX; /* DC origin */ INT32 DCOrgX; /* DC origin */
INT32 DCOrgY; INT32 DCOrgY;
INT32 CursPosX; /* Current position */ INT32 CursPosX; /* Current position */

View File

@ -454,7 +454,7 @@ DWORD WINAPI auxOutMessage(UINT16 uDeviceID, UINT16 uMessage, DWORD dw1, DWORD d
#define TIMERR_NOCANDO (TIMERR_BASE+1) /* request not completed */ #define TIMERR_NOCANDO (TIMERR_BASE+1) /* request not completed */
#define TIMERR_STRUCT (TIMERR_BASE+33) /* time struct size */ #define TIMERR_STRUCT (TIMERR_BASE+33) /* time struct size */
typedef void (*LPTIMECALLBACK) (UINT16 uTimerID, UINT16 uMessage, DWORD dwUser, DWORD dw1, DWORD dw2); typedef void (CALLBACK *LPTIMECALLBACK) (UINT16 uTimerID, UINT16 uMessage, DWORD dwUser, DWORD dw1, DWORD dw2);
#define TIME_ONESHOT 0 /* program timer for single event */ #define TIME_ONESHOT 0 /* program timer for single event */
#define TIME_PERIODIC 1 /* program for continuous periodic event */ #define TIME_PERIODIC 1 /* program for continuous periodic event */

View File

@ -132,12 +132,12 @@ extern FARPROC16 MODULE_GetWndProcEntry16( const char *name );
extern FARPROC16 WIN32_GetProcAddress16( HMODULE32 hmodule, LPSTR name ); extern FARPROC16 WIN32_GetProcAddress16( HMODULE32 hmodule, LPSTR name );
/* builtin.c */ /* builtin.c */
extern BOOL16 BUILTIN_Init(void); extern BOOL32 BUILTIN_Init(void);
extern HMODULE16 BUILTIN_LoadModule( LPCSTR name, BOOL16 force ); extern HMODULE16 BUILTIN_LoadModule( LPCSTR name, BOOL32 force );
extern LPCSTR BUILTIN_GetEntryPoint16( WORD cs, WORD ip, WORD *pOrd ); extern LPCSTR BUILTIN_GetEntryPoint16( WORD cs, WORD ip, WORD *pOrd );
extern LPCSTR BUILTIN_GetEntryPoint32( void *relay ); extern FARPROC32 BUILTIN_GetEntryPoint32( char *buffer, void *relay );
extern FARPROC32 BUILTIN_GetProcAddress32(NE_MODULE *pModule, LPCSTR function); extern FARPROC32 BUILTIN_GetProcAddress32(NE_MODULE *pModule, LPCSTR function);
extern BOOL16 BUILTIN_ParseDLLOptions( const char *str ); extern BOOL32 BUILTIN_ParseDLLOptions( const char *str );
extern void BUILTIN_PrintDLLs(void); extern void BUILTIN_PrintDLLs(void);
/* ne_image.c */ /* ne_image.c */

View File

@ -47,6 +47,7 @@ struct options
{ {
char * desktopGeometry; /* NULL when no desktop */ char * desktopGeometry; /* NULL when no desktop */
char * programName; /* To use when loading resources */ char * programName; /* To use when loading resources */
char * argv0; /* argv[0] of Wine process */
int usePrivateMap; int usePrivateMap;
int useFixedMap; int useFixedMap;
int synchronous; /* X synchronous mode */ int synchronous; /* X synchronous mode */

View File

@ -350,7 +350,7 @@ typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
DWORD Reserved[ 4 ]; DWORD Reserved[ 4 ];
} IMAGE_LOAD_CONFIG_DIRECTORY,*LPIMAGE_LOAD_CONFIG_DIRECTORY; } IMAGE_LOAD_CONFIG_DIRECTORY,*LPIMAGE_LOAD_CONFIG_DIRECTORY;
typedef VOID (*LPIMAGE_TLS_CALLBACK)( typedef VOID (CALLBACK *LPIMAGE_TLS_CALLBACK)(
LPVOID DllHandle,DWORD Reason,LPVOID Reserved LPVOID DllHandle,DWORD Reason,LPVOID Reserved
); );

View File

@ -7,7 +7,8 @@
#ifndef __WINE_STACKFRAME_H #ifndef __WINE_STACKFRAME_H
#define __WINE_STACKFRAME_H #define __WINE_STACKFRAME_H
#include <windows.h> #include <string.h>
#include "windows.h"
#include "ldt.h" #include "ldt.h"
#pragma pack(1) #pragma pack(1)
@ -25,7 +26,6 @@ typedef struct
WORD bp; /* 14 16-bit bp */ WORD bp; /* 14 16-bit bp */
WORD ip; /* 16 return address */ WORD ip; /* 16 return address */
WORD cs; /* 18 */ WORD cs; /* 18 */
WORD args[1]; /* 1a arguments to API function */
} STACK16FRAME; } STACK16FRAME;
/* 32-bit stack layout after CallTo16() */ /* 32-bit stack layout after CallTo16() */
@ -48,14 +48,30 @@ typedef struct
/* Saved 16-bit stack for current process (Win16 only) */ /* Saved 16-bit stack for current process (Win16 only) */
extern DWORD IF1632_Saved16_ss_sp; extern DWORD IF1632_Saved16_ss_sp;
/* Saved 32-bit stack for current process (Win16 only) */
extern DWORD IF1632_Saved32_esp;
/* Original Unix stack */
extern DWORD IF1632_Original32_esp;
#define CURRENT_STACK16 ((STACK16FRAME *)PTR_SEG_TO_LIN(IF1632_Saved16_ss_sp)) #define CURRENT_STACK16 ((STACK16FRAME *)PTR_SEG_TO_LIN(IF1632_Saved16_ss_sp))
#define CURRENT_DS (CURRENT_STACK16->ds) #define CURRENT_DS (CURRENT_STACK16->ds)
/* varargs lists on the 16-bit stack */
typedef void *VA_LIST16;
#define __VA_ROUNDED16(type) \
((sizeof(type) + sizeof(WORD) - 1) / sizeof(WORD) * sizeof(WORD))
#define VA_START16(list) ((list) = (VA_LIST16)(CURRENT_STACK16 + 1))
#define VA_ARG16(list,type) \
(((list) = (VA_LIST16)((char *)(list) + __VA_ROUNDED16(type))), \
*((type *)(void *)((char *)(list) - __VA_ROUNDED16(type))))
#define VA_END16(list) ((void)0)
/* Push bytes on the 16-bit stack; return a segptr to the first pushed byte */
#define STACK16_PUSH(size) \
(memmove((char*)CURRENT_STACK16-(size),CURRENT_STACK16,sizeof(STACK16FRAME)),\
IF1632_Saved16_ss_sp -= (size), \
(SEGPTR)(IF1632_Saved16_ss_sp + sizeof(STACK16FRAME)))
/* Pop bytes from the 16-bit stack */
#define STACK16_POP(size) \
(memmove((char*)CURRENT_STACK16+(size),CURRENT_STACK16,sizeof(STACK16FRAME)),\
IF1632_Saved16_ss_sp += (size))
#endif /* __WINE_STACKFRAME_H */ #endif /* __WINE_STACKFRAME_H */

View File

@ -12,30 +12,33 @@
struct SysColorObjects struct SysColorObjects
{ {
HBRUSH32 hbrushScrollbar; /* COLOR_SCROLLBAR */ HBRUSH32 hbrushScrollbar; /* COLOR_SCROLLBAR */
/* COLOR_BACKGROUND */ HBRUSH32 hbrushBackground; /* COLOR_BACKGROUND */
HBRUSH32 hbrushActiveCaption; /* COLOR_ACTIVECAPTION */ HBRUSH32 hbrushActiveCaption; /* COLOR_ACTIVECAPTION */
HBRUSH32 hbrushInactiveCaption; /* COLOR_INACTIVECAPTION */ HBRUSH32 hbrushInactiveCaption; /* COLOR_INACTIVECAPTION */
HBRUSH32 hbrushMenu; /* COLOR_MENU */ HBRUSH32 hbrushMenu; /* COLOR_MENU */
HBRUSH32 hbrushWindow; /* COLOR_WINDOW */ HBRUSH32 hbrushWindow; /* COLOR_WINDOW */
HPEN32 hpenWindowFrame; /* COLOR_WINDOWFRAME */ HBRUSH32 hbrushWindowFrame; /* COLOR_WINDOWFRAME */
/* COLOR_MENUTEXT */ HBRUSH32 hbrushMenuText; /* COLOR_MENUTEXT */
HPEN32 hpenWindowText; /* COLOR_WINDOWTEXT */ HBRUSH32 hbrushWindowText; /* COLOR_WINDOWTEXT */
/* COLOR_CAPTIONTEXT */ HBRUSH32 hbrushCaptionText; /* COLOR_CAPTIONTEXT */
HBRUSH32 hbrushActiveBorder; /* COLOR_ACTIVEBORDER */ HBRUSH32 hbrushActiveBorder; /* COLOR_ACTIVEBORDER */
HBRUSH32 hbrushInactiveBorder; /* COLOR_INACTIVEBORDER */ HBRUSH32 hbrushInactiveBorder; /* COLOR_INACTIVEBORDER */
/* COLOR_APPWORKSPACE */ HBRUSH32 hbrushAppWorkspace; /* COLOR_APPWORKSPACE */
HBRUSH32 hbrushHighlight; /* COLOR_HIGHLIGHT */ HBRUSH32 hbrushHighlight; /* COLOR_HIGHLIGHT */
/* COLOR_HIGHLIGHTTEXT */ HBRUSH32 hbrushHighlightText; /* COLOR_HIGHLIGHTTEXT */
HBRUSH32 hbrushBtnFace; /* COLOR_BTNFACE */ HBRUSH32 hbrushBtnFace; /* COLOR_BTNFACE */
HBRUSH32 hbrushBtnShadow; /* COLOR_BTNSHADOW */ HBRUSH32 hbrushBtnShadow; /* COLOR_BTNSHADOW */
/* COLOR_GRAYTEXT */ HBRUSH32 hbrushGrayText; /* COLOR_GRAYTEXT */
/* COLOR_BTNTEXT */ HBRUSH32 hbrushBtnText; /* COLOR_BTNTEXT */
/* COLOR_INACTIVECAPTIONTEXT */ HBRUSH32 hbrushInactiveCaptionText; /* COLOR_INACTIVECAPTIONTEXT */
HBRUSH32 hbrushBtnHighlight; /* COLOR_BTNHIGHLIGHT */ HBRUSH32 hbrushBtnHighlight; /* COLOR_BTNHIGHLIGHT */
/* COLOR_3DDKSHADOW */ HBRUSH32 hbrush3DDkShadow; /* COLOR_3DDKSHADOW */
/* COLOR_3DLIGHT */ HBRUSH32 hbrush3DLight; /* COLOR_3DLIGHT */
/* COLOR_INFOTEXT */ HBRUSH32 hbrushInfoText; /* COLOR_INFOTEXT */
/* COLOR_INFOBK */ HBRUSH32 hbrushInfoBk; /* COLOR_INFOBK */
HPEN32 hpenWindowFrame; /* COLOR_WINDOWFRAME */
HPEN32 hpenWindowText; /* COLOR_WINDOWTEXT */
}; };
extern void SYSCOLOR_Init(void); extern void SYSCOLOR_Init(void);

View File

@ -18,6 +18,20 @@
#define INITPDEVICE 0x0000 #define INITPDEVICE 0x0000
#endif #endif
#define OS_ARC 3
#define OS_SCANLINES 4
#define OS_RECTANGLE 6
#define OS_ELLIPSE 7
#define OS_MARKER 8
#define OS_POLYLINE 18
#define OS_ALTPOLYGON 22
#define OS_WINDPOLYGON 20
#define OS_PIE 23
#define OS_POLYMARKER 24
#define OS_CHORD 39
#define OS_CIRCLE 55
#define OS_ROUNDRECT 72
/* Internal Data */ /* Internal Data */
#define ORD_BITBLT 1 #define ORD_BITBLT 1
#define ORD_COLORINFO 2 #define ORD_COLORINFO 2
@ -89,7 +103,7 @@ typedef struct PRINTER_FONTS_INFO
typedef struct typedef struct
{ {
char szDriver[9]; /* Driver name eg EPSON */ LPSTR szDriver; /* Driver name eg EPSON */
HINSTANCE16 hInst; /* Handle for driver */ HINSTANCE16 hInst; /* Handle for driver */
WORD ds_reg; /* DS of driver */ WORD ds_reg; /* DS of driver */
FARPROC16 fn[TOTAL_PRINTER_DRIVER_FUNCTIONS]; /* Printer functions */ FARPROC16 fn[TOTAL_PRINTER_DRIVER_FUNCTIONS]; /* Printer functions */
@ -97,9 +111,6 @@ typedef struct
int nPrinterFonts; /* Number of printer fonts */ int nPrinterFonts; /* Number of printer fonts */
PRINTER_FONTS_INFO *paPrinterFonts; /* array of printer fonts */ PRINTER_FONTS_INFO *paPrinterFonts; /* array of printer fonts */
int nIndex; /* Index in global driver array */ int nIndex; /* Index in global driver array */
HGLOBAL16 hThunk; /* Thunking buffer */
SEGPTR ThunkBufSegPtr;
SEGPTR ThunkBufLimit;
} LOADED_PRINTER_DRIVER; } LOADED_PRINTER_DRIVER;
typedef struct PDEVICE_HEADER typedef struct PDEVICE_HEADER
@ -150,6 +161,8 @@ typedef struct
LOGFONT16 lf; /* Current font details */ LOGFONT16 lf; /* Current font details */
TEXTMETRIC16 tm; /* Current font metrics */ TEXTMETRIC16 tm; /* Current font metrics */
SEGPTR segptrFontInfo; /* Current font realized by printer driver */ SEGPTR segptrFontInfo; /* Current font realized by printer driver */
SEGPTR segptrBrushInfo; /* Current brush realized by printer driver */
SEGPTR segptrPenInfo; /* Current pen realized by printer driver */
} WIN16DRV_PDEVICE; } WIN16DRV_PDEVICE;
/* /*
@ -187,6 +200,10 @@ extern BOOL32 WIN16DRV_GetTextMetrics( DC *dc, TEXTMETRIC32A *metrics );
extern BOOL32 WIN16DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags, extern BOOL32 WIN16DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
const RECT32 *lprect, LPCSTR str, UINT32 count, const RECT32 *lprect, LPCSTR str, UINT32 count,
const INT32 *lpDx ); const INT32 *lpDx );
extern BOOL32 WIN16DRV_LineTo( DC *dc, INT32 x, INT32 y );
extern BOOL32 WIN16DRV_MoveToEx(DC *dc,INT32 x,INT32 y,LPPOINT32 pt);
extern BOOL32 WIN16DRV_Polygon(DC *dc, LPPOINT32 pt, INT32 count );
extern BOOL32 WIN16DRV_Rectangle(DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom);
extern HGDIOBJ32 WIN16DRV_SelectObject( DC *dc, HGDIOBJ32 handle ); extern HGDIOBJ32 WIN16DRV_SelectObject( DC *dc, HGDIOBJ32 handle );
extern BOOL32 WIN16DRV_PatBlt( struct tagDC *dc, INT32 left, INT32 top, extern BOOL32 WIN16DRV_PatBlt( struct tagDC *dc, INT32 left, INT32 top,
INT32 width, INT32 height, DWORD rop ); INT32 width, INT32 height, DWORD rop );
@ -202,3 +219,4 @@ extern SEGPTR win16drv_SegPtr_DrawMode;
extern LPDRAWMODE win16drv_DrawModeP; extern LPDRAWMODE win16drv_DrawModeP;
#endif /* __WINE_WIN16DRV_H */ #endif /* __WINE_WIN16DRV_H */

View File

@ -1120,6 +1120,15 @@ typedef struct
FONTSIGNATURE fs; FONTSIGNATURE fs;
} CHARSETINFO,*LPCHARSETINFO; } CHARSETINFO,*LPCHARSETINFO;
typedef struct
{
FLOAT eM11;
FLOAT eM12;
FLOAT eM21;
FLOAT eM22;
FLOAT eDx;
FLOAT eDy;
} XFORM, *LPXFORM;
typedef struct typedef struct
{ {
@ -1432,14 +1441,16 @@ DECL_WINELIB_TYPE_AW(NEWTEXTMETRICEX);
DECL_WINELIB_TYPE_AW(LPNEWTEXTMETRICEX); DECL_WINELIB_TYPE_AW(LPNEWTEXTMETRICEX);
typedef INT16 (*FONTENUMPROC16)(SEGPTR,SEGPTR,UINT16,LPARAM); typedef INT16 (CALLBACK *FONTENUMPROC16)(SEGPTR,SEGPTR,UINT16,LPARAM);
typedef INT32 (*FONTENUMPROC32A)(LPENUMLOGFONT32A,LPNEWTEXTMETRIC32A,UINT32,LPARAM); typedef INT32 (CALLBACK *FONTENUMPROC32A)(LPENUMLOGFONT32A,LPNEWTEXTMETRIC32A,
typedef INT32 (*FONTENUMPROC32W)(LPENUMLOGFONT32W,LPNEWTEXTMETRIC32W,UINT32,LPARAM); UINT32,LPARAM);
typedef INT32 (CALLBACK *FONTENUMPROC32W)(LPENUMLOGFONT32W,LPNEWTEXTMETRIC32W,
UINT32,LPARAM);
DECL_WINELIB_TYPE_AW(FONTENUMPROC); DECL_WINELIB_TYPE_AW(FONTENUMPROC);
typedef INT16 (*FONTENUMPROCEX16)(SEGPTR,SEGPTR,UINT16,LPARAM); typedef INT16 (CALLBACK *FONTENUMPROCEX16)(SEGPTR,SEGPTR,UINT16,LPARAM);
typedef INT32 (*FONTENUMPROCEX32A)(LPENUMLOGFONTEX32A,LPNEWTEXTMETRICEX32A,UINT32,LPARAM); typedef INT32 (CALLBACK *FONTENUMPROCEX32A)(LPENUMLOGFONTEX32A,LPNEWTEXTMETRICEX32A,UINT32,LPARAM);
typedef INT32 (*FONTENUMPROCEX32W)(LPENUMLOGFONTEX32W,LPNEWTEXTMETRICEX32W,UINT32,LPARAM); typedef INT32 (CALLBACK *FONTENUMPROCEX32W)(LPENUMLOGFONTEX32W,LPNEWTEXTMETRICEX32W,UINT32,LPARAM);
DECL_WINELIB_TYPE_AW(FONTENUMPROCEX); DECL_WINELIB_TYPE_AW(FONTENUMPROCEX);
/* tmPitchAndFamily bits */ /* tmPitchAndFamily bits */
@ -1616,6 +1627,12 @@ DECL_WINELIB_TYPE(LPLOGPEN);
#define TRANSPARENT 1 #define TRANSPARENT 1
#define OPAQUE 2 #define OPAQUE 2
/* Graphics Modes */
#define GM_COMPATIBLE 1
#define GM_ADVANCED 2
#define GM_LAST 2
/* Map modes */ /* Map modes */
#define MM_TEXT 1 #define MM_TEXT 1
#define MM_LOMETRIC 2 #define MM_LOMETRIC 2
@ -4274,8 +4291,10 @@ DECL_WINELIB_TYPE(LPMETAFILEPICT);
#define META_CREATEBITMAP 0x06FE #define META_CREATEBITMAP 0x06FE
#define META_CREATEREGION 0x06FF #define META_CREATEREGION 0x06FF
typedef INT16 (*MFENUMPROC16)(HDC16,HANDLETABLE16*,METARECORD*,INT16,LPARAM); typedef INT16 (CALLBACK *MFENUMPROC16)(HDC16,HANDLETABLE16*,METARECORD*,
typedef INT32 (*MFENUMPROC32)(HDC32,HANDLETABLE32*,METARECORD*,INT32,LPARAM); INT16,LPARAM);
typedef INT32 (CALLBACK *MFENUMPROC32)(HDC32,HANDLETABLE32*,METARECORD*,
INT32,LPARAM);
DECL_WINELIB_TYPE(MFENUMPROC); DECL_WINELIB_TYPE(MFENUMPROC);
#ifndef NOLOGERROR #ifndef NOLOGERROR
@ -4844,14 +4863,13 @@ typedef struct _MEMORY_BASIC_INFORMATION
DWORD Type; DWORD Type;
} MEMORY_BASIC_INFORMATION,*LPMEMORY_BASIC_INFORMATION; } MEMORY_BASIC_INFORMATION,*LPMEMORY_BASIC_INFORMATION;
typedef DWORD (*LPTHREAD_START_ROUTINE)(LPVOID); typedef DWORD (CALLBACK *LPTHREAD_START_ROUTINE)(LPVOID);
typedef BOOL32 (*CODEPAGE_ENUMPROC32A)(LPSTR); typedef BOOL32 (CALLBACK *CODEPAGE_ENUMPROC32A)(LPSTR);
typedef BOOL32 (*CODEPAGE_ENUMPROC32W)(LPWSTR); typedef BOOL32 (CALLBACK *CODEPAGE_ENUMPROC32W)(LPWSTR);
DECL_WINELIB_TYPE_AW(CODEPAGE_ENUMPROC); DECL_WINELIB_TYPE_AW(CODEPAGE_ENUMPROC);
typedef BOOL32 (CALLBACK *LOCALE_ENUMPROC32A)(LPSTR);
typedef BOOL32 (*LOCALE_ENUMPROC32A)(LPSTR); typedef BOOL32 (CALLBACK *LOCALE_ENUMPROC32W)(LPWSTR);
typedef BOOL32 (*LOCALE_ENUMPROC32W)(LPWSTR);
DECL_WINELIB_TYPE_AW(LOCALE_ENUMPROC); DECL_WINELIB_TYPE_AW(LOCALE_ENUMPROC);
typedef struct tagSYSTEM_INFO typedef struct tagSYSTEM_INFO
@ -4889,8 +4907,8 @@ typedef struct tagSYSTEM_INFO
#define PROCESSOR_ALPHA_21064 21064 #define PROCESSOR_ALPHA_21064 21064
/* service main function prototype */ /* service main function prototype */
typedef VOID (*LPSERVICE_MAIN_FUNCTION32A)(DWORD,LPSTR); typedef VOID (CALLBACK *LPSERVICE_MAIN_FUNCTION32A)(DWORD,LPSTR);
typedef VOID (*LPSERVICE_MAIN_FUNCTION32W)(DWORD,LPWSTR); typedef VOID (CALLBACK *LPSERVICE_MAIN_FUNCTION32W)(DWORD,LPWSTR);
DECL_WINELIB_TYPE_AW(LPSERVICE_MAIN_FUNCTION); DECL_WINELIB_TYPE_AW(LPSERVICE_MAIN_FUNCTION);
/* service start table */ /* service start table */
@ -5011,16 +5029,12 @@ DECL_WINELIB_TYPE_AW(LPSERVICE_TABLE_ENTRY);
#define PR_JOBSTATUS 0x0000 #define PR_JOBSTATUS 0x0000
typedef BOOL32 (*ENUMRESTYPEPROC32A)(HMODULE32 hModule, LPSTR type,LONG lParam); typedef BOOL32 (CALLBACK *ENUMRESTYPEPROC32A)(HMODULE32,LPSTR,LONG);
typedef BOOL32 (*ENUMRESTYPEPROC32W)(HMODULE32 hModule, LPWSTR type,LONG lParam); typedef BOOL32 (CALLBACK *ENUMRESTYPEPROC32W)(HMODULE32,LPWSTR,LONG);
typedef BOOL32 (*ENUMRESNAMEPROC32A)(HMODULE32 hModule, LPCSTR type, typedef BOOL32 (CALLBACK *ENUMRESNAMEPROC32A)(HMODULE32,LPCSTR,LPSTR,LONG);
LPSTR name,LONG lParam); typedef BOOL32 (CALLBACK *ENUMRESNAMEPROC32W)(HMODULE32,LPCWSTR,LPWSTR,LONG);
typedef BOOL32 (*ENUMRESNAMEPROC32W)(HMODULE32 hModule, LPCWSTR type, typedef BOOL32 (CALLBACK *ENUMRESLANGPROC32A)(HMODULE32,LPCSTR,LPCSTR,WORD,LONG);
LPWSTR name,LONG lParam); typedef BOOL32 (CALLBACK *ENUMRESLANGPROC32W)(HMODULE32,LPCWSTR,LPCWSTR,WORD,LONG);
typedef BOOL32 (*ENUMRESLANGPROC32A)(HMODULE32 hModule, LPCSTR type,
LPCSTR name,WORD lang,LONG lParam);
typedef BOOL32 (*ENUMRESLANGPROC32W)(HMODULE32 hModule, LPCWSTR type,
LPCWSTR name,WORD lang,LONG lParam);
DECL_WINELIB_TYPE_AW(ENUMRESTYPEPROC); DECL_WINELIB_TYPE_AW(ENUMRESTYPEPROC);
DECL_WINELIB_TYPE_AW(ENUMRESNAMEPROC); DECL_WINELIB_TYPE_AW(ENUMRESNAMEPROC);
@ -5496,6 +5510,9 @@ BOOL32 WINAPI GetMenuItemInfo32W(HMENU32,UINT32,BOOL32,MENUITEMINFO32W*);
#define GetMenuItemInfo WINELIB_NAME_AW(GetMenuItemInfo) #define GetMenuItemInfo WINELIB_NAME_AW(GetMenuItemInfo)
UINT32 WINAPI GetOEMCP(void); UINT32 WINAPI GetOEMCP(void);
DWORD WINAPI GetPriorityClass(HANDLE32); DWORD WINAPI GetPriorityClass(HANDLE32);
INT32 WINAPI GetPrivateProfileSection32A(LPCSTR,LPSTR,INT32,LPCSTR);
INT32 WINAPI GetPrivateProfileSection32W(LPCWSTR,LPWSTR,INT32,LPCWSTR);
#define GetPrivateProfileSection WINELIB_NAME_AW(GetPrivateProfileSection)
HANDLE32 WINAPI GetProcessHeap(void); HANDLE32 WINAPI GetProcessHeap(void);
DWORD WINAPI GetShortPathName32A(LPCSTR,LPSTR,DWORD); DWORD WINAPI GetShortPathName32A(LPCSTR,LPSTR,DWORD);
DWORD WINAPI GetShortPathName32W(LPCWSTR,LPWSTR,DWORD); DWORD WINAPI GetShortPathName32W(LPCWSTR,LPWSTR,DWORD);
@ -5529,7 +5546,7 @@ BOOL32 WINAPI HeapLock(HANDLE32);
LPVOID WINAPI HeapReAlloc(HANDLE32,DWORD,LPVOID,DWORD); LPVOID WINAPI HeapReAlloc(HANDLE32,DWORD,LPVOID,DWORD);
DWORD WINAPI HeapSize(HANDLE32,DWORD,LPVOID); DWORD WINAPI HeapSize(HANDLE32,DWORD,LPVOID);
BOOL32 WINAPI HeapUnlock(HANDLE32); BOOL32 WINAPI HeapUnlock(HANDLE32);
BOOL32 WINAPI HeapValidate(HANDLE32,DWORD,LPVOID); BOOL32 WINAPI HeapValidate(HANDLE32,DWORD,LPCVOID);
BOOL32 WINAPI IsDBCSLeadByteEx(UINT32,BYTE); BOOL32 WINAPI IsDBCSLeadByteEx(UINT32,BYTE);
BOOL32 WINAPI IsWindowUnicode(HWND32); BOOL32 WINAPI IsWindowUnicode(HWND32);
BOOL32 WINAPI IsValidLocale(DWORD,DWORD); BOOL32 WINAPI IsValidLocale(DWORD,DWORD);
@ -6482,6 +6499,9 @@ DWORD WINAPI GetFileVersionInfo32W(LPCWSTR,DWORD,DWORD,LPVOID);
HWND16 WINAPI GetFocus16(void); HWND16 WINAPI GetFocus16(void);
HWND32 WINAPI GetFocus32(void); HWND32 WINAPI GetFocus32(void);
#define GetFocus WINELIB_NAME(GetFocus) #define GetFocus WINELIB_NAME(GetFocus)
HWND16 WINAPI GetForegroundWindow16(void);
HWND32 WINAPI GetForegroundWindow32(void);
#define GetForegroundWindow WINELIB_NAME(GetForegroundWindow)
DWORD WINAPI GetFreeSpace16(UINT16); DWORD WINAPI GetFreeSpace16(UINT16);
#define GetFreeSpace32(w) (0x100000L) #define GetFreeSpace32(w) (0x100000L)
#define GetFreeSpace WINELIB_NAME(GetFreeSpace) #define GetFreeSpace WINELIB_NAME(GetFreeSpace)
@ -6641,6 +6661,9 @@ INT32 WINAPI GetScrollPos32(HWND32,INT32);
BOOL16 WINAPI GetScrollRange16(HWND16,INT16,LPINT16,LPINT16); BOOL16 WINAPI GetScrollRange16(HWND16,INT16,LPINT16,LPINT16);
BOOL32 WINAPI GetScrollRange32(HWND32,INT32,LPINT32,LPINT32); BOOL32 WINAPI GetScrollRange32(HWND32,INT32,LPINT32,LPINT32);
#define GetScrollRange WINELIB_NAME(GetScrollRange) #define GetScrollRange WINELIB_NAME(GetScrollRange)
HWND16 WINAPI GetShellWindow16(void);
HWND32 WINAPI GetShellWindow32(void);
#define GetShellWindow WINELIB_NAME(GetShellWindow)
HGDIOBJ16 WINAPI GetStockObject16(INT16); HGDIOBJ16 WINAPI GetStockObject16(INT16);
HGDIOBJ32 WINAPI GetStockObject32(INT32); HGDIOBJ32 WINAPI GetStockObject32(INT32);
#define GetStockObject WINELIB_NAME(GetStockObject) #define GetStockObject WINELIB_NAME(GetStockObject)
@ -7428,6 +7451,9 @@ BOOL32 WINAPI SetFileAttributes32W(LPCWSTR,DWORD);
HWND16 WINAPI SetFocus16(HWND16); HWND16 WINAPI SetFocus16(HWND16);
HWND32 WINAPI SetFocus32(HWND32); HWND32 WINAPI SetFocus32(HWND32);
#define SetFocus WINELIB_NAME(SetFocus) #define SetFocus WINELIB_NAME(SetFocus)
BOOL16 WINAPI SetForegroundWindow16(HWND16);
BOOL32 WINAPI SetForegroundWindow32(HWND32);
#define SetForegroundWindow WINELIB_NAME(SetForegroundWindow)
UINT16 WINAPI SetHandleCount16(UINT16); UINT16 WINAPI SetHandleCount16(UINT16);
UINT32 WINAPI SetHandleCount32(UINT32); UINT32 WINAPI SetHandleCount32(UINT32);
#define SetHandleCount WINELIB_NAME(SetHandleCount) #define SetHandleCount WINELIB_NAME(SetHandleCount)

View File

@ -126,6 +126,7 @@ typedef HANDLE32 HMIXEROBJ;
typedef DWORD LCID; typedef DWORD LCID;
typedef WORD LANGID; typedef WORD LANGID;
typedef DWORD LCTYPE; typedef DWORD LCTYPE;
typedef float FLOAT;
/* Pointers types. These are the same for emulator and library. */ /* Pointers types. These are the same for emulator and library. */
@ -145,6 +146,7 @@ typedef INT32 *LPINT32;
typedef UINT32 *LPUINT32; typedef UINT32 *LPUINT32;
typedef HKEY *LPHKEY; typedef HKEY *LPHKEY;
typedef HMIXEROBJ *LPHMIXEROBJ; typedef HMIXEROBJ *LPHMIXEROBJ;
typedef FLOAT *LPFLOAT;
/* Special case: a segmented pointer is just a pointer in the user's code. */ /* Special case: a segmented pointer is just a pointer in the user's code. */

View File

@ -7,7 +7,6 @@ MODULE = none
LIBMODULE = library LIBMODULE = library
LIB_SRCS = \ LIB_SRCS = \
arch.c \
libres.c \ libres.c \
miscstubs.c miscstubs.c

View File

@ -1,32 +0,0 @@
/*
* Big endian structure conversion routines
*
* Copyright Miguel de Icaza, 1994
*/
#include "arch.h"
#include "windows.h"
void ARCH_ConvBitmapInfo (BITMAPINFOHEADER *image)
{
image->biSize = CONV_LONG (image->biSize);
image->biWidth = CONV_LONG (image->biWidth);
image->biHeight = CONV_LONG (image->biHeight);
image->biPlanes = CONV_SHORT (image->biPlanes);
image->biBitCount = CONV_SHORT (image->biBitCount);
image->biCompression = CONV_LONG (image->biCompression);
image->biSizeImage = CONV_LONG (image->biSizeImage);
image->biXPelsPerMeter = CONV_LONG (image->biXPelsPerMeter);
image->biYPelsPerMeter = CONV_LONG (image->biYPelsPerMeter);
image->biClrUsed = CONV_LONG (image->biClrUsed);
image->biClrImportant = CONV_LONG (image->biClrImportant);
}
void ARCH_ConvCoreHeader (BITMAPCOREHEADER *image)
{
image->bcSize = CONV_LONG (image->bcSize);
image->bcWidth = CONV_SHORT (image->bcWidth);
image->bcHeight = CONV_SHORT (image->bcHeight);
image->bcPlanes = CONV_SHORT (image->bcPlanes);
image->bcBitCount = CONV_SHORT (image->bcBitCount);
}

View File

@ -7,10 +7,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "windows.h" #include "wintypes.h"
#include "dde_mem.h"
#include "global.h"
#include "debug.h"
/* for windows/winproc.c */ /* for windows/winproc.c */

View File

@ -417,6 +417,7 @@ HMODULE32 MODULE_CreateDummyModule( const OFSTRUCT *ofs )
NE_MODULE *pModule; NE_MODULE *pModule;
SEGTABLEENTRY *pSegment; SEGTABLEENTRY *pSegment;
char *pStr,*s; char *pStr,*s;
int len;
const char* basename; const char* basename;
INT32 of_size = sizeof(OFSTRUCT) - sizeof(ofs->szPathName) INT32 of_size = sizeof(OFSTRUCT) - sizeof(ofs->szPathName)
@ -473,19 +474,15 @@ HMODULE32 MODULE_CreateDummyModule( const OFSTRUCT *ofs )
/* Module name */ /* Module name */
pStr = (char *)pSegment; pStr = (char *)pSegment;
pModule->name_table = (int)pStr - (int)pModule; pModule->name_table = (int)pStr - (int)pModule;
/* strcpy( pStr, "\x08W32SXXXX" ); */
basename = strrchr(ofs->szPathName,'\\'); basename = strrchr(ofs->szPathName,'\\');
if (!basename) if (!basename) basename = ofs->szPathName;
basename=ofs->szPathName; else basename++;
else len = strlen(basename);
basename++; if ((s = strchr(basename,'.'))) len = s - basename;
basename=strdup(basename); if (len > 8) len = 8;
if ((s=strchr(basename,'.'))) *pStr = len;
*s='\0'; strncpy( pStr+1, basename, len );
*pStr = strlen(basename); if (len < 8) pStr[len+1] = 0;
if (*pStr>8) *pStr=8;
strncpy( pStr+1, basename, 8 );
free((void*)basename);
pStr += 9; pStr += 9;
/* All tables zero terminated */ /* All tables zero terminated */
@ -1609,7 +1606,7 @@ HINSTANCE32 WINAPI WinExec32( LPCSTR lpCmdLine, UINT32 nCmdShow )
return 2; /* File not found */ return 2; /* File not found */
if (!(cmdShowHandle = GlobalAlloc16( 0, 2 * sizeof(WORD) ))) if (!(cmdShowHandle = GlobalAlloc16( 0, 2 * sizeof(WORD) )))
return 8; /* Out of memory */ return 8; /* Out of memory */
if (!(cmdLineHandle = GlobalAlloc16( 0, 256 ))) if (!(cmdLineHandle = GlobalAlloc16( 0, 2048 )))
{ {
GlobalFree16( cmdShowHandle ); GlobalFree16( cmdShowHandle );
return 8; /* Out of memory */ return 8; /* Out of memory */
@ -1660,6 +1657,11 @@ HINSTANCE32 WINAPI WinExec32( LPCSTR lpCmdLine, UINT32 nCmdShow )
cmdline[0] = strlen( cmdline + 1 ); cmdline[0] = strlen( cmdline + 1 );
*p = '\0'; *p = '\0';
/* this is a (hopefully acceptable hack to get the whole
commandline for PROCESS_Create
we put it after the processed one */
lstrcpyn32A(cmdline + (unsigned char)cmdline[0] +2,
lpCmdLine, 2048 - 256);
/* Now load the executable file */ /* Now load the executable file */

View File

@ -18,7 +18,6 @@
#include "neexe.h" #include "neexe.h"
#include "windows.h" #include "windows.h"
#include "task.h" #include "task.h"
#include "arch.h"
#include "selectors.h" #include "selectors.h"
#include "callback.h" #include "callback.h"
#include "file.h" #include "file.h"

View File

@ -14,7 +14,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include "windows.h" #include "windows.h"
#include "arch.h"
#include "global.h" #include "global.h"
#include "ldt.h" #include "ldt.h"
#include "module.h" #include "module.h"
@ -264,11 +263,8 @@ HRSRC16 NE_FindResource( HMODULE16 hModule, SEGPTR typeId, SEGPTR resId )
if (!pModule || !pModule->res_table) return 0; if (!pModule || !pModule->res_table) return 0;
pTypeInfo = (NE_TYPEINFO *)((char *)pModule + pModule->res_table + 2); pTypeInfo = (NE_TYPEINFO *)((char *)pModule + pModule->res_table + 2);
if ((pModule->expected_version < 0x030a) && (HIWORD(typeId) || HIWORD(resId))) if (HIWORD(typeId) || HIWORD(resId))
{ {
/* Search the names in the nametable (which is not present
* since Windows 3.1). */
DWORD id = NE_FindNameTableId( pModule, typeId, resId ); DWORD id = NE_FindNameTableId( pModule, typeId, resId );
if (id) /* found */ if (id) /* found */
{ {

View File

@ -12,7 +12,6 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include "arch.h"
#include "windows.h" #include "windows.h"
#include "gdi.h" #include "gdi.h"
#include "global.h" #include "global.h"

View File

@ -434,7 +434,7 @@ HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance,
STACK16FRAME *frame16; STACK16FRAME *frame16;
STACK32FRAME *frame32; STACK32FRAME *frame32;
#ifndef WINELIB32 #ifndef WINELIB32
extern DWORD CALLTO16_RetAddr_word; extern DWORD CALLTO16_RetAddr_regs;
extern void CALLTO16_Restore(); extern void CALLTO16_Restore();
#endif #endif
@ -586,8 +586,8 @@ HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance,
pTask->ss_sp = PTR_SEG_OFF_TO_SEGPTR( hInstance, pTask->ss_sp = PTR_SEG_OFF_TO_SEGPTR( hInstance,
((pModule->sp != 0) ? pModule->sp : ((pModule->sp != 0) ? pModule->sp :
pSegTable[pModule->ss-1].minsize + pModule->stack_size) & ~1 ); pSegTable[pModule->ss-1].minsize + pModule->stack_size) & ~1 );
pTask->ss_sp -= sizeof(DWORD); /* To store saved %%esp */ pTask->ss_sp -= sizeof(STACK16FRAME) - sizeof(DWORD) /* for saved %esp */;
frame16 = (STACK16FRAME *)PTR_SEG_TO_LIN( pTask->ss_sp ) - 1; frame16 = (STACK16FRAME *)PTR_SEG_TO_LIN( pTask->ss_sp );
frame16->saved_ss_sp = 0; frame16->saved_ss_sp = 0;
frame16->ebp = 0; frame16->ebp = 0;
frame16->ds = frame16->es = pTask->hInstance; frame16->ds = frame16->es = pTask->hInstance;
@ -595,13 +595,11 @@ HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance,
frame16->entry_ip = OFFSETOF(TASK_RescheduleProc) + 14; frame16->entry_ip = OFFSETOF(TASK_RescheduleProc) + 14;
frame16->entry_cs = SELECTOROF(TASK_RescheduleProc); frame16->entry_cs = SELECTOROF(TASK_RescheduleProc);
frame16->bp = 0; frame16->bp = 0;
frame16->args[0] = LOWORD(frame32); *(DWORD *)(frame16 + 1) = frame32; /* Store the 32-bit stack pointer */
frame16->args[1] = HIWORD(frame32);
#ifndef WINELIB #ifndef WINELIB
frame16->ip = LOWORD( CALLTO16_RetAddr_word ); frame16->ip = LOWORD( CALLTO16_RetAddr_regs );
frame16->cs = HIWORD( CALLTO16_RetAddr_word ); frame16->cs = HIWORD( CALLTO16_RetAddr_regs );
#endif /* WINELIB */ #endif /* WINELIB */
pTask->ss_sp -= sizeof(STACK16FRAME);
/* If there's no 16-bit stack yet, use a part of the new task stack */ /* If there's no 16-bit stack yet, use a part of the new task stack */
/* This is only needed to have a stack to switch from on the first */ /* This is only needed to have a stack to switch from on the first */
@ -1180,14 +1178,17 @@ void WINAPI SwitchStackTo( WORD seg, WORD ptr, WORD top )
/* Switch to the new stack */ /* Switch to the new stack */
/* Note: we need to take the 3 arguments into account; otherwise,
* the stack will underflow upon return from this function.
*/
IF1632_Saved16_ss_sp = PTR_SEG_OFF_TO_SEGPTR( seg, IF1632_Saved16_ss_sp = PTR_SEG_OFF_TO_SEGPTR( seg,
ptr - sizeof(STACK16FRAME) ); ptr - sizeof(STACK16FRAME) - 3 * sizeof(WORD) );
newFrame = CURRENT_STACK16; newFrame = CURRENT_STACK16;
/* Copy the stack frame and the local variables to the new stack */ /* Copy the stack frame and the local variables to the new stack */
copySize = oldFrame->bp - OFFSETOF(pData->old_ss_sp); copySize = oldFrame->bp - OFFSETOF(pData->old_ss_sp);
memcpy( newFrame, oldFrame, MAX( copySize, sizeof(STACK16FRAME) )); memmove( newFrame, oldFrame, MAX( copySize, sizeof(STACK16FRAME) ));
} }

View File

@ -846,7 +846,7 @@ BOOL16 WINAPI MemManInfo( MEMMANINFO *info )
#define MAGIC_GLOBAL_USED 0x5342 #define MAGIC_GLOBAL_USED 0x5342
#define GLOBAL_LOCK_MAX 0xFF #define GLOBAL_LOCK_MAX 0xFF
#define HANDLE_TO_INTERN(h) (PGLOBAL32_INTERN)(((char *)(h))-2) #define HANDLE_TO_INTERN(h) ((PGLOBAL32_INTERN)(((char *)(h))-2))
#define INTERN_TO_HANDLE(i) ((HGLOBAL32) &((i)->Pointer)) #define INTERN_TO_HANDLE(i) ((HGLOBAL32) &((i)->Pointer))
#define POINTER_TO_HANDLE(p) (*(((HGLOBAL32 *)(p))-1)) #define POINTER_TO_HANDLE(p) (*(((HGLOBAL32 *)(p))-1))
#define ISHANDLE(h) (((DWORD)(h)&2)!=0) #define ISHANDLE(h) (((DWORD)(h)&2)!=0)
@ -970,7 +970,18 @@ BOOL32 WINAPI GlobalUnlock32(HGLOBAL32 hmem)
*/ */
HGLOBAL32 WINAPI GlobalHandle32(LPCVOID pmem) HGLOBAL32 WINAPI GlobalHandle32(LPCVOID pmem)
{ {
return (HGLOBAL32) POINTER_TO_HANDLE(pmem); HGLOBAL32 handle = POINTER_TO_HANDLE(pmem);
if (HEAP_IsInsideHeap( GetProcessHeap(), 0, (LPCVOID)handle ))
{
if (HANDLE_TO_INTERN(handle)->Magic == MAGIC_GLOBAL_USED)
return handle; /* valid moveable block */
}
/* maybe FIXED block */
if (HeapValidate( GetProcessHeap(), 0, pmem ))
return (HGLOBAL32)pmem; /* valid fixed block */
SetLastError( ERROR_INVALID_HANDLE );
return 0;
} }

View File

@ -1142,7 +1142,7 @@ DWORD WINAPI HeapSize( HANDLE32 heap, DWORD flags, LPVOID ptr )
/*********************************************************************** /***********************************************************************
* HeapValidate (KERNEL32.343) * HeapValidate (KERNEL32.343)
*/ */
BOOL32 WINAPI HeapValidate( HANDLE32 heap, DWORD flags, LPVOID block ) BOOL32 WINAPI HeapValidate( HANDLE32 heap, DWORD flags, LPCVOID block )
{ {
SUBHEAP *subheap; SUBHEAP *subheap;
HEAP *heapPtr = (HEAP *)heap; HEAP *heapPtr = (HEAP *)heap;

View File

@ -11,6 +11,7 @@ C_SRCS = \
compobj.c \ compobj.c \
crtdll.c \ crtdll.c \
cpu.c \ cpu.c \
ddeml.c \
error.c \ error.c \
lstr.c \ lstr.c \
lzexpand.c \ lzexpand.c \

View File

@ -1112,15 +1112,15 @@ LRESULT WINAPI ReplaceTextDlgProc(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam,
/*********************************************************************** /***********************************************************************
* PrintDlg (COMMDLG.20) * PrintDlg16 (COMMDLG.20)
*/ */
BOOL16 WINAPI PrintDlg( SEGPTR printdlg ) BOOL16 WINAPI PrintDlg16( SEGPTR printdlg )
{ {
HANDLE16 hInst; HANDLE16 hInst;
BOOL16 bRet = FALSE; BOOL16 bRet = FALSE;
LPCVOID template; LPCVOID template;
HWND32 hwndDialog; HWND32 hwndDialog;
LPPRINTDLG lpPrint = (LPPRINTDLG)PTR_SEG_TO_LIN(printdlg); LPPRINTDLG16 lpPrint = (LPPRINTDLG16)PTR_SEG_TO_LIN(printdlg);
dprintf_commdlg(stddeb,"PrintDlg(%p) // Flags=%08lX\n", lpPrint, lpPrint->Flags ); dprintf_commdlg(stddeb,"PrintDlg(%p) // Flags=%08lX\n", lpPrint, lpPrint->Flags );
@ -1145,6 +1145,26 @@ BOOL16 WINAPI PrintDlg( SEGPTR printdlg )
} }
/***********************************************************************
* PrintDlg32A (COMDLG32.17)
*/
BOOL32 WINAPI PrintDlg32A( LPPRINTDLG32A printdlg )
{
fprintf( stdnimp, "PrintDlg32A: empty stub\n" );
return FALSE;
}
/***********************************************************************
* PrintDlg32W (COMDLG32.18)
*/
BOOL32 WINAPI PrintDlg32W( LPPRINTDLG32W printdlg )
{
fprintf( stdnimp, "PrintDlg32A: empty stub\n" );
return FALSE;
}
/*********************************************************************** /***********************************************************************
* PrintDlgProc (COMMDLG.21) * PrintDlgProc (COMMDLG.21)
*/ */

View File

@ -39,6 +39,8 @@ Unresolved issues Uwe Bonnes 970904:
#include "crtdll.h" #include "crtdll.h"
#include "drive.h" #include "drive.h"
#include "file.h" #include "file.h"
#include "except.h"
#include "options.h"
extern int FILE_GetUnixHandle( HFILE32 ); extern int FILE_GetUnixHandle( HFILE32 );
@ -52,9 +54,12 @@ LPSTR CRTDLL_acmdln_dll; /* CRTDLL.38 */
UINT32 CRTDLL_basemajor_dll; /* CRTDLL.42 */ UINT32 CRTDLL_basemajor_dll; /* CRTDLL.42 */
UINT32 CRTDLL_baseminor_dll; /* CRTDLL.43 */ UINT32 CRTDLL_baseminor_dll; /* CRTDLL.43 */
UINT32 CRTDLL_baseversion_dll; /* CRTDLL.44 */ UINT32 CRTDLL_baseversion_dll; /* CRTDLL.44 */
UINT32 CRTDLL_commode_dll; /* CRTDLL.59 */
LPSTR CRTDLL_environ_dll; /* CRTDLL.75 */ LPSTR CRTDLL_environ_dll; /* CRTDLL.75 */
UINT32 CRTDLL_fmode_dll; /* CRTDLL.104 */
UINT32 CRTDLL_osmajor_dll; /* CRTDLL.241 */ UINT32 CRTDLL_osmajor_dll; /* CRTDLL.241 */
UINT32 CRTDLL_osminor_dll; /* CRTDLL.242 */ UINT32 CRTDLL_osminor_dll; /* CRTDLL.242 */
UINT32 CRTDLL_osmode_dll; /* CRTDLL.243 */
UINT32 CRTDLL_osver_dll; /* CRTDLL.244 */ UINT32 CRTDLL_osver_dll; /* CRTDLL.244 */
UINT32 CRTDLL_osversion_dll; /* CRTDLL.245 */ UINT32 CRTDLL_osversion_dll; /* CRTDLL.245 */
UINT32 CRTDLL_winmajor_dll; /* CRTDLL.329 */ UINT32 CRTDLL_winmajor_dll; /* CRTDLL.329 */
@ -171,6 +176,29 @@ DWORD __cdecl CRTDLL__fdopen(INT32 handle, LPCSTR mode)
return (DWORD)file; return (DWORD)file;
} }
/*******************************************************************
* _global_unwind2 (CRTDLL.129)
*/
void __cdecl CRTDLL__global_unwind2( CONTEXT *context )
{
/* Retrieve the arguments (args[0] is return addr, args[1] is first arg) */
DWORD *args = (DWORD *)ESP_reg(context);
RtlUnwind( (PEXCEPTION_FRAME)args[1], (LPVOID)EIP_reg(context),
NULL, 0, context );
}
/*******************************************************************
* _local_unwind2 (CRTDLL.173)
*/
void __cdecl CRTDLL__local_unwind2( CONTEXT *context )
{
/* Retrieve the arguments (args[0] is return addr, args[1] is first arg) */
DWORD *args = (DWORD *)ESP_reg(context);
PEXCEPTION_FRAME endframe = (PEXCEPTION_FRAME)args[1];
DWORD nr = args[2];
fprintf(stderr,"CRTDLL__local_unwind2(%p,%ld)\n",endframe,nr);
}
/********************************************************************* /*********************************************************************
* fopen (CRTDLL.372) * fopen (CRTDLL.372)
*/ */
@ -700,10 +728,14 @@ LPSTR CRTDLL__strlwr(LPSTR x)
INT32 CRTDLL_system(LPSTR x) INT32 CRTDLL_system(LPSTR x)
{ {
#define SYSBUF_LENGTH 1500 #define SYSBUF_LENGTH 1500
char buffer[SYSBUF_LENGTH]="wine \""; char buffer[SYSBUF_LENGTH];
unsigned char *y = x; unsigned char *y = x;
unsigned char *bp =buffer+strlen(buffer); unsigned char *bp;
int i =strlen(buffer) + strlen(x) +2; int i;
sprintf( buffer, "%s \"", Options.argv0 );
bp = buffer + strlen(buffer);
i = strlen(buffer) + strlen(x) +2;
/* Calculate needed buffer size tp prevent overflow*/ /* Calculate needed buffer size tp prevent overflow*/
while (*y) { while (*y) {
@ -854,7 +886,7 @@ LPSTR __cdecl CRTDLL__strdup(LPSTR ptr)
INT32 __cdecl CRTDLL_fclose( FILE *stream ) INT32 __cdecl CRTDLL_fclose( FILE *stream )
{ {
int unix_handle=fileno(stream); int unix_handle=fileno(stream);
HFILE32 dos_handle=3; HFILE32 dos_handle=1;
HFILE32 ret=EOF; HFILE32 ret=EOF;
if (unix_handle<4) ret= fclose(stream); if (unix_handle<4) ret= fclose(stream);

268
misc/ddeml.c Normal file
View File

@ -0,0 +1,268 @@
/*
* DDEML library
*
* Copyright 1997 Alexandre Julliard
*/
/* Only empty stubs for now */
#include <stdio.h>
#include "ddeml.h"
#include "stddebug.h"
#include "debug.h"
/*****************************************************************
* DdeInitialize16 (DDEML.2)
*/
UINT16 WINAPI DdeInitialize16( LPDWORD pidInst, PFNCALLBACK16 pfnCallback,
DWORD afCmd, DWORD ulRes)
{
fprintf( stdnimp, "DdeInitialize16: empty stub\n" );
return 0;
}
/*****************************************************************
* DdeInitialize32A (USER32.106)
*/
UINT32 WINAPI DdeInitialize32A( LPDWORD pidInst, PFNCALLBACK32 pfnCallback,
DWORD afCmd, DWORD ulRes )
{
fprintf( stdnimp, "DdeInitialize32A: empty stub\n" );
return 0;
}
/*****************************************************************
* DdeInitialize32W (USER32.107)
*/
UINT32 WINAPI DdeInitialize32W( LPDWORD pidInst, PFNCALLBACK32 pfnCallback,
DWORD afCmd, DWORD ulRes )
{
fprintf( stdnimp, "DdeInitialize32W: empty stub\n" );
return 0;
}
/*****************************************************************
* DdeUninitialize16 (DDEML.3)
*/
BOOL16 WINAPI DdeUninitialize16( DWORD idInst )
{
return (BOOL16)DdeUninitialize32( idInst );
}
/*****************************************************************
* DdeUninitialize32 (USER32.119)
*/
BOOL32 WINAPI DdeUninitialize32( DWORD idInst )
{
fprintf( stdnimp, "DdeUninitialize: empty stub\n" );
return TRUE;
}
/*****************************************************************
* DdeConnect16 (DDEML.7)
*/
HCONV WINAPI DdeConnect16( DWORD idInst, HSZ hszService, HSZ hszTopic,
LPCONVCONTEXT16 pCC )
{
fprintf( stdnimp, "DdeConnect16: empty stub\n" );
return 0;
}
/*****************************************************************
* DdeConnect32 (USER32.92)
*/
HCONV WINAPI DdeConnect32( DWORD idInst, HSZ hszService, HSZ hszTopic,
LPCONVCONTEXT32 pCC )
{
fprintf( stdnimp, "DdeConnect32: empty stub\n" );
return 0;
}
/*****************************************************************
* DdeDisconnect16 (DDEML.8)
*/
BOOL16 WINAPI DdeDisconnect16( HCONV hConv )
{
return (BOOL16)DdeDisconnect32( hConv );
}
/*****************************************************************
* DdeDisconnect32 (USER32.97)
*/
BOOL32 WINAPI DdeDisconnect32( HCONV hConv )
{
fprintf( stdnimp, "DdeDisconnect: empty stub\n" );
return 0;
}
/*****************************************************************
* DdeReconnect (DDEML.37) (USER32.115)
*/
HCONV WINAPI DdeReconnect( HCONV hConv )
{
fprintf( stdnimp, "DdeReconnect: empty stub\n" );
return 0;
}
/*****************************************************************
* DdeCreateStringHandle16 (DDEML.21)
*/
HSZ WINAPI DdeCreateStringHandle16( DWORD idInst, LPCSTR str, INT16 codepage )
{
return DdeCreateStringHandle32A( idInst, str, codepage );
}
/*****************************************************************
* DdeCreateStringHandle32A (USER32.95)
*/
HSZ WINAPI DdeCreateStringHandle32A( DWORD idInst, LPCSTR psz, INT32 codepage )
{
fprintf( stdnimp, "DdeCreateStringHandle32A: empty stub\n" );
return 0;
}
/*****************************************************************
* DdeCreateStringHandle32W (USER32.96)
*/
HSZ WINAPI DdeCreateStringHandle32W( DWORD idInst, LPCWSTR psz, INT32 codepage)
{
fprintf( stdnimp, "DdeCreateStringHandle32W: empty stub\n" );
return 0;
}
/*****************************************************************
* DdeFreeStringHandle16 (DDEML.22)
*/
BOOL16 WINAPI DdeFreeStringHandle16( DWORD idInst, HSZ hsz )
{
return (BOOL32)DdeFreeStringHandle32( idInst, hsz );
}
/*****************************************************************
* DdeFreeStringHandle32 (USER32.101)
*/
BOOL32 WINAPI DdeFreeStringHandle32( DWORD idInst, HSZ hsz )
{
fprintf( stdnimp, "DdeFreeStringHandle: empty stub\n" );
return TRUE;
}
/*****************************************************************
* DdeFreeDataHandle16 (DDEML.19)
*/
BOOL16 WINAPI DdeFreeDataHandle16( HDDEDATA hData )
{
return (BOOL32)DdeFreeDataHandle32( hData );
}
/*****************************************************************
* DdeFreeDataHandle32 (USER32.100)
*/
BOOL32 WINAPI DdeFreeDataHandle32( HDDEDATA hData )
{
fprintf( stdnimp, "DdeFreeDataHandle: empty stub\n" );
return TRUE;
}
/*****************************************************************
* DdeKeepStringHandle16 (DDEML.24)
*/
BOOL16 WINAPI DdeKeepStringHandle16( DWORD idInst, HSZ hsz )
{
return (BOOL32)DdeKeepStringHandle32( idInst, hsz );
}
/*****************************************************************
* DdeKeepStringHandle32 (USER32.108)
*/
BOOL32 WINAPI DdeKeepStringHandle32( DWORD idInst, HSZ hsz )
{
fprintf( stdnimp, "DdeKeepStringHandle: empty stub\n" );
return TRUE;
}
/*****************************************************************
* DdeClientTransaction16 (DDEML.11)
*/
HDDEDATA WINAPI DdeClientTransaction16( LPVOID pData, DWORD cbData,
HCONV hConv, HSZ hszItem, UINT16 wFmt,
UINT16 wType, DWORD dwTimeout,
LPDWORD pdwResult )
{
return DdeClientTransaction32( (LPBYTE)pData, cbData, hConv, hszItem,
wFmt, wType, dwTimeout, pdwResult );
}
/*****************************************************************
* DdeClientTransaction32 (USER32.90)
*/
HDDEDATA WINAPI DdeClientTransaction32( LPBYTE pData, DWORD cbData,
HCONV hConv, HSZ hszItem, UINT32 wFmt,
UINT32 wType, DWORD dwTimeout,
LPDWORD pdwResult )
{
fprintf( stdnimp, "DdeClientTransaction: empty stub\n" );
return 0;
}
/*****************************************************************
* DdeNameService16 (DDEML.27)
*/
HDDEDATA WINAPI DdeNameService16( DWORD idInst, HSZ hsz1, HSZ hsz2,
UINT16 afCmd )
{
return DdeNameService32( idInst, hsz1, hsz2, afCmd );
}
/*****************************************************************
* DdeNameService32 (USER32.109)
*/
HDDEDATA WINAPI DdeNameService32( DWORD idInst, HSZ hsz1, HSZ hsz2,
UINT32 afCmd )
{
fprintf( stdnimp, "DdeNameService: empty stub\n" );
return 0;
}
/*****************************************************************
* DdeGetLastError16 (DDEML.20)
*/
UINT16 WINAPI DdeGetLastError16( DWORD idInst )
{
return (UINT16)DdeGetLastError32( idInst );
}
/*****************************************************************
* DdeGetLastError32 (USER32.103)
*/
UINT32 WINAPI DdeGetLastError32( DWORD idInst )
{
fprintf( stdnimp, "DdeGetLastError: empty stub\n" );
return 0;
}

View File

@ -132,7 +132,7 @@ SEGPTR WINAPI AnsiPrev16( SEGPTR start, SEGPTR current )
void WINAPI OutputDebugString16( LPCSTR str ) void WINAPI OutputDebugString16( LPCSTR str )
{ {
char *module; char *module;
char *p, *buffer = HeapAlloc( GetProcessHeap(), 0, strlen(str)+1 ); char *p, *buffer = HeapAlloc( GetProcessHeap(), 0, strlen(str)+2 );
/* Remove CRs */ /* Remove CRs */
for (p = buffer; *str; str++) if (*str != '\r') *p++ = *str; for (p = buffer; *str; str++) if (*str != '\r') *p++ = *str;
*p = '\0'; *p = '\0';

View File

@ -205,6 +205,7 @@ struct options Options =
{ /* default options */ { /* default options */
NULL, /* desktopGeometry */ NULL, /* desktopGeometry */
NULL, /* programName */ NULL, /* programName */
NULL, /* argv0 */
FALSE, /* usePrivateMap */ FALSE, /* usePrivateMap */
FALSE, /* useFixedMap */ FALSE, /* useFixedMap */
FALSE, /* synchronous */ FALSE, /* synchronous */
@ -484,6 +485,7 @@ static void MAIN_ParseOptions( int *argc, char *argv[] )
char *xrm_string; char *xrm_string;
Options.programName = MAIN_GetProgramName( *argc, argv ); Options.programName = MAIN_GetProgramName( *argc, argv );
Options.argv0 = argv[0];
/* Get display name from command line */ /* Get display name from command line */
for (i = 1; i < *argc - 1; i++) for (i = 1; i < *argc - 1; i++)

View File

@ -510,27 +510,12 @@ DWORD WINAPI NtOpenFile(DWORD x1,DWORD flags,DWORD x3,DWORD x4,DWORD alignment,D
/* returns file io completion status */ /* returns file io completion status */
return 0; return 0;
} }
/*
These functions were originally in CRTDLL. CRTFLL now call the C-Lib
function directly. So they were moved here
*/
/*********************************************************************
* atoi (NDLL.885) /**************************************************************************
* NTDLL_chkstk (NTDLL.862)
*/ */
INT32 NTDLL_atoi(LPCSTR x) void NTDLL_chkstk(void)
{ {
if (!x) return 0; /* FIXME: should subtract %eax bytes from stack pointer */
return atoi(x);
} }
/*********************************************************************
* atol (NTDLL.886)
*/
LONG NTDLL_atol(LPCSTR x)
{
if (!x) return 0;
return atol(x);
}

View File

@ -22,7 +22,7 @@ DWORD WINAPI OleBuildVersion()
} }
/*********************************************************************** /***********************************************************************
* OleInitialize [OLE2.2] * OleInitialize (OLE2.2) (OLE32.108)
*/ */
HRESULT WINAPI OleInitialize(LPVOID reserved) HRESULT WINAPI OleInitialize(LPVOID reserved)
{ {
@ -31,9 +31,9 @@ HRESULT WINAPI OleInitialize(LPVOID reserved)
} }
/*********************************************************************** /***********************************************************************
* OleUnitialize [OLE2.3] * OleUnitialize (OLE2.3) (OLE32.131)
*/ */
void WINAPI OleUninitialize() void WINAPI OleUninitialize(void)
{ {
dprintf_ole(stdnimp,"OleUninitialize()\n"); dprintf_ole(stdnimp,"OleUninitialize()\n");
} }

View File

@ -1048,3 +1048,8 @@ void WINAPI Control_RunDLL(DWORD a1,DWORD a2,LPSTR a3,DWORD a4) {
a1,a2,a3,a4 a1,a2,a3,a4
); );
} }
void WINAPI FreeIconList( DWORD dw )
{
fprintf( stdnimp, "FreeIconList: empty stub\n" );
}

View File

@ -416,7 +416,8 @@ DWORD WINAPI GetFileResourceSize(LPCSTR filename,SEGPTR restype,SEGPTR resid,
HFILE32 lzfd; HFILE32 lzfd;
OFSTRUCT ofs; OFSTRUCT ofs;
BYTE *resdata = NULL; BYTE *resdata = NULL;
int reslen,res; int reslen=0;
int res=0;
dprintf_ver(stddeb,"GetFileResourceSize(%s,%lx,%lx,%p)\n", dprintf_ver(stddeb,"GetFileResourceSize(%s,%lx,%lx,%p)\n",
filename,(LONG)restype,(LONG)resid,off filename,(LONG)restype,(LONG)resid,off
@ -452,7 +453,8 @@ DWORD WINAPI GetFileResource(LPCSTR filename,SEGPTR restype,SEGPTR resid,
HFILE32 lzfd; HFILE32 lzfd;
OFSTRUCT ofs; OFSTRUCT ofs;
BYTE *resdata=NULL; BYTE *resdata=NULL;
int res,reslen=datalen; int res=0;
int reslen=datalen;
dprintf_ver(stddeb,"GetFileResource(%s,%lx,%lx,%ld,%ld,%p)\n", dprintf_ver(stddeb,"GetFileResource(%s,%lx,%lx,%ld,%ld,%p)\n",
filename,(LONG)restype,(LONG)resid,off,datalen,data filename,(LONG)restype,(LONG)resid,off,datalen,data
@ -1196,7 +1198,7 @@ _find_dataA(BYTE *block,LPCSTR str, WORD buff_remain) {
} }
/* this one used for Win32 resources, which are always in UNICODE format */ /* this one used for Win32 resources, which are always in UNICODE format */
extern LPWSTR CRTDLL_wcschr(LPWSTR str,WCHAR xchar); extern LPWSTR CRTDLL_wcschr(LPCWSTR str,WCHAR xchar);
static BYTE* static BYTE*
_find_dataW(BYTE *block,LPCWSTR str, WORD buff_remain) { _find_dataW(BYTE *block,LPCWSTR str, WORD buff_remain) {
LPWSTR nextslash; LPWSTR nextslash;

View File

@ -629,6 +629,9 @@ INT32 WINAPI WINSOCK_connect32(SOCKET32 s, struct sockaddr *name, INT32 namelen)
/* application did AsyncSelect() but then went /* application did AsyncSelect() but then went
* ahead and called connect() without waiting for * ahead and called connect() without waiting for
* notification. * notification.
*
* FIXME: Do we have to post a notification message
* in this case?
*/ */
if( !(pws->flags & WS_FD_CONNECTED) ) if( !(pws->flags & WS_FD_CONNECTED) )
@ -641,10 +644,10 @@ INT32 WINAPI WINSOCK_connect32(SOCKET32 s, struct sockaddr *name, INT32 namelen)
EVENT_AddIO( pws->fd, EVENT_IO_WRITE ); EVENT_AddIO( pws->fd, EVENT_IO_WRITE );
else else
EVENT_DeleteIO( pws->fd, EVENT_IO_WRITE ); EVENT_DeleteIO( pws->fd, EVENT_IO_WRITE );
}
}
pws->flags |= WS_FD_CONNECTED; pws->flags |= WS_FD_CONNECTED;
} pws->flags &= ~(WS_FD_INACTIVE | WS_FD_CONNECT | WS_FD_LISTENING);
}
pws->flags &= ~(WS_FD_INACTIVE | WS_FD_CONNECT);
return 0; return 0;
} }
pwsi->err = (errno == EINPROGRESS) ? WSAEWOULDBLOCK : wsaErrno(); pwsi->err = (errno == EINPROGRESS) ? WSAEWOULDBLOCK : wsaErrno();
@ -898,15 +901,18 @@ INT32 WINAPI WINSOCK_listen32(SOCKET32 s, INT32 backlog)
dprintf_winsock(stddeb, "WS_LISTEN(%08x): socket %04x, backlog %d\n", dprintf_winsock(stddeb, "WS_LISTEN(%08x): socket %04x, backlog %d\n",
(unsigned)pwsi, s, backlog); (unsigned)pwsi, s, backlog);
if( _check_ws(pwsi, pws) ) if( _check_ws(pwsi, pws) )
{
if (listen(pws->fd, backlog) == 0)
{ {
if( !pws->psop ) if( !pws->psop )
{ {
int fd_flags = fcntl(pws->fd, F_GETFL, 0); int fd_flags = fcntl(pws->fd, F_GETFL, 0);
if( !(fd_flags & O_NONBLOCK) ) pws->flags |= WS_FD_ACCEPT; if( !(fd_flags & O_NONBLOCK) ) pws->flags |= WS_FD_ACCEPT;
} }
else if( !(pws->flags & WS_FD_CONNECTED) ) pws->flags |= WS_FD_LISTENING; pws->flags |= WS_FD_LISTENING;
pws->flags &= ~(WS_FD_INACTIVE | WS_FD_CONNECTED); /* just in case */
if (listen(pws->fd, backlog) == 0) return 0; return 0;
}
pwsi->err = wsaErrno(); pwsi->err = wsaErrno();
} }
else if( pwsi ) pwsi->err = WSAENOTSOCK; else if( pwsi ) pwsi->err = WSAENOTSOCK;
@ -1816,6 +1822,9 @@ BOOL32 WINSOCK_HandleIO( int* max_fd, int num_pending, fd_set io_set[3] )
if((flags & WS_FD_ACCEPT) && (flags & WS_FD_LISTENING)) if((flags & WS_FD_ACCEPT) && (flags & WS_FD_LISTENING))
{ {
/* WS_FD_ACCEPT is valid only if the socket is in the
* listening state */
FD_CLR( fd, &io_set[EVENT_IO_WRITE] ); FD_CLR( fd, &io_set[EVENT_IO_WRITE] );
if( r ) if( r )
{ {

View File

@ -10,6 +10,8 @@
#include "windows.h" #include "windows.h"
#include "ldt.h" #include "ldt.h"
#include "stackframe.h" #include "stackframe.h"
#include "debug.h"
#include "stddebug.h"
#define WPRINTF_LEFTALIGN 0x0001 /* Align output on the left ('-' prefix) */ #define WPRINTF_LEFTALIGN 0x0001 /* Align output on the left ('-' prefix) */
#define WPRINTF_PREFIX_HEX 0x0002 /* Prefix hex with 0x ('#' prefix) */ #define WPRINTF_PREFIX_HEX 0x0002 /* Prefix hex with 0x ('#' prefix) */
@ -249,35 +251,27 @@ INT16 WINAPI wvsnprintf16( LPSTR buffer, UINT16 maxlen, LPCSTR spec,
{ {
case WPR_WCHAR: /* No Unicode in Win16 */ case WPR_WCHAR: /* No Unicode in Win16 */
case WPR_CHAR: case WPR_CHAR:
cur_arg = (DWORD)*(CHAR *)args; cur_arg = (DWORD)VA_ARG16( args, CHAR );
args = (WORD *)args + 1;
break; break;
case WPR_WSTRING: /* No Unicode in Win16 */ case WPR_WSTRING: /* No Unicode in Win16 */
case WPR_STRING: case WPR_STRING:
if (IsBadReadPtr16( *(SEGPTR *)args, 1 )) cur_arg = (DWORD)""; cur_arg = (DWORD)VA_ARG16( args, SEGPTR );
else cur_arg = (DWORD)PTR_SEG_TO_LIN( *(SEGPTR *)args ); if (IsBadReadPtr16( (SEGPTR)cur_arg, 1 )) cur_arg = (DWORD)"";
args = (SEGPTR *)args + 1; else cur_arg = (DWORD)PTR_SEG_TO_LIN( (SEGPTR)cur_arg );
break; break;
case WPR_SIGNED: case WPR_SIGNED:
if (!(format.flags & WPRINTF_LONG)) if (!(format.flags & WPRINTF_LONG))
{ {
cur_arg = (DWORD)(INT32)*(INT16 *)args; cur_arg = (DWORD)(INT32)VA_ARG16( args, INT16 );
args = (INT16 *)args + 1;
break; break;
} }
/* fall through */ /* fall through */
case WPR_HEXA: case WPR_HEXA:
case WPR_UNSIGNED: case WPR_UNSIGNED:
if (format.flags & WPRINTF_LONG) if (format.flags & WPRINTF_LONG)
{ cur_arg = (DWORD)VA_ARG16( args, UINT32 );
cur_arg = (DWORD)*(UINT32 *)args;
args = (UINT32 *)args + 1;
}
else else
{ cur_arg = (DWORD)VA_ARG16( args, UINT16 );
cur_arg = (DWORD)*(UINT16 *)args;
args = (UINT16 *)args + 1;
}
break; break;
} }
len = WPRINTF_GetLen( &format, &cur_arg, number, maxlen - 1 ); len = WPRINTF_GetLen( &format, &cur_arg, number, maxlen - 1 );
@ -286,11 +280,13 @@ INT16 WINAPI wvsnprintf16( LPSTR buffer, UINT16 maxlen, LPCSTR spec,
*p++ = ' '; *p++ = ' ';
switch(format.type) switch(format.type)
{ {
case WPR_WCHAR:
case WPR_CHAR: case WPR_CHAR:
if ((*p = (CHAR)cur_arg)) p++; if ((*p = (CHAR)cur_arg)) p++;
else if (format.width > 1) *p++ = ' '; else if (format.width > 1) *p++ = ' ';
else len = 0; else len = 0;
break; break;
case WPR_WSTRING:
case WPR_STRING: case WPR_STRING:
if (len) memcpy( p, (LPCSTR)cur_arg, len ); if (len) memcpy( p, (LPCSTR)cur_arg, len );
p += len; p += len;
@ -312,10 +308,6 @@ INT16 WINAPI wvsnprintf16( LPSTR buffer, UINT16 maxlen, LPCSTR spec,
if (len) memcpy( p, number, len ); if (len) memcpy( p, number, len );
p += len; p += len;
break; break;
case WPR_WCHAR:
case WPR_WSTRING:
fprintf( stderr, "Unicode not supported in wsprintf16\n" );
break;
} }
if (format.flags & WPRINTF_LEFTALIGN) if (format.flags & WPRINTF_LEFTALIGN)
for (i = format.precision; i < format.width; i++, maxlen--) for (i = format.precision; i < format.width; i++, maxlen--)
@ -361,7 +353,7 @@ INT32 WINAPI wvsnprintf32A( LPSTR buffer, UINT32 maxlen, LPCSTR spec,
else len = 0; else len = 0;
break; break;
case WPR_STRING: case WPR_STRING:
if (len) memcpy( p, va_arg( args, LPCSTR ), len ); memcpy( p, va_arg( args, LPCSTR ), len );
p += len; p += len;
break; break;
case WPR_WSTRING: case WPR_WSTRING:
@ -384,7 +376,7 @@ INT32 WINAPI wvsnprintf32A( LPSTR buffer, UINT32 maxlen, LPCSTR spec,
case WPR_SIGNED: case WPR_SIGNED:
case WPR_UNSIGNED: case WPR_UNSIGNED:
for (i = len; i < format.precision; i++, maxlen--) *p++ = '0'; for (i = len; i < format.precision; i++, maxlen--) *p++ = '0';
if (len) memcpy( p, number, len ); memcpy( p, number, len );
p += len; p += len;
(void)va_arg( args, INT32 ); /* Go to the next arg */ (void)va_arg( args, INT32 ); /* Go to the next arg */
break; break;
@ -395,6 +387,7 @@ INT32 WINAPI wvsnprintf32A( LPSTR buffer, UINT32 maxlen, LPCSTR spec,
maxlen -= len; maxlen -= len;
} }
*p = 0; *p = 0;
dprintf_string(stddeb,"%s\n",buffer);
return (maxlen > 1) ? (INT32)(p - buffer) : -1; return (maxlen > 1) ? (INT32)(p - buffer) : -1;
} }
@ -475,6 +468,7 @@ INT32 WINAPI wvsnprintf32W( LPWSTR buffer, UINT32 maxlen, LPCWSTR spec,
*/ */
INT16 WINAPI wvsprintf16( LPSTR buffer, LPCSTR spec, LPCVOID args ) INT16 WINAPI wvsprintf16( LPSTR buffer, LPCSTR spec, LPCVOID args )
{ {
dprintf_string(stddeb,"wvsprintf16 for %p got ",buffer);
return wvsnprintf16( buffer, 0xffff, spec, args ); return wvsnprintf16( buffer, 0xffff, spec, args );
} }
@ -484,6 +478,7 @@ INT16 WINAPI wvsprintf16( LPSTR buffer, LPCSTR spec, LPCVOID args )
*/ */
INT32 WINAPI wvsprintf32A( LPSTR buffer, LPCSTR spec, va_list args ) INT32 WINAPI wvsprintf32A( LPSTR buffer, LPCSTR spec, va_list args )
{ {
dprintf_string(stddeb,"wvsprintf32A for %p got ",buffer);
return wvsnprintf32A( buffer, 0xffffffff, spec, args ); return wvsnprintf32A( buffer, 0xffffffff, spec, args );
} }
@ -493,6 +488,7 @@ INT32 WINAPI wvsprintf32A( LPSTR buffer, LPCSTR spec, va_list args )
*/ */
INT32 WINAPI wvsprintf32W( LPWSTR buffer, LPCWSTR spec, va_list args ) INT32 WINAPI wvsprintf32W( LPWSTR buffer, LPCWSTR spec, va_list args )
{ {
dprintf_string(stddeb,"wvsprintf32W for %p got ",buffer);
return wvsnprintf32W( buffer, 0xffffffff, spec, args ); return wvsnprintf32W( buffer, 0xffffffff, spec, args );
} }
@ -506,9 +502,10 @@ INT16 WINAPIV wsprintf16( LPSTR buffer, LPCSTR spec, ... )
va_list valist; va_list valist;
INT16 res; INT16 res;
dprintf_string(stddeb,"wsprintf16 for %p got ",buffer);
va_start( valist, spec ); va_start( valist, spec );
/* Note: we call the 32-bit version, because the args are 32-bit */ /* Note: we call the 32-bit version, because the args are 32-bit */
res = (INT16)wvsprintf32A( buffer, spec, valist ); res = (INT16)wvsnprintf32A( buffer, 0xffffffff, spec, valist );
va_end( valist ); va_end( valist );
return res; return res;
} }
@ -516,11 +513,18 @@ INT16 WINAPIV wsprintf16( LPSTR buffer, LPCSTR spec, ... )
/* Emulator version */ /* Emulator version */
INT16 WINAPIV WIN16_wsprintf16(void) INT16 WINAPIV WIN16_wsprintf16(void)
{ {
SEGPTR *win_stack = (SEGPTR *)CURRENT_STACK16->args; VA_LIST16 valist;
LPSTR buffer = (LPSTR)PTR_SEG_TO_LIN(win_stack[0]); INT16 res;
LPCSTR spec = (LPCSTR)PTR_SEG_TO_LIN(win_stack[1]); SEGPTR buffer, spec;
return wvsprintf16( buffer, spec, &win_stack[2] );
VA_START16( valist );
buffer = VA_ARG16( valist, SEGPTR );
spec = VA_ARG16( valist, SEGPTR );
dprintf_string(stddeb,"WIN16_wsprintf16 got ");
res = wvsnprintf16( (LPSTR)PTR_SEG_TO_LIN(buffer), 0xffff,
(LPCSTR)PTR_SEG_TO_LIN(spec), valist );
VA_END16( valist );
return res;
} }
@ -532,8 +536,9 @@ INT32 WINAPIV wsprintf32A( LPSTR buffer, LPCSTR spec, ... )
va_list valist; va_list valist;
INT32 res; INT32 res;
dprintf_string(stddeb,"wsprintf32A for %p got ",buffer);
va_start( valist, spec ); va_start( valist, spec );
res = wvsprintf32A( buffer, spec, valist ); res = wvsnprintf32A( buffer, 0xffffffff, spec, valist );
va_end( valist ); va_end( valist );
return res; return res;
} }
@ -547,8 +552,9 @@ INT32 WINAPIV wsprintf32W( LPWSTR buffer, LPCWSTR spec, ... )
va_list valist; va_list valist;
INT32 res; INT32 res;
dprintf_string(stddeb,"wsprintf32W for %p\n",buffer);
va_start( valist, spec ); va_start( valist, spec );
res = wvsprintf32W( buffer, spec, valist ); res = wvsnprintf32W( buffer, 0xffffffff, spec, valist );
va_end( valist ); va_end( valist );
return res; return res;
} }

View File

@ -12,6 +12,7 @@ C_SRCS = \
int11.c \ int11.c \
int12.c \ int12.c \
int13.c \ int13.c \
int15.c \
int1a.c \ int1a.c \
int21.c \ int21.c \
int25.c \ int25.c \

29
msdos/int15.c Normal file
View File

@ -0,0 +1,29 @@
/*
* BIOS interrupt 15h handler
*/
#include <stdio.h>
#include <stdlib.h>
#include "miscemu.h"
#include "stddebug.h"
#include "debug.h"
/**********************************************************************
* INT_Int15Handler
*
* Handler for int 15h (old cassette interrupt).
*/
void WINAPI INT_Int15Handler( CONTEXT *context )
{
switch(AH_reg(context))
{
case 0x88: /* get size of memory above 1 M */
AX_reg(context) = 64; /* FIXME: are 64K ok? */
RESET_CFLAG(context);
break;
default:
INT_BARF( context, 0x15 );
}
}

View File

@ -42,12 +42,16 @@ static BYTE cmosimage[64] =
#endif /* linux && __i386__ */ #endif /* linux && __i386__ */
#ifdef DIRECT_IO_ACCESS #ifdef DIRECT_IO_ACCESS
extern int iopl(int level);
static char do_direct_port_access = 0; static char do_direct_port_access = 0;
static char port_permissions[0x10000]; static char port_permissions[0x10000];
#define IO_READ 1 #define IO_READ 1
#define IO_WRITE 2 #define IO_WRITE 2
#endif
#endif /* DIRECT_IO_ACCESS */
/********************************************************************** /**********************************************************************
* IO_port_init * IO_port_init

View File

@ -17,6 +17,7 @@
#include "mmsystem.h" #include "mmsystem.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
#include "xmalloc.h"
static BOOL32 mmTimeStarted = FALSE; static BOOL32 mmTimeStarted = FALSE;
static MMTIME mmSysTimeMS; static MMTIME mmSysTimeMS;

View File

@ -254,8 +254,8 @@ HBRUSH32 WINAPI GetSysColorBrush32( INT32 index )
switch(index){ switch(index){
case COLOR_SCROLLBAR: case COLOR_SCROLLBAR:
return sysColorObjects.hbrushScrollbar; return sysColorObjects.hbrushScrollbar;
case COLOR_BACKGROUND: /* same as COLOR_DESKTOP */ case COLOR_BACKGROUND:
return sysColorObjects.hbrushScrollbar; /*FIXME*/ return sysColorObjects.hbrushBackground;
case COLOR_ACTIVECAPTION: case COLOR_ACTIVECAPTION:
return sysColorObjects.hbrushActiveCaption; return sysColorObjects.hbrushActiveCaption;
case COLOR_INACTIVECAPTION: case COLOR_INACTIVECAPTION:
@ -265,51 +265,43 @@ HBRUSH32 WINAPI GetSysColorBrush32( INT32 index )
case COLOR_WINDOW: case COLOR_WINDOW:
return sysColorObjects.hbrushWindow; return sysColorObjects.hbrushWindow;
case COLOR_WINDOWFRAME: case COLOR_WINDOWFRAME:
fprintf( stderr, "GetSysColorBrush32: Unimplemented index(%d)\n", index ); return sysColorObjects.hbrushWindowFrame;
break;
case COLOR_MENUTEXT: case COLOR_MENUTEXT:
fprintf( stderr, "GetSysColorBrush32: Unimplemented index(%d)\n", index ); return sysColorObjects.hbrushMenuText;
break;
case COLOR_WINDOWTEXT: case COLOR_WINDOWTEXT:
fprintf( stderr, "GetSysColorBrush32: Unimplemented index(%d)\n", index ); return sysColorObjects.hbrushWindowText;
break;
case COLOR_CAPTIONTEXT: case COLOR_CAPTIONTEXT:
fprintf( stderr, "GetSysColorBrush32: Unimplemented index(%d)\n", index ); return sysColorObjects.hbrushCaptionText;
break;
case COLOR_ACTIVEBORDER: case COLOR_ACTIVEBORDER:
return sysColorObjects.hbrushActiveBorder; return sysColorObjects.hbrushActiveBorder;
case COLOR_INACTIVEBORDER: case COLOR_INACTIVEBORDER:
return sysColorObjects.hbrushInactiveBorder; return sysColorObjects.hbrushInactiveBorder;
case COLOR_APPWORKSPACE: case COLOR_APPWORKSPACE:
return sysColorObjects.hbrushActiveBorder; /*FIXME*/ return sysColorObjects.hbrushAppWorkspace;
case COLOR_HIGHLIGHT: case COLOR_HIGHLIGHT:
return sysColorObjects.hbrushHighlight; return sysColorObjects.hbrushHighlight;
case COLOR_HIGHLIGHTTEXT: case COLOR_HIGHLIGHTTEXT:
return sysColorObjects.hbrushHighlight; /*FIXME*/ return sysColorObjects.hbrushHighlightText;
case COLOR_BTNFACE: /* same as COLOR_3DFACE */ case COLOR_BTNFACE: /* same as COLOR_3DFACE */
return sysColorObjects.hbrushBtnFace; return sysColorObjects.hbrushBtnFace;
case COLOR_BTNSHADOW: /* same as COLOR_3DSHADOW */ case COLOR_BTNSHADOW: /* same as COLOR_3DSHADOW */
return sysColorObjects.hbrushBtnShadow; return sysColorObjects.hbrushBtnShadow;
case COLOR_GRAYTEXT: case COLOR_GRAYTEXT:
return sysColorObjects.hbrushBtnShadow; /*FIXME*/ return sysColorObjects.hbrushGrayText;
case COLOR_BTNTEXT: case COLOR_BTNTEXT:
return sysColorObjects.hbrushBtnShadow; /*FIXME*/ return sysColorObjects.hbrushBtnText;
case COLOR_INACTIVECAPTIONTEXT: case COLOR_INACTIVECAPTIONTEXT:
return sysColorObjects.hbrushBtnShadow; /*FIXME*/ return sysColorObjects.hbrushInactiveCaptionText;
case COLOR_BTNHIGHLIGHT: /* same as COLOR_(3DHIGH|3DHI|BTNHI)LIGHT */ case COLOR_BTNHIGHLIGHT: /* same as COLOR_(3DHIGH|3DHI|BTNHI)LIGHT */
return sysColorObjects.hbrushBtnHighlight; return sysColorObjects.hbrushBtnHighlight;
/* case COLOR_3DDKSHADOW: FIXME case COLOR_3DDKSHADOW:
fprintf( stderr, "GetSysColorBrush32: Unimplemented index(%d)\n", index ); return sysColorObjects.hbrush3DDkShadow;
break;
case COLOR_3DLIGHT: case COLOR_3DLIGHT:
fprintf( stderr, "GetSysColorBrush32: Unimplemented index(%d)\n", index ); return sysColorObjects.hbrush3DLight;
break;
case COLOR_INFOTEXT: case COLOR_INFOTEXT:
fprintf( stderr, "GetSysColorBrush32: Unimplemented index(%d)\n", index ); return sysColorObjects.hbrushInfoText;
break;
case COLOR_INFOBK: case COLOR_INFOBK:
fprintf( stderr, "GetSysColorBrush32: Unimplemented index(%d)\n", index ); return sysColorObjects.hbrushInfoBk;
break;*/
default: default:
fprintf( stderr, "GetSysColorBrush32: Unknown index(%d)\n", index ); fprintf( stderr, "GetSysColorBrush32: Unknown index(%d)\n", index );
} }

View File

@ -52,6 +52,7 @@ static const WIN_DC_INFO DC_defaultValues =
0, /* breakRem */ 0, /* breakRem */
1, /* bitsPerPixel */ 1, /* bitsPerPixel */
MM_TEXT, /* MapMode */ MM_TEXT, /* MapMode */
GM_COMPATIBLE, /* GraphicsMode */
0, /* DCOrgX */ 0, /* DCOrgX */
0, /* DCOrgY */ 0, /* DCOrgY */
0, /* CursPosX */ 0, /* CursPosX */
@ -1037,6 +1038,42 @@ DWORD WINAPI SetDCOrg( HDC16 hdc, INT16 x, INT16 y )
} }
/***********************************************************************
* GetGraphicsMode (GDI32.188)
*/
INT32 WINAPI GetGraphicsMode( HDC32 hdc )
{
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return 0;
return dc->w.GraphicsMode;
}
/***********************************************************************
* SetGraphicsMode (GDI32.317)
*/
INT32 WINAPI SetGraphicsMode( HDC32 hdc, INT32 mode )
{
INT32 ret;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return 0;
if ((mode <= 0) || (mode > GM_LAST)) return 0;
ret = dc->w.GraphicsMode;
dc->w.GraphicsMode = mode;
return ret;
}
/***********************************************************************
* GetWorldTransform (GDI32.244)
*/
BOOL32 WINAPI GetWorldTransform( HDC32 hdc, LPXFORM xform )
{
fprintf( stdnimp, "GetWorldTransform: empty stub\n" );
return FALSE;
}
/*********************************************************************** /***********************************************************************
* SetDCHook (GDI.190) * SetDCHook (GDI.190)
*/ */

View File

@ -697,6 +697,42 @@ BOOL16 WINAPI IsGDIObject( HGDIOBJ16 handle )
} }
/***********************************************************************
* SetObjectOwner16 (GDI.461)
*/
void WINAPI SetObjectOwner16( HGDIOBJ16 handle, HANDLE16 owner )
{
/* Nothing to do */
}
/***********************************************************************
* SetObjectOwner32 (GDI32.386)
*/
void WINAPI SetObjectOwner32( HGDIOBJ32 handle, HANDLE32 owner )
{
/* Nothing to do */
}
/***********************************************************************
* GdiGetBatchLimit (GDI32.129)
*/
DWORD WINAPI GdiGetBatchLimit(void)
{
return 1; /* FIXME */
}
/***********************************************************************
* GdiSetBatchLimit (GDI32.139)
*/
DWORD WINAPI GdiSetBatchLimit( DWORD limit )
{
return 1; /* FIXME */
}
/*********************************************************************** /***********************************************************************
* MulDiv16 (GDI.128) * MulDiv16 (GDI.128)
*/ */

View File

@ -280,8 +280,14 @@ static BOOL32 PROCESS_FillEnvDB( PDB32 *pdb, TDB *pTask, LPCSTR cmd_line )
array = NULL; array = NULL;
/* Copy the command line */ /* Copy the command line */
/* Fixme: Here we rely on the hack that loader/module.c put's the unprocessed
if (!(pdb->env_db->cmd_line = HEAP_strdupA( pdb->heap, 0, cmd_line ))) commandline after the processed one in Pascal notation.
We may access Null data if we get called another way.
If we have a real CreateProcess sometimes, the problem to get an unrestricted
commandline will go away and we won't need that hack any longer
*/
if (!(pdb->env_db->cmd_line =
HEAP_strdupA( pdb->heap, 0, cmd_line + (unsigned char)cmd_line[0] + 2)))
goto error; goto error;
return TRUE; return TRUE;

View File

@ -5,6 +5,7 @@
* Copyright 1997 Eric Youngdale * Copyright 1997 Eric Youngdale
*/ */
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -33,14 +34,14 @@
typedef enum typedef enum
{ {
TYPE_INVALID, TYPE_INVALID,
TYPE_BYTE, /* byte variable */ TYPE_BYTE, /* byte variable (Win16) */
TYPE_WORD, /* word variable */ TYPE_WORD, /* word variable (Win16) */
TYPE_LONG, /* long variable */ TYPE_LONG, /* long variable (Win16) */
TYPE_PASCAL_16, /* pascal function with 16-bit return (Win16) */ TYPE_PASCAL_16, /* pascal function with 16-bit return (Win16) */
TYPE_PASCAL, /* pascal function with 32-bit return (Win16) */ TYPE_PASCAL, /* pascal function with 32-bit return (Win16) */
TYPE_ABS, /* absolute value (Win16) */
TYPE_RETURN, /* simple return value function (Win16) */
TYPE_REGISTER, /* register function */ TYPE_REGISTER, /* register function */
TYPE_ABS, /* absolute value */
TYPE_RETURN, /* simple return value function */
TYPE_STUB, /* unimplemented stub */ TYPE_STUB, /* unimplemented stub */
TYPE_STDCALL, /* stdcall function (Win32) */ TYPE_STDCALL, /* stdcall function (Win32) */
TYPE_CDECL, /* cdecl function (Win32) */ TYPE_CDECL, /* cdecl function (Win32) */
@ -57,9 +58,9 @@ static const char * const TypeNames[TYPE_NBTYPES] =
"long", /* TYPE_LONG */ "long", /* TYPE_LONG */
"pascal16", /* TYPE_PASCAL_16 */ "pascal16", /* TYPE_PASCAL_16 */
"pascal", /* TYPE_PASCAL */ "pascal", /* TYPE_PASCAL */
"register", /* TYPE_REGISTER */
"equate", /* TYPE_ABS */ "equate", /* TYPE_ABS */
"return", /* TYPE_RETURN */ "return", /* TYPE_RETURN */
"register", /* TYPE_REGISTER */
"stub", /* TYPE_STUB */ "stub", /* TYPE_STUB */
"stdcall", /* TYPE_STDCALL */ "stdcall", /* TYPE_STDCALL */
"cdecl", /* TYPE_CDECL */ "cdecl", /* TYPE_CDECL */
@ -425,6 +426,12 @@ static int ParseExportFunction( ORDDEF *odp )
odp->u.func.arg_types[i] = '\0'; odp->u.func.arg_types[i] = '\0';
if ((odp->type == TYPE_STDCALL) && !i) if ((odp->type == TYPE_STDCALL) && !i)
odp->type = TYPE_CDECL; /* stdcall is the same as cdecl for 0 args */ odp->type = TYPE_CDECL; /* stdcall is the same as cdecl for 0 args */
if ((odp->type == TYPE_REGISTER) && (SpecType == SPEC_WIN32) && i)
{
fprintf( stderr, "%s:%d: register functions cannot have arguments in Win32\n",
SpecName, Line );
return -1;
}
strcpy(odp->u.func.link_name, GetToken()); strcpy(odp->u.func.link_name, GetToken());
return 0; return 0;
} }
@ -448,6 +455,13 @@ static int ParseEquate( ORDDEF *odp )
return -1; return -1;
} }
if (SpecType == SPEC_WIN32)
{
fprintf( stderr, "%s:%d: 'equate' not supported for Win32\n",
SpecName, Line );
return -1;
}
odp->u.abs.value = value; odp->u.abs.value = value;
return 0; return 0;
} }
@ -481,6 +495,13 @@ static int ParseReturn( ORDDEF *odp )
return -1; return -1;
} }
if (SpecType == SPEC_WIN32)
{
fprintf( stderr, "%s:%d: 'return' not supported for Win32\n",
SpecName, Line );
return -1;
}
return 0; return 0;
} }
@ -931,116 +952,6 @@ static int BuildModule16( FILE *outfile, int max_code_offset,
} }
/*******************************************************************
* BuildModule32
*
* Build the in-memory representation of a 32-bit pseudo-NE module, and dump it
* as a byte stream into the assembly code.
*/
static int BuildModule32( FILE *outfile )
{
char *buffer;
NE_MODULE *pModule;
OFSTRUCT *pFileInfo;
BYTE *pstr;
WORD *pword;
/* Module layout:
* NE_MODULE Module
* OFSTRUCT File information
* SEGTABLEENTRY Segment table (empty)
* WORD[2] Resource table (empty)
* BYTE[2] Imported names (empty)
* BYTE[n] Resident names table (1 entry)
* BYTE[n] Entry table (empty)
*/
buffer = xmalloc( 0x10000 );
pModule = (NE_MODULE *)buffer;
pModule->magic = IMAGE_OS2_SIGNATURE;
pModule->count = 1;
pModule->next = 0;
pModule->dgroup_entry = 0;
pModule->flags = NE_FFLAGS_SINGLEDATA | NE_FFLAGS_BUILTIN |
NE_FFLAGS_LIBMODULE | NE_FFLAGS_WIN32;
pModule->dgroup = 0;
pModule->heap_size = DLLHeapSize;
pModule->stack_size = 0;
pModule->ip = 0;
pModule->cs = 0;
pModule->sp = 0;
pModule->ss = 0;
pModule->seg_count = 0;
pModule->modref_count = 0;
pModule->nrname_size = 0;
pModule->modref_table = 0;
pModule->nrname_fpos = 0;
pModule->moveable_entries = 0;
pModule->alignment = 0;
pModule->truetype = 0;
pModule->os_flags = NE_OSFLAGS_WINDOWS;
pModule->misc_flags = 0;
pModule->dlls_to_init = 0;
pModule->nrname_handle = 0;
pModule->min_swap_area = 0;
pModule->expected_version = 0x030a;
pModule->pe_module = NULL;
pModule->self = 0;
pModule->self_loading_sel = 0;
/* File information */
pFileInfo = (OFSTRUCT *)(pModule + 1);
pModule->fileinfo = (int)pFileInfo - (int)pModule;
memset( pFileInfo, 0, sizeof(*pFileInfo) - sizeof(pFileInfo->szPathName) );
pFileInfo->cBytes = sizeof(*pFileInfo) - sizeof(pFileInfo->szPathName)
+ strlen(DLLFileName);
strcpy( pFileInfo->szPathName, DLLFileName );
pstr = (char *)pFileInfo + pFileInfo->cBytes + 1;
/* Segment table */
pModule->seg_table = (int)pstr - (int)pModule;
/* Resource table */
pword = (WORD *)pstr;
pModule->res_table = (int)pword - (int)pModule;
*pword++ = 0;
*pword++ = 0;
/* Imported names table */
pstr = (char *)pword;
pModule->import_table = (int)pstr - (int)pModule;
*pstr++ = 0;
*pstr++ = 0;
/* Resident names table */
pModule->name_table = (int)pstr - (int)pModule;
/* First entry is module name */
*pstr = strlen(DLLName );
strcpy( pstr + 1, DLLName );
pstr += *pstr + 1;
*(WORD *)pstr = 0;
pstr += sizeof(WORD);
*pstr++ = 0;
/* Entry table */
pModule->entry_table = (int)pstr - (int)pModule;
*pstr++ = 0;
/* Dump the module content */
DumpBytes( outfile, (char *)pModule, (int)pstr - (int)pModule,
".data", "Module_Start" );
return (int)pstr - (int)pModule;
}
/******************************************************************* /*******************************************************************
* BuildSpec32File * BuildSpec32File
* *
@ -1049,8 +960,9 @@ static int BuildModule32( FILE *outfile )
static int BuildSpec32File( char * specfile, FILE *outfile ) static int BuildSpec32File( char * specfile, FILE *outfile )
{ {
ORDDEF *odp; ORDDEF *odp;
int i, module_size, len; int i, nb_names, nb_stubs;
char buffer[1024]; char buffer[1024];
unsigned char *args, *p;
fprintf( outfile, "/* File generated automatically; do not edit! */\n" ); fprintf( outfile, "/* File generated automatically; do not edit! */\n" );
fprintf( outfile, "\t.file\t\"%s\"\n", specfile ); fprintf( outfile, "\t.file\t\"%s\"\n", specfile );
@ -1067,131 +979,54 @@ static int BuildSpec32File( char * specfile, FILE *outfile )
fprintf( outfile, "\t.text\n" ); fprintf( outfile, "\t.text\n" );
fprintf( outfile, "\t.align 4\n" ); fprintf( outfile, "\t.align 4\n" );
fprintf( outfile, "Code_Start:\n\n" ); fprintf( outfile, "Code_Start:\n" );
/* Output code for all register functions */
for (i = Base, odp = OrdinalDefinitions + Base; i <= Limit; i++, odp++) for (i = Base, odp = OrdinalDefinitions + Base; i <= Limit; i++, odp++)
{ {
switch (odp->type) if (odp->type != TYPE_REGISTER) continue;
{ fprintf( outfile, "\n/* %s.%d (%s) */\n", DLLName, i, odp->name);
case TYPE_INVALID:
break;
case TYPE_STDCALL:
case TYPE_CDECL:
case TYPE_STUB:
case TYPE_REGISTER:
fprintf( outfile, "/* %s.%d (%s) */\n", DLLName, i, odp->name);
#ifdef USE_STABS
fprintf( outfile, ".stabs \"%s_%d:F1\",36,0,%d,%s_%d\n",
DLLName, i, odp->lineno, DLLName, i);
#endif
fprintf( outfile, "%s_%d:\n", DLLName, i );
#ifdef USE_STABS
fprintf( outfile, ".stabn 68,0,%d,0\n", odp->lineno);
#endif
fprintf( outfile, "\tpushl %%ebp\n" );
fprintf( outfile, "\tpushl $" PREFIX "%s\n",odp->u.func.link_name);
fprintf( outfile, "\tcall " PREFIX "CallFrom32_%s_%d\n",
(odp->type == TYPE_REGISTER) ? "regs" :
((odp->type == TYPE_STDCALL) ? "stdcall" : "cdecl"),
strlen(odp->u.func.arg_types));
fprintf( outfile, "\tnop\n" );
break;
case TYPE_RETURN:
fprintf( outfile, "/* %s.%d (%s) */\n", DLLName, i, odp->name);
#ifdef USE_STABS
fprintf( outfile, ".stabs \"%s_%d:F1\",36,0,%d,%s_%d\n",
DLLName, i, odp->lineno, DLLName, i);
#endif
fprintf( outfile, "%s_%d:\n", DLLName, i );
#ifdef USE_STABS
fprintf( outfile, ".stabn 68,0,%d,0\n", odp->lineno);
#endif
fprintf( outfile, "\tmovl $%d,%%eax\n", odp->u.ret.ret_value );
if (odp->u.ret.arg_size)
{
fprintf( outfile, "\tret $%d\n", odp->u.ret.arg_size );
}
else
{
fprintf( outfile, "\tret\n" );
fprintf( outfile, "\tnop\n" );
fprintf( outfile, "\tnop\n" );
}
break;
case TYPE_BYTE:
fprintf( outfile, "/* %s.%d (%s) */\n", DLLName, i, odp->name);
fprintf( outfile, "\t.data\n" );
fprintf( outfile, "%s_%d:\n", DLLName, i );
len = StoreVariableCode( buffer, 1, odp );
DumpBytes( outfile, buffer, len, NULL, NULL );
fprintf( outfile, "\t.text\n" );
break;
case TYPE_WORD:
fprintf( outfile, "/* %s.%d (%s) */\n",
DLLName, i, odp->name);
fprintf( outfile, "\t.data\n" );
fprintf( outfile, "%s_%d:\n", DLLName, i );
len = StoreVariableCode( buffer, 2, odp );
DumpBytes( outfile, buffer, len, NULL, NULL );
fprintf( outfile, "\t.text\n" );
break;
case TYPE_LONG:
fprintf( outfile, "/* %s.%d (%s) */\n",
DLLName, i, odp->name);
fprintf( outfile, "\t.data\n" );
fprintf( outfile, "%s_%d:\n", DLLName, i );
len = StoreVariableCode( buffer, 4, odp );
DumpBytes( outfile, buffer, len, NULL, NULL );
fprintf( outfile, "\t.text\n" );
break;
case TYPE_VARARGS:
case TYPE_EXTERN:
break;
default:
fprintf(stderr,"build: function type %d not available for Win32\n",
odp->type);
return -1;
}
}
module_size = BuildModule32( outfile );
/* Output the DLL functions table for no debugging code */
fprintf( outfile, "\t.text\n" );
fprintf( outfile, "\t.align 4\n" ); fprintf( outfile, "\t.align 4\n" );
fprintf( outfile, "NoDbg_Functions:\n" ); #ifdef USE_STABS
for (i = Base, odp = OrdinalDefinitions + Base; i <= Limit; i++, odp++) fprintf( outfile, ".stabs \"%s_%d:F1\",36,0,%d,%s_%d\n",
{ DLLName, i, odp->lineno, DLLName, i);
switch(odp->type) #endif
{ fprintf( outfile, "%s_%d:\n", DLLName, i );
case TYPE_INVALID: #ifdef USE_STABS
fprintf( outfile, "\t.long 0\n" ); fprintf( outfile, ".stabn 68,0,%d,0\n", odp->lineno);
break; #endif
case TYPE_VARARGS: fprintf( outfile, "\tpushl $" PREFIX "%s\n",odp->u.func.link_name);
fprintf( outfile, "\t.long " PREFIX "%s\n",odp->u.vargs.link_name); fprintf( outfile, "\tjmp " PREFIX "CALL32_Regs\n" );
break;
case TYPE_EXTERN:
fprintf( outfile, "\t.long " PREFIX "%s\n", odp->u.ext.link_name );
break;
case TYPE_STDCALL:
case TYPE_CDECL:
fprintf( outfile, "\t.long " PREFIX "%s\n", odp->u.func.link_name);
break;
default:
fprintf( outfile, "\t.long %s_%d\n", DLLName, i );
break;
}
} }
/* Output the DLL functions table for debugging code */ /* Output code for all stubs functions */
nb_stubs = 0;
for (i = Base, odp = OrdinalDefinitions + Base; i <= Limit; i++, odp++)
{
if (odp->type != TYPE_STUB) continue;
fprintf( outfile, "\n/* %s.%d (%s) */\n", DLLName, i, odp->name);
#ifdef USE_STABS
fprintf( outfile, ".stabs \"%s_%d:F1\",36,0,%d,%s_%d\n",
DLLName, i, odp->lineno, DLLName, i);
#endif
fprintf( outfile, "%s_%d:\n", DLLName, i );
#ifdef USE_STABS
fprintf( outfile, ".stabn 68,0,%d,0\n", odp->lineno);
#endif
fprintf( outfile, "\tpushl $Name_%d\n", i );
fprintf( outfile, "\tpushl $%d\n", i );
if (++nb_stubs == 1)
{
fprintf( outfile, "DoStub:\n" );
fprintf( outfile, "\tpushl $DLLName\n" );
fprintf( outfile, "\tcall " PREFIX "RELAY_Unimplemented32\n" );
}
else fprintf( outfile, "\tjmp DoStub\n" );
}
/* Output the DLL functions table */
fprintf( outfile, "\t.text\n" ); fprintf( outfile, "\t.text\n" );
fprintf( outfile, "\t.align 4\n" ); fprintf( outfile, "\t.align 4\n" );
@ -1209,9 +1044,18 @@ static int BuildSpec32File( char * specfile, FILE *outfile )
case TYPE_EXTERN: case TYPE_EXTERN:
fprintf( outfile, "\t.long " PREFIX "%s\n", odp->u.ext.link_name ); fprintf( outfile, "\t.long " PREFIX "%s\n", odp->u.ext.link_name );
break; break;
default: case TYPE_STDCALL:
case TYPE_CDECL:
fprintf( outfile, "\t.long " PREFIX "%s\n", odp->u.func.link_name);
break;
case TYPE_REGISTER:
case TYPE_STUB:
fprintf( outfile, "\t.long %s_%d\n", DLLName, i ); fprintf( outfile, "\t.long %s_%d\n", DLLName, i );
break; break;
default:
fprintf(stderr,"build: function type %d not available for Win32\n",
odp->type);
return -1;
} }
} }
@ -1220,8 +1064,20 @@ static int BuildSpec32File( char * specfile, FILE *outfile )
fprintf( outfile, "FuncNames:\n" ); fprintf( outfile, "FuncNames:\n" );
for (i = Base, odp = OrdinalDefinitions + Base; i <= Limit; i++, odp++) for (i = Base, odp = OrdinalDefinitions + Base; i <= Limit; i++, odp++)
{ {
if (odp->type == TYPE_INVALID) fprintf( outfile, "\t.long 0\n" ); if (odp->type != TYPE_INVALID)
else fprintf( outfile, "\t.long Name_%d\n", i ); fprintf( outfile, "\t.long Name_%d\n", i );
}
/* Output the DLL ordinals table */
fprintf( outfile, "FuncOrdinals:\n" );
nb_names = 0;
for (i = Base, odp = OrdinalDefinitions + Base; i <= Limit; i++, odp++)
{
if (odp->type == TYPE_INVALID) continue;
nb_names++;
/* Some assemblers do not have .word */
fprintf( outfile, "\t.byte %d,%d\n", LOBYTE(i), HIBYTE(i) );
} }
/* Output the DLL names */ /* Output the DLL names */
@ -1232,6 +1088,29 @@ static int BuildSpec32File( char * specfile, FILE *outfile )
fprintf( outfile, "Name_%d:\t.ascii \"%s\\0\"\n", i, odp->name ); fprintf( outfile, "Name_%d:\t.ascii \"%s\\0\"\n", i, odp->name );
} }
/* Output the DLL functions arguments */
args = p = (unsigned char *)xmalloc( Limit - Base + 1 );
for (i = Base, odp = OrdinalDefinitions + Base; i <= Limit; i++, odp++)
{
switch(odp->type)
{
case TYPE_STDCALL:
*p++ = (unsigned char)strlen(odp->u.func.arg_types);
break;
case TYPE_CDECL:
*p++ = 0x80 | (unsigned char)strlen(odp->u.func.arg_types);
break;
case TYPE_REGISTER:
*p++ = 0xfe;
break;
default:
*p++ = 0xff;
break;
}
}
DumpBytes( outfile, args, Limit - Base + 1, NULL, "FuncArgs" );
/* Output the DLL descriptor */ /* Output the DLL descriptor */
fprintf( outfile, "DLLName:\t.ascii \"%s\\0\"\n", DLLName ); fprintf( outfile, "DLLName:\t.ascii \"%s\\0\"\n", DLLName );
@ -1239,14 +1118,13 @@ static int BuildSpec32File( char * specfile, FILE *outfile )
fprintf( outfile, "\t.globl " PREFIX "%s_Descriptor\n", DLLName ); fprintf( outfile, "\t.globl " PREFIX "%s_Descriptor\n", DLLName );
fprintf( outfile, PREFIX "%s_Descriptor:\n", DLLName ); fprintf( outfile, PREFIX "%s_Descriptor:\n", DLLName );
fprintf( outfile, "\t.long DLLName\n" ); /* Name */ fprintf( outfile, "\t.long DLLName\n" ); /* Name */
fprintf( outfile, "\t.long Module_Start\n" ); /* Module start */
fprintf( outfile, "\t.long %d\n", module_size ); /* Module size */
fprintf( outfile, "\t.long %d\n", Base ); /* Base */ fprintf( outfile, "\t.long %d\n", Base ); /* Base */
fprintf( outfile, "\t.long %d\n", Limit+1-Base ); /* Size */ fprintf( outfile, "\t.long %d\n", Limit+1-Base ); /* Number of functions */
fprintf( outfile, "\t.long Code_Start\n" ); /* Code start */ fprintf( outfile, "\t.long %d\n", nb_names ); /* Number of names */
fprintf( outfile, "\t.long Functions\n" ); /* Functions */ fprintf( outfile, "\t.long Functions\n" ); /* Functions */
fprintf( outfile, "\t.long NoDbg_Functions\n" ); /* Funcs without debug*/
fprintf( outfile, "\t.long FuncNames\n" ); /* Function names */ fprintf( outfile, "\t.long FuncNames\n" ); /* Function names */
fprintf( outfile, "\t.long FuncOrdinals\n" ); /* Function ordinals */
fprintf( outfile, "\t.long FuncArgs\n" ); /* Function arguments */
#ifdef USE_STABS #ifdef USE_STABS
fprintf( outfile, "\t.text\n"); fprintf( outfile, "\t.text\n");
fprintf( outfile, "\t.stabs \"\",100,0,0,.Letext\n"); fprintf( outfile, "\t.stabs \"\",100,0,0,.Letext\n");
@ -1410,77 +1288,6 @@ static int BuildSpecFile( FILE *outfile, char *specname )
} }
/*******************************************************************
* BuildCall32LargeStack
*
* Build the function used to switch to the original 32-bit stack
* before calling a 32-bit function from 32-bit code. This is used for
* functions that need a large stack, like X bitmaps functions.
*
* The generated function has the following prototype:
* int xxx( int (*func)(), void *arg );
*
* The pointer to the function can be retrieved by calling CALL32_Init,
* which also takes care of saving the current 32-bit stack pointer.
*
* Stack layout:
* ... ...
* (ebp+12) arg
* (ebp+8) func
* (ebp+4) ret addr
* (ebp) ebp
*/
static void BuildCall32LargeStack( FILE *outfile )
{
/* Initialization function */
fprintf( outfile, "\n\t.align 4\n" );
#ifdef USE_STABS
fprintf( outfile, ".stabs \"CALL32_Init:F1\",36,0,0," PREFIX "CALL32_Init\n");
#endif
fprintf( outfile, "\t.globl " PREFIX "CALL32_Init\n" );
fprintf( outfile, PREFIX "CALL32_Init:\n" );
fprintf( outfile, "\tleal -256(%%esp),%%eax\n" );
fprintf( outfile, "\tmovl %%eax,CALL32_Original32_esp\n" );
fprintf( outfile, "\tmovl $CALL32_LargeStack,%%eax\n" );
fprintf( outfile, "\tret\n" );
/* Function header */
fprintf( outfile, "\n\t.align 4\n" );
#ifdef USE_STABS
fprintf( outfile, ".stabs \"CALL32_LargeStack:F1\",36,0,0,CALL32_LargeStack\n");
#endif
fprintf( outfile, "CALL32_LargeStack:\n" );
/* Entry code */
fprintf( outfile, "\tpushl %%ebp\n" );
fprintf( outfile, "\tmovl %%esp,%%ebp\n" );
/* Switch to the original 32-bit stack pointer */
fprintf( outfile, "\tmovl CALL32_Original32_esp, %%esp\n" );
/* Transfer the argument and call the function */
fprintf( outfile, "\tpushl 12(%%ebp)\n" );
fprintf( outfile, "\tcall 8(%%ebp)\n" );
/* Restore registers and return */
fprintf( outfile, "\tmovl %%ebp,%%esp\n" );
fprintf( outfile, "\tpopl %%ebp\n" );
fprintf( outfile, "\tret\n" );
/* Data */
fprintf( outfile, "\t.data\n" );
fprintf( outfile, "CALL32_Original32_esp:\t.long 0\n" );
fprintf( outfile, "\t.text\n" );
}
/******************************************************************* /*******************************************************************
* TransferArgs16To32 * TransferArgs16To32
* *
@ -2028,7 +1835,7 @@ static void BuildCallTo16Func( FILE *outfile, char *profile )
/* Push the return address */ /* Push the return address */
fprintf( outfile, "\tpushl " PREFIX "CALLTO16_RetAddr_long\n" ); fprintf( outfile, "\tpushl " PREFIX "CALLTO16_RetAddr_regs\n" );
/* Push the called routine address */ /* Push the called routine address */
@ -2111,16 +1918,25 @@ static void BuildRet16Func( FILE *outfile )
{ {
fprintf( outfile, "\t.globl " PREFIX "CALLTO16_Ret_word\n" ); fprintf( outfile, "\t.globl " PREFIX "CALLTO16_Ret_word\n" );
fprintf( outfile, "\t.globl " PREFIX "CALLTO16_Ret_long\n" ); fprintf( outfile, "\t.globl " PREFIX "CALLTO16_Ret_long\n" );
fprintf( outfile, "\t.globl " PREFIX "CALLTO16_Ret_regs\n" );
/* Put return value into eax */ fprintf( outfile, PREFIX "CALLTO16_Ret_word:\n" );
fprintf( outfile, "\txorl %%edx,%%edx\n" );
/* Remove the arguments just in case */
fprintf( outfile, PREFIX "CALLTO16_Ret_long:\n" ); fprintf( outfile, PREFIX "CALLTO16_Ret_long:\n" );
fprintf( outfile, "\tleal -%d(%%ebp),%%esp\n",
STRUCTOFFSET(STACK16FRAME,bp) + 4 /* for saved %%esp */ );
/* Put return value into %eax */
fprintf( outfile, PREFIX "CALLTO16_Ret_regs:\n" );
fprintf( outfile, "\tshll $16,%%edx\n" ); fprintf( outfile, "\tshll $16,%%edx\n" );
fprintf( outfile, "\tmovw %%ax,%%dx\n" ); fprintf( outfile, "\tmovw %%ax,%%dx\n" );
fprintf( outfile, "\tmovl %%edx,%%eax\n" ); fprintf( outfile, "\tmovl %%edx,%%eax\n" );
fprintf( outfile, PREFIX "CALLTO16_Ret_word:\n" );
/* Restore 32-bit segment registers */ /* Restore 32-bit segment registers and stack*/
fprintf( outfile, "\tpopl %%ecx\n" ); /* Get the saved %%esp */ fprintf( outfile, "\tpopl %%ecx\n" ); /* Get the saved %%esp */
fprintf( outfile, "\tmovw $0x%04x,%%bx\n", WINE_DATA_SELECTOR ); fprintf( outfile, "\tmovw $0x%04x,%%bx\n", WINE_DATA_SELECTOR );
@ -2158,30 +1974,120 @@ static void BuildRet16Func( FILE *outfile )
fprintf( outfile, "\t.data\n" ); fprintf( outfile, "\t.data\n" );
fprintf( outfile, "\t.globl " PREFIX "CALLTO16_RetAddr_word\n" ); fprintf( outfile, "\t.globl " PREFIX "CALLTO16_RetAddr_word\n" );
fprintf( outfile, "\t.globl " PREFIX "CALLTO16_RetAddr_long\n" ); fprintf( outfile, "\t.globl " PREFIX "CALLTO16_RetAddr_long\n" );
fprintf( outfile, "\t.globl " PREFIX "CALLTO16_RetAddr_regs\n" );
fprintf( outfile, "\t.globl " PREFIX "CALLTO16_Saved32_esp\n" ); fprintf( outfile, "\t.globl " PREFIX "CALLTO16_Saved32_esp\n" );
fprintf( outfile, PREFIX "CALLTO16_RetAddr_word:\t.long 0\n" ); fprintf( outfile, PREFIX "CALLTO16_RetAddr_word:\t.long 0\n" );
fprintf( outfile, PREFIX "CALLTO16_RetAddr_long:\t.long 0\n" ); fprintf( outfile, PREFIX "CALLTO16_RetAddr_long:\t.long 0\n" );
fprintf( outfile, PREFIX "CALLTO16_RetAddr_regs:\t.long 0\n" );
fprintf( outfile, PREFIX "CALLTO16_Saved32_esp:\t.long 0\n" ); fprintf( outfile, PREFIX "CALLTO16_Saved32_esp:\t.long 0\n" );
fprintf( outfile, "\t.text\n" ); fprintf( outfile, "\t.text\n" );
} }
/******************************************************************* /*******************************************************************
* BuildContext32 * BuildCallTo32LargeStack
* *
* Build the CONTEXT structure on the stack. * Build the function used to switch to the original 32-bit stack
* before calling a 32-bit function from 32-bit code. This is used for
* functions that need a large stack, like X bitmaps functions.
*
* The generated function has the following prototype:
* int xxx( int (*func)(), void *arg );
*
* The pointer to the function can be retrieved by calling CALL32_Init,
* which also takes care of saving the current 32-bit stack pointer.
*
* Stack layout:
* ... ...
* (ebp+12) arg
* (ebp+8) func
* (ebp+4) ret addr
* (ebp) ebp
*/ */
static void BuildContext32( FILE *outfile ) static void BuildCallTo32LargeStack( FILE *outfile )
{ {
/* Initialization function */
fprintf( outfile, "\n\t.align 4\n" );
#ifdef USE_STABS
fprintf( outfile, ".stabs \"CALL32_Init:F1\",36,0,0," PREFIX "CALL32_Init\n");
#endif
fprintf( outfile, "\t.globl " PREFIX "CALL32_Init\n" );
fprintf( outfile, PREFIX "CALL32_Init:\n" );
fprintf( outfile, "\tleal -256(%%esp),%%eax\n" );
fprintf( outfile, "\tmovl %%eax,CALL32_Original32_esp\n" );
fprintf( outfile, "\tmovl $CALL32_LargeStack,%%eax\n" );
fprintf( outfile, "\tret\n" );
/* Function header */
fprintf( outfile, "\n\t.align 4\n" );
#ifdef USE_STABS
fprintf( outfile, ".stabs \"CALL32_LargeStack:F1\",36,0,0,CALL32_LargeStack\n");
#endif
fprintf( outfile, "CALL32_LargeStack:\n" );
/* Entry code */
fprintf( outfile, "\tpushl %%ebp\n" );
fprintf( outfile, "\tmovl %%esp,%%ebp\n" );
/* Switch to the original 32-bit stack pointer */
fprintf( outfile, "\tmovl CALL32_Original32_esp, %%esp\n" );
/* Transfer the argument and call the function */
fprintf( outfile, "\tpushl 12(%%ebp)\n" );
fprintf( outfile, "\tcall 8(%%ebp)\n" );
/* Restore registers and return */
fprintf( outfile, "\tmovl %%ebp,%%esp\n" );
fprintf( outfile, "\tpopl %%ebp\n" );
fprintf( outfile, "\tret\n" );
/* Data */
fprintf( outfile, "\t.data\n" );
fprintf( outfile, "CALL32_Original32_esp:\t.long 0\n" );
fprintf( outfile, "\t.text\n" );
}
/*******************************************************************
* BuildCallFrom32Regs
*
* Build a 32-bit-to-Wine call-back function for a 'register' function.
* 'args' is the number of dword arguments.
*
* Stack layout:
* ... ...
* (esp+208) ret addr (or relay addr when debugging_relay is on)
* (esp+204) entry point
* (esp+0) CONTEXT struct
*/
static void BuildCallFrom32Regs( FILE *outfile )
{
/* Function header */
fprintf( outfile, "\n\t.align 4\n" );
#ifdef USE_STABS
fprintf( outfile, ".stabs \"CALL32_Regs:F1\",36,0,0," PREFIX "CALL32_Regs\n" );
#endif
fprintf( outfile, "\t.globl " PREFIX "CALL32_Regs\n" );
fprintf( outfile, PREFIX "CALL32_Regs:\n" );
/* Build the context structure */ /* Build the context structure */
fprintf( outfile, "\tpushw $0\n" ); fprintf( outfile, "\tpushw $0\n" );
fprintf( outfile, "\tpushw %%ss\n" ); fprintf( outfile, "\tpushw %%ss\n" );
fprintf( outfile, "\tpushl %%eax\n" ); /* %esp */ fprintf( outfile, "\tpushl %%eax\n" ); /* %esp place holder */
fprintf( outfile, "\tpushfl\n" ); fprintf( outfile, "\tpushfl\n" );
fprintf( outfile, "\tpushw $0\n" ); fprintf( outfile, "\tpushw $0\n" );
fprintf( outfile, "\tpushw %%cs\n" ); fprintf( outfile, "\tpushw %%cs\n" );
fprintf( outfile, "\tsubl $8,%%esp\n" ); /* %eip + %ebp */ fprintf( outfile, "\tpushl 20(%%esp)\n" ); /* %eip at time of call */
fprintf( outfile, "\tpushl %%ebp\n" );
fprintf( outfile, "\tpushl %%eax\n" ); fprintf( outfile, "\tpushl %%eax\n" );
fprintf( outfile, "\tpushl %%ecx\n" ); fprintf( outfile, "\tpushl %%ecx\n" );
@ -2200,56 +2106,31 @@ static void BuildContext32( FILE *outfile )
fprintf( outfile, "\tmovw %%gs,%%ax\n" ); fprintf( outfile, "\tmovw %%gs,%%ax\n" );
fprintf( outfile, "\tpushl %%eax\n" ); fprintf( outfile, "\tpushl %%eax\n" );
fprintf( outfile, "\tsubl $%d,%%esp\n", fprintf( outfile, "\tleal -%d(%%esp),%%esp\n",
sizeof(FLOATING_SAVE_AREA) + 6 * sizeof(DWORD) /* DR regs */ ); sizeof(FLOATING_SAVE_AREA) + 6 * sizeof(DWORD) /* DR regs */ );
fprintf( outfile, "\tpushl $0x0001001f\n" ); /* ContextFlags */ fprintf( outfile, "\tpushl $0x0001001f\n" ); /* ContextFlags */
fprintf( outfile, "\tfsave %d(%%esp)\n", CONTEXTOFFSET(FloatSave) ); fprintf( outfile, "\tfsave %d(%%esp)\n", CONTEXTOFFSET(FloatSave) );
fprintf( outfile, "\tmovl 4(%%ebp),%%eax\n" ); /* %eip at time of call */ fprintf( outfile, "\tleal %d(%%esp),%%eax\n",
fprintf( outfile, "\tmovl %%eax,%d(%%esp)\n", CONTEXTOFFSET(Eip) ); sizeof(CONTEXT) + 4 ); /* %esp at time of call */
fprintf( outfile, "\tmovl 0(%%ebp),%%eax\n" ); /* %ebp at time of call */
fprintf( outfile, "\tmovl %%eax,%d(%%esp)\n", CONTEXTOFFSET(Ebp) );
fprintf( outfile, "\tleal 8(%%ebp),%%eax\n" ); /* %esp at time of call */
fprintf( outfile, "\tmovl %%eax,%d(%%esp)\n", CONTEXTOFFSET(Esp) ); fprintf( outfile, "\tmovl %%eax,%d(%%esp)\n", CONTEXTOFFSET(Esp) );
/* Push pointer to context */ fprintf( outfile, "\tcall " PREFIX "RELAY_CallFrom32Regs\n" );
fprintf( outfile, "\tpushl %%esp\n" );
}
/*******************************************************************
* RestoreContext32
*
* Restore the registers from the context structure.
* All registers except %cs and %ss are restored.
*/
static void RestoreContext32( FILE *outfile )
{
/* Restore the context structure */ /* Restore the context structure */
fprintf( outfile, "\tleal %d(%%ebp),%%esp\n", -sizeof(CONTEXT)-8 );
fprintf( outfile, "\tfrstor %d(%%esp)\n", CONTEXTOFFSET(FloatSave) ); fprintf( outfile, "\tfrstor %d(%%esp)\n", CONTEXTOFFSET(FloatSave) );
/* Store flags over the relay addr */ /* Store %eip value onto the new stack */
fprintf( outfile, "\tmovl %d(%%esp),%%eax\n", CONTEXTOFFSET(EFlags) );
fprintf( outfile, "\tmovl %%eax,%d(%%esp)\n", sizeof(CONTEXT) );
/* Get the new stack addr */
fprintf( outfile, "\tmovl %d(%%esp),%%ebx\n", CONTEXTOFFSET(Esp) );
/* Set eip and ebp value onto the new stack */
fprintf( outfile, "\tmovl %d(%%esp),%%eax\n", CONTEXTOFFSET(Eip) ); fprintf( outfile, "\tmovl %d(%%esp),%%eax\n", CONTEXTOFFSET(Eip) );
fprintf( outfile, "\tmovl %%eax,-4(%%ebx)\n" ); /* %eip at time of call */ fprintf( outfile, "\tmovl %d(%%esp),%%ebx\n", CONTEXTOFFSET(Esp) );
fprintf( outfile, "\tmovl %d(%%esp),%%eax\n", CONTEXTOFFSET(Ebp) ); fprintf( outfile, "\tmovl %%eax,0(%%ebx)\n" );
fprintf( outfile, "\tmovl %%eax,-8(%%ebx)\n" ); /* %ebp at time of call */
/* Set ebp to point to the new stack */
fprintf( outfile, "\tleal -8(%%ebx),%%ebp\n" );
/* Restore all registers */ /* Restore all registers */
fprintf( outfile, "\taddl $%d,%%esp\n",
fprintf( outfile, "\tleal %d(%%esp),%%esp\n",
sizeof(FLOATING_SAVE_AREA) + 7 * sizeof(DWORD) ); sizeof(FLOATING_SAVE_AREA) + 7 * sizeof(DWORD) );
fprintf( outfile, "\tpopl %%eax\n" ); fprintf( outfile, "\tpopl %%eax\n" );
fprintf( outfile, "\tmovw %%ax,%%gs\n" ); fprintf( outfile, "\tmovw %%ax,%%gs\n" );
@ -2266,124 +2147,11 @@ static void RestoreContext32( FILE *outfile )
fprintf( outfile, "\tpopl %%edx\n" ); fprintf( outfile, "\tpopl %%edx\n" );
fprintf( outfile, "\tpopl %%ecx\n" ); fprintf( outfile, "\tpopl %%ecx\n" );
fprintf( outfile, "\tpopl %%eax\n" ); fprintf( outfile, "\tpopl %%eax\n" );
fprintf( outfile, "\taddl $%d,%%esp\n",
6 * sizeof(DWORD) /* %ebp + %eip + %cs + %efl + %esp + %ss */ );
fprintf( outfile, "\tpopfl\n" );
}
/*******************************************************************
* BuildCallFrom32Func
*
* Build a 32-bit-to-Wine call-back function.
* 'args' is the number of dword arguments.
*
* Stack layout:
* ... ...
* (ebp+12) arg2
* (ebp+8) arg1
* (ebp+4) ret addr
* (ebp) ebp
* (ebp-4) entry point
* (ebp-8) relay addr
*/
static void BuildCallFrom32Func( FILE *outfile, const char *profile )
{
int args, stdcall, reg_func;
if (!strncmp( profile, "stdcall", 7 ))
{
stdcall = 1;
reg_func = 0;
args = atoi( profile + 8 );
}
else if (!strncmp( profile, "cdecl", 5 ))
{
stdcall = reg_func = 0;
args = atoi( profile + 6 );
}
else if (!strncmp( profile, "regs", 4 ))
{
stdcall = reg_func = 1;
args = atoi( profile + 5 );
}
else
{
fprintf( stderr, "Invalid function profile '%s', ignored\n", profile );
return;
}
/* Function header */
fprintf( outfile, "\n\t.align 4\n" );
#ifdef USE_STABS
fprintf( outfile, ".stabs \"CallFrom32_%s:F1\",36,0,0," PREFIX "CallFrom32_%s\n",
profile, profile);
#endif
fprintf( outfile, "\t.globl " PREFIX "CallFrom32_%s\n", profile );
fprintf( outfile, PREFIX "CallFrom32_%s:\n", profile );
/* Entry code */
fprintf( outfile, "\tleal 8(%%esp),%%ebp\n" );
/* Transfer the arguments */
if (reg_func) BuildContext32( outfile );
if (args)
{
int i;
for (i = args; i > 0; i--)
fprintf( outfile, "\tpushl %d(%%ebp)\n", 4 * i + 4 );
}
#if 0
/* Set %es = %ds */
fprintf( outfile, "\tmovw %%ds,%%ax\n" );
fprintf( outfile, "\tmovw %%ax,%%es\n" );
#endif
/* Print the debugging info */
if (debugging)
{
fprintf( outfile, "\tpushl $%d\n", /* Nb args */
reg_func ? args | 0x80000000 : args);
fprintf( outfile, "\tpushl %%ebp\n" );
fprintf( outfile, "\tcall " PREFIX "RELAY_DebugCallFrom32\n" );
fprintf( outfile, "\tadd $8, %%esp\n" );
}
/* Call the function */
fprintf( outfile, "\tcall -4(%%ebp)\n" );
/* Print the debugging info */
if (debugging)
{
fprintf( outfile, "\tpushl %%eax\n" );
fprintf( outfile, "\tpushl $%d\n", /* Nb args */
reg_func ? args | 0x80000000 : args);
fprintf( outfile, "\tpushl %%ebp\n" );
fprintf( outfile, "\tcall " PREFIX "RELAY_DebugCallFrom32Ret\n" );
fprintf( outfile, "\tpopl %%eax\n" );
fprintf( outfile, "\tpopl %%eax\n" );
fprintf( outfile, "\tpopl %%eax\n" );
}
if (reg_func) RestoreContext32( outfile );
fprintf( outfile, "\tmovl %%ebp,%%esp\n" );
fprintf( outfile, "\tpopl %%ebp\n" ); fprintf( outfile, "\tpopl %%ebp\n" );
fprintf( outfile, "\tleal 8(%%esp),%%esp\n" ); /* skip %eip and %cs */
/* Return, removing arguments */ fprintf( outfile, "\tpopfl\n" );
fprintf( outfile, "\tpopl %%esp\n" );
if (args && stdcall) fprintf( outfile, "\tret $%d\n", args * 4 ); fprintf( outfile, "\tret\n" );
else fprintf( outfile, "\tret\n" );
} }
@ -2512,14 +2280,13 @@ static int BuildCallTo16( FILE *outfile, char * outname, int argc, char *argv[]
/******************************************************************* /*******************************************************************
* BuildCallFrom32 * BuildCall32
* *
* Build the 32-bit-to-Wine callbacks * Build the 32-bit callbacks
*/ */
static int BuildCallFrom32( FILE *outfile, char * outname, int argc, char *argv[] ) static int BuildCall32( FILE *outfile, char * outname )
{ {
char buffer[1024]; char buffer[1024];
int i;
/* File header */ /* File header */
@ -2538,16 +2305,16 @@ static int BuildCallFrom32( FILE *outfile, char * outname, int argc, char *argv[
fprintf( outfile, ".stabs \"%s\",100,0,0,Code_Start\n", outname); fprintf( outfile, ".stabs \"%s\",100,0,0,Code_Start\n", outname);
fprintf( outfile, "\t.text\n" ); fprintf( outfile, "\t.text\n" );
fprintf( outfile, "\t.align 4\n" ); fprintf( outfile, "\t.align 4\n" );
fprintf( outfile, "Code_Start:\n\n" ); fprintf( outfile, "Code_Start:\n" );
#endif #endif
/* Build the callback functions */
for (i = 2; i < argc; i++) BuildCallFrom32Func( outfile, argv[i] );
/* Build the 32-bit large stack callback */ /* Build the 32-bit large stack callback */
BuildCall32LargeStack( outfile ); BuildCallTo32LargeStack( outfile );
/* Build the register callback function */
BuildCallFrom32Regs( outfile );
#ifdef USE_STABS #ifdef USE_STABS
fprintf( outfile, "\t.text\n"); fprintf( outfile, "\t.text\n");
@ -2568,7 +2335,7 @@ static void usage(void)
"usage: build [-o outfile] -spec SPECNAMES\n" "usage: build [-o outfile] -spec SPECNAMES\n"
" build [-o outfile] -callfrom16 FUNCTION_PROFILES\n" " build [-o outfile] -callfrom16 FUNCTION_PROFILES\n"
" build [-o outfile] -callto16 FUNCTION_PROFILES\n" " build [-o outfile] -callto16 FUNCTION_PROFILES\n"
" build [-o outfile] -callfrom32 FUNCTION_PROFILES\n" ); " build [-o outfile] -call32\n" );
exit(1); exit(1);
} }
@ -2582,14 +2349,14 @@ int main(int argc, char **argv)
FILE *outfile = stdout; FILE *outfile = stdout;
int res = -1; int res = -1;
if (argc <= 2) usage(); if (argc < 2) usage();
if (!strcmp( argv[1], "-o" )) if (!strcmp( argv[1], "-o" ))
{ {
outname = argv[2]; outname = argv[2];
argv += 2; argv += 2;
argc -= 2; argc -= 2;
if (argc <= 2) usage(); if (argc < 2) usage();
if (!(outfile = fopen( outname, "w" ))) if (!(outfile = fopen( outname, "w" )))
{ {
fprintf( stderr, "Unable to create output file '%s'\n", outname ); fprintf( stderr, "Unable to create output file '%s'\n", outname );
@ -2603,8 +2370,8 @@ int main(int argc, char **argv)
res = BuildCallFrom16( outfile, outname, argc, argv ); res = BuildCallFrom16( outfile, outname, argc, argv );
else if (!strcmp( argv[1], "-callto16" )) else if (!strcmp( argv[1], "-callto16" ))
res = BuildCallTo16( outfile, outname, argc, argv ); res = BuildCallTo16( outfile, outname, argc, argv );
else if (!strcmp( argv[1], "-callfrom32" )) else if (!strcmp( argv[1], "-call32" ))
res = BuildCallFrom32( outfile, outname, argc, argv ); res = BuildCall32( outfile, outname );
else else
{ {
fclose( outfile ); fclose( outfile );

View File

@ -268,13 +268,13 @@ static void output_src( FILE *file, INCL_FILE *pFile, int *column )
{ {
if (!strcmp( ext, ".y" )) /* yacc file */ if (!strcmp( ext, ".y" )) /* yacc file */
{ {
fprintf( file, "y.tab.o: ./y.tab.c" ); fprintf( file, "y.tab.o: y.tab.c" );
*column += 18; *column += 16;
} }
else if (!strcmp( ext, ".l" )) /* lex file */ else if (!strcmp( ext, ".l" )) /* lex file */
{ {
fprintf( file, "lex.yy.o: ./lex.yy.c" ); fprintf( file, "lex.yy.o: lex.yy.c" );
*column += 20; *column += 18;
} }
else if (!strcmp( ext, ".rc" )) /* resource file */ else if (!strcmp( ext, ".rc" )) /* resource file */
{ {

View File

@ -6,6 +6,7 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <time.h>
#include "windows.h" #include "windows.h"
#include "winerror.h" #include "winerror.h"
#include "shell.h" #include "shell.h"

View File

@ -13,6 +13,7 @@
#include "task.h" #include "task.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
#include "process.h" /* for pCurrentProcess */
/*********************************************************************** /***********************************************************************
@ -20,21 +21,7 @@
*/ */
LPCSTR WINAPI GetCommandLine32A(void) LPCSTR WINAPI GetCommandLine32A(void)
{ {
static char buffer[256]; return pCurrentProcess->env_db->cmd_line;
char *cp;
PDB *pdb = (PDB *)GlobalLock16( GetCurrentPDB() );
/* FIXME: should use pCurrentProcess->env_db->cmd_line here */
lstrcpyn32A( buffer, MODULE_GetModuleName(GetCurrentTask()),
sizeof(buffer) - 1 );
cp = buffer + strlen(buffer);
if (pdb->cmdLine[0])
{
*cp++ = ' ';
memcpy( cp, &pdb->cmdLine[1], pdb->cmdLine[0] );
}
dprintf_win32(stddeb,"CommandLine = %s\n", buffer );
return buffer;
} }
/*********************************************************************** /***********************************************************************

View File

@ -45,25 +45,6 @@
#define TEB_EXCEPTION_FRAME(pcontext) \ #define TEB_EXCEPTION_FRAME(pcontext) \
((PEXCEPTION_FRAME)((TEB *)GET_SEL_BASE((pcontext)->SegFs))->except) ((PEXCEPTION_FRAME)((TEB *)GET_SEL_BASE((pcontext)->SegFs))->except)
/*******************************************************************
* _local_unwind2 (CRTDLL)
*/
void WINAPI CRTDLL__local_unwind2(PEXCEPTION_FRAME endframe,DWORD nr,
PCONTEXT pcontext)
{
fprintf(stderr,"CRTDLL__local_unwind2(%p,%ld)\n",endframe,nr);
return;
}
/*******************************************************************
* _global_unwind2 (CRTDLL)
*/
void WINAPI CRTDLL__global_unwind2(PEXCEPTION_FRAME endframe,PCONTEXT pcontext)
{
RtlUnwind(endframe,NULL/*should point to the return;*/,NULL,0,pcontext);
return;
}
/******************************************************************* /*******************************************************************
* RtlUnwind (KERNEL32.443) * RtlUnwind (KERNEL32.443)
* *
@ -78,7 +59,7 @@ void WINAPI RtlUnwind( PEXCEPTION_FRAME pEndFrame, LPVOID unusedEip,
DWORD dispatch; DWORD dispatch;
int retval; int retval;
pcontext->Eax=returnEax; EAX_reg(pcontext) = returnEax;
/* build an exception record, if we do not have one */ /* build an exception record, if we do not have one */
if(!pRecord) if(!pRecord)
@ -86,7 +67,7 @@ void WINAPI RtlUnwind( PEXCEPTION_FRAME pEndFrame, LPVOID unusedEip,
record.ExceptionCode = STATUS_INVALID_DISPOSITION; record.ExceptionCode = STATUS_INVALID_DISPOSITION;
record.ExceptionFlags = 0; record.ExceptionFlags = 0;
record.ExceptionRecord = NULL; record.ExceptionRecord = NULL;
record.ExceptionAddress = (LPVOID)pcontext->Eip; record.ExceptionAddress = (LPVOID)EIP_reg(pcontext);
record.NumberParameters = 0; record.NumberParameters = 0;
pRecord = &record; pRecord = &record;
} }
@ -125,6 +106,16 @@ void WINAPI RtlUnwind( PEXCEPTION_FRAME pEndFrame, LPVOID unusedEip,
} }
} }
/* This is the real entry point called by relay debugging code */
void EXC_RtlUnwind( CONTEXT *context )
{
/* Retrieve the arguments (args[0] is return addr, args[1] is first arg) */
DWORD *args = (DWORD *)ESP_reg(context);
ESP_reg(context) += 4 * sizeof(DWORD); /* Pop the arguments */
RtlUnwind( (PEXCEPTION_FRAME)args[1], (LPVOID)args[2],
(PEXCEPTION_RECORD)args[3], args[4], context );
}
/******************************************************************* /*******************************************************************
* RaiseException (KERNEL32.418) * RaiseException (KERNEL32.418)
@ -147,7 +138,7 @@ void WINAPI RaiseException(DWORD dwExceptionCode,
record.ExceptionFlags = dwExceptionFlags; record.ExceptionFlags = dwExceptionFlags;
record.ExceptionRecord = NULL; record.ExceptionRecord = NULL;
record.NumberParameters = cArguments; record.NumberParameters = cArguments;
record.ExceptionAddress = (LPVOID) pcontext->Eip; record.ExceptionAddress = (LPVOID)EIP_reg(pcontext);
if (lpArguments) for( i = 0; i < cArguments; i++) if (lpArguments) for( i = 0; i < cArguments; i++)
record.ExceptionInformation[i] = lpArguments[i]; record.ExceptionInformation[i] = lpArguments[i];
@ -162,6 +153,8 @@ void WINAPI RaiseException(DWORD dwExceptionCode,
dprintf_win32(stddeb,"calling exception handler at 0x%x\n", dprintf_win32(stddeb,"calling exception handler at 0x%x\n",
(int) pframe->Handler); (int) pframe->Handler);
dispatch=0; dispatch=0;
dprintf_relay(stddeb,"CallTo32(except=%p,record=%p,frame=%p,context=%p,dispatch=%p)\n",
pframe->Handler, &record, pframe, pcontext, &dispatch );
retval=pframe->Handler(&record,pframe,pcontext,&dispatch); retval=pframe->Handler(&record,pframe,pcontext,&dispatch);
dprintf_win32(stddeb,"exception handler returns 0x%x, dispatch=0x%x\n", dprintf_win32(stddeb,"exception handler returns 0x%x, dispatch=0x%x\n",
@ -180,6 +173,14 @@ void WINAPI RaiseException(DWORD dwExceptionCode,
} }
} }
/* This is the real entry point called by relay debugging code */
void EXC_RaiseException( CONTEXT *context )
{
/* Retrieve the arguments (args[0] is return addr, args[1] is first arg) */
DWORD *args = (DWORD *)ESP_reg(context);
ESP_reg(context) += 4 * sizeof(DWORD); /* Pop the arguments */
RaiseException( args[1], args[2], args[3], (LPDWORD)args[4], context );
}
/******************************************************************* /*******************************************************************
* UnhandledExceptionFilter (KERNEL32.537) * UnhandledExceptionFilter (KERNEL32.537)

View File

@ -117,6 +117,17 @@ VOID* WINAPI FreeSid(LPSID pSid) {
return NULL; return NULL;
} }
/***********************************************************************
* InitializeSecurityDescriptor (ADVAPI.73)
*/
BOOL32 WINAPI InitializeSecurityDescriptor( SECURITY_DESCRIPTOR *pDescr,
DWORD revision )
{
fprintf( stdnimp, "InitializeSecurityDescriptor: empty stub\n" );
return TRUE;
}
/*********************************************************************** /***********************************************************************
* InitializeSid (ADVAPI.74) * InitializeSid (ADVAPI.74)
*/ */

View File

@ -97,6 +97,8 @@ static void SYSCOLOR_SetColor( int index, COLORREF color )
sysColorObjects.hbrushScrollbar = CreateSolidBrush32( color ); sysColorObjects.hbrushScrollbar = CreateSolidBrush32( color );
break; break;
case COLOR_BACKGROUND: case COLOR_BACKGROUND:
DeleteObject32( sysColorObjects.hbrushBackground );
sysColorObjects.hbrushBackground = CreateSolidBrush32( color );
break; break;
case COLOR_ACTIVECAPTION: case COLOR_ACTIVECAPTION:
DeleteObject32( sysColorObjects.hbrushActiveCaption ); DeleteObject32( sysColorObjects.hbrushActiveCaption );
@ -115,16 +117,26 @@ static void SYSCOLOR_SetColor( int index, COLORREF color )
sysColorObjects.hbrushWindow = CreateSolidBrush32( color ); sysColorObjects.hbrushWindow = CreateSolidBrush32( color );
break; break;
case COLOR_WINDOWFRAME: case COLOR_WINDOWFRAME:
DeleteObject32( sysColorObjects.hbrushWindowFrame );
sysColorObjects.hbrushWindowFrame = CreateSolidBrush32( color );
/* FIXME: we should not need this pen */
DeleteObject32( sysColorObjects.hpenWindowFrame ); DeleteObject32( sysColorObjects.hpenWindowFrame );
sysColorObjects.hpenWindowFrame = CreatePen32( PS_SOLID, 1, color ); sysColorObjects.hpenWindowFrame = CreatePen32( PS_SOLID, 1, color );
break; break;
case COLOR_MENUTEXT: case COLOR_MENUTEXT:
DeleteObject32( sysColorObjects.hbrushMenuText );
sysColorObjects.hbrushMenuText = CreateSolidBrush32( color );
break; break;
case COLOR_WINDOWTEXT: case COLOR_WINDOWTEXT:
DeleteObject32( sysColorObjects.hbrushWindowText );
sysColorObjects.hbrushWindowText = CreateSolidBrush32( color );
/* FIXME: we should not need this pen */
DeleteObject32( sysColorObjects.hpenWindowText ); DeleteObject32( sysColorObjects.hpenWindowText );
sysColorObjects.hpenWindowText = CreatePen32( PS_DOT, 1, color ); sysColorObjects.hpenWindowText = CreatePen32( PS_DOT, 1, color );
break; break;
case COLOR_CAPTIONTEXT: case COLOR_CAPTIONTEXT:
DeleteObject32( sysColorObjects.hbrushCaptionText );
sysColorObjects.hbrushCaptionText = CreateSolidBrush32( color );
break; break;
case COLOR_ACTIVEBORDER: case COLOR_ACTIVEBORDER:
DeleteObject32( sysColorObjects.hbrushActiveBorder ); DeleteObject32( sysColorObjects.hbrushActiveBorder );
@ -135,12 +147,16 @@ static void SYSCOLOR_SetColor( int index, COLORREF color )
sysColorObjects.hbrushInactiveBorder = CreateSolidBrush32( color ); sysColorObjects.hbrushInactiveBorder = CreateSolidBrush32( color );
break; break;
case COLOR_APPWORKSPACE: case COLOR_APPWORKSPACE:
DeleteObject32( sysColorObjects.hbrushAppWorkspace );
sysColorObjects.hbrushAppWorkspace = CreateSolidBrush32( color );
break; break;
case COLOR_HIGHLIGHT: case COLOR_HIGHLIGHT:
DeleteObject32( sysColorObjects.hbrushHighlight ); DeleteObject32( sysColorObjects.hbrushHighlight );
sysColorObjects.hbrushHighlight = CreateSolidBrush32(MAKE_SOLID(color)); sysColorObjects.hbrushHighlight = CreateSolidBrush32( color );
break; break;
case COLOR_HIGHLIGHTTEXT: case COLOR_HIGHLIGHTTEXT:
DeleteObject32( sysColorObjects.hbrushHighlightText );
sysColorObjects.hbrushHighlightText = CreateSolidBrush32( color );
break; break;
case COLOR_BTNFACE: case COLOR_BTNFACE:
DeleteObject32( sysColorObjects.hbrushBtnFace ); DeleteObject32( sysColorObjects.hbrushBtnFace );
@ -151,17 +167,35 @@ static void SYSCOLOR_SetColor( int index, COLORREF color )
sysColorObjects.hbrushBtnShadow = CreateSolidBrush32( color ); sysColorObjects.hbrushBtnShadow = CreateSolidBrush32( color );
break; break;
case COLOR_GRAYTEXT: case COLOR_GRAYTEXT:
DeleteObject32( sysColorObjects.hbrushGrayText );
sysColorObjects.hbrushGrayText = CreateSolidBrush32( color );
case COLOR_BTNTEXT: case COLOR_BTNTEXT:
DeleteObject32( sysColorObjects.hbrushBtnText );
sysColorObjects.hbrushBtnText = CreateSolidBrush32( color );
break;
case COLOR_INACTIVECAPTIONTEXT: case COLOR_INACTIVECAPTIONTEXT:
DeleteObject32( sysColorObjects.hbrushInactiveCaptionText );
sysColorObjects.hbrushInactiveCaptionText = CreateSolidBrush32(color);
break; break;
case COLOR_BTNHIGHLIGHT: case COLOR_BTNHIGHLIGHT:
DeleteObject32( sysColorObjects.hbrushBtnHighlight ); DeleteObject32( sysColorObjects.hbrushBtnHighlight );
sysColorObjects.hbrushBtnHighlight = CreateSolidBrush32( color ); sysColorObjects.hbrushBtnHighlight = CreateSolidBrush32( color );
break; break;
case COLOR_3DDKSHADOW: case COLOR_3DDKSHADOW:
DeleteObject32( sysColorObjects.hbrush3DDkShadow );
sysColorObjects.hbrush3DDkShadow = CreateSolidBrush32( color );
break;
case COLOR_3DLIGHT: case COLOR_3DLIGHT:
DeleteObject32( sysColorObjects.hbrush3DLight );
sysColorObjects.hbrush3DLight = CreateSolidBrush32( color );
break;
case COLOR_INFOTEXT: case COLOR_INFOTEXT:
DeleteObject32( sysColorObjects.hbrushInfoText );
sysColorObjects.hbrushInfoText = CreateSolidBrush32( color );
break;
case COLOR_INFOBK: case COLOR_INFOBK:
DeleteObject32( sysColorObjects.hbrushInfoBk );
sysColorObjects.hbrushInfoBk = CreateSolidBrush32( color );
break; break;
} }
} }

View File

@ -624,6 +624,62 @@ HWND32 WINAPI SetActiveWindow32( HWND32 hwnd )
} }
/*******************************************************************
* GetForegroundWindow16 (USER.608)
*/
HWND16 WINAPI GetForegroundWindow16(void)
{
return (HWND16)GetForegroundWindow32();
}
/*******************************************************************
* SetForegroundWindow16 (USER.609)
*/
BOOL16 WINAPI SetForegroundWindow16( HWND16 hwnd )
{
return SetForegroundWindow32( hwnd );
}
/*******************************************************************
* GetForegroundWindow32 (USER32.241)
*/
HWND32 WINAPI GetForegroundWindow32(void)
{
return GetActiveWindow32();
}
/*******************************************************************
* SetForegroundWindow32 (USER32.482)
*/
BOOL32 WINAPI SetForegroundWindow32( HWND32 hwnd )
{
SetActiveWindow32( hwnd );
return TRUE;
}
/*******************************************************************
* GetShellWindow16 (USER.600)
*/
HWND16 WINAPI GetShellWindow16(void)
{
return GetShellWindow32();
}
/*******************************************************************
* GetShellWindow32 (USER32.287)
*/
HWND32 WINAPI GetShellWindow32(void)
{
fprintf( stdnimp, "GetShellWindow: empty stub\n" );
return 0;
}
/*********************************************************************** /***********************************************************************
* BringWindowToTop16 (USER.45) * BringWindowToTop16 (USER.45)
*/ */
@ -2423,7 +2479,7 @@ HDWP32 WINAPI DeferWindowPos32( HDWP32 hdwp, HWND32 hwnd, HWND32 hwndAfter,
pDWP->winPos[i].cx = cx; pDWP->winPos[i].cx = cx;
pDWP->winPos[i].cy = cy; pDWP->winPos[i].cy = cy;
} }
pDWP->winPos[i].flags &= flags & (SWP_NOSIZE | SWP_NOMOVE | pDWP->winPos[i].flags &= flags | ~(SWP_NOSIZE | SWP_NOMOVE |
SWP_NOZORDER | SWP_NOREDRAW | SWP_NOZORDER | SWP_NOREDRAW |
SWP_NOACTIVATE | SWP_NOCOPYBITS| SWP_NOACTIVATE | SWP_NOCOPYBITS|
SWP_NOOWNERZORDER); SWP_NOOWNERZORDER);