Commit fb9a919f authored by Alexandre Julliard's avatar Alexandre Julliard

Release 940301

Tue Mar 1 11:30:21 1994 Bob Amstadt (bob@pooh) * [Configure] [*/Imakefile] Created configure script to handle different types of Wine builds. * [Configure] [tools/build.c] [if1632/Imakefile] [Wine.tmpl] Added ability to compile Wine on systems with 14-char filename limit. * [if1632/relay.c] [include/options.h] [misc/main.c] Added -relaydbg option to command line if DEBUG_RELAY is defined. * [loader/selector.c] Fixed bug in GetEntryDLLName() that caused Wine to seg fault. * [memory/heap.c] Fixed LocalInit() to work correctly. * [misc/user.c] Added code to call loaded DLLs' initialization routines. Tue Mar 1 01:01:17 MET 1994 julliard@di.epfl.ch (Alexandre Julliard) * [windows/dce.c] Added clipping of child windows by their parent's client area. * [windows/nonclient.c] Bug fix in NC_DoNCPaint(). * [windows/painting.c] Bug fix in RedrawWindow(). Feb 27, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [mem/atom.c] Bug fix again in ATOM_DeleteAtom() : change LocalFree() by USER_HEAP_FREE(). (Previous patch done Feb 13th had been lost) * [controls/scroll.c] Move bitmaps loading in AllocScrollBar() instead of in WM_CREATE. * [windows/class.c] (sorry Alex ...) There was no bug there "in RegisterClass() : WNDCLASS->lpszClassName was reset to NULL." ^^^^^ * [misc/clipboard.c] --- New File --- New function EnumClipboardFormats(). New function OpenClipboard(). New function CloseClipboard(). New function EmptyClipboard(). New function GetClipboardOwner(). New function GetClipboardViewer(). New function CountClipboardFormats(). New function IsClipboardFormatAvailable(). New function OpenClipboard(). New function GetClipboardData(). New function SetClipboardViewer(). New function EnumClipboardFormats(). New function RegisterClipboardFormat(). New function ChangeClipboardChain(). New function SetClipboardData(). New function GetOpenClipboardWindow(). New function GetPriorityClipboardFormat(). New function GetClipboardFormatName(). Tue Mar 1 20:15:45 1994 Erik Bos <erik@trashcan.hacktic.nl> * [misc/comm.c] bugfix in OpenComm(). Tue Feb 22 18:04:02 1994 Jeffrey Hsu <hsu@freefall.cdrom.com> * [include/winsock.h] The sockproto struct is already defined in <sys/socket.h> * [misc/winsock.c] Need to include <netinet/in.h> for struct in-addr. Use sys_errlist[] instead of strerror[]. *[toolkit/heap.c] ANSI C specifies that the malloc functions are defined in stdlib.h, so we don't need to include malloc.h. *[loader/ldtlib.c] Print informative error message about probable cause of i386_set_ldt() failure and then exit. *[Imakefile] For systems that don't use gmake by default, set the MAKE variable to gmake and propagate it on recursive makes. Take out -li386 for FreeBSD systems and define __FreeBSD__ so Wine can be built with the FreeBSD 1.0.2 compiler. Tue Feb 22 02:52:19 EST 1994 jrichard@cs.uml.edu (John Richardson) * [objects/bitblt.c] Added in three functions to do stretching and compression for WHITEONBLACK, BLACKONWHITE, and color copies. Tue Feb 22 15:01:31 EST 1994 jrichard@cs.uml.edu (John Richardson) * [windows/graphics.c] Added FloodFill and FloodFill_rec. FloodFill_rec is pretty inefficent, but should suffice for now. * [include/windows.h] Changed the x,y paramaters for the FloodFill prototype from ints to shorts Tue Feb 22 00:58:28 MET 1994 julliard@di.epfl.ch (Alexandre Julliard) * [windows/widgets.c] Added desktop window class. * [windows/painting.c] Bug fix in RedrawWindow(). Implemented ExcludeUpdateRgn(). * [windows/win.c] [windows/winpos.c] Implemented desktop window. * [controls/desktop.c] Preliminary desktop window procedure. Feb 20, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [controls/menu.c] New function LoadMenuIndirect(). New function GetMenuCheckMarkDimensions(). * [if1632/user.spec] Entry for DefDlgProc(). * [windows/class.c] Fix bug in RegisterClass() : WNDCLASS->lpszMenuName was reset to NULL. * [windows/win.c] In CreateWindowEx(), if hMenu == 0 then use wndclass->lpszMenuName to load Menu from resource; Mon Feb 21 22:38:28 1994 Erik Bos (erik@trashcan.hacktic.nl) * [loader/library.c] [loader/wine.c] Fixed runing DLL's as main executable problem. * [misc/dos_fs.c] Added wildcard support in DOS_readdir(). * [misc/winsocket.c] Added proper error handling of BSD winsocket functions. * [miscemu/int21.c] KERNEL_DOS3Call renamed to DOS3Call and modified to use do_int21(). * [main/main.c] Added functions for GetVersion, GetWinFlags and GetTimerResolution for libwine.a, SystemParametersInfo() partly implemented. Tue Feb 22 19:00:02 1994 Miguel de Icaza (miguel@xochitl.nuclecu.unam.mx) * [toolkit/winmain.c] Added _WinMain function. Setups the library (calls USER_InitApp). * [toolkit/sup.c] Added load_mz_header, load_ne_header, load_type_info and load_name_info functions. * [toolkit/heap.c] Code cleanup. * [misc/user.c] Moved from loader/misc.c. I hope to put back all the loader functions in the ~loader subdirectory in the future. CUrrently is needed since it has USER_InitApp. * [misc/resource.c] Since WineLib will probably need DLLs (currently it needs Sysres.dll). WineLib will be using much code of the loader again. So I removed some ifdefs that were used by WineLib. Added load_typeinfo and load_nameinfo (and the corresponding functions in [toolkit/sup.c] Added integer convertion functions in the needed places. Added very ugly patch (includes wine.c). In the next release I plan to move back all the loader routines to ~/loader. In the meantime I needed this patch. It doesn't affect any of the emulator code (its ifdefed for WineLib). * [misc/main.c] Cleaned up call to WinMain (now uses [toolkit/winmain.c] Ifdefed argument number checking when compiling the library. * [loader/wine.c] Modified to use load_(mz|ne)_header instead of doing a direct read. When compiling the emulator it still uses the direct read for performance. * [include/wine.h] Prototypes for loading routines. * [include/class.h] Added WINE_PACKED macro instead of __attribute__ ((packed)) * [include/arch.h] Macros for converting integers (Little endian to big-endian). Needed in the Sun to allow loading of DLL files. Mon Feb 14 23:48:09 MET 1994 julliard@di.epfl.ch (Alexandre Julliard) * [windows/clipping.c] Moved everything into windows/painting.c and removed this file. * [windows/message.c] Removed calls to memmove() in MSG_RemoveMsg(). * [windows/nonclient.c] Added WM_GETMINMAXINFO support for window resizing. * [windows/painting.c] Implemented RedrawWindow(). * [windows/scroll.c] Bug fix in ScrollWindowEx(). * [windows/win.c] Moved UpdateWindow() to windows/painting.c. Fri Feb 11 12:41:28 1994 Erik Bos (erik@trashcan.hacktic.nl) * [loader/wine.c] [misc/dos_fs.c] getenv() eq NULL bugfixes. * [misc/comm.c] cfmakeraw changed for SunOS. Feb 13, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [mem/atom.c] Bug fix in ATOM_DeleteAtom() : change LocalFree() by USER_HEAP_FREE(). * [misc/message.c] New function FatalAppExit(). * [objects/font.c] New empty stub SetMapperFlags(). * [controls/menu.c] Better CheckMark & other bitmaps placement. * [windows/graphics.c] New function RoundRect() : calc.exe now working... Tue Feb 15 14:29:37 1994 John Richardson * [objects/bitblt.c] Fixed StretchBlt so it works quicker and faster. It still doesn't use the StretchMode bits for bitmap compression, but that will come soon. Mon Feb 14 13:21:04 1994 Miguel de Icaza (miguel@roxanne.nuclecu.unam.mx) * [include/windows.h,dialog.h,gdi.h] Changed __atribute__ ((packed)) for WINE_PACKED. When compiling the library this is defined as nothing. This gets rid with all the problems compiling under SunOS. Also * [windows/utility.c] Added DebugPrintString. * [toolkit/sup.c] Added hSysRes = 1 definition to resolve externals. Added CallLineDDAProc function (toolkit version). Added toy, and hi ineficient memmove until code in message.c get rewritten. * [objects/gdiobj.c] Ifdefed linux/emulator-dependent code to allow compilation of WineLib. * [misc/winsocket.c] Added ifdef to allow compilation under SunOS. * [misc/resource.c] When compiling the library, the resource file is expected to be in a file called $argv[0].Res. Also the information of the resource is expected to be at offset 0 of the .Res file. * [misc/main.c] Call WinMain with arguments if compiling WineLib. Call shutdown functions (Comm_DeInit, DOS_DeInitFS). Call sync_profiles to preserve changes to .INI files. * [misc/comm.c,dos_fs.c] removed call to atexit(Comm_DeInit) removed call to atexit(DOS_DeInitFS) Shutdown functions are now called from the return of WinMain * removed memorylib subdirectory * moved memory/atom.c to misc/atom.c moved memorylib/heap.c to toolkit/heap.c * [loader/wine.c] Moved DebugPrintString to windows/utility.c * [include/winsock.h] Define SO_DONTLINGER only if it has not been previously defined. * [include/windows.h] added definition for DLGPROC. added definition for LMEM_WINE_ALIGN and other LMEM_* constants. When compiling WineLib WNDPROC is defined with all the parameters to avoid compilation problems. * [include/user.h] When compiling WineLib USER_HEAP_(ALLOC|REALLOC|ADDR|FREE) the calls are translated to the library allocation routines. * [include/gdi.h,user.h] When compiling WineLib GDI_HEAP_(ALLOC|ADDR|FREE) the calls are translated to the library allocation routines. * [include/atom.h] Defined LocalAlign. When compiling the emulator it's translated as a call to LocalAlloc (the original code), when compiling WineLib as a call to LocalAlloc with a WINE-flag called LMEM_WINE_ALIGN (atom.c needs aligned data on a 4 byte boundary). * [misc/file.c] Renamed KERNEL_* functions and fixed prototypes. * [if1632/kernel.spec] Renamed KERNEL_* functions in order to be used by applications using Wine as a library (OpeFile, _lclose, _lread, _lcreate, _llseek, _lopen, _lwrite). * [Makefile] Create library instead of executable when building target libwine.a Tue Feb 8 13:52:11 1994 Miguel de Icaza (miguel@roxanne) * [Makefiles] Use $(CC) instead of cc. Added libwine target. * [include/prototypes] #ifdefed section for WineLib * moved loader/cursor.c to misc/cursor.c moved loader/resource.c to misc/resource.c moved misc/emulate.c to miscemu/emulate.c moved misc/int1a.c to miscemu/int1a.c moved misc/int21.c to miscemu/int21.c moved misc/kernel.c to miscemu/kernel.c moved misc/user.c to miscemu/user.c * [memorylib/heap.c] Heap management for WineLib * [misc/comm.c] Modified to allow compilation under SunOS (#include errno, SunOS doesn't have atexit ()). * [misc/dos_fs.c] Modified to allow compilation under SunOS (#include vfs.h) * [misc/file.c] Modified to allow compilation under SunOS (OPEN_MAX constant, #include unistd.h) * [objects/palette.c] Modified to allow compilation under SunOS (#include limits) * [toolkit/sup.c] WineLib version of CallWindowProc. * [windows/event.c] Typedef XPointer under X11R4 (OpenWindows). * [windows/win.c] When compiling WineLib, use direct callbacks instead of the windows supplied callbacks. Mon Feb 7 22:37:34 MET 1994 julliard@di.epfl.ch (Alexandre Julliard) * [loader/cursor.c] New function CURSOR_SetWinCursor(), for internal use, to set the cursor of a specific window more reliably than with SetCursor(). * [windows/nonclient.c] Better window management. Moving and resizing from the system menu should work now. Added scroll-bar mouse tracking. * [windows/win.c] Moved scroll-bar creation and destruction to defwnd.c. Feb 5, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [windows/nonclient.c] Call to StdDrawMenuBar() during NC's drawing. New NC_TrackMouseMenuBar() function which call MenuButtonDown(), MenuButtonUp() & MenuMouseMove(). * [controls/menu.c] New ChangeMenu() function. Remove permanently old Xt menu code. Make common functions MenuButtonDown(), MenuButtonUp() & MenuMouseMove() for both popups & menubar. * [controls/combo.c] Paint OBM_COMBO directly in combo client. * [controls/listbox.c] Fix bug in multicolumns calculations. * [controls/Makefile] Remove rules for old file 'caption.c'. * [misc/kernel.c] Remove empty stub GetModuleFileName(). * [loader/library.c] New GetModuleHandle() function. New GetModuleUsage() function. New GetModuleFileName() function. * [loader/resource.c] Try to find the bug a missing menu loading ... Not found yet ! * [windows/win.c] Remove old menubar creation. Thu Feb 3 22:30:11 1994 Erik Bos (erik@trashcan.hacktic.nl) * [misc/winsocket.c] More functions added. * [if1632/winsock.spec] [misc/winsocket.c] Added John Brezak's winsock.dll stuff.
parent dba420a7
#! /bin/sh
ALLDEFINES=''
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
else
WINELIB=''
fi
echo -n 'Short filenames (Y/N) [N]? '
read input
if [ "$input" = 'y' -o "$input" = 'Y' ]
then
SHORTNAMES='#define ShortNames -DSHORTNAMES'
ALLDEFINES=$ALLDEFINES -DSHORTNAMES
else
SHORTNAMES=''
fi
echo '/* autoconf.h generated automatically. Run Configure. */' > autoconf.h
echo $WINELIB >> autoconf.h
echo $SHORTNAMES >> autoconf.h
echo "#define AutoDefines $ALLDEFINES" >> autoconf.h
xmkmf -a
#include "autoconf.h"
#include "Wine.tmpl" #include "Wine.tmpl"
#if defined(i386FreeBsd)
MAKE = gmake
CC = gcc -D__FreeBSD__
#endif
DEFINES = AutoDefines -DUSE_READLINE -DWINESTAT
/* /*
* This is the second try at using Imakefiles. There are probably many * This is the second try at using Imakefiles. There are probably many
* problems and things I haven't even considered. I do not have a fixed * problems and things I haven't even considered. I do not have a fixed
...@@ -12,66 +20,76 @@ ...@@ -12,66 +20,76 @@
*/ */
#define IHaveSubdirs #define IHaveSubdirs
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' 'CC=$(CC)' #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' 'CC=$(CC)' 'MAKE=$(MAKE)'\
'DEFINES=$(DEFINES)'
SUBDIRS = \ COMMONSUBDIRS = \
tools \
controls \ controls \
etc \ etc \
if1632 \
include \ include \
loader \
memory \
misc \ misc \
objects \ objects \
test \ test \
windows windows
/* EMUSUBDIRS = \
* due to me not having the time and resources to test this, debugging tools \
* has been left out by for now of the Imakefiles. To put it back you have debugger \
* to add: if1632 \
* debugger loader \
* to the SUBDIRS list and: memory \
* debugger miscemu
* readline.o
* to the OBJS list. LIBSUBDIRS = \
* toolkit
* Not doing this will make the build fail in loader/signal.c, with an
* unresolved reference to wine_debug. Comment out the line for now...
* sigh. Fixed soon.
*/
WINEDIR = $(LIBDIR)/wine WINEDIR = $(LIBDIR)/wine
OBJS = \ COMMONOBJS = \
if1632.o \
controls.o \ controls.o \
loader.o \
memory.o \
misc.o \ misc.o \
objects.o \ objects.o \
windows.o windows.o
#ifdef i386BsdArchitecture /*
SYSLIBS = -ll -lm -li386 -lgnumalloc * WARNING: if1632.o must be the first object file because its code must be
* linked at the lowest possible addresses.
*/
EMUOBJS = \
if1632.o \
debugger.o \
loader.o \
memory.o \
miscemu.o \
readline.o
LIBOBJS = \
toolkit.o
#ifndef WINELIB
SUBDIRS = $(COMMONSUBDIRS) $(EMUSUBDIRS)
OBJS = $(COMMONOBJS) $(EMUOBJS)
#else #else
#ifdef LinuxArchitecture SUBDIRS = $(COMMONSUBDIRS) $(LIBSUBDIRS)
SYSLIBS = -lm OBJS = $(COMMONOBJS) $(LIBOBJS)
#endif #endif
#if defined(i386BsdArchitecture)
SYSLIBS = -ll -lm -li386 -lgnumalloc
#elif defined(i386FreeBsd)
SYSLIBS = -ll -lm -lgnumalloc
#elif defined(LinuxArchitecture)
SYSLIBS = -lm -lg
#endif #endif
MakeSubdirs($(SUBDIRS)) MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS))
#ifdef i386BsdArchitecture
AllTarget(wine) AllTarget(wine)
#endif
NormalProgramTarget(wine,$(OBJS),XawClientDepLibs,XawClientLibs,$(SYSLIBS))
#ifdef LinuxArchitecture #ifndef WINELIB
AllTarget(wine) NormalProgramTarget(wine,$(EMUOBJS) $(COMMONOBJS),$(DEPXLIB),$(XLIB),$(SYSLIBS))
#else
NormalLibraryTarget(wine,$(LIBOBJS) $(COMMONOBJS))
#endif #endif
depend:: depend::
......
######################################################################
# These variables are inherited by the sub-makefiles
DEBUGOPTS=
COPTS=-O2 -m486
INCLUDE_DIR=include
LDFLAGS=
######################################################################
# These definitions are for the top level
TARGET=wine
LIBS=-L/usr/X386/lib -lX11 -lm
OBJS=if1632/if1632.o controls/controls.o loader/loader.o \
memory/memory.o misc/misc.o objects/objects.o windows/windows.o debugger/debugger.o
SUBDIRS=if1632 controls loader memory misc objects windows debugger
TAGFILES=if1632/{*.c,*.S} controls/{*.c,*.S} loader/{*.c,*.S} \
memory/{*.c,*.S} misc/{*.c,*.S} objects/{*.c,*.S} \
windows/{*.c,*.S} debugger/{*.c,*.S}
all: $(TARGET)
dummy:
tags:
etags $(TAGFILES)
clean:
rm -f *~ *.o *#
@for i in tools $(SUBDIRS); do (cd $$i && $(MAKE) clean) || exit; done
patchclean:
rm -f `find . -name '*.orig' -o -name '*.rej'`
$(TARGET): dummy
@for i in tools $(SUBDIRS); \
do (cd $$i && echo $$i && $(MAKE) INCLUDE_DIR=../$(INCLUDE_DIR) \
COPTS="$(COPTS)" DEBUGOPTS="$(DEBUGOPTS)") || exit; done
$(CC) $(LDFLAGS) -o $(TARGET) $(OBJS) $(LIBS)
depend:
@for i in tools $(SUBDIRS); \
do (cd $$i && echo $$i && \
$(MAKE) INCLUDE_DIR=../$(INCLUDE_DIR) COPTS="$(COPTS)" depend) \
|| exit; done
...@@ -4,23 +4,16 @@ LICENSE unless explicitly stated in the individual source file. ...@@ -4,23 +4,16 @@ LICENSE unless explicitly stated in the individual source file.
INSTALLATION: INSTALLATION:
Linux: You must have one of:
Uncompress and untar this archive into the directory of your Linux version 0.99.13 or above
choice. This release requires a Linux version 0.99 pl13 kernel NetBSD-current
or above. FreeBSD-current or FreeBSD 1.1
NetBSD: To build Wine, first do a "./Configure" and then a "make". The
If you use BSD make rather than GNU make, you must apply the patches
in the file "bsdmake.patch". This release requires NetBSD-current.
All:
To build Wine, first do a "make depend" and then a "make". The
executable "wine" will be built. "wine" will load and run Windows' executable "wine" will be built. "wine" will load and run Windows'
executables. You must have a file "wine.ini" in the current directory, executables. You must have a file "wine.ini" in the current directory,
your homedirectory, or in the path specified by the environment your home directory, or in the path specified by the environment
variable WINEPATH. Multiple directories in WINEPATH should be seperated variable WINEPATH. Multiple directories in WINEPATH should be seperated
by semi-colons and NOT by colons! by semi-colons and NOT by colons!
...@@ -41,6 +34,31 @@ For example: to run Windows' solitaire: ...@@ -41,6 +34,31 @@ For example: to run Windows' solitaire:
Have a nice game of solitaire, but be careful. Emulation isn't perfect. Have a nice game of solitaire, but be careful. Emulation isn't perfect.
So, occassionally it will crash. So, occassionally it will crash.
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.
- Clipboard functions!
- and more...
WHAT'S NEW with Wine-940223: (see ChangeLog for details)
- FreeBSD support
- FloodFill()
- Desktop window support
- Menu fixes
- and more...
WHAT'S NEW with Wine-940216: (see ChangeLog for details)
- Many many bug fixes
- Switched to using Imakefile's instead of Makefile's.
- Lot's of changes for libwine.a
WHAT'S NEW with Wine-940209: (see ChangeLog for details)
- Many many bug fixes
- Minor directory structure reorganization
- New GetModule*() functions.
- WINSOCK DLL
- First stab at Wine as a library
WHAT'S NEW with Wine-940201: (see ChangeLog for details) WHAT'S NEW with Wine-940201: (see ChangeLog for details)
- Support for huge data structures. - Support for huge data structures.
- FreeBSD support. - FreeBSD support.
......
...@@ -6,13 +6,22 @@ XCOMM Imake rules go here ...@@ -6,13 +6,22 @@ XCOMM Imake rules go here
XCOMM First, dll description to files etc XCOMM First, dll description to files etc
#ifndef MakeDllFromSpec #ifndef MakeDllFromSpec
#ifndef ShortNames
#define MakeDllFromSpec(name,objfile) @@\ #define MakeDllFromSpec(name,objfile) @@\
objfile.o: Concat(dll_,name.o) Concat3(dll_,name,_tab.o) @@\ 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 @@\ Concat(dll_,name.S) Concat3(dll_,name,_tab.c): name.spec $(TOP)/tools/build @@\
$(TOP)/tools/build name.spec @@\ $(TOP)/tools/build name.spec @@\
#endif #else
#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 @@\
$(TOP)/tools/build name.spec @@\
#endif /* SHORTNAMES */
#endif /* MakeDllFromSpec */
/* /*
* WineRelocatableTarget - generate rules to produce a relocatable object * WineRelocatableTarget - generate rules to produce a relocatable object
......
/* autoconf.h generated automatically. Run Configure. */
#error You must run Configure before you can build the makefiles.
*** Makefile.orig Tue Jan 18 12:36:47 1994
--- Makefile Mon Jan 24 22:34:06 1994
***************
*** 8,14 ****
######################################################################
# These definitions are for the top level
TARGET=wine
! LIBS=-L/usr/X386/lib -lX11 -lm
OBJS=if1632/if1632.o controls/controls.o loader/loader.o \
memory/memory.o misc/misc.o objects/objects.o windows/windows.o debugger/debugger.o
SUBDIRS=if1632 controls loader memory misc objects windows debugger
--- 8,14 ----
######################################################################
# These definitions are for the top level
TARGET=wine
! LIBS=-L/usr/X386/lib -lX11 -lm -li386 -lgnumalloc -ll
OBJS=if1632/if1632.o controls/controls.o loader/loader.o \
memory/memory.o misc/misc.o objects/objects.o windows/windows.o debugger/debugger.o
SUBDIRS=if1632 controls loader memory misc objects windows debugger
diff -ruN ../Backup//controls/Makefile ./controls/Makefile
--- ../Backup//controls/Makefile Sat Sep 11 22:13:44 1993
+++ ./controls/Makefile Thu Sep 16 10:00:24 1993
@@ -14,6 +14,7 @@
depend:
$(CC) $(CFLAGS) -M *.c > .depend
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
+.if exists(.depend)
+.include ".depend"
+.endif
+
diff -ruN ../Backup//if1632/Makefile ./if1632/Makefile
--- ../Backup//if1632/Makefile Tue Sep 14 08:56:17 1993
+++ ./if1632/Makefile Thu Sep 16 10:00:24 1993
@@ -45,9 +45,9 @@
depend:
$(CC) $(CFLAGS) -M *.c > .depend
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
+.if exists(.depend)
+.include ".depend"
+.endif
diff -ruN ../Backup//loader/Makefile ./loader/Makefile
--- ../Backup//loader/Makefile Sat Sep 11 21:42:05 1993
+++ ./loader/Makefile Thu Sep 16 10:00:24 1993
@@ -13,6 +13,6 @@
depend:
$(CC) $(CFLAGS) -M *.c > .depend
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
+.if exists(.depend)
+.include ".depend"
+.endif
diff -ruN ../Backup//memory/Makefile ./memory/Makefile
--- ../Backup//memory/Makefile Sat Sep 11 21:42:05 1993
+++ ./memory/Makefile Thu Sep 16 10:00:24 1993
@@ -13,6 +13,6 @@
depend:
$(CC) $(CFLAGS) -M *.c > .depend
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
+.if exists(.depend)
+.include ".depend"
+.endif
diff -ruN ../Backup//misc/Makefile ./misc/Makefile
--- ../Backup//misc/Makefile Tue Sep 14 09:17:00 1993
+++ ./misc/Makefile Thu Sep 16 10:00:24 1993
@@ -14,6 +14,6 @@
depend:
$(CC) $(CFLAGS) -M *.c > .depend
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
+.if exists(.depend)
+.include ".depend"
+.endif
diff -ruN ../Backup//objects/Makefile ./objects/Makefile
--- ../Backup//objects/Makefile Tue Sep 14 13:59:04 1993
+++ ./objects/Makefile Thu Sep 16 10:00:24 1993
@@ -14,6 +14,6 @@
depend:
$(CC) $(CFLAGS) -M *.c > .depend
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
+.if exists(.depend)
+.include ".depend"
+.endif
diff -ruN ../Backup//tools/Makefile ./tools/Makefile
--- ../Backup//tools/Makefile Tue Sep 14 09:46:40 1993
+++ ./tools/Makefile Thu Sep 16 10:00:24 1993
@@ -14,6 +14,10 @@
#
# Dependency lists
#
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
+.if exists(.depend)
+.include ".depend"
+.endif
+
+#ifeq (.depend,$(wildcard .depend))
+#include .depend
+#endif
diff -ruN ../Backup//windows/Makefile ./windows/Makefile
--- ../Backup//windows/Makefile Tue Sep 14 08:39:45 1993
+++ ./windows/Makefile Thu Sep 16 10:00:24 1993
@@ -14,6 +14,6 @@
depend:
$(CC) $(CFLAGS) -M *.c > .depend
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
+.if exists(.depend)
+.include ".depend"
+.endif
--- debugger/Makefile.orig Thu Sep 30 07:29:39 1993
+++ debugger/Makefile Thu Sep 30 07:27:00 1993
@@ -37,3 +37,6 @@
depend: dbg.tab.c dbg.tab.h lex.yy.c
$(CC) $(CFLAGS) -M *.c > .depend
+.if exists(.depend)
+.include ".depend"
+.endif
...@@ -4,23 +4,15 @@ MODULE = controls ...@@ -4,23 +4,15 @@ MODULE = controls
SRCS = \ SRCS = \
button.c \ button.c \
caption.c \
combo.c \ combo.c \
listbox.c \ listbox.c \
menu.c \ menu.c \
scroll.c \ scroll.c \
static.c \ static.c \
desktop.c \
widgets.c widgets.c
OBJS = \ OBJS = $(SRCS:.c=.o)
button.o \
caption.o \
combo.o \
listbox.o \
menu.o \
scroll.o \
static.o \
widgets.o
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS)) WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget() DependTarget()
......
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
OBJS = menu.o caption.o widgets.o button.o \
scroll.o listbox.o combo.o static.o
default: controls.o
controls.o: $(OBJS)
$(LD) -r -o controls.o $(OBJS)
clean:
rm -f *.o *~ *.s dll_* *.a *#
depend:
$(CC) $(CFLAGS) -M *.c > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif
/*
* Interface code to CAPTION widget
*
* Copyright Martin Ayotte, 1994
*
*/
/*
#define DEBUG_CAPTION
*/
static char Copyright[] = "Copyright Martin Ayotte, 1994";
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include "windows.h"
#include "caption.h"
#include "heap.h"
#include "win.h"
#include <sys/types.h>
#include <dirent.h>
#include <sys/stat.h>
HBITMAP hStdClose = (HBITMAP)NULL;
HBITMAP hStdCloseD = (HBITMAP)NULL;
HBITMAP hStdMinim = (HBITMAP)NULL;
HBITMAP hStdMinimD = (HBITMAP)NULL;
HBITMAP hStdMaxim = (HBITMAP)NULL;
HBITMAP hStdMaximD = (HBITMAP)NULL;
HMENU hStdSysMenu = (HMENU)NULL;
LPHEADCAPTION CaptionBarGetWindowAndStorage(HWND hWnd, WND **wndPtr);
LPHEADCAPTION CaptionBarGetStorageHeader(HWND hWnd);
void SetMenuLogicalParent(HMENU hMenu, HWND hWnd);
/***********************************************************************
* CaptionBarWndProc
*/
LONG CaptionBarWndProc( HWND hWnd, WORD message, WORD wParam, LONG lParam )
{
WORD wRet;
short x, y;
short width, height;
WND *wndPtr;
LPHEADCAPTION lphs;
PAINTSTRUCT ps;
HDC hDC;
HDC hMemDC;
BITMAP bm;
RECT rect;
char str[128];
switch(message)
{
case WM_CREATE:
wndPtr = WIN_FindWndPtr(hWnd);
lphs = (LPHEADCAPTION)malloc(sizeof(HEADCAPTION));
if (lphs == 0) {
printf("Bad Memory Alloc on CAPTIONBAR !\n");
return 0;
}
memset(lphs, 0, sizeof(HEADCAPTION));
#ifdef DEBUG_CAPTION
printf("CreateCaptionBarStruct %lX !\n", lphs);
#endif
*((LPHEADCAPTION *)&wndPtr->wExtra[1]) = lphs;
if (hStdClose == (HBITMAP)NULL)
hStdClose = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_CLOSE));
lphs->hClose = hStdClose;
if (hStdMinim == (HBITMAP)NULL)
hStdMinim = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_REDUCE));
lphs->hMinim = hStdMinim;
if (hStdMaxim == (HBITMAP)NULL)
hStdMaxim = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RESTORE));
lphs->hMaxim = hStdMaxim;
if (hStdCloseD == (HBITMAP)NULL)
hStdCloseD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_CLOSE));
if (hStdMinimD == (HBITMAP)NULL)
hStdMinimD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_REDUCED));
if (hStdMaximD == (HBITMAP)NULL)
hStdMaximD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RESTORED));
if (hStdSysMenu == (HBITMAP)NULL)
hStdSysMenu = LoadMenu((HINSTANCE)NULL, "SYSMENU");
lphs->hSysMenu = hStdSysMenu;
printf("CaptionBar SYSMENU %04X !\n", lphs->hSysMenu);
if (lphs->hSysMenu == 0) lphs->hSysMenu = CreatePopupMenu();
AppendMenu(lphs->hSysMenu, MF_STRING, 9999, "About &Wine ...");
GetClientRect(hWnd, &rect);
CopyRect(&lphs->rectClose, &rect);
CopyRect(&lphs->rectMaxim, &rect);
lphs->rectClose.right = lphs->rectClose.left +
lphs->rectClose.bottom + lphs->rectClose.top;
lphs->rectMaxim.left = lphs->rectMaxim.right -
lphs->rectMaxim.bottom + lphs->rectMaxim.top;
CopyRect(&lphs->rectMinim, &lphs->rectMaxim);
if (lphs->hMaxim != 0) {
lphs->rectMinim.left = lphs->rectMaxim.bottom + lphs->rectMaxim.top;
lphs->rectMinim.right = lphs->rectMaxim.bottom + lphs->rectMaxim.top;
}
if (lphs->hClose == 0) lphs->rectClose.right = lphs->rectClose.left;
printf("CAPTION Close.right=%d Maxim.left=%d Minim.left=%d !\n",
lphs->rectClose.right, lphs->rectMaxim.left, lphs->rectMinim.left);
return 0;
case WM_DESTROY:
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
if (lphs == 0) return 0;
#ifdef DEBUG_CAPTION
printf("CaptionBar WM_DESTROY %lX !\n", lphs);
#endif
DestroyMenu(lphs->hSysMenu);
free(lphs);
*((LPHEADCAPTION *)&wndPtr->wExtra[1]) = 0;
return 0;
case WM_COMMAND:
#ifdef DEBUG_CAPTION
printf("CaptionBar WM_COMMAND %04X %08X !\n", wParam, lParam);
#endif
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
if (wParam == 9999) {
printf("CaptionBar Show 'About Wine ...' !\n");
}
SendMessage(wndPtr->hwndParent, message, wParam, lParam);
break;
case WM_SIZE:
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
width = LOWORD(lParam);
height = HIWORD(lParam);
if (lphs->hClose != 0)
SetRect(&lphs->rectClose, 0, 0, height, height);
if (lphs->hMinim != 0) {
if (lphs->hMaxim != 0)
SetRect(&lphs->rectMinim, width - 2 * height, 0,
width - height, height);
else
SetRect(&lphs->rectMinim, width - height, 0, width, height);
}
if (lphs->hMaxim != 0)
SetRect(&lphs->rectMaxim, width - height, 0, width, height);
break;
case WM_LBUTTONDOWN:
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
SetCapture(hWnd);
x = LOWORD(lParam);
y = HIWORD(lParam);
hDC = GetDC(hWnd);
if (x > lphs->rectClose.left && x < lphs->rectClose.right) {
lphs->hClose = hStdCloseD;
InvalidateRect(hWnd, &lphs->rectClose, TRUE);
UpdateWindow(hWnd);
}
if (x > lphs->rectMinim.left && x < lphs->rectMinim.right) {
lphs->hMinim = hStdMinimD;
InvalidateRect(hWnd, &lphs->rectMinim, TRUE);
UpdateWindow(hWnd);
}
if (x > lphs->rectMaxim.left && x < lphs->rectMaxim.right &&
lphs->hMaxim != 0) {
lphs->hMaxim = hStdMaximD;
InvalidateRect(hWnd, &lphs->rectMaxim, TRUE);
UpdateWindow(hWnd);
}
ReleaseDC(hWnd, hDC);
break;
case WM_LBUTTONUP:
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
ReleaseCapture();
#ifdef DEBUG_CAPTION
printf("CaptionBar WM_LBUTTONUP %lX !\n", lParam);
#endif
x = LOWORD(lParam);
y = HIWORD(lParam);
if (x > lphs->rectClose.left && x < lphs->rectClose.right) {
lphs->hClose = hStdClose;
InvalidateRect(hWnd, &lphs->rectClose, TRUE);
UpdateWindow(hWnd);
TrackPopupMenu(lphs->hSysMenu, TPM_LEFTBUTTON, 0, -20,
0, wndPtr->hwndParent, (LPRECT)NULL);
SetMenuLogicalParent(lphs->hSysMenu, hWnd);
printf("CAPTION Pop the SYSMENU !\n");
break;
}
if (x > lphs->rectMinim.left && x < lphs->rectMinim.right) {
SendMessage(wndPtr->hwndParent, WM_SYSCOMMAND, SC_MINIMIZE, 0L);
lphs->hMinim = hStdMinim;
InvalidateRect(hWnd, &lphs->rectMinim, TRUE);
UpdateWindow(hWnd);
printf("CAPTION Minimize Window !\n");
break;
}
if (x > lphs->rectMaxim.left && x < lphs->rectMaxim.right) {
lphs->hMaxim = hStdMaxim;
InvalidateRect(hWnd, &lphs->rectMaxim, TRUE);
UpdateWindow(hWnd);
SendMessage(wndPtr->hwndParent, WM_SYSCOMMAND, SC_MAXIMIZE, 0L);
printf("CAPTION Maximize Window !\n");
break;
}
break;
case WM_LBUTTONDBLCLK:
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
#ifdef DEBUG_CAPTION
printf("CaptionBar WM_LBUTTONDBLCLK %lX !\n", lParam);
#endif
x = LOWORD(lParam);
y = HIWORD(lParam);
if (x > lphs->rectClose.left && x < lphs->rectClose.right) {
SendMessage(wndPtr->hwndParent, WM_SYSCOMMAND, SC_CLOSE, 0L);
printf("CAPTION DoubleClick Close Window !\n");
break;
}
break;
case WM_KEYDOWN:
case WM_KEYUP:
case WM_CHAR:
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
return(SendMessage(wndPtr->hwndParent, message, wParam, lParam));
case WM_PAINT:
GetWindowRect(hWnd, &rect);
#ifdef DEBUG_CAPTION
printf("CaptionBar WM_PAINT left=%d top=%d right=%d bottom=%d !\n",
rect.left, rect.top, rect.right, rect.bottom);
#endif
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
hDC = BeginPaint(hWnd, &ps);
hMemDC = CreateCompatibleDC(hDC);
if (lphs->hClose != 0) {
GetObject(lphs->hClose, sizeof(BITMAP), (LPSTR)&bm);
SelectObject(hMemDC, lphs->hClose);
BitBlt(hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
}
if (lphs->hMinim != 0) {
GetObject(lphs->hMinim, sizeof(BITMAP), (LPSTR)&bm);
SelectObject(hMemDC, lphs->hMinim);
BitBlt(hDC, lphs->rectMinim.left, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
}
if (lphs->hMaxim != 0) {
GetObject(lphs->hMaxim, sizeof(BITMAP), (LPSTR)&bm);
SelectObject(hMemDC, lphs->hMaxim);
BitBlt(hDC, lphs->rectMaxim.left, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
}
DeleteDC(hMemDC);
GetClientRect(hWnd, &rect);
FrameRect(hDC, &rect, GetStockObject(BLACK_BRUSH));
rect.left = lphs->rectClose.right;
rect.right = lphs->rectMinim.left;
#ifdef DEBUG_CAPTION
printf("CaptionBar WM_PAINT left=%d top=%d right=%d bottom=%d !\n",
rect.left, rect.top, rect.right, rect.bottom);
#endif
FillRect(hDC, &rect, GetStockObject(GRAY_BRUSH));
if (GetWindowTextLength(wndPtr->hwndParent) > 0) {
GetWindowText(wndPtr->hwndParent, str, sizeof(str));
width = GetTextExtent(hDC, str, strlen(str));
DrawText(hDC, str, -1, &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
}
EndPaint(hWnd, &ps);
break;
default:
return DefWindowProc( hWnd, message, wParam, lParam );
}
return(0);
}
LPHEADCAPTION CaptionBarGetWindowAndStorage(HWND hWnd, WND **wndPtr)
{
WND *Ptr;
LPHEADCAPTION lphs;
*(wndPtr) = Ptr = WIN_FindWndPtr(hWnd);
if (Ptr == 0) {
printf("Bad Window handle on CaptionBar !\n");
return 0;
}
lphs = *((LPHEADCAPTION *)&Ptr->wExtra[1]);
return lphs;
}
LPHEADCAPTION CaptionBarGetStorageHeader(HWND hWnd)
{
WND *wndPtr;
LPHEADCAPTION lphs;
wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr == 0) {
printf("Bad Window handle on CaptionBar !\n");
return 0;
}
lphs = *((LPHEADCAPTION *)&wndPtr->wExtra[1]);
return lphs;
}
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
static char Copyright[] = "Copyright Martin Ayotte, 1993"; static char Copyright[] = "Copyright Martin Ayotte, 1993";
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include "windows.h" #include "windows.h"
#include "combo.h" #include "combo.h"
#include "heap.h" #include "heap.h"
...@@ -39,8 +37,7 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -39,8 +37,7 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
int AltState; int AltState;
WND *wndPtr; WND *wndPtr;
LPHEADCOMBO lphc; LPHEADCOMBO lphc;
LPDRAWITEMSTRUCT lpdis; HDC hDC, hMemDC;
HDC hMemDC;
BITMAP bm; BITMAP bm;
char str[128]; char str[128];
PAINTSTRUCT paintstruct; PAINTSTRUCT paintstruct;
...@@ -48,47 +45,48 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -48,47 +45,48 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
switch(message) switch(message)
{ {
case WM_CREATE: case WM_CREATE:
ShowScrollBar(hwnd, SB_BOTH, FALSE);
GetClientRect(hwnd, &rect);
width = rect.right - rect.left;
height = rect.bottom - rect.top;
/* SetWindowPos(hwnd, 0, 0, 0, width, 16,
SWP_NOMOVE | SWP_NOZORDER); */
CreateComboStruct(hwnd);
wndPtr = WIN_FindWndPtr(hwnd); wndPtr = WIN_FindWndPtr(hwnd);
lphc = ComboGetStorageHeader(hwnd); if (wndPtr == NULL) return 0;
if (lphc == NULL) return 0;
#ifdef DEBUG_COMBO #ifdef DEBUG_COMBO
printf("Combo WM_CREATE %lX !\n", lphc); printf("Combo WM_CREATE %lX !\n", lphc);
#endif #endif
if (hComboBit == (HBITMAP)NULL) if (hComboBit == (HBITMAP)NULL)
hComboBit = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_COMBO)); hComboBit = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_COMBO));
lphc->hWndDrop = CreateWindow("BUTTON", "", GetObject(hComboBit, sizeof(BITMAP), (LPSTR)&bm);
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_OWNERDRAW, wndPtr->dwStyle &= 0xFFFFFFFFL ^ (WS_VSCROLL | WS_HSCROLL);
width - 16, 0, 16, 16, hwnd, 1, wndPtr->hInstance, 0L); GetWindowRect(hwnd, &rect);
width = rect.right - rect.left;
height = rect.bottom - rect.top;
SetWindowPos(hwnd, 0, 0, 0, width + bm.bmHeight, bm.bmHeight,
SWP_NOMOVE | SWP_NOZORDER);
CreateComboStruct(hwnd);
lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
if (wndPtr->dwStyle & CBS_SIMPLE) if (wndPtr->dwStyle & CBS_SIMPLE)
/* lphc->hWndEdit = CreateWindow("EDIT", "", */ /* lphc->hWndEdit = CreateWindow("EDIT", "", */
lphc->hWndEdit = CreateWindow("STATIC", "", lphc->hWndEdit = CreateWindow("STATIC", "",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | SS_LEFT, WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | SS_LEFT,
0, 0, width - 16, 16, hwnd, 1, wndPtr->hInstance, 0L); 0, 0, width - bm.bmHeight, bm.bmHeight,
hwnd, 1, wndPtr->hInstance, 0L);
else else
lphc->hWndEdit = CreateWindow("STATIC", "", lphc->hWndEdit = CreateWindow("STATIC", "",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | SS_LEFT, WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | SS_LEFT,
0, 0, width - 16, 16, hwnd, 1, wndPtr->hInstance, 0L); 0, 0, width - bm.bmHeight, bm.bmHeight,
hwnd, 1, wndPtr->hInstance, 0L);
lphc->hWndLBox = CreateWindow("LISTBOX", "", lphc->hWndLBox = CreateWindow("LISTBOX", "",
WS_CHILD | WS_CLIPCHILDREN | WS_BORDER | WS_VSCROLL | LBS_NOTIFY, WS_CHILD | WS_CLIPCHILDREN | WS_BORDER | WS_VSCROLL | LBS_NOTIFY,
wndPtr->rectClient.left, wndPtr->rectClient.top + 16, width, height, wndPtr->rectClient.left, wndPtr->rectClient.top + bm.bmHeight,
wndPtr->hwndParent, 1, wndPtr->hInstance, (LPSTR)MAKELONG(0, hwnd)); width, height, wndPtr->hwndParent, 1,
wndPtr->hInstance, (LPSTR)MAKELONG(0, hwnd));
ShowWindow(lphc->hWndLBox, SW_HIDE); ShowWindow(lphc->hWndLBox, SW_HIDE);
#ifdef DEBUG_COMBO #ifdef DEBUG_COMBO
printf("Combo Creation Drop=%X LBox=%X!\n", lphc->hWndDrop, lphc->hWndLBox); printf("Combo Creation LBox=%X!\n", lphc->hWndLBox);
#endif #endif
return 0; return 0;
case WM_DESTROY: case WM_DESTROY:
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == 0) return 0; if (lphc == 0) return 0;
/* /*
DestroyWindow(lphc->hWndDrop);
DestroyWindow(lphc->hWndEdit); DestroyWindow(lphc->hWndEdit);
*/ */
DestroyWindow(lphc->hWndLBox); DestroyWindow(lphc->hWndLBox);
...@@ -106,30 +104,6 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -106,30 +104,6 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
wndPtr = WIN_FindWndPtr(hwnd); wndPtr = WIN_FindWndPtr(hwnd);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
if (LOWORD(lParam) == lphc->hWndDrop) {
if (HIWORD(lParam) != BN_CLICKED) return 0;
#ifdef DEBUG_COMBO
printf("CB_SHOWDROPDOWN !\n");
#endif
lphc->dwState = lphc->dwState ^ CB_SHOWDROPDOWN;
if ((lphc->dwState & CB_SHOWDROPDOWN) == CB_SHOWDROPDOWN) {
ShowWindow(lphc->hWndLBox, SW_SHOW);
/*
SetFocus(lphc->hWndLBox);
*/
}
else {
/*
SetFocus(lphc->hWndEdit);
*/
ShowWindow(lphc->hWndLBox, SW_HIDE);
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
if (y != LB_ERR) {
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str);
SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str);
}
}
}
if (LOWORD(lParam) == lphc->hWndLBox) { if (LOWORD(lParam) == lphc->hWndLBox) {
switch(HIWORD(lParam)) switch(HIWORD(lParam))
{ {
...@@ -153,13 +127,39 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -153,13 +127,39 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
break; break;
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
printf("Combo WM_LBUTTONDOWN wParam=%x lParam=%lX !\n", wParam, lParam); printf("Combo WM_LBUTTONDOWN wParam=%x lParam=%lX !\n", wParam, lParam);
GetClientRect(hwnd, &rect);
rect.left = rect.right - (rect.bottom - rect.top);
hDC = GetDC(hwnd);
InflateRect(&rect, -1, -1);
DrawReliefRect(hDC, rect, 1, 1);
ReleaseDC(hwnd, hDC);
wndPtr = WIN_FindWndPtr(hwnd); wndPtr = WIN_FindWndPtr(hwnd);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
lphc->dwState = lphc->dwState ^ CB_SHOWDROPDOWN; lphc->dwState = lphc->dwState ^ CB_SHOWDROPDOWN;
if ((lphc->dwState & CB_SHOWDROPDOWN) == CB_SHOWDROPDOWN) if ((lphc->dwState & CB_SHOWDROPDOWN) == CB_SHOWDROPDOWN)
ShowWindow(lphc->hWndLBox, SW_SHOW); ShowWindow(lphc->hWndLBox, SW_SHOW);
else {
/*
SetFocus(lphc->hWndEdit);
*/
ShowWindow(lphc->hWndLBox, SW_HIDE);
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
if (y != LB_ERR) {
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str);
SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str);
}
}
break;
case WM_LBUTTONUP:
printf("Combo WM_LBUTTONUP wParam=%x lParam=%lX !\n", wParam, lParam);
GetClientRect(hwnd, &rect);
rect.left = rect.right - (rect.bottom - rect.top);
hDC = GetDC(hwnd);
InflateRect(&rect, -1, -1);
DrawReliefRect(hDC, rect, 1, 0);
ReleaseDC(hwnd, hDC);
break; break;
case WM_KEYDOWN: case WM_KEYDOWN:
wndPtr = WIN_FindWndPtr(hwnd); wndPtr = WIN_FindWndPtr(hwnd);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L); y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
...@@ -206,32 +206,19 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -206,32 +206,19 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
break; break;
case WM_CTLCOLOR: case WM_CTLCOLOR:
return(SendMessage(GetParent(hwnd), WM_CTLCOLOR, wParam, lParam)); return(SendMessage(GetParent(hwnd), WM_CTLCOLOR, wParam, lParam));
case WM_DRAWITEM:
#ifdef DEBUG_SCROLL
printf("ComboBox WM_DRAWITEM w=%04X l=%08X\n", wParam, lParam);
#endif
lpdis = (LPDRAWITEMSTRUCT)lParam;
if (lpdis->CtlType == ODT_BUTTON && lpdis->itemAction == ODA_DRAWENTIRE) {
hMemDC = CreateCompatibleDC(lpdis->hDC);
GetObject(hComboBit, sizeof(BITMAP), (LPSTR)&bm);
SelectObject(hMemDC, hComboBit);
BitBlt(lpdis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
DeleteDC(hMemDC);
}
if (lpdis->CtlType == ODT_BUTTON && lpdis->itemAction == ODA_SELECT) {
CopyRect(&rect, &lpdis->rcItem);
InflateRect(&rect, -1, -1);
DrawReliefRect(lpdis->hDC, rect, 1, 1);
}
break;
case WM_PAINT: case WM_PAINT:
BeginPaint( hwnd, &paintstruct ); GetClientRect(hwnd, &rect);
EndPaint( hwnd, &paintstruct ); hDC = BeginPaint(hwnd, &paintstruct);
hMemDC = CreateCompatibleDC(hDC);
GetObject(hComboBit, sizeof(BITMAP), (LPSTR)&bm);
SelectObject(hMemDC, hComboBit);
BitBlt(hDC, rect.right - bm.bmWidth, 0,
bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
DeleteDC(hMemDC);
EndPaint(hwnd, &paintstruct);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
InvalidateRect(lphc->hWndEdit, NULL, TRUE); InvalidateRect(lphc->hWndEdit, NULL, TRUE);
UpdateWindow(lphc->hWndEdit); UpdateWindow(lphc->hWndEdit);
InvalidateRect(lphc->hWndDrop, NULL, TRUE);
UpdateWindow(lphc->hWndDrop);
if ((lphc->dwState & CB_SHOWDROPDOWN) == CB_SHOWDROPDOWN) { if ((lphc->dwState & CB_SHOWDROPDOWN) == CB_SHOWDROPDOWN) {
InvalidateRect(lphc->hWndLBox, NULL, TRUE); InvalidateRect(lphc->hWndLBox, NULL, TRUE);
UpdateWindow(lphc->hWndLBox); UpdateWindow(lphc->hWndLBox);
......
/*
* Desktop window class.
*
* Copyright 1994 Alexandre Julliard
*/
static char Copyright[] = "Copyright Alexandre Julliard, 1994";
#include "windows.h"
LONG DesktopWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam )
{
/* Most messages are ignored (we DON'T call DefWindowProc) */
switch(message)
{
}
return 0;
}
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
static char Copyright[] = "Copyright Martin Ayotte, 1993"; static char Copyright[] = "Copyright Martin Ayotte, 1993";
#include <stdio.h> #include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <dirent.h> #include <dirent.h>
...@@ -87,14 +85,11 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -87,14 +85,11 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
SetScrollRange(hwnd, SB_HORZ, 1, 1, TRUE); SetScrollRange(hwnd, SB_HORZ, 1, 1, TRUE);
ShowScrollBar(hwnd, SB_HORZ, FALSE); ShowScrollBar(hwnd, SB_HORZ, FALSE);
} }
if (wndPtr->hCursor == (HCURSOR)NULL)
wndPtr->hCursor = LoadCursor((HINSTANCE)NULL, IDC_ARROW);
return 0; return 0;
case WM_DESTROY: case WM_DESTROY:
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr); lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
if (lphl == 0) return 0; if (lphl == 0) return 0;
ListBoxResetContent(hwnd); ListBoxResetContent(hwnd);
DestroyCursor(wndPtr->hCursor);
free(lphl); free(lphl);
*((LPHEADLIST *)&wndPtr->wExtra[1]) = 0; *((LPHEADLIST *)&wndPtr->wExtra[1]) = 0;
#ifdef DEBUG_LISTBOX #ifdef DEBUG_LISTBOX
...@@ -496,6 +491,19 @@ void StdDrawListBox(HWND hwnd) ...@@ -496,6 +491,19 @@ void StdDrawListBox(HWND hwnd)
lphl->ItemsPerColumn = ipc = 0; lphl->ItemsPerColumn = ipc = 0;
for(i = 1; i <= lphl->ItemsCount; i++) { for(i = 1; i <= lphl->ItemsCount; i++) {
if (i >= lphl->FirstVisible) { if (i >= lphl->FirstVisible) {
if (lpls == NULL) break;
if ((h + lpls->dis.rcItem.bottom - lpls->dis.rcItem.top) > rect.bottom) {
if ((wndPtr->dwStyle & LBS_MULTICOLUMN) == LBS_MULTICOLUMN) {
lphl->ItemsPerColumn = max(lphl->ItemsPerColumn, ipc);
ipc = 0;
h = 0;
rect.left += lphl->ColumnsWidth;
rect.right += lphl->ColumnsWidth;
if (rect.left > maxwidth) break;
}
else
break;
}
h2 = lpls->dis.rcItem.bottom - lpls->dis.rcItem.top; h2 = lpls->dis.rcItem.bottom - lpls->dis.rcItem.top;
lpls->dis.rcItem.top = h; lpls->dis.rcItem.top = h;
lpls->dis.rcItem.bottom = h + h2; lpls->dis.rcItem.bottom = h + h2;
...@@ -512,18 +520,6 @@ void StdDrawListBox(HWND hwnd) ...@@ -512,18 +520,6 @@ void StdDrawListBox(HWND hwnd)
h += h2; h += h2;
lphl->ItemsVisible++; lphl->ItemsVisible++;
ipc++; ipc++;
if (h > rect.bottom) {
if ((wndPtr->dwStyle & LBS_MULTICOLUMN) == LBS_MULTICOLUMN) {
lphl->ItemsPerColumn = max(lphl->ItemsPerColumn, ipc);
ipc = 0;
h = 0;
rect.left += lphl->ColumnsWidth;
rect.right += lphl->ColumnsWidth;
if (rect.left > maxwidth) break;
}
else
break;
}
} }
if (lpls->lpNext == NULL) goto EndOfPaint; if (lpls->lpNext == NULL) goto EndOfPaint;
lpls = (LPLISTSTRUCT)lpls->lpNext; lpls = (LPLISTSTRUCT)lpls->lpNext;
...@@ -624,7 +620,7 @@ EndOfPaint: ...@@ -624,7 +620,7 @@ EndOfPaint:
int ListBoxFindMouse(HWND hwnd, int X, int Y) int ListBoxFindMouse(HWND hwnd, int X, int Y)
{ {
WND *wndPtr; WND *wndPtr;
LPHEADLIST lphl; LPHEADLIST lphl;
LPLISTSTRUCT lpls; LPLISTSTRUCT lpls;
RECT rect; RECT rect;
......
...@@ -6,8 +6,7 @@ ...@@ -6,8 +6,7 @@
static char Copyright[] = "Copyright Alexandre Julliard, 1993"; static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "windows.h" #include "win.h"
#include "dialog.h"
LONG ButtonWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ); LONG ButtonWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam );
...@@ -16,6 +15,7 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ); ...@@ -16,6 +15,7 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam );
LONG ListBoxWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam ); LONG ListBoxWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
LONG ComboBoxWndProc ( 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 PopupMenuWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
LONG DesktopWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
static WNDCLASS WIDGETS_BuiltinClasses[] = static WNDCLASS WIDGETS_BuiltinClasses[] =
...@@ -32,6 +32,8 @@ static WNDCLASS WIDGETS_BuiltinClasses[] = ...@@ -32,6 +32,8 @@ static WNDCLASS WIDGETS_BuiltinClasses[] =
0, 0, 0, 0, NULL, "COMBOBOX" }, 0, 0, 0, 0, NULL, "COMBOBOX" },
{ CS_GLOBALCLASS, (LONG(*)())PopupMenuWndProc, 0, 8, { CS_GLOBALCLASS, (LONG(*)())PopupMenuWndProc, 0, 8,
0, 0, 0, 0, NULL, "POPUPMENU" }, 0, 0, 0, 0, NULL, "POPUPMENU" },
{ CS_GLOBALCLASS, (LONG(*)())DesktopWndProc, 0, 0,
0, 0, 0, 0, NULL, DESKTOP_CLASS_NAME },
{ CS_GLOBALCLASS, (LONG(*)())DefDlgProc, 0, DLGWINDOWEXTRA, { CS_GLOBALCLASS, (LONG(*)())DefDlgProc, 0, DLGWINDOWEXTRA,
0, 0, 0, 0, NULL, DIALOG_CLASS_NAME } 0, 0, 0, 0, NULL, DIALOG_CLASS_NAME }
}; };
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
MODULE = debugger MODULE = debugger
DEFINES = -DUSE_READLINE
SUBDIRS = readline SUBDIRS = readline
/* Quick and dirt hack, since i386 is defined as 1. sigh */ /* Quick and dirt hack, since i386 is defined as 1. sigh */
......
CFLAGS=-g -I../include -DUSE_READLINE ${COPTS}
LIBS= readline/libedit.a
OBJS=dbg.tab.o hash.o lex.yy.o info.o i386-pinsn.o
#YACC=bison -v -d
YACC=yacc -b dbg -d
#LEX=flex
LEX=lex
debugger.o: ${OBJS} readline/libedit.a
(cd readline; make)
ld -r -o debugger.o ${OBJS} $(LIBS)
readline/libedit.a:
(cd readline; make)
dbg.tab.o: dbg.tab.c
gcc $(CFLAGS) -DYYDEBUG=1 -c dbg.tab.c
lex.yy.o: lex.yy.c
gcc $(CFLAGS) -I. -c lex.yy.c
lex.yy.c: debug.l
${LEX} -I debug.l
dbg.tab.c dbg.tab.h: dbg.y
${YACC} dbg.y
dtest: dtest.o debugger.o
gcc -o dtest dtest.o debugger.o
clean:
rm -f *.o main dbg.tab.* lex.yy.* *.output *~ *# dtest
(cd readline; make clean)
depend: dbg.tab.c dbg.tab.h lex.yy.c
$(CC) $(CFLAGS) -M *.c > .depend
...@@ -113,6 +113,10 @@ c { return 'c'; } ...@@ -113,6 +113,10 @@ c { return 'c'; }
%% %%
#ifndef yywrap
int yywrap(void) { return 1; }
#endif
#ifdef USE_READLINE #ifdef USE_READLINE
#ifndef whitespace #ifndef whitespace
#define whitespace(c) (((c) == ' ') || ((c) == '\t')) #define whitespace(c) (((c) == ' ') || ((c) == '\t'))
......
## $Revision: 1.3 $
##
## Unix makefile for editline library.
##
## Set your options:
## -DANSI_ARROWS ANSI arrows keys work like emacs.
## -DHAVE_STDLIB Have <stdlib.h>.
## -DHAVE_TCGETATTR Have tcgetattr(), tcsetattr().
## -DHIDE Make static functions static (non debug).
## -DHIST_SIZE=n History size.
## -DNEED_STRDUP Don't have strdup().
## -DUNIQUE_HISTORY Don't save command if same as last one.
## -DUSE_DIRENT Use <dirent.h>, not <sys/dir.h>?
## -DUSE_TERMCAP Use the termcap library for terminal size
## see LDFLAGS, below, if you set this.
## -DNEED_PERROR Don't have perror() (used in testit)
DEFS = -DANSI_ARROWS -DHAVE_TCGETATTR -DHIDE -DUSE_DIRENT -DSYS_UNIX
## Set your C compiler:
WARN = -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wwrite-strings \
-Wunused -Wcomment -Wswitch
CC = gcc -ansi $(WARN)
#CC = cc
CFLAGS = $(DEFS) -O -g
## If you have -DUSE_TERMCAP, set this as appropriate:
#LDFLAGS = -ltermlib
#LDFLAGS = -ltermcap
## Set ranlib as appropriate:
RANLIB = ranlib
#RANLIB = echo
## End of configuration.
SOURCES = editline.c complete.c sysunix.c
OBJECTS = editline.o complete.o sysunix.o
SHARFILES = README Makefile editline.3 editline.h unix.h editline.c \
complete.c sysunix.c testit.c \
Make.os9 os9.h sysos9.c
all: libedit.a
testit: testit.c libedit.a
$(CC) $(CFLAGS) -o testit testit.c libedit.a $(LDFLAGS)
shar: $(SHARFILES)
shar $(SHARFILES) >shar
clean:
rm -f *.[oa] testit foo core tags lint lint.all a.out shar *# *~
lint: testit
lint -a -b -u -x $(DEFS) $(SOURCES) testit.c >lint.all
sed -e '/warning: function prototype not in scope/d' \
-e '/warning: old style argument declaration/'d \
-e '/mix of old and new style function declaration/'d \
<lint.all >lint
libedit.a: $(OBJECTS)
@rm -f $@
ar r $@ $(OBJECTS)
$(RANLIB) $@
$(OBJECTS): editline.h
#include "../autoconf.h"
#include "../Wine.tmpl" #include "../Wine.tmpl"
MODULE = if1632 MODULE = if1632
...@@ -28,6 +29,7 @@ MakeDllFromSpec(sound,$(TOP)/$(MODULE)) ...@@ -28,6 +29,7 @@ MakeDllFromSpec(sound,$(TOP)/$(MODULE))
MakeDllFromSpec(unixlib,$(TOP)/$(MODULE)) MakeDllFromSpec(unixlib,$(TOP)/$(MODULE))
MakeDllFromSpec(user,$(TOP)/$(MODULE)) MakeDllFromSpec(user,$(TOP)/$(MODULE))
MakeDllFromSpec(win87em,$(TOP)/$(MODULE)) MakeDllFromSpec(win87em,$(TOP)/$(MODULE))
MakeDllFromSpec(winsock,$(TOP)/$(MODULE))
/* /*
* Yes I know *.o is not very clever, but can you do it cleaner ? * Yes I know *.o is not very clever, but can you do it cleaner ?
...@@ -37,7 +39,7 @@ WineRelocatableTarget($(TOP)/$(MODULE),*.o,) ...@@ -37,7 +39,7 @@ WineRelocatableTarget($(TOP)/$(MODULE),*.o,)
$(TOP)/$(MODULE).o: $(OBJS) $(TOP)/$(MODULE).o: $(OBJS)
clean:: clean::
$(RM) dll* $(RM) dll* dtb*
depend:: depend::
......
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
BUILDOBJS=dll_kernel.o dll_user.o dll_gdi.o dll_unixlib.o \
dll_win87em.o dll_shell.o dll_sound.o dll_keyboard.o\
dll_kernel_tab.o dll_user_tab.o dll_gdi_tab.o dll_unixlib_tab.o \
dll_win87em_tab.o dll_shell_tab.o \
dll_sound_tab.o dll_keyboard_tab.o
MUST_BE_LINKED_FIRST=call.o $(BUILDOBJS)
OBJS=$(MUST_BE_LINKED_FIRST) callback.o relay.o
# Uncomment the following 2 lines for use with FreeBSD
# %.o: %.S
# $(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) $(COPTS) -c -o $@ $<
default: if1632.o
if1632.o: $(OBJS)
$(LD) -r -o if1632.o $(OBJS)
clean:
rm -f *.o *~ *.s dll_* *.a *#
dll_kernel.S dll_kernel_tab.c: ../tools/build kernel.spec
../tools/build kernel.spec
dll_user.S dll_user_tab.c: ../tools/build user.spec
../tools/build user.spec
dll_gdi.S dll_gdi_tab.c: ../tools/build gdi.spec
../tools/build gdi.spec
dll_unixlib.S dll_unixlib_tab.c: ../tools/build unixlib.spec
../tools/build unixlib.spec
dll_win87em.S dll_win87em_tab.c: ../tools/build win87em.spec
../tools/build win87em.spec
dll_shell.S dll_shell_tab.c: ../tools/build shell.spec
../tools/build shell.spec
dll_sound.S dll_sound_tab.c: ../tools/build sound.spec
../tools/build sound.spec
dll_keyboard.S dll_keyboard_tab.c: ../tools/build keyboard.spec
../tools/build keyboard.spec
depend:
$(CC) $(CFLAGS) -M *.c > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif
...@@ -102,11 +102,11 @@ _CallToInit16: ...@@ -102,11 +102,11 @@ _CallToInit16:
movw %ax,%ss movw %ax,%ss
movl %esp,%eax movl %esp,%eax
movl %eax,%ebp movl %eax,%ebp
#if 1
movw $UDATASEL,%ax movw $UDATASEL,%ax
movw %ax,%fs movw %ax,%fs
movw %ax,%gs movw %ax,%gs
#endif movw %ds,%ax
/* /*
* Call entry point * Call entry point
*/ */
......
...@@ -33,9 +33,12 @@ length 490 ...@@ -33,9 +33,12 @@ length 490
23 pascal Arc(word s_word s_word s_word s_word s_word s_word s_word s_word) 23 pascal Arc(word s_word s_word s_word s_word s_word s_word s_word s_word)
Arc(1 2 3 4 5 6 7 8 9) Arc(1 2 3 4 5 6 7 8 9)
24 pascal Ellipse(word s_word s_word s_word s_word) Ellipse(1 2 3 4 5) 24 pascal Ellipse(word s_word s_word s_word s_word) Ellipse(1 2 3 4 5)
25 pascal FloodFill(word word word long) FloodFill(1 2 3 4)
26 pascal Pie(word s_word s_word s_word s_word s_word s_word s_word s_word) 26 pascal Pie(word s_word s_word s_word s_word s_word s_word s_word s_word)
Pie(1 2 3 4 5 6 7 8 9) Pie(1 2 3 4 5 6 7 8 9)
27 pascal Rectangle(word s_word s_word s_word s_word) Rectangle(1 2 3 4 5) 27 pascal Rectangle(word s_word s_word s_word s_word) Rectangle(1 2 3 4 5)
28 pascal RoundRect(word s_word s_word s_word s_word s_word s_word)
RoundRect(1 2 3 4 5 6 7)
29 pascal PatBlt(word s_word s_word s_word s_word long) PatBlt(1 2 3 4 5 6) 29 pascal PatBlt(word s_word s_word s_word s_word long) PatBlt(1 2 3 4 5 6)
30 pascal SaveDC(word) SaveDC(1) 30 pascal SaveDC(word) SaveDC(1)
31 pascal SetPixel(word s_word s_word long) SetPixel(1 2 3 4) 31 pascal SetPixel(word s_word s_word long) SetPixel(1 2 3 4)
...@@ -135,6 +138,7 @@ length 490 ...@@ -135,6 +138,7 @@ length 490
346 pascal SetTextAlign(word word) SetTextAlign(1 2) 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) 348 pascal Chord(word s_word s_word s_word s_word s_word s_word s_word s_word)
Chord(1 2 3 4 5 6 7 8 9) Chord(1 2 3 4 5 6 7 8 9)
349 pascal SetMapperFlags(word word) SetMapperFlags(1 2)
350 pascal GetCharWidth(word word word ptr) GetCharWidth(1 2 3 4) 350 pascal GetCharWidth(word word word ptr) GetCharWidth(1 2 3 4)
360 pascal CreatePalette(ptr) CreatePalette(1) 360 pascal CreatePalette(ptr) CreatePalette(1)
363 pascal GetPaletteEntries(word word word ptr) GetPaletteEntries(1 2 3 4) 363 pascal GetPaletteEntries(word word word ptr) GetPaletteEntries(1 2 3 4)
......
...@@ -4,7 +4,8 @@ name kernel ...@@ -4,7 +4,8 @@ name kernel
id 1 id 1
length 415 length 415
3 return GetVersion 0 0x301 3 pascal GetVersion() GetVersion()
#return GetVersion 0 0x301
4 pascal LocalInit(word word word) LocalInit(1 2 3) 4 pascal LocalInit(word word word) LocalInit(1 2 3)
5 pascal LocalAlloc(word word) LocalAlloc(1 2) 5 pascal LocalAlloc(word word) LocalAlloc(1 2)
6 pascal LocalReAlloc(word word word) LocalReAlloc(1 2 3) 6 pascal LocalReAlloc(word word word) LocalReAlloc(1 2 3)
...@@ -30,7 +31,10 @@ length 415 ...@@ -30,7 +31,10 @@ length 415
30 pascal WaitEvent(word) KERNEL_WaitEvent(1) 30 pascal WaitEvent(word) KERNEL_WaitEvent(1)
34 pascal SetTaskQueue(word word) SetTaskQueue(1 2) 34 pascal SetTaskQueue(word word) SetTaskQueue(1 2)
35 pascal GetTaskQueue(word) GetTaskQueue(1) 35 pascal GetTaskQueue(word) GetTaskQueue(1)
49 pascal GetModuleFileName(word ptr s_word) KERNEL_GetModuleFileName(1 2 3) 36 pascal GetCurrentTask() GetCurrentTask()
47 pascal GetModuleHandle(ptr) GetModuleHandle(1)
48 pascal GetModuleUsage(word) GetModuleUsage(1)
49 pascal GetModuleFileName(word ptr s_word) GetModuleFileName(1 2 3)
50 pascal GetProcAddress(word ptr) GetProcAddress(1 2) 50 pascal GetProcAddress(word ptr) GetProcAddress(1 2)
51 pascal MakeProcInstance(ptr word) CALLBACK_MakeProcInstance(1 2) 51 pascal MakeProcInstance(ptr word) CALLBACK_MakeProcInstance(1 2)
52 pascal FreeProcInstance(ptr) FreeProcInstance(1) 52 pascal FreeProcInstance(ptr) FreeProcInstance(1)
...@@ -42,13 +46,13 @@ length 415 ...@@ -42,13 +46,13 @@ length 415
62 pascal LockResource(word) LockResource(1) 62 pascal LockResource(word) LockResource(1)
63 pascal FreeResource(word) FreeResource(1) 63 pascal FreeResource(word) FreeResource(1)
64 pascal AccessResource(word word) AccessResource(1 2) 64 pascal AccessResource(word word) AccessResource(1 2)
74 pascal OpenFile(ptr ptr word) KERNEL_OpenFile(1 2 3) 74 pascal OpenFile(ptr ptr word) OpenFile(1 2 3)
81 pascal _lclose(word) KERNEL__lclose(1) 81 pascal _lclose(word) _lclose(1)
82 pascal _lread(word ptr word) KERNEL__lread(1 2 3) 82 pascal _lread(word ptr word) _lread(1 2 3)
83 pascal _lcreate(ptr word) KERNEL__lcreate(1 2) 83 pascal _lcreate(ptr word) _lcreate(1 2)
84 pascal _llseek(word long word) KERNEL__llseek(1 2 3) 84 pascal _llseek(word long word) _llseek(1 2 3)
85 pascal _lopen(ptr word) KERNEL__lopen(1 2) 85 pascal _lopen(ptr word) _lopen(1 2)
86 pascal _lwrite(word ptr word) KERNEL__lwrite(1 2 3) 86 pascal _lwrite(word ptr word) _lwrite(1 2 3)
88 pascal lstrcpy(ptr ptr) lstrcpy(1 2) 88 pascal lstrcpy(ptr ptr) lstrcpy(1 2)
89 pascal lstrcat(ptr ptr) lstrcat(1 2) 89 pascal lstrcat(ptr ptr) lstrcat(1 2)
90 pascal lstrlen(ptr) lstrlen(1) 90 pascal lstrlen(ptr) lstrlen(1)
...@@ -58,10 +62,10 @@ length 415 ...@@ -58,10 +62,10 @@ length 415
92 pascal GetTempDrive(byte) GetTempDrive(1) 92 pascal GetTempDrive(byte) GetTempDrive(1)
95 pascal LoadLibrary(ptr) LoadLibrary(1) 95 pascal LoadLibrary(ptr) LoadLibrary(1)
96 pascal FreeLibrary(word) FreeLibrary(1) 96 pascal FreeLibrary(word) FreeLibrary(1)
97 pascal GetTempFileName(byte ptr word ptr) GetTempDrive(1 2 3 4) 97 pascal GetTempFileName(byte ptr word ptr) GetTempFileName(1 2 3 4)
102 register DOS3Call(word word word word word 102 register DOS3Call(word word word word word
word word word word word) word word word word word)
KERNEL_DOS3Call() DOS3Call()
107 pascal SetErrorMode(word) SetErrorMode(1) 107 pascal SetErrorMode(word) SetErrorMode(1)
111 pascal GlobalWire(word) GlobalLock(1) 111 pascal GlobalWire(word) GlobalLock(1)
112 pascal GlobalUnWire(word) GlobalUnlock(1) 112 pascal GlobalUnWire(word) GlobalUnlock(1)
...@@ -74,10 +78,12 @@ length 415 ...@@ -74,10 +78,12 @@ length 415
129 pascal WritePrivateProfileString(ptr ptr ptr ptr) 129 pascal WritePrivateProfileString(ptr ptr ptr ptr)
WritePrivateProfileString(1 2 3 4) WritePrivateProfileString(1 2 3 4)
131 pascal GetDOSEnvironment() GetDOSEnvironment() 131 pascal GetDOSEnvironment() GetDOSEnvironment()
132 return GetWinFlags 0 0x413 132 pascal GetWinFlags() GetWinFlags()
#132 return GetWinFlags 0 0x413
134 pascal GetWindowsDirectory(ptr word) GetWindowsDirectory(1 2) 134 pascal GetWindowsDirectory(ptr word) GetWindowsDirectory(1 2)
135 pascal GetSystemDirectory(ptr word) GetSystemDirectory(1 2) 135 pascal GetSystemDirectory(ptr word) GetSystemDirectory(1 2)
136 pascal GetDriveType(byte) GetWindowsDirectory(1) 136 pascal GetDriveType(byte) GetWindowsDirectory(1)
137 pascal FatalAppExit(word ptr) FatalAppExit(1 2)
152 return GetNumTasks 0 1 152 return GetNumTasks 0 1
154 return GlobalNotify 4 0 154 return GlobalNotify 4 0
163 pascal GlobalLRUOldest(word) ReturnArg(1) 163 pascal GlobalLRUOldest(word) ReturnArg(1)
......
...@@ -18,10 +18,11 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; ...@@ -18,10 +18,11 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "segmem.h" #include "segmem.h"
#include "prototypes.h" #include "prototypes.h"
#include "dlls.h" #include "dlls.h"
#include "options.h"
/* #define DEBUG_RELAY /* */ #define DEBUG_RELAY /* */
#define N_BUILTINS 8 #define N_BUILTINS 9
struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] = struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] =
{ {
...@@ -33,6 +34,7 @@ struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] = ...@@ -33,6 +34,7 @@ struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] =
{ "SHELL", SHELL_table, 256, 6 }, { "SHELL", SHELL_table, 256, 6 },
{ "SOUND", SOUND_table, 20, 7 }, { "SOUND", SOUND_table, 20, 7 },
{ "KEYBOARD",KEYBOARD_table,137, 8 }, { "KEYBOARD",KEYBOARD_table,137, 8 },
{ "WINSOCK", WINSOCK_table, 155, 9 },
}; };
unsigned short *Stack16Frame; unsigned short *Stack16Frame;
...@@ -87,6 +89,7 @@ DLLRelay(unsigned int func_num, unsigned int seg_off) ...@@ -87,6 +89,7 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
dll_p = &dll_builtin_table[dll_id].dll_table[ordinal]; dll_p = &dll_builtin_table[dll_id].dll_table[ordinal];
#ifdef DEBUG_RELAY #ifdef DEBUG_RELAY
if (Options.relay_debug)
{ {
unsigned int *ret_addr; unsigned int *ret_addr;
unsigned short *stack_p; unsigned short *stack_p;
...@@ -185,10 +188,13 @@ DLLRelay(unsigned int func_num, unsigned int seg_off) ...@@ -185,10 +188,13 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
arg_table[15]); arg_table[15]);
#ifdef DEBUG_RELAY #ifdef DEBUG_RELAY
printf("Returning %08.8x from %s (%s.%d)\n", if (Options.relay_debug)
ret_val, {
dll_p->export_name, printf("Returning %08.8x from %s (%s.%d)\n",
dll_builtin_table[dll_id].dll_name, ordinal); ret_val,
dll_p->export_name,
dll_builtin_table[dll_id].dll_name, ordinal);
}
#endif #endif
return ret_val; return ret_val;
......
...@@ -11,7 +11,7 @@ length 540 ...@@ -11,7 +11,7 @@ length 540
11 pascal SetSystemTimer(word word word ptr) SetSystemTimer(1 2 3 4) 11 pascal SetSystemTimer(word word word ptr) SetSystemTimer(1 2 3 4)
12 pascal KillTimer(word word) KillTimer(1 2) 12 pascal KillTimer(word word) KillTimer(1 2)
13 pascal GetTickCount() GetTickCount() 13 pascal GetTickCount() GetTickCount()
14 return GetTimerResolution 0 1000 14 pascal GetTimerResolution() GetTimerResolution()
15 pascal GetCurrentTime() GetTickCount() 15 pascal GetCurrentTime() GetTickCount()
16 pascal ClipCursor(ptr) ClipCursor(1) 16 pascal ClipCursor(ptr) ClipCursor(1)
17 pascal GetCursorPos(ptr) GetCursorPos(1) 17 pascal GetCursorPos(ptr) GetCursorPos(1)
...@@ -121,9 +121,23 @@ length 540 ...@@ -121,9 +121,23 @@ length 540
134 pascal SetWindowWord(word s_word word) SetWindowWord(1 2 3) 134 pascal SetWindowWord(word s_word word) SetWindowWord(1 2 3)
135 pascal GetWindowLong(word s_word) GetWindowLong(1 2) 135 pascal GetWindowLong(word s_word) GetWindowLong(1 2)
136 pascal SetWindowLong(word s_word long) SetWindowLong(1 2 3) 136 pascal SetWindowLong(word s_word long) SetWindowLong(1 2 3)
137 pascal OpenClipboard(word) OpenClipboard(1)
138 pascal CloseClipboard() CloseClipboard()
139 pascal EmptyClipboard() EmptyClipboard()
140 pascal GetClipboardOwner() GetClipboardOwner()
141 pascal SetClipboardData(word word) SetClipboardData(1 2)
142 pascal GetClipboardData(word) GetClipboardData(1)
143 pascal CountClipboardFormats() CountClipboardFormats()
144 pascal EnumClipboardFormats(word) EnumClipboardFormats(1)
145 pascal RegisterClipboardFormat(ptr) RegisterClipboardFormat(1)
146 pascal GetClipboardFormatName(word ptr s_word) GetClipboardFormatName(1 2 3)
147 pascal SetClipboardViewer(word) SetClipboardViewer(1)
148 pascal GetClipboardViewer() GetClipboardViewer()
149 pascal ChangeClipboardChain(word ptr) ChangeClipboardChain(1 2)
150 pascal LoadMenu(word ptr) LoadMenu(1 2) 150 pascal LoadMenu(word ptr) LoadMenu(1 2)
151 pascal CreateMenu() CreateMenu() 151 pascal CreateMenu() CreateMenu()
152 pascal DestroyMenu(word) DestroyMenu(1) 152 pascal DestroyMenu(word) DestroyMenu(1)
153 pascal ChangeMenu(word word ptr word word) ChangeMenu(1 2 3 4 5)
154 pascal CheckMenuItem(word word word) CheckMenuItem(1 2 3) 154 pascal CheckMenuItem(word word word) CheckMenuItem(1 2 3)
155 pascal EnableMenuItem(word word word) EnableMenuItem(1 2 3) 155 pascal EnableMenuItem(word word word) EnableMenuItem(1 2 3)
156 pascal GetSystemMenu(word word) GetSystemMenu(1 2) 156 pascal GetSystemMenu(word word) GetSystemMenu(1 2)
...@@ -136,7 +150,7 @@ length 540 ...@@ -136,7 +150,7 @@ length 540
165 pascal SetCaretPos(word word) SetCaretPos(1 2) 165 pascal SetCaretPos(word word) SetCaretPos(1 2)
166 pascal HideCaret(word) HideCaret(1) 166 pascal HideCaret(word) HideCaret(1)
167 pascal ShowCaret(word) ShowCaret(1) 167 pascal ShowCaret(word) ShowCaret(1)
166 pascal SetCaretBlinkTime(word) SetCaretBlinkTime(1) 168 pascal SetCaretBlinkTime(word) SetCaretBlinkTime(1)
169 pascal GetCaretBlinkTime() GetCaretBlinkTime() 169 pascal GetCaretBlinkTime() GetCaretBlinkTime()
171 pascal WinHelp(word word long) WinHelp(1 2 3) 171 pascal WinHelp(word word long) WinHelp(1 2 3)
173 pascal LoadCursor(word ptr) LoadCursor(1 2) 173 pascal LoadCursor(word ptr) LoadCursor(1 2)
...@@ -152,6 +166,7 @@ length 540 ...@@ -152,6 +166,7 @@ length 540
183 pascal GetCaretPos(ptr) GetCaretPos(1) 183 pascal GetCaretPos(ptr) GetCaretPos(1)
190 pascal GetUpdateRect(word ptr word) GetUpdateRect(1 2 3) 190 pascal GetUpdateRect(word ptr word) GetUpdateRect(1 2 3)
191 pascal ChildWindowFromPoint(word long) ChildWindowFromPoint(1 2) 191 pascal ChildWindowFromPoint(word long) ChildWindowFromPoint(1 2)
193 pascal IsClipboardFormatAvailable(word) IsClipboardFormatAvailable(1)
200 pascal OpenComm(ptr word word) OpenComm(1 2 3) 200 pascal OpenComm(ptr word word) OpenComm(1 2 3)
201 pascal SetCommState(ptr) SetCommState(1) 201 pascal SetCommState(ptr) SetCommState(1)
202 pascal GetCommState(word ptr) GetCommState(1 2) 202 pascal GetCommState(word ptr) GetCommState(1 2)
...@@ -171,6 +186,7 @@ length 540 ...@@ -171,6 +186,7 @@ length 540
218 pascal DialogBoxIndirect(word word word ptr) DialogBoxIndirect(1 2 3 4) 218 pascal DialogBoxIndirect(word word word ptr) DialogBoxIndirect(1 2 3 4)
219 pascal CreateDialogIndirect(word ptr word ptr) 219 pascal CreateDialogIndirect(word ptr word ptr)
CreateDialogIndirect(1 2 3 4) CreateDialogIndirect(1 2 3 4)
220 pascal LoadMenuIndirect(ptr) LoadMenuIndirect(1)
221 pascal ScrollDC(word s_word s_word ptr ptr word ptr) 221 pascal ScrollDC(word s_word s_word ptr ptr word ptr)
ScrollDC(1 2 3 4 5 6 7) ScrollDC(1 2 3 4 5 6 7)
227 pascal GetNextDlgGroupItem(word word word) GetNextDlgGroupItem(1 2 3) 227 pascal GetNextDlgGroupItem(word word word) GetNextDlgGroupItem(1 2 3)
...@@ -181,6 +197,7 @@ length 540 ...@@ -181,6 +197,7 @@ length 540
SetWindowPos(1 2 3 4 5 6 7) SetWindowPos(1 2 3 4 5 6 7)
236 pascal GetCapture() GetCapture() 236 pascal GetCapture() GetCapture()
237 pascal GetUpdateRgn(word word word) GetUpdateRgn(1 2 3) 237 pascal GetUpdateRgn(word word word) GetUpdateRgn(1 2 3)
238 pascal ExcludeUpdateRgn(word word) ExcludeUpdateRgn(1 2)
239 pascal DialogBoxParam(word ptr word ptr long) DialogBoxParam(1 2 3 4 5) 239 pascal DialogBoxParam(word ptr word ptr long) DialogBoxParam(1 2 3 4 5)
240 pascal DialogBoxIndirectParam(word word word ptr long) 240 pascal DialogBoxIndirectParam(word word word ptr long)
DialogBoxIndirectParam(1 2 3 4 5) DialogBoxIndirectParam(1 2 3 4 5)
...@@ -189,6 +206,7 @@ length 540 ...@@ -189,6 +206,7 @@ length 540
242 pascal CreateDialogIndirectParam(word ptr word ptr long) 242 pascal CreateDialogIndirectParam(word ptr word ptr long)
CreateDialogIndirectParam(1 2 3 4 5) CreateDialogIndirectParam(1 2 3 4 5)
244 pascal EqualRect(ptr ptr) EqualRect(1 2) 244 pascal EqualRect(ptr ptr) EqualRect(1 2)
248 pascal GetOpenClipboardWindow() GetOpenClipboardWindow()
258 pascal MapWindowPoints(word word ptr word) MapWindowPoints(1 2 3 4) 258 pascal MapWindowPoints(word word ptr word) MapWindowPoints(1 2 3 4)
262 pascal GetWindow(word word) GetWindow(1 2) 262 pascal GetWindow(word word) GetWindow(1 2)
266 pascal SetMessageQueue(word) SetMessageQueue(1) 266 pascal SetMessageQueue(word) SetMessageQueue(1)
...@@ -199,6 +217,8 @@ length 540 ...@@ -199,6 +217,8 @@ length 540
283 pascal RealizePalette(word) RealizePalette(1) 283 pascal RealizePalette(word) RealizePalette(1)
286 pascal GetDesktopWindow() GetDesktopWindow() 286 pascal GetDesktopWindow() GetDesktopWindow()
288 pascal GetMessageExtraInfo() GetMessageExtraInfo() 288 pascal GetMessageExtraInfo() GetMessageExtraInfo()
290 pascal RedrawWindow(word ptr word word) RedrawWindow(1 2 3 4)
308 pascal DefDlgProc(word word word long) DefDlgProc(1 2 3 4)
319 pascal ScrollWindowEx(word s_word s_word ptr ptr word ptr word) 319 pascal ScrollWindowEx(word s_word s_word ptr ptr word ptr word)
ScrollWindowEx(1 2 3 4 5 6 7 8) ScrollWindowEx(1 2 3 4 5 6 7 8)
324 pascal FillWindow(word word word word) FillWindow(1 2 3 4) 324 pascal FillWindow(word word word word) FillWindow(1 2 3 4)
...@@ -209,6 +229,8 @@ length 540 ...@@ -209,6 +229,8 @@ length 540
370 pascal GetWindowPlacement(word ptr) GetWindowPlacement(1 2) 370 pascal GetWindowPlacement(word ptr) GetWindowPlacement(1 2)
371 pascal SetWindowPlacement(word ptr) SetWindowPlacement(1 2) 371 pascal SetWindowPlacement(word ptr) SetWindowPlacement(1 2)
373 pascal SubtractRect(ptr ptr ptr) SubtractRect(1 2 3) 373 pascal SubtractRect(ptr ptr ptr) SubtractRect(1 2 3)
402 pascal GetPriorityClipboardFormat(word ptr s_word)
GetPriorityClipboardFormat(1 2 3)
403 pascal UnregisterClass(ptr word) UnregisterClass(1 2) 403 pascal UnregisterClass(ptr word) UnregisterClass(1 2)
404 pascal GetClassInfo(word ptr ptr) GetClassInfo(1 2 3) 404 pascal GetClassInfo(word ptr ptr) GetClassInfo(1 2 3)
406 pascal CreateCursor(word word word word word ptr ptr) 406 pascal CreateCursor(word word word word word ptr ptr)
...@@ -221,6 +243,7 @@ length 540 ...@@ -221,6 +243,7 @@ length 540
415 pascal CreatePopupMenu() CreatePopupMenu() 415 pascal CreatePopupMenu() CreatePopupMenu()
416 pascal TrackPopupMenu(word word word word word word ptr) 416 pascal TrackPopupMenu(word word word word word word ptr)
TrackPopupMenu(1 2 3 4 5 6 7) TrackPopupMenu(1 2 3 4 5 6 7)
417 pascal GetMenuCheckMarkDimensions() GetMenuCheckMarkDimensions()
418 pascal SetMenuItemBitmaps(word word word word word) 418 pascal SetMenuItemBitmaps(word word word word word)
SetMenuItemBitmaps(1 2 3 4 5) SetMenuItemBitmaps(1 2 3 4 5)
420 pascal wsprintf(ptr ptr) wsprintf(1 2) 420 pascal wsprintf(ptr ptr) wsprintf(1 2)
...@@ -246,3 +269,4 @@ length 540 ...@@ -246,3 +269,4 @@ length 540
471 pascal lstrcmpi(ptr ptr) lstrcmpi(1 2) 471 pascal lstrcmpi(ptr ptr) lstrcmpi(1 2)
472 pascal AnsiNext(ptr) AnsiNext(1 ) 472 pascal AnsiNext(ptr) AnsiNext(1 )
473 pascal AnsiPrev(ptr ptr) AnsiPrev(1 2) 473 pascal AnsiPrev(ptr ptr) AnsiPrev(1 2)
483 pascal SystemParametersInfo(word word ptr word) SystemParametersInfo(1 2 3 4)
#
# File: winsock.def
# System: MS-Windows 3.x
# Summary: Module definition file for Windows Sockets DLL.
#
name winsock
id 9
length 155
1 pascal accept(long ptr ptr) Winsock_accept(1 2 3)
2 pascal bind(long ptr word) Winsock_bind(1 2 3)
3 pascal closesocket(long) Winsock_closesocket(1)
4 pascal connect(long ptr word) Winsock_connect(1 2 3)
5 pascal getpeername(long ptr ptr) Winsock_getpeername(1 2 3)
6 pascal getsockname(long ptr ptr) Winsock_getsockname(1 2 3)
7 pascal getsockopt(long word word ptr ptr)
Winsock_getsockopt(1 2 3 4 5)
8 pascal htonl(long) Winsock_htonl(1)
9 pascal htons(word) Winsock_htons(1)
10 pascal inet_addr(ptr) Winsock_inet_addr(1)
11 pascal inet_ntoa(long) Winsock_inet_ntoa(1)
12 pascal ioctlsocket(long long ptr) Winsock_ioctlsocket(1 2 3)
13 pascal listen(long word) Winsock_listen(1 2)
14 pascal ntohl(long) Winsock_ntohl(1)
15 pascal ntohs(word) Winsock_ntohs(1)
16 pascal recv(long ptr word word) Winsock_recv(1 2 3 4)
17 pascal recvfrom(long ptr word word ptr ptr)
Winsock_recvfrom(1 2 3 4 5 6)
18 pascal select(word ptr ptr ptr ptr word)
Winsock_select(1 2 3 4 5 6)
19 pascal send(long ptr word word) Winsock_send(1 2 3 4)
20 pascal sendto(long ptr word word ptr ptr)
Winsock_sendto(1 2 3 4 5 6)
21 pascal setsockopt(long word word ptr word)
Winsock_setsockopt(1 2 3 4 5)
22 pascal shutdown(long word) Winsock_shutdown(1 2)
23 pascal socket(word word word) Winsock_socket(1 2 3)
51 pascal gethostbyaddr(ptr word word) Winsock_gethostbyaddr(1 2 3)
52 pascal gethostbyname(ptr) Winsock_gethostbyname(1)
53 pascal getprotobyname(ptr) Winsock_getprotobyname(1)
54 pascal getprotobynumber(word) Winsock_getprotobynumber(1)
55 pascal getservbyname(ptr) Winsock_getservbyname(1)
56 pascal getservbyport(word ptr) Winsock_getservbyport(1 2)
57 pascal gethostname(ptr word) Winsock_gethostname(1 2)
101 pascal WSAAsyncSelect(long word word long)
WSAAsyncSelect(1 2 3 4)
102 pascal WSAAsyncGetHostByAddr(word word ptr word word ptr word)
WSAAsyncGetHostByAddr(1 2 3 4 5 6 7)
103 pascal WSAAsyncGetHostByName(word word ptr ptr word)
WSAAsyncGetHostByName(1 2 3 4 5)
104 pascal WSAAsyncGetProtoByNumber(word word word ptr word)
WSAAsyncGetProtoByNumber(1 2 3 4 5)
105 pascal WSAAsyncGetProtoByName(word word ptr ptr word)
WSAAsyncGetProtoByName(1 2 3 4 5)
106 pascal WSAAsyncGetServByPort(word word word ptr ptr word)
WSAAsyncGetServByPort(1 2 3 4 5 6)
107 pascal WSAAsyncGetServByName(word word ptr ptr ptr word)
WSAAsyncGetServByName(1 2 3 4 5 6)
108 pascal WSACancelAsyncRequest(word) WSACancelAsyncRequest(1)
109 pascal WSASetBlockingHook() WSASetBlockingHook()
110 pascal WSAUnhookBlockingHook() WSAUnhookBlockingHook()
111 pascal WSAGetLastError() WSAGetLastError()
112 pascal WSASetLastError(word) WSASetLastError(1)
113 pascal WSACancelBlockingCall() WSACancelBlockingCall()
114 pascal WSAIsBlocking() WSAIsBlocking()
115 pascal WSAStartup(word ptr) WSAStartup(1 2)
116 pascal WSACleanup() WSACleanup()
151 pascal __WSAFDIsSet(long ptr) WSAFDIsSet(1 2)
/*
* Machine dependent integer conversions
*
* Copyright Miguel de Icaza, 1994
*/
#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)
#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)
#endif
...@@ -24,4 +24,10 @@ typedef struct ...@@ -24,4 +24,10 @@ typedef struct
HANDLE entries[1]; HANDLE entries[1];
} ATOMTABLE; } ATOMTABLE;
#ifdef WINELIB
#define LocalAlign(flags,bytes) LocalAlloc (flags|LMEM_WINE_ALIGN,bytes)
#else
#define LocalAlign(flags,bytes) LocalAlloc (flags,bytes)
#endif
#endif /* ATOM_H */ #endif /* ATOM_H */
...@@ -19,7 +19,7 @@ typedef struct tagCLASS ...@@ -19,7 +19,7 @@ typedef struct tagCLASS
ATOM atomName; /* Name of the class */ ATOM atomName; /* Name of the class */
HANDLE hdce; /* Class DCE (if CS_CLASSDC) */ HANDLE hdce; /* Class DCE (if CS_CLASSDC) */
WORD cWindows; /* Count of existing windows of this class */ WORD cWindows; /* Count of existing windows of this class */
WNDCLASS wc __attribute__ ((packed)); /* Class information */ WNDCLASS wc WINE_PACKED; /* Class information */
WORD wExtra[1]; /* Class extra bytes */ WORD wExtra[1]; /* Class extra bytes */
} CLASS; } CLASS;
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
typedef struct tagHEADCOMBO { typedef struct tagHEADCOMBO {
DWORD dwStyle; DWORD dwStyle;
DWORD dwState; DWORD dwState;
HWND hWndDrop;
HWND hWndEdit; HWND hWndEdit;
HWND hWndLBox; HWND hWndLBox;
} HEADCOMBO; } HEADCOMBO;
......
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
#include "windows.h" #include "windows.h"
#define DIALOG_CLASS_NAME "#32770" /* Integer atom */
/* Dialog info structure. /* Dialog info structure.
* This structure is stored into the window extra bytes (cbWndExtra). * This structure is stored into the window extra bytes (cbWndExtra).
...@@ -34,11 +32,11 @@ typedef struct ...@@ -34,11 +32,11 @@ typedef struct
typedef struct typedef struct
{ {
DWORD style; DWORD style;
BYTE nbItems __attribute__ ((packed)); BYTE nbItems WINE_PACKED;
WORD x __attribute__ ((packed)); WORD x WINE_PACKED;
WORD y __attribute__ ((packed)); WORD y WINE_PACKED;
WORD cx __attribute__ ((packed)); WORD cx WINE_PACKED;
WORD cy __attribute__ ((packed)); WORD cy WINE_PACKED;
} DLGTEMPLATEHEADER; } DLGTEMPLATEHEADER;
...@@ -50,7 +48,7 @@ typedef struct ...@@ -50,7 +48,7 @@ typedef struct
WORD cx; WORD cx;
WORD cy; WORD cy;
WORD id; WORD id;
DWORD style __attribute__ ((packed)); DWORD style WINE_PACKED;
} DLGCONTROLHEADER; } DLGCONTROLHEADER;
......
...@@ -13,6 +13,9 @@ typedef struct dll_arg_relocation_s ...@@ -13,6 +13,9 @@ typedef struct dll_arg_relocation_s
unsigned char src_type; /* Argument type */ unsigned char src_type; /* Argument type */
} DLL_ARG; } DLL_ARG;
#define DLL 0
#define EXE 1
#define DLL_ARGTYPE_SIGNEDWORD 0 #define DLL_ARGTYPE_SIGNEDWORD 0
#define DLL_ARGTYPE_WORD 1 #define DLL_ARGTYPE_WORD 1
#define DLL_ARGTYPE_LONG 2 #define DLL_ARGTYPE_LONG 2
...@@ -59,5 +62,6 @@ extern struct dll_table_entry_s WIN87EM_table[]; ...@@ -59,5 +62,6 @@ extern struct dll_table_entry_s WIN87EM_table[];
extern struct dll_table_entry_s SHELL_table[]; extern struct dll_table_entry_s SHELL_table[];
extern struct dll_table_entry_s SOUND_table[]; extern struct dll_table_entry_s SOUND_table[];
extern struct dll_table_entry_s KEYBOARD_table[]; extern struct dll_table_entry_s KEYBOARD_table[];
extern struct dll_table_entry_s WINSOCK_table[];
#endif /* DLLS_H */ #endif /* DLLS_H */
...@@ -45,25 +45,25 @@ typedef struct tagGDIOBJHDR ...@@ -45,25 +45,25 @@ typedef struct tagGDIOBJHDR
typedef struct tagBRUSHOBJ typedef struct tagBRUSHOBJ
{ {
GDIOBJHDR header; GDIOBJHDR header;
LOGBRUSH logbrush __attribute__ ((packed)); LOGBRUSH logbrush WINE_PACKED;
} BRUSHOBJ; } BRUSHOBJ;
typedef struct tagPENOBJ typedef struct tagPENOBJ
{ {
GDIOBJHDR header; GDIOBJHDR header;
LOGPEN logpen __attribute__ ((packed)); LOGPEN logpen WINE_PACKED;
} PENOBJ; } PENOBJ;
typedef struct tagPALETTEOBJ typedef struct tagPALETTEOBJ
{ {
GDIOBJHDR header; GDIOBJHDR header;
LOGPALETTE logpalette __attribute__ ((packed)); LOGPALETTE logpalette WINE_PACKED;
} PALETTEOBJ; } PALETTEOBJ;
typedef struct tagFONTOBJ typedef struct tagFONTOBJ
{ {
GDIOBJHDR header; GDIOBJHDR header;
LOGFONT logfont __attribute__ ((packed)); LOGFONT logfont WINE_PACKED;
} FONTOBJ; } FONTOBJ;
typedef struct tagBITMAPOBJ typedef struct tagBITMAPOBJ
...@@ -271,12 +271,21 @@ typedef struct tagDC ...@@ -271,12 +271,21 @@ typedef struct tagDC
/* GDI local heap */ /* GDI local heap */
#ifdef WINELIB
#define GDI_HEAP_ALLOC(f,size) LocalAlloc (f,size)
#define GDI_HEAP_ADDR(handle) LocalLock (handle)
#define GDI_HEAP_FREE(handle) LocalFree (handle)
#else
extern MDESC *GDI_Heap; extern MDESC *GDI_Heap;
#define GDI_HEAP_ALLOC(f,size) ((int)HEAP_Alloc(&GDI_Heap,f,size) & 0xffff) #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))) #define GDI_HEAP_FREE(handle) (HEAP_Free(&GDI_Heap,GDI_HEAP_ADDR(handle)))
#endif
extern HANDLE GDI_AllocObject( WORD, WORD ); extern HANDLE GDI_AllocObject( WORD, WORD );
extern BOOL GDI_FreeObject( HANDLE ); extern BOOL GDI_FreeObject( HANDLE );
......
...@@ -7,6 +7,7 @@ struct dosdirent { ...@@ -7,6 +7,7 @@ struct dosdirent {
DIR *ds; DIR *ds;
char unixpath[256]; char unixpath[256];
char filename[256]; char filename[256];
char filemask[12];
char attribute; char attribute;
long filesize; long filesize;
long filetime; long filetime;
...@@ -35,17 +36,21 @@ struct diskinfo { ...@@ -35,17 +36,21 @@ struct diskinfo {
#define CX (context->sc_ecx & 0x0000ffffL) #define CX (context->sc_ecx & 0x0000ffffL)
#define DX (context->sc_edx & 0x0000ffffL) #define DX (context->sc_edx & 0x0000ffffL)
#define ES context->sc_es #define CS context->sc_cs
#define DS context->sc_ds #define DS context->sc_ds
#define ES context->sc_es
#define DI context->sc_edi #define DI context->sc_edi
#define SI context->sc_esi #define SI context->sc_esi
#define EFL context->sc_efl
#define pointer(a,b) (((unsigned int) a << 16) | b) #define pointer(a,b) (((unsigned int) a << 16) | b)
#define segment(a) (a >> 16) #define segment(a) (a >> 16)
#define offset(a) (a & 0xffff) #define offset(a) (a & 0xffff)
#define SetCflag (context->sc_efl |= 0x00000001L) #define SetCflag (EFL |= 0x00000001L)
#define ResetCflag (context->sc_efl &= 0xfffffffeL) #define ResetCflag (EFL &= 0xfffffffeL)
/* extended error codes */ /* extended error codes */
......
...@@ -6,12 +6,6 @@ ...@@ -6,12 +6,6 @@
#ifndef MENU_H #ifndef MENU_H
#define MENU_H #define MENU_H
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Core.h>
#include <X11/Xaw/Form.h>
#include <X11/Xaw/Command.h>
#include <X11/Xaw/Box.h>
typedef struct tagMENUITEM typedef struct tagMENUITEM
...@@ -25,24 +19,12 @@ typedef struct tagMENUITEM ...@@ -25,24 +19,12 @@ typedef struct tagMENUITEM
WORD sel_key; WORD sel_key;
char *shortcut; char *shortcut;
char *item_text; char *item_text;
Widget w;
Widget menu_w;
char menu_name[10]; char menu_name[10];
RECT rect; RECT rect;
HBITMAP hCheckBit; HBITMAP hCheckBit;
HBITMAP hUnCheckBit; HBITMAP hUnCheckBit;
} MENUITEM, *LPMENUITEM; } MENUITEM, *LPMENUITEM;
typedef struct tagMENUBAR
{
struct tagMENUBAR *next;
HANDLE menuDescription; /* Memory containing menu desc. */
HWND ownerWnd; /* Owner window */
int nItems; /* Number of items on menu */
Widget parentWidget; /* Parent of menu widget */
Widget menuBarWidget; /* Widget to contain menu options */
MENUITEM *firstItem;
} MENUBAR, *LPMENUBAR;
typedef struct tagPOPUPMENU typedef struct tagPOPUPMENU
{ {
...@@ -57,6 +39,9 @@ typedef struct tagPOPUPMENU ...@@ -57,6 +39,9 @@ typedef struct tagPOPUPMENU
BOOL SysFlag; BOOL SysFlag;
WORD Width; WORD Width;
WORD Height; WORD Height;
WORD CheckWidth;
WORD PopWidth;
RECT rect;
} POPUPMENU, *LPPOPUPMENU; } POPUPMENU, *LPPOPUPMENU;
typedef struct typedef struct
...@@ -76,11 +61,12 @@ typedef struct ...@@ -76,11 +61,12 @@ typedef struct
WORD item_flags; /* See windows.h */ WORD item_flags; /* See windows.h */
WORD item_id; /* Control Id for menu item */ WORD item_id; /* Control Id for menu item */
char item_text[1]; /* Text for menu item */ char item_text[1]; /* Text for menu item */
} MENU_NORMALITEM; } MENUITEMTEMPLATE;
extern LPMENUBAR MENU_CreateMenuBar(Widget parent, HANDLE instance, void StdDrawMenuBar(HDC hDC, LPRECT lprect, LPPOPUPMENU lppop);
HWND wnd, char *menu_name, int width); void MenuButtonDown(HWND hWnd, LPPOPUPMENU lppop, int x, int y);
extern LPMENUBAR MENU_UseMenu(Widget parent, HANDLE instance, void MenuButtonUp(HWND hWnd, LPPOPUPMENU lppop, int x, int y);
HWND wnd, HMENU hmenu, int width); void MenuMouseMove(HWND hWnd, LPPOPUPMENU lppop, WORD wParam, int x, int y);
extern void NC_TrackSysMenu(HWND hwnd);
#endif /* MENU_H */ #endif /* MENU_H */
...@@ -27,9 +27,9 @@ struct ne_header_s ...@@ -27,9 +27,9 @@ struct ne_header_s
u_char linker_version; /* Linker version number */ u_char linker_version; /* Linker version number */
u_char linker_revision; /* Linker revision number */ u_char linker_revision; /* Linker revision number */
u_short entry_tab_offset; /* Offset to entry table relative to NE */ u_short entry_tab_offset; /* Offset to entry table relative to NE */
u_short entry_tab_length; /* Length of etnry table in bytes */ u_short entry_tab_length; /* Length of entry table in bytes */
u_long reserved1; /* Reserved by Microsoft */ u_long reserved1; /* Reserved by Microsoft */
u_short format_flags; /* Flags that segments in this file */ u_short format_flags; /* Flags about segments in this file */
u_short auto_data_seg; /* Automatic data segment number */ u_short auto_data_seg; /* Automatic data segment number */
u_short local_heap_length; /* Initial size of local heap */ u_short local_heap_length; /* Initial size of local heap */
u_short stack_length; /* Initial size of stack */ u_short stack_length; /* Initial size of stack */
......
...@@ -13,6 +13,7 @@ struct options ...@@ -13,6 +13,7 @@ struct options
int usePrivateMap; int usePrivateMap;
int synchronous; int synchronous;
short cmdShow; short cmdShow;
int relay_debug;
}; };
extern struct options Options; extern struct options Options;
......
...@@ -7,11 +7,13 @@ ...@@ -7,11 +7,13 @@
#define PROTOTYPES_H #define PROTOTYPES_H
#include <sys/types.h> #include <sys/types.h>
#include "neexe.h" #include "neexe.h"
#include "segmem.h" #include "segmem.h"
#include "wine.h" #include "wine.h"
#include "int21.h" #include "int21.h"
#ifndef WINELIB
extern struct segment_descriptor_s * extern struct segment_descriptor_s *
CreateSelectors(struct w_files *); CreateSelectors(struct w_files *);
...@@ -49,4 +51,6 @@ extern struct dosdirent *DOS_opendir(char *dosdirname); ...@@ -49,4 +51,6 @@ extern struct dosdirent *DOS_opendir(char *dosdirname);
extern struct dosdirent *DOS_readdir(struct dosdirent *de); extern struct dosdirent *DOS_readdir(struct dosdirent *de);
extern void DOS_closedir(struct dosdirent *de); extern void DOS_closedir(struct dosdirent *de);
#endif /* WINELIB */
#endif /* PROTOTYPES_H */ #endif /* PROTOTYPES_H */
...@@ -12,6 +12,15 @@ ...@@ -12,6 +12,15 @@
#include <sys/shm.h> #include <sys/shm.h>
#endif #endif
#if defined(__NetBSD__) || defined(__FreeBSD__)
#define HAVE_IPC
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#define SHMSEG 32 /* XXX SEMMNI /usr/src/sys/conf/param.h */
#define SHM_RANGE_START 0x40000000
#endif
/* /*
* Array to track selector allocation. * Array to track selector allocation.
*/ */
......
...@@ -10,7 +10,15 @@ ...@@ -10,7 +10,15 @@
#include "segmem.h" #include "segmem.h"
#include "heap.h" #include "heap.h"
/* USER local heap */ /* USER local heap */
#ifdef WINELIB
#define USER_HEAP_ALLOC(f,size) LocalAlloc (f, size)
#define USER_HEAP_REALLOC(handle,size,f) LocalReAlloc (handle,size,f)
#define USER_HEAP_ADDR(handle) LocalLock (handle)
#define USER_HEAP_FREE(handle) LocalFree (handle)
#else
extern MDESC *USER_Heap; extern MDESC *USER_Heap;
...@@ -20,4 +28,6 @@ extern MDESC *USER_Heap; ...@@ -20,4 +28,6 @@ extern MDESC *USER_Heap;
#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))) #define USER_HEAP_FREE(handle) (HEAP_Free(&USER_Heap,USER_HEAP_ADDR(handle)))
#endif /* WINELIB */
#endif /* USER_H */ #endif /* USER_H */
...@@ -10,10 +10,15 @@ ...@@ -10,10 +10,15 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include "windows.h" #include "windows.h"
#include "menu.h"
#define WND_MAGIC 0x444e4957 /* 'WIND' */ #define WND_MAGIC 0x444e4957 /* 'WIND' */
/* Built-in class names (see _Undocumented_Windows_ p.418) */
#define POPUPMENU_CLASS_NAME "#32768" /* PopupMenu */
#define DESKTOP_CLASS_NAME "#32769" /* Desktop */
#define DIALOG_CLASS_NAME "#32770" /* Dialog */
#define WINSWITCH_CLASS_NAME "#32771" /* WinSwitch */
#define ICONTITLE_CLASS_NAME "#32772" /* IconTitle */
typedef struct tagWND typedef struct tagWND
{ {
...@@ -37,16 +42,13 @@ typedef struct tagWND ...@@ -37,16 +42,13 @@ typedef struct tagWND
DWORD dwExStyle; /* Extended style (from CreateWindowEx) */ DWORD dwExStyle; /* Extended style (from CreateWindowEx) */
HANDLE hdce; /* Window DCE (if CS_OWNDC or CS_CLASSDC) */ HANDLE hdce; /* Window DCE (if CS_OWNDC or CS_CLASSDC) */
HMENU hmenuSystem; /* System menu */ HMENU hmenuSystem; /* System menu */
HCURSOR hCursor; /* Window Current Cursor */
void *VScroll; /* Vertical ScrollBar Struct Pointer */ void *VScroll; /* Vertical ScrollBar Struct Pointer */
void *HScroll; /* Horizontal ScrollBar Struct Pointer */ void *HScroll; /* Horizontal ScrollBar Struct Pointer */
WORD wIDmenu; /* ID or hmenu (from CreateWindow) */ WORD wIDmenu; /* ID or hmenu (from CreateWindow) */
HANDLE hText; /* Handle of window text */ HANDLE hText; /* Handle of window text */
WORD flags; /* Misc. flags */ WORD flags; /* Misc. flags (see below) */
Window window; /* X window */ Window window; /* X window */
LPMENUBAR menuBarPtr; /* Menu bar */
HMENU hSysMenu; /* window's copy of System Menu */ HMENU hSysMenu; /* window's copy of System Menu */
HWND hWndMenuBar; /* Menu bar */
WORD wExtra[1]; /* Window extra bytes */ WORD wExtra[1]; /* Window extra bytes */
} WND; } WND;
...@@ -58,9 +60,7 @@ typedef struct tagWND ...@@ -58,9 +60,7 @@ typedef struct tagWND
#define WIN_CLASS_DC 0x10 /* Win class has style CS_CLASSDC */ #define WIN_CLASS_DC 0x10 /* Win class has style CS_CLASSDC */
#define WIN_DOUBLE_CLICKS 0x20 /* Win class has style CS_DBLCLKS */ #define WIN_DOUBLE_CLICKS 0x20 /* Win class has style CS_DBLCLKS */
#define WIN_RESTORE_MAX 0x40 /* Maximize when restoring */ #define WIN_RESTORE_MAX 0x40 /* Maximize when restoring */
#define WIN_INTERNAL_PAINT 0x80 /* Internal WM_PAINT message pending */
/* First top-level window */
extern HWND firstWindow;
/* Window functions */ /* Window functions */
WND *WIN_FindWndPtr( HWND hwnd ); WND *WIN_FindWndPtr( HWND hwnd );
...@@ -68,5 +68,7 @@ BOOL WIN_UnlinkWindow( HWND hwnd ); ...@@ -68,5 +68,7 @@ BOOL WIN_UnlinkWindow( HWND hwnd );
BOOL WIN_LinkWindow( HWND hwnd, HWND hwndInsertAfter ); BOOL WIN_LinkWindow( HWND hwnd, HWND hwndInsertAfter );
HWND WIN_FindWinToRepaint( HWND hwnd ); HWND WIN_FindWinToRepaint( HWND hwnd );
extern Display * display;
extern Screen * screen;
#endif /* WIN_H */ #endif /* WIN_H */
...@@ -63,4 +63,9 @@ struct sigcontext_struct { ...@@ -63,4 +63,9 @@ struct sigcontext_struct {
#define HZ 100 #define HZ 100
#endif #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 */ #endif /* WINE_H */
...@@ -3,32 +3,15 @@ ...@@ -3,32 +3,15 @@
MODULE = loader MODULE = loader
SRCS = \ SRCS = \
int1a.c \
int21.c \
dump.c \ dump.c \
files.c \
ldt.c \ ldt.c \
ldtlib.c \ ldtlib.c \
resource.c \
selector.c \ selector.c \
signal.c \ signal.c \
library.c \ library.c \
wine.c \ wine.c
cursor.c
OBJS = \ OBJS = $(SRCS:.c=.o)
int1a.o \
int21.o \
dump.o \
files.o \
ldt.o \
ldtlib.o \
resource.o \
selector.o \
signal.o \
library.o \
wine.o \
cursor.o
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS)) WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget() DependTarget()
......
CFLAGS=$(COPTS) $(DEBUGOPTS) -I../include
OBJS=dump.o ldt.o ldtlib.o resource.o selector.o signal.o library.o \
wine.o cursor.o
default: loader.o
loader.o: $(OBJS)
$(LD) -r -o loader.o $(OBJS)
clean:
rm -f *.o *~ *.s dll_* *.a *#
depend:
$(CC) $(CFLAGS) -M *.c > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif
...@@ -79,9 +79,13 @@ set_ldt_entry(int entry, unsigned long base, unsigned int limit, ...@@ -79,9 +79,13 @@ set_ldt_entry(int entry, unsigned long base, unsigned int limit,
sd = make_sd(base, limit, contents, read_only_flag, seg_32bit_flag, limit_in_pages_flag); sd = make_sd(base, limit, contents, read_only_flag, seg_32bit_flag, limit_in_pages_flag);
ret = i386_set_ldt(entry, (union descriptor *)sd, 1); ret = i386_set_ldt(entry, (union descriptor *)sd, 1);
if (ret < 0) if (ret < 0) {
perror("i386_set_ldt"); perror("i386_set_ldt");
fprintf(stderr,
"Did you reconfigure the kernel with \"options USER_LDT\"?\n");
exit(1);
}
return ret; return ret;
#endif #endif
......
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
...@@ -7,11 +6,73 @@ ...@@ -7,11 +6,73 @@
#include <unistd.h> #include <unistd.h>
#include "prototypes.h" #include "prototypes.h"
#include "windows.h" #include "windows.h"
#include "win.h"
#include "gdi.h"
#include "wine.h" #include "wine.h"
#include "dlls.h"
extern struct w_files * wine_files;
/**********************************************************************
* GetCurrentTask [KERNEL.36]
*/
HTASK GetCurrentTask()
{
int pid = getpid();
printf("GetCurrentTask() returned %d !\n", pid);
return pid;
}
/**********************************************************************
* GetModuleHandle [KERNEL.47]
*/
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;
}
/**********************************************************************
* GetModuleUsage [KERNEL.48]
*/
int GetModuleUsage(HANDLE hModule)
{
struct w_files *w;
printf("GetModuleUsage(%04X);\n", hModule);
w = GetFileInfo(hModule);
/* return w->Usage; */
return 1;
}
/**********************************************************************
* GetModuleFilename [KERNEL.49]
*/
int GetModuleFileName(HANDLE hModule, LPSTR lpFileName, short nSize)
{
struct w_files *w;
printf("GetModuleFileName(%04X, %08X, %d);\n", hModule, lpFileName, nSize);
if (lpFileName == NULL) return 0;
w = GetFileInfo(hModule);
if (w == NULL) return 0;
if (nSize > strlen(w->name)) nSize = strlen(w->name) + 1;
strncpy(lpFileName, w->name, nSize);
printf("GetModuleFileName copied '%s' return %d \n", lpFileName, nSize);
return nSize - 1;
}
/********************************************************************** /**********************************************************************
* LoadLibrary [KERNEL.95] * LoadLibrary [KERNEL.95]
...@@ -20,7 +81,7 @@ HANDLE LoadLibrary(LPSTR libname) ...@@ -20,7 +81,7 @@ HANDLE LoadLibrary(LPSTR libname)
{ {
HANDLE hRet; HANDLE hRet;
printf("LoadLibrary '%s'\n", libname); printf("LoadLibrary '%s'\n", libname);
hRet = LoadImage(libname); hRet = LoadImage(libname, DLL);
printf("after LoadLibrary hRet=%04X\n", hRet); printf("after LoadLibrary hRet=%04X\n", hRet);
return hRet; return hRet;
} }
...@@ -35,3 +96,4 @@ void FreeLibrary(HANDLE hLib) ...@@ -35,3 +96,4 @@ void FreeLibrary(HANDLE hLib)
if (hLib != (HANDLE)NULL) GlobalFree(hLib); if (hLib != (HANDLE)NULL) GlobalFree(hLib);
} }
...@@ -585,7 +585,7 @@ unsigned int GetEntryDLLName(char * dll_name, char * function, int * sel, ...@@ -585,7 +585,7 @@ unsigned int GetEntryDLLName(char * dll_name, char * function, int * sel,
j = GetEntryPointFromOrdinal(wpnt, ordinal); j = GetEntryPointFromOrdinal(wpnt, ordinal);
*addr = j & 0xffff; *addr = j & 0xffff;
j = j >> 16; j = j >> 16;
*sel = wpnt->selector_table[j].selector; *sel = j;
return 0; return 0;
}; };
return 1; return 1;
...@@ -615,12 +615,7 @@ unsigned int GetEntryDLLOrdinal(char * dll_name, int ordinal, int * sel, ...@@ -615,12 +615,7 @@ unsigned int GetEntryDLLOrdinal(char * dll_name, int ordinal, int * sel,
j = GetEntryPointFromOrdinal(wpnt, ordinal); j = GetEntryPointFromOrdinal(wpnt, ordinal);
*addr = j & 0xffff; *addr = j & 0xffff;
j = j >> 16; j = j >> 16;
#if 0 *sel = j;
/* This seems like it would never work */
*sel = wpnt->selector_table[j].selector;
#else
*sel = j; /* Is there any reason this will ever fail?? */
#endif
return 0; return 0;
}; };
return 1; return 1;
......
...@@ -22,6 +22,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; ...@@ -22,6 +22,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "wine.h" #include "wine.h"
#include "windows.h" #include "windows.h"
#include "wineopts.h" #include "wineopts.h"
#include "arch.h"
/* #define DEBUG_FIXUP */ /* #define DEBUG_FIXUP */
...@@ -46,22 +47,13 @@ struct ne_header_s *CurrentNEHeader; ...@@ -46,22 +47,13 @@ struct ne_header_s *CurrentNEHeader;
int CurrentNEFile; int CurrentNEFile;
HINSTANCE hSysRes; HINSTANCE hSysRes;
static char *Extensions[] = { "dll", "exe", NULL }; static char *DLL_Extensions[] = { "dll", "exe", NULL };
static char *EXE_Extensions[] = { "exe", NULL };
static char *WinePath = NULL; static char *WinePath = NULL;
FILE *SpyFp = NULL; FILE *SpyFp = NULL;
/********************************************************************** /**********************************************************************
* DebugPrintString
*/
int
DebugPrintString(char *str)
{
printf("%s", str);
return 0;
}
/**********************************************************************
* myerror * myerror
*/ */
void void
...@@ -103,11 +95,35 @@ GetFileInfo(unsigned short instance) ...@@ -103,11 +95,35 @@ GetFileInfo(unsigned short instance)
return w; return w;
} }
#ifndef WINELIB
/**********************************************************************
*
* Load MZ Header
*/
void load_mz_header(int fd, struct mz_header_s *mz_header)
{
if (read(fd, mz_header, sizeof(struct mz_header_s)) !=
sizeof(struct mz_header_s))
{
myerror("Unable to read MZ header from file");
}
}
void load_ne_header (int fd, struct ne_header_s *ne_header)
{
if (read(fd, ne_header, sizeof(struct ne_header_s))
!= sizeof(struct ne_header_s))
{
myerror("Unable to read NE header from file");
}
}
#endif
/********************************************************************** /**********************************************************************
* LoadImage * LoadImage
* Load one NE format executable into memory * Load one NE format executable into memory
*/ */
HINSTANCE LoadImage(char *modulename) HINSTANCE LoadImage(char *modulename, int filetype)
{ {
unsigned int read_size; unsigned int read_size;
int i; int i;
...@@ -118,11 +134,9 @@ HINSTANCE LoadImage(char *modulename) ...@@ -118,11 +134,9 @@ HINSTANCE LoadImage(char *modulename)
/* /*
* search file * search file
*/ */
if (FindFile(buffer, sizeof(buffer), modulename, Extensions, WindowsPath) if (FindFile(buffer, sizeof(buffer), modulename, (filetype == EXE ?
==NULL) EXE_Extensions : DLL_Extensions), WindowsPath) ==NULL)
{ {
fprintf(stderr,"LoadImage: I can't find %s !\n",modulename); fprintf(stderr,"LoadImage: I can't find %s !\n",modulename);
return (HINSTANCE) NULL; return (HINSTANCE) NULL;
} }
...@@ -159,21 +173,13 @@ HINSTANCE LoadImage(char *modulename) ...@@ -159,21 +173,13 @@ HINSTANCE LoadImage(char *modulename)
wpnt->mz_header = (struct mz_header_s *) malloc(sizeof(struct mz_header_s));; wpnt->mz_header = (struct mz_header_s *) malloc(sizeof(struct mz_header_s));;
status = lseek(wpnt->fd, 0, SEEK_SET); status = lseek(wpnt->fd, 0, SEEK_SET);
if (read(wpnt->fd, wpnt->mz_header, sizeof(struct mz_header_s)) != load_mz_header (wpnt->fd, wpnt->mz_header);
sizeof(struct mz_header_s))
{
myerror("Unable to read MZ header from file");
}
if (wpnt->mz_header->must_be_0x40 != 0x40) if (wpnt->mz_header->must_be_0x40 != 0x40)
myerror("This is not a Windows program"); myerror("This is not a Windows program");
wpnt->ne_header = (struct ne_header_s *) malloc(sizeof(struct ne_header_s)); wpnt->ne_header = (struct ne_header_s *) malloc(sizeof(struct ne_header_s));
status = lseek(wpnt->fd, wpnt->mz_header->ne_offset, SEEK_SET); status = lseek(wpnt->fd, wpnt->mz_header->ne_offset, SEEK_SET);
if (read(wpnt->fd, wpnt->ne_header, sizeof(struct ne_header_s)) load_ne_header (wpnt->fd, wpnt->ne_header);
!= sizeof(struct ne_header_s))
{
myerror("Unable to read NE header from file");
}
if (wpnt->ne_header->header_type[0] != 'N' || if (wpnt->ne_header->header_type[0] != 'N' ||
wpnt->ne_header->header_type[1] != 'E') wpnt->ne_header->header_type[1] != 'E')
myerror("This is not a Windows program"); myerror("This is not a Windows program");
...@@ -190,6 +196,7 @@ HINSTANCE LoadImage(char *modulename) ...@@ -190,6 +196,7 @@ HINSTANCE LoadImage(char *modulename)
/* /*
* Create segment selectors. * Create segment selectors.
*/ */
#ifndef WINELIB
status = lseek(wpnt->fd, wpnt->mz_header->ne_offset + status = lseek(wpnt->fd, wpnt->mz_header->ne_offset +
wpnt->ne_header->segment_tab_offset, wpnt->ne_header->segment_tab_offset,
SEEK_SET); SEEK_SET);
...@@ -235,7 +242,7 @@ HINSTANCE LoadImage(char *modulename) ...@@ -235,7 +242,7 @@ HINSTANCE LoadImage(char *modulename)
wpnt->name = (char*) malloc(*wpnt->rname_table + 1); wpnt->name = (char*) malloc(*wpnt->rname_table + 1);
memcpy(wpnt->name, wpnt->rname_table+1, *wpnt->rname_table); memcpy(wpnt->name, wpnt->rname_table+1, *wpnt->rname_table);
wpnt->name[*wpnt->rname_table] = 0; wpnt->name[*wpnt->rname_table] = 0;
#endif
/* /*
* Now load any DLLs that this module refers to. * Now load any DLLs that this module refers to.
*/ */
...@@ -245,9 +252,11 @@ HINSTANCE LoadImage(char *modulename) ...@@ -245,9 +252,11 @@ HINSTANCE LoadImage(char *modulename)
int fd, j; int fd, j;
GetModuleName(wpnt, i + 1, buff); GetModuleName(wpnt, i + 1, buff);
#ifndef WINELIB
if(FindDLLTable(buff)) continue; /* This module already loaded */ if(FindDLLTable(buff)) continue; /* This module already loaded */
#endif
LoadImage(buff); LoadImage(buff, DLL);
/* /*
fprintf(stderr,"Unable to load:%s\n", buff); fprintf(stderr,"Unable to load:%s\n", buff);
*/ */
...@@ -255,31 +264,6 @@ HINSTANCE LoadImage(char *modulename) ...@@ -255,31 +264,6 @@ HINSTANCE LoadImage(char *modulename)
return(wpnt->hinstance); return(wpnt->hinstance);
} }
/**********************************************************************
* ParseArgs
*/
void
ParseArgs(int argc, char **argv)
{
if (argc < 2)
{
fprintf(stderr, "usage: %s [-spy FILENAME] FILENAME\n", argv[0]);
exit(1);
}
Argc = argc - 1;
for (Argv = argv + 1; **Argv == '-' && Argc > 0; Argv++)
{
if (strcmp(*Argv, "-spy") == 0)
{
if (strcmp(*(++Argv), "-") == 0)
SpyFp = stdout;
else
SpyFp = fopen(*Argv, "a");
}
}
}
/********************************************************************** /**********************************************************************
* main * main
...@@ -300,22 +284,29 @@ _WinMain(int argc, char **argv) ...@@ -300,22 +284,29 @@ _WinMain(int argc, char **argv)
int i; int i;
int rv; int rv;
ParseArgs(argc, argv); Argc = argc - 1;
Argv = argv + 1;
p = getenv("WINEPATH");
WinePath = malloc(256 + strlen(p)); WinePath = malloc(1024);
getcwd(WinePath, 256);
strcat(WinePath, ";"); getcwd(WinePath, 512);
strcat(WinePath, p);
if ((p = getenv("WINEPATH")) != NULL) {
LoadImage(Argv[0]); strcat(WinePath, ";");
strcat(WinePath, p);
}
if (LoadImage(Argv[0], EXE) == (HINSTANCE) NULL ) {
fprintf(stderr, "wine: can't find %s!.\n", Argv[0]);
exit(1);
}
GetPrivateProfileString("wine", "SystemResources", "sysres.dll", GetPrivateProfileString("wine", "SystemResources", "sysres.dll",
filename, sizeof(filename), filename, sizeof(filename), WINE_INI);
WINE_INI);
hSysRes = LoadImage(filename); hSysRes = LoadImage(filename, DLL);
if (hSysRes == (HINSTANCE)NULL) if (hSysRes == (HINSTANCE)NULL)
printf("Error Loading System Resources !!!\n"); fprintf(stderr, "wine: can't find %s!.\n", filename);
else else
printf("System Resources Loaded // hSysRes='%04X'\n", hSysRes); printf("System Resources Loaded // hSysRes='%04X'\n", hSysRes);
...@@ -324,22 +315,15 @@ _WinMain(int argc, char **argv) ...@@ -324,22 +315,15 @@ _WinMain(int argc, char **argv)
*/ */
wpnt = wine_files; wpnt = wine_files;
for(wpnt = wine_files; wpnt; wpnt = wpnt->next) for(wpnt = wine_files; wpnt; wpnt = wpnt->next)
for (segment = 0; segment < wpnt->ne_header->n_segment_tab; segment++) {
for (segment = 0; segment < wpnt->ne_header->n_segment_tab; segment++)
{ {
if (FixupSegment(wpnt, segment) < 0) if (FixupSegment(wpnt, segment) < 0)
{ {
myerror("fixup failed."); myerror("fixup failed.");
} }
} }
}
/*
* Fixup stack and jump to start.
*/
ds_reg = wine_files->selector_table[wine_files->ne_header->auto_data_seg-1].selector;
cs_reg = wine_files->selector_table[wine_files->ne_header->cs-1].selector;
ip_reg = wine_files->ne_header->ip;
ss_reg = wine_files->selector_table[wine_files->ne_header->ss-1].selector;
sp_reg = wine_files->ne_header->sp;
#ifdef WINESTAT #ifdef WINESTAT
cp = strrchr(argv[0], '/'); cp = strrchr(argv[0], '/');
...@@ -351,25 +335,63 @@ _WinMain(int argc, char **argv) ...@@ -351,25 +335,63 @@ _WinMain(int argc, char **argv)
}; };
#endif #endif
/*
* Initialize signal handling.
*/
init_wine_signals(); init_wine_signals();
if (WineForceFail) /*
{ * Fixup stack and jump to start.
p = (char *) ((cs_reg << 16) | ip_reg); */
ds_reg = (wine_files->
*p++ = 0xcd; selector_table[wine_files->ne_header->auto_data_seg-1].selector);
*p++ = 0x20; cs_reg = wine_files->selector_table[wine_files->ne_header->cs-1].selector;
} ip_reg = wine_files->ne_header->ip;
ss_reg = wine_files->selector_table[wine_files->ne_header->ss-1].selector;
sp_reg = wine_files->ne_header->sp;
if (ss_reg == 0) rv = CallToInit16(cs_reg << 16 | ip_reg, ss_reg << 16 | sp_reg, ds_reg);
printf ("rv = %x\n", rv);
}
void InitializeLoadedDLLs()
{
struct w_files * wpnt;
int cs_reg, ds_reg, ip_reg;
int rv;
fprintf(stderr, "Initializing DLLs\n");
/*
* Initialize libraries
*/
wpnt = wine_files;
for(wpnt = wine_files; wpnt; wpnt = wpnt->next)
{ {
fprintf(stderr, "SS is 0\n"); /*
} * Is this a library?
*/
if (wpnt->ne_header->format_flags & 0x8000)
{
if (!(wpnt->ne_header->format_flags & 0x0001))
{
/* Not SINGLEDATA */
fprintf(stderr, "Library is not marked SINGLEDATA\n");
exit(1);
}
LinearTest(); ds_reg = wpnt->selector_table[wpnt->
ne_header->auto_data_seg-1].selector;
cs_reg = wpnt->selector_table[wpnt->ne_header->cs-1].selector;
ip_reg = wpnt->ne_header->ip;
rv = CallToInit16(cs_reg << 16 | ip_reg, ss_reg << 16 | sp_reg, ds_reg); fprintf(stderr, "Initializing %s, cs:ip %04x:%04x, ds %04x\n",
printf ("rv = %x\n", rv); wpnt->name, cs_reg, ip_reg, ds_reg);
rv = CallTo16(cs_reg << 16 | ip_reg, ds_reg);
printf ("rv = %x\n", rv);
}
}
} }
...@@ -389,6 +411,7 @@ GetImportedName(int fd, struct mz_header_s *mz_header, ...@@ -389,6 +411,7 @@ GetImportedName(int fd, struct mz_header_s *mz_header,
name_offset, SEEK_SET); name_offset, SEEK_SET);
length = 0; length = 0;
read(fd, &length, 1); /* Get the length byte */ read(fd, &length, 1); /* Get the length byte */
length = CONV_CHAR_TO_LONG (length);
read(fd, buffer, length); read(fd, buffer, length);
buffer[length] = 0; buffer[length] = 0;
return buffer; return buffer;
...@@ -405,17 +428,19 @@ GetModuleName(struct w_files * wpnt, int index, char *buffer) ...@@ -405,17 +428,19 @@ GetModuleName(struct w_files * wpnt, int index, char *buffer)
struct ne_header_s *ne_header = wpnt->ne_header; struct ne_header_s *ne_header = wpnt->ne_header;
char *p; char *p;
int length; int length;
int name_offset, status; WORD name_offset, status;
int i; int i;
status = lseek(fd, mz_header->ne_offset + ne_header->moduleref_tab_offset + status = lseek(fd, mz_header->ne_offset + ne_header->moduleref_tab_offset +
2*(index - 1), SEEK_SET); 2*(index - 1), SEEK_SET);
name_offset = 0; name_offset = 0;
read(fd, &name_offset, 2); read(fd, &name_offset, 2);
name_offset = CONV_SHORT (name_offset);
status = lseek(fd, mz_header->ne_offset + ne_header->iname_tab_offset + status = lseek(fd, mz_header->ne_offset + ne_header->iname_tab_offset +
name_offset, SEEK_SET); name_offset, SEEK_SET);
length = 0; length = 0;
read(fd, &length, 1); /* Get the length byte */ read(fd, &length, 1); /* Get the length byte */
length = CONV_CHAR_TO_LONG (length);
read(fd, buffer, length); read(fd, buffer, length);
buffer[length] = 0; buffer[length] = 0;
...@@ -427,6 +452,7 @@ GetModuleName(struct w_files * wpnt, int index, char *buffer) ...@@ -427,6 +452,7 @@ GetModuleName(struct w_files * wpnt, int index, char *buffer)
} }
#ifndef WINELIB
/********************************************************************** /**********************************************************************
* FixupSegment * FixupSegment
*/ */
...@@ -700,3 +726,4 @@ FARPROC GetProcAddress(HINSTANCE hinstance, char *proc_name) ...@@ -700,3 +726,4 @@ FARPROC GetProcAddress(HINSTANCE hinstance, char *proc_name)
return NULL; return NULL;
} }
#endif
...@@ -5,12 +5,9 @@ MODULE = memory ...@@ -5,12 +5,9 @@ MODULE = memory
SRCS = \ SRCS = \
global.c \ global.c \
heap.c \ heap.c \
atom.c linear.c
OBJS = \ OBJS = $(SRCS:.c=.o)
global.o \
heap.o \
atom.o
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS)) WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget() DependTarget()
......
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
OBJS=global.o heap.o atom.o linear.o
default: memory.o
memory.o: $(OBJS)
$(LD) -r -o memory.o $(OBJS)
clean:
rm -f *.o *~ *.s dll_* *.a *#
depend:
$(CC) $(CFLAGS) -M *.c > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif
...@@ -138,8 +138,8 @@ HEAP_ReAlloc(MDESC **free_list, void *old_block, ...@@ -138,8 +138,8 @@ HEAP_ReAlloc(MDESC **free_list, void *old_block,
if (new_size > m->length) if (new_size > m->length)
{ {
m_free = m + 1 + m->length / sizeof(MDESC); m_free = m + 1 + m->length / sizeof(MDESC);
if (m_free->next != m_free || if (m_free->next == m_free ||
m_free->prev != m_free || m_free->prev == m_free ||
m_free->length + sizeof(MDESC) < new_size) m_free->length + sizeof(MDESC) < new_size)
{ {
void *new_p = HEAP_Alloc(free_list, flags, new_size); void *new_p = HEAP_Alloc(free_list, flags, new_size);
...@@ -284,7 +284,7 @@ HEAP_Free(MDESC **free_list, void *block) ...@@ -284,7 +284,7 @@ HEAP_Free(MDESC **free_list, void *block)
/********************************************************************** /**********************************************************************
* HEAP_LocalFindHeap * HEAP_LocalFindHeap
*/ */
MDESC ** LHEAP *
HEAP_LocalFindHeap(unsigned short owner) HEAP_LocalFindHeap(unsigned short owner)
{ {
LHEAP *lh; LHEAP *lh;
...@@ -296,13 +296,13 @@ HEAP_LocalFindHeap(unsigned short owner) ...@@ -296,13 +296,13 @@ HEAP_LocalFindHeap(unsigned short owner)
for (lh = LocalHeaps; lh != NULL; lh = lh->next) for (lh = LocalHeaps; lh != NULL; lh = lh->next)
{ {
if (lh->selector == owner) if (lh->selector == owner)
return &lh->free_list; return lh;
} }
return NULL; return NULL;
} }
#define LOCALHEAP() HEAP_LocalFindHeap(Segments[Stack16Frame[11] >> 3].owner) #define LOCALHEAP() (&HEAP_LocalFindHeap(Segments[Stack16Frame[11] >> 3].owner)->free_list)
/********************************************************************** /**********************************************************************
* HEAP_LocalInit * HEAP_LocalInit
...@@ -402,8 +402,25 @@ LocalFree(unsigned int handle) ...@@ -402,8 +402,25 @@ LocalFree(unsigned int handle)
unsigned int unsigned int
LocalInit(unsigned int segment, unsigned int start, unsigned int end) LocalInit(unsigned int segment, unsigned int start, unsigned int end)
{ {
HEAP_Init(LOCALHEAP(), unsigned short owner = Segments[Stack16Frame[11] >> 3].owner;
(void *) ((segment << 16) | start), end - start + 1); LHEAP *lh = HEAP_LocalFindHeap(owner);
if (segment == 0)
{
/* Get current DS */
segment = Stack16Frame[6];
}
if (lh == NULL)
{
HEAP_LocalInit(owner,
(void *) ((segment << 16) | start), end - start + 1);
}
else
{
HEAP_Init(&lh->free_list,
(void *) ((segment << 16) | start), end - start + 1);
}
return segment; return segment;
} }
......
...@@ -3,46 +3,26 @@ ...@@ -3,46 +3,26 @@
MODULE = misc MODULE = misc
SRCS = \ SRCS = \
atom.c \
clipboard.c \
comm.c \ comm.c \
dos.c \ cursor.c \
dos_fs.c \ dos_fs.c \
emulate.c \
exec.c \ exec.c \
file.c \ file.c \
int1a.c \
int21.c \
kernel.c \
keyboard.c \ keyboard.c \
lstr.c \ lstr.c \
main.c \ main.c \
message.c \ message.c \
profile.c \ profile.c \
rect.c \ rect.c \
resource.c \
sound.c \ sound.c \
spy.c \ spy.c \
user.c \ user.c \
xt.c winsocket.c
OBJS = \ OBJS = $(SRCS:.c=.o)
comm.o \
dos.o \
dos_fs.o \
emulate.o \
exec.o \
file.o \
int1a.o \
int21.o \
kernel.o \
keyboard.o \
lstr.o \
main.o \
message.o \
profile.o \
rect.o \
sound.o \
spy.o \
user.o \
xt.o
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS)) WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget() DependTarget()
......
CFLAGS=$(COPTS) $(DEBUGOPTS) -I../include
OBJS=main.o kernel.o user.o rect.o file.o sound.o emulate.o \
keyboard.o profile.o lstr.o exec.o message.o int1a.o int21.o \
dos_fs.o comm.o spy.o
default: misc.o
misc.o: $(OBJS)
$(LD) -r -o misc.o $(OBJS)
clean:
rm -f *.o *~ *.s dll_* *.a *#
depend:
$(CC) $(CFLAGS) -M *.c > .depend
ifeq (.depend,$(wildcard .depend))
include .depend
endif
...@@ -22,12 +22,19 @@ ...@@ -22,12 +22,19 @@
* because they can't generally be differentiated from string constants * because they can't generally be differentiated from string constants
* located below 0x10000 in the emulation library. If you need * located below 0x10000 in the emulation library. If you need
* integer atoms, use the "#1234" form. * integer atoms, use the "#1234" form.
*
* 13/Feb, miguel
* Changed the calls to LocalAlloc to LocalAlign. When compiling WINELIB
* you call a special version of LocalAlloc that would do the alignement.
* When compiling the emulator we depend on LocalAlloc returning the
* aligned block. Needed to test the Library.
*/ */
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "user.h"
#include "atom.h" #include "atom.h"
...@@ -50,7 +57,7 @@ static BOOL ATOM_InitTable( ATOMTABLE ** table, WORD entries ) ...@@ -50,7 +57,7 @@ static BOOL ATOM_InitTable( ATOMTABLE ** table, WORD entries )
int i; int i;
HANDLE handle; HANDLE handle;
handle = LocalAlloc( LMEM_MOVEABLE, sizeof(ATOMTABLE) + handle = LocalAlign ( LMEM_MOVEABLE, sizeof(ATOMTABLE) +
(entries-1) * sizeof(HANDLE) ); (entries-1) * sizeof(HANDLE) );
if (!handle) return FALSE; if (!handle) return FALSE;
*table = (ATOMTABLE *) LocalLock( handle ); *table = (ATOMTABLE *) LocalLock( handle );
...@@ -126,7 +133,7 @@ static ATOM ATOM_AddAtom( ATOMTABLE * table, LPCSTR str ) ...@@ -126,7 +133,7 @@ static ATOM ATOM_AddAtom( ATOMTABLE * table, LPCSTR str )
entry = entryPtr->next; entry = entryPtr->next;
} }
entry = (int)LocalAlloc( LMEM_MOVEABLE, sizeof(ATOMENTRY)+len-1 ) & 0xffff; entry = (int)LocalAlign( LMEM_MOVEABLE, sizeof(ATOMENTRY)+len-1 ) & 0xffff;
if (!entry) return 0; if (!entry) return 0;
entryPtr = ATOM_MakePtr( table, entry ); entryPtr = ATOM_MakePtr( table, entry );
entryPtr->next = table->entries[hash]; entryPtr->next = table->entries[hash];
...@@ -166,7 +173,7 @@ static ATOM ATOM_DeleteAtom( ATOMTABLE * table, ATOM atom ) ...@@ -166,7 +173,7 @@ static ATOM ATOM_DeleteAtom( ATOMTABLE * table, ATOM atom )
if (--entryPtr->refCount == 0) if (--entryPtr->refCount == 0)
{ {
*prevEntry = entryPtr->next; *prevEntry = entryPtr->next;
LocalFree( entry ); USER_HEAP_FREE( entry );
} }
return 0; return 0;
} }
......
/*
* 'Wine' Clipboard function handling
*
* Copyright 1994 Martin Ayotte
*/
static char Copyright[] = "Copyright Martin Ayotte, 1994";
/*
#define DEBUG_CLIPBOARD
*/
#include <windows.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "prototypes.h"
#include "heap.h"
#include "win.h"
typedef struct tagCLIPFORMAT {
WORD wFormatID;
WORD wRefCount;
LPSTR Name;
HANDLE hData;
DWORD BufSize;
void *PrevFormat;
void *NextFormat;
} CLIPFORMAT;
typedef CLIPFORMAT FAR* LPCLIPFORMAT;
static HWND hWndClipboardOwner = 0;
static HWND hWndViewer = 0;
static WORD LastRegFormat = 0xC000;
CLIPFORMAT ClipFormats[12] = {
{ CF_TEXT, 1, "Text", (HANDLE)NULL, 0, NULL, &ClipFormats[1] },
{ CF_BITMAP, 1, "Bitmap", (HANDLE)NULL, 0, &ClipFormats[0], &ClipFormats[2] },
{ CF_METAFILEPICT, 1, "MetaFile Picture", (HANDLE)NULL, 0, &ClipFormats[1], &ClipFormats[3] },
{ CF_SYLK, 1, "Sylk", (HANDLE)NULL, 0, &ClipFormats[2], &ClipFormats[4] },
{ CF_DIF, 1, "DIF", (HANDLE)NULL, 0, &ClipFormats[3], &ClipFormats[5] },
{ CF_TIFF, 1, "TIFF", (HANDLE)NULL, 0, &ClipFormats[4], &ClipFormats[6] },
{ CF_OEMTEXT, 1, "OEM Text", (HANDLE)NULL, 0, &ClipFormats[5], &ClipFormats[7] },
{ CF_DIB, 1, "DIB", (HANDLE)NULL, 0, &ClipFormats[6], &ClipFormats[8] },
{ CF_PALETTE, 1, "Palette", (HANDLE)NULL, 0, &ClipFormats[7], &ClipFormats[9] },
{ CF_PENDATA, 1, "PenData", (HANDLE)NULL, 0, &ClipFormats[8], &ClipFormats[10] },
{ CF_RIFF, 1, "RIFF", (HANDLE)NULL, 0, &ClipFormats[9], &ClipFormats[11] },
{ CF_WAVE, 1, "Wave", (HANDLE)NULL, 0, &ClipFormats[10], NULL }
};
/**************************************************************************
* OpenClipboard [USER.137]
*/
BOOL OpenClipboard(HWND hWnd)
{
if (hWndClipboardOwner != 0) return FALSE;
hWndClipboardOwner = hWnd;
#ifdef DEBUG_CLIPBOARD
printf("OpenClipboard(%04X); !\n", hWnd);
#endif
return TRUE;
}
/**************************************************************************
* CloseClipboard [USER.138]
*/
BOOL CloseClipboard()
{
if (hWndClipboardOwner == 0) return FALSE;
hWndClipboardOwner = 0;
#ifdef DEBUG_CLIPBOARD
printf("CloseClipboard(); !\n");
#endif
return TRUE;
}
/**************************************************************************
* EmptyClipboard [USER.139]
*/
BOOL EmptyClipboard()
{
LPCLIPFORMAT lpFormat = ClipFormats;
if (hWndClipboardOwner == 0) return FALSE;
#ifdef DEBUG_CLIPBOARD
printf("EmptyClipboard(); !\n");
#endif
while(TRUE) {
if (lpFormat == NULL) break;
if (lpFormat->hData != 0) {
GlobalFree(lpFormat->hData);
lpFormat->hData = 0;
}
lpFormat = lpFormat->NextFormat;
}
return TRUE;
}
/**************************************************************************
* GetClipboardOwner [USER.140]
*/
HWND GetClipboardOwner()
{
#ifdef DEBUG_CLIPBOARD
printf("GetClipboardOwner() = %04X !\n", hWndClipboardOwner);
#endif
return hWndClipboardOwner;
}
/**************************************************************************
* SetClipboardData [USER.141]
*/
HANDLE SetClipboardData(WORD wFormat, HANDLE hData)
{
LPCLIPFORMAT lpFormat = ClipFormats;
#ifdef DEBUG_CLIPBOARD
printf("SetClipboardDate(%04X, %04X) !\n", wFormat, hData);
#endif
while(TRUE) {
if (lpFormat == NULL) return 0;
if (lpFormat->wFormatID == wFormat) break;
lpFormat = lpFormat->NextFormat;
}
if (lpFormat->hData != 0) GlobalFree(lpFormat->hData);
lpFormat->hData = hData;
return lpFormat->hData;
}
/**************************************************************************
* GetClipboardData [USER.142]
*/
HANDLE GetClipboardData(WORD wFormat)
{
LPCLIPFORMAT lpFormat = ClipFormats;
#ifdef DEBUG_CLIPBOARD
printf("GetClipboardData(%04X) !\n", wFormat);
#endif
while(TRUE) {
if (lpFormat == NULL) return 0;
if (lpFormat->wFormatID == wFormat) break;
lpFormat = lpFormat->NextFormat;
}
return lpFormat->hData;
}
/**************************************************************************
* CountClipboardFormats [USER.143]
*/
int CountClipboardFormats()
{
int FormatCount = 0;
LPCLIPFORMAT lpFormat = ClipFormats;
while(TRUE) {
if (lpFormat == NULL) break;
if (lpFormat->hData != 0) {
#ifdef DEBUG_CLIPBOARD
printf("CountClipboardFormats // Find Not Empty (%04X) !\n",
lpFormat->hData);
#endif
FormatCount++;
}
lpFormat = lpFormat->NextFormat;
}
#ifdef DEBUG_CLIPBOARD
printf("CountClipboardFormats() = %d !\n", FormatCount);
#endif
return FormatCount;
}
/**************************************************************************
* EnumClipboardFormats [USER.144]
*/
WORD EnumClipboardFormats(WORD wFormat)
{
LPCLIPFORMAT lpFormat = ClipFormats;
#ifdef DEBUG_CLIPBOARD
printf("EnumClipboardFormats(%04X) !\n", wFormat);
#endif
if (wFormat == 0) {
if (lpFormat->hData != 0)
return lpFormat->wFormatID;
else
wFormat = lpFormat->wFormatID;
}
while(TRUE) {
if (lpFormat == NULL) return 0;
if (lpFormat->wFormatID == wFormat) break;
lpFormat = lpFormat->NextFormat;
}
#ifdef DEBUG_CLIPBOARD
printf("EnumClipboardFormats // Find Last (%04X) !\n",
lpFormat->wFormatID);
#endif
lpFormat = lpFormat->NextFormat;
while(TRUE) {
if (lpFormat == NULL) return 0;
if (lpFormat->hData != 0) break;
lpFormat = lpFormat->NextFormat;
}
#ifdef DEBUG_CLIPBOARD
printf("EnumClipboardFormats // Find Not Empty Id=%04X hData=%04X !\n",
lpFormat->wFormatID, lpFormat->hData);
#endif
return lpFormat->wFormatID;
}
/**************************************************************************
* RegisterClipboardFormat [USER.145]
*/
WORD RegisterClipboardFormat(LPCSTR FormatName)
{
LPCLIPFORMAT lpNewFormat;
LPCLIPFORMAT lpFormat = ClipFormats;
if (FormatName == NULL) return 0;
while(TRUE) {
if (lpFormat->NextFormat == NULL) break;
lpFormat = lpFormat->NextFormat;
}
lpNewFormat = (LPCLIPFORMAT)malloc(sizeof(CLIPFORMAT));
if (lpNewFormat == NULL) return 0;
lpFormat->NextFormat = lpNewFormat;
#ifdef DEBUG_CLIPBOARD
printf("RegisterClipboardFormat('%s') !\n", FormatName);
#endif
lpNewFormat->wFormatID = LastRegFormat;
lpNewFormat->wRefCount = 1;
lpNewFormat->Name = (LPSTR)malloc(strlen(FormatName) + 1);
if (lpNewFormat->Name == NULL) {
free(lpNewFormat);
return 0;
}
strcpy(lpNewFormat->Name, FormatName);
lpNewFormat->hData = 0;
lpNewFormat->BufSize = 0;
lpNewFormat->PrevFormat = lpFormat;
lpNewFormat->NextFormat = NULL;
return LastRegFormat++;
}
/**************************************************************************
* GetClipboardFormatName [USER.146]
*/
int GetClipboardFormatName(WORD wFormat, LPSTR retStr, short maxlen)
{
LPCLIPFORMAT lpFormat = ClipFormats;
#ifdef DEBUG_CLIPBOARD
printf("GetClipboardFormat(%04X, %08X, %d) !\n", wFormat, retStr, maxlen);
#endif
while(TRUE) {
if (lpFormat == NULL) return 0;
if (lpFormat->wFormatID == wFormat) break;
lpFormat = lpFormat->NextFormat;
}
if (lpFormat->Name == NULL) return 0;
#ifdef DEBUG_CLIPBOARD
printf("GetClipboardFormat // Name='%s' !\n", lpFormat->Name);
#endif
maxlen = min(maxlen - 1, strlen(lpFormat->Name));
printf("GetClipboardFormat // maxlen=%d !\n", maxlen);
memcpy(retStr, lpFormat->Name, maxlen);
retStr[maxlen] = 0;
return maxlen;
}
/**************************************************************************
* SetClipboardViewer [USER.147]
*/
HWND SetClipboardViewer(HWND hWnd)
{
#ifdef DEBUG_CLIPBOARD
printf("SetClipboardFormat(%04X) !\n", hWnd);
#endif
hWndViewer = hWnd;
}
/**************************************************************************
* GetClipboardViewer [USER.148]
*/
HWND GetClipboardViewer()
{
#ifdef DEBUG_CLIPBOARD
printf("GetClipboardFormat() = %04X !\n", hWndViewer);
#endif
}
/**************************************************************************
* ChangeClipboardChain [USER.149]
*/
BOOL ChangeClipboardChain(HWND hWnd, HWND hWndNext)
{
#ifdef DEBUG_CLIPBOARD
printf("ChangeClipboardChain(%04X, %04X) !\n", hWnd, hWndNext);
#endif
}
/**************************************************************************
* IsClipboardFormatAvailable [USER.193]
*/
BOOL IsClipboardFormatAvailable(WORD wFormat)
{
LPCLIPFORMAT lpFormat = ClipFormats;
#ifdef DEBUG_CLIPBOARD
printf("IsClipboardFormatAvailable(%04X) !\n", wFormat);
#endif
while(TRUE) {
if (lpFormat == NULL) return FALSE;
if (lpFormat->wFormatID == wFormat) break;
lpFormat = lpFormat->NextFormat;
}
return (lpFormat->hData != 0);
}
/**************************************************************************
* GetOpenClipboardWindow [USER.248]
*/
HWND GetOpenClipboardWindow()
{
#ifdef DEBUG_CLIPBOARD
printf("GetOpenClipboardWindow() = %04X !\n", hWndClipboardOwner);
#endif
return hWndClipboardOwner;
}
/**************************************************************************
* GetPriorityClipboardFormat [USER.402]
*/
int GetPriorityClipboardFormat(WORD FAR *lpPriorityList, short nCount)
{
#ifdef DEBUG_CLIPBOARD
printf("GetPriorityClipboardFormat(%08X, %d) !\n", lpPriorityList, nCount);
#endif
}
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <termios.h> #include <termios.h>
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <sys/stat.h> #include <sys/stat.h>
#if defined(__NetBSD__) || defined(__FreeBSD__) #if defined(__NetBSD__) || defined(__FreeBSD__)
#include <errno.h> #include <errno.h>
...@@ -53,12 +54,12 @@ void Comm_Init(void) ...@@ -53,12 +54,12 @@ void Comm_Init(void)
if (!S_ISCHR(st.st_mode)) if (!S_ISCHR(st.st_mode))
fprintf(stderr,"comm: can 't use `%s' as COM%d !\n", temp, x); fprintf(stderr,"comm: can 't use `%s' as COM%d !\n", temp, x);
else else
if ((ptr = malloc(strlen(temp)+1)) == NULL) if ((COM[serial].devicename = malloc(strlen(temp)+1)) == NULL)
fprintf(stderr,"comm: can't malloc for device info!\n"); fprintf(stderr,"comm: can't malloc for device info!\n");
else { else {
COM[serial].fd = 0; COM[serial].fd = 0;
COM[serial].devicename = ptr; strcpy(COM[serial].devicename, temp);
strcpy(COM[serial++].devicename, temp); serial++;
} }
} }
...@@ -74,17 +75,16 @@ void Comm_Init(void) ...@@ -74,17 +75,16 @@ void Comm_Init(void)
if (!S_ISCHR(st.st_mode)) if (!S_ISCHR(st.st_mode))
fprintf(stderr,"comm: can 't use `%s' as LPT%d !\n", temp, x); fprintf(stderr,"comm: can 't use `%s' as LPT%d !\n", temp, x);
else else
if ((ptr = malloc(strlen(temp)+1)) == NULL) if ((LPT[parallel].devicename = malloc(strlen(temp)+1)) == NULL)
fprintf(stderr,"comm: can't malloc for device info!\n"); fprintf(stderr,"comm: can't malloc for device info!\n");
else { else {
LPT[serial].fd = 0; LPT[parallel].fd = 0;
LPT[serial].devicename = ptr; strcpy(LPT[parallel].devicename, temp);
strcpy(LPT[serial++].devicename, temp); parallel++;
} }
} }
} }
atexit(Comm_DeInit);
} }
void Comm_DeInit(void) void Comm_DeInit(void)
...@@ -155,6 +155,12 @@ fprintf(stderr,"BuildCommDCB: (%s), ptr %d\n", device, lpdcb); ...@@ -155,6 +155,12 @@ fprintf(stderr,"BuildCommDCB: (%s), ptr %d\n", device, lpdcb);
if (!strncmp(device,"COM",3)) { if (!strncmp(device,"COM",3)) {
port = device[3] - '0'; port = device[3] - '0';
if (port-- == 0) {
fprintf(stderr, "comm: BUG ! COM0 can't exists!.\n");
commerror = IE_BADID;
}
if (!ValidCOMPort(port)) { if (!ValidCOMPort(port)) {
commerror = IE_BADID; commerror = IE_BADID;
return -1; return -1;
...@@ -240,6 +246,11 @@ fprintf(stderr,"OpenComm: %s, %d, %d\n", device, cbInQueue, cbOutQueue); ...@@ -240,6 +246,11 @@ fprintf(stderr,"OpenComm: %s, %d, %d\n", device, cbInQueue, cbOutQueue);
if (!strncmp(device,"COM",3)) { if (!strncmp(device,"COM",3)) {
port = device[3] - '0'; port = device[3] - '0';
if (port-- == 0) {
fprintf(stderr, "comm: BUG ! COM0 doesn't exists!.\n");
commerror = IE_BADID;
}
if (!ValidCOMPort(port)) { if (!ValidCOMPort(port)) {
commerror = IE_BADID; commerror = IE_BADID;
return -1; return -1;
...@@ -252,7 +263,7 @@ fprintf(stderr,"OpenComm: %s, %d, %d\n", device, cbInQueue, cbOutQueue); ...@@ -252,7 +263,7 @@ fprintf(stderr,"OpenComm: %s, %d, %d\n", device, cbInQueue, cbOutQueue);
fd = open(COM[port].devicename, O_RDWR | O_NONBLOCK, 0); fd = open(COM[port].devicename, O_RDWR | O_NONBLOCK, 0);
if (fd == -1) { if (fd == -1) {
commerror = WinError(); commerror = WinError();
return -1; return -1;
} else { } else {
COM[port].fd = fd; COM[port].fd = fd;
return fd; return fd;
...@@ -473,9 +484,20 @@ fprintf(stderr,"SetCommState: fd %d, ptr %d\n", lpdcb->Id, lpdcb); ...@@ -473,9 +484,20 @@ fprintf(stderr,"SetCommState: fd %d, ptr %d\n", lpdcb->Id, lpdcb);
commerror = WinError(); commerror = WinError();
return -1; return -1;
} }
cfmakeraw(&port);
port.c_cc[VMIN] = 0; port.c_cc[VMIN] = 0;
port.c_cc[VTIME] = 0; port.c_cc[VTIME] = 1;
port.c_iflag &= ~(ISTRIP|BRKINT|IGNCR|ICRNL|INLCR|IMAXBEL);
port.c_iflag |= (IGNBRK);
port.c_oflag &= ~(OPOST);
port.c_cflag &= ~(HUPCL);
port.c_cflag |= CLOCAL | CREAD;
port.c_lflag &= ~(ICANON|ECHO|ISIG);
port.c_lflag |= NOFLSH;
fprintf(stderr,"SetCommState: baudrate %d\n",lpdcb->BaudRate); fprintf(stderr,"SetCommState: baudrate %d\n",lpdcb->BaudRate);
#ifdef CBAUD #ifdef CBAUD
......
...@@ -7,7 +7,6 @@ static char Copyright[] = "Copyright Martin Ayotte, 1993"; ...@@ -7,7 +7,6 @@ static char Copyright[] = "Copyright Martin Ayotte, 1993";
#define DEBUG_CURSOR #define DEBUG_CURSOR
*/ */
#include <X11/Intrinsic.h>
#include <X11/cursorfont.h> #include <X11/cursorfont.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <stdio.h> #include <stdio.h>
...@@ -293,6 +292,30 @@ BOOL DestroyCursor(HCURSOR hCursor) ...@@ -293,6 +292,30 @@ BOOL DestroyCursor(HCURSOR hCursor)
/********************************************************************** /**********************************************************************
* CURSOR_SetWinCursor
*
* Set the cursor for a given window. To be used instead of SetCursor()
* wherever possible.
*/
HCURSOR CURSOR_SetWinCursor( HWND hwnd, HCURSOR hCursor )
{
CURSORALLOC *lpcur;
HCURSOR hOldCursor;
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr || !hCursor) return 0;
lpcur = (CURSORALLOC *)GlobalLock(hCursor);
hOldCursor = hActiveCursor;
if (hActiveCursor != hCursor) ShowCursCount = 0;
if (ShowCursCount >= 0)
XDefineCursor( display, wndPtr->window, lpcur->xcursor );
GlobalUnlock(hCursor);
hActiveCursor = hCursor;
return hOldCursor;
}
/**********************************************************************
* SetCursor [USER.69] * SetCursor [USER.69]
*/ */
HCURSOR SetCursor(HCURSOR hCursor) HCURSOR SetCursor(HCURSOR hCursor)
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef __linux__ #if defined(__linux__) || defined(sun)
#include <sys/vfs.h> #include <sys/vfs.h>
#endif #endif
#if defined(__NetBSD__) || defined(__FreeBSD__) #if defined(__NetBSD__) || defined(__FreeBSD__)
...@@ -73,15 +73,6 @@ void DOS_InitFS(void) ...@@ -73,15 +73,6 @@ void DOS_InitFS(void)
ToDos(TempDirectory); ToDos(TempDirectory);
ToDos(WindowsPath); ToDos(WindowsPath);
#ifdef DEBUG
fprintf(stderr,"wine.ini = %s\n",WINE_INI);
fprintf(stderr,"win.ini = %s\n",WIN_INI);
fprintf(stderr,"windir = %s\n",WindowsDirectory);
fprintf(stderr,"sysdir = %s\n",SystemDirectory);
fprintf(stderr,"tempdir = %s\n",TempDirectory);
fprintf(stderr,"path = %s\n",WindowsPath);
#endif
for (x=0; x!=MAX_DOS_DRIVES; x++) { for (x=0; x!=MAX_DOS_DRIVES; x++) {
DosDrives[x].serialnumber = (0xEB0500L | x); DosDrives[x].serialnumber = (0xEB0500L | x);
...@@ -104,14 +95,11 @@ void DOS_InitFS(void) ...@@ -104,14 +95,11 @@ void DOS_InitFS(void)
temp[strlen(temp)] = '\0'; temp[strlen(temp)] = '\0';
DosDrives[x].rootdir = ptr; DosDrives[x].rootdir = ptr;
strcpy(DosDrives[x].rootdir, temp); strcpy(DosDrives[x].rootdir, temp);
strcpy(DosDrives[x].cwd, "/windows/"); strcpy(DosDrives[x].cwd, "/");
strcpy(DosDrives[x].label, "DRIVE-"); strcpy(DosDrives[x].label, "DRIVE-");
strcat(DosDrives[x].label, drive); strcat(DosDrives[x].label, drive);
DosDrives[x].disabled = 0; DosDrives[x].disabled = 0;
} }
atexit(DOS_DeInitFS);
DOS_SetDefaultDrive(2); DOS_SetDefaultDrive(2);
for (x=0; x!=MAX_DOS_DRIVES; x++) { for (x=0; x!=MAX_DOS_DRIVES; x++) {
...@@ -132,6 +120,14 @@ void DOS_InitFS(void) ...@@ -132,6 +120,14 @@ void DOS_InitFS(void)
for (x=0; x!=MAX_OPEN_DIRS ; x++) for (x=0; x!=MAX_OPEN_DIRS ; x++)
DosDirs[x].inuse = 0; DosDirs[x].inuse = 0;
#ifdef DEBUG
fprintf(stderr,"wine.ini = %s\n",WINE_INI);
fprintf(stderr,"win.ini = %s\n",WIN_INI);
fprintf(stderr,"windir = %s\n",WindowsDirectory);
fprintf(stderr,"sysdir = %s\n",SystemDirectory);
fprintf(stderr,"tempdir = %s\n",TempDirectory);
fprintf(stderr,"path = %s\n",WindowsPath);
#endif
} }
void DOS_DeInitFS(void) void DOS_DeInitFS(void)
...@@ -187,7 +183,7 @@ WORD DOS_GetEquipment(void) ...@@ -187,7 +183,7 @@ WORD DOS_GetEquipment(void)
if (diskdrives) if (diskdrives)
diskdrives--; diskdrives--;
equipment = diskdrives << 6; equipment = (diskdrives << 6) || 0x02;
return (equipment); return (equipment);
} }
...@@ -633,17 +629,23 @@ fprintf(stderr,"FindFile: looking for %s\n",rootname); ...@@ -633,17 +629,23 @@ fprintf(stderr,"FindFile: looking for %s\n",rootname);
*/ */
char *WineIniFileName(void) char *WineIniFileName(void)
{ {
static char *IniName = NULL; static char *IniName = NULL, *env;
char inipath[256]; char inipath[256];
if (IniName) if (IniName)
return IniName; return IniName;
getcwd(inipath, 256); getcwd(inipath, 256);
strcat(inipath, ";");
strcat(inipath, getenv("HOME")); if ((env = getenv("HOME")) !=NULL) {
strcat(inipath, ";"); strcat(inipath, ";");
strcat(inipath, getenv("WINEPATH")); strcat(inipath, env);
}
if ((env = getenv("WINEPATH")) !=NULL) {
strcat(inipath, ";");
strcat(inipath, env);
}
IniName = malloc(1024); IniName = malloc(1024);
if (FindFile(IniName, 1024, "wine.ini", NULL, inipath) == NULL) if (FindFile(IniName, 1024, "wine.ini", NULL, inipath) == NULL)
...@@ -672,6 +674,43 @@ char *WinIniFileName() ...@@ -672,6 +674,43 @@ char *WinIniFileName()
return name; return name;
} }
int match(char *filename, char *filemask)
{
int x, masklength = strlen(filemask);
#ifdef DEBUG
fprintf(stderr, "match: %s, %s\n", filename, filemask);
#endif
for (x = 0; x != masklength ; x++) {
#ifdef DEBUG
printf("(%c%c) ", *filename, filemask[x]);
#endif
if (!*filename)
/* stop if EOFname */
return 1;
if (filemask[x] == '?') {
/* skip the next char */
filename++;
continue;
}
if (filemask[x] == '*') {
/* skip each char until '.' or EOFname */
while (*filename && *filename !='.')
filename++;
continue;
}
if (filemask[x] != *filename)
return 0;
filename++;
}
return 1;
}
struct dosdirent *DOS_opendir(char *dosdirname) struct dosdirent *DOS_opendir(char *dosdirname)
{ {
int x,y; int x,y;
...@@ -687,21 +726,24 @@ struct dosdirent *DOS_opendir(char *dosdirname) ...@@ -687,21 +726,24 @@ struct dosdirent *DOS_opendir(char *dosdirname)
if ((unixdirname = GetDirectUnixFileName(dosdirname)) == NULL) if ((unixdirname = GetDirectUnixFileName(dosdirname)) == NULL)
return NULL; return NULL;
strcpy(temp,unixdirname); strcpy(temp, unixdirname);
y = strlen(temp); y = strlen(temp);
while (y--) while (y--)
{ {
if (temp[y] == '/') if (temp[y] == '/')
{ {
temp[y] = '\0'; temp[y++] = '\0';
strcpy(DosDirs[x].filemask, temp +y);
ToDos(DosDirs[x].filemask);
break; break;
} }
} }
fprintf(stderr,"%s -> %s\n",unixdirname,temp); #ifdef DEBUG
fprintf(stderr,"DOS_opendir: %s -> %s\n", unixdirname, temp);
#endif
DosDirs[x].inuse = 1; DosDirs[x].inuse = 1;
strcpy(DosDirs[x].unixpath, temp); strcpy(DosDirs[x].unixpath, temp);
...@@ -722,17 +764,20 @@ struct dosdirent *DOS_readdir(struct dosdirent *de) ...@@ -722,17 +764,20 @@ struct dosdirent *DOS_readdir(struct dosdirent *de)
if (!de->inuse) if (!de->inuse)
return NULL; return NULL;
if ((d = readdir(de->ds)) == NULL) do {
{ if ((d = readdir(de->ds)) == NULL)
closedir(de->ds); {
de->inuse = 0; closedir(de->ds);
return de; de->inuse = 0;
} return de;
}
strcpy(de->filename, d->d_name); strcpy(de->filename, d->d_name);
if (d->d_reclen > 12) if (d->d_reclen > 12)
de->filename[12] = '\0'; de->filename[12] = '\0';
ToDos (de->filename);
ToDos(de->filename);
} while ( !match(de->filename, de->filemask) );
de->attribute = 0x0; de->attribute = 0x0;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
*/ */
#include "win.h" #include "windows.h"
#define HELP_CONTEXT 0x0001 #define HELP_CONTEXT 0x0001
#define HELP_QUIT 0x0002 #define HELP_QUIT 0x0002
...@@ -25,7 +25,7 @@ WORD WinExec(LPSTR lpCmdLine, WORD nCmdShow) ...@@ -25,7 +25,7 @@ WORD WinExec(LPSTR lpCmdLine, WORD nCmdShow)
{ {
int X, X2, C; int X, X2, C;
char *ArgV[20]; char *ArgV[20];
printf("WinExec(%s, %u)\n", lpCmdLine, nCmdShow); printf("WinExec('%s', %04X)\n", lpCmdLine, nCmdShow);
for (X = X2 = C = 0; X < strlen(lpCmdLine) + 1; X++) { for (X = X2 = C = 0; X < strlen(lpCmdLine) + 1; X++) {
if ((lpCmdLine[X] == ' ') || (lpCmdLine[X] == '\0')) { if ((lpCmdLine[X] == ' ') || (lpCmdLine[X] == '\0')) {
ArgV[C] = (char *)malloc(X - X2 + 1); ArgV[C] = (char *)malloc(X - X2 + 1);
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <stdio.h> #include <stdio.h>
#include <fcntl.h> #include <fcntl.h>
#include <limits.h> #include <limits.h>
#include <unistd.h>
#include "prototypes.h" #include "prototypes.h"
char WindowsDirectory[256], SystemDirectory[256], TempDirectory[256]; char WindowsDirectory[256], SystemDirectory[256], TempDirectory[256];
...@@ -33,7 +34,7 @@ char WindowsDirectory[256], SystemDirectory[256], TempDirectory[256]; ...@@ -33,7 +34,7 @@ char WindowsDirectory[256], SystemDirectory[256], TempDirectory[256];
Emulate the _lopen windows call Emulate the _lopen windows call
***************************************************************************/ ***************************************************************************/
WORD KERNEL__lopen (LPSTR lpPathName, WORD iReadWrite) int _lopen (LPSTR lpPathName, int iReadWrite)
{ {
int handle; int handle;
char *UnixFileName; char *UnixFileName;
...@@ -60,7 +61,7 @@ WORD KERNEL__lopen (LPSTR lpPathName, WORD iReadWrite) ...@@ -60,7 +61,7 @@ WORD KERNEL__lopen (LPSTR lpPathName, WORD iReadWrite)
/*************************************************************************** /***************************************************************************
_lread _lread
***************************************************************************/ ***************************************************************************/
WORD KERNEL__lread (WORD hFile, LPSTR lpBuffer, WORD wBytes) WORD _lread (int hFile, LPSTR lpBuffer, int wBytes)
{ {
int result; int result;
...@@ -80,7 +81,7 @@ WORD KERNEL__lread (WORD hFile, LPSTR lpBuffer, WORD wBytes) ...@@ -80,7 +81,7 @@ WORD KERNEL__lread (WORD hFile, LPSTR lpBuffer, WORD wBytes)
/**************************************************************************** /****************************************************************************
_lwrite _lwrite
****************************************************************************/ ****************************************************************************/
WORD KERNEL__lwrite (WORD hFile, LPSTR lpBuffer, WORD wBytes) WORD _lwrite (int hFile, LPSTR lpBuffer, int wBytes)
{ {
int result; int result;
...@@ -99,7 +100,7 @@ WORD KERNEL__lwrite (WORD hFile, LPSTR lpBuffer, WORD wBytes) ...@@ -99,7 +100,7 @@ WORD KERNEL__lwrite (WORD hFile, LPSTR lpBuffer, WORD wBytes)
/*************************************************************************** /***************************************************************************
_lclose _lclose
***************************************************************************/ ***************************************************************************/
WORD KERNEL__lclose (WORD hFile) int _lclose (int hFile)
{ {
#ifdef DEBUG_FILE #ifdef DEBUG_FILE
fprintf(stderr, "_lclose: handle %d\n", hFile); fprintf(stderr, "_lclose: handle %d\n", hFile);
...@@ -114,7 +115,7 @@ WORD KERNEL__lclose (WORD hFile) ...@@ -114,7 +115,7 @@ WORD KERNEL__lclose (WORD hFile)
Warning: This is nearly totally untested. It compiles, that's it... Warning: This is nearly totally untested. It compiles, that's it...
-SL 9/13/93 -SL 9/13/93
**************************************************************************/ **************************************************************************/
WORD KERNEL_OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle) int OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle)
{ {
int base,flags; int base,flags;
...@@ -141,7 +142,7 @@ WORD KERNEL_OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle) ...@@ -141,7 +142,7 @@ WORD KERNEL_OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle)
} }
else else
{ {
return KERNEL__lopen (lpFileName, wStyle); return _lopen (lpFileName, wStyle);
} }
} }
...@@ -152,6 +153,10 @@ WORD KERNEL_OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle) ...@@ -152,6 +153,10 @@ WORD KERNEL_OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle)
Linux isn't limited to 20 files, this one's easy. - SL Linux isn't limited to 20 files, this one's easy. - SL
**************************************************************************/ **************************************************************************/
#if !defined (OPEN_MAX)
/* This one is for the Sun */
#define OPEN_MAX _POSIX_OPEN_MAX
#endif
WORD SetHandleCount (WORD wNumber) WORD SetHandleCount (WORD wNumber)
{ {
printf("SetHandleCount(%d)\n",wNumber); printf("SetHandleCount(%d)\n",wNumber);
...@@ -161,7 +166,7 @@ WORD SetHandleCount (WORD wNumber) ...@@ -161,7 +166,7 @@ WORD SetHandleCount (WORD wNumber)
/*************************************************************************** /***************************************************************************
_llseek _llseek
***************************************************************************/ ***************************************************************************/
LONG KERNEL__llseek (WORD hFile, LONG lOffset, int nOrigin) LONG _llseek (int hFile, LONG lOffset, int nOrigin)
{ {
int origin; int origin;
...@@ -184,7 +189,7 @@ LONG KERNEL__llseek (WORD hFile, LONG lOffset, int nOrigin) ...@@ -184,7 +189,7 @@ LONG KERNEL__llseek (WORD hFile, LONG lOffset, int nOrigin)
/*************************************************************************** /***************************************************************************
_lcreate _lcreate
***************************************************************************/ ***************************************************************************/
LONG KERNEL__lcreate (LPSTR lpszFilename, int fnAttribute) LONG _lcreate (LPSTR lpszFilename, int fnAttribute)
{ {
int handle; int handle;
char *UnixFileName; char *UnixFileName;
......
...@@ -20,13 +20,15 @@ Screen * XT_screen; /* To be removed */ ...@@ -20,13 +20,15 @@ Screen * XT_screen; /* To be removed */
Display * display; Display * display;
Screen * screen; Screen * screen;
char *ProgramName; /* Used by resource.c with WINELIB */
struct options Options = struct options Options =
{ /* default options */ { /* default options */
NULL, /* spyFilename */ NULL, /* spyFilename */
FALSE, /* usePrivateMap */ FALSE, /* usePrivateMap */
FALSE, /* synchronous */ FALSE, /* synchronous */
SW_SHOWNORMAL /* cmdShow */ SW_SHOWNORMAL, /* cmdShow */
FALSE
}; };
...@@ -36,7 +38,8 @@ static XrmOptionDescRec optionsTable[] = ...@@ -36,7 +38,8 @@ static XrmOptionDescRec optionsTable[] =
{ "-iconic", ".iconic", XrmoptionNoArg, (caddr_t)"on" }, { "-iconic", ".iconic", XrmoptionNoArg, (caddr_t)"on" },
{ "-privatemap", ".privatemap", XrmoptionNoArg, (caddr_t)"on" }, { "-privatemap", ".privatemap", XrmoptionNoArg, (caddr_t)"on" },
{ "-synchronous", ".synchronous", XrmoptionNoArg, (caddr_t)"on" }, { "-synchronous", ".synchronous", XrmoptionNoArg, (caddr_t)"on" },
{ "-spy", ".spy", XrmoptionSepArg, (caddr_t)NULL } { "-spy", ".spy", XrmoptionSepArg, (caddr_t)NULL },
{ "-relaydbg", ".relaydbg", XrmoptionNoArg, (caddr_t)"on" }
}; };
#define NB_OPTIONS (sizeof(optionsTable) / sizeof(optionsTable[0])) #define NB_OPTIONS (sizeof(optionsTable) / sizeof(optionsTable[0]))
...@@ -66,8 +69,11 @@ static void MAIN_ParseOptions( int *argc, char *argv[] ) ...@@ -66,8 +69,11 @@ static void MAIN_ParseOptions( int *argc, char *argv[] )
XrmDatabase db = NULL; XrmDatabase db = NULL;
XrmParseCommand( &db, optionsTable, NB_OPTIONS, "wine", argc, argv ); XrmParseCommand( &db, optionsTable, NB_OPTIONS, "wine", argc, argv );
#ifdef WINELIB
/* Need to assemble command line and pass it to WinMain */
#else
if (*argc < 2) MAIN_Usage( argv[0] ); if (*argc < 2) MAIN_Usage( argv[0] );
#endif
if (XrmGetResource( db, "wine.display", "Wine.display", &dummy, &value )) if (XrmGetResource( db, "wine.display", "Wine.display", &dummy, &value ))
display_name = value.addr; display_name = value.addr;
else display_name = NULL; else display_name = NULL;
...@@ -85,6 +91,8 @@ static void MAIN_ParseOptions( int *argc, char *argv[] ) ...@@ -85,6 +91,8 @@ static void MAIN_ParseOptions( int *argc, char *argv[] )
Options.usePrivateMap = TRUE; Options.usePrivateMap = TRUE;
if (XrmGetResource(db,"wine.synchronous","Wine.synchronous",&dummy,&value)) if (XrmGetResource(db,"wine.synchronous","Wine.synchronous",&dummy,&value))
Options.synchronous = TRUE; Options.synchronous = TRUE;
if (XrmGetResource(db,"wine.relaydbg","Wine.relaydbg",&dummy,&value))
Options.relay_debug = TRUE;
if (XrmGetResource(db,"wine.spy","Wine.spy",&dummy,&value)) if (XrmGetResource(db,"wine.spy","Wine.spy",&dummy,&value))
Options.spyFilename = value.addr; Options.spyFilename = value.addr;
} }
...@@ -95,7 +103,10 @@ static void MAIN_ParseOptions( int *argc, char *argv[] ) ...@@ -95,7 +103,10 @@ static void MAIN_ParseOptions( int *argc, char *argv[] )
*/ */
int main( int argc, char *argv[] ) int main( int argc, char *argv[] )
{ {
int ret_val;
XKeyboardState keyboard_state;
XKeyboardControl keyboard_value;
XrmInitialize(); XrmInitialize();
MAIN_ParseOptions( &argc, argv ); MAIN_ParseOptions( &argc, argv );
...@@ -105,16 +116,171 @@ int main( int argc, char *argv[] ) ...@@ -105,16 +116,171 @@ int main( int argc, char *argv[] )
XT_screen = screen; XT_screen = screen;
if (Options.synchronous) XSynchronize( display, True ); if (Options.synchronous) XSynchronize( display, True );
XGetKeyboardControl(display, &keyboard_state);
ProgramName = argv [0];
DOS_InitFS(); DOS_InitFS();
Comm_Init(); Comm_Init();
return _WinMain( argc, argv );
}
ret_val = _WinMain( argc, argv );
Comm_DeInit ();
DOS_DeInitFS ();
sync_profiles ();
/* restore sounds/keyboard settings */
keyboard_value.key_click_percent = keyboard_state.key_click_percent;
keyboard_value.bell_percent = keyboard_state.bell_percent;
keyboard_value.bell_pitch = keyboard_state.bell_pitch;
keyboard_value.bell_duration = keyboard_state.bell_duration;
keyboard_value.auto_repeat_mode = keyboard_state.global_auto_repeat;
XChangeKeyboardControl(display, KBKeyClickPercent | KBBellPercent |
KBBellPitch | KBBellDuration | KBAutoRepeatMode, &keyboard_value);
return ret_val;
}
/*********************************************************************** /***********************************************************************
* MessageBeep (USER.104) * MessageBeep (USER.104)
*/ */
void MessageBeep( WORD i ) void MessageBeep( WORD i )
{ {
XBell( display, 100 ); XBell(display, 100);
}
/***********************************************************************
* GetVersion (KERNEL.3)
*/
LONG GetVersion(void)
{
return (0x04001003); /* dos version 4.00, win ver 3.1 */
}
/***********************************************************************
* GetWinFlags (KERNEL.132)
*/
LONG GetWinFlags(void)
{
return (WF_STANDARD | WF_CPU286 | WF_PMODE | WF_80x87);
}
/***********************************************************************
* GetTimerResolution (USER.14)
*/
LONG GetTimerResolution(void)
{
return (1000);
}
/***********************************************************************
* SystemParametersInfo (USER.483)
*/
BOOL SystemParametersInfo (UINT uAction, UINT uParam, void FAR *lpvParam, UINT fuWinIni)
{
XKeyboardState keyboard_state;
XKeyboardControl keyboard_value;
fprintf(stderr, "SystemParametersInfo: action %d, param %x, flag %x\n",
uAction, uParam, fuWinIni);
switch (uAction) {
case SPI_GETBEEP:
XGetKeyboardControl(display, &keyboard_state);
if (keyboard_state.bell_percent == 0)
*(BOOL *) lpvParam = FALSE;
else
*(BOOL *) lpvParam = TRUE;
break;
case SPI_GETBORDER:
*(int *) lpvParam = 1;
break;
case SPI_GETFASTTASKSWITCH:
*(BOOL *) lpvParam = FALSE;
break;
case SPI_GETGRIDGRANULARITY:
*(int *) lpvParam = 1;
break;
case SPI_GETICONTITLEWRAP:
*(BOOL *) lpvParam = FALSE;
break;
case SPI_GETKEYBOARDDELAY:
*(int *) lpvParam = 1;
break;
case SPI_GETKEYBOARDSPEED:
*(WORD *) lpvParam = 30;
break;
case SPI_GETMENUDROPALIGNMENT:
*(BOOL *) lpvParam = FALSE;
break;
case SPI_GETSCREENSAVEACTIVE:
*(WORD *) lpvParam = FALSE;
break;
case SPI_GETSCREENSAVETIMEOUT:
*(int *) lpvParam = 0;
break;
case SPI_ICONHORIZONTALSPACING:
if (lpvParam == NULL)
fprintf(stderr, "SystemParametersInfo: Horizontal icon spacing set to %d\n.", uParam);
else
*(int *) lpvParam = 50;
break;
case SPI_ICONVERTICALSPACING:
if (lpvParam == NULL)
fprintf(stderr, "SystemParametersInfo: Vertical icon spacing set to %d\n.", uParam);
else
*(int *) lpvParam = 50;
break;
case SPI_SETBEEP:
if (uParam == TRUE)
keyboard_value.bell_percent = -1;
else
keyboard_value.bell_percent = 0;
XChangeKeyboardControl(display, KBBellPercent,
&keyboard_value);
break;
case SPI_SETSCREENSAVEACTIVE:
if (uParam == TRUE)
XActivateScreenSaver(display);
else
XResetScreenSaver(display);
break;
case SPI_SETSCREENSAVETIMEOUT:
XSetScreenSaver(display, uParam, 60, DefaultBlanking,
DefaultExposures);
break;
case SPI_LANGDRIVER:
case SPI_SETBORDER:
case SPI_SETDESKPATTERN:
case SPI_SETDESKWALLPAPER:
case SPI_SETDOUBLECLKHEIGHT:
case SPI_SETDOUBLECLICKTIME:
case SPI_SETDOUBLECLKWIDTH:
case SPI_SETFASTTASKSWITCH:
case SPI_SETKEYBOARDDELAY:
case SPI_SETKEYBOARDSPEED:
fprintf(stderr, "SystemParametersInfo: option %d ignored.\n", uParam);
break;
default:
fprintf(stderr, "SystemParametersInfo: unknown option %d.\n", uParam);
break;
}
return 1;
} }
...@@ -17,6 +17,8 @@ static char Copyright[] = "Copyright Martin Ayotte, 1993"; ...@@ -17,6 +17,8 @@ static char Copyright[] = "Copyright Martin Ayotte, 1993";
#include "heap.h" #include "heap.h"
#include "win.h" #include "win.h"
extern HINSTANCE hSysRes;
extern HBITMAP hUpArrow;
typedef struct tagMSGBOX { typedef struct tagMSGBOX {
LPSTR Title; LPSTR Title;
...@@ -39,7 +41,7 @@ LONG SystemMessageBoxProc(HWND hwnd, WORD message, WORD wParam, LONG lParam); ...@@ -39,7 +41,7 @@ LONG SystemMessageBoxProc(HWND hwnd, WORD message, WORD wParam, LONG lParam);
* MessageBox [USER.1] * MessageBox [USER.1]
*/ */
int MessageBox( HWND hWnd, LPSTR str, LPSTR title, WORD type ) int MessageBox(HWND hWnd, LPSTR str, LPSTR title, WORD type)
{ {
HWND hDlg; HWND hDlg;
WND *wndPtr; WND *wndPtr;
...@@ -47,15 +49,20 @@ int MessageBox( HWND hWnd, LPSTR str, LPSTR title, WORD type ) ...@@ -47,15 +49,20 @@ int MessageBox( HWND hWnd, LPSTR str, LPSTR title, WORD type )
MSG msg; MSG msg;
MSGBOX mb; MSGBOX mb;
DWORD dwStyle; DWORD dwStyle;
HINSTANCE hInst;
wndPtr = WIN_FindWndPtr(hWnd); wndPtr = WIN_FindWndPtr(hWnd);
#ifdef DEBUG_MSGBOX #ifdef DEBUG_MSGBOX
printf( "MessageBox: '%s'\n", str ); printf( "MessageBox: '%s'\n", str );
#endif #endif
if (wndPtr == NULL)
hInst = hSysRes;
else
hInst = wndPtr->hInstance;
wndClass.style = CS_HREDRAW | CS_VREDRAW ; wndClass.style = CS_HREDRAW | CS_VREDRAW ;
wndClass.lpfnWndProc = (WNDPROC)SystemMessageBoxProc; wndClass.lpfnWndProc = (WNDPROC)SystemMessageBoxProc;
wndClass.cbClsExtra = 0; wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0; wndClass.cbWndExtra = 0;
wndClass.hInstance = wndPtr->hInstance; wndClass.hInstance = hInst;
wndClass.hIcon = (HICON)NULL; wndClass.hIcon = (HICON)NULL;
wndClass.hCursor = LoadCursor((HANDLE)NULL, IDC_ARROW); wndClass.hCursor = LoadCursor((HANDLE)NULL, IDC_ARROW);
wndClass.hbrBackground = GetStockObject(WHITE_BRUSH); wndClass.hbrBackground = GetStockObject(WHITE_BRUSH);
...@@ -70,7 +77,7 @@ int MessageBox( HWND hWnd, LPSTR str, LPSTR title, WORD type ) ...@@ -70,7 +77,7 @@ int MessageBox( HWND hWnd, LPSTR str, LPSTR title, WORD type )
dwStyle = WS_POPUP | WS_DLGFRAME | WS_VISIBLE; dwStyle = WS_POPUP | WS_DLGFRAME | WS_VISIBLE;
if ((type & (MB_SYSTEMMODAL | MB_TASKMODAL)) == 0) dwStyle |= WS_CAPTION; if ((type & (MB_SYSTEMMODAL | MB_TASKMODAL)) == 0) dwStyle |= WS_CAPTION;
hDlg = CreateWindow("MESSAGEBOX", title, dwStyle, 100, 150, 400, 120, hDlg = CreateWindow("MESSAGEBOX", title, dwStyle, 100, 150, 400, 120,
(HWND)NULL, (HMENU)NULL, wndPtr->hInstance, (LPSTR)&mb); (HWND)NULL, (HMENU)NULL, hInst, (LPSTR)&mb);
if (hDlg == 0) return 0; if (hDlg == 0) return 0;
while(TRUE) { while(TRUE) {
if (!mb.ActiveFlg) break; if (!mb.ActiveFlg) break;
...@@ -78,15 +85,13 @@ int MessageBox( HWND hWnd, LPSTR str, LPSTR title, WORD type ) ...@@ -78,15 +85,13 @@ int MessageBox( HWND hWnd, LPSTR str, LPSTR title, WORD type )
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
} }
if (!UnregisterClass("MESSAGEBOX", wndPtr->hInstance)) return 0; if (!UnregisterClass("MESSAGEBOX", hInst)) return 0;
#ifdef DEBUG_MSGBOX #ifdef DEBUG_MSGBOX
printf( "MessageBox return %04X !\n", mb.wRetVal); printf( "MessageBox return %04X !\n", mb.wRetVal);
#endif #endif
return(mb.wRetVal); return(mb.wRetVal);
} }
LPMSGBOX MsgBoxGetStorageHeader(HWND hwnd) LPMSGBOX MsgBoxGetStorageHeader(HWND hwnd)
{ {
WND *wndPtr; WND *wndPtr;
...@@ -286,17 +291,13 @@ BOOL FAR PASCAL AboutWine_Proc(HWND hDlg, WORD msg, WORD wParam, LONG lParam) ...@@ -286,17 +291,13 @@ BOOL FAR PASCAL AboutWine_Proc(HWND hDlg, WORD msg, WORD wParam, LONG lParam)
CreditMode = FALSE; CreditMode = FALSE;
strcpy(str, "WINELOGO"); strcpy(str, "WINELOGO");
hBitMap = LoadBitmap((HINSTANCE)NULL, (LPSTR)str); hBitMap = LoadBitmap((HINSTANCE)NULL, (LPSTR)str);
/* getcwd(str, 256);
strcat(str, ";");
strcat(str, getenv("HOME"));
strcat(str, ";");
strcat(str, getenv("WINEPATH")); */
strcpy(str, "PROPOSED_LICENSE"); strcpy(str, "PROPOSED_LICENSE");
printf("str = '%s'\n", str); printf("str = '%s'\n", str);
hFile = KERNEL_OpenFile((LPSTR)str, &ofstruct, OF_READ); hFile = OpenFile((LPSTR)str, &ofstruct, OF_READ);
ptr = (LPSTR)malloc(2048); ptr = (LPSTR)malloc(2048);
lseek(hFile, 0L, SEEK_SET); lseek(hFile, 0L, SEEK_SET);
KERNEL__lread(hFile, ptr, 2000L); _lread(hFile, ptr, 2000L);
close(hFile); close(hFile);
return TRUE; return TRUE;
case WM_PAINT: case WM_PAINT:
...@@ -353,3 +354,12 @@ return FALSE; ...@@ -353,3 +354,12 @@ return FALSE;
} }
/**************************************************************************
* FatalAppExit [USER.137]
*/
void FatalAppExit(WORD wAction, LPSTR str)
{
MessageBox((HWND)NULL, str, NULL, MB_SYSTEMMODAL | MB_OK);
exit(1);
}
...@@ -90,7 +90,8 @@ void InflateRect( LPRECT rect, short x, short y ) ...@@ -90,7 +90,8 @@ void InflateRect( LPRECT rect, short x, short y )
*/ */
BOOL IntersectRect( LPRECT dest, LPRECT src1, LPRECT src2 ) BOOL IntersectRect( LPRECT dest, LPRECT src1, LPRECT src2 )
{ {
if ((src1->left >= src2->right) || (src2->left >= src1->right) || if (IsRectEmpty(src1) || IsRectEmpty(src2) ||
(src1->left >= src2->right) || (src2->left >= src1->right) ||
(src1->top >= src2->bottom) || (src2->top >= src1->bottom)) (src1->top >= src2->bottom) || (src2->top >= src1->bottom))
{ {
SetRectEmpty( dest ); SetRectEmpty( dest );
......
#ifndef WINELIB
static char RCSId[] = "$Id: resource.c,v 1.4 1993/07/04 04:04:21 root Exp root $"; 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"; static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#endif
#include <X11/Intrinsic.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include "arch.h"
#include "prototypes.h" #include "prototypes.h"
#include "windows.h" #include "windows.h"
#include "win.h"
#include "gdi.h" #include "gdi.h"
#include "wine.h" #include "wine.h"
#include "icon.h" #include "icon.h"
...@@ -35,6 +36,16 @@ extern HINSTANCE hSysRes; ...@@ -35,6 +36,16 @@ 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);
extern char *ProgramName;
/*****************************************************************************
* Super Patch, I promise to arrange things as soon as I can.
*
******************************************************************************/
#ifdef WINELIB
#include "../loader/wine.c"
#endif
/********************************************************************** /**********************************************************************
* OpenResourceFile * OpenResourceFile
...@@ -43,21 +54,28 @@ int ...@@ -43,21 +54,28 @@ int
OpenResourceFile(HANDLE instance) OpenResourceFile(HANDLE instance)
{ {
struct w_files *w; struct w_files *w;
char *res_file;
if (ResourceInst == instance) if (ResourceInst == instance)
return ResourceFd; return ResourceFd;
w = GetFileInfo(instance); w = GetFileInfo(instance);
if (w == NULL) if (w == NULL)
return -1; return -1;
ResourceFileInfo = w;
res_file = w->filename;
if (ResourceFd >= 0) if (ResourceFd >= 0)
close(ResourceFd); close(ResourceFd);
ResourceInst = instance; ResourceInst = instance;
ResourceFileInfo = w;
ResourceFd = open(w->filename, O_RDONLY); ResourceFd = open (res_file, O_RDONLY);
#ifdef DEBUG_RESOURCE
printf("OpenResourceFile(%04X) // file='%s' hFile=%04X !\n",
instance, w->filename, ResourceFd);
#endif
return ResourceFd; return ResourceFd;
} }
...@@ -128,6 +146,12 @@ ConvertInfoBitmap( HDC hdc, BITMAPINFO * image ) ...@@ -128,6 +146,12 @@ ConvertInfoBitmap( HDC hdc, BITMAPINFO * image )
bits, image, DIB_RGB_COLORS ); bits, image, DIB_RGB_COLORS );
} }
#ifndef WINELIB
load_typeinfo (int fd, struct resource_typeinfo_s *typeinfo)
{
return read (fd, typeinfo, sizeof (*typeinfo)) == sizeof (*typeinfo);
}
#endif
/********************************************************************** /**********************************************************************
* FindResourceByNumber * FindResourceByNumber
*/ */
...@@ -157,26 +181,30 @@ FindResourceByNumber(struct resource_nameinfo_s *result_p, ...@@ -157,26 +181,30 @@ FindResourceByNumber(struct resource_nameinfo_s *result_p,
printf("FindResourceByNumber (%s) bad block size !\n", resource_id); printf("FindResourceByNumber (%s) bad block size !\n", resource_id);
return -1; return -1;
} }
size_shift = CONV_SHORT(size_shift);
/* /*
* Find resource. * Find resource.
*/ */
typeinfo.type_id = 0xffff; typeinfo.type_id = 0xffff;
while (typeinfo.type_id != 0) { while (typeinfo.type_id != 0) {
if (read(ResourceFd, &typeinfo, sizeof(typeinfo)) != if (!load_typeinfo (ResourceFd, &typeinfo)){
sizeof(typeinfo)) {
printf("FindResourceByNumber (%X) bad typeinfo size !\n", resource_id); printf("FindResourceByNumber (%X) bad typeinfo size !\n", resource_id);
return -1; return -1;
} }
#ifdef DEBUG_RESOURCE #ifdef DEBUG_RESOURCE
printf("FindResourceByNumber type=%X count=%d\n", printf("FindResourceByNumber type=%X count=%d searched=%d \n",
typeinfo.type_id, typeinfo.count); typeinfo.type_id, typeinfo.count, type_id);
#endif #endif
if (typeinfo.type_id == 0) break; if (typeinfo.type_id == 0) break;
if (typeinfo.type_id == type_id || type_id == -1) { if (typeinfo.type_id == type_id || type_id == -1) {
for (i = 0; i < typeinfo.count; i++) { for (i = 0; i < typeinfo.count; i++) {
#ifndef WINELIB
if (read(ResourceFd, &nameinfo, sizeof(nameinfo)) != if (read(ResourceFd, &nameinfo, sizeof(nameinfo)) !=
sizeof(nameinfo)) { sizeof(nameinfo))
#else
if (!load_nameinfo (ResourceFd, &nameinfo))
#endif
{
printf("FindResourceByNumber (%X) bad nameinfo size !\n", resource_id); printf("FindResourceByNumber (%X) bad nameinfo size !\n", resource_id);
return -1; return -1;
} }
...@@ -229,6 +257,7 @@ FindResourceByName(struct resource_nameinfo_s *result_p, ...@@ -229,6 +257,7 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
printf("FindResourceByName (%s) bad block size !\n", resource_name); printf("FindResourceByName (%s) bad block size !\n", resource_name);
return -1; return -1;
} }
size_shift = CONV_SHORT (size_shift);
/* /*
* Find resource. * Find resource.
...@@ -236,43 +265,55 @@ FindResourceByName(struct resource_nameinfo_s *result_p, ...@@ -236,43 +265,55 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
typeinfo.type_id = 0xffff; typeinfo.type_id = 0xffff;
while (typeinfo.type_id != 0) while (typeinfo.type_id != 0)
{ {
if (read(ResourceFd, &typeinfo, sizeof(typeinfo)) != if (!load_typeinfo (ResourceFd, &typeinfo))
sizeof(typeinfo))
{ {
printf("FindResourceByName (%s) bad typeinfo size !\n", resource_name); printf("FindResourceByName (%s) bad typeinfo size !\n", resource_name);
return -1; return -1;
} }
#ifdef DEBUG_RESOURCE #ifdef DEBUG_RESOURCE
printf("FindResourceByName typeinfo.type_id=%X type_id=%X\n", printf("FindResourceByName typeinfo.type_id=%X count=%d type_id=%X\n",
typeinfo.type_id, type_id); typeinfo.type_id, typeinfo.count, type_id);
#endif #endif
if (typeinfo.type_id == 0) break; if (typeinfo.type_id == 0) break;
if (typeinfo.type_id == type_id || type_id == -1) if (typeinfo.type_id == type_id || type_id == -1)
{ {
for (i = 0; i < typeinfo.count; i++) for (i = 0; i < typeinfo.count; i++)
{ {
#ifndef WINELIB
if (read(ResourceFd, &nameinfo, sizeof(nameinfo)) != if (read(ResourceFd, &nameinfo, sizeof(nameinfo)) !=
sizeof(nameinfo)) sizeof(nameinfo))
#else
if (!load_nameinfo (ResourceFd, &nameinfo))
#endif
{ {
printf("FindResourceByName (%s) bad nameinfo size !\n", resource_name); printf("FindResourceByName (%s) bad nameinfo size !\n", resource_name);
return -1; return -1;
} }
/*
if (nameinfo.id & 0x8000) if ((nameinfo.id & 0x8000) != 0) continue;
continue; */
#ifdef DEBUG_RESOURCE
printf("FindResourceByName // nameinfo.id=%04X !\n", nameinfo.id);
#endif
old_pos = lseek(ResourceFd, 0, SEEK_CUR); old_pos = lseek(ResourceFd, 0, SEEK_CUR);
new_pos = rtoff + nameinfo.id; new_pos = rtoff + nameinfo.id;
lseek(ResourceFd, new_pos, SEEK_SET); lseek(ResourceFd, new_pos, SEEK_SET);
read(ResourceFd, &nbytes, 1); read(ResourceFd, &nbytes, 1);
#ifdef DEBUG_RESOURCE
printf("FindResourceByName // namesize=%d !\n", nbytes);
#endif
nbytes = CONV_CHAR_TO_LONG (nbytes);
read(ResourceFd, name, nbytes); read(ResourceFd, name, nbytes);
lseek(ResourceFd, old_pos, SEEK_SET); lseek(ResourceFd, old_pos, SEEK_SET);
name[nbytes] = '\0'; name[nbytes] = '\0';
#ifdef DEBUG_RESOURCE #ifdef DEBUG_RESOURCE
printf("FindResourceByName type_id=%X name='%s' resource_name='%s'\n", printf("FindResourceByName type_id=%X (%d of %d) name='%s' resource_name='%s'\n",
typeinfo.type_id, name, resource_name); typeinfo.type_id, i + 1, typeinfo.count,
name, resource_name);
#endif #endif
if (strcasecmp(name, resource_name) == 0) /* if (strcasecmp(name, resource_name) == 0) */
if (strcasecmp(name, resource_name) == 0 ||
(nameinfo.id == 0x8001 && type_id == NE_RSCTYPE_MENU))
{ {
memcpy(result_p, &nameinfo, sizeof(nameinfo)); memcpy(result_p, &nameinfo, sizeof(nameinfo));
return size_shift; return size_shift;
...@@ -333,7 +374,6 @@ HICON LoadIcon(HANDLE instance, LPSTR icon_name) ...@@ -333,7 +374,6 @@ HICON LoadIcon(HANDLE instance, LPSTR icon_name)
ReleaseDC(GetDesktopWindow(), hdc); ReleaseDC(GetDesktopWindow(), hdc);
return 0; return 0;
} }
printf("LoadIcon Alloc hIcon=%X\n", hIcon);
lpico = (ICONALLOC *)GlobalLock(hIcon); lpico = (ICONALLOC *)GlobalLock(hIcon);
lpico->descriptor = *lpicodesc; lpico->descriptor = *lpicodesc;
width = lpicodesc->Width; width = lpicodesc->Width;
...@@ -390,6 +430,9 @@ HICON LoadIcon(HANDLE instance, LPSTR icon_name) ...@@ -390,6 +430,9 @@ HICON LoadIcon(HANDLE instance, LPSTR icon_name)
DeleteDC(hMemDC2); DeleteDC(hMemDC2);
ReleaseDC(GetDesktopWindow(), hdc); ReleaseDC(GetDesktopWindow(), hdc);
GlobalUnlock(hIcon); GlobalUnlock(hIcon);
#ifdef DEBUG_RESOURCE
printf("LoadIcon Alloc hIcon=%X\n", hIcon);
#endif
return hIcon; return hIcon;
} }
...@@ -679,7 +722,10 @@ RSC_LoadResource(int instance, char *rsc_name, int type, int *image_size_ret) ...@@ -679,7 +722,10 @@ RSC_LoadResource(int instance, char *rsc_name, int type, int *image_size_ret)
size_shift = FindResourceByName(&nameinfo, type, rsc_name); size_shift = FindResourceByName(&nameinfo, type, rsc_name);
} }
if (size_shift == -1) { if (size_shift == -1) {
printf("RSC_LoadResource / Resource '%X' not Found !\n", rsc_name); if ((LONG)rsc_name >= 0x00010000L)
printf("RSC_LoadResource / Resource '%s' not Found !\n", rsc_name);
else
printf("RSC_LoadResource / Resource '%X' not Found !\n", rsc_name);
return 0; return 0;
} }
/* /*
......
...@@ -18,6 +18,7 @@ extern BOOL ATOM_Init(); ...@@ -18,6 +18,7 @@ extern BOOL ATOM_Init();
extern BOOL GDI_Init(); extern BOOL GDI_Init();
extern void SYSMETRICS_Init(); extern void SYSMETRICS_Init();
#ifndef WINELIB
/*********************************************************************** /***********************************************************************
* USER_HeapInit * USER_HeapInit
*/ */
...@@ -29,7 +30,7 @@ static BOOL USER_HeapInit() ...@@ -29,7 +30,7 @@ static BOOL USER_HeapInit()
HEAP_Init( &USER_Heap, s->base_addr, USER_HEAP_SIZE ); HEAP_Init( &USER_Heap, s->base_addr, USER_HEAP_SIZE );
return TRUE; return TRUE;
} }
#endif
/********************************************************************** /**********************************************************************
* USER_InitApp * USER_InitApp
...@@ -52,9 +53,11 @@ USER_InitApp(int hInstance) ...@@ -52,9 +53,11 @@ USER_InitApp(int hInstance)
/* Initialize system colors and metrics*/ /* Initialize system colors and metrics*/
SYSMETRICS_Init(); SYSMETRICS_Init();
SYSCOLOR_Init(); SYSCOLOR_Init();
#ifndef WINELIB
/* Create USER heap */ /* Create USER heap */
if (!USER_HeapInit()) return 0; if (!USER_HeapInit()) return 0;
#endif
/* Create the DCEs */ /* Create the DCEs */
DCE_Init(); DCE_Init();
...@@ -72,6 +75,11 @@ USER_InitApp(int hInstance) ...@@ -72,6 +75,11 @@ USER_InitApp(int hInstance)
/* Create task message queue */ /* Create task message queue */
queueSize = GetProfileInt( "windows", "DefaultQueueSize", 8 ); queueSize = GetProfileInt( "windows", "DefaultQueueSize", 8 );
if (!SetMessageQueue( queueSize )) return 0; if (!SetMessageQueue( queueSize )) return 0;
#ifndef WINELIB
/* Initialize DLLs */
InitializeLoadedDLLs();
#endif
return 1; return 1;
} }
/*
* based on Windows Sockets 1.1 specs
* (ftp.microsoft.com:/Advsys/winsock/spec11/WINSOCK.TXT)
*/
#include <netdb.h>
#include <stdio.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 "winsock.h"
#define DEBUG_WINSOCK
/* XXX per task */
WORD wsa_errno;
int wsa_initted;
WORD errno_to_wsaerrno(int errno)
{
switch(errno) {
case ENETDOWN:
return WSAENETDOWN;
case EAFNOSUPPORT:
return WSAEAFNOSUPPORT;
case EMFILE:
return WSAEMFILE;
case ENOBUFS:
return WSAENOBUFS;
case EPROTONOSUPPORT:
return EPROTONOSUPPORT;
case EPROTOTYPE:
return WSAEPROTOTYPE;
case EBADF:
case ENOTSOCK:
return WSAENOTSOCK;
default:
#ifndef sun
#if defined(__FreeBSD__)
fprintf(stderr, "winsock: errno_to_wsaerrno translation failure.\n\t: %s (%d)\n",
sys_errlist[errno], errno);
#else
fprintf(stderr, "winsock: errno_to_wsaerrno translation failure.\n\t: %s (%d)\n",
strerror [errno], errno);
#endif
#else
fprintf (stderr, "winsock: errno_to_wsaerrno translation failure.\n");
#endif
break;
}
}
SOCKET Winsock_accept(SOCKET s, struct sockaddr FAR *addr, int FAR *addrlen)
{
int sock;
if ((sock = accept(s, addr, addrlen)) < 0) {
wsa_errno = errno_to_wsaerrno(errno);
return INVALID_SOCKET;
}
return sock;
}
int Winsock_bind(SOCKET s, struct sockaddr FAR *name, int namelen)
{
if (bind(s, name, namelen) < 0) {
wsa_errno = errno_to_wsaerrno(errno);
return SOCKET_ERROR;
}
return 0;
}
int Winsock_closesocket(SOCKET s)
{
if (close(s) < 0) {
wsa_errno = errno_to_wsaerrno(errno);
return SOCKET_ERROR;
}
return 0;
}
int Winsock_connect(SOCKET s, struct sockaddr FAR *name, int namelen)
{
if (connect(s, name, namelen) < 0) {
wsa_errno = errno_to_wsaerrno(errno);
return SOCKET_ERROR;
}
return 0;
}
int Winsock_getpeername(SOCKET s, struct sockaddr FAR *name, int FAR *namelen)
{
if (getpeername(s, name, namelen) < 0) {
wsa_errno = errno_to_wsaerrno(errno);
return SOCKET_ERROR;
}
return 0;
}
int Winsock_getsockname(SOCKET s, struct sockaddr FAR *name, int FAR *namelen)
{
if (getsockname(s, name, namelen) < 0) {
wsa_errno = errno_to_wsaerrno(errno);
return SOCKET_ERROR;
}
return 0;
}
int Winsock_getsockopt(SOCKET s, int loptname, char FAR *optval, int FAR *optlen)
{
if (getsockopt(s, 0, loptname, optval, optlen) < 0) {
wsa_errno = errno_to_wsaerrno(errno);
return SOCKET_ERROR;
}
return 0;
}
u_long Winsock_htonl(u_long hostlong)
{
return( htonl(hostlong) );
}
u_short Winsock_htons(u_short hostshort)
{
return( htons(hostshort) );
}
u_long Winsock_inet_addr(char FAR *cp)
{
return( inet_addr(cp) );
}
char *Winsock_inet_ntoa(struct in_addr in)
{
char *s;
if ((s = inet_ntoa(in)) == NULL) {
wsa_errno = errno_to_wsaerrno(errno);
return NULL;
}
return s;
}
int Winsock_ioctlsocket(SOCKET s, long cmd, u_long FAR *argp)
{
if (ioctl(s, cmd, argp) < 0) {
wsa_errno = errno_to_wsaerrno(errno);
return SOCKET_ERROR;
}
return 0;
}
int Winsock_listen(SOCKET s, int backlog)
{
if (listen(s, backlog) < 0) {
wsa_errno = errno_to_wsaerrno(errno);
return SOCKET_ERROR;
}
return 0;
}
u_long Winsock_ntohl(u_long netlong)
{
return( ntohl(netlong) );
}
u_short Winsock_ntohs(u_short netshort)
{
return( ntohs(netshort) );
}
int Winsock_recv(SOCKET s, char FAR *buf, int len, int flags)
{
int length;
if ((length = recv(s, buf, len, flags)) < 0) {
wsa_errno = errno_to_wsaerrno(errno);
return SOCKET_ERROR;
}
return length;
}
int Winsock_recvfrom(SOCKET s, char FAR *buf, int len, int flags,
struct sockaddr FAR *from, int FAR *fromlen)
{
int length;
if ((length = recvfrom(s, buf, len, flags, from, fromlen)) < 0) {
wsa_errno = errno_to_wsaerrno(errno);
return SOCKET_ERROR;
}
return length;
}
int Winsock_select(int nfds, fd_set FAR *readfds, fd_set FAR *writefds,
fd_set FAR *exceptfds, struct timeval FAR *timeout)
{
return(select(nfds, readfds, writefds, exceptfds, timeout));
}
int Winsock_send(SOCKET s, char FAR *buf, int len, int flags)
{
int length;
if ((length = send(s, buf, len, flags)) < 0) {
wsa_errno = errno_to_wsaerrno(errno);
return SOCKET_ERROR;
}
return length;
}
int Winsock_sendto(SOCKET s, char FAR *buf, int len, int flags,
struct sockaddr FAR *to, int tolen)
{
int length;
if ((length = sendto(s, buf, len, flags, to, tolen)) < 0) {
wsa_errno = errno_to_wsaerrno(errno);
return SOCKET_ERROR;
}
return length;
}
int Winsock_setsockopt(SOCKET s, int level, int optname, const char FAR *optval,
int optlen)
{
if (setsockopt(s, level, optname, optval, optlen) < 0) {
wsa_errno = errno_to_wsaerrno(errno);
return SOCKET_ERROR;
}
return 0;
}
int Winsock_shutdown(SOCKET s, int how)
{
if (shutdown(s, how) < 0) {
wsa_errno = errno_to_wsaerrno(errno);
return SOCKET_ERROR;
}
return 0;
}
SOCKET Winsock_socket(WORD af, WORD type, WORD protocol)
{
int sock;
#ifdef DEBUG_WINSOCK
printf("Winsock_socket: af=%d type=%d protocol=%d\n", af, type, protocol);
#endif
/* let the kernel do the dirty work..
if (!wsa_initted) {
wsa_errno = WSANOTINITIALISED;
return INVALID_SOCKET;
}
*/
if ((sock = socket(af, type, protocol)) < 0) {
wsa_errno = errno_to_wsaerrno(errno);
return INVALID_SOCKET;
}
return sock;
}
struct hostent *Winsock_gethostbyaddr(const char FAR *addr, int len, int type)
{
struct hostent *host;
if ((host = gethostbyaddr(addr, len, type)) == NULL) {
wsa_errno = errno_to_wsaerrno(errno);
return NULL;
}
return host;
}
struct hostent *Winsock_gethostbyname(const char FAR *name)
{
struct hostent *host;
if ((host = gethostbyname(name)) == NULL) {
wsa_errno = errno_to_wsaerrno(errno);
return NULL;
}
return host;
}
int Winsock_gethostname(char FAR *name, int namelen)
{
if (gethostname(name, namelen) < 0) {
wsa_errno = errno_to_wsaerrno(errno);
return SOCKET_ERROR;
}
return 0;
}
struct protoent *Winsock_getprotobyname(char FAR *name)
{
struct protoent *proto;
if ((proto = getprotobyname(name)) == NULL) {
wsa_errno = errno_to_wsaerrno(errno);
return NULL;
}
return proto;
}
struct protoent *Winsock_getprotobynumber(int number)
{
struct protoent *proto;
if ((proto = getprotobynumber(number)) == NULL) {
wsa_errno = errno_to_wsaerrno(errno);
return NULL;
}
return proto;
}
struct servent *Winsock_getservbyname(const char FAR *name, const char FAR *proto)
{
struct servent *service;
if ((service = getservbyname(name, proto)) == NULL) {
wsa_errno = errno_to_wsaerrno(errno);
return NULL;
}
return service;
}
struct servent *Winsock_getservbyport(int port, const char FAR *proto)
{
struct servent *service;
if ((service = getservbyport(port, proto)) == NULL) {
wsa_errno = errno_to_wsaerrno(errno);
return NULL;
}
return service;
}
HANDLE WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, const char FAR *addr,
int len, int type, const char FAR *buf, int buflen)
{
}
HANDLE WSAAsyncGetHostByName(HWND hWnd, u_int wMsg, const char FAR *name,
char FAR *buf, int buflen)
{
}
HANDLE WSAAsyncGetProtoByName(HWND hWnd, u_int wMsg, const char FAR *name,
char FAR *buf, int buflen)
{
}
HANDLE WSAAsyncGetProtoByNumber(HWND hWnd, u_int wMsg, int number,
char FAR *buf, int buflen)
{
}
HANDLE WSAAsyncGetServByName(HWND hWnd, u_int wMsg, const char FAR *name,
const char FAR *proto, char FAR *buf, int buflen)
{
}
HANDLE WSAAsyncGetServByPort(HWND hWnd, u_int wMsg, int port, const char FAR
*proto, char FAR *buf, int buflen)
{
}
int WSAAsyncSelect(SOCKET s, HWND hWnd, u_int wMsg, long lEvent)
{
}
int WSAFDIsSet(int fd, fd_set *set)
{
return( FD_ISSET(fd, set) );
}
WSACancelAsyncRequest(HANDLE hAsyncTaskHandle)
{
}
WSACancelBlockingCall ( void )
{
}
int WSAGetLastError(void)
{
return wsa_errno;
}
void WSASetLastError(int iError)
{
wsa_errno = iError;
}
BOOL WSAIsBlocking (void)
{
}
FARPROC WSASetBlockingHook(FARPROC lpBlockFunc)
{
}
int WSAUnhookBlockingHook(void)
{
}
WSADATA Winsock_data = {
0x0101,
0x0101,
"WINE Sockets",
#ifdef linux
"LINUX/i386",
#endif
#ifdef __NetBSD__
"NetBSD/i386",
#endif
#ifdef sunos
"SunOS",
#endif
128,
1024,
NULL
};
int WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData)
{
#ifdef DEBUG_WINSOCK
fprintf(stderr, "WSAStartup: verReq=%x\n", wVersionRequested);
#endif
if (LOBYTE(wVersionRequested) < 1 ||
(LOBYTE(wVersionRequested) == 1 &&
HIBYTE(wVersionRequested) < 1))
return WSAVERNOTSUPPORTED;
if (!lpWSAData)
return WSAEINVAL;
bcopy(&Winsock_data, lpWSAData, sizeof(Winsock_data));
wsa_initted = 1;
return(0);
}
int WSACleanup(void)
{
wsa_initted = 0;
return 0;
}
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