Commit 9ea19e54 authored by Alexandre Julliard's avatar Alexandre Julliard

Release 970101

Wed Jan 1 15:36:17 1997 Alexandre Julliard <julliard@lrc.epfl.ch> * [controls/listbox.c] Use FindFirstFile/FindNextFile in LISTBOX_Directory. * [files/dos_fs.c] Rewrote FindFirstFile/FindNextFile to use DOSFS_FindNext(). * [files/file.c] [files/directory.c] Use Win32 kernel objects and handles for file handles. Unified SearchPath() and OpenFile(). * [loader/builtin.c] Moved to if1632/ directory. * [tools/build.c] [debugger/*] [miscemu/*] Win16 register functions now receive the same CONTEXT * structure as Win32 functions. * [include/sigcontext.h] [miscemu/instr.c] Added new macros to get register values from the SIGCONTEXT structure (only used for instruction emulation now). * [scheduler/process.c] [scheduler/thread.c] (New files) Allocate process and thread structures. * [scheduler/process.c] [win32/k32obj.c] Added Win32 kernel objects and handles management. * [loader/task.c] Create a Win32 process and thread for every Win16 task. * [misc/commdlg.c] [misc/shell.c] [windows/msgbox.c] Built-in resources are now in Win32 format. This also avoids 16-bit callbacks for built-in dialogs. * [misc/lzexpand.c] Differentiate between 16-bit and 32-bit file handles. * [miscemu/int*.c] Moved all int emulation to msdos/ directory. * [msdos/*] New directory msdos/ contains all MS-DOS emulation code that can also be used for Winelib; this should enable Winelib apps to use DOS3Call and related functions. * [rc/winerc.c] A few bug fixes for Win32 resource format. * [windows/winpos.c] Hack in WINPOS_ReorderOwnerPopups() to avoid X crashed (still not right though). Sun Dec 29 17:47:55 1996 O. Flebbe <flebbe@science-computing.uni-tuebingen.de> * [loader/pe_image.c] Make sure BSS of a PE_Image is zero. Sat Dec 28 22:15:34 1996 Alex Korobka <alex@trantor.pharm.sunysb.edu> * [windows/scroll.c] ScrollWindowEx() rewrite, ScrollDC() fix. * [windows/nonclient.c] [controls/menu.c] Fixed Alt-Space crashes in dialogs. * [windows/event.c] [windows/message.c] Some changes in mouse message generation. Thu Dec 26 09:25:24 1996 Philippe De Muyter <phdm@info.ucl.ac.be> * [debugger/stabs.c] Dummy DEBUG_ReadExecutableDbgInfo provided for !__ELF__ case. Tue Dec 24 00:59:05 MET 1996 Martin Buck <martin-2.buck@student.uni-ulm.de> * [windows/event.c] Changed XK_Page_{Up,Down} to XK_{Prior,Next} for X11R5 compatibility.
parent 7ebe1a41
This is release 961222 of Wine, the MS Windows emulator. This is still a This is release 970101 of Wine, the MS Windows emulator. This is still a
developer's only release. There are many bugs and many unimplemented API developer's only release. There are many bugs and many unimplemented API
features. Most applications still do not work correctly. features. Most applications still do not work correctly.
Patches should be submitted to "julliard@lrc.epfl.ch". Please don't Patches should be submitted to "julliard@lrc.epfl.ch". Please don't
forget to include a ChangeLog entry. forget to include a ChangeLog entry.
WHAT'S NEW with Wine-961222: (see ChangeLog for details) WHAT'S NEW with Wine-970101: (see ChangeLog for details)
- Lots of improvements to the built-in debugger - Win32 handle management and related stuff.
- Yet more Win32 stuff. - Several files moved around, new directories created.
- Lots of bug fixes. - Lots of bug fixes.
See the README file in the distribution for installation instructions. See the README file in the distribution for installation instructions.
...@@ -16,10 +16,10 @@ Because of lags created by using mirror, this message may reach you before ...@@ -16,10 +16,10 @@ Because of lags created by using mirror, this message may reach you before
the release is available at the ftp sites. The sources will be available the release is available at the ftp sites. The sources will be available
from the following locations: from the following locations:
ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-961222.tar.gz ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-970101.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-961222.tar.gz ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-970101.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-961222.tar.gz ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-970101.tar.gz
ftp://aris.com/pub/linux/ALPHA/Wine/development/Wine-961222.tar.gz ftp://aris.com/pub/linux/ALPHA/Wine/development/Wine-970101.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite. It should also be available from any site that mirrors tsx-11 or sunsite.
......
---------------------------------------------------------------------- ----------------------------------------------------------------------
Wed Jan 1 15:36:17 1997 Alexandre Julliard <julliard@lrc.epfl.ch>
* [controls/listbox.c]
Use FindFirstFile/FindNextFile in LISTBOX_Directory.
* [files/dos_fs.c]
Rewrote FindFirstFile/FindNextFile to use DOSFS_FindNext().
* [files/file.c] [files/directory.c]
Use Win32 kernel objects and handles for file handles.
Unified SearchPath() and OpenFile().
* [loader/builtin.c]
Moved to if1632/ directory.
* [tools/build.c] [debugger/*] [miscemu/*]
Win16 register functions now receive the same CONTEXT * structure
as Win32 functions.
* [include/sigcontext.h] [miscemu/instr.c]
Added new macros to get register values from the SIGCONTEXT
structure (only used for instruction emulation now).
* [scheduler/process.c] [scheduler/thread.c] (New files)
Allocate process and thread structures.
* [scheduler/process.c] [win32/k32obj.c]
Added Win32 kernel objects and handles management.
* [loader/task.c]
Create a Win32 process and thread for every Win16 task.
* [misc/commdlg.c] [misc/shell.c] [windows/msgbox.c]
Built-in resources are now in Win32 format. This also avoids
16-bit callbacks for built-in dialogs.
* [misc/lzexpand.c]
Differentiate between 16-bit and 32-bit file handles.
* [miscemu/int*.c]
Moved all int emulation to msdos/ directory.
* [msdos/*]
New directory msdos/ contains all MS-DOS emulation code that can
also be used for Winelib; this should enable Winelib apps to use
DOS3Call and related functions.
* [rc/winerc.c]
A few bug fixes for Win32 resource format.
* [windows/winpos.c]
Hack in WINPOS_ReorderOwnerPopups() to avoid X crashed (still not
right though).
Sun Dec 29 17:47:55 1996 O. Flebbe <flebbe@science-computing.uni-tuebingen.de>
* [loader/pe_image.c]
Make sure BSS of a PE_Image is zero.
Sat Dec 28 22:15:34 1996 Alex Korobka <alex@trantor.pharm.sunysb.edu>
* [windows/scroll.c]
ScrollWindowEx() rewrite, ScrollDC() fix.
* [windows/nonclient.c] [controls/menu.c]
Fixed Alt-Space crashes in dialogs.
* [windows/event.c] [windows/message.c]
Some changes in mouse message generation.
Thu Dec 26 09:25:24 1996 Philippe De Muyter <phdm@info.ucl.ac.be>
* [debugger/stabs.c]
Dummy DEBUG_ReadExecutableDbgInfo provided for !__ELF__ case.
Tue Dec 24 00:59:05 MET 1996 Martin Buck <martin-2.buck@student.uni-ulm.de>
* [windows/event.c]
Changed XK_Page_{Up,Down} to XK_{Prior,Next} for X11R5
compatibility.
----------------------------------------------------------------------
Sun Dec 22 13:30:18 1996 Alexandre Julliard <julliard@lrc.epfl.ch> Sun Dec 22 13:30:18 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [graphics/metafiledrv/init.c] [graphisc/metafiledrv/mapping.c] * [graphics/metafiledrv/init.c] [graphisc/metafiledrv/mapping.c]
......
...@@ -53,9 +53,11 @@ COMMONSUBDIRS = \ ...@@ -53,9 +53,11 @@ COMMONSUBDIRS = \
loader \ loader \
memory \ memory \
misc \ misc \
msdos \
multimedia \ multimedia \
objects \ objects \
resources \ resources \
scheduler \
win32 \ win32 \
windows windows
...@@ -82,9 +84,11 @@ COMMONOBJS = \ ...@@ -82,9 +84,11 @@ COMMONOBJS = \
loader/loader.o \ loader/loader.o \
memory/memory.o \ memory/memory.o \
misc/misc.o \ misc/misc.o \
msdos/msdos.o \
multimedia/multimedia.o \ multimedia/multimedia.o \
objects/objects.o \ objects/objects.o \
resources/resources.o \ resources/resources.o \
scheduler/scheduler.o \
win32/win32.o \ win32/win32.o \
windows/windows.o windows/windows.o
......
...@@ -2489,6 +2489,7 @@ loader/Makefile ...@@ -2489,6 +2489,7 @@ loader/Makefile
memory/Makefile memory/Makefile
misc/Makefile misc/Makefile
miscemu/Makefile miscemu/Makefile
msdos/Makefile
multimedia/Makefile multimedia/Makefile
objects/Makefile objects/Makefile
programs/Makefile programs/Makefile
...@@ -2496,6 +2497,7 @@ programs/progman/Makefile ...@@ -2496,6 +2497,7 @@ programs/progman/Makefile
programs/winhelp/Makefile programs/winhelp/Makefile
rc/Makefile rc/Makefile
resources/Makefile resources/Makefile
scheduler/Makefile
tools/Makefile tools/Makefile
win32/Makefile win32/Makefile
windows/Makefile include/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 windows/Makefile include/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
...@@ -2604,6 +2606,7 @@ loader/Makefile ...@@ -2604,6 +2606,7 @@ loader/Makefile
memory/Makefile memory/Makefile
misc/Makefile misc/Makefile
miscemu/Makefile miscemu/Makefile
msdos/Makefile
multimedia/Makefile multimedia/Makefile
objects/Makefile objects/Makefile
programs/Makefile programs/Makefile
...@@ -2611,6 +2614,7 @@ programs/progman/Makefile ...@@ -2611,6 +2614,7 @@ programs/progman/Makefile
programs/winhelp/Makefile programs/winhelp/Makefile
rc/Makefile rc/Makefile
resources/Makefile resources/Makefile
scheduler/Makefile
tools/Makefile tools/Makefile
win32/Makefile win32/Makefile
windows/Makefile "} windows/Makefile "}
......
...@@ -131,6 +131,7 @@ loader/Makefile ...@@ -131,6 +131,7 @@ loader/Makefile
memory/Makefile memory/Makefile
misc/Makefile misc/Makefile
miscemu/Makefile miscemu/Makefile
msdos/Makefile
multimedia/Makefile multimedia/Makefile
objects/Makefile objects/Makefile
programs/Makefile programs/Makefile
...@@ -138,6 +139,7 @@ programs/progman/Makefile ...@@ -138,6 +139,7 @@ programs/progman/Makefile
programs/winhelp/Makefile programs/winhelp/Makefile
rc/Makefile rc/Makefile
resources/Makefile resources/Makefile
scheduler/Makefile
tools/Makefile tools/Makefile
win32/Makefile win32/Makefile
windows/Makefile ]) windows/Makefile ])
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <unistd.h> #include <unistd.h>
#include "win.h" #include "win.h"
#include "desktop.h" #include "desktop.h"
#include "directory.h"
#include "graphics.h" #include "graphics.h"
#include "heap.h" #include "heap.h"
...@@ -25,13 +24,13 @@ static HBITMAP32 DESKTOP_LoadBitmap( HDC32 hdc, const char *filename ) ...@@ -25,13 +24,13 @@ static HBITMAP32 DESKTOP_LoadBitmap( HDC32 hdc, const char *filename )
BITMAPFILEHEADER *fileHeader; BITMAPFILEHEADER *fileHeader;
BITMAPINFO *bitmapInfo; BITMAPINFO *bitmapInfo;
HBITMAP32 hbitmap; HBITMAP32 hbitmap;
HFILE file; HFILE32 file;
LPSTR buffer; LPSTR buffer;
LONG size; LONG size;
/* Read all the file into memory */ /* Read all the file into memory */
if ((file = _lopen( filename, OF_READ )) == HFILE_ERROR) if ((file = _lopen32( filename, OF_READ )) == HFILE_ERROR32)
{ {
UINT32 len = GetWindowsDirectory32A( NULL, 0 ); UINT32 len = GetWindowsDirectory32A( NULL, 0 );
if (!(buffer = HeapAlloc( SystemHeap, 0, len + strlen(filename) + 2 ))) if (!(buffer = HeapAlloc( SystemHeap, 0, len + strlen(filename) + 2 )))
...@@ -39,19 +38,19 @@ static HBITMAP32 DESKTOP_LoadBitmap( HDC32 hdc, const char *filename ) ...@@ -39,19 +38,19 @@ static HBITMAP32 DESKTOP_LoadBitmap( HDC32 hdc, const char *filename )
GetWindowsDirectory32A( buffer, len + 1 ); GetWindowsDirectory32A( buffer, len + 1 );
strcat( buffer, "\\" ); strcat( buffer, "\\" );
strcat( buffer, filename ); strcat( buffer, filename );
file = _lopen( buffer, OF_READ ); file = _lopen32( buffer, OF_READ );
HeapFree( SystemHeap, 0, buffer ); HeapFree( SystemHeap, 0, buffer );
} }
if (file == HFILE_ERROR) return 0; if (file == HFILE_ERROR32) return 0;
size = _llseek( file, 0, 2 ); size = _llseek32( file, 0, 2 );
if (!(buffer = HeapAlloc( SystemHeap, 0, size ))) if (!(buffer = HeapAlloc( SystemHeap, 0, size )))
{ {
_lclose( file ); _lclose32( file );
return 0; return 0;
} }
_llseek( file, 0, 0 ); _llseek32( file, 0, 0 );
size = _lread32( file, buffer, size ); size = _lread32( file, buffer, size );
_lclose( file ); _lclose32( file );
fileHeader = (BITMAPFILEHEADER *)buffer; fileHeader = (BITMAPFILEHEADER *)buffer;
bitmapInfo = (BITMAPINFO *)(buffer + sizeof(BITMAPFILEHEADER)); bitmapInfo = (BITMAPINFO *)(buffer + sizeof(BITMAPFILEHEADER));
...@@ -157,7 +156,7 @@ LRESULT DesktopWndProc( HWND32 hwnd, UINT32 message, ...@@ -157,7 +156,7 @@ LRESULT DesktopWndProc( HWND32 hwnd, UINT32 message,
case WM_SYSCOMMAND: case WM_SYSCOMMAND:
if ((wParam & 0xfff0) != SC_CLOSE) return 0; if ((wParam & 0xfff0) != SC_CLOSE) return 0;
ExitWindows( 0, 0 ); ExitWindows16( 0, 0 );
case WM_SETCURSOR: case WM_SETCURSOR:
return (LRESULT)SetCursor( LoadCursor16( 0, IDC_ARROW ) ); return (LRESULT)SetCursor( LoadCursor16( 0, IDC_ARROW ) );
......
...@@ -8,9 +8,8 @@ ...@@ -8,9 +8,8 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include "windows.h" #include "windows.h"
#include "winerror.h"
#include "drive.h" #include "drive.h"
#include "dos_fs.h"
#include "msdos.h"
#include "heap.h" #include "heap.h"
#include "spy.h" #include "spy.h"
#include "win.h" #include "win.h"
...@@ -478,7 +477,7 @@ static void LISTBOX_PaintItem( WND *wnd, LB_DESCR *descr, HDC32 hdc, ...@@ -478,7 +477,7 @@ static void LISTBOX_PaintItem( WND *wnd, LB_DESCR *descr, HDC32 hdc,
else else
SetTextColor( hdc, GetSysColor( COLOR_WINDOWTEXT ) ); SetTextColor( hdc, GetSysColor( COLOR_WINDOWTEXT ) );
} }
dprintf_listbox( stddeb, "Listbox %04x: painting %d (%s) action=%02x" dprintf_listbox( stddeb, "Listbox %04x: painting %d (%s) action=%02x "
"rect=%d,%d-%d,%d\n", "rect=%d,%d-%d,%d\n",
wnd->hwndSelf, index, item ? item->str : "", action, wnd->hwndSelf, index, item ? item->str : "", action,
rect->left, rect->top, rect->right, rect->bottom ); rect->left, rect->top, rect->right, rect->bottom );
...@@ -1455,55 +1454,45 @@ static LRESULT LISTBOX_SetCount( WND *wnd, LB_DESCR *descr, INT32 count ) ...@@ -1455,55 +1454,45 @@ static LRESULT LISTBOX_SetCount( WND *wnd, LB_DESCR *descr, INT32 count )
LRESULT LISTBOX_Directory( WND *wnd, LB_DESCR *descr, UINT32 attrib, LRESULT LISTBOX_Directory( WND *wnd, LB_DESCR *descr, UINT32 attrib,
LPCSTR filespec, BOOL32 long_names ) LPCSTR filespec, BOOL32 long_names )
{ {
char mask[13]; HANDLE32 handle;
const char *ptr; LRESULT ret = LB_OKAY;
char *path, *p; WIN32_FIND_DATA32A entry;
int count, skip, pos; int pos;
LRESULT ret;
DOS_DIRENT entry;
/* FIXME: should use FindFirstFile/FindNextFile */
if (!filespec) return LB_ERR; if ((handle = FindFirstFile32A(filespec,&entry)) == INVALID_HANDLE_VALUE32)
if (!(ptr = DOSFS_GetUnixFileName( filespec, FALSE ))) return LB_ERR;
path = HEAP_strdupA( SystemHeap, 0, ptr );
p = strrchr( path, '/' );
*p++ = '\0';
if (!(ptr = DOSFS_ToDosFCBFormat( p )))
{ {
HeapFree( SystemHeap, 0, path ); if (GetLastError() != ERROR_NO_MORE_FILES) return LB_ERR;
return LB_ERR;
} }
strcpy( mask, ptr ); else
skip = 0;
ret = LB_OKAY;
attrib &= ~FA_LABEL;
while ((count = DOSFS_FindNext( path, mask, NULL, 0,
attrib, skip, &entry )) > 0)
{ {
char buffer[260]; do
skip += count;
if (entry.attr & FA_DIRECTORY)
{ {
if (!(attrib & DDL_DIRECTORY) || !strcmp(entry.name,". ")) char buffer[270];
continue; if (entry.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
if (long_names) sprintf( buffer, "[%s]", entry.unixname ); {
else sprintf( buffer, "[%s]", DOSFS_ToDosDTAFormat( entry.name ) ); if (!(attrib & DDL_DIRECTORY) ||
} !strcmp( entry.cAlternateFileName, "." )) continue;
else /* not a directory */ if (long_names) sprintf( buffer, "[%s]", entry.cFileName );
{ else sprintf( buffer, "[%s]", entry.cAlternateFileName );
if ((attrib & DDL_EXCLUSIVE) && }
((attrib & (FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_ARCHIVE)) != else /* not a directory */
(entry.attr & (FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_ARCHIVE)))) {
continue; #define ATTRIBS (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | \
if (long_names) strcpy( buffer, entry.unixname ); FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE)
else strcpy( buffer, DOSFS_ToDosDTAFormat( entry.name ) );
} if ((attrib & DDL_EXCLUSIVE) &&
if (!long_names) AnsiLower( buffer ); ((attrib & ATTRIBS) != (entry.dwFileAttributes & ATTRIBS)))
pos = LISTBOX_FindFileStrPos( wnd, descr, buffer ); continue;
if ((ret = LISTBOX_InsertString( wnd, descr, pos, buffer )) < 0) #undef ATTRIBS
break; if (long_names) strcpy( buffer, entry.cFileName );
else strcpy( buffer, entry.cAlternateFileName );
}
if (!long_names) AnsiLower( buffer );
pos = LISTBOX_FindFileStrPos( wnd, descr, buffer );
if ((ret = LISTBOX_InsertString( wnd, descr, pos, buffer )) < 0)
break;
} while (FindNextFile32A( handle, &entry ));
FindClose32( handle );
} }
if ((ret == LB_OKAY) && (attrib & DDL_DRIVES)) if ((ret == LB_OKAY) && (attrib & DDL_DRIVES))
...@@ -1517,8 +1506,6 @@ LRESULT LISTBOX_Directory( WND *wnd, LB_DESCR *descr, UINT32 attrib, ...@@ -1517,8 +1506,6 @@ LRESULT LISTBOX_Directory( WND *wnd, LB_DESCR *descr, UINT32 attrib,
break; break;
} }
} }
HeapFree( SystemHeap, 0, path );
return ret; return ret;
} }
...@@ -1744,6 +1731,7 @@ static LRESULT LISTBOX_HandleTimer( WND *wnd, LB_DESCR *descr, ...@@ -1744,6 +1731,7 @@ static LRESULT LISTBOX_HandleTimer( WND *wnd, LB_DESCR *descr,
break; break;
case LB_TIMER_DOWN: case LB_TIMER_DOWN:
index = descr->top_item + LISTBOX_GetCurrentPageSize( wnd, descr ); index = descr->top_item + LISTBOX_GetCurrentPageSize( wnd, descr );
if (index == descr->focus_item) index++;
if (index >= descr->nb_items) index = descr->nb_items - 1; if (index >= descr->nb_items) index = descr->nb_items - 1;
break; break;
case LB_TIMER_RIGHT: case LB_TIMER_RIGHT:
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "listbox.h" #include "listbox.h"
#include "dos_fs.h" #include "dos_fs.h"
#include "drive.h" #include "drive.h"
#include "file.h"
#include "heap.h" #include "heap.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
...@@ -699,6 +698,7 @@ int ListBoxSetCurSel(LPHEADLIST lphl, WORD wIndex) ...@@ -699,6 +698,7 @@ int ListBoxSetCurSel(LPHEADLIST lphl, WORD wIndex)
LONG ListBoxDirectory(LPHEADLIST lphl, UINT attrib, LPCSTR filespec) LONG ListBoxDirectory(LPHEADLIST lphl, UINT attrib, LPCSTR filespec)
{ {
#if 0
char mask[13]; char mask[13];
char* temp = NULL; char* temp = NULL;
const char* ptr; const char* ptr;
...@@ -772,6 +772,8 @@ LONG ListBoxDirectory(LPHEADLIST lphl, UINT attrib, LPCSTR filespec) ...@@ -772,6 +772,8 @@ LONG ListBoxDirectory(LPHEADLIST lphl, UINT attrib, LPCSTR filespec)
SEGPTR_FREE( temp ); SEGPTR_FREE( temp );
return ret; return ret;
#endif
return 0;
} }
/* ------------------------- dimensions ------------------------- */ /* ------------------------- dimensions ------------------------- */
......
...@@ -65,9 +65,10 @@ static void DEBUG_SetOpcode( const DBG_ADDR *addr, BYTE op ) ...@@ -65,9 +65,10 @@ static void DEBUG_SetOpcode( const DBG_ADDR *addr, BYTE op )
* Determine if the instruction at CS:EIP is an instruction that * Determine if the instruction at CS:EIP is an instruction that
* we need to step over (like a call or a repetitive string move). * we need to step over (like a call or a repetitive string move).
*/ */
static BOOL32 DEBUG_IsStepOverInstr( SIGCONTEXT *context ) static BOOL32 DEBUG_IsStepOverInstr(void)
{ {
BYTE *instr = (BYTE *)PTR_SEG_OFF_TO_LIN(CS_reg(context),EIP_reg(context)); BYTE *instr = (BYTE *)PTR_SEG_OFF_TO_LIN( CS_reg(&DEBUG_context),
EIP_reg(&DEBUG_context) );
for (;;) for (;;)
{ {
...@@ -182,7 +183,7 @@ void DEBUG_AddBreakpoint( const DBG_ADDR *address ) ...@@ -182,7 +183,7 @@ void DEBUG_AddBreakpoint( const DBG_ADDR *address )
int num; int num;
BYTE *p; BYTE *p;
DBG_FIX_ADDR_SEG( &addr, CS_reg(DEBUG_context) ); DBG_FIX_ADDR_SEG( &addr, CS_reg(&DEBUG_context) );
if (next_bp < MAX_BREAKPOINTS) if (next_bp < MAX_BREAKPOINTS)
num = next_bp++; num = next_bp++;
...@@ -273,17 +274,17 @@ void DEBUG_InfoBreakpoints(void) ...@@ -273,17 +274,17 @@ void DEBUG_InfoBreakpoints(void)
* Determine if we should continue execution after a SIGTRAP signal when * Determine if we should continue execution after a SIGTRAP signal when
* executing in the given mode. * executing in the given mode.
*/ */
BOOL32 DEBUG_ShouldContinue( SIGCONTEXT *context, enum exec_mode mode ) BOOL32 DEBUG_ShouldContinue( enum exec_mode mode )
{ {
DBG_ADDR addr; DBG_ADDR addr;
int bpnum; int bpnum;
/* If not single-stepping, back up over the int3 instruction */ /* If not single-stepping, back up over the int3 instruction */
if (!(EFL_reg(DEBUG_context) & STEP_FLAG)) EIP_reg(DEBUG_context)--; if (!(EFL_reg(&DEBUG_context) & STEP_FLAG)) EIP_reg(&DEBUG_context)--;
addr.seg = (CS_reg(DEBUG_context) == WINE_CODE_SELECTOR) ? addr.seg = (CS_reg(&DEBUG_context) == WINE_CODE_SELECTOR) ?
0 : CS_reg(DEBUG_context); 0 : CS_reg(&DEBUG_context);
addr.off = EIP_reg(DEBUG_context); addr.off = EIP_reg(&DEBUG_context);
bpnum = DEBUG_FindBreakpoint( &addr ); bpnum = DEBUG_FindBreakpoint( &addr );
breakpoints[0].enabled = 0; /* disable the step-over breakpoint */ breakpoints[0].enabled = 0; /* disable the step-over breakpoint */
...@@ -299,8 +300,8 @@ BOOL32 DEBUG_ShouldContinue( SIGCONTEXT *context, enum exec_mode mode ) ...@@ -299,8 +300,8 @@ BOOL32 DEBUG_ShouldContinue( SIGCONTEXT *context, enum exec_mode mode )
/* If there's no breakpoint and we are not single-stepping, then we */ /* If there's no breakpoint and we are not single-stepping, then we */
/* must have encountered an int3 in the Windows program; let's skip it. */ /* must have encountered an int3 in the Windows program; let's skip it. */
if ((bpnum == -1) && !(EFL_reg(DEBUG_context) & STEP_FLAG)) if ((bpnum == -1) && !(EFL_reg(&DEBUG_context) & STEP_FLAG))
EIP_reg(DEBUG_context)++; EIP_reg(&DEBUG_context)++;
/* no breakpoint, continue if in continuous mode */ /* no breakpoint, continue if in continuous mode */
return (mode == EXEC_CONT); return (mode == EXEC_CONT);
...@@ -313,14 +314,13 @@ BOOL32 DEBUG_ShouldContinue( SIGCONTEXT *context, enum exec_mode mode ) ...@@ -313,14 +314,13 @@ BOOL32 DEBUG_ShouldContinue( SIGCONTEXT *context, enum exec_mode mode )
* Set the breakpoints to the correct state to restart execution * Set the breakpoints to the correct state to restart execution
* in the given mode. * in the given mode.
*/ */
void DEBUG_RestartExecution( SIGCONTEXT *context, enum exec_mode mode, void DEBUG_RestartExecution( enum exec_mode mode, int instr_len )
int instr_len )
{ {
DBG_ADDR addr; DBG_ADDR addr;
addr.seg = (CS_reg(DEBUG_context) == WINE_CODE_SELECTOR) ? addr.seg = (CS_reg(&DEBUG_context) == WINE_CODE_SELECTOR) ?
0 : CS_reg(DEBUG_context); 0 : CS_reg(&DEBUG_context);
addr.off = EIP_reg(DEBUG_context); addr.off = EIP_reg(&DEBUG_context);
if (DEBUG_FindBreakpoint( &addr ) != -1) if (DEBUG_FindBreakpoint( &addr ) != -1)
mode = EXEC_STEP_INSTR; /* If there's a breakpoint, skip it */ mode = EXEC_STEP_INSTR; /* If there's a breakpoint, skip it */
...@@ -328,14 +328,14 @@ void DEBUG_RestartExecution( SIGCONTEXT *context, enum exec_mode mode, ...@@ -328,14 +328,14 @@ void DEBUG_RestartExecution( SIGCONTEXT *context, enum exec_mode mode,
switch(mode) switch(mode)
{ {
case EXEC_CONT: /* Continuous execution */ case EXEC_CONT: /* Continuous execution */
EFL_reg(DEBUG_context) &= ~STEP_FLAG; EFL_reg(&DEBUG_context) &= ~STEP_FLAG;
DEBUG_SetBreakpoints( TRUE ); DEBUG_SetBreakpoints( TRUE );
break; break;
case EXEC_STEP_OVER: /* Stepping over a call */ case EXEC_STEP_OVER: /* Stepping over a call */
if (DEBUG_IsStepOverInstr(DEBUG_context)) if (DEBUG_IsStepOverInstr())
{ {
EFL_reg(DEBUG_context) &= ~STEP_FLAG; EFL_reg(&DEBUG_context) &= ~STEP_FLAG;
addr.off += instr_len; addr.off += instr_len;
breakpoints[0].addr = addr; breakpoints[0].addr = addr;
breakpoints[0].enabled = TRUE; breakpoints[0].enabled = TRUE;
...@@ -347,7 +347,7 @@ void DEBUG_RestartExecution( SIGCONTEXT *context, enum exec_mode mode, ...@@ -347,7 +347,7 @@ void DEBUG_RestartExecution( SIGCONTEXT *context, enum exec_mode mode,
/* else fall through to single-stepping */ /* else fall through to single-stepping */
case EXEC_STEP_INSTR: /* Single-stepping an instruction */ case EXEC_STEP_INSTR: /* Single-stepping an instruction */
EFL_reg(DEBUG_context) |= STEP_FLAG; EFL_reg(&DEBUG_context) |= STEP_FLAG;
break; break;
} }
} }
...@@ -134,8 +134,8 @@ break_command: ...@@ -134,8 +134,8 @@ break_command:
addr.off += $4; addr.off += $4;
DEBUG_AddBreakpoint( &addr ); DEBUG_AddBreakpoint( &addr );
} }
| tBREAK tEOL { DBG_ADDR addr = { CS_reg(DEBUG_context), | tBREAK tEOL { DBG_ADDR addr = { CS_reg(&DEBUG_context),
EIP_reg(DEBUG_context) }; EIP_reg(&DEBUG_context) };
DEBUG_AddBreakpoint( &addr ); DEBUG_AddBreakpoint( &addr );
} }
...@@ -239,32 +239,15 @@ void mode_command(int newmode) ...@@ -239,32 +239,15 @@ void mode_command(int newmode)
} }
/*********************************************************************** /***********************************************************************
* DEBUG_EnterDebugger * DEBUG_Main
* *
* Force an entry into the debugger. * Debugger main loop.
*/
void DEBUG_EnterDebugger(void)
{
kill( getpid(), SIGHUP );
}
/***********************************************************************
* DebugBreak16 (KERNEL.203)
*/ */
void DebugBreak16( SIGCONTEXT *regs ) static void DEBUG_Main( int signal )
{
const char *module = MODULE_GetModuleName( GetExePtr(GetCurrentTask()) );
fprintf( stderr, "%s called DebugBreak\n", module ? module : "???" );
wine_debug( SIGTRAP, regs );
}
void wine_debug( int signal, SIGCONTEXT *regs )
{ {
static int loaded_symbols = 0; static int loaded_symbols = 0;
static BOOL32 in_debugger = FALSE;
char SymbolTableFile[256]; char SymbolTableFile[256];
int instr_len = 0, newmode; int instr_len = 0, newmode;
BOOL32 ret_ok; BOOL32 ret_ok;
...@@ -272,8 +255,13 @@ void wine_debug( int signal, SIGCONTEXT *regs ) ...@@ -272,8 +255,13 @@ void wine_debug( int signal, SIGCONTEXT *regs )
yydebug = 0; yydebug = 0;
#endif #endif
if (in_debugger)
{
fprintf( stderr, "Segmentation fault inside debugger, exiting.\n" );
exit(1);
}
in_debugger = TRUE;
yyin = stdin; yyin = stdin;
DEBUG_context = regs;
DEBUG_SetBreakpoints( FALSE ); DEBUG_SetBreakpoints( FALSE );
...@@ -306,12 +294,12 @@ void wine_debug( int signal, SIGCONTEXT *regs ) ...@@ -306,12 +294,12 @@ void wine_debug( int signal, SIGCONTEXT *regs )
DEBUG_LoadEntryPoints(); DEBUG_LoadEntryPoints();
} }
if ((signal != SIGTRAP) || !DEBUG_ShouldContinue( regs, dbg_exec_mode )) if ((signal != SIGTRAP) || !DEBUG_ShouldContinue( dbg_exec_mode ))
{ {
DBG_ADDR addr; DBG_ADDR addr;
addr.seg = CS_reg(DEBUG_context); addr.seg = CS_reg(&DEBUG_context);
addr.off = EIP_reg(DEBUG_context); addr.off = EIP_reg(&DEBUG_context);
DBG_FIX_ADDR_SEG( &addr, 0 ); DBG_FIX_ADDR_SEG( &addr, 0 );
/* Put the display in a correct state */ /* Put the display in a correct state */
...@@ -332,9 +320,9 @@ void wine_debug( int signal, SIGCONTEXT *regs ) ...@@ -332,9 +320,9 @@ void wine_debug( int signal, SIGCONTEXT *regs )
DEBUG_InfoStack(); DEBUG_InfoStack();
if (dbg_mode == 16) if (dbg_mode == 16)
{ {
LDT_Print( SELECTOR_TO_ENTRY(DS_reg(DEBUG_context)), 1 ); LDT_Print( SELECTOR_TO_ENTRY(DS_reg(&DEBUG_context)), 1 );
if (ES_reg(DEBUG_context) != DS_reg(DEBUG_context)) if (ES_reg(&DEBUG_context) != DS_reg(&DEBUG_context))
LDT_Print( SELECTOR_TO_ENTRY(ES_reg(DEBUG_context)), 1 ); LDT_Print( SELECTOR_TO_ENTRY(ES_reg(&DEBUG_context)), 1 );
} }
DEBUG_BackTrace(); DEBUG_BackTrace();
} }
...@@ -347,7 +335,7 @@ void wine_debug( int signal, SIGCONTEXT *regs ) ...@@ -347,7 +335,7 @@ void wine_debug( int signal, SIGCONTEXT *regs )
{ {
DEBUG_Disasm( &addr ); DEBUG_Disasm( &addr );
fprintf(stderr,"\n"); fprintf(stderr,"\n");
instr_len = addr.off - EIP_reg(DEBUG_context); instr_len = addr.off - EIP_reg(&DEBUG_context);
} }
ret_ok = 0; ret_ok = 0;
...@@ -356,18 +344,48 @@ void wine_debug( int signal, SIGCONTEXT *regs ) ...@@ -356,18 +344,48 @@ void wine_debug( int signal, SIGCONTEXT *regs )
issue_prompt(); issue_prompt();
yyparse(); yyparse();
flush_symbols(); flush_symbols();
addr.seg = CS_reg(DEBUG_context); addr.seg = CS_reg(&DEBUG_context);
addr.off = EIP_reg(DEBUG_context); addr.off = EIP_reg(&DEBUG_context);
DBG_FIX_ADDR_SEG( &addr, 0 ); DBG_FIX_ADDR_SEG( &addr, 0 );
ret_ok = DEBUG_ValidateRegisters(); ret_ok = DEBUG_ValidateRegisters();
if (ret_ok) ret_ok = DBG_CHECK_READ_PTR( &addr, 1 ); if (ret_ok) ret_ok = DBG_CHECK_READ_PTR( &addr, 1 );
} while (!ret_ok); } while (!ret_ok);
} }
DEBUG_RestartExecution( regs, dbg_exec_mode, instr_len ); DEBUG_RestartExecution( dbg_exec_mode, instr_len );
in_debugger = FALSE;
} }
/***********************************************************************
* DEBUG_EnterDebugger
*
* Force an entry into the debugger.
*/
void DEBUG_EnterDebugger(void)
{
kill( getpid(), SIGHUP );
}
/***********************************************************************
* DebugBreak16 (KERNEL.203)
*/
void DebugBreak16( CONTEXT *regs )
{
const char *module = MODULE_GetModuleName( GetExePtr(GetCurrentTask()) );
fprintf( stderr, "%s called DebugBreak\n", module ? module : "???" );
DEBUG_Main( SIGTRAP );
}
void wine_debug( int signal, SIGCONTEXT *regs )
{
DEBUG_SetSigContext( regs );
DEBUG_Main( signal );
DEBUG_GetSigContext( regs );
}
int yyerror(char * s) int yyerror(char * s)
{ {
fprintf(stderr,"%s\n", s); fprintf(stderr,"%s\n", s);
......
...@@ -34,7 +34,7 @@ static int syntax_error; ...@@ -34,7 +34,7 @@ static int syntax_error;
DIGIT [0-9] DIGIT [0-9]
HEXDIGIT [0-9a-fA-F] HEXDIGIT [0-9a-fA-F]
FORMAT [bcdiswx] FORMAT [bcdiswx]
IDENTIFIER [_a-zA-Z\.~][_a-zA-Z0-9\.~]* IDENTIFIER [_a-zA-Z\.~][_a-zA-Z0-9\.~@]*
%% %%
......
...@@ -164,7 +164,7 @@ BOOL32 DEBUG_SetSymbolValue( const char * name, const DBG_ADDR *addr ) ...@@ -164,7 +164,7 @@ BOOL32 DEBUG_SetSymbolValue( const char * name, const DBG_ADDR *addr )
if (!nh) return FALSE; if (!nh) return FALSE;
nh->addr = *addr; nh->addr = *addr;
DBG_FIX_ADDR_SEG( &nh->addr, DS_reg(DEBUG_context) ); DBG_FIX_ADDR_SEG( &nh->addr, DS_reg(&DEBUG_context) );
return TRUE; return TRUE;
} }
......
...@@ -166,7 +166,7 @@ void DEBUG_List( DBG_ADDR *addr, int count ) ...@@ -166,7 +166,7 @@ void DEBUG_List( DBG_ADDR *addr, int count )
static DBG_ADDR lasttime = { 0xffffffff, 0 }; static DBG_ADDR lasttime = { 0xffffffff, 0 };
if (addr == NULL) addr = &lasttime; if (addr == NULL) addr = &lasttime;
DBG_FIX_ADDR_SEG( addr, CS_reg(DEBUG_context) ); DBG_FIX_ADDR_SEG( addr, CS_reg(&DEBUG_context) );
while (count-- > 0) while (count-- > 0)
{ {
DEBUG_PrintAddress( addr, dbg_mode, FALSE ); DEBUG_PrintAddress( addr, dbg_mode, FALSE );
......
...@@ -114,7 +114,7 @@ int DEBUG_ReadMemory( const DBG_ADDR *address ) ...@@ -114,7 +114,7 @@ int DEBUG_ReadMemory( const DBG_ADDR *address )
{ {
DBG_ADDR addr = *address; DBG_ADDR addr = *address;
DBG_FIX_ADDR_SEG( &addr, DS_reg(DEBUG_context) ); DBG_FIX_ADDR_SEG( &addr, DS_reg(&DEBUG_context) );
if (!DBG_CHECK_READ_PTR( &addr, sizeof(int) )) return 0; if (!DBG_CHECK_READ_PTR( &addr, sizeof(int) )) return 0;
return *(int *)DBG_ADDR_TO_LIN( &addr ); return *(int *)DBG_ADDR_TO_LIN( &addr );
} }
...@@ -129,7 +129,7 @@ void DEBUG_WriteMemory( const DBG_ADDR *address, int value ) ...@@ -129,7 +129,7 @@ void DEBUG_WriteMemory( const DBG_ADDR *address, int value )
{ {
DBG_ADDR addr = *address; DBG_ADDR addr = *address;
DBG_FIX_ADDR_SEG( &addr, DS_reg(DEBUG_context) ); DBG_FIX_ADDR_SEG( &addr, DS_reg(&DEBUG_context) );
if (!DBG_CHECK_WRITE_PTR( &addr, sizeof(int) )) return; if (!DBG_CHECK_WRITE_PTR( &addr, sizeof(int) )) return;
*(int *)DBG_ADDR_TO_LIN( &addr ) = value; *(int *)DBG_ADDR_TO_LIN( &addr ) = value;
} }
...@@ -149,7 +149,7 @@ void DEBUG_ExamineMemory( const DBG_ADDR *address, int count, char format ) ...@@ -149,7 +149,7 @@ void DEBUG_ExamineMemory( const DBG_ADDR *address, int count, char format )
int i; int i;
DBG_FIX_ADDR_SEG( &addr, (format == 'i') ? DBG_FIX_ADDR_SEG( &addr, (format == 'i') ?
CS_reg(DEBUG_context) : DS_reg(DEBUG_context) ); CS_reg(&DEBUG_context) : DS_reg(&DEBUG_context) );
if (format != 'i' && count > 1) if (format != 'i' && count > 1)
{ {
......
...@@ -372,4 +372,12 @@ leave: ...@@ -372,4 +372,12 @@ leave:
} }
#else /* !__ELF__ */
int
DEBUG_ReadExecutableDbgInfo(void)
{
return FALSE;
}
#endif /* __ELF__ */ #endif /* __ELF__ */
...@@ -57,17 +57,17 @@ void DEBUG_InfoStack(void) ...@@ -57,17 +57,17 @@ void DEBUG_InfoStack(void)
DBG_ADDR addr; DBG_ADDR addr;
fprintf(stderr,"Stack dump:\n"); fprintf(stderr,"Stack dump:\n");
if ((SS_reg(DEBUG_context) == WINE_DATA_SELECTOR) || if ((SS_reg(&DEBUG_context) == WINE_DATA_SELECTOR) ||
(GET_SEL_FLAGS(SS_reg(DEBUG_context)) & LDT_FLAGS_32BIT)) (GET_SEL_FLAGS(SS_reg(&DEBUG_context)) & LDT_FLAGS_32BIT))
{ /* 32-bit mode */ { /* 32-bit mode */
addr.seg = 0; addr.seg = 0;
addr.off = ESP_reg(DEBUG_context); addr.off = ESP_reg(&DEBUG_context);
DEBUG_ExamineMemory( &addr, 24, 'x' ); DEBUG_ExamineMemory( &addr, 24, 'x' );
} }
else /* 16-bit mode */ else /* 16-bit mode */
{ {
addr.seg = SS_reg(DEBUG_context); addr.seg = SS_reg(&DEBUG_context);
addr.off = SP_reg(DEBUG_context); addr.off = SP_reg(&DEBUG_context);
DEBUG_ExamineMemory( &addr, 24, 'w' ); DEBUG_ExamineMemory( &addr, 24, 'w' );
} }
fprintf(stderr,"\n"); fprintf(stderr,"\n");
...@@ -85,40 +85,28 @@ void DEBUG_BackTrace(void) ...@@ -85,40 +85,28 @@ void DEBUG_BackTrace(void)
int frameno = 0; int frameno = 0;
fprintf(stderr,"Backtrace:\n"); fprintf(stderr,"Backtrace:\n");
if (SS_reg(DEBUG_context) == WINE_DATA_SELECTOR) /* 32-bit mode */ if (SS_reg(&DEBUG_context) == WINE_DATA_SELECTOR) /* 32-bit mode */
{ {
addr.seg = 0; nframe = 1;
addr.off = EBP_reg(DEBUG_context); if (frames) free( frames );
nframe = 1; frames = (struct bt_info *) xmalloc( sizeof(struct bt_info) );
while (addr.off)
{
FRAME32 *frame = (FRAME32 *)addr.off;
if (!DBG_CHECK_READ_PTR( &addr, sizeof(FRAME32) )) return;
if (!frame->ip) break;
addr.off = frame->bp;
nframe++;
}
if( frames != NULL )
{
free(frames);
}
frames = (struct bt_info *) xmalloc(nframe
* sizeof(struct bt_info) );
fprintf(stderr,"%s%d ",(curr_frame == 0 ? "=>" : " "), frameno++); fprintf(stderr,"%s%d ",(curr_frame == 0 ? "=>" : " "), frameno++);
addr.off = EIP_reg(DEBUG_context);
addr.seg = 0;
addr.off = EIP_reg(&DEBUG_context);
frames[0].eip = addr.off; frames[0].eip = addr.off;
frames[0].frame = DEBUG_PrintAddress( &addr, 32, TRUE ); frames[0].frame = DEBUG_PrintAddress( &addr, 32, TRUE );
fprintf( stderr, "\n" ); fprintf( stderr, "\n" );
addr.off = EBP_reg(DEBUG_context); frames[0].ebp = addr.off = EBP_reg(&DEBUG_context);
frames[0].ebp = addr.off;
while (addr.off) while (addr.off)
{ {
FRAME32 *frame = (FRAME32 *)addr.off; FRAME32 *frame = (FRAME32 *)addr.off;
if (!DBG_CHECK_READ_PTR( &addr, sizeof(FRAME32) )) return; if (!DBG_CHECK_READ_PTR( &addr, sizeof(FRAME32) )) return;
if (!frame->ip) break; if (!frame->ip) break;
nframe++;
frames = (struct bt_info *)xrealloc(frames,
nframe*sizeof(struct bt_info));
fprintf(stderr,"%s%d ", (frameno == curr_frame ? "=>" : " "), fprintf(stderr,"%s%d ", (frameno == curr_frame ? "=>" : " "),
frameno); frameno);
addr.off = frame->ip; addr.off = frame->ip;
...@@ -133,7 +121,7 @@ void DEBUG_BackTrace(void) ...@@ -133,7 +121,7 @@ void DEBUG_BackTrace(void)
} }
else /* 16-bit mode */ else /* 16-bit mode */
{ {
WORD ss = SS_reg(DEBUG_context), cs = CS_reg(DEBUG_context); WORD ss = SS_reg(&DEBUG_context), cs = CS_reg(&DEBUG_context);
if (GET_SEL_FLAGS(ss) & LDT_FLAGS_32BIT) if (GET_SEL_FLAGS(ss) & LDT_FLAGS_32BIT)
{ {
fprintf( stderr, "Not implemented: 32-bit backtrace on a different stack segment.\n" ); fprintf( stderr, "Not implemented: 32-bit backtrace on a different stack segment.\n" );
...@@ -141,11 +129,11 @@ void DEBUG_BackTrace(void) ...@@ -141,11 +129,11 @@ void DEBUG_BackTrace(void)
} }
fprintf( stderr,"%d ", frameno++ ); fprintf( stderr,"%d ", frameno++ );
addr.seg = cs; addr.seg = cs;
addr.off = IP_reg(DEBUG_context); addr.off = IP_reg(&DEBUG_context);
DEBUG_PrintAddress( &addr, 16, TRUE ); DEBUG_PrintAddress( &addr, 16, TRUE );
fprintf( stderr, "\n" ); fprintf( stderr, "\n" );
addr.seg = ss; addr.seg = ss;
addr.off = BP_reg(DEBUG_context) & ~1; addr.off = BP_reg(&DEBUG_context) & ~1;
for (;;) for (;;)
{ {
FRAME16 *frame = (FRAME16 *)DBG_ADDR_TO_LIN(&addr); FRAME16 *frame = (FRAME16 *)DBG_ADDR_TO_LIN(&addr);
......
prefix = @prefix@ prefix = @prefix@
sysconfdir = @sysconfdir@ sysconfdir = @sysconfdir@
DEFS = -D__WINE__ -DETCDIR=\"$(sysconfdir)\" DEFS = -D__WINE__ -DNO_TRANSITION_TYPES -DETCDIR=\"$(sysconfdir)\"
TOPSRCDIR = @top_srcdir@ TOPSRCDIR = @top_srcdir@
TOPOBJDIR = .. TOPOBJDIR = ..
SRCDIR = @srcdir@ SRCDIR = @srcdir@
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "msdos.h" #include "msdos.h"
#include "options.h" #include "options.h"
#include "task.h" #include "task.h"
#include "xmalloc.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
...@@ -137,11 +136,11 @@ int DRIVE_Init(void) ...@@ -137,11 +136,11 @@ int DRIVE_Init(void)
p = path + strlen(path) - 1; p = path + strlen(path) - 1;
while ((p > path) && ((*p == '/') || (*p == '\\'))) *p-- = '\0'; while ((p > path) && ((*p == '/') || (*p == '\\'))) *p-- = '\0';
if (strlen(path)) if (strlen(path))
drive->root = xstrdup( path ); drive->root = HEAP_strdupA( SystemHeap, 0, path );
else else
drive->root = xstrdup( "/" ); drive->root = HEAP_strdupA( SystemHeap, 0, "/" );
drive->dos_cwd = xstrdup( "" ); drive->dos_cwd = HEAP_strdupA( SystemHeap, 0, "" );
drive->unix_cwd = xstrdup( "" ); drive->unix_cwd = HEAP_strdupA( SystemHeap, 0, "" );
drive->type = DRIVE_GetDriveType( name ); drive->type = DRIVE_GetDriveType( name );
drive->flags = 0; drive->flags = 0;
...@@ -180,9 +179,9 @@ int DRIVE_Init(void) ...@@ -180,9 +179,9 @@ int DRIVE_Init(void)
{ {
fprintf( stderr, "Warning: no valid DOS drive found, check your configuration file.\n" ); fprintf( stderr, "Warning: no valid DOS drive found, check your configuration file.\n" );
/* Create a C drive pointing to Unix root dir */ /* Create a C drive pointing to Unix root dir */
DOSDrives[2].root = xstrdup( "/" ); DOSDrives[2].root = HEAP_strdupA( SystemHeap, 0, "/" );
DOSDrives[2].dos_cwd = xstrdup( "" ); DOSDrives[2].dos_cwd = HEAP_strdupA( SystemHeap, 0, "" );
DOSDrives[2].unix_cwd = xstrdup( "" ); DOSDrives[2].unix_cwd = HEAP_strdupA( SystemHeap, 0, "" );
strcpy( DOSDrives[2].label, "Drive C " ); strcpy( DOSDrives[2].label, "Drive C " );
DOSDrives[2].serial = 0x12345678; DOSDrives[2].serial = 0x12345678;
DOSDrives[2].type = TYPE_HD; DOSDrives[2].type = TYPE_HD;
...@@ -413,7 +412,7 @@ int DRIVE_Chdir( int drive, const char *path ) ...@@ -413,7 +412,7 @@ int DRIVE_Chdir( int drive, const char *path )
{ {
char buffer[MAX_PATHNAME_LEN]; char buffer[MAX_PATHNAME_LEN];
const char *unix_cwd, *dos_cwd; const char *unix_cwd, *dos_cwd;
BYTE attr; BY_HANDLE_FILE_INFORMATION info;
TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() ); TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() );
dprintf_dosfs( stddeb, "DRIVE_Chdir(%c:,%s)\n", 'A' + drive, path ); dprintf_dosfs( stddeb, "DRIVE_Chdir(%c:,%s)\n", 'A' + drive, path );
...@@ -422,8 +421,8 @@ int DRIVE_Chdir( int drive, const char *path ) ...@@ -422,8 +421,8 @@ int DRIVE_Chdir( int drive, const char *path )
lstrcpyn32A( buffer + 2, path, sizeof(buffer) - 2 ); lstrcpyn32A( buffer + 2, path, sizeof(buffer) - 2 );
if (!(unix_cwd = DOSFS_GetUnixFileName( buffer, TRUE ))) return 0; if (!(unix_cwd = DOSFS_GetUnixFileName( buffer, TRUE ))) return 0;
if (!FILE_Stat( unix_cwd, &attr, NULL, NULL, NULL )) return 0; if (!FILE_Stat( unix_cwd, &info )) return 0;
if (!(attr & FA_DIRECTORY)) if (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{ {
DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk ); DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
return 0; return 0;
...@@ -437,10 +436,10 @@ int DRIVE_Chdir( int drive, const char *path ) ...@@ -437,10 +436,10 @@ int DRIVE_Chdir( int drive, const char *path )
dprintf_dosfs( stddeb, "DRIVE_Chdir(%c:): unix_cwd=%s dos_cwd=%s\n", dprintf_dosfs( stddeb, "DRIVE_Chdir(%c:): unix_cwd=%s dos_cwd=%s\n",
'A' + drive, unix_cwd, dos_cwd + 3 ); 'A' + drive, unix_cwd, dos_cwd + 3 );
free( DOSDrives[drive].dos_cwd ); HeapFree( SystemHeap, 0, DOSDrives[drive].dos_cwd );
free( DOSDrives[drive].unix_cwd ); HeapFree( SystemHeap, 0, DOSDrives[drive].unix_cwd );
DOSDrives[drive].dos_cwd = xstrdup( dos_cwd + 3 ); DOSDrives[drive].dos_cwd = HEAP_strdupA( SystemHeap, 0, dos_cwd + 3 );
DOSDrives[drive].unix_cwd = xstrdup( unix_cwd ); DOSDrives[drive].unix_cwd = HEAP_strdupA( SystemHeap, 0, unix_cwd );
if (pTask && (pTask->curdrive & 0x80) && if (pTask && (pTask->curdrive & 0x80) &&
((pTask->curdrive & ~0x80) == drive)) ((pTask->curdrive & ~0x80) == drive))
...@@ -569,7 +568,7 @@ BOOL32 GetDiskFreeSpace32W( LPCWSTR root, LPDWORD cluster_sectors, ...@@ -569,7 +568,7 @@ BOOL32 GetDiskFreeSpace32W( LPCWSTR root, LPDWORD cluster_sectors,
LPDWORD total_clusters ) LPDWORD total_clusters )
{ {
LPSTR xroot; LPSTR xroot;
BOOL ret; BOOL32 ret;
xroot = HEAP_strdupWtoA( GetProcessHeap(), 0, root); xroot = HEAP_strdupWtoA( GetProcessHeap(), 0, root);
ret = GetDiskFreeSpace32A( xroot,cluster_sectors, sector_bytes, ret = GetDiskFreeSpace32A( xroot,cluster_sectors, sector_bytes,
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
* Copyright 1996 Alexandre Julliard * Copyright 1996 Alexandre Julliard
*/ */
#define NO_TRANSITION_TYPES /* This file is Win32-clean */
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -14,7 +13,6 @@ ...@@ -14,7 +13,6 @@
#include "windows.h" #include "windows.h"
#include "dos_fs.h" #include "dos_fs.h"
#include "heap.h" #include "heap.h"
#include "xmalloc.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
...@@ -139,16 +137,16 @@ static void PROFILE_Free( PROFILESECTION *section ) ...@@ -139,16 +137,16 @@ static void PROFILE_Free( PROFILESECTION *section )
for ( ; section; section = next_section) for ( ; section; section = next_section)
{ {
if (section->name) free( section->name ); if (section->name) HeapFree( SystemHeap, 0, section->name );
for (key = section->key; key; key = next_key) for (key = section->key; key; key = next_key)
{ {
next_key = key->next; next_key = key->next;
if (key->name) free( key->name ); if (key->name) HeapFree( SystemHeap, 0, key->name );
if (key->value) free( key->value ); if (key->value) HeapFree( SystemHeap, 0, key->value );
free( key ); HeapFree( SystemHeap, 0, key );
} }
next_section = section->next; next_section = section->next;
free( section ); HeapFree( SystemHeap, 0, section );
} }
} }
...@@ -167,7 +165,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file ) ...@@ -167,7 +165,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
PROFILESECTION **prev_section; PROFILESECTION **prev_section;
PROFILEKEY *key, **prev_key; PROFILEKEY *key, **prev_key;
first_section = (PROFILESECTION *)xmalloc( sizeof(*section) ); first_section = HEAP_xalloc( SystemHeap, 0, sizeof(*section) );
first_section->name = NULL; first_section->name = NULL;
first_section->key = NULL; first_section->key = NULL;
first_section->next = NULL; first_section->next = NULL;
...@@ -192,8 +190,8 @@ static PROFILESECTION *PROFILE_Load( FILE *file ) ...@@ -192,8 +190,8 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
{ {
*p2 = '\0'; *p2 = '\0';
p++; p++;
section = (PROFILESECTION *)xmalloc( sizeof(*section)); section = HEAP_xalloc( SystemHeap, 0, sizeof(*section) );
section->name = xstrdup( p ); section->name = HEAP_strdupA( SystemHeap, 0, p );
section->key = NULL; section->key = NULL;
section->next = NULL; section->next = NULL;
*prev_section = section; *prev_section = section;
...@@ -209,9 +207,9 @@ static PROFILESECTION *PROFILE_Load( FILE *file ) ...@@ -209,9 +207,9 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
*p2++ = '\0'; *p2++ = '\0';
while (*p2 && isspace(*p2)) p2++; while (*p2 && isspace(*p2)) p2++;
} }
key = (PROFILEKEY *)xmalloc( sizeof(*key) ); key = HEAP_xalloc( SystemHeap, 0, sizeof(*key) );
key->name = xstrdup( p ); key->name = HEAP_strdupA( SystemHeap, 0, p );
key->value = p2 ? xstrdup( p2 ) : NULL; key->value = HEAP_strdupA( SystemHeap, 0, p2 );
key->next = NULL; key->next = NULL;
*prev_key = key; *prev_key = key;
prev_key = &key->next; prev_key = &key->next;
...@@ -268,9 +266,9 @@ static BOOL32 PROFILE_DeleteKey( PROFILESECTION **section, ...@@ -268,9 +266,9 @@ static BOOL32 PROFILE_DeleteKey( PROFILESECTION **section,
{ {
PROFILEKEY *to_del = *key; PROFILEKEY *to_del = *key;
*key = to_del->next; *key = to_del->next;
if (to_del->name) free( to_del->name ); if (to_del->name) HeapFree( SystemHeap, 0, to_del->name );
if (to_del->value) free( to_del->value ); if (to_del->value) HeapFree( SystemHeap, 0, to_del->value);
free( to_del ); HeapFree( SystemHeap, 0, to_del );
return TRUE; return TRUE;
} }
key = &(*key)->next; key = &(*key)->next;
...@@ -302,8 +300,8 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section, ...@@ -302,8 +300,8 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section,
key = &(*key)->next; key = &(*key)->next;
} }
if (!create) return NULL; if (!create) return NULL;
*key = (PROFILEKEY *)xmalloc( sizeof(PROFILEKEY) ); *key = HEAP_xalloc( SystemHeap, 0, sizeof(PROFILEKEY) );
(*key)->name = xstrdup( key_name ); (*key)->name = HEAP_strdupA( SystemHeap, 0, key_name );
(*key)->value = NULL; (*key)->value = NULL;
(*key)->next = NULL; (*key)->next = NULL;
return *key; return *key;
...@@ -311,11 +309,11 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section, ...@@ -311,11 +309,11 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section,
section = &(*section)->next; section = &(*section)->next;
} }
if (!create) return NULL; if (!create) return NULL;
*section = (PROFILESECTION *)xmalloc( sizeof(PROFILESECTION) ); *section = HEAP_xalloc( SystemHeap, 0, sizeof(PROFILESECTION) );
(*section)->name = xstrdup(section_name); (*section)->name = HEAP_strdupA( SystemHeap, 0, section_name );
(*section)->next = NULL; (*section)->next = NULL;
(*section)->key = (PROFILEKEY *)xmalloc( sizeof(PROFILEKEY) ); (*section)->key = HEAP_xalloc( SystemHeap, 0, sizeof(PROFILEKEY) );
(*section)->key->name = xstrdup( key_name ); (*section)->key->name = HEAP_strdupA( SystemHeap, 0, key_name );
(*section)->key->value = NULL; (*section)->key->value = NULL;
(*section)->key->next = NULL; (*section)->key->next = NULL;
return (*section)->key; return (*section)->key;
...@@ -400,10 +398,10 @@ static BOOL32 PROFILE_Open( LPCSTR filename ) ...@@ -400,10 +398,10 @@ static BOOL32 PROFILE_Open( LPCSTR filename )
/* Flush the previous profile */ /* Flush the previous profile */
newdos_name = xstrdup( dos_name ); newdos_name = HEAP_strdupA( SystemHeap, 0, dos_name );
PROFILE_FlushFile(); PROFILE_FlushFile();
PROFILE_Free( CurProfile.section ); PROFILE_Free( CurProfile.section );
if (CurProfile.dos_name) free( CurProfile.dos_name ); if (CurProfile.dos_name) HeapFree( SystemHeap, 0, CurProfile.dos_name );
CurProfile.section = NULL; CurProfile.section = NULL;
CurProfile.dos_name = newdos_name; CurProfile.dos_name = newdos_name;
...@@ -528,6 +526,7 @@ static BOOL32 PROFILE_SetString( LPCSTR section_name, LPCSTR key_name, ...@@ -528,6 +526,7 @@ static BOOL32 PROFILE_SetString( LPCSTR section_name, LPCSTR key_name,
key_name, TRUE ); key_name, TRUE );
dprintf_profile( stddeb, "PROFILE_SetString('%s','%s','%s'): ", dprintf_profile( stddeb, "PROFILE_SetString('%s','%s','%s'): ",
section_name, key_name, value ); section_name, key_name, value );
if (!key) return FALSE;
if (key->value) if (key->value)
{ {
if (!strcmp( key->value, value )) if (!strcmp( key->value, value ))
...@@ -536,10 +535,10 @@ static BOOL32 PROFILE_SetString( LPCSTR section_name, LPCSTR key_name, ...@@ -536,10 +535,10 @@ static BOOL32 PROFILE_SetString( LPCSTR section_name, LPCSTR key_name,
return TRUE; /* No change needed */ return TRUE; /* No change needed */
} }
dprintf_profile( stddeb, "replacing '%s'\n", key->value ); dprintf_profile( stddeb, "replacing '%s'\n", key->value );
free( key->value ); HeapFree( SystemHeap, 0, key->value );
} }
else dprintf_profile( stddeb, "creating key\n" ); else dprintf_profile( stddeb, "creating key\n" );
key->value = xstrdup( value ); key->value = HEAP_strdupA( SystemHeap, 0, value );
CurProfile.changed = TRUE; CurProfile.changed = TRUE;
} }
return TRUE; return TRUE;
......
...@@ -144,7 +144,7 @@ HDC16 CreateMetaFile16( LPCSTR filename ) ...@@ -144,7 +144,7 @@ HDC16 CreateMetaFile16( LPCSTR filename )
{ {
DC *dc; DC *dc;
METAFILEDRV_PDEVICE *physDev; METAFILEDRV_PDEVICE *physDev;
HFILE hFile; HFILE32 hFile;
dprintf_metafile( stddeb, "CreateMetaFile16: '%s'\n", filename ); dprintf_metafile( stddeb, "CreateMetaFile16: '%s'\n", filename );
...@@ -154,13 +154,13 @@ HDC16 CreateMetaFile16( LPCSTR filename ) ...@@ -154,13 +154,13 @@ HDC16 CreateMetaFile16( LPCSTR filename )
if (filename) /* disk based metafile */ if (filename) /* disk based metafile */
{ {
physDev->mh->mtType = METAFILE_DISK; physDev->mh->mtType = METAFILE_DISK;
if ((hFile = _lcreat( filename, 0 )) == HFILE_ERROR) if ((hFile = _lcreat32( filename, 0 )) == HFILE_ERROR32)
{ {
DeleteDC32( dc->hSelf ); DeleteDC32( dc->hSelf );
return 0; return 0;
} }
if (_lwrite32( hFile, (LPSTR)physDev->mh, if (_lwrite32( hFile, (LPSTR)physDev->mh,
sizeof(*physDev->mh)) == HFILE_ERROR) sizeof(*physDev->mh)) == HFILE_ERROR32)
{ {
DeleteDC32( dc->hSelf ); DeleteDC32( dc->hSelf );
return 0; return 0;
...@@ -183,7 +183,7 @@ HMETAFILE16 CloseMetaFile16( HDC16 hdc ) ...@@ -183,7 +183,7 @@ HMETAFILE16 CloseMetaFile16( HDC16 hdc )
{ {
DC *dc; DC *dc;
HMETAFILE16 hmf; HMETAFILE16 hmf;
HFILE hFile; HFILE32 hFile;
METAFILEDRV_PDEVICE *physDev; METAFILEDRV_PDEVICE *physDev;
dprintf_metafile( stddeb, "CloseMetaFile(%04x)\n", hdc ); dprintf_metafile( stddeb, "CloseMetaFile(%04x)\n", hdc );
...@@ -205,18 +205,18 @@ HMETAFILE16 CloseMetaFile16( HDC16 hdc ) ...@@ -205,18 +205,18 @@ HMETAFILE16 CloseMetaFile16( HDC16 hdc )
{ {
hFile = physDev->mh->mtNoParameters; hFile = physDev->mh->mtNoParameters;
physDev->mh->mtNoParameters = 0; physDev->mh->mtNoParameters = 0;
if (_llseek(hFile, 0L, 0) == HFILE_ERROR) if (_llseek32(hFile, 0L, 0) == HFILE_ERROR32)
{ {
DeleteDC32( hdc ); DeleteDC32( hdc );
return 0; return 0;
} }
if (_lwrite32( hFile, (LPSTR)physDev->mh, if (_lwrite32( hFile, (LPSTR)physDev->mh,
sizeof(*physDev->mh)) == HFILE_ERROR) sizeof(*physDev->mh)) == HFILE_ERROR32)
{ {
DeleteDC32( hdc ); DeleteDC32( hdc );
return 0; return 0;
} }
_lclose(hFile); _lclose32(hFile);
} }
/* Now allocate a global handle for the metafile */ /* Now allocate a global handle for the metafile */
......
...@@ -149,23 +149,9 @@ HBITMAP16 WinGCreateBitmap16(HDC16 winDC, BITMAPINFO *header, void **bits) ...@@ -149,23 +149,9 @@ HBITMAP16 WinGCreateBitmap16(HDC16 winDC, BITMAPINFO *header, void **bits)
bmpObjPtr->bitmap.bmHeight, bmpi->biBitCount ); bmpObjPtr->bitmap.bmHeight, bmpi->biBitCount );
if( bmpObjPtr->pixmap ) if( bmpObjPtr->pixmap )
{ {
WORD s; sel = SELECTOR_AllocBlock( p->si.shmaddr, bytes,
if( (sel = AllocSelectorArray( (bytes + 0xFFFF) >> 16 )) ) SEGMENT_DATA, FALSE, FALSE);
{ if (sel) p->bits = PTR_SEG_OFF_TO_SEGPTR(sel,0);
DWORD base = (DWORD)p->si.shmaddr, l;
SetSelectorBase( sel, base );
SetSelectorLimit( sel, bytes );
s = sel;
for( l = 0x10000; l < bytes ; )
{
s += __AHINCR;
SetSelectorBase( s, base + l );
l += 0x10000;
SetSelectorLimit( s, (l < bytes)?0xFFFF:bytes%0x10000);
}
p->bits = MAKELONG(0, sel);
}
else XFreePixmap( display, bmpObjPtr->pixmap ); else XFreePixmap( display, bmpObjPtr->pixmap );
} }
if( !sel ) if( !sel )
......
...@@ -55,6 +55,7 @@ DLLS = \ ...@@ -55,6 +55,7 @@ DLLS = \
SPEC_FILES = $(DLLS:.spec=.s) SPEC_FILES = $(DLLS:.spec=.s)
C_SRCS = \ C_SRCS = \
builtin.c \
dummy.c \ dummy.c \
relay.c \ relay.c \
thunk.c thunk.c
......
...@@ -4,20 +4,20 @@ ...@@ -4,20 +4,20 @@
* Copyright 1996 Alexandre Julliard * Copyright 1996 Alexandre Julliard
*/ */
#ifndef WINELIB #include <assert.h>
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
#include "windows.h" #include "windows.h"
#include "gdi.h" #include "gdi.h"
#include "global.h" #include "global.h"
#include "module.h" #include "module.h"
#include "miscemu.h"
#include "neexe.h" #include "neexe.h"
#include "stackframe.h"
#include "user.h" #include "user.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
/* Built-in modules descriptors */ /* Built-in modules descriptors */
/* Don't change these structures! (see tools/build.c) */ /* Don't change these structures! (see tools/build.c) */
...@@ -166,6 +166,8 @@ static BUILTIN_DLL BuiltinDLLs[] = ...@@ -166,6 +166,8 @@ static BUILTIN_DLL BuiltinDLLs[] =
{ NULL, 0 } { NULL, 0 }
}; };
/* Ordinal number for interrupt 0 handler in WPROCS.DLL */
#define FIRST_INTERRUPT_ORDINAL 100
/*********************************************************************** /***********************************************************************
* BUILTIN_Init * BUILTIN_Init
...@@ -176,15 +178,13 @@ BOOL16 BUILTIN_Init(void) ...@@ -176,15 +178,13 @@ BOOL16 BUILTIN_Init(void)
{ {
BUILTIN_DLL *dll; BUILTIN_DLL *dll;
NE_MODULE *pModule; NE_MODULE *pModule;
WORD vector;
HMODULE16 hModule;
for (dll = BuiltinDLLs; dll->descr; dll++) for (dll = BuiltinDLLs; dll->descr; dll++)
if (dll->flags & DLL_FLAG_ALWAYS_USED) if (dll->flags & DLL_FLAG_ALWAYS_USED)
if (!BUILTIN_LoadModule(dll->descr->name, TRUE)) return FALSE; if (!BUILTIN_LoadModule(dll->descr->name, TRUE)) return FALSE;
/* Initialize KERNEL.178 (__WINFLAGS) with the correct flags value */
MODULE_SetEntryPoint( GetModuleHandle( "KERNEL" ), 178, GetWinFlags() );
/* Set the USER and GDI heap selectors */ /* Set the USER and GDI heap selectors */
pModule = MODULE_GetPtr( GetModuleHandle( "USER" )); pModule = MODULE_GetPtr( GetModuleHandle( "USER" ));
...@@ -192,6 +192,40 @@ BOOL16 BUILTIN_Init(void) ...@@ -192,6 +192,40 @@ BOOL16 BUILTIN_Init(void)
pModule = MODULE_GetPtr( GetModuleHandle( "GDI" )); pModule = MODULE_GetPtr( GetModuleHandle( "GDI" ));
GDI_HeapSel = (NE_SEG_TABLE( pModule ) + pModule->dgroup - 1)->selector; GDI_HeapSel = (NE_SEG_TABLE( pModule ) + pModule->dgroup - 1)->selector;
/* Initialize KERNEL.178 (__WINFLAGS) with the correct flags value */
hModule = GetModuleHandle( "KERNEL" );
MODULE_SetEntryPoint( hModule, 178, GetWinFlags() );
/* Initialize the real-mode selector entry points */
#define SET_ENTRY_POINT(num,addr) \
MODULE_SetEntryPoint( hModule, (num), GLOBAL_CreateBlock( GMEM_FIXED, \
DOSMEM_dosmem+(addr), 0x10000, hModule, \
FALSE, FALSE, FALSE, NULL ))
SET_ENTRY_POINT( 174, 0xa0000 ); /* KERNEL.174: __A000H */
SET_ENTRY_POINT( 181, 0xb0000 ); /* KERNEL.181: __B000H */
SET_ENTRY_POINT( 182, 0xb8000 ); /* KERNEL.182: __B800H */
SET_ENTRY_POINT( 195, 0xc0000 ); /* KERNEL.195: __C000H */
SET_ENTRY_POINT( 179, 0xd0000 ); /* KERNEL.179: __D000H */
SET_ENTRY_POINT( 190, 0xe0000 ); /* KERNEL.190: __E000H */
SET_ENTRY_POINT( 173, 0xf0000 ); /* KERNEL.173: __ROMBIOS */
SET_ENTRY_POINT( 194, 0xf0000 ); /* KERNEL.194: __F000H */
MODULE_SetEntryPoint(hModule,193,DOSMEM_BiosSeg); /* KERNEL.193: __0040H */
#undef SET_ENTRY_POINT
/* Set interrupt vectors from entry points in WPROCS.DLL */
hModule = GetModuleHandle( "WPROCS" );
for (vector = 0; vector < 256; vector++)
{
FARPROC16 proc = MODULE_GetEntryPoint( hModule,
FIRST_INTERRUPT_ORDINAL+vector);
assert(proc);
INT_SetHandler( vector, proc );
}
return TRUE; return TRUE;
} }
...@@ -416,6 +450,20 @@ FARPROC32 BUILTIN_GetProcAddress32( NE_MODULE *pModule, LPCSTR function ) ...@@ -416,6 +450,20 @@ FARPROC32 BUILTIN_GetProcAddress32( NE_MODULE *pModule, LPCSTR function )
} }
/**********************************************************************
* BUILTIN_DefaultIntHandler
*
* Default interrupt handler.
*/
void BUILTIN_DefaultIntHandler( CONTEXT *context )
{
WORD ordinal;
STACK16FRAME *frame = CURRENT_STACK16;
BUILTIN_GetEntryPoint16( frame->entry_cs, frame->entry_ip, &ordinal );
INT_BARF( context, ordinal - FIRST_INTERRUPT_ORDINAL );
}
/*********************************************************************** /***********************************************************************
* BUILTIN_ParseDLLOptions * BUILTIN_ParseDLLOptions
* *
...@@ -475,5 +523,3 @@ void BUILTIN_PrintDLLs(void) ...@@ -475,5 +523,3 @@ void BUILTIN_PrintDLLs(void)
fprintf(stderr,"\n"); fprintf(stderr,"\n");
exit(1); exit(1);
} }
#endif /* WINELIB */
...@@ -70,18 +70,18 @@ type win16 ...@@ -70,18 +70,18 @@ type win16
71 pascal16 DeleteAtom(word) DeleteAtom 71 pascal16 DeleteAtom(word) DeleteAtom
72 pascal16 GetAtomName(word ptr word) GetAtomName 72 pascal16 GetAtomName(word ptr word) GetAtomName
73 pascal16 GetAtomHandle(word) GetAtomHandle 73 pascal16 GetAtomHandle(word) GetAtomHandle
74 pascal16 OpenFile(ptr ptr word) OpenFile 74 pascal16 OpenFile(ptr ptr word) OpenFile16
75 stub OpenPathName 75 stub OpenPathName
76 stub DeletePathName 76 stub DeletePathName
#77 RESERVED1 #77 RESERVED1
#78 RESERVED2 #78 RESERVED2
#79 RESERVED3 #79 RESERVED3
#80 RESERVED4 #80 RESERVED4
81 pascal16 _lclose(word) _lclose 81 pascal16 _lclose(word) _lclose16
82 pascal16 _lread(word segptr word) WIN16_lread 82 pascal16 _lread(word segptr word) WIN16_lread
83 pascal16 _lcreat(ptr word) _lcreat 83 pascal16 _lcreat(ptr word) _lcreat16
84 pascal _llseek(word long word) _llseek 84 pascal _llseek(word long word) _llseek16
85 pascal16 _lopen(ptr word) _lopen 85 pascal16 _lopen(ptr word) _lopen16
86 pascal16 _lwrite(word ptr word) _lwrite16 86 pascal16 _lwrite(word ptr word) _lwrite16
87 pascal16 RESERVED5(ptr ptr) lstrcmp16 87 pascal16 RESERVED5(ptr ptr) lstrcmp16
88 pascal lstrcpy(segptr segptr) lstrcpy16 88 pascal lstrcpy(segptr segptr) lstrcpy16
...@@ -96,7 +96,7 @@ type win16 ...@@ -96,7 +96,7 @@ type win16
97 pascal16 GetTempFileName(byte ptr word ptr) GetTempFileName16 97 pascal16 GetTempFileName(byte ptr word ptr) GetTempFileName16
98 return GetLastDiskChange 0 0 98 return GetLastDiskChange 0 0
99 stub GetLPErrMode 99 stub GetLPErrMode
100 stub ValidateCodeSegments 100 return ValidateCodeSegments 0 0
101 stub NoHookDosCall 101 stub NoHookDosCall
102 register DOS3Call() DOS3Call 102 register DOS3Call() DOS3Call
103 register NetBIOSCall() NetBIOSCall 103 register NetBIOSCall() NetBIOSCall
...@@ -135,7 +135,7 @@ type win16 ...@@ -135,7 +135,7 @@ type win16
134 pascal16 GetWindowsDirectory(ptr word) GetWindowsDirectory16 134 pascal16 GetWindowsDirectory(ptr word) GetWindowsDirectory16
135 pascal16 GetSystemDirectory(ptr word) GetSystemDirectory16 135 pascal16 GetSystemDirectory(ptr word) GetSystemDirectory16
136 pascal16 GetDriveType(byte) GetDriveType16 136 pascal16 GetDriveType(byte) GetDriveType16
137 pascal FatalAppExit(word ptr) FatalAppExit 137 pascal16 FatalAppExit(word ptr) FatalAppExit16
138 pascal GetHeapSpaces(word) GetHeapSpaces 138 pascal GetHeapSpaces(word) GetHeapSpaces
139 stub DoSignal 139 stub DoSignal
140 pascal16 SetSigHandler(segptr ptr ptr word word) SetSigHandler 140 pascal16 SetSigHandler(segptr ptr ptr word word) SetSigHandler
...@@ -146,7 +146,7 @@ type win16 ...@@ -146,7 +146,7 @@ type win16
145 pascal16 RemoveDirectory(ptr) RemoveDirectory16 145 pascal16 RemoveDirectory(ptr) RemoveDirectory16
146 pascal16 DeleteFile(ptr) DeleteFile16 146 pascal16 DeleteFile(ptr) DeleteFile16
147 pascal16 SetLastError(long) SetLastError 147 pascal16 SetLastError(long) SetLastError
148 pascal16 GetLastError() GetLastError 148 pascal GetLastError() GetLastError
149 stub GetVersionEx 149 stub GetVersionEx
150 pascal16 DirectedYield(word) DirectedYield 150 pascal16 DirectedYield(word) DirectedYield
151 stub WinOldApCall 151 stub WinOldApCall
...@@ -163,7 +163,7 @@ type win16 ...@@ -163,7 +163,7 @@ type win16
163 pascal16 GlobalLRUOldest(word) GlobalLRUOldest 163 pascal16 GlobalLRUOldest(word) GlobalLRUOldest
164 pascal16 GlobalLRUNewest(word) GlobalLRUNewest 164 pascal16 GlobalLRUNewest(word) GlobalLRUNewest
165 return A20Proc 2 0 165 return A20Proc 2 0
166 pascal16 WinExec(ptr word) WinExec 166 pascal16 WinExec(ptr word) WinExec16
167 pascal16 GetExpWinVer(word) GetExpWinVer 167 pascal16 GetExpWinVer(word) GetExpWinVer
168 pascal16 DirectResAlloc(word word word) DirectResAlloc 168 pascal16 DirectResAlloc(word word word) DirectResAlloc
169 pascal GetFreeSpace(word) GetFreeSpace 169 pascal GetFreeSpace(word) GetFreeSpace
...@@ -197,7 +197,7 @@ type win16 ...@@ -197,7 +197,7 @@ type win16
197 pascal16 GlobalFix(word) GlobalFix 197 pascal16 GlobalFix(word) GlobalFix
198 pascal16 GlobalUnfix(word) GlobalUnfix 198 pascal16 GlobalUnfix(word) GlobalUnfix
199 pascal16 SetHandleCount(word) SetHandleCount16 199 pascal16 SetHandleCount(word) SetHandleCount16
200 stub ValidateFreeSpaces 200 return ValidateFreeSpaces 0 0
201 stub ReplaceInst 201 stub ReplaceInst
202 stub RegisterPtrace 202 stub RegisterPtrace
203 register DebugBreak() DebugBreak16 203 register DebugBreak() DebugBreak16
...@@ -257,7 +257,7 @@ type win16 ...@@ -257,7 +257,7 @@ type win16
347 pascal16 IsBadHugeWritePtr(segptr long) IsBadHugeWritePtr16 347 pascal16 IsBadHugeWritePtr(segptr long) IsBadHugeWritePtr16
348 pascal16 hmemcpy(ptr ptr long) hmemcpy 348 pascal16 hmemcpy(ptr ptr long) hmemcpy
349 pascal _hread(word segptr long) WIN16_hread 349 pascal _hread(word segptr long) WIN16_hread
350 pascal _hwrite(word ptr long) _hwrite 350 pascal _hwrite(word ptr long) _hwrite16
#351 BUNNY_351 #351 BUNNY_351
352 pascal lstrcatn(segptr segptr word) lstrcatn16 352 pascal lstrcatn(segptr segptr word) lstrcatn16
353 pascal lstrcpyn(segptr segptr word) lstrcpyn16 353 pascal lstrcpyn(segptr segptr word) lstrcpyn16
...@@ -279,8 +279,8 @@ type win16 ...@@ -279,8 +279,8 @@ type win16
417 stub WriteProfileSection 417 stub WriteProfileSection
418 stub GetPrivateProfileSection 418 stub GetPrivateProfileSection
419 stub GetProfileSection 419 stub GetProfileSection
420 stub GetFileAttributes 420 pascal GetFileAttributes(ptr) GetFileAttributes16
421 stub SetFileAttributes 421 pascal16 SetFileAttributes(ptr long) SetFileAttributes16
422 pascal16 GetDiskFreeSpace(ptr ptr ptr ptr ptr) GetDiskFreeSpace16 422 pascal16 GetDiskFreeSpace(ptr ptr ptr ptr ptr) GetDiskFreeSpace16
432 stub FileTimeToLocalFileTime 432 stub FileTimeToLocalFileTime
450 pascal16 KERNEL_450() stub_KERNEL_450 450 pascal16 KERNEL_450() stub_KERNEL_450
......
...@@ -25,7 +25,7 @@ base 1 ...@@ -25,7 +25,7 @@ base 1
0020 stdcall ClearCommBreak(long) ClearCommBreak32 0020 stdcall ClearCommBreak(long) ClearCommBreak32
0021 stdcall ClearCommError(long ptr ptr) ClearCommError 0021 stdcall ClearCommError(long ptr ptr) ClearCommError
0022 stub CloseConsoleHandle 0022 stub CloseConsoleHandle
0023 stdcall CloseHandle(long) CloseHandle 0023 stdcall CloseHandle(long) CloseHandle
0024 stub CloseProfileUserMapping 0024 stub CloseProfileUserMapping
0025 stub CmdBatNotification 0025 stub CmdBatNotification
0026 stub CommConfigDialogA 0026 stub CommConfigDialogA
...@@ -110,8 +110,8 @@ base 1 ...@@ -110,8 +110,8 @@ base 1
0105 stub ExpungeConsoleCommandHistoryA 0105 stub ExpungeConsoleCommandHistoryA
0106 stub ExpungeConsoleCommandHistoryW 0106 stub ExpungeConsoleCommandHistoryW
0107 stub ExtendVirtualBuffer 0107 stub ExtendVirtualBuffer
0108 stub FatalAppExitA 0108 stdcall FatalAppExitA(long ptr) FatalAppExit32A
0109 stub FatalAppExitW 0109 stdcall FatalAppExitW(long ptr) FatalAppExit32W
0110 stub FatalExit 0110 stub FatalExit
0111 stdcall FileTimeToDosDateTime(ptr ptr ptr) FileTimeToDosDateTime 0111 stdcall FileTimeToDosDateTime(ptr ptr ptr) FileTimeToDosDateTime
0112 stdcall FileTimeToLocalFileTime(ptr ptr) FileTimeToLocalFileTime 0112 stdcall FileTimeToLocalFileTime(ptr ptr) FileTimeToLocalFileTime
...@@ -201,9 +201,9 @@ base 1 ...@@ -201,9 +201,9 @@ base 1
0196 stdcall GetCurrentDirectoryA(long ptr) GetCurrentDirectory32A 0196 stdcall GetCurrentDirectoryA(long ptr) GetCurrentDirectory32A
0197 stdcall GetCurrentDirectoryW(long ptr) GetCurrentDirectory32W 0197 stdcall GetCurrentDirectoryW(long ptr) GetCurrentDirectory32W
0198 stdcall GetCurrentProcess() GetCurrentProcess 0198 stdcall GetCurrentProcess() GetCurrentProcess
0199 stdcall GetCurrentProcessId() GetCurrentThreadId 0199 stdcall GetCurrentProcessId() GetCurrentProcessId
0200 stdcall GetCurrentThread() GetCurrentThread 0200 stdcall GetCurrentThread() GetCurrentThread
0201 stdcall GetCurrentThreadId() GetCurrentThreadId 0201 stdcall GetCurrentThreadId() GetCurrentThreadId
0202 stub GetDateFormatA 0202 stub GetDateFormatA
0203 stub GetDateFormatW 0203 stub GetDateFormatW
0204 stub GetDefaultCommConfigA 0204 stub GetDefaultCommConfigA
...@@ -398,7 +398,7 @@ base 1 ...@@ -398,7 +398,7 @@ base 1
0393 stub OpenConsoleW 0393 stub OpenConsoleW
0394 stub OpenEventA 0394 stub OpenEventA
0395 stub OpenEventW 0395 stub OpenEventW
0396 stdcall OpenFile(ptr ptr long) OpenFile 0396 stdcall OpenFile(ptr ptr long) OpenFile32
0397 stdcall OpenFileMappingA(long long ptr) OpenFileMapping 0397 stdcall OpenFileMappingA(long long ptr) OpenFileMapping
0398 stub OpenFileMappingW 0398 stub OpenFileMappingW
0399 stub OpenMutexA 0399 stub OpenMutexA
...@@ -499,7 +499,7 @@ base 1 ...@@ -499,7 +499,7 @@ base 1
0494 stdcall SetHandleCount(long) SetHandleCount32 0494 stdcall SetHandleCount(long) SetHandleCount32
0495 stub SetHandleInformation 0495 stub SetHandleInformation
0496 stub SetLastConsoleEventActive 0496 stub SetLastConsoleEventActive
0497 stdcall SetLastError(long) SetLastError 0497 stdcall SetLastError(long) SetLastError
0498 stub SetLocalTime 0498 stub SetLocalTime
0499 stdcall SetLocaleInfoA(long long ptr) SetLocaleInfoA 0499 stdcall SetLocaleInfoA(long long ptr) SetLocaleInfoA
0500 stub SetLocaleInfoW 0500 stub SetLocaleInfoW
...@@ -533,9 +533,9 @@ base 1 ...@@ -533,9 +533,9 @@ base 1
0528 stub TerminateProcess 0528 stub TerminateProcess
0529 stub TerminateThread 0529 stub TerminateThread
0530 stdcall TlsAlloc() TlsAlloc 0530 stdcall TlsAlloc() TlsAlloc
0531 stdcall TlsFree(long) TlsFree 0531 stdcall TlsFree(long) TlsFree
0532 stdcall TlsGetValue(long) TlsGetValue 0532 stdcall TlsGetValue(long) TlsGetValue
0533 stdcall TlsSetValue(long ptr) TlsSetValue 0533 stdcall TlsSetValue(long ptr) TlsSetValue
0534 stub TransactNamedPipe 0534 stub TransactNamedPipe
0535 stdcall TransmitCommChar(long long) TransmitCommChar32 0535 stdcall TransmitCommChar(long long) TransmitCommChar32
0536 stub TrimVirtualBuffer 0536 stub TrimVirtualBuffer
...@@ -568,7 +568,7 @@ base 1 ...@@ -568,7 +568,7 @@ base 1
0563 stub WaitNamedPipeA 0563 stub WaitNamedPipeA
0564 stub WaitNamedPipeW 0564 stub WaitNamedPipeW
0565 stdcall WideCharToMultiByte(long long ptr long ptr long ptr ptr) WideCharToMultiByte 0565 stdcall WideCharToMultiByte(long long ptr long ptr long ptr ptr) WideCharToMultiByte
0566 stdcall WinExec(ptr long) WinExec 0566 stdcall WinExec(ptr long) WinExec32
0567 stdcall WriteConsoleA(long ptr long ptr ptr) WriteConsole32A 0567 stdcall WriteConsoleA(long ptr long ptr ptr) WriteConsole32A
0568 stub WriteConsoleInputA 0568 stub WriteConsoleInputA
0569 stub WriteConsoleInputVDMA 0569 stub WriteConsoleInputVDMA
...@@ -592,12 +592,12 @@ base 1 ...@@ -592,12 +592,12 @@ base 1
0587 stdcall WriteProfileStringA(ptr ptr ptr) WriteProfileString32A 0587 stdcall WriteProfileStringA(ptr ptr ptr) WriteProfileString32A
0588 stdcall WriteProfileStringW(ptr ptr ptr) WriteProfileString32W 0588 stdcall WriteProfileStringW(ptr ptr ptr) WriteProfileString32W
0589 stub WriteTapemark 0589 stub WriteTapemark
0590 stdcall _hread(long ptr long) _hread 0590 stdcall _hread(long ptr long) _hread32
0591 stdcall _hwrite(long ptr long) _hwrite 0591 stdcall _hwrite(long ptr long) _hwrite32
0592 stdcall _lclose(long) _lclose 0592 stdcall _lclose(long) _lclose32
0593 stdcall _lcreat(ptr long) _lcreat 0593 stdcall _lcreat(ptr long) _lcreat32
0594 stdcall _llseek(long long long) _llseek 0594 stdcall _llseek(long long long) _llseek32
0595 stdcall _lopen(ptr long) _lopen 0595 stdcall _lopen(ptr long) _lopen32
0596 stdcall _lread(long ptr long) _lread32 0596 stdcall _lread(long ptr long) _lread32
0597 stdcall _lwrite(long ptr long) _lwrite32 0597 stdcall _lwrite(long ptr long) _lwrite32
0598 stdcall lstrcat(ptr ptr) lstrcat32A 0598 stdcall lstrcat(ptr ptr) lstrcat32A
......
name lz32 name lz32
type win32 type win32
0 stdcall LZCopy(long long) LZCopy 0 stdcall LZCopy(long long) LZCopy32
1 stdcall LZOpenFileA(ptr ptr long) LZOpenFile32A 1 stdcall LZOpenFileA(ptr ptr long) LZOpenFile32A
2 stdcall LZInit(long) LZInit 2 stdcall LZInit(long) LZInit32
3 stdcall LZSeek(long long long) LZSeek 3 stdcall LZSeek(long long long) LZSeek32
4 stdcall LZRead(long ptr long) LZRead32 4 stdcall LZRead(long ptr long) LZRead32
5 stdcall LZClose(long) LZClose 5 stdcall LZClose(long) LZClose32
6 stdcall LZStart() LZStart 6 stdcall LZStart() LZStart32
7 stdcall CopyLZFile(long long) CopyLZFile 7 stdcall CopyLZFile(long long) CopyLZFile32
8 stdcall LZDone() LZDone 8 stdcall LZDone() LZDone
9 stdcall GetExpandedNameA(ptr ptr) GetExpandedName32A 9 stdcall GetExpandedNameA(ptr ptr) GetExpandedName32A
10 stdcall LZOpenFileW(ptr ptr long) LZOpenFile32W 10 stdcall LZOpenFileW(ptr ptr long) LZOpenFile32W
......
name lzexpand name lzexpand
type win16 type win16
1 pascal LZCopy(word word) LZCopy 1 pascal LZCopy(word word) LZCopy16
2 pascal16 LZOpenFile(ptr ptr word) LZOpenFile16 2 pascal16 LZOpenFile(ptr ptr word) LZOpenFile16
3 pascal16 LZInit(word) LZInit 3 pascal16 LZInit(word) LZInit16
4 pascal LZSeek(word long word) LZSeek 4 pascal LZSeek(word long word) LZSeek16
5 pascal16 LZRead(word segptr word) LZRead16 5 pascal16 LZRead(word ptr word) LZRead16
6 pascal16 LZClose(word) LZClose 6 pascal16 LZClose(word) LZClose16
7 pascal16 LZStart() LZStart 7 pascal16 LZStart() LZStart16
8 pascal CopyLZFile(word word) CopyLZFile 8 pascal CopyLZFile(word word) CopyLZFile16
9 pascal16 LZDone() LZDone 9 pascal16 LZDone() LZDone
10 pascal16 GetExpandedName(ptr ptr) GetExpandedName16 10 pascal16 GetExpandedName(ptr ptr) GetExpandedName16
#11 WEP #11 WEP
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
#include <stdio.h> #include <stdio.h>
#include "windows.h" #include "windows.h"
#include "winnt.h"
#include "global.h" #include "global.h"
#include "module.h" #include "module.h"
#include "registers.h"
#include "stackframe.h" #include "stackframe.h"
#include "task.h" #include "task.h"
#include "stddebug.h" #include "stddebug.h"
...@@ -52,7 +52,7 @@ BOOL32 RELAY_Init(void) ...@@ -52,7 +52,7 @@ BOOL32 RELAY_Init(void)
* RELAY_DebugCallFrom16 * RELAY_DebugCallFrom16
*/ */
void RELAY_DebugCallFrom16( int func_type, char *args, void RELAY_DebugCallFrom16( int func_type, char *args,
void *entry_point, SIGCONTEXT *context ) void *entry_point, CONTEXT *context )
{ {
STACK16FRAME *frame; STACK16FRAME *frame;
WORD ordinal; WORD ordinal;
...@@ -108,25 +108,19 @@ void RELAY_DebugCallFrom16( int func_type, char *args, ...@@ -108,25 +108,19 @@ void RELAY_DebugCallFrom16( int func_type, char *args,
printf( " AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n", printf( " AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n",
AX_reg(context), BX_reg(context), CX_reg(context), AX_reg(context), BX_reg(context), CX_reg(context),
DX_reg(context), SI_reg(context), DI_reg(context), DX_reg(context), SI_reg(context), DI_reg(context),
ES_reg(context), EFL_reg(context) ); (WORD)ES_reg(context), EFL_reg(context) );
} }
/*********************************************************************** /***********************************************************************
* RELAY_DebugCallFrom16Ret * RELAY_DebugCallFrom16Ret
*/ */
void RELAY_DebugCallFrom16Ret( int func_type, int ret_val, SIGCONTEXT *context) void RELAY_DebugCallFrom16Ret( int func_type, int ret_val, CONTEXT *context)
{ {
STACK16FRAME *frame; STACK16FRAME *frame;
WORD ordinal; WORD ordinal;
if (*(DWORD *)PTR_SEG_TO_LIN(IF1632_Stack32_base) != 0xDEADBEEF)
{
fprintf(stderr, "Wine wrote past the end of the 32 bit stack. Please report this.\n");
exit(1); /* There's probably no point in going on */
}
if (!debugging_relay) return; if (!debugging_relay) return;
frame = CURRENT_STACK16; frame = CURRENT_STACK16;
printf( "Ret %s() ", BUILTIN_GetEntryPoint16( frame->entry_cs, printf( "Ret %s() ", BUILTIN_GetEntryPoint16( frame->entry_cs,
frame->entry_ip, frame->entry_ip,
...@@ -147,7 +141,7 @@ void RELAY_DebugCallFrom16Ret( int func_type, int ret_val, SIGCONTEXT *context) ...@@ -147,7 +141,7 @@ void RELAY_DebugCallFrom16Ret( int func_type, int ret_val, SIGCONTEXT *context)
printf( " AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n", printf( " AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n",
AX_reg(context), BX_reg(context), CX_reg(context), AX_reg(context), BX_reg(context), CX_reg(context),
DX_reg(context), SI_reg(context), DI_reg(context), DX_reg(context), SI_reg(context), DI_reg(context),
ES_reg(context), EFL_reg(context) ); (WORD)ES_reg(context), EFL_reg(context) );
break; break;
} }
} }
......
...@@ -14,8 +14,8 @@ type win16 ...@@ -14,8 +14,8 @@ type win16
13 pascal16 DragQueryPoint(word ptr) DragQueryPoint 13 pascal16 DragQueryPoint(word ptr) DragQueryPoint
20 pascal16 ShellExecute(word ptr ptr ptr ptr s_word) ShellExecute 20 pascal16 ShellExecute(word ptr ptr ptr ptr s_word) ShellExecute
21 pascal16 FindExecutable(ptr ptr ptr) FindExecutable 21 pascal16 FindExecutable(ptr ptr ptr) FindExecutable
22 pascal16 ShellAbout(word ptr ptr word) ShellAbout 22 pascal16 ShellAbout(word ptr ptr word) ShellAbout16
33 pascal16 AboutDlgProc(word word word long) AboutDlgProc 33 pascal16 AboutDlgProc(word word word long) AboutDlgProc16
34 pascal16 ExtractIcon(word ptr s_word) ExtractIcon 34 pascal16 ExtractIcon(word ptr s_word) ExtractIcon
36 pascal16 ExtractAssociatedIcon(word ptr ptr) ExtractAssociatedIcon 36 pascal16 ExtractAssociatedIcon(word ptr ptr) ExtractAssociatedIcon
37 pascal DoEnvironmentSubst(ptr word) DoEnvironmentSubst 37 pascal DoEnvironmentSubst(ptr word) DoEnvironmentSubst
......
...@@ -84,7 +84,7 @@ base 1 ...@@ -84,7 +84,7 @@ base 1
0079 stub SheSetCurDrive 0079 stub SheSetCurDrive
0080 stub SheShortenPathA 0080 stub SheShortenPathA
0081 stub SheShortenPathW 0081 stub SheShortenPathW
0082 stdcall ShellAboutA(long ptr ptr long) ShellAbout 0082 stdcall ShellAboutA(long ptr ptr long) ShellAbout32A
0083 stdcall ShellAboutW(long ptr ptr long) ShellAbout32W 0083 stdcall ShellAboutW(long ptr ptr long) ShellAbout32W
0084 stdcall ShellExecuteA(long ptr ptr ptr ptr long) ShellExecute 0084 stdcall ShellExecuteA(long ptr ptr ptr ptr long) ShellExecute
0085 stub ShellExecuteEx 0085 stub ShellExecuteEx
......
...@@ -8,7 +8,7 @@ heap 65520 ...@@ -8,7 +8,7 @@ heap 65520
4 stub DisableOEMLayer 4 stub DisableOEMLayer
5 pascal16 InitApp(word) InitApp 5 pascal16 InitApp(word) InitApp
6 pascal16 PostQuitMessage(word) PostQuitMessage 6 pascal16 PostQuitMessage(word) PostQuitMessage
7 pascal16 ExitWindows(long word) ExitWindows 7 pascal16 ExitWindows(long word) ExitWindows16
10 pascal16 SetTimer(word word word segptr) SetTimer16 10 pascal16 SetTimer(word word word segptr) SetTimer16
11 pascal16 SetSystemTimer(word word word segptr) SetSystemTimer16 11 pascal16 SetSystemTimer(word word word segptr) SetSystemTimer16
12 pascal16 KillTimer(word word) KillTimer16 12 pascal16 KillTimer(word word) KillTimer16
...@@ -125,9 +125,9 @@ heap 65520 ...@@ -125,9 +125,9 @@ heap 65520
123 pascal16 CallMsgFilter(segptr s_word) CallMsgFilter16 123 pascal16 CallMsgFilter(segptr s_word) CallMsgFilter16
124 pascal16 UpdateWindow(word) UpdateWindow 124 pascal16 UpdateWindow(word) UpdateWindow
125 pascal16 InvalidateRect(word ptr word) InvalidateRect16 125 pascal16 InvalidateRect(word ptr word) InvalidateRect16
126 pascal16 InvalidateRgn(word word word) InvalidateRgn 126 pascal16 InvalidateRgn(word word word) InvalidateRgn16
127 pascal16 ValidateRect(word ptr) ValidateRect16 127 pascal16 ValidateRect(word ptr) ValidateRect16
128 pascal16 ValidateRgn(word word) ValidateRgn 128 pascal16 ValidateRgn(word word) ValidateRgn16
129 pascal16 GetClassWord(word s_word) GetClassWord 129 pascal16 GetClassWord(word s_word) GetClassWord
130 pascal16 SetClassWord(word s_word word) SetClassWord 130 pascal16 SetClassWord(word s_word word) SetClassWord
131 pascal GetClassLong(word s_word) GetClassLong16 131 pascal GetClassLong(word s_word) GetClassLong16
...@@ -170,7 +170,7 @@ heap 65520 ...@@ -170,7 +170,7 @@ heap 65520
168 pascal16 SetCaretBlinkTime(word) SetCaretBlinkTime 168 pascal16 SetCaretBlinkTime(word) SetCaretBlinkTime
169 pascal16 GetCaretBlinkTime() GetCaretBlinkTime16 169 pascal16 GetCaretBlinkTime() GetCaretBlinkTime16
170 pascal16 ArrangeIconicWindows(word) ArrangeIconicWindows 170 pascal16 ArrangeIconicWindows(word) ArrangeIconicWindows
171 pascal16 WinHelp(word ptr word long) WinHelp 171 pascal16 WinHelp(word ptr word long) WinHelp16
172 stub SwitchToThisWindow 172 stub SwitchToThisWindow
173 pascal16 LoadCursor(word segptr) LoadCursor16 173 pascal16 LoadCursor(word segptr) LoadCursor16
174 pascal16 LoadIcon(word segptr) LoadIcon16 174 pascal16 LoadIcon(word segptr) LoadIcon16
......
...@@ -199,7 +199,7 @@ base 1 ...@@ -199,7 +199,7 @@ base 1
0192 stdcall EnumWindows(ptr long) THUNK_EnumWindows32 0192 stdcall EnumWindows(ptr long) THUNK_EnumWindows32
0193 stdcall EqualRect(ptr ptr) EqualRect32 0193 stdcall EqualRect(ptr ptr) EqualRect32
0194 stdcall ExcludeUpdateRgn(long long) ExcludeUpdateRgn 0194 stdcall ExcludeUpdateRgn(long long) ExcludeUpdateRgn
0195 stub ExitWindowsEx 0195 stdcall ExitWindowsEx(long long) ExitWindowsEx
0196 stdcall FillRect(long ptr long) FillRect32 0196 stdcall FillRect(long ptr long) FillRect32
0197 stdcall FindWindowA(ptr ptr) FindWindow32A 0197 stdcall FindWindowA(ptr ptr) FindWindow32A
0198 stdcall FindWindowExA(long long ptr ptr) FindWindowEx32A 0198 stdcall FindWindowExA(long long ptr ptr) FindWindowEx32A
...@@ -332,7 +332,7 @@ base 1 ...@@ -332,7 +332,7 @@ base 1
0325 stub InternalGetWindowText 0325 stub InternalGetWindowText
0326 stdcall IntersectRect(ptr ptr ptr) IntersectRect32 0326 stdcall IntersectRect(ptr ptr ptr) IntersectRect32
0327 stdcall InvalidateRect(long ptr long) InvalidateRect32 0327 stdcall InvalidateRect(long ptr long) InvalidateRect32
0328 stdcall InvalidateRgn(long long long) InvalidateRgn 0328 stdcall InvalidateRgn(long long long) InvalidateRgn32
0329 stdcall InvertRect(long ptr) InvertRect32 0329 stdcall InvertRect(long ptr) InvertRect32
0330 stdcall IsCharAlphaA(long) IsCharAlpha32A 0330 stdcall IsCharAlphaA(long) IsCharAlpha32A
0331 stdcall IsCharAlphaNumericA(long) IsCharAlphaNumeric32A 0331 stdcall IsCharAlphaNumericA(long) IsCharAlphaNumeric32A
...@@ -553,7 +553,7 @@ base 1 ...@@ -553,7 +553,7 @@ base 1
0546 stub ToAsciiEx 0546 stub ToAsciiEx
0547 stub ToUnicode 0547 stub ToUnicode
0548 stdcall TrackPopupMenu(long long long long long long ptr) TrackPopupMenu32 0548 stdcall TrackPopupMenu(long long long long long long ptr) TrackPopupMenu32
0549 stub TrackPopupMenuEx 0549 stdcall TrackPopupMenuEx(long long long long long ptr) TrackPopupMenuEx
0550 stdcall TranslateAccelerator(long long ptr) TranslateAccelerator 0550 stdcall TranslateAccelerator(long long ptr) TranslateAccelerator
0551 stdcall TranslateAcceleratorA(long long ptr) TranslateAccelerator 0551 stdcall TranslateAcceleratorA(long long ptr) TranslateAccelerator
0552 stdcall TranslateAcceleratorW(long long ptr) TranslateAccelerator 0552 stdcall TranslateAcceleratorW(long long ptr) TranslateAccelerator
...@@ -575,15 +575,15 @@ base 1 ...@@ -575,15 +575,15 @@ base 1
0568 stub UserRealizePalette 0568 stub UserRealizePalette
0569 stub UserRegisterWowHandlers 0569 stub UserRegisterWowHandlers
0570 stdcall ValidateRect(long ptr) ValidateRect32 0570 stdcall ValidateRect(long ptr) ValidateRect32
0571 stdcall ValidateRgn(long long) ValidateRgn 0571 stdcall ValidateRgn(long long) ValidateRgn32
0572 stdcall VkKeyScanA(long) VkKeyScan 0572 stdcall VkKeyScanA(long) VkKeyScan
0573 stub VkKeyScanExA 0573 stub VkKeyScanExA
0574 stub VkKeyScanExW 0574 stub VkKeyScanExW
0575 stub VkKeyScanW 0575 stub VkKeyScanW
0576 stub WaitForInputIdle 0576 stub WaitForInputIdle
0577 stub WaitMessage 0577 stub WaitMessage
0578 stdcall WinHelpA(long ptr long long) WIN32_WinHelpA 0578 stdcall WinHelpA(long ptr long long) WinHelp32A
0579 stub WinHelpW 0579 stdcall WinHelpW(long ptr long long) WinHelp32W
0580 stdcall WindowFromDC(long) WindowFromDC32 0580 stdcall WindowFromDC(long) WindowFromDC32
0581 stdcall WindowFromPoint(long long) WindowFromPoint32 0581 stdcall WindowFromPoint(long long) WindowFromPoint32
0582 stub keybd_event 0582 stub keybd_event
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <X11/extensions/XShm.h> #include <X11/extensions/XShm.h>
#include "gdi.h" #include "gdi.h"
#include "xmalloc.h"
#ifdef PRELIMINARY_WING16_SUPPORT #ifdef PRELIMINARY_WING16_SUPPORT
......
...@@ -277,12 +277,12 @@ typedef DEVNAMES * LPDEVNAMES; ...@@ -277,12 +277,12 @@ typedef DEVNAMES * LPDEVNAMES;
BOOL ChooseColor(LPCHOOSECOLOR lpChCol); BOOL ChooseColor(LPCHOOSECOLOR lpChCol);
DWORD CommDlgExtendedError(void); DWORD CommDlgExtendedError(void);
BOOL FindText( SEGPTR find); HWND16 FindText( SEGPTR find);
short GetFileTitle(LPCSTR lpFile, LPSTR lpTitle, UINT cbBuf); short GetFileTitle(LPCSTR lpFile, LPSTR lpTitle, UINT cbBuf);
BOOL GetOpenFileName(SEGPTR ofn); BOOL GetOpenFileName(SEGPTR ofn);
BOOL GetSaveFileName(SEGPTR ofn); BOOL GetSaveFileName(SEGPTR ofn);
BOOL PrintDlg( SEGPTR print); BOOL PrintDlg( SEGPTR print);
BOOL ReplaceText( SEGPTR find); HWND16 ReplaceText( SEGPTR find);
BOOL ChooseFont(LPCHOOSEFONT lpChFont); BOOL ChooseFont(LPCHOOSEFONT lpChFont);
LRESULT FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM16 wParam, LPARAM lParam); LRESULT FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM16 wParam, LPARAM lParam);
......
...@@ -3,16 +3,6 @@ ...@@ -3,16 +3,6 @@
#define stddeb stdout #define stddeb stdout
#define stdnimp stdout #define stdnimp stdout
#ifdef DEBUG_RUNTIME
#define api_assert(name,test) if (test) ; else \
{ \
fprintf(stddeb,"API assertion failed for %s: %s\n", name, #test); \
abort(); \
}
#else
#define api_assert(name,test) ;
#endif
/* Do not remove this line or change anything below this line */ /* Do not remove this line or change anything below this line */
#ifdef DEBUG_NONE_EXT #ifdef DEBUG_NONE_EXT
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
#ifndef __WINE_DEBUGGER_H #ifndef __WINE_DEBUGGER_H
#define __WINE_DEBUGGER_H #define __WINE_DEBUGGER_H
#include "ldt.h" #include "winnt.h"
#include "registers.h" #include "selectors.h"
#include "sigcontext.h"
#include "pe_image.h" #include "pe_image.h"
#define STEP_FLAG 0x100 /* single step flag */ #define STEP_FLAG 0x100 /* single step flag */
...@@ -101,7 +101,7 @@ enum exec_mode ...@@ -101,7 +101,7 @@ enum exec_mode
EXEC_STEP_INSTR /* Single-stepping an instruction */ EXEC_STEP_INSTR /* Single-stepping an instruction */
}; };
extern SIGCONTEXT *DEBUG_context; /* debugger/registers.c */ extern CONTEXT DEBUG_context; /* debugger/registers.c */
extern unsigned int dbg_mode; extern unsigned int dbg_mode;
/* debugger/break.c */ /* debugger/break.c */
...@@ -111,10 +111,9 @@ extern void DEBUG_AddBreakpoint( const DBG_ADDR *addr ); ...@@ -111,10 +111,9 @@ extern void DEBUG_AddBreakpoint( const DBG_ADDR *addr );
extern void DEBUG_DelBreakpoint( int num ); extern void DEBUG_DelBreakpoint( int num );
extern void DEBUG_EnableBreakpoint( int num, BOOL32 enable ); extern void DEBUG_EnableBreakpoint( int num, BOOL32 enable );
extern void DEBUG_InfoBreakpoints(void); extern void DEBUG_InfoBreakpoints(void);
extern BOOL32 DEBUG_HandleTrap( SIGCONTEXT *context ); extern BOOL32 DEBUG_HandleTrap(void);
extern BOOL32 DEBUG_ShouldContinue( SIGCONTEXT *context, enum exec_mode mode ); extern BOOL32 DEBUG_ShouldContinue( enum exec_mode mode );
extern void DEBUG_RestartExecution( SIGCONTEXT *context, enum exec_mode mode, extern void DEBUG_RestartExecution( enum exec_mode mode, int instr_len );
int instr_len );
/* debugger/db_disasm.c */ /* debugger/db_disasm.c */
extern void DEBUG_Disasm( DBG_ADDR *addr ); extern void DEBUG_Disasm( DBG_ADDR *addr );
...@@ -163,6 +162,8 @@ extern void DEBUG_SetRegister( enum debug_regs reg, int val ); ...@@ -163,6 +162,8 @@ extern void DEBUG_SetRegister( enum debug_regs reg, int val );
extern int DEBUG_GetRegister( enum debug_regs reg ); extern int DEBUG_GetRegister( enum debug_regs reg );
extern void DEBUG_InfoRegisters(void); extern void DEBUG_InfoRegisters(void);
extern BOOL32 DEBUG_ValidateRegisters(void); extern BOOL32 DEBUG_ValidateRegisters(void);
extern void DEBUG_SetSigContext( const SIGCONTEXT *sigcontext );
extern void DEBUG_GetSigContext( SIGCONTEXT *sigcontext );
/* debugger/stack.c */ /* debugger/stack.c */
extern void DEBUG_InfoStack(void); extern void DEBUG_InfoStack(void);
......
...@@ -38,5 +38,10 @@ typedef struct ...@@ -38,5 +38,10 @@ typedef struct
#pragma pack(4) #pragma pack(4)
extern BOOL32 DIALOG_Init(void); extern BOOL32 DIALOG_Init(void);
extern HWND32 DIALOG_CreateIndirect( HINSTANCE32 hInst, LPCSTR dlgTemplate,
BOOL32 win32Template, HWND32 owner,
DLGPROC16 dlgProc, LPARAM param,
WINDOWPROCTYPE procType );
extern INT32 DIALOG_DoDialogBox( HWND32 hwnd, HWND32 owner );
#endif /* DIALOG_H */ #endif /* DIALOG_H */
/*
* DOS directory handling declarations
*
* Copyright 1996 Alexandre Julliard
*/
#ifndef __WINE_DIRECTORY_H
#define __WINE_DIRECTORY_H
extern int DIR_Init(void);
extern UINT32 DIR_GetWindowsUnixDir( LPSTR path, UINT32 count );
extern UINT32 DIR_GetSystemUnixDir( LPSTR path, UINT32 count );
extern UINT32 DIR_GetTempUnixDir( LPSTR path, UINT32 count );
extern UINT32 DIR_GetDosPath( INT32 element, LPSTR path, UINT32 count );
extern UINT32 DIR_GetUnixPath( INT32 element, LPSTR path, UINT32 count );
#endif /* __WINE_DIRECTORY_H */
...@@ -8,21 +8,10 @@ ...@@ -8,21 +8,10 @@
#define __WINE_DOS_FS_H #define __WINE_DOS_FS_H
#include <time.h> #include <time.h>
#include "wintypes.h" #include "windows.h"
#define MAX_FILENAME_LEN 256
#define MAX_PATHNAME_LEN 1024 #define MAX_PATHNAME_LEN 1024
typedef struct
{
char name[12]; /* File name in FCB format */
char unixname[MAX_FILENAME_LEN]; /* Unix file name */
DWORD size; /* File size in bytes */
WORD date; /* File date in DOS format */
WORD time; /* File time in DOS format */
BYTE attr; /* File DOS attributes */
} DOS_DIRENT;
#define IS_END_OF_NAME(ch) (!(ch) || ((ch) == '/') || ((ch) == '\\')) #define IS_END_OF_NAME(ch) (!(ch) || ((ch) == '/') || ((ch) == '\\'))
extern void DOSFS_ToDosDateTime( time_t unixtime, WORD *pDate, WORD *pTime ); extern void DOSFS_ToDosDateTime( time_t unixtime, WORD *pDate, WORD *pTime );
...@@ -30,17 +19,16 @@ extern time_t DOSFS_DosDateTimeToUnixTime(WORD,WORD); ...@@ -30,17 +19,16 @@ extern time_t DOSFS_DosDateTimeToUnixTime(WORD,WORD);
extern const char *DOSFS_ToDosFCBFormat( const char *name ); extern const char *DOSFS_ToDosFCBFormat( const char *name );
extern const char *DOSFS_ToDosDTAFormat( const char *name ); extern const char *DOSFS_ToDosDTAFormat( const char *name );
extern const char *DOSFS_IsDevice( const char *name ); extern const char *DOSFS_IsDevice( const char *name );
extern BOOL32 DOSFS_FindUnixName( const char *path, const char *name,
char *buffer, int maxlen,
UINT32 drive_flags );
extern const char * DOSFS_GetUnixFileName( const char * name, int check_last ); extern const char * DOSFS_GetUnixFileName( const char * name, int check_last );
extern const char * DOSFS_GetDosTrueName( const char *name, int unix_format ); extern const char * DOSFS_GetDosTrueName( const char *name, int unix_format );
extern int DOSFS_GetDosFileName( const char *name, char *buffer, int len ); extern int DOSFS_GetDosFileName( const char *name, char *buffer, int len );
extern time_t DOSFS_FileTimeToUnixTime(LPFILETIME ft); extern time_t DOSFS_FileTimeToUnixTime( const FILETIME *ft );
extern void DOSFS_UnixTimeToFileTime(time_t unixtime,LPFILETIME ft); extern void DOSFS_UnixTimeToFileTime(time_t unixtime,LPFILETIME ft);
extern int DOSFS_FindNext( const char *path, const char *short_mask, extern int DOSFS_FindNext( const char *path, const char *short_mask,
const char *long_mask, int drive, BYTE attr, const char *long_mask, int drive, BYTE attr,
int skip, DOS_DIRENT *entry ); int skip, WIN32_FIND_DATA32A *entry );
extern int DOS_GetFreeSpace(int drive, long *size, long *available);
extern char *WineIniFileName(void);
#endif /* __WINE_DOS_FS_H */ #endif /* __WINE_DOS_FS_H */
...@@ -6,8 +6,7 @@ ...@@ -6,8 +6,7 @@
#ifndef __WINE_EXCEPT_H #ifndef __WINE_EXCEPT_H
#define __WINE_EXCEPT_H #define __WINE_EXCEPT_H
#include "wintypes.h" #include "winnt.h"
#include "registers.h"
/* /*
* exception codes * exception codes
*/ */
......
...@@ -8,21 +8,28 @@ ...@@ -8,21 +8,28 @@
#define __WINE_FILE_H #define __WINE_FILE_H
#include "windows.h" #include "windows.h"
#include "handle32.h"
/* files/file.c */
extern void FILE_Destroy( K32OBJ *ptr );
extern void FILE_SetDosError(void); extern void FILE_SetDosError(void);
extern void FILE_CloseAllFiles( HANDLE16 hPDB ); extern HFILE32 FILE_DupUnixHandle( int fd );
extern HFILE FILE_DupUnixHandle( int fd ); extern BOOL32 FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info );
extern int FILE_Stat( LPCSTR unixName, BYTE *pattr, DWORD *psize, extern HFILE32 FILE_Dup( HFILE32 hFile );
WORD *pdate, WORD *ptime ); extern HFILE32 FILE_Dup2( HFILE32 hFile1, HFILE32 hFile2 );
extern int FILE_GetDateTime( HFILE hFile, WORD *pdate, WORD *ptime, extern HFILE32 FILE_Open( LPCSTR path, INT32 mode );
BOOL32 refresh ); extern BOOL32 FILE_SetFileType( HFILE32 hFile, DWORD type );
extern int FILE_SetDateTime( HFILE hFile, WORD date, WORD time ); extern HFILE32 _lcreat_uniq( LPCSTR path, INT32 attr );
extern int FILE_Fstat( HFILE hFile, BYTE *pattr, DWORD *psize,
WORD *pdate, WORD *ptime ); /* files/directory.c */
extern HFILE FILE_Dup( HFILE hFile ); extern int DIR_Init(void);
extern HFILE FILE_Dup2( HFILE hFile1, HFILE hFile2 ); extern UINT32 DIR_GetWindowsUnixDir( LPSTR path, UINT32 count );
extern HFILE FILE_Open( LPCSTR path, INT32 mode ); extern UINT32 DIR_GetSystemUnixDir( LPSTR path, UINT32 count );
extern BOOL32 FILE_SetFileType( HFILE hFile, DWORD type ); extern UINT32 DIR_GetTempUnixDir( LPSTR path, UINT32 count );
extern HFILE _lcreat_uniq( LPCSTR path, INT32 attr ); extern UINT32 DIR_GetDosPath( INT32 element, LPSTR path, UINT32 count );
extern UINT32 DIR_GetUnixPath( INT32 element, LPSTR path, UINT32 count );
extern DWORD DIR_SearchPath( LPCSTR path, LPCSTR name, LPCSTR ext,
DWORD buflen, LPSTR buffer, LPSTR *lastpart,
BOOL32 win32 );
#endif /* __WINE_FILE_H */ #endif /* __WINE_FILE_H */
/*
* KERNEL32 objects
*
* Copyright 1996 Alexandre Julliard
*/
#ifndef __WINE_HANDLE32_H #ifndef __WINE_HANDLE32_H
#define __WINE_HANDLE32_H #define __WINE_HANDLE32_H
#include <stdlib.h>
#include "wintypes.h" #include "wintypes.h"
/* Object types */
typedef enum
{
K32OBJ_UNKNOWN = 0,
K32OBJ_SEMAPHORE,
K32OBJ_EVENT,
K32OBJ_MUTEX,
K32OBJ_CRITICAL_SECTION,
K32OBJ_PROCESS,
K32OBJ_THREAD,
K32OBJ_FILE,
K32OBJ_CHANGE,
K32OBJ_CONSOLE,
K32OBJ_SCREEN_BUFFER,
K32OBJ_MEM_MAPPED_FILE,
K32OBJ_SERIAL,
K32OBJ_DEVICE_IOCTL,
K32OBJ_PIPE,
K32OBJ_MAILSLOT,
K32OBJ_TOOLHELP_SNAPSHOT,
K32OBJ_SOCKET,
K32OBJ_NBOBJECTS
} K32OBJ_TYPE;
/* Kernel object */
typedef struct
{
K32OBJ_TYPE type;
DWORD refcount;
} K32OBJ;
extern void K32OBJ_IncCount( K32OBJ *ptr );
extern void K32OBJ_DecCount( K32OBJ *ptr );
/* The _*_OBJECT structures contain information needed about each /* The _*_OBJECT structures contain information needed about each
* particular type of handle. This information is a combination of * particular type of handle. This information is a combination of
* equivalent UNIX-style handles/descriptors and general information * equivalent UNIX-style handles/descriptors and general information
...@@ -17,63 +57,6 @@ typedef struct { ...@@ -17,63 +57,6 @@ typedef struct {
unsigned long magic; unsigned long magic;
} KERNEL_OBJECT; } KERNEL_OBJECT;
typedef struct {
KERNEL_OBJECT common;
unsigned long thread_id;
unsigned long process_id;
} THREAD_OBJECT;
typedef struct {
KERNEL_OBJECT common;
unsigned long process_id;
unsigned long main_thread_id;
} PROCESS_OBJECT;
typedef struct {
KERNEL_OBJECT common;
HFILE hfile;
int prot;
unsigned long size;
} FILEMAP_OBJECT;
typedef struct {
KERNEL_OBJECT common;
} SEMAPHORE_OBJECT;
typedef struct {
KERNEL_OBJECT common;
} EVENT_OBJECT;
/* Should this even be here?
*/
typedef struct {
KERNEL_OBJECT common;
} REGKEY_OBJECT;
typedef struct _VRANGE_OBJECT{
KERNEL_OBJECT common;
DWORD start;
DWORD size;
struct _VRANGE_OBJECT *next;
} VRANGE_OBJECT;
struct _HEAPITEM_OBJECT;
typedef struct{
KERNEL_OBJECT common;
LPVOID start;
DWORD size;
DWORD maximum;
DWORD flags;
struct _HEAPITEM_OBJECT *first,*last;
} HEAP_OBJECT;
typedef struct _HEAPITEM_OBJECT{
KERNEL_OBJECT common;
HEAP_OBJECT *heap;
DWORD size; /* size including header */
struct _HEAPITEM_OBJECT *next,*prev;
} HEAPITEM_OBJECT;
/* Object number definitions. These numbers are used to /* Object number definitions. These numbers are used to
* validate the kernel object by comparison against the * validate the kernel object by comparison against the
...@@ -101,8 +84,4 @@ int ValidateKernelObject(KERNEL_OBJECT *ptr); ...@@ -101,8 +84,4 @@ int ValidateKernelObject(KERNEL_OBJECT *ptr);
#define CreateKernelObject(size) (malloc(size)) #define CreateKernelObject(size) (malloc(size))
#define ReleaseKernelObject(ptr) (free(ptr)) #define ReleaseKernelObject(ptr) (free(ptr))
/* Prototypes for the Close*Handle functions
*/
int CloseFileHandle(HFILE hFile);
#endif /* __WINE_HANDLE32_H */ #endif /* __WINE_HANDLE32_H */
...@@ -15,6 +15,7 @@ extern HANDLE32 SegptrHeap; ...@@ -15,6 +15,7 @@ extern HANDLE32 SegptrHeap;
extern int HEAP_IsInsideHeap( HANDLE32 heap, DWORD flags, LPCVOID ptr ); extern int HEAP_IsInsideHeap( HANDLE32 heap, DWORD flags, LPCVOID ptr );
extern SEGPTR HEAP_GetSegptr( HANDLE32 heap, DWORD flags, LPCVOID ptr ); extern SEGPTR HEAP_GetSegptr( HANDLE32 heap, DWORD flags, LPCVOID ptr );
extern LPVOID HEAP_xalloc( HANDLE32 heap, DWORD flags, DWORD size );
extern LPSTR HEAP_strdupA( HANDLE32 heap, DWORD flags, LPCSTR str ); extern LPSTR HEAP_strdupA( HANDLE32 heap, DWORD flags, LPCSTR str );
extern LPWSTR HEAP_strdupW( HANDLE32 heap, DWORD flags, LPCWSTR str ); extern LPWSTR HEAP_strdupW( HANDLE32 heap, DWORD flags, LPCWSTR str );
extern LPWSTR HEAP_strdupAtoW( HANDLE32 heap, DWORD flags, LPCSTR str ); extern LPWSTR HEAP_strdupAtoW( HANDLE32 heap, DWORD flags, LPCSTR str );
......
...@@ -10,8 +10,8 @@ extern HMENU16 MENU_GetDefSysMenu(void); ...@@ -10,8 +10,8 @@ extern HMENU16 MENU_GetDefSysMenu(void);
extern void MENU_InitSysMenuPopup(HMENU16 hmenu, DWORD style, DWORD clsStyle); extern void MENU_InitSysMenuPopup(HMENU16 hmenu, DWORD style, DWORD clsStyle);
extern UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth, extern UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth,
int orgX, int orgY ); int orgX, int orgY );
extern void MENU_TrackMouseMenuBar( HWND hwnd, POINT16 pt ); extern void MENU_TrackMouseMenuBar( WND* , INT16 ht, POINT16 pt );
extern void MENU_TrackKbdMenuBar( WND*, UINT wParam, INT vkey); extern void MENU_TrackKbdMenuBar( WND*, UINT16 wParam, INT16 vkey);
extern UINT MENU_DrawMenuBar( HDC32 hDC, LPRECT16 lprect, extern UINT MENU_DrawMenuBar( HDC32 hDC, LPRECT16 lprect,
HWND hwnd, BOOL suppress_draw ); HWND hwnd, BOOL suppress_draw );
extern LRESULT PopupMenuWndProc( HWND hwnd, UINT message, extern LRESULT PopupMenuWndProc( HWND hwnd, UINT message,
......
...@@ -33,5 +33,7 @@ extern void EVENT_ProcessEvent( XEvent *event ); ...@@ -33,5 +33,7 @@ extern void EVENT_ProcessEvent( XEvent *event );
extern void EVENT_RegisterWindow( WND *pWnd ); extern void EVENT_RegisterWindow( WND *pWnd );
extern void EVENT_DestroyWindow( WND *pWnd ); extern void EVENT_DestroyWindow( WND *pWnd );
extern void EVENT_DummyMotionNotify(void); extern void EVENT_DummyMotionNotify(void);
extern HWND32 EVENT_Capture( HWND32, INT16 );
extern INT16 EVENT_GetCaptureInfo(void);
#endif /* __WINE_MESSAGE_H */ #endif /* __WINE_MESSAGE_H */
...@@ -8,38 +8,35 @@ ...@@ -8,38 +8,35 @@
#define __WINE_MISCEMU_H #define __WINE_MISCEMU_H
#include <stdio.h> #include <stdio.h>
#include "wintypes.h" #include "winnt.h"
#include "registers.h"
/* miscemu/dosmem.c */ /* miscemu/dosmem.c */
extern BOOL32 DOSMEM_Init(void); extern BOOL32 DOSMEM_Init(void);
extern void DOSMEM_Tick(void); extern void DOSMEM_Tick(void);
extern void DOSMEM_FillBiosSegment(void); extern void DOSMEM_FillBiosSegment(void);
extern HANDLE16 DOSMEM_BiosSeg;
extern void DOSMEM_InitMemoryHandling(); extern void DOSMEM_InitMemoryHandling();
extern LPVOID DOSMEM_RealMode2Linear(DWORD); extern LPVOID DOSMEM_RealMode2Linear(DWORD);
extern WORD DOSMEM_AllocSelector(WORD); extern WORD DOSMEM_AllocSelector(WORD);
extern HANDLE16 DOSMEM_BiosSeg;
extern char *DOSMEM_dosmem;
extern DWORD DOSMEM_CollateTable; extern DWORD DOSMEM_CollateTable;
extern void DOSMEM_InitCollateTable();
/* miscemu/instr.c */ /* miscemu/interrupts.c */
extern BOOL32 INSTR_EmulateInstruction( SIGCONTEXT *context );
/* miscemu/interrupts.c */
extern BOOL32 INT_Init(void); extern BOOL32 INT_Init(void);
/* msdos/interrupts.c */
extern FARPROC16 INT_GetHandler( BYTE intnum ); extern FARPROC16 INT_GetHandler( BYTE intnum );
extern void INT_SetHandler( BYTE intnum, FARPROC16 handler ); extern void INT_SetHandler( BYTE intnum, FARPROC16 handler );
/* miscemu/int1a.c */ /* msdos/ioports.c */
extern DWORD INT1A_GetTicksSinceMidnight(void); extern DWORD IO_inport( int port, int count );
extern void IO_outport( int port, int count, DWORD value );
/* miscemu/int21.c */
extern BOOL32 INT21_Init(void);
/* miscemu/ioports.c */ /* msdos/int1a.c */
extern DWORD inport( int port, int count ); extern DWORD INT1A_GetTicksSinceMidnight(void);
extern void outport( int port, int count, DWORD value );
/* misc/cpu.c */
extern int runtime_cpu(void);
#define INT_BARF(context,num) \ #define INT_BARF(context,num) \
fprintf( stderr, "int%x: unknown/not implemented parameters:\n" \ fprintf( stderr, "int%x: unknown/not implemented parameters:\n" \
...@@ -47,6 +44,6 @@ extern void outport( int port, int count, DWORD value ); ...@@ -47,6 +44,6 @@ extern void outport( int port, int count, DWORD value );
"SI %04x, DI %04x, DS %04x, ES %04x\n", \ "SI %04x, DI %04x, DS %04x, ES %04x\n", \
(num), (num), AX_reg(context), BX_reg(context), CX_reg(context), \ (num), (num), AX_reg(context), BX_reg(context), CX_reg(context), \
DX_reg(context), SI_reg(context), DI_reg(context), \ DX_reg(context), SI_reg(context), DI_reg(context), \
DS_reg(context), ES_reg(context) ) (WORD)DS_reg(context), (WORD)ES_reg(context) )
#endif /* __WINE_MISCEMU_H */ #endif /* __WINE_MISCEMU_H */
...@@ -84,7 +84,8 @@ extern WORD DOS_ExtendedError; ...@@ -84,7 +84,8 @@ extern WORD DOS_ExtendedError;
extern BYTE DOS_ErrorClass, DOS_ErrorAction, DOS_ErrorLocus; extern BYTE DOS_ErrorClass, DOS_ErrorAction, DOS_ErrorLocus;
#define DOS_ERROR(err,class,action,locus) \ #define DOS_ERROR(err,class,action,locus) \
( DOS_ErrorClass = (class), DOS_ErrorAction = (action), \ ( SetLastError(err), \
DOS_ErrorClass = (class), DOS_ErrorAction = (action), \
DOS_ErrorLocus = (locus), DOS_ExtendedError = (err) ) DOS_ErrorLocus = (locus), DOS_ExtendedError = (err) )
/* Error codes */ /* Error codes */
......
/*
* Process definitions
*
* Copyright 1996 Alexandre Julliard
*/
#ifndef __WINE_PROCESS_H
#define __WINE_PROCESS_H
#include "windows.h"
#include "winbase.h"
#include "handle32.h"
/* Process handle entry */
typedef struct
{
DWORD flags; /* Handle flags */
K32OBJ *ptr; /* Object ptr */
} HANDLE_ENTRY;
/* Process handle table */
typedef struct
{
DWORD count;
HANDLE_ENTRY entries[1];
} HANDLE_TABLE;
/* Win32 process environment database */
typedef struct
{
LPSTR environ; /* 00 Process environment strings */
DWORD unknown1; /* 04 Unknown */
LPSTR cmd_line; /* 08 Command line */
LPSTR cur_dir; /* 0c Current directory */
STARTUPINFO32A *startup_info; /* 10 Startup information */
HANDLE32 hStdin; /* 14 Handle for standard input */
HANDLE32 hStdout; /* 18 Handle for standard output */
HANDLE32 hStderr; /* 1c Handle for standard error */
DWORD unknown2; /* 20 Unknown */
DWORD inherit_console; /* 24 Inherit console flag */
DWORD break_type; /* 28 Console events flag */
K32OBJ *break_sem; /* 2c SetConsoleCtrlHandler semaphore */
K32OBJ *break_event; /* 30 SetConsoleCtrlHandler event */
K32OBJ *break_thread; /* 34 SetConsoleCtrlHandler thread */
void *break_handlers; /* 38 List of console handlers */
} ENVDB;
/* Win32 process database */
typedef struct _PDB32
{
K32OBJ header; /* 00 Kernel object header */
DWORD unknown1; /* 08 Unknown */
K32OBJ *event; /* 0c Pointer to an event object */
DWORD exit_code; /* 10 Process exit code */
DWORD unknown2; /* 14 Unknown */
HANDLE32 heap; /* 18 Default process heap */
HANDLE32 mem_context; /* 1c Process memory context */
DWORD flags; /* 20 Flags */
void *pdb16; /* 24 DOS PSP */
WORD PSP_sel; /* 28 Selector to DOS PSP */
WORD module; /* 2a IMTE for the process module */
WORD threads; /* 2c Number of threads */
WORD running_threads; /* 2e Number of running threads */
WORD unknown3; /* 30 Unknown */
WORD ring0_threads; /* 32 Number of ring 0 threads */
HANDLE32 system_heap; /* 34 System heap to allocate handles */
HTASK32 task; /* 38 Win16 task */
void *mem_map_files; /* 3c Pointer to mem-mapped files */
ENVDB *env_DB; /* 40 Environment database */
HANDLE_TABLE *handle_table; /* 44 Handle table */
struct _PDB32 *parent; /* 48 Parent process */
void *modref_list; /* 4c MODREF list */
void *thread_list; /* 50 List of threads */
void *debuggee_CB; /* 54 Debuggee context block */
void *local_heap_free; /* 58 Head of local heap free list */
DWORD unknown4; /* 5c Unknown */
CRITICAL_SECTION crit_section; /* 60 Critical section */
DWORD unknown5[3]; /* 78 Unknown */
K32OBJ *console; /* 84 Console */
DWORD tls_bits[2]; /* 88 TLS in-use bits */
DWORD process_dword; /* 90 Unknown */
struct _PDB32 *group; /* 94 Process group */
void *exe_modref; /* 98 MODREF for the process EXE */
void *top_exc_filter; /* 9c Top exception filter */
DWORD priority; /* a0 Priority level */
HANDLE32 heap_list; /* a4 Head of process heap list */
void *heap_handles; /* a8 Head of heap handles list */
DWORD unknown6; /* ac Unknown */
K32OBJ *console_provider; /* b0 Console provider (??) */
WORD env_selector; /* b4 Selector to process environment */
WORD error_mode; /* b6 Error mode */
K32OBJ *load_done_evt; /* b8 Event for process loading done */
DWORD unknown7; /* bc Unknown */
} PDB32;
extern HANDLE32 PROCESS_AllocHandle( K32OBJ *ptr, DWORD flags);
extern K32OBJ *PROCESS_GetObjPtr( HANDLE32 handle, K32OBJ_TYPE type );
extern BOOL32 PROCESS_SetObjPtr( HANDLE32 handle, K32OBJ *ptr, DWORD flags );
extern PDB32 *PROCESS_Create(void);
extern void PROCESS_Destroy( K32OBJ *ptr );
extern PDB32 *pCurrentProcess;
#endif /* __WINE_PROCESS_H */
/*
* Register definitions
*
* Copyright 1995 Alexandre Julliard
*/
#ifndef __WINE_REGISTERS_H
#define __WINE_REGISTERS_H
#include "wintypes.h"
/* The Win32 register context */
#define CONTEXT_i386 0x00010000
#define CONTEXT_i486 CONTEXT_i386
#define CONTEXT_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
#define CONTEXT_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
#define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
#define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
#define SIZE_OF_80387_REGISTERS 80
typedef struct
{
DWORD ControlWord;
DWORD StatusWord;
DWORD TagWord;
DWORD ErrorOffset;
DWORD ErrorSelector;
DWORD DataOffset;
DWORD DataSelector;
BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
DWORD Cr0NpxState;
} FLOATING_SAVE_AREA;
typedef struct
{
DWORD ContextFlags;
/* These are selected by CONTEXT_DEBUG_REGISTERS */
DWORD Dr0;
DWORD Dr1;
DWORD Dr2;
DWORD Dr3;
DWORD Dr6;
DWORD Dr7;
/* These are selected by CONTEXT_FLOATING_POINT */
FLOATING_SAVE_AREA FloatSave;
/* These are selected by CONTEXT_SEGMENTS */
DWORD SegGs;
DWORD SegFs;
DWORD SegEs;
DWORD SegDs;
/* These are selected by CONTEXT_INTEGER */
DWORD Edi;
DWORD Esi;
DWORD Ebx;
DWORD Edx;
DWORD Ecx;
DWORD Eax;
/* These are selected by CONTEXT_CONTROL */
DWORD Ebp;
DWORD Eip;
DWORD SegCs;
DWORD EFlags;
DWORD Esp;
DWORD SegSs;
} CONTEXT, *PCONTEXT;
#ifndef WINELIB
#ifdef i386
extern int runtime_cpu (void);
#else
static inline int runtime_cpu(void) { return 3; }
#endif
#ifdef linux
typedef 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;
} SIGCONTEXT;
#define WINE_DATA_SELECTOR 0x2b
#define WINE_CODE_SELECTOR 0x23
#endif /* linux */
#ifdef __NetBSD__
#include <signal.h>
typedef struct sigcontext SIGCONTEXT;
#define WINE_DATA_SELECTOR 0x1f
#define WINE_CODE_SELECTOR 0x17
#endif /* NetBSD */
#if defined(__svr4__) || defined(_SCO_DS)
#include <signal.h>
#ifdef _SCO_DS
#include <sys/regset.h>
#endif
#include <sys/ucontext.h>
typedef struct ucontext SIGCONTEXT;
#define WINE_DATA_SELECTOR 0x1f
#define WINE_CODE_SELECTOR 0x17
#endif /* svr4 || SCO_DS */
#ifdef __FreeBSD__
#include <signal.h>
typedef struct sigcontext SIGCONTEXT;
#define WINE_DATA_SELECTOR 0x27
#define WINE_CODE_SELECTOR 0x1f
#endif /* FreeBSD */
#if !defined(__svr4__) && !defined(_SCO_DS)
#define EAX_reg(context) ((context)->sc_eax)
#define EBX_reg(context) ((context)->sc_ebx)
#define ECX_reg(context) ((context)->sc_ecx)
#define EDX_reg(context) ((context)->sc_edx)
#define ESI_reg(context) ((context)->sc_esi)
#define EDI_reg(context) ((context)->sc_edi)
#define EBP_reg(context) ((context)->sc_ebp)
#define CS_reg(context) ((context)->sc_cs)
#define DS_reg(context) ((context)->sc_ds)
#define ES_reg(context) ((context)->sc_es)
#define SS_reg(context) ((context)->sc_ss)
#ifdef linux
/* fs and gs are not supported on *BSD. Hopefully we won't need them. */
#define FS_reg(context) ((context)->sc_fs)
#define GS_reg(context) ((context)->sc_gs)
#endif
#ifndef __FreeBSD__
#define EFL_reg(context) ((context)->sc_eflags)
#else
#define EFL_reg(context) ((context)->sc_efl)
#endif
#define EIP_reg(context) ((context)->sc_eip)
#define ESP_reg(context) ((context)->sc_esp)
#else /* __svr4__ || _SCO_DS */
#ifdef _SCO_DS
#define gregs regs
#endif
#define EAX_reg(context) ((context)->uc_mcontext.gregs[EAX])
#define EBX_reg(context) ((context)->uc_mcontext.gregs[EBX])
#define ECX_reg(context) ((context)->uc_mcontext.gregs[ECX])
#define EDX_reg(context) ((context)->uc_mcontext.gregs[EDX])
#define ESI_reg(context) ((context)->uc_mcontext.gregs[ESI])
#define EDI_reg(context) ((context)->uc_mcontext.gregs[EDI])
#define EBP_reg(context) ((context)->uc_mcontext.gregs[EBP])
#define CS_reg(context) ((context)->uc_mcontext.gregs[CS])
#define DS_reg(context) ((context)->uc_mcontext.gregs[DS])
#define ES_reg(context) ((context)->uc_mcontext.gregs[ES])
#define SS_reg(context) ((context)->uc_mcontext.gregs[SS])
#define FS_reg(context) ((context)->uc_mcontext.gregs[FS])
#define GS_reg(context) ((context)->uc_mcontext.gregs[GS])
#define EFL_reg(context) ((context)->uc_mcontext.gregs[EFL])
#define EIP_reg(context) ((context)->uc_mcontext.gregs[EIP])
#ifdef R_ESP
#define ESP_reg(context) ((context)->uc_mcontext.gregs[R_ESP])
#else
#define ESP_reg(context) ((context)->uc_mcontext.gregs[ESP])
#endif
#endif /* __svr4__ || _SCO_DS */
#define AX_reg(context) (*(WORD*)&EAX_reg(context))
#define BX_reg(context) (*(WORD*)&EBX_reg(context))
#define CX_reg(context) (*(WORD*)&ECX_reg(context))
#define DX_reg(context) (*(WORD*)&EDX_reg(context))
#define SI_reg(context) (*(WORD*)&ESI_reg(context))
#define DI_reg(context) (*(WORD*)&EDI_reg(context))
#define BP_reg(context) (*(WORD*)&EBP_reg(context))
#define AL_reg(context) (*(BYTE*)&EAX_reg(context))
#define AH_reg(context) (*((BYTE*)&EAX_reg(context)+1))
#define BL_reg(context) (*(BYTE*)&EBX_reg(context))
#define BH_reg(context) (*((BYTE*)&EBX_reg(context)+1))
#define CL_reg(context) (*(BYTE*)&ECX_reg(context))
#define CH_reg(context) (*((BYTE*)&ECX_reg(context)+1))
#define DL_reg(context) (*(BYTE*)&EDX_reg(context))
#define DH_reg(context) (*((BYTE*)&EDX_reg(context)+1))
#define IP_reg(context) (*(WORD*)&EIP_reg(context))
#define SP_reg(context) (*(WORD*)&ESP_reg(context))
#define FL_reg(context) (*(WORD*)&EFL_reg(context))
#define SET_CFLAG(context) (EFL_reg(context) |= 0x0001)
#define RESET_CFLAG(context) (EFL_reg(context) &= 0xfffffffe)
#else /* ifndef WINELIB */
typedef void SIGCONTEXT;
#define WINE_DATA_SELECTOR 0x00
#define WINE_CODE_SELECTOR 0x00
#endif /* ifndef WINELIB */
#endif /* __WINE_REGISTERS_H */
...@@ -54,5 +54,6 @@ extern HGLOBAL16 NE_LoadResource( HMODULE16 hModule, HRSRC16 hRsrc ); ...@@ -54,5 +54,6 @@ extern HGLOBAL16 NE_LoadResource( HMODULE16 hModule, HRSRC16 hRsrc );
extern HGLOBAL16 SYSRES_LoadResource( SYSTEM_RESOURCE id ); extern HGLOBAL16 SYSRES_LoadResource( SYSTEM_RESOURCE id );
extern void SYSRES_FreeResource( HGLOBAL16 handle ); extern void SYSRES_FreeResource( HGLOBAL16 handle );
extern LPCVOID SYSRES_GetResPtr( SYSTEM_RESOURCE id );
#endif /* __WINE_RESOURCE_H */ #endif /* __WINE_RESOURCE_H */
...@@ -18,4 +18,33 @@ extern WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size, ...@@ -18,4 +18,33 @@ extern WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size,
BOOL32 readonly ); BOOL32 readonly );
extern void SELECTOR_FreeBlock( WORD sel, WORD count ); extern void SELECTOR_FreeBlock( WORD sel, WORD count );
#ifndef WINELIB
#ifdef linux
#define WINE_DATA_SELECTOR 0x2b
#define WINE_CODE_SELECTOR 0x23
#endif /* linux */
#ifdef __NetBSD__
#define WINE_DATA_SELECTOR 0x1f
#define WINE_CODE_SELECTOR 0x17
#endif /* NetBSD */
#ifdef __FreeBSD__
#define WINE_DATA_SELECTOR 0x27
#define WINE_CODE_SELECTOR 0x1f
#endif /* FreeBSD */
#if defined(__svr4__) || defined(_SCO_DS)
#define WINE_DATA_SELECTOR 0x1f
#define WINE_CODE_SELECTOR 0x17
#endif /* svr4 || SCO_DS */
#else /* WINELIB */
#define WINE_DATA_SELECTOR 0x00
#define WINE_CODE_SELECTOR 0x00
#endif /* WINELIB */
#endif /* __WINE_SELECTORS_H */ #endif /* __WINE_SELECTORS_H */
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#define MAX_PATH 260 #define MAX_PATH 260
#endif #endif
extern INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
HICON16 hIcon);
extern void SHELL_LoadRegistry(); extern void SHELL_LoadRegistry();
extern void SHELL_SaveRegistry(); extern void SHELL_SaveRegistry();
extern void SHELL_Init(); extern void SHELL_Init();
...@@ -81,6 +79,6 @@ DWORD SHGetFileInfo32W(LPCWSTR,DWORD,SHFILEINFO32W*,UINT32,UINT32); ...@@ -81,6 +79,6 @@ DWORD SHGetFileInfo32W(LPCWSTR,DWORD,SHFILEINFO32W*,UINT32,UINT32);
#define SE_ERR_DDEBUSY 30 #define SE_ERR_DDEBUSY 30
#define SE_ERR_NOASSOC 31 #define SE_ERR_NOASSOC 31
LRESULT AboutDlgProc(HWND hWnd,UINT msg,WPARAM16 wParam,LPARAM lParam); LRESULT AboutDlgProc(HWND32 hWnd,UINT32 msg,WPARAM16 wParam,LPARAM lParam);
#endif /* __WINE_SHELL_H */ #endif /* __WINE_SHELL_H */
/*
* Signal context definitions
*
* Copyright 1995 Alexandre Julliard
*/
#ifndef __WINE_SIGCONTEXT_H
#define __WINE_SIGCONTEXT_H
#ifdef WINELIB
#error This file must not be used in Winelib
#endif
#ifdef linux
typedef 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;
} SIGCONTEXT;
#endif /* linux */
#ifdef __NetBSD__
#include <signal.h>
typedef struct sigcontext SIGCONTEXT;
#endif /* NetBSD */
#if defined(__svr4__) || defined(_SCO_DS)
#include <signal.h>
#ifdef _SCO_DS
#include <sys/regset.h>
#endif
#include <sys/ucontext.h>
typedef struct ucontext SIGCONTEXT;
#endif /* svr4 || SCO_DS */
#ifdef __FreeBSD__
#include <signal.h>
typedef struct sigcontext SIGCONTEXT;
#endif /* FreeBSD */
#if !defined(__svr4__) && !defined(_SCO_DS)
#define EAX_sig(context) ((context)->sc_eax)
#define EBX_sig(context) ((context)->sc_ebx)
#define ECX_sig(context) ((context)->sc_ecx)
#define EDX_sig(context) ((context)->sc_edx)
#define ESI_sig(context) ((context)->sc_esi)
#define EDI_sig(context) ((context)->sc_edi)
#define EBP_sig(context) ((context)->sc_ebp)
#define CS_sig(context) ((context)->sc_cs)
#define DS_sig(context) ((context)->sc_ds)
#define ES_sig(context) ((context)->sc_es)
#define SS_sig(context) ((context)->sc_ss)
#ifdef linux
/* fs and gs are not supported on *BSD. Hopefully we won't need them. */
#define FS_sig(context) ((context)->sc_fs)
#define GS_sig(context) ((context)->sc_gs)
#endif
#ifndef __FreeBSD__
#define EFL_sig(context) ((context)->sc_eflags)
#else
#define EFL_sig(context) ((context)->sc_efl)
#endif
#define EIP_sig(context) ((context)->sc_eip)
#define ESP_sig(context) ((context)->sc_esp)
#else /* __svr4__ || _SCO_DS */
#ifdef _SCO_DS
#define gregs regs
#endif
#define EAX_sig(context) ((context)->uc_mcontext.gregs[EAX])
#define EBX_sig(context) ((context)->uc_mcontext.gregs[EBX])
#define ECX_sig(context) ((context)->uc_mcontext.gregs[ECX])
#define EDX_sig(context) ((context)->uc_mcontext.gregs[EDX])
#define ESI_sig(context) ((context)->uc_mcontext.gregs[ESI])
#define EDI_sig(context) ((context)->uc_mcontext.gregs[EDI])
#define EBP_sig(context) ((context)->uc_mcontext.gregs[EBP])
#define CS_sig(context) ((context)->uc_mcontext.gregs[CS])
#define DS_sig(context) ((context)->uc_mcontext.gregs[DS])
#define ES_sig(context) ((context)->uc_mcontext.gregs[ES])
#define SS_sig(context) ((context)->uc_mcontext.gregs[SS])
#define FS_sig(context) ((context)->uc_mcontext.gregs[FS])
#define GS_sig(context) ((context)->uc_mcontext.gregs[GS])
#define EFL_sig(context) ((context)->uc_mcontext.gregs[EFL])
#define EIP_sig(context) ((context)->uc_mcontext.gregs[EIP])
#ifdef R_ESP
#define ESP_sig(context) ((context)->uc_mcontext.gregs[R_ESP])
#else
#define ESP_sig(context) ((context)->uc_mcontext.gregs[ESP])
#endif
#endif /* __svr4__ || _SCO_DS */
#define AX_sig(context) (*(WORD*)&EAX_sig(context))
#define BX_sig(context) (*(WORD*)&EBX_sig(context))
#define CX_sig(context) (*(WORD*)&ECX_sig(context))
#define DX_sig(context) (*(WORD*)&EDX_sig(context))
#define SI_sig(context) (*(WORD*)&ESI_sig(context))
#define DI_sig(context) (*(WORD*)&EDI_sig(context))
#define BP_sig(context) (*(WORD*)&EBP_sig(context))
#define AL_sig(context) (*(BYTE*)&EAX_sig(context))
#define AH_sig(context) (*((BYTE*)&EAX_sig(context)+1))
#define BL_sig(context) (*(BYTE*)&EBX_sig(context))
#define BH_sig(context) (*((BYTE*)&EBX_sig(context)+1))
#define CL_sig(context) (*(BYTE*)&ECX_sig(context))
#define CH_sig(context) (*((BYTE*)&ECX_sig(context)+1))
#define DL_sig(context) (*(BYTE*)&EDX_sig(context))
#define DH_sig(context) (*((BYTE*)&EDX_sig(context)+1))
#define IP_sig(context) (*(WORD*)&EIP_sig(context))
#define SP_sig(context) (*(WORD*)&ESP_sig(context))
#define FL_sig(context) (*(WORD*)&EFL_sig(context))
#endif /* __WINE_SIGCONTEXT_H */
...@@ -51,7 +51,6 @@ extern WORD IF1632_Saved16_sp; ...@@ -51,7 +51,6 @@ extern WORD IF1632_Saved16_sp;
/* Saved 32-bit stack for current process (Win16 only) */ /* Saved 32-bit stack for current process (Win16 only) */
extern DWORD IF1632_Saved32_esp; extern DWORD IF1632_Saved32_esp;
extern SEGPTR IF1632_Stack32_base;
/* Original Unix stack */ /* Original Unix stack */
extern DWORD IF1632_Original32_esp; extern DWORD IF1632_Original32_esp;
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "wintypes.h" #include "wintypes.h"
LPSTR STRING32_DupUniToAnsi(LPCWSTR src);
LPWSTR STRING32_DupAnsiToUni(LPCSTR src); LPWSTR STRING32_DupAnsiToUni(LPCSTR src);
LPWSTR STRING32_strdupW(LPCWSTR); LPWSTR STRING32_strdupW(LPCWSTR);
......
...@@ -47,6 +47,7 @@ typedef struct ...@@ -47,6 +47,7 @@ typedef struct
#define THUNK_MAGIC ('P' | ('T' << 8)) #define THUNK_MAGIC ('P' | ('T' << 8))
struct _THDB;
/* Task database. See 'Windows Internals' p. 226 */ /* Task database. See 'Windows Internals' p. 226 */
typedef struct typedef struct
...@@ -55,9 +56,8 @@ typedef struct ...@@ -55,9 +56,8 @@ typedef struct
WORD sp; /* 02 Stack pointer of task */ WORD sp; /* 02 Stack pointer of task */
WORD ss; /* 04 Stack segment of task */ WORD ss; /* 04 Stack segment of task */
WORD nEvents; /* 06 Events for this task */ WORD nEvents; /* 06 Events for this task */
char priority; /* 08 Task priority, -32..15 */ INT16 priority; /* 08 Task priority, -32..15 */
BYTE unused1; /* 09 */ WORD unused1; /* 0a */
HGLOBAL16 hStack32; /* 0a Handle to 32-bit stack */
HTASK16 hSelf; /* 0c Selector of this TDB */ HTASK16 hSelf; /* 0c Selector of this TDB */
HANDLE16 hPrevInstance; /* 0e Previous instance of module */ HANDLE16 hPrevInstance; /* 0e Previous instance of module */
DWORD esp; /* 10 32-bit stack pointer */ DWORD esp; /* 10 32-bit stack pointer */
...@@ -81,7 +81,9 @@ typedef struct ...@@ -81,7 +81,9 @@ typedef struct
DWORD int3e WINE_PACKED; /* 46 int 3e (80x87 emu) handler */ DWORD int3e WINE_PACKED; /* 46 int 3e (80x87 emu) handler */
DWORD int75 WINE_PACKED; /* 4a int 75 (80x87 error) handler */ DWORD int75 WINE_PACKED; /* 4a int 75 (80x87 error) handler */
DWORD compat_flags WINE_PACKED; /* 4e Compatibility flags */ DWORD compat_flags WINE_PACKED; /* 4e Compatibility flags */
BYTE unused4[14]; /* 52 */ BYTE unused4[2]; /* 52 */
struct _THDB *thdb; /* 54 Pointer to thread database */
BYTE unused5[8]; /* 58 */
HANDLE16 hPDB; /* 60 Selector of PDB (i.e. PSP) */ HANDLE16 hPDB; /* 60 Selector of PDB (i.e. PSP) */
SEGPTR dta WINE_PACKED; /* 62 Current DTA */ SEGPTR dta WINE_PACKED; /* 62 Current DTA */
BYTE curdrive; /* 66 Current drive */ BYTE curdrive; /* 66 Current drive */
...@@ -113,5 +115,6 @@ extern HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance, ...@@ -113,5 +115,6 @@ extern HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance,
HANDLE16 hEnvironment, LPCSTR cmdLine, HANDLE16 hEnvironment, LPCSTR cmdLine,
UINT16 cmdShow ); UINT16 cmdShow );
extern void TASK_KillCurrentTask( INT16 exitCode ); extern void TASK_KillCurrentTask( INT16 exitCode );
extern HTASK16 TASK_GetNextTask( HTASK16 hTask );
#endif /* _WINE_TASK_H */ #endif /* _WINE_TASK_H */
/*
* Thread definitions
*
* Copyright 1996 Alexandre Julliard
*/
#ifndef __WINE_THREAD_H
#define __WINE_THREAD_H
#include "process.h"
/* Thread exception block */
typedef struct _TEB
{
void *except; /* 00 Head of exception handling chain */
void *stack_top; /* 04 Top of thread stack */
void *stack_low; /* 08 Stack low-water mark */
HTASK16 htask16; /* 0c Win16 task handle */
WORD stack_sel; /* 0e 16-bit stack selector */
DWORD selman_list; /* 10 Selector manager list */
DWORD user_ptr; /* 14 User pointer */
struct _TEB *self; /* 18 Pointer to this structure */
WORD flags; /* 1c Flags */
WORD mutex_count; /* 1e Win16 mutex count */
DWORD debug_context; /* 20 Debug context */
DWORD *ppriority; /* 24 Pointer to current priority */
HQUEUE16 queue; /* 28 Message queue */
WORD pad1; /* 2a */
LPVOID *tls_ptr; /* 2c Pointer to TLS array */
} TEB;
/* Thread database */
typedef struct _THDB
{
K32OBJ header; /* 00 Kernel object header */
PDB32 *process; /* 08 Process owning this thread */
K32OBJ *event; /* 0c Thread event */
TEB teb; /* 10 Thread information block */
PDB32 *process2; /* 40 Same as offset 08 (?) */
DWORD flags; /* 44 Flags */
DWORD exit_code; /* 48 Termination status */
WORD teb_sel; /* 4c Selector to TEB */
WORD emu_sel; /* 4e 80387 emulator selector */
DWORD unknown1; /* 50 Unknown */
void *wait_list; /* 54 Event waiting list */
DWORD unknown2; /* 58 Unknown */
void *ring0_thread; /* 5c Pointer to ring 0 thread */
void *ptdbx; /* 60 Pointer to TDBX structure */
void *stack_base; /* 64 Base of the stack */
void *exit_stack; /* 68 Stack pointer on thread exit */
void *emu_data; /* 6c Related to 80387 emulation */
DWORD last_error; /* 70 Last error code */
void *debugger_CB; /* 74 Debugger context block */
DWORD debug_thread; /* 78 Thread debugging this one (?) */
void *context; /* 7c Thread register context */
DWORD unknown3[3]; /* 80 Unknown */
WORD current_ss; /* 8c Another 16-bit stack selector */
WORD pad2; /* 8e */
void *ss_table; /* 90 Pointer to info about 16-bit stack */
WORD thunk_ss; /* 94 Yet another 16-bit stack selector */
WORD pad3; /* 96 */
LPVOID tls_array[64]; /* 98 Thread local storage */
DWORD delta_priority; /* 198 Priority delta */
DWORD unknown4[7]; /* 19c Unknown */
void *create_data; /* 1b8 Pointer to creation structure */
DWORD suspend_count; /* 1bc SuspendThread() counter */
DWORD unknown5[9]; /* 1c0 Unknown */
K32OBJ *crit_section; /* 1e4 Some critical section */
K32OBJ *win16_mutex; /* 1e8 Pointer to Win16 mutex */
K32OBJ *win32_mutex; /* 1ec Pointer to KERNEL32 mutex */
K32OBJ *crit_section2; /* 1f0 Another critical section */
DWORD unknown6[2]; /* 1f4 Unknown */
} THDB;
extern THDB *THREAD_Create( PDB32 *pdb, DWORD stack_size );
extern void THREAD_Destroy( K32OBJ *ptr );
extern THDB *pCurrentThread;
#endif /* __WINE_THREAD_H */
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
#include "windows.h" #include "windows.h"
#define INVALID_HANDLE_VALUE ((HANDLE32) -1)
#define WAIT_FAILED 0xffffffff #define WAIT_FAILED 0xffffffff
#define WAIT_OBJECT_0 0 #define WAIT_OBJECT_0 0
#define WAIT_ABANDONED STATUS_ABANDONED_WAIT_0 #define WAIT_ABANDONED STATUS_ABANDONED_WAIT_0
...@@ -148,7 +146,6 @@ HACCEL32 LoadAcceleratorsA( HINSTANCE32, const char *); ...@@ -148,7 +146,6 @@ HACCEL32 LoadAcceleratorsA( HINSTANCE32, const char *);
void DeleteCriticalSection(CRITICAL_SECTION *lpCrit); void DeleteCriticalSection(CRITICAL_SECTION *lpCrit);
void EnterCriticalSection(CRITICAL_SECTION *lpCrit); void EnterCriticalSection(CRITICAL_SECTION *lpCrit);
int GetCurrentProcessId(void);
void InitializeCriticalSection(CRITICAL_SECTION *lpCrit); void InitializeCriticalSection(CRITICAL_SECTION *lpCrit);
void LeaveCriticalSection(CRITICAL_SECTION *lpCrit); void LeaveCriticalSection(CRITICAL_SECTION *lpCrit);
HANDLE32 OpenProcess(DWORD access, BOOL32 inherit, DWORD id); HANDLE32 OpenProcess(DWORD access, BOOL32 inherit, DWORD id);
......
...@@ -5,26 +5,28 @@ extern int WIN32_LastError; ...@@ -5,26 +5,28 @@ extern int WIN32_LastError;
* All instances of ERROR_UNKNOWN should be tested under Win95/NT * All instances of ERROR_UNKNOWN should be tested under Win95/NT
* and replaced. * and replaced.
*/ */
#define ERROR_UNKNOWN 99999 #define ERROR_UNKNOWN 99999
#define ERROR_SUCCESS 0 #define ERROR_SUCCESS 0
#define ERROR_FILE_NOT_FOUND 2 #define ERROR_FILE_NOT_FOUND 2
#define ERROR_TOO_MANY_OPEN_FILES 4 #define ERROR_PATH_NOT_FOUND 3
#define ERROR_ACCESS_DENIED 5 #define ERROR_TOO_MANY_OPEN_FILES 4
#define ERROR_INVALID_HANDLE 6 #define ERROR_ACCESS_DENIED 5
#define ERROR_BAD_FORMAT 11 #define ERROR_INVALID_HANDLE 6
#define ERROR_OUTOFMEMORY 14 #define ERROR_BAD_FORMAT 11
#define ERROR_FILE_EXISTS 80 #define ERROR_OUTOFMEMORY 14
#define ERROR_INVALID_PARAMETER 87 #define ERROR_NO_MORE_FILES 18
#define ERROR_BROKEN_PIPE 109 #define ERROR_FILE_EXISTS 80
#define ERROR_DISK_FULL 112 #define ERROR_INVALID_PARAMETER 87
#define ERROR_CALL_NOT_IMPLEMENTED 120 #define ERROR_BROKEN_PIPE 109
#define ERROR_SEEK_ON_DEVICE 132 #define ERROR_DISK_FULL 112
#define ERROR_DIR_NOT_EMPTY 145 #define ERROR_CALL_NOT_IMPLEMENTED 120
#define ERROR_BUSY 170 #define ERROR_SEEK_ON_DEVICE 132
#define ERROR_FILENAME_EXCED_RANGE 206 #define ERROR_DIR_NOT_EMPTY 145
#define ERROR_MORE_DATA 234 #define ERROR_BUSY 170
#define ERROR_NO_MORE_ITEMS 259 #define ERROR_FILENAME_EXCED_RANGE 206
#define ERROR_IO_DEVICE 1117 #define ERROR_MORE_DATA 234
#define ERROR_POSSIBLE_DEADLOCK 1131 #define ERROR_NO_MORE_ITEMS 259
#define ERROR_BAD_DEVICE 1200 #define ERROR_IO_DEVICE 1117
#define ERROR_POSSIBLE_DEADLOCK 1131
#define ERROR_BAD_DEVICE 1200
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#ifndef __WINE_WINNT_H #ifndef __WINE_WINNT_H
#define __WINE_WINNT_H #define __WINE_WINNT_H
#include "wintypes.h"
/* Heap flags */ /* Heap flags */
#define HEAP_NO_SERIALIZE 0x00000001 #define HEAP_NO_SERIALIZE 0x00000001
#define HEAP_GROWABLE 0x00000002 #define HEAP_GROWABLE 0x00000002
...@@ -21,4 +23,119 @@ ...@@ -21,4 +23,119 @@
#define HEAP_WINE_SEGPTR 0x01000000 /* Not a Win32 flag */ #define HEAP_WINE_SEGPTR 0x01000000 /* Not a Win32 flag */
#define HEAP_WINE_CODESEG 0x02000000 /* Not a Win32 flag */ #define HEAP_WINE_CODESEG 0x02000000 /* Not a Win32 flag */
/* The Win32 register context */
#define CONTEXT_i386 0x00010000
#define CONTEXT_i486 CONTEXT_i386
#define CONTEXT_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
#define CONTEXT_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
#define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
#define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
#define SIZE_OF_80387_REGISTERS 80
typedef struct
{
DWORD ControlWord;
DWORD StatusWord;
DWORD TagWord;
DWORD ErrorOffset;
DWORD ErrorSelector;
DWORD DataOffset;
DWORD DataSelector;
BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
DWORD Cr0NpxState;
} FLOATING_SAVE_AREA;
typedef struct
{
DWORD ContextFlags;
/* These are selected by CONTEXT_DEBUG_REGISTERS */
DWORD Dr0;
DWORD Dr1;
DWORD Dr2;
DWORD Dr3;
DWORD Dr6;
DWORD Dr7;
/* These are selected by CONTEXT_FLOATING_POINT */
FLOATING_SAVE_AREA FloatSave;
/* These are selected by CONTEXT_SEGMENTS */
DWORD SegGs;
DWORD SegFs;
DWORD SegEs;
DWORD SegDs;
/* These are selected by CONTEXT_INTEGER */
DWORD Edi;
DWORD Esi;
DWORD Ebx;
DWORD Edx;
DWORD Ecx;
DWORD Eax;
/* These are selected by CONTEXT_CONTROL */
DWORD Ebp;
DWORD Eip;
DWORD SegCs;
DWORD EFlags;
DWORD Esp;
DWORD SegSs;
} CONTEXT, *PCONTEXT;
#ifdef __WINE__
/* Macros for easier access to context registers */
#define EAX_reg(context) ((context)->Eax)
#define EBX_reg(context) ((context)->Ebx)
#define ECX_reg(context) ((context)->Ecx)
#define EDX_reg(context) ((context)->Edx)
#define ESI_reg(context) ((context)->Esi)
#define EDI_reg(context) ((context)->Edi)
#define EBP_reg(context) ((context)->Ebp)
#define CS_reg(context) ((context)->SegCs)
#define DS_reg(context) ((context)->SegDs)
#define ES_reg(context) ((context)->SegEs)
#define FS_reg(context) ((context)->SegFs)
#define GS_reg(context) ((context)->SegGs)
#define SS_reg(context) ((context)->SegSs)
#define EFL_reg(context) ((context)->EFlags)
#define EIP_reg(context) ((context)->Eip)
#define ESP_reg(context) ((context)->Esp)
#define AX_reg(context) (*(WORD*)&EAX_reg(context))
#define BX_reg(context) (*(WORD*)&EBX_reg(context))
#define CX_reg(context) (*(WORD*)&ECX_reg(context))
#define DX_reg(context) (*(WORD*)&EDX_reg(context))
#define SI_reg(context) (*(WORD*)&ESI_reg(context))
#define DI_reg(context) (*(WORD*)&EDI_reg(context))
#define BP_reg(context) (*(WORD*)&EBP_reg(context))
#define AL_reg(context) (*(BYTE*)&EAX_reg(context))
#define AH_reg(context) (*((BYTE*)&EAX_reg(context)+1))
#define BL_reg(context) (*(BYTE*)&EBX_reg(context))
#define BH_reg(context) (*((BYTE*)&EBX_reg(context)+1))
#define CL_reg(context) (*(BYTE*)&ECX_reg(context))
#define CH_reg(context) (*((BYTE*)&ECX_reg(context)+1))
#define DL_reg(context) (*(BYTE*)&EDX_reg(context))
#define DH_reg(context) (*((BYTE*)&EDX_reg(context)+1))
#define IP_reg(context) (*(WORD*)&EIP_reg(context))
#define SP_reg(context) (*(WORD*)&ESP_reg(context))
#define FL_reg(context) (*(WORD*)&EFL_reg(context))
#define SET_CFLAG(context) (EFL_reg(context) |= 0x0001)
#define RESET_CFLAG(context) (EFL_reg(context) &= 0xfffffffe)
#endif /* __WINE__ */
#endif /* __WINE_WINNT_H */ #endif /* __WINE_WINNT_H */
...@@ -93,7 +93,6 @@ typedef WORD CATCHBUF[9]; ...@@ -93,7 +93,6 @@ typedef WORD CATCHBUF[9];
typedef WORD *LPCATCHBUF; typedef WORD *LPCATCHBUF;
typedef DWORD ACCESS_MASK; typedef DWORD ACCESS_MASK;
typedef ACCESS_MASK REGSAM; typedef ACCESS_MASK REGSAM;
typedef INT16 HFILE;
typedef HANDLE32 HHOOK; typedef HANDLE32 HHOOK;
typedef HANDLE32 HKEY; typedef HANDLE32 HKEY;
typedef HANDLE32 HMIXEROBJ; typedef HANDLE32 HMIXEROBJ;
...@@ -138,6 +137,7 @@ DECLARE_HANDLE(HDC); ...@@ -138,6 +137,7 @@ DECLARE_HANDLE(HDC);
DECLARE_HANDLE(HDROP); DECLARE_HANDLE(HDROP);
DECLARE_HANDLE(HDRVR); DECLARE_HANDLE(HDRVR);
DECLARE_HANDLE(HDWP); DECLARE_HANDLE(HDWP);
DECLARE_HANDLE(HFILE);
DECLARE_HANDLE(HFONT); DECLARE_HANDLE(HFONT);
DECLARE_HANDLE(HGDIOBJ); DECLARE_HANDLE(HGDIOBJ);
DECLARE_HANDLE(HGLOBAL); DECLARE_HANDLE(HGLOBAL);
...@@ -234,6 +234,7 @@ DECL_WINELIB_TYPE(HDC); ...@@ -234,6 +234,7 @@ DECL_WINELIB_TYPE(HDC);
DECL_WINELIB_TYPE(HDROP); DECL_WINELIB_TYPE(HDROP);
DECL_WINELIB_TYPE(HDRVR); DECL_WINELIB_TYPE(HDRVR);
DECL_WINELIB_TYPE(HDWP); DECL_WINELIB_TYPE(HDWP);
DECL_WINELIB_TYPE(HFILE);
DECL_WINELIB_TYPE(HFONT); DECL_WINELIB_TYPE(HFONT);
DECL_WINELIB_TYPE(HGDIOBJ); DECL_WINELIB_TYPE(HGDIOBJ);
DECL_WINELIB_TYPE(HGLOBAL); DECL_WINELIB_TYPE(HGLOBAL);
......
/*
* USER definitions
*
* Copyright 1996 Alexandre Julliard
*/
#ifndef __WINE_WINUSER_H
#define __WINE_WINUSER_H
#include "wintypes.h"
/* Window classes */
typedef struct
{
UINT32 style;
WNDPROC32 lpfnWndProc;
INT32 cbClsExtra;
INT32 cbWndExtra;
HINSTANCE32 hInstance;
HICON32 hIcon;
HCURSOR32 hCursor;
HBRUSH32 hbrBackground;
LPCSTR lpszMenuName;
LPCSTR lpszClassName;
} WNDCLASS32A, *LPWNDCLASS32A;
typedef struct
{
UINT32 style;
WNDPROC32 lpfnWndProc;
INT32 cbClsExtra;
INT32 cbWndExtra;
HINSTANCE32 hInstance;
HICON32 hIcon;
HCURSOR32 hCursor;
HBRUSH32 hbrBackground;
LPCWSTR lpszMenuName;
LPCWSTR lpszClassName;
} WNDCLASS32W, *LPWNDCLASS32W;
#pragma pack(1)
typedef struct
{
UINT16 style;
WNDPROC16 lpfnWndProc WINE_PACKED;
INT16 cbClsExtra;
INT16 cbWndExtra;
HANDLE16 hInstance;
HICON16 hIcon;
HCURSOR16 hCursor;
HBRUSH16 hbrBackground;
SEGPTR lpszMenuName WINE_PACKED;
SEGPTR lpszClassName WINE_PACKED;
} WNDCLASS16, *LPWNDCLASS16;
#pragma pack(4)
typedef struct
{
UINT32 cbSize;
UINT32 style;
WNDPROC32 lpfnWndProc;
INT32 cbClsExtra;
INT32 cbWndExtra;
HINSTANCE32 hInstance;
HICON32 hIcon;
HCURSOR32 hCursor;
HBRUSH32 hbrBackground;
LPCSTR lpszMenuName;
LPCSTR lpszClassName;
HICON32 hIconSm;
} WNDCLASSEX32A, *LPWNDCLASSEX32A;
typedef struct
{
UINT32 cbSize;
UINT32 style;
WNDPROC32 lpfnWndProc;
INT32 cbClsExtra;
INT32 cbWndExtra;
HINSTANCE32 hInstance;
HICON32 hIcon;
HCURSOR32 hCursor;
HBRUSH32 hbrBackground;
LPCWSTR lpszMenuName;
LPCWSTR lpszClassName;
HICON32 hIconSm;
} WNDCLASSEX32W, *LPWNDCLASSEX32W;
typedef struct
{
UINT32 cbSize;
UINT32 style;
WNDPROC16 lpfnWndProc;
INT16 cbClsExtra;
INT16 cbWndExtra;
HANDLE16 hInstance;
HICON16 hIcon;
HCURSOR16 hCursor;
HBRUSH16 hbrBackground;
SEGPTR lpszMenuName;
SEGPTR lpszClassName;
HICON16 hIconSm;
} WNDCLASSEX16, *LPWNDCLASSEX16;
DECL_WINELIB_TYPE_AW(WNDCLASS);
DECL_WINELIB_TYPE_AW(LPWNDCLASS);
DECL_WINELIB_TYPE_AW(WNDCLASSEX);
DECL_WINELIB_TYPE_AW(LPWNDCLASSEX);
#define CS_VREDRAW 0x0001
#define CS_HREDRAW 0x0002
#define CS_KEYCVTWINDOW 0x0004
#define CS_DBLCLKS 0x0008
#define CS_OWNDC 0x0020
#define CS_CLASSDC 0x0040
#define CS_PARENTDC 0x0080
#define CS_NOKEYCVT 0x0100
#define CS_NOCLOSE 0x0200
#define CS_SAVEBITS 0x0800
#define CS_BYTEALIGNCLIENT 0x1000
#define CS_BYTEALIGNWINDOW 0x2000
#define CS_GLOBALCLASS 0x4000
/* Offsets for GetClassLong() and GetClassWord() */
#define GCL_MENUNAME (-8)
#define GCW_HBRBACKGROUND (-10)
#define GCL_HBRBACKGROUND GCW_HBRBACKGROUND
#define GCW_HCURSOR (-12)
#define GCL_HCURSOR GCW_HCURSOR
#define GCW_HICON (-14)
#define GCL_HICON GCW_HICON
#define GCW_HMODULE (-16)
#define GCL_HMODULE GCW_HMODULE
#define GCW_CBWNDEXTRA (-18)
#define GCL_CBWNDEXTRA GCW_CBWNDEXTRA
#define GCW_CBCLSEXTRA (-20)
#define GCL_CBCLSEXTRA GCW_CBCLSEXTRA
#define GCL_WNDPROC (-24)
#define GCW_STYLE (-26)
#define GCL_STYLE GCW_STYLE
#define GCW_ATOM (-32)
#define GCW_HICONSM (-34)
#define GCL_HICONSM GCW_HICONSM
#endif /* __WINE_WINUSER_H */
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "dde_mem.h" #include "dde_mem.h"
#include "global.h" #include "global.h"
#include "debug.h" #include "debug.h"
#include "xmalloc.h"
void SIGNAL_MaskAsyncEvents( BOOL32 mask ) void SIGNAL_MaskAsyncEvents( BOOL32 mask )
{ {
...@@ -46,7 +45,6 @@ int CallTo32_LargeStack( int (*func)(), int nbargs, ...) ...@@ -46,7 +45,6 @@ int CallTo32_LargeStack( int (*func)(), int nbargs, ...)
} }
} }
extern LRESULT AboutDlgProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT ColorDlgProc(HWND,UINT,WPARAM16,LPARAM); extern LRESULT ColorDlgProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT ComboBoxWndProc(HWND,UINT,WPARAM16,LPARAM); extern LRESULT ComboBoxWndProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT ComboLBoxWndProc(HWND,UINT,WPARAM16,LPARAM); extern LRESULT ComboLBoxWndProc(HWND,UINT,WPARAM16,LPARAM);
...@@ -61,7 +59,6 @@ extern LRESULT PrintSetupDlgProc(HWND,UINT,WPARAM16,LPARAM); ...@@ -61,7 +59,6 @@ extern LRESULT PrintSetupDlgProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT ReplaceTextDlgProc(HWND,UINT,WPARAM16,LPARAM); extern LRESULT ReplaceTextDlgProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT ScrollBarWndProc(HWND,UINT,WPARAM16,LPARAM); extern LRESULT ScrollBarWndProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT StaticWndProc(HWND,UINT,WPARAM16,LPARAM); extern LRESULT StaticWndProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT SystemMessageBoxProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT TASK_Reschedule(void); extern LRESULT TASK_Reschedule(void);
/*********************************************************************** /***********************************************************************
...@@ -72,7 +69,6 @@ extern LRESULT TASK_Reschedule(void); ...@@ -72,7 +69,6 @@ extern LRESULT TASK_Reschedule(void);
FARPROC16 MODULE_GetWndProcEntry16( char *name ) FARPROC16 MODULE_GetWndProcEntry16( char *name )
{ {
#define MAP_STR_TO_PROC(str,proc) if(!strcmp(name,str))return (FARPROC16)proc #define MAP_STR_TO_PROC(str,proc) if(!strcmp(name,str))return (FARPROC16)proc
MAP_STR_TO_PROC("AboutDlgProc",AboutDlgProc);
MAP_STR_TO_PROC("ColorDlgProc",ColorDlgProc); MAP_STR_TO_PROC("ColorDlgProc",ColorDlgProc);
MAP_STR_TO_PROC("ComboBoxWndProc",ComboBoxWndProc); MAP_STR_TO_PROC("ComboBoxWndProc",ComboBoxWndProc);
MAP_STR_TO_PROC("ComboLBoxWndProc",ComboLBoxWndProc); MAP_STR_TO_PROC("ComboLBoxWndProc",ComboLBoxWndProc);
...@@ -88,7 +84,6 @@ FARPROC16 MODULE_GetWndProcEntry16( char *name ) ...@@ -88,7 +84,6 @@ FARPROC16 MODULE_GetWndProcEntry16( char *name )
MAP_STR_TO_PROC("ReplaceTextDlgProc",ReplaceTextDlgProc); MAP_STR_TO_PROC("ReplaceTextDlgProc",ReplaceTextDlgProc);
MAP_STR_TO_PROC("ScrollBarWndProc",ScrollBarWndProc); MAP_STR_TO_PROC("ScrollBarWndProc",ScrollBarWndProc);
MAP_STR_TO_PROC("StaticWndProc",StaticWndProc); MAP_STR_TO_PROC("StaticWndProc",StaticWndProc);
MAP_STR_TO_PROC("SystemMessageBoxProc",SystemMessageBoxProc);
MAP_STR_TO_PROC("TASK_Reschedule",TASK_Reschedule); MAP_STR_TO_PROC("TASK_Reschedule",TASK_Reschedule);
fprintf(stderr,"warning: No mapping for %s(), add one in library/miscstubs.c\n",name); fprintf(stderr,"warning: No mapping for %s(), add one in library/miscstubs.c\n",name);
return NULL; return NULL;
......
...@@ -26,7 +26,7 @@ int main( int argc, char *argv [] ) ...@@ -26,7 +26,7 @@ int main( int argc, char *argv [] )
for (i = 2; i < argc; i++) strcat(strcat(lpszCmdParam, " "), argv[i]); for (i = 2; i < argc; i++) strcat(strcat(lpszCmdParam, " "), argv[i]);
if(!MAIN_Init()) return 0; /* JBP: Needed for DosDrives[] structure, etc. */ if(!MAIN_Init()) return 0; /* JBP: Needed for DosDrives[] structure, etc. */
hInstance = WinExec( *argv, SW_SHOWNORMAL ); hInstance = WinExec32( *argv, SW_SHOWNORMAL );
TASK_Reschedule(); TASK_Reschedule();
InitApp( hInstance ); InitApp( hInstance );
......
...@@ -6,7 +6,6 @@ VPATH = @srcdir@ ...@@ -6,7 +6,6 @@ VPATH = @srcdir@
MODULE = loader MODULE = loader
C_SRCS = \ C_SRCS = \
builtin.c \
main.c \ main.c \
module.c \ module.c \
ne_image.c \ ne_image.c \
......
...@@ -18,14 +18,13 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; ...@@ -18,14 +18,13 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "menu.h" #include "menu.h"
#include "atom.h" #include "atom.h"
#include "dialog.h" #include "dialog.h"
#include "directory.h"
#include "drive.h" #include "drive.h"
#include "queue.h" #include "queue.h"
#include "syscolor.h" #include "syscolor.h"
#include "sysmetrics.h" #include "sysmetrics.h"
#include "file.h"
#include "gdi.h" #include "gdi.h"
#include "heap.h" #include "heap.h"
#include "debugger.h"
#include "miscemu.h" #include "miscemu.h"
#include "neexe.h" #include "neexe.h"
#include "options.h" #include "options.h"
...@@ -39,6 +38,9 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; ...@@ -39,6 +38,9 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
#ifndef WINELIB
#include "debugger.h"
#endif
/* Winelib run-time flag */ /* Winelib run-time flag */
#ifdef WINELIB #ifdef WINELIB
...@@ -70,6 +72,9 @@ int MAIN_Init(void) ...@@ -70,6 +72,9 @@ int MAIN_Init(void)
/* Load the configuration file */ /* Load the configuration file */
if (!PROFILE_LoadWineIni()) return 0; if (!PROFILE_LoadWineIni()) return 0;
/* Initialize DOS memory */
if (!DOSMEM_Init()) return 0;
#ifdef WINELIB #ifdef WINELIB
/* Create USER and GDI heap */ /* Create USER and GDI heap */
USER_HeapSel = GlobalAlloc16( GMEM_FIXED, 0x10000 ); USER_HeapSel = GlobalAlloc16( GMEM_FIXED, 0x10000 );
...@@ -83,15 +88,6 @@ int MAIN_Init(void) ...@@ -83,15 +88,6 @@ int MAIN_Init(void)
/* Create built-in modules */ /* Create built-in modules */
if (!BUILTIN_Init()) return 0; if (!BUILTIN_Init()) return 0;
/* Initialize interrupt vectors */
if (!INT_Init()) return 0;
/* Initialize DOS memory */
if (!DOSMEM_Init()) return 0;
/* Initialize the DOS interrupt */
if (!INT21_Init()) return 0;
/* Initialize signal handling */ /* Initialize signal handling */
if (!SIGNAL_Init()) return 0; if (!SIGNAL_Init()) return 0;
...@@ -182,7 +178,7 @@ int main(int argc, char *argv[] ) ...@@ -182,7 +178,7 @@ int main(int argc, char *argv[] )
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)
{ {
if ((handle = WinExec( argv[i], SW_SHOWNORMAL )) < 32) if ((handle = WinExec32( argv[i], SW_SHOWNORMAL )) < 32)
{ {
fprintf(stderr, "wine: can't exec '%s': ", argv[i]); fprintf(stderr, "wine: can't exec '%s': ", argv[i]);
switch (handle) switch (handle)
......
...@@ -68,7 +68,7 @@ BOOL NE_LoadSegment( HMODULE16 hModule, WORD segnum ) ...@@ -68,7 +68,7 @@ BOOL NE_LoadSegment( HMODULE16 hModule, WORD segnum )
SELFLOADHEADER *selfloadheader; SELFLOADHEADER *selfloadheader;
STACK16FRAME *stack16Top; STACK16FRAME *stack16Top;
WORD oldss, oldsp, oldselector, newselector; WORD oldss, oldsp, oldselector, newselector;
HFILE hf = FILE_DupUnixHandle( fd ); HFILE32 hf = FILE_DupUnixHandle( fd );
selfloadheader = (SELFLOADHEADER *) selfloadheader = (SELFLOADHEADER *)
PTR_SEG_OFF_TO_LIN(pSegTable->selector,0); PTR_SEG_OFF_TO_LIN(pSegTable->selector,0);
...@@ -89,7 +89,7 @@ BOOL NE_LoadSegment( HMODULE16 hModule, WORD segnum ) ...@@ -89,7 +89,7 @@ BOOL NE_LoadSegment( HMODULE16 hModule, WORD segnum )
stack16Top->cs = 0; stack16Top->cs = 0;
newselector = CallTo16_word_www( selfloadheader->LoadAppSeg, newselector = CallTo16_word_www( selfloadheader->LoadAppSeg,
hModule, hf, segnum ); hModule, hf, segnum );
_lclose( hf ); _lclose32( hf );
if (newselector != oldselector) { if (newselector != oldselector) {
/* Self loaders like creating their own selectors; /* Self loaders like creating their own selectors;
* they love asking for trouble to Wine developers * they love asking for trouble to Wine developers
......
...@@ -234,7 +234,7 @@ HGLOBAL16 NE_AllocResource( HMODULE16 hModule, HRSRC16 hRsrc, DWORD size ) ...@@ -234,7 +234,7 @@ HGLOBAL16 NE_AllocResource( HMODULE16 hModule, HRSRC16 hRsrc, DWORD size )
int NE_AccessResource( HMODULE16 hModule, HRSRC16 hRsrc ) int NE_AccessResource( HMODULE16 hModule, HRSRC16 hRsrc )
{ {
NE_NAMEINFO *pNameInfo=NULL; NE_NAMEINFO *pNameInfo=NULL;
int fd; HFILE32 fd;
NE_MODULE *pModule = MODULE_GetPtr( hModule ); NE_MODULE *pModule = MODULE_GetPtr( hModule );
if (!pModule || !pModule->res_table) return -1; if (!pModule || !pModule->res_table) return -1;
...@@ -242,10 +242,10 @@ int NE_AccessResource( HMODULE16 hModule, HRSRC16 hRsrc ) ...@@ -242,10 +242,10 @@ int NE_AccessResource( HMODULE16 hModule, HRSRC16 hRsrc )
pNameInfo = (NE_NAMEINFO*)((char*)pModule + hRsrc); pNameInfo = (NE_NAMEINFO*)((char*)pModule + hRsrc);
#endif #endif
if ((fd = _lopen( NE_MODULE_NAME(pModule), OF_READ )) != -1) if ((fd = _lopen32( NE_MODULE_NAME(pModule), OF_READ )) != -1)
{ {
WORD sizeShift = *(WORD *)((char *)pModule + pModule->res_table); WORD sizeShift = *(WORD *)((char *)pModule + pModule->res_table);
_llseek( fd, (int)pNameInfo->offset << sizeShift, SEEK_SET ); _llseek32( fd, (int)pNameInfo->offset << sizeShift, SEEK_SET );
} }
return fd; return fd;
} }
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "global.h" #include "global.h"
#include "task.h" #include "task.h"
#include "ldt.h" #include "ldt.h"
#include "registers.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
#include "debugger.h" #include "debugger.h"
...@@ -419,7 +418,8 @@ problem needs to be fixed properly at some stage */ ...@@ -419,7 +418,8 @@ problem needs to be fixed properly at some stage */
load_addr = pe->load_addr = (int)xmalloc(pe->vma_size); load_addr = pe->load_addr = (int)xmalloc(pe->vma_size);
dprintf_win32(stddeb, "Load addr is really %x, range %x\n", dprintf_win32(stddeb, "Load addr is really %x, range %x\n",
pe->load_addr, pe->vma_size); pe->load_addr, pe->vma_size);
memset( (void *)load_addr, 0, pe->vma_size);
for(i=0; i < pe->pe_header->coff.NumberOfSections; i++) for(i=0; i < pe->pe_header->coff.NumberOfSections; i++)
{ {
...@@ -575,7 +575,6 @@ problem needs to be fixed properly at some stage */ ...@@ -575,7 +575,6 @@ problem needs to be fixed properly at some stage */
} }
HINSTANCE16 MODULE_CreateInstance(HMODULE16 hModule,LOADPARAMS *params); HINSTANCE16 MODULE_CreateInstance(HMODULE16 hModule,LOADPARAMS *params);
void InitTask( SIGCONTEXT *context );
HINSTANCE16 PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params ) HINSTANCE16 PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params )
{ {
...@@ -636,49 +635,6 @@ static void PE_InitDLL(HMODULE16 hModule) ...@@ -636,49 +635,6 @@ static void PE_InitDLL(HMODULE16 hModule)
} }
} }
/* FIXME: This stuff is all on a "well it works" basis. An implementation
based on some kind of documentation would be greatly appreciated :-) */
typedef struct _TEB
{
void *Except; /* 00 */
void *stack; /* 04 */
int dummy1[4]; /* 08 */
struct _TEB *TEBDSAlias; /* 18 */
int dummy2[2]; /* 1C */
int taskid; /* 24 */
int dummy3[2]; /* 28 */
LPBYTE process; /* 30 */ /* points to current process struct */
} TEB;
/* the current process structure. Only the processheap is of interest (off 0x18) */
struct {
DWORD dummy[6];
HANDLE32 procheap; /* 18: Process Heap */
} dummyprocess;
void PE_InitTEB(int hTEB)
{
TDB *pTask;
TEB *pTEB;
pTask = (TDB *)(GlobalLock16(GetCurrentTask() & 0xffff));
pTEB = (TEB *)(GlobalLock16(hTEB));
pTEB->stack = (void *)pTask->esp;
pTEB->Except = (void *)(-1);
pTEB->TEBDSAlias = pTEB;
pTEB->taskid = getpid();
dummyprocess.procheap = GetProcessHeap();
pTEB->process = &dummyprocess;
}
VOID
NtCurrentTeb(CONTEXT *context) {
context->Eax = GlobalLock16(LOWORD(context->SegFs));
}
void PE_InitializeDLLs(HMODULE16 hModule) void PE_InitializeDLLs(HMODULE16 hModule)
{ {
NE_MODULE *pModule; NE_MODULE *pModule;
......
...@@ -22,9 +22,8 @@ ...@@ -22,9 +22,8 @@
#endif #endif
#include "debugger.h" #include "debugger.h"
#include "miscemu.h"
#include "options.h" #include "options.h"
#include "registers.h" #include "sigcontext.h"
#include "win.h" #include "win.h"
#include "winsock.h" #include "winsock.h"
...@@ -51,6 +50,7 @@ wine_sigaction(int sig,struct sigaction * new, struct sigaction * old) ...@@ -51,6 +50,7 @@ wine_sigaction(int sig,struct sigaction * new, struct sigaction * old)
} }
#endif #endif
extern BOOL32 INSTR_EmulateInstruction( SIGCONTEXT *context );
/********************************************************************** /**********************************************************************
* wine_timer * wine_timer
...@@ -139,17 +139,17 @@ static void SIGNAL_fault(int signal, void *siginfo, SIGCONTEXT *context) ...@@ -139,17 +139,17 @@ static void SIGNAL_fault(int signal, void *siginfo, SIGCONTEXT *context)
static void SIGNAL_fault(int signal, int code, SIGCONTEXT *context) static void SIGNAL_fault(int signal, int code, SIGCONTEXT *context)
{ {
#endif #endif
if (CS_reg(context) == WINE_CODE_SELECTOR) if (CS_sig(context) == WINE_CODE_SELECTOR)
{ {
fprintf( stderr, "Segmentation fault in Wine program (%x:%lx)." fprintf( stderr, "Segmentation fault in Wine program (%x:%lx)."
" Please debug.\n", " Please debug.\n",
CS_reg(context), EIP_reg(context) ); CS_sig(context), EIP_sig(context) );
} }
else else
{ {
if (INSTR_EmulateInstruction( context )) return; if (INSTR_EmulateInstruction( context )) return;
fprintf( stderr, "Segmentation fault in Windows program %x:%lx.\n", fprintf( stderr, "Segmentation fault in Windows program %x:%lx.\n",
CS_reg(context), EIP_reg(context) ); CS_sig(context), EIP_sig(context) );
} }
wine_debug( signal, context ); wine_debug( signal, context );
} }
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
* Copyright 1996 Alexandre Julliard * Copyright 1996 Alexandre Julliard
*/ */
#include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "windows.h" #include "windows.h"
#include "debugger.h"
#include "selectors.h" #include "selectors.h"
#include "winbase.h" #include "winbase.h"
#include "winerror.h" #include "winerror.h"
...@@ -187,7 +187,7 @@ static HEAP *HEAP_GetPtr( HANDLE32 heap ) ...@@ -187,7 +187,7 @@ static HEAP *HEAP_GetPtr( HANDLE32 heap )
if (debugging_heap && !HeapValidate( heap, 0, NULL )) if (debugging_heap && !HeapValidate( heap, 0, NULL ))
{ {
HEAP_Dump( heapPtr ); HEAP_Dump( heapPtr );
DEBUG_EnterDebugger(); assert( FALSE );
SetLastError( ERROR_INVALID_HANDLE ); SetLastError( ERROR_INVALID_HANDLE );
return NULL; return NULL;
} }
...@@ -1204,12 +1204,28 @@ BOOL32 HeapWalk( HANDLE32 heap, void *entry ) ...@@ -1204,12 +1204,28 @@ BOOL32 HeapWalk( HANDLE32 heap, void *entry )
/*********************************************************************** /***********************************************************************
* HEAP_xalloc
*
* Same as HeapAlloc(), but die on failure.
*/
LPVOID HEAP_xalloc( HANDLE32 heap, DWORD flags, DWORD size )
{
LPVOID p = HeapAlloc( heap, flags, size );
if (!p)
{
fprintf( stderr, "Virtual memory exhausted.\n" );
exit(1);
}
return p;
}
/***********************************************************************
* HEAP_strdupA * HEAP_strdupA
*/ */
LPSTR HEAP_strdupA( HANDLE32 heap, DWORD flags, LPCSTR str ) LPSTR HEAP_strdupA( HANDLE32 heap, DWORD flags, LPCSTR str )
{ {
INT32 len = lstrlen32A(str) + 1; LPSTR p = HEAP_xalloc( heap, flags, lstrlen32A(str) + 1 );
LPSTR p = HeapAlloc( heap, flags, len );
lstrcpy32A( p, str ); lstrcpy32A( p, str );
return p; return p;
} }
...@@ -1221,7 +1237,7 @@ LPSTR HEAP_strdupA( HANDLE32 heap, DWORD flags, LPCSTR str ) ...@@ -1221,7 +1237,7 @@ LPSTR HEAP_strdupA( HANDLE32 heap, DWORD flags, LPCSTR str )
LPWSTR HEAP_strdupW( HANDLE32 heap, DWORD flags, LPCWSTR str ) LPWSTR HEAP_strdupW( HANDLE32 heap, DWORD flags, LPCWSTR str )
{ {
INT32 len = lstrlen32W(str) + 1; INT32 len = lstrlen32W(str) + 1;
LPWSTR p = HeapAlloc( heap, flags, len * sizeof(WCHAR) ); LPWSTR p = HEAP_xalloc( heap, flags, len * sizeof(WCHAR) );
lstrcpy32W( p, str ); lstrcpy32W( p, str );
return p; return p;
} }
...@@ -1235,11 +1251,7 @@ LPWSTR HEAP_strdupAtoW( HANDLE32 heap, DWORD flags, LPCSTR str ) ...@@ -1235,11 +1251,7 @@ LPWSTR HEAP_strdupAtoW( HANDLE32 heap, DWORD flags, LPCSTR str )
LPWSTR ret; LPWSTR ret;
if (!str) return NULL; if (!str) return NULL;
if (!(ret = HeapAlloc( heap, flags, (lstrlen32A(str)+1) * sizeof(WCHAR) ))) ret = HEAP_xalloc( heap, flags, (lstrlen32A(str)+1) * sizeof(WCHAR) );
{
fprintf( stderr, "Virtual memory exhausted.\n" );
exit(1);
}
lstrcpyAtoW( ret, str ); lstrcpyAtoW( ret, str );
return ret; return ret;
} }
...@@ -1253,11 +1265,7 @@ LPSTR HEAP_strdupWtoA( HANDLE32 heap, DWORD flags, LPCWSTR str ) ...@@ -1253,11 +1265,7 @@ LPSTR HEAP_strdupWtoA( HANDLE32 heap, DWORD flags, LPCWSTR str )
LPSTR ret; LPSTR ret;
if (!str) return NULL; if (!str) return NULL;
if (!(ret = HeapAlloc( heap, flags, lstrlen32W(str) + 1 ))) ret = HEAP_xalloc( heap, flags, lstrlen32W(str) + 1 );
{
fprintf( stderr, "Virtual memory exhausted.\n" );
exit(1);
}
lstrcpyWtoA( ret, str ); lstrcpyWtoA( ret, str );
return ret; return ret;
} }
...@@ -271,14 +271,11 @@ DWORD GetSelectorBase( WORD sel ) ...@@ -271,14 +271,11 @@ DWORD GetSelectorBase( WORD sel )
base = GET_SEL_BASE(sel); base = GET_SEL_BASE(sel);
#ifndef WINELIB
/* if base points into DOSMEM, assume we have to /* if base points into DOSMEM, assume we have to
* return pointer into physical lower 1MB * return pointer into physical lower 1MB
*/ */
if ((base >= (DWORD)DOSMEM_dosmem) && if ((base >= (DWORD)DOSMEM_dosmem) &&
(base < ((DWORD)DOSMEM_dosmem+0x100000))) (base < (DWORD)DOSMEM_dosmem+0x100000)) base -= (DWORD)DOSMEM_dosmem;
base = base - (DWORD)DOSMEM_dosmem;
#endif
return base; return base;
} }
......
...@@ -11,6 +11,7 @@ C_SRCS = \ ...@@ -11,6 +11,7 @@ C_SRCS = \
commdlg.c \ commdlg.c \
compobj.c \ compobj.c \
crtdll.c \ crtdll.c \
cpu.c \
driver.c \ driver.c \
exec.c \ exec.c \
escape.c \ escape.c \
......
...@@ -739,7 +739,7 @@ UINT16 *SetCommEventMask(INT16 fd,UINT16 fuEvtMask) ...@@ -739,7 +739,7 @@ UINT16 *SetCommEventMask(INT16 fd,UINT16 fuEvtMask)
{ {
dprintf_comm(stddeb,"SetCommEventMask:fd %d,mask %d\n",fd,fuEvtMask); dprintf_comm(stddeb,"SetCommEventMask:fd %d,mask %d\n",fd,fuEvtMask);
eventmask |= fuEvtMask; eventmask |= fuEvtMask;
return (UINT *)&eventmask; /* FIXME, should be SEGPTR */ return (UINT16 *)&eventmask; /* FIXME, should be SEGPTR */
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
int runtime_cpu (void) int runtime_cpu (void)
{ {
#ifndef __i386__
return 5; /* Might as well pretend to be a Pentium... */
#else /* __i386__ */
static int cache = 0; static int cache = 0;
#ifdef linux #ifdef linux
...@@ -37,8 +40,8 @@ int runtime_cpu (void) ...@@ -37,8 +40,8 @@ int runtime_cpu (void)
} }
} }
return cache; return cache;
#else #endif /* linux */
/* FIXME: how do we do this on other systems? */ /* FIXME: how do we do this on other systems? */
return 3; return 3;
#endif #endif /* __i386__ */
} }
/* /*
* Windows Exec & Help * Windows Exec & Help
* */
*/
#define NO_TRANSITION_TYPES /* This file is Win32-clean */
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
...@@ -15,21 +15,6 @@ ...@@ -15,21 +15,6 @@
#include "debug.h" #include "debug.h"
#include "win.h" #include "win.h"
#define HELP_CONTEXT 0x0001
#define HELP_QUIT 0x0002
#define HELP_INDEX 0x0003
#define HELP_CONTENTS 0x0003
#define HELP_HELPONHELP 0x0004
#define HELP_SETINDEX 0x0005
#define HELP_SETCONTENTS 0x0005
#define HELP_CONTEXTPOPUP 0x0008
#define HELP_FORCEFILE 0x0009
#define HELP_KEY 0x0101
#define HELP_COMMAND 0x0102
#define HELP_PARTIALKEY 0x0105
#define HELP_MULTIKEY 0x0201
#define HELP_SETWINPOS 0x0203
/*********************************************************************** /***********************************************************************
* EXEC_ExitWindows * EXEC_ExitWindows
...@@ -38,29 +23,35 @@ ...@@ -38,29 +23,35 @@
* This is the back-end of ExitWindows(), called when all windows * This is the back-end of ExitWindows(), called when all windows
* have agreed to be terminated. * have agreed to be terminated.
*/ */
void EXEC_ExitWindows( int retCode ) void EXEC_ExitWindows(void)
{ {
/* Do the clean-up stuff */ /* Do the clean-up stuff */
WriteOutProfiles(); WriteOutProfiles();
SHELL_SaveRegistry(); SHELL_SaveRegistry();
exit( retCode ); exit(0);
} }
/*********************************************************************** /***********************************************************************
* ExitWindows (USER.7) * ExitWindows16 (USER.7)
*/ */
BOOL ExitWindows( DWORD dwReturnCode, WORD wReserved ) BOOL16 ExitWindows16( DWORD dwReturnCode, UINT16 wReserved )
{
return ExitWindowsEx( EWX_LOGOFF, 0xffffffff );
}
/***********************************************************************
* ExitWindowsEx (USER32.195)
*/
BOOL32 ExitWindowsEx( UINT32 flags, DWORD reserved )
{ {
int i; int i;
BOOL16 result; BOOL32 result;
WND **list, **ppWnd; WND **list, **ppWnd;
api_assert("ExitWindows", wReserved == 0);
api_assert("ExitWindows", HIWORD(dwReturnCode) == 0);
/* We have to build a list of all windows first, as in EnumWindows */ /* We have to build a list of all windows first, as in EnumWindows */
if (!(list = WIN_BuildWinArray( WIN_GetDesktop() ))) return FALSE; if (!(list = WIN_BuildWinArray( WIN_GetDesktop() ))) return FALSE;
...@@ -85,24 +76,35 @@ BOOL ExitWindows( DWORD dwReturnCode, WORD wReserved ) ...@@ -85,24 +76,35 @@ BOOL ExitWindows( DWORD dwReturnCode, WORD wReserved )
} }
HeapFree( SystemHeap, 0, list ); HeapFree( SystemHeap, 0, list );
if (result) EXEC_ExitWindows( LOWORD(dwReturnCode) ); if (result) EXEC_ExitWindows();
return FALSE; return FALSE;
} }
/********************************************************************** /**********************************************************************
* WinHelp [USER.171] * WinHelp16 (USER.171)
*/ */
BOOL WinHelp(HWND hWnd, LPSTR lpHelpFile, WORD wCommand, DWORD dwData) BOOL16 WinHelp16( HWND16 hWnd, LPCSTR lpHelpFile, UINT16 wCommand,
DWORD dwData )
{
return WinHelp32A( hWnd, lpHelpFile, wCommand,
(DWORD)PTR_SEG_TO_LIN(dwData) );
}
/**********************************************************************
* WinHelp32A (USER32.578)
*/
BOOL32 WinHelp32A( HWND32 hWnd, LPCSTR lpHelpFile, UINT32 wCommand,
DWORD dwData )
{ {
static WORD WM_WINHELP=0; static WORD WM_WINHELP=0;
HWND hDest; HWND32 hDest;
LPWINHELP lpwh; LPWINHELP lpwh;
HGLOBAL16 hwh; HGLOBAL16 hwh;
void *data=0;
int size,dsize,nlen; int size,dsize,nlen;
if (wCommand != HELP_QUIT) /* FIXME */ if (wCommand != HELP_QUIT) /* FIXME */
if(WinExec("winhelp.exe -x",SW_SHOWNORMAL)<=32) if(WinExec32("winhelp.exe -x",SW_SHOWNORMAL)<=32)
return FALSE; return FALSE;
/* FIXME: Should be directed yield, to let winhelp open the window */ /* FIXME: Should be directed yield, to let winhelp open the window */
Yield(); Yield();
...@@ -131,16 +133,13 @@ BOOL WinHelp(HWND hWnd, LPSTR lpHelpFile, WORD wCommand, DWORD dwData) ...@@ -131,16 +133,13 @@ BOOL WinHelp(HWND hWnd, LPSTR lpHelpFile, WORD wCommand, DWORD dwData)
case HELP_KEY: case HELP_KEY:
case HELP_PARTIALKEY: case HELP_PARTIALKEY:
case HELP_COMMAND: case HELP_COMMAND:
data = PTR_SEG_TO_LIN(dwData); dsize = strlen( (LPSTR)dwData )+1;
dsize = strlen(data)+1;
break; break;
case HELP_MULTIKEY: case HELP_MULTIKEY:
data = PTR_SEG_TO_LIN(dwData); dsize = ((LPMULTIKEYHELP)dwData)->mkSize;
dsize = ((LPMULTIKEYHELP)data) -> mkSize;
break; break;
case HELP_SETWINPOS: case HELP_SETWINPOS:
data = PTR_SEG_TO_LIN(dwData); dsize = ((LPHELPWININFO)dwData)->wStructSize;
dsize = ((LPHELPWININFO)data) -> wStructSize;
break; break;
default: default:
fprintf(stderr,"Unknown help command %d\n",wCommand); fprintf(stderr,"Unknown help command %d\n",wCommand);
...@@ -160,10 +159,23 @@ BOOL WinHelp(HWND hWnd, LPSTR lpHelpFile, WORD wCommand, DWORD dwData) ...@@ -160,10 +159,23 @@ BOOL WinHelp(HWND hWnd, LPSTR lpHelpFile, WORD wCommand, DWORD dwData)
strcpy(((char*)lpwh) + sizeof(WINHELP),lpHelpFile); strcpy(((char*)lpwh) + sizeof(WINHELP),lpHelpFile);
} }
if(dsize) { if(dsize) {
memcpy(((char*)lpwh)+sizeof(WINHELP)+nlen,data,dsize); memcpy(((char*)lpwh)+sizeof(WINHELP)+nlen,(LPSTR)dwData,dsize);
lpwh->ofsData = sizeof(WINHELP)+nlen; lpwh->ofsData = sizeof(WINHELP)+nlen;
} else } else
lpwh->ofsData = 0; lpwh->ofsData = 0;
GlobalUnlock16(hwh); GlobalUnlock16(hwh);
return SendMessage16(hDest,WM_WINHELP,hWnd,hwh); return SendMessage16(hDest,WM_WINHELP,hWnd,hwh);
} }
/**********************************************************************
* WinHelp32W (USER32.579)
*/
BOOL32 WinHelp32W( HWND32 hWnd, LPCWSTR helpFile, UINT32 command,
DWORD dwData )
{
LPSTR file = HEAP_strdupWtoA( GetProcessHeap(), 0, helpFile );
BOOL32 ret = WinHelp32A( hWnd, file, command, dwData );
HeapFree( GetProcessHeap(), 0, file );
return ret;
}
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
#include <ctype.h> #include <ctype.h>
#include "windows.h" #include "windows.h"
#include "heap.h"
#include "ldt.h" #include "ldt.h"
#include "module.h" #include "module.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
#include "xmalloc.h" #include "xmalloc.h"
#include "string32.h"
#define ToUpper(c) toupper(c) #define ToUpper(c) toupper(c)
#define ToLower(c) tolower(c) #define ToLower(c) tolower(c)
...@@ -173,7 +173,7 @@ SEGPTR AnsiPrev( SEGPTR start, SEGPTR current) ...@@ -173,7 +173,7 @@ SEGPTR AnsiPrev( SEGPTR start, SEGPTR current)
void OutputDebugString( LPCSTR str ) void OutputDebugString( LPCSTR str )
{ {
char *module; char *module;
char *p, *buffer = xmalloc( strlen(str)+1 ); char *p, *buffer = HeapAlloc( GetProcessHeap(), 0, strlen(str)+1 );
/* Remove CRs */ /* Remove CRs */
for (p = buffer; *str; str++) if (*str != '\r') *p++ = *str; for (p = buffer; *str; str++) if (*str != '\r') *p++ = *str;
*p = '\0'; *p = '\0';
...@@ -181,7 +181,7 @@ void OutputDebugString( LPCSTR str ) ...@@ -181,7 +181,7 @@ void OutputDebugString( LPCSTR str )
module = MODULE_GetModuleName( GetExePtr(GetCurrentTask()) ); module = MODULE_GetModuleName( GetExePtr(GetCurrentTask()) );
fprintf( stderr, "OutputDebugString: %s says '%s'\n", fprintf( stderr, "OutputDebugString: %s says '%s'\n",
module ? module : "???", buffer ); module ? module : "???", buffer );
free( buffer ); HeapFree( GetProcessHeap(), 0, buffer );
} }
/*********************************************************************** /***********************************************************************
...@@ -506,7 +506,7 @@ FormatMessage32A( ...@@ -506,7 +506,7 @@ FormatMessage32A(
fprintf(stdnimp," - line wrapping not supported.\n"); fprintf(stdnimp," - line wrapping not supported.\n");
from = NULL; from = NULL;
if (dwFlags & FORMAT_MESSAGE_FROM_STRING) if (dwFlags & FORMAT_MESSAGE_FROM_STRING)
from = xstrdup((LPSTR)lpSource); from = HEAP_strdupA( GetProcessHeap(), 0, (LPSTR)lpSource);
if (dwFlags & FORMAT_MESSAGE_FROM_SYSTEM) { if (dwFlags & FORMAT_MESSAGE_FROM_SYSTEM) {
/* gather information from system message tables ... */ /* gather information from system message tables ... */
fprintf(stdnimp," - FORMAT_MESSAGE_FROM_SYSTEM not implemented.\n"); fprintf(stdnimp," - FORMAT_MESSAGE_FROM_SYSTEM not implemented.\n");
...@@ -517,11 +517,11 @@ FormatMessage32A( ...@@ -517,11 +517,11 @@ FormatMessage32A(
dwMessageId &= 0xFFFF; dwMessageId &= 0xFFFF;
bufsize=LoadMessage32A(0,dwMessageId,dwLanguageId,NULL,100); bufsize=LoadMessage32A(0,dwMessageId,dwLanguageId,NULL,100);
if (bufsize) { if (bufsize) {
from = (char*)xmalloc(bufsize+1); from = HeapAlloc( GetProcessHeap(), 0, bufsize + 1 );
LoadMessage32A(0,dwMessageId,dwLanguageId,from,bufsize+1); LoadMessage32A(0,dwMessageId,dwLanguageId,from,bufsize+1);
} }
} }
target = (char*)xmalloc(100); target = HeapAlloc( GetProcessHeap(), 0, 100);
t = target; t = target;
talloced= 100; talloced= 100;
*t = 0; *t = 0;
...@@ -568,12 +568,12 @@ FormatMessage32A( ...@@ -568,12 +568,12 @@ FormatMessage32A(
f++; f++;
if (NULL!=(x=strchr(f,'!'))) { if (NULL!=(x=strchr(f,'!'))) {
*x='\0'; *x='\0';
fmtstr=(char*)xmalloc(strlen(f)+2); fmtstr=HeapAlloc(GetProcessHeap(),0,strlen(f)+2);
sprintf(fmtstr,"%%%s",f); sprintf(fmtstr,"%%%s",f);
f=x+1; f=x+1;
} }
} else } else
fmtstr=strdup("%s"); fmtstr=HEAP_strdupA(GetProcessHeap(),0,"%s");
if (dwFlags & FORMAT_MESSAGE_ARGUMENT_ARRAY) if (dwFlags & FORMAT_MESSAGE_ARGUMENT_ARRAY)
argliststart=args+insertnr-1; argliststart=args+insertnr-1;
else else
...@@ -583,16 +583,16 @@ FormatMessage32A( ...@@ -583,16 +583,16 @@ FormatMessage32A(
argliststart=((DWORD*)&args)+insertnr-1; argliststart=((DWORD*)&args)+insertnr-1;
if (fmtstr[strlen(fmtstr)]=='s') if (fmtstr[strlen(fmtstr)]=='s')
sprintfbuf=(char*)xmalloc(strlen((LPSTR)argliststart[0])+1); sprintfbuf=HeapAlloc(GetProcessHeap(),0,strlen((LPSTR)argliststart[0])+1);
else else
sprintfbuf=(char*)xmalloc(100); sprintfbuf=HeapAlloc(GetProcessHeap(),0,100);
vsprintf(sprintfbuf,fmtstr,argliststart); vsprintf(sprintfbuf,fmtstr,argliststart);
x=sprintfbuf; x=sprintfbuf;
while (*x) { while (*x) {
ADD_TO_T(*x++); ADD_TO_T(*x++);
} }
free(sprintfbuf); HeapFree(GetProcessHeap(),0,sprintfbuf);
free(fmtstr); HeapFree(GetProcessHeap(),0,fmtstr);
break; break;
case '0': case '0':
nolinefeed=1; nolinefeed=1;
...@@ -620,8 +620,8 @@ FormatMessage32A( ...@@ -620,8 +620,8 @@ FormatMessage32A(
memcpy(*(LPSTR*)lpBuffer,target,talloced); memcpy(*(LPSTR*)lpBuffer,target,talloced);
} else } else
strncpy(lpBuffer,target,nSize); strncpy(lpBuffer,target,nSize);
free(target); HeapFree(GetProcessHeap(),0,target);
if (from) free(from); if (from) HeapFree(GetProcessHeap(),0,from);
return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ? return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ?
strlen(*(LPSTR*)lpBuffer): strlen(*(LPSTR*)lpBuffer):
strlen(lpBuffer); strlen(lpBuffer);
...@@ -689,7 +689,7 @@ FormatMessage32W( ...@@ -689,7 +689,7 @@ FormatMessage32W(
fprintf(stdnimp," - line wrapping not supported.\n"); fprintf(stdnimp," - line wrapping not supported.\n");
from = NULL; from = NULL;
if (dwFlags & FORMAT_MESSAGE_FROM_STRING) if (dwFlags & FORMAT_MESSAGE_FROM_STRING)
from = STRING32_DupUniToAnsi((LPWSTR)lpSource); from = HEAP_strdupWtoA(GetProcessHeap(),0,(LPWSTR)lpSource);
if (dwFlags & FORMAT_MESSAGE_FROM_SYSTEM) { if (dwFlags & FORMAT_MESSAGE_FROM_SYSTEM) {
/* gather information from system message tables ... */ /* gather information from system message tables ... */
fprintf(stdnimp," - FORMAT_MESSAGE_FROM_SYSTEM not implemented.\n"); fprintf(stdnimp," - FORMAT_MESSAGE_FROM_SYSTEM not implemented.\n");
...@@ -699,12 +699,13 @@ FormatMessage32W( ...@@ -699,12 +699,13 @@ FormatMessage32W(
dwMessageId &= 0xFFFF; dwMessageId &= 0xFFFF;
bufsize=LoadMessage32A(0,dwMessageId,dwLanguageId,NULL,100); bufsize=LoadMessage32A(0,dwMessageId,dwLanguageId,NULL,100);
if (bufsize) { if (bufsize)
from = (char*)xmalloc(bufsize+1); {
LoadMessage32A(0,dwMessageId,dwLanguageId,from,bufsize+1); from = HeapAlloc( GetProcessHeap(), 0, bufsize + 1 );
LoadMessage32A(0,dwMessageId,dwLanguageId,from,bufsize+1);
} }
} }
target = (char*)xmalloc(100); target = HeapAlloc( GetProcessHeap(), 0, 100 );
t = target; t = target;
talloced= 100; talloced= 100;
*t = 0; *t = 0;
...@@ -749,14 +750,15 @@ FormatMessage32W( ...@@ -749,14 +750,15 @@ FormatMessage32W(
} }
if (*f=='!') { if (*f=='!') {
f++; f++;
if (NULL!=(x=strchr(f,'!'))) { if (NULL!=(x=strchr(f,'!')))
*x='\0'; {
fmtstr=(char*)xmalloc(strlen(f)+2); *x='\0';
fmtstr=HeapAlloc( GetProcessHeap(), 0, strlen(f)+2);
sprintf(fmtstr,"%%%s",f); sprintf(fmtstr,"%%%s",f);
f=x+1; f=x+1;
} }
} else } else
fmtstr=strdup("%s"); fmtstr=HEAP_strdupA( GetProcessHeap(),0,"%s");
if (dwFlags & FORMAT_MESSAGE_ARGUMENT_ARRAY) if (dwFlags & FORMAT_MESSAGE_ARGUMENT_ARRAY)
argliststart=args+insertnr-1; argliststart=args+insertnr-1;
else else
...@@ -768,22 +770,22 @@ FormatMessage32W( ...@@ -768,22 +770,22 @@ FormatMessage32W(
if (fmtstr[strlen(fmtstr)]=='s') { if (fmtstr[strlen(fmtstr)]=='s') {
DWORD xarr[3]; DWORD xarr[3];
xarr[0]=(DWORD)STRING32_DupUniToAnsi((LPWSTR)(*(argliststart+0))); xarr[0]=(DWORD)HEAP_strdupWtoA(GetProcessHeap(),0,(LPWSTR)(*(argliststart+0)));
/* possible invalid pointers */ /* possible invalid pointers */
xarr[1]=*(argliststart+1); xarr[1]=*(argliststart+1);
xarr[2]=*(argliststart+2); xarr[2]=*(argliststart+2);
sprintfbuf=(char*)xmalloc(lstrlen32W((LPWSTR)argliststart[0])*2+1); sprintfbuf=HeapAlloc(GetProcessHeap(),0,lstrlen32W((LPWSTR)argliststart[0])*2+1);
vsprintf(sprintfbuf,fmtstr,xarr); vsprintf(sprintfbuf,fmtstr,xarr);
} else { } else {
sprintfbuf=(char*)xmalloc(100); sprintfbuf=HeapAlloc(GetProcessHeap(),0,100);
vsprintf(sprintfbuf,fmtstr,argliststart); vsprintf(sprintfbuf,fmtstr,argliststart);
} }
x=sprintfbuf; x=sprintfbuf;
while (*x) { while (*x) {
ADD_TO_T(*x++); ADD_TO_T(*x++);
} }
free(sprintfbuf); HeapFree(GetProcessHeap(),0,sprintfbuf);
free(fmtstr); HeapFree(GetProcessHeap(),0,fmtstr);
break; break;
case '0': case '0':
nolinefeed=1; nolinefeed=1;
...@@ -810,8 +812,8 @@ FormatMessage32W( ...@@ -810,8 +812,8 @@ FormatMessage32W(
lstrcpynAtoW(*(LPWSTR*)lpBuffer,target,talloced); lstrcpynAtoW(*(LPWSTR*)lpBuffer,target,talloced);
} else } else
lstrcpynAtoW(lpBuffer,target,nSize); lstrcpynAtoW(lpBuffer,target,nSize);
free(target); HeapFree(GetProcessHeap(),0,target);
if (from) free(from); if (from) HeapFree(GetProcessHeap(),0,from);
return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ? return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ?
lstrlen32W(*(LPWSTR*)lpBuffer): lstrlen32W(*(LPWSTR*)lpBuffer):
lstrlen32W(lpBuffer); lstrlen32W(lpBuffer);
......
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment