Commit ded3038c authored by Alexandre Julliard's avatar Alexandre Julliard

Release 950706

Wed Jul 5 19:06:35 1995 Alexandre Julliard <julliard@sunsite.unc.edu> * [controls/scroll.c] Fixed drawing bug that caused part of a non-client scroll bar to be painted even when the scroll-bar was hidden. * [debugger/break.c] [debugger/dbg.y] Rewrote breakpoint handling to work in 16-bit mode. Implemented single-stepping ('step' and 'next' instructions). * [debugger/debug.l] Format specifier is now a separate token. Entering an empty line at the debugger prompt causes the previous command to be repeated, like under gdb. * [debugger/debug.l] [debugger/registers.c] Differentiate 16-bit and 32-bit registers without taking current mode into account ($eax is always 32-bit, $ax always 16-bit). * [debugger/stack.c] Fixed stack information routines to differentiate between 16-bit and 32-bit stacks. * [loader/task.c] Option -debug now sets a breakpoint at the first instruction of every loaded task. * [miscemu/instr.c] Added handling of lock, repe and repne prefixes. * [objects/dib.c] Changed StretchDIBits() to do the correct thing, even if it's still not really optimal. * [windows/graphics.c] Fixes in RoundRect(), thanks to Babak Masalehdan. * [windows/message.c] Tried to fix mouse event handling with respect to disabled windows. * [windows/painting.c] Clear WIN_NEEDS_NCPAINT flag before sending WM_NCPAINT to avoid infinite loops. * [windows/win.c] Fixed IsWindowVisible() to return FALSE when one of the parent windows is hidden. Sat Jul 1 22:08:21 1995 Martin von Loewis <loewis@informatik.hu-berlin.de> * [if1632/compobj.spec][misc/compobj.c] CoGetMalloc: New function Added relay entries for COMPOBJ ordinals above 100 CoInitialize: Changed parameter to DWORD * [if1632/ole2.spec] Exported implementation of OleBuildVersion * [if1632/ole2disp.spec][misc/ole2disp.c][misc/Imakefile] ole2disp.c: New file SysAllocString, SysReallocString, SysAllocStringLen, SysReAllocStringLen, SysFreeString, SysStringLen: new functions * [if1632/ole2nls.spec][include/winnls.h][misc/ole2nls.c] CompareStringA: New function Thu Jun 29 19:42:02 1995 Marcus Meissner <msmeissn@faui01.informatik.uni-erlangen.de> * [objects/font.c] [if1632/gdi.spec] New stubs for CreateScalableFontResource, GetGlyphOutline. Thu Jun 29 13:47:08 GMT 1995 Gran Thyni (goran@norrsken.bildbasen.se) * [misc/commdlg.c] Extensive changes and bug fixes to FileDialog handling, behaves more like native Windows. Wed Jun 28 13:04:44 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [controls/listbox.c] [controls/combo.c] Some minor optimizations. * [memory/local.c] LOCAL_FindFreeBlock(): Never use the last one. * [memory/global.c] GlobalReAlloc(): GMEM_MODIFY must not be ignored when size==0. * [misc/file.c] read() returns an error when length==0. This is not what Windows programs expect, so pay attention to this in _lread(). Changed this in _lwrite(), _hread(), _hwrite(), too. * [loader/resource.c] LoadIcon(): Ignore bih->biSizeImage, some icons have wrong values in there. * [if1632/shell.spec] [misc/shell.c] Wrong spec file entries caused havoc: HKEY has 32 bit, not 16. Accept some more combinations of parameters in the Reg..() functions. * [if1632/toolhelp.spec] Make InterruptRegister() and InterruptUnregister() return false. * [windows/hook.c] CallNextHookEx() used to crash when called with a null hhook. Fixed. Wed Jun 28 10:14:34 1995 Martin von Loewis <martin@informatik.hu-berlin.de> * [include/neexe.h][loader/ne_image.c] NE_LoadSegment: Detect iterated segments * [misc/ole2nls.c] LOCALE_SLONGDATE: fixed typo * [miscemu/int5c.c] Reordered include files to avoid conflicts with Linux libc.5.1 * [rc/winerc.c] Added -b option to process binary resource files into C arrays * [include/callback.h] CallWndProc: Added dummy ds parameter for libwine * [include/gdi.h][include/user.h] USER_HEAP_ALLOC, GDI_HEAP_ALLOC: dropped flags parameter * [include/ldt.h][include/stackframe.h] defined segment conversion macros for libwine * [misc/atom.c] Defined USER_HeapSel for libwine * [misc/main.c] Disable -dll option for libwine * [misc/user.c] removed GetFreeSystemResources, SystemHeapInfo from libwine for now * [toolkit/heap.c] fixed LocalLock prototype * [toolkit/sup.c] sync'ed load_mz_header, load_ne_header with structures * [toolkit/winmain.c] Disabled resource DLLs for libwine for now Mon Jun 26 19:30:24 1995 Hans de Graaff (graaff@twi72.twi.tudelft.nl) * [misc/main.c] Fixed -enhanced option to report a 386 CPU instead of a 286. Fri Jun 23 23:18:25 1995 Marcus Meissner <msmeissn@faui01.informatik.uni-erlangen.de> * [misc/dos_fs.c] Remove maximum open dosdirent limit (fixing the winfile.exe problem) by using telldir()/seekdir(). Fri Jun 23 13:42:25 1995 Hans de Graaff (graaff@twi72.twi.tudelft.nl) * [misc/profile.c] Fixed problem parsing empty lines within sections in .ini files.
parent bd34d4ff
This is release 950620 of Wine the MS Windows emulator. This is still a
This is release 950706 of Wine the MS Windows emulator. This is still a
developer's only release. There are many bugs and many unimplemented API
features. Most applications still do not work.
Patches should be submitted to "wine-new@amscons.com". Please don't forget
to include a ChangeLog entry. I'll make a new release every other Sunday.
WHAT'S NEW with Wine-950620: (see ChangeLog for details)
- Many fixes to edit and listbox controls.
- Better MDI code.
- Many local heap fixes.
- Some built-in DLLs are now disabled by default.
WHAT'S NEW with Wine-950706: (see ChangeLog for details)
- Built-in debugger supports single-stepping (please test it on *BSD).
- Winelib should compile again.
- More OLE2 functions.
- Lots of bug fixes.
See the README file in the distribution for installation instructions.
......@@ -18,11 +17,11 @@ Because of lags created by using mirror, this message may reach you before
the release is available at the ftp sites. The sources will be available
from the following locations:
sunsite.unc.edu:/pub/Linux/ALPHA/wine/Wine-950620.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-950620.tar.gz
ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-950620.tar.gz
ftp.funet.fi:/pub/OS/Linux/ALPHA/Wine/Wine-950620.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-950620.tar.gz
sunsite.unc.edu:/pub/Linux/ALPHA/wine/Wine-950706.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-950706.tar.gz
ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-950706.tar.gz
ftp.funet.fi:/pub/OS/Linux/ALPHA/Wine/Wine-950706.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-950706.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite.
......
----------------------------------------------------------------------
Wed Jul 5 19:06:35 1995 Alexandre Julliard <alex@numenor>
* [controls/scroll.c]
Fixed drawing bug that caused part of a non-client scroll bar
to be painted even when the scroll-bar was hidden.
* [debugger/break.c] [debugger/dbg.y]
Rewrote breakpoint handling to work in 16-bit mode.
Implemented single-stepping ('step' and 'next' instructions).
* [debugger/debug.l]
Format specifier is now a separate token.
Entering an empty line at the debugger prompt causes the previous
command to be repeated, like under gdb.
* [debugger/debug.l] [debugger/registers.c]
Differentiate 16-bit and 32-bit registers without taking current
mode into account ($eax is always 32-bit, $ax always 16-bit).
* [debugger/stack.c]
Fixed stack information routines to differentiate between 16-bit
and 32-bit stacks.
* [loader/task.c]
Option -debug now sets a breakpoint at the first instruction of
every loaded task.
* [miscemu/instr.c]
Added handling of lock, repe and repne prefixes.
* [objects/dib.c]
Changed StretchDIBits() to do the correct thing, even if it's still
not really optimal.
* [windows/graphics.c]
Fixes in RoundRect(), thanks to Babak Masalehdan.
* [windows/message.c]
Tried to fix mouse event handling with respect to disabled
windows.
* [windows/painting.c]
Clear WIN_NEEDS_NCPAINT flag before sending WM_NCPAINT to avoid
infinite loops.
* [windows/win.c]
Fixed IsWindowVisible() to return FALSE when one of the parent
windows is hidden.
Sat Jul 1 22:08:21 1995 Martin von Loewis <loewis@informatik.hu-berlin.de>
* [if1632/compobj.spec][misc/compobj.c]
CoGetMalloc: New function
Added relay entries for COMPOBJ ordinals above 100
CoInitialize: Changed parameter to DWORD
* [if1632/ole2.spec]
Exported implementation of OleBuildVersion
* [if1632/ole2disp.spec][misc/ole2disp.c][misc/Imakefile]
ole2disp.c: New file
SysAllocString, SysReallocString, SysAllocStringLen,
SysReAllocStringLen, SysFreeString, SysStringLen: new functions
* [if1632/ole2nls.spec][include/winnls.h][misc/ole2nls.c]
CompareStringA: New function
Thu Jun 29 19:42:02 1995 Marcus Meissner <msmeissn@faui01.informatik.uni-erlangen.de>
* [objects/font.c] [if1632/gdi.spec]
New stubs for CreateScalableFontResource, GetGlyphOutline.
Thu Jun 29 13:47:08 GMT 1995 Gran Thyni (goran@norrsken.bildbasen.se)
* [misc/commdlg.c]
Extensive changes and bug fixes to FileDialog handling,
behaves more like native Windows.
Wed Jun 28 13:04:44 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
* [controls/listbox.c] [controls/combo.c]
Some minor optimizations.
* [memory/local.c]
LOCAL_FindFreeBlock(): Never use the last one.
* [memory/global.c]
GlobalReAlloc(): GMEM_MODIFY must not be ignored when size==0.
* [misc/file.c]
read() returns an error when length==0. This is not what Windows
programs expect, so pay attention to this in _lread(). Changed this
in _lwrite(), _hread(), _hwrite(), too.
* [loader/resource.c]
LoadIcon(): Ignore bih->biSizeImage, some icons have wrong values in
there.
* [if1632/shell.spec] [misc/shell.c]
Wrong spec file entries caused havoc: HKEY has 32 bit, not 16.
Accept some more combinations of parameters in the Reg..() functions.
* [if1632/toolhelp.spec]
Make InterruptRegister() and InterruptUnregister() return false.
* [windows/hook.c]
CallNextHookEx() used to crash when called with a null hhook. Fixed.
Wed Jun 28 10:14:34 1995 Martin von Loewis <martin@informatik.hu-berlin.de>
* [include/neexe.h][loader/ne_image.c]
NE_LoadSegment: Detect iterated segments
* [misc/ole2nls.c]
LOCALE_SLONGDATE: fixed typo
* [miscemu/int5c.c]
Reordered include files to avoid conflicts with Linux libc.5.1
* [rc/winerc.c]
Added -b option to process binary resource files into C arrays
* [include/callback.h]
CallWndProc: Added dummy ds parameter for libwine
* [include/gdi.h][include/user.h]
USER_HEAP_ALLOC, GDI_HEAP_ALLOC: dropped flags parameter
* [include/ldt.h][include/stackframe.h]
defined segment conversion macros for libwine
* [misc/atom.c]
Defined USER_HeapSel for libwine
* [misc/main.c]
Disable -dll option for libwine
* [misc/user.c]
removed GetFreeSystemResources, SystemHeapInfo from libwine for now
* [toolkit/heap.c]
fixed LocalLock prototype
* [toolkit/sup.c]
sync'ed load_mz_header, load_ne_header with structures
* [toolkit/winmain.c]
Disabled resource DLLs for libwine for now
Mon Jun 26 19:30:24 1995 Hans de Graaff (graaff@twi72.twi.tudelft.nl)
* [misc/main.c]
Fixed -enhanced option to report a 386 CPU instead of a 286.
Fri Jun 23 23:18:25 1995 Marcus Meissner <msmeissn@faui01.informatik.uni-erlangen.de>
* [misc/dos_fs.c]
Remove maximum open dosdirent limit (fixing the winfile.exe
problem) by using telldir()/seekdir().
Fri Jun 23 13:42:25 1995 Hans de Graaff (graaff@twi72.twi.tudelft.nl)
* [misc/profile.c]
Fixed problem parsing empty lines within sections in .ini files.
----------------------------------------------------------------------
Mon Jun 19 20:29:50 1995 Alexandre Julliard (julliard@sunsite.unc.edu)
* [debugger/*.c]
......
......@@ -103,7 +103,6 @@ then
fi
prompt "Where should Windows apps store temp files" CF_Temp $CF_Temp
prompt "Which path should be used to find progs/DLL's" CF_Path "$CF_Windows;$CF_System"
prompt "Where is sysres.dll" CF_SystemResources `pwd`/sysres.dll
prompt "Where is COM1" CF_Com1 '/dev/cua0'
prompt "Where is COM2" CF_Com2 '/dev/cua1'
prompt "Where is LPT1" CF_Lpt1 '/dev/lp0'
......
.\" -*- nroff -*-
.TH WINE 1 "June 29, 1995" "Version 6/20/95" "Windows Emulation"
.SH NAME
wine \- run Windows 3.x programs under Linux
.SH SYNOPSIS
.B wine
[
.I options
]
.I program_name
[
.I arguments
]
.SH DESCRIPTION
.B wine
invokes the Linux Windows emulator.
.PP
.B wine
currently runs a number of games and small applications (approximately
half of the applets and common games actually run), although the entire API
has not been implemented.
.PP
See the files
.B README,
.B ChangeLog,
.B Configure,
and the
.B Makefile
contained in the source distribution
to compile
.B wine.
.SH REQUIREMENTS
At present,
.B wine
will run under any Linux kernel more recent than 0.99.13, or
under recent releases of NetBSD and FreeBSD.
.PP
.B X
must be installed.
.PP
.B libXpm
must be installed. (It is probably available from the same site
.B wine
was, or the sources may be FTP'd from ftp.x.org).
.SH INSTALLATION
To install
.B wine,
run "./Configure", which will ask for configuration information and
create the Makefiles, then run "make".
.SH OPTIONS
.TP
.I -depth n
Change the depth to use for multiple-depth screens
.TP
.I -desktop geom
Use a desktop window of the given geometry
.TP
.I -display name
Use the specified display
.TP
.I -iconic
Start as an icon
.TP
.I -debug
Enter the debugger before starting application
.TP
.I -name name
Set the application name
.TP
.I -privatemap
Use a private color map
.TP
.I -synchronous
Turn on synchronous display mode
.TP
.I -backingstore
Turn on backing store
.TP
.I -spy file
Turn on message spying to the specified file
.TP
.I -debugmsg name[,name]
Turn debugging messages on or off - for instance,
.I -debugmsg +dll,+heap
will turn on DLL and heap debugging messages. The full list is:
all, accel, bitblt, bitmap, caret, catch, cdaudio, class, clipboard, clipping,
combo, comm, cursor, dc, dialog, dll, dosfs, driver, edit, enum, event, exec,
file, fixup, font, gdi, global, graphics, icon, int, key, keyboard, ldt,
listbox, local, malloc, mci, mcianim, mciwave, mdi, menu, menucalc, message,
metafile, midi, mmio, mmsys, mmtime, module, msg, nonclient, ole, palette,
profile, prop, reg, region, relay, resource, scroll, selector, selectors,
stress, syscolor, task, text, timer, toolhelp, utility, win, winsock.
.TP
.I -dll name
Enables/disables built-in DLL's - starting wine with
.I -dll -commdlg
is probably a good idea.
The full list of DLLs modifiable by this is:
KERNEL, USER, GDI, WIN87EM, SHELL, SOUND, KEYBOARD, WINSOCK, STRESS, MMSYSTEM,
SYSTEM, TOOLHELP, MOUSE, COMMDLG, OLE2, OLE2CONV, OLE2DISP, OLE2NLS, OLE2PROX,
OLECLI, OLESVR, COMPOBJ, STORAGE, WINPROCS, DDEML
.TP
.I -allowreadonly
Read only files may be opened in write mode
.TP
.I -enhanced
Starts wine in Enhanced mode (not guaranteed to work yet)
.PD 1
.SH PROGRAM/ARGUMENTS
The program name may be specified in DOS format (C:\\WINDOWS\\SOL.EXE) or in
Linux format (/msdos/windows/sol.exe). The program being executed may be
passed arguments by adding them on to the end of the command line invoking
.B wine
(such as: wine "notepad C:\\TEMP\\README.TXT"). Note that
the program name and its arguments
.I must
be passed as a single parameter, which is usually accomplished by placing
them together in quotation marks. Multiple applications may be started
by placing all of them on the command line (such as: wine notepad clock).
.SH CONFIGURATION FILE
.B wine
expects a configuration file (/usr/local/etc/wine.conf),
which should conform to the following rules. The actual file name may
be specified during the execution of the
.B Configure
script. Alternatively, you may have a
.I .winerc
file of this format in your home directory.
.SH CONFIGURATION FILE FORMAT
.B [drives]
.br
.I format: <driveletter> = <rootdirectory>
.br
default: none
.br
This section is used to specify the root directory of each
.B DOS
drive, since most Windows applications require a DOS/MS-Windows based
disk drive & directory scheme.
.br
If you mounted your dos partition as
.I /dos
and installed Microsoft Windows in
C:\\WINDOWS then you should specify
.I c=/dos
in the drives section.
.PP
.B [wine]
.br
.I format: windows = <directory>
.br
default: C:\\WINDOWS
.br
Used to specify a different Windows directory
.PP
.I format: system = <directory>
.br
default: C:\\WINDOWS\\SYSTEM
.br
Used to specify a different system directory
.PP
.I format: temp = <directory>
.br
default: C:\\TEMP
.br
Used to specify a directory where Windows applications can store
temporary files.
.PP
.I format: path = <directories separated by semi-colons>
.br
default: C:\\WINDOWS;C:\\WINDOWS\\SYSTEM
.br
Used to specify the path which will be used to find executables and .DLL's.
.PP
.I format: symboltablefile = <filename>
.br
default: wine.sym
.br
Used to specify the path and file name of the symbol table used by the built-in
debugger.
.PP
.B [serialports]
.br
.I format: com[12345678] = <devicename>
.br
default: none
.br
Used to specify the devices which are used as com1 - com8.
.PP
.B [parallelports]
.br
.I format: lpt[12345678] = <devicename>
.br
default: none
.br
Used to specify the devices which are used as lpt1 - lpt8.
.PP
.B [spy]
.br
.I format: file = <filename or CON when logging to stdout>
.br
default: none
.br
Used to specify the file which will be used as
.B logfile.
.PP
.I format: exclude = <message names separated by semicolons>
.br
default: none
.br
Used to specify which messages will be excluded from the logfile.
.PP
.I format: include = <message names separated by semicolons>
.br
default: none
.br Used to specify which messages will be included in the logfile.
.SH SAMPLE wine.conf
[drives]
.br
a=/mnt/fd0
.br
c=/dos
.br
d=~/Wine
.PP
[wine]
.br
windows=c:\\windows
.br
system=c:\\windows\\system
.br
temp=c:\\temp
.br
path=c:\\windows;c:\\windows\\system;c:\\winapps\\word
.br
symboltablefile=/usr/local/lib/wine.sym
.PP
[serialports]
.br
com1=/dev/cua1
.br
com2=/dev/cua1
.PP
[parallelports]
.br
lpt1=/dev/lp0
.PP
[spy]
.br
;File=CON
.br
;File=spy.log
.br
Exclude=WM_TIMER;WM_SETCURSOR;WM_MOUSEMOVE;WM_NCHITTEST;
.br
Include=WM_COMMAND;
.SH AUTHORS
.B Wine
is available thanks to the work of Bob Amstadt, Dag Asheim,
Martin Ayotte, Ross Biro, Erik Bos, Fons Botman, John Brezak,
Andrew Bulhak, John Burton, Paul Falstad, Olaf Flebbe, Peter Galbavy,
Cameron Heide, Jeffrey Hsu, Miguel de Icaza, Alexandre Julliard,
Jon Konrath, Scott A. Laird, Martin von Loewis, Kenneth MacDonald,
Peter MacDonald, William Magro, David Metcalfe, Michael Patra,
John Richardson, Johannes Ruscheinski, Thomas Sandford,
Constantine Sapuntzakis, Bernd Schmidt, Yngvi Sigurjonsson, Rick Sladkey,
William Smith, Erik Svendsen, Goran Thyni, Jimmy Tirtawangsa, Jon Tombs,
Linus Torvalds, Michael Veksler, Carl Williams, Karl Guenter Wuensch,
Eric Youngdale, and James Youngman.
.PP
This man page is maintained by Mike Phillips (msphil@mail.wm.edu), so please
send all corrections, comments, flames, etc., to him.
.SH BUGS
There are too many to count, much less list. Some are of note, however:
Any Windows program using Visual Basic (VBRUNxxx.DLL) will not run yet,
nor will any program depending on undocumented functions or on the
COMMDLG (any standard file open/save interface) unless you disable the
internal COMMDLG with the
.I -dll -commdlg
option. In addition, 16-color support is imperfect at best, and
icons sometimes display improperly on some systems. Certain
multi-language modules will not load properly. Progress is being made
regularly, however.
.PP
Currently, no directories in the path can have upper-case letters in them
(ex. /msdos/driveC), as the conversions necessary to handle the msdos
filename conventions currently cause them to be lost.
.PP
A partial list of applications known to work with
.B wine
include: sol, cruel, golf.exe, clock, notepad, charmap, and calc.
The following URLs point to different success/testing lists:
.br
.I http://www.ifi.uio.no/~dash/wine/working-apps.html
.br
.I http://dutifp.twi.tudelft.nl:8000/wine/
.PP
We would like to hear about what software does run under
.B Wine,
and such reports may be posted to
.I comp.emulators.ms-windows.wine.
.SH AVAILABILITY
The most recent public version of
.B wine
can be ftp'ed from tsx-11.mit.edu in the /pub/linux/ALPHA/Wine/development
directory. The releases are in the format 'Wine-yymmdd.tar.gz',
or 'Wine-yymmdd.diff.gz' for the diff's from the previous release.
.SH FILES
.PD 0
.TP
.I /usr/local/bin/wine
The invoker program.
.TP
.I /usr/local/etc/wine.conf
Main configuration file for wine.
.TP
.I ChangeLog
Changes in Wine, since the beginning (most recent changes first)
.TP
.I Configure
Shell script to automate compilation. Usually followed by make (or gmake
on *BSD systems) to compile wine; it can even build a sample
.B wine.conf
file
.TP
.I Wine newsgroup
Subscribe to comp.emulators.ms-windows.wine
......@@ -340,9 +340,6 @@ static void SCROLL_DrawInterior( HWND hwnd, HDC hdc, int nBar, RECT *rect,
BOOL bottom_selected )
{
RECT r;
WND *wndPtr = WIN_FindWndPtr( hwnd );
if (((nBar == SB_VERT) && !(wndPtr->dwStyle & WS_VSCROLL))
|| ((nBar == SB_HORZ) && (!wndPtr->dwStyle & WS_HSCROLL))) return;
/* Select the correct brush and pen */
......@@ -440,9 +437,13 @@ void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, int nBar )
WORD arrowSize, thumbPos;
RECT rect;
BOOL vertical;
WND *wndPtr = WIN_FindWndPtr( hwnd );
SCROLLINFO *infoPtr = SCROLL_GetScrollInfo( hwnd, nBar );
if (!infoPtr) return;
if (!wndPtr || !infoPtr ||
((nBar == SB_VERT) && !(wndPtr->dwStyle & WS_VSCROLL)) ||
((nBar == SB_HORZ) && !(wndPtr->dwStyle & WS_HSCROLL))) return;
vertical = SCROLL_GetScrollBarRect( hwnd, nBar, &rect,
&arrowSize, &thumbPos );
/* Draw the arrows */
......@@ -467,9 +468,13 @@ static void SCROLL_RefreshScrollBar( HWND hwnd, int nBar )
RECT rect;
BOOL vertical;
HDC hdc;
WND *wndPtr = WIN_FindWndPtr( hwnd );
SCROLLINFO *infoPtr = SCROLL_GetScrollInfo( hwnd, nBar );
if (!infoPtr) return;
if (!wndPtr || !infoPtr ||
((nBar == SB_VERT) && !(wndPtr->dwStyle & WS_VSCROLL)) ||
((nBar == SB_HORZ) && !(wndPtr->dwStyle & WS_HSCROLL))) return;
vertical = SCROLL_GetScrollBarRect( hwnd, nBar, &rect,
&arrowSize, &thumbPos );
hdc = (nBar == SB_CTL) ? GetDC(hwnd) : GetWindowDC(hwnd);
......
......@@ -16,7 +16,9 @@ SRCS = \
dbg.tab.c \
hash.c \
info.c \
lex.yy.c
lex.yy.c \
registers.c \
stack.c
SUBDIRS_OBJS = readline/readline.o
......
......@@ -61,25 +61,15 @@
/*
* Instruction disassembler.
*/
#if 0
#include <mach/boolean.h>
#include "db_machdep.h"
#include "db_access.h"
#include "db_sym.h"
#include <kern/task.h>
#endif
#include <stdio.h>
#include "db_disasm.h"
#include "windows.h"
#include "ldt.h"
extern void print_address( unsigned int seg, unsigned int addr, int addrlen );
/*
* Switch to disassemble 16-bit code.
*/
static boolean_t db_disasm_16 = FALSE;
static BOOL db_disasm_16 = FALSE;
/*
* Size attributes
......@@ -932,13 +922,9 @@ static unsigned int db_get_task_value( unsigned int segment, unsigned int loc,
/*
* Read address at location and return updated location.
*/
db_addr_t
db_read_address(segment, loc, short_addr, regmodrm, addrp)
unsigned int segment;
db_addr_t loc;
int short_addr;
int regmodrm;
struct i_addr *addrp; /* out */
unsigned int db_read_address( unsigned int segment, unsigned int loc,
int short_addr, int regmodrm,
struct i_addr *addrp )
{
int mod, rm, sib, index, disp;
......@@ -1058,21 +1044,15 @@ db_print_address(seg, size, addrp)
fprintf(stderr,",%s,%d", addrp->index, 1<<addrp->ss);
fprintf(stderr,")");
} else
db_task_printsym((db_addr_t)addrp->disp, size);
db_task_printsym(addrp->disp, size);
}
/*
* Disassemble floating-point ("escape") instruction
* and return updated location.
*/
db_addr_t
db_disasm_esc(segment, loc, inst, short_addr, size, seg)
unsigned int segment;
db_addr_t loc;
int inst;
int short_addr;
int size;
char * seg;
unsigned int db_disasm_esc( unsigned int segment, unsigned int loc,
int inst, int short_addr, int size, char *seg )
{
int regmodrm;
struct finst *fp;
......@@ -1151,11 +1131,7 @@ db_disasm_esc(segment, loc, inst, short_addr, size, seg)
* Disassemble instruction at 'loc'. Return address of start of
* next instruction.
*/
db_addr_t
db_disasm(segment, loc, flag16)
unsigned int segment;
db_addr_t loc;
boolean_t flag16;
unsigned int db_disasm( unsigned int segment, unsigned int loc )
{
int inst;
int size;
......@@ -1166,7 +1142,7 @@ db_disasm(segment, loc, flag16)
int i_size;
int i_mode;
int regmodrm = 0;
boolean_t first;
BOOL first;
int displ;
int prefix;
int imm;
......@@ -1174,7 +1150,8 @@ db_disasm(segment, loc, flag16)
int len;
struct i_addr address;
db_disasm_16 = flag16;
if (!segment) db_disasm_16 = FALSE;
else db_disasm_16 = !(GET_SEL_FLAGS(segment) & LDT_FLAGS_32BIT);
get_value_inc(inst, segment, loc, 1, FALSE);
......@@ -1240,7 +1217,7 @@ db_disasm(segment, loc, flag16)
} while (prefix);
if (inst >= 0xd8 && inst <= 0xdf) {
loc = db_disasm_esc(loc, inst, short_addr, size, seg);
loc = db_disasm_esc(segment, loc, inst, short_addr, size, seg);
fprintf(stderr,"\n");
return (loc);
}
......@@ -1441,8 +1418,7 @@ db_disasm(segment, loc, flag16)
if (seg)
fprintf(stderr,"%s:%d",seg, displ);
else
db_task_printsym((db_addr_t)displ,
short_addr ? WORD : LONG);
db_task_printsym(displ, short_addr ? WORD : LONG);
break;
case Db:
......@@ -1454,8 +1430,7 @@ db_disasm(segment, loc, flag16)
}
else
displ = displ + loc;
db_task_printsym((db_addr_t)displ,
short_addr ? WORD : LONG);
db_task_printsym(displ, short_addr ? WORD : LONG);
break;
case Dl:
......@@ -1469,8 +1444,7 @@ db_disasm(segment, loc, flag16)
get_value_inc(displ, segment, loc, 4, TRUE);
displ = displ + loc;
}
db_task_printsym((db_addr_t)displ,
short_addr ? WORD : LONG);
db_task_printsym( displ, short_addr ? WORD : LONG);
break;
case o1:
......
#define FALSE 0
#define TRUE 1
typedef unsigned char boolean_t;
typedef unsigned long db_addr_t;
extern db_addr_t db_disasm(unsigned int segment, db_addr_t loc,
boolean_t flag16);
......@@ -10,24 +10,25 @@
#include <stdio.h>
#include <signal.h>
#include "ldt.h"
#include <unistd.h>
#include "windows.h"
#include "wine.h"
#include "debugger.h"
#define YYSTYPE int
#include "regpos.h"
extern FILE * yyin;
unsigned int * regval = NULL;
unsigned int dbg_mask = 0;
unsigned int dbg_mode = 0;
static enum exec_mode dbg_exec_mode = EXEC_CONT;
void issue_prompt(void);
void mode_command(int);
%}
%token CONT
%token STEP
%token NEXT
%token QUIT
%token HELP
%token BACKTRACE
......@@ -40,10 +41,13 @@ void mode_command(int);
%token ENABLE
%token DISABLE
%token BREAK
%token DELETE
%token SET
%token MODE
%token PRINT
%token EXAM
%token IDENTIFIER
%token FORMAT
%token NO_SYMBOL
%token SYMBOLFILE
%token DEFINE
......@@ -58,68 +62,59 @@ void mode_command(int);
| infocmd '\n'
| error '\n' { yyerrok; }
| QUIT '\n' { exit(0); }
| 'q' '\n' { exit(0); }
| HELP '\n' { dbg_help(); }
| CONT '\n' { return 0; }
| 'c' '\n' { return 0; }
| CONT '\n' { dbg_exec_mode = EXEC_CONT; return 0; }
| STEP '\n' { dbg_exec_mode = EXEC_STEP_INSTR; return 0; }
| NEXT '\n' { dbg_exec_mode = EXEC_STEP_OVER; return 0; }
| ABORT '\n' { kill(getpid(), SIGABRT); }
| SYMBOLFILE IDENTIFIER '\n' { read_symboltable($2); }
| SYMBOLFILE IDENTIFIER '\n' { read_symboltable($2); }
| DEFINE IDENTIFIER expr '\n' { add_hash($2, 0, $3); }
| MODE NUM { mode_command($2); }
| ENABLE NUM { enable_break($2); }
| DISABLE NUM { disable_break($2); }
| BREAK '*' expr { add_break($3); }
| MODE NUM '\n' { mode_command($2); }
| ENABLE NUM '\n' { DEBUG_EnableBreakpoint( $2, TRUE ); }
| DISABLE NUM '\n' { DEBUG_EnableBreakpoint( $2, FALSE ); }
| BREAK '*' expr { DEBUG_AddBreakpoint( 0xffffffff, $3 ); }
| BREAK '\n' { DEBUG_AddBreakpoint( 0xffffffff, EIP ); }
| DELETE BREAK NUM '\n' { DEBUG_DelBreakpoint( $3 ); }
| BACKTRACE '\n' { DEBUG_BackTrace(); }
| x_command
| BACKTRACE '\n' { dbg_bt(); }
| print_command
| deposit_command
deposit_command:
SET REG '=' expr '\n' { if(regval) regval[$2] = $4; else application_not_running();}
SET REG '=' expr '\n' { DEBUG_SetRegister( $2, $4 ); }
| SET '*' expr '=' expr '\n' { *((unsigned int *) $3) = $5; }
| SET symbol '=' expr '\n' { *((unsigned int *) $2) = $4; }
| SET symbol '=' expr '\n' { *((unsigned int *) $2) = $4; }
x_command:
'x' expr '\n' { examine_memory( 0xffffffff, $2, 1, 'x'); }
| 'x' '/' fmt expr '\n' { examine_memory( 0xffffffff, $4, 1, $3); }
| 'x' '/' NUM fmt expr '\n' { examine_memory( 0xffffffff, $5, $3, $4); }
EXAM expr '\n' { examine_memory( 0xffffffff, $2, 1, 'x'); }
| EXAM FORMAT expr '\n' { examine_memory( 0xffffffff, $3,
$2 >> 8, $2 & 0xff ); }
print:
'p'
| PRINT
print_command:
print expr '\n' { examine_memory( 0, ((unsigned int) &$2 ), 1, 'x'); }
| print '/' fmt expr '\n' { examine_memory( 0, (unsigned int) &$4, 1, $3); }
fmt: 'x' { $$ = 'x'; }
| 'd' { $$ = 'd'; }
| 'i' { $$ = 'i'; }
| 'w' { $$ = 'w'; }
| 's' { $$ = 's'; }
| 'c' { $$ = 'c'; }
| 'b' { $$ = 'b'; }
symbol: IDENTIFIER { $$ = find_hash($1);
if($$ == 0xffffffff) {
fprintf(stderr,"Symbol %s not found\n", $1);
YYERROR;
}
}
PRINT expr '\n' { examine_memory( 0, ((unsigned int) &$2 ), 1,'x'); }
| PRINT FORMAT expr '\n' { examine_memory( 0, (unsigned int)&$3,
$2 >> 8, $2 & 0xff ); }
symbol: IDENTIFIER { if (($$ = find_hash($1)) == 0xffffffff)
{
fprintf(stderr,"Symbol %s not found\n", (char *)$1);
YYERROR;
}
}
expr: NUM { $$ = $1; }
| REG { if(regval) $$ = regval[$1]; else application_not_running();}
| REG { $$ = DEBUG_GetRegister($1); }
| symbol { $$ = $1; }
| expr '+' NUM { $$ = $1 + $3; }
| expr '-' NUM { $$ = $1 - $3; }
| '(' expr ')' { $$ = $2; }
| '*' expr { $$ = *((unsigned int *) $2); }
infocmd: INFO REGS { info_reg(); }
| INFO STACK { info_stack(); }
infocmd: INFO REGS { DEBUG_InfoRegisters(); }
| INFO STACK { DEBUG_InfoStack(); }
| INFO BREAK { DEBUG_InfoBreakpoints(); }
| INFO SEGMENTS { LDT_Print(); }
| INFO BREAK { info_break(); }
%%
......@@ -133,78 +128,55 @@ issue_prompt(){
void mode_command(int newmode)
{
if(newmode == 16){
dbg_mask = 0xffff;
dbg_mode = 16;
return;
}
if(newmode == 32){
dbg_mask = 0xffffffff;
dbg_mode = 32;
return;
}
fprintf(stderr,"Invalid mode (use 16 or 32)\n");
if ((newmode == 16) || (newmode == 32)) dbg_mode = newmode;
else fprintf(stderr,"Invalid mode (use 16 or 32)\n");
}
static int loaded_symbols = 0;
void
wine_debug(int signal, int * regs)
void wine_debug( int signal, struct sigcontext_struct *regs )
{
static int dummy_regs[32];
char SymbolTableFile[256];
static int loaded_symbols = 0;
char SymbolTableFile[256];
int instr_len = 0, newmode;
#ifdef YYDEBUG
yydebug = 0;
yydebug = 1;
#endif
yyin = stdin;
regval = regs ? regs : dummy_regs;
if (SC_CS == WINE_CODE_SELECTOR) dbg_mode = 32;
else dbg_mode = (GET_SEL_FLAGS(SC_CS) & LDT_FLAGS_32BIT) ? 32 : 16;
dbg_mask = (dbg_mode == 32) ? 0xffffffff : 0xffff;
fprintf(stderr,"In %d bit mode.\n", dbg_mode);
if(dbg_mode == 32 && !loaded_symbols)
{
loaded_symbols++;
GetPrivateProfileString("wine", "SymbolTableFile", "wine.sym",
SymbolTableFile, sizeof(SymbolTableFile), WINE_INI);
read_symboltable(SymbolTableFile);
}
/* Remove the breakpoints from memory... */
insert_break(0);
/* If we stopped on a breakpoint, report this fact */
if(signal == SIGTRAP)
{
unsigned int addr;
int bpnum;
addr = SC_EIP(dbg_mask);
if (dbg_mode == 16) addr = PTR_SEG_OFF_TO_LIN( SC_CS, addr );
if(should_continue(bpnum=get_bpnum(addr))){
insert_break(1);
return;
}
fprintf(stderr,"Stopped on breakpoint %d\n", bpnum);
}
/* Show where we crashed */
if(regs)
examine_memory(0xffffffff, SC_EIP(dbg_mask), 1, 'i');
issue_prompt();
yyparse();
flush_symbols();
/* Re-insert the breakpoints from memory... */
insert_break(1);
fprintf(stderr,"Returning to Wine...\n");
yyin = stdin;
context = (struct sigcontext_struct *)regs;
if (CS == WINE_CODE_SELECTOR) newmode = 32;
else newmode = (GET_SEL_FLAGS(CS) & LDT_FLAGS_32BIT) ? 32 : 16;
if (newmode != dbg_mode)
fprintf(stderr,"In %d bit mode.\n", dbg_mode = newmode);
if(dbg_mode == 32 && !loaded_symbols)
{
loaded_symbols++;
GetPrivateProfileString("wine", "SymbolTableFile", "wine.sym",
SymbolTableFile, sizeof(SymbolTableFile), WINE_INI);
read_symboltable(SymbolTableFile);
}
DEBUG_SetBreakpoints( FALSE );
if ((signal != SIGTRAP) || !DEBUG_ShouldContinue( regs, dbg_exec_mode ))
{
unsigned int segment = (CS == WINE_CODE_SELECTOR) ? 0 : CS;
/* Show where we crashed */
print_address( segment, EIP, dbg_mode );
fprintf(stderr,": ");
instr_len = db_disasm( segment, EIP ) - EIP;
fprintf(stderr,"\n");
issue_prompt();
yyparse();
flush_symbols();
}
DEBUG_RestartExecution( regs, dbg_exec_mode, instr_len );
}
......
......@@ -7,9 +7,10 @@
%{
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dbg.tab.h"
#include "regpos.h"
#include "debugger.h"
#ifdef USE_READLINE
#undef YY_INPUT
......@@ -19,102 +20,89 @@
#endif
extern char * readline(char *);
extern void add_history(char *);
static int dbg_read(char * buf, int size);
static char * make_symbol(char *);
void flush_symbols();
static int syntax_error;
extern int yylval;
%}
DIGIT [0-9]
HEXDIGIT [0-9a-fA-F]
DIGIT [0-9]
HEXDIGIT [0-9a-fA-F]
FORMAT [bcdiswx]
IDENTIFIER [_a-zA-Z\.~][_a-zA-Z0-9\.~]*
%%
\n { syntax_error = 0; return '\n'; } /* Indicate end of command */
"+" { return '+'; }
"-" { return '-'; }
"/" { return '/'; }
"=" { return '='; }
"(" { return '('; }
")" { return ')'; }
"*" { return '*'; }
"?" { return HELP; }
"0x"+{HEXDIGIT}+ {
sscanf(yytext, "%x", &yylval);
return NUM;
}
{DIGIT}+ {
sscanf(yytext, "%d", &yylval);
return NUM;
}
$pc { yylval = RN_EIP; return REG;}
$sp { yylval = RN_ESP_AT_SIGNAL; return REG;}
$eip { yylval = RN_EIP; return REG;}
$esp { yylval = RN_ESP_AT_SIGNAL; return REG;}
$ebp { yylval = RN_EBP; return REG;}
$eax { yylval = RN_EAX; return REG;}
$ebx { yylval = RN_EBX; return REG;}
$ecx { yylval = RN_ECX; return REG;}
$edx { yylval = RN_EDX; return REG;}
$esi { yylval = RN_ESI; return REG;}
$edi { yylval = RN_EDI; return REG;}
$es { yylval = RN_ES; return REG;}
$ds { yylval = RN_DS; return REG;}
$cs { yylval = RN_CS; return REG;}
$ss { yylval = RN_SS; return REG;}
info|inf|in { return INFO; }
segments|segm { return SEGMENTS; }
break|brea|bre { return BREAK; }
enable|enabl|enab|ena { return ENABLE;}
\n { syntax_error = 0; return '\n'; } /*Indicate end of command*/
[-+=()*] { return *yytext; }
"0x"{HEXDIGIT}+ { sscanf(yytext, "%x", &yylval); return NUM; }
{DIGIT}+ { sscanf(yytext, "%d", &yylval); return NUM; }
"/"{DIGIT}+{FORMAT} { char *last; yylval = strtol( yytext+1, &last, NULL );
yylval = (yylval << 8) | *last; return FORMAT; }
"/"{FORMAT} { yylval = (1 << 8) | yytext[1]; return FORMAT; }
$pc { yylval = REG_EIP; return REG; }
$flags { yylval = REG_EFL; return REG; }
$eip { yylval = REG_EIP; return REG; }
$ip { yylval = REG_IP; return REG; }
$esp { yylval = REG_ESP; return REG; }
$sp { yylval = REG_SP; return REG; }
$eax { yylval = REG_EAX; return REG; }
$ebx { yylval = REG_EBX; return REG; }
$ecx { yylval = REG_ECX; return REG; }
$edx { yylval = REG_EDX; return REG; }
$esi { yylval = REG_ESI; return REG; }
$edi { yylval = REG_EDI; return REG; }
$ebp { yylval = REG_EBP; return REG; }
$ax { yylval = REG_AX; return REG; }
$bx { yylval = REG_BX; return REG; }
$cx { yylval = REG_CX; return REG; }
$dx { yylval = REG_DX; return REG; }
$si { yylval = REG_SI; return REG; }
$di { yylval = REG_DI; return REG; }
$bp { yylval = REG_BP; return REG; }
$es { yylval = REG_ES; return REG; }
$ds { yylval = REG_DS; return REG; }
$cs { yylval = REG_CS; return REG; }
$ss { yylval = REG_SS; return REG; }
info|inf|in { return INFO; }
segments|segm { return SEGMENTS; }
break|brea|bre|br|b { return BREAK; }
enable|enabl|enab|ena { return ENABLE;}
disable|disabl|disab|disa|dis { return DISABLE; }
quit|qui|qu { return QUIT; }
delete|delet|dele|del { return DELETE; }
quit|qui|qu|q { return QUIT; }
x { return EXAM; }
help|hel|he { return HELP; }
"?" { return HELP; }
set|se { return SET; }
bt { return BACKTRACE; }
cont|con|co { return CONT; }
cont|con|co|c { return CONT; }
step|ste|st|s { return STEP; }
next|nex|ne|n { return NEXT; }
symbolfile|symbolfil|symbolfi|symbolf|symbol|symbo|symb { return SYMBOLFILE; }
define|defin|defi|def|de { return DEFINE; }
abort|abor|abo { return ABORT; }
print|prin|pri|pr { return PRINT; }
print|prin|pri|pr|p { return PRINT; }
mode { return MODE; }
regs|reg|re { return REGS; }
registers|regs|reg|re { return REGS; }
stack|stac|sta|st { return STACK; }
p { return 'p'; }
x { return 'x'; }
d { return 'd'; }
i { return 'i'; }
w { return 'w'; }
b { return 'b'; }
s { return 's'; }
c { return 'c'; }
q { return 'q'; }
{IDENTIFIER} {yylval = (int) make_symbol(yytext);
return IDENTIFIER;
}
......@@ -161,35 +149,45 @@ static void stripwhite (char *string)
string[++i] = '\0';
}
dbg_read(char * buf, int size){
char * line;
int len;
do{
flush_symbols();
line = readline ("Wine-dbg>");
if (!line) return 0;
len = strlen(line);
/* Remove leading and trailing whitespace from the line.
Then, if there is anything left, add it to the history list
and execute it. */
stripwhite (line);
if (*line)
{
add_history (line);
if(size < len + 1){
fprintf(stderr,"Fatal readline goof.\n");
exit(0);
}
strcpy(buf, line);
buf[len] = '\n';
buf[len+1] = 0;
free(line);
return len + 1;
}
} while (1==1);
static int dbg_read(char * buf, int size)
{
static char last_line[256] = "";
char * line;
int len;
for (;;)
{
flush_symbols();
line = readline ("Wine-dbg>");
if (!line) exit(0);
/* Remove leading and trailing whitespace from the line.
Then, if there is anything left, add it to the history list
and execute it. */
stripwhite (line);
if (*line)
{
add_history( line );
strncpy( last_line, line, 255 );
last_line[255] = '\0';
}
else line = last_line; /* Repeat previous command */
if ((len = strlen(line)) > 0)
{
if (size < len + 1)
{
fprintf(stderr,"Fatal readline goof.\n");
exit(0);
}
strcpy(buf, line);
buf[len] = '\n';
buf[len+1] = 0;
free(line);
return len + 1;
}
}
}
static char *local_symbols[10];
......
#include <signal.h>
#include <stdio.h>
extern void wine_debug(unsigned int*);
#ifdef linux
#include <linux/sched.h>
#include <asm/system.h>
#endif
struct sigaction segv_act;
#ifdef linux
struct sigcontext_struct {
unsigned short sc_gs, __gsh;
unsigned short sc_fs, __fsh;
unsigned short sc_es, __esh;
unsigned short sc_ds, __dsh;
unsigned long sc_edi;
unsigned long sc_esi;
unsigned long sc_ebp;
unsigned long sc_esp;
unsigned long sc_ebx;
unsigned long sc_edx;
unsigned long sc_ecx;
unsigned long sc_eax;
unsigned long sc_trapno;
unsigned long sc_err;
unsigned long sc_eip;
unsigned short sc_cs, __csh;
unsigned long sc_eflags;
unsigned long esp_at_signal;
unsigned short sc_ss, __ssh;
unsigned long i387;
unsigned long oldmask;
unsigned long cr2;
};
#endif
#ifdef linux
static void win_fault(int signal, struct sigcontext_struct context){
struct sigcontext_struct *scp = &context;
#else
static void win_fault(int signal, int code, struct sigcontext *scp){
#endif
wine_debug((unsigned int *) scp); /* Enter our debugger */
}
char realtext[] = "This is what should really be printed\n";
int
main(){
char * pnt;
#ifdef linux
segv_act.sa_handler = (__sighandler_t) win_fault;
sigaction(SIGSEGV, &segv_act, NULL);
#endif
#if defined(__NetBSD__) || defined(__FreeBSD__)
sigset_t sig_mask;
sigemptyset(&sig_mask);
segv_act.sa_handler = (__sighandler_t) win_fault;
segv_act.sa_flags = 0;
segv_act.sa_mask = sig_mask;
if (sigaction(SIGSEGV, &segv_act, NULL) < 0) {
perror("sigaction");
exit(1);
}
#endif
fprintf(stderr,"%x\n", realtext);
/* Now force a segmentation fault */
pnt = (char *) 0xc0000000;
fprintf(stderr,"%s", pnt);
return 0;
}
unsigned int * wine_files = NULL;
GetEntryPointFromOrdinal(int wpnt, int ordinal) {}
......@@ -155,10 +155,6 @@ read_symboltable(char * filename){
}
/* Load the entry points from the dynamic linking into the hash tables.
* This does not work yet - something needs to be added before it scans the
* tables correctly
*/
void load_entrypoints( HMODULE hModule )
{
......
......@@ -6,16 +6,10 @@
#include <stdio.h>
#include <stdlib.h>
#include "ldt.h"
#include "db_disasm.h"
#include "regpos.h"
#include "debugger.h"
extern char * find_nearest_symbol( unsigned int seg, unsigned int addr );
extern int * regval;
extern unsigned int dbg_mask;
extern unsigned int dbg_mode;
void application_not_running()
{
fprintf(stderr,"Application not running\n");
......@@ -32,54 +26,6 @@ void print_address( unsigned int segment, unsigned int addr, int addrlen )
}
void info_reg(){
if(!regval) {
application_not_running();
return;
}
fprintf(stderr,"Register dump:\n");
/* First get the segment registers out of the way */
fprintf(stderr," CS:%4.4x SS:%4.4x DS:%4.4x ES:%4.4x GS:%4.4x FS:%4.4x\n",
SC_CS, SC_SS, SC_DS, SC_ES, SC_GS, SC_FS);
/* Now dump the main registers */
fprintf(stderr," EIP:%8.8x ESP:%8.8x EBP:%8.8x EFLAGS:%8.8x\n",
SC_EIP(dbg_mask), SC_ESP(dbg_mask), SC_EBP(dbg_mask), SC_EFLAGS);
/* And dump the regular registers */
fprintf(stderr," EAX:%8.8x EBX:%8.8x ECX:%8.8x EDX:%8.8x\n",
SC_EAX(dbg_mask), SC_EBX(dbg_mask), SC_ECX(dbg_mask), SC_EDX(dbg_mask));
/* Finally dump these main registers */
fprintf(stderr," EDI:%8.8x ESI:%8.8x\n",
SC_EDI(dbg_mask), SC_ESI(dbg_mask));
}
void info_stack(){
unsigned int * dump;
int i;
if(!regval) {
application_not_running();
return;
}
fprintf(stderr,"Stack dump:\n");
dump = (int*) SC_ESP(dbg_mask);
for(i=0; i<22; i++)
{
fprintf(stderr," %8.8x", *dump++);
if ((i % 8) == 7)
fprintf(stderr,"\n");
}
fprintf(stderr,"\n");
}
void examine_memory( unsigned int segment, unsigned int addr,
int count, char format )
{
......@@ -88,9 +34,10 @@ void examine_memory( unsigned int segment, unsigned int addr,
unsigned short int * wdump;
int i;
if (segment == 0xffffffff)
segment = (dbg_mode == 32) ? 0 : (format == 'i' ? SC_CS : SC_DS);
if (segment == 0xffffffff) segment = (format == 'i' ? CS : DS);
if ((segment == WINE_CODE_SELECTOR) || (segment == WINE_DATA_SELECTOR))
segment = 0;
if (format != 'i' && count > 1)
{
print_address( segment, addr, dbg_mode );
......@@ -114,7 +61,7 @@ void examine_memory( unsigned int segment, unsigned int addr,
for(i=0; i<count; i++) {
print_address( segment, addr, dbg_mode );
fprintf(stderr,": ");
addr = db_disasm( segment, addr, (dbg_mode == 16) );
addr = db_disasm( segment, addr );
fprintf(stderr,"\n");
};
return;
......@@ -152,7 +99,7 @@ void examine_memory( unsigned int segment, unsigned int addr,
wdump = (unsigned short *)pnt;
for(i=0; i<count; i++)
{
fprintf(stderr," %x", *wdump++);
fprintf(stderr," %04x", *wdump++);
addr += 2;
if ((i % 10) == 7) {
fprintf(stderr,"\n");
......@@ -205,14 +152,15 @@ char * helptext[] = {
"The commands accepted by the Wine debugger are a small subset",
"of the commands that gdb would accept. The commands currently",
"are:\n",
" break *<addr> bt",
" break [*<addr>] delete break bpnum",
" disable bpnum enable bpnum",
" help quit",
" x <expr> cont",
" step next",
" mode [16,32] print <expr>",
" set <reg> = <expr> set *<expr> = <expr>",
" info [reg,stack,break,segments] symbolfile <filename>",
" define <identifier> <expr>",
" info [reg,stack,break,segments] bt",
" symbolfile <filename> define <identifier> <expr>",
"",
"The 'x' command accepts repeat counts and formats (including 'i') in the",
"same way that gdb does.",
......@@ -230,57 +178,3 @@ void dbg_help(){
i = 0;
while(helptext[i]) fprintf(stderr,"%s\n", helptext[i++]);
}
struct frame{
union{
struct {
unsigned short saved_bp;
unsigned short saved_ip;
unsigned short saved_cs;
} win16;
struct {
unsigned long saved_bp;
unsigned long saved_ip;
unsigned short saved_cs;
} win32;
} u;
};
void dbg_bt(){
struct frame * frame;
unsigned short cs;
int frameno = 0;
if(!regval) {
application_not_running();
return;
}
if (dbg_mode == 16)
frame = (struct frame *)PTR_SEG_OFF_TO_LIN( SC_SS, SC_BP & ~1 );
else
frame = (struct frame *)SC_EBP(dbg_mask);
fprintf(stderr,"Backtrace:\n");
cs = SC_CS;
while((cs & 3) == 3) {
/* See if in 32 bit mode or not. Assume GDT means 32 bit. */
if ((cs & 7) != 7) {
fprintf(stderr,"%d ",frameno++);
print_address( 0, frame->u.win32.saved_ip, 32 );
fprintf( stderr, "\n" );
if (!frame->u.win32.saved_ip) break;
frame = (struct frame *) frame->u.win32.saved_bp;
} else {
if (frame->u.win16.saved_bp & 1) cs = frame->u.win16.saved_cs;
fprintf(stderr,"%d %4.4x:%4.4x\n", frameno++, cs,
frame->u.win16.saved_ip);
if (!frame->u.win16.saved_bp) break;
frame = (struct frame *) PTR_SEG_OFF_TO_LIN( SC_SS, frame->u.win16.saved_bp & ~1);
}
}
putchar('\n');
}
/*
* Debugger register handling
*
* Copyright 1995 Alexandre Julliard
*/
#include <stdio.h>
#include "debugger.h"
struct sigcontext_struct *context;
/***********************************************************************
* DEBUG_SetRegister
*
* Set a register value.
*/
void DEBUG_SetRegister( enum debug_regs reg, int val )
{
switch(reg)
{
case REG_EAX: EAX = val; break;
case REG_EBX: EBX = val; break;
case REG_ECX: ECX = val; break;
case REG_EDX: EDX = val; break;
case REG_ESI: ESI = val; break;
case REG_EDI: EDI = val; break;
case REG_EBP: EBP = val; break;
case REG_EFL: EFL = val; break;
case REG_EIP: EIP = val; break;
case REG_ESP: ESP = val; break;
case REG_AX: AX = val; break;
case REG_BX: BX = val; break;
case REG_CX: CX = val; break;
case REG_DX: DX = val; break;
case REG_SI: SI = val; break;
case REG_DI: DI = val; break;
case REG_BP: BP = val; break;
case REG_FL: FL = val; break;
case REG_IP: IP = val; break;
case REG_SP: SP = val; break;
case REG_CS: CS = val; break;
case REG_DS: DS = val; break;
case REG_ES: ES = val; break;
case REG_SS: SS = val; break;
}
}
/***********************************************************************
* DEBUG_GetRegister
*
* Get a register value.
*/
int DEBUG_GetRegister( enum debug_regs reg )
{
switch(reg)
{
case REG_EAX: return EAX;
case REG_EBX: return EBX;
case REG_ECX: return ECX;
case REG_EDX: return EDX;
case REG_ESI: return ESI;
case REG_EDI: return EDI;
case REG_EBP: return EBP;
case REG_EFL: return EFL;
case REG_EIP: return EIP;
case REG_ESP: return ESP;
case REG_AX: return AX;
case REG_BX: return BX;
case REG_CX: return CX;
case REG_DX: return DX;
case REG_SI: return SI;
case REG_DI: return DI;
case REG_BP: return BP;
case REG_FL: return FL;
case REG_IP: return IP;
case REG_SP: return SP;
case REG_CS: return CS;
case REG_DS: return DS;
case REG_ES: return ES;
case REG_SS: return SS;
}
return 0; /* should not happen */
}
/***********************************************************************
* DEBUG_InfoRegisters
*
* Display registers information.
*/
void DEBUG_InfoRegisters(void)
{
fprintf(stderr,"Register dump:\n");
/* First get the segment registers out of the way */
fprintf( stderr," CS:%04x SS:%04x DS:%04x ES:%04x\n", CS, SS, DS, ES );
if (dbg_mode == 16)
{
fprintf( stderr," IP:%04x SP:%04x BP:%04x FLAGS:%04x\n",
IP, SP, BP, FL );
fprintf( stderr," AX:%04x BX:%04x CX:%04x DX:%04x SI:%04x DI:%04x\n",
AX, BX, CX, DX, SI, DI );
}
else /* 32-bit mode */
{
fprintf( stderr, " EIP:%08lx ESP:%08lx EBP:%08lx EFLAGS:%08lx\n",
EIP, ESP, EBP, EFL );
fprintf( stderr, " EAX:%08lx EBX:%08lx ECX:%08lx EDX:%08lx\n",
EAX, EBX, ECX, EDX);
fprintf( stderr, " ESI:%08lx EDI:%08lx\n", ESI, EDI);
}
}
#ifdef linux
/* Register numbers */
#define RN_GS 0
#define RN_FS 1
#define RN_ES 2
#define RN_DS 3
#define RN_EDI 4
#define RN_ESI 5
#define RN_EBP 6
#define RN_ESP 7
#define RN_EBX 8
#define RN_EDX 9
#define RN_ECX 10
#define RN_EAX 11
#define RN_TRAPNO 12
#define RN_ERR 13
#define RN_EIP 14
#define RN_CS 15
#define RN_EFLAGS 16
#define RN_ESP_AT_SIGNAL 17
#define RN_SS 18
#define RN_I387 19
#define RN_OLDMASK 20
#define RN_CR2 21
#endif
#ifdef __NetBSD__
/* Register numbers */
#define RN_GS 0
#define RN_FS 1
#define RN_ES 2
#define RN_DS 3
#define RN_EDI 4
#define RN_ESI 5
#define RN_EBP 6
#define RN_EBX 7
#define RN_EDX 8
#define RN_ECX 9
#define RN_EAX 10
#define RN_EIP 11
#define RN_CS 12
#define RN_EFLAGS 13
#define RN_ESP_AT_SIGNAL 14
#define RN_SS 15
#define RN_OLDMASK 17
#endif
#ifdef __FreeBSD__
#define RN_OLDMASK 1
/* Register numbers */
#define RN_ESP 2
#define RN_EBP 3
#define RN_ESP_AT_SIGNAL 4
#define RN_EIP 5
#define RN_EFLAGS 6
#define RN_ES 7
#define RN_DS 8
#define RN_CS 9
#define RN_SS 10
#define RN_EDI 11
#define RN_ESI 12
#define RN_EBX 13
#define RN_EDX 14
#define RN_ECX 15
#define RN_EAX 16
/* FreeBSD doesn't save gs or fs */
#define SC_GS 0x27
#define SC_FS 0x27
#endif
#ifdef linux
#define SC_GS regval[RN_GS]
#define SC_FS regval[RN_FS]
#define I387 regval[RN_I387]
#define CR2 regval[RN_CR2]
#endif
#ifdef __NetBSD__
#define SC_GS regval[RN_GS]
#define SC_FS regval[RN_FS]
#endif
#define SC_ES regval[RN_ES]
#define SC_DS regval[RN_DS]
#define SC_EDI(dbg_mask) (regval[RN_EDI] & dbg_mask)
#define SC_ESI(dbg_mask) (regval[RN_ESI] & dbg_mask)
#define SC_EBP(dbg_mask) (regval[RN_EBP] & dbg_mask)
#define SC_EBX(dbg_mask) (regval[RN_EBX] & dbg_mask)
#define SC_EDX(dbg_mask) (regval[RN_EDX] & dbg_mask)
#define SC_ECX(dbg_mask) (regval[RN_ECX] & dbg_mask)
#define SC_EAX(dbg_mask) (regval[RN_EAX] & dbg_mask)
#define SC_DI (regval[RN_EDI] & 0xffff)
#define SC_SI (regval[RN_ESI] & 0xffff)
#define SC_BP (regval[RN_EBP] & 0xffff)
#define SC_SP (regval[RN_ESP] & 0xffff)
#define SC_BX (regval[RN_EBX] & 0xffff)
#define SC_DX (regval[RN_EDX] & 0xffff)
#define SC_CX (regval[RN_ECX] & 0xffff)
#define SC_AX (regval[RN_EAX] & 0xffff)
#define SC_TRAPNO regval[RN_TRAPNO]
#define SC_ERR regval[RN_ERR]
#define SC_EIP(dbg_mask) (regval[RN_EIP] & dbg_mask)
#define SC_CS regval[RN_CS]
#define SC_EFLAGS regval[RN_EFLAGS]
#define SC_ESP(dbg_mask) (regval[RN_ESP_AT_SIGNAL] & dbg_mask)
#define SC_SS regval[RN_SS]
#define OLDMASK regval[RN_OLDMASK]
/*
* Debugger stack handling
*
* Copyright 1995 Alexandre Julliard
*/
#include <stdio.h>
#include "windows.h"
#include "debugger.h"
typedef struct
{
WORD bp;
WORD ip;
WORD cs;
} FRAME16;
typedef struct
{
DWORD bp;
DWORD ip;
WORD cs;
} FRAME32;
/***********************************************************************
* DEBUG_InfoStack
*
* Dump the top of the stack
*/
void DEBUG_InfoStack(void)
{
fprintf(stderr,"Stack dump:\n");
if ((SS == WINE_DATA_SELECTOR) ||
(GET_SEL_FLAGS(SS) & LDT_FLAGS_32BIT)) /* 32-bit mode */
{
examine_memory( 0, ESP, 10, 'x' );
}
else /* 16-bit mode */
{
examine_memory( SS, SP, 10, 'w' );
}
fprintf(stderr,"\n");
}
/***********************************************************************
* DEBUG_BackTrace
*
* Display a stack back-trace.
*/
void DEBUG_BackTrace(void)
{
int frameno = 0;
fprintf(stderr,"Backtrace:\n");
if (SS == WINE_DATA_SELECTOR) /* 32-bit mode */
{
FRAME32 *frame = (FRAME32 *)EBP;
while (frame->ip)
{
fprintf(stderr,"%d ",frameno++);
print_address( 0, frame->ip, 32 );
fprintf( stderr, "\n" );
frame = (FRAME32 *)frame->bp;
}
}
else /* 16-bit mode */
{
FRAME16 *frame = (FRAME16 *)PTR_SEG_OFF_TO_LIN( SS, BP & ~1 );
WORD cs = CS;
if (GET_SEL_FLAGS(SS) & LDT_FLAGS_32BIT)
{
fprintf( stderr, "Not implemented: 32-bit backtrace on a different stack segment.\n" );
return;
}
while (frame->bp)
{
if (frame->bp & 1) cs = frame->cs;
fprintf( stderr,"%d ", frameno++ );
print_address( cs, frame->ip, 16 );
fprintf( stderr, "\n" );
frame = (FRAME16 *)PTR_SEG_OFF_TO_LIN( SS, frame->bp & ~1 );
}
}
fprintf( stderr, "\n" );
}
......@@ -2,9 +2,9 @@ name compobj
id 22
1 pascal CoBuildVersion() CoBuildVersion
2 pascal CoInitialize(ptr) CoInitialize
2 pascal CoInitialize(long) CoInitialize
3 pascal CoUninitialize() CoUnitialize
4 stub COGETMALLOC
4 pascal CoGetMalloc(long ptr) CoGetMalloc
5 stub COREGISTERCLASSOBJECT
6 stub COREVOKECLASSOBJECT
7 stub COGETCLASSOBJECT
......@@ -97,49 +97,49 @@ id 22
95 stub SETETASK
96 stub LRPCFREEMONITORDATA
97 stub REMLOOKUPSHUNK
#100 ??0CARRAYFVALUE@@REC@KI@Z
#101 ??1CARRAYFVALUE@@REC@XZ
#102 ?ASSERTVALID@CARRAYFVALUE@@RFCXXZ
#103 ?FREEEXTRA@CARRAYFVALUE@@RECXXZ
#104 ?_GETAT@CARRAYFVALUE@@RFCPEXH@Z
#105 ?GETSIZE@CARRAYFVALUE@@RFCHXZ
#108 ?INDEXOF@CARRAYFVALUE@@RECHPEXII@Z
#109 ?INSERTAT@CARRAYFVALUE@@RECHHPEXH@Z
#111 ?REMOVEAT@CARRAYFVALUE@@RECXHH@Z
#112 ?SETAT@CARRAYFVALUE@@RECXHPEX@Z
#113 ?SETATGROW@CARRAYFVALUE@@RECHHPEX@Z
#114 ?SETSIZE@CARRAYFVALUE@@RECHHH@Z
#120 ?GETASSOCAT@CMAPKEYTOVALUE@@BFCPEUCASSOC@1@PEXIAEI@Z
#121 ?SETASSOCKEY@CMAPKEYTOVALUE@@BFCHPEUCASSOC@1@PEXI@Z
#122 ??1CMAPKEYTOVALUE@@REC@XZ
#123 ?GETASSOCKEYPTR@CMAPKEYTOVALUE@@BFCXPEUCASSOC@1@PEPEXPEI@Z
#124 ?NEWASSOC@CMAPKEYTOVALUE@@BECPEUCASSOC@1@IPEXI0@Z
#125 ?SIZEASSOC@CMAPKEYTOVALUE@@BFCIXZ
#126 ?FREEASSOC@CMAPKEYTOVALUE@@BECXPEUCASSOC@1@@Z
#127 ?GETSTARTPOSITION@CMAPKEYTOVALUE@@RFCPEXXZ
#128 ?GETNEXTASSOC@CMAPKEYTOVALUE@@RFCXPEPEXPEXPEI1@Z
#129 ?COMPAREASSOCKEY@CMAPKEYTOVALUE@@BFCHPEUCASSOC@1@PEXI@Z
#130 ?REMOVEHKEY@CMAPKEYTOVALUE@@RECHK@Z
#131 ?GETHKEY@CMAPKEYTOVALUE@@RFCKPEXI@Z
#132 ?GETCOUNT@CMAPKEYTOVALUE@@RFCHXZ
#133 ?LOOKUP@CMAPKEYTOVALUE@@RFCHPEXI0@Z
#134 ?GETASSOCVALUE@CMAPKEYTOVALUE@@BFCXPEUCASSOC@1@PEX@Z
#135 ?REMOVEKEY@CMAPKEYTOVALUE@@RECHPEXI@Z
#136 ?REMOVEALL@CMAPKEYTOVALUE@@RECXXZ
#138 ?FREEASSOCKEY@CMAPKEYTOVALUE@@BFCXPEUCASSOC@1@@Z
#139 ?SETAT@CMAPKEYTOVALUE@@RECHPEXI0@Z
#140 ?LOOKUPHKEY@CMAPKEYTOVALUE@@RFCHKPEX@Z
#141 ?ASSERTVALID@CMAPKEYTOVALUE@@RFCXXZ
#142 ?SETASSOCVALUE@CMAPKEYTOVALUE@@BFCXPEUCASSOC@1@PEX@Z
#143 ?SETATHKEY@CMAPKEYTOVALUE@@RECHKPEX@Z
#144 ??0CMAPKEYTOVALUE@@REC@KIIHP7CIPEXI@ZI@Z
#145 ?INITHASHTABLE@CMAPKEYTOVALUE@@BECHXZ
#146 ?GETASSOCVALUEPTR@CMAPKEYTOVALUE@@BFCXPEUCASSOC@1@PEPEX@Z
#147 ?LOOKUPADD@CMAPKEYTOVALUE@@RFCHPEXI0@Z
#148 MKVDEFAULTHASHKEY
#150 COMEMCTXOF
#151 COMEMALLOC
#152 COMEMFREE
#160 CORUNMODALLOOP
#161 COHANDLEINCOMINGCALL
#162 COSETACKSTATE
100 stub ??0CARRAYFVALUE@@REC@KI@Z
101 stub ??1CARRAYFVALUE@@REC@XZ
102 stub ?ASSERTVALID@CARRAYFVALUE@@RFCXXZ
103 stub ?FREEEXTRA@CARRAYFVALUE@@RECXXZ
104 stub ?_GETAT@CARRAYFVALUE@@RFCPEXH@Z
105 stub ?GETSIZE@CARRAYFVALUE@@RFCHXZ
108 stub ?INDEXOF@CARRAYFVALUE@@RECHPEXII@Z
109 stub ?INSERTAT@CARRAYFVALUE@@RECHHPEXH@Z
111 stub ?REMOVEAT@CARRAYFVALUE@@RECXHH@Z
112 stub ?SETAT@CARRAYFVALUE@@RECXHPEX@Z
113 stub ?SETATGROW@CARRAYFVALUE@@RECHHPEX@Z
114 stub ?SETSIZE@CARRAYFVALUE@@RECHHH@Z
120 stub ?GETASSOCAT@CMAPKEYTOVALUE@@BFCPEUCASSOC@1@PEXIAEI@Z
121 stub ?SETASSOCKEY@CMAPKEYTOVALUE@@BFCHPEUCASSOC@1@PEXI@Z
122 stub ??1CMAPKEYTOVALUE@@REC@XZ
123 stub ?GETASSOCKEYPTR@CMAPKEYTOVALUE@@BFCXPEUCASSOC@1@PEPEXPEI@Z
124 stub ?NEWASSOC@CMAPKEYTOVALUE@@BECPEUCASSOC@1@IPEXI0@Z
125 stub ?SIZEASSOC@CMAPKEYTOVALUE@@BFCIXZ
126 stub ?FREEASSOC@CMAPKEYTOVALUE@@BECXPEUCASSOC@1@@Z
127 stub ?GETSTARTPOSITION@CMAPKEYTOVALUE@@RFCPEXXZ
128 stub ?GETNEXTASSOC@CMAPKEYTOVALUE@@RFCXPEPEXPEXPEI1@Z
129 stub ?COMPAREASSOCKEY@CMAPKEYTOVALUE@@BFCHPEUCASSOC@1@PEXI@Z
130 stub ?REMOVEHKEY@CMAPKEYTOVALUE@@RECHK@Z
131 stub ?GETHKEY@CMAPKEYTOVALUE@@RFCKPEXI@Z
132 stub ?GETCOUNT@CMAPKEYTOVALUE@@RFCHXZ
133 stub ?LOOKUP@CMAPKEYTOVALUE@@RFCHPEXI0@Z
134 stub ?GETASSOCVALUE@CMAPKEYTOVALUE@@BFCXPEUCASSOC@1@PEX@Z
135 stub ?REMOVEKEY@CMAPKEYTOVALUE@@RECHPEXI@Z
136 stub ?REMOVEALL@CMAPKEYTOVALUE@@RECXXZ
138 stub ?FREEASSOCKEY@CMAPKEYTOVALUE@@BFCXPEUCASSOC@1@@Z
139 stub ?SETAT@CMAPKEYTOVALUE@@RECHPEXI0@Z
140 stub ?LOOKUPHKEY@CMAPKEYTOVALUE@@RFCHKPEX@Z
141 stub ?ASSERTVALID@CMAPKEYTOVALUE@@RFCXXZ
142 stub ?SETASSOCVALUE@CMAPKEYTOVALUE@@BFCXPEUCASSOC@1@PEX@Z
143 stub ?SETATHKEY@CMAPKEYTOVALUE@@RECHKPEX@Z
144 stub ??0CMAPKEYTOVALUE@@REC@KIIHP7CIPEXI@ZI@Z
145 stub ?INITHASHTABLE@CMAPKEYTOVALUE@@BECHXZ
146 stub ?GETASSOCVALUEPTR@CMAPKEYTOVALUE@@BFCXPEUCASSOC@1@PEPEX@Z
147 stub ?LOOKUPADD@CMAPKEYTOVALUE@@RFCHPEXI0@Z
148 stub MKVDEFAULTHASHKEY
150 stub COMEMCTXOF
151 stub COMEMALLOC
152 stub COMEMFREE
160 stub CORUNMODALLOOP
161 stub COHANDLEINCOMINGCALL
162 stub COSETACKSTATE
......@@ -205,8 +205,8 @@ id 3
306 stub ENGINEMAKEFONTDIR
307 stub GetCharABCWidths
308 stub GetOutLineTextMetrics
309 stub GetGlyphOutLine
310 stub CreateScalableFontResource
309 pascal GetGlyphOutLine(word word word ptr long ptr ptr) GetGlyphOutLine
310 pascal16 CreateScalableFontResource(word ptr ptr ptr) CreateScalableFontResource
311 stub GetFontData
312 stub ConvertOutLineFontFile
313 pascal16 GetRasterizerCaps(ptr word) GetRasterizerCaps
......
name OLE2
id 15
1 stub OleBuildVersion
1 pascal OleBuildVersion() OleBuildVersion
2 pascal OleInitialize(ptr) OleInitialize
3 pascal OleUninitialize() OleUninitialize
4 stub DLLGETCLASSOBJECT
......
......@@ -2,12 +2,12 @@ name ole2disp
id 17
1 stub DLLGETCLASSOBJECT
2 stub SYSALLOCSTRING
3 stub SYSREALLOCSTRING
4 stub SYSALLOCSTRINGLEN
5 stub SYSREALLOCSTRINGLEN
6 stub SYSFREESTRING
7 stub SYSSTRINGLEN
2 pascal SysAllocString(ptr) SysAllocString
3 pascal SysReallocString(ptr ptr) SysReAllocString
4 pascal SysAllocStringLen(ptr word) SysAllocStringLen
5 pascal SysReAllocStringLen(ptr ptr word) SysReAllocStringLen
6 pascal SysFreeString(long) SysFreeString
7 pascal SysStringLen(long) SysStringLen
8 stub VARIANTINIT
9 stub VARIANTCLEAR
10 stub VARIANTCOPY
......
......@@ -8,7 +8,7 @@ id 18
5 pascal GetLocaleInfoA(long long ptr word) GetLocaleInfoA
6 stub LCMAPSTRINGA
7 stub GETSTRINGTYPEA
8 stub COMPARESTRINGA
8 pascal16 CompareStringA(long long ptr word ptr word) CompareStringA
#9 WEP
10 stub LIBMAIN
11 stub NOTIFYWINDOWPROC
......@@ -6,13 +6,13 @@ id 5
# proper parameters. It's just to have stub for PROGMAN.EXE ...
#
1 pascal RegOpenKey(word ptr ptr) RegOpenKey
2 pascal RegCreateKey(word ptr ptr) RegCreateKey
3 pascal RegCloseKey(word) RegCloseKey
4 pascal RegDeleteKey(word ptr) RegDeleteKey
5 pascal RegSetValue(word ptr long ptr long) RegSetValue
6 pascal RegQueryValue(word ptr ptr ptr) RegQueryValue
7 pascal RegEnumKey(word long ptr long) RegEnumKey
1 pascal RegOpenKey(long ptr ptr) RegOpenKey
2 pascal RegCreateKey(long ptr ptr) RegCreateKey
3 pascal RegCloseKey(long) RegCloseKey
4 pascal RegDeleteKey(long ptr) RegDeleteKey
5 pascal RegSetValue(long ptr long ptr long) RegSetValue
6 pascal RegQueryValue(long ptr ptr ptr) RegQueryValue
7 pascal RegEnumKey(long long ptr long) RegEnumKey
9 pascal16 DragAcceptFiles(word word) DragAcceptFiles
11 pascal16 DragQueryFile(word s_word ptr s_word) DragQueryFile
12 pascal16 DragFinish(word) DragFinish
......
......@@ -26,8 +26,8 @@ id 12
72 pascal16 MemManInfo(ptr) MemManInfo
73 stub NOTIFYREGISTER
74 stub NOTIFYUNREGISTER
75 stub INTERRUPTREGISTER
76 stub INTERRUPTUNREGISTER
75 return INTERRUPTREGISTER 6 0
76 return INTERRUPTUNREGISTER 2 0
77 stub TERMINATEAPP
78 pascal MemoryRead(word long ptr long) MemoryRead
79 pascal MemoryWrite(word long ptr long) MemoryWrite
......
......@@ -88,7 +88,7 @@ extern WORD CallTo16_regs_( FARPROC func, WORD ds, WORD es, WORD bp, WORD ax,
(*func)( code, wParam, lParam )
#define CallTimeFuncProc( func, id, msg, dwUser, dw1, dw2 ) \
(*func)( id, msg, dwUser, dw1, dw2 )
#define CallWndProc( func, hwnd, msg, wParam, lParam ) \
#define CallWndProc( func, ds, hwnd, msg, wParam, lParam ) \
(*func)( hwnd, msg, wParam, lParam )
#endif /* WINELIB */
......
/*
* Debugger definitions
*
* Copyright 1995 Alexandre Julliard
*/
#ifndef DEBUGGER_H
#define DEBUGGER_H
#include "ldt.h"
#include "registers.h"
#include "wine.h"
enum debug_regs
{
REG_EAX, REG_EBX, REG_ECX, REG_EDX, REG_ESI,
REG_EDI, REG_EBP, REG_EFL, REG_EIP, REG_ESP,
REG_AX, REG_BX, REG_CX, REG_DX, REG_SI,
REG_DI, REG_BP, REG_FL, REG_IP, REG_SP,
REG_CS, REG_DS, REG_ES, REG_SS
};
enum exec_mode
{
EXEC_CONT, /* Continuous execution */
EXEC_STEP_OVER, /* Stepping over a call */
EXEC_STEP_INSTR /* Single-stepping an instruction */
};
extern struct sigcontext_struct *context; /* debugger/registers.c */
extern unsigned int dbg_mode;
/* debugger/break.c */
extern void DEBUG_SetBreakpoints( BOOL set );
extern int DEBUG_FindBreakpoint( unsigned int segment, unsigned int addr );
extern void DEBUG_AddBreakpoint( unsigned int segment, unsigned int addr );
extern void DEBUG_DelBreakpoint( int num );
extern void DEBUG_EnableBreakpoint( int num, BOOL enable );
extern void DEBUG_InfoBreakpoints(void);
extern BOOL DEBUG_HandleTrap( struct sigcontext_struct *context );
extern BOOL DEBUG_ShouldContinue( struct sigcontext_struct *context,
enum exec_mode mode );
extern void DEBUG_RestartExecution( struct sigcontext_struct *context,
enum exec_mode mode, int instr_len );
/* debugger/registers.c */
extern void DEBUG_SetRegister( enum debug_regs reg, int val );
extern int DEBUG_GetRegister( enum debug_regs reg );
extern void DEBUG_InfoRegisters(void);
/* debugger/stack.c */
extern void DEBUG_InfoStack(void);
extern void DEBUG_BackTrace(void);
/* debugger/dbg.y */
extern void wine_debug( int signal, struct sigcontext_struct * regs );
extern void print_address( unsigned int seg, unsigned int addr, int addrlen );
extern unsigned int db_disasm( unsigned int segment, unsigned int loc );
#endif /* DEBUGGER_H */
......@@ -20,6 +20,25 @@ typedef struct
LOGFONT logfont WINE_PACKED;
} FONTOBJ;
/* may be switched... */
#define GGO_BITMAP 0x4F4D
#define GGO_NATIVE 0x4F50
typedef struct
{
UINT gmBlackBoxX;
UINT gmBlackBoxY;
POINT gmptGlyphOrigin;
int gmCellIncX;
int gmCellIncY;
} GLYPHMETRICS,*LPGLYPHMETRICS;
typedef struct
{
DWORD eM11; /* all type FIXED in Borlands Handbook */
DWORD eM12;
DWORD eM21;
DWORD eM22;
} MAT2,*LPMAT2;
#ifndef WINELIB
#pragma pack(4)
#endif
......
......@@ -245,7 +245,7 @@ typedef struct tagDC
#ifdef WINELIB
#define GDI_HEAP_ALLOC(f,size) LocalAlloc (f,size)
#define GDI_HEAP_ALLOC(size) LocalAlloc (LMEM_FIXED,size)
#define GDI_HEAP_LIN_ADDR(handle) LocalLock (handle)
#define GDI_HEAP_SEG_ADDR(handle) LocalLock (handle)
#define GDI_HEAP_FREE(handle) LocalFree (handle)
......
......@@ -47,19 +47,33 @@ extern ldt_copy_entry ldt_copy[LDT_SIZE];
#define __AHSHIFT 3
#define __AHINCR (1 << __AHSHIFT)
#ifndef WINELIB
#define SELECTOR_TO_ENTRY(sel) (((int)(sel) & 0xffff) >> __AHSHIFT)
#define ENTRY_TO_SELECTOR(i) ((i) ? (((int)(i) << __AHSHIFT) | 7) : 0)
#define IS_LDT_ENTRY_FREE(i) (!(ldt_copy[(i)].base || ldt_copy[(i)].limit))
#define IS_SELECTOR_FREE(sel) (IS_LDT_ENTRY_FREE(SELECTOR_TO_ENTRY(sel)))
#define GET_SEL_BASE(sel) (ldt_copy[SELECTOR_TO_ENTRY(sel)].base)
#define GET_SEL_LIMIT(sel) (ldt_copy[SELECTOR_TO_ENTRY(sel)].limit)
#else
/* Complain if these are used in WineLib */
#define SELECTOR_TO_ENTRY(sel) error.error
#define ENTRY_TO_SELECTOR(i) error.error
#define IS_LDT_ENTRY_FREE(i) error.error
#define GET_SEL_BASE(sel) error.error
#define GET_SEL_LIMIT(sel) error.error
#endif
#ifndef WINELIB
/* Convert a segmented ptr (16:16) to a linear (32) pointer */
#define PTR_SEG_TO_LIN(ptr) \
((void*)(GET_SEL_BASE((int)(ptr) >> 16) + ((int)(ptr) & 0xffff)))
#define PTR_SEG_OFF_TO_LIN(seg,off) \
((void*)(GET_SEL_BASE(seg) + (unsigned int)(off)))
#else
#define PTR_SEG_TO_LIN(ptr) ((void*)(ptr))
#define PTR_SEG_OFF_TO_LIN(seg,off) ((void*)(off))
#endif
extern unsigned char ldt_flags_copy[LDT_SIZE];
......
......@@ -28,6 +28,8 @@ typedef struct {
HWND hParent;
HFONT hFont;
BOOL bRedrawFlag;
BOOL HasStrings;
BOOL OwnerDrawn;
WORD iNumStops;
LPINT TabStops;
HANDLE hDrawItemStruct;
......@@ -41,9 +43,6 @@ extern void DestroyListBoxStruct(LPHEADLIST lphl);
extern void ListBoxSendNotification(LPHEADLIST lphl,HWND hwnd, WORD code);
extern BOOL OWNER_DRAWN(LPHEADLIST lphl);
extern BOOL HasStrings(LPHEADLIST lphl);
extern LPLISTSTRUCT ListBoxGetItem(LPHEADLIST lphl, UINT uIndex);
extern int ListMaxFirstVisible(LPHEADLIST lphl);
extern int ListBoxScrollToFocus(LPHEADLIST lphl);
......
......@@ -15,6 +15,7 @@ struct dosdirent {
char search_attribute;
long filesize;
long filetime;
int telldirnum;
short entnum; /* Directory entry number */
};
......
......@@ -102,6 +102,7 @@ struct ne_segment_table_entry_s
#define NE_SEGFLAGS_DATA 0x0001
#define NE_SEGFLAGS_ALLOCATED 0x0002
#define NE_SEGFLAGS_LOADED 0x0004
#define NE_SEGFLAGS_ITERATED 0x0008
#define NE_SEGFLAGS_MOVEABLE 0x0010
#define NE_SEGFLAGS_SHAREABLE 0x0020
#define NE_SEGFLAGS_PRELOAD 0x0040
......
......@@ -20,7 +20,6 @@ extern HBITMAP ConvertInfoBitmap( HDC hdc, BITMAPINFO * image );
/* loader/signal.c */
extern void init_wine_signals(void);
extern void wine_debug(int signal, int * regs);
/* loader/wine.c */
......
......@@ -13,6 +13,7 @@
#define EDX (context->sc_edx)
#define ESI (context->sc_esi)
#define EDI (context->sc_edi)
#define EBP (context->sc_ebp)
#define AX (*(WORD*)&context->sc_eax)
#define BX (*(WORD*)&context->sc_ebx)
......@@ -20,6 +21,7 @@
#define DX (*(WORD*)&context->sc_edx)
#define SI (*(WORD*)&context->sc_esi)
#define DI (*(WORD*)&context->sc_edi)
#define BP (*(WORD*)&context->sc_ebp)
#define AL (*(BYTE*)&context->sc_eax)
#define AH (*(((BYTE*)&context->sc_eax)+1))
......@@ -37,8 +39,10 @@
#ifndef __FreeBSD__
#define EFL (context->sc_eflags)
#define FL (*(WORD*)&context->sc_eflags)
#else
#define EFL (context->sc_efl)
#define FL (*(WORD*)&context->sc_efl)
#endif
#define EIP (context->sc_eip)
......
......@@ -57,6 +57,7 @@ extern DWORD IF1632_Saved32_esp;
extern SEGPTR IF1632_Stack32_base;
extern DWORD IF1632_Original32_esp;
#ifndef WINELIB
#define CURRENT_STACK16 \
((STACK16FRAME *)PTR_SEG_OFF_TO_LIN(IF1632_Saved16_ss,IF1632_Saved16_sp))
......@@ -67,5 +68,10 @@ extern DWORD IF1632_Original32_esp;
#define MAKE_SEGPTR(ptr) \
((SEGPTR)IF1632_Stack32_base + \
((DWORD)(ptr) - (DWORD)PTR_SEG_TO_LIN(IF1632_Stack32_base)))
#else
#define CURRENT_STACK16 error.error
#define CURRENT_DS 0
#define MAKE_SEGPTR(ptr) (ptr)
#endif
#endif /* WINE_STACKFRAME_H */
......@@ -14,8 +14,8 @@
#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_ALLOC(size) LocalAlloc (LMEM_FIXED, size)
#define USER_HEAP_REALLOC(handle,size) LocalReAlloc (handle,size,LMEM_FIXED)
#define USER_HEAP_LIN_ADDR(handle) LocalLock (handle)
#define USER_HEAP_SEG_ADDR(handle) LocalLock (handle)
#define USER_HEAP_FREE(handle) LocalFree (handle)
......
......@@ -98,3 +98,7 @@
#define LOCALE_INEGSYMPRECEDES 0x00000056
#define LOCALE_INEGSEPBYSPACE 0x00000057
#define NORM_IGNORECASE 1
#define NORM_IGNORENONSPACE 2
#define NORM_IGNORESYMBOLS 4
#define NORM_STRINGSORT 0x1000
......@@ -20,7 +20,6 @@ typedef struct
} DWP;
extern HWND WINPOS_NextWindowFromPoint( HWND hwnd, POINT pt );
extern HWND WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg );
extern LONG WINPOS_SendNCCalcSize( HWND hwnd, BOOL calcValidRect,
RECT *newWindowRect, RECT *oldWindowRect,
......
......@@ -11,13 +11,13 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <string.h>
#include <errno.h>
#include "windows.h"
#include "debugger.h"
#include "dos_fs.h"
#include "dlls.h"
#include "miscemu.h"
#include "neexe.h"
#include "wineopts.h"
#include "task.h"
#include "options.h"
#include "task.h"
#include "pe_image.h"
#include "stddebug.h"
#include "debug.h"
......@@ -115,7 +115,7 @@ int _WinMain(int argc, char **argv)
}
}
if (Options.debug) wine_debug(0, NULL);
if (Options.debug) DEBUG_SetBreakpoints( TRUE ); /* Setup breakpoints */
Yield(); /* Start the first task */
fprintf( stderr, "WinMain: Should never happen: returned from Yield()\n" );
......
......@@ -50,6 +50,18 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
pModuleTable = NE_MODULE_TABLE( pModule );
if (!pSeg->filepos) return TRUE; /* No file image, just return */
if (pSeg->flags & NE_SEGFLAGS_ITERATED)
{
fprintf(stderr, "Sorry, iterated segments are not supported\n"
"Please report that %*.*s, segment %d is such a segment\n",
*((BYTE*)pModule + pModule->name_table),
*((BYTE*)pModule + pModule->name_table),
(char *)pModule + pModule->name_table + 1,
segnum
);
exit(1);
}
fd = MODULE_OpenFile( hModule );
dprintf_module( stddeb, "Loading segment %d, selector=%04x\n",
......@@ -277,6 +289,9 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
*/
void NE_FixupPrologs( HMODULE hModule )
{
#ifdef WINELIB
fprintf(stderr,"NE_FixupPrologs should not be called for libwine\n");
#else
NE_MODULE *pModule;
SEGTABLEENTRY *pSegTable;
WORD dgroup = 0;
......@@ -357,6 +372,7 @@ void NE_FixupPrologs( HMODULE hModule )
p += (sel == 0xff) ? 6 : 3;
}
}
#endif
}
......
......@@ -343,14 +343,14 @@ HICON LoadIcon( HANDLE instance, SEGPTR icon_name )
if (rsc_mem == (HANDLE)NULL) {
printf("LoadIcon / Icon %08x not Found !\n", (int) icon_name);
return 0;
}
}
lp = (WORD *)LockResource(rsc_mem);
lpicodesc = (ICONDESCRIP *)(lp + 3);
hIcon = GlobalAlloc(GMEM_MOVEABLE, sizeof(ICONALLOC) + 1024);
if (hIcon == (HICON)NULL) {
FreeResource( rsc_mem );
return 0;
}
}
lpico = (ICONALLOC *)GlobalLock(hIcon);
lpico->descriptor = *lpicodesc;
width = lpicodesc->Width;
......@@ -373,20 +373,15 @@ HICON LoadIcon( HANDLE instance, SEGPTR icon_name )
lpico->hBitmap = CreateDIBitmap( hdc, &pInfo->bmiHeader, CBM_INIT,
(char*)bmi + size, pInfo, DIB_RGB_COLORS );
if (bih->biSizeImage == 0)
if (bih->biCompression != BI_RGB)
{
if (bih->biCompression != BI_RGB)
{
fprintf(stderr,"Unknown size for compressed Icon bitmap.\n");
FreeResource( rsc_mem );
ReleaseDC( 0, hdc);
return 0;
}
bih->biSizeImage = (DIB_GetImageWidthBytes(bih->biWidth,bih->biBitCount) +
DIB_GetImageWidthBytes(bih->biWidth,1)) * bih->biHeight/2;
fprintf(stderr,"Unknown size for compressed Icon bitmap.\n");
FreeResource( rsc_mem );
ReleaseDC( 0, hdc);
return 0;
}
bits = (char *)bmi + size +
bih->biSizeImage * bih->biBitCount / (bih->biBitCount+1);
DIB_GetImageWidthBytes(bih->biWidth,bih->biBitCount) * bih->biHeight;
bih->biBitCount = 1;
bih->biClrUsed = bih->biClrImportant = 2;
rgbq = &pInfo->bmiColors[0];
......
......@@ -14,7 +14,7 @@
#include <syscall.h>
#endif
#include "wine.h"
#include "debugger.h"
#include "prototypes.h"
#include "miscemu.h"
#include "registers.h"
......@@ -53,37 +53,20 @@ static void win_fault(int signal, struct sigcontext_struct context_struct)
static void win_fault(int signal, int code, struct sigcontext *context)
{
#endif
#if !(defined (linux) || defined (__NetBSD__))
int i, *dump;
#endif
if(signal == SIGTRAP) EIP--; /* Back up over the int3 instruction. */
else if (CS == WINE_CODE_SELECTOR)
if (signal != SIGTRAP)
{
fprintf(stderr, "Segmentation fault in Wine program (%x:%lx)."
" Please debug\n", CS, EIP );
if (CS == WINE_CODE_SELECTOR)
{
fprintf(stderr, "Segmentation fault in Wine program (%x:%lx)."
" Please debug\n", CS, EIP );
}
else if (INSTR_EmulateInstruction( context )) return;
fprintf(stderr,"In win_fault %x:%lx\n", CS, EIP );
}
else if (INSTR_EmulateInstruction( context )) return;
XUngrabPointer(display, CurrentTime);
XUngrabServer(display);
XFlush(display);
fprintf(stderr,"In win_fault %x:%lx\n", CS, EIP );
#if defined(linux) || defined(__NetBSD__) || defined(__FreeBSD__)
wine_debug(signal, (int *)context); /* Enter our debugger */
#else
fprintf(stderr,"Stack: %x:%x\n", SS, ESP );
dump = (int*) context;
for(i=0; i<22; i++)
{
fprintf(stderr," %8.8x", *dump++);
if ((i % 8) == 7)
fprintf(stderr,"\n");
}
fprintf(stderr,"\n");
exit(1);
#endif
wine_debug( signal, context ); /* Enter our debugger */
}
void init_wine_signals(void)
......
......@@ -10,14 +10,15 @@
#include "windows.h"
#include "task.h"
#include "callback.h"
#include "debugger.h"
#include "global.h"
#include "instance.h"
#include "miscemu.h"
#include "module.h"
#include "neexe.h"
#include "options.h"
#include "selectors.h"
#include "toolhelp.h"
#include "wine.h"
#include "stddebug.h"
#include "debug.h"
......@@ -220,6 +221,7 @@ static void TASK_CallToStart(void)
dprintf_task( stddeb, "Starting main program: cs:ip=%04x:%04x ds=%04x ss:sp=%04x:%04x\n",
cs_reg, ip_reg, ds_reg,
IF1632_Saved16_ss, IF1632_Saved16_sp);
CallTo16_regs_( (FARPROC)(cs_reg << 16 | ip_reg), ds_reg,
pTask->hPDB /*es*/, 0 /*bp*/, 0 /*ax*/,
pModule->stack_size /*bx*/, pModule->heap_size /*cx*/,
......@@ -365,6 +367,14 @@ HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
IF1632_Saved16_sp = pTask->sp;
}
/* Add a breakpoint at the start of the task */
if (Options.debug)
{
fprintf( stderr, "Task '%s': ", name );
DEBUG_AddBreakpoint( pSegTable[pModule->cs-1].selector, pModule->ip );
}
/* Add the task to the linked list */
TASK_LinkTask( hTask );
......@@ -891,6 +901,7 @@ HMODULE GetExePtr( HANDLE handle )
(pTask->hInstance == owner) ||
(pTask->hQueue == owner) ||
(pTask->hPDB == owner)) return pTask->hModule;
hTask = pTask->hNext;
}
return 0;
}
......
......@@ -194,7 +194,7 @@ HGLOBAL GlobalReAlloc( HGLOBAL handle, DWORD size, WORD flags )
/* Discard the block if requested */
if ((size == 0) && (flags & GMEM_MOVEABLE))
if ((size == 0) && (flags & GMEM_MOVEABLE) && !(flags & GMEM_MODIFY))
{
if (!(pArena->flags & GA_MOVEABLE) ||
!(pArena->flags & GA_DISCARDABLE) ||
......
......@@ -115,13 +115,13 @@ static LOCALHEAPINFO *LOCAL_GetHeap( WORD ds )
/***********************************************************************
* LOCAL_AddFreeBlock
* LOCAL_MakeBlockFree
*
* Make a block free, inserting it in the free-list.
* 'block' is the handle of the block arena; 'baseptr' points to
* the beginning of the data segment containing the heap.
*/
static void LOCAL_AddFreeBlock( char *baseptr, WORD block )
static void LOCAL_MakeBlockFree( char *baseptr, WORD block )
{
LOCALARENA *pArena, *pNext;
WORD next;
......@@ -308,7 +308,6 @@ HLOCAL LocalInit( WORD selector, WORD start, WORD end )
if (debugging_local) LOCAL_PrintHeap(selector);
}
#if 1
if (start == 0) {
/* Check if the segment is the DGROUP of a module */
......@@ -316,6 +315,10 @@ HLOCAL LocalInit( WORD selector, WORD start, WORD end )
{
SEGTABLEENTRY *pSeg = NE_SEG_TABLE( pModule ) + pModule->dgroup - 1;
if (pModule->dgroup && (pSeg->selector == selector)) {
/* We can't just use the simple method of using the value
* of minsize + stacksize, since there are programs that
* resize the data segment before calling InitTask(). So,
* we must put it at the end of the segment */
start = GlobalSize( GlobalHandle( selector ) );
start -= end;
end += start;
......@@ -323,7 +326,6 @@ HLOCAL LocalInit( WORD selector, WORD start, WORD end )
}
}
}
#endif
ptr = PTR_SEG_OFF_TO_LIN( selector, 0 );
start = LALIGN( max( start, sizeof(INSTANCEDATA) ) );
......@@ -489,9 +491,10 @@ static HLOCAL LOCAL_FindFreeBlock( WORD ds, WORD size )
arena = pInfo->first;
pArena = ARENA_PTR( ptr, arena );
while (arena != pArena->free_next) {
for (;;) {
arena = pArena->free_next;
pArena = ARENA_PTR( ptr, arena );
if (arena == pArena->free_next) break;
if (pArena->size >= size) return arena;
}
dprintf_local( stddeb, "Local_FindFreeBlock: not enough space\n" );
......@@ -539,13 +542,14 @@ static HLOCAL LOCAL_GetBlock( WORD ds, WORD size, WORD flags )
return 0;
}
dprintf_local( stddeb, "LOCAL_GetBlock size = %04x\n", size );
/* Make a block out of the free arena */
pArena = ARENA_PTR( ptr, arena );
dprintf_local( stddeb, "LOCAL_GetBlock size = %04x, arena at %04x size %04x\n", size,
arena, pArena->size );
if (pArena->size > size + LALIGN(sizeof(LOCALARENA)))
{
LOCAL_AddBlock( ptr, arena, arena+size );
LOCAL_AddFreeBlock( ptr, arena+size );
LOCAL_MakeBlockFree( ptr, arena+size );
pInfo->items++;
}
LOCAL_RemoveFreeBlock( ptr, arena );
......@@ -618,7 +622,7 @@ static HLOCAL LOCAL_GetNewHandle( WORD ds )
/***********************************************************************
* LOCAL_FreeArena
*/
HLOCAL LOCAL_FreeArena( WORD ds, WORD arena )
static HLOCAL LOCAL_FreeArena( WORD ds, WORD arena )
{
char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 );
LOCALHEAPINFO *pInfo;
......@@ -648,7 +652,7 @@ HLOCAL LOCAL_FreeArena( WORD ds, WORD arena )
}
else /* Make a new free block */
{
LOCAL_AddFreeBlock( ptr, arena );
LOCAL_MakeBlockFree( ptr, arena );
}
/* Check if we can merge with the next block */
......@@ -769,7 +773,7 @@ HLOCAL LOCAL_ReAlloc( WORD ds, HLOCAL handle, WORD size, WORD flags )
dprintf_local( stddeb, "size reduction, making new free block\n");
/* It is worth making a new free block */
LOCAL_AddBlock( ptr, arena, nextarena );
LOCAL_AddFreeBlock( ptr, nextarena );
LOCAL_MakeBlockFree( ptr, nextarena );
pInfo->items++;
}
dprintf_local( stddeb, "LocalReAlloc: returning %04x\n", handle );
......@@ -788,7 +792,7 @@ HLOCAL LOCAL_ReAlloc( WORD ds, HLOCAL handle, WORD size, WORD flags )
dprintf_local( stddeb, "size increase, making new free block\n");
/* It is worth making a new free block */
LOCAL_AddBlock( ptr, arena, nextarena );
LOCAL_AddFreeBlock( ptr, nextarena );
LOCAL_MakeBlockFree( ptr, nextarena );
pInfo->items++;
}
dprintf_local( stddeb, "LocalReAlloc: returning %04x\n", handle );
......
......@@ -18,6 +18,7 @@ SRCS = \
lstr.c \
main.c \
ole2.c \
ole2disp.c \
ole2nls.c \
olecli.c \
olesvr.c \
......
......@@ -45,7 +45,10 @@
#define GET_ATOM_TABLE(sel) ((ATOMTABLE*)PTR_SEG_OFF_TO_LIN(sel, \
((INSTANCEDATA*)PTR_SEG_OFF_TO_LIN(sel,0))->atomtable))
#ifdef WINELIB
#define USER_HeapSel 0
#endif
/***********************************************************************
* ATOM_InitTable
......
......@@ -14,6 +14,8 @@
#include "stddebug.h"
#include "debug.h"
DWORD currentMalloc=0;
/***********************************************************************
* CoBuildVersion [COMPOBJ.1]
*/
......@@ -25,10 +27,13 @@ DWORD WINAPI CoBuildVersion()
/***********************************************************************
* CoInitialize [COMPOBJ.2]
* lpReserved is an IMalloc pointer in 16bit OLE. We just stored it as-is.
*/
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
HRESULT WINAPI CoInitialize(DWORD lpReserved)
{
dprintf_ole(stdnimp,"CoInitialize\n");
/* remember the LPMALLOC, maybe somebody wants to read it later on */
currentMalloc = lpReserved;
return S_OK;
}
......@@ -41,6 +46,21 @@ void CoUnitialize()
}
/***********************************************************************
* CoGetMalloc [COMPOBJ.4]
*/
HRESULT WINAPI CoGetMalloc(DWORD dwMemContext, DWORD * lpMalloc)
{
if(currentMalloc)
{
*lpMalloc = currentMalloc;
return S_OK;
}
*lpMalloc = 0;
/* 16-bit E_NOTIMPL */
return 0x80000001L;
}
/***********************************************************************
* CoDisconnectObject
*/
OLESTATUS WINAPI CoDisconnectObject(
......
......@@ -35,13 +35,13 @@
#include "debug.h"
#define WINE_INI_USER "~/.winerc"
#define MAX_OPEN_DIRS 16
#define MAX_DOS_DRIVES 26
extern char WindowsDirectory[256], SystemDirectory[256],TempDirectory[256];
char WindowsPath[256];
static int max_open_dirs = 0;
static int CurrentDrive = 2;
struct DosDriveStruct { /* eg: */
......@@ -53,7 +53,7 @@ struct DosDriveStruct { /* eg: */
};
static struct DosDriveStruct DosDrives[MAX_DOS_DRIVES];
static struct dosdirent DosDirs[MAX_OPEN_DIRS];
static struct dosdirent *DosDirs=NULL;
static void ExpandTildeString(char *s)
{
......@@ -221,7 +221,7 @@ void DOS_InitFS(void)
}
}
for (x=0; x!=MAX_OPEN_DIRS ; x++)
for (x=0; x!=max_open_dirs ; x++)
DosDirs[x].inuse = 0;
dprintf_dosfs(stddeb,"wine.ini = %s\n",WINE_INI);
......@@ -869,6 +869,7 @@ struct dosdirent *DOS_opendir(char *dosdirname)
int x,y;
char *unixdirname;
char temp[256];
DIR *ds;
if ((unixdirname = DOS_GetUnixFileName(dosdirname)) == NULL)
return NULL;
......@@ -885,10 +886,15 @@ struct dosdirent *DOS_opendir(char *dosdirname)
}
}
for (x=0; x <= MAX_OPEN_DIRS; x++) {
if (x == MAX_OPEN_DIRS) {
fprintf( stderr, "DOS_opendir(): Too many open directories\n");
return NULL;
for (x=0; x <= max_open_dirs; x++) {
if (x == max_open_dirs) {
if (DosDirs) {
DosDirs=(struct dosdirent*)realloc(DosDirs,(++max_open_dirs)*sizeof(DosDirs[0]));
} else {
DosDirs=(struct dosdirent*)malloc(sizeof(DosDirs[0]));
max_open_dirs=1;
}
break; /* this one is definitely not in use */
}
if (!DosDirs[x].inuse) break;
if (strcmp(DosDirs[x].unixpath,temp) == 0) break;
......@@ -903,7 +909,13 @@ struct dosdirent *DOS_opendir(char *dosdirname)
strcpy(DosDirs[x].unixpath, temp);
DosDirs[x].entnum = 0;
if ((DosDirs[x].ds = opendir(temp)) == NULL)
if ((ds = opendir(temp)) == NULL)
return NULL;
if (-1==(DosDirs[x].telldirnum=telldir(ds))) {
closedir(ds);
return NULL;
}
if (-1==closedir(ds))
return NULL;
return &DosDirs[x];
......@@ -915,13 +927,19 @@ struct dosdirent *DOS_readdir(struct dosdirent *de)
char temp[256];
struct dirent *d;
struct stat st;
DIR *ds;
if (!de->inuse)
return NULL;
if (-1==(ds=opendir(de->unixpath)))
return NULL;
seekdir(ds,de->telldirnum); /* returns no error value. strange */
do {
if ((d = readdir(de->ds)) == NULL)
if ((d = readdir(ds)) == NULL) {
de->telldirnum=telldir(ds);
closedir(ds);
return NULL;
}
de->entnum++; /* Increment the directory entry number */
strcpy(de->filename, d->d_name);
......@@ -944,16 +962,15 @@ struct dosdirent *DOS_readdir(struct dosdirent *de)
de->filesize = st.st_size;
de->filetime = st.st_mtime;
de->telldirnum = telldir(ds);
closedir(ds);
return de;
}
void DOS_closedir(struct dosdirent *de)
{
if (de && de->inuse)
{
closedir(de->ds);
de->inuse = 0;
}
}
char *DOS_GetRedirectedDir(int drive)
......
......@@ -75,7 +75,7 @@ INT _lread (INT hFile, LPSTR lpBuffer, WORD wBytes)
dprintf_file(stddeb, "_lread: handle %d, buffer = %ld, length = %d\n",
hFile, (long) lpBuffer, wBytes);
result = read (hFile, lpBuffer, wBytes);
result = wBytes == 0 ? 0 : read (hFile, lpBuffer, wBytes);
if (result == -1)
return HFILE_ERROR;
......@@ -93,7 +93,7 @@ INT _lwrite (INT hFile, LPCSTR lpBuffer, WORD wBytes)
dprintf_file(stddeb, "_lwrite: handle %d, buffer = %ld, length = %d\n",
hFile, (long) lpBuffer, wBytes);
result = write (hFile, lpBuffer, wBytes);
result = wBytes == 0 ? 0 : write (hFile, lpBuffer, wBytes);
if (result == -1)
return HFILE_ERROR;
......@@ -438,12 +438,12 @@ WORD SetErrorMode(WORD x)
***************************************************************************/
LONG _hread(INT hf, LPSTR hpvBuffer, LONG cbBuffer)
{
return read(hf, hpvBuffer, cbBuffer);
return cbBuffer == 0 ? 0 : read(hf, hpvBuffer, cbBuffer);
}
/***************************************************************************
_hwrite
***************************************************************************/
LONG _hwrite(INT hf, LPCSTR hpvBuffer, LONG cbBuffer)
{
return write(hf, hpvBuffer, cbBuffer);
return cbBuffer == 0 ? 0 : write(hf, hpvBuffer, cbBuffer);
}
......@@ -224,6 +224,7 @@ BOOL ParseDebugOptions(char *options)
#endif
#ifndef WINELIB
/***********************************************************************
* MAIN_ParseDLLOptions
*
......@@ -258,6 +259,7 @@ static BOOL MAIN_ParseDLLOptions(char *options)
else
return TRUE;
}
#endif
......@@ -347,6 +349,7 @@ static void MAIN_ParseOptions( int *argc, char *argv[] )
}
if(MAIN_GetResource( db, ".dll", &value))
#ifndef WINELIB
if(MAIN_ParseDLLOptions((char*)value.addr)==FALSE)
{
int i;
......@@ -359,6 +362,9 @@ static void MAIN_ParseOptions( int *argc, char *argv[] )
fprintf(stderr,"\n\n");
exit(1);
}
#else
fprintf(stderr,"-dll not supported in libwine\n");
#endif
}
......@@ -559,7 +565,7 @@ LONG GetVersion(void)
LONG GetWinFlags(void)
{
if (Options.enhanced)
return (WF_STANDARD | WF_ENHANCED | WF_CPU286 | WF_PMODE | WF_80x87);
return (WF_STANDARD | WF_ENHANCED | WF_CPU386 | WF_PMODE | WF_80x87);
else
return (WF_STANDARD | WF_CPU286 | WF_PMODE | WF_80x87);
}
......
/*
* OLE2DISP library
*
* Copyright 1995 Martin von Loewis
*/
#include "windows.h"
#include "ole2.h"
#include "global.h"
#include "local.h"
#include "ldt.h"
#include "stddebug.h"
#include "debug.h"
/* This implementation of the BSTR API is 16-bit only. It
represents BSTR as a 16:16 far pointer, and the strings
as ISO-8859 */
typedef DWORD BSTR;
HGLOBAL BSTRheapsel=0;
#define BSTR_HEAP_SIZE 65536
static BSTR BSTR_AllocBytes(int n)
{
HLOCAL mem;
if(!BSTRheapsel)
{
BSTRheapsel=GlobalAlloc(GMEM_FIXED,BSTR_HEAP_SIZE);
LocalInit(BSTRheapsel,0,BSTR_HEAP_SIZE-1);
}
if(!BSTRheapsel)
return 0;
mem=LOCAL_Alloc(BSTRheapsel,LMEM_FIXED,n);
return mem ? MAKELONG(mem,BSTRheapsel) : 0;
}
static void BSTR_Free(BSTR in)
{
LOCAL_Free(BSTRheapsel, LOWORD(in));
}
static void* BSTR_GetAddr(BSTR in)
{
return in ? PTR_SEG_TO_LIN(in) : 0;
}
/***********************************************************************
* SysAllocString [OLE2DISP.2]
*/
BSTR SysAllocString(char *in)
{
BSTR out=BSTR_AllocBytes(strlen(in)+1);
if(!out)return 0;
strcpy(BSTR_GetAddr(out),in);
return out;
}
/***********************************************************************
* SysReAllocString [OLE2DISP.3]
*/
int SysReAllocString(BSTR *old,char *in)
{
BSTR new=SysAllocString(in);
BSTR_Free(*old);
*old=new;
return 1;
}
/***********************************************************************
* SysAllocStringLen [OLE2DISP.4]
*/
BSTR SysAllocStringLen(char *in, int len)
{
BSTR out=BSTR_AllocBytes(len+1);
if(!out)return 0;
strcpy(BSTR_GetAddr(out),in);
return out;
}
/***********************************************************************
* SysReAllocStringLen [OLE2DISP.5]
*/
int SysReAllocStringLen(BSTR *old,char *in,int len)
{
BSTR new=SysAllocStringLen(in,len);
BSTR_Free(*old);
*old=new;
return 1;
}
/***********************************************************************
* SysFreeString [OLE2DISP.6]
*/
void SysFreeString(BSTR in)
{
BSTR_Free(in);
}
/***********************************************************************
* SysStringLen [OLE2DISP.7]
*/
int SysStringLen(BSTR str)
{
return strlen(BSTR_GetAddr(str));
}
......@@ -237,7 +237,7 @@ LOCVAL(LOCALE_INEGCURR,"8")
LOCVAL(LOCALE_SDATE,".")
LOCVAL(LOCALE_STIME,":")
LOCVAL(LOCALE_SSHORTDATE,"dd.MM.yyyy")
LOCVAL(LOCALE_SLONGDATEi,"ddd, d. MMMM yyyy")
LOCVAL(LOCALE_SLONGDATE,"ddd, d. MMMM yyyy")
/*
LOCVAL(LOCALE_STIMEFORMAT)
*/
......@@ -329,3 +329,35 @@ LOCVAL(LOCALE_INEGSEPBYSPACE)
strncpy(buf,retString,len);
return retLen;
}
/***********************************************************************
* CompareStringA (OLE2NLS.8)
* This implementation ignores the locale, and trusts in libc
*/
int CompareStringA(DWORD lcid, DWORD fdwStyle,
char *s1, int l1, char *s2,int l2)
{
int len,ret;
if(fdwStyle & NORM_IGNORENONSPACE)
{
fprintf(stdnimp, "CompareStringA: IGNORENONSPACE not supprted\n");
}
if(fdwStyle & NORM_IGNORESYMBOLS)
fprintf(stdnimp, "CompareStringA: IGNORESYMBOLS not supported\n");
/* Is strcmp defaulting to string sort or to word sort?? */
/* FIXME: Handle NORM_STRINGSORT */
l1 = (l1==-1)?strlen(s1):l1;
l2 = (l2==-1)?strlen(s2):l2;
len = l1<l2 ? l1:l2;
ret = (fdwStyle & NORM_IGNORECASE) ?
strncasecmp(s1,s2,len) :
strncmp(s1,s2,len);
/* not equal, return 1 or 3 */
if(ret!=0)return ret+2;
/* same len, return 2 */
if(l1==l2)return 2;
/* the longer one is lexically greater */
return (l1<l2)? 1 : 3;
}
......@@ -184,6 +184,9 @@ static TSecHeader *load (char *filename, char **pfullname)
state = IgnoreToEOL;
break;
}
if (c == '\n')
break;
if (c == '=' || overflow){
TKeys *temp;
......@@ -197,8 +200,9 @@ static TSecHeader *load (char *filename, char **pfullname)
state = KeyValue;
next = CharBuffer;
dprintf_profile(stddeb,"%s: key %s\n", file, CharBuffer);
} else
} else {
*next++ = c;
}
break;
case KeyValue:
......@@ -293,6 +297,7 @@ static short GetSetProfile (int set, LPSTR AppName, LPSTR KeyName,
}
ReturnedString [Size-1] = 0;
strncpy (ReturnedString, key->Value, Size-1);
dprintf_profile(stddeb,"GetSetProfile // Return ``%s''\n", ReturnedString);
return 1;
}
/* If Getting the information, then don't write the information
......@@ -303,6 +308,7 @@ static short GetSetProfile (int set, LPSTR AppName, LPSTR KeyName,
else {
ReturnedString [Size-1] = 0;
strncpy (ReturnedString, Default, Size-1);
dprintf_profile(stddeb,"GetSetProfile // Key not found\n");
}
return 1;
}
......@@ -318,6 +324,7 @@ static short GetSetProfile (int set, LPSTR AppName, LPSTR KeyName,
} else {
ReturnedString [Size-1] = 0;
strncpy (ReturnedString, Default, Size-1);
dprintf_profile(stddeb,"GetSetProfile // Section not found\n");
}
return 1;
}
......
......@@ -13,7 +13,6 @@
#include "dlgs.h"
#include "dialog.h"
#include "stddebug.h"
/* #define DEBUG_REG */
#include "debug.h"
LPKEYSTRUCT lphRootKey = NULL,lphTopKey = NULL;
......@@ -185,7 +184,7 @@ LONG RegCreateKey(HKEY hKey, LPCSTR lpSubKey, HKEY FAR *lphKey)
LONG RegCloseKey(HKEY hKey)
{
dprintf_reg(stdnimp, "EMPTY STUB !!! RegCloseKey(%08lX);\n", hKey);
return ERROR_INVALID_PARAMETER;
return ERROR_SUCCESS;
}
......@@ -196,7 +195,7 @@ LONG RegDeleteKey(HKEY hKey, LPCSTR lpSubKey)
{
dprintf_reg(stdnimp, "EMPTY STUB !!! RegDeleteKey(%08lX, '%s');\n",
hKey, lpSubKey);
return ERROR_INVALID_PARAMETER;
return ERROR_SUCCESS;
}
......@@ -204,29 +203,29 @@ LONG RegDeleteKey(HKEY hKey, LPCSTR lpSubKey)
* RegSetValue [SHELL.5]
*/
LONG RegSetValue(HKEY hKey, LPCSTR lpSubKey, DWORD dwType,
LPCSTR lpVal, DWORD dwIgnored)
LPCSTR lpVal, DWORD dwIgnored)
{
HKEY hRetKey;
LPKEYSTRUCT lpKey;
LONG dwRet;
dprintf_reg(stddeb, "RegSetValue(%08lX, '%s', %08lX, '%s', %08lX);\n",
hKey, lpSubKey, dwType, lpVal, dwIgnored);
if (lpSubKey == NULL) return ERROR_INVALID_PARAMETER;
if (lpVal == NULL) return ERROR_INVALID_PARAMETER;
if ((dwRet = RegOpenKey(hKey, lpSubKey, &hRetKey)) != ERROR_SUCCESS) {
dprintf_reg(stddeb, "RegSetValue // key not found ... so create it !\n");
if ((dwRet = RegCreateKey(hKey, lpSubKey, &hRetKey)) != ERROR_SUCCESS) {
fprintf(stderr, "RegSetValue // key creation error %08lX !\n", dwRet);
return dwRet;
}
}
lpKey = (LPKEYSTRUCT)GlobalLock(hRetKey);
if (lpKey == NULL) return ERROR_BADKEY;
if (lpKey->lpValue != NULL) free(lpKey->lpValue);
lpKey->lpValue = malloc(strlen(lpVal) + 1);
strcpy(lpKey->lpValue, lpVal);
dprintf_reg(stddeb,"RegSetValue // successful key='%s' val='%s' !\n", lpSubKey, lpKey->lpValue);
return ERROR_SUCCESS;
HKEY hRetKey;
LPKEYSTRUCT lpKey;
LONG dwRet;
dprintf_reg(stddeb, "RegSetValue(%08lX, '%s', %08lX, '%s', %08lX);\n",
hKey, lpSubKey, dwType, lpVal, dwIgnored);
if (lpSubKey == NULL) return ERROR_INVALID_PARAMETER;
if (lpVal == NULL) return ERROR_INVALID_PARAMETER;
if ((dwRet = RegOpenKey(hKey, lpSubKey, &hRetKey)) != ERROR_SUCCESS) {
dprintf_reg(stddeb, "RegSetValue // key not found ... so create it !\n");
if ((dwRet = RegCreateKey(hKey, lpSubKey, &hRetKey)) != ERROR_SUCCESS) {
fprintf(stderr, "RegSetValue // key creation error %08lX !\n", dwRet);
return dwRet;
}
}
lpKey = (LPKEYSTRUCT)GlobalLock(hRetKey);
if (lpKey == NULL) return ERROR_BADKEY;
if (lpKey->lpValue != NULL) free(lpKey->lpValue);
lpKey->lpValue = malloc(strlen(lpVal) + 1);
strcpy(lpKey->lpValue, lpVal);
dprintf_reg(stddeb,"RegSetValue // successful key='%s' val='%s' !\n", lpSubKey, lpKey->lpValue);
return ERROR_SUCCESS;
}
......@@ -249,7 +248,7 @@ LONG RegQueryValue(HKEY hKey, LPCSTR lpSubKey, LPSTR lpVal, LONG FAR *lpcb)
if ((dwRet = RegOpenKey(hKey, lpSubKey, &hRetKey)) != ERROR_SUCCESS) {
fprintf(stderr, "RegQueryValue // key not found !\n");
return dwRet;
}
}
lpKey = (LPKEYSTRUCT)GlobalLock(hRetKey);
if (lpKey == NULL) return ERROR_BADKEY;
if (lpKey->lpValue != NULL) {
......
......@@ -24,6 +24,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#define USER_HEAP_SIZE 0x10000
#ifndef WINELIB
LPSTR USER_Heap = NULL;
WORD USER_HeapSel = 0;
......@@ -73,7 +74,6 @@ BOOL SystemHeapInfo( SYSHEAPINFO *pHeapInfo )
}
#ifndef WINELIB
/***********************************************************************
* USER_HeapInit
*/
......
......@@ -98,6 +98,10 @@ BOOL INSTR_EmulateInstruction( struct sigcontext_struct *context )
case 0x67:
long_addr = !long_addr; /* addr size prefix */
break;
case 0xf0: /* lock */
case 0xf2: /* repne */
case 0xf3: /* repe */
break;
default:
prefix = 0; /* no more prefixes */
break;
......@@ -115,6 +119,7 @@ BOOL INSTR_EmulateInstruction( struct sigcontext_struct *context )
{
case 0xcd: /* int <XX> */
instr++;
/* FIXME: should check if handler has been changed */
if (!do_int(*instr, context))
{
fprintf(stderr,"Unexpected Windows interrupt %x\n", *instr);
......
......@@ -437,7 +437,8 @@ static void ioctlGenericBlkDevReq(struct sigcontext_struct *context)
drive = BL - 1;
if (!DOS_ValidDrive(drive)) {
AX = 0x02;
Error( FileNotFound, EC_NotFound, EL_Disk );
AX = FileNotFound;
SetCflag;
return;
}
......@@ -502,7 +503,7 @@ static void GetExtendedErrorInfo(struct sigcontext_struct *context)
{
AX = ExtendedError;
BX = (ErrorClass << 8) | Action;
CH = ErrorLocus << 8;
CH = ErrorLocus;
}
static void CreateFile(struct sigcontext_struct *context)
......@@ -656,15 +657,17 @@ static void MakeDir(struct sigcontext_struct *context)
dprintf_int(stddeb,"int21: makedir %s\n", (char *)PTR_SEG_OFF_TO_LIN(DS,DX) );
if ((dirname = DOS_GetUnixFileName( PTR_SEG_OFF_TO_LIN(DS,DX) ))== NULL) {
AX = CanNotMakeDir;
SetCflag;
return;
Error( CanNotMakeDir, EC_AccessDenied, EL_Disk );
AX = CanNotMakeDir;
SetCflag;
return;
}
if (mkdir(dirname,0) == -1) {
AX = CanNotMakeDir;
SetCflag;
return;
Error( CanNotMakeDir, EC_AccessDenied, EL_Disk );
AX = CanNotMakeDir;
SetCflag;
return;
}
ResetCflag;
}
......@@ -693,9 +696,10 @@ static void RemoveDir(struct sigcontext_struct *context)
dprintf_int(stddeb,"int21: removedir %s\n", (char *)PTR_SEG_OFF_TO_LIN(DS,DX) );
if ((dirname = DOS_GetUnixFileName( PTR_SEG_OFF_TO_LIN(DS,DX) ))== NULL) {
AX = PathNotFound;
SetCflag;
return;
Error( PathNotFound, EC_NotFound, EL_Disk );
AX = PathNotFound;
SetCflag;
return;
}
/*
......@@ -705,9 +709,10 @@ static void RemoveDir(struct sigcontext_struct *context)
}
*/
if (rmdir(dirname) == -1) {
AX = AccessDenied;
SetCflag;
return;
Error( AccessDenied, EC_AccessDenied, EL_Disk );
AX = AccessDenied;
SetCflag;
return;
}
ResetCflag;
}
......@@ -839,9 +844,10 @@ static void CreateTempFile(struct sigcontext_struct *context)
handle = open(DOS_GetUnixFileName(temp), O_CREAT | O_TRUNC | O_RDWR);
if (handle == -1) {
AX = WriteProtected;
SetCflag;
return;
Error( WriteProtected, EC_AccessDenied, EL_Disk );
AX = WriteProtected;
SetCflag;
return;
}
strcpy(PTR_SEG_OFF_TO_LIN(DS,DX), temp);
......@@ -855,9 +861,10 @@ static void CreateNewFile(struct sigcontext_struct *context)
int handle;
if ((handle = open(DOS_GetUnixFileName( PTR_SEG_OFF_TO_LIN(DS,DX) ), O_CREAT | O_EXCL | O_RDWR)) == -1) {
AX = WriteProtected;
SetCflag;
return;
Error( WriteProtected, EC_AccessDenied, EL_Disk );
AX = WriteProtected;
SetCflag;
return;
}
AX = handle;
......@@ -874,9 +881,10 @@ static void GetCurrentDirectory(struct sigcontext_struct *context)
drive = DL - 1;
if (!DOS_ValidDrive(drive)) {
AX = InvalidDrive;
SetCflag;
return;
Error( InvalidDrive, EC_NotFound, EL_Disk );
AX = InvalidDrive;
SetCflag;
return;
}
strcpy(PTR_SEG_OFF_TO_LIN(DS,SI), DOS_GetCurrentDir(drive) );
......@@ -895,9 +903,10 @@ static void GetDiskSerialNumber(struct sigcontext_struct *context)
drive = BL - 1;
if (!DOS_ValidDrive(drive)) {
AX =InvalidDrive;
SetCflag;
return;
Error( InvalidDrive, EC_NotFound, EL_Disk );
AX = InvalidDrive;
SetCflag;
return;
}
DOS_GetSerialNumber(drive, &serialnumber);
......@@ -923,9 +932,10 @@ static void SetDiskSerialNumber(struct sigcontext_struct *context)
drive = BL - 1;
if (!DOS_ValidDrive(drive)) {
AX = InvalidDrive;
SetCflag;
return;
Error( InvalidDrive, EC_NotFound, EL_Disk );
AX = InvalidDrive;
SetCflag;
return;
}
serialnumber = dataptr[1] + (dataptr[2] << 8) + (dataptr[3] << 16) +
......@@ -1477,8 +1487,9 @@ int do_int21(struct sigcontext_struct * context)
drive = BL ? (BL - 1) : DOS_GetDefaultDrive();
if(!DOS_ValidDrive(drive))
{
Error( InvalidDrive, EC_NotFound, EL_Disk );
AX = InvalidDrive;
SetCflag;
AX = 0x000F; /* Bad drive number */
}
else
{
......@@ -1494,8 +1505,9 @@ int do_int21(struct sigcontext_struct * context)
drive = BL ? (BL - 1) : DOS_GetDefaultDrive();
if(!DOS_ValidDrive(drive))
{
Error( InvalidDrive, EC_NotFound, EL_Disk );
AX = InvalidDrive;
SetCflag;
AX = 0x000F; /* Bad drive number */
}
else
{
......
......@@ -4,12 +4,12 @@
* Copyright 1995 Alexandre Julliard
*/
#include "miscemu.h"
#include "registers.h"
#include "wine.h"
#include "miscemu.h"
#include "stddebug.h"
/* #define DEBUG_INT */
#include "debug.h"
#include "registers.h"
/***********************************************************************
......
......@@ -1034,6 +1034,16 @@ BOOL BITBLT_InternalStretchBlt( DC *dcDst, short xDst, short yDst,
yDst = dcDst->w.DCOrgY + YLPTODP( dcDst, yDst );
widthDst = widthDst * dcDst->w.VportExtX / dcDst->w.WndExtX;
heightDst = heightDst * dcDst->w.VportExtY / dcDst->w.WndExtY;
dprintf_bitblt( stddeb, " vportdst=%d,%d-%d,%d wnddst=%d,%d-%d,%d\n",
dcDst->w.VportOrgX, dcDst->w.VportOrgY,
dcDst->w.VportExtX, dcDst->w.VportExtY,
dcDst->w.WndOrgX, dcDst->w.WndOrgY,
dcDst->w.WndExtX, dcDst->w.WndExtY );
dprintf_bitblt( stddeb, " rectdst=%d,%d-%d,%d orgdst=%d,%d\n",
xDst, yDst, widthDst, heightDst,
dcDst->w.DCOrgX, dcDst->w.DCOrgY );
if (useSrc)
{
xSrc = dcSrc->w.DCOrgX + XLPTODP( dcSrc, xSrc );
......@@ -1041,10 +1051,23 @@ BOOL BITBLT_InternalStretchBlt( DC *dcDst, short xDst, short yDst,
widthSrc = widthSrc * dcSrc->w.VportExtX / dcSrc->w.WndExtX;
heightSrc = heightSrc * dcSrc->w.VportExtY / dcSrc->w.WndExtY;
fStretch = (widthSrc != widthDst) || (heightSrc != heightDst);
dprintf_bitblt( stddeb," vportsrc=%d,%d-%d,%d wndsrc=%d,%d-%d,%d\n",
dcSrc->w.VportOrgX, dcSrc->w.VportOrgY,
dcSrc->w.VportExtX, dcSrc->w.VportExtY,
dcSrc->w.WndOrgX, dcSrc->w.WndOrgY,
dcSrc->w.WndExtX, dcSrc->w.WndExtY );
dprintf_bitblt( stddeb, " rectsrc=%d,%d-%d,%d orgsrc=%d,%d\n",
xSrc, ySrc, widthSrc, heightSrc,
dcSrc->w.DCOrgX, dcSrc->w.DCOrgY );
if (!BITBLT_GetVisRectangles( dcDst, xDst, yDst, widthDst, heightDst,
dcSrc, xSrc, ySrc, widthSrc, heightSrc,
&visRectSrc, &visRectDst ))
return TRUE;
dprintf_bitblt( stddeb, " vissrc=%d,%d-%d,%d visdst=%d,%d-%d,%d\n",
visRectSrc.left, visRectSrc.top,
visRectSrc.right, visRectSrc.bottom,
visRectDst.left, visRectDst.top,
visRectDst.right, visRectDst.bottom );
}
else
{
......@@ -1052,6 +1075,9 @@ BOOL BITBLT_InternalStretchBlt( DC *dcDst, short xDst, short yDst,
if (!BITBLT_GetVisRectangles( dcDst, xDst, yDst, widthDst, heightDst,
NULL, 0, 0, 0, 0, NULL, &visRectDst ))
return TRUE;
dprintf_bitblt( stddeb, " vissrc=none visdst=%d,%d-%d,%d\n",
visRectDst.left, visRectDst.top,
visRectDst.right, visRectDst.bottom );
}
width = visRectDst.right - visRectDst.left;
......@@ -1240,12 +1266,7 @@ BOOL BitBlt( HDC hdcDst, short xDst, short yDst, short width, short height,
"BitBlt: %04x %d,%d %d bpp -> %04x %d,%d %dx%dx%d rop=%06lx\n",
hdcSrc, xSrc, ySrc, dcSrc ? dcSrc->w.bitsPerPixel : 0,
hdcDst, xDst, yDst, width, height, dcDst->w.bitsPerPixel, rop);
if (dcSrc != NULL) {
dprintf_bitblt(stddeb," src org=%d,%d",
dcSrc->w.DCOrgX, dcSrc->w.DCOrgY);
}
dprintf_bitblt(stddeb," dst org=%d,%d\n", dcDst->w.DCOrgX,
dcDst->w.DCOrgY);
return CallTo32_LargeStack( (int(*)())BITBLT_InternalStretchBlt, 11,
dcDst, xDst, yDst, width, height,
dcSrc, xSrc, ySrc, width, height, rop );
......
......@@ -541,9 +541,19 @@ int StretchDIBits( HDC hdc,
WORD xSrc, WORD ySrc, WORD wSrcWidth, WORD wSrcHeight,
LPSTR bits, LPBITMAPINFO info, WORD wUsage, DWORD dwRop )
{
printf("StretchDIBits // call SetDIBitsToDevice for now !!!!\n");
return SetDIBitsToDevice(hdc, xDest, yDest, wDestWidth, wDestHeight,
xSrc, ySrc, 1, 1, bits, info, wUsage);
HBITMAP hBitmap, hOldBitmap;
HDC hdcMem;
hBitmap = CreateDIBitmap( hdc, &info->bmiHeader, CBM_INIT,
bits, info, wUsage );
hdcMem = CreateCompatibleDC( hdc );
hOldBitmap = SelectObject( hdcMem, hBitmap );
StretchBlt( hdc, xDest, yDest, wDestWidth, wDestHeight,
hdcMem, xSrc, ySrc, wSrcWidth, wSrcHeight, dwRop );
SelectObject( hdcMem, hOldBitmap );
DeleteDC( hdcMem );
DeleteObject( hBitmap );
return wSrcHeight;
}
/***********************************************************************
......
......@@ -259,6 +259,34 @@ void FONT_GetMetrics( LOGFONT * logfont, XFontStruct * xfont,
metrics->tmAveCharWidth = average;
}
/***********************************************************************
* GetGlyphOutLine (GDI.309)
*/
DWORD GetGlyphOutLine(
HDC hdc, UINT uChar, UINT fuFormat, LPGLYPHMETRICS lpgm,
DWORD cbBuffer, LPSTR lpBuffer, LPMAT2 lpmat2
) {
dprintf_font(stdnimp,"GetGlyphOutLine(0x%x, '%c', 0x%x, %p, %d, %p, %p) // - empty stub!\n",
hdc,uChar,fuFormat,lpgm,cbBuffer,lpBuffer,lpmat2
);
return (DWORD)-1; /* failure */
}
/***********************************************************************
* CreateScalableFontResource (GDI.310)
*/
BOOL CreateScalableFontResource(
UINT fHidden,LPSTR lpszResourceFile,
LPSTR lpszFontFile,LPSTR lpszCurrentPath
) {
/* fHidden=1 - only visible for the calling app, read-only, not
* enumbered with EnumFonts/EnumFontFamilies
* lpszCurrentPath can be NULL
*/
dprintf_font(stdnimp,"CreateScalableFontResource(%d,%s,%s,%x(%s)) // empty stub!\n",
fHidden,lpszResourceFile,lpszFontFile,lpszCurrentPath
);
return FALSE; /* create failed */
}
/***********************************************************************
* CreateFontIndirect (GDI.57)
......
......@@ -11,6 +11,7 @@
#include <X11/xpm.h>
#include "gdi.h"
#include "bitmap.h"
#include "callback.h"
#include "color.h"
#include "icon.h"
#include "stddebug.h"
......@@ -280,9 +281,10 @@ HBITMAP OBM_LoadBitmap( WORD id )
if (!OBM_InitColorSymbols()) return 0;
if (!OBM_CreateBitmaps( OBM_Pixmaps_Data[id].data,
OBM_Pixmaps_Data[id].color,
FALSE, &hbitmap, &hbitmask ))
if (!CallTo32_LargeStack( (int(*)())OBM_CreateBitmaps, 5,
OBM_Pixmaps_Data[id].data,
OBM_Pixmaps_Data[id].color,
FALSE, &hbitmap, &hbitmask ))
{
fprintf( stderr, "Error creating OEM bitmap %d\n", OBM_FIRST+id );
return 0;
......@@ -308,8 +310,9 @@ HICON OBM_LoadIcon( WORD id )
if (!(hicon = GlobalAlloc( GMEM_MOVEABLE, sizeof(ICONALLOC) ))) return 0;
pIcon = (ICONALLOC *)GlobalLock( hicon );
if (!OBM_CreateBitmaps( OBM_Icons_Data[id], TRUE, TRUE,
&pIcon->hBitmap, &pIcon->hBitMask ))
if (!CallTo32_LargeStack( (int(*)())OBM_CreateBitmaps, 5,
OBM_Icons_Data[id], TRUE, TRUE,
&pIcon->hBitmap, &pIcon->hBitMask ))
{
fprintf( stderr, "Error creating OEM icon %d\n", OIC_FIRST+id );
GlobalFree( hicon );
......
......@@ -49,6 +49,8 @@ LOCAL_LIBRARIES = -ll
NormalProgramTarget(winerc,$(OBJS),$(DEPLIBS),$(LOCAL_LIBRARIES),)
depend:: y.tab.c y.tab.h lex.yy.c
DependTarget()
clean::
......
......@@ -16,7 +16,13 @@
#include "parser.h"
#include "y.tab.h"
char usage[]="winerc -dvc -p prefix -o outfile < infile \n";
char usage[]="winerc -bdvc -p prefix -o outfile < infile \n"
" -b Create a C array from a binary .res file\n"
" -d Output debugging information\n"
" -p prefix Give a prefix for the generated names\n"
" -v Show each resource as it is processed\n"
" -o file Output to file.c and file.h\n";
/*might be overwritten by command line*/
char *prefix="_Resource";
......@@ -29,16 +35,18 @@ int main(int argc,char *argv[])
{
extern int yydebug;
extern char* optarg;
int optc,lose,ret;
lose=0;
int optc,lose,ret,binary;
lose=binary=0;
#if defined(__NetBSD__) || defined(__FreeBSD__)
while((optc=getopt(argc,argv,"dp:vo:"))!=EOF)
while((optc=getopt(argc,argv,"bdp:vo:"))!=EOF)
#else
while((optc=getopt(argc,argv,"dp:vo:",0))!=EOF)
while((optc=getopt(argc,argv,"bdp:vo:",0))!=EOF)
#endif
switch(optc)
{
/* bison will print state transitions on stderr */
case 'b':binary=1;
break;
case 'd':yydebug=1;
setbuf(stdout,0);
setbuf(stderr,0);
......@@ -54,7 +62,10 @@ int main(int argc,char *argv[])
if(lose)return fprintf(stderr,usage),1;
if(!header)header=stdout;
if(!code)code=stdout;
ret=yyparse();
if(binary)
ret=transform_binary_file();
else
ret=yyparse();
fclose(header);
fclose(code);
return ret;
......@@ -68,6 +79,20 @@ void set_out_file(char *prefix)
header=fopen(hname,"w");
}
int transform_binary_file()
{
int i,c;
fprintf(header,"#define APPLICATION_HAS_RESOURCES 1\n");
fprintf(code,"char _Application_resources[]={");
for(i=0;;i++)
{
c=getchar();
if(c==-1)break;
if(i%16==0)fputc('\n',code);
fprintf(code,"%3d,",c);
}
fprintf(code,"\n0}\nint _Aplication_resources_size=%d;\n",i);
}
/* SunOS' memcpy is wrong for overlapping arrays */
char *save_memcpy(char *d,char* s,int l)
......
......@@ -115,7 +115,7 @@ BOOL LocalInit (WORD segment, WORD start, WORD end)
return 1;
}
char *LocalLock (HANDLE hMem)
WORD LocalLock (HANDLE hMem)
{
void **m = HEAP_FindSlot (hMem);
#ifdef DEBUG_HEAP
......
......@@ -4,6 +4,7 @@
#include "callback.h"
#include "wine.h"
#include "arch.h"
#include "neexe.h"
LONG CallWindowProc (WNDPROC func, HWND hwnd, WORD message,
WORD wParam, LONG lParam)
......@@ -24,9 +25,8 @@ LONG CallWindowProc (WNDPROC func, HWND hwnd, WORD message,
void load_mz_header (int fd, struct mz_header_s *mz_header)
{
#define TAB mz_header
LOAD (dont_care1);
LOAD (must_be_0x40);
LOAD (dont_care2);
LOAD (mz_magic);
LOAD (dont_care);
LOADSHORT (ne_offset);
}
......@@ -34,7 +34,7 @@ void load_ne_header (int fd, struct ne_header_s *ne_header)
{
#undef TAB
#define TAB ne_header
LOAD (header_type);
LOAD (ne_magic);
LOADSHORT (linker_version);
LOADSHORT (linker_revision);
LOADSHORT (entry_tab_offset);
......
......@@ -10,6 +10,8 @@ _WinMain (int argc, char *argv [])
char filename [4096], *module_name, *resource_file;
HANDLE hTaskMain, hInstance;
/* The libwine resource DLL is temporarily disabled */
#if 0
if ((module_name = strchr (argv [0], '/')) == NULL){
printf ("Error: Can't determine base name for resource loading\n");
return 0;
......@@ -20,9 +22,12 @@ _WinMain (int argc, char *argv [])
strcat (resource_file, ".dll");
hInstance = LoadImage (resource_file, 0, 0);
#endif
USER_InitApp( hInstance );
#if 0
hTaskMain = CreateNewTask (1); /* This is not correct */
#endif
ret_val = WinMain (hInstance, /* hInstance */
0, /* hPrevInstance */
"", /* lpszCmdParam */
......
......@@ -1544,7 +1544,9 @@ static void BuildCall16Func( char *profile )
{
/* Set ax equal to ds for window procedures */
printf( "\tmovw 16(%%ebx),%%ax\n" );
/* printf( "\tmovw %%ax,%%ds\n" ); */
/* This seems to be needed, although I still don't see why... */
printf( "\tmovw %%ax,%%ds\n" );
}
/* Jump to the called routine */
......
......@@ -332,9 +332,8 @@ BOOL Rectangle( HDC hdc, int left, int top, int right, int bottom )
* RoundRect (GDI.28)
*/
BOOL RoundRect( HDC hDC, short left, short top, short right, short bottom,
short ell_width, short ell_height)
short ell_width, short ell_height )
{
int x1, y1, x2, y2;
DC * dc = (DC *) GDI_GetObjPtr(hDC, DC_MAGIC);
if (!dc)
{
......@@ -346,59 +345,103 @@ BOOL RoundRect( HDC hDC, short left, short top, short right, short bottom,
}
dprintf_graphics(stddeb, "RoundRect(%d %d %d %d %d %d\n",
left, top, right, bottom, ell_width, ell_height);
x1 = XLPTODP(dc, left);
y1 = YLPTODP(dc, top);
x2 = XLPTODP(dc, right - ell_width);
y2 = YLPTODP(dc, bottom - ell_height);
left = XLPTODP( dc, left );
top = YLPTODP( dc, top );
right = XLPTODP( dc, right );
bottom = YLPTODP( dc, bottom );
ell_width = abs( ell_width * dc->w.VportExtX / dc->w.WndExtX );
ell_height = abs( ell_height * dc->w.VportExtY / dc->w.WndExtY );
/* Fix the coordinates */
if (left > right) { short t = left; left = right; right = t; }
if (top > bottom) { short t = top; top = bottom; bottom = t; }
if (ell_width > right - left) ell_width = right - left;
if (ell_height > bottom - top) ell_height = bottom - top;
if (DC_SetupGCForBrush( dc ))
{
XFillArc(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x1, dc->w.DCOrgY + y1,
ell_width, ell_height, 90 * 64, 90 * 64);
XFillArc(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x1, dc->w.DCOrgY + y2,
ell_width, ell_height, 180 * 64, 90 * 64);
XFillArc(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x2, dc->w.DCOrgY + y2,
ell_width, ell_height, 270 * 64, 90 * 64);
XFillArc(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x2, dc->w.DCOrgY + y1,
ell_width, ell_height, 0, 90 * 64);
ell_width /= 2; ell_height /= 2;
XFillRectangle(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left + ell_width, dc->w.DCOrgY + top,
right - left - 2 * ell_width, bottom - top);
XFillRectangle(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top + ell_height,
ell_width, bottom - top - 2 * ell_height);
XFillRectangle(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + right - ell_width, dc->w.DCOrgY + top + ell_height,
ell_width, bottom - top - 2 * ell_height);
ell_width *= 2; ell_height *= 2;
}
if (DC_SetupGCForPen(dc)) {
XDrawArc(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x1, dc->w.DCOrgY + y1,
ell_width, ell_height, 90 * 64, 90 * 64);
XDrawArc(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x1, dc->w.DCOrgY + y2,
ell_width, ell_height, 180 * 64, 90 * 64);
XDrawArc(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x2, dc->w.DCOrgY + y2,
ell_width, ell_height, 270 * 64, 90 * 64);
XDrawArc(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x2, dc->w.DCOrgY + y1,
ell_width, ell_height, 0, 90 * 64);
if (ell_width && ell_height)
{
XFillArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
ell_width, ell_height, 90 * 64, 90 * 64 );
XFillArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + bottom - ell_height,
ell_width, ell_height, 180 * 64, 90 * 64 );
XFillArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + right - ell_width,
dc->w.DCOrgY + bottom - ell_height,
ell_width, ell_height, 270 * 64, 90 * 64 );
XFillArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + right - ell_width, dc->w.DCOrgY + top,
ell_width, ell_height, 0, 90 * 64 );
}
if (ell_width < right - left)
{
XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left + ell_width / 2,
dc->w.DCOrgY + top,
right - left - ell_width, ell_height / 2 );
XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left + ell_width / 2,
dc->w.DCOrgY + bottom - (ell_height+1) / 2,
right - left - ell_width, (ell_height+1) / 2 );
}
if (ell_height < bottom - top)
{
XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left,
dc->w.DCOrgY + top + ell_height / 2,
right - left, bottom - top - ell_height );
}
}
if (DC_SetupGCForPen(dc))
{
if (ell_width && ell_height)
{
XDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
ell_width, ell_height, 90 * 64, 90 * 64 );
XDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + bottom - ell_height,
ell_width, ell_height, 180 * 64, 90 * 64 );
XDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + right - ell_width,
dc->w.DCOrgY + bottom - ell_height,
ell_width, ell_height, 270 * 64, 90 * 64 );
XDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + right - ell_width, dc->w.DCOrgY + top,
ell_width, ell_height, 0, 90 * 64 );
}
ell_width /= 2; ell_height /= 2;
MoveTo(hDC, left, top + ell_height);
LineTo(hDC, left, bottom - ell_height);
MoveTo(hDC, left + ell_width, bottom);
LineTo(hDC, right - ell_width, bottom);
MoveTo(hDC, right, bottom - ell_height);
LineTo(hDC, right, top + ell_height);
MoveTo(hDC, right - ell_width, top);
LineTo(hDC, left + ell_width, top);
if (ell_width < right - left)
{
XDrawLine( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left + ell_width / 2,
dc->w.DCOrgY + top,
dc->w.DCOrgX + right - ell_width / 2,
dc->w.DCOrgY + top );
XDrawLine( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left + ell_width / 2,
dc->w.DCOrgY + bottom,
dc->w.DCOrgX + right - ell_width / 2,
dc->w.DCOrgY + bottom );
}
if (ell_height < bottom - top)
{
XDrawLine( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + right,
dc->w.DCOrgY + top + ell_height / 2,
dc->w.DCOrgX + right,
dc->w.DCOrgY + bottom - ell_height / 2 );
XDrawLine( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left,
dc->w.DCOrgY + top + ell_height / 2,
dc->w.DCOrgX + left,
dc->w.DCOrgY + bottom - ell_height / 2 );
}
}
return TRUE;
}
......
......@@ -152,6 +152,6 @@ BOOL UnhookWindowsHookEx( HHOOK hhook )
DWORD CallNextHookEx( HHOOK hhook, short code, WPARAM wParam, LPARAM lParam )
{
HOOKDATA *data = (HOOKDATA *)PTR_SEG_TO_LIN(hhook);
if (!data->next) return 0;
if (data == NULL || !data->next) return 0;
else return INTERNAL_CALL_HOOK( data->next, code, wParam, lParam );
}
......@@ -183,6 +183,82 @@ static void MSG_RemoveMsg( MESSAGEQUEUE * msgQueue, int pos )
/***********************************************************************
* MSG_GetWindowForEvent
*
* Find the window and hittest for a mouse event.
*/
static INT MSG_GetWindowForEvent( POINT pt, HWND *phwnd )
{
WND *wndPtr;
HWND hwnd;
INT hittest, x, y;
*phwnd = hwnd = GetDesktopWindow();
x = pt.x;
y = pt.y;
while (hwnd)
{
/* If point is in window, and window is visible, and it */
/* is enabled (or it's a top-level window), then explore */
/* its children. Otherwise, go to the next window. */
wndPtr = WIN_FindWndPtr( hwnd );
if ((wndPtr->dwStyle & WS_VISIBLE) &&
(!(wndPtr->dwStyle & WS_DISABLED) ||
!(wndPtr->dwStyle & WS_CHILD)) &&
(x >= wndPtr->rectWindow.left) &&
(x < wndPtr->rectWindow.right) &&
(y >= wndPtr->rectWindow.top) &&
(y < wndPtr->rectWindow.bottom))
{
*phwnd = hwnd;
/* If window is minimized or disabled, ignore its children */
if ((wndPtr->dwStyle & WS_MINIMIZE) ||
(wndPtr->dwStyle & WS_DISABLED)) break;
x -= wndPtr->rectClient.left;
y -= wndPtr->rectClient.top;
hwnd = wndPtr->hwndChild;
}
else hwnd = wndPtr->hwndNext;
}
/* Send the WM_NCHITTEST message */
while (*phwnd)
{
wndPtr = WIN_FindWndPtr( *phwnd );
if (wndPtr->dwStyle & WS_DISABLED) hittest = HTERROR;
else hittest = (INT)SendMessage( *phwnd, WM_NCHITTEST, 0,
MAKELONG( pt.x, pt.y ) );
if (hittest != HTTRANSPARENT) break; /* Found the window */
hwnd = wndPtr->hwndNext;
while (hwnd)
{
wndPtr = WIN_FindWndPtr( hwnd );
if ((wndPtr->dwStyle & WS_VISIBLE) &&
(x >= wndPtr->rectWindow.left) &&
(x < wndPtr->rectWindow.right) &&
(y >= wndPtr->rectWindow.top) &&
(y < wndPtr->rectWindow.bottom)) break;
hwnd = wndPtr->hwndNext;
}
if (hwnd) *phwnd = hwnd; /* Found a suitable sibling */
else /* Go back to the parent */
{
*phwnd = WIN_FindWndPtr( *phwnd )->hwndParent;
wndPtr = WIN_FindWndPtr( *phwnd );
x += wndPtr->rectClient.left;
y += wndPtr->rectClient.top;
}
}
if (!*phwnd) *phwnd = GetDesktopWindow();
return hittest;
}
/***********************************************************************
* MSG_TranslateMouseMsg
*
* Translate an mouse hardware event into a real mouse message.
......@@ -218,20 +294,7 @@ static BOOL MSG_TranslateMouseMsg( MSG *msg, BOOL remove )
ScreenToClient( msg->hwnd, (LPPOINT)&msg->lParam );
return TRUE; /* No need to further process the message */
}
else msg->hwnd = WindowFromPoint( msg->pt );
/* Send the WM_NCHITTEST message */
hittest_result = (INT)SendMessage( msg->hwnd, WM_NCHITTEST, 0,
MAKELONG( msg->pt.x, msg->pt.y ) );
while ((hittest_result == HTTRANSPARENT) && (msg->hwnd))
{
msg->hwnd = WINPOS_NextWindowFromPoint( msg->hwnd, msg->pt );
if (msg->hwnd)
hittest_result = (INT)SendMessage( msg->hwnd, WM_NCHITTEST, 0,
MAKELONG( msg->pt.x, msg->pt.y ));
}
if (!msg->hwnd) msg->hwnd = GetDesktopWindow();
else hittest_result = MSG_GetWindowForEvent( msg->pt, &msg->hwnd );
/* Send the WM_PARENTNOTIFY message */
......
......@@ -39,8 +39,8 @@ HDC BeginPaint( HWND hwnd, LPPAINTSTRUCT lps )
if (wndPtr->flags & WIN_NEEDS_NCPAINT)
{
SendMessage( hwnd, WM_NCPAINT, 0, 0 );
wndPtr->flags &= ~WIN_NEEDS_NCPAINT;
SendMessage( hwnd, WM_NCPAINT, 0, 0 );
}
lps->hdc = GetDCEx( hwnd, hrgnUpdate, DCX_INTERSECTRGN | DCX_USESTYLE );
......@@ -56,8 +56,8 @@ HDC BeginPaint( HWND hwnd, LPPAINTSTRUCT lps )
if (wndPtr->flags & WIN_NEEDS_ERASEBKGND)
{
lps->fErase = !SendMessage( hwnd, WM_ERASEBKGND, lps->hdc, 0 );
wndPtr->flags &= ~WIN_NEEDS_ERASEBKGND;
lps->fErase = !SendMessage( hwnd, WM_ERASEBKGND, lps->hdc, 0 );
}
else lps->fErase = TRUE;
......@@ -225,8 +225,8 @@ BOOL RedrawWindow( HWND hwnd, LPRECT rectUpdate, HRGN hrgnUpdate, UINT flags )
{
if (wndPtr->flags & WIN_NEEDS_NCPAINT)
{
SendMessage( hwnd, WM_NCPAINT, 0, 0 );
wndPtr->flags &= ~WIN_NEEDS_NCPAINT;
SendMessage( hwnd, WM_NCPAINT, 0, 0 );
}
if (wndPtr->flags & WIN_NEEDS_ERASEBKGND)
{
......
......@@ -892,11 +892,15 @@ BOOL IsChild( HWND parent, HWND child )
/***********************************************************************
* IsWindowVisible (USER.49)
*/
BOOL IsWindowVisible(HWND hWnd)
BOOL IsWindowVisible( HWND hwnd )
{
WND * wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr == 0) return(FALSE);
else return ((wndPtr->dwStyle & WS_VISIBLE) != 0);
WND *wndPtr = WIN_FindWndPtr( hwnd );
while (wndPtr && (wndPtr->dwStyle & WS_CHILD))
{
if (!(wndPtr->dwStyle & WS_VISIBLE)) return FALSE;
wndPtr = WIN_FindWndPtr( wndPtr->hwndParent );
}
return (wndPtr && (wndPtr->dwStyle & WS_VISIBLE));
}
......
......@@ -531,32 +531,6 @@ BOOL SetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *wndpl )
/*******************************************************************
* WINPOS_NextWindowFromPoint
*
* Looks for next enabled window that is
* a) sibling of hwnd, later in Z-order and encloses pt, or
* b) parent of hwnd
*/
HWND WINPOS_NextWindowFromPoint( HWND hwnd, POINT pt )
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr->hwndParent) return hwnd; /* desktop window */
ScreenToClient( wndPtr->hwndParent, &pt ); /* make pt relative to parent */
for (;;)
{
if (!wndPtr->hwndNext) break; /* No more children */
hwnd = wndPtr->hwndNext;
wndPtr = WIN_FindWndPtr( hwnd );
if ((wndPtr->dwStyle & WS_VISIBLE) &&
!(wndPtr->dwStyle & WS_DISABLED) &&
PtInRect( &wndPtr->rectWindow, pt )) return hwnd;
}
return wndPtr->hwndParent;
}
/*******************************************************************
* WINPOS_ChangeActiveWindow
*
* Change the active window and send the corresponding messages.
......
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