Release 0.4.0

Mon Sep 13 05:00:11 1993  Eric Youngdale

	* [Makefile] [if1632/relay.c] [include/dlls.h] [selector.c]
	  [loader/wine.c] [tools/build.c]
	Added ability to generate missing functions statistics.

Mon Sep 13 12:09:47 1993  Scott A. Laird  (scott@curly)

	* [WIN31-APPLETS]
	Added new file.

	* [if1632/kernel.spec]
	Added definitions for GetProfile{Int,String} and SetHandleCount.

	* [if1632/keyboard.spec]
	Created interface specification for Keyboard driver DLL.

	* [if1632/relay.c]
	Added keyboard.dll to list of included DLLs.

	* [if1632/user.spec]
	Added LoadAccelerators definition.

	* [loader/resource.c]
	Added LoadAccelerators stub.

	* [misc/file.c]
	Changed OpenFile, and added SetHandleCount (for winfile.exe)

	* [misc/keyboard.c]
	Added keyboard code.

	* [misc/profile.c] [misc/xt.c]
	Moved GetPrivateProfile* commands here, and added GetProfile*
	commands.

Mon Sep 13 10:24:37 1993  Andrew Bulhak

	* [windows/utility.c]
	Implemented MulDiv(), OutputDebugString() and wvsprintf()

Fri Sep 10 09:13:30 1993  John Brezak

	* [*/Makefile]
	Created patch to allow BSD make to build wine.

	* [windows/win.c]
	Fixed NULL pointer reference.

	* [windows/message.c] [misc/xt.c]
	Defined HZ to handle system specific timing.

	* [windows/graphics.c]
	Use M_PI is PI

	* [objects/pallete.c]
	NetBSD does not have /usr/include/values.h and MAXINT is INT_MAX.

	* [dump.c] [ldt.c] [wine.c]
	ifdef'ed linux headers for linux compile.

	* [loader/ldtlib.c]
	Add NetBSD system calls when compiled on that system.

	* [loader/selector.c]
	Use mmap(MAP_ANON, ...) for NetBSD.

	* [if1632/call.S]
	Fixed selector assumptions.

Thu Sep 9 20:01:37 1993  David Metcalfe

	* [controls/WinButton*] [controls/button.c] [controls/widget.c]
  	  [windows/win.c] [windows/class.c]
	Added 3D button control and tied into CreateWindow()

Thu Sep  9 07:35:24 1993  Scott Laird

	* [if1632/sound.spec]
	Created interface specification for SOUND DLL.

	* [if1632/win87em.spec]
	Added more functions to the WIN87EM DLL interface specification

	* [misc/emulate.c]
	Created stubs for the new math emulation functions.

	* [misc/sound.c]
	Created stubs for the SOUND DLL.

Sun Sep  5 21:02:10 1993  John Burton

	* [if1632/kernel.spec]
	Added interface specifications for OpenFile, _lclose, _lread, _lopen,
	and _lwrite.

	* [include/windows.h]
	Added OF_ macros

	* [misc/file.c]
	Implemented OpenFile, _lclose, _lread, _lopen and _lwrite.

Fri Sep  3 18:47:03 1993  Alexandre Julliard

        * [windows/dc.c]
	Bug fix

	* [objects/text.c]
	Bug fix

Fri Sep  3 18:47:03 1993  Bob Amstadt

        * [objects/linedda.c]
        Finished LineDDA().
This commit is contained in:
Alexandre Julliard 1993-09-14 16:47:10 +00:00
parent 401710d757
commit f41aeca9ff
53 changed files with 10624 additions and 1626 deletions

File diff suppressed because it is too large Load Diff

7864
ALPHA-pl13.diff Normal file

File diff suppressed because it is too large Load Diff

115
ChangeLog
View File

@ -1,3 +1,118 @@
Mon Sep 13 05:00:11 1993 Eric Youngdale
* [Makefile] [if1632/relay.c] [include/dlls.h] [selector.c]
[loader/wine.c] [tools/build.c]
Added ability to generate missing functions statistics.
Mon Sep 13 12:09:47 1993 Scott A. Laird (scott@curly)
* [WIN31-APPLETS]
Added new file.
* [if1632/kernel.spec]
Added definitions for GetProfile{Int,String} and SetHandleCount.
* [if1632/keyboard.spec]
Created interface specification for Keyboard driver DLL.
* [if1632/relay.c]
Added keyboard.dll to list of included DLLs.
* [if1632/user.spec]
Added LoadAccelerators definition.
* [loader/resource.c]
Added LoadAccelerators stub.
* [misc/file.c]
Changed OpenFile, and added SetHandleCount (for winfile.exe)
* [misc/keyboard.c]
Added keyboard code.
* [misc/profile.c] [misc/xt.c]
Moved GetPrivateProfile* commands here, and added GetProfile*
commands.
Mon Sep 13 10:24:37 1993 Andrew Bulhak
* [windows/utility.c]
Implemented MulDiv(), OutputDebugString() and wvsprintf()
Fri Sep 10 09:13:30 1993 John Brezak
* [*/Makefile]
Created patch to allow BSD make to build wine.
* [windows/win.c]
Fixed NULL pointer reference.
* [windows/message.c] [misc/xt.c]
Defined HZ to handle system specific timing.
* [windows/graphics.c]
Use M_PI is PI
* [objects/pallete.c]
NetBSD does not have /usr/include/values.h and MAXINT is INT_MAX.
* [dump.c] [ldt.c] [wine.c]
ifdef'ed linux headers for linux compile.
* [loader/ldtlib.c]
Add NetBSD system calls when compiled on that system.
* [loader/selector.c]
Use mmap(MAP_ANON, ...) for NetBSD.
* [if1632/call.S]
Fixed selector assumptions.
Thu Sep 9 20:01:37 1993 David Metcalfe
* [controls/WinButton*] [controls/button.c] [controls/widget.c]
[windows/win.c] [windows/class.c]
Added 3D button control and tied into CreateWindow()
Thu Sep 9 07:35:24 1993 Scott Laird
* [if1632/sound.spec]
Created interface specification for SOUND DLL.
* [if1632/win87em.spec]
Added more functions to the WIN87EM DLL interface specification
* [misc/emulate.c]
Created stubs for the new math emulation functions.
* [misc/sound.c]
Created stubs for the SOUND DLL.
Sun Sep 5 21:02:10 1993 John Burton
* [if1632/kernel.spec]
Added interface specifications for OpenFile, _lclose, _lread, _lopen,
and _lwrite.
* [include/windows.h]
Added OF_ macros
* [misc/file.c]
Implemented OpenFile, _lclose, _lread, _lopen and _lwrite.
Fri Sep 3 18:47:03 1993 Alexandre Julliard
* [windows/dc.c]
Bug fix
* [objects/text.c]
Bug fix
Fri Sep 3 18:47:03 1993 Bob Amstadt
* [objects/linedda.c]
Finished LineDDA().
Fri Sep 3 11:52:18 1993 Bob Amstadt
* [windows/timer.c]

37
README
View File

@ -4,14 +4,47 @@ License.
INSTALLATION:
Linux:
Uncompress and untar this archive into the directory of your
choice. This release requires a Linux version 0.99 pl12 kernel with
ALPHA-diffs and sognal-diffs. Apply ALPHA-diffs first, and then
signal-diffs.
ALPHA-pl13-diffs.
NetBSD:
If you use BSD make rather than GNU make, you must apply the patches
in the file "bsdmake.patch". This release requires NetBSD 0.9 with
additional patches.
All:
To build Wine, first do a "make depend" and then a "make". The
executable "wine" will be built.
Grab a copy of Windows sol.exe (Solitaire) and run it with the command:
wine sol.exe
Have a nice game of solitaire, but be careful. Emulation isn't perfect.
So, occassionally it will crash.
WHAT'S NEW with version 0.4.0: (see ChangeLog for details)
- Wine now compiles and runs under NetBSD. Patches are
required for NetBSD.
- Wine stat patches included. Add "-DWINESTAT" to the definition
of COPTS in the main Makefile to activate.
- Preliminary keyboard handling.
- Button control window implemented.
- many other new functions added.
WHAT'S NEW with version 0.3.1: (see ChangeLog for details)
- LineDDA() completed
- numerous bug fixes
- INT 1Ah implemented
- SOUND DLL implemented
- More of WIN87EM DLL implemented
- OpenFile() and friends implemented
WHAT'S NEW with version 0.3.0: (see ChangeLog for details)
- Mouse capture
- Text justification and underlining

45
WIN31-APPLETS Normal file
View File

@ -0,0 +1,45 @@
Status of MS Windows 3.1 Applets
September 13, 1993
I copied the following DLLs from my Windows (3.1) directory to my Wine
directory. Below I show how most of the programs included with
Windows 3.1 died.
commdlg.dll olesvr.dll recorder.dll
olecli.dll pbrush.dll toolhelp.dll
Scott Laird (lair@midway.uchicago.edu)
calc.exe dies no USER.89 (CreateDialog)
calendar.exe dies no KERNEL.60 (FindResource)
cardfile.exe cannot read relocation info
charmap.exe dies no USER.89 (CreateDialog)
clipbrd.exe dies no error
clock.exe dies no KERNEL.60 (FindResource)
control.exe dies no KERNEL.90 (lstrlen)
drwatson.exe dies no KERNEL.36 (GetCurrentTask)
mplayer.exe no MMSYSTEM.dll
notepad.exe dies no error
nwpopup.exe dies no KERNEL.47 (GetModuleHandle)
packager.exe cannot read relocation info
pbrush.exe cannot read relocation info
pifedit.exe dies no KERNEL.60 (FindResource)
printman.exe dies no KERNEL.107 (SetErrorMode)
progman.exe dies no error
recorder.exe cannot read relocation info
regedit.exe dies no KERNEL.90 (lstrlen)
sol.exe ** RUNS **
soundrec.exe no MMSYSTEM.dll
sysedit.exe dies no USER.159 (GetSubMenu)
terminal.exe dies int21 2a
winfile.exe DOS ax=2fdf, dies no KERNEL.107
winhelp.exe dies no KERNEL.60 (FindResource)
winmine.exe dies no USER.256 (GetDesktopWindow)
winpopup.exe no NETAPI
wintutor.exe 'Cannot load WINTUTOR.DAT' (file present)
write.exe cannot read relocation info

147
bsdmake.patch Normal file
View File

@ -0,0 +1,147 @@
*** ./windows/Makefile.orig Fri Sep 3 16:37:58 1993
--- ./windows/Makefile Thu Sep 9 22:56:21 1993
***************
*** 14,19 ****
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! ifeq (.depend,$(wildcard .depend))
! include .depend
! endif
--- 14,19 ----
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! .if exists(.depend)
! .include ".depend"
! .endif
*** ./tools/Makefile.orig Tue Jul 20 18:40:18 1993
--- ./tools/Makefile Thu Sep 9 22:56:21 1993
***************
*** 12,17 ****
#
# Dependency lists
#
! ifeq (.depend,$(wildcard .depend))
! include .depend
! endif
--- 12,21 ----
#
# Dependency lists
#
! .if exists(.depend)
! .include ".depend"
! .endif
!
! #ifeq (.depend,$(wildcard .depend))
! #include .depend
! #endif
*** ./objects/Makefile.orig Fri Sep 3 16:39:20 1993
--- ./objects/Makefile Thu Sep 9 22:56:23 1993
***************
*** 14,19 ****
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! ifeq (.depend,$(wildcard .depend))
! include .depend
! endif
--- 14,19 ----
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! .if exists(.depend)
! .include ".depend"
! .endif
*** ./misc/Makefile.orig Thu Sep 9 11:16:49 1993
--- ./misc/Makefile Thu Sep 9 22:56:23 1993
***************
*** 13,18 ****
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! ifeq (.depend,$(wildcard .depend))
! include .depend
! endif
--- 13,18 ----
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! .if exists(.depend)
! .include ".depend"
! .endif
*** ./memory/Makefile.orig Tue Jul 20 18:43:02 1993
--- ./memory/Makefile Thu Sep 9 22:56:34 1993
***************
*** 13,18 ****
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! ifeq (.depend,$(wildcard .depend))
! include .depend
! endif
--- 13,18 ----
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! .if exists(.depend)
! .include ".depend"
! .endif
*** ./loader/Makefile.orig Mon Aug 30 20:44:18 1993
--- ./loader/Makefile Thu Sep 9 22:56:36 1993
***************
*** 13,18 ****
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! ifeq (.depend,$(wildcard .depend))
! include .depend
! endif
--- 13,18 ----
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! .if exists(.depend)
! .include ".depend"
! .endif
*** ./if1632/Makefile.orig Thu Sep 9 11:15:58 1993
--- ./if1632/Makefile Thu Sep 9 22:56:38 1993
***************
*** 42,50 ****
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! ifeq (.depend,$(wildcard .depend))
! include .depend
! endif
--- 42,50 ----
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! .if exists(.depend)
! .include ".depend"
! .endif
*** ./controls/Makefile.orig Mon Aug 30 19:40:39 1993
--- ./controls/Makefile Thu Sep 9 22:56:43 1993
***************
*** 14,19 ****
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! ifeq (.depend,$(wildcard .depend))
! include .depend
! endif
--- 14,20 ----
depend:
$(CC) $(CFLAGS) -M *.c > .depend
! .if exists(.depend)
! .include ".depend"
! .endif
!

View File

@ -1,7 +1,7 @@
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
OBJS=menu.o widgets.o SmeMenuButto.o WinLabel.o WinCommand.o WinMenuButto.o
# WinButton.o
OBJS=menu.o widgets.o button.o SmeMenuButto.o WinLabel.o WinCommand.o \
WinMenuButto.o WinButton.o
default: controls.o

605
controls/WinButton.c Normal file
View File

@ -0,0 +1,605 @@
/***********************************************************
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
* Modifications for Wine
*
* 8/28/93 David Metcalfe (david@prism.demon.co.uk)
* Created from Command widget and added 3D effect
*/
/*
* WinButton.c - WinButton button widget
*/
#include <stdio.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Xmu/Misc.h>
#include <X11/Xaw/XawInit.h>
#include "WinButtonP.h"
#include <X11/Xmu/Converters.h>
#define DEFAULT_HIGHLIGHT_THICKNESS 0
#define DEFAULT_SHAPE_HIGHLIGHT 32767
/****************************************************************
*
* Full class record constant
*
****************************************************************/
/* Private Data */
static char defaultTranslations[] =
"<EnterWindow>: highlight() \n\
<LeaveWindow>: reset() \n\
<Btn1Down>: set() \n\
<Btn1Up>: notify() unset() ";
#define offset(field) XtOffsetOf(WinButtonRec, field)
static XtResource resources[] = {
{XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer),
offset(winbutton.callbacks), XtRCallback, (XtPointer)NULL},
{XtNhighlightThickness, XtCThickness, XtRDimension, sizeof(Dimension),
offset(winbutton.highlight_thickness), XtRImmediate,
(XtPointer) DEFAULT_SHAPE_HIGHLIGHT},
{XtNshapeStyle, XtCShapeStyle, XtRShapeStyle, sizeof(int),
offset(winbutton.shape_style), XtRImmediate,
(XtPointer)XawShapeRectangle},
{XtNcornerRoundPercent, XtCCornerRoundPercent,
XtRDimension, sizeof(Dimension),
offset(winbutton.corner_round), XtRImmediate, (XtPointer) 25},
{XtNshadowThickness, XtCShadowThickness, XtRDimension, sizeof(Dimension),
offset(winbutton.shadow_thickness), XtRImmediate, (XtPointer) 2},
{XtNshadowHighlight, XtCShadowHighlight, XtRPixel, sizeof(Pixel),
offset(winbutton.shadow_highlight), XtRString, (XtPointer) "white"},
{XtNshadowShade, XtCShadowShade, XtRPixel, sizeof(Pixel),
offset(winbutton.shadow_shade), XtRString, (XtPointer) "grey25"},
};
#undef offset
static Boolean SetValues();
static void Initialize(), Redisplay(), Set(), Reset(), Notify(), Unset();
static void Highlight(), Unhighlight(), Destroy(), PaintWinButtonWidget();
static void ClassInitialize();
static Boolean ShapeButton();
static void Realize(), Resize();
static XtActionsRec actionsList[] = {
{"set", Set},
{"notify", Notify},
{"highlight", Highlight},
{"reset", Reset},
{"unset", Unset},
{"unhighlight", Unhighlight}
};
#define SuperClass ((WinLabelWidgetClass)&winLabelClassRec)
WinButtonClassRec winButtonClassRec = {
{
(WidgetClass) SuperClass, /* superclass */
"WinButton", /* class_name */
sizeof(WinButtonRec), /* size */
ClassInitialize, /* class_initialize */
NULL, /* class_part_initialize */
FALSE, /* class_inited */
Initialize, /* initialize */
NULL, /* initialize_hook */
Realize, /* realize */
actionsList, /* actions */
XtNumber(actionsList), /* num_actions */
resources, /* resources */
XtNumber(resources), /* resource_count */
NULLQUARK, /* xrm_class */
FALSE, /* compress_motion */
TRUE, /* compress_exposure */
TRUE, /* compress_enterleave */
FALSE, /* visible_interest */
Destroy, /* destroy */
Resize, /* resize */
Redisplay, /* expose */
SetValues, /* set_values */
NULL, /* set_values_hook */
XtInheritSetValuesAlmost, /* set_values_almost */
NULL, /* get_values_hook */
NULL, /* accept_focus */
XtVersion, /* version */
NULL, /* callback_private */
defaultTranslations, /* tm_table */
XtInheritQueryGeometry, /* query_geometry */
XtInheritDisplayAccelerator, /* display_accelerator */
NULL /* extension */
}, /* CoreClass fields initialization */
{
XtInheritChangeSensitive /* change_sensitive */
}, /* SimpleClass fields initialization */
{
0, /* field not used */
}, /* WinLabelClass fields initialization */
{
0, /* field not used */
}, /* WinButtonClass fields initialization */
};
/* for public consumption */
WidgetClass winButtonWidgetClass = (WidgetClass) &winButtonClassRec;
/****************************************************************
*
* Private Procedures
*
****************************************************************/
static GC
Get_GC(cbw, fg, bg)
WinButtonWidget cbw;
Pixel fg, bg;
{
XGCValues values;
values.foreground = fg;
values.background = bg;
values.font = cbw->winlabel.font->fid;
values.cap_style = CapProjecting;
if (cbw->winbutton.highlight_thickness > 1 )
values.line_width = cbw->winbutton.highlight_thickness;
else
values.line_width = 0;
return XtGetGC((Widget)cbw,
(GCForeground|GCBackground|GCFont|GCLineWidth|GCCapStyle),
&values);
}
static void
Get_Shadow_GCs(cbw)
WinButtonWidget cbw;
{
XGCValues values;
values.foreground = cbw->winbutton.shadow_highlight;
values.line_width = cbw->winbutton.shadow_thickness;
values.cap_style = CapProjecting;
cbw->winbutton.shadow_highlight_gc =
XtGetGC((Widget)cbw, (GCForeground|GCLineWidth|GCCapStyle), &values);
values.foreground = cbw->winbutton.shadow_shade;
values.line_width = cbw->winbutton.shadow_thickness;
values.cap_style = CapProjecting;
cbw->winbutton.shadow_shade_gc =
XtGetGC((Widget)cbw, (GCForeground|GCLineWidth|GCCapStyle), &values);
}
/* ARGSUSED */
static void
Initialize(request, new, args, num_args)
Widget request, new;
ArgList args; /* unused */
Cardinal *num_args; /* unused */
{
WinButtonWidget cbw = (WinButtonWidget) new;
int shape_event_base, shape_error_base;
if (cbw->winbutton.shape_style != XawShapeRectangle
&& !XShapeQueryExtension(XtDisplay(new), &shape_event_base,
&shape_error_base))
cbw->winbutton.shape_style = XawShapeRectangle;
if (cbw->winbutton.highlight_thickness == DEFAULT_SHAPE_HIGHLIGHT) {
if (cbw->winbutton.shape_style != XawShapeRectangle)
cbw->winbutton.highlight_thickness = 0;
else
cbw->winbutton.highlight_thickness = DEFAULT_HIGHLIGHT_THICKNESS;
}
XtVaSetValues(new, XtNbackground, "grey75");
cbw->winbutton.normal_GC = Get_GC(cbw, cbw->winlabel.foreground,
cbw->core.background_pixel);
cbw->winbutton.inverse_GC = Get_GC(cbw, cbw->core.background_pixel,
cbw->winlabel.foreground);
XtReleaseGC(new, cbw->winlabel.normal_GC);
cbw->winlabel.normal_GC = cbw->winbutton.normal_GC;
Get_Shadow_GCs(cbw);
cbw->winbutton.set = FALSE;
cbw->winbutton.highlighted = HighlightNone;
}
static Region
HighlightRegion(cbw)
WinButtonWidget cbw;
{
static Region outerRegion = NULL, innerRegion, emptyRegion;
XRectangle rect;
if (cbw->winbutton.highlight_thickness == 0 ||
cbw->winbutton.highlight_thickness >
(Dimension) ((Dimension) Min(cbw->core.width, cbw->core.height)/2))
return(NULL);
if (outerRegion == NULL) {
/* save time by allocating scratch regions only once. */
outerRegion = XCreateRegion();
innerRegion = XCreateRegion();
emptyRegion = XCreateRegion();
}
rect.x = rect.y = 0;
rect.width = cbw->core.width;
rect.height = cbw->core.height;
XUnionRectWithRegion( &rect, emptyRegion, outerRegion );
rect.x = rect.y = cbw->winbutton.highlight_thickness;
rect.width -= cbw->winbutton.highlight_thickness * 2;
rect.height -= cbw->winbutton.highlight_thickness * 2;
XUnionRectWithRegion( &rect, emptyRegion, innerRegion );
XSubtractRegion( outerRegion, innerRegion, outerRegion );
return outerRegion;
}
/***************************
*
* Action Procedures
*
***************************/
/* ARGSUSED */
static void
Set(w,event,params,num_params)
Widget w;
XEvent *event;
String *params; /* unused */
Cardinal *num_params; /* unused */
{
WinButtonWidget cbw = (WinButtonWidget)w;
if (cbw->winbutton.set)
return;
cbw->winbutton.set= TRUE;
if (XtIsRealized(w))
PaintWinButtonWidget(w, (Region) NULL, TRUE);
}
/* ARGSUSED */
static void
Unset(w,event,params,num_params)
Widget w;
XEvent *event;
String *params; /* unused */
Cardinal *num_params;
{
WinButtonWidget cbw = (WinButtonWidget)w;
if (!cbw->winbutton.set)
return;
cbw->winbutton.set = FALSE;
if (XtIsRealized(w)) {
XClearWindow(XtDisplay(w), XtWindow(w));
PaintWinButtonWidget(w, (Region) NULL, TRUE);
}
}
/* ARGSUSED */
static void
Reset(w,event,params,num_params)
Widget w;
XEvent *event;
String *params; /* unused */
Cardinal *num_params; /* unused */
{
WinButtonWidget cbw = (WinButtonWidget)w;
if (cbw->winbutton.set) {
cbw->winbutton.highlighted = HighlightNone;
Unset(w, event, params, num_params);
}
else
Unhighlight(w, event, params, num_params);
}
/* ARGSUSED */
static void
Highlight(w,event,params,num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
{
WinButtonWidget cbw = (WinButtonWidget)w;
if ( *num_params == (Cardinal) 0)
cbw->winbutton.highlighted = HighlightWhenUnset;
else {
if ( *num_params != (Cardinal) 1)
XtWarning("Too many parameters passed to highlight action table.");
switch (params[0][0]) {
case 'A':
case 'a':
cbw->winbutton.highlighted = HighlightAlways;
break;
default:
cbw->winbutton.highlighted = HighlightWhenUnset;
break;
}
}
if (XtIsRealized(w))
PaintWinButtonWidget(w, HighlightRegion(cbw), TRUE);
}
/* ARGSUSED */
static void
Unhighlight(w,event,params,num_params)
Widget w;
XEvent *event;
String *params; /* unused */
Cardinal *num_params; /* unused */
{
WinButtonWidget cbw = (WinButtonWidget)w;
cbw->winbutton.highlighted = HighlightNone;
if (XtIsRealized(w))
PaintWinButtonWidget(w, HighlightRegion(cbw), TRUE);
}
/* ARGSUSED */
static void
Notify(w,event,params,num_params)
Widget w;
XEvent *event;
String *params; /* unused */
Cardinal *num_params; /* unused */
{
WinButtonWidget cbw = (WinButtonWidget)w;
/* check to be sure state is still Set so that user can cancel
the action (e.g. by moving outside the window, in the default
bindings.
*/
if (cbw->winbutton.set)
XtCallCallbackList(w, cbw->winbutton.callbacks, NULL);
}
/*
* Repaint the widget window
*/
/************************
*
* REDISPLAY (DRAW)
*
************************/
/* ARGSUSED */
static void
Redisplay(w, event, region)
Widget w;
XEvent *event;
Region region;
{
PaintWinButtonWidget(w, region, FALSE);
}
/* Function Name: PaintWinButtonWidget
* Description: Paints the winbutton widget.
* Arguments: w - the winbutton widget.
* region - region to paint (passed to the superclass).
* change - did it change either set or highlight state?
* Returns: none
*/
static void
PaintWinButtonWidget(w, region, change)
Widget w;
Region region;
Boolean change;
{
WinButtonWidget cbw = (WinButtonWidget) w;
Boolean very_thick;
GC norm_gc, rev_gc;
int offset;
very_thick = cbw->winbutton.highlight_thickness >
(Dimension)((Dimension) Min(cbw->core.width,
cbw->core.height)/2);
offset = cbw->winbutton.shadow_thickness / 2;
if (cbw->winbutton.set) {
XClearWindow(XtDisplay(w), XtWindow(w));
region = NULL; /* Force label to repaint text. */
}
else {
XDrawLine(XtDisplay(w), XtWindow(w), cbw->winbutton.shadow_highlight_gc,
offset, offset, cbw->core.width - offset, offset);
XDrawLine(XtDisplay(w), XtWindow(w), cbw->winbutton.shadow_highlight_gc,
offset, offset, offset, cbw->core.height - offset);
XDrawLine(XtDisplay(w), XtWindow(w), cbw->winbutton.shadow_shade_gc,
offset, cbw->core.height - offset + 1,
cbw->core.width - offset, cbw->core.height - offset);
XDrawLine(XtDisplay(w), XtWindow(w), cbw->winbutton.shadow_shade_gc,
cbw->core.width - offset, offset + 1,
cbw->core.width - offset, cbw->core.height - offset);
}
if (cbw->winbutton.highlight_thickness <= 0)
{
(*SuperClass->core_class.expose) (w, (XEvent *) NULL, region);
return;
}
/*
* If we are set then use the same colors as if we are not highlighted.
*/
if (cbw->winbutton.set == (cbw->winbutton.highlighted == HighlightNone)) {
norm_gc = cbw->winbutton.inverse_GC;
rev_gc = cbw->winbutton.normal_GC;
}
else {
norm_gc = cbw->winbutton.normal_GC;
rev_gc = cbw->winbutton.inverse_GC;
}
if ( !( (!change && (cbw->winbutton.highlighted == HighlightNone)) ||
((cbw->winbutton.highlighted == HighlightWhenUnset) &&
(cbw->winbutton.set))) ) {
if (very_thick) {
cbw->winlabel.normal_GC = norm_gc; /* Give the label the right GC. */
XFillRectangle(XtDisplay(w),XtWindow(w), rev_gc,
0, 0, cbw->core.width, cbw->core.height);
}
else {
/* wide lines are centered on the path, so indent it */
int offset = cbw->winbutton.highlight_thickness/2;
XDrawRectangle(XtDisplay(w),XtWindow(w), rev_gc, offset, offset,
cbw->core.width - cbw->winbutton.highlight_thickness,
cbw->core.height - cbw->winbutton.highlight_thickness);
}
}
(*SuperClass->core_class.expose) (w, (XEvent *) NULL, region);
}
static void
Destroy(w)
Widget w;
{
WinButtonWidget cbw = (WinButtonWidget) w;
/* so WinLabel can release it */
if (cbw->winlabel.normal_GC == cbw->winbutton.normal_GC)
XtReleaseGC( w, cbw->winbutton.inverse_GC );
else
XtReleaseGC( w, cbw->winbutton.normal_GC );
}
/*
* Set specified arguments into widget
*/
/* ARGSUSED */
static Boolean
SetValues (current, request, new)
Widget current, request, new;
{
WinButtonWidget oldcbw = (WinButtonWidget) current;
WinButtonWidget cbw = (WinButtonWidget) new;
Boolean redisplay = False;
if ( oldcbw->core.sensitive != cbw->core.sensitive && !cbw->core.sensitive) {
/* about to become insensitive */
cbw->winbutton.set = FALSE;
cbw->winbutton.highlighted = HighlightNone;
redisplay = TRUE;
}
if ( (oldcbw->winlabel.foreground != cbw->winlabel.foreground) ||
(oldcbw->core.background_pixel != cbw->core.background_pixel) ||
(oldcbw->winbutton.highlight_thickness !=
cbw->winbutton.highlight_thickness) ||
(oldcbw->winlabel.font != cbw->winlabel.font) )
{
if (oldcbw->winlabel.normal_GC == oldcbw->winbutton.normal_GC)
/* WinLabel has release one of these */
XtReleaseGC(new, cbw->winbutton.inverse_GC);
else
XtReleaseGC(new, cbw->winbutton.normal_GC);
cbw->winbutton.normal_GC = Get_GC(cbw, cbw->winlabel.foreground,
cbw->core.background_pixel);
cbw->winbutton.inverse_GC = Get_GC(cbw, cbw->core.background_pixel,
cbw->winlabel.foreground);
XtReleaseGC(new, cbw->winlabel.normal_GC);
cbw->winlabel.normal_GC = (cbw->winbutton.set
? cbw->winbutton.inverse_GC
: cbw->winbutton.normal_GC);
redisplay = True;
}
if ( XtIsRealized(new)
&& oldcbw->winbutton.shape_style != cbw->winbutton.shape_style
&& !ShapeButton(cbw, TRUE))
{
cbw->winbutton.shape_style = oldcbw->winbutton.shape_style;
}
return (redisplay);
}
static void ClassInitialize()
{
XawInitializeWidgetSet();
XtSetTypeConverter( XtRString, XtRShapeStyle, XmuCvtStringToShapeStyle,
NULL, 0, XtCacheNone, NULL );
}
static Boolean
ShapeButton(cbw, checkRectangular)
WinButtonWidget cbw;
Boolean checkRectangular;
{
Dimension corner_size;
if ( (cbw->winbutton.shape_style == XawShapeRoundedRectangle) ) {
corner_size = (cbw->core.width < cbw->core.height) ? cbw->core.width
: cbw->core.height;
corner_size = (int) (corner_size * cbw->winbutton.corner_round) / 100;
}
if (checkRectangular || cbw->winbutton.shape_style != XawShapeRectangle) {
if (!XmuReshapeWidget((Widget) cbw, cbw->winbutton.shape_style,
corner_size, corner_size)) {
cbw->winbutton.shape_style = XawShapeRectangle;
return(False);
}
}
return(TRUE);
}
static void Realize(w, valueMask, attributes)
Widget w;
Mask *valueMask;
XSetWindowAttributes *attributes;
{
(*winButtonWidgetClass->core_class.superclass->core_class.realize)
(w, valueMask, attributes);
ShapeButton( (WinButtonWidget) w, FALSE);
}
static void Resize(w)
Widget w;
{
if (XtIsRealized(w))
ShapeButton( (WinButtonWidget) w, FALSE);
(*winButtonWidgetClass->core_class.superclass->core_class.resize)(w);
}

109
controls/WinButton.h Normal file
View File

@ -0,0 +1,109 @@
/***********************************************************
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
* Modifications for Wine
*
* 8/28/93 David Metcalfe (david@prism.demon.co.uk)
* Created from Command widget and added 3D effect
*/
#ifndef _WinButton_h
#define _WinButton_h
#include "WinLabel.h"
/* WinButton widget resources:
Name Class RepType Default Value
---- ----- ------- -------------
accelerators Accelerators AcceleratorTable NULL
ancestorSensitive AncestorSensitive Boolean True
background Background Pixel XtDefaultBackground
backgroundPixmap Pixmap Pixmap XtUnspecifiedPixmap
bitmap Pixmap Pixmap None
borderColor BorderColor Pixel XtDefaultForeground
borderPixmap Pixmap Pixmap XtUnspecifiedPixmap
borderWidth BorderWidth Dimension 1
callback Callback XtCallbackList NULL
colormap Colormap Colormap parent's colormap
cornerRoundPercent CornerRoundPercent Dimension 25
cursor Cursor Cursor None
cursorName Cursor String NULL
depth Depth int parent's depth
destroyCallback Callback XtCallbackList NULL
encoding Encoding UnsignedChar XawTextEncoding8bit
font Font XFontStruct* XtDefaultFont
foreground Foreground Pixel XtDefaultForeground
height Height Dimension text height
highlightThickness Thickness Dimension 0 if shaped, else 2
insensitiveBorder Insensitive Pixmap Gray
internalHeight Height Dimension 2
internalWidth Width Dimension 4
justify Justify XtJustify XtJustifyCenter
label Label String NULL
leftBitmap LeftBitmap Pixmap None
mappedWhenManaged MappedWhenManaged Boolean True
pointerColor Foreground Pixel XtDefaultForeground
pointerColorBackground Background Pixel XtDefaultBackground
resize Resize Boolean True
screen Screen Screen parent's Screen
sensitive Sensitive Boolean True
shadowHighlight ShadowHighlight Pixel White
shadowShade ShadowShade Pixel Grey25
shadowThickness ShadowThickness Dimension 2
shapeStyle ShapeStyle ShapeStyle Rectangle
translations Translations TranslationTable see doc or source
width Width Dimension text width
x Position Position 0
y Position Position 0
*/
#define XtNhighlightThickness "highlightThickness"
#define XtNshapeStyle "shapeStyle"
#define XtCShapeStyle "ShapeStyle"
#define XtRShapeStyle "ShapeStyle"
#define XtNcornerRoundPercent "cornerRoundPercent"
#define XtCCornerRoundPercent "CornerRoundPercent"
#define XtNshadowThickness "shadowThickness"
#define XtCShadowThickness "ShadowThickness"
#define XtNshadowHighlight "shadowHighlight"
#define XtCShadowHighlight "ShadowHighlight"
#define XtNshadowShade "shadowShade"
#define XtCShadowShade "ShadowShade"
#define XawShapeRectangle XmuShapeRectangle
#define XawShapeOval XmuShapeOval
#define XawShapeEllipse XmuShapeEllipse
#define XawShapeRoundedRectangle XmuShapeRoundedRectangle
extern WidgetClass winButtonWidgetClass;
typedef struct _WinButtonClassRec *WinButtonWidgetClass;
typedef struct _WinButtonRec *WinButtonWidget;
#endif /* _WinButton_h */
/* DON'T ADD STUFF AFTER THIS */

123
controls/WinButtonP.h Normal file
View File

@ -0,0 +1,123 @@
/***********************************************************
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
* Modifications for Wine
*
* 8/28/93 David Metcalfe (david@prism.demon.co.uk)
* Created from Command widget and added 3D effect
*/
/*
* WinButtonP.h - Private definitions for WinButton widget
*
*/
#ifndef _WinButtonP_h
#define _WinButtonP_h
#include "WinButton.h"
#include "WinLabelP.h"
/***********************************************************************
*
* WinButton Widget Private Data
*
***********************************************************************/
typedef enum {
HighlightNone, /* Do not highlight. */
HighlightWhenUnset, /* Highlight only when unset, this is
to preserve current command widget
functionality. */
HighlightAlways /* Always highlight, lets the toggle widget
and other subclasses do the right thing. */
} XtCommandHighlight;
/************************************
*
* Class structure
*
***********************************/
/* New fields for the WinButton widget class record */
typedef struct _WinButtonClass
{
int makes_compiler_happy; /* not used */
} WinButtonClassPart;
/* Full class record declaration */
typedef struct _WinButtonClassRec {
CoreClassPart core_class;
SimpleClassPart simple_class;
WinLabelClassPart winlabel_class;
WinButtonClassPart winbutton_class;
} WinButtonClassRec;
extern WinButtonClassRec winButtonClassRec;
/***************************************
*
* Instance (widget) structure
*
**************************************/
/* New fields for the WinButton widget record */
typedef struct {
/* resources */
Dimension highlight_thickness;
Dimension shadow_thickness;
Pixel shadow_shade;
Pixel shadow_highlight;
XtCallbackList callbacks;
/* private state */
Pixmap gray_pixmap;
GC normal_GC;
GC inverse_GC;
GC shadow_highlight_gc;
GC shadow_shade_gc;
Boolean set;
XtCommandHighlight highlighted;
/* more resources */
int shape_style;
Dimension corner_round;
} WinButtonPart;
/* XtEventsPtr eventTable;*/
/* Full widget declaration */
typedef struct _WinButtonRec {
CorePart core;
SimplePart simple;
WinLabelPart winlabel;
WinButtonPart winbutton;
} WinButtonRec;
#endif /* _WinButtonP_h */

86
controls/button.c Normal file
View File

@ -0,0 +1,86 @@
/*
* Interface code to button widgets
*
* Copyright David W. Metcalfe, 1993
*
*/
static char Copyright[] = "Copyright David W. Metcalfe, 1993";
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include "WinButton.h"
#include "windows.h"
#include "heap.h"
#include "win.h"
static void BUTTON_WinButtonCallback(Widget w, XtPointer client_data,
XtPointer call_data);
void BUTTON_CreateButton(LPSTR className, LPSTR buttonLabel, HWND hwnd)
{
WND *wndPtr = WIN_FindWndPtr(hwnd);
WND *parentPtr = WIN_FindWndPtr(wndPtr->hwndParent);
DWORD style;
char widgetName[15];
#ifdef DEBUG_BUTTON
printf("button: label = %s, x = %d, y = %d\n", buttonLabel,
wndPtr->rectClient.left, wndPtr->rectClient.top);
printf(" width = %d, height = %d\n",
wndPtr->rectClient.right - wndPtr->rectClient.left,
wndPtr->rectClient.bottom - wndPtr->rectClient.top);
#endif
if (!wndPtr)
return;
style = wndPtr->dwStyle & 0x0000000F;
switch (style)
{
case BS_PUSHBUTTON:
case BS_DEFPUSHBUTTON:
sprintf(widgetName, "%s%d", className, wndPtr->wIDmenu);
wndPtr->winWidget = XtVaCreateManagedWidget(widgetName,
winButtonWidgetClass,
parentPtr->winWidget,
XtNlabel, buttonLabel,
XtNx, wndPtr->rectClient.left,
XtNy, wndPtr->rectClient.top,
XtNwidth, wndPtr->rectClient.right -
wndPtr->rectClient.left,
XtNheight, wndPtr->rectClient.bottom -
wndPtr->rectClient.top,
XtVaTypedArg, XtNbackground, XtRString,
"grey70", strlen("grey75")+1,
NULL);
XtAddCallback(wndPtr->winWidget, XtNcallback,
BUTTON_WinButtonCallback, (XtPointer) hwnd);
break;
default:
printf("CreateButton: Unsupported button style %lX\n",
wndPtr->dwStyle);
}
GlobalUnlock(hwnd);
GlobalUnlock(wndPtr->hwndParent);
}
static void BUTTON_WinButtonCallback(Widget w, XtPointer client_data,
XtPointer call_data)
{
HWND hwnd = (HWND) client_data;
WND *wndPtr;
wndPtr = WIN_FindWndPtr(hwnd);
CallWindowProc(wndPtr->lpfnWndProc, wndPtr->hwndParent, WM_COMMAND,
wndPtr->wIDmenu, MAKELPARAM(hwnd, BN_CLICKED));
GlobalUnlock(hwnd);
}

View File

@ -7,6 +7,7 @@
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "windows.h"
#include "win.h"
static LONG WIDGETS_ButtonWndProc( HWND hwnd, WORD message,
@ -71,18 +72,20 @@ static LONG WIDGETS_ButtonWndProc( HWND hwnd, WORD message,
return 0;
case WM_PAINT:
{
HDC hdc;
PAINTSTRUCT ps;
RECT rect;
hdc = BeginPaint( hwnd, &ps );
GetClientRect( hwnd, &rect );
DrawText(hdc, "Button", -1, &rect,
DT_SINGLELINE | DT_CENTER | DT_VCENTER );
EndPaint( hwnd, &ps );
return 0;
}
{
PAINTSTRUCT ps;
BeginPaint( hwnd, &ps );
EndPaint( hwnd, &ps );
return 0;
}
case WM_COMMAND:
{
WND *wndParent;
wndParent = WIN_FindWndPtr(hwnd);
CallWindowProc(wndParent->lpfnWndProc, hwnd, message, wParam, lParam);
return 0;
}
default:
return DefWindowProc( hwnd, message, wParam, lParam );

View File

@ -1,9 +1,10 @@
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
BUILDOBJS=dll_kernel.o dll_user.o dll_gdi.o dll_unixlib.o \
dll_win87em.o dll_shell.o \
dll_win87em.o dll_shell.o dll_sound.o dll_keyboard.o\
dll_kernel_tab.o dll_user_tab.o dll_gdi_tab.o dll_unixlib_tab.o \
dll_win87em_tab.o dll_shell_tab.o
dll_win87em_tab.o dll_shell_tab.o \
dll_sound_tab.o dll_keyboard_tab.o
MUST_BE_LINKED_FIRST=call.o $(BUILDOBJS)
@ -35,9 +36,19 @@ dll_win87em.S dll_win87em_tab.c: ../tools/build win87em.spec
dll_shell.S dll_shell_tab.c: ../tools/build shell.spec
../tools/build shell.spec
dll_sound.S dll_sound_tab.c: ../tools/build sound.spec
../tools/build sound.spec
dll_keyboard.S dll_keyboard_tab.c: ../tools/build keyboard.spec
../tools/build keyboard.spec
depend:
$(CC) $(CFLAGS) -M *.c > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif

View File

@ -1,6 +1,12 @@
/*
* Copyright Robert J. Amstadt, 1993
*/
#ifdef linux
#define UDATASEL 0x2b
#endif
#ifdef __NetBSD__
#define UDATASEL 0x27
#endif
.data
jump_target:
return_value:
@ -95,7 +101,11 @@ _CallToInit16:
movw %ax,%ss
movl %esp,%eax
movl %eax,%ebp
#if 1
movw $ UDATASEL,%ax
movw %ax,%fs
movw %ax,%gs
#endif
/*
* Call entry point
*/
@ -114,7 +124,7 @@ _CallToInit16:
* GDT usage.
*/
pushl %eax
movw $0x2b,%ax
movw $ UDATASEL,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%fs
@ -194,7 +204,7 @@ _CallTo16:
* GDT usage.
*/
pushl %eax
movw $0x2b,%ax
movw $ UDATASEL,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%fs
@ -249,7 +259,7 @@ _CallTo32:
* Restore segment registers.
*/
pushl %eax
movw $0x2b,%ax
movw $ UDATASEL,%ax
movw %ax,%ds
movw %ax,%es
popl %eax

View File

@ -111,6 +111,7 @@ length 490
105 pascal SelectVisRgn(word word) SelectVisRgn(1 2)
106 pascal SetBitmapBits(word long ptr) SetBitmapBits(1 2 3)
117 pascal SetDCOrg(word s_word s_word) SetDCOrg(1 2 3)
128 pascal MulDiv(s_word s_word s_word) MulDiv(1 2 3)
129 pascal SaveVisRgn(word) SaveVisRgn(1)
130 pascal RestoreVisRgn(word) RestoreVisRgn(1)
131 pascal InquireVisRgn(word) InquireVisRgn(1)

View File

@ -2,7 +2,7 @@
#
name kernel
id 1
length 410
length 415
3 return GetVersion 0 0x301
4 pascal LocalInit(word word word) LocalInit(1 2 3)
@ -32,6 +32,11 @@ length 410
50 pascal GetProcAddress(word ptr) GetProcAddress(1 2)
51 pascal MakeProcInstance(ptr word) CALLBACK_MakeProcInstance(1 2)
52 pascal FreeProcInstance(ptr) FreeProcInstance(1)
74 pascal OpenFile(ptr ptr word) KERNEL_OpenFile(1 2 3)
81 pascal _lclose(word) KERNEL__lclose(1)
82 pascal _lread(word ptr word) KERNEL__lread(1 2 3)
85 pascal _lopen(ptr word) KERNEL__lopen(1 2)
86 pascal _lwrite(word ptr word) KERNEL__lwrite(1 2 3)
91 register InitTask(word word word word word
word word word word word)
KERNEL_InitTask()
@ -40,6 +45,7 @@ length 410
KERNEL_DOS3Call()
111 pascal GlobalWire(word) GlobalLock(1)
112 pascal GlobalUnWire(word) GlobalUnlock(1)
115 pascal OutputDebugString(ptr) OutputDebugString(1)
121 return LocalShrink 4 0
127 pascal GetPrivateProfileInt(ptr ptr s_word ptr)
GetPrivateProfileInt(1 2 3 4)
@ -57,3 +63,6 @@ length 410
192 pascal GlobalPageUnlock(word) GlobalUnlock(1)
197 pascal GlobalFix(word) GlobalLock(1)
198 pascal GlobalUnfix(word) GlobalUnlock(1)
57 pascal GetProfileInt(ptr ptr word) GetProfileInt(1 2 3)
58 pascal GetProfileString(ptr ptr ptr ptr word) GetProfileString(1 2 3 4 5)
199 pascal SetHandleCount(word) SetHandleCount(1)

27
if1632/keyboard.spec Normal file
View File

@ -0,0 +1,27 @@
# $Id: keyboard.spec,v 1.1 1993/09/10 05:32:12 scott Exp $
#
name keyboard
id 8
length 137
#1 pascal Inquire
#2 pascal Enable
#3 pascal Disable
4 pascal ToAscii(word word ptr ptr word) ToAscii(1 2 3 4 5)
5 pascal AnsiToOem(ptr ptr) AnsiToOem(1 2)
6 pascal OemToAnsi(ptr ptr) OemToAnsi(1 2)
#7 pascal SetSpeed
#100 pascal ScreenSwitchEnable
#126 pascal GetTableSeg
#127 pascal NewTable
128 pascal OemKeyScan(word) OemKeyScan(1)
129 pascal VkKeyScan(byte) VkKeyScan(1)
130 pascal GetKeyboardType(byte) GetKeyboardType(1)
131 pascal MapVirtualKey(word word) MapVirtualKey(1 2)
132 pascal GetKbCodePage() GetKbCodePage()
133 pascal GetKeyNameText(long ptr word) GetKeyNameText(1 2 3)
134 pascal AnsiToOemBuff(ptr ptr word) AnsiToOemBuff(1 2 3)
135 pascal OemToAnsiBuff(ptr ptr word) OemToAnsiBuff(1 2 3)
#136 pascal EnableKbSysReq
#137 pascal GetBiosKeyProc

View File

@ -7,17 +7,19 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#ifdef linux
#include <linux/unistd.h>
#include <linux/head.h>
#include <linux/ldt.h>
#include <linux/segment.h>
#endif
#include <errno.h>
#include "neexe.h"
#include "segmem.h"
#include "prototypes.h"
#include "dlls.h"
#define N_BUILTINS 6
#define N_BUILTINS 8
struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] =
{
@ -27,6 +29,8 @@ struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] =
{ "UNIXLIB", UNIXLIB_table, 10, 4 },
{ "WIN87EM", WIN87EM_table, 10, 5 },
{ "SHELL", SHELL_table, 256, 6 },
{ "SOUND", SOUND_table, 20, 7 },
{ "KEYBOARD",KEYBOARD_table,137, 8 },
};
unsigned short *Stack16Frame;
@ -239,3 +243,40 @@ ReturnArg(int arg)
{
return arg;
}
#ifdef WINESTAT
void winestat(){
int i, j;
double perc;
int used, implemented;
int tused, timplemented;
struct dll_table_entry_s *table;
tused = 0;
timplemented = 0;
for (i = 0; i < N_BUILTINS; i++) {
table = dll_builtin_table[i].dll_table;
used = 0;
implemented = 0;
for(j=0; j < dll_builtin_table[i].dll_table_length; j++) {
if(table[j].used){
used++;
if (table[j].handler) implemented++;
else
printf("%s.%d\n",
dll_builtin_table[i].dll_name,
j);
};
};
tused += used;
timplemented += implemented;
if(used)
perc = implemented * 100.00 / used;
else
perc = 0.0;
printf("%s: %d %d %3.1f\n", dll_builtin_table[i].dll_name, implemented, used, perc);
};
perc = timplemented * 100.00 / tused;
printf("TOTAL: %d %d %3.1f\n",timplemented, tused, perc);
}
#endif /* WINESTAT */

View File

@ -1,5 +1,5 @@
# $Id: shell.spec,v 1.3 1993/07/04 04:04:21 root Exp root $
#
name shell
id 5
id 6
length 256

17
if1632/sound.spec Normal file
View File

@ -0,0 +1,17 @@
# $Id: win87em.spec,v 1.3 1993/07/04 04:04:21 root Exp root $
#
name sound
id 7
length 20
1 pascal OPENSOUND() OpenSound()
2 pascal CLOSESOUND() CloseSound()
3 pascal SETVOICEQUEUESIZE(word word) SetVoiceQueueSize(1 2)
4 pascal SETVOICENOTE(word word word word) SetVoiceNote(1 2 3 4)
5 pascal SETVOICEACCENT(word word word word word)
SetVoiceAccent(1 2 3 4 5)
6 pascal SETVOICEENVELOPE(word word word) SetVoiceEnvelope(1 2 3)
7 pascal SETSOUNDNOISE(word word) SetSoundNoise(1 2)
8 pascal SETVOICESOUND(word long word) SetVoiceSound(1 2 3)
9 pascal STARTSOUND() StartSound()
10 pascal STOPSOUND() StopSound()

View File

@ -83,3 +83,5 @@ length 540
373 pascal SubtractRect(ptr ptr ptr) SubtractRect(1 2 3)
403 pascal UnregisterClass(ptr word) UnregisterClass(1 2)
411 pascal AppendMenu(word word word ptr) AppendMenu(1 2 3 4)
177 pascal LoadAccelerators(word ptr) LoadAccelerators(1 2)
421 pascal wvsprintf(ptr ptr ptr) wvsprintf(1 2 3)

View File

@ -3,3 +3,9 @@
name win87em
id 5
length 10
1 register _fpMath(word word word word
word word word word) WIN87_fpmath()
3 pascal __WinEm87Info(ptr word) WIN87_WinEm87Info(1 2)
4 pascal __WinEm87Restore(ptr word) WIN87_WinEm87Restore(1 2)
5 pascal __WinEm87Save(ptr word) WIN87_WinEm87Save(1 2)

View File

@ -36,6 +36,9 @@ struct dll_table_entry_s
char *export_name;
void *handler; /* Address of function to process request */
int handler_type; /* C or PASCAL calling convention */
#ifdef WINESTAT
int used; /* Number of times this function referenced */
#endif
int n_args; /* Number of arguments passed to function */
DLL_ARG args[DLL_MAX_ARGS]; /* Argument conversion data */
};
@ -54,5 +57,7 @@ extern struct dll_table_entry_s GDI_table[];
extern struct dll_table_entry_s UNIXLIB_table[];
extern struct dll_table_entry_s WIN87EM_table[];
extern struct dll_table_entry_s SHELL_table[];
extern struct dll_table_entry_s SOUND_table[];
extern struct dll_table_entry_s KEYBOARD_table[];
#endif /* DLLS_H */

View File

@ -136,6 +136,7 @@ struct relocation_entry_s
/* Used by Windows 3.0 programs, like when getting selector to be
given to makeprocinst */
#define NE_RELTYPE_INT1 4
#define NE_RELTYPE_OFFSET16 5
/*
* DOS PSP
*/

View File

@ -45,6 +45,9 @@ typedef int *LPCATCHBUF;
#define NULL (void *)0
#endif
#define MAKELPARAM(low, high) ((LONG)(((WORD)(low)) | \
(((DWORD)((WORD)(high))) << 16)))
typedef struct { short left, top, right, bottom; } RECT;
typedef RECT *LPRECT;
typedef RECT *NPRECT;
@ -697,6 +700,20 @@ typedef OFSTRUCT *LPOFSTRUCT;
#define OF_READ 0x0000
#define OF_WRITE 0x0001
#define OF_READWRITE 0x0002
#define OF_CANCEL 0x0800
#define OF_CREATE 0x1000
#define OF_DELETE 0x0200
#define OF_EXIST 0x4000
#define OF_PARSE 0x0100
#define OF_PROMPT 0x2000
#define OF_REOPEN 0x8000
#define OF_SHARE_COMPAT 0x0000
#define OF_SHARE_DENY_NONE 0x0040
#define OF_SHARE_DENY_READ 0x0030
#define OF_SHARE_DENY_WRITE 0x0020
#define OF_SHARE_EXCLUSIVE 0x0010
#define OF_VERIFY 0x0400
typedef struct
{
@ -905,6 +922,29 @@ enum { SW_HIDE, SW_SHOWNORMAL, SW_NORMAL, SW_SHOWMINIMIZED, SW_SHOWMAXIMIZED,
#define WS_CHILDWINDOW (WS_CHILD)
#define WS_TILEDWINDOW (WS_OVERLAPPEDWINDOW)
/* Button control styles */
#define BS_PUSHBUTTON 0x00000000L
#define BS_DEFPUSHBUTTON 0x00000001L
#define BS_CHECKBOX 0x00000002L
#define BS_AUTOCHECKBOX 0x00000003L
#define BS_RADIOBUTTON 0x00000004L
#define BS_3STATE 0x00000005L
#define BS_AUTO3STATE 0x00000006L
#define BS_GROUPBOX 0x00000007L
#define BS_USERBUTTON 0x00000008L
#define BS_AUTORADIOBUTTON 0x00000009L
#define BS_OWNERDRAW 0x0000000BL
#define BS_LEFTTEXT 0x00000020L
/* Button notification codes */
#define BN_CLICKED 0
#define BN_PAINT 1
#define BN_HILITE 2
#define BN_UNLITE 3
#define BN_DISABLE 4
#define BN_DOUBLECLICKED 5
#define GMEM_MOVEABLE 0x0002
#define F(ret,name) ret name(void);

View File

@ -7,9 +7,11 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#ifdef linux
#include <linux/unistd.h>
#include <linux/head.h>
#include <linux/ldt.h>
#endif
#include <errno.h>
#include "neexe.h"
#include "segmem.h"

View File

@ -4,27 +4,35 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <linux/unistd.h>
#include <linux/head.h>
#include <linux/ldt.h>
#include "prototypes.h"
#ifdef __NetBSD__
#include <machine/segments.h>
#endif
/**********************************************************************
* print_ldt
*/
/* XXX These are *real* 386 descriptors !! */
void
print_ldt()
{
char buffer[0x10000];
struct modify_ldt_ldt_s ldt_info;
unsigned long *lp;
unsigned long base_addr, limit;
int type, dpl, i;
#ifdef __NetBSD__
struct segment_descriptor *sd;
#endif
if (get_ldt(buffer) < 0)
exit(1);
lp = (unsigned long *) buffer;
#ifdef __NetBSD__
sd = (struct segment_descriptor *) buffer;
#endif
for (i = 0; i < 32; i++, lp++)
{
/* First 32 bits of descriptor */
@ -35,9 +43,15 @@ print_ldt()
/* First 32 bits of descriptor */
base_addr |= (*lp & 0xFF000000) | ((*lp << 16) & 0x00FF0000);
limit |= (*lp & 0x000F0000);
type = (*lp >> 9) & 7;
#ifdef linux
type = (*lp >> 10) & 5;
dpl = (*lp >> 13) & 3;
#endif
#ifdef __NetBSD__
type = sd->sd_type;
dpl = sd->sd_dpl;
sd++;
#endif
if (*lp & 1000)
{
printf("Entry %2d: Base %08.8x, Limit %05.5x, DPL %d, Type %d\n",

View File

@ -4,16 +4,66 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#ifdef linux
#include <linux/unistd.h>
#include <linux/head.h>
#include <linux/ldt.h>
_syscall3(int, modify_ldt, int, func, void *, ptr, unsigned long, bytecount)
#endif
#ifdef __NetBSD__
#include <machine/segments.h>
extern int i386_get_ldt(int, union descriptor *, int);
extern int i386_set_ldt(int, union descriptor *, int);
struct segment_descriptor *
make_sd(unsigned base, unsigned limit, int contents, int read_exec_only, int seg32, int inpgs)
{
#if 1
static long d[2];
d[0] = ((base & 0x0000ffff) << 16) |
(limit & 0x0ffff);
d[1] = (base & 0xff000000) |
((base & 0x00ff0000)>>16) |
(limit & 0xf0000) |
(contents << 10) |
((read_exec_only ^ 1) << 9) |
(seg32 << 22) |
(inpgs << 23) |
0xf000;
printf("%x %x\n", d[1], d[0]);
return ((struct segment_descriptor *)d);
#else
static struct segment_descriptor d;
d.sd_lolimit = limit & 0x0000ffff;
d.sd_lobase = base & 0x00ffffff;
d.sd_type = contents & 0x01f;
d.sd_dpl = SEL_UPL & 0x3;
d.sd_p = 1;
d.sd_hilimit = (limit & 0x00ff0000) >> 16;
d.sd_xx = 0;
d.sd_def32 = seg32?1:0;
d.sd_gran = inpgs?1:0;
d.sd_hibase = (base & 0xff000000) >> 24;
return ((struct segment_descriptor *)&d);
#endif
}
#endif
int
get_ldt(void *buffer)
{
#ifdef linux
return modify_ldt(0, buffer, 32 * sizeof(struct modify_ldt_ldt_s));
#endif
#ifdef __NetBSD__
return i386_get_ldt(0, (union descriptor *)buffer, 32);
#endif
}
int
@ -21,6 +71,7 @@ set_ldt_entry(int entry, unsigned long base, unsigned int limit,
int seg_32bit_flag, int contents, int read_only_flag,
int limit_in_pages_flag)
{
#ifdef linux
struct modify_ldt_ldt_s ldt_info;
ldt_info.entry_number = entry;
@ -32,4 +83,24 @@ set_ldt_entry(int entry, unsigned long base, unsigned int limit,
ldt_info.limit_in_pages = limit_in_pages_flag;
return modify_ldt(1, &ldt_info, sizeof(ldt_info));
#endif
#ifdef __NetBSD__
struct segment_descriptor *sd;
int ret;
#ifdef DEBUG
printf("set_ldt_entry: entry=%x base=%x limit=%x%s %s-bit contents=%d %s\n",
entry, base, limit, limit_in_pages_flag?"-pages":"",
seg_32bit_flag?"32":"16",
contents, read_only_flag?"read-only":"");
#endif
sd = make_sd(base, limit, contents, read_only_flag, seg_32bit_flag, limit_in_pages_flag);
ret = i386_set_ldt(entry, (union descriptor *)sd, 1);
if (ret < 0)
perror("i386_set_ldt");
return ret;
#endif
}

View File

@ -274,6 +274,7 @@ LoadString(HANDLE instance, WORD resource_id, LPSTR buffer, int buflen)
HICON
LoadIcon(HANDLE instance, LPSTR icon_name)
{
fprintf(stderr,"LoadIcon: (%d),%d\n",instance,icon_name);
return 0;
}
@ -283,6 +284,17 @@ LoadIcon(HANDLE instance, LPSTR icon_name)
HCURSOR
LoadCursor(HANDLE instance, LPSTR cursor_name)
{
fprintf(stderr,"LoadCursor: (%d),%d\n",instance,cursor_name);
return 0;
}
/**********************************************************************
* LoadAccelerators
*/
HANDLE
LoadAccelerators(HANDLE instance, LPSTR lpTableName)
{
fprintf(stderr,"LoadAccelerators: (%d),%d\n",instance,lpTableName);
return 0;
}

View File

@ -7,17 +7,37 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#ifdef linux
#include <linux/unistd.h>
#include <linux/head.h>
#include <linux/mman.h>
#include <linux/a.out.h>
#include <linux/ldt.h>
#endif
#ifdef __NetBSD__
#include <sys/mman.h>
#endif
#include <errno.h>
#include "neexe.h"
#include "segmem.h"
#include "prototypes.h"
#include "wine.h"
#ifdef linux
#define DEV_ZERO
#define UTEXTSEL 0x23
#endif
#ifdef __NetBSD__
#include <machine/segments.h>
#define PAGE_SIZE getpagesize()
#define MODIFY_LDT_CONTENTS_DATA 0
#define MODIFY_LDT_CONTENTS_STACK 1
#define MODIFY_LDT_CONTENTS_CODE 2
#define UTEXTSEL 0x1f
#endif
#define MAX_SELECTORS 512
static struct segment_descriptor_s * EnvironmentSelector = NULL;
@ -42,19 +62,21 @@ GetNextSegment(unsigned int flags, unsigned int limit)
{
struct segment_descriptor_s *selectors, *s;
int sel_idx;
#ifdef DEV_ZERO
FILE *zfile;
#endif
sel_idx = next_unused_selector++;
/*
* Fill in selector info.
*/
zfile = fopen("/dev/zero","r");
s = malloc(sizeof(*s));
s->flags = NE_SEGFLAGS_DATA;
s->selector = (sel_idx << 3) | 0x0007;
s->length = limit;
#ifdef DEV_ZERO
zfile = fopen("/dev/zero","r");
s->base_addr = (void *) mmap((char *) (s->selector << 16),
((s->length + PAGE_SIZE - 1) &
~(PAGE_SIZE - 1)),
@ -62,6 +84,14 @@ GetNextSegment(unsigned int flags, unsigned int limit)
MAP_FIXED | MAP_PRIVATE, fileno(zfile), 0);
fclose(zfile);
#else
s->base_addr = (void *) mmap((char *) (s->selector << 16),
((s->length + PAGE_SIZE - 1) &
~(PAGE_SIZE - 1)),
PROT_EXEC | PROT_READ | PROT_WRITE,
MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0);
#endif
if (set_ldt_entry(sel_idx, (unsigned long) s->base_addr,
(s->length - 1) & 0xffff, 0,
@ -99,6 +129,9 @@ unsigned int GetEntryDLLName(char * dll_name, char * function, int * sel,
ordinal = FindOrdinalFromName(dll_table, function);
*sel = dll_table[ordinal].selector;
*addr = (unsigned int) dll_table[ordinal].address;
#ifdef WINESTAT
dll_table[ordinal].used++;
#endif
return 0;
};
@ -136,6 +169,9 @@ unsigned int GetEntryDLLOrdinal(char * dll_name, int ordinal, int * sel,
if(dll_table) {
*sel = dll_table[ordinal].selector;
*addr = (unsigned int) dll_table[ordinal].address;
#ifdef WINESTAT
dll_table[ordinal].used++;
#endif
return 0;
};
@ -239,7 +275,11 @@ GetDOSEnvironment()
* CreateEnvironment
*/
static struct segment_descriptor_s *
#ifdef DEV_ZERO
CreateEnvironment(FILE *zfile)
#else
CreateEnvironment(void)
#endif
{
char *p;
int sel_idx;
@ -248,17 +288,24 @@ CreateEnvironment(FILE *zfile)
s = (struct segment_descriptor_s *)
malloc(sizeof(struct segment_descriptor_s));
sel_idx = next_unused_selector;
sel_idx = next_unused_selector++;
/*
* Create memory to hold environment.
*/
s->flags = NE_SEGFLAGS_DATA;
s->selector = (next_unused_selector++ << 3) | 0x0007;
s->selector = (sel_idx << 3) | 0x0007;
s->length = PAGE_SIZE;
#ifdef DEV_ZERO
s->base_addr = (void *) mmap((char *) (s->selector << 16),
PAGE_SIZE,
PROT_EXEC | PROT_READ | PROT_WRITE,
MAP_FIXED | MAP_PRIVATE, fileno(zfile), 0);
#else
s->base_addr = (void *) mmap((char *) (s->selector << 16),
PAGE_SIZE,
PROT_EXEC | PROT_READ | PROT_WRITE,
MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0);
#endif
/*
* Fill environment with meaningless babble.
@ -287,7 +334,11 @@ CreateEnvironment(FILE *zfile)
* CreateThunks
*/
static struct segment_descriptor_s *
#ifdef DEV_ZERO
CreateThunks(FILE *zfile)
#else
CreateThunks(void)
#endif
{
int sel_idx;
struct segment_descriptor_s * s;
@ -295,17 +346,24 @@ CreateThunks(FILE *zfile)
s = (struct segment_descriptor_s *)
malloc(sizeof(struct segment_descriptor_s));
sel_idx = next_unused_selector;
sel_idx = next_unused_selector++;
/*
* Create memory to hold environment.
*/
s->flags = 0;
s->selector = (next_unused_selector++ << 3) | 0x0007;
s->selector = (sel_idx << 3) | 0x0007;
s->length = 0x10000;
#ifdef DEV_ZERO
s->base_addr = (void *) mmap((char *) (s->selector << 16),
s->length,
PROT_EXEC | PROT_READ | PROT_WRITE,
MAP_FIXED | MAP_PRIVATE, fileno(zfile), 0);
#else
s->base_addr = (void *) mmap((char *) (s->selector << 16),
s->length,
PROT_EXEC | PROT_READ | PROT_WRITE,
MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0);
#endif
/*
@ -324,7 +382,11 @@ CreateThunks(FILE *zfile)
* CreatePSP
*/
static struct segment_descriptor_s *
#ifdef DEV_ZERO
CreatePSP(FILE *zfile)
#else
CreatePSP(void)
#endif
{
struct dos_psp_s *psp;
unsigned short *usp;
@ -336,17 +398,24 @@ CreatePSP(FILE *zfile)
s = (struct segment_descriptor_s *)
malloc(sizeof(struct segment_descriptor_s));
sel_idx = next_unused_selector;
sel_idx = next_unused_selector++;
/*
* Create memory to hold PSP.
*/
s->flags = NE_SEGFLAGS_DATA;
s->selector = (next_unused_selector++ << 3) | 0x0007;
s->selector = (sel_idx << 3) | 0x0007;
s->length = PAGE_SIZE;
#ifdef DEV_ZERO
s->base_addr = (void *) mmap((char *) (s->selector << 16),
PAGE_SIZE,
PROT_EXEC | PROT_READ | PROT_WRITE,
MAP_FIXED | MAP_PRIVATE, fileno(zfile), 0);
#else
s->base_addr = (void *) mmap((char *) (s->selector << 16),
PAGE_SIZE,
PROT_EXEC | PROT_READ | PROT_WRITE,
MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0);
#endif
/*
* Fill PSP
@ -357,13 +426,13 @@ CreatePSP(FILE *zfile)
psp->pspDispatcher[0] = 0x9a;
usp = (unsigned short *) &psp->pspDispatcher[1];
*usp = (unsigned short) KERNEL_Ordinal_102;
*(usp + 1) = 0x23;
*(usp + 1) = UTEXTSEL;
psp->pspTerminateVector[0] = (unsigned short) UNIXLIB_Ordinal_0;
psp->pspTerminateVector[1] = 0x0023;
psp->pspTerminateVector[1] = UTEXTSEL;
psp->pspControlCVector[0] = (unsigned short) UNIXLIB_Ordinal_0;
psp->pspControlCVector[1] = 0x0023;
psp->pspControlCVector[1] = UTEXTSEL;
psp->pspCritErrorVector[0] = (unsigned short) UNIXLIB_Ordinal_0;
psp->pspCritErrorVector[1] = 0x0023;
psp->pspCritErrorVector[1] = UTEXTSEL;
psp->pspEnvironment = EnvironmentSelector->selector;
p1 = psp->pspCommandTail;
@ -409,7 +478,9 @@ CreateSelectors(struct w_files * wpnt)
int SelectorTableLength;
int i;
int status;
#ifdef DEV_ZERO
FILE * zfile;
#endif
int old_length, file_image_length;
/*
@ -424,7 +495,9 @@ CreateSelectors(struct w_files * wpnt)
* Step through the segment table in the exe header.
*/
s = selectors;
#ifdef DEV_ZERO
zfile = fopen("/dev/zero","r");
#endif
for (i = 0; i < ne_header->n_segment_tab; i++, s++)
{
#ifdef DEBUG_SEGMENT
@ -497,11 +570,19 @@ CreateSelectors(struct w_files * wpnt)
if (s->flags & NE_SEGFLAGS_EXECUTEONLY)
read_only = 1;
}
#ifdef DEV_ZERO
s->base_addr =
(void *) mmap((char *) (s->selector << 16),
(s->length + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1),
PROT_EXEC | PROT_READ | PROT_WRITE,
MAP_FIXED | MAP_PRIVATE, fileno(zfile), 0);
#else
s->base_addr =
(void *) mmap((char *) (s->selector << 16),
(s->length + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1),
PROT_EXEC | PROT_READ | PROT_WRITE,
MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0);
#endif
if (seg_table[i].seg_data_offset != 0)
{
/*
@ -524,6 +605,11 @@ CreateSelectors(struct w_files * wpnt)
ran_out++;
return NULL;
}
#ifdef DEBUG_SEGMENT
printf(" SELECTOR %04.4x, %s\n",
s->selector,
contents == MODIFY_LDT_CONTENTS_CODE ? "CODE" : "DATA");
#endif
/*
* If this is the automatic data segment, then we must initialize
* the local heap.
@ -543,12 +629,20 @@ CreateSelectors(struct w_files * wpnt)
next_unused_selector += ne_header->n_segment_tab;
if(!EnvironmentSelector) {
#ifdef DEV_ZERO
EnvironmentSelector = CreateEnvironment(zfile);
PSP_Selector = CreatePSP(zfile);
MakeProcThunks = CreateThunks(zfile);
#else
EnvironmentSelector = CreateEnvironment();
PSP_Selector = CreatePSP();
MakeProcThunks = CreateThunks();
#endif
};
#ifdef DEV_ZERO
fclose(zfile);
#endif
return selectors;
}

View File

@ -7,10 +7,12 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#ifdef linux
#include <linux/unistd.h>
#include <linux/head.h>
#include <linux/ldt.h>
#include <linux/segment.h>
#endif
#include <string.h>
#include <errno.h>
#include "neexe.h"
@ -222,6 +224,9 @@ LoadImage(char * filename, char * modulename)
_WinMain(int argc, char **argv)
{
int segment;
#ifdef WINESTAT
char * cp;
#endif
struct w_files * wpnt;
int cs_reg, ds_reg, ss_reg, ip_reg, sp_reg;
int i;
@ -270,6 +275,16 @@ _WinMain(int argc, char **argv)
ss_reg = wine_files->selector_table[wine_files->ne_header->ss-1].selector;
sp_reg = wine_files->ne_header->sp;
#ifdef WINESTAT
cp = strrchr(argv[0], '/');
if(!cp) cp = argv[0];
else cp++;
if(strcmp(cp,"winestat") == 0) {
winestat();
exit(0);
};
#endif
init_wine_signals();
rv = CallToInit16(cs_reg << 16 | ip_reg, ss_reg << 16 | sp_reg, ds_reg);
@ -489,12 +504,13 @@ FixupSegment(struct w_files * wpnt, int segment_num)
default:
#ifndef DEBUG_FIXUP
printf("%d: ADDR TYPE %d, TYPE %d, OFFSET %04.4x, ",
fprintf(stderr,"%d: ADDR TYPE %d, TYPE %d, OFFSET %04.4x, ",
i + 1, rep->address_type, rep->relocation_type,
rep->offset);
printf("TARGET %04.4x %04.4x\n", rep->target1, rep->target2);
fprintf(stderr,"TARGET %04.4x %04.4x\n", rep->target1, rep->target2);
#endif
free(rep1);
return -1;
}
@ -530,13 +546,15 @@ FixupSegment(struct w_files * wpnt, int segment_num)
next_addr = *sp;
*sp = (unsigned short) selector;
sp = (unsigned short *) ((char *) sel->base_addr + next_addr);
if (rep->relocation_type == NE_RELTYPE_INT1) break;
}
while (next_addr != 0xffff);
break;
default:
#ifdef DEBUG_FIXUP
#ifndef DEBUG_FIXUP
printf("%d: ADDR TYPE %d, TYPE %d, OFFSET %04.4x, ",
i + 1, rep->address_type, rep->relocation_type,
rep->offset);

View File

@ -1,6 +1,7 @@
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
OBJS=dos.o kernel.o user.o xt.o rect.o
OBJS=dos.o kernel.o user.o xt.o rect.o file.o sound.o emulate.o \
keyboard.o profile.o
default: misc.o

53
misc/emulate.c Normal file
View File

@ -0,0 +1,53 @@
static char RCSId[] = "$Id: heap.c,v 1.3 1993/07/04 04:04:21 root Exp root $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "prototypes.h"
#include "regfunc.h"
struct Win87EmInfoStruct {
unsigned short Version;
unsigned short SizeSaveArea;
unsigned short WinDataSeg;
unsigned short WinCodeSeg;
unsigned short Have80x87;
unsigned short Unused;
};
int
WIN87_fpmath()
{
printf( "_fpmath: (%d)\n",_BX);
switch(_BX )
{
case 11:
return 1;
default:
return 0;
}
}
int
WIN87_WinEm87Info(struct Win87EmInfoStruct *pWIS, int cbWin87EmInfoStruct)
{
printf( "__WinEm87Info(%p,%d)\n",pWIS,cbWin87EmInfoStruct);
}
int
WIN87_WinEm87Restore(void *pWin87EmSaveArea, int cbWin87EmSaveArea)
{
printf( "__WinEm87Restore(%p,%d)\n",pWin87EmSaveArea,cbWin87EmSaveArea);
}
int
WIN87_WinEm87Save(void *pWin87EmSaveArea, int cbWin87EmSaveArea)
{
printf( "__WinEm87Save(%p,%d)\n",pWin87EmSaveArea,cbWin87EmSaveArea);
}

208
misc/file.c Normal file
View File

@ -0,0 +1,208 @@
/************************************************************************
* FILE.C Copyright (C) 1993 John Burton
*
* File I/O routines for the Linux Wine Project.
*
* There are two main parts to this module - first there are the
* actual emulation functions, and secondly a routine for translating
* DOS filenames into UNIX style filenames.
*
* For each DOS drive letter, we need to store the location in the unix
* file system to map that drive to, and the current directory for that
* drive.
*
* Finally we need to store the current drive letter in this module.
*
* WARNING : Many options of OpenFile are not yet implemeted.
*
*
************************************************************************/
#include <windows.h>
#include <assert.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <limits.h>
/***************************************************************************
This structure stores the infomation needed for a single DOS drive
***************************************************************************/
struct DosDriveStruct
{
char RootDirectory [256]; /* Unix base for this drive letter */
char CurrentDirectory [256]; /* Current directory for this drive */
};
/***************************************************************************
Table for DOS drives
***************************************************************************/
struct DosDriveStruct DosDrives[] =
{
{"/mnt/floppy1" , ""},
{"/mnt/floppy2" , ""},
{"/mnt/HardDisk", "/wine"},
{"" , "/wine/Wine"}
};
#define NUM_DRIVES (sizeof (DosDrives) / sizeof (struct DosDriveStruct))
/**************************************************************************
Global variable to store current drive letter (0 = A, 1 = B etc)
**************************************************************************/
int CurrentDrive = 2;
/**************************************************************************
ParseDOSFileName
Return a fully specified DOS filename with the disk letter separated from
the path information.
**************************************************************************/
void ParseDOSFileName (char *UnixFileName, char *DosFileName, int *Drive)
{
int character;
for (character = 0; character < strlen(DosFileName); character++)
{
if (DosFileName[character] == '\\')
DosFileName[character] = '/';
}
if (DosFileName[1] == ':')
{
*Drive = DosFileName[0] - 'A';
if (*Drive > 26)
*Drive = *Drive - 'a' + 'A';
DosFileName = DosFileName + 2;
}
else
*Drive = CurrentDrive;
if (DosFileName[0] == '/')
{
strcpy (UnixFileName, DosDrives[*Drive].RootDirectory);
strcat (UnixFileName, DosFileName);
return;
}
strcpy (UnixFileName, DosDrives[*Drive].RootDirectory);
strcat (UnixFileName, DosDrives[*Drive].CurrentDirectory);
strcat (UnixFileName, "/");
strcat (UnixFileName, DosFileName);
return;
}
/***************************************************************************
_lopen
Emulate the _lopen windows call
***************************************************************************/
WORD KERNEL__lopen (LPSTR lpPathName, WORD iReadWrite)
{
char UnixFileName[256];
int Drive;
int handle;
ParseDOSFileName (UnixFileName, lpPathName, &Drive);
handle = open (UnixFileName, iReadWrite);
#ifdef DEBUG_FILE
fprintf (stderr, "_lopen: %s (Handle = %d)\n", UnixFileName, handle);
#endif
return handle;
}
/***************************************************************************
_lread
***************************************************************************/
WORD KERNEL__lread (WORD hFile, LPSTR lpBuffer, WORD wBytes)
{
int result;
result = read (hFile, lpBuffer, wBytes);
#ifdef DEBUG_FILE
fprintf(stderr, "_lread: hFile = %d, lpBuffer = %s, wBytes = %d\n",
hFile, lpBuffer, wBytes);
#endif
return result;
}
/****************************************************************************
_lwrite
****************************************************************************/
WORD KERNEL__lwrite (WORD hFile, LPSTR lpBuffer, WORD wBytes)
{
#ifdef DEBUG_FILE
fprintf(stderr, "_lwrite: hFile = %d, lpBuffer = %s, wBytes = %d\n",
hFile, lpBuffer, wBytes);
#endif
return write (hFile, lpBuffer, wBytes);
}
/***************************************************************************
_lclose
***************************************************************************/
WORD KERNEL__lclose (WORD hFile)
{
close (hFile);
}
/**************************************************************************
OpenFile
Warning: This is nearly totally untested. It compiles, that's it...
-SL 9/13/93
**************************************************************************/
WORD KERNEL_OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle)
{
int base,flags;
fprintf(stderr,"Openfile(%s,<struct>,%d) ",lpFileName,wStyle);
base=wStyle&0xF;
flags=wStyle&0xFFF0;
flags&=0xFF0F; /* strip SHARE bits for now */
flags&=0xD7FF; /* strip PROMPT & CANCEL bits for now */
flags&=0x7FFF; /* strip REOPEN bit for now */
flags&=0xFBFF; /* strib VERIFY bit for now */
if(flags&OF_CREATE) { base |=O_CREAT; flags &=0xEFFF; }
fprintf(stderr,"now %d,%d\n",base,flags);
if(flags&(OF_DELETE|OF_EXIST))
{
fprintf(stderr,"Unsupported OpenFile option\n");
return -1;
}
else
{
return KERNEL__lopen (lpFileName, wStyle);
}
}
/**************************************************************************
SetHandleCount
Changes the number of file handles available to the application. Since
Linux isn't limited to 20 files, this one's easy. - SL
**************************************************************************/
WORD SetHandleCount (WORD wNumber)
{
printf("SetHandleCount(%d)\n",wNumber);
return((wNumber<OPEN_MAX) ? wNumber : OPEN_MAX);
}

109
misc/keyboard.c Normal file
View File

@ -0,0 +1,109 @@
static char RCSId[] = "$Id: keyboard.c,v 1.2 1993/09/13 18:52:02 scott Exp $";
static char Copyright[] = "Copyright Scott A. Laird, 1993";
#include "prototypes.h"
#include "windows.h"
int ToAscii(WORD wVirtKey, WORD wScanCode, LPSTR lpKeyState,
LPVOID lpChar, WORD wFlags)
{
printf("ToAscii (%d,%d)\n",wVirtKey, wScanCode);
return -1;
}
int AnsiToOem(LPSTR lpAnsiStr, LPSTR lpOemStr)
{
printf("AnsiToOem (%s)\n",lpAnsiStr);
strcpy(lpOemStr,lpAnsiStr); /* Probably not the right thing to do, but... */
return -1;
}
BOOL OemToAnsi(LPSTR lpOemStr, LPSTR lpAnsiStr)
{
printf("OemToAnsi (%s)\n",lpOemStr);
strcpy(lpAnsiStr,lpOemStr); /* Probably not the right thing to do, but... */
return -1;
}
DWORD OemKeyScan(WORD wOemChar)
{
printf("*OemKeyScan (%d)\n",wOemChar);
return 0;
}
/* VkKeyScan translates an ANSI character to a virtual-key and shift code
* for the current keyboard. For now we return -1, which is fail. */
WORD VkKeyScan(WORD cChar)
{
printf("VkKeyScan (%d)\n",cChar);
return -1;
}
int GetKeyboardType(int nTypeFlag)
{
printf("GetKeyboardType(%d)\n",nTypeFlag);
switch(nTypeFlag)
{
case 0: /* Keyboard type */
return 4; /* AT-101 */
break;
case 1: /* Keyboard Subtype */
return 0; /* There are no defined subtypes */
break;
case 2: /* Number of F-keys */
return 12; /* We're doing an 101 for now, so return 12 F-keys */
break;
default:
printf(" Unknown type on GetKeyboardType\n");
return 0; /* The book says 0 here, so 0 */
}
}
/* MapVirtualKey translates keycodes from one format to another. This
* is a total punt. */
WORD MapVirtualKey(WORD wCode, WORD wMapType)
{
printf("*MapVirtualKey(%d,%d)\n",wCode,wMapType);
return 0;
}
int GetKbCodePage(void)
{
printf("GetKbCodePage()\n");
return 437; /* US -- probably should be 850 from time to time */
}
/* This should distinguish key names. Maybe later */
int GetKeyNameText(LONG lParam, LPSTR lpBuffer, int nSize)
{
printf("GetKeyNameText(%d,<ptr>, %d)\n",lParam,nSize);
lpBuffer[0]=0; /* This key has no name */
return 0;
}
void AnsiToOemBuff(LPSTR lpAnsiStr, LPSTR lpOemStr, int nLength)
{
printf("AnsiToOemBuff(%s,<ptr>,%d)\n",lpAnsiStr,nLength);
strncpy(lpOemStr,lpAnsiStr,nLength); /* should translate... */
}
void OemToAnsiBuff(LPSTR lpOemStr, LPSTR lpAnsiStr, int nLength)
{
printf("OemToAnsiBuff(%s,<ptr>,%d)\n",lpOemStr,nLength);
strncpy(lpAnsiStr,lpOemStr,nLength); /* should translate... */
}

40
misc/profile.c Normal file
View File

@ -0,0 +1,40 @@
static char RCSId[] = "$Id: profile.c,v 1.1 1993/09/13 16:42:32 scott Exp $";
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "prototypes.h"
#include "windows.h"
WORD GetPrivateProfileInt( LPSTR section, LPSTR entry,
short defval, LPSTR filename )
{
printf( "GetPrivateProfileInt: %s %s %d %s\n", section, entry, defval, filename );
return defval;
}
short GetPrivateProfileString( LPSTR section, LPSTR entry, LPSTR defval,
LPSTR buffer, short count, LPSTR filename )
{
printf( "GetPrivateProfileString: %s %s %s %d %s\n", section, entry, defval, count, filename );
strncpy( buffer, defval, count );
buffer[count-1] = 0;
return strlen(buffer);
}
WORD GetProfileInt( LPSTR lpAppName, LPSTR lpKeyName, int nDefault)
{
printf("GetProfileInt: %s %s %d\n",lpAppName,lpKeyName,nDefault);
return nDefault;
}
int GetProfileString(LPSTR lpAppName, LPSTR lpKeyName, LPSTR lpDefault,
LPSTR lpReturnedString, int nSize)
{
printf( "GetProfileString: %s %s %s %d \n", lpAppName,lpKeyName,
lpDefault, nSize );
strncpy( lpReturnedString,lpDefault,nSize );
lpReturnedString[nSize-1] = 0;
return strlen(lpReturnedString);
}

75
misc/sound.c Normal file
View File

@ -0,0 +1,75 @@
static char RCSId[] = "$Id: heap.c,v 1.3 1993/07/04 04:04:21 root Exp root $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "prototypes.h"
int OpenSound(void)
{
printf("OpenSound()\n");
return -1;
}
void CloseSound(void)
{
printf("CloseSound()\n");
}
int SetVoiceQueueSize(int nVoice, int nBytes)
{
printf("SetVoiceQueueSize (%d,%d)\n",nVoice,nBytes);
return 0;
}
int SetVoiceNote(int nVoice, int nValue, int nLength, int nCdots)
{
printf("SetVoiceNote (%d,%d,%d,%d)\n",nVoice,nValue,nLength,nCdots);
return 0;
}
int SetVoiceAccent(int nVoice, int nTempo, int nVolume, int nMode, int nPitch)
{
printf("SetVoiceAccent(%d,%d,%d,%d,%d)\n", nVoice, nTempo,
nVolume, nMode, nPitch);
return 0;
}
int SetVoiceEnvelope(int nVoice, int nShape, int nRepeat)
{
printf("SetVoiceEnvelope(%d,%d,%d)\n",nVoice,nShape,nRepeat);
return 0;
}
int SetSoundNoise(int nSource, int nDuration)
{
printf("SetSoundNoise(%d,%d)\n",nSource,nDuration);
return 0;
}
int SetVoiceSound(int nVoice, long lFrequency, int nDuration)
{
printf("SetVoiceSound(%d, %d, %d)\n",nVoice,lFrequency, nDuration);
return 0;
}
int StartSound(void)
{
return 0;
}
int StopSound(void)
{
return 0;
}
/*
11 pascal WAITSOUNDSTATE(word) WaitSoundState(1)
12 pascal SYNCALLVOICES() SyncAllVoices()
13 pascal COUNTVOICENOTES(word) CountVoiceNotes(1)
14 pascal GETTHRESHOLDEVENT() GetThresholdEvent()
15 pascal GETTHRESHOLDSTATUS() GetThresholdStatus()
16 pascal SETVOICETHRESHOLD(word word) SetVoiceThreshold(1 2)
*/

View File

@ -20,6 +20,9 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "class.h"
#include "gdi.h"
#ifdef __NetBSD__
#define HZ 100
#endif
Display * XT_display;
Screen * XT_screen;
@ -146,21 +149,6 @@ void AdjustWindowRect( LPRECT rect, DWORD style, BOOL menu )
rect->right, rect->bottom, style, menu );
}
WORD GetPrivateProfileInt( LPSTR section, LPSTR entry,
short defval, LPSTR filename )
{
printf( "GetPrivateProfileInt: %s %s %d %s\n", section, entry, defval, filename );
return defval;
}
short GetPrivateProfileString( LPSTR section, LPSTR entry, LPSTR defval,
LPSTR buffer, short count, LPSTR filename )
{
printf( "GetPrivateProfileString: %s %s %s %d %s\n", section, entry, defval, count, filename );
strncpy( buffer, defval, count );
buffer[count-1] = 0;
return strlen(buffer);
}
BOOL IsIconic( HWND hwnd )
{

View File

@ -6,8 +6,7 @@
static char Copyright[] = "Copyright Bob Amstadt, 1993";
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <stdlib.h>
#include "win.h"
/**********************************************************************
@ -16,4 +15,32 @@ static char Copyright[] = "Copyright Bob Amstadt, 1993";
void LineDDA(short nXStart, short nYStart, short nXEnd, short nYEnd,
FARPROC callback, long lParam)
{
int x, y;
int b;
int x_diff = nXEnd - nXStart;
int y_diff = nYEnd - nYStart;
if (x_diff == 0 && y_diff == 0)
return;
if ((abs(x_diff) < abs(y_diff) && x_diff != 0) || y_diff == 0)
{
b = (nXStart * y_diff) / x_diff - nYStart;
for (x = nXStart; x <= nXEnd; x++)
{
y = (x * y_diff) / x_diff + b;
CallLineDDAProc(callback, x, y, lParam);
}
}
else
{
b = (nYStart * x_diff) / y_diff - nXStart;
for (y = nYStart; y <= nYEnd; y++)
{
x = (y * x_diff) / y_diff + b;
CallLineDDAProc(callback, x, y, lParam);
}
}
}

View File

@ -7,7 +7,13 @@
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <stdlib.h>
#ifdef linux
#include <values.h>
#endif
#ifdef __NetBSD__
#include <limits.h>
#define MAXINT INT_MAX
#endif
#include <X11/Xlib.h>
#include "gdi.h"

View File

@ -23,11 +23,17 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
*/
int DrawText( HDC hdc, LPSTR str, int count, LPRECT rect, WORD flags )
{
SIZE size;
int x = rect->left, y = rect->top;
if (flags & DT_CENTER) x = (rect->left + rect->right) / 2;
if (flags & DT_VCENTER) y = (rect->top + rect->bottom) / 2;
if (count == -1) count = strlen(str);
if (!GetTextExtentPoint( hdc, str, count, &size )) return 0;
if (flags & DT_CENTER) x = (rect->left + rect->right - size.cx) / 2;
else if (flags & DT_RIGHT) x = rect->right - size.cx;
if (flags & DT_VCENTER) y = (rect->top + rect->bottom - size.cy) / 2;
else if (flags & DT_BOTTOM) y = rect->bottom - size.cy;
if (!TextOut( hdc, x, y, str, count )) return 0;
return 1;
}

View File

@ -1,90 +0,0 @@
diff -c -r linux.99pl12/linux//kernel/signal.c linux//kernel/signal.c
*** linux.99pl12/linux//kernel/signal.c Sat Aug 28 00:24:01 1993
--- linux//kernel/signal.c Fri Aug 27 22:45:41 1993
***************
*** 195,201 ****
COPY(eip); COPY(eflags);
COPY(ecx); COPY(edx);
COPY(ebx);
! COPY(esp); COPY(ebp);
COPY(edi); COPY(esi);
COPY(cs); COPY(ss);
COPY(ds); COPY(es);
--- 195,202 ----
COPY(eip); COPY(eflags);
COPY(ecx); COPY(edx);
COPY(ebx);
! regs->esp = context.esp_at_signal; /* Can be different with Wine */
! COPY(ebp);
COPY(edi); COPY(esi);
COPY(cs); COPY(ss);
COPY(ds); COPY(es);
***************
*** 353,360 ****
frame = (unsigned long *) regs->esp;
signr = 1;
sa = current->sigaction;
! if (regs->ss != USER_DS)
! printk("Warning: signal handler with nonstandard stack segment\n");
for (mask = 1 ; mask ; sa++,signr++,mask += mask) {
if (mask > handler_signal)
break;
--- 354,360 ----
frame = (unsigned long *) regs->esp;
signr = 1;
sa = current->sigaction;
!
for (mask = 1 ; mask ; sa++,signr++,mask += mask) {
if (mask > handler_signal)
break;
***************
*** 365,370 ****
--- 365,381 ----
sa->sa_handler = NULL;
/* force a supervisor-mode page-in of the signal handler to reduce races */
__asm__("testb $0,%%fs:%0": :"m" (*(char *) sa_handler));
+
+ /* If ss != USER_DS, we cannot rely upon the ss:esp as a */
+ /* stack. We will instead use USER_DS:sa->sa_restorer */
+ if (regs->ss != USER_DS) {
+ frame = (unsigned long *) sa->sa_restorer;
+ if(frame == NULL) {
+ printk("No signal handler stack available\n");
+ do_exit(signr);
+ };
+ };
+
setup_frame(&frame,eip,regs,signr,sa_handler,oldmask);
eip = sa_handler; regs->cs = USER_CS;
current->blocked |= sa->sa_mask;
***************
*** 371,376 ****
--- 382,392 ----
oldmask |= sa->sa_mask;
}
regs->esp = (unsigned long) frame;
+ /* When running the Wine program, the segment registers may be holding
+ unusual values */
+ regs->ss = USER_DS; /* Make sure that this is correct */
+ regs->ds = USER_DS; /* And the same here */
+ regs->es = USER_DS; /* And here again */
regs->eip = eip; /* "return" to the first handler */
return 1;
}
diff -c -r linux.99pl12/linux//kernel/traps.c linux//kernel/traps.c
*** linux.99pl12/linux//kernel/traps.c Thu Aug 19 00:34:24 1993
--- linux//kernel/traps.c Fri Aug 27 09:11:01 1993
***************
*** 66,71 ****
--- 66,76 ----
if ((regs->eflags & VM_MASK) || ((0xffff & regs->cs) == USER_CS))
return;
+
+ /* See if we are using the LDT. If so, pass along the signal. */
+ if((7 & regs->cs) == 7 && current->ldt && (regs->cs >> 3) < 512)
+ return;
+
printk("%s: %04x\n", str, err & 0xffff);
printk("EIP: %04x:%p\nEFLAGS: %p\n", 0xffff & regs->cs,regs->eip,regs->eflags);
printk("eax: %08x ebx: %08x ecx: %08x edx: %08x\n",

147
test/btnlook.c Executable file
View File

@ -0,0 +1,147 @@
/*------------------------------------------
BTNLOOK.C -- Button Look Program
------------------------------------------*/
#include <windows.h>
#include <stdio.h>
struct
{
long style;
char *text;
}
button[] =
{
BS_PUSHBUTTON, "PUSHBUTTON",
BS_DEFPUSHBUTTON, "DEFPUSHBUTTON",
/* BS_CHECKBOX, "CHECKBOX",
BS_AUTOCHECKBOX, "AUTOCHECKBOX",
BS_RADIOBUTTON, "RADIOBUTTON",
BS_3STATE, "3STATE",
BS_AUTO3STATE, "AUTO3STATE",
BS_GROUPBOX, "GROUPBOX",
BS_USERBUTTON, "USERBUTTON",
BS_AUTORADIOBUTTON, "AUTORADIOBUTTON",
BS_PUSHBOX, "PUSHBOX"
*/};
#define NUM (sizeof button / sizeof button[0])
long FAR PASCAL _export WndProc(HWND, WORD, WORD, LONG);
int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance,
LPSTR lpszCmdParam, int nCmdShow)
{
static char szAppName[] = "BtnLook";
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
if (!hPrevInstance)
{
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szAppName;
RegisterClass(&wndclass);
}
hwnd = CreateWindow(szAppName, "Button Look",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL);
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
long FAR PASCAL _export WndProc(HWND hwnd, WORD message, WORD wParam, LONG lParam)
{
static char szPrm[] = "wParam LOWORD(lParam) HIWORD(lParam)",
szTop[] = "Control ID Window Handle Notification",
szUnd[] = "__________ _____________ ____________",
szFormat[] = " %5u %4X %5u",
szBuffer[50];
static HWND hwndButton[NUM];
static RECT rect;
static int cxChar, cyChar;
HDC hdc;
PAINTSTRUCT ps;
int i;
TEXTMETRIC tm;
switch (message)
{
case WM_CREATE:
hdc = GetDC(hwnd);
SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
GetTextMetrics(hdc, &tm);
cxChar = tm.tmAveCharWidth;
cyChar = tm.tmHeight + tm.tmExternalLeading;
ReleaseDC(hwnd, hdc);
for (i = 0; i < NUM; i++)
hwndButton[i] = CreateWindow("button", button[i].text,
WS_CHILD | WS_VISIBLE | button[i].style,
cxChar, cyChar * (1 + 2 * i),
20 * cxChar, 7 * cyChar / 4,
hwnd, i,
((LPCREATESTRUCT) lParam)->hInstance, NULL);
return 0;
case WM_SIZE:
rect.left = 24 * cxChar;
rect.top = 3 * cyChar;
rect.right = LOWORD(lParam);
rect.bottom = HIWORD(lParam);
return 0;
case WM_PAINT:
InvalidateRect(hwnd, &rect, TRUE);
hdc = BeginPaint(hwnd, &ps);
SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
SetBkMode(hdc, TRANSPARENT);
TextOut(hdc, 24 * cxChar, 1 * cyChar, szPrm, sizeof szPrm - 1);
TextOut(hdc, 24 * cxChar, 2 * cyChar, szTop, sizeof szTop - 1);
TextOut(hdc, 24 * cxChar, 2 * cyChar, szUnd, sizeof szUnd - 1);
EndPaint(hwnd, &ps);
return 0;
case WM_COMMAND:
/* ScrollWindow(hwnd, 0, -cyChar, &rect, &rect); */
hdc = GetDC(hwnd);
SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
TextOut(hdc, 24 * cxChar, cyChar * 5, /* (rect.bottom / cyChar - 1), */
szBuffer, sprintf(szBuffer, szFormat, wParam,
LOWORD(lParam), HIWORD(lParam)));
ReleaseDC(hwnd, hdc);
ValidateRect(hwnd, NULL);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}

BIN
test/btnlook.exe Executable file

Binary file not shown.

View File

@ -1,8 +1,10 @@
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
build: build.c
cc -O2 -o build build.c
cc $(CFLAGS) -o build build.c
clean:
rm -f *.o *~
rm -f *.o *~ build
depend:
$(CC) $(CFLAGS) -M *.c > .depend
@ -14,4 +16,4 @@ dummy:
#
ifeq (.depend,$(wildcard .depend))
include .depend
endif
endif

View File

@ -6,6 +6,13 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <string.h>
#include <ctype.h>
#ifdef linux
#define UTEXTSEL 0x23
#endif
#ifdef __NetBSD__
#define UTEXTSEL 0x1f
#endif
#define VARTYPE_BYTE 0
#define VARTYPE_SIGNEDWORD 0
#define VARTYPE_WORD 1
@ -738,9 +745,12 @@ main(int argc, char **argv)
{
case FUNCTYPE_PASCAL:
case FUNCTYPE_REG:
fprintf(fp, " { 0x23, %s_Ordinal_%d, ", UpperDLLName, i);
fprintf(fp, " { 0x%x, %s_Ordinal_%d, ", UTEXTSEL, UpperDLLName, i);
fprintf(fp, "\042%s\042, ", odp->export_name);
fprintf(fp, "%s, DLL_HANDLERTYPE_PASCAL, ", fdp->internal_name);
#ifdef WINESTAT
fprintf(fp, "0, ");
#endif
fprintf(fp, "%d, ", fdp->n_args_32);
if (fdp->n_args_32 > 0)
{
@ -759,9 +769,12 @@ main(int argc, char **argv)
break;
case FUNCTYPE_C:
fprintf(fp, " { 0x23, %s_Ordinal_%d, ", UpperDLLName, i);
fprintf(fp, " { 0x%x, %s_Ordinal_%d, ", UTEXTSEL, UpperDLLName, i);
fprintf(fp, "\042%s\042, ", odp->export_name);
fprintf(fp, "%s, DLL_HANDLERTYPE_C, ", fdp->internal_name);
#ifdef WINESTAT
fprintf(fp, "0, ");
#endif
fprintf(fp, "%d, ", fdp->n_args_32);
if (fdp->n_args_32 > 0)
{
@ -780,8 +793,8 @@ main(int argc, char **argv)
break;
default:
fprintf(fp, " { 0x23, %s_Ordinal_%d, \042\042, NULL },\n",
UpperDLLName, i);
fprintf(fp, " { 0x%x, %s_Ordinal_%d, \042\042, NULL },\n",
UTEXTSEL, UpperDLLName, i);
break;
}
}

View File

@ -1,7 +1,7 @@
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
OBJS=class.o dc.o dce.o event.o message.o win.o timer.o graphics.o \
clipping.o mapping.o painting.o keyboard.o
clipping.o mapping.o painting.o keyboard.o utility.o
default: windows.o

View File

@ -25,7 +25,7 @@ HCLASS CLASS_FindClassByName( char * name, CLASS **ptr )
while(class)
{
*ptr = (CLASS *) USER_HEAP_ADDR(class);
if (!strcmp( (*ptr)->wc.lpszClassName, name )) return class;
if (!strcasecmp( (*ptr)->wc.lpszClassName, name )) return class;
class = (*ptr)->hNext;
}
return 0;

View File

@ -338,7 +338,6 @@ HDC CreateDC( LPSTR driver, LPSTR device, LPSTR output, LPSTR initData )
dc->w.planes = displayDevCaps->planes;
dc->w.bitsPerPixel = displayDevCaps->bitsPixel;
XSetSubwindowMode( XT_display, dc->u.x.gc, IncludeInferiors );
DC_SetDeviceInfo( handle, dc );
return handle;

View File

@ -8,6 +8,9 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <math.h>
#include <X11/Xlib.h>
#ifndef PI
#define PI M_PI
#endif
#include "gdi.h"

View File

@ -13,6 +13,10 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <stdlib.h>
#ifdef __NetBSD__
#define HZ 100
#endif
#include "message.h"
#include "win.h"

304
windows/utility.c Normal file
View File

@ -0,0 +1,304 @@
/* utility.c Utility functions for Wine
* Author: acb
* Commenced: 10-9-1993
*
* This unit contains the implementations of
* various Windows API functions that perform
* utility tasks; i.e., that do not fit into
* any major category but perform useful tasks.
*/
#include <stdio.h>
#include <ctype.h>
#include "windows.h"
static char Copyright[] = "Copyright Andrew C. Bulhak, 1993";
/*#define debug_utility*/
/* MulDiv is a simple function that may as well have been
* implemented as a macro; however Microsoft, in their infinite
* wisdom, have implemented it as a DLL function and therefore
* so should we.
* Basically, it takes two 16-bit integers, multiplies them
* and divides by a third integer.
*/
int MulDiv(int foo, int bar, int baz)
{
return (long)(((int)foo*bar)/baz);
};
/* UTILITY_strip015() removes \015 (^M, CR) from a string;
* this is done to convert a MS-DOS-style string to a more
* UNIX-friendly format. Replacement is done in-place.
*/
void UTILITY_strip015(char *dest) {
char *src = dest;
while(*src) {
while(*src == '\015') src++; /* Skip \015s */
while((*src) && (*src != '\015')) *(dest++) = *(src++);
};
*dest = '\0'; /* Add null terminator */
};
/*
* OutputDebugString strips CRs from its (string) parameter and
* calls DebugPrintString(), which was written by someone else.
* Since this is part of the standard Windows API, it needs no
* references to nonstandard DLLs.
*/
void OutputDebugString(LPSTR foo)
{
UTILITY_strip015(foo);
DebugPrintString(foo);
};
/* UTILITY_qualify(source, dest) takes the format string source and
* changes all the parameters to correspond to Linux integer sizes
* rather than Windows sizes. For example, it converts %i to %hi
* and %lx to %x. No array size checking is done at present.
*/
static void UTILITY_qualify(const char *source, char *dest)
{
#ifdef debug_utility
printf("UTILITY_qualify(\"%s\", \"%s\");\n", source, dest);
#endif
if(!source) return; /* Dumbass attack! */
while(*source) {
/* Find next format code. */
while((*source != '%') && (*source)) {
*(dest++) = *(source++);
}
/* Yeah, I know I shouldn't use gotos.... */
if (!(*source)) goto loop_end;
/* skip the '%' */
*(dest++) = *(source++);
/* Now insert a size qualifier, if needed. */
switch(*source) {
case 'i':
case 'd':
case 'x':
case 'X':
case 'u':
case 'o':
/* We have a 16-bit value here. */
*(dest++) = 'h';
break;
};
/* Here we go 'round the mulberry bush... */
loop_end:
};
*dest = '\0';
};
/* UTILITY_argsize() evaluates the size of the argument list that
* accompanies a vsprintf() or wvsprintf() call.
* Arguments:
* char *format; printf-style format string.
* BOOL windows; if this is TRUE, we assume that ints are
* 16 bits in size; otherwise we deal with
* 32-bit variables.
* Returns:
* size (in bytes) of the arguments that follow the call.
*/
size_t UTILITY_argsize(const char *format, BOOL windows)
{
size_t size = 0;
#define INT_SIZE (windows ? 2 : 4)
while(*format) {
while((*format) && (*format != '%')) format++; /* skip ahead */
if(*format) {
char modifier = ' ';
#ifdef debug_utility
printf("found:\t\"%%");
#endif
format++; /* skip past '%' */
/* First skip the flags, field width, etc. */
/* First the flags */
if ((*format == '#') || (*format == '-') || (*format == '+')
|| (*format == ' ')) {
#ifdef debug_utility
printf("%c", *format);
#endif
format++;
}
/* Now the field width, etc. */
while(isdigit(*format)) {
#ifdef debug_utility
printf("%c", *format);
#endif
format++;
}
if(*format == '.') {
#ifdef debug_utility
printf("%c", *format);
#endif
format++;
}
while(isdigit(*format)) {
#ifdef debug_utility
printf("%c", *format);
#endif
format++;
}
/* Now we handle the rest */
if((*format == 'h') || (*format == 'l') || (*format == 'L')) {
#ifdef debug_utility
printf("%c", modifier);
#endif
modifier = *(format++);
}
/* Handle the actual type. */
#ifdef debug_utility
printf("%c\"\n", *format);
#endif
switch(*format) {
case 'd':
case 'i':
case 'o':
case 'x':
case 'X':
case 'u':
case 'c':
size += ((modifier == 'l') ? 4 : INT_SIZE);
break;
case 's': size += sizeof(char *); break;
case 'e':
case 'E':
case 'f':
case 'g':
case 'G':
/* It doesn't look as if Windows' wvsprintf()
supports floating-point arguments. However,
I'll leave this code here just in case. */
size += (modifier == 'L') ? sizeof(long double) : sizeof(double);
break;
case 'p': size += sizeof(void *); break;
case 'n': size += sizeof(int *); break;
};
};
};
#undef INT_SIZE
#ifdef debug_utility
printf("UTILITY_argsize: returning %i\n", size);
#endif
return size;
};
/* UTILITY_convertArgs() creates a 32-bit argument list from a 16-bit list.
* This is used to allow wvsprintf() arguments to be fed through
* vsprintf().
*
* Arguments:
* char *fmt; format string
* char *winarg; Windows-style arguments
*
* Returns:
* malloc()ed pointer to new argument list. This should
* be free()d as soon as it is finished with.
*/
char *UTILITY_convertArgs(char *format, char *winarg)
{
char *result = (char *)malloc(UTILITY_argsize(format, 0));
char *rptr = result;
while(*format) {
while((*format) && (*format != '%')) format++; /* skip ahead */
if(*format) {
char modifier = ' ';
#ifdef debug_utility
printf("found:\t\"%%");
#endif
format++; /* skip past '%' */
/* First skip the flags, field width, etc. */
/* First the flags */
if ((*format == '#') || (*format == '-') || (*format == '+')
|| (*format == ' ')) format++;
/* Now the field width, etc. */
while(isdigit(*format)) format++;
if(*format == '.') format++;
while(isdigit(*format)) format++;
/* Now we handle the rest */
if((*format == 'h') || (*format == 'l') || (*format == 'L'))
modifier = *(format++);
/* Handle the actual type. */
#ifdef debug_utility
printf("%c\"\n", *format);
#endif
switch(*format) {
case 'd':
case 'i':
*(((int *)rptr)++) = (modifier=='l') ? *(((int *)winarg)++) : *(((short *)winarg)++);
break;
case 'o':
case 'x':
case 'X':
case 'u':
case 'c':
*(((unsigned int *)rptr)++) = (modifier=='l') ? *(((unsigned int *)winarg)++)
: *(((unsigned short *)winarg)++);
break;
case 's':
case 'p':
case 'n': /* A pointer, is a pointer, is a pointer... */
*(((char **)rptr)++) = *(((char **)winarg)++);
break;
case 'e':
case 'E':
case 'f':
case 'g':
case 'G':
/* It doesn't look as if Windows' wvsprintf()
supports floating-point arguments. However,
I'll leave this code here just in case. */
if(modifier=='L')
*(((long double *)rptr)++) = *(((long double *)winarg)++);
else *(((double *)rptr)++) = *(((double *)winarg)++);
break;
}
}
}
return result;
};
/* wvsprintf() is an implementation of vsprintf(). This
* implementation converts the arguments to 32-bit integers and
* calls the standard library function vsprintf().
*
* Known shortcomings:
* wvsprintf() doesn't yet convert the arguments back after
* calling vsprintf(), so if Windows implements %n and a
* program depends on it, we're in trouble.
*/
int wvsprintf(LPSTR buf, LPSTR format, LPSTR args)
{
char qualified_fmt[1536];
char *newargs;
int result;
/* 1.5K is a safe value as wvsprintf can only handle buffers up to
1K and in a worst case such a buffer would look like "%i%i%i..." */
if(!buf || !format) return 0;
/* Change the format string so that ints are handled as short by
default */
UTILITY_qualify(format, qualified_fmt);
/* Convert agruments to 32-bit values */
newargs = UTILITY_convertArgs(format, args);
result = vsprintf(buf, qualified_fmt, newargs);
free(newargs);
return result;
};

View File

@ -21,6 +21,8 @@ extern Display * XT_display;
static HWND firstWindow = 0;
void BUTTON_CreateButton(LPSTR className, LPSTR buttonLabel, HWND hwnd);
/***********************************************************************
* WIN_FindWndPtr
@ -99,7 +101,7 @@ HWND CreateWindow( LPSTR className, LPSTR windowName,
{
/* Check if parent is valid */
parentPtr = WIN_FindWndPtr( parent );
if (!parentPtr) return 0;
if (!parent) return 0;
}
else if (style & WS_CHILD) return 0; /* WS_CHILD needs a parent */
@ -160,10 +162,16 @@ HWND CreateWindow( LPSTR className, LPSTR windowName,
/* Create the widgets */
if (style & WS_CHILD)
if (!strcasecmp(className, "BUTTON"))
{
wndPtr->shellWidget = 0;
wndPtr->winWidget = XtVaCreateManagedWidget(className,
BUTTON_CreateButton(className, windowName, hwnd);
}
else
{
if (style & WS_CHILD)
{
wndPtr->shellWidget = 0;
wndPtr->winWidget = XtVaCreateManagedWidget(className,
coreWidgetClass,
parentPtr->winWidget,
XtNx, x,
@ -171,58 +179,61 @@ HWND CreateWindow( LPSTR className, LPSTR windowName,
XtNwidth, width,
XtNheight, height,
NULL );
}
else
{
wndPtr->shellWidget = XtVaAppCreateShell(className,
}
else
{
wndPtr->shellWidget = XtVaAppCreateShell(className,
windowName,
topLevelShellWidgetClass,
XT_display,
XtNx, x,
XtNy, y,
NULL );
wndPtr->compositeWidget = XtVaCreateManagedWidget(className,
wndPtr->compositeWidget = XtVaCreateManagedWidget(className,
formWidgetClass,
wndPtr->shellWidget,
NULL );
if (wndPtr->wIDmenu == 0)
{
wndPtr->menuBarPtr = MENU_CreateMenuBar(wndPtr->compositeWidget,
instance, hwnd,
classPtr->wc.lpszMenuName,
width);
wndPtr->wIDmenu =
GlobalHandleFromPointer(wndPtr->menuBarPtr->firstItem);
}
else
{
wndPtr->menuBarPtr = MENU_UseMenu(wndPtr->compositeWidget,
instance, hwnd,
wndPtr->wIDmenu, width);
}
if (wndPtr->wIDmenu == 0)
{
wndPtr->menuBarPtr =
MENU_CreateMenuBar(wndPtr->compositeWidget,
instance, hwnd,
classPtr->wc.lpszMenuName,
width);
if (wndPtr->menuBarPtr)
wndPtr->wIDmenu =
GlobalHandleFromPointer(wndPtr->menuBarPtr->firstItem);
}
else
{
wndPtr->menuBarPtr = MENU_UseMenu(wndPtr->compositeWidget,
instance, hwnd,
wndPtr->wIDmenu, width);
}
if (wndPtr->menuBarPtr != NULL)
{
wndPtr->winWidget =
XtVaCreateManagedWidget(className,
compositeWidgetClass,
wndPtr->compositeWidget,
XtNwidth, width,
XtNheight, height,
XtNfromVert,
wndPtr->menuBarPtr->menuBarWidget,
XtNvertDistance, 4,
NULL );
}
else
{
wndPtr->winWidget =
XtVaCreateManagedWidget(className,
if (wndPtr->menuBarPtr != NULL)
{
wndPtr->winWidget =
XtVaCreateManagedWidget(className,
compositeWidgetClass,
wndPtr->compositeWidget,
XtNwidth, width,
XtNheight, height,
XtNfromVert,
wndPtr->menuBarPtr->menuBarWidget,
XtNvertDistance, 4,
NULL );
}
else
{
wndPtr->winWidget =
XtVaCreateManagedWidget(className,
compositeWidgetClass,
wndPtr->compositeWidget,
XtNwidth, width,
XtNheight, height,
NULL );
}
}
}