Commit 8d24ae6d authored by Alexandre Julliard's avatar Alexandre Julliard

Release 940405

Tue Apr 5 14:36:59 1994 Bob Amstadt (bob@pooh) * [include/mdi.h] [windows/mdi.c] Use WM_PARENTNOTIFY messages to activate children. Generate WM_CHILDACTIVATE messages. Beginnings handler for maxmized child window. Clean up when children are destroyed. * [windows/message.c] [windows/nonclient.c] [windows/winpos.c] Removed code add 94/03/26. Apr 4, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [control/menu.c] Make mouse menu navigation working again. :-)) (be carefull, clicking outside menus (ie.: clientrect) not resolved yet) * [windows/nonclient.c] [controls/scroll.c] Bugs fix in NCTrackScrollBars(). * [misc/dos_fs.c] Bug fix in 'ToDos()' in conversion for '/', (example: '/window/' was translated to 'WINDOWs'). * [miscemu/int21.c] Function ChangeDir() extract possible drive before DOS_ChangeDir(). * [loader/library.c] [loader/wine.c] Playing around moving function GetProcAddress() and put some code in. Mon Apr 4 21:39:07 1994 Alexandre Julliard (julliard@lamisun.epfl.ch) * [misc/main.c] Better explanation of command-line options. * [objects/dib.c] Implemented SetDIBitsToDevice(). * [windows/dc.c] Bug fix in SetDCState(). * [windows/event.c] Removed WS_DISABLED handling (now done in message.c). * [windows/message.c] Added sending a WM_PARENTNOTIFY message in MSG_TranslateMouseMsg(). Use WindowFromPoint() to find the window for mouse events, taking into account disabled windows. * [windows/painting.c] Bug fix in BeginPaint() to allow calling it at other times than on WM_PAINT (Solitaire needs it...) * [windows/win.c] Implemented FindWindow(). Rewritten EnableWindow() to behave more like Windows. * [windows/winpos.c] Rewritten WindowFromPoint() to also search child windows. Mon Apr 4 17:36:32 1994 Erik Bos (erik@trashcan.hacktic.nl) * [include/int21.h] -> [msdos.h] renamed. * [miscemu/int10.h] [miscemu/int25.h] [miscemu/int26.h] new, added for int 10, 25 and 26. * [miscemu/ioports.c] new, added to allow win apps to use ioports. * [loader/signal.c] Added support for in, inb, out, outb instructions. Sun Mar 27 13:40:25 1994 Bob Amstadt (bob@pooh) * controls/menu.c (InsertMenu): Changed to use FindMenuItem(). Sat Mar 26 21:23:55 1994 Bob Amstadt (bob@pooh) * [windows/mdi.c] Window list properly updated. * [windows/message.c] Call WINPOS_ChildActivate() when mouse pressed. * [windows/nonclient.c] Use WINPOS_IsAnActiveWindow() instead of GetActiveWindow() in NC_HandleNCPaint(). * [windows/winpos.c] Created functions WINPOS_IsAnActiveWindow() and WINPOS_ActivateChild() Thu Mar 24 14:49:17 1994 Bob Amstadt (bob@pooh) * controls/menu.c (DeleteMenu): Changed to use FindMenuItem (DeleteMenu): Many bug fixes. * [controls/menu.c] Created function FindMenuItem(). Thu Mar 24 14:17:24 1994 Bob Amstadt (bob@pooh) * [windows/win.c] Removed incorrect MDI handling code from CreateWindowEx(). * [controls/menu.c] MF_STRING items needed to allocate a private copy of string. * [controls/menu.c] Fixed buggy calls to GlobalFree(). * [memory/global.c] Eliminated some redundant code with function call. Wed Mar 23 1994 Pentti Moilanen (pentti.moilanen@ntc.nokia.com) * [windows/timer.c] timer list pointers looped in InsertTimer Tue Mar 29 13:32:08 MET DST 1994 julliard@di.epfl.ch (Alexandre Julliard) * [misc/cursor.c] A few changes for desktop window support. * [misc/main.c] Added -depth option. * [misc/rect.c] Yet another bug fix in SubtractRect(). * [objects/bitmap.c] Changes to use only one depth (specified with -depth) for color bitmaps. * [objects/brush.c] Added support for dithered solid brushes. * [objects/color.c] Use the same 20 system colors as in Windows. System palette initialisation now done in COLOR_InitPalette(). Added support for a color mapping table to map logical color indexes to X colormap entries. Implemented GetNearestColor() and RealizeDefaultPalette(). * [objects/dib.c] Added support for color mapping table. * [objects/dither.c] (New file) Implemented solid color dithering. * [objects/palette.c] Implemented GetSystemPaletteEntries() and SelectPalette(). * [windows/class.c] Make a copy of the menu name in RegisterClass(). * [windows/dc.c] Fixed device caps when using a desktop window. Added support for the color mapping table in DCs. * [windows/event.c] Added ConfigureNotify handler on desktop window. * [windows/message.c] Removed call to XTranslateCoordinates() on every mouse motion New function MSG_Synchronize() to synchronize with the X server. * [windows/syscolor.c] Rewritten SYSCOLOR_Init() to read the system colors from WIN.INI. * [windows/winpos.c] Added synchronization on window mapping. Solves the double redraw problem when starting Solitaire. Mar 27, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [control/menu.c] * [windows/defwnd.c] Make keyboard navigation working with menubar, but temporarely inserted a bug in menubar mouse handling ... :-(( (it will be fix next week !) * [windows/defwnd.c] Connect VK_MENU to menubar navigation. * [loader/library.c] GetModuleHandle() return 'fictive 0xF000+ handles' for built-in DLLs. Sun Mar 20 22:32:13 1994 Erik Bos (erik@trashcan.hacktic.nl) * [misc/main.c] Added Copy(). Added a check for `-h' to show usage. * [misc/dos_fs.c] Fixed bug in FindFile(), to load directories as dlls. * [misc/dos_fs.c] Fixed ToUnix() and ToDos() again, as my previous patch didn't make it. * [misc/dos_fs.c] [miscemu/int21.c] Bug fixes, should be able to handle all winfile and progman int21 requests now except for a few small things. Tue Mar 29 06:25:54 1994 crw@harris.mlb.semi.harris.com (Carl Williams) * [memory/heap.c] Implemented GetFreeSystemResources(). Mon Mar 21 17:32:25 1994 Bob Amstadt (bob@pooh) * controls/menu.c (GetSubMenu): Function did not return correct value * [windows/mdi.c] Beginnings of menu handling. Thu Mar 10 11:32:06 1994 Stefan (SAM) Muenzel (muenzel@tat.physik.uni-tuebingen.de) * [objects/font.c] if font.width equals zero use asterix instead. Mon Mar 21 17:23:37 MET 1994 julliard@di.epfl.ch (Alexandre Julliard) * [objects/bitmap.c] Rewritten bitmap code to use exclusively X pixmaps; *much* faster. * [objects/brush.c] Some changes with pattern brushes because of the new bitmap code. * [objects/color.c] Added function COLOR_ToPhysical for better color mapping. * [objects/dib.c] Heavily optimized SetDIBits(). * [windows/dc.c] Opimized SetDCState() and DC_SetupGC*() functions. Added stub for CreateIC(). Mar 20, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [misc/message.c] Call SetFocus() after closing box to give back focus to previous owner. * [misc/files.c] Small bug fix in GetTempFilename() : replace a '\' to '\\'. * [control/scroll.c] Calls to BitBlt() replace by StretchBlt(). * [control/menu.c] Call SetFocus() to previous owner after closing Popups. Fill stub DeleteMenu(). * [control/listbox.c] * [control/combo.c] Use SetFocus() in WM_LBUTTONDOWN. Close ComboBox List upon WM_KILLFOCUS. Early development of WM_MEASUREITEM mecanism. * [windows/defwnd.c] Early development of WM_MEASUREITEM mecanism. Tue Mar 22 10:44:57 1994 Miguel de Icaza (miguel@xochitl) * [misc/atom.c] Fixed sintaxis problem when building the library. Tue Mar 15 13:11:56 1994 Bob Amstadt (bob@pooh) * [include/windows.h] Added message types and structures for MDI * [include/mdi.h] Created internal structures for handling MDI * [windows/mdi.c] Began creating MDI support Thu Mar 10 16:51:46 1994 Bob Amstadt (bob@pooh) * [loader/wine.c] [include/wine.h] Added new field to "struct w_files" to hold the "name table" resource for Windows 3.0 programs * [loader/resource.c] Added code to handle programs with a "name table" resource. LoadResourceByName() modified to check for the existence of this resource. Mon Mar 14 22:31:42 MET 1994 julliard@di.epfl.ch (Alexandre Julliard) * [objects/color.c] Added installing the private colormap on the desktop window. * [windows/event.c] Cleaned up focus event handling (see focus.c). Use GetFocus() to direct key events to the correct window. * [windows/focus.c] Rewritten SetFocus() to: - only set X focus on top-level windows - send WM_SETFOCUS and WM_KILLFOCUS messages (was done in event.c) - prevent setting focus to disabled windows - install private colormap so -privatemap option works again * [windows/message.c] [windows/timer.c] Changed timer management to no longer use PostMessage(), but to generate timer messages on the fly. Also fixed a related bug in GetMessage() which could cause busy-waiting. * [windows/win.c] Only select focus events on top-level windows. * [windows/winpos.c] Added some sanity checks for desktop window. Fri Mar 4 20:42:01 1994 Erik Bos (erik@trashcan.hacktic.nl) * [misc/dos_fs.c] bug fixes in ToUnix(), WinIniFileName(), GetUnixFileName(). Support for tilde symbol added for rootdirectories in [drives] section of wine's configfile. * [misc/file.c] hread(), hwrite() added. * [misc/main.c] hmemcpy() added. * [if1632/stress.spec] [include/stress.h] [misc/stress.c] Added STRESS.DLL, an useless dll used to stress a windows system. * [*/*] Added missing #includes, fixed prototypes for prototype checking. * [include/prototypes.h] Added prototypes for loader/*c, if1632/*c. Tue Mar 8 09:54:34 1994 Bob Amstadt (bob@pooh) * [Configure] Added reminder to set WINEPATH, if it is not set. * [Imakefile] Removed #elif's * [controls/button.c] Added BN_CLICKED notification for owner-draw buttons. * [if1632/kernel.spec] [memory/heap.c] Changed Local* functions to WIN16_Local* to prevent unconcious use of these functions. * [if1632/relay.c] Push old Stack16Frame on stack before setting. * [include/atom.h] [misc/atom.c] [include/heap.h] [memory/local.c] Added multiple local heap handling in Atom* functions. * [include/regfunc.h] [miscemu/int21.c] Rewrote DOS3Call() use context frame that is already on the stack. * [misc/profile.c] Fixed to allow leading ";" to mark comments. * [misc/spy.c] Fixed bugs and added support for "include" and "exclude" filters. * [misc/user.c] Rearranged calls in InitApp(). * [misc/font.c] Fixed font handling to create system fonts, if they are used. * [windows/dc.c] If text drawn on window with no font specified, then default the font to the system font. Mon Mar 7 20:32:09 MET 1994 julliard@di.epfl.ch (Alexandre Julliard) * [controls/desktop.c] Added handling of WM_NCCREATE and WM_ERASEBKGND functions. Implemented SetDeskPattern(). * [misc/main.c] Added -desktop option to get a large desktop window with everything inside it. Added -name option. * [misc/rect.c] Bug fix in SubtractRect(). * [objects/*.c] Replaced the DefaultRootWindow() macro by the rootWindow variable. * [windows/event.c] [windows/message.c] [windows/nonclient.c] [windows/win.c] A few changes to accomodate the new desktop window. Tue Mar 8 11:13:03 1994 Miguel de Icaza (miguel@xochitl.nuclecu.unam.mx) * [toolkit/arch.c] --New file-- Routines for converting little endian data structures to big-endian data structures, currently only BITMAP structures are converted. * [misc/atom.c] When used as part of the WineLib, the code is much simpler. Doesn't depend on alignement. * [loader/wine.c] Ifdefed Emulator dependent code if compiling WineLib. * [loader/resource.c] Moved misc/resource.c to loader/resource.c. * [loader/dump.c,ldt.c,ldtlib.c,library,c,selector.c,signal.c] Ifdefed whole code if compiling WINELIB. * [include/winsock.h] Added compilation define to allow compilation on SunOS. * [include/wine.h] Removed load_typeinfo and load_nameinfo prototypes, they belong to neexe.h * [include/neexe.h] Added load_typeinfo and load_nameinfo prototypes. * [include/arch.h] Fixed some bugs in the conversion routines. Added macros for Bitmap loading. Tue Mar 8 12:52:05 1994 crw@maniac.mlb.semi.harris.com (Carl Williams) * [if1632/kernel.spec] [memory/global.c] Implemented GetFreeSpace() * [if1632/user.spec] [loader/resource.c] Implemented CreateIcon()
parent fb9a919f
- EBP and ESP are sometimes corrupted while running 16-bit code.
- Dialog Boxes created by WM_CREATE handler aren't visible
- RegisterClass() with hbrBackground = COLOR_APPWORKSPACE+1 does not work.
- MDI client area needs to resize when frame does
- Need to generate WM_CHILDACTIVATE
\ No newline at end of file
......@@ -2,12 +2,13 @@
ALLDEFINES=''
echo
echo -n 'Build Wine as emulator or library (E/L) [E]? '
read input
if [ "$input" = 'l' -o "$input" = 'L' ]
then
WINELIB='#define WineLib -DWINELIB'
ALLDEFINES=$ALLDEFINES -DWINELIB
WINELIB='#define WINELIB -DWINELIB'
ALLDEFINES="$ALLDEFINES -DWINELIB"
else
WINELIB=''
fi
......@@ -17,14 +18,40 @@ read input
if [ "$input" = 'y' -o "$input" = 'Y' ]
then
SHORTNAMES='#define ShortNames -DSHORTNAMES'
ALLDEFINES=$ALLDEFINES -DSHORTNAMES
ALLDEFINES="$ALLDEFINES -DSHORTNAMES"
else
SHORTNAMES=''
fi
echo -n 'Global configfile name [/usr/local/etc/wine.conf]? '
read input
if [ "$input" = '' ]
then
WINE_INI_GLOBAL='#define WINE_INI_GLOBAL "/usr/local/etc/wine.conf"'
else
WINE_INI_GLOBAL='#define WINE_INI_GLOBAL "'$input'"'
fi
if [ "`(domainname)`" = 'amscons.com' ]
then
echo -n 'New build program (Y/N) [N]? '
read input
if [ "$input" = 'y' -o "$input" = 'Y' ]
then
NEWBUILD='#define NewBuild -DNEWBUILD'
ALLDEFINES="$ALLDEFINES -DNEWBUILD"
else
NEWBUILD=''
fi
else
NEWBUILD=''
fi
echo '/* autoconf.h generated automatically. Run Configure. */' > autoconf.h
echo $WINELIB >> autoconf.h
echo $SHORTNAMES >> autoconf.h
echo $NEWBUILD >> autoconf.h
echo $WINE_INI_GLOBAL >> autoconf.h
echo "#define AutoDefines $ALLDEFINES" >> autoconf.h
xmkmf -a
......@@ -12,8 +12,9 @@ SUBMITTING YOUR WORK:
Submissions of code for inclussion into Wine should be sent to
bob@amscons.com (Bob Amstadt). You MUST provide a suitable
ChangeLog entry for any work that you submit. I prefer new code
to be submitted as diffs off of the latest release. Releases are
every Tuesday evening (approximately 19:00 PST or Wednesday 03:00 GMT).
to be submitted as unified diffs (diff -u) off of the latest release.
Releases are every Tuesday evening (approximately 17:00 PST or
Wednesday 01:00 GMT).
MEMORY AND SEGMENTS:
......@@ -78,4 +79,11 @@ the "build" program to create dll_*.s and dll_tab_*.c. The dll_*.s
files contain the entry point code for each API call, and the dll_tab_*.s
files contain tables used by relay.c to translate arguments and transfer
control to the proper handler. The format of the *.spec files is
documented in the file "tools/build-spec.txt".
\ No newline at end of file
documented in the file "tools/build-spec.txt".
REGISTER FUNCTIONS:
Some functions are defined as type "register" in the DLL specification files.
Inorder to return values in the registers to the WIN16 program, the handler
function must exit by calling ReturnFromRegisterFunc(). Look at the function
DOS3Call() for an example of how this works.
......@@ -27,6 +27,7 @@ COMMONSUBDIRS = \
controls \
etc \
include \
loader \
misc \
objects \
test \
......@@ -36,7 +37,6 @@ EMUSUBDIRS = \
tools \
debugger \
if1632 \
loader \
memory \
miscemu
......@@ -47,6 +47,7 @@ WINEDIR = $(LIBDIR)/wine
COMMONOBJS = \
controls.o \
loader.o \
misc.o \
objects.o \
windows.o
......@@ -58,7 +59,6 @@ COMMONOBJS = \
EMUOBJS = \
if1632.o \
debugger.o \
loader.o \
memory.o \
miscemu.o \
readline.o
......@@ -74,11 +74,13 @@ SUBDIRS = $(COMMONSUBDIRS) $(LIBSUBDIRS)
OBJS = $(COMMONOBJS) $(LIBOBJS)
#endif
#if defined(i386BsdArchitecture)
#ifdef i386BsdArchitecture
SYSLIBS = -ll -lm -li386 -lgnumalloc
#elif defined(i386FreeBsd)
#endif
#ifdef i386FreeBsd
SYSLIBS = -ll -lm -lgnumalloc
#elif defined(LinuxArchitecture)
#endif
#ifdef LinuxArchitecture
SYSLIBS = -lm -lg
#endif
......
......@@ -2,7 +2,9 @@ Copyright Robert J. Amstadt, 1993. All code is provided without
warranty. All code is covered by the license contained in the file
LICENSE unless explicitly stated in the individual source file.
INSTALLATION:
1. COMPILATION:
You must have one of:
......@@ -11,21 +13,103 @@ You must have one of:
FreeBSD-current or FreeBSD 1.1
To build Wine, first do a "./Configure" and then a "make". The
executable "wine" will be built. "wine" will load and run Windows'
executables. You must have a file "wine.ini" in the current directory,
your home directory, or in the path specified by the environment
variable WINEPATH. Multiple directories in WINEPATH should be seperated
by semi-colons and NOT by colons!
executable "wine" will be built. "wine" will load and run 16-bit
Windows' executables.
You must specify the entire path to the executable, or a filename only
(using the path= statement in wine.ini as the search path)
For example: to run Windows' solitaire:
export WINEPATH=/etc;/usr/windows
2. SETUP:
Wine requires you to have a file /usr/local/etc/wine.conf (you can
supply a different name when configuring wine) or a file called .winerc
in your homedirectory.
The formatstyle of this config file is just like a windows .ini file.
Here's an explanation of each section:
* [drives]
format: <driveletter> = <rootdirectory>
default: none
This section is used to specify the root directory of each `dos'drive
as windows' applications require a dos/mswindows based diskdrive &
directory scheme.
If you mounted you dos-partition as /dos and installed microsoft windows
in c:\windows than you should specify c=/dos in the drives section.
* [wine]
format: windows = <directory>
default: c:\windows
Used to specify an different windows directory.
format: system = <directory>
default: c:\windows\system
Used to specify an different system directory.
format: temp = <directory>
default: c:\temp
Used to specify a directory where windows applications can store temporary
files.
format: path = <directories separated by semi-colons>
default: c:\windows;c:\windows\system
Used to specify the path which will be used to find executables and DLL's.
format: systemresources = <filename>
default: c:\temp
wine sol (using the path= statement in wine.ini
wine sol.exe as the search path)
Used to specify the name of sysres.dll, a dll which is used by wine itself.
* [serialports]
format: com[12345678] = <devicename>
default: none
Used to specify the devices which are used as com1 - com8.
* [parallelports]
format: lpt[12345678] = <devicename>
default: none
Used to specify the devices which are used as lpt1 - lpt8.
* [spy]
format: file = <filename or CON when logging to stdout>
default: none
used to specify the file which will be used as logfile.
format: exclude = <message names separated by semicolons>
default: none
Used to specify which messages will be excluded from the logfile.
format: include = <message names separated by semicolons>
default: none
Used to specify which messages will be included in the logfile.
3. RUNNING PROGRAMS
When invoking wine, you must specify the entire path to the executable,
or a filename only.
For example: to run Windows' solitaire:
wine sol (using the searchpath to locate the file)
wine sol.exe
wine c:\\windows\\sol.exe (using a dosfilename)
......@@ -34,6 +118,93 @@ For example: to run Windows' solitaire:
Have a nice game of solitaire, but be careful. Emulation isn't perfect.
So, occassionally it will crash.
4. EXAMPLE CONFIGFILE
----------------------------------------------------------------------------
[drives]
a=/mnt/fd0
c=/dos
d=~/Wine
[wine]
windows=c:\windows
system=c:\windows\system
temp=c:\temp
path=c:\windows;c:\windows\system;c:\winapps\word\;c:\winapps\pctools
systemresources=./sysres.dll
[serialports]
com1=/dev/cua1
com2=/dev/cua1
[parallelports]
lpt1=/dev/lp0
[spy]
;File=CON
;File=spy.log
Exclude=WM_TIMER;WM_SETCURSOR;WM_MOUSEMOVE;WM_NCHITTEST;WM_NCACTIVATE;WM_GETDLGCODE;
Include=WM_COMMAND;
----------------------------------------------------------------------------
5. BUILD:
The documentation for the build program is in the file build-spec.txt
6. FINALE:
Good luck,
If you successfully add anything, please send me a copy.
Bob Amstadt
bob@amscons.com
7. WHAT'S NEW
WHAT'S NEW with Wine-940405: (see ChangeLog for details)
- Mouse activation of menus working again
- GetprocAddress()
- SetDIBitsToDevice()
- FindWindow()
- int 10hm 25h and 26h
- in, inb, out, outb emulation
- and many many bug fixes!
WHAT'S NEW with Wine-940329: (see ChangeLog for details)
- MDI: child windows can be created, activated and cascaded.
- -depth option
- support for dithered brushes
- GetNearestColor(), RealizeDefaultPalette(),
GetSystemPaletteEntries(), and SelectPalette()
- System colors read from WIN.INI
- Keyboard menu manipulation (mouse is temporarily broken)
- GetFreeSystemResources()
- and many many bug fixes!
WHAT'S NEW with Wine-940322: (see ChangeLog for details)
- Speed improvements in bitmaps and mouse messages
- More MDI support. More to come next week...
- and many many bug fixes!
WHAT'S NEW with Wine-940315: (see ChangeLog for details)
- Beginnings of MDI support. More to come next week...
- Stress DLL
- and many many bug fixes!
WHAT'S NEW with Wine-940309: (see ChangeLog for details)
- New "exclude" and "include" filters for spy feature. See sample
wine.ini for details.
- -desktop and -name options (see ChangeLog)
- GetFreeSpace() and CreateIcon()
- and many many bug fixes!
WHAT'S NEW with Wine-940301: (see ChangeLog for details)
- NEW Configure script to set compile time options!
- Support for filesystems with short (less than 14 chars) filenames.
......@@ -299,27 +470,3 @@ WHAT'S NEW with version 0.0.1:
library routines. A brief description of how to build these
specifications is included in the file "build-spec.txt".
- The code to dispatch builtin DLL calls is complete, but untested.
TODO:
- Segment fixup code completion.
- Trap and handle DOS and DPMI calls.
- GlobalAlloc of code segments.
- Rewrite global memory support including kernel mods to allow
application to mess with page map.
- Handle self-loading applications.
- Resource loading
- Lots and lots of API fiunctions.
BUILD:
The documentation for the build program is in the file build-spec.txt
FINALE:
Good luck,
If you successfully add anything, please send me a copy.
Bob Amstadt
bob@amscons.com
XCOMM $Id$
INCLUDES = -I$(TOP)/include
INCLUDES = -I$(TOP)/include -I$(TOP)
XCOMM Imake rules go here
XCOMM First, dll description to files etc
#ifndef MakeDllFromSpec
#ifndef NewBuild
#ifndef ShortNames
#define MakeDllFromSpec(name,objfile) @@\
objfile.o: Concat(dll_,name.o) Concat3(dll_,name,_tab.o) @@\
@@\
Concat(dll_,name.S) Concat3(dll_,name,_tab.c): name.spec $(TOP)/tools/build @@\
$(TOP)/tools/build name.spec @@\
#else
#else /* ShortNames */
#define MakeDllFromSpec(name,objfile) @@\
objfile.o: Concat(dll_,name.o) Concat(dtb_,name.o) @@\
@@\
Concat(dll_,name.S) Concat(dtb_,name.c): name.spec $(TOP)/tools/build @@\
Concat(dll_,name.S) Concat(dtb_,name.c): name.spec $(TOP)/tools/build @@\
$(TOP)/tools/build name.spec @@\
#endif /* SHORTNAMES */
#endif /* ShortNames */
#else /* NewBuild */
#ifndef ShortNames
#define MakeDllFromSpec(name,objfile) @@\
Concat(dll_,name.S) Concat(rly_,name.S) Concat3(dll_,name,_tab.c): name.spec $(TOP)/tools/newbuild @@\
$(TOP)/tools/newbuild name.spec @@\
#else /* ShortNames */
#define MakeDllFromSpec(name,objfile) @@\
Concat(dll_,name.S) Concat(rly_,name.S) Concat(dtb_,name.c): name.spec $(TOP)/tools/newbuild @@\
$(TOP)/tools/newbuild name.spec @@\
#endif /* ShortNames */
#endif /* NewBuild */
#endif /* MakeDllFromSpec */
/*
......
......@@ -963,7 +963,10 @@ static LONG UB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam)
ReleaseCapture();
GetClientRect(hWnd, &rc);
if (PtInRect(&rc, MAKEPOINT(lParam)))
{
NOTIFY_PARENT(hWnd, BN_CLICKED);
NOTIFY_PARENT(hWnd, BN_UNHILITE);
}
InvalidateRect(hWnd, NULL, FALSE);
UpdateWindow(hWnd);
}
......
......@@ -6,16 +6,108 @@
static char Copyright[] = "Copyright Alexandre Julliard, 1994";
#include "windows.h"
#include <stdio.h>
#include <string.h>
#include "win.h"
#include "desktop.h"
/***********************************************************************
* DESKTOP_DoEraseBkgnd
*
* Handle the WM_ERASEBKGND message.
*/
static LONG DESKTOP_DoEraseBkgnd( HWND hwnd, HDC hdc, DESKTOPINFO *infoPtr )
{
RECT rect;
/* Set colors in case pattern is a monochrome bitmap */
SetBkColor( hdc, RGB(0,0,0) );
SetTextColor( hdc, GetSysColor(COLOR_BACKGROUND) );
GetClientRect( hwnd, &rect );
FillRect( hdc, &rect, infoPtr->hbrushPattern );
return 1;
}
/***********************************************************************
* DesktopWndProc
*
* Window procedure for the desktop window.
*/
LONG DesktopWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam )
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
DESKTOPINFO *infoPtr = (DESKTOPINFO *)wndPtr->wExtra;
/* Most messages are ignored (we DON'T call DefWindowProc) */
switch(message)
{
/* Warning: this message is sent directly by */
/* WIN_CreateDesktopWindow() and does not contain a valid lParam */
case WM_NCCREATE:
infoPtr->hbrushPattern = 0;
infoPtr->hbitmapWallPaper = 0;
SetDeskPattern();
break;
case WM_ERASEBKGND:
if (rootWindow == DefaultRootWindow(display)) return 1;
return DESKTOP_DoEraseBkgnd( hwnd, (HDC)wParam, infoPtr );
}
return 0;
}
/***********************************************************************
* SetDeskPattern (USER.279)
*/
BOOL SetDeskPattern()
{
char buffer[100];
GetProfileString( "desktop", "Pattern", "(None)", buffer, 100 );
return DESKTOP_SetPattern( buffer );
}
/***********************************************************************
* SetDeskWallPaper (USER.285)
*/
BOOL SetDeskWallPaper( LPSTR filename )
{
return TRUE;
}
/***********************************************************************
* DESKTOP_SetPattern
*
* Set the desktop pattern.
*/
BOOL DESKTOP_SetPattern(char *pattern )
{
WND *wndPtr = WIN_FindWndPtr( GetDesktopWindow() );
DESKTOPINFO *infoPtr = (DESKTOPINFO *)wndPtr->wExtra;
int pat[8];
if (infoPtr->hbrushPattern) DeleteObject( infoPtr->hbrushPattern );
memset( pat, 0, sizeof(pat) );
if (pattern && sscanf( pattern, " %d %d %d %d %d %d %d %d",
&pat[0], &pat[1], &pat[2], &pat[3],
&pat[4], &pat[5], &pat[6], &pat[7] ))
{
WORD pattern[8];
HBITMAP hbitmap;
int i;
for (i = 0; i < 8; i++) pattern[i] = pat[i] & 0xffff;
hbitmap = CreateBitmap( 8, 8, 1, 1, pattern );
infoPtr->hbrushPattern = CreatePatternBrush( hbitmap );
DeleteObject( hbitmap );
}
else infoPtr->hbrushPattern = CreateSolidBrush( GetSysColor(COLOR_BACKGROUND) );
return TRUE;
}
......@@ -7,6 +7,7 @@
static char Copyright[] = "Copyright David W. Metcalfe, 1993";
#include <stdio.h>
#include <windows.h>
#include "win.h"
#include "user.h"
......
......@@ -7,7 +7,9 @@
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "win.h"
#include "desktop.h"
#include "mdi.h"
#include "gdi.h"
LONG ButtonWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam );
LONG StaticWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam );
......@@ -16,6 +18,7 @@ LONG ListBoxWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
LONG ComboBoxWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
LONG PopupMenuWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
LONG DesktopWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
LONG MDIClientWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
static WNDCLASS WIDGETS_BuiltinClasses[] =
......@@ -32,10 +35,12 @@ static WNDCLASS WIDGETS_BuiltinClasses[] =
0, 0, 0, 0, NULL, "COMBOBOX" },
{ CS_GLOBALCLASS, (LONG(*)())PopupMenuWndProc, 0, 8,
0, 0, 0, 0, NULL, "POPUPMENU" },
{ CS_GLOBALCLASS, (LONG(*)())DesktopWndProc, 0, 0,
{ CS_GLOBALCLASS, (LONG(*)())DesktopWndProc, 0, sizeof(DESKTOPINFO),
0, 0, 0, 0, NULL, DESKTOP_CLASS_NAME },
{ CS_GLOBALCLASS, (LONG(*)())DefDlgProc, 0, DLGWINDOWEXTRA,
0, 0, 0, 0, NULL, DIALOG_CLASS_NAME }
0, 0, 0, 0, NULL, DIALOG_CLASS_NAME },
{ CS_GLOBALCLASS, (LONG(*)())MDIClientWndProc, 0, sizeof(MDICLIENTINFO),
0, 0, 0, STOCK_LTGRAY_BRUSH, NULL, "MDICLIENT" }
};
#define NB_BUILTIN_CLASSES \
......@@ -47,7 +52,7 @@ static WNDCLASS WIDGETS_BuiltinClasses[] =
*
* Initialize the built-in window classes.
*/
BOOL WIDGETS_Init()
BOOL WIDGETS_Init(void)
{
int i;
for (i = 0; i < NB_BUILTIN_CLASSES; i++)
......
......@@ -8,15 +8,25 @@ SRCS = \
callback.c \
relay.c
/*
* Hack alert. There appear to be no object files, 'cause a very
* nasty rule below links *.o together, which is a generally bad idea,
* but I can't see how else to do it.
*/
OBJS = \
call.o \
callback.o \
relay.o
DLLOBJS = \
dll_gdi.o \
dll_kernel.o \
dll_keyboard.o \
dll_shell.o \
dll_sound.o \
dll_stress.o \
dll_unixlib.o \
dll_user.o \
dll_win87em.o \
dll_winsock.o
OBJS1= $(SRCS:.S=.o)
#ifndef NewBuild
OBJS = $(DLLOBJS) $(OBJS1:.c=.o) $(DLLOBJS:.o=_tab.o)
#else
OBJS = $(DLLOBJS) $(OBJS1:.c=.o) $(DLLOBJS:.o=_tab.o) $(DLLOBJS:dll_.rly_)
#endif
/*
* If you add a new spec file, copy one of these lines
......@@ -26,21 +36,19 @@ MakeDllFromSpec(kernel,$(TOP)/$(MODULE))
MakeDllFromSpec(keyboard,$(TOP)/$(MODULE))
MakeDllFromSpec(shell,$(TOP)/$(MODULE))
MakeDllFromSpec(sound,$(TOP)/$(MODULE))
MakeDllFromSpec(stress,$(TOP)/$(MODULE))
MakeDllFromSpec(unixlib,$(TOP)/$(MODULE))
MakeDllFromSpec(user,$(TOP)/$(MODULE))
MakeDllFromSpec(win87em,$(TOP)/$(MODULE))
MakeDllFromSpec(winsock,$(TOP)/$(MODULE))
/*
* Yes I know *.o is not very clever, but can you do it cleaner ?
*/
WineRelocatableTarget($(TOP)/$(MODULE),*.o,)
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget()
CleanTarget()
$(TOP)/$(MODULE).o: $(OBJS)
includes::
install::
clean::
$(RM) dll* dtb*
depend::
includes::
......@@ -105,7 +105,7 @@ _CallToInit16:
movw $UDATASEL,%ax
movw %ax,%fs
movw %ax,%gs
movw %ds,%ax
/* movw %ds,%ax */
/*
* Call entry point
......
......@@ -126,6 +126,8 @@ length 490
148 pascal SetBrushOrg(word s_word s_word) SetBrushOrg(1 2 3)
149 pascal GetBrushOrg(word) GetBrushOrg(1)
150 pascal UnrealizeObject(word) UnrealizeObject(1)
153 pascal CreateIC(ptr ptr ptr ptr) CreateIC(1 2 3 4)
154 pascal GetNearestColor(word long) GetNearestColor(1 2)
161 pascal PtInRegion(word s_word s_word) PtInRegion(1 2 3)
162 pascal GetBitmapDimension(word) GetBitmapDimension(1)
163 pascal SetBitmapDimension(word s_word s_word) SetBitmapDimension(1 2 3)
......@@ -134,6 +136,7 @@ length 490
179 pascal GetDCState(word) GetDCState(1)
180 pascal SetDCState(word word) SetDCState(1 2)
181 pascal RectInRegionOld(word ptr) RectInRegion(1 2)
250 pascal Copy(ptr ptr word) Copy(1 2 3)
345 pascal GetTextAlign(word) GetTextAlign(1)
346 pascal SetTextAlign(word word) SetTextAlign(1 2)
348 pascal Chord(word s_word s_word s_word s_word s_word s_word s_word s_word)
......@@ -141,14 +144,21 @@ length 490
349 pascal SetMapperFlags(word word) SetMapperFlags(1 2)
350 pascal GetCharWidth(word word word ptr) GetCharWidth(1 2 3 4)
360 pascal CreatePalette(ptr) CreatePalette(1)
361 pascal GDISelectPalette(word word) GDISelectPalette(1 2)
362 pascal GDIRealizePalette(word) GDIRealizePalette(1)
363 pascal GetPaletteEntries(word word word ptr) GetPaletteEntries(1 2 3 4)
364 pascal SetPaletteEntries(word word word ptr) SetPaletteEntries(1 2 3 4)
365 pascal RealizeDefaultPalette(word) RealizeDefaultPalette(1)
370 pascal GetNearestPaletteIndex(word long) GetNearestPaletteIndex(1 2)
375 pascal GetSystemPaletteEntries(word word word ptr)
GetSystemPaletteEntries(1 2 3 4)
411 pascal GetCurLogFont(word) GetCurLogFont(1)
440 pascal SetDIBits(word word word word ptr ptr word) SetDIBits(1 2 3 4 5 6 7)
441 pascal GetDIBits(word word word word ptr ptr word) GetDIBits(1 2 3 4 5 6 7)
442 pascal CreateDIBitmap(word ptr long ptr ptr word)
CreateDIBitmap(1 2 3 4 5 6)
443 pascal SetDIBitsToDevice(word s_word s_word word word word word word word ptr ptr word)
SetDIBitsToDevice(1 2 3 4 5 6 7 8 9 10 11 12)
444 pascal CreateRoundRectRgn(s_word s_word s_word s_word s_word s_word)
CreateRoundRectRgn(1 2 3 4 5 6)
445 pascal CreateDIBPatternBrush(word word) CreateDIBPatternBrush(1 2)
......
......@@ -6,16 +6,16 @@ length 415
3 pascal GetVersion() GetVersion()
#return GetVersion 0 0x301
4 pascal LocalInit(word word word) LocalInit(1 2 3)
5 pascal LocalAlloc(word word) LocalAlloc(1 2)
6 pascal LocalReAlloc(word word word) LocalReAlloc(1 2 3)
7 pascal LocalFree(word) LocalFree(1)
8 pascal LocalLock(word) LocalLock(1)
9 pascal LocalUnlock(word) LocalUnlock(1)
10 pascal LocalSize(word) LocalSize(1)
4 pascal LocalInit(word word word) WIN16_LocalInit(1 2 3)
5 pascal LocalAlloc(word word) WIN16_LocalAlloc(1 2)
6 pascal LocalReAlloc(word word word) WIN16_LocalReAlloc(1 2 3)
7 pascal LocalFree(word) WIN16_LocalFree(1)
8 pascal LocalLock(word) WIN16_LocalLock(1)
9 pascal LocalUnlock(word) WIN16_LocalUnlock(1)
10 pascal LocalSize(word) WIN16_LocalSize(1)
11 pascal LocalHandle(word) ReturnArg(1)
12 pascal LocalFlags(word) LocalFlags(1)
13 pascal LocalCompact(word) LocalCompact(1)
12 pascal LocalFlags(word) WIN16_LocalFlags(1)
13 pascal LocalCompact(word) WIN16_LocalCompact(1)
14 return LocalNotify 4 0
15 pascal GlobalAlloc(word long) GlobalAlloc(1 2)
16 pascal GlobalReAlloc(word long word) GlobalReAlloc(1 2 3)
......@@ -89,6 +89,7 @@ length 415
163 pascal GlobalLRUOldest(word) ReturnArg(1)
164 pascal GlobalLRUNewest(word) ReturnArg(1)
166 pascal WinExec(ptr word) WinExec(1 2)
169 pascal GetFreeSpace(word) GetFreeSpace(1)
170 pascal AllocCStoDSAlias(word) AllocDStoCSAlias(1)
171 pascal AllocDStoCSAlias(word) AllocDStoCSAlias(1)
175 pascal AllocSelector(word) AllocSelector(1)
......
......@@ -3,6 +3,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
......@@ -14,6 +15,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <linux/segment.h>
#endif
#include <errno.h>
#include "neexe.h"
#include "segmem.h"
#include "prototypes.h"
......@@ -22,7 +24,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#define DEBUG_RELAY /* */
#define N_BUILTINS 9
#define N_BUILTINS 10
struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] =
{
......@@ -35,6 +37,7 @@ struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] =
{ "SOUND", SOUND_table, 20, 7 },
{ "KEYBOARD",KEYBOARD_table,137, 8 },
{ "WINSOCK", WINSOCK_table, 155, 9 },
{ "STRESS", STRESS_table, 15,10 },
};
unsigned short *Stack16Frame;
......@@ -65,6 +68,7 @@ int
DLLRelay(unsigned int func_num, unsigned int seg_off)
{
struct dll_table_entry_s *dll_p;
unsigned short *saved_Stack16Frame;
unsigned int segment;
unsigned int offset;
unsigned int dll_id;
......@@ -78,6 +82,7 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
/*
* Determine address of arguments.
*/
saved_Stack16Frame = Stack16Frame;
Stack16Frame = (unsigned short *) seg_off;
arg_ptr = (void *) (seg_off + 0x18);
......@@ -138,7 +143,11 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
* if we choose.
*/
if (dll_p->n_args == 0)
return (*func_ptr)(arg_ptr);
{
ret_val = (*func_ptr)(arg_ptr);
Stack16Frame = saved_Stack16Frame;
return ret_val;
}
/*
* Getting this far means we need to convert the 16-bit argument stack.
......@@ -197,6 +206,7 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
}
#endif
Stack16Frame = saved_Stack16Frame;
return ret_val;
}
......
# summary: resource modification dll
#
name stress
id 10
length 15
2 pascal allocmem(long) AllocMem(1)
3 pascal freeallmem() FreeAllMem()
6 pascal allocfilehandles(word) AllocFileHandles(1)
7 pascal unallocfilehandles() UnAllocFileHandles()
8 pascal getfreefilehandles() GetFreeFileHandles()
10 pascal allocdiskspace(long word) AllocDiskSpace(1 2)
11 pascal unallocdiskspace(word) UnAllocDiskSpace(1)
12 pascal allocusermem(word) AllocUserMem(1)
13 pascal freeallusermem() FreeAllUserMem()
14 pascal allocgdimem(word) AllocGDIMem(1)
15 pascal freeallgdimem() FreeAllGDIMem()
......@@ -152,7 +152,7 @@ length 540
167 pascal ShowCaret(word) ShowCaret(1)
168 pascal SetCaretBlinkTime(word) SetCaretBlinkTime(1)
169 pascal GetCaretBlinkTime() GetCaretBlinkTime()
171 pascal WinHelp(word word long) WinHelp(1 2 3)
171 pascal WinHelp(word ptr word long) WinHelp(1 2 3 4)
173 pascal LoadCursor(word ptr) LoadCursor(1 2)
174 pascal LoadIcon(word ptr) LoadIcon(1 2)
175 pascal LoadBitmap(word ptr) LoadBitmap(1 2)
......@@ -215,6 +215,7 @@ length 540
277 pascal GetDlgCtrlID(word) GetDlgCtrlID(1)
282 pascal SelectPalette(word word word) SelectPalette(1 2 3)
283 pascal RealizePalette(word) RealizePalette(1)
284 pascal GetFreeSystemResources(word) GetFreeSystemResources(1)
286 pascal GetDesktopWindow() GetDesktopWindow()
288 pascal GetMessageExtraInfo() GetMessageExtraInfo()
290 pascal RedrawWindow(word ptr word word) RedrawWindow(1 2 3 4)
......@@ -235,6 +236,8 @@ length 540
404 pascal GetClassInfo(word ptr ptr) GetClassInfo(1 2 3)
406 pascal CreateCursor(word word word word word ptr ptr)
CreateCursor(1 2 3 4 5 6 7)
407 pascal CreateIcon(word word word byte byte ptr ptr)
CreateIcon(1 2 3 4 5 6 7)
410 pascal InsertMenu(word word word word ptr) InsertMenu(1 2 3 4 5)
411 pascal AppendMenu(word word word ptr) AppendMenu(1 2 3 4)
412 pascal RemoveMenu(word word word) RemoveMenu(1 2 3)
......@@ -257,6 +260,9 @@ length 540
436 pascal IsCharLower(byte) IsCharLower(1)
437 pascal AnsiUpperBuff(ptr word) AnsiUpperBuff(1 2)
438 pascal AnsiLowerBuff(ptr word) AnsiLowerBuff(1 2)
445 pascal DefFrameProc(word word word word long) DefFrameProc(1 2 3 4 5)
447 pascal DefMDIChildProc(word word word long) DefMDIChildProc(1 2 3 4)
451 pascal TranslateMDISysAccel(word ptr) TranslateMDISysAccel(1 2)
452 pascal CreateWindowEx(long ptr ptr long s_word s_word s_word s_word
word word word ptr)
CreateWindowEx(1 2 3 4 5 6 7 8 9 10 11 12)
......
......@@ -5,13 +5,20 @@
*/
#if defined (mc68000) || defined (sparc)
#define CONV_LONG(a) (((a)&0xFF) << 24) | (((a) & 0xFF00) << 8) | (((a) & 0xFF0000) >> 8) | ((a)&0xFF000000 >> 24)
#define CONV_SHORT(a) (((a) & 0xFF) << 8) | (((a) & 0xFF00) >> 8)
#define CONV_CHAR_TO_LONG(x) ((x) >> 24)
#define CONV_SHORT_TO_LONG(x) ((x) >> 16)
#define CONV_LONG(a) (((a)&0xFF) << 24) | (((a) & 0xFF00) << 8) | (((unsigned long)(a) & 0xFF0000) >> 8) | ((unsigned long)((a)&0xFF000000) >> 24)
#define CONV_SHORT(a) (((a) & 0xFF) << 8) | (((unsigned long)(a) & 0xFF00) >> 8)
#define CONV_CHAR_TO_LONG(x) ((unsigned long)(x) >> 24)
#define CONV_SHORT_TO_LONG(x) ((unsigned long)(x) >> 16)
#define CONV_BITMAPINFO ARCH_ConvBitmapInfo
#define CONV_BITMAPCOREHEADER ARCH_ConvCoreHeader
#else
#define CONV_LONG(a) (a)
#define CONV_SHORT(a) (a)
#define CONV_CHAR_TO_LONG(a) (a)
#define CONV_SHORT_TO_LONG(a) (a)
#define CONV_BITMAPINFO
#define CONV_BITMAPCOREHEADER
#endif
......@@ -9,7 +9,6 @@
#include "windows.h"
typedef struct
{
HANDLE next;
......@@ -27,7 +26,10 @@ typedef struct
#ifdef WINELIB
#define LocalAlign(flags,bytes) LocalAlloc (flags|LMEM_WINE_ALIGN,bytes)
#else
#define LocalAlign(flags,bytes) LocalAlloc (flags,bytes)
#define LocalAlign(flags,bytes) WIN16_LocalAlloc((flags),(bytes))
#define LocalAlloc WIN16_LocalAlloc
#define LocalLock WIN16_LocalLock
#define LocalFree WIN16_LocalFree
#endif
#endif /* ATOM_H */
/*
* GDI bitmap definitions
*
* Copyright 1993 Alexandre Julliard
*/
#ifndef BITMAP_H
#define BITMAP_H
#include <X11/Xlib.h>
#include "windows.h"
/* Handle of the bitmap selected by default in a memory DC */
extern HBITMAP BITMAP_hbitmapMemDC;
/* GCs used for B&W and color bitmap operations */
extern GC BITMAP_monoGC, BITMAP_colorGC;
#define BITMAP_GC(bmp) \
(((bmp)->bitmap.bmBitsPixel == 1) ? BITMAP_monoGC : BITMAP_colorGC)
#endif /* BITMAP_H */
/*
* Desktop window definitions.
*
* Copyright 1994 Alexandre Julliard
*/
#ifndef DESKTOP_H
#define DESKTOP_H
#include "windows.h"
typedef struct
{
HBRUSH hbrushPattern;
HBITMAP hbitmapWallPaper;
} DESKTOPINFO;
extern BOOL DESKTOP_SetPattern(char *pattern );
#endif /* DESKTOP_H */
......@@ -63,5 +63,6 @@ extern struct dll_table_entry_s SHELL_table[];
extern struct dll_table_entry_s SOUND_table[];
extern struct dll_table_entry_s KEYBOARD_table[];
extern struct dll_table_entry_s WINSOCK_table[];
extern struct dll_table_entry_s STRESS_table[];
#endif /* DLLS_H */
......@@ -69,10 +69,9 @@ typedef struct tagFONTOBJ
typedef struct tagBITMAPOBJ
{
GDIOBJHDR header;
HANDLE hBitmap;
BOOL bSelected;
HDC hdc;
SIZE size;
BITMAP bitmap;
Pixmap pixmap;
SIZE size; /* For SetBitmapDimension() */
} BITMAPOBJ;
typedef struct tagRGNOBJ
......@@ -152,7 +151,6 @@ typedef struct
short breakExtra; /* breakTotalExtra / breakCount */
short breakRem; /* breakTotalExtra % breakCount */
BYTE planes;
BYTE bitsPerPixel;
WORD MapMode;
......@@ -179,6 +177,8 @@ typedef struct
int style;
int pixel;
int width;
char * dashes;
int dash_len;
} X_PHYSPEN;
/* X physical brush */
......@@ -197,6 +197,13 @@ typedef struct
TEXTMETRIC metrics;
} X_PHYSFONT;
/* X physical palette information */
typedef struct
{
HANDLE hMapping;
WORD mappingSize;
} X_PHYSPALETTE;
/* X-specific DC information */
typedef struct
{
......@@ -205,6 +212,7 @@ typedef struct
X_PHYSFONT font;
X_PHYSPEN pen;
X_PHYSBRUSH brush;
X_PHYSPALETTE pal;
} X_DC_INFO;
......@@ -282,7 +290,7 @@ typedef struct tagDC
extern MDESC *GDI_Heap;
#define GDI_HEAP_ALLOC(f,size) ((int)HEAP_Alloc(&GDI_Heap,f,size) & 0xffff)
#define GDI_HEAP_ADDR(handle) ((void *)(handle | ((int)GDI_Heap & 0xffff0000)))
#define GDI_HEAP_ADDR(handle) ((void *)((handle)|((int)GDI_Heap & 0xffff0000)))
#define GDI_HEAP_FREE(handle) (HEAP_Free(&GDI_Heap,GDI_HEAP_ADDR(handle)))
#endif
......@@ -296,5 +304,7 @@ extern Screen * XT_screen; /* Will be removed */
extern Display * display;
extern Screen * screen;
extern Window rootWindow;
extern int screenWidth, screenHeight, screenDepth;
#endif /* GDI_H */
......@@ -6,6 +6,10 @@
#ifndef HEAP_H
#define HEAP_H
#include "segmem.h"
#include "regfunc.h"
#include "atom.h"
/**********************************************************************
* LOCAL HEAP STRUCTURES AND FUNCTIONS
*/
......@@ -17,11 +21,24 @@ typedef struct heap_mem_desc_s
unsigned char flags;
} MDESC;
typedef struct heap_local_heap_s
{
struct heap_local_heap_s *next;
MDESC *free_list;
ATOMTABLE *local_table;
unsigned short selector;
} LHEAP;
extern void HEAP_Init(MDESC **free_list, void *start, int length);
extern void *HEAP_Alloc(MDESC **free_list, int flags, int bytes);
extern int HEAP_Free(MDESC **free_list, void *block);
extern void *HEAP_ReAlloc(MDESC **free_list, void *old_block,
int new_size, unsigned int flags);
extern LHEAP *HEAP_LocalFindHeap(unsigned short owner);
#define HEAP_OWNER (Segments[Stack16Frame[11] >> 3].owner)
#define LOCALHEAP() (&HEAP_LocalFindHeap(HEAP_OWNER)->free_list)
#define LOCALATOMTABLE() (&HEAP_LocalFindHeap(HEAP_OWNER)->local_table)
/**********************************************************************
* GLOBAL HEAP STRUCTURES AND FUNCTIONS:
......
/* MDI.H
*
* Copyright 1994, Bob Amstadt
*
* MDI structure definitions.
*/
#ifndef MDI_H
#define MDI_H
#include "windows.h"
#define MDI_MAXLISTLENGTH 64
typedef struct mdi_child_info_s
{
struct mdi_child_info_s *next, *prev;
HWND hwnd;
} MDICHILDINFO;
typedef struct
{
HMENU hWindowMenu;
MDICHILDINFO *infoActiveChildren;
WORD nActiveChildren;
WORD idFirstChild;
HWND hwndActiveChild;
HWND hwndHitTest;
BOOL flagMenuAltered;
BOOL flagChildMaximized;
} MDICLIENTINFO;
#endif /* MDI_H */
......@@ -28,15 +28,17 @@ typedef struct tagMENUITEM
typedef struct tagPOPUPMENU
{
HWND hWnd; /* PopupMenu window handle */
HWND hWndParent; /* Parent opupMenu window handle */
HWND ownerWnd; /* Owner window */
WORD nItems; /* Number of items on menu */
HWND hWnd; /* PopupMenu window handle */
HWND hWndParent; /* Parent PopupMenu window handle */
HWND ownerWnd; /* Owner window */
HWND hWndPrev; /* Previous Window Focus Owner */
WORD nItems; /* Number of items on menu */
MENUITEM *firstItem;
WORD FocusedItem;
WORD MouseFlags;
WORD BarFlags;
BOOL SysFlag;
BOOL BarFlag; /* TRUE if menu is a MENUBAR */
BOOL SysFlag; /* TRUE if menu is a SYSMENU */
BOOL ChildFlag; /* TRUE if child of other menu */
WORD Width;
WORD Height;
WORD CheckWidth;
......@@ -64,7 +66,7 @@ typedef struct
} MENUITEMTEMPLATE;
void StdDrawMenuBar(HDC hDC, LPRECT lprect, LPPOPUPMENU lppop);
void MenuButtonDown(HWND hWnd, LPPOPUPMENU lppop, int x, int y);
BOOL MenuButtonDown(HWND hWnd, LPPOPUPMENU lppop, int x, int y);
void MenuButtonUp(HWND hWnd, LPPOPUPMENU lppop, int x, int y);
void MenuMouseMove(HWND hWnd, LPPOPUPMENU lppop, WORD wParam, int x, int y);
extern void NC_TrackSysMenu(HWND hwnd);
......
......@@ -48,9 +48,10 @@ extern void MSG_IncPaintCount( HANDLE hQueue );
extern void MSG_DecPaintCount( HANDLE hQueue );
extern void MSG_IncTimerCount( HANDLE hQueue );
extern void MSG_DecTimerCount( HANDLE hQueue );
extern void MSG_Synchronize();
extern BOOL MSG_CreateSysMsgQueue( int size );
extern void hardware_event(HWND hwnd, WORD message, WORD wParam, LONG lParam,
WORD xPos, WORD yPos, DWORD time, DWORD extraInfo);
extern void hardware_event( WORD message, WORD wParam, LONG lParam,
int xPos, int yPos, DWORD time, DWORD extraInfo );
extern BOOL MSG_GetHardwareMessage( LPMSG msg );
#endif /* MESSAGE_H */
#ifndef INT21_H
#define INT21_H
#ifndef __MSDOS_H
#define __MSDOS_H
#include <dirent.h>
#include <windows.h>
struct dosdirent {
int inuse;
......@@ -11,20 +12,9 @@ struct dosdirent {
char attribute;
long filesize;
long filetime;
long filedate;
};
struct diskinfo {
unsigned int infolevel;
unsigned long serialnumber;
char label[11];
char fstype[8];
};
#define DosVersion 0x0303;
#define SectorSize 0x200;
#define SectorsPerCluster 0x04;
#define DOSVERSION 0x0330;
#define EAX context->sc_eax
#define EBX context->sc_ebx
......@@ -45,13 +35,39 @@ struct diskinfo {
#define EFL context->sc_efl
#define pointer(a,b) (((unsigned int) a << 16) | b)
#define segment(a) (a >> 16)
#define offset(a) (a & 0xffff)
#define SetCflag (EFL |= 0x00000001L)
#define ResetCflag (EFL &= 0xfffffffeL)
#define pointer(a,b) (BYTE*)(((WORD) a << 16) | b)
#define segment(a) ((DWORD)a >> 16)
#define offset(a) ((DWORD)a & 0xffff)
#define setword(a,b) *(BYTE*)a = b & 0xff; \
*((BYTE*)a + 1) = (b>>8) & 0xff;
#define setdword(a,b) *(BYTE*)a = b & 0xff; \
*((BYTE*)a + 1) = (b>>8) & 0xff; \
*((BYTE*)a + 2) = (b>>16) & 0xff; \
*((BYTE*)a + 3) = (b>>24) & 0xff;
#define getword(a) (WORD) *(BYTE*)a + \
(*((BYTE*)a + 1) << 8)
#define getdword(a) (DWORD) (*(BYTE*)a + \
(*((BYTE*)a + 1) << 8) + \
(*((BYTE*)a + 2) << 16) + \
(*((BYTE*)a + 3) << 24))
/* dos file attributes */
#define FA_NORMAL 0x00 /* Normal file, no attributes */
#define FA_RDONLY 0x01 /* Read only attribute */
#define FA_HIDDEN 0x02 /* Hidden file */
#define FA_SYSTEM 0x04 /* System file */
#define FA_LABEL 0x08 /* Volume label */
#define FA_DIREC 0x10 /* Directory */
#define FA_ARCH 0x20 /* Archive */
/* extended error codes */
#define NoError 0x00
......@@ -113,4 +129,4 @@ struct diskinfo {
#define EL_Network 0x03
#define EL_Memory 0x05
#endif /* INT21_H */
#endif /* __MSDOS_H */
......@@ -220,4 +220,7 @@ struct resource_typeinfo_s
#define NE_RSCTYPE_RCDATA 0x800a
#define NE_RSCTYPE_STRING 0x8006
int load_typeinfo (int, struct resource_typeinfo_s *);
int load_nameinfo (int, struct resource_nameinfo_s *);
#endif /* NEEXE_H */
......@@ -10,6 +10,8 @@
struct options
{
char * spyFilename;
char * desktopGeometry; /* NULL when no desktop */
char * programName; /* To use when loading resources */
int usePrivateMap;
int synchronous;
short cmdShow;
......
......@@ -3,54 +3,259 @@
/*
* Copyright Robert J. Amstadt, 1993
*/
#ifndef PROTOTYPES_H
#define PROTOTYPES_H
#ifndef _WINE_PROTOTYPES_H
#define _WINE_PROTOTYPES_H
#include <sys/types.h>
#include "neexe.h"
#include "segmem.h"
#include "wine.h"
#include "int21.h"
#include "heap.h"
#include "msdos.h"
#include "windows.h"
#ifndef WINELIB
extern struct segment_descriptor_s *
CreateSelectors(struct w_files *);
/* loader/dump.c */
extern void PrintFileHeader(struct ne_header_s *ne_header);
extern void PrintSegmentTable(struct ne_segment_table_entry_s *seg_table,
int nentries);
int nentries);
extern void PrintRelocationTable(char *exe_ptr,
struct ne_segment_table_entry_s *seg_entry_p,
int segment);
struct ne_segment_table_entry_s *seg_entry_p,
int segment);
/* loader/ldtlib.c */
struct segment_descriptor *
make_sd(unsigned base, unsigned limit, int contents, int read_exec_only, int seg32, int inpgs);
int get_ldt(void *buffer);
int 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);
/* loader/resource.c */
extern int OpenResourceFile(HANDLE instance);
extern HBITMAP ConvertCoreBitmap( HDC hdc, BITMAPCOREHEADER * image );
extern HBITMAP ConvertInfoBitmap( HDC hdc, BITMAPINFO * image );
extern int FindResourceByNumber(struct resource_nameinfo_s *result_p,
int type_id, int resource_id);
extern int FindResourceByName(struct resource_nameinfo_s *result_p,
int type_id, char *resource_name);
extern HICON LoadIcon(HANDLE instance, LPSTR icon_name);
extern HANDLE RSC_LoadResource(int instance, char *rsc_name, int type,
int *image_size_ret);
extern int LoadString(HANDLE instance, WORD resource_id, LPSTR buffer, int buflen);
extern HANDLE RSC_LoadMenu(HANDLE instance, LPSTR menu_name);
extern HBITMAP LoadBitmap(HANDLE instance, LPSTR bmp_name);
/* loader/selector.c */
extern int FindUnusedSelectors(int n_selectors);
extern int IPCCopySelector(int i_old, unsigned long new, int swap_type);
extern WORD AllocSelector(WORD old_selector);
extern unsigned int PrestoChangoSelector(unsigned src_selector, unsigned dst_selector);
extern WORD AllocDStoCSAlias(WORD ds_selector);
extern WORD FreeSelector(WORD sel);
extern SEGDESC *CreateNewSegments(int code_flag, int read_only, int length,
int n_segments);
extern SEGDESC *GetNextSegment(unsigned int flags, unsigned int limit);
extern unsigned int GetEntryDLLName(char *dll_name, char *function, int *sel,
int *addr);
extern unsigned int GetEntryDLLOrdinal(char *dll_name, int ordinal, int *sel,
int *addr);
extern unsigned int GetEntryPointFromOrdinal(struct w_files * wpnt,
int ordinal);
extern SEGDESC *CreateSelectors(struct w_files * wpnt);
/* loader/signal.c */
extern int init_wine_signals(void);
/* loader/wine.c */
extern void myerror(const char *s);
extern void load_mz_header (int, struct mz_header_s *);
extern void load_ne_header (int, struct ne_header_s *);
extern char *GetFilenameFromInstance(unsigned short instance);
extern struct w_files *GetFileInfo(unsigned short instance);
extern HINSTANCE LoadImage(char *modulename, int filetype);
extern int _WinMain(int argc, char **argv);
extern void InitializeLoadedDLLs();
extern int FixupSegment(struct w_files * wpnt, int segment_num);
extern struct dll_table_entry_s *FindDLLTable(char *dll_name);
extern unsigned int GetEntryPointFromOrdinal(struct w_files * wpnt,
int ordinal);
extern struct segment_descriptor_s *GetNextSegment(unsigned int flags,
unsigned int limit);
extern struct segment_descriptor_s *CreateNewSegments(int code_flag,
int read_only,
int length,
int n_segments);
/*
extern struct mz_header_s *CurrentMZHeader;
extern struct ne_header_s *CurrentNEHeader;
extern int CurrentNEFile;
extern do_int1A(struct sigcontext_struct * context);
extern do_int21(struct sigcontext_struct * context);
*/
extern void GetUnixDirName(char *rootdir, char *name);
extern char *GetDirectUnixFileName(char *dosfilename);
extern char *GetUnixFileName(char *dosfilename);
/* if1632/relay.c */
extern int CallBack16(void *func, int n_args, ...);
extern void *CALLBACK_MakeProcInstance(void *func, int instance);
extern void CallLineDDAProc(FARPROC func, short xPos, short yPos, long lParam);
extern void winestat(void);
/* if1632/callback.c */
extern int DLLRelay(unsigned int func_num, unsigned int seg_off);
extern struct dll_table_entry_s *FindDLLTable(char *dll_name);
extern int FindOrdinalFromName(struct dll_table_entry_s *dll_table, char *func_name);
extern int ReturnArg(int arg);
/* miscemu/int1a.c */
extern do_int1A(struct sigcontext_struct *context);
/* miscemu/int21.c */
extern do_int21(struct sigcontext_struct *context);
/* miscemu/kernel.c */
extern int KERNEL_LockSegment(int segment);
extern int KERNEL_UnlockSegment(int segment);
extern KERNEL_InitTask();
extern int KERNEL_WaitEvent(int task);
/* misc/comm.c */
void Comm_Init(void);
void Comm_DeInit(void);
/* misc/dos_fs.c */
extern void DOS_InitFS(void);
extern WORD DOS_GetEquipment(void);
extern int DOS_ValidDrive(int drive);
extern int DOS_GetDefaultDrive(void);
extern void DOS_SetDefaultDrive(int drive);
extern void ToUnix(char *s);
extern void ToDos(char *s);
extern void ChopOffSlash(char *string);
extern int DOS_DisableDrive(int drive);
extern int DOS_EnableDrive(int drive);
extern char *GetUnixFileName(char *dosfilename);
extern char *DOS_GetCurrentDir(int drive);
extern int DOS_ChangeDir(int drive, char *dirname);
extern int DOS_MakeDir(int drive, char *dirname);
extern int DOS_GetSerialNumber(int drive, unsigned long *serialnumber);
extern int DOS_SetSerialNumber(int drive, unsigned long serialnumber);
extern char *DOS_GetVolumeLabel(int drive);
extern int DOS_SetVolumeLabel(int drive, char *label);
extern int DOS_GetFreeSpace(int drive, long *size, long *available);
extern char *FindFile(char *buffer, int buflen, char *rootname, char **extensions, char *path);
extern char *WineIniFileName(void);
extern char *WinIniFileName(void);
extern struct dosdirent *DOS_opendir(char *dosdirname);
extern char *WinIniFileName(void);
extern struct dosdirent *DOS_opendir(char *dosdirname);
extern struct dosdirent *DOS_readdir(struct dosdirent *de);
extern void DOS_closedir(struct dosdirent *de);
#endif /* WINELIB */
/* misc/profile.c */
extern void sync_profiles(void);
/* misc/spy.c */
extern void SpyInit(void);
/* controls/button.c */
extern LONG ButtonWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam);
/* controls/combo.c */
extern LONG ComboBoxWndProc(HWND hwnd, WORD message, WORD wParam, LONG lParam);
/* controls/desktop.c */
#endif /* PROTOTYPES_H */
extern LONG DesktopWndProc (HWND hwnd, WORD message, WORD wParam, LONG lParam);
extern BOOL DESKTOP_SetPattern(char *pattern);
/* controls/listbox.c */
extern LONG ListBoxWndProc(HWND hwnd, WORD message, WORD wParam, LONG lParam);
/* controls/menu.c */
extern LONG PopupMenuWndProc(HWND hwnd, WORD message, WORD wParam, LONG lParam);
/* controls/scrollbar.c */
extern LONG ScrollBarWndProc(HWND hWnd, WORD message, WORD wParam, LONG lParam);
/* controls/static.c */
extern LONG StaticWndProc(HWND hwnd, WORD message, WORD wParam, LONG lParam);
/* controls/widget.c */
extern BOOL WIDGETS_Init(void);
/* memory/heap.c */
extern void HEAP_Init(MDESC **free_list, void *start, int length);
extern void *HEAP_Alloc(MDESC **free_list, int flags, int bytes);
extern void *HEAP_ReAlloc(MDESC **free_list, void *old_block, int new_size, unsigned int flags);
extern int HEAP_Free(MDESC **free_list, void *block);
extern LHEAP *HEAP_LocalFindHeap(unsigned short owner);
extern void HEAP_LocalInit(unsigned short owner, void *start, int length);
extern void *WIN16_LocalAlloc(int flags, int bytes);
extern int WIN16_LocalCompact(int min_free);
extern unsigned int WIN16_LocalFlags(unsigned int handle);
extern unsigned int WIN16_LocalFree(unsigned int handle);
extern unsigned int WIN16_LocalInit(unsigned int segment, unsigned int start, unsigned int end);
extern void *WIN16_LocalLock(unsigned int handle);
extern void *WIN16_LocalReAlloc(unsigned int handle, int flags, int bytes);
extern unsigned int WIN16_LocalSize(unsigned int handle);
extern unsigned int WIN16_LocalUnlock(unsigned int handle);
/* objects/bitmaps.c */
extern BOOL BITMAP_Init(void);
/* objects/color.c */
extern BOOL COLOR_Init(void);
/* objects/dib.c */
extern int DIB_BitmapInfoSize(BITMAPINFO *info, WORD coloruse);
/* objects/gdiobj.c */
extern BOOL GDI_Init(void);
/* objects/palette.c */
extern BOOL PALETTE_Init(void);
/* objects/region.c */
extern BOOL REGION_Init(void);
/* windows/graphic.c */
extern void DrawReliefRect(HDC hdc, RECT rect, int thickness, BOOL pressed);
/* windows/dce.c */
extern void DCE_Init(void);
/* windows/dialog.c */
extern BOOL DIALOG_Init(void);
/* windows/syscolor.c */
extern void SYSCOLOR_Init(void);
/* windows/sysmetrics.c */
extern void SYSMETRICS_Init(void);
#endif /* WINELIB */
#endif /* _WINE_PROTOTYPES_H */
......@@ -6,6 +6,7 @@
extern unsigned short *Stack16Frame;
#define _CONTEXT &Stack16Frame[12]
#define _AX Stack16Frame[34]
#define _BX Stack16Frame[28]
#define _CX Stack16Frame[32]
......
#ifndef __STRESS_H
#define __STRESS_H
#include <windows.h>
#ifdef __cplusplus
extern "C" {
#endif
#define EDS_WIN 1
#define EDS_CUR 2
#define EDS_TEMP 3
BOOL AllocGDIMem(UINT);
BOOL AllocMem(DWORD);
BOOL AllocUserMem(UINT);
int AllocDiskSpace(long, UINT);
int AllocFileHandles(int);
int GetFreeFileHandles(void);
void FreeAllGDIMem(void);
void FreeAllMem(void);
void FreeAllUserMem(void);
void UnAllocDiskSpace(UINT);
void UnAllocFileHandles(void);
#ifdef __cplusplus
}
#endif
#endif /* __STRESS_H */
......@@ -25,7 +25,7 @@ extern MDESC *USER_Heap;
#define USER_HEAP_ALLOC(f,size) ((int)HEAP_Alloc(&USER_Heap,f,size) & 0xffff)
#define USER_HEAP_REALLOC(handle,size,f) ((int)HEAP_ReAlloc(&USER_Heap, \
USER_HEAP_ADDR(handle),size,f) & 0xffff)
#define USER_HEAP_ADDR(handle) ((void *)(handle|((int)USER_Heap & 0xffff0000)))
#define USER_HEAP_ADDR(handle) ((void *)((handle)|((int)USER_Heap&0xffff0000)))
#define USER_HEAP_FREE(handle) (HEAP_Free(&USER_Heap,USER_HEAP_ADDR(handle)))
#endif /* WINELIB */
......
......@@ -67,8 +67,11 @@ WND *WIN_FindWndPtr( HWND hwnd );
BOOL WIN_UnlinkWindow( HWND hwnd );
BOOL WIN_LinkWindow( HWND hwnd, HWND hwndInsertAfter );
HWND WIN_FindWinToRepaint( HWND hwnd );
BOOL WINPOS_IsAnActiveWindow( HWND hwnd );
void WINPOS_ActivateChild( HWND hwnd );
extern Display * display;
extern Screen * screen;
extern Window rootWindow;
#endif /* WIN_H */
......@@ -5,6 +5,7 @@
#ifndef _WINARGS
typedef short INT;
typedef unsigned short UINT;
typedef unsigned short WORD;
typedef unsigned long DWORD;
......@@ -218,6 +219,25 @@ typedef struct {
DWORD dwExStyle WINE_PACKED;
} CREATESTRUCT, *LPCREATESTRUCT;
typedef struct
{
HMENU hWindowMenu;
WORD idFirstChild;
} CLIENTCREATESTRUCT, *LPCLIENTCREATESTRUCT;
typedef struct
{
LPSTR szClass;
LPSTR szTitle;
HANDLE hOwner;
short x;
short y;
short cx;
short cy;
LONG style WINE_PACKED;
LONG lParam WINE_PACKED;
} MDICREATESTRUCT, *LPMDICREATESTRUCT;
/* Offsets for GetWindowLong() and GetWindowWord() */
#define GWL_EXSTYLE (-20)
#define GWL_STYLE (-16)
......@@ -466,7 +486,9 @@ typedef WORD ATOM;
typedef DWORD COLORREF;
#define RGB(r,g,b) ((COLORREF)((r) | ((g) << 8) | ((b) << 16)))
#define RGB(r,g,b) ((COLORREF)((r) | ((g) << 8) | ((b) << 16)))
#define PALETTERGB(r,g,b) (0x02000000 | RGB(r,g,b))
#define PALETTEINDEX(i) ((COLORREF)(0x01000000 | (WORD)(i)))
#define GetRValue(rgb) ((rgb) & 0xff)
#define GetGValue(rgb) (((rgb) >> 8) & 0xff)
......@@ -987,6 +1009,8 @@ typedef OFSTRUCT *LPOFSTRUCT;
#define OF_SHARE_EXCLUSIVE 0x0010
#define OF_VERIFY 0x0400
#define DRIVE_CANNOTDETERMINE 0
#define DRIVE_DOESNOTEXIST 1
#define DRIVE_REMOVABLE 2
#define DRIVE_FIXED 3
#define DRIVE_REMOTE 4
......@@ -1378,6 +1402,18 @@ enum { WM_NULL, WM_CREATE, WM_DESTROY, WM_MOVE, WM_UNUSED0, WM_SIZE, WM_ACTIVATE
#define WM_PARENTNOTIFY 0x0210
#define WM_MDICREATE 0x0220
#define WM_MDIDESTROY 0x0221
#define WM_MDIACTIVATE 0x0222
#define WM_MDIRESTORE 0x0223
#define WM_MDINEXT 0x0224
#define WM_MDIMAXIMIZE 0x0225
#define WM_MDITILE 0x0226
#define WM_MDICASCADE 0x0227
#define WM_MDIICONARRANGE 0x0228
#define WM_MDIGETACTIVE 0x0229
#define WM_MDISETMENU 0x0230
#define WM_ENTERSIZEMOVE 0x0231
#define WM_EXITSIZEMOVE 0x0232
......@@ -2117,6 +2153,7 @@ int wsprintf(LPSTR a,LPSTR b,...);
F(HMENU,CreateMenu)
F(BOOL,GetInputState)
F(BOOL,SetDeskPattern)
F(LPSTR,GetDOSEnvironment)
F(DWORD,GetMessagePos)
F(LONG,GetMessageTime)
......@@ -2199,9 +2236,11 @@ Fa(BOOL,DestroyWindow,HWND,a)
Fa(BOOL,EnableHardwareInput,BOOL,a)
Fa(BOOL,FreeModule,HANDLE,a)
Fa(BOOL,FreeResource,HANDLE,a)
#ifndef GLOBAL_SOURCE
Fa(BOOL,GlobalUnWire,HANDLE,a)
Fa(BOOL,GlobalUnfix,HANDLE,a)
Fa(BOOL,GlobalUnlock,HANDLE,a)
#endif
Fa(BOOL,InitAtomTable,WORD,a)
Fa(BOOL,IsClipboardFormatAvailable,WORD,a)
Fa(BOOL,IsIconic,HWND,a)
......@@ -2215,6 +2254,7 @@ Fa(BOOL,LocalUnlock,HANDLE,a)
Fa(BOOL,OpenClipboard,HWND,a)
Fa(BOOL,OpenIcon,HWND,a)
Fa(BOOL,RemoveFontResource,LPSTR,a)
Fa(BOOL,SetDeskWallPaper,LPSTR,a)
Fa(BOOL,SetErrorMode,WORD,a)
Fa(BOOL,SwapMouseButton,BOOL,a)
Fa(BOOL,UnrealizeObject,HBRUSH,a)
......@@ -2232,9 +2272,11 @@ Fa(DWORD,GetViewportExt,HDC,a)
Fa(DWORD,GetViewportOrg,HDC,a)
Fa(DWORD,GetWindowExt,HDC,a)
Fa(DWORD,GetWindowOrg,HDC,a)
#ifndef GLOBAL_SOURCE
Fa(DWORD,GlobalCompact,DWORD,a)
Fa(DWORD,GlobalHandle,WORD,a)
Fa(DWORD,GlobalSize,HANDLE,a)
#endif
Fa(DWORD,OemKeyScan,WORD,a)
Fa(FARPROC,LocalNotify,FARPROC,a)
Fa(HANDLE,BeginDeferWindowPos,int,nNumWindows)
......@@ -2248,9 +2290,11 @@ Fa(HANDLE,GetMetaFileBits,HANDLE,a)
Fa(HANDLE,GetModuleHandle,LPSTR,a)
Fa(HANDLE,GetStockObject,int,a)
Fa(HANDLE,GetWindowTask,HWND,a)
#ifndef GLOBAL_SOURCE
Fa(HANDLE,GlobalFree,HANDLE,a)
Fa(HANDLE,GlobalLRUNewest,HANDLE,a)
Fa(HANDLE,GlobalLRUOldest,HANDLE,a)
#endif
Fa(HANDLE,LoadLibrary,LPSTR,a)
Fa(HANDLE,LocalFree,HANDLE,a)
Fa(HANDLE,LocalHandle,WORD,a)
......@@ -2289,13 +2333,19 @@ Fa(LONG,SetSwapAreaSize,WORD,a)
Fa(LPSTR,AnsiLower,LPSTR,a)
Fa(LPSTR,AnsiNext,LPSTR,a)
Fa(LPSTR,AnsiUpper,LPSTR,a)
#ifndef GLOBAL_SOURCE
Fa(LPSTR,GlobalLock,HANDLE,a)
Fa(LPSTR,GlobalWire,HANDLE,a)
#endif
Fa(LPSTR,LockResource,HANDLE,a)
#ifndef GLOBAL_SOURCE
Fa(void,GlobalFix,HANDLE,a)
Fa(void,GlobalNotify,FARPROC,a)
#endif
Fa(void,LimitEmsPages,DWORD,a)
Fa(void,SetConvertHook,BOOL,a)
Fa(UINT,GDIRealizePalette,HDC,a)
Fa(UINT,RealizePalette,HDC,a)
Fa(WORD,AllocDStoCSAlias,WORD,a)
Fa(WORD,AllocSelector,WORD,a)
Fa(WORD,ArrangeIconicWindows,HWND,a)
......@@ -2305,13 +2355,15 @@ Fa(WORD,GetDriveType,int,a)
Fa(WORD,GetMenuItemCount,HMENU,a)
Fa(WORD,GetTaskQueue,HANDLE,a)
Fa(WORD,GetTextAlign,HDC,a)
#ifndef GLOBAL_SOURCE
Fa(WORD,GlobalFlags,HANDLE,a)
Fa(WORD,GlobalPageLock,HANDLE,a)
Fa(WORD,GlobalPageUnlock,HANDLE,a)
#endif
Fa(WORD,LocalCompact,WORD,a)
Fa(WORD,LocalFlags,HANDLE,a)
Fa(WORD,LocalSize,HANDLE,a)
Fa(int,RealizePalette,HDC,a)
Fa(WORD,RealizeDefaultPalette,HDC,a)
Fa(WORD,RegisterClipboardFormat,LPCSTR,a)
Fa(WORD,RegisterWindowMessage,LPCSTR,a)
Fa(WORD,SetHandleCount,WORD,a)
......@@ -2412,7 +2464,9 @@ Fb(FARPROC,MakeProcInstance,FARPROC,a,HANDLE,b)
Fb(FARPROC,SetWindowsHook,int,a,FARPROC,b)
Fb(HANDLE,CopyMetaFile,HANDLE,a,LPSTR,b)
Fb(HANDLE,GetProp,HWND,a,LPSTR,b)
#ifndef GLOBAL_SOURCE
Fb(HANDLE,GlobalAlloc,WORD,a,DWORD,b)
#endif
Fb(HANDLE,LoadAccelerators,HANDLE,a,LPSTR,b)
Fb(HANDLE,LoadModule,LPSTR,a,LPVOID,b)
Fb(HANDLE,LoadResource,HANDLE,a,HANDLE,b)
......@@ -2425,6 +2479,7 @@ Fb(HBRUSH,CreateDIBPatternBrush,HANDLE,a,WORD,b)
Fb(HBRUSH,CreateHatchBrush,short,a,COLORREF,b)
Fb(HCURSOR,LoadCursor,HANDLE,a,LPSTR,b)
Fb(HICON,LoadIcon,HANDLE,a,LPSTR,b)
Fb(HPALETTE,GDISelectPalette,HDC,a,HPALETTE,b)
Fb(HMENU,GetSubMenu,HMENU,a,short,b)
Fb(HMENU,GetSystemMenu,HWND,a,BOOL,b)
Fb(HMENU,LoadMenu,HANDLE,a,LPSTR,b)
......@@ -2553,7 +2608,9 @@ Fc(DWORD,SetWindowOrg,HDC,a,short,b,short,c)
Fc(FARPROC,SetResourceHandler,HANDLE,a,LPSTR,b,FARPROC,c)
Fc(HANDLE,AllocResource,HANDLE,a,HANDLE,b,DWORD,c)
Fc(HANDLE,FindResource,HANDLE,a,LPSTR,b,LPSTR,c)
#ifndef GLOBAL_SOURCE
Fc(HANDLE,GlobalReAlloc,HANDLE,a,DWORD,b,WORD,c)
#endif
Fc(HANDLE,LocalReAlloc,HANDLE,a,WORD,b,WORD,c)
Fc(HBITMAP,CreateCompatibleBitmap,HDC,a,short,b,short,c)
Fc(HBITMAP,CreateDiscardableBitmap,HDC,a,short,b,short,c)
......@@ -2737,7 +2794,7 @@ Fi(BOOL,Pie,HDC,a,int,xLeft,int,yTop,int,xRight,int,yBottom,int,xStart,int,yStar
Fk(HWND,CreateWindow,LPSTR,szAppName,LPSTR,Label,DWORD,ol,short,x,short,y,short,w,short,h,HWND,d,HMENU,e,,HANDLE i,LPSTR,g)
Fk(BOOL,StretchBlt,HDC,a,short,b,short,c,short,d,short,e,HDC,f,short,g,short,h,short,i,short,j,DWORD,k)
Fl(HWND,CreateWindowEx,DWORD,a,LPSTR,b,LPSTR,c,DWORD,d,short,e,short,f,short,g,short,h,HWND,i,HMENU,j,HANDLE,k,LPSTR,l)
Fl(int,SetDIBitsToDevice,HDC,a,WORD,b,WORD,c,WORD,d,WORD,e,WORD,f,WORD,g,WORD,h,WORD,i,LPSTR,j,LPBITMAPINFO,k,WORD,l)
Fl(int,SetDIBitsToDevice,HDC,a,short,b,short,c,WORD,d,WORD,e,WORD,f,WORD,g,WORD,h,WORD,i,LPSTR,j,LPBITMAPINFO,k,WORD,l)
Fm(int,StretchDIBits,HDC,a,WORD,b,WORD,c,WORD,d,WORD,e,WORD,f,WORD,g,WORD,h,WORD,i,LPSTR,j,LPBITMAPINFO,k,WORD,l,DWORD,m)
Fn(HFONT,CreateFont,int,a,int,b,int,c,int,d,int,e,BYTE,f,BYTE,g,BYTE,h,BYTE,i,BYTE,j,BYTE,k,BYTE,l,BYTE,m,LPSTR,n)
......
......@@ -3,28 +3,35 @@
#include "dlls.h"
struct w_files{
struct w_files * next;
char * name; /* Name, as it appears in the windows binaries */
char * filename; /* Actual name of the unix file that satisfies this */
int fd;
struct mz_header_s *mz_header;
struct ne_header_s *ne_header;
struct ne_segment_table_entry_s *seg_table;
struct segment_descriptor_s *selector_table;
char * lookup_table;
char * nrname_table;
char * rname_table;
unsigned short hinstance;
#define MAX_NAME_LENGTH 64
typedef struct resource_name_table
{
struct resource_name_table *next;
unsigned short type_ord;
unsigned short id_ord;
char id[MAX_NAME_LENGTH];
} RESNAMTAB;
struct w_files
{
struct w_files * next;
char * name; /* Name, as it appears in the windows binaries */
char * filename; /* Actual name of the unix file that satisfies this */
int fd;
struct mz_header_s *mz_header;
struct ne_header_s *ne_header;
struct ne_segment_table_entry_s *seg_table;
struct segment_descriptor_s *selector_table;
char * lookup_table;
char * nrname_table;
char * rname_table;
unsigned short hinstance;
RESNAMTAB *resnamtab;
};
extern struct w_files * wine_files;
extern char *GetFilenameFromInstance(unsigned short instance);
extern struct w_files *GetFileInfo(unsigned short instance);
extern char *WineIniFileName(void);
extern char *WinIniFileName(void);
#define MAX_DOS_DRIVES 26
#define WINE_INI WineIniFileName()
......@@ -63,9 +70,4 @@ struct sigcontext_struct {
#define HZ 100
#endif
void load_mz_header (int, struct mz_header_s *);
void load_ne_header (int, struct ne_header_s *);
int load_typeinfo (int, struct resource_typeinfo_s *);
int load_nameinfo (int, struct resource_nameinfo_s *);
#endif /* WINE_H */
......@@ -63,6 +63,7 @@ typedef WSADATA FAR *LPWSADATA;
#endif
#ifndef _SYS_SOCKET_H_
#ifndef _sys_socket_h
/*
* Structure used by kernel to pass protocol
* information in raw sockets.
......@@ -72,6 +73,7 @@ struct sockproto {
u_short sp_protocol; /* protocol */
};
#endif
#endif
/*
* Maximum queue length specifiable by listen.
......
......@@ -9,6 +9,7 @@ SRCS = \
selector.c \
signal.c \
library.c \
resource.c \
wine.c
OBJS = $(SRCS:.c=.o)
......
#ifndef WINELIB
static char RCSId[] = "$Id: dump.c,v 1.2 1993/07/04 04:04:21 root Exp root $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
......@@ -89,3 +90,4 @@ PrintRelocationTable(char *exe_ptr,
printf("TARGET %04.4x %04.4x\n", rep->target1, rep->target2);
}
}
#endif /* ifndef WINELIB */
#ifndef WINELIB
static char RCSId[] = "$Id: ldt.c,v 1.2 1993/07/04 04:04:21 root Exp root $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "prototypes.h"
#if defined(__NetBSD__) || defined(__FreeBSD__)
#include <machine/segments.h>
#endif
......@@ -84,3 +85,5 @@ print_ldt()
}
}
}
#endif /* ifndef WINELIB */
#ifndef WINELIB
static char RCSId[] = "$Id: ldtlib.c,v 1.2 1993/07/04 04:04:21 root Exp root $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
......@@ -90,3 +91,4 @@ set_ldt_entry(int entry, unsigned long base, unsigned int limit,
#endif
}
#endif /* ifndef WINELIB */
#ifndef WINELIB
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
......@@ -9,8 +11,18 @@
#include "wine.h"
#include "dlls.h"
typedef struct module_table_entry
{
HINSTANCE hInst;
LPSTR name;
WORD count;
} MODULEENTRY;
extern struct w_files * wine_files;
#define N_BUILTINS 10
extern struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS];
/**********************************************************************
* GetCurrentTask [KERNEL.36]
......@@ -28,19 +40,27 @@ HTASK GetCurrentTask()
*/
HANDLE GetModuleHandle(LPSTR lpModuleName)
{
register struct w_files *w = wine_files;
printf("GetModuleHandle('%s');\n", lpModuleName);
while (w) {
printf("GetModuleHandle // '%s' \n", w->name);
if (strcmp(w->name, lpModuleName) == 0) {
printf("GetModuleHandle('%s') return %04X \n",
lpModuleName, w->hinstance);
return w->hinstance;
}
w = w->next;
}
printf("GetModuleHandle('%s') not found !\n", lpModuleName);
return 0;
register struct w_files *w = wine_files;
int i;
printf("GetModuleHandle('%s');\n", lpModuleName);
while (w) {
/* printf("GetModuleHandle // '%s' \n", w->name); */
if (strcmp(w->name, lpModuleName) == 0) {
printf("GetModuleHandle('%s') return %04X \n",
lpModuleName, w->hinstance);
return w->hinstance;
}
w = w->next;
}
for (i = 0; i < N_BUILTINS; i++) {
if (strcmp(dll_builtin_table[i].dll_name, lpModuleName) == 0) {
printf("GetModuleHandle('%s') return %04X \n",
lpModuleName, 0xFF00 + i);
return (0xFF00 + i);
}
}
printf("GetModuleHandle('%s') not found !\n", lpModuleName);
return 0;
}
......@@ -79,11 +99,11 @@ int GetModuleFileName(HANDLE hModule, LPSTR lpFileName, short nSize)
*/
HANDLE LoadLibrary(LPSTR libname)
{
HANDLE hRet;
HANDLE hModule;
printf("LoadLibrary '%s'\n", libname);
hRet = LoadImage(libname, DLL);
printf("after LoadLibrary hRet=%04X\n", hRet);
return hRet;
hModule = LoadImage(libname, DLL);
printf("LoadLibrary returned hModule=%04X\n", hModule);
return hModule;
}
......@@ -97,3 +117,64 @@ void FreeLibrary(HANDLE hLib)
}
/**********************************************************************
* GetProcAddress [KERNEL.50]
*/
FARPROC GetProcAddress(HANDLE hModule, char *proc_name)
{
WORD wOrdin;
int sel, addr, ret;
register struct w_files *w = wine_files;
int ordinal, len;
char * cpnt;
char C[128];
if (hModule == 0) {
printf("GetProcAddress: Bad Module handle=%#04X\n", hModule);
return NULL;
}
if (hModule >= 0xF000) {
if ((int) proc_name & 0xffff0000) {
printf("GetProcAddress: builtin %#04x, '%s'\n", hModule, proc_name);
/* wOrdin = FindOrdinalFromName(struct dll_table_entry_s *dll_table, proc_name); */
}
else {
printf("GetProcAddress: builtin %#04x, %d\n", hModule, (int) proc_name);
}
return NULL;
}
while (w && w->hinstance != hModule) w = w->next;
printf("GetProcAddress // Module Found ! w->filename='%s'\n", w->filename);
if (w == NULL) return NULL;
if ((int) proc_name & 0xffff0000) {
AnsiUpper(proc_name);
printf("GetProcAddress: %#04x, '%s'\n", hModule, proc_name);
cpnt = w->nrname_table;
while(TRUE) {
if (((int) cpnt) - ((int)w->nrname_table) >
w->ne_header->nrname_tab_length) return NULL;
len = *cpnt++;
strncpy(C, cpnt, len);
C[len] = '\0';
printf("pointing Function '%s' !\n", C);
if (strncmp(cpnt, proc_name, len) == 0) break;
cpnt += len + 2;
};
ordinal = *((unsigned short *) (cpnt + len));
}
else {
printf("GetProcAddress: %#04x, %d\n", hModule, (int) proc_name);
ordinal = (int)proc_name;
}
ret = GetEntryPointFromOrdinal(w, ordinal);
if (ret == -1) {
printf("GetProcAddress // Function not found !\n");
return NULL;
}
addr = ret & 0xffff;
sel = (ret >> 16);
printf("GetProcAddress // ret=%08X sel=%04X addr=%04X\n", ret, sel, addr);
return ret;
}
#endif /* ifndef WINELIB */
#ifndef WINELIB
static char RCSId[] = "$Id: resource.c,v 1.4 1993/07/04 04:04:21 root Exp root $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "arch.h"
#include "prototypes.h"
#include "windows.h"
......@@ -17,6 +17,8 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "icon.h"
#include "accel.h"
/* #define DEBUG_RESOURCE */
#define MIN(a,b) ((a) < (b) ? (a) : (b))
typedef struct resource_s
......@@ -34,18 +36,105 @@ static struct w_files *ResourceFileInfo = NULL;
static RESOURCE *Top = NULL;
extern HINSTANCE hSysRes;
HANDLE RSC_LoadResource(int instance, char *rsc_name, int type, int *image_size_ret);
HANDLE RSC_LoadResource(int instance, char *rsc_name, int type,
int *image_size_ret);
void RSC_LoadNameTable(void);
extern char *ProgramName;
/*****************************************************************************
* Super Patch, I promise to arrange things as soon as I can.
*
******************************************************************************/
#ifdef WINELIB
#include "../loader/wine.c"
#endif
/**********************************************************************
* RSC_LoadNameTable
*/
#ifndef WINELIB
void
RSC_LoadNameTable()
{
struct resource_typeinfo_s typeinfo;
struct resource_nameinfo_s nameinfo;
unsigned short size_shift;
RESNAMTAB *top, *new;
char read_buf[1024];
char *p;
int i;
unsigned short len;
off_t rtoff;
off_t saved_pos;
top = NULL;
/*
* Move to beginning of resource table.
*/
rtoff = (ResourceFileInfo->mz_header->ne_offset +
ResourceFileInfo->ne_header->resource_tab_offset);
lseek(ResourceFd, rtoff, SEEK_SET);
/*
* Read block size.
*/
if (read(ResourceFd, &size_shift, sizeof(size_shift)) !=
sizeof(size_shift))
{
return;
}
size_shift = CONV_SHORT(size_shift);
/*
* Find resource.
*/
typeinfo.type_id = 0xffff;
while (typeinfo.type_id != 0)
{
if (!load_typeinfo (ResourceFd, &typeinfo))
break;
if (typeinfo.type_id == 0)
break;
if (typeinfo.type_id == 0x800f)
{
for (i = 0; i < typeinfo.count; i++)
{
if (read(ResourceFd, &nameinfo, sizeof(nameinfo)) !=
sizeof(nameinfo))
{
break;
}
saved_pos = lseek(ResourceFd, 0, SEEK_CUR);
lseek(ResourceFd, (long) nameinfo.offset << size_shift,
SEEK_SET);
read(ResourceFd, &len, sizeof(len));
while (len)
{
new = (RESNAMTAB *) GlobalQuickAlloc(sizeof(*new));
new->next = top;
top = new;
read(ResourceFd, &new->type_ord, 2);
read(ResourceFd, &new->id_ord, 2);
read(ResourceFd, read_buf, len - 6);
p = read_buf + strlen(read_buf) + 1;
strncpy(new->id, p, MAX_NAME_LENGTH);
new->id[MAX_NAME_LENGTH - 1] = '\0';
read(ResourceFd, &len, sizeof(len));
}
lseek(ResourceFd, saved_pos, SEEK_SET);
}
break;
}
else
{
lseek(ResourceFd, (typeinfo.count * sizeof(nameinfo)), SEEK_CUR);
}
}
ResourceFileInfo->resnamtab = top;
}
#endif /* WINELIB */
/**********************************************************************
* OpenResourceFile
......@@ -69,8 +158,15 @@ OpenResourceFile(HANDLE instance)
close(ResourceFd);
ResourceInst = instance;
ResourceFd = open (res_file, O_RDONLY);
ResourceFd = open (res_file, O_RDONLY);
#if 1
#ifndef WINELIB
if (w->resnamtab == (RESNAMTAB *) -1)
{
RSC_LoadNameTable();
}
#endif
#endif
#ifdef DEBUG_RESOURCE
printf("OpenResourceFile(%04X) // file='%s' hFile=%04X !\n",
......@@ -242,6 +338,25 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
off_t rtoff;
/*
* Check for loaded name table.
*/
if (ResourceFileInfo->resnamtab != NULL)
{
RESNAMTAB *e;
for (e = ResourceFileInfo->resnamtab; e != NULL; e = e->next)
{
if (e->type_ord == (type_id & 0x000f) &&
strcasecmp(e->id, resource_name) == 0)
{
return FindResourceByNumber(result_p, type_id, e->id_ord);
}
}
return -1;
}
/*
* Move to beginning of resource table.
*/
rtoff = (ResourceFileInfo->mz_header->ne_offset +
......@@ -311,9 +426,7 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
typeinfo.type_id, i + 1, typeinfo.count,
name, resource_name);
#endif
/* if (strcasecmp(name, resource_name) == 0) */
if (strcasecmp(name, resource_name) == 0 ||
(nameinfo.id == 0x8001 && type_id == NE_RSCTYPE_MENU))
if (strcasecmp(name, resource_name) == 0)
{
memcpy(result_p, &nameinfo, sizeof(nameinfo));
return size_shift;
......@@ -794,6 +907,10 @@ LoadString(HANDLE instance, WORD resource_id, LPSTR buffer, int buflen)
HANDLE
RSC_LoadMenu(HANDLE instance, LPSTR menu_name)
{
#ifdef DEBUG_RESOURCE
printf("RSC_LoadMenu: instance = %04x, name = '%s'\n",
instance, menu_name);
#endif
return RSC_LoadResource(instance, menu_name, NE_RSCTYPE_MENU, NULL);
}
......@@ -808,7 +925,8 @@ LoadBitmap(HANDLE instance, LPSTR bmp_name)
HDC hdc;
long *lp;
int image_size;
int size;
#ifdef DEBUG_RESOURCE
printf("LoadBitmap: instance = %04x, name = %08x\n",
instance, bmp_name);
......@@ -828,14 +946,73 @@ LoadBitmap(HANDLE instance, LPSTR bmp_name)
GlobalFree(rsc_mem);
return 0;
}
if (*lp == sizeof(BITMAPCOREHEADER))
size = CONV_LONG (*lp);
if (size == sizeof(BITMAPCOREHEADER)){
CONV_BITMAPCOREHEADER (lp);
hbitmap = ConvertCoreBitmap( hdc, (BITMAPCOREHEADER *) lp );
else if (*lp == sizeof(BITMAPINFOHEADER))
} else if (size == sizeof(BITMAPINFOHEADER)){
CONV_BITMAPINFO (lp);
hbitmap = ConvertInfoBitmap( hdc, (BITMAPINFO *) lp );
else hbitmap = 0;
} else hbitmap = 0;
GlobalFree(rsc_mem);
ReleaseDC( 0, hdc );
return hbitmap;
}
/**********************************************************************
* CreateIcon [USER.407]
*/
HICON CreateIcon(HANDLE hInstance, int nWidth, int nHeight,
BYTE nPlanes, BYTE nBitsPixel, LPSTR lpANDbits,
LPSTR lpXORbits)
{
HICON hIcon;
ICONALLOC *lpico;
#ifdef DEBUG_RESOURCE
printf("CreateIcon: hInstance = %04x, nWidth = %08x, nHeight = %08x \n",
hInstance, nWidth, nHeight);
printf(" nPlanes = %04x, nBitsPixel = %04x,",nPlanes, nBitsPixel);
printf(" lpANDbits= %04x, lpXORbits = %04x, \n",lpANDbits, lpXORbits);
#endif
if (hInstance == (HANDLE)NULL) {
printf("CreateIcon / hInstance %04x not Found!\n",hInstance);
return 0;
}
hIcon = GlobalAlloc(GMEM_MOVEABLE, sizeof(ICONALLOC) + 1024);
if (hIcon == (HICON)NULL) {
printf("Can't allocate memory for Icon in CreateIcon\n");
return 0;
}
lpico= (ICONALLOC *)GlobalLock(hIcon);
lpico->descriptor.Width=nWidth;
lpico->descriptor.Height=nHeight;
lpico->descriptor.ColorCount=16; /* Dummy Value */
lpico->descriptor.Reserved1=0;
lpico->descriptor.Reserved2=nPlanes;
lpico->descriptor.Reserved3=nWidth*nHeight;
/* either nPlanes and/or nBitCount is set to one */
lpico->descriptor.icoDIBSize=nWidth*nHeight*nPlanes*nBitsPixel;
lpico->descriptor.icoDIBOffset=0;
if( !(lpico->hBitmap=CreateBitmap(nWidth, nHeight, nPlanes, nBitsPixel,
lpXORbits)) ) {
printf("CreateIcon: couldn't create the XOR bitmap\n");
return(0);
}
/* the AND BitMask is always monochrome */
if( !(lpico->hBitMask=CreateBitmap(nWidth, nHeight, 1, 1, lpANDbits)) ) {
printf("CreateIcon: couldn't create the AND bitmap\n");
return(0);
}
GlobalUnlock(hIcon);
#ifdef DEBUG_RESOURCE
printf("CreateIcon Alloc hIcon=%X\n", hIcon);
#endif
return hIcon;
}
#ifndef WINELIB
static char RCSId[] = "$Id: selector.c,v 1.3 1993/07/04 04:04:21 root Exp root $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#ifdef __linux__
#include <linux/unistd.h>
#include <linux/head.h>
......@@ -16,14 +20,16 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#endif
#if defined(__NetBSD__) || defined(__FreeBSD__)
#include <sys/mman.h>
#include <machine/segments.h>
#endif
#include <errno.h>
#include "neexe.h"
#include "segmem.h"
#include "prototypes.h"
#include "wine.h"
#include "windows.h"
#include "prototypes.h"
/* #define DEBUG_SELECTORS /* */
/* #define DEBUG_SELECTORS */
#ifdef linux
#define DEV_ZERO
......@@ -31,7 +37,6 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#endif
#if defined(__NetBSD__) || defined(__FreeBSD__)
#include <machine/segments.h>
#define PAGE_SIZE getpagesize()
#define MODIFY_LDT_CONTENTS_DATA 0
#define MODIFY_LDT_CONTENTS_STACK 1
......@@ -214,8 +219,7 @@ IPCCopySelector(int i_old, unsigned long new, int swap_type)
* This is very bad!!! This function is implemented for Windows
* compatibility only. Do not call this from the emulation library.
*/
unsigned int
AllocSelector(unsigned int old_selector)
WORD AllocSelector(WORD old_selector)
{
SEGDESC *s_new, *s_old;
int i_new, i_old;
......@@ -382,7 +386,7 @@ unsigned int PrestoChangoSelector(unsigned src_selector, unsigned dst_selector)
/**********************************************************************
* AllocCStoDSAlias
*/
AllocDStoCSAlias(unsigned int ds_selector)
WORD AllocDStoCSAlias(WORD ds_selector)
{
unsigned int cs_selector;
......@@ -396,7 +400,7 @@ AllocDStoCSAlias(unsigned int ds_selector)
/**********************************************************************
* FreeSelector
*/
unsigned int FreeSelector(unsigned int sel)
WORD FreeSelector(WORD sel)
{
SEGDESC *s;
int sel_idx;
......@@ -694,10 +698,9 @@ GetEntryPointFromOrdinal(struct w_files * wpnt, int ordinal)
/**********************************************************************
* GetDOSEnvironment
*/
void *
GetDOSEnvironment()
LPSTR GetDOSEnvironment(void)
{
return EnvironmentSelector->base_addr;
return (LPSTR) EnvironmentSelector->base_addr;
}
/**********************************************************************
......@@ -916,3 +919,4 @@ CreateSelectors(struct w_files * wpnt)
return selectors;
}
#endif /* ifndef WINELIB */
#include <signal.h>
#ifndef WINELIB
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <errno.h>
#include <time.h>
#if defined(__NetBSD__) || defined(__FreeBSD__)
......@@ -8,14 +10,14 @@
#else
#include <syscall.h>
#endif
#include <signal.h>
#include <errno.h>
#ifdef linux
#include <linux/sched.h>
#include <asm/system.h>
#endif
#include "wine.h"
#include "segmem.h"
#include "prototypes.h"
char * cstack[4096];
struct sigaction segv_act;
......@@ -40,92 +42,145 @@ wine_sigaction(int sig,struct sigaction * new, struct sigaction * old)
}
#ifdef linux
static void win_fault(int signal, struct sigcontext_struct context){
struct sigcontext_struct *scp = &context;
static void win_fault(int signal, struct sigcontext_struct context)
{
struct sigcontext_struct *scp = &context;
#else
static void win_fault(int signal, int code, struct sigcontext *scp){
static void win_fault(int signal, int code, struct sigcontext *scp)
{
#endif
unsigned char * instr;
unsigned char intno;
unsigned int * dump;
int i;
unsigned char * instr;
unsigned int * dump;
int i;
/* First take care of a few preliminaries */
#ifdef linux
if(signal != SIGSEGV) exit(1);
if((scp->sc_cs & 7) != 7){
if(signal != SIGSEGV)
exit(1);
if((scp->sc_cs & 7) != 7)
{
#endif
#if defined(__NetBSD__) || defined(__FreeBSD__)
/* set_es(0x27); set_ds(0x27); */
if(signal != SIGBUS) exit(1);
if(scp->sc_cs == 0x1f){
if(signal != SIGBUS)
exit(1);
if(scp->sc_cs == 0x1f)
{
#endif
fprintf(stderr,
"Segmentation fault in Wine program (%x:%x)."
" Please debug\n",
scp->sc_cs, scp->sc_eip);
goto oops;
};
fprintf(stderr,
"Segmentation fault in Wine program (%x:%x)."
" Please debug\n",
scp->sc_cs, scp->sc_eip);
goto oops;
};
/* Now take a look at the actual instruction where the program
bombed */
instr = (char *) SAFEMAKEPTR(scp->sc_cs, scp->sc_eip);
/* Now take a look at the actual instruction where the program
bombed */
instr = (unsigned char *) SAFEMAKEPTR(scp->sc_cs, scp->sc_eip);
if(*instr != 0xcd) {
fprintf(stderr,
"Unexpected Windows program segfault"
" - opcode = %x\n", *instr);
#if 0
return;
#else
goto oops;
#endif
};
switch(*instr)
{
case 0xcd: /* int <XX> */
instr++;
switch(*instr)
{
case 0x10:
if(!do_int10(scp))
goto oops;
break;
instr++;
intno = *instr;
switch(intno){
case 0x21:
if(!do_int21(scp)) goto oops;
case 0x11:
scp->sc_eax = (scp->sc_eax & 0xffff0000L) | DOS_GetEquipment();
break;
case 0x11:
scp->sc_eax = (scp->sc_eax & 0xffff0000L) | DOS_GetEquipment();
case 0x12:
scp->sc_eax = (scp->sc_eax & 0xffff0000L) | 640L;
break; /* get base mem size */
case 0x1A:
if(!do_int1A(scp))
goto oops;
break;
case 0x21:
if (!do_int21(scp))
goto oops;
break;
case 0x22:
scp->sc_eax = 0x1234;
scp->sc_ebx = 0x5678;
scp->sc_ecx = 0x9abc;
scp->sc_edx = 0xdef0;
break;
case 0x25:
if (!do_int25(scp))
goto oops;
break;
case 0x12:
scp->sc_eax = (scp->sc_eax & 0xffff0000L) | 640L;
break; /* get base mem size */
case 0x1A:
if(!do_int1A(scp)) goto oops;
case 0x26:
if (!do_int26(scp))
goto oops;
break;
default:
fprintf(stderr,"Unexpected Windows interrupt %x\n", intno);
default:
fprintf(stderr,"Unexpected Windows interrupt %x\n", *instr);
goto oops;
}
scp->sc_eip += 2; /* Bypass the int instruction */
break;
case 0xec: /* inb al,dx */
inportb(scp);
scp->sc_eip++;
break;
case 0xed: /* in ax,dx */
inport(scp);
scp->sc_eip++;
break;
case 0xee: /* outb dx,al */
outportb(scp);
scp->sc_eip++;
break;
case 0xef: /* out dx,ax */
outport(scp);
scp->sc_eip++;
break;
default:
fprintf(stderr, "Unexpected Windows program segfault"
" - opcode = %x\n", *instr);
goto oops;
};
}
/* OK, done handling the interrupt */
/* OK, done handling the interrupt */
return;
scp->sc_eip += 2; /* Bypass the int instruction */
return;
oops:
fprintf(stderr,"In win_fault %x:%x\n", scp->sc_cs, scp->sc_eip);
oops:
fprintf(stderr,"In win_fault %x:%x\n", scp->sc_cs, scp->sc_eip);
#ifdef linux
wine_debug(scp); /* Enter our debugger */
wine_debug(scp); /* Enter our debugger */
#else
fprintf(stderr,"Stack: %x:%x\n", scp->sc_ss, scp->sc_esp);
dump = (int*) scp;
for(i=0; i<22; i++)
{
fprintf(stderr," %8.8x", *dump++);
if ((i % 8) == 7)
fprintf(stderr,"\n");
}
fprintf(stderr,"\n");
exit(1);
fprintf(stderr,"Stack: %x:%x\n", scp->sc_ss, scp->sc_esp);
dump = (int*) scp;
for(i=0; i<22; i++)
{
fprintf(stderr," %8.8x", *dump++);
if ((i % 8) == 7)
fprintf(stderr,"\n");
}
fprintf(stderr,"\n");
exit(1);
#endif
}
int
init_wine_signals(){
int init_wine_signals(void)
{
#ifdef linux
segv_act.sa_handler = (__sighandler_t) win_fault;
/* Point to the top of the stack, minus 4 just in case, and make
......@@ -155,3 +210,4 @@ init_wine_signals(){
#endif
}
#endif /* ifndef WINELIB */
......@@ -49,7 +49,6 @@ HINSTANCE hSysRes;
static char *DLL_Extensions[] = { "dll", "exe", NULL };
static char *EXE_Extensions[] = { "exe", NULL };
static char *WinePath = NULL;
FILE *SpyFp = NULL;
......@@ -137,7 +136,7 @@ HINSTANCE LoadImage(char *modulename, int filetype)
if (FindFile(buffer, sizeof(buffer), modulename, (filetype == EXE ?
EXE_Extensions : DLL_Extensions), WindowsPath) ==NULL)
{
fprintf(stderr,"LoadImage: I can't find %s !\n",modulename);
fprintf(stderr, "LoadImage: I can't find %s.dll | %s.exe !\n",modulename, modulename);
return (HINSTANCE) NULL;
}
fprintf(stderr,"LoadImage: loading %s (%s)\n", modulename, buffer);
......@@ -155,6 +154,7 @@ HINSTANCE LoadImage(char *modulename, int filetype)
wpnt1->next = wpnt;
};
wpnt->next = NULL;
wpnt->resnamtab = (RESNAMTAB *) -1;
/*
* Open file for reading.
......@@ -248,8 +248,6 @@ HINSTANCE LoadImage(char *modulename, int filetype)
*/
for(i=0; i<wpnt->ne_header->n_mod_ref_tab; i++){
char buff[14];
char buff2[256];
int fd, j;
GetModuleName(wpnt, i + 1, buff);
#ifndef WINELIB
......@@ -265,37 +263,26 @@ return(wpnt->hinstance);
}
#ifndef WINELIB
/**********************************************************************
* main
*/
_WinMain(int argc, char **argv)
int _WinMain(int argc, char **argv)
{
int segment;
char *p;
char *sysresname;
char filename[100];
char syspath[256];
char exe_path[256];
#ifdef WINESTAT
char * cp;
#endif
struct w_files * wpnt;
int cs_reg, ds_reg, ss_reg, ip_reg, sp_reg;
int i;
int rv;
Argc = argc - 1;
Argv = argv + 1;
WinePath = malloc(1024);
getcwd(WinePath, 512);
if ((p = getenv("WINEPATH")) != NULL) {
strcat(WinePath, ";");
strcat(WinePath, p);
}
if (LoadImage(Argv[0], EXE) == (HINSTANCE) NULL ) {
fprintf(stderr, "wine: can't find %s!.\n", Argv[0]);
exit(1);
......@@ -393,6 +380,7 @@ void InitializeLoadedDLLs()
}
}
}
#endif
/**********************************************************************
......@@ -402,10 +390,8 @@ char *
GetImportedName(int fd, struct mz_header_s *mz_header,
struct ne_header_s *ne_header, int name_offset, char *buffer)
{
char *p;
int length;
int status;
int i;
status = lseek(fd, mz_header->ne_offset + ne_header->iname_tab_offset +
name_offset, SEEK_SET);
......@@ -426,7 +412,6 @@ GetModuleName(struct w_files * wpnt, int index, char *buffer)
int fd = wpnt->fd;
struct mz_header_s *mz_header = wpnt->mz_header;
struct ne_header_s *ne_header = wpnt->ne_header;
char *p;
int length;
WORD name_offset, status;
int i;
......@@ -714,16 +699,4 @@ FixupSegment(struct w_files * wpnt, int segment_num)
return 0;
}
/**********************************************************************
* GetProcAddress
*/
FARPROC GetProcAddress(HINSTANCE hinstance, char *proc_name)
{
if ((int) proc_name & 0xffff0000)
printf("GetProcAddress: %#04x, '%s'\n", hinstance, proc_name);
else
printf("GetProcAddress: %#04x, %d\n", hinstance, (int) proc_name);
return NULL;
}
#endif
static char RCSId[] = "$Id: global.c,v 1.2 1993/07/04 04:04:21 root Exp root $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#define GLOBAL_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "prototypes.h"
#include "heap.h"
#include "segmem.h"
......@@ -153,7 +156,7 @@ GlobalGetFreeSegments(unsigned int flags, int n_segments)
/**********************************************************************
* GlobalAlloc
*/
unsigned int
HANDLE
GlobalAlloc(unsigned int flags, unsigned long size)
{
GDESC *g;
......@@ -258,7 +261,7 @@ GlobalAlloc(unsigned int flags, unsigned long size)
* Windows programs will pass a handle in the "block" parameter, but
* this function will also accept a 32-bit address.
*/
unsigned int
HANDLE
GlobalFree(unsigned int block)
{
GDESC *g;
......@@ -269,18 +272,7 @@ GlobalFree(unsigned int block)
/*
* Find GDESC for this block.
*/
if (block & 0xffff0000)
{
for (g = GlobalList; g != NULL; g = g->next)
if (g->handle > 0 && (unsigned int) g->addr == block)
break;
}
else
{
for (g = GlobalList; g != NULL; g = g->next)
if (g->handle == block)
break;
}
g = GlobalGetGDesc(block);
if (g == NULL)
return block;
......@@ -556,12 +548,7 @@ GlobalReAlloc(unsigned int block, unsigned int new_size, unsigned int flags)
/*
* Find GDESC for this block.
*/
for (g = GlobalList; g != NULL; g = g->next)
{
if (g->handle == block)
break;
}
g = GlobalGetGDesc(block);
if (g == NULL)
return 0;
......@@ -733,6 +720,70 @@ GlobalHandleFromPointer(void *block)
else
return g->handle;
}
/**********************************************************************
* GetFreeSpace (kernel.169)
*/
DWORD GetFreeSpace(UINT wFlags)
/* windows 3.1 doesn't use the wFlags parameter !!
(so I won't either) */
{
GDESC *g;
unsigned char free_map[512];
unsigned int max_selector_used = 0;
unsigned int i;
unsigned int selector;
int total_free;
/*
* Initialize free list to all items not controlled by GlobalAlloc()
*/
for (i = 0; i < 512; i++)
free_map[i] = -1;
/*
* Traverse table looking for used and free selectors.
*/
for (g = GlobalList; g != NULL; g = g->next)
{
/*
* Check for free segments.
*/
if (g->sequence == -1)
{
free_map[g->handle >> 3] = 1;
if (g->handle > max_selector_used)
max_selector_used = g->handle;
}
/*
* Check for heap allocated segments.
*/
else if (g->handle == 0)
{
selector = (unsigned int) g->addr >> 16;
free_map[selector >> 3] = 0;
if (selector > max_selector_used)
max_selector_used = selector;
}
}
/*
* All segments past the biggest selector used are free.
*/
for (i = (max_selector_used >> 3) + 1; i < 512; i++)
free_map[i] = 1;
/*
* Add up the total free segments (obviously this amount of memory
may not be contiguous, use GlobalCompact to get largest contiguous
memory available).
*/
total_free=0;
for (i = 0; i < 512; i++)
if (free_map[i] == 1)
total_free++;
return total_free << 16;
}
......@@ -3,17 +3,13 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "prototypes.h"
#include "segmem.h"
#include "heap.h"
#include "regfunc.h"
typedef struct heap_local_heap_s
{
struct heap_local_heap_s *next;
MDESC *free_list;
unsigned short selector;
} LHEAP;
/* #define DEBUG_HEAP */
LHEAP *LocalHeaps = NULL;
......@@ -23,6 +19,9 @@ LHEAP *LocalHeaps = NULL;
void
HEAP_Init(MDESC **free_list, void *start, int length)
{
if (length < 2 * sizeof(MDESC))
return;
*free_list = (MDESC *) start;
(*free_list)->prev = NULL;
(*free_list)->next = NULL;
......@@ -302,8 +301,6 @@ HEAP_LocalFindHeap(unsigned short owner)
return NULL;
}
#define LOCALHEAP() (&HEAP_LocalFindHeap(Segments[Stack16Frame[11] >> 3].owner)->free_list)
/**********************************************************************
* HEAP_LocalInit
*/
......@@ -316,43 +313,47 @@ HEAP_LocalInit(unsigned short owner, void *start, int length)
printf("HEAP_LocalInit: owner %04x, start %08x, length %04x\n",
owner, start, length);
#endif
if (length < 2 * sizeof(MDESC))
return;
lh = (LHEAP *) malloc(sizeof(*lh));
if (lh == NULL)
return;
lh->selector = owner;
lh->next = LocalHeaps;
lh->next = LocalHeaps;
lh->selector = owner;
lh->local_table = NULL;
HEAP_Init(&lh->free_list, start, length);
LocalHeaps = lh;
}
/**********************************************************************
* LocalAlloc
* WIN16_LocalAlloc
*/
void *
LocalAlloc(int flags, int bytes)
WIN16_LocalAlloc(int flags, int bytes)
{
void *m;
#ifdef DEBUG_HEAP
printf("LocalAlloc: flags %x, bytes %d\n", flags, bytes);
printf("WIN16_LocalAlloc: flags %x, bytes %d\n", flags, bytes);
printf(" called from segment %04x\n", Stack16Frame[11]);
#endif
m = HEAP_Alloc(LOCALHEAP(), flags, bytes);
#ifdef DEBUG_HEAP
printf("LocalAlloc: returning %x\n", (int) m);
printf("WIN16_LocalAlloc: returning %x\n", (int) m);
#endif
return m;
}
/**********************************************************************
* LocalCompact
* WIN16_LocalCompact
*/
int
LocalCompact(int min_free)
WIN16_LocalCompact(int min_free)
{
MDESC *m;
int max_block;
......@@ -366,10 +367,10 @@ LocalCompact(int min_free)
}
/**********************************************************************
* LocalFlags
* WIN16_LocalFlags
*/
unsigned int
LocalFlags(unsigned int handle)
WIN16_LocalFlags(unsigned int handle)
{
MDESC *m;
......@@ -382,10 +383,10 @@ LocalFlags(unsigned int handle)
}
/**********************************************************************
* LocalFree
* WIN16_LocalFree
*/
unsigned int
LocalFree(unsigned int handle)
WIN16_LocalFree(unsigned int handle)
{
unsigned int addr;
......@@ -397,12 +398,12 @@ LocalFree(unsigned int handle)
}
/**********************************************************************
* LocalInit
* WIN16_LocalInit
*/
unsigned int
LocalInit(unsigned int segment, unsigned int start, unsigned int end)
WIN16_LocalInit(unsigned int segment, unsigned int start, unsigned int end)
{
unsigned short owner = Segments[Stack16Frame[11] >> 3].owner;
unsigned short owner = HEAP_OWNER;
LHEAP *lh = HEAP_LocalFindHeap(owner);
if (segment == 0)
......@@ -426,10 +427,10 @@ LocalInit(unsigned int segment, unsigned int start, unsigned int end)
}
/**********************************************************************
* LocalLock
* WIN16_LocalLock
*/
void *
LocalLock(unsigned int handle)
WIN16_LocalLock(unsigned int handle)
{
MDESC *m;
......@@ -443,10 +444,10 @@ LocalLock(unsigned int handle)
}
/**********************************************************************
* LocalReAlloc
* WIN16_LocalReAlloc
*/
void *
LocalReAlloc(unsigned int handle, int flags, int bytes)
WIN16_LocalReAlloc(unsigned int handle, int flags, int bytes)
{
void *m;
......@@ -458,10 +459,10 @@ LocalReAlloc(unsigned int handle, int flags, int bytes)
}
/**********************************************************************
* LocalSize
* WIN16_LocalSize
*/
unsigned int
LocalSize(unsigned int handle)
WIN16_LocalSize(unsigned int handle)
{
MDESC *m;
......@@ -474,10 +475,10 @@ LocalSize(unsigned int handle)
}
/**********************************************************************
* LocalUnlock
* WIN16_LocalUnlock
*/
unsigned int
LocalUnlock(unsigned int handle)
WIN16_LocalUnlock(unsigned int handle)
{
MDESC *m;
......@@ -491,3 +492,49 @@ LocalUnlock(unsigned int handle)
return 0;
}
/**********************************************************************
* GetFreeSystemResources (user.284)
*/
#define USERRESOURCES 2
#define GDIRESOURCES 1
#define SYSTEMRESOURCES 0
#include <user.h>
#include <gdi.h>
WORD GetFreeSystemResources(WORD SystemResourceType)
{
unsigned int GdiFree=0,GdiResult=0;
unsigned int UserFree=0,UserResult=0;
unsigned int result=0;
MDESC *m;
printf("GetFreeSystemResources(%u)\n",SystemResourceType);
switch(SystemResourceType) {
case(USERRESOURCES):
for (m = USER_Heap; m != NULL; m = m->next) /* add up free area in heap */
UserFree += m->length;
result=(UserFree*100)/65516; /* 65516 == 64K */
break;
case(GDIRESOURCES):
for (m = GDI_Heap; m != NULL; m = m->next)
GdiFree += m->length;
result=(GdiFree*100)/65516;
break;
case(SYSTEMRESOURCES):
for (m = USER_Heap; m != NULL; m = m->next)
UserFree += m->length;
UserResult=(UserFree*100)/65516;
for (m = GDI_Heap; m != NULL; m = m->next)
GdiFree += m->length;
GdiResult=(GdiFree*100)/65516;
result=(UserResult < GdiResult) ? UserResult:GdiResult;
break;
default:
result=0;
break;
}
return(result);
}
......@@ -3,6 +3,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1994";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "prototypes.h"
#include "heap.h"
#include "segmem.h"
......
......@@ -16,9 +16,9 @@ SRCS = \
message.c \
profile.c \
rect.c \
resource.c \
sound.c \
spy.c \
stress.c \
user.c \
winsocket.c
......
......@@ -7,13 +7,6 @@
/*
* Current limitations:
*
* - This code should work fine when called from the emulation library,
* but probably not when called from the Windows program. The reason
* is that everything is allocated on the current local heap, instead
* of taking into account the DS register. Correcting this will also
* require some changes in the local heap management to bring it closer
* to Windows.
*
* - The code assumes that LocalAlloc() returns a block aligned on a
* 4-bytes boundary (because of the shifting done in HANDLETOATOM).
* If this is not the case, the allocation code will have to be changed.
......@@ -30,22 +23,35 @@
* aligned block. Needed to test the Library.
*/
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "user.h"
#include "atom.h"
#include "prototypes.h"
#ifndef WINELIB
#include "heap.h"
#endif
#define DEFAULT_ATOMTABLE_SIZE 37
#define MIN_STR_ATOM 0xc000
#ifdef WINELIB
#define ATOMTOHANDLE
#define HANDLETOATOM
#else
#define ATOMTOHANDLE(atom) ((HANDLE)(atom) << 2)
#define HANDLETOATOM(handle) ((ATOM)(0xc000 | ((handle) >> 2)))
#endif
#ifdef WINELIB
static ATOMTABLE * localTable = NULL;
#undef LOCALATOMTABLE
#define LOCALATOMTABLE() &localTable
#endif
static ATOMTABLE * globalTable = NULL;
......@@ -56,18 +62,31 @@ static BOOL ATOM_InitTable( ATOMTABLE ** table, WORD entries )
{
int i;
HANDLE handle;
if (table == &globalTable)
{
handle = USER_HEAP_ALLOC(LMEM_MOVEABLE, sizeof(ATOMTABLE) +
(entries-1) * sizeof(HANDLE) );
if (!handle)
return FALSE;
*table = (ATOMTABLE *) USER_HEAP_ADDR( handle );
}
else
{
handle = LocalAlign ( LMEM_MOVEABLE, sizeof(ATOMTABLE) +
(entries-1) * sizeof(HANDLE) );
if (!handle)
return FALSE;
*table = (ATOMTABLE *) LocalLock( handle );
}
handle = LocalAlign ( LMEM_MOVEABLE, sizeof(ATOMTABLE) +
(entries-1) * sizeof(HANDLE) );
if (!handle) return FALSE;
*table = (ATOMTABLE *) LocalLock( handle );
(*table)->size = entries;
for (i = 0; i < entries; i++) (*table)->entries[i] = 0;
for (i = 0; i < entries; i++)
(*table)->entries[i] = 0;
return TRUE;
}
/***********************************************************************
* ATOM_Init
*
......@@ -87,7 +106,11 @@ BOOL ATOM_Init()
*/
static ATOMENTRY * ATOM_MakePtr( ATOMTABLE * table, HANDLE handle )
{
#ifdef WINELIB
return (ATOMENTRY *) LocalLock (handle);
#else
return (ATOMENTRY *) (((int)table & 0xffff0000) | (int)handle);
#endif
}
......@@ -132,8 +155,18 @@ static ATOM ATOM_AddAtom( ATOMTABLE * table, LPCSTR str )
}
entry = entryPtr->next;
}
if (table == globalTable)
{
entry = (int) USER_HEAP_ALLOC(LMEM_MOVEABLE,
sizeof(ATOMENTRY)+len-1 ) & 0xffff;
}
else
{
entry = (int) LocalAlign(LMEM_MOVEABLE,
sizeof(ATOMENTRY)+len-1 ) & 0xffff;
}
entry = (int)LocalAlign( LMEM_MOVEABLE, sizeof(ATOMENTRY)+len-1 ) & 0xffff;
if (!entry) return 0;
entryPtr = ATOM_MakePtr( table, entry );
entryPtr->next = table->entries[hash];
......@@ -173,7 +206,10 @@ static ATOM ATOM_DeleteAtom( ATOMTABLE * table, ATOM atom )
if (--entryPtr->refCount == 0)
{
*prevEntry = entryPtr->next;
USER_HEAP_FREE( entry );
if (table == globalTable)
USER_HEAP_FREE(entry);
else
LocalFree( entry );
}
return 0;
}
......@@ -246,7 +282,7 @@ static WORD ATOM_GetAtomName( ATOMTABLE * table, ATOM atom,
*/
BOOL InitAtomTable( WORD entries )
{
return ATOM_InitTable( &localTable, entries );
return ATOM_InitTable( LOCALATOMTABLE(), entries );
}
......@@ -265,8 +301,8 @@ HANDLE GetAtomHandle( ATOM atom )
*/
ATOM AddAtom( LPCSTR str )
{
if (!localTable) InitAtomTable( DEFAULT_ATOMTABLE_SIZE );
return ATOM_AddAtom( localTable, str );
if (!*LOCALATOMTABLE()) InitAtomTable( DEFAULT_ATOMTABLE_SIZE );
return ATOM_AddAtom( *LOCALATOMTABLE(), str );
}
......@@ -275,8 +311,8 @@ ATOM AddAtom( LPCSTR str )
*/
ATOM DeleteAtom( ATOM atom )
{
if (!localTable) InitAtomTable( DEFAULT_ATOMTABLE_SIZE );
return ATOM_DeleteAtom( localTable, atom );
if (!*LOCALATOMTABLE()) InitAtomTable( DEFAULT_ATOMTABLE_SIZE );
return ATOM_DeleteAtom( *LOCALATOMTABLE(), atom );
}
......@@ -285,8 +321,8 @@ ATOM DeleteAtom( ATOM atom )
*/
ATOM FindAtom( LPCSTR str )
{
if (!localTable) InitAtomTable( DEFAULT_ATOMTABLE_SIZE );
return ATOM_FindAtom( localTable, str );
if (!*LOCALATOMTABLE()) InitAtomTable( DEFAULT_ATOMTABLE_SIZE );
return ATOM_FindAtom( *LOCALATOMTABLE(), str );
}
......@@ -295,8 +331,8 @@ ATOM FindAtom( LPCSTR str )
*/
WORD GetAtomName( ATOM atom, LPSTR buffer, short count )
{
if (!localTable) InitAtomTable( DEFAULT_ATOMTABLE_SIZE );
return ATOM_GetAtomName( localTable, atom, buffer, count );
if (!*LOCALATOMTABLE()) InitAtomTable( DEFAULT_ATOMTABLE_SIZE );
return ATOM_GetAtomName( *LOCALATOMTABLE(), atom, buffer, count );
}
......
......@@ -10,6 +10,8 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994";
#define DEBUG_CLIPBOARD
*/
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>
#include <sys/types.h>
#include <sys/stat.h>
......
......@@ -8,11 +8,14 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <sys/stat.h>
#if defined(__NetBSD__) || defined(__FreeBSD__)
#include <errno.h>
#include <sys/ioctl.h>
#endif
#include <unistd.h>
#include "wine.h"
#include "windows.h"
......@@ -38,7 +41,7 @@ void Comm_DeInit(void);
void Comm_Init(void)
{
int x, serial = 0, parallel = 0;
char option[10], temp[256], *ptr;
char option[10], temp[256];
struct stat st;
for (x=0; x!=MAX_PORTS; x++) {
......@@ -145,10 +148,10 @@ int BuildCommDCB(LPSTR device, DCB FAR *lpdcb)
/* 012345 */
int port;
char *ptr, *ptr2, temp[256],temp2[10];
char *ptr, temp[256];
#ifdef DEBUG_COMM
fprintf(stderr,"BuildCommDCB: (%s), ptr %d\n", device, lpdcb);
fprintf(stderr,"BuildCommDCB: (%s), ptr %d\n", device, (long) lpdcb);
#endif
commerror = 0;
......@@ -296,8 +299,6 @@ fprintf(stderr,"OpenComm: %s, %d, %d\n", device, cbInQueue, cbOutQueue);
int CloseComm(int fd)
{
int status;
#ifdef DEBUG_COMM
fprintf(stderr,"CloseComm: fd %d\n", fd);
#endif
......@@ -477,7 +478,7 @@ int SetCommState(DCB FAR *lpdcb)
struct termios port;
#ifdef DEBUG_COMM
fprintf(stderr,"SetCommState: fd %d, ptr %d\n", lpdcb->Id, lpdcb);
fprintf(stderr,"SetCommState: fd %d, ptr %d\n", lpdcb->Id, (long) lpdcb);
#endif
if (tcgetattr(lpdcb->Id, &port) == -1) {
......@@ -666,7 +667,7 @@ int GetCommState(int fd, DCB FAR *lpdcb)
struct termios port;
#ifdef DEBUG_COMM
fprintf(stderr,"GetCommState: fd %d, ptr %d\n", fd, lpdcb);
fprintf(stderr,"GetCommState: fd %d, ptr %d\n", fd, (long) lpdcb);
#endif
if (tcgetattr(fd, &port) == -1) {
......@@ -836,7 +837,7 @@ int ReadComm(int fd, LPSTR lpvBuf, int cbRead)
struct DosDeviceStruct *ptr;
#ifdef DEBUG_COMM
fprintf(stderr,"ReadComm: fd %d, ptr %d, length %d\n", fd, lpvBuf, cbRead);
fprintf(stderr,"ReadComm: fd %d, ptr %d, length %d\n", fd, (long) lpvBuf, cbRead);
#endif
if ((ptr = GetDeviceStruct(fd)) == NULL) {
......@@ -875,7 +876,7 @@ int WriteComm(int fd, LPSTR lpvBuf, int cbWrite)
struct DosDeviceStruct *ptr;
#ifdef DEBUG_COMM
fprintf(stderr,"WriteComm: fd %d, ptr %d, length %d\n", fd, lpvBuf, cbWrite);
fprintf(stderr,"WriteComm: fd %d, ptr %d, length %d\n", fd, (long) lpvBuf, cbWrite);
#endif
if ((ptr = GetDeviceStruct(fd)) == NULL) {
......
......@@ -7,14 +7,15 @@ static char Copyright[] = "Copyright Martin Ayotte, 1993";
#define DEBUG_CURSOR
*/
#include <X11/cursorfont.h>
#include <X11/Xlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <X11/cursorfont.h>
#include <X11/Xlib.h>
#include "prototypes.h"
#include "windows.h"
#include "win.h"
......@@ -28,6 +29,7 @@ static HCURSOR hEmptyCursor = 0;
RECT ClipCursorRect;
extern HINSTANCE hSysRes;
extern Window winHasCursor;
extern int desktopX, desktopY; /* misc/main.c */
static struct { LPSTR name; HCURSOR cursor; } system_cursor[] =
{
......@@ -116,6 +118,11 @@ HCURSOR LoadCursor(HANDLE instance, LPSTR cursor_name)
lpcur->xcursor = XCreateFontCursor(XT_display, XC_sb_h_double_arrow);
GlobalUnlock(hCursor);
return hCursor;
case IDC_SIZENWSE:
case IDC_SIZENESW:
lpcur->xcursor = XCreateFontCursor(XT_display, XC_fleur);
GlobalUnlock(hCursor);
return hCursor;
default:
break;
}
......@@ -358,19 +365,10 @@ HCURSOR SetCursor(HCURSOR hCursor)
*/
void SetCursorPos(short x, short y)
{
Window root, child;
int rootX, rootY;
int childX, childY;
unsigned int mousebut;
#ifdef DEBUG_CURSOR
printf("SetCursorPos // x=%d y=%d\n", x, y);
#endif
XQueryPointer(XT_display, DefaultRootWindow(XT_display),
&root, &child, &rootX, &rootY, &childX, &childY, &mousebut);
XWarpPointer(XT_display, child, root, 0, 0,
DisplayWidth(XT_display, DefaultScreen(XT_display)),
DisplayHeight(XT_display, DefaultScreen(XT_display)),
(int)x, (int)y);
XWarpPointer( display, None, rootWindow, 0, 0, 0, 0, x, y );
}
......@@ -383,15 +381,19 @@ void GetCursorPos(LPPOINT lpRetPoint)
int rootX, rootY;
int childX, childY;
unsigned int mousebut;
if (lpRetPoint != NULL) {
XQueryPointer(XT_display, DefaultRootWindow(XT_display),
&root, &child, &rootX, &rootY, &childX, &childY, &mousebut);
if (!lpRetPoint) return;
if (!XQueryPointer( display, rootWindow, &root, &child,
&rootX, &rootY, &childX, &childY, &mousebut ))
lpRetPoint->x = lpRetPoint->y = 0;
else
{
lpRetPoint->x = rootX + desktopX;
lpRetPoint->y = rootY + desktopY;
}
#ifdef DEBUG_CURSOR
printf("GetCursorPos // x=%d y=%d\n", rootX, rootY);
printf("GetCursorPos // x=%d y=%d\n", lpRetPoint->x, lpRetPoint->y);
#endif
lpRetPoint->x = rootX;
lpRetPoint->y = rootY;
}
}
......
......@@ -3,6 +3,10 @@
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "windows.h"
#define HELP_CONTEXT 0x0001
......@@ -23,79 +27,65 @@
WORD WinExec(LPSTR lpCmdLine, WORD nCmdShow)
{
int X, X2, C;
char *ArgV[20];
printf("WinExec('%s', %04X)\n", lpCmdLine, nCmdShow);
for (X = X2 = C = 0; X < strlen(lpCmdLine) + 1; X++) {
if ((lpCmdLine[X] == ' ') || (lpCmdLine[X] == '\0')) {
ArgV[C] = (char *)malloc(X - X2 + 1);
strncpy(ArgV[C], &lpCmdLine[X2], X - X2);
ArgV[C][X - X2] = '\0';
C++; X2 = X + 1;
}
}
ArgV[C] = NULL;
for (C = 0; ; C++) {
if (ArgV[C] == NULL) break;
printf("--> '%s' \n", ArgV[C]);
}
switch(fork()) {
case -1:
printf("Can't 'fork' process !\n");
break;
case 0:
printf("New process started !\n");
execvp(ArgV[0], ArgV);
printf("Child process died !\n");
exit(1);
break;
default:
printf("Main process stay alive !\n");
break;
}
for (C = 0; ; C++) {
if (ArgV[C] == NULL) break;
free(ArgV[C]);
}
return(TRUE);
int X, X2, C;
char *ArgV[20];
printf("WinExec('%s', %04X)\n", lpCmdLine, nCmdShow);
ArgV[0] = "wine";
C = 1;
for (X = X2 = 0; X < strlen(lpCmdLine) + 1; X++) {
if ((lpCmdLine[X] == ' ') || (lpCmdLine[X] == '\0')) {
ArgV[C] = (char *)malloc(X - X2 + 1);
strncpy(ArgV[C], &lpCmdLine[X2], X - X2);
ArgV[C][X - X2] = '\0';
C++; X2 = X + 1;
}
}
ArgV[C] = NULL;
for (C = 0; ; C++) {
if (ArgV[C] == NULL) break;
printf("--> '%s' \n", ArgV[C]);
}
switch(fork()) {
case -1:
printf("Can't 'fork' process !\n");
break;
case 0:
printf("New process started !\n");
execvp(ArgV[0], ArgV);
printf("Child process died !\n");
exit(1);
break;
default:
printf("Main process stay alive !\n");
break;
}
for (C = 0; ; C++) {
if (ArgV[C] == NULL) break;
free(ArgV[C]);
}
return(TRUE);
}
BOOL WinHelp(HWND hWnd, LPSTR lpHelpFile, WORD wCommand, DWORD dwData)
{
char *ArgV[6];
char str[32];
printf("WinHelp(%s, %u, %lu)\n", lpHelpFile, wCommand, dwData);
switch(fork()) {
case -1:
printf("Can't 'fork' process !\n");
break;
case 0:
printf("New process started !\n");
ArgV[0] = "wine";
ArgV[1] = "winhelp.exe";
ArgV[2] = lpHelpFile;
switch (wCommand) {
case HELP_CONTEXT:
case HELP_KEY:
case HELP_SETINDEX:
sprintf(str, "%lu", dwData);
ArgV[3] = str;
default:
ArgV[3] = NULL;
}
ArgV[4] = NULL;
if (wCommand == HELP_HELPONHELP) ArgV[2] = NULL;
/*
_WinMain(ArgV, 2);
*/
execvp(ArgV[0], ArgV);
printf("Child process died !\n");
exit(1);
break;
default:
printf("Main process stay alive !\n");
break;
}
return(TRUE);
char str[256];
printf("WinHelp(%s, %u, %lu)\n", lpHelpFile, wCommand, dwData);
switch(wCommand) {
case 0:
case HELP_HELPONHELP:
GetWindowsDirectory(str, sizeof(str));
strcat(str, "\\winhelp.exe");
printf("'%s'\n", str);
break;
case HELP_INDEX:
GetWindowsDirectory(str, sizeof(str));
strcat(str, "\\winhelp.exe");
printf("'%s'\n", str);
break;
default:
return FALSE;
}
WinExec(str, SW_SHOWNORMAL);
return(TRUE);
}
......@@ -19,16 +19,16 @@
#define DEBUG_FILE
#include <windows.h>
#include <stdio.h>
#include <fcntl.h>
#include <limits.h>
#include <unistd.h>
#include <time.h>
#include <windows.h>
#include "prototypes.h"
char WindowsDirectory[256], SystemDirectory[256], TempDirectory[256];
/***************************************************************************
_lopen
......@@ -40,12 +40,12 @@ int _lopen (LPSTR lpPathName, int iReadWrite)
char *UnixFileName;
#ifdef DEBUG_FILE
fprintf (stderr, "_lopen: open %s\n", lpPathName);
fprintf (stderr, "_lopen: open('%s', %X);\n", lpPathName, iReadWrite);
#endif
if ((UnixFileName = GetUnixFileName(lpPathName)) == NULL)
return HFILE_ERROR;
iReadWrite &= 0x000F;
handle = open (UnixFileName, iReadWrite);
#ifdef DEBUG_FILE
......@@ -67,7 +67,7 @@ WORD _lread (int hFile, LPSTR lpBuffer, int wBytes)
#ifdef DEBUG_FILE
fprintf(stderr, "_lread: handle %d, buffer = %ld, length = %d\n",
hFile, lpBuffer, wBytes);
hFile, (int) lpBuffer, wBytes);
#endif
result = read (hFile, lpBuffer, wBytes);
......@@ -87,7 +87,7 @@ WORD _lwrite (int hFile, LPSTR lpBuffer, int wBytes)
#ifdef DEBUG_FILE
fprintf(stderr, "_lwrite: handle %d, buffer = %ld, length = %d\n",
hFile, lpBuffer, wBytes);
hFile, (int) lpBuffer, wBytes);
#endif
result = write (hFile, lpBuffer, wBytes);
......@@ -103,10 +103,12 @@ WORD _lwrite (int hFile, LPSTR lpBuffer, int wBytes)
int _lclose (int hFile)
{
#ifdef DEBUG_FILE
fprintf(stderr, "_lclose: handle %d\n", hFile);
fprintf(stderr, "_lclose: handle %d\n", hFile);
#endif
close (hFile);
if (close (hFile))
return HFILE_ERROR;
else
return 0;
}
/**************************************************************************
......@@ -221,12 +223,12 @@ UINT GetDriveType(int drive)
#endif
if (!DOS_ValidDrive(drive))
return 0;
return DRIVE_DOESNOTEXIST;
if (drive == 0 || drive == 1)
return DRIVE_REMOVABLE;
return DRIVE_REMOTE;
return DRIVE_REMOVABLE;
}
/***************************************************************************
......@@ -254,6 +256,7 @@ UINT GetWindowsDirectory(LPSTR lpszSysPath, UINT cbSysPath)
fprintf(stderr,"GetWindowsDirectory (%s)\n",lpszSysPath);
#endif
ChopOffSlash(lpszSysPath);
return(strlen(lpszSysPath));
}
/***************************************************************************
......@@ -270,6 +273,7 @@ UINT GetSystemDirectory(LPSTR lpszSysPath, UINT cbSysPath)
fprintf(stderr,"GetSystemDirectory (%s)\n",lpszSysPath);
#endif
ChopOffSlash(lpszSysPath);
return(strlen(lpszSysPath));
}
/***************************************************************************
......@@ -288,7 +292,7 @@ int GetTempFileName(BYTE bDriveLetter, LPCSTR lpszPrefixString, UINT uUnique, LP
strcpy(tempname,lpszPrefixString);
tempname[3]='\0';
sprintf(lpszTempFileName,"%s\%s%d.tmp",WindowsDirectory, tempname,
sprintf(lpszTempFileName,"%s\\%s%d.tmp",WindowsDirectory, tempname,
unique);
ToDos(lpszTempFileName);
......@@ -308,3 +312,52 @@ WORD SetErrorMode(WORD x)
{
fprintf(stderr,"wine: SetErrorMode %4x (ignored)\n",x);
}
/***************************************************************************
_hread
***************************************************************************/
long _hread(int hf, void FAR *hpvBuffer, long cbBuffer)
{
long dataread = 0;
size_t status, size;
while (cbBuffer)
{
size = cbBuffer < 30000 ? cbBuffer : 30000;
status = read(hf, hpvBuffer, size);
if (status == -1)
return HFILE_ERROR;
if (status == 0)
return dataread;
dataread += status;
hpvBuffer += status;
cbBuffer -= status;
}
return dataread;
}
/***************************************************************************
_hwrite
***************************************************************************/
long _hwrite(int hf, const void FAR *hpvBuffer, long cbBuffer)
{
long datawritten = 0;
size_t status, size;
while (cbBuffer)
{
size = cbBuffer < 30000 ? cbBuffer : 30000;
status = write(hf, hpvBuffer, size);
if (status == -1)
return HFILE_ERROR;
if (status == 0)
return datawritten;
datawritten += status;
hpvBuffer += status;
cbBuffer -= status;
}
return datawritten;
}
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 <stdlib.h>
#include <stdio.h>
#include "prototypes.h"
#include "windows.h"
......
......@@ -6,6 +6,7 @@ static char Copyright[] = "Copyright Yngvi Sigurjonsson (yngvi@hafro.is), 1993"
#include <ctype.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include "prototypes.h"
#include "regfunc.h"
......
......@@ -14,9 +14,12 @@
static char Copyright [] = "Copyright (C) 1993 Miguel de Icaza";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "windows.h"
#include "wine.h"
#include "windows.h"
#include "prototypes.h"
/* #define DEBUG */
......@@ -121,12 +124,18 @@ static TSecHeader *load (char *file)
}
if (state == FirstBrace) /* On first pass, don't allow dangling keys */
break;
if (c == ' ' || c == '\t')
break;
if (c == '\n' || c == ';' || overflow) /* Abort Definition */
next = CharBuffer;
if (c == ';')
{
state = IgnoreToEOL;
break;
}
if (c == '=' || overflow){
TKeys *temp;
......@@ -165,7 +174,7 @@ static TSecHeader *load (char *file)
return SecHeader;
}
static new_key (TSecHeader *section, char *KeyName, char *Value)
static void new_key (TSecHeader *section, char *KeyName, char *Value)
{
TKeys *key;
......
......@@ -150,6 +150,12 @@ BOOL EqualRect( LPRECT rect1, LPRECT rect2 )
BOOL SubtractRect( LPRECT dest, LPRECT src1, LPRECT src2 )
{
RECT tmp;
if (IsRectEmpty( src1 ))
{
SetRectEmpty( dest );
return FALSE;
}
*dest = *src1;
if (IntersectRect( &tmp, src1, src2 ))
{
......@@ -160,13 +166,13 @@ BOOL SubtractRect( LPRECT dest, LPRECT src1, LPRECT src2 )
}
if ((tmp.top == dest->top) && (tmp.bottom == dest->bottom))
{
if (tmp.left == dest->left) dest->right = tmp.right;
else if (tmp.right == dest->right) dest->left = tmp.left;
if (tmp.left == dest->left) dest->left = tmp.right;
else if (tmp.right == dest->right) dest->right = tmp.left;
}
else if ((tmp.left == dest->left) && (tmp.right == dest->right))
{
if (tmp.top == dest->top) dest->bottom = tmp.bottom;
else if (tmp.bottom == dest->bottom) dest->top = tmp.top;
if (tmp.top == dest->top) dest->top = tmp.bottom;
else if (tmp.bottom == dest->bottom) dest->bottom = tmp.top;
}
}
return TRUE;
......
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 <stdlib.h>
#include <stdio.h>
#include "prototypes.h"
int OpenSound(void)
......
......@@ -7,6 +7,7 @@
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xresource.h>
#include <string.h>
#include "wineopts.h"
#include "windows.h"
#include "wine.h"
......@@ -14,7 +15,7 @@
#ifndef NOSPY
#define SPY_MAX_MSGNUM 0x0210
#define SPY_MAX_MSGNUM 0x0232
const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
{
......@@ -92,7 +93,9 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
"WM_NCCREATE", /* 0x0081 */
"WM_NCDESTROY", /* 0x0082 */
"WM_NCCALCSIZE", /* 0x0083 */
NULL, NULL, NULL,
"WM_NCHITTEST", /* 0x0084 */
"WM_NCPAINT", /* 0x0085 */
"WM_NCACTIVATE", /* 0x0086 */
"WM_GETDLGCODE", /* 0x0087 */
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
......@@ -135,9 +138,9 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
"WM_KEYLAST", /* 0x0108 */
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
"WM_INITDIALOG", /* 0x0110 */
"WM_INITDIALOG", /* 0x0110 */
"WM_COMMAND", /* 0x0111 */
NULL,
"WM_SYSCOMMAND", /* 0x0112 */
"WM_TIMER", /* 0x0113 */
"WM_HSCROLL", /* 0x0114 */
"WM_VSCROLL", /* 0x0115 */
......@@ -211,9 +214,26 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
"WM_MBUTTONDOWN", /* 0x0207 */
"WM_MBUTTONUP", /* 0x0208 */
"WM_MBUTTONDBLCLK", /* 0x0209 */
NULL, NULL, NULL, NULL, NULL, NULL,
"WM_PARENTNOTIFY", /* 0x0210 */
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/* 0x0220 */
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, /* 0x0230 */
"WM_ENTERSIZEMOVE", /* 0x0231 */
"WM_EXITSIZEMOVE" /* 0x0232 */
};
char SpyFilters[256];
char SpyIncludes[256];
#endif /* NOSPY */
/**********************************************************************
......@@ -222,18 +242,24 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
void SpyMessage(HWND hwnd, WORD msg, WORD wParam, LONG lParam)
{
#ifndef NOSPY
char msg_name[80];
if (SpyFp == NULL)
return;
if (msg > SPY_MAX_MSGNUM || MessageTypeNames[msg] == NULL)
{
fprintf(SpyFp, "%04.4x %04.4x %04.4x %08.8x\n",
hwnd, msg, wParam, lParam);
}
msg_name[0] = '\0';
else
strcpy(msg_name, MessageTypeNames[msg]);
strcat(msg_name, ";");
if ((strlen(SpyIncludes) == 0 || strstr(SpyIncludes, msg_name) != NULL) &&
strstr(SpyFilters, msg_name) == NULL)
{
fprintf(SpyFp, "%04.4x %20.20s %04.4x %08.8x\n",
hwnd, MessageTypeNames[msg], wParam, lParam);
msg_name[strlen(msg_name) - 1] = '\0';
fprintf(SpyFp, "%04.4x %20.20s %04.4x %04.4x %08.8x\n",
hwnd, msg_name, msg, wParam, lParam);
}
#endif
}
......@@ -245,7 +271,7 @@ void SpyInit(void)
{
char filename[100];
if (SpyFp == NULL)
if (SpyFp != NULL)
return;
if (Options.spyFilename == NULL)
......@@ -261,5 +287,13 @@ void SpyInit(void)
else if (strlen(filename))
SpyFp = fopen(filename, "a");
else
{
SpyFp = NULL;
return;
}
GetPrivateProfileString("spy", "exclude", "", SpyFilters,
sizeof(SpyFilters), WINE_INI);
GetPrivateProfileString("spy", "include", "", SpyIncludes,
sizeof(SpyIncludes), WINE_INI);
}
#include <stdio.h>
#include <limits.h>
#include "windows.h"
#include "stress.h"
#define STRESS_DEBUG
int AllocDiskSpace(long lLeft, UINT uDrive)
{
#ifdef STRESS_DEBUG
fprintf(stderr, "stress.dll: AllocDiskSpace %d, %ld\n", uDrive, lLeft);
#endif
return 1;
}
int AllocFileHandles(int Left)
{
#ifdef STRESS_DEBUG
fprintf(stderr, "stress.dll: AllocFileHandles %d\n", Left);
#endif
if (Left < 0)
return -1;
else
return 1;
}
BOOL AllocGDIMem(UINT uLeft)
{
#ifdef STRESS_DEBUG
fprintf(stderr, "stress.dll: AllocGDIMem %d\n", uLeft);
#endif
return 1;
}
BOOL AllocMem(DWORD dwLeft)
{
#ifdef STRESS_DEBUG
fprintf(stderr, "stress.dll: AllocMem %ld\n", dwLeft);
#endif
return 1;
}
BOOL AllocUserMem(UINT uContig)
{
#ifdef STRESS_DEBUG
fprintf(stderr, "stress.dll: AllocUserMem %d\n", uContig);
#endif
return 1;
}
void FreeAllMem(void)
{
#ifdef STRESS_DEBUG
fprintf(stderr, "stress.dll: FreeAllMem\n");
#endif
}
void FreeAllGDIMem(void)
{
#ifdef STRESS_DEBUG
fprintf(stderr, "stress.dll: FreeAllGDIMem\n");
#endif
}
void FreeAllUserMem(void)
{
#ifdef STRESS_DEBUG
fprintf(stderr, "stress.dll: FreeAllUserMem\n");
#endif
}
void GetFreeAllUserMem(void)
{
#ifdef STRESS_DEBUG
fprintf(stderr, "stress.dll: GetFreeAllUserMem\n");
#endif
}
int GetFreeFileHandles(void)
{
#ifdef STRESS_DEBUG
fprintf(stderr, "stress.dll: GetFreeFileHandles\n");
#endif
#ifndef OPEN_MAX
return _POSIX_OPEN_MAX
#else
return OPEN_MAX;
#endif
}
void UnAllocDiskSpace(UINT drive)
{
#ifdef STRESS_DEBUG
fprintf(stderr, "stress.dll: UnAllocDiskSpace %d\n", drive);
#endif
}
void UnAllocFileHandles(void)
{
#ifdef STRESS_DEBUG
fprintf(stderr, "stress.dll: GetFreeAllUserMem\n");
#endif
}
......@@ -17,6 +17,7 @@ MDESC *USER_Heap = NULL;
extern BOOL ATOM_Init();
extern BOOL GDI_Init();
extern void SYSMETRICS_Init();
extern BOOL WIN_CreateDesktopWindow();
#ifndef WINELIB
/***********************************************************************
......@@ -44,6 +45,11 @@ USER_InitApp(int hInstance)
SpyInit();
#ifndef WINELIB
/* Create USER heap */
if (!USER_HeapInit()) return 0;
#endif
/* Global atom table initialisation */
if (!ATOM_Init()) return 0;
......@@ -54,11 +60,6 @@ USER_InitApp(int hInstance)
SYSMETRICS_Init();
SYSCOLOR_Init();
#ifndef WINELIB
/* Create USER heap */
if (!USER_HeapInit()) return 0;
#endif
/* Create the DCEs */
DCE_Init();
......@@ -76,10 +77,15 @@ USER_InitApp(int hInstance)
queueSize = GetProfileInt( "windows", "DefaultQueueSize", 8 );
if (!SetMessageQueue( queueSize )) return 0;
/* Create desktop window */
if (!WIN_CreateDesktopWindow()) return 0;
#if 1
#ifndef WINELIB
/* Initialize DLLs */
InitializeLoadedDLLs();
#endif
#endif
return 1;
}
/*
* based on Windows Sockets 1.1 specs
* (ftp.microsoft.com:/Advsys/winsock/spec11/WINSOCK.TXT)
*
* (C) 1993,1994 John Brezak, Erik Bos.
*/
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#if defined(__FreeBSD__)
#include <netinet/in.h>
#endif
#include <arpa/inet.h>
#include <errno.h>
#include <netdb.h>
#include <unistd.h>
#include "winsock.h"
#define DEBUG_WINSOCK
......@@ -47,12 +48,12 @@ WORD errno_to_wsaerrno(int errno)
sys_errlist[errno], errno);
#else
fprintf(stderr, "winsock: errno_to_wsaerrno translation failure.\n\t: %s (%d)\n",
strerror [errno], errno);
strerror[errno], errno);
#endif
#else
fprintf (stderr, "winsock: errno_to_wsaerrno translation failure.\n");
#endif
break;
return WSAENETDOWN;
}
}
......
......@@ -4,8 +4,12 @@ MODULE = miscemu
SRCS = \
emulate.c \
int10.c \
int1a.c \
int21.c \
int25.c \
int26.c \
ioports.c \
kernel.c
OBJS = $(SRCS:.c=.o)
......
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 <stdlib.h>
#include <stdio.h>
#include "prototypes.h"
#include "regfunc.h"
......@@ -13,9 +15,6 @@ struct Win87EmInfoStruct {
unsigned short Unused;
};
int
WIN87_fpmath()
{
......@@ -49,5 +48,3 @@ WIN87_WinEm87Save(void *pWin87EmSaveArea, int cbWin87EmSaveArea)
{
printf( "__WinEm87Save(%p,%d)\n",pWin87EmSaveArea,cbWin87EmSaveArea);
}
#include <stdio.h>
#include "msdos.h"
#include "wine.h"
static void Barf(struct sigcontext_struct *context)
{
fprintf(stderr, "int10: unknown/not implemented parameters:\n");
fprintf(stderr, "int10: AX %04x, BX %04x, CX %04x, DX %04x, "
"SI %04x, DI %04x, DS %04x, ES %04x\n",
AX, BX, CX, DX, SI, DI, DS, ES);
}
int do_int10(struct sigcontext_struct *context)
{
switch((context->sc_eax >> 8) & 0xff)
{
case 0x0f:
EAX = (EAX & 0xffffff00) | 0x5b;
break;
case 0x12:
if ((EBX & 0xff) == 0x10) {
EBX = (EBX & 0xffff0000) | 0x0003;
ECX = (ECX & 0xffff0000) | 0x0009;
}
break;
case 0x1a:
EBX = (EBX & 0xffff0000) | 0x0008;
break;
default:
Barf(context);
};
return 1;
}
#include <time.h>
#include <stdio.h>
#include "msdos.h"
#include "wine.h"
#ifdef linux
......
#include <stdio.h>
#include "msdos.h"
#include "wine.h"
int do_int25(struct sigcontext_struct *context)
{
BYTE *dataptr = pointer(DS, BX);
DWORD begin, length;
if( (ECX & 0xffff) == 0xffff)
{
begin = getdword(dataptr);
length = getword(&dataptr[4]);
dataptr = (BYTE *) getdword(&dataptr[6]);
fprintf(stderr, "int25: abs diskread, drive %d, sector %d, "
"count %d, buffer %d\n", EAX & 0xff, begin, length, (int) dataptr);
}
begin = EDX & 0xffff;
length = ECX & 0xffff;
fprintf(stderr,"int25: abs diskread-2, drive %d, sector %d, count %d,"
" buffer %d\n", EAX & 0xff, begin, length, (int) dataptr);
ResetCflag;
return 1;
}
#include <stdio.h>
#include "msdos.h"
#include "wine.h"
int do_int26(struct sigcontext_struct *context)
{
BYTE *dataptr = pointer(DS, BX);
DWORD begin, length;
if( (ECX & 0xffff) == 0xffff)
{
begin = getdword(dataptr);
length = getword(&dataptr[4]);
dataptr = (BYTE *) getdword(&dataptr[6]);
fprintf(stderr, "int26: abs diskread, drive %d, sector %d, "
"count %d, buffer %d\n", EAX & 0xff, begin, length, (int) dataptr);
}
begin = EDX & 0xffff;
length = ECX & 0xffff;
fprintf(stderr,"int26: abs diskread-2, drive %d, sector %d, count %d,"
" buffer %d\n", EAX & 0xff, begin, length, (int) dataptr);
ResetCflag;
return 1;
}
#include <stdio.h>
#include <time.h>
#include "msdos.h"
#include "wine.h"
static BYTE cmosaddress;
static BYTE cmosimage[64] = {
0x27, 0x34, 0x31, 0x47, 0x16, 0x15, 0x00, 0x01,
0x04, 0x94, 0x26, 0x02, 0x50, 0x80, 0x00, 0x00,
0x40, 0xb1, 0x00, 0x9c, 0x01, 0x80, 0x02, 0x00,
0x1c, 0x00, 0x00, 0xad, 0x02, 0x10, 0x00, 0x00,
0x08, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x03, 0x58,
0x00, 0x1c, 0x19, 0x81, 0x00, 0x0e, 0x00, 0x80,
0x1b, 0x7b, 0x21, 0x00, 0x00, 0x00, 0x05, 0x5f };
void inportb(struct sigcontext_struct *context)
{
fprintf(stderr, "IO: inb (%x)\n", EDX & 0xffff);
switch(EDX & 0xffff)
{
case 0x70:
EAX = (EAX & 0xffffff00L) | cmosaddress;
break;
case 0x71:
EAX = (EAX & 0xffffff00L) | cmosimage[cmosaddress & 0x3f];
break;
default:
}
}
void inport(struct sigcontext_struct *context)
{
fprintf(stderr, "IO: in (%x)\n", EDX & 0xffff);
EAX = (EAX & 0xffff0000L) | 0xffff;
}
void outportb(struct sigcontext_struct *context)
{
fprintf(stderr, "IO: outb (%x), %x\n", EDX & 0xffff, EAX & 0xff);
switch (EDX & 0xffff)
{
case 0x70:
cmosaddress = EAX & 0xff;
break;
case 0x71:
cmosimage[cmosaddress & 0x3f] = EAX & 0xff;
break;
default:
}
}
void outport(struct sigcontext_struct *context)
{
fprintf(stderr, "IO: out (%x), %x\n", EDX & 0xffff, EAX & 0xffff);
}
......@@ -16,7 +16,8 @@ SRCS = \
clipping.c \
bitblt.c \
linedda.c \
color.c
color.c \
dither.c
OBJS = \
bitmap.o \
......@@ -32,7 +33,8 @@ OBJS = \
clipping.o \
bitblt.o \
linedda.o \
color.o
color.o \
dither.o
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget()
......
......@@ -314,7 +314,7 @@ BOOL StretchBlt( HDC hdcDest, short xDest, short yDest, short widthDest, short h
sxi = XGetImage(display, dcSrc->u.x.drawable, xs1, ys1,
widthSrc, heightSrc, AllPlanes, ZPixmap);
dxi = XCreateImage(display, DefaultVisualOfScreen(screen),
DefaultDepthOfScreen(screen), ZPixmap,
screenDepth, ZPixmap,
0, NULL, widthDest, heightDest,
32, 0);
dxi->data = malloc(dxi->bytes_per_line * heightDest);
......
......@@ -7,6 +7,8 @@
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "gdi.h"
#include "bitmap.h"
#include "prototypes.h"
#define NB_HATCH_STYLES 6
......@@ -21,7 +23,8 @@ static char HatchBrushes[NB_HATCH_STYLES][8] =
{ 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81 } /* HS_DIAGCROSS */
};
extern XImage * BITMAP_BmpToImage( BITMAP *, void * );
extern WORD COLOR_ToPhysical( DC *dc, COLORREF color );
/***********************************************************************
* CreateBrushIndirect (GDI.50)
......@@ -57,23 +60,21 @@ HBRUSH CreateHatchBrush( short style, COLORREF color )
HBRUSH CreatePatternBrush( HBITMAP hbitmap )
{
LOGBRUSH logbrush = { BS_PATTERN, 0, 0 };
BITMAPOBJ * bmpObj;
BITMAP * bmp;
BITMAPOBJ *bmp, *newbmp;
#ifdef DEBUG_GDI
printf( "CreatePatternBrush: %d\n", hbitmap );
#endif
/* Make a copy of the bitmap */
if (!(bmpObj = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC )))
if (!(bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC )))
return 0;
if (!(bmp = (BITMAP *) GlobalLock( bmpObj->hBitmap ))) return 0;
logbrush.lbHatch = CreateBitmap( bmp->bmWidth, bmp->bmHeight,
bmp->bmPlanes, bmp->bmBitsPixel,
((char *)bmp) + sizeof(BITMAP) );
GlobalUnlock( bmpObj->hBitmap );
if (!logbrush.lbHatch) return 0;
logbrush.lbHatch = CreateBitmapIndirect( &bmp->bitmap );
newbmp = (BITMAPOBJ *) GDI_GetObjPtr( logbrush.lbHatch, BITMAP_MAGIC );
if (!newbmp) return 0;
XCopyArea( display, bmp->pixmap, newbmp->pixmap, BITMAP_GC(bmp),
0, 0, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight, 0, 0 );
return CreateBrushIndirect( &logbrush );
}
......@@ -172,32 +173,46 @@ int BRUSH_GetObject( BRUSHOBJ * brush, int count, LPSTR buffer )
/***********************************************************************
* BRUSH_MakeSolidBrush
*/
static void BRUSH_SelectSolidBrush( DC *dc, COLORREF color )
{
if ((dc->w.bitsPerPixel > 1) && !COLOR_IsSolid( color ))
{
/* Dithered brush */
dc->u.x.brush.pixmap = DITHER_DitherColor( dc, color );
dc->u.x.brush.fillStyle = FillTiled;
dc->u.x.brush.pixel = 0;
}
else
{
/* Solid brush */
dc->u.x.brush.pixel = COLOR_ToPhysical( dc, color );
dc->u.x.brush.fillStyle = FillSolid;
}
}
/***********************************************************************
* BRUSH_SelectPatternBrush
*/
BOOL BRUSH_SelectPatternBrush( DC * dc, HBITMAP hbitmap )
static BOOL BRUSH_SelectPatternBrush( DC * dc, HBITMAP hbitmap )
{
BITMAPOBJ * bmpObjPtr;
BITMAP * bmp;
bmpObjPtr = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
if (!bmpObjPtr) return FALSE;
if (!(bmp = (BITMAP *) GlobalLock( bmpObjPtr->hBitmap ))) return FALSE;
dc->u.x.brush.pixmap = XCreatePixmap( XT_display,
DefaultRootWindow(XT_display),
8, 8, bmp->bmBitsPixel );
BITMAP_CopyToPixmap( bmp, dc->u.x.brush.pixmap, 0, 0, 8, 8 );
BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
if (!bmp) return FALSE;
dc->u.x.brush.pixmap = XCreatePixmap( display, rootWindow,
8, 8, bmp->bitmap.bmBitsPixel );
XCopyArea( display, bmp->pixmap, dc->u.x.brush.pixmap,
BITMAP_GC(bmp), 0, 0, 8, 8, 0, 0 );
if (bmp->bmBitsPixel > 1)
if (bmp->bitmap.bmBitsPixel > 1)
{
dc->u.x.brush.fillStyle = FillTiled;
XSetTile( XT_display, dc->u.x.gc, dc->u.x.brush.pixmap );
dc->u.x.brush.pixel = 0; /* Ignored */
}
else
{
dc->u.x.brush.fillStyle = FillOpaqueStippled;
XSetStipple( XT_display, dc->u.x.gc, dc->u.x.brush.pixmap );
dc->u.x.brush.pixel = -1; /* Special case (see DC_SetupGCForBrush) */
}
return TRUE;
......@@ -218,28 +233,24 @@ HBRUSH BRUSH_SelectObject( HDC hdc, DC * dc, HBRUSH hbrush, BRUSHOBJ * brush )
if (dc->u.x.brush.pixmap)
{
XFreePixmap( XT_display, dc->u.x.brush.pixmap );
XFreePixmap( display, dc->u.x.brush.pixmap );
dc->u.x.brush.pixmap = 0;
}
dc->u.x.brush.style = brush->logbrush.lbStyle;
switch(brush->logbrush.lbStyle)
{
case BS_SOLID:
case BS_NULL:
dc->u.x.brush.pixel = GetNearestPaletteIndex( dc->w.hPalette,
brush->logbrush.lbColor );
dc->u.x.brush.fillStyle = FillSolid;
break;
case BS_SOLID:
BRUSH_SelectSolidBrush( dc, brush->logbrush.lbColor );
break;
case BS_HATCHED:
dc->u.x.brush.pixel = GetNearestPaletteIndex( dc->w.hPalette,
brush->logbrush.lbColor );
dc->u.x.brush.pixmap = XCreateBitmapFromData(XT_display,
DefaultRootWindow(XT_display),
HatchBrushes[brush->logbrush.lbHatch],
8, 8 );
XSetStipple( XT_display, dc->u.x.gc, dc->u.x.brush.pixmap );
dc->u.x.brush.pixel = COLOR_ToPhysical( dc, brush->logbrush.lbColor );
dc->u.x.brush.pixmap = XCreateBitmapFromData( display, rootWindow,
HatchBrushes[brush->logbrush.lbHatch], 8, 8 );
dc->u.x.brush.fillStyle = FillStippled;
break;
......@@ -264,5 +275,3 @@ HBRUSH BRUSH_SelectObject( HDC hdc, DC * dc, HBRUSH hbrush, BRUSHOBJ * brush )
return prevHandle;
}
......@@ -40,7 +40,6 @@ const WIN_DC_INFO DCVAL_defaultValues =
0, /* breakCount */
0, /* breakExtra */
0, /* breakRem */
1, /* planes */
1, /* bitsPerPixel */
MM_TEXT, /* MapMode */
0, /* DCOrgX */
......
/*
* Dithering functions
*
* Copyright 1994 Alexandre Julliard
*/
static char Copyright[] = "Copyright Alexandre Julliard, 1994";
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "gdi.h"
#include "bitmap.h"
/* Levels of each primary */
#define PRIMARY_LEVELS 3
#define TOTAL_LEVELS (PRIMARY_LEVELS*PRIMARY_LEVELS*PRIMARY_LEVELS)
/* Dithering matrix size */
#define MATRIX_SIZE 8
#define MATRIX_SIZE_2 (MATRIX_SIZE*MATRIX_SIZE)
/* Total number of possible levels for a dithered primary color */
#define DITHER_LEVELS (MATRIX_SIZE_2 * (PRIMARY_LEVELS-1) + 1)
/* Dithering matrix */
static const int dither_matrix[MATRIX_SIZE_2] =
{
0, 32, 8, 40, 2, 34, 10, 42,
48, 16, 56, 24, 50, 18, 58, 26,
12, 44, 4, 36, 14, 46, 6, 38,
60, 28, 52, 20, 62, 30, 54, 22,
3, 35, 11, 43, 1, 33, 9, 41,
51, 19, 59, 27, 49, 17, 57, 25,
15, 47, 7, 39, 13, 45, 5, 37,
63, 31, 55, 23, 61, 29, 53, 21
};
/* Mapping between (R,G,B) triples and EGA colors */
static const int EGAmapping[TOTAL_LEVELS] =
{
0, /* 000000 -> 000000 */
4, /* 00007f -> 000080 */
12, /* 0000ff -> 0000ff */
2, /* 007f00 -> 008000 */
6, /* 007f7f -> 008080 */
6, /* 007fff -> 008080 */
10, /* 00ff00 -> 00ff00 */
6, /* 00ff7f -> 008080 */
14, /* 00ffff -> 00ffff */
1, /* 7f0000 -> 800000 */
5, /* 7f007f -> 800080 */
5, /* 7f00ff -> 800080 */
3, /* 7f7f00 -> 808000 */
8, /* 7f7f7f -> 808080 */
7, /* 7f7fff -> c0c0c0 */
3, /* 7fff00 -> 808000 */
7, /* 7fff7f -> c0c0c0 */
7, /* 7fffff -> c0c0c0 */
9, /* ff0000 -> ff0000 */
5, /* ff007f -> 800080 */
13, /* ff00ff -> ff00ff */
3, /* ff7f00 -> 808000 */
7, /* ff7f7f -> c0c0c0 */
7, /* ff7fff -> c0c0c0 */
11, /* ffff00 -> ffff00 */
7, /* ffff7f -> c0c0c0 */
15 /* ffffff -> ffffff */
};
/* Map an EGA index (0..15) to a pixel value */
extern int COLOR_mapEGAPixel[16]; /* in color.c */
#define PIXEL_VALUE(r,g,b) \
COLOR_mapEGAPixel[EGAmapping[((r)*PRIMARY_LEVELS+(g))*PRIMARY_LEVELS+(b)]]
/* X image for building dithered pixmap */
static XImage *ditherImage = NULL;
static char *imageData = NULL;
/***********************************************************************
* DITHER_Init
*
* Create the X image used for dithering.
*/
BOOL DITHER_Init()
{
int bytes_per_line = (screenDepth * MATRIX_SIZE + 7) / 8;
if (!(imageData = (char *) malloc( bytes_per_line * MATRIX_SIZE )))
return FALSE;
ditherImage = XCreateImage( display, DefaultVisualOfScreen(screen),
screenDepth, ZPixmap, 0, imageData,
MATRIX_SIZE, MATRIX_SIZE, 8, bytes_per_line );
return (ditherImage != NULL);
}
/***********************************************************************
* DITHER_DitherColor
*/
Pixmap DITHER_DitherColor( DC *dc, COLORREF color )
{
static COLORREF prevColor = 0xffffffff;
unsigned int x, y;
Pixmap pixmap;
/* printf( "Dither: %x\n", color ); */
if (color != prevColor)
{
int r = GetRValue( color ) * DITHER_LEVELS;
int g = GetGValue( color ) * DITHER_LEVELS;
int b = GetBValue( color ) * DITHER_LEVELS;
const int *pmatrix = dither_matrix;
WORD *mapping = (WORD *) GDI_HEAP_ADDR( dc->u.x.pal.hMapping );
for (y = 0; y < MATRIX_SIZE; y++)
{
for (x = 0; x < MATRIX_SIZE; x++)
{
int d = *pmatrix++ * 256;
int dr = ((r + d) / MATRIX_SIZE_2) / 256;
int dg = ((g + d) / MATRIX_SIZE_2) / 256;
int db = ((b + d) / MATRIX_SIZE_2) / 256;
XPutPixel( ditherImage, x, y, PIXEL_VALUE(dr,dg,db) );
}
}
prevColor = color;
}
pixmap = XCreatePixmap( display, rootWindow,
MATRIX_SIZE, MATRIX_SIZE, screenDepth );
XPutImage( display, pixmap, BITMAP_colorGC, ditherImage, 0, 0,
0, 0, MATRIX_SIZE, MATRIX_SIZE );
return pixmap;
}
......@@ -8,6 +8,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/Xatom.h>
#include "gdi.h"
......@@ -17,7 +18,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
*
* Find a X font matching the logical font.
*/
XFontStruct * FONT_MatchFont( DC * dc, LOGFONT * font )
static XFontStruct * FONT_MatchFont( LOGFONT * font )
{
char pattern[100];
char *family, *weight, *charset;
......@@ -44,8 +45,16 @@ XFontStruct * FONT_MatchFont( DC * dc, LOGFONT * font )
default: family = "*"; break;
}
sprintf( pattern, "-*-%s-%s-%c-normal--*-%d-*-*-%c-%d-%s",
family, weight, slant, height, spacing, width, charset );
/* Width==0 seems not to be a valid wildcard on SGI's, using * instead */
if ( width == 0 )
sprintf( pattern, "-*-%s-%s-%c-normal--*-%d-*-*-%c-*-%s",
family, weight, slant, height, spacing, charset
);
else
sprintf( pattern, "-*-%s-%s-%c-normal--*-%d-*-*-%c-%d-%s",
family, weight, slant, height, spacing, width, charset
);
#ifdef DEBUG_FONT
printf( "FONT_MatchFont: '%s'\n", pattern );
#endif
......@@ -166,13 +175,24 @@ HFONT FONT_SelectObject( DC * dc, HFONT hfont, FONTOBJ * font )
/* Load font if necessary */
if (!font)
{
HFONT hnewfont;
hnewfont = CreateFont(10, 7, 0, 0, FW_DONTCARE,
FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
DEFAULT_QUALITY, FF_DONTCARE, "*" );
font = (FONTOBJ *) GDI_HEAP_ADDR( hnewfont );
}
if ((hfont >= FIRST_STOCK_FONT) && (hfont <= LAST_STOCK_FONT))
stockPtr = &stockFonts[hfont - FIRST_STOCK_FONT];
else stockPtr = NULL;
else
stockPtr = NULL;
if (!stockPtr || !stockPtr->fstruct)
{
fontStruct = FONT_MatchFont( dc, &font->logfont );
fontStruct = FONT_MatchFont( &font->logfont );
}
else
{
......
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment