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.
This commit is contained in:
Alexandre Julliard 1997-01-01 17:29:55 +00:00
parent 7ebe1a4135
commit 9ea19e54cb
171 changed files with 5908 additions and 4721 deletions

View File

@ -1,13 +1,13 @@
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
features. Most applications still do not work correctly.
Patches should be submitted to "julliard@lrc.epfl.ch". Please don't
forget to include a ChangeLog entry.
WHAT'S NEW with Wine-961222: (see ChangeLog for details)
- Lots of improvements to the built-in debugger
- Yet more Win32 stuff.
WHAT'S NEW with Wine-970101: (see ChangeLog for details)
- Win32 handle management and related stuff.
- Several files moved around, new directories created.
- Lots of bug fixes.
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
the release is available at the ftp sites. The sources will be available
from the following locations:
ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-961222.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-961222.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-961222.tar.gz
ftp://aris.com/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-970101.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-970101.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.

View File

@ -1,3 +1,85 @@
----------------------------------------------------------------------
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>

View File

@ -53,9 +53,11 @@ COMMONSUBDIRS = \
loader \
memory \
misc \
msdos \
multimedia \
objects \
resources \
scheduler \
win32 \
windows
@ -82,9 +84,11 @@ COMMONOBJS = \
loader/loader.o \
memory/memory.o \
misc/misc.o \
msdos/msdos.o \
multimedia/multimedia.o \
objects/objects.o \
resources/resources.o \
scheduler/scheduler.o \
win32/win32.o \
windows/windows.o

4
configure vendored
View File

@ -2489,6 +2489,7 @@ loader/Makefile
memory/Makefile
misc/Makefile
miscemu/Makefile
msdos/Makefile
multimedia/Makefile
objects/Makefile
programs/Makefile
@ -2496,6 +2497,7 @@ programs/progman/Makefile
programs/winhelp/Makefile
rc/Makefile
resources/Makefile
scheduler/Makefile
tools/Makefile
win32/Makefile
windows/Makefile include/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
@ -2604,6 +2606,7 @@ loader/Makefile
memory/Makefile
misc/Makefile
miscemu/Makefile
msdos/Makefile
multimedia/Makefile
objects/Makefile
programs/Makefile
@ -2611,6 +2614,7 @@ programs/progman/Makefile
programs/winhelp/Makefile
rc/Makefile
resources/Makefile
scheduler/Makefile
tools/Makefile
win32/Makefile
windows/Makefile "}

View File

@ -131,6 +131,7 @@ loader/Makefile
memory/Makefile
misc/Makefile
miscemu/Makefile
msdos/Makefile
multimedia/Makefile
objects/Makefile
programs/Makefile
@ -138,6 +139,7 @@ programs/progman/Makefile
programs/winhelp/Makefile
rc/Makefile
resources/Makefile
scheduler/Makefile
tools/Makefile
win32/Makefile
windows/Makefile ])

View File

@ -10,7 +10,6 @@
#include <unistd.h>
#include "win.h"
#include "desktop.h"
#include "directory.h"
#include "graphics.h"
#include "heap.h"
@ -25,13 +24,13 @@ static HBITMAP32 DESKTOP_LoadBitmap( HDC32 hdc, const char *filename )
BITMAPFILEHEADER *fileHeader;
BITMAPINFO *bitmapInfo;
HBITMAP32 hbitmap;
HFILE file;
HFILE32 file;
LPSTR buffer;
LONG size;
/* 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 );
if (!(buffer = HeapAlloc( SystemHeap, 0, len + strlen(filename) + 2 )))
@ -39,19 +38,19 @@ static HBITMAP32 DESKTOP_LoadBitmap( HDC32 hdc, const char *filename )
GetWindowsDirectory32A( buffer, len + 1 );
strcat( buffer, "\\" );
strcat( buffer, filename );
file = _lopen( buffer, OF_READ );
file = _lopen32( buffer, OF_READ );
HeapFree( SystemHeap, 0, buffer );
}
if (file == HFILE_ERROR) return 0;
size = _llseek( file, 0, 2 );
if (file == HFILE_ERROR32) return 0;
size = _llseek32( file, 0, 2 );
if (!(buffer = HeapAlloc( SystemHeap, 0, size )))
{
_lclose( file );
_lclose32( file );
return 0;
}
_llseek( file, 0, 0 );
_llseek32( file, 0, 0 );
size = _lread32( file, buffer, size );
_lclose( file );
_lclose32( file );
fileHeader = (BITMAPFILEHEADER *)buffer;
bitmapInfo = (BITMAPINFO *)(buffer + sizeof(BITMAPFILEHEADER));
@ -157,7 +156,7 @@ LRESULT DesktopWndProc( HWND32 hwnd, UINT32 message,
case WM_SYSCOMMAND:
if ((wParam & 0xfff0) != SC_CLOSE) return 0;
ExitWindows( 0, 0 );
ExitWindows16( 0, 0 );
case WM_SETCURSOR:
return (LRESULT)SetCursor( LoadCursor16( 0, IDC_ARROW ) );

View File

@ -8,9 +8,8 @@
#include <string.h>
#include <stdio.h>
#include "windows.h"
#include "winerror.h"
#include "drive.h"
#include "dos_fs.h"
#include "msdos.h"
#include "heap.h"
#include "spy.h"
#include "win.h"
@ -478,7 +477,7 @@ static void LISTBOX_PaintItem( WND *wnd, LB_DESCR *descr, HDC32 hdc,
else
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",
wnd->hwndSelf, index, item ? item->str : "", action,
rect->left, rect->top, rect->right, rect->bottom );
@ -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,
LPCSTR filespec, BOOL32 long_names )
{
char mask[13];
const char *ptr;
char *path, *p;
int count, skip, pos;
LRESULT ret;
DOS_DIRENT entry;
HANDLE32 handle;
LRESULT ret = LB_OKAY;
WIN32_FIND_DATA32A entry;
int pos;
/* FIXME: should use FindFirstFile/FindNextFile */
if (!filespec) return LB_ERR;
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 )))
if ((handle = FindFirstFile32A(filespec,&entry)) == INVALID_HANDLE_VALUE32)
{
HeapFree( SystemHeap, 0, path );
return LB_ERR;
if (GetLastError() != ERROR_NO_MORE_FILES) return LB_ERR;
}
strcpy( mask, ptr );
skip = 0;
ret = LB_OKAY;
attrib &= ~FA_LABEL;
while ((count = DOSFS_FindNext( path, mask, NULL, 0,
attrib, skip, &entry )) > 0)
else
{
char buffer[260];
skip += count;
if (entry.attr & FA_DIRECTORY)
do
{
if (!(attrib & DDL_DIRECTORY) || !strcmp(entry.name,". "))
continue;
if (long_names) sprintf( buffer, "[%s]", entry.unixname );
else sprintf( buffer, "[%s]", DOSFS_ToDosDTAFormat( entry.name ) );
}
else /* not a directory */
{
if ((attrib & DDL_EXCLUSIVE) &&
((attrib & (FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_ARCHIVE)) !=
(entry.attr & (FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_ARCHIVE))))
continue;
if (long_names) strcpy( buffer, entry.unixname );
else strcpy( buffer, DOSFS_ToDosDTAFormat( entry.name ) );
}
if (!long_names) AnsiLower( buffer );
pos = LISTBOX_FindFileStrPos( wnd, descr, buffer );
if ((ret = LISTBOX_InsertString( wnd, descr, pos, buffer )) < 0)
break;
char buffer[270];
if (entry.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if (!(attrib & DDL_DIRECTORY) ||
!strcmp( entry.cAlternateFileName, "." )) continue;
if (long_names) sprintf( buffer, "[%s]", entry.cFileName );
else sprintf( buffer, "[%s]", entry.cAlternateFileName );
}
else /* not a directory */
{
#define ATTRIBS (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | \
FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE)
if ((attrib & DDL_EXCLUSIVE) &&
((attrib & ATTRIBS) != (entry.dwFileAttributes & ATTRIBS)))
continue;
#undef ATTRIBS
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))
@ -1517,8 +1506,6 @@ LRESULT LISTBOX_Directory( WND *wnd, LB_DESCR *descr, UINT32 attrib,
break;
}
}
HeapFree( SystemHeap, 0, path );
return ret;
}
@ -1744,6 +1731,7 @@ static LRESULT LISTBOX_HandleTimer( WND *wnd, LB_DESCR *descr,
break;
case LB_TIMER_DOWN:
index = descr->top_item + LISTBOX_GetCurrentPageSize( wnd, descr );
if (index == descr->focus_item) index++;
if (index >= descr->nb_items) index = descr->nb_items - 1;
break;
case LB_TIMER_RIGHT:

View File

@ -88,7 +88,6 @@ static BOOL fEndMenuCalled = FALSE;
extern void NC_DrawSysButton(HWND hwnd, HDC32 hdc, BOOL down); /*nonclient.c*/
extern BOOL NC_GetSysPopupPos(WND* wndPtr, RECT16* rect);
extern HTASK16 TASK_GetNextTask(HTASK16);
static HBITMAP16 hStdCheck = 0;
static HBITMAP16 hStdMnArrow = 0;
@ -111,13 +110,9 @@ static UINT uSubPWndLevel = 0;
static HMENU16 MENU_CopySysMenu(void)
{
HMENU16 hMenu;
HGLOBAL16 handle;
POPUPMENU *menu;
if (!(handle = SYSRES_LoadResource( SYSRES_MENU_SYSMENU ))) return 0;
hMenu = LoadMenuIndirect16( GlobalLock16( handle ) );
SYSRES_FreeResource( handle );
if (!hMenu)
if (!(hMenu = LoadMenuIndirect32A( SYSRES_GetResPtr(SYSRES_MENU_SYSMENU))))
{
dprintf_menu(stddeb,"No SYSMENU\n");
return 0;
@ -1644,8 +1639,8 @@ static void MENU_KeyRight( HWND* hwndOwner, HMENU16* hmenu,
* If 'x' and 'y' are not 0, we simulate a button-down event at (x,y)
* before beginning tracking. This is to help menu-bar tracking.
*/
static BOOL MENU_TrackMenu( HMENU16 hmenu, UINT wFlags, int x, int y,
HWND hwnd, const RECT16 *lprect )
static BOOL32 MENU_TrackMenu( HMENU16 hmenu, UINT32 wFlags, int x, int y,
HWND16 hwnd, const RECT16 *lprect )
{
MSG16 msg;
POPUPMENU *menu;
@ -1660,10 +1655,17 @@ static BOOL MENU_TrackMenu( HMENU16 hmenu, UINT wFlags, int x, int y,
POINT16 pt = { x, y };
MENU_ButtonDown( hwnd, hmenu, &hmenuCurrent, pt );
}
SetCapture32( hwnd );
EVENT_Capture( hwnd, HTMENU );
while (!fClosed)
{
if (!MSG_InternalGetMessage( &msg, 0, hwnd, MSGF_MENU, 0, TRUE ))
/* we have to keep the message in the queue until it's
* clear that menu loop is not over yet.
*/
if (!MSG_InternalGetMessage( &msg, 0, hwnd, MSGF_MENU,
PM_NOREMOVE, TRUE ))
break;
TranslateMessage( &msg );
@ -1672,26 +1674,29 @@ static BOOL MENU_TrackMenu( HMENU16 hmenu, UINT wFlags, int x, int y,
if ((msg.message >= WM_MOUSEFIRST) && (msg.message <= WM_MOUSELAST))
{
/* Find the sub-popup for this mouse event (if any) */
HMENU16 hsubmenu = MENU_FindMenuByCoords( hmenu, msg.pt );
switch(msg.message)
{
/* no WM_NC... messages in captured state */
case WM_RBUTTONDBLCLK:
case WM_RBUTTONDOWN:
case WM_NCRBUTTONDOWN:
if (!(wFlags & TPM_RIGHTBUTTON)) break;
/* fall through */
case WM_LBUTTONDBLCLK:
case WM_LBUTTONDOWN:
case WM_NCLBUTTONDOWN:
fClosed = !MENU_ButtonDown( hwnd, hsubmenu,
&hmenuCurrent, msg.pt );
break;
case WM_RBUTTONUP:
case WM_NCRBUTTONUP:
if (!(wFlags & TPM_RIGHTBUTTON)) break;
/* fall through */
case WM_LBUTTONUP:
case WM_NCLBUTTONUP:
/* If outside all menus but inside lprect, ignore it */
if (!hsubmenu && lprect && PtInRect16(lprect, msg.pt)) break;
fClosed = !MENU_ButtonUp( hwnd, hsubmenu,
@ -1700,7 +1705,6 @@ static BOOL MENU_TrackMenu( HMENU16 hmenu, UINT wFlags, int x, int y,
break;
case WM_MOUSEMOVE:
case WM_NCMOUSEMOVE:
if ((msg.wParam & MK_LBUTTON) ||
((wFlags & TPM_RIGHTBUTTON) && (msg.wParam & MK_RBUTTON)))
{
@ -1814,22 +1818,63 @@ static BOOL MENU_TrackMenu( HMENU16 hmenu, UINT wFlags, int x, int y,
return TRUE;
}
/***********************************************************************
* MENU_TrackSysPopup
*/
static void MENU_TrackSysPopup( WND* pWnd )
{
RECT16 rect;
HMENU16 hMenu = pWnd->hSysMenu;
HDC16 hDC = 0;
/* track the system menu like a normal popup menu */
if( IsMenu(hMenu) )
{
HWND16 hWnd = pWnd->hwndSelf;
if (!(pWnd->dwStyle & WS_MINIMIZE))
{
hDC = GetWindowDC32( hWnd );
NC_DrawSysButton( hWnd, hDC, TRUE );
}
NC_GetSysPopupPos( pWnd, &rect );
MENU_InitSysMenuPopup( hMenu, pWnd->dwStyle,
pWnd->class->style);
TrackPopupMenu16( hMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON,
rect.left, rect.bottom, 0, hWnd, &rect );
if (!(pWnd->dwStyle & WS_MINIMIZE))
{
NC_DrawSysButton( hWnd, hDC, FALSE );
ReleaseDC32( hWnd, hDC );
}
}
}
/***********************************************************************
* MENU_TrackMouseMenuBar
*
* Menu-bar tracking upon a mouse event. Called from NC_HandleSysCommand().
*/
void MENU_TrackMouseMenuBar( HWND hwnd, POINT16 pt )
void MENU_TrackMouseMenuBar( WND* wndPtr, INT16 ht, POINT16 pt )
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
HideCaret(0);
SendMessage16( hwnd, WM_ENTERMENULOOP, 0, 0 );
SendMessage16( hwnd, WM_INITMENU, wndPtr->wIDmenu, 0 );
MENU_TrackMenu( (HMENU16)wndPtr->wIDmenu, TPM_LEFTALIGN | TPM_LEFTBUTTON,
pt.x, pt.y, hwnd, NULL );
SendMessage16( hwnd, WM_EXITMENULOOP, 0, 0 );
ShowCaret(0);
BOOL32 bTrackSys = ((ht == HTSYSMENU && !wndPtr->wIDmenu) ||
(wndPtr->dwStyle & (WS_MINIMIZE | WS_CHILD)));
HWND16 hWnd = wndPtr->hwndSelf;
HMENU16 hMenu = (bTrackSys) ? wndPtr->hSysMenu : wndPtr->wIDmenu;
if( IsMenu(hMenu) )
{
HideCaret(0);
SendMessage16( hWnd, WM_ENTERMENULOOP, 0, 0 );
SendMessage16( hWnd, WM_INITMENU, hMenu, 0 );
if( bTrackSys )
MENU_TrackSysPopup( wndPtr );
else
MENU_TrackMenu( hMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON,
pt.x, pt.y, hWnd, NULL );
SendMessage16( hWnd, WM_EXITMENULOOP, 0, 0 );
ShowCaret(0);
}
}
@ -1838,64 +1883,67 @@ void MENU_TrackMouseMenuBar( HWND hwnd, POINT16 pt )
*
* Menu-bar tracking upon a keyboard event. Called from NC_HandleSysCommand().
*/
void MENU_TrackKbdMenuBar( WND* wndPtr, UINT wParam, INT vkey)
void MENU_TrackKbdMenuBar( WND* wndPtr, UINT16 wParam, INT16 vkey)
{
UINT uItem = NO_SELECTED_ITEM;
INT16 htMenu;
UINT16 uItem = NO_SELECTED_ITEM;
HMENU16 hTrackMenu;
/* find window that has a menu
*/
/* find window that has a menu */
if( !(wndPtr->dwStyle & WS_CHILD) )
{
wndPtr = WIN_FindWndPtr( GetActiveWindow() );
if( !wndPtr ) return;
}
else
while( wndPtr->dwStyle & WS_CHILD &&
!(wndPtr->dwStyle & WS_SYSMENU) )
if( !(wndPtr = wndPtr->parent) ) return;
while( wndPtr->dwStyle & WS_CHILD && !(wndPtr->dwStyle & WS_SYSMENU) )
if( !(wndPtr = wndPtr->parent) ) return;
if( wndPtr->dwStyle & WS_CHILD || !wndPtr->wIDmenu )
if( !(wndPtr->dwStyle & WS_SYSMENU) )
return;
if( !wndPtr->wIDmenu && !(wndPtr->dwStyle & WS_SYSMENU) ) return;
hTrackMenu = ( IsMenu( wndPtr->wIDmenu ) )? wndPtr->wIDmenu:
wndPtr->hSysMenu;
htMenu = ((wndPtr->dwStyle & (WS_CHILD | WS_MINIMIZE)) ||
!wndPtr->wIDmenu) ? HTSYSMENU : HTMENU;
hTrackMenu = ( htMenu == HTSYSMENU ) ? wndPtr->hSysMenu : wndPtr->wIDmenu;
HideCaret(0);
SendMessage16( wndPtr->hwndSelf, WM_ENTERMENULOOP, 0, 0 );
SendMessage16( wndPtr->hwndSelf, WM_INITMENU, wndPtr->wIDmenu, 0 );
if( IsMenu( hTrackMenu ) )
{
HideCaret(0);
SendMessage16( wndPtr->hwndSelf, WM_ENTERMENULOOP, 0, 0 );
SendMessage16( wndPtr->hwndSelf, WM_INITMENU, hTrackMenu, 0 );
/* find suitable menu entry
*/
/* find suitable menu entry */
if( vkey == VK_SPACE )
uItem = SYSMENU_SELECTED;
else if( vkey )
{
uItem = MENU_FindItemByKey( wndPtr->hwndSelf, wndPtr->wIDmenu, vkey );
if( uItem >= 0xFFFE )
{
if( uItem == 0xFFFF )
MessageBeep(0);
SendMessage16( wndPtr->hwndSelf, WM_EXITMENULOOP, 0, 0 );
ShowCaret(0);
return;
}
}
if( vkey == VK_SPACE )
uItem = SYSMENU_SELECTED;
else if( vkey )
{
uItem = ( htMenu == HTSYSMENU )
? 0xFFFE /* only VK_SPACE in this case */
: MENU_FindItemByKey( wndPtr->hwndSelf, wndPtr->wIDmenu, vkey );
if( uItem >= 0xFFFE )
{
if( uItem == 0xFFFF ) MessageBeep(0);
htMenu = 0;
}
}
MENU_SelectItem( wndPtr->hwndSelf, hTrackMenu, uItem, TRUE );
if( uItem == NO_SELECTED_ITEM )
MENU_SelectItemRel( wndPtr->hwndSelf, hTrackMenu, ITEM_NEXT );
else
PostMessage( wndPtr->hwndSelf, WM_KEYDOWN, VK_DOWN, 0L );
switch( htMenu )
{
case HTMENU:
MENU_SelectItem( wndPtr->hwndSelf, hTrackMenu, uItem, TRUE );
if( uItem == NO_SELECTED_ITEM )
MENU_SelectItemRel( wndPtr->hwndSelf, hTrackMenu, ITEM_NEXT );
else
PostMessage( wndPtr->hwndSelf, WM_KEYDOWN, VK_DOWN, 0L );
MENU_TrackMenu( hTrackMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON,
0, 0, wndPtr->hwndSelf, NULL );
MENU_TrackMenu( hTrackMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON,
0, 0, wndPtr->hwndSelf, NULL );
break;
SendMessage16( wndPtr->hwndSelf, WM_EXITMENULOOP, 0, 0 );
ShowCaret(0);
case HTSYSMENU:
MENU_TrackSysPopup( wndPtr );
default:
}
SendMessage16( wndPtr->hwndSelf, WM_EXITMENULOOP, 0, 0 );
ShowCaret(0);
}
}
@ -1927,6 +1975,20 @@ BOOL32 TrackPopupMenu32( HMENU32 hMenu, UINT32 wFlags, INT32 x, INT32 y,
return TrackPopupMenu16(hMenu,wFlags,x,y,nReserved,hWnd,lpRect?&r:NULL);
}
/**********************************************************************
* TrackPopupMenuEx (USER32.549)
*/
BOOL32 TrackPopupMenuEx( HMENU32 hMenu, UINT32 wFlags, INT32 x, INT32 y,
HWND32 hWnd, LPTPMPARAMS lpTpm )
{
RECT16 r;
fprintf( stderr, "TrackPopupMenuEx: not fully implemented\n" );
if (lpTpm)
CONV_RECT32TO16( &lpTpm->rcExclude, &r );
return TrackPopupMenu16(hMenu,wFlags,x,y,0,hWnd,lpTpm?&r:NULL);
}
/***********************************************************************
* PopupMenuWndProc
@ -2709,7 +2771,7 @@ HMENU16 LoadMenuIndirect16( LPCVOID template )
WORD version, offset;
LPCSTR p = (LPCSTR)template;
dprintf_menu(stddeb,"LoadMenuIndirect32A: %p\n", template );
dprintf_menu(stddeb,"LoadMenuIndirect16: %p\n", template );
version = GET_WORD(p);
p += sizeof(WORD);
if (version)
@ -2738,7 +2800,7 @@ HMENU32 LoadMenuIndirect32A( LPCVOID template )
WORD version, offset;
LPCSTR p = (LPCSTR)template;
dprintf_menu(stddeb,"LoadMenuIndirect32A: %p\n", template );
dprintf_menu(stddeb,"LoadMenuIndirect16: %p\n", template );
version = GET_WORD(p);
p += sizeof(WORD);
if (version)

View File

@ -27,7 +27,6 @@
#include "listbox.h"
#include "dos_fs.h"
#include "drive.h"
#include "file.h"
#include "heap.h"
#include "stddebug.h"
#include "debug.h"
@ -699,6 +698,7 @@ int ListBoxSetCurSel(LPHEADLIST lphl, WORD wIndex)
LONG ListBoxDirectory(LPHEADLIST lphl, UINT attrib, LPCSTR filespec)
{
#if 0
char mask[13];
char* temp = NULL;
const char* ptr;
@ -772,6 +772,8 @@ LONG ListBoxDirectory(LPHEADLIST lphl, UINT attrib, LPCSTR filespec)
SEGPTR_FREE( temp );
return ret;
#endif
return 0;
}
/* ------------------------- dimensions ------------------------- */

View File

@ -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
* 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 (;;)
{
@ -182,7 +183,7 @@ void DEBUG_AddBreakpoint( const DBG_ADDR *address )
int num;
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)
num = next_bp++;
@ -273,17 +274,17 @@ void DEBUG_InfoBreakpoints(void)
* Determine if we should continue execution after a SIGTRAP signal when
* executing in the given mode.
*/
BOOL32 DEBUG_ShouldContinue( SIGCONTEXT *context, enum exec_mode mode )
BOOL32 DEBUG_ShouldContinue( enum exec_mode mode )
{
DBG_ADDR addr;
int bpnum;
/* 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) ?
0 : CS_reg(DEBUG_context);
addr.off = EIP_reg(DEBUG_context);
addr.seg = (CS_reg(&DEBUG_context) == WINE_CODE_SELECTOR) ?
0 : CS_reg(&DEBUG_context);
addr.off = EIP_reg(&DEBUG_context);
bpnum = DEBUG_FindBreakpoint( &addr );
breakpoints[0].enabled = 0; /* disable the step-over breakpoint */
@ -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 */
/* must have encountered an int3 in the Windows program; let's skip it. */
if ((bpnum == -1) && !(EFL_reg(DEBUG_context) & STEP_FLAG))
EIP_reg(DEBUG_context)++;
if ((bpnum == -1) && !(EFL_reg(&DEBUG_context) & STEP_FLAG))
EIP_reg(&DEBUG_context)++;
/* no breakpoint, continue if in continuous mode */
return (mode == EXEC_CONT);
@ -313,14 +314,13 @@ BOOL32 DEBUG_ShouldContinue( SIGCONTEXT *context, enum exec_mode mode )
* Set the breakpoints to the correct state to restart execution
* in the given mode.
*/
void DEBUG_RestartExecution( SIGCONTEXT *context, enum exec_mode mode,
int instr_len )
void DEBUG_RestartExecution( enum exec_mode mode, int instr_len )
{
DBG_ADDR addr;
addr.seg = (CS_reg(DEBUG_context) == WINE_CODE_SELECTOR) ?
0 : CS_reg(DEBUG_context);
addr.off = EIP_reg(DEBUG_context);
addr.seg = (CS_reg(&DEBUG_context) == WINE_CODE_SELECTOR) ?
0 : CS_reg(&DEBUG_context);
addr.off = EIP_reg(&DEBUG_context);
if (DEBUG_FindBreakpoint( &addr ) != -1)
mode = EXEC_STEP_INSTR; /* If there's a breakpoint, skip it */
@ -328,14 +328,14 @@ void DEBUG_RestartExecution( SIGCONTEXT *context, enum exec_mode mode,
switch(mode)
{
case EXEC_CONT: /* Continuous execution */
EFL_reg(DEBUG_context) &= ~STEP_FLAG;
EFL_reg(&DEBUG_context) &= ~STEP_FLAG;
DEBUG_SetBreakpoints( TRUE );
break;
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;
breakpoints[0].addr = addr;
breakpoints[0].enabled = TRUE;
@ -347,7 +347,7 @@ void DEBUG_RestartExecution( SIGCONTEXT *context, enum exec_mode mode,
/* else fall through to single-stepping */
case EXEC_STEP_INSTR: /* Single-stepping an instruction */
EFL_reg(DEBUG_context) |= STEP_FLAG;
EFL_reg(&DEBUG_context) |= STEP_FLAG;
break;
}
}

View File

@ -134,8 +134,8 @@ break_command:
addr.off += $4;
DEBUG_AddBreakpoint( &addr );
}
| tBREAK tEOL { DBG_ADDR addr = { CS_reg(DEBUG_context),
EIP_reg(DEBUG_context) };
| tBREAK tEOL { DBG_ADDR addr = { CS_reg(&DEBUG_context),
EIP_reg(&DEBUG_context) };
DEBUG_AddBreakpoint( &addr );
}
@ -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 )
{
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 void DEBUG_Main( int signal )
{
static int loaded_symbols = 0;
static BOOL32 in_debugger = FALSE;
char SymbolTableFile[256];
int instr_len = 0, newmode;
BOOL32 ret_ok;
@ -272,8 +255,13 @@ void wine_debug( int signal, SIGCONTEXT *regs )
yydebug = 0;
#endif
if (in_debugger)
{
fprintf( stderr, "Segmentation fault inside debugger, exiting.\n" );
exit(1);
}
in_debugger = TRUE;
yyin = stdin;
DEBUG_context = regs;
DEBUG_SetBreakpoints( FALSE );
@ -306,12 +294,12 @@ void wine_debug( int signal, SIGCONTEXT *regs )
DEBUG_LoadEntryPoints();
}
if ((signal != SIGTRAP) || !DEBUG_ShouldContinue( regs, dbg_exec_mode ))
if ((signal != SIGTRAP) || !DEBUG_ShouldContinue( dbg_exec_mode ))
{
DBG_ADDR addr;
addr.seg = CS_reg(DEBUG_context);
addr.off = EIP_reg(DEBUG_context);
addr.seg = CS_reg(&DEBUG_context);
addr.off = EIP_reg(&DEBUG_context);
DBG_FIX_ADDR_SEG( &addr, 0 );
/* Put the display in a correct state */
@ -332,9 +320,9 @@ void wine_debug( int signal, SIGCONTEXT *regs )
DEBUG_InfoStack();
if (dbg_mode == 16)
{
LDT_Print( SELECTOR_TO_ENTRY(DS_reg(DEBUG_context)), 1 );
if (ES_reg(DEBUG_context) != DS_reg(DEBUG_context))
LDT_Print( SELECTOR_TO_ENTRY(ES_reg(DEBUG_context)), 1 );
LDT_Print( SELECTOR_TO_ENTRY(DS_reg(&DEBUG_context)), 1 );
if (ES_reg(&DEBUG_context) != DS_reg(&DEBUG_context))
LDT_Print( SELECTOR_TO_ENTRY(ES_reg(&DEBUG_context)), 1 );
}
DEBUG_BackTrace();
}
@ -347,7 +335,7 @@ void wine_debug( int signal, SIGCONTEXT *regs )
{
DEBUG_Disasm( &addr );
fprintf(stderr,"\n");
instr_len = addr.off - EIP_reg(DEBUG_context);
instr_len = addr.off - EIP_reg(&DEBUG_context);
}
ret_ok = 0;
@ -356,18 +344,48 @@ void wine_debug( int signal, SIGCONTEXT *regs )
issue_prompt();
yyparse();
flush_symbols();
addr.seg = CS_reg(DEBUG_context);
addr.off = EIP_reg(DEBUG_context);
addr.seg = CS_reg(&DEBUG_context);
addr.off = EIP_reg(&DEBUG_context);
DBG_FIX_ADDR_SEG( &addr, 0 );
ret_ok = DEBUG_ValidateRegisters();
if (ret_ok) ret_ok = DBG_CHECK_READ_PTR( &addr, 1 );
} 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)
{
fprintf(stderr,"%s\n", s);

View File

@ -34,7 +34,7 @@ static int syntax_error;
DIGIT [0-9]
HEXDIGIT [0-9a-fA-F]
FORMAT [bcdiswx]
IDENTIFIER [_a-zA-Z\.~][_a-zA-Z0-9\.~]*
IDENTIFIER [_a-zA-Z\.~][_a-zA-Z0-9\.~@]*
%%

View File

@ -164,7 +164,7 @@ BOOL32 DEBUG_SetSymbolValue( const char * name, const DBG_ADDR *addr )
if (!nh) return FALSE;
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;
}

View File

@ -166,7 +166,7 @@ void DEBUG_List( DBG_ADDR *addr, int count )
static DBG_ADDR lasttime = { 0xffffffff, 0 };
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)
{
DEBUG_PrintAddress( addr, dbg_mode, FALSE );

View File

@ -114,7 +114,7 @@ int DEBUG_ReadMemory( const DBG_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;
return *(int *)DBG_ADDR_TO_LIN( &addr );
}
@ -129,7 +129,7 @@ void DEBUG_WriteMemory( const DBG_ADDR *address, int value )
{
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;
*(int *)DBG_ADDR_TO_LIN( &addr ) = value;
}
@ -149,7 +149,7 @@ void DEBUG_ExamineMemory( const DBG_ADDR *address, int count, char format )
int 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)
{

View File

@ -7,7 +7,7 @@
#include <stdio.h>
#include "debugger.h"
SIGCONTEXT *DEBUG_context;
CONTEXT DEBUG_context;
/***********************************************************************
* DEBUG_SetRegister
@ -18,44 +18,32 @@ void DEBUG_SetRegister( enum debug_regs reg, int val )
{
switch(reg)
{
case REG_EAX: EAX_reg(DEBUG_context) = val; break;
case REG_EBX: EBX_reg(DEBUG_context) = val; break;
case REG_ECX: ECX_reg(DEBUG_context) = val; break;
case REG_EDX: EDX_reg(DEBUG_context) = val; break;
case REG_ESI: ESI_reg(DEBUG_context) = val; break;
case REG_EDI: EDI_reg(DEBUG_context) = val; break;
case REG_EBP: EBP_reg(DEBUG_context) = val; break;
case REG_EFL: EFL_reg(DEBUG_context) = val; break;
case REG_EIP: EIP_reg(DEBUG_context) = val; break;
case REG_ESP: ESP_reg(DEBUG_context) = val; break;
case REG_AX: AX_reg(DEBUG_context) = val; break;
case REG_BX: BX_reg(DEBUG_context) = val; break;
case REG_CX: CX_reg(DEBUG_context) = val; break;
case REG_DX: DX_reg(DEBUG_context) = val; break;
case REG_SI: SI_reg(DEBUG_context) = val; break;
case REG_DI: DI_reg(DEBUG_context) = val; break;
case REG_BP: BP_reg(DEBUG_context) = val; break;
case REG_FL: FL_reg(DEBUG_context) = val; break;
case REG_IP: IP_reg(DEBUG_context) = val; break;
case REG_SP: SP_reg(DEBUG_context) = val; break;
case REG_CS: CS_reg(DEBUG_context) = val; break;
case REG_DS: DS_reg(DEBUG_context) = val; break;
case REG_ES: ES_reg(DEBUG_context) = val; break;
case REG_SS: SS_reg(DEBUG_context) = val; break;
#ifdef FS_reg
case REG_FS: FS_reg(DEBUG_context) = val; break;
#else
case REG_FS:
fprintf( stderr, "Register %%fs not supported on this system\n" );
break;
#endif
#ifdef GS_reg
case REG_GS: GS_reg(DEBUG_context) = val; break;
#else
case REG_GS:
fprintf( stderr, "Register %%gs not supported on this system\n" );
break;
#endif
case REG_EAX: EAX_reg(&DEBUG_context) = val; break;
case REG_EBX: EBX_reg(&DEBUG_context) = val; break;
case REG_ECX: ECX_reg(&DEBUG_context) = val; break;
case REG_EDX: EDX_reg(&DEBUG_context) = val; break;
case REG_ESI: ESI_reg(&DEBUG_context) = val; break;
case REG_EDI: EDI_reg(&DEBUG_context) = val; break;
case REG_EBP: EBP_reg(&DEBUG_context) = val; break;
case REG_EFL: EFL_reg(&DEBUG_context) = val; break;
case REG_EIP: EIP_reg(&DEBUG_context) = val; break;
case REG_ESP: ESP_reg(&DEBUG_context) = val; break;
case REG_AX: AX_reg(&DEBUG_context) = val; break;
case REG_BX: BX_reg(&DEBUG_context) = val; break;
case REG_CX: CX_reg(&DEBUG_context) = val; break;
case REG_DX: DX_reg(&DEBUG_context) = val; break;
case REG_SI: SI_reg(&DEBUG_context) = val; break;
case REG_DI: DI_reg(&DEBUG_context) = val; break;
case REG_BP: BP_reg(&DEBUG_context) = val; break;
case REG_FL: FL_reg(&DEBUG_context) = val; break;
case REG_IP: IP_reg(&DEBUG_context) = val; break;
case REG_SP: SP_reg(&DEBUG_context) = val; break;
case REG_CS: CS_reg(&DEBUG_context) = val; break;
case REG_DS: DS_reg(&DEBUG_context) = val; break;
case REG_ES: ES_reg(&DEBUG_context) = val; break;
case REG_SS: SS_reg(&DEBUG_context) = val; break;
case REG_FS: FS_reg(&DEBUG_context) = val; break;
case REG_GS: GS_reg(&DEBUG_context) = val; break;
}
}
@ -69,49 +57,106 @@ int DEBUG_GetRegister( enum debug_regs reg )
{
switch(reg)
{
case REG_EAX: return EAX_reg(DEBUG_context);
case REG_EBX: return EBX_reg(DEBUG_context);
case REG_ECX: return ECX_reg(DEBUG_context);
case REG_EDX: return EDX_reg(DEBUG_context);
case REG_ESI: return ESI_reg(DEBUG_context);
case REG_EDI: return EDI_reg(DEBUG_context);
case REG_EBP: return EBP_reg(DEBUG_context);
case REG_EFL: return EFL_reg(DEBUG_context);
case REG_EIP: return EIP_reg(DEBUG_context);
case REG_ESP: return ESP_reg(DEBUG_context);
case REG_AX: return AX_reg(DEBUG_context);
case REG_BX: return BX_reg(DEBUG_context);
case REG_CX: return CX_reg(DEBUG_context);
case REG_DX: return DX_reg(DEBUG_context);
case REG_SI: return SI_reg(DEBUG_context);
case REG_DI: return DI_reg(DEBUG_context);
case REG_BP: return BP_reg(DEBUG_context);
case REG_FL: return FL_reg(DEBUG_context);
case REG_IP: return IP_reg(DEBUG_context);
case REG_SP: return SP_reg(DEBUG_context);
case REG_CS: return CS_reg(DEBUG_context);
case REG_DS: return DS_reg(DEBUG_context);
case REG_ES: return ES_reg(DEBUG_context);
case REG_SS: return SS_reg(DEBUG_context);
#ifdef FS_reg
case REG_FS: return FS_reg(DEBUG_context);
#else
case REG_FS:
fprintf( stderr, "Register %%fs not supported on this system\n" );
return 0;
#endif
#ifdef GS_reg
case REG_GS: return GS_reg(DEBUG_context);
#else
case REG_GS:
fprintf( stderr, "Register %%gs not supported on this system\n" );
return 0;
#endif
case REG_EAX: return EAX_reg(&DEBUG_context);
case REG_EBX: return EBX_reg(&DEBUG_context);
case REG_ECX: return ECX_reg(&DEBUG_context);
case REG_EDX: return EDX_reg(&DEBUG_context);
case REG_ESI: return ESI_reg(&DEBUG_context);
case REG_EDI: return EDI_reg(&DEBUG_context);
case REG_EBP: return EBP_reg(&DEBUG_context);
case REG_EFL: return EFL_reg(&DEBUG_context);
case REG_EIP: return EIP_reg(&DEBUG_context);
case REG_ESP: return ESP_reg(&DEBUG_context);
case REG_AX: return AX_reg(&DEBUG_context);
case REG_BX: return BX_reg(&DEBUG_context);
case REG_CX: return CX_reg(&DEBUG_context);
case REG_DX: return DX_reg(&DEBUG_context);
case REG_SI: return SI_reg(&DEBUG_context);
case REG_DI: return DI_reg(&DEBUG_context);
case REG_BP: return BP_reg(&DEBUG_context);
case REG_FL: return FL_reg(&DEBUG_context);
case REG_IP: return IP_reg(&DEBUG_context);
case REG_SP: return SP_reg(&DEBUG_context);
case REG_CS: return CS_reg(&DEBUG_context);
case REG_DS: return DS_reg(&DEBUG_context);
case REG_ES: return ES_reg(&DEBUG_context);
case REG_SS: return SS_reg(&DEBUG_context);
case REG_FS: return FS_reg(&DEBUG_context);
case REG_GS: return GS_reg(&DEBUG_context);
}
return 0; /* should not happen */
}
/***********************************************************************
* DEBUG_SetSigContext
*
* Set the register values from a sigcontext.
*/
extern void DEBUG_SetSigContext( const SIGCONTEXT *sigcontext )
{
EAX_reg(&DEBUG_context) = EAX_sig(sigcontext);
EBX_reg(&DEBUG_context) = EBX_sig(sigcontext);
ECX_reg(&DEBUG_context) = ECX_sig(sigcontext);
EDX_reg(&DEBUG_context) = EDX_sig(sigcontext);
ESI_reg(&DEBUG_context) = ESI_sig(sigcontext);
EDI_reg(&DEBUG_context) = EDI_sig(sigcontext);
EBP_reg(&DEBUG_context) = EBP_sig(sigcontext);
EFL_reg(&DEBUG_context) = EFL_sig(sigcontext);
EIP_reg(&DEBUG_context) = EIP_sig(sigcontext);
ESP_reg(&DEBUG_context) = ESP_sig(sigcontext);
CS_reg(&DEBUG_context) = LOWORD(CS_sig(sigcontext));
DS_reg(&DEBUG_context) = LOWORD(DS_sig(sigcontext));
ES_reg(&DEBUG_context) = LOWORD(ES_sig(sigcontext));
SS_reg(&DEBUG_context) = LOWORD(SS_sig(sigcontext));
#ifdef FS_sig
FS_reg(&DEBUG_context) = LOWORD(FS_sig(sigcontext));
#else
__asm__("movw %%fs,%w0":"=r" (FS_reg(&DEBUG_context)));
FS_reg(&DEBUG_context) &= 0xffff;
#endif
#ifdef GS_sig
GS_reg(&DEBUG_context) = LOWORD(GS_sig(sigcontext));
#else
__asm__("movw %%gs,%w0":"=r" (GS_reg(&DEBUG_context)));
GS_reg(&DEBUG_context) &= 0xffff;
#endif
}
/***********************************************************************
* DEBUG_GetSigContext
*
* Build a sigcontext from the register values.
*/
extern void DEBUG_GetSigContext( SIGCONTEXT *sigcontext )
{
EAX_sig(sigcontext) = EAX_reg(&DEBUG_context);
EBX_sig(sigcontext) = EBX_reg(&DEBUG_context);
ECX_sig(sigcontext) = ECX_reg(&DEBUG_context);
EDX_sig(sigcontext) = EDX_reg(&DEBUG_context);
ESI_sig(sigcontext) = ESI_reg(&DEBUG_context);
EDI_sig(sigcontext) = EDI_reg(&DEBUG_context);
EBP_sig(sigcontext) = EBP_reg(&DEBUG_context);
EFL_sig(sigcontext) = EFL_reg(&DEBUG_context);
EIP_sig(sigcontext) = EIP_reg(&DEBUG_context);
ESP_sig(sigcontext) = ESP_reg(&DEBUG_context);
CS_sig(sigcontext) = CS_reg(&DEBUG_context);
DS_sig(sigcontext) = DS_reg(&DEBUG_context);
ES_sig(sigcontext) = ES_reg(&DEBUG_context);
SS_sig(sigcontext) = SS_reg(&DEBUG_context);
#ifdef FS_sig
FS_sig(sigcontext) = FS_reg(&DEBUG_context);
#else
__asm__("movw %w0,%%fs"::"r" (FS_reg(&DEBUG_context)));
#endif
#ifdef GS_sig
GS_sig(sigcontext) = GS_reg(&DEBUG_context);
#else
__asm__("movw %w0,%%gs"::"r" (FS_reg(&DEBUG_context)));
#endif
}
/***********************************************************************
* DEBUG_InfoRegisters
@ -123,35 +168,30 @@ void DEBUG_InfoRegisters(void)
fprintf(stderr,"Register dump:\n");
/* First get the segment registers out of the way */
fprintf( stderr," CS:%04x SS:%04x DS:%04x ES:%04x",
CS_reg(DEBUG_context), SS_reg(DEBUG_context),
DS_reg(DEBUG_context), ES_reg(DEBUG_context) );
#ifdef FS_reg
fprintf( stderr, " FS:%04x", FS_reg(DEBUG_context) );
#endif
#ifdef GS_reg
fprintf( stderr, " GS:%04x", GS_reg(DEBUG_context) );
#endif
fprintf( stderr," CS:%04x SS:%04x DS:%04x ES:%04x FS:%04x GS:%04x",
(WORD)CS_reg(&DEBUG_context), (WORD)SS_reg(&DEBUG_context),
(WORD)DS_reg(&DEBUG_context), (WORD)ES_reg(&DEBUG_context),
(WORD)FS_reg(&DEBUG_context), (WORD)GS_reg(&DEBUG_context) );
if (dbg_mode == 16)
{
fprintf( stderr,"\n IP:%04x SP:%04x BP:%04x FLAGS:%04x\n",
IP_reg(DEBUG_context), SP_reg(DEBUG_context),
BP_reg(DEBUG_context), FL_reg(DEBUG_context) );
IP_reg(&DEBUG_context), SP_reg(&DEBUG_context),
BP_reg(&DEBUG_context), FL_reg(&DEBUG_context) );
fprintf( stderr," AX:%04x BX:%04x CX:%04x DX:%04x SI:%04x DI:%04x\n",
AX_reg(DEBUG_context), BX_reg(DEBUG_context),
CX_reg(DEBUG_context), DX_reg(DEBUG_context),
SI_reg(DEBUG_context), DI_reg(DEBUG_context) );
AX_reg(&DEBUG_context), BX_reg(&DEBUG_context),
CX_reg(&DEBUG_context), DX_reg(&DEBUG_context),
SI_reg(&DEBUG_context), DI_reg(&DEBUG_context) );
}
else /* 32-bit mode */
{
fprintf( stderr, "\n EIP:%08lx ESP:%08lx EBP:%08lx EFLAGS:%08lx\n",
EIP_reg(DEBUG_context), ESP_reg(DEBUG_context),
EBP_reg(DEBUG_context), EFL_reg(DEBUG_context) );
EIP_reg(&DEBUG_context), ESP_reg(&DEBUG_context),
EBP_reg(&DEBUG_context), EFL_reg(&DEBUG_context) );
fprintf( stderr, " EAX:%08lx EBX:%08lx ECX:%08lx EDX:%08lx\n",
EAX_reg(DEBUG_context), EBX_reg(DEBUG_context),
ECX_reg(DEBUG_context), EDX_reg(DEBUG_context) );
EAX_reg(&DEBUG_context), EBX_reg(&DEBUG_context),
ECX_reg(&DEBUG_context), EDX_reg(&DEBUG_context) );
fprintf( stderr, " ESI:%08lx EDI:%08lx\n",
ESI_reg(DEBUG_context), EDI_reg(DEBUG_context) );
ESI_reg(&DEBUG_context), EDI_reg(&DEBUG_context) );
}
}
@ -170,39 +210,35 @@ BOOL32 DEBUG_ValidateRegisters(void)
((((seg) & 7) != 7) || IS_LDT_ENTRY_FREE(SELECTOR_TO_ENTRY(seg)))) \
{ \
fprintf( stderr, "*** Invalid value for %s register: %04x\n", \
(name), (seg) ); \
(name), (WORD)(seg) ); \
return FALSE; \
}
if (CS_reg(DEBUG_context) != WINE_CODE_SELECTOR)
CHECK_SEG( CS_reg(DEBUG_context), "CS" );
if (SS_reg(DEBUG_context) != WINE_DATA_SELECTOR)
CHECK_SEG( SS_reg(DEBUG_context), "SS" );
if (DS_reg(DEBUG_context) != WINE_DATA_SELECTOR)
CHECK_SEG( DS_reg(DEBUG_context), "DS" );
if (ES_reg(DEBUG_context) != WINE_DATA_SELECTOR)
CHECK_SEG( ES_reg(DEBUG_context), "ES" );
#ifdef FS_reg
if (FS_reg(DEBUG_context) != WINE_DATA_SELECTOR)
CHECK_SEG( FS_reg(DEBUG_context), "FS" );
#endif
#ifdef GS_reg
if (GS_reg(DEBUG_context) != WINE_DATA_SELECTOR)
CHECK_SEG( GS_reg(DEBUG_context), "GS" );
#endif
if (CS_reg(&DEBUG_context) != WINE_CODE_SELECTOR)
CHECK_SEG( CS_reg(&DEBUG_context), "CS" );
if (SS_reg(&DEBUG_context) != WINE_DATA_SELECTOR)
CHECK_SEG( SS_reg(&DEBUG_context), "SS" );
if (DS_reg(&DEBUG_context) != WINE_DATA_SELECTOR)
CHECK_SEG( DS_reg(&DEBUG_context), "DS" );
if (ES_reg(&DEBUG_context) != WINE_DATA_SELECTOR)
CHECK_SEG( ES_reg(&DEBUG_context), "ES" );
if (FS_reg(&DEBUG_context) != WINE_DATA_SELECTOR)
CHECK_SEG( FS_reg(&DEBUG_context), "FS" );
if (GS_reg(&DEBUG_context) != WINE_DATA_SELECTOR)
CHECK_SEG( GS_reg(&DEBUG_context), "GS" );
/* Check that CS and SS are not NULL */
if (!(CS_reg(DEBUG_context) & ~3))
if (!(CS_reg(&DEBUG_context) & ~3))
{
fprintf( stderr, "*** Invalid value for CS register: %04x\n",
CS_reg(DEBUG_context) );
(WORD)CS_reg(&DEBUG_context) );
return FALSE;
}
if (!(SS_reg(DEBUG_context) & ~3))
if (!(SS_reg(&DEBUG_context) & ~3))
{
fprintf( stderr, "*** Invalid value for SS register: %04x\n",
SS_reg(DEBUG_context) );
(WORD)SS_reg(&DEBUG_context) );
return FALSE;
}
return TRUE;

View File

@ -372,4 +372,12 @@ leave:
}
#else /* !__ELF__ */
int
DEBUG_ReadExecutableDbgInfo(void)
{
return FALSE;
}
#endif /* __ELF__ */

View File

@ -57,17 +57,17 @@ void DEBUG_InfoStack(void)
DBG_ADDR addr;
fprintf(stderr,"Stack dump:\n");
if ((SS_reg(DEBUG_context) == WINE_DATA_SELECTOR) ||
(GET_SEL_FLAGS(SS_reg(DEBUG_context)) & LDT_FLAGS_32BIT))
if ((SS_reg(&DEBUG_context) == WINE_DATA_SELECTOR) ||
(GET_SEL_FLAGS(SS_reg(&DEBUG_context)) & LDT_FLAGS_32BIT))
{ /* 32-bit mode */
addr.seg = 0;
addr.off = ESP_reg(DEBUG_context);
addr.off = ESP_reg(&DEBUG_context);
DEBUG_ExamineMemory( &addr, 24, 'x' );
}
else /* 16-bit mode */
{
addr.seg = SS_reg(DEBUG_context);
addr.off = SP_reg(DEBUG_context);
addr.seg = SS_reg(&DEBUG_context);
addr.off = SP_reg(&DEBUG_context);
DEBUG_ExamineMemory( &addr, 24, 'w' );
}
fprintf(stderr,"\n");
@ -85,40 +85,28 @@ void DEBUG_BackTrace(void)
int frameno = 0;
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;
addr.off = EBP_reg(DEBUG_context);
nframe = 1;
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) );
nframe = 1;
if (frames) free( frames );
frames = (struct bt_info *) xmalloc( sizeof(struct bt_info) );
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].frame = DEBUG_PrintAddress( &addr, 32, TRUE );
fprintf( stderr, "\n" );
addr.off = EBP_reg(DEBUG_context);
frames[0].ebp = addr.off;
frames[0].ebp = addr.off = EBP_reg(&DEBUG_context);
while (addr.off)
{
FRAME32 *frame = (FRAME32 *)addr.off;
if (!DBG_CHECK_READ_PTR( &addr, sizeof(FRAME32) )) return;
if (!frame->ip) break;
nframe++;
frames = (struct bt_info *)xrealloc(frames,
nframe*sizeof(struct bt_info));
fprintf(stderr,"%s%d ", (frameno == curr_frame ? "=>" : " "),
frameno);
addr.off = frame->ip;
@ -133,7 +121,7 @@ void DEBUG_BackTrace(void)
}
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)
{
fprintf( stderr, "Not implemented: 32-bit backtrace on a different stack segment.\n" );
@ -141,11 +129,11 @@ void DEBUG_BackTrace(void)
}
fprintf( stderr,"%d ", frameno++ );
addr.seg = cs;
addr.off = IP_reg(DEBUG_context);
addr.off = IP_reg(&DEBUG_context);
DEBUG_PrintAddress( &addr, 16, TRUE );
fprintf( stderr, "\n" );
addr.seg = ss;
addr.off = BP_reg(DEBUG_context) & ~1;
addr.off = BP_reg(&DEBUG_context) & ~1;
for (;;)
{
FRAME16 *frame = (FRAME16 *)DBG_ADDR_TO_LIN(&addr);

View File

@ -1,6 +1,6 @@
prefix = @prefix@
sysconfdir = @sysconfdir@
DEFS = -D__WINE__ -DETCDIR=\"$(sysconfdir)\"
DEFS = -D__WINE__ -DNO_TRANSITION_TYPES -DETCDIR=\"$(sysconfdir)\"
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ..
SRCDIR = @srcdir@

View File

@ -6,16 +6,18 @@
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include "windows.h"
#include "winerror.h"
#include "dos_fs.h"
#include "drive.h"
#include "file.h"
#include "heap.h"
#include "msdos.h"
#include "options.h"
#include "xmalloc.h"
#include "stddebug.h"
#include "debug.h"
@ -42,12 +44,12 @@ static int DIR_GetPath( const char *keyname, const char *defval,
{
char path[MAX_PATHNAME_LEN];
const char *dos_name ,*unix_name;
BYTE attr;
BY_HANDLE_FILE_INFORMATION info;
PROFILE_GetWineIniString( "wine", keyname, defval, path, sizeof(path) );
if (!(unix_name = DOSFS_GetUnixFileName( path, TRUE )) ||
!FILE_Stat( unix_name, &attr, NULL, NULL, NULL ) ||
!(attr & FA_DIRECTORY))
!FILE_Stat( unix_name, &info ) ||
!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
fprintf(stderr, "Invalid path '%s' for %s directory\n", path, keyname);
return 0;
@ -58,8 +60,8 @@ static int DIR_GetPath( const char *keyname, const char *defval,
keyname, unix_name );
return 0;
}
*unix_path = xstrdup( unix_name );
*dos_path = xstrdup( dos_name );
*unix_path = HEAP_strdupA( SystemHeap, 0, unix_name );
*dos_path = HEAP_strdupA( SystemHeap, 0, dos_name );
return 1;
}
@ -71,7 +73,7 @@ void DIR_ParseWindowsPath( char *path )
{
char *p;
const char *dos_name ,*unix_name;
BYTE attr;
BY_HANDLE_FILE_INFORMATION info;
int i;
for ( ; path && *path; path = p)
@ -86,8 +88,8 @@ void DIR_ParseWindowsPath( char *path )
break;
}
if (!(unix_name = DOSFS_GetUnixFileName( path, TRUE )) ||
!FILE_Stat( unix_name, &attr, NULL, NULL, NULL ) ||
!(attr & FA_DIRECTORY))
!FILE_Stat( unix_name, &info ) ||
!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
fprintf(stderr,"Warning: invalid dir '%s' in path, deleting it.\n",
path );
@ -99,8 +101,8 @@ void DIR_ParseWindowsPath( char *path )
unix_name );
continue;
}
DIR_UnixPath[DIR_PathElements] = xstrdup( unix_name );
DIR_DosPath[DIR_PathElements] = xstrdup( dos_name );
DIR_UnixPath[DIR_PathElements] = HEAP_strdupA(SystemHeap,0,unix_name);
DIR_DosPath[DIR_PathElements] = HEAP_strdupA(SystemHeap,0,dos_name);
DIR_PathElements++;
}
@ -171,11 +173,11 @@ int DIR_Init(void)
/* Put the temp and Windows directories into the environment */
env_p = (char *)xmalloc( strlen(DIR_TempDosDir) + 6 );
env_p = HEAP_xalloc( SystemHeap, 0, strlen(DIR_TempDosDir) + 6 );
strcpy( env_p, "TEMP=" );
strcpy( env_p + 5, DIR_TempDosDir );
putenv( env_p );
env_p = (char *)xmalloc( strlen(DIR_WindowsDosDir) + 8 );
env_p = HEAP_xalloc( SystemHeap, 0, strlen(DIR_WindowsDosDir) + 8 );
strcpy( env_p, "windir=" );
strcpy( env_p + 7, DIR_WindowsDosDir );
putenv( env_p );
@ -325,3 +327,303 @@ UINT32 GetSystemDirectory32W( LPWSTR path, UINT32 count )
if (path) lstrcpynAtoW( path, DIR_SystemDosDir, count );
return strlen( DIR_SystemDosDir );
}
/***********************************************************************
* CreateDirectory16 (KERNEL.144)
*/
BOOL16 CreateDirectory16( LPCSTR path, LPVOID dummy )
{
dprintf_file( stddeb,"CreateDirectory16(%s,%p)\n", path, dummy );
return (BOOL16)CreateDirectory32A( path, NULL );
}
/***********************************************************************
* CreateDirectory32A (KERNEL32.39)
*/
BOOL32 CreateDirectory32A( LPCSTR path, LPSECURITY_ATTRIBUTES lpsecattribs )
{
const char *unixName;
dprintf_file( stddeb, "CreateDirectory32A(%s,%p)\n", path, lpsecattribs );
if ((unixName = DOSFS_IsDevice( path )) != NULL)
{
dprintf_file(stddeb, "CreateDirectory: device '%s'!\n", unixName);
DOS_ERROR( ER_AccessDenied, EC_AccessDenied, SA_Abort, EL_Disk );
return FALSE;
}
if (!(unixName = DOSFS_GetUnixFileName( path, FALSE ))) return 0;
if ((mkdir( unixName, 0777 ) == -1) && (errno != EEXIST))
{
FILE_SetDosError();
return FALSE;
}
return TRUE;
}
/***********************************************************************
* CreateDirectory32W (KERNEL32.42)
*/
BOOL32 CreateDirectory32W( LPCWSTR path, LPSECURITY_ATTRIBUTES lpsecattribs )
{
LPSTR xpath = HEAP_strdupWtoA( GetProcessHeap(), 0, path );
BOOL32 ret = CreateDirectory32A( xpath, lpsecattribs );
HeapFree( GetProcessHeap(), 0, xpath );
return ret;
}
/***********************************************************************
* CreateDirectoryEx32A (KERNEL32.40)
*/
BOOL32 CreateDirectoryEx32A( LPCSTR template, LPCSTR path,
LPSECURITY_ATTRIBUTES lpsecattribs)
{
return CreateDirectory32A(path,lpsecattribs);
}
/***********************************************************************
* CreateDirectoryEx32W (KERNEL32.41)
*/
BOOL32 CreateDirectoryEx32W( LPCWSTR template, LPCWSTR path,
LPSECURITY_ATTRIBUTES lpsecattribs)
{
return CreateDirectory32W(path,lpsecattribs);
}
/***********************************************************************
* RemoveDirectory16 (KERNEL)
*/
BOOL16 RemoveDirectory16( LPCSTR path )
{
return (BOOL16)RemoveDirectory32A( path );
}
/***********************************************************************
* RemoveDirectory32A (KERNEL32.437)
*/
BOOL32 RemoveDirectory32A( LPCSTR path )
{
const char *unixName;
dprintf_file(stddeb, "RemoveDirectory: '%s'\n", path );
if ((unixName = DOSFS_IsDevice( path )) != NULL)
{
dprintf_file(stddeb, "RemoveDirectory: device '%s'!\n", unixName);
DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
return FALSE;
}
if (!(unixName = DOSFS_GetUnixFileName( path, TRUE ))) return FALSE;
if (rmdir( unixName ) == -1)
{
FILE_SetDosError();
return FALSE;
}
return TRUE;
}
/***********************************************************************
* RemoveDirectory32W (KERNEL32.438)
*/
BOOL32 RemoveDirectory32W( LPCWSTR path )
{
LPSTR xpath = HEAP_strdupWtoA( GetProcessHeap(), 0, path );
BOOL32 ret = RemoveDirectory32A( xpath );
HeapFree( GetProcessHeap(), 0, xpath );
return ret;
}
/***********************************************************************
* DIR_SearchPath
*
* Implementation of SearchPath32A. 'win32' specifies whether the search
* order is Win16 (module path last) or Win32 (module path first).
*
* FIXME: should return long path names.
*/
DWORD DIR_SearchPath( LPCSTR path, LPCSTR name, LPCSTR ext,
DWORD buflen, LPSTR buffer, LPSTR *lastpart,
BOOL32 win32 )
{
DWORD len;
LPSTR tmp;
int i;
/* First check the supplied parameters */
if (strchr( name, '.' )) ext = NULL; /* Ignore the specified extension */
if (path && !*path) path = NULL; /* Ignore empty path */
len = strlen(name);
if (ext) len += strlen(ext);
if (path) len += strlen(path) + 1;
/* Allocate a buffer for the file name and extension */
if (path || ext)
{
if (!(tmp = HeapAlloc( GetProcessHeap(), 0, len + 1 )))
{
SetLastError( ERROR_OUTOFMEMORY );
return 0;
}
if (path)
{
strcpy( tmp, path );
strcat( tmp, "\\" );
strcat( tmp, name );
}
else strcpy( tmp, name );
if (ext) strcat( tmp, ext );
}
else tmp = (LPSTR)name;
/* If we have an explicit path, everything's easy */
if (path || (*tmp && (tmp[1] == ':')) ||
strchr( tmp, '/' ) || strchr( tmp, '\\' ))
{
if (!DOSFS_GetUnixFileName( tmp, TRUE )) goto not_found;
lstrcpyn32A( buffer, tmp, buflen );
if (tmp != name) HeapFree( GetProcessHeap(), 0, tmp );
return len;
}
/* Try the path of the current executable (for Win32 search order) */
if (win32 && GetCurrentTask())
{
LPSTR p;
GetModuleFileName32A( GetCurrentTask(), buffer, buflen );
if ((p = strrchr( buffer, '\\' )))
{
lstrcpyn32A( p + 1, tmp, (INT32)buflen - (p - buffer) );
if (DOSFS_GetUnixFileName( buffer, TRUE ))
{
*p = '\0';
goto found;
}
}
}
/* Try the current directory */
if (DOSFS_GetUnixFileName( tmp, TRUE ))
{
GetCurrentDirectory32A( buflen, buffer );
goto found;
}
/* Try the Windows directory */
if (DOSFS_FindUnixName( DIR_WindowsUnixDir, name, NULL, 0,
DRIVE_GetFlags( DIR_WindowsDosDir[0] - 'A' ) ))
{
lstrcpyn32A( buffer, DIR_WindowsDosDir, buflen );
goto found;
}
/* Try the Windows system directory */
if (DOSFS_FindUnixName( DIR_SystemUnixDir, name, NULL, 0,
DRIVE_GetFlags( DIR_SystemDosDir[0] - 'A' ) ))
{
lstrcpyn32A( buffer, DIR_SystemDosDir, buflen );
goto found;
}
/* Try the path of the current executable (for Win16 search order) */
if (!win32 && GetCurrentTask())
{
LPSTR p;
GetModuleFileName32A( GetCurrentTask(), buffer, buflen );
if ((p = strrchr( buffer, '\\' )))
{
lstrcpyn32A( p + 1, tmp, (INT32)buflen - (p - buffer) );
if (DOSFS_GetUnixFileName( buffer, TRUE ))
{
*p = '\0';
goto found;
}
}
}
/* Try all directories in path */
for (i = 0; i < DIR_PathElements; i++)
{
if (DOSFS_FindUnixName( DIR_UnixPath[i], name, NULL, 0,
DRIVE_GetFlags( DIR_DosPath[i][0] - 'A' ) ))
{
lstrcpyn32A( buffer, DIR_DosPath[i], buflen );
goto found;
}
}
not_found:
if (tmp != name) HeapFree( GetProcessHeap(), 0, tmp );
SetLastError( ERROR_FILE_NOT_FOUND );
DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
return 0;
found:
len = strlen(buffer);
if (lastpart) *lastpart = buffer + len + 1;
if (len + 1 < buflen)
{
buffer += len;
*buffer++ = '\\';
buflen -= len + 1;
lstrcpyn32A( buffer, tmp, buflen );
}
len += strlen(tmp) + 1;
if (tmp != name) HeapFree( GetProcessHeap(), 0, tmp );
return len;
}
/***********************************************************************
* SearchPath32A (KERNEL32.447)
*/
DWORD SearchPath32A( LPCSTR path, LPCSTR name, LPCSTR ext, DWORD buflen,
LPSTR buffer, LPSTR *lastpart )
{
return DIR_SearchPath( path, name, ext, buflen, buffer, lastpart, TRUE );
}
/***********************************************************************
* SearchPath32W (KERNEL32.448)
*/
DWORD SearchPath32W( LPCWSTR path, LPCWSTR name, LPCWSTR ext, DWORD buflen,
LPWSTR buffer, LPWSTR *lastpart )
{
LPSTR pathA = HEAP_strdupWtoA( GetProcessHeap(), 0, path );
LPSTR nameA = HEAP_strdupWtoA( GetProcessHeap(), 0, name );
LPSTR extA = HEAP_strdupWtoA( GetProcessHeap(), 0, ext );
LPSTR lastpartA;
LPSTR bufferA = HeapAlloc( GetProcessHeap(), 0, buflen + 1 );
DWORD ret = DIR_SearchPath( pathA, nameA, extA, buflen, bufferA,
&lastpartA, TRUE );
lstrcpyAtoW( buffer, bufferA );
if (lastpart)
{
if (lastpartA) *lastpart = buffer + (lastpartA - bufferA);
else *lastpart = NULL;
}
HeapFree( GetProcessHeap(), 0, bufferA );
HeapFree( GetProcessHeap(), 0, extA );
HeapFree( GetProcessHeap(), 0, nameA );
HeapFree( GetProcessHeap(), 0, pathA );
return ret;
}

View File

@ -8,16 +8,20 @@
#include <sys/types.h>
#include <ctype.h>
#include <dirent.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <time.h>
#include <unistd.h>
#if defined(__svr4__) || defined(_SCO_DS)
#include <sys/statfs.h>
#endif
#include "windows.h"
#include "winerror.h"
#include "dos_fs.h"
#include "drive.h"
#include "file.h"
@ -25,7 +29,15 @@
#include "msdos.h"
#include "stddebug.h"
#include "debug.h"
#include "xmalloc.h"
/* Define the VFAT ioctl to get both short and long file names */
#if 0 /* not working yet */
#ifdef linux
#define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, long)
#else /* linux */
#undef VFAT_IOCTL_READDIR_BOTH /* just in case... */
#endif /* linux */
#endif
/* Chars we don't want to see in DOS file names */
#define INVALID_DOS_CHARS "*?<>|\"+=,;[] \345"
@ -55,6 +67,27 @@ BYTE DOS_ErrorClass;
BYTE DOS_ErrorAction;
BYTE DOS_ErrorLocus;
/* Info structure for FindFirstFile handle */
typedef struct
{
LPSTR path;
LPSTR mask;
int drive;
int skip;
} FIND_FIRST_INFO;
/* Directory info for DOSFS_ReadDir */
typedef struct
{
DIR *dir;
#ifdef VFAT_IOCTL_READDIR_BOTH
int fd;
char short_name[12];
struct dirent dirent[2];
#endif
} DOS_DIR;
/***********************************************************************
* DOSFS_ValidDOSName
@ -150,7 +183,11 @@ const char *DOSFS_ToDosFCBFormat( const char *name )
{
p++;
strcpy( buffer, ". " );
if (*p == '.') p++;
if (*p == '.')
{
buffer[1] = '.';
p++;
}
return (!*p || (*p == '/') || (*p == '\\')) ? buffer : NULL;
}
@ -265,6 +302,7 @@ static int DOSFS_MatchShort( const char *mask, const char *name )
static int DOSFS_MatchLong( const char *mask, const char *name,
int case_sensitive )
{
if (!strcmp( mask, "*.*" )) return 1;
while (*name && *mask)
{
if (*mask == '*')
@ -291,6 +329,95 @@ static int DOSFS_MatchLong( const char *mask, const char *name,
}
/***********************************************************************
* DOSFS_OpenDir
*/
static DOS_DIR *DOSFS_OpenDir( LPCSTR path )
{
DOS_DIR *dir = HeapAlloc( SystemHeap, 0, sizeof(*dir) );
if (!dir)
{
DOS_ERROR( ER_OutOfMemory, EC_OutOfResource, SA_Abort, EL_Memory );
return NULL;
}
#ifdef VFAT_IOCTL_READDIR_BOTH
/* Check if the VFAT ioctl is supported on this directory */
if ((dir->fd = open( path, O_RDONLY )) != -1)
{
if (ioctl( dir->fd, VFAT_IOCTL_READDIR_BOTH, (long)dir->dirent ) == -1)
{
close( dir->fd );
dir->fd = -1;
}
else
{
/* Set the file pointer back at the start of the directory */
lseek( dir->fd, 0, SEEK_SET );
dir->dir = NULL;
return dir;
}
}
#endif /* VFAT_IOCTL_READDIR_BOTH */
/* Now use the standard opendir/readdir interface */
if (!(dir->dir = opendir( path )))
{
HeapFree( SystemHeap, 0, dir );
return NULL;
}
return dir;
}
/***********************************************************************
* DOSFS_CloseDir
*/
static void DOSFS_CloseDir( DOS_DIR *dir )
{
#ifdef VFAT_IOCTL_READDIR_BOTH
if (dir->fd != -1) close( dir->fd );
#endif /* VFAT_IOCTL_READDIR_BOTH */
if (dir->dir) closedir( dir->dir );
HeapFree( SystemHeap, 0, dir );
}
/***********************************************************************
* DOSFS_ReadDir
*/
static BOOL32 DOSFS_ReadDir( DOS_DIR *dir, LPCSTR *long_name,
LPCSTR *short_name )
{
struct dirent *dirent;
#ifdef VFAT_IOCTL_READDIR_BOTH
if (dir->fd != -1)
{
LPCSTR fcb_name;
if (ioctl( dir->fd, VFAT_IOCTL_READDIR_BOTH, (long)dir->dirent ) == -1)
return FALSE;
if (!dir->dirent[0].d_reclen) return FALSE;
fcb_name = DOSFS_ToDosFCBFormat( dir->dirent[0].d_name );
if (fcb_name) strcpy( dir->short_name, fcb_name );
else dir->short_name[0] = '\0';
*short_name = dir->short_name;
if (dir->dirent[1].d_name[0]) *long_name = dir->dirent[1].d_name;
else *long_name = dir->dirent[0].d_name;
return TRUE;
}
#endif /* VFAT_IOCTL_READDIR_BOTH */
if (!(dirent = readdir( dir->dir ))) return FALSE;
*long_name = dirent->d_name;
*short_name = NULL;
return TRUE;
}
/***********************************************************************
* DOSFS_ToDosDateTime
*
@ -344,7 +471,7 @@ void DOSFS_UnixTimeToFileTime( time_t unixtime, FILETIME *filetime )
*
* Convert a FILETIME format to Unix time.
*/
time_t DOSFS_FileTimeToUnixTime( FILETIME *filetime )
time_t DOSFS_FileTimeToUnixTime( const FILETIME *filetime )
{
/* FIXME :-) */
return filetime->dwLowDateTime;
@ -359,7 +486,8 @@ time_t DOSFS_FileTimeToUnixTime( FILETIME *filetime )
* hashed version that fits in 8.3 format.
* File name can be terminated by '\0', '\\' or '/'.
*/
const char *DOSFS_Hash( const char *name, int dir_format, int ignore_case )
static const char *DOSFS_Hash( const char *name, int dir_format,
int ignore_case )
{
static const char invalid_chars[] = INVALID_DOS_CHARS "~.";
static const char hash_chars[32] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ012345";
@ -439,7 +567,7 @@ const char *DOSFS_Hash( const char *name, int dir_format, int ignore_case )
{
if (!dir_format) *dst++ = '.';
for (i = 3, ext++; (i > 0) && !IS_END_OF_NAME(*ext); i--, ext++)
*dst++ = toupper(*ext);
*dst++ = strchr( invalid_chars, *ext ) ? '_' : toupper(*ext);
}
if (!dir_format) *dst = '\0';
}
@ -455,53 +583,59 @@ const char *DOSFS_Hash( const char *name, int dir_format, int ignore_case )
* File name can be terminated by '\0', '\\' or '/'.
* Return 1 if OK, 0 if no file name matches.
*/
static int DOSFS_FindUnixName( const char *path, const char *name,
char *buffer, int maxlen, UINT32 drive_flags )
BOOL32 DOSFS_FindUnixName( const char *path, const char *name,
char *buffer, int maxlen, UINT32 drive_flags )
{
DIR *dir;
struct dirent *dirent;
DOS_DIR *dir;
LPCSTR long_name, short_name;
char dos_name[12];
BOOL32 ret;
const char *dos_name = DOSFS_ToDosFCBFormat( name );
const char *p = strchr( name, '/' );
int len = p ? (int)(p - name) : strlen(name);
dprintf_dosfs( stddeb, "DOSFS_FindUnixName: %s %s\n", path, name );
dprintf_dosfs( stddeb, "DOSFS_FindUnixName: %s,%s\n", path, name );
if ((p = strchr( name, '\\' ))) len = MIN( (int)(p - name), len );
if (!(dir = opendir( path )))
dos_name[0] = '\0';
if ((p = DOSFS_ToDosFCBFormat( name ))) strcpy( dos_name, p );
if (!(dir = DOSFS_OpenDir( path )))
{
dprintf_dosfs( stddeb, "DOSFS_FindUnixName(%s,%s): can't open dir\n",
path, name );
return 0;
}
while ((dirent = readdir( dir )) != NULL)
while ((ret = DOSFS_ReadDir( dir, &long_name, &short_name )))
{
/* Check against Unix name */
if (len == strlen(dirent->d_name))
if (len == strlen(long_name))
{
if (drive_flags & DRIVE_CASE_SENSITIVE)
{
if (!lstrncmp32A( dirent->d_name, name, len )) break;
if (!lstrncmp32A( long_name, name, len )) break;
}
else
{
if (!lstrncmpi32A( dirent->d_name, name, len )) break;
if (!lstrncmpi32A( long_name, name, len )) break;
}
}
if (dos_name)
if (dos_name[0])
{
/* Check against hashed DOS name */
const char *hash_name = DOSFS_Hash( dirent->d_name, TRUE,
if (!short_name)
short_name = DOSFS_Hash( long_name, TRUE,
!(drive_flags & DRIVE_CASE_SENSITIVE) );
if (!strcmp( dos_name, hash_name )) break;
if (!strcmp( dos_name, short_name )) break;
}
}
if (dirent) lstrcpyn32A( buffer, dirent->d_name, maxlen );
closedir( dir );
if (ret && buffer) lstrcpyn32A( buffer, long_name, maxlen );
dprintf_dosfs( stddeb, "DOSFS_FindUnixName(%s,%s) -> %s\n",
path, name, dirent ? buffer : "** Not found **" );
return (dirent != NULL);
path, name, ret ? long_name : "** Not found **" );
DOSFS_CloseDir( dir );
return ret;
}
@ -531,6 +665,41 @@ const char *DOSFS_IsDevice( const char *name )
return NULL;
}
/***********************************************************************
* DOSFS_GetPathDrive
*
* Get the drive specified by a given path name (DOS or Unix format).
*/
static int DOSFS_GetPathDrive( const char **name )
{
int drive;
const char *p = *name;
if (*p && (p[1] == ':'))
{
drive = toupper(*p) - 'A';
*name += 2;
}
else if (*p == '/') /* Absolute Unix path? */
{
if ((drive = DRIVE_FindDriveRoot( name )) == -1)
{
fprintf( stderr, "Warning: %s not accessible from a DOS drive\n",
*name );
/* Assume it really was a DOS name */
drive = DRIVE_GetCurrentDrive();
}
}
else drive = DRIVE_GetCurrentDrive();
if (!DRIVE_IsValid(drive))
{
DOS_ERROR( ER_InvalidDrive, EC_MediaError, SA_Abort, EL_Disk );
return -1;
}
return drive;
}
/***********************************************************************
* DOSFS_GetUnixFileName
@ -542,33 +711,14 @@ const char *DOSFS_IsDevice( const char *name )
const char * DOSFS_GetUnixFileName( const char * name, int check_last )
{
static char buffer[MAX_PATHNAME_LEN];
int drive, len, found;
int drive, len;
BOOL32 found;
UINT32 flags;
char *p, *root;
dprintf_dosfs( stddeb, "DOSFS_GetUnixFileName: %s\n", name );
if (name[0] && (name[1] == ':'))
{
drive = toupper(name[0]) - 'A';
name += 2;
}
else if (name[0] == '/') /* Absolute Unix path? */
{
if ((drive = DRIVE_FindDriveRoot( &name )) == -1)
{
fprintf( stderr, "Warning: %s not accessible from a DOS drive\n",
name );
/* Assume it really was a DOS name */
drive = DRIVE_GetCurrentDrive();
}
}
else drive = DRIVE_GetCurrentDrive();
if (!DRIVE_IsValid(drive))
{
DOS_ERROR( ER_InvalidDrive, EC_MediaError, SA_Abort, EL_Disk );
return NULL;
}
if ((drive = DOSFS_GetPathDrive( &name )) == -1) return NULL;
flags = DRIVE_GetFlags(drive);
lstrcpyn32A( buffer, DRIVE_GetRoot(drive), MAX_PATHNAME_LEN );
if (buffer[1]) root = buffer + strlen(buffer);
@ -587,7 +737,7 @@ const char * DOSFS_GetUnixFileName( const char * name, int check_last )
p = buffer[1] ? buffer + strlen(buffer) : buffer;
len = MAX_PATHNAME_LEN - strlen(buffer);
found = 1;
found = TRUE;
while (*name && found)
{
const char *newname = DOSFS_CheckDotDot( name, root, '/', &len );
@ -652,29 +802,8 @@ const char * DOSFS_GetDosTrueName( const char *name, int unix_format )
char *p;
dprintf_dosfs( stddeb, "DOSFS_GetDosTrueName(%s,%d)\n", name, unix_format);
if (name[0] && (name[1] == ':'))
{
drive = toupper(name[0]) - 'A';
name += 2;
}
else if (name[0] == '/') /* Absolute Unix path? */
{
if ((drive = DRIVE_FindDriveRoot( &name )) == -1)
{
fprintf( stderr, "Warning: %s not accessible from a DOS drive\n",
name );
/* Assume it really was a DOS name */
drive = DRIVE_GetCurrentDrive();
}
}
else drive = DRIVE_GetCurrentDrive();
if (!DRIVE_IsValid(drive))
{
DOS_ERROR( ER_InvalidDrive, EC_MediaError, SA_Abort, EL_Disk );
return NULL;
}
if ((drive = DOSFS_GetPathDrive( &name )) == -1) return NULL;
p = buffer;
*p++ = 'A' + drive;
*p++ = ':';
@ -748,25 +877,32 @@ const char * DOSFS_GetDosTrueName( const char *name, int unix_format )
*/
int DOSFS_FindNext( const char *path, const char *short_mask,
const char *long_mask, int drive, BYTE attr,
int skip, DOS_DIRENT *entry )
int skip, WIN32_FIND_DATA32A *entry )
{
static DIR *dir = NULL;
struct dirent *dirent;
static DOS_DIR *dir = NULL;
int count = 0;
static char buffer[MAX_PATHNAME_LEN];
static int cur_pos = 0;
static int drive_root = 0;
char *p;
const char *hash_name;
LPCSTR long_name, short_name;
UINT32 flags;
BY_HANDLE_FILE_INFORMATION info;
if ((attr & ~(FA_UNUSED | FA_ARCHIVE | FA_RDONLY)) == FA_LABEL)
{
if (skip) return 0;
strcpy( entry->name, DRIVE_GetLabel( drive ) );
entry->attr = FA_LABEL;
entry->size = 0;
DOSFS_ToDosDateTime( time(NULL), &entry->date, &entry->time );
entry->dwFileAttributes = FILE_ATTRIBUTE_LABEL;
DOSFS_UnixTimeToFileTime( (time_t)0, &entry->ftCreationTime );
DOSFS_UnixTimeToFileTime( (time_t)0, &entry->ftLastAccessTime );
DOSFS_UnixTimeToFileTime( (time_t)0, &entry->ftLastWriteTime );
entry->nFileSizeHigh = 0;
entry->nFileSizeLow = 0;
entry->dwReserved0 = 0;
entry->dwReserved1 = 0;
strcpy( entry->cFileName,
DOSFS_ToDosDTAFormat( DRIVE_GetLabel( drive )) );
strcpy( entry->cAlternateFileName, entry->cFileName );
return 1;
}
@ -778,9 +914,9 @@ int DOSFS_FindNext( const char *path, const char *short_mask,
dprintf_dosfs( stddeb, "DOSFS_FindNext: cache miss, path=%s skip=%d buf=%s cur=%d\n",
path, skip, buffer, cur_pos );
cur_pos = skip;
if (dir) closedir(dir);
if (dir) DOSFS_CloseDir(dir);
if (!*path) path = "/";
if (!(dir = opendir(path))) return 0;
if (!(dir = DOSFS_OpenDir(path))) return 0;
drive_path = path;
drive_root = 0;
if (DRIVE_FindDriveRoot( &drive_path ) != -1)
@ -796,23 +932,22 @@ int DOSFS_FindNext( const char *path, const char *short_mask,
p = buffer + strlen(buffer);
attr |= FA_UNUSED | FA_ARCHIVE | FA_RDONLY;
flags = DRIVE_GetFlags( drive );
hash_name = NULL;
while ((dirent = readdir( dir )) != NULL)
while (DOSFS_ReadDir( dir, &long_name, &short_name ))
{
if (skip-- > 0) continue;
count++;
/* Don't return '.' and '..' in the root of the drive */
if (drive_root && (dirent->d_name[0] == '.') &&
(!dirent->d_name[1] ||
((dirent->d_name[1] == '.') && !dirent->d_name[2]))) continue;
if (drive_root && (long_name[0] == '.') &&
(!long_name[1] || ((long_name[1] == '.') && !long_name[2])))
continue;
/* Check the long mask */
if (long_mask)
{
if (!DOSFS_MatchLong( long_mask, dirent->d_name,
if (!DOSFS_MatchLong( long_mask, long_name,
flags & DRIVE_CASE_SENSITIVE )) continue;
}
@ -820,44 +955,208 @@ int DOSFS_FindNext( const char *path, const char *short_mask,
if (short_mask)
{
hash_name = DOSFS_Hash( dirent->d_name, TRUE,
!(flags & DRIVE_CASE_SENSITIVE) );
if (!DOSFS_MatchShort( short_mask, hash_name )) continue;
if (!short_name)
short_name = DOSFS_Hash( long_name, TRUE,
!(flags & DRIVE_CASE_SENSITIVE) );
if (!DOSFS_MatchShort( short_mask, short_name )) continue;
}
/* Check the file attributes */
lstrcpyn32A( p, dirent->d_name, sizeof(buffer) - (int)(p - buffer) );
if (!FILE_Stat( buffer, &entry->attr, &entry->size,
&entry->date, &entry->time ))
lstrcpyn32A( p, long_name, sizeof(buffer) - (int)(p - buffer) );
if (!FILE_Stat( buffer, &info ))
{
fprintf( stderr, "DOSFS_FindNext: can't stat %s\n", buffer );
continue;
}
if (entry->attr & ~attr) continue;
if (info.dwFileAttributes & ~attr) continue;
/* We now have a matching entry; fill the result and return */
if (!hash_name)
hash_name = DOSFS_Hash( dirent->d_name, TRUE,
!(flags & DRIVE_CASE_SENSITIVE) );
strcpy( entry->name, hash_name );
lstrcpyn32A( entry->unixname, dirent->d_name, sizeof(entry->unixname));
if (!(flags & DRIVE_CASE_PRESERVING)) AnsiLower( entry->unixname );
dprintf_dosfs( stddeb, "DOSFS_FindNext: returning %s %02x %ld\n",
entry->name, entry->attr, entry->size );
if (!short_name)
short_name = DOSFS_Hash( long_name, TRUE,
!(flags & DRIVE_CASE_SENSITIVE) );
entry->dwFileAttributes = info.dwFileAttributes;
entry->ftCreationTime = info.ftCreationTime;
entry->ftLastAccessTime = info.ftLastAccessTime;
entry->ftLastWriteTime = info.ftLastWriteTime;
entry->nFileSizeHigh = info.nFileSizeHigh;
entry->nFileSizeLow = info.nFileSizeLow;
strcpy( entry->cAlternateFileName, DOSFS_ToDosDTAFormat(short_name) );
lstrcpyn32A( entry->cFileName, long_name, sizeof(entry->cFileName) );
if (!(flags & DRIVE_CASE_PRESERVING)) AnsiLower( entry->cFileName );
dprintf_dosfs( stddeb, "DOSFS_FindNext: returning %s (%s) %02lx %ld\n",
entry->cFileName, entry->cAlternateFileName,
entry->dwFileAttributes, entry->nFileSizeLow );
cur_pos += count;
p[-1] = '\0'; /* Remove trailing slash in buffer */
return count;
}
closedir( dir );
DOSFS_CloseDir( dir );
dir = NULL;
return 0; /* End of directory */
}
/*************************************************************************
* FindFirstFile16 (KERNEL.413)
*/
HANDLE16 FindFirstFile16( LPCSTR path, WIN32_FIND_DATA32A *data )
{
HGLOBAL16 handle;
FIND_FIRST_INFO *info;
LPCSTR ptr;
if (!path) return 0;
if (!(ptr = DOSFS_GetUnixFileName( path, FALSE )))
return INVALID_HANDLE_VALUE16;
if (!(handle = GlobalAlloc16( GMEM_MOVEABLE, sizeof(FIND_FIRST_INFO) )))
return INVALID_HANDLE_VALUE16;
info = (FIND_FIRST_INFO *)GlobalLock16( handle );
info->path = HEAP_strdupA( SystemHeap, 0, ptr );
info->mask = strrchr( info->path, '/' );
*(info->mask++) = '\0';
if (path[0] && (path[1] == ':')) info->drive = toupper(*path) - 'A';
else info->drive = DRIVE_GetCurrentDrive();
info->skip = 0;
GlobalUnlock16( handle );
if (!FindNextFile16( handle, data ))
{
FindClose16( handle );
DOS_ERROR( ER_NoMoreFiles, EC_MediaError, SA_Abort, EL_Disk );
return INVALID_HANDLE_VALUE16;
}
return handle;
}
/*************************************************************************
* FindFirstFile32A (KERNEL32.123)
*/
HANDLE32 FindFirstFile32A( LPCSTR path, WIN32_FIND_DATA32A *data )
{
HANDLE32 handle = FindFirstFile16( path, data );
if (handle == INVALID_HANDLE_VALUE16) return INVALID_HANDLE_VALUE32;
return handle;
}
/*************************************************************************
* FindFirstFile32W (KERNEL32.124)
*/
HANDLE32 FindFirstFile32W( LPCWSTR path, WIN32_FIND_DATA32W *data )
{
WIN32_FIND_DATA32A dataA;
LPSTR pathA = HEAP_strdupWtoA( GetProcessHeap(), 0, path );
HANDLE32 handle = FindFirstFile32A( pathA, &dataA );
HeapFree( GetProcessHeap(), 0, pathA );
if (handle != INVALID_HANDLE_VALUE32)
{
data->dwFileAttributes = dataA.dwFileAttributes;
data->ftCreationTime = dataA.ftCreationTime;
data->ftLastAccessTime = dataA.ftLastAccessTime;
data->ftLastWriteTime = dataA.ftLastWriteTime;
data->nFileSizeHigh = dataA.nFileSizeHigh;
data->nFileSizeLow = dataA.nFileSizeLow;
lstrcpyAtoW( data->cFileName, dataA.cFileName );
lstrcpyAtoW( data->cAlternateFileName, dataA.cAlternateFileName );
}
return handle;
}
/*************************************************************************
* FindNextFile16 (KERNEL.414)
*/
BOOL16 FindNextFile16( HANDLE16 handle, WIN32_FIND_DATA32A *data )
{
FIND_FIRST_INFO *info;
int count;
if (!(info = (FIND_FIRST_INFO *)GlobalLock16( handle )))
{
DOS_ERROR( ER_InvalidHandle, EC_ProgramError, SA_Abort, EL_Disk );
return FALSE;
}
GlobalUnlock16( handle );
if (!info->path)
{
DOS_ERROR( ER_NoMoreFiles, EC_MediaError, SA_Abort, EL_Disk );
return FALSE;
}
if (!(count = DOSFS_FindNext( info->path, NULL, info->mask, info->drive,
0xff, info->skip, data )))
{
HeapFree( SystemHeap, 0, info->path );
info->path = info->mask = NULL;
DOS_ERROR( ER_NoMoreFiles, EC_MediaError, SA_Abort, EL_Disk );
return FALSE;
}
info->skip += count;
return TRUE;
}
/*************************************************************************
* FindNextFile32A (KERNEL32.126)
*/
BOOL32 FindNextFile32A( HANDLE32 handle, WIN32_FIND_DATA32A *data )
{
return FindNextFile16( handle, data );
}
/*************************************************************************
* FindNextFile32W (KERNEL32.127)
*/
BOOL32 FindNextFile32W( HANDLE32 handle, WIN32_FIND_DATA32W *data )
{
WIN32_FIND_DATA32A dataA;
if (!FindNextFile32A( handle, &dataA )) return FALSE;
data->dwFileAttributes = dataA.dwFileAttributes;
data->ftCreationTime = dataA.ftCreationTime;
data->ftLastAccessTime = dataA.ftLastAccessTime;
data->ftLastWriteTime = dataA.ftLastWriteTime;
data->nFileSizeHigh = dataA.nFileSizeHigh;
data->nFileSizeLow = dataA.nFileSizeLow;
lstrcpyAtoW( data->cFileName, dataA.cFileName );
lstrcpyAtoW( data->cAlternateFileName, dataA.cAlternateFileName );
return TRUE;
}
/*************************************************************************
* FindClose16 (KERNEL.415)
*/
BOOL16 FindClose16( HANDLE16 handle )
{
FIND_FIRST_INFO *info;
if ((handle == INVALID_HANDLE_VALUE16) ||
!(info = (FIND_FIRST_INFO *)GlobalLock16( handle )))
{
DOS_ERROR( ER_InvalidHandle, EC_ProgramError, SA_Abort, EL_Disk );
return FALSE;
}
if (info->path) HeapFree( SystemHeap, 0, info->path );
GlobalUnlock16( handle );
GlobalFree16( handle );
return TRUE;
}
/*************************************************************************
* FindClose32 (KERNEL32.119)
*/
BOOL32 FindClose32( HANDLE32 handle )
{
return FindClose16( (HANDLE16)handle );
}
/***********************************************************************
* GetShortPathNameA (KERNEL32.271)
* GetShortPathName32A (KERNEL32.271)
*/
DWORD GetShortPathName32A( LPCSTR longpath, LPSTR shortpath, DWORD shortlen )
{
@ -940,7 +1239,8 @@ BOOL32 DosDateTimeToFileTime( WORD fatdate, WORD fattime, LPFILETIME ft )
/***********************************************************************
* FileTimeToDosDateTime (KERNEL32.111)
*/
BOOL32 FileTimeToDosDateTime( LPFILETIME ft, LPWORD fatdate, LPWORD fattime)
BOOL32 FileTimeToDosDateTime( const FILETIME *ft, LPWORD fatdate,
LPWORD fattime )
{
time_t unixtime = DOSFS_FileTimeToUnixTime(ft);
DOSFS_ToDosDateTime(unixtime,fatdate,fattime);
@ -951,7 +1251,7 @@ BOOL32 FileTimeToDosDateTime( LPFILETIME ft, LPWORD fatdate, LPWORD fattime)
/***********************************************************************
* LocalFileTimeToFileTime (KERNEL32.373)
*/
BOOL32 LocalFileTimeToFileTime( LPFILETIME localft, LPFILETIME utcft )
BOOL32 LocalFileTimeToFileTime( const FILETIME *localft, LPFILETIME utcft )
{
struct tm *xtm;
@ -966,7 +1266,7 @@ BOOL32 LocalFileTimeToFileTime( LPFILETIME localft, LPFILETIME utcft )
/***********************************************************************
* FileTimeToLocalFileTime (KERNEL32.112)
*/
BOOL32 FileTimeToLocalFileTime( LPFILETIME utcft, LPFILETIME localft )
BOOL32 FileTimeToLocalFileTime( const FILETIME *utcft, LPFILETIME localft )
{
struct tm *xtm;
@ -981,7 +1281,7 @@ BOOL32 FileTimeToLocalFileTime( LPFILETIME utcft, LPFILETIME localft )
/***********************************************************************
* FileTimeToSystemTime (KERNEL32.113)
*/
BOOL32 FileTimeToSystemTime( LPFILETIME ft, LPSYSTEMTIME syst )
BOOL32 FileTimeToSystemTime( const FILETIME *ft, LPSYSTEMTIME syst )
{
struct tm *xtm;
time_t xtime = DOSFS_FileTimeToUnixTime(ft);
@ -1001,7 +1301,7 @@ BOOL32 FileTimeToSystemTime( LPFILETIME ft, LPSYSTEMTIME syst )
/***********************************************************************
* SystemTimeToFileTime (KERNEL32.526)
*/
BOOL32 SystemTimeToFileTime( LPSYSTEMTIME syst, LPFILETIME ft )
BOOL32 SystemTimeToFileTime( const SYSTEMTIME *syst, LPFILETIME ft )
{
struct tm xtm;

View File

@ -32,7 +32,6 @@
#include "msdos.h"
#include "options.h"
#include "task.h"
#include "xmalloc.h"
#include "stddebug.h"
#include "debug.h"
@ -137,11 +136,11 @@ int DRIVE_Init(void)
p = path + strlen(path) - 1;
while ((p > path) && ((*p == '/') || (*p == '\\'))) *p-- = '\0';
if (strlen(path))
drive->root = xstrdup( path );
drive->root = HEAP_strdupA( SystemHeap, 0, path );
else
drive->root = xstrdup( "/" );
drive->dos_cwd = xstrdup( "" );
drive->unix_cwd = xstrdup( "" );
drive->root = HEAP_strdupA( SystemHeap, 0, "/" );
drive->dos_cwd = HEAP_strdupA( SystemHeap, 0, "" );
drive->unix_cwd = HEAP_strdupA( SystemHeap, 0, "" );
drive->type = DRIVE_GetDriveType( name );
drive->flags = 0;
@ -180,9 +179,9 @@ int DRIVE_Init(void)
{
fprintf( stderr, "Warning: no valid DOS drive found, check your configuration file.\n" );
/* Create a C drive pointing to Unix root dir */
DOSDrives[2].root = xstrdup( "/" );
DOSDrives[2].dos_cwd = xstrdup( "" );
DOSDrives[2].unix_cwd = xstrdup( "" );
DOSDrives[2].root = HEAP_strdupA( SystemHeap, 0, "/" );
DOSDrives[2].dos_cwd = HEAP_strdupA( SystemHeap, 0, "" );
DOSDrives[2].unix_cwd = HEAP_strdupA( SystemHeap, 0, "" );
strcpy( DOSDrives[2].label, "Drive C " );
DOSDrives[2].serial = 0x12345678;
DOSDrives[2].type = TYPE_HD;
@ -413,7 +412,7 @@ int DRIVE_Chdir( int drive, const char *path )
{
char buffer[MAX_PATHNAME_LEN];
const char *unix_cwd, *dos_cwd;
BYTE attr;
BY_HANDLE_FILE_INFORMATION info;
TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() );
dprintf_dosfs( stddeb, "DRIVE_Chdir(%c:,%s)\n", 'A' + drive, path );
@ -422,8 +421,8 @@ int DRIVE_Chdir( int drive, const char *path )
lstrcpyn32A( buffer + 2, path, sizeof(buffer) - 2 );
if (!(unix_cwd = DOSFS_GetUnixFileName( buffer, TRUE ))) return 0;
if (!FILE_Stat( unix_cwd, &attr, NULL, NULL, NULL )) return 0;
if (!(attr & FA_DIRECTORY))
if (!FILE_Stat( unix_cwd, &info )) return 0;
if (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
return 0;
@ -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",
'A' + drive, unix_cwd, dos_cwd + 3 );
free( DOSDrives[drive].dos_cwd );
free( DOSDrives[drive].unix_cwd );
DOSDrives[drive].dos_cwd = xstrdup( dos_cwd + 3 );
DOSDrives[drive].unix_cwd = xstrdup( unix_cwd );
HeapFree( SystemHeap, 0, DOSDrives[drive].dos_cwd );
HeapFree( SystemHeap, 0, DOSDrives[drive].unix_cwd );
DOSDrives[drive].dos_cwd = HEAP_strdupA( SystemHeap, 0, dos_cwd + 3 );
DOSDrives[drive].unix_cwd = HEAP_strdupA( SystemHeap, 0, unix_cwd );
if (pTask && (pTask->curdrive & 0x80) &&
((pTask->curdrive & ~0x80) == drive))
@ -569,7 +568,7 @@ BOOL32 GetDiskFreeSpace32W( LPCWSTR root, LPDWORD cluster_sectors,
LPDWORD total_clusters )
{
LPSTR xroot;
BOOL ret;
BOOL32 ret;
xroot = HEAP_strdupWtoA( GetProcessHeap(), 0, root);
ret = GetDiskFreeSpace32A( xroot,cluster_sectors, sector_bytes,

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,6 @@
* Copyright 1996 Alexandre Julliard
*/
#define NO_TRANSITION_TYPES /* This file is Win32-clean */
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
@ -14,7 +13,6 @@
#include "windows.h"
#include "dos_fs.h"
#include "heap.h"
#include "xmalloc.h"
#include "stddebug.h"
#include "debug.h"
@ -139,16 +137,16 @@ static void PROFILE_Free( PROFILESECTION *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)
{
next_key = key->next;
if (key->name) free( key->name );
if (key->value) free( key->value );
free( key );
if (key->name) HeapFree( SystemHeap, 0, key->name );
if (key->value) HeapFree( SystemHeap, 0, key->value );
HeapFree( SystemHeap, 0, key );
}
next_section = section->next;
free( section );
HeapFree( SystemHeap, 0, section );
}
}
@ -167,7 +165,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
PROFILESECTION **prev_section;
PROFILEKEY *key, **prev_key;
first_section = (PROFILESECTION *)xmalloc( sizeof(*section) );
first_section = HEAP_xalloc( SystemHeap, 0, sizeof(*section) );
first_section->name = NULL;
first_section->key = NULL;
first_section->next = NULL;
@ -192,8 +190,8 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
{
*p2 = '\0';
p++;
section = (PROFILESECTION *)xmalloc( sizeof(*section));
section->name = xstrdup( p );
section = HEAP_xalloc( SystemHeap, 0, sizeof(*section) );
section->name = HEAP_strdupA( SystemHeap, 0, p );
section->key = NULL;
section->next = NULL;
*prev_section = section;
@ -209,9 +207,9 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
*p2++ = '\0';
while (*p2 && isspace(*p2)) p2++;
}
key = (PROFILEKEY *)xmalloc( sizeof(*key) );
key->name = xstrdup( p );
key->value = p2 ? xstrdup( p2 ) : NULL;
key = HEAP_xalloc( SystemHeap, 0, sizeof(*key) );
key->name = HEAP_strdupA( SystemHeap, 0, p );
key->value = HEAP_strdupA( SystemHeap, 0, p2 );
key->next = NULL;
*prev_key = key;
prev_key = &key->next;
@ -268,9 +266,9 @@ static BOOL32 PROFILE_DeleteKey( PROFILESECTION **section,
{
PROFILEKEY *to_del = *key;
*key = to_del->next;
if (to_del->name) free( to_del->name );
if (to_del->value) free( to_del->value );
free( to_del );
if (to_del->name) HeapFree( SystemHeap, 0, to_del->name );
if (to_del->value) HeapFree( SystemHeap, 0, to_del->value);
HeapFree( SystemHeap, 0, to_del );
return TRUE;
}
key = &(*key)->next;
@ -302,8 +300,8 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section,
key = &(*key)->next;
}
if (!create) return NULL;
*key = (PROFILEKEY *)xmalloc( sizeof(PROFILEKEY) );
(*key)->name = xstrdup( key_name );
*key = HEAP_xalloc( SystemHeap, 0, sizeof(PROFILEKEY) );
(*key)->name = HEAP_strdupA( SystemHeap, 0, key_name );
(*key)->value = NULL;
(*key)->next = NULL;
return *key;
@ -311,11 +309,11 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section,
section = &(*section)->next;
}
if (!create) return NULL;
*section = (PROFILESECTION *)xmalloc( sizeof(PROFILESECTION) );
(*section)->name = xstrdup(section_name);
*section = HEAP_xalloc( SystemHeap, 0, sizeof(PROFILESECTION) );
(*section)->name = HEAP_strdupA( SystemHeap, 0, section_name );
(*section)->next = NULL;
(*section)->key = (PROFILEKEY *)xmalloc( sizeof(PROFILEKEY) );
(*section)->key->name = xstrdup( key_name );
(*section)->key = HEAP_xalloc( SystemHeap, 0, sizeof(PROFILEKEY) );
(*section)->key->name = HEAP_strdupA( SystemHeap, 0, key_name );
(*section)->key->value = NULL;
(*section)->key->next = NULL;
return (*section)->key;
@ -400,10 +398,10 @@ static BOOL32 PROFILE_Open( LPCSTR filename )
/* Flush the previous profile */
newdos_name = xstrdup( dos_name );
newdos_name = HEAP_strdupA( SystemHeap, 0, dos_name );
PROFILE_FlushFile();
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.dos_name = newdos_name;
@ -528,6 +526,7 @@ static BOOL32 PROFILE_SetString( LPCSTR section_name, LPCSTR key_name,
key_name, TRUE );
dprintf_profile( stddeb, "PROFILE_SetString('%s','%s','%s'): ",
section_name, key_name, value );
if (!key) return FALSE;
if (key->value)
{
if (!strcmp( key->value, value ))
@ -536,10 +535,10 @@ static BOOL32 PROFILE_SetString( LPCSTR section_name, LPCSTR key_name,
return TRUE; /* No change needed */
}
dprintf_profile( stddeb, "replacing '%s'\n", key->value );
free( key->value );
HeapFree( SystemHeap, 0, key->value );
}
else dprintf_profile( stddeb, "creating key\n" );
key->value = xstrdup( value );
key->value = HEAP_strdupA( SystemHeap, 0, value );
CurProfile.changed = TRUE;
}
return TRUE;

View File

@ -144,7 +144,7 @@ HDC16 CreateMetaFile16( LPCSTR filename )
{
DC *dc;
METAFILEDRV_PDEVICE *physDev;
HFILE hFile;
HFILE32 hFile;
dprintf_metafile( stddeb, "CreateMetaFile16: '%s'\n", filename );
@ -154,13 +154,13 @@ HDC16 CreateMetaFile16( LPCSTR filename )
if (filename) /* disk based metafile */
{
physDev->mh->mtType = METAFILE_DISK;
if ((hFile = _lcreat( filename, 0 )) == HFILE_ERROR)
if ((hFile = _lcreat32( filename, 0 )) == HFILE_ERROR32)
{
DeleteDC32( dc->hSelf );
return 0;
}
if (_lwrite32( hFile, (LPSTR)physDev->mh,
sizeof(*physDev->mh)) == HFILE_ERROR)
sizeof(*physDev->mh)) == HFILE_ERROR32)
{
DeleteDC32( dc->hSelf );
return 0;
@ -183,7 +183,7 @@ HMETAFILE16 CloseMetaFile16( HDC16 hdc )
{
DC *dc;
HMETAFILE16 hmf;
HFILE hFile;
HFILE32 hFile;
METAFILEDRV_PDEVICE *physDev;
dprintf_metafile( stddeb, "CloseMetaFile(%04x)\n", hdc );
@ -205,18 +205,18 @@ HMETAFILE16 CloseMetaFile16( HDC16 hdc )
{
hFile = physDev->mh->mtNoParameters;
physDev->mh->mtNoParameters = 0;
if (_llseek(hFile, 0L, 0) == HFILE_ERROR)
if (_llseek32(hFile, 0L, 0) == HFILE_ERROR32)
{
DeleteDC32( hdc );
return 0;
}
if (_lwrite32( hFile, (LPSTR)physDev->mh,
sizeof(*physDev->mh)) == HFILE_ERROR)
sizeof(*physDev->mh)) == HFILE_ERROR32)
{
DeleteDC32( hdc );
return 0;
}
_lclose(hFile);
_lclose32(hFile);
}
/* Now allocate a global handle for the metafile */

View File

@ -149,23 +149,9 @@ HBITMAP16 WinGCreateBitmap16(HDC16 winDC, BITMAPINFO *header, void **bits)
bmpObjPtr->bitmap.bmHeight, bmpi->biBitCount );
if( bmpObjPtr->pixmap )
{
WORD s;
if( (sel = AllocSelectorArray( (bytes + 0xFFFF) >> 16 )) )
{
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);
}
sel = SELECTOR_AllocBlock( p->si.shmaddr, bytes,
SEGMENT_DATA, FALSE, FALSE);
if (sel) p->bits = PTR_SEG_OFF_TO_SEGPTR(sel,0);
else XFreePixmap( display, bmpObjPtr->pixmap );
}
if( !sel )

View File

@ -55,6 +55,7 @@ DLLS = \
SPEC_FILES = $(DLLS:.spec=.s)
C_SRCS = \
builtin.c \
dummy.c \
relay.c \
thunk.c

View File

@ -4,20 +4,20 @@
* Copyright 1996 Alexandre Julliard
*/
#ifndef WINELIB
#include <assert.h>
#include <ctype.h>
#include <string.h>
#include "windows.h"
#include "gdi.h"
#include "global.h"
#include "module.h"
#include "miscemu.h"
#include "neexe.h"
#include "stackframe.h"
#include "user.h"
#include "stddebug.h"
#include "debug.h"
/* Built-in modules descriptors */
/* Don't change these structures! (see tools/build.c) */
@ -166,6 +166,8 @@ static BUILTIN_DLL BuiltinDLLs[] =
{ NULL, 0 }
};
/* Ordinal number for interrupt 0 handler in WPROCS.DLL */
#define FIRST_INTERRUPT_ORDINAL 100
/***********************************************************************
* BUILTIN_Init
@ -176,15 +178,13 @@ BOOL16 BUILTIN_Init(void)
{
BUILTIN_DLL *dll;
NE_MODULE *pModule;
WORD vector;
HMODULE16 hModule;
for (dll = BuiltinDLLs; dll->descr; dll++)
if (dll->flags & DLL_FLAG_ALWAYS_USED)
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 */
pModule = MODULE_GetPtr( GetModuleHandle( "USER" ));
@ -192,6 +192,40 @@ BOOL16 BUILTIN_Init(void)
pModule = MODULE_GetPtr( GetModuleHandle( "GDI" ));
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;
}
@ -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
*
@ -475,5 +523,3 @@ void BUILTIN_PrintDLLs(void)
fprintf(stderr,"\n");
exit(1);
}
#endif /* WINELIB */

View File

@ -70,18 +70,18 @@ type win16
71 pascal16 DeleteAtom(word) DeleteAtom
72 pascal16 GetAtomName(word ptr word) GetAtomName
73 pascal16 GetAtomHandle(word) GetAtomHandle
74 pascal16 OpenFile(ptr ptr word) OpenFile
74 pascal16 OpenFile(ptr ptr word) OpenFile16
75 stub OpenPathName
76 stub DeletePathName
#77 RESERVED1
#78 RESERVED2
#79 RESERVED3
#80 RESERVED4
81 pascal16 _lclose(word) _lclose
81 pascal16 _lclose(word) _lclose16
82 pascal16 _lread(word segptr word) WIN16_lread
83 pascal16 _lcreat(ptr word) _lcreat
84 pascal _llseek(word long word) _llseek
85 pascal16 _lopen(ptr word) _lopen
83 pascal16 _lcreat(ptr word) _lcreat16
84 pascal _llseek(word long word) _llseek16
85 pascal16 _lopen(ptr word) _lopen16
86 pascal16 _lwrite(word ptr word) _lwrite16
87 pascal16 RESERVED5(ptr ptr) lstrcmp16
88 pascal lstrcpy(segptr segptr) lstrcpy16
@ -96,7 +96,7 @@ type win16
97 pascal16 GetTempFileName(byte ptr word ptr) GetTempFileName16
98 return GetLastDiskChange 0 0
99 stub GetLPErrMode
100 stub ValidateCodeSegments
100 return ValidateCodeSegments 0 0
101 stub NoHookDosCall
102 register DOS3Call() DOS3Call
103 register NetBIOSCall() NetBIOSCall
@ -135,7 +135,7 @@ type win16
134 pascal16 GetWindowsDirectory(ptr word) GetWindowsDirectory16
135 pascal16 GetSystemDirectory(ptr word) GetSystemDirectory16
136 pascal16 GetDriveType(byte) GetDriveType16
137 pascal FatalAppExit(word ptr) FatalAppExit
137 pascal16 FatalAppExit(word ptr) FatalAppExit16
138 pascal GetHeapSpaces(word) GetHeapSpaces
139 stub DoSignal
140 pascal16 SetSigHandler(segptr ptr ptr word word) SetSigHandler
@ -146,7 +146,7 @@ type win16
145 pascal16 RemoveDirectory(ptr) RemoveDirectory16
146 pascal16 DeleteFile(ptr) DeleteFile16
147 pascal16 SetLastError(long) SetLastError
148 pascal16 GetLastError() GetLastError
148 pascal GetLastError() GetLastError
149 stub GetVersionEx
150 pascal16 DirectedYield(word) DirectedYield
151 stub WinOldApCall
@ -163,7 +163,7 @@ type win16
163 pascal16 GlobalLRUOldest(word) GlobalLRUOldest
164 pascal16 GlobalLRUNewest(word) GlobalLRUNewest
165 return A20Proc 2 0
166 pascal16 WinExec(ptr word) WinExec
166 pascal16 WinExec(ptr word) WinExec16
167 pascal16 GetExpWinVer(word) GetExpWinVer
168 pascal16 DirectResAlloc(word word word) DirectResAlloc
169 pascal GetFreeSpace(word) GetFreeSpace
@ -197,7 +197,7 @@ type win16
197 pascal16 GlobalFix(word) GlobalFix
198 pascal16 GlobalUnfix(word) GlobalUnfix
199 pascal16 SetHandleCount(word) SetHandleCount16
200 stub ValidateFreeSpaces
200 return ValidateFreeSpaces 0 0
201 stub ReplaceInst
202 stub RegisterPtrace
203 register DebugBreak() DebugBreak16
@ -257,7 +257,7 @@ type win16
347 pascal16 IsBadHugeWritePtr(segptr long) IsBadHugeWritePtr16
348 pascal16 hmemcpy(ptr ptr long) hmemcpy
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
352 pascal lstrcatn(segptr segptr word) lstrcatn16
353 pascal lstrcpyn(segptr segptr word) lstrcpyn16
@ -279,8 +279,8 @@ type win16
417 stub WriteProfileSection
418 stub GetPrivateProfileSection
419 stub GetProfileSection
420 stub GetFileAttributes
421 stub SetFileAttributes
420 pascal GetFileAttributes(ptr) GetFileAttributes16
421 pascal16 SetFileAttributes(ptr long) SetFileAttributes16
422 pascal16 GetDiskFreeSpace(ptr ptr ptr ptr ptr) GetDiskFreeSpace16
432 stub FileTimeToLocalFileTime
450 pascal16 KERNEL_450() stub_KERNEL_450

View File

@ -25,7 +25,7 @@ base 1
0020 stdcall ClearCommBreak(long) ClearCommBreak32
0021 stdcall ClearCommError(long ptr ptr) ClearCommError
0022 stub CloseConsoleHandle
0023 stdcall CloseHandle(long) CloseHandle
0023 stdcall CloseHandle(long) CloseHandle
0024 stub CloseProfileUserMapping
0025 stub CmdBatNotification
0026 stub CommConfigDialogA
@ -110,8 +110,8 @@ base 1
0105 stub ExpungeConsoleCommandHistoryA
0106 stub ExpungeConsoleCommandHistoryW
0107 stub ExtendVirtualBuffer
0108 stub FatalAppExitA
0109 stub FatalAppExitW
0108 stdcall FatalAppExitA(long ptr) FatalAppExit32A
0109 stdcall FatalAppExitW(long ptr) FatalAppExit32W
0110 stub FatalExit
0111 stdcall FileTimeToDosDateTime(ptr ptr ptr) FileTimeToDosDateTime
0112 stdcall FileTimeToLocalFileTime(ptr ptr) FileTimeToLocalFileTime
@ -201,9 +201,9 @@ base 1
0196 stdcall GetCurrentDirectoryA(long ptr) GetCurrentDirectory32A
0197 stdcall GetCurrentDirectoryW(long ptr) GetCurrentDirectory32W
0198 stdcall GetCurrentProcess() GetCurrentProcess
0199 stdcall GetCurrentProcessId() GetCurrentThreadId
0200 stdcall GetCurrentThread() GetCurrentThread
0201 stdcall GetCurrentThreadId() GetCurrentThreadId
0199 stdcall GetCurrentProcessId() GetCurrentProcessId
0200 stdcall GetCurrentThread() GetCurrentThread
0201 stdcall GetCurrentThreadId() GetCurrentThreadId
0202 stub GetDateFormatA
0203 stub GetDateFormatW
0204 stub GetDefaultCommConfigA
@ -398,7 +398,7 @@ base 1
0393 stub OpenConsoleW
0394 stub OpenEventA
0395 stub OpenEventW
0396 stdcall OpenFile(ptr ptr long) OpenFile
0396 stdcall OpenFile(ptr ptr long) OpenFile32
0397 stdcall OpenFileMappingA(long long ptr) OpenFileMapping
0398 stub OpenFileMappingW
0399 stub OpenMutexA
@ -499,7 +499,7 @@ base 1
0494 stdcall SetHandleCount(long) SetHandleCount32
0495 stub SetHandleInformation
0496 stub SetLastConsoleEventActive
0497 stdcall SetLastError(long) SetLastError
0497 stdcall SetLastError(long) SetLastError
0498 stub SetLocalTime
0499 stdcall SetLocaleInfoA(long long ptr) SetLocaleInfoA
0500 stub SetLocaleInfoW
@ -533,9 +533,9 @@ base 1
0528 stub TerminateProcess
0529 stub TerminateThread
0530 stdcall TlsAlloc() TlsAlloc
0531 stdcall TlsFree(long) TlsFree
0532 stdcall TlsGetValue(long) TlsGetValue
0533 stdcall TlsSetValue(long ptr) TlsSetValue
0531 stdcall TlsFree(long) TlsFree
0532 stdcall TlsGetValue(long) TlsGetValue
0533 stdcall TlsSetValue(long ptr) TlsSetValue
0534 stub TransactNamedPipe
0535 stdcall TransmitCommChar(long long) TransmitCommChar32
0536 stub TrimVirtualBuffer
@ -568,7 +568,7 @@ base 1
0563 stub WaitNamedPipeA
0564 stub WaitNamedPipeW
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
0568 stub WriteConsoleInputA
0569 stub WriteConsoleInputVDMA
@ -592,12 +592,12 @@ base 1
0587 stdcall WriteProfileStringA(ptr ptr ptr) WriteProfileString32A
0588 stdcall WriteProfileStringW(ptr ptr ptr) WriteProfileString32W
0589 stub WriteTapemark
0590 stdcall _hread(long ptr long) _hread
0591 stdcall _hwrite(long ptr long) _hwrite
0592 stdcall _lclose(long) _lclose
0593 stdcall _lcreat(ptr long) _lcreat
0594 stdcall _llseek(long long long) _llseek
0595 stdcall _lopen(ptr long) _lopen
0590 stdcall _hread(long ptr long) _hread32
0591 stdcall _hwrite(long ptr long) _hwrite32
0592 stdcall _lclose(long) _lclose32
0593 stdcall _lcreat(ptr long) _lcreat32
0594 stdcall _llseek(long long long) _llseek32
0595 stdcall _lopen(ptr long) _lopen32
0596 stdcall _lread(long ptr long) _lread32
0597 stdcall _lwrite(long ptr long) _lwrite32
0598 stdcall lstrcat(ptr ptr) lstrcat32A

View File

@ -1,14 +1,14 @@
name lz32
type win32
0 stdcall LZCopy(long long) LZCopy
0 stdcall LZCopy(long long) LZCopy32
1 stdcall LZOpenFileA(ptr ptr long) LZOpenFile32A
2 stdcall LZInit(long) LZInit
3 stdcall LZSeek(long long long) LZSeek
2 stdcall LZInit(long) LZInit32
3 stdcall LZSeek(long long long) LZSeek32
4 stdcall LZRead(long ptr long) LZRead32
5 stdcall LZClose(long) LZClose
6 stdcall LZStart() LZStart
7 stdcall CopyLZFile(long long) CopyLZFile
5 stdcall LZClose(long) LZClose32
6 stdcall LZStart() LZStart32
7 stdcall CopyLZFile(long long) CopyLZFile32
8 stdcall LZDone() LZDone
9 stdcall GetExpandedNameA(ptr ptr) GetExpandedName32A
10 stdcall LZOpenFileW(ptr ptr long) LZOpenFile32W

View File

@ -1,14 +1,14 @@
name lzexpand
type win16
1 pascal LZCopy(word word) LZCopy
1 pascal LZCopy(word word) LZCopy16
2 pascal16 LZOpenFile(ptr ptr word) LZOpenFile16
3 pascal16 LZInit(word) LZInit
4 pascal LZSeek(word long word) LZSeek
5 pascal16 LZRead(word segptr word) LZRead16
6 pascal16 LZClose(word) LZClose
7 pascal16 LZStart() LZStart
8 pascal CopyLZFile(word word) CopyLZFile
3 pascal16 LZInit(word) LZInit16
4 pascal LZSeek(word long word) LZSeek16
5 pascal16 LZRead(word ptr word) LZRead16
6 pascal16 LZClose(word) LZClose16
7 pascal16 LZStart() LZStart16
8 pascal CopyLZFile(word word) CopyLZFile16
9 pascal16 LZDone() LZDone
10 pascal16 GetExpandedName(ptr ptr) GetExpandedName16
#11 WEP

View File

@ -5,9 +5,9 @@
#include <stdio.h>
#include "windows.h"
#include "winnt.h"
#include "global.h"
#include "module.h"
#include "registers.h"
#include "stackframe.h"
#include "task.h"
#include "stddebug.h"
@ -52,7 +52,7 @@ BOOL32 RELAY_Init(void)
* RELAY_DebugCallFrom16
*/
void RELAY_DebugCallFrom16( int func_type, char *args,
void *entry_point, SIGCONTEXT *context )
void *entry_point, CONTEXT *context )
{
STACK16FRAME *frame;
WORD ordinal;
@ -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",
AX_reg(context), BX_reg(context), CX_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
*/
void RELAY_DebugCallFrom16Ret( int func_type, int ret_val, SIGCONTEXT *context)
void RELAY_DebugCallFrom16Ret( int func_type, int ret_val, CONTEXT *context)
{
STACK16FRAME *frame;
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;
frame = CURRENT_STACK16;
printf( "Ret %s() ", BUILTIN_GetEntryPoint16( frame->entry_cs,
frame->entry_ip,
@ -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",
AX_reg(context), BX_reg(context), CX_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;
}
}

View File

@ -14,8 +14,8 @@ type win16
13 pascal16 DragQueryPoint(word ptr) DragQueryPoint
20 pascal16 ShellExecute(word ptr ptr ptr ptr s_word) ShellExecute
21 pascal16 FindExecutable(ptr ptr ptr) FindExecutable
22 pascal16 ShellAbout(word ptr ptr word) ShellAbout
33 pascal16 AboutDlgProc(word word word long) AboutDlgProc
22 pascal16 ShellAbout(word ptr ptr word) ShellAbout16
33 pascal16 AboutDlgProc(word word word long) AboutDlgProc16
34 pascal16 ExtractIcon(word ptr s_word) ExtractIcon
36 pascal16 ExtractAssociatedIcon(word ptr ptr) ExtractAssociatedIcon
37 pascal DoEnvironmentSubst(ptr word) DoEnvironmentSubst

View File

@ -84,7 +84,7 @@ base 1
0079 stub SheSetCurDrive
0080 stub SheShortenPathA
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
0084 stdcall ShellExecuteA(long ptr ptr ptr ptr long) ShellExecute
0085 stub ShellExecuteEx

View File

@ -8,7 +8,7 @@ heap 65520
4 stub DisableOEMLayer
5 pascal16 InitApp(word) InitApp
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
11 pascal16 SetSystemTimer(word word word segptr) SetSystemTimer16
12 pascal16 KillTimer(word word) KillTimer16
@ -125,9 +125,9 @@ heap 65520
123 pascal16 CallMsgFilter(segptr s_word) CallMsgFilter16
124 pascal16 UpdateWindow(word) UpdateWindow
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
128 pascal16 ValidateRgn(word word) ValidateRgn
128 pascal16 ValidateRgn(word word) ValidateRgn16
129 pascal16 GetClassWord(word s_word) GetClassWord
130 pascal16 SetClassWord(word s_word word) SetClassWord
131 pascal GetClassLong(word s_word) GetClassLong16
@ -170,7 +170,7 @@ heap 65520
168 pascal16 SetCaretBlinkTime(word) SetCaretBlinkTime
169 pascal16 GetCaretBlinkTime() GetCaretBlinkTime16
170 pascal16 ArrangeIconicWindows(word) ArrangeIconicWindows
171 pascal16 WinHelp(word ptr word long) WinHelp
171 pascal16 WinHelp(word ptr word long) WinHelp16
172 stub SwitchToThisWindow
173 pascal16 LoadCursor(word segptr) LoadCursor16
174 pascal16 LoadIcon(word segptr) LoadIcon16

View File

@ -199,7 +199,7 @@ base 1
0192 stdcall EnumWindows(ptr long) THUNK_EnumWindows32
0193 stdcall EqualRect(ptr ptr) EqualRect32
0194 stdcall ExcludeUpdateRgn(long long) ExcludeUpdateRgn
0195 stub ExitWindowsEx
0195 stdcall ExitWindowsEx(long long) ExitWindowsEx
0196 stdcall FillRect(long ptr long) FillRect32
0197 stdcall FindWindowA(ptr ptr) FindWindow32A
0198 stdcall FindWindowExA(long long ptr ptr) FindWindowEx32A
@ -332,7 +332,7 @@ base 1
0325 stub InternalGetWindowText
0326 stdcall IntersectRect(ptr ptr ptr) IntersectRect32
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
0330 stdcall IsCharAlphaA(long) IsCharAlpha32A
0331 stdcall IsCharAlphaNumericA(long) IsCharAlphaNumeric32A
@ -553,7 +553,7 @@ base 1
0546 stub ToAsciiEx
0547 stub ToUnicode
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
0551 stdcall TranslateAcceleratorA(long long ptr) TranslateAccelerator
0552 stdcall TranslateAcceleratorW(long long ptr) TranslateAccelerator
@ -575,15 +575,15 @@ base 1
0568 stub UserRealizePalette
0569 stub UserRegisterWowHandlers
0570 stdcall ValidateRect(long ptr) ValidateRect32
0571 stdcall ValidateRgn(long long) ValidateRgn
0571 stdcall ValidateRgn(long long) ValidateRgn32
0572 stdcall VkKeyScanA(long) VkKeyScan
0573 stub VkKeyScanExA
0574 stub VkKeyScanExW
0575 stub VkKeyScanW
0576 stub WaitForInputIdle
0577 stub WaitMessage
0578 stdcall WinHelpA(long ptr long long) WIN32_WinHelpA
0579 stub WinHelpW
0578 stdcall WinHelpA(long ptr long long) WinHelp32A
0579 stdcall WinHelpW(long ptr long long) WinHelp32W
0580 stdcall WindowFromDC(long) WindowFromDC32
0581 stdcall WindowFromPoint(long long) WindowFromPoint32
0582 stub keybd_event

View File

@ -9,7 +9,6 @@ type win16
7 pascal PopupMenuWndProc(word word word long) PopupMenuWndProc
9 pascal DefDlgProc(word word word long) DefDlgProc16
10 pascal MDIClientWndProc(word word word long) MDIClientWndProc
13 pascal SystemMessageBoxProc(word word word long) SystemMessageBoxProc
14 pascal FileOpenDlgProc(word word word long) FileOpenDlgProc
15 pascal FileSaveDlgProc(word word word long) FileSaveDlgProc
16 pascal ColorDlgProc(word word word long) ColorDlgProc
@ -17,7 +16,6 @@ type win16
18 pascal ReplaceTextDlgProc(word word word long) ReplaceTextDlgProc
19 pascal PrintSetupDlgProc(word word word long) PrintSetupDlgProc
20 pascal PrintDlgProc(word word word long) PrintDlgProc
21 pascal AboutDlgProc(word word word long) AboutDlgProc
22 pascal ComboLBoxWndProc(word word word long) ComboLBoxWndProc
24 pascal16 TASK_Reschedule() TASK_Reschedule
27 pascal EntryAddrProc(word word) MODULE_GetEntryPoint
@ -26,263 +24,263 @@ type win16
# Interrupt vectors 0-255 are ordinals 100-355
# The 'word' parameter are the flags pushed on the stack by the interrupt
100 register INT_Int00Handler(word) INT_DummyHandler
101 register INT_Int01Handler(word) INT_DummyHandler
102 register INT_Int02Handler(word) INT_DummyHandler
103 register INT_Int03Handler(word) INT_DummyHandler
104 register INT_Int04Handler(word) INT_DummyHandler
105 register INT_Int05Handler(word) INT_DummyHandler
106 register INT_Int06Handler(word) INT_DummyHandler
107 register INT_Int07Handler(word) INT_DummyHandler
108 register INT_Int08Handler(word) INT_DummyHandler
109 register INT_Int09Handler(word) INT_DummyHandler
110 register INT_Int0aHandler(word) INT_DummyHandler
111 register INT_Int0bHandler(word) INT_DummyHandler
112 register INT_Int0cHandler(word) INT_DummyHandler
113 register INT_Int0dHandler(word) INT_DummyHandler
114 register INT_Int0eHandler(word) INT_DummyHandler
115 register INT_Int0fHandler(word) INT_DummyHandler
100 register INT_Int00Handler(word) BUILTIN_DefaultIntHandler
101 register INT_Int01Handler(word) BUILTIN_DefaultIntHandler
102 register INT_Int02Handler(word) BUILTIN_DefaultIntHandler
103 register INT_Int03Handler(word) BUILTIN_DefaultIntHandler
104 register INT_Int04Handler(word) BUILTIN_DefaultIntHandler
105 register INT_Int05Handler(word) BUILTIN_DefaultIntHandler
106 register INT_Int06Handler(word) BUILTIN_DefaultIntHandler
107 register INT_Int07Handler(word) BUILTIN_DefaultIntHandler
108 register INT_Int08Handler(word) BUILTIN_DefaultIntHandler
109 register INT_Int09Handler(word) BUILTIN_DefaultIntHandler
110 register INT_Int0aHandler(word) BUILTIN_DefaultIntHandler
111 register INT_Int0bHandler(word) BUILTIN_DefaultIntHandler
112 register INT_Int0cHandler(word) BUILTIN_DefaultIntHandler
113 register INT_Int0dHandler(word) BUILTIN_DefaultIntHandler
114 register INT_Int0eHandler(word) BUILTIN_DefaultIntHandler
115 register INT_Int0fHandler(word) BUILTIN_DefaultIntHandler
116 register INT_Int10Handler(word) INT_Int10Handler
117 register INT_Int11Handler(word) INT_Int11Handler
118 register INT_Int12Handler(word) INT_Int12Handler
119 register INT_Int13Handler(word) INT_Int13Handler
120 register INT_Int14Handler(word) INT_DummyHandler
121 register INT_Int15Handler(word) INT_Int15Handler
122 register INT_Int16Handler(word) INT_Int16Handler
123 register INT_Int17Handler(word) INT_DummyHandler
124 register INT_Int18Handler(word) INT_DummyHandler
125 register INT_Int19Handler(word) INT_DummyHandler
120 register INT_Int14Handler(word) BUILTIN_DefaultIntHandler
121 register INT_Int15Handler(word) BUILTIN_DefaultIntHandler
122 register INT_Int16Handler(word) BUILTIN_DefaultIntHandler
123 register INT_Int17Handler(word) BUILTIN_DefaultIntHandler
124 register INT_Int18Handler(word) BUILTIN_DefaultIntHandler
125 register INT_Int19Handler(word) BUILTIN_DefaultIntHandler
126 register INT_Int1aHandler(word) INT_Int1aHandler
127 register INT_Int1bHandler(word) INT_DummyHandler
128 register INT_Int1cHandler(word) INT_DummyHandler
129 register INT_Int1dHandler(word) INT_DummyHandler
130 register INT_Int1eHandler(word) INT_DummyHandler
131 register INT_Int1fHandler(word) INT_DummyHandler
132 register INT_Int20Handler(word) INT_DummyHandler
127 register INT_Int1bHandler(word) BUILTIN_DefaultIntHandler
128 register INT_Int1cHandler(word) BUILTIN_DefaultIntHandler
129 register INT_Int1dHandler(word) BUILTIN_DefaultIntHandler
130 register INT_Int1eHandler(word) BUILTIN_DefaultIntHandler
131 register INT_Int1fHandler(word) BUILTIN_DefaultIntHandler
132 register INT_Int20Handler(word) BUILTIN_DefaultIntHandler
133 register INT_Int21Handler(word) DOS3Call
134 register INT_Int22Handler(word) INT_DummyHandler
135 register INT_Int23Handler(word) INT_DummyHandler
136 register INT_Int24Handler(word) INT_DummyHandler
134 register INT_Int22Handler(word) BUILTIN_DefaultIntHandler
135 register INT_Int23Handler(word) BUILTIN_DefaultIntHandler
136 register INT_Int24Handler(word) BUILTIN_DefaultIntHandler
# Note: int 25 and 26 don't pop the flags from the stack
137 register INT_Int25Handler() INT_Int25Handler
138 register INT_Int26Handler() INT_Int26Handler
139 register INT_Int27Handler(word) INT_DummyHandler
140 register INT_Int28Handler(word) INT_DummyHandler
141 register INT_Int29Handler(word) INT_DummyHandler
139 register INT_Int27Handler(word) BUILTIN_DefaultIntHandler
140 register INT_Int28Handler(word) BUILTIN_DefaultIntHandler
141 register INT_Int29Handler(word) BUILTIN_DefaultIntHandler
142 register INT_Int2aHandler(word) INT_Int2aHandler
143 register INT_Int2bHandler(word) INT_DummyHandler
144 register INT_Int2cHandler(word) INT_DummyHandler
145 register INT_Int2dHandler(word) INT_DummyHandler
146 register INT_Int2eHandler(word) INT_DummyHandler
143 register INT_Int2bHandler(word) BUILTIN_DefaultIntHandler
144 register INT_Int2cHandler(word) BUILTIN_DefaultIntHandler
145 register INT_Int2dHandler(word) BUILTIN_DefaultIntHandler
146 register INT_Int2eHandler(word) BUILTIN_DefaultIntHandler
147 register INT_Int2fHandler(word) INT_Int2fHandler
148 register INT_Int30Handler(word) INT_DummyHandler
148 register INT_Int30Handler(word) BUILTIN_DefaultIntHandler
149 register INT_Int31Handler(word) INT_Int31Handler
150 register INT_Int32Handler(word) INT_DummyHandler
151 register INT_Int33Handler(word) INT_DummyHandler
152 register INT_Int34Handler(word) INT_DummyHandler
153 register INT_Int35Handler(word) INT_DummyHandler
154 register INT_Int36Handler(word) INT_DummyHandler
155 register INT_Int37Handler(word) INT_DummyHandler
156 register INT_Int38Handler(word) INT_DummyHandler
157 register INT_Int39Handler(word) INT_DummyHandler
158 register INT_Int3aHandler(word) INT_DummyHandler
159 register INT_Int3bHandler(word) INT_DummyHandler
160 register INT_Int3cHandler(word) INT_DummyHandler
161 register INT_Int3dHandler(word) INT_DummyHandler
162 register INT_Int3eHandler(word) INT_DummyHandler
163 register INT_Int3fHandler(word) INT_DummyHandler
164 register INT_Int40Handler(word) INT_DummyHandler
165 register INT_Int41Handler(word) INT_DummyHandler
166 register INT_Int42Handler(word) INT_DummyHandler
167 register INT_Int43Handler(word) INT_DummyHandler
168 register INT_Int44Handler(word) INT_DummyHandler
169 register INT_Int45Handler(word) INT_DummyHandler
170 register INT_Int46Handler(word) INT_DummyHandler
171 register INT_Int47Handler(word) INT_DummyHandler
172 register INT_Int48Handler(word) INT_DummyHandler
173 register INT_Int49Handler(word) INT_DummyHandler
174 register INT_Int4aHandler(word) INT_DummyHandler
150 register INT_Int32Handler(word) BUILTIN_DefaultIntHandler
151 register INT_Int33Handler(word) BUILTIN_DefaultIntHandler
152 register INT_Int34Handler(word) BUILTIN_DefaultIntHandler
153 register INT_Int35Handler(word) BUILTIN_DefaultIntHandler
154 register INT_Int36Handler(word) BUILTIN_DefaultIntHandler
155 register INT_Int37Handler(word) BUILTIN_DefaultIntHandler
156 register INT_Int38Handler(word) BUILTIN_DefaultIntHandler
157 register INT_Int39Handler(word) BUILTIN_DefaultIntHandler
158 register INT_Int3aHandler(word) BUILTIN_DefaultIntHandler
159 register INT_Int3bHandler(word) BUILTIN_DefaultIntHandler
160 register INT_Int3cHandler(word) BUILTIN_DefaultIntHandler
161 register INT_Int3dHandler(word) BUILTIN_DefaultIntHandler
162 register INT_Int3eHandler(word) BUILTIN_DefaultIntHandler
163 register INT_Int3fHandler(word) BUILTIN_DefaultIntHandler
164 register INT_Int40Handler(word) BUILTIN_DefaultIntHandler
165 register INT_Int41Handler(word) BUILTIN_DefaultIntHandler
166 register INT_Int42Handler(word) BUILTIN_DefaultIntHandler
167 register INT_Int43Handler(word) BUILTIN_DefaultIntHandler
168 register INT_Int44Handler(word) BUILTIN_DefaultIntHandler
169 register INT_Int45Handler(word) BUILTIN_DefaultIntHandler
170 register INT_Int46Handler(word) BUILTIN_DefaultIntHandler
171 register INT_Int47Handler(word) BUILTIN_DefaultIntHandler
172 register INT_Int48Handler(word) BUILTIN_DefaultIntHandler
173 register INT_Int49Handler(word) BUILTIN_DefaultIntHandler
174 register INT_Int4aHandler(word) BUILTIN_DefaultIntHandler
175 register INT_Int4bHandler(word) INT_Int4bHandler
176 register INT_Int4cHandler(word) INT_DummyHandler
177 register INT_Int4dHandler(word) INT_DummyHandler
178 register INT_Int4eHandler(word) INT_DummyHandler
179 register INT_Int4fHandler(word) INT_DummyHandler
180 register INT_Int50Handler(word) INT_DummyHandler
181 register INT_Int51Handler(word) INT_DummyHandler
182 register INT_Int52Handler(word) INT_DummyHandler
183 register INT_Int53Handler(word) INT_DummyHandler
184 register INT_Int54Handler(word) INT_DummyHandler
185 register INT_Int55Handler(word) INT_DummyHandler
186 register INT_Int56Handler(word) INT_DummyHandler
187 register INT_Int57Handler(word) INT_DummyHandler
188 register INT_Int58Handler(word) INT_DummyHandler
189 register INT_Int59Handler(word) INT_DummyHandler
190 register INT_Int5aHandler(word) INT_DummyHandler
191 register INT_Int5bHandler(word) INT_DummyHandler
176 register INT_Int4cHandler(word) BUILTIN_DefaultIntHandler
177 register INT_Int4dHandler(word) BUILTIN_DefaultIntHandler
178 register INT_Int4eHandler(word) BUILTIN_DefaultIntHandler
179 register INT_Int4fHandler(word) BUILTIN_DefaultIntHandler
180 register INT_Int50Handler(word) BUILTIN_DefaultIntHandler
181 register INT_Int51Handler(word) BUILTIN_DefaultIntHandler
182 register INT_Int52Handler(word) BUILTIN_DefaultIntHandler
183 register INT_Int53Handler(word) BUILTIN_DefaultIntHandler
184 register INT_Int54Handler(word) BUILTIN_DefaultIntHandler
185 register INT_Int55Handler(word) BUILTIN_DefaultIntHandler
186 register INT_Int56Handler(word) BUILTIN_DefaultIntHandler
187 register INT_Int57Handler(word) BUILTIN_DefaultIntHandler
188 register INT_Int58Handler(word) BUILTIN_DefaultIntHandler
189 register INT_Int59Handler(word) BUILTIN_DefaultIntHandler
190 register INT_Int5aHandler(word) BUILTIN_DefaultIntHandler
191 register INT_Int5bHandler(word) BUILTIN_DefaultIntHandler
192 register INT_Int5cHandler(word) NetBIOSCall
193 register INT_Int5dHandler(word) INT_DummyHandler
194 register INT_Int5eHandler(word) INT_DummyHandler
195 register INT_Int5fHandler(word) INT_DummyHandler
196 register INT_Int60Handler(word) INT_DummyHandler
197 register INT_Int61Handler(word) INT_DummyHandler
198 register INT_Int62Handler(word) INT_DummyHandler
199 register INT_Int63Handler(word) INT_DummyHandler
200 register INT_Int64Handler(word) INT_DummyHandler
201 register INT_Int65Handler(word) INT_DummyHandler
202 register INT_Int66Handler(word) INT_DummyHandler
203 register INT_Int67Handler(word) INT_DummyHandler
204 register INT_Int68Handler(word) INT_DummyHandler
205 register INT_Int69Handler(word) INT_DummyHandler
206 register INT_Int6aHandler(word) INT_DummyHandler
207 register INT_Int6bHandler(word) INT_DummyHandler
208 register INT_Int6cHandler(word) INT_DummyHandler
209 register INT_Int6dHandler(word) INT_DummyHandler
210 register INT_Int6eHandler(word) INT_DummyHandler
211 register INT_Int6fHandler(word) INT_DummyHandler
212 register INT_Int70Handler(word) INT_DummyHandler
213 register INT_Int71Handler(word) INT_DummyHandler
214 register INT_Int72Handler(word) INT_DummyHandler
215 register INT_Int73Handler(word) INT_DummyHandler
216 register INT_Int74Handler(word) INT_DummyHandler
217 register INT_Int75Handler(word) INT_DummyHandler
218 register INT_Int76Handler(word) INT_DummyHandler
219 register INT_Int77Handler(word) INT_DummyHandler
220 register INT_Int78Handler(word) INT_DummyHandler
221 register INT_Int79Handler(word) INT_DummyHandler
222 register INT_Int7aHandler(word) INT_DummyHandler
223 register INT_Int7bHandler(word) INT_DummyHandler
224 register INT_Int7cHandler(word) INT_DummyHandler
225 register INT_Int7dHandler(word) INT_DummyHandler
226 register INT_Int7eHandler(word) INT_DummyHandler
227 register INT_Int7fHandler(word) INT_DummyHandler
228 register INT_Int80Handler(word) INT_DummyHandler
229 register INT_Int81Handler(word) INT_DummyHandler
230 register INT_Int82Handler(word) INT_DummyHandler
231 register INT_Int83Handler(word) INT_DummyHandler
232 register INT_Int84Handler(word) INT_DummyHandler
233 register INT_Int85Handler(word) INT_DummyHandler
234 register INT_Int86Handler(word) INT_DummyHandler
235 register INT_Int87Handler(word) INT_DummyHandler
236 register INT_Int88Handler(word) INT_DummyHandler
237 register INT_Int89Handler(word) INT_DummyHandler
238 register INT_Int8aHandler(word) INT_DummyHandler
239 register INT_Int8bHandler(word) INT_DummyHandler
240 register INT_Int8cHandler(word) INT_DummyHandler
241 register INT_Int8dHandler(word) INT_DummyHandler
242 register INT_Int8eHandler(word) INT_DummyHandler
243 register INT_Int8fHandler(word) INT_DummyHandler
244 register INT_Int90Handler(word) INT_DummyHandler
245 register INT_Int91Handler(word) INT_DummyHandler
246 register INT_Int92Handler(word) INT_DummyHandler
247 register INT_Int93Handler(word) INT_DummyHandler
248 register INT_Int94Handler(word) INT_DummyHandler
249 register INT_Int95Handler(word) INT_DummyHandler
250 register INT_Int96Handler(word) INT_DummyHandler
251 register INT_Int97Handler(word) INT_DummyHandler
252 register INT_Int98Handler(word) INT_DummyHandler
253 register INT_Int99Handler(word) INT_DummyHandler
254 register INT_Int9aHandler(word) INT_DummyHandler
255 register INT_Int9bHandler(word) INT_DummyHandler
256 register INT_Int9cHandler(word) INT_DummyHandler
257 register INT_Int9dHandler(word) INT_DummyHandler
258 register INT_Int9eHandler(word) INT_DummyHandler
259 register INT_Int9fHandler(word) INT_DummyHandler
260 register INT_Inta0Handler(word) INT_DummyHandler
261 register INT_Inta1Handler(word) INT_DummyHandler
262 register INT_Inta2Handler(word) INT_DummyHandler
263 register INT_Inta3Handler(word) INT_DummyHandler
264 register INT_Inta4Handler(word) INT_DummyHandler
265 register INT_Inta5Handler(word) INT_DummyHandler
266 register INT_Inta6Handler(word) INT_DummyHandler
267 register INT_Inta7Handler(word) INT_DummyHandler
268 register INT_Inta8Handler(word) INT_DummyHandler
269 register INT_Inta9Handler(word) INT_DummyHandler
270 register INT_IntaaHandler(word) INT_DummyHandler
271 register INT_IntabHandler(word) INT_DummyHandler
272 register INT_IntacHandler(word) INT_DummyHandler
273 register INT_IntadHandler(word) INT_DummyHandler
274 register INT_IntaeHandler(word) INT_DummyHandler
275 register INT_IntafHandler(word) INT_DummyHandler
276 register INT_Intb0Handler(word) INT_DummyHandler
277 register INT_Intb1Handler(word) INT_DummyHandler
278 register INT_Intb2Handler(word) INT_DummyHandler
279 register INT_Intb3Handler(word) INT_DummyHandler
280 register INT_Intb4Handler(word) INT_DummyHandler
281 register INT_Intb5Handler(word) INT_DummyHandler
282 register INT_Intb6Handler(word) INT_DummyHandler
283 register INT_Intb7Handler(word) INT_DummyHandler
284 register INT_Intb8Handler(word) INT_DummyHandler
285 register INT_Intb9Handler(word) INT_DummyHandler
286 register INT_IntbaHandler(word) INT_DummyHandler
287 register INT_IntbbHandler(word) INT_DummyHandler
288 register INT_IntbcHandler(word) INT_DummyHandler
289 register INT_IntbdHandler(word) INT_DummyHandler
290 register INT_IntbeHandler(word) INT_DummyHandler
291 register INT_IntbfHandler(word) INT_DummyHandler
292 register INT_Intc0Handler(word) INT_DummyHandler
293 register INT_Intc1Handler(word) INT_DummyHandler
294 register INT_Intc2Handler(word) INT_DummyHandler
295 register INT_Intc3Handler(word) INT_DummyHandler
296 register INT_Intc4Handler(word) INT_DummyHandler
297 register INT_Intc5Handler(word) INT_DummyHandler
298 register INT_Intc6Handler(word) INT_DummyHandler
299 register INT_Intc7Handler(word) INT_DummyHandler
300 register INT_Intc8Handler(word) INT_DummyHandler
301 register INT_Intc9Handler(word) INT_DummyHandler
302 register INT_IntcaHandler(word) INT_DummyHandler
303 register INT_IntcbHandler(word) INT_DummyHandler
304 register INT_IntccHandler(word) INT_DummyHandler
305 register INT_IntcdHandler(word) INT_DummyHandler
306 register INT_IntceHandler(word) INT_DummyHandler
307 register INT_IntcfHandler(word) INT_DummyHandler
308 register INT_Intd0Handler(word) INT_DummyHandler
309 register INT_Intd1Handler(word) INT_DummyHandler
310 register INT_Intd2Handler(word) INT_DummyHandler
311 register INT_Intd3Handler(word) INT_DummyHandler
312 register INT_Intd4Handler(word) INT_DummyHandler
313 register INT_Intd5Handler(word) INT_DummyHandler
314 register INT_Intd6Handler(word) INT_DummyHandler
315 register INT_Intd7Handler(word) INT_DummyHandler
316 register INT_Intd8Handler(word) INT_DummyHandler
317 register INT_Intd9Handler(word) INT_DummyHandler
318 register INT_IntdaHandler(word) INT_DummyHandler
319 register INT_IntdbHandler(word) INT_DummyHandler
320 register INT_IntdcHandler(word) INT_DummyHandler
321 register INT_IntddHandler(word) INT_DummyHandler
322 register INT_IntdeHandler(word) INT_DummyHandler
323 register INT_IntdfHandler(word) INT_DummyHandler
324 register INT_Inte0Handler(word) INT_DummyHandler
325 register INT_Inte1Handler(word) INT_DummyHandler
326 register INT_Inte2Handler(word) INT_DummyHandler
327 register INT_Inte3Handler(word) INT_DummyHandler
328 register INT_Inte4Handler(word) INT_DummyHandler
329 register INT_Inte5Handler(word) INT_DummyHandler
330 register INT_Inte6Handler(word) INT_DummyHandler
331 register INT_Inte7Handler(word) INT_DummyHandler
332 register INT_Inte8Handler(word) INT_DummyHandler
333 register INT_Inte9Handler(word) INT_DummyHandler
334 register INT_InteaHandler(word) INT_DummyHandler
335 register INT_IntebHandler(word) INT_DummyHandler
336 register INT_IntecHandler(word) INT_DummyHandler
337 register INT_IntedHandler(word) INT_DummyHandler
338 register INT_InteeHandler(word) INT_DummyHandler
339 register INT_IntefHandler(word) INT_DummyHandler
340 register INT_Intf0Handler(word) INT_DummyHandler
341 register INT_Intf1Handler(word) INT_DummyHandler
342 register INT_Intf2Handler(word) INT_DummyHandler
343 register INT_Intf3Handler(word) INT_DummyHandler
344 register INT_Intf4Handler(word) INT_DummyHandler
345 register INT_Intf5Handler(word) INT_DummyHandler
346 register INT_Intf6Handler(word) INT_DummyHandler
347 register INT_Intf7Handler(word) INT_DummyHandler
348 register INT_Intf8Handler(word) INT_DummyHandler
349 register INT_Intf9Handler(word) INT_DummyHandler
350 register INT_IntfaHandler(word) INT_DummyHandler
351 register INT_IntfbHandler(word) INT_DummyHandler
352 register INT_IntfcHandler(word) INT_DummyHandler
353 register INT_IntfdHandler(word) INT_DummyHandler
354 register INT_IntfeHandler(word) INT_DummyHandler
355 register INT_IntffHandler(word) INT_DummyHandler
193 register INT_Int5dHandler(word) BUILTIN_DefaultIntHandler
194 register INT_Int5eHandler(word) BUILTIN_DefaultIntHandler
195 register INT_Int5fHandler(word) BUILTIN_DefaultIntHandler
196 register INT_Int60Handler(word) BUILTIN_DefaultIntHandler
197 register INT_Int61Handler(word) BUILTIN_DefaultIntHandler
198 register INT_Int62Handler(word) BUILTIN_DefaultIntHandler
199 register INT_Int63Handler(word) BUILTIN_DefaultIntHandler
200 register INT_Int64Handler(word) BUILTIN_DefaultIntHandler
201 register INT_Int65Handler(word) BUILTIN_DefaultIntHandler
202 register INT_Int66Handler(word) BUILTIN_DefaultIntHandler
203 register INT_Int67Handler(word) BUILTIN_DefaultIntHandler
204 register INT_Int68Handler(word) BUILTIN_DefaultIntHandler
205 register INT_Int69Handler(word) BUILTIN_DefaultIntHandler
206 register INT_Int6aHandler(word) BUILTIN_DefaultIntHandler
207 register INT_Int6bHandler(word) BUILTIN_DefaultIntHandler
208 register INT_Int6cHandler(word) BUILTIN_DefaultIntHandler
209 register INT_Int6dHandler(word) BUILTIN_DefaultIntHandler
210 register INT_Int6eHandler(word) BUILTIN_DefaultIntHandler
211 register INT_Int6fHandler(word) BUILTIN_DefaultIntHandler
212 register INT_Int70Handler(word) BUILTIN_DefaultIntHandler
213 register INT_Int71Handler(word) BUILTIN_DefaultIntHandler
214 register INT_Int72Handler(word) BUILTIN_DefaultIntHandler
215 register INT_Int73Handler(word) BUILTIN_DefaultIntHandler
216 register INT_Int74Handler(word) BUILTIN_DefaultIntHandler
217 register INT_Int75Handler(word) BUILTIN_DefaultIntHandler
218 register INT_Int76Handler(word) BUILTIN_DefaultIntHandler
219 register INT_Int77Handler(word) BUILTIN_DefaultIntHandler
220 register INT_Int78Handler(word) BUILTIN_DefaultIntHandler
221 register INT_Int79Handler(word) BUILTIN_DefaultIntHandler
222 register INT_Int7aHandler(word) BUILTIN_DefaultIntHandler
223 register INT_Int7bHandler(word) BUILTIN_DefaultIntHandler
224 register INT_Int7cHandler(word) BUILTIN_DefaultIntHandler
225 register INT_Int7dHandler(word) BUILTIN_DefaultIntHandler
226 register INT_Int7eHandler(word) BUILTIN_DefaultIntHandler
227 register INT_Int7fHandler(word) BUILTIN_DefaultIntHandler
228 register INT_Int80Handler(word) BUILTIN_DefaultIntHandler
229 register INT_Int81Handler(word) BUILTIN_DefaultIntHandler
230 register INT_Int82Handler(word) BUILTIN_DefaultIntHandler
231 register INT_Int83Handler(word) BUILTIN_DefaultIntHandler
232 register INT_Int84Handler(word) BUILTIN_DefaultIntHandler
233 register INT_Int85Handler(word) BUILTIN_DefaultIntHandler
234 register INT_Int86Handler(word) BUILTIN_DefaultIntHandler
235 register INT_Int87Handler(word) BUILTIN_DefaultIntHandler
236 register INT_Int88Handler(word) BUILTIN_DefaultIntHandler
237 register INT_Int89Handler(word) BUILTIN_DefaultIntHandler
238 register INT_Int8aHandler(word) BUILTIN_DefaultIntHandler
239 register INT_Int8bHandler(word) BUILTIN_DefaultIntHandler
240 register INT_Int8cHandler(word) BUILTIN_DefaultIntHandler
241 register INT_Int8dHandler(word) BUILTIN_DefaultIntHandler
242 register INT_Int8eHandler(word) BUILTIN_DefaultIntHandler
243 register INT_Int8fHandler(word) BUILTIN_DefaultIntHandler
244 register INT_Int90Handler(word) BUILTIN_DefaultIntHandler
245 register INT_Int91Handler(word) BUILTIN_DefaultIntHandler
246 register INT_Int92Handler(word) BUILTIN_DefaultIntHandler
247 register INT_Int93Handler(word) BUILTIN_DefaultIntHandler
248 register INT_Int94Handler(word) BUILTIN_DefaultIntHandler
249 register INT_Int95Handler(word) BUILTIN_DefaultIntHandler
250 register INT_Int96Handler(word) BUILTIN_DefaultIntHandler
251 register INT_Int97Handler(word) BUILTIN_DefaultIntHandler
252 register INT_Int98Handler(word) BUILTIN_DefaultIntHandler
253 register INT_Int99Handler(word) BUILTIN_DefaultIntHandler
254 register INT_Int9aHandler(word) BUILTIN_DefaultIntHandler
255 register INT_Int9bHandler(word) BUILTIN_DefaultIntHandler
256 register INT_Int9cHandler(word) BUILTIN_DefaultIntHandler
257 register INT_Int9dHandler(word) BUILTIN_DefaultIntHandler
258 register INT_Int9eHandler(word) BUILTIN_DefaultIntHandler
259 register INT_Int9fHandler(word) BUILTIN_DefaultIntHandler
260 register INT_Inta0Handler(word) BUILTIN_DefaultIntHandler
261 register INT_Inta1Handler(word) BUILTIN_DefaultIntHandler
262 register INT_Inta2Handler(word) BUILTIN_DefaultIntHandler
263 register INT_Inta3Handler(word) BUILTIN_DefaultIntHandler
264 register INT_Inta4Handler(word) BUILTIN_DefaultIntHandler
265 register INT_Inta5Handler(word) BUILTIN_DefaultIntHandler
266 register INT_Inta6Handler(word) BUILTIN_DefaultIntHandler
267 register INT_Inta7Handler(word) BUILTIN_DefaultIntHandler
268 register INT_Inta8Handler(word) BUILTIN_DefaultIntHandler
269 register INT_Inta9Handler(word) BUILTIN_DefaultIntHandler
270 register INT_IntaaHandler(word) BUILTIN_DefaultIntHandler
271 register INT_IntabHandler(word) BUILTIN_DefaultIntHandler
272 register INT_IntacHandler(word) BUILTIN_DefaultIntHandler
273 register INT_IntadHandler(word) BUILTIN_DefaultIntHandler
274 register INT_IntaeHandler(word) BUILTIN_DefaultIntHandler
275 register INT_IntafHandler(word) BUILTIN_DefaultIntHandler
276 register INT_Intb0Handler(word) BUILTIN_DefaultIntHandler
277 register INT_Intb1Handler(word) BUILTIN_DefaultIntHandler
278 register INT_Intb2Handler(word) BUILTIN_DefaultIntHandler
279 register INT_Intb3Handler(word) BUILTIN_DefaultIntHandler
280 register INT_Intb4Handler(word) BUILTIN_DefaultIntHandler
281 register INT_Intb5Handler(word) BUILTIN_DefaultIntHandler
282 register INT_Intb6Handler(word) BUILTIN_DefaultIntHandler
283 register INT_Intb7Handler(word) BUILTIN_DefaultIntHandler
284 register INT_Intb8Handler(word) BUILTIN_DefaultIntHandler
285 register INT_Intb9Handler(word) BUILTIN_DefaultIntHandler
286 register INT_IntbaHandler(word) BUILTIN_DefaultIntHandler
287 register INT_IntbbHandler(word) BUILTIN_DefaultIntHandler
288 register INT_IntbcHandler(word) BUILTIN_DefaultIntHandler
289 register INT_IntbdHandler(word) BUILTIN_DefaultIntHandler
290 register INT_IntbeHandler(word) BUILTIN_DefaultIntHandler
291 register INT_IntbfHandler(word) BUILTIN_DefaultIntHandler
292 register INT_Intc0Handler(word) BUILTIN_DefaultIntHandler
293 register INT_Intc1Handler(word) BUILTIN_DefaultIntHandler
294 register INT_Intc2Handler(word) BUILTIN_DefaultIntHandler
295 register INT_Intc3Handler(word) BUILTIN_DefaultIntHandler
296 register INT_Intc4Handler(word) BUILTIN_DefaultIntHandler
297 register INT_Intc5Handler(word) BUILTIN_DefaultIntHandler
298 register INT_Intc6Handler(word) BUILTIN_DefaultIntHandler
299 register INT_Intc7Handler(word) BUILTIN_DefaultIntHandler
300 register INT_Intc8Handler(word) BUILTIN_DefaultIntHandler
301 register INT_Intc9Handler(word) BUILTIN_DefaultIntHandler
302 register INT_IntcaHandler(word) BUILTIN_DefaultIntHandler
303 register INT_IntcbHandler(word) BUILTIN_DefaultIntHandler
304 register INT_IntccHandler(word) BUILTIN_DefaultIntHandler
305 register INT_IntcdHandler(word) BUILTIN_DefaultIntHandler
306 register INT_IntceHandler(word) BUILTIN_DefaultIntHandler
307 register INT_IntcfHandler(word) BUILTIN_DefaultIntHandler
308 register INT_Intd0Handler(word) BUILTIN_DefaultIntHandler
309 register INT_Intd1Handler(word) BUILTIN_DefaultIntHandler
310 register INT_Intd2Handler(word) BUILTIN_DefaultIntHandler
311 register INT_Intd3Handler(word) BUILTIN_DefaultIntHandler
312 register INT_Intd4Handler(word) BUILTIN_DefaultIntHandler
313 register INT_Intd5Handler(word) BUILTIN_DefaultIntHandler
314 register INT_Intd6Handler(word) BUILTIN_DefaultIntHandler
315 register INT_Intd7Handler(word) BUILTIN_DefaultIntHandler
316 register INT_Intd8Handler(word) BUILTIN_DefaultIntHandler
317 register INT_Intd9Handler(word) BUILTIN_DefaultIntHandler
318 register INT_IntdaHandler(word) BUILTIN_DefaultIntHandler
319 register INT_IntdbHandler(word) BUILTIN_DefaultIntHandler
320 register INT_IntdcHandler(word) BUILTIN_DefaultIntHandler
321 register INT_IntddHandler(word) BUILTIN_DefaultIntHandler
322 register INT_IntdeHandler(word) BUILTIN_DefaultIntHandler
323 register INT_IntdfHandler(word) BUILTIN_DefaultIntHandler
324 register INT_Inte0Handler(word) BUILTIN_DefaultIntHandler
325 register INT_Inte1Handler(word) BUILTIN_DefaultIntHandler
326 register INT_Inte2Handler(word) BUILTIN_DefaultIntHandler
327 register INT_Inte3Handler(word) BUILTIN_DefaultIntHandler
328 register INT_Inte4Handler(word) BUILTIN_DefaultIntHandler
329 register INT_Inte5Handler(word) BUILTIN_DefaultIntHandler
330 register INT_Inte6Handler(word) BUILTIN_DefaultIntHandler
331 register INT_Inte7Handler(word) BUILTIN_DefaultIntHandler
332 register INT_Inte8Handler(word) BUILTIN_DefaultIntHandler
333 register INT_Inte9Handler(word) BUILTIN_DefaultIntHandler
334 register INT_InteaHandler(word) BUILTIN_DefaultIntHandler
335 register INT_IntebHandler(word) BUILTIN_DefaultIntHandler
336 register INT_IntecHandler(word) BUILTIN_DefaultIntHandler
337 register INT_IntedHandler(word) BUILTIN_DefaultIntHandler
338 register INT_InteeHandler(word) BUILTIN_DefaultIntHandler
339 register INT_IntefHandler(word) BUILTIN_DefaultIntHandler
340 register INT_Intf0Handler(word) BUILTIN_DefaultIntHandler
341 register INT_Intf1Handler(word) BUILTIN_DefaultIntHandler
342 register INT_Intf2Handler(word) BUILTIN_DefaultIntHandler
343 register INT_Intf3Handler(word) BUILTIN_DefaultIntHandler
344 register INT_Intf4Handler(word) BUILTIN_DefaultIntHandler
345 register INT_Intf5Handler(word) BUILTIN_DefaultIntHandler
346 register INT_Intf6Handler(word) BUILTIN_DefaultIntHandler
347 register INT_Intf7Handler(word) BUILTIN_DefaultIntHandler
348 register INT_Intf8Handler(word) BUILTIN_DefaultIntHandler
349 register INT_Intf9Handler(word) BUILTIN_DefaultIntHandler
350 register INT_IntfaHandler(word) BUILTIN_DefaultIntHandler
351 register INT_IntfbHandler(word) BUILTIN_DefaultIntHandler
352 register INT_IntfcHandler(word) BUILTIN_DefaultIntHandler
353 register INT_IntfdHandler(word) BUILTIN_DefaultIntHandler
354 register INT_IntfeHandler(word) BUILTIN_DefaultIntHandler
355 register INT_IntffHandler(word) BUILTIN_DefaultIntHandler
# VxDs. The first Vxd is at 400
#

View File

@ -9,6 +9,7 @@
#include <X11/extensions/XShm.h>
#include "gdi.h"
#include "xmalloc.h"
#ifdef PRELIMINARY_WING16_SUPPORT

View File

@ -277,12 +277,12 @@ typedef DEVNAMES * LPDEVNAMES;
BOOL ChooseColor(LPCHOOSECOLOR lpChCol);
DWORD CommDlgExtendedError(void);
BOOL FindText( SEGPTR find);
HWND16 FindText( SEGPTR find);
short GetFileTitle(LPCSTR lpFile, LPSTR lpTitle, UINT cbBuf);
BOOL GetOpenFileName(SEGPTR ofn);
BOOL GetSaveFileName(SEGPTR ofn);
BOOL PrintDlg( SEGPTR print);
BOOL ReplaceText( SEGPTR find);
HWND16 ReplaceText( SEGPTR find);
BOOL ChooseFont(LPCHOOSEFONT lpChFont);
LRESULT FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM16 wParam, LPARAM lParam);

View File

@ -3,16 +3,6 @@
#define stddeb 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 */
#ifdef DEBUG_NONE_EXT

View File

@ -7,9 +7,9 @@
#ifndef __WINE_DEBUGGER_H
#define __WINE_DEBUGGER_H
#include "ldt.h"
#include "registers.h"
#include "winnt.h"
#include "selectors.h"
#include "sigcontext.h"
#include "pe_image.h"
#define STEP_FLAG 0x100 /* single step flag */
@ -101,7 +101,7 @@ enum exec_mode
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;
/* debugger/break.c */
@ -111,10 +111,9 @@ extern void DEBUG_AddBreakpoint( const DBG_ADDR *addr );
extern void DEBUG_DelBreakpoint( int num );
extern void DEBUG_EnableBreakpoint( int num, BOOL32 enable );
extern void DEBUG_InfoBreakpoints(void);
extern BOOL32 DEBUG_HandleTrap( SIGCONTEXT *context );
extern BOOL32 DEBUG_ShouldContinue( SIGCONTEXT *context, enum exec_mode mode );
extern void DEBUG_RestartExecution( SIGCONTEXT *context, enum exec_mode mode,
int instr_len );
extern BOOL32 DEBUG_HandleTrap(void);
extern BOOL32 DEBUG_ShouldContinue( enum exec_mode mode );
extern void DEBUG_RestartExecution( enum exec_mode mode, int instr_len );
/* debugger/db_disasm.c */
extern void DEBUG_Disasm( DBG_ADDR *addr );
@ -163,6 +162,8 @@ extern void DEBUG_SetRegister( enum debug_regs reg, int val );
extern int DEBUG_GetRegister( enum debug_regs reg );
extern void DEBUG_InfoRegisters(void);
extern BOOL32 DEBUG_ValidateRegisters(void);
extern void DEBUG_SetSigContext( const SIGCONTEXT *sigcontext );
extern void DEBUG_GetSigContext( SIGCONTEXT *sigcontext );
/* debugger/stack.c */
extern void DEBUG_InfoStack(void);

View File

@ -38,5 +38,10 @@ typedef struct
#pragma pack(4)
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 */

View File

@ -1,17 +0,0 @@
/*
* 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 */

View File

@ -8,21 +8,10 @@
#define __WINE_DOS_FS_H
#include <time.h>
#include "wintypes.h"
#include "windows.h"
#define MAX_FILENAME_LEN 256
#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) == '\\'))
extern void DOSFS_ToDosDateTime( time_t unixtime, WORD *pDate, WORD *pTime );
@ -30,17 +19,16 @@ extern time_t DOSFS_DosDateTimeToUnixTime(WORD,WORD);
extern const char *DOSFS_ToDosFCBFormat( const char *name );
extern const char *DOSFS_ToDosDTAFormat( 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_GetDosTrueName( const char *name, int unix_format );
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 int DOSFS_FindNext( const char *path, const char *short_mask,
const char *long_mask, int drive, BYTE attr,
int skip, DOS_DIRENT *entry );
extern int DOS_GetFreeSpace(int drive, long *size, long *available);
extern char *WineIniFileName(void);
int skip, WIN32_FIND_DATA32A *entry );
#endif /* __WINE_DOS_FS_H */

View File

@ -6,8 +6,7 @@
#ifndef __WINE_EXCEPT_H
#define __WINE_EXCEPT_H
#include "wintypes.h"
#include "registers.h"
#include "winnt.h"
/*
* exception codes
*/

View File

@ -8,21 +8,28 @@
#define __WINE_FILE_H
#include "windows.h"
#include "handle32.h"
/* files/file.c */
extern void FILE_Destroy( K32OBJ *ptr );
extern void FILE_SetDosError(void);
extern void FILE_CloseAllFiles( HANDLE16 hPDB );
extern HFILE FILE_DupUnixHandle( int fd );
extern int FILE_Stat( LPCSTR unixName, BYTE *pattr, DWORD *psize,
WORD *pdate, WORD *ptime );
extern int FILE_GetDateTime( HFILE hFile, WORD *pdate, WORD *ptime,
BOOL32 refresh );
extern int FILE_SetDateTime( HFILE hFile, WORD date, WORD time );
extern int FILE_Fstat( HFILE hFile, BYTE *pattr, DWORD *psize,
WORD *pdate, WORD *ptime );
extern HFILE FILE_Dup( HFILE hFile );
extern HFILE FILE_Dup2( HFILE hFile1, HFILE hFile2 );
extern HFILE FILE_Open( LPCSTR path, INT32 mode );
extern BOOL32 FILE_SetFileType( HFILE hFile, DWORD type );
extern HFILE _lcreat_uniq( LPCSTR path, INT32 attr );
extern HFILE32 FILE_DupUnixHandle( int fd );
extern BOOL32 FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info );
extern HFILE32 FILE_Dup( HFILE32 hFile );
extern HFILE32 FILE_Dup2( HFILE32 hFile1, HFILE32 hFile2 );
extern HFILE32 FILE_Open( LPCSTR path, INT32 mode );
extern BOOL32 FILE_SetFileType( HFILE32 hFile, DWORD type );
extern HFILE32 _lcreat_uniq( LPCSTR path, INT32 attr );
/* files/directory.c */
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 );
extern DWORD DIR_SearchPath( LPCSTR path, LPCSTR name, LPCSTR ext,
DWORD buflen, LPSTR buffer, LPSTR *lastpart,
BOOL32 win32 );
#endif /* __WINE_FILE_H */

View File

@ -1,9 +1,49 @@
/*
* KERNEL32 objects
*
* Copyright 1996 Alexandre Julliard
*/
#ifndef __WINE_HANDLE32_H
#define __WINE_HANDLE32_H
#include <stdlib.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
* particular type of handle. This information is a combination of
* equivalent UNIX-style handles/descriptors and general information
@ -17,63 +57,6 @@ typedef struct {
unsigned long magic;
} 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
* validate the kernel object by comparison against the
@ -101,8 +84,4 @@ int ValidateKernelObject(KERNEL_OBJECT *ptr);
#define CreateKernelObject(size) (malloc(size))
#define ReleaseKernelObject(ptr) (free(ptr))
/* Prototypes for the Close*Handle functions
*/
int CloseFileHandle(HFILE hFile);
#endif /* __WINE_HANDLE32_H */

View File

@ -15,6 +15,7 @@ extern HANDLE32 SegptrHeap;
extern int HEAP_IsInsideHeap( 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 LPWSTR HEAP_strdupW( HANDLE32 heap, DWORD flags, LPCWSTR str );
extern LPWSTR HEAP_strdupAtoW( HANDLE32 heap, DWORD flags, LPCSTR str );

View File

@ -10,8 +10,8 @@ extern HMENU16 MENU_GetDefSysMenu(void);
extern void MENU_InitSysMenuPopup(HMENU16 hmenu, DWORD style, DWORD clsStyle);
extern UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth,
int orgX, int orgY );
extern void MENU_TrackMouseMenuBar( HWND hwnd, POINT16 pt );
extern void MENU_TrackKbdMenuBar( WND*, UINT wParam, INT vkey);
extern void MENU_TrackMouseMenuBar( WND* , INT16 ht, POINT16 pt );
extern void MENU_TrackKbdMenuBar( WND*, UINT16 wParam, INT16 vkey);
extern UINT MENU_DrawMenuBar( HDC32 hDC, LPRECT16 lprect,
HWND hwnd, BOOL suppress_draw );
extern LRESULT PopupMenuWndProc( HWND hwnd, UINT message,

View File

@ -33,5 +33,7 @@ extern void EVENT_ProcessEvent( XEvent *event );
extern void EVENT_RegisterWindow( WND *pWnd );
extern void EVENT_DestroyWindow( WND *pWnd );
extern void EVENT_DummyMotionNotify(void);
extern HWND32 EVENT_Capture( HWND32, INT16 );
extern INT16 EVENT_GetCaptureInfo(void);
#endif /* __WINE_MESSAGE_H */

View File

@ -8,38 +8,35 @@
#define __WINE_MISCEMU_H
#include <stdio.h>
#include "wintypes.h"
#include "registers.h"
#include "winnt.h"
/* miscemu/dosmem.c */
extern BOOL32 DOSMEM_Init(void);
extern void DOSMEM_Tick(void);
extern void DOSMEM_FillBiosSegment(void);
extern HANDLE16 DOSMEM_BiosSeg;
extern void DOSMEM_InitMemoryHandling();
extern LPVOID DOSMEM_RealMode2Linear(DWORD);
extern WORD DOSMEM_AllocSelector(WORD);
extern HANDLE16 DOSMEM_BiosSeg;
extern char *DOSMEM_dosmem;
extern DWORD DOSMEM_CollateTable;
extern void DOSMEM_InitCollateTable();
/* miscemu/instr.c */
extern BOOL32 INSTR_EmulateInstruction( SIGCONTEXT *context );
/* miscemu/interrupts.c */
/* miscemu/interrupts.c */
extern BOOL32 INT_Init(void);
/* msdos/interrupts.c */
extern FARPROC16 INT_GetHandler( BYTE intnum );
extern void INT_SetHandler( BYTE intnum, FARPROC16 handler );
/* miscemu/int1a.c */
/* msdos/ioports.c */
extern DWORD IO_inport( int port, int count );
extern void IO_outport( int port, int count, DWORD value );
/* msdos/int1a.c */
extern DWORD INT1A_GetTicksSinceMidnight(void);
/* miscemu/int21.c */
extern BOOL32 INT21_Init(void);
/* miscemu/ioports.c */
extern DWORD inport( int port, int count );
extern void outport( int port, int count, DWORD value );
/* misc/cpu.c */
extern int runtime_cpu(void);
#define INT_BARF(context,num) \
fprintf( stderr, "int%x: unknown/not implemented parameters:\n" \
@ -47,6 +44,6 @@ extern void outport( int port, int count, DWORD value );
"SI %04x, DI %04x, DS %04x, ES %04x\n", \
(num), (num), AX_reg(context), BX_reg(context), CX_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 */

View File

@ -84,7 +84,8 @@ extern WORD DOS_ExtendedError;
extern BYTE DOS_ErrorClass, DOS_ErrorAction, DOS_ErrorLocus;
#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) )
/* Error codes */

105
include/process.h Normal file
View File

@ -0,0 +1,105 @@
/*
* 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 */

View File

@ -1,235 +0,0 @@
/*
* 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 */

View File

@ -54,5 +54,6 @@ extern HGLOBAL16 NE_LoadResource( HMODULE16 hModule, HRSRC16 hRsrc );
extern HGLOBAL16 SYSRES_LoadResource( SYSTEM_RESOURCE id );
extern void SYSRES_FreeResource( HGLOBAL16 handle );
extern LPCVOID SYSRES_GetResPtr( SYSTEM_RESOURCE id );
#endif /* __WINE_RESOURCE_H */

View File

@ -18,4 +18,33 @@ extern WORD SELECTOR_ReallocBlock( WORD sel, const void *base, DWORD size,
BOOL32 readonly );
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 */

View File

@ -13,8 +13,6 @@
#define MAX_PATH 260
#endif
extern INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
HICON16 hIcon);
extern void SHELL_LoadRegistry();
extern void SHELL_SaveRegistry();
extern void SHELL_Init();
@ -81,6 +79,6 @@ DWORD SHGetFileInfo32W(LPCWSTR,DWORD,SHFILEINFO32W*,UINT32,UINT32);
#define SE_ERR_DDEBUSY 30
#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 */

146
include/sigcontext.h Normal file
View File

@ -0,0 +1,146 @@
/*
* 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 */

View File

@ -51,7 +51,6 @@ extern WORD IF1632_Saved16_sp;
/* Saved 32-bit stack for current process (Win16 only) */
extern DWORD IF1632_Saved32_esp;
extern SEGPTR IF1632_Stack32_base;
/* Original Unix stack */
extern DWORD IF1632_Original32_esp;

View File

@ -10,7 +10,6 @@
#include "wintypes.h"
LPSTR STRING32_DupUniToAnsi(LPCWSTR src);
LPWSTR STRING32_DupAnsiToUni(LPCSTR src);
LPWSTR STRING32_strdupW(LPCWSTR);

View File

@ -47,6 +47,7 @@ typedef struct
#define THUNK_MAGIC ('P' | ('T' << 8))
struct _THDB;
/* Task database. See 'Windows Internals' p. 226 */
typedef struct
@ -55,9 +56,8 @@ typedef struct
WORD sp; /* 02 Stack pointer of task */
WORD ss; /* 04 Stack segment of task */
WORD nEvents; /* 06 Events for this task */
char priority; /* 08 Task priority, -32..15 */
BYTE unused1; /* 09 */
HGLOBAL16 hStack32; /* 0a Handle to 32-bit stack */
INT16 priority; /* 08 Task priority, -32..15 */
WORD unused1; /* 0a */
HTASK16 hSelf; /* 0c Selector of this TDB */
HANDLE16 hPrevInstance; /* 0e Previous instance of module */
DWORD esp; /* 10 32-bit stack pointer */
@ -81,7 +81,9 @@ typedef struct
DWORD int3e WINE_PACKED; /* 46 int 3e (80x87 emu) handler */
DWORD int75 WINE_PACKED; /* 4a int 75 (80x87 error) handler */
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) */
SEGPTR dta WINE_PACKED; /* 62 Current DTA */
BYTE curdrive; /* 66 Current drive */
@ -113,5 +115,6 @@ extern HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance,
HANDLE16 hEnvironment, LPCSTR cmdLine,
UINT16 cmdShow );
extern void TASK_KillCurrentTask( INT16 exitCode );
extern HTASK16 TASK_GetNextTask( HTASK16 hTask );
#endif /* _WINE_TASK_H */

81
include/thread.h Normal file
View File

@ -0,0 +1,81 @@
/*
* 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 */

View File

@ -3,8 +3,6 @@
#include "windows.h"
#define INVALID_HANDLE_VALUE ((HANDLE32) -1)
#define WAIT_FAILED 0xffffffff
#define WAIT_OBJECT_0 0
#define WAIT_ABANDONED STATUS_ABANDONED_WAIT_0
@ -148,7 +146,6 @@ HACCEL32 LoadAcceleratorsA( HINSTANCE32, const char *);
void DeleteCriticalSection(CRITICAL_SECTION *lpCrit);
void EnterCriticalSection(CRITICAL_SECTION *lpCrit);
int GetCurrentProcessId(void);
void InitializeCriticalSection(CRITICAL_SECTION *lpCrit);
void LeaveCriticalSection(CRITICAL_SECTION *lpCrit);
HANDLE32 OpenProcess(DWORD access, BOOL32 inherit, DWORD id);

View File

@ -6,7 +6,6 @@ extern "C" {
#endif
#include "wintypes.h"
#include "winuser.h"
#pragma pack(1)
@ -432,6 +431,139 @@ DECL_WINELIB_TYPE(LPNCCALCSIZE_PARAMS);
#define SC_SCREENSAVE 0xf140
#define SC_HOTKEY 0xf150
/****** Window classes ******/
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;
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;
DECL_WINELIB_TYPE_AW(WNDCLASS);
DECL_WINELIB_TYPE_AW(LPWNDCLASS);
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;
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;
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
/***** Window hooks *****/
/* Hook values */
@ -1653,7 +1785,9 @@ typedef struct
#define DRIVE_CDROM 5
#define DRIVE_RAMDISK 6
#define HFILE_ERROR -1
#define HFILE_ERROR16 ((HFILE16)-1)
#define HFILE_ERROR32 ((HFILE32)-1)
#define HFILE_ERROR WINELIB_NAME(HFILE_ERROR)
#define DDL_READWRITE 0x0000
#define DDL_READONLY 0x0001
@ -1717,6 +1851,10 @@ typedef struct
DECL_WINELIB_TYPE_AW(WIN32_FIND_DATA);
DECL_WINELIB_TYPE_AW(LPWIN32_FIND_DATA);
#define INVALID_HANDLE_VALUE16 ((HANDLE16) -1)
#define INVALID_HANDLE_VALUE32 ((HANDLE32) -1)
#define INVALID_HANDLE_VALUE WINELIB_NAME(INVALID_HANDLE_VALUE)
/* comm */
#define CBR_110 0xFF10
@ -2482,11 +2620,25 @@ typedef struct
#define HWND_NOTOPMOST ((HWND)-2)
/* Flags for TrackPopupMenu */
#define TPM_LEFTBUTTON 0x0000
#define TPM_RIGHTBUTTON 0x0002
#define TPM_LEFTALIGN 0x0000
#define TPM_CENTERALIGN 0x0004
#define TPM_RIGHTALIGN 0x0008
#define TPM_LEFTBUTTON 0x0000
#define TPM_RIGHTBUTTON 0x0002
#define TPM_LEFTALIGN 0x0000
#define TPM_CENTERALIGN 0x0004
#define TPM_RIGHTALIGN 0x0008
#define TPM_TOPALIGN 0x0000
#define TPM_VCENTERALIGN 0x0010
#define TPM_BOTTOMALIGN 0x0020
#define TPM_HORIZONTAL 0x0000
#define TPM_VERTICAL 0x0040
#define TPM_NONOTIFY 0x0080
#define TPM_RETURNCMD 0x0100
typedef struct
{
UINT32 cbSize;
RECT32 rcExclude;
} TPMPARAMS, *LPTPMPARAMS;
#define MF_INSERT 0x0000
#define MF_CHANGE 0x0080
@ -3723,10 +3875,14 @@ typedef struct {
/* Code page information.
*/
typedef struct {
DWORD MaxCharSize;
BYTE DefaultChar[2];
BYTE LeadBytes[5];
#define MAX_LEADBYTES 12
#define MAX_DEFAULTCHAR 2
typedef struct
{
UINT32 MaxCharSize;
BYTE DefaultChar[MAX_DEFAULTCHAR];
BYTE LeadByte[MAX_LEADBYTES];
} CPINFO, *LPCPINFO;
/* The 'overlapped' data structure used by async I/O functions.
@ -3848,16 +4004,17 @@ typedef struct
/* File attribute flags
*/
#define FILE_ATTRIBUTE_ARCHIVE 0x0020
#define FILE_ATTRIBUTE_COMPRESSED 0x0800
#define FILE_ATTRIBUTE_DIRECTORY 0x0010
#define FILE_ATTRIBUTE_HIDDEN 0x0002
#define FILE_ATTRIBUTE_NORMAL 0x0080
#define FILE_ATTRIBUTE_READONLY 0x0001
#define FILE_ATTRIBUTE_HIDDEN 0x0002
#define FILE_ATTRIBUTE_SYSTEM 0x0004
#define FILE_ATTRIBUTE_LABEL 0x0008 /* Not in Windows API */
#define FILE_ATTRIBUTE_DIRECTORY 0x0010
#define FILE_ATTRIBUTE_ARCHIVE 0x0020
#define FILE_ATTRIBUTE_NORMAL 0x0080
#define FILE_ATTRIBUTE_TEMPORARY 0x0100
#define FILE_ATTRIBUTE_ATOMIC_WRITE 0x0200
#define FILE_ATTRIBUTE_XACTION_WRITE 0x0400
#define FILE_ATTRIBUTE_COMPRESSED 0x0800
/* WinHelp internal structure */
@ -3902,6 +4059,19 @@ typedef struct {
#define HELP_MULTIKEY 0x0201
#define HELP_SETWINPOS 0x0203
/* ExitWindows() flags */
#define EW_RESTARTWINDOWS 0x0042
#define EW_REBOOTSYSTEM 0x0043
#define EW_EXITANDEXECAPP 0x0044
/* ExitWindowsEx() flags */
#define EWX_LOGOFF 0
#define EWX_SHUTDOWN 1
#define EWX_REBOOT 2
#define EWX_FORCE 4
#define EWX_POWEROFF 8
#define CCHDEVICENAME 32
#define CCHFORMNAME 32
@ -4281,6 +4451,7 @@ BOOL16 SetDeskPattern(void);
VOID SetPriority(HTASK16,INT16);
WORD SetSelectorBase(WORD,DWORD);
WORD SetSelectorLimit(WORD,DWORD);
LONG SetSwapAreaSize(WORD);
HQUEUE16 SetTaskQueue(HTASK16,HQUEUE16);
FARPROC16 SetTaskSignalProc(HTASK16,FARPROC16);
DWORD SetViewportExt(HDC16,INT16,INT16);
@ -4302,8 +4473,9 @@ VOID Yield(void);
BOOL32 Beep(DWORD,DWORD);
BOOL32 ClearCommError(INT32,LPDWORD,LPCOMSTAT);
HFILE CreateFile32A(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE32);
HFILE CreateFile32W(LPCWSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE32);
BOOL32 CloseHandle(HANDLE32);
HFILE32 CreateFile32A(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE32);
HFILE32 CreateFile32W(LPCWSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE32);
#define CreateFile WINELIB_NAME_AW(CreateFile)
HANDLE32 CreateFileMapping32A(HANDLE32,LPSECURITY_ATTRIBUTES,DWORD,DWORD,DWORD,LPCSTR);
HANDLE32 CreateFileMapping32W(HANDLE32,LPSECURITY_ATTRIBUTES,DWORD,DWORD,DWORD,LPCWSTR);
@ -4320,24 +4492,29 @@ BOOL32 EnumSystemLocales32W(LOCALE_ENUMPROC32W,DWORD);
#define EnumSystemLocales WINELIB_NAME_AW(EnumSystemLocales)
BOOL32 EnumThreadWindows(DWORD,WNDENUMPROC32,LPARAM);
void ExitProcess(DWORD);
BOOL32 FileTimeToDosDateTime(LPFILETIME,LPWORD,LPWORD);
BOOL32 FileTimeToLocalFileTime(LPFILETIME,LPFILETIME);
BOOL32 FileTimeToSystemTime(LPFILETIME,LPSYSTEMTIME);
BOOL32 ExitWindowsEx(UINT32,DWORD);
BOOL32 FileTimeToDosDateTime(const FILETIME*,LPWORD,LPWORD);
BOOL32 FileTimeToLocalFileTime(const FILETIME*,LPFILETIME);
BOOL32 FileTimeToSystemTime(const FILETIME*,LPSYSTEMTIME);
HRSRC32 FindResourceEx32A(HINSTANCE32,LPCSTR,LPCSTR,WORD);
HRSRC32 FindResourceEx32W(HINSTANCE32,LPCWSTR,LPCWSTR,WORD);
#define FindResourceEx WINELIB_NAME_AW(FindResourceEx)
BOOL32 FlushFileBuffers(HFILE);
BOOL32 FlushFileBuffers(HFILE32);
UINT32 GetACP(void);
LPCSTR GetCommandLine32A();
LPCWSTR GetCommandLine32W();
#define GetCommandLine WINELIB_NAME_AW(GetCommandLine)
BOOL32 GetCommTimeouts(INT32,LPCOMMTIMEOUTS);
DWORD GetCurrentThreadId(void);
BOOL32 GetCPInfo(UINT32,LPCPINFO);
HANDLE32 GetCurrentProcess(void);
DWORD GetCurrentProcessId(void);
HANDLE32 GetCurrentThread(void);
DWORD GetCurrentThreadId(void);
BOOL32 GetDCOrgEx(HDC32,LPPOINT32);
DWORD GetFileInformationByHandle(HFILE,BY_HANDLE_FILE_INFORMATION*);
DWORD GetFileSize(HFILE,LPDWORD);
DWORD GetFileType(HFILE);
DWORD GetFileInformationByHandle(HFILE32,BY_HANDLE_FILE_INFORMATION*);
DWORD GetFileSize(HFILE32,LPDWORD);
BOOL32 GetFileTime(HFILE32,LPFILETIME,LPFILETIME,LPFILETIME);
DWORD GetFileType(HFILE32);
VOID GetLocalTime(LPSYSTEMTIME);
DWORD GetLogicalDrives(void);
UINT32 GetOEMCP(void);
@ -4345,7 +4522,7 @@ HANDLE32 GetProcessHeap(void);
DWORD GetShortPathName32A(LPCSTR,LPSTR,DWORD);
DWORD GetShortPathName32W(LPCWSTR,LPWSTR,DWORD);
#define GetShortPathName WINELIB_NAME_AW(GetShortPathName)
HFILE GetStdHandle(DWORD);
HFILE32 GetStdHandle(DWORD);
VOID GetSystemInfo(LPSYSTEM_INFO);
BOOL32 GetSystemPowerStatus(LPSYSTEM_POWER_STATUS);
VOID GetSystemTime(LPSYSTEMTIME);
@ -4362,7 +4539,7 @@ BOOL32 HeapUnlock(HANDLE32);
BOOL32 HeapValidate(HANDLE32,DWORD,LPVOID);
BOOL32 IsWindowUnicode(HWND32);
BOOL32 IsValidLocale(DWORD,DWORD);
BOOL32 LocalFileTimeToFileTime(LPFILETIME,LPFILETIME);
BOOL32 LocalFileTimeToFileTime(const FILETIME*,LPFILETIME);
LPVOID MapViewOfFileEx(HANDLE32,DWORD,DWORD,DWORD,DWORD,DWORD);
BOOL32 MoveFile32A(LPCSTR,LPCSTR);
BOOL32 MoveFile32W(LPCWSTR,LPCWSTR);
@ -4371,7 +4548,7 @@ BOOL32 QueryPerformanceCounter(LPLARGE_INTEGER);
BOOL32 ReadConsole32A(HANDLE32,LPVOID,DWORD,LPDWORD,LPVOID);
BOOL32 ReadConsole32W(HANDLE32,LPVOID,DWORD,LPDWORD,LPVOID);
#define ReadConsole WINELIB_NAME_AW(ReadConsole)
BOOL32 ReadFile(HFILE,LPVOID,DWORD,LPDWORD,LPOVERLAPPED);
BOOL32 ReadFile(HFILE32,LPVOID,DWORD,LPDWORD,LPOVERLAPPED);
DWORD RegCreateKeyEx32A(HKEY,LPCSTR,DWORD,LPSTR,DWORD,REGSAM,
LPSECURITY_ATTRIBUTES,LPHKEY,LPDWORD);
DWORD RegCreateKeyEx32W(HKEY,LPCWSTR,DWORD,LPWSTR,DWORD,REGSAM,
@ -4400,27 +4577,32 @@ BOOL32 SetCommTimeouts(INT32,LPCOMMTIMEOUTS);
BOOL32 SetConsoleTitle32A(LPCSTR);
BOOL32 SetConsoleTitle32W(LPCWSTR);
#define SetConsoleTitle WINELIB_NAME_AW(SetConsoleTitle)
BOOL32 SetEndOfFile(HFILE);
DWORD SetFilePointer(HFILE,LONG,LPLONG,DWORD);
BOOL32 SetFileTime(HFILE,LPFILETIME,LPFILETIME,LPFILETIME);
BOOL32 SetEndOfFile(HFILE32);
DWORD SetFilePointer(HFILE32,LONG,LPLONG,DWORD);
BOOL32 SetFileTime(HFILE32,const FILETIME*,const FILETIME*,const FILETIME*);
VOID SetLastErrorEx(DWORD,DWORD);
BOOL32 SetTimeZoneInformation(const LPTIME_ZONE_INFORMATION);
BOOL32 SetSystemPowerState(BOOL32,BOOL32);
BOOL32 SetSystemTime(const SYSTEMTIME*);
VOID Sleep(DWORD);
BOOL32 SystemTimeToFileTime(LPSYSTEMTIME,LPFILETIME);
BOOL32 SystemTimeToFileTime(const SYSTEMTIME*,LPFILETIME);
BOOL32 TrackPopupMenuEx(HMENU32,UINT32,INT32,INT32,HWND32,LPTPMPARAMS);
DWORD TlsAlloc(void);
BOOL32 TlsFree(DWORD);
LPVOID TlsGetValue(DWORD);
BOOL32 TlsSetValue(DWORD,LPVOID);
LPVOID VirtualAlloc(LPVOID,DWORD,DWORD,DWORD);
BOOL32 VirtualFree(LPVOID,DWORD,DWORD);
BOOL32 WriteConsole32A(HANDLE32,LPVOID,DWORD,LPDWORD,LPVOID);
BOOL32 WriteConsole32W(HANDLE32,LPVOID,DWORD,LPDWORD,LPVOID);
#define WriteConsole WINELIB_NAME_AW(WriteConsole)
BOOL32 WriteFile(HFILE,LPVOID,DWORD,LPDWORD,LPOVERLAPPED);
BOOL32 WriteFile(HFILE32,LPVOID,DWORD,LPDWORD,LPOVERLAPPED);
/* Declarations for functions that are the same in Win16 and Win32 */
BOOL16 CheckDlgButton(HWND32,INT32,UINT32);
BOOL16 CheckRadioButton(HWND32,UINT32,UINT32,UINT32);
LONG CopyLZFile(HFILE,HFILE);
HBITMAP16 CreateBitmap(INT32,INT32,UINT32,UINT32,LPCVOID);
BOOL16 CreateCaret(HWND32,HBITMAP32,INT32,INT32);
HBITMAP16 CreateCompatibleBitmap(HDC32,INT32,INT32);
@ -4439,13 +4621,7 @@ INT16 GetUpdateRgn(HWND32,HRGN32,BOOL32);
WORD GetWindowWord(HWND32,INT32);
BOOL16 HideCaret(HWND32);
BOOL16 IsWindow(HWND32);
void LZClose(HFILE);
LONG LZCopy(HFILE,HFILE);
void LZDone(void);
HFILE LZInit(HFILE);
LONG LZSeek(HFILE,LONG,INT32);
INT16 LZStart(void);
HFILE OpenFile(LPCSTR,OFSTRUCT*,UINT32);
UINT16 RealizePalette(HDC32);
DWORD RegCloseKey(HKEY);
DWORD RegFlushKey(HKEY);
@ -4456,18 +4632,11 @@ BOOL16 SetCaretBlinkTime(UINT32);
BOOL16 SetCaretPos(INT32,INT32);
WORD SetClassWord(HWND32,INT32,WORD);
VOID SetLastError(DWORD);
VOID SetLastErrorEx(DWORD,DWORD);
VOID SetRectRgn(HRGN32,INT32,INT32,INT32,INT32);
COLORREF SetTextColor(HDC32,COLORREF);
WORD SetWindowWord(HWND32,INT32,WORD);
BOOL16 ShowCaret(HWND32);
VOID UpdateWindow(HWND32);
LONG _hread(HFILE,LPVOID,LONG);
HFILE _lclose(HFILE);
HFILE _lcreat(LPCSTR,INT32);
LONG _llseek(HFILE,LONG,INT32);
HFILE _lopen(LPCSTR,INT32);
LONG _hwrite(HFILE,LPCSTR,LONG);
/* Declarations for functions that change between Win16 and Win32 */
@ -4583,6 +4752,9 @@ HCURSOR16 CopyCursor16(HINSTANCE16,HCURSOR16);
HICON16 CopyIcon16(HINSTANCE16,HICON16);
HICON32 CopyIcon32(HICON32);
#define CopyIcon WINELIB_NAME(CopyIcon)
LONG CopyLZFile16(HFILE16,HFILE16);
LONG CopyLZFile32(HFILE32,HFILE32);
#define CopyLZFile WINELIB_NAME(CopyLZFile)
BOOL16 CopyRect16(RECT16*,const RECT16*);
BOOL32 CopyRect32(RECT32*,const RECT32*);
#define CopyRect WINELIB_NAME(CopyRect)
@ -4835,6 +5007,9 @@ BOOL32 EscapeCommFunction32(INT32,UINT32);
INT16 ExcludeClipRect16(HDC16,INT16,INT16,INT16,INT16);
INT32 ExcludeClipRect32(HDC32,INT32,INT32,INT32,INT32);
#define ExcludeClipRect WINELIB_NAME(ExcludeClipRect)
BOOL16 ExitWindows16(DWORD,UINT16);
#define ExitWindows32(a,b) ExitWindowsEx(EWX_LOGOFF,0xffffffff)
#define ExitWindows WINELIB_NAME(ExitWindows)
BOOL16 ExtFloodFill16(HDC16,INT16,INT16,COLORREF,UINT16);
BOOL32 ExtFloodFill32(HDC32,INT32,INT32,COLORREF,UINT32);
#define ExtFloodFill WINELIB_NAME(ExtFloodFill)
@ -4842,6 +5017,10 @@ BOOL16 ExtTextOut16(HDC16,INT16,INT16,UINT16,const RECT16*,LPCSTR,UINT16,con
BOOL32 ExtTextOut32A(HDC32,INT32,INT32,UINT32,const RECT32*,LPCSTR,UINT32,const INT32*);
BOOL32 ExtTextOut32W(HDC32,INT32,INT32,UINT32,const RECT32*,LPCWSTR,UINT32,const INT32*);
#define ExtTextOut WINELIB_NAME_AW(ExtTextOut)
void FatalAppExit16(UINT16,LPCSTR);
void FatalAppExit32A(UINT32,LPCSTR);
void FatalAppExit32W(UINT32,LPCWSTR);
#define FatalAppExit WINELIB_NAME_AW(FatalAppExit)
INT16 FillRect16(HDC16,const RECT16*,HBRUSH16);
INT32 FillRect32(HDC32,const RECT32*,HBRUSH32);
#define FillRect WINELIB_NAME(FillRect)
@ -4851,11 +5030,11 @@ BOOL32 FillRgn32(HDC32,HRGN32,HBRUSH32);
BOOL16 FindClose16(HANDLE16);
BOOL32 FindClose32(HANDLE32);
#define FindClose WINELIB_NAME(FindClose)
HANDLE16 FindFirstFile16(LPCSTR,LPVOID);
HANDLE16 FindFirstFile16(LPCSTR,LPWIN32_FIND_DATA32A);
HANDLE32 FindFirstFile32A(LPCSTR,LPWIN32_FIND_DATA32A);
HANDLE32 FindFirstFile32W(LPCWSTR,LPWIN32_FIND_DATA32W);
#define FindFirst WINELIB_NAME_AW(FindFirst)
BOOL16 FindNextFile16(HANDLE16,LPVOID);
BOOL16 FindNextFile16(HANDLE16,LPWIN32_FIND_DATA32A);
BOOL32 FindNextFile32A(HANDLE32,LPWIN32_FIND_DATA32A);
BOOL32 FindNextFile32W(HANDLE32,LPWIN32_FIND_DATA32W);
#define FindNext WINELIB_NAME_AW(FindNext)
@ -5227,6 +5406,9 @@ BOOL32 IntersectRect32(LPRECT32,const RECT32*,const RECT32*);
void InvalidateRect16(HWND16,const RECT16*,BOOL16);
void InvalidateRect32(HWND32,const RECT32*,BOOL32);
#define InvalidateRect WINELIB_NAME(InvalidateRect)
void InvalidateRgn16(HWND16,HRGN16,BOOL16);
void InvalidateRgn32(HWND32,HRGN32,BOOL32);
#define InvalidateRgn WINELIB_NAME(InvalidateRgn)
void InvertRect16(HDC16,const RECT16*);
void InvertRect32(HDC32,const RECT32*);
#define InvertRect WINELIB_NAME(InvertRect)
@ -5277,13 +5459,16 @@ BOOL32 KillSystemTimer32(HWND32,UINT32);
BOOL16 KillTimer16(HWND16,UINT16);
BOOL32 KillTimer32(HWND32,UINT32);
#define KillTimer WINELIB_NAME(KillTimer)
HFILE LZOpenFile16(LPCSTR,LPOFSTRUCT,UINT16);
HFILE LZOpenFile32A(LPCSTR,LPOFSTRUCT,UINT32);
HFILE LZOpenFile32W(LPCWSTR,LPOFSTRUCT,UINT32);
HFILE16 LZOpenFile16(LPCSTR,LPOFSTRUCT,UINT16);
HFILE32 LZOpenFile32A(LPCSTR,LPOFSTRUCT,UINT32);
HFILE32 LZOpenFile32W(LPCWSTR,LPOFSTRUCT,UINT32);
#define LZOpenFile WINELIB_NAME_AW(LZOpenFile)
INT16 LZRead16(HFILE,SEGPTR,UINT16);
INT32 LZRead32(HFILE,LPVOID,UINT32);
INT16 LZRead16(HFILE16,LPVOID,UINT16);
INT32 LZRead32(HFILE32,LPVOID,UINT32);
#define LZRead WINELIB_NAME(LZRead)
INT16 LZStart16(void);
INT32 LZStart32(void);
#define LZStart WINELIB_NAME(LZStart)
VOID LineDDA16(INT16,INT16,INT16,INT16,LINEDDAPROC16,LPARAM);
BOOL32 LineDDA32(INT32,INT32,INT32,INT32,LINEDDAPROC32,LPARAM);
#define LineDDA WINELIB_NAME(LineDDA)
@ -5364,6 +5549,18 @@ HGLOBAL16 LockSegment16(HGLOBAL16);
BOOL16 LPtoDP16(HDC16,LPPOINT16,INT16);
BOOL32 LPtoDP32(HDC32,LPPOINT32,INT32);
#define LPtoDP WINELIB_NAME(LPtoDP)
void LZClose16(HFILE16);
void LZClose32(HFILE32);
#define LZClose WINELIB_NAME(LZClose)
LONG LZCopy16(HFILE16,HFILE16);
LONG LZCopy32(HFILE32,HFILE32);
#define LZCopy WINELIB_NAME(LZCopy)
HFILE16 LZInit16(HFILE16);
HFILE32 LZInit32(HFILE32);
#define LZInit WINELIB_NAME(LZInit)
LONG LZSeek16(HFILE16,LONG,INT16);
LONG LZSeek32(HFILE32,LONG,INT32);
#define LZSeek WINELIB_NAME(LZSeek)
FARPROC16 MakeProcInstance16(FARPROC16,HANDLE16);
#define MakeProcInstance32(proc,inst) (proc)
#define MakeProcInstance WINELIB_NAME(MakeProcInstance)
@ -5416,6 +5613,9 @@ BOOL32 OffsetViewportOrgEx32(HDC32,INT32,INT32,LPPOINT32);
BOOL16 OffsetWindowOrgEx16(HDC16,INT16,INT16,LPPOINT16);
BOOL32 OffsetWindowOrgEx32(HDC32,INT32,INT32,LPPOINT32);
#define OffsetWindowOrgEx WINELIB_NAME(OffsetWindowOrgEx)
HFILE16 OpenFile16(LPCSTR,OFSTRUCT*,UINT16);
HFILE32 OpenFile32(LPCSTR,OFSTRUCT*,UINT32);
#define OpenFile WINELIB_NAME(OpenFile)
BOOL16 PaintRgn16(HDC16,HRGN16);
BOOL32 PaintRgn32(HDC32,HRGN32);
#define PaintRgn WINELIB_NAME(PaintRgn)
@ -5720,6 +5920,10 @@ void SetWindowText16(HWND16,SEGPTR);
void SetWindowText32A(HWND32,LPCSTR);
void SetWindowText32W(HWND32,LPCWSTR);
#define SetWindowText WINELIB_NAME_AW(SetWindowText)
BOOL16 ShellAbout16(HWND16,LPCSTR,LPCSTR,HICON16);
BOOL32 ShellAbout32A(HWND32,LPCSTR,LPCSTR,HICON32);
BOOL32 ShellAbout32W(HWND32,LPCWSTR,LPCWSTR,HICON32);
#define ShellAbout WINELIB_NAME_AW(ShellAbout)
void ShowScrollBar16(HWND16,INT16,BOOL16);
BOOL32 ShowScrollBar32(HWND32,INT32,BOOL32);
#define ShowScrollBar WINELIB_NAME(ShowScrollBar)
@ -5728,8 +5932,10 @@ BOOL16 StretchBlt16(HDC16,INT16,INT16,INT16,INT16,HDC16,INT16,INT16,
BOOL32 StretchBlt32(HDC32,INT32,INT32,INT32,INT32,HDC32,INT32,INT32,
INT32,INT32,DWORD);
#define StretchBlt WINELIB_NAME(StretchBlt)
INT16 StretchDIBits16(HDC16,INT16,INT16,INT16,INT16,INT16,INT16,INT16,INT16,const VOID*,const BITMAPINFO*,UINT16,DWORD);
INT32 StretchDIBits32(HDC32,INT32,INT32,INT32,INT32,INT32,INT32,INT32,INT32,const VOID*,const BITMAPINFO*,UINT32,DWORD);
INT16 StretchDIBits16(HDC16,INT16,INT16,INT16,INT16,INT16,INT16,INT16,
INT16,const VOID*,const BITMAPINFO*,UINT16,DWORD);
INT32 StretchDIBits32(HDC32,INT32,INT32,INT32,INT32,INT32,INT32,INT32,
INT32,const VOID*,const BITMAPINFO*,UINT32,DWORD);
#define StretchDIBits WINELIB_NAME(StretchDIBits)
BOOL16 SubtractRect16(LPRECT16,const RECT16*,const RECT16*);
BOOL32 SubtractRect32(LPRECT32,const RECT32*,const RECT32*);
@ -5770,6 +5976,9 @@ BOOL32 UnregisterClass32W(LPCWSTR,HINSTANCE32);
void ValidateRect16(HWND16,const RECT16*);
void ValidateRect32(HWND32,const RECT32*);
#define ValidateRect WINELIB_NAME(ValidateRect)
VOID ValidateRgn16(HWND16,HRGN16);
VOID ValidateRgn32(HWND32,HRGN32);
#define ValidateRgn WINELIB_NAME(ValidateRgn)
DWORD VerFindFile16(UINT16,LPCSTR,LPCSTR,LPCSTR,LPSTR,UINT16*,LPSTR,UINT16*);
DWORD VerFindFile32A(UINT32,LPCSTR,LPCSTR,LPCSTR,LPSTR,UINT32*,LPSTR,UINT32*);
DWORD VerFindFile32W(UINT32,LPCWSTR,LPCWSTR,LPCWSTR,LPWSTR,UINT32*,LPWSTR,UINT32*);
@ -5828,6 +6037,13 @@ INT16 lstrlen16(LPCSTR);
INT32 lstrlen32A(LPCSTR);
INT32 lstrlen32W(LPCWSTR);
#define lstrlen WINELIB_NAME_AW(lstrlen)
HINSTANCE16 WinExec16(LPCSTR,UINT16);
HINSTANCE32 WinExec32(LPCSTR,UINT32);
#define WinExec WINELIB_NAME(WinExec)
BOOL16 WinHelp16(HWND16,LPCSTR,UINT16,DWORD);
BOOL32 WinHelp32A(HWND32,LPCSTR,UINT32,DWORD);
BOOL32 WinHelp32W(HWND32,LPCWSTR,UINT32,DWORD);
#define WinHelp WINELIB_NAME_AW(WinHelp)
INT16 wsnprintf16(LPSTR,UINT16,LPCSTR,...);
INT32 wsnprintf32A(LPSTR,UINT32,LPCSTR,...);
INT32 wsnprintf32W(LPWSTR,UINT32,LPCWSTR,...);
@ -5844,11 +6060,29 @@ INT16 wvsprintf16(LPSTR,LPCSTR,LPCVOID);
INT32 wvsprintf32A(LPSTR,LPCSTR,LPCVOID);
INT32 wvsprintf32W(LPWSTR,LPCWSTR,LPCVOID);
#define wvsprintf WINELIB_NAME_AW(wvsprintf)
UINT16 _lread16(HFILE,LPVOID,UINT16);
UINT32 _lread32(HFILE,LPVOID,UINT32);
LONG _hread16(HFILE16,LPVOID,LONG);
LONG _hread32(HFILE32,LPVOID,LONG);
#define _hread WINELIB_NAME(_hread)
LONG _hwrite16(HFILE16,LPCSTR,LONG);
LONG _hwrite32(HFILE32,LPCSTR,LONG);
#define _hwrite WINELIB_NAME(_hwrite)
HFILE16 _lcreat16(LPCSTR,INT16);
HFILE32 _lcreat32(LPCSTR,INT32);
#define _lcreat WINELIB_NAME(_lcreat)
HFILE16 _lclose16(HFILE16);
HFILE32 _lclose32(HFILE32);
#define _lclose WINELIB_NAME(_lclose)
LONG _llseek16(HFILE16,LONG,INT16);
LONG _llseek32(HFILE32,LONG,INT32);
#define _llseek WINELIB_NAME(_llseek)
HFILE16 _lopen16(LPCSTR,INT16);
HFILE32 _lopen32(LPCSTR,INT32);
#define _lopen WINELIB_NAME(_lopen)
UINT16 _lread16(HFILE16,LPVOID,UINT16);
UINT32 _lread32(HFILE32,LPVOID,UINT32);
#define _lread WINELIB_NAME(_lread)
UINT16 _lwrite16(HFILE,LPCSTR,UINT16);
UINT32 _lwrite32(HFILE,LPCSTR,UINT32);
UINT16 _lwrite16(HFILE16,LPCSTR,UINT16);
UINT32 _lwrite32(HFILE32,LPCSTR,UINT32);
#define _lwrite WINELIB_NAME(_lwrite)
/* Extra functions that don't exist in the Windows API */
@ -5942,9 +6176,7 @@ BOOL EndDeferWindowPos(HDWP16);
UINT16 EnumClipboardFormats(UINT16);
BOOL EnumMetaFile(HDC16,HMETAFILE16,MFENUMPROC16,LPARAM);
INT Escape(HDC16,INT,INT,SEGPTR,SEGPTR);
BOOL ExitWindows(DWORD,WORD);
HICON16 ExtractIcon(HINSTANCE16,LPCSTR,WORD);
void FatalAppExit(UINT,LPCSTR);
void FatalExit(int);
ATOM FindAtom(SEGPTR);
HINSTANCE16 FindExecutable(LPCSTR,LPCSTR,LPSTR);
@ -6023,7 +6255,6 @@ BOOL GrayString(HDC16,HBRUSH16,GRAYSTRINGPROC16,LPARAM,INT,INT,INT,INT,INT
BOOL HiliteMenuItem(HWND,HMENU16,UINT,UINT);
BOOL InSendMessage(void);
WORD InitAtomTable(WORD);
void InvalidateRgn(HWND32,HRGN32,BOOL32);
BOOL IsChild(HWND,HWND);
BOOL IsClipboardFormatAvailable(WORD);
BOOL IsDialogMessage(HWND,LPMSG16);
@ -6086,7 +6317,6 @@ WORD SetPaletteEntries(HPALETTE16,WORD,WORD,LPPALETTEENTRY);
HWND SetParent(HWND,HWND);
FARPROC16 SetResourceHandler(HINSTANCE16,LPSTR,FARPROC16);
int SetSoundNoise(int,int);
LONG SetSwapAreaSize(WORD);
void SetSysColors(int,LPINT16,COLORREF*);
WORD SetSystemPaletteUse(HDC16,WORD);
int SetVoiceAccent(int,int,int,int,int);
@ -6113,15 +6343,10 @@ INT16 TranslateAccelerator(HWND,HACCEL16,LPMSG16);
BOOL TranslateMDISysAccel(HWND,LPMSG16);
BOOL TranslateMessage(LPMSG16);
int UpdateColors(HDC16);
void ValidateCodeSegments(void);
LPSTR ValidateFreeSpaces(void);
void ValidateRgn(HWND32,HRGN32);
WORD VkKeyScan(WORD);
SEGPTR WIN16_LockResource(HGLOBAL16);
void WaitMessage(void);
int WaitSoundState(int);
HINSTANCE16 WinExec(LPSTR,WORD);
BOOL WinHelp(HWND,LPSTR,WORD,DWORD);
#endif /* NO_TRANSITION_TYPES */

View File

@ -5,26 +5,28 @@ extern int WIN32_LastError;
* All instances of ERROR_UNKNOWN should be tested under Win95/NT
* and replaced.
*/
#define ERROR_UNKNOWN 99999
#define ERROR_UNKNOWN 99999
#define ERROR_SUCCESS 0
#define ERROR_FILE_NOT_FOUND 2
#define ERROR_TOO_MANY_OPEN_FILES 4
#define ERROR_ACCESS_DENIED 5
#define ERROR_INVALID_HANDLE 6
#define ERROR_BAD_FORMAT 11
#define ERROR_OUTOFMEMORY 14
#define ERROR_FILE_EXISTS 80
#define ERROR_INVALID_PARAMETER 87
#define ERROR_BROKEN_PIPE 109
#define ERROR_DISK_FULL 112
#define ERROR_CALL_NOT_IMPLEMENTED 120
#define ERROR_SEEK_ON_DEVICE 132
#define ERROR_DIR_NOT_EMPTY 145
#define ERROR_BUSY 170
#define ERROR_FILENAME_EXCED_RANGE 206
#define ERROR_MORE_DATA 234
#define ERROR_NO_MORE_ITEMS 259
#define ERROR_IO_DEVICE 1117
#define ERROR_POSSIBLE_DEADLOCK 1131
#define ERROR_BAD_DEVICE 1200
#define ERROR_SUCCESS 0
#define ERROR_FILE_NOT_FOUND 2
#define ERROR_PATH_NOT_FOUND 3
#define ERROR_TOO_MANY_OPEN_FILES 4
#define ERROR_ACCESS_DENIED 5
#define ERROR_INVALID_HANDLE 6
#define ERROR_BAD_FORMAT 11
#define ERROR_OUTOFMEMORY 14
#define ERROR_NO_MORE_FILES 18
#define ERROR_FILE_EXISTS 80
#define ERROR_INVALID_PARAMETER 87
#define ERROR_BROKEN_PIPE 109
#define ERROR_DISK_FULL 112
#define ERROR_CALL_NOT_IMPLEMENTED 120
#define ERROR_SEEK_ON_DEVICE 132
#define ERROR_DIR_NOT_EMPTY 145
#define ERROR_BUSY 170
#define ERROR_FILENAME_EXCED_RANGE 206
#define ERROR_MORE_DATA 234
#define ERROR_NO_MORE_ITEMS 259
#define ERROR_IO_DEVICE 1117
#define ERROR_POSSIBLE_DEADLOCK 1131
#define ERROR_BAD_DEVICE 1200

View File

@ -7,6 +7,8 @@
#ifndef __WINE_WINNT_H
#define __WINE_WINNT_H
#include "wintypes.h"
/* Heap flags */
#define HEAP_NO_SERIALIZE 0x00000001
#define HEAP_GROWABLE 0x00000002
@ -21,4 +23,119 @@
#define HEAP_WINE_SEGPTR 0x01000000 /* 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 */

View File

@ -93,7 +93,6 @@ typedef WORD CATCHBUF[9];
typedef WORD *LPCATCHBUF;
typedef DWORD ACCESS_MASK;
typedef ACCESS_MASK REGSAM;
typedef INT16 HFILE;
typedef HANDLE32 HHOOK;
typedef HANDLE32 HKEY;
typedef HANDLE32 HMIXEROBJ;
@ -138,6 +137,7 @@ DECLARE_HANDLE(HDC);
DECLARE_HANDLE(HDROP);
DECLARE_HANDLE(HDRVR);
DECLARE_HANDLE(HDWP);
DECLARE_HANDLE(HFILE);
DECLARE_HANDLE(HFONT);
DECLARE_HANDLE(HGDIOBJ);
DECLARE_HANDLE(HGLOBAL);
@ -234,6 +234,7 @@ DECL_WINELIB_TYPE(HDC);
DECL_WINELIB_TYPE(HDROP);
DECL_WINELIB_TYPE(HDRVR);
DECL_WINELIB_TYPE(HDWP);
DECL_WINELIB_TYPE(HFILE);
DECL_WINELIB_TYPE(HFONT);
DECL_WINELIB_TYPE(HGDIOBJ);
DECL_WINELIB_TYPE(HGLOBAL);

View File

@ -1,149 +0,0 @@
/*
* 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 */

View File

@ -11,7 +11,6 @@
#include "dde_mem.h"
#include "global.h"
#include "debug.h"
#include "xmalloc.h"
void SIGNAL_MaskAsyncEvents( BOOL32 mask )
{
@ -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 ComboBoxWndProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT ComboLBoxWndProc(HWND,UINT,WPARAM16,LPARAM);
@ -61,7 +59,6 @@ extern LRESULT PrintSetupDlgProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT ReplaceTextDlgProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT ScrollBarWndProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT StaticWndProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT SystemMessageBoxProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT TASK_Reschedule(void);
/***********************************************************************
@ -72,7 +69,6 @@ extern LRESULT TASK_Reschedule(void);
FARPROC16 MODULE_GetWndProcEntry16( char *name )
{
#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("ComboBoxWndProc",ComboBoxWndProc);
MAP_STR_TO_PROC("ComboLBoxWndProc",ComboLBoxWndProc);
@ -88,7 +84,6 @@ FARPROC16 MODULE_GetWndProcEntry16( char *name )
MAP_STR_TO_PROC("ReplaceTextDlgProc",ReplaceTextDlgProc);
MAP_STR_TO_PROC("ScrollBarWndProc",ScrollBarWndProc);
MAP_STR_TO_PROC("StaticWndProc",StaticWndProc);
MAP_STR_TO_PROC("SystemMessageBoxProc",SystemMessageBoxProc);
MAP_STR_TO_PROC("TASK_Reschedule",TASK_Reschedule);
fprintf(stderr,"warning: No mapping for %s(), add one in library/miscstubs.c\n",name);
return NULL;

View File

@ -26,7 +26,7 @@ int main( int argc, char *argv [] )
for (i = 2; i < argc; i++) strcat(strcat(lpszCmdParam, " "), argv[i]);
if(!MAIN_Init()) return 0; /* JBP: Needed for DosDrives[] structure, etc. */
hInstance = WinExec( *argv, SW_SHOWNORMAL );
hInstance = WinExec32( *argv, SW_SHOWNORMAL );
TASK_Reschedule();
InitApp( hInstance );

View File

@ -6,7 +6,6 @@ VPATH = @srcdir@
MODULE = loader
C_SRCS = \
builtin.c \
main.c \
module.c \
ne_image.c \

View File

@ -18,14 +18,13 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "menu.h"
#include "atom.h"
#include "dialog.h"
#include "directory.h"
#include "drive.h"
#include "queue.h"
#include "syscolor.h"
#include "sysmetrics.h"
#include "file.h"
#include "gdi.h"
#include "heap.h"
#include "debugger.h"
#include "miscemu.h"
#include "neexe.h"
#include "options.h"
@ -39,6 +38,9 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "stddebug.h"
#include "debug.h"
#ifndef WINELIB
#include "debugger.h"
#endif
/* Winelib run-time flag */
#ifdef WINELIB
@ -70,6 +72,9 @@ int MAIN_Init(void)
/* Load the configuration file */
if (!PROFILE_LoadWineIni()) return 0;
/* Initialize DOS memory */
if (!DOSMEM_Init()) return 0;
#ifdef WINELIB
/* Create USER and GDI heap */
USER_HeapSel = GlobalAlloc16( GMEM_FIXED, 0x10000 );
@ -83,15 +88,6 @@ int MAIN_Init(void)
/* Create built-in modules */
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 */
if (!SIGNAL_Init()) return 0;
@ -182,7 +178,7 @@ int main(int argc, char *argv[] )
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]);
switch (handle)

View File

@ -15,28 +15,23 @@
#include "dos_fs.h"
#include "file.h"
#include "global.h"
#include "heap.h"
#include "hook.h"
#include "ldt.h"
#include "module.h"
#include "neexe.h"
#include "registers.h"
#include "selectors.h"
#include "stackframe.h"
#include "task.h"
#include "toolhelp.h"
#include "stddebug.h"
#include "debug.h"
#include "callback.h"
#include "xmalloc.h"
extern HINSTANCE16 PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params );
static HMODULE16 hFirstModule = 0;
static HMODULE16 hCachedModule = 0; /* Module cached by MODULE_OpenFile */
#ifndef WINELIB
static HGLOBAL16 hInitialStack32 = 0;
#endif
/***********************************************************************
* MODULE_GetPtr
@ -281,8 +276,7 @@ DWORD MODULE_AllocateSegment(WORD wFlags, WORD wSize, WORD wElem)
/***********************************************************************
* MODULE_CreateSegments
*/
#ifndef WINELIB32
static BOOL MODULE_CreateSegments( HMODULE16 hModule )
static BOOL32 MODULE_CreateSegments( HMODULE16 hModule )
{
SEGTABLEENTRY *pSegment;
NE_MODULE *pModule;
@ -308,7 +302,6 @@ static BOOL MODULE_CreateSegments( HMODULE16 hModule )
(pModule->dgroup - 1) * sizeof(SEGTABLEENTRY) : 0;
return TRUE;
}
#endif
/***********************************************************************
@ -443,7 +436,7 @@ HMODULE16 MODULE_CreateDummyModule( const OFSTRUCT *ofs )
/***********************************************************************
* MODULE_LoadExeHeader
*/
static HMODULE16 MODULE_LoadExeHeader( HFILE hFile, OFSTRUCT *ofs )
static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs )
{
struct mz_header_s mz_header;
struct ne_header_s ne_header;
@ -459,15 +452,15 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE hFile, OFSTRUCT *ofs )
((fastload && ((offset) >= fastload_offset) && \
((offset)+(size) <= fastload_offset+fastload_length)) ? \
(memcpy( buffer, fastload+(offset)-fastload_offset, (size) ), TRUE) : \
(_llseek( hFile, mz_header.ne_offset+(offset), SEEK_SET), \
(_llseek32( hFile, mz_header.ne_offset+(offset), SEEK_SET), \
_lread32( hFile, (buffer), (size) ) == (size)))
_llseek( hFile, 0, SEEK_SET );
_llseek32( hFile, 0, SEEK_SET );
if ((_lread32(hFile,&mz_header,sizeof(mz_header)) != sizeof(mz_header)) ||
(mz_header.mz_magic != MZ_SIGNATURE))
return (HMODULE16)11; /* invalid exe */
_llseek( hFile, mz_header.ne_offset, SEEK_SET );
_llseek32( hFile, mz_header.ne_offset, SEEK_SET );
if (_lread32( hFile, &ne_header, sizeof(ne_header) ) != sizeof(ne_header))
return (HMODULE16)11; /* invalid exe */
@ -515,12 +508,12 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE hFile, OFSTRUCT *ofs )
fastload_length=ne_header.fastload_length<<ne_header.align_shift_count;
dprintf_module( stddeb, "Using fast-load area offset=%x len=%d\n",
fastload_offset, fastload_length );
if ((fastload = (char *)xmalloc( fastload_length )) != NULL)
if ((fastload = HeapAlloc( SystemHeap, 0, fastload_length )) != NULL)
{
_llseek( hFile, mz_header.ne_offset + fastload_offset, SEEK_SET );
_llseek32( hFile, mz_header.ne_offset + fastload_offset, SEEK_SET);
if (_lread32(hFile, fastload, fastload_length) != fastload_length)
{
free( fastload );
HeapFree( SystemHeap, 0, fastload );
fastload = NULL;
}
}
@ -537,7 +530,8 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE hFile, OFSTRUCT *ofs )
/* Get the segment table */
pModule->seg_table = (int)pData - (int)pModule;
buffer = xmalloc( ne_header.n_segment_tab * sizeof(struct ne_segment_table_entry_s) );
buffer = HeapAlloc( SystemHeap, 0, ne_header.n_segment_tab *
sizeof(struct ne_segment_table_entry_s));
if (buffer)
{
int i;
@ -545,17 +539,24 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE hFile, OFSTRUCT *ofs )
if (!READ( ne_header.segment_tab_offset,
ne_header.n_segment_tab * sizeof(struct ne_segment_table_entry_s),
buffer )) return (HMODULE16)11; /* invalid exe */
buffer ))
{
HeapFree( SystemHeap, 0, buffer );
HeapFree( SystemHeap, 0, fastload );
GlobalFree16( hModule );
return (HMODULE16)11; /* invalid exe */
}
pSeg = (struct ne_segment_table_entry_s *)buffer;
for (i = ne_header.n_segment_tab; i > 0; i--, pSeg++)
{
memcpy( pData, pSeg, sizeof(*pSeg) );
pData += sizeof(SEGTABLEENTRY);
}
free( buffer );
HeapFree( SystemHeap, 0, buffer );
}
else
{
HeapFree( SystemHeap, 0, fastload );
GlobalFree16( hModule );
return (HMODULE16)11; /* invalid exe */
}
@ -579,6 +580,7 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE hFile, OFSTRUCT *ofs )
ne_header.moduleref_tab_offset - ne_header.rname_tab_offset,
pData ))
{
HeapFree( SystemHeap, 0, fastload );
GlobalFree16( hModule );
return (HMODULE16)11; /* invalid exe */
}
@ -591,7 +593,12 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE hFile, OFSTRUCT *ofs )
pModule->modref_table = (int)pData - (int)pModule;
if (!READ( ne_header.moduleref_tab_offset,
ne_header.n_mod_ref_tab * sizeof(WORD),
pData )) return (HMODULE16)11; /* invalid exe */
pData ))
{
HeapFree( SystemHeap, 0, fastload );
GlobalFree16( hModule );
return (HMODULE16)11; /* invalid exe */
}
pData += ne_header.n_mod_ref_tab * sizeof(WORD);
}
else pModule->modref_table = 0; /* No module references */
@ -603,6 +610,7 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE hFile, OFSTRUCT *ofs )
ne_header.entry_tab_offset - ne_header.iname_tab_offset,
pData ))
{
HeapFree( SystemHeap, 0, fastload );
GlobalFree16( hModule );
return (HMODULE16)11; /* invalid exe */
}
@ -615,11 +623,17 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE hFile, OFSTRUCT *ofs )
ne_header.entry_tab_length,
pData ))
{
HeapFree( SystemHeap, 0, fastload );
GlobalFree16( hModule );
return (HMODULE16)11; /* invalid exe */
}
pData += ne_header.entry_tab_length;
/* Free the fast-load area */
#undef READ
HeapFree( SystemHeap, 0, fastload );
/* Get the non-resident names table */
if (ne_header.nrname_tab_length)
@ -632,7 +646,7 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE hFile, OFSTRUCT *ofs )
return (HMODULE16)11; /* invalid exe */
}
buffer = GlobalLock16( pModule->nrname_handle );
_llseek( hFile, ne_header.nrname_tab_offset, SEEK_SET );
_llseek32( hFile, ne_header.nrname_tab_offset, SEEK_SET );
if (_lread32( hFile, buffer, ne_header.nrname_tab_length )
!= ne_header.nrname_tab_length)
{
@ -661,7 +675,6 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE hFile, OFSTRUCT *ofs )
MODULE_RegisterModule( pModule );
return hModule;
#undef READ
}
@ -1007,7 +1020,7 @@ HINSTANCE16 LoadModule( LPCSTR name, LPVOID paramBlock )
OFSTRUCT ofs;
#ifndef WINELIB
WORD *pModRef, *pDLLs;
HFILE hFile;
HFILE32 hFile;
int i;
hModule = MODULE_FindModule( name );
@ -1017,7 +1030,7 @@ HINSTANCE16 LoadModule( LPCSTR name, LPVOID paramBlock )
/* Try to load the built-in first if not disabled */
if ((hModule = BUILTIN_LoadModule( name, FALSE ))) return hModule;
if ((hFile = OpenFile( name, &ofs, OF_READ )) == HFILE_ERROR)
if ((hFile = OpenFile32( name, &ofs, OF_READ )) == HFILE_ERROR32)
{
/* Now try the built-in even if disabled */
if ((hModule = BUILTIN_LoadModule( name, TRUE )))
@ -1035,7 +1048,7 @@ HINSTANCE16 LoadModule( LPCSTR name, LPVOID paramBlock )
{
/* FIXME: Hack because PE_LoadModule is recursive */
int fd = dup( FILE_GetUnixHandle(hFile) );
_lclose( hFile );
_lclose32( hFile );
if (hModule == 21) hModule = PE_LoadModule( fd, &ofs, paramBlock );
close( fd );
if (hModule < 32)
@ -1043,7 +1056,7 @@ HINSTANCE16 LoadModule( LPCSTR name, LPVOID paramBlock )
name, hModule );
return hModule;
}
_lclose( hFile );
_lclose32( hFile );
pModule = MODULE_GetPtr( hModule );
/* Allocate the segments for this module */
@ -1101,7 +1114,8 @@ HINSTANCE16 LoadModule( LPCSTR name, LPVOID paramBlock )
if (pModule->flags & NE_FFLAGS_SELFLOAD)
{
HFILE hf;
HFILE32 hf;
HGLOBAL16 hInitialStack32 = 0;
/* Handle self loading modules */
SEGTABLEENTRY * pSegTable = (SEGTABLEENTRY *) NE_SEG_TABLE(pModule);
SELFLOADHEADER *selfloadheader;
@ -1139,17 +1153,17 @@ HINSTANCE16 LoadModule( LPCSTR name, LPVOID paramBlock )
stack16Top->ip = 0;
stack16Top->cs = 0;
if (!IF1632_Stack32_base) {
if (!IF1632_Saved32_esp)
{
STACK32FRAME* frame32;
char *stack32Top;
/* Setup an initial 32 bit stack frame */
hInitialStack32 = GLOBAL_Alloc( GMEM_FIXED, 0x10000,
hInitialStack32 = GLOBAL_Alloc( GMEM_FIXED, 0x10000,
hModule, FALSE, FALSE,
FALSE );
/* Create the 32-bit stack frame */
*(DWORD *)GlobalLock16(hInitialStack32) = 0xDEADBEEF;
stack32Top = (char*)GlobalLock16(hInitialStack32) +
0x10000;
frame32 = (STACK32FRAME *)stack32Top - 1;
@ -1163,20 +1177,19 @@ HINSTANCE16 LoadModule( LPCSTR name, LPVOID paramBlock )
frame32->retaddr = 0;
frame32->codeselector = WINE_CODE_SELECTOR;
/* pTask->esp = (DWORD)frame32; */
IF1632_Stack32_base = WIN16_GlobalLock16(hInitialStack32);
}
hf = FILE_DupUnixHandle( MODULE_OpenFile( hModule ) );
CallTo16_word_ww( selfloadheader->BootApp, hModule, hf );
_lclose(hf);
_lclose32(hf);
/* some BootApp procs overwrite the selector of dgroup */
pSegTable[pModule->dgroup - 1].selector = saved_dgroup;
IF1632_Saved16_ss = oldss;
IF1632_Saved16_sp = oldsp;
for (i = 2; i <= pModule->seg_count; i++) NE_LoadSegment( hModule, i );
if (hInitialStack32){
if (hInitialStack32)
{
GlobalFree16(hInitialStack32);
IF1632_Stack32_base = hInitialStack32 = 0;
hInitialStack32 = 0;
}
}
else
@ -1389,9 +1402,18 @@ void FreeLibrary( HINSTANCE16 handle )
/***********************************************************************
* WinExec (KERNEL.166)
* WinExec16 (KERNEL.166)
*/
HINSTANCE16 WinExec( LPSTR lpCmdLine, WORD nCmdShow )
HINSTANCE16 WinExec16( LPCSTR lpCmdLine, UINT16 nCmdShow )
{
return WinExec32( lpCmdLine, nCmdShow );
}
/***********************************************************************
* WinExec32 (KERNEL32.566)
*/
HINSTANCE32 WinExec32( LPCSTR lpCmdLine, UINT32 nCmdShow )
{
LOADPARAMS params;
HGLOBAL16 cmdShowHandle, cmdLineHandle;

View File

@ -68,7 +68,7 @@ BOOL NE_LoadSegment( HMODULE16 hModule, WORD segnum )
SELFLOADHEADER *selfloadheader;
STACK16FRAME *stack16Top;
WORD oldss, oldsp, oldselector, newselector;
HFILE hf = FILE_DupUnixHandle( fd );
HFILE32 hf = FILE_DupUnixHandle( fd );
selfloadheader = (SELFLOADHEADER *)
PTR_SEG_OFF_TO_LIN(pSegTable->selector,0);
@ -89,7 +89,7 @@ BOOL NE_LoadSegment( HMODULE16 hModule, WORD segnum )
stack16Top->cs = 0;
newselector = CallTo16_word_www( selfloadheader->LoadAppSeg,
hModule, hf, segnum );
_lclose( hf );
_lclose32( hf );
if (newselector != oldselector) {
/* Self loaders like creating their own selectors;
* they love asking for trouble to Wine developers

View File

@ -234,7 +234,7 @@ HGLOBAL16 NE_AllocResource( HMODULE16 hModule, HRSRC16 hRsrc, DWORD size )
int NE_AccessResource( HMODULE16 hModule, HRSRC16 hRsrc )
{
NE_NAMEINFO *pNameInfo=NULL;
int fd;
HFILE32 fd;
NE_MODULE *pModule = MODULE_GetPtr( hModule );
if (!pModule || !pModule->res_table) return -1;
@ -242,10 +242,10 @@ int NE_AccessResource( HMODULE16 hModule, HRSRC16 hRsrc )
pNameInfo = (NE_NAMEINFO*)((char*)pModule + hRsrc);
#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);
_llseek( fd, (int)pNameInfo->offset << sizeShift, SEEK_SET );
_llseek32( fd, (int)pNameInfo->offset << sizeShift, SEEK_SET );
}
return fd;
}

View File

@ -28,7 +28,6 @@
#include "global.h"
#include "task.h"
#include "ldt.h"
#include "registers.h"
#include "stddebug.h"
#include "debug.h"
#include "debugger.h"
@ -419,7 +418,8 @@ problem needs to be fixed properly at some stage */
load_addr = pe->load_addr = (int)xmalloc(pe->vma_size);
dprintf_win32(stddeb, "Load addr is really %x, range %x\n",
pe->load_addr, pe->vma_size);
memset( (void *)load_addr, 0, pe->vma_size);
for(i=0; i < pe->pe_header->coff.NumberOfSections; i++)
{
@ -575,7 +575,6 @@ problem needs to be fixed properly at some stage */
}
HINSTANCE16 MODULE_CreateInstance(HMODULE16 hModule,LOADPARAMS *params);
void InitTask( SIGCONTEXT *context );
HINSTANCE16 PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params )
{
@ -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)
{
NE_MODULE *pModule;

View File

@ -22,9 +22,8 @@
#endif
#include "debugger.h"
#include "miscemu.h"
#include "options.h"
#include "registers.h"
#include "sigcontext.h"
#include "win.h"
#include "winsock.h"
@ -51,6 +50,7 @@ wine_sigaction(int sig,struct sigaction * new, struct sigaction * old)
}
#endif
extern BOOL32 INSTR_EmulateInstruction( SIGCONTEXT *context );
/**********************************************************************
* wine_timer
@ -139,17 +139,17 @@ static void SIGNAL_fault(int signal, void *siginfo, SIGCONTEXT *context)
static void SIGNAL_fault(int signal, int code, SIGCONTEXT *context)
{
#endif
if (CS_reg(context) == WINE_CODE_SELECTOR)
if (CS_sig(context) == WINE_CODE_SELECTOR)
{
fprintf( stderr, "Segmentation fault in Wine program (%x:%lx)."
" Please debug.\n",
CS_reg(context), EIP_reg(context) );
CS_sig(context), EIP_sig(context) );
}
else
{
if (INSTR_EmulateInstruction( context )) return;
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 );
}

View File

@ -11,10 +11,8 @@
#include "windows.h"
#include "task.h"
#include "callback.h"
#include "directory.h"
#include "dos_fs.h"
#include "file.h"
#include "debugger.h"
#include "global.h"
#include "instance.h"
#include "message.h"
@ -24,19 +22,24 @@
#include "options.h"
#include "peexe.h"
#include "pe_image.h"
#include "process.h"
#include "queue.h"
#include "selectors.h"
#include "stackframe.h"
#include "thread.h"
#include "toolhelp.h"
#include "winnt.h"
#include "stddebug.h"
#include "debug.h"
#include "dde_proc.h"
#ifndef WINELIB
#include "debugger.h"
#endif
/* Min. number of thunks allocated when creating a new segment */
#define MIN_THUNKS 32
/* 32-bit stack size for each task */
#define STACK32_SIZE 0x10000
extern void USER_AppExit( HTASK16, HINSTANCE16, HQUEUE16 );
/* Saved 16-bit stack for current process (Win16 only) */
@ -45,7 +48,6 @@ WORD IF1632_Saved16_sp = 0;
/* Saved 32-bit stack for current process (Win16 only) */
DWORD IF1632_Saved32_esp = 0;
SEGPTR IF1632_Stack32_base = 0;
/* Original Unix stack */
DWORD IF1632_Original32_esp;
@ -279,7 +281,6 @@ static void TASK_CreateThunks( HGLOBAL16 handle, WORD offset, WORD count )
*
* Allocate a thunk for MakeProcInstance().
*/
#ifndef WINELIB32
static SEGPTR TASK_AllocThunk( HTASK16 hTask )
{
TDB *pTask;
@ -308,7 +309,6 @@ static SEGPTR TASK_AllocThunk( HTASK16 hTask )
pThunk->free = *(WORD *)((BYTE *)pThunk + pThunk->free);
return PTR_SEG_OFF_TO_SEGPTR( sel, base );
}
#endif
/***********************************************************************
@ -316,7 +316,6 @@ static SEGPTR TASK_AllocThunk( HTASK16 hTask )
*
* Free a MakeProcInstance() thunk.
*/
#ifndef WINELIB32
static BOOL TASK_FreeThunk( HTASK16 hTask, SEGPTR thunk )
{
TDB *pTask;
@ -338,7 +337,6 @@ static BOOL TASK_FreeThunk( HTASK16 hTask, SEGPTR thunk )
pThunk->free = LOWORD(thunk) - base;
return TRUE;
}
#endif
/***********************************************************************
@ -350,7 +348,7 @@ static BOOL TASK_FreeThunk( HTASK16 hTask, SEGPTR thunk )
#ifndef WINELIB
static void TASK_CallToStart(void)
{
int cs_reg, ds_reg, fs_reg, ip_reg;
int cs_reg, ds_reg, ip_reg;
int exit_code = 1;
TDB *pTask = (TDB *)GlobalLock16( hCurrentTask );
NE_MODULE *pModule = MODULE_GetPtr( pTask->hModule );
@ -363,15 +361,12 @@ static void TASK_CallToStart(void)
{
/* FIXME: all this is an ugly hack */
extern void PE_InitTEB( int hTEB );
extern void InitTask( SIGCONTEXT *context );
extern void InitTask( CONTEXT *context );
extern void PE_InitializeDLLs( HMODULE16 hModule );
InitTask( NULL );
InitApp( pTask->hModule );
fs_reg = (int)GlobalAlloc16( GMEM_FIXED | GMEM_ZEROINIT, 0x10000 );
PE_InitTEB( fs_reg );
__asm__ __volatile__("movw %w0,%%fs"::"r" (fs_reg));
__asm__ __volatile__("movw %w0,%%fs"::"r" (pCurrentThread->teb_sel));
PE_InitializeDLLs( pTask->hModule );
exit_code = CallTaskStart32((FARPROC32)(pModule->pe_module->load_addr +
pModule->pe_module->pe_header->opt_coff.AddressOfEntryPoint) );
@ -421,6 +416,7 @@ HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance,
{
HTASK16 hTask;
TDB *pTask;
PDB32 *pdb32;
HGLOBAL16 hParentEnv;
NE_MODULE *pModule;
SEGTABLEENTRY *pSegTable;
@ -505,10 +501,10 @@ HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance,
pTask->pdb.dispatcher[0] = 0x9a; /* ljmp */
#ifndef WINELIB
*(FARPROC16 *)&pTask->pdb.dispatcher[1] = MODULE_GetEntryPoint( GetModuleHandle("KERNEL"), 102 ); /* KERNEL.102 is DOS3Call() */
#endif
pTask->pdb.savedint22 = INT_GetHandler( 0x22 );
pTask->pdb.savedint23 = INT_GetHandler( 0x23 );
pTask->pdb.savedint24 = INT_GetHandler( 0x24 );
#endif
pTask->pdb.fileHandlesPtr =
PTR_SEG_OFF_TO_SEGPTR( GlobalHandleToSel(pTask->hPDB),
(int)&((PDB *)0)->fileHandles );
@ -537,15 +533,14 @@ HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance,
pTask->dta = PTR_SEG_OFF_TO_SEGPTR( pTask->hPDB,
(int)&pTask->pdb.cmdLine - (int)&pTask->pdb );
/* Allocate the 32-bit stack */
/* Create the Win32 part of the task */
pTask->hStack32 = GLOBAL_Alloc( GMEM_FIXED, STACK32_SIZE, pTask->hPDB,
FALSE, FALSE, FALSE );
pdb32 = PROCESS_Create();
pTask->thdb = THREAD_Create( pdb32, 0 );
/* Create the 32-bit stack frame */
/* Create the 32-bit stack frame */
*(DWORD *)GlobalLock16(pTask->hStack32) = 0xDEADBEEF;
stack32Top = (char*)GlobalLock16(pTask->hStack32) + STACK32_SIZE;
stack32Top = (char*)pTask->thdb->teb.stack_top;
frame32 = (STACK32FRAME *)stack32Top - 1;
frame32->saved_esp = (DWORD)stack32Top;
frame32->edi = 0;
@ -633,14 +628,15 @@ static void TASK_DeleteTask( HTASK16 hTask )
if (!(pTask = (TDB *)GlobalLock16( hTask ))) return;
hPDB = pTask->hPDB;
/* Delete the Win32 part of the task */
PROCESS_Destroy( &pTask->thdb->process->header );
THREAD_Destroy( &pTask->thdb->header );
/* Free the task module */
FreeModule16( pTask->hModule );
/* Close all open files of this task */
FILE_CloseAllFiles( pTask->hPDB );
/* Free the selector aliases */
GLOBAL_FreeBlock( pTask->hCSAlias );
@ -667,10 +663,10 @@ static void TASK_DeleteTask( HTASK16 hTask )
*/
void TASK_KillCurrentTask( INT16 exitCode )
{
extern void EXEC_ExitWindows( int retCode );
extern void EXEC_ExitWindows(void);
TDB* pTask = (TDB*) GlobalLock16( hCurrentTask );
if (!pTask) EXEC_ExitWindows(0); /* No current task yet */
if (!pTask) EXEC_ExitWindows(); /* No current task yet */
/* Perform USER cleanup */
@ -686,7 +682,7 @@ void TASK_KillCurrentTask( INT16 exitCode )
if (nTaskCount <= 1)
{
dprintf_task( stddeb, "Killing the last task, exiting\n" );
EXEC_ExitWindows( 0 );
EXEC_ExitWindows();
}
/* Remove the task from the list to be sure we never switch back to it */
@ -713,29 +709,6 @@ void TASK_KillCurrentTask( INT16 exitCode )
exit(1);
}
/***********************************************************************
* TASK_YieldToSystem
*
* Scheduler interface, this way we ensure that all "unsafe" events are
* processed outside the scheduler.
*/
void TASK_YieldToSystem(TDB* pTask)
{
MESSAGEQUEUE* pQ;
TASK_SCHEDULE();
if( pTask )
{
pQ = (MESSAGEQUEUE*)GlobalLock16(pTask->hQueue);
if( pQ && pQ->flags & QUEUE_FLAG_XEVENT )
{
pQ->flags &= ~QUEUE_FLAG_XEVENT;
EVENT_WaitXEvent( FALSE, FALSE );
}
}
}
/***********************************************************************
* TASK_Reschedule
*
@ -830,21 +803,42 @@ void TASK_Reschedule(void)
/* Switch to the new stack */
hCurrentTask = hTask;
pCurrentThread = pNewTask->thdb;
pCurrentProcess = pCurrentThread->process;
IF1632_Saved16_ss = pNewTask->ss;
IF1632_Saved16_sp = pNewTask->sp;
IF1632_Saved32_esp = pNewTask->esp;
IF1632_Stack32_base = WIN16_GlobalLock16( pNewTask->hStack32 );
}
/***********************************************************************
* TASK_YieldToSystem
*
* Scheduler interface, this way we ensure that all "unsafe" events are
* processed outside the scheduler.
*/
void TASK_YieldToSystem(TDB* pTask)
{
MESSAGEQUEUE* pQ;
TASK_SCHEDULE();
if( pTask )
{
pQ = (MESSAGEQUEUE*)GlobalLock16(pTask->hQueue);
if( pQ && pQ->flags & QUEUE_FLAG_XEVENT )
{
pQ->flags &= ~QUEUE_FLAG_XEVENT;
EVENT_WaitXEvent( FALSE, FALSE );
}
}
}
/***********************************************************************
* InitTask (KERNEL.91)
*/
#ifdef WINELIB
void InitTask(void)
#else
void InitTask( SIGCONTEXT *context )
#endif
void InitTask( CONTEXT *context )
{
TDB *pTask;
NE_MODULE *pModule;
@ -852,14 +846,13 @@ void InitTask( SIGCONTEXT *context )
INSTANCEDATA *pinstance;
LONG stacklow, stackhi;
#ifndef WINELIB
if (context) EAX_reg(context) = 0;
#endif
if (!(pTask = (TDB *)GlobalLock16( hCurrentTask ))) return;
if (!(pModule = MODULE_GetPtr( pTask->hModule ))) return;
#ifndef WINELIB
NE_InitializeDLLs( pTask->hModule );
#endif
if (context)
{
@ -885,7 +878,6 @@ void InitTask( SIGCONTEXT *context )
{
LocalInit( pTask->hInstance, 0, pModule->heap_size );
}
#endif
/* Initialize the INSTANCEDATA structure */
pSegTable = NE_SEG_TABLE( pModule );
@ -1039,12 +1031,10 @@ void Yield(void)
*/
FARPROC16 MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
{
#ifdef WINELIB
return func; /* func can be called directly in Winelib */
#else
BYTE *thunk;
SEGPTR thunkaddr;
if (__winelib) return func; /* func can be called directly in Winelib */
thunkaddr = TASK_AllocThunk( hCurrentTask );
if (!thunkaddr) return (FARPROC16)0;
thunk = PTR_SEG_TO_LIN( thunkaddr );
@ -1058,7 +1048,6 @@ FARPROC16 MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
*thunk++ = 0xea; /* ljmp func */
*(DWORD *)thunk = (DWORD)func;
return (FARPROC16)thunkaddr;
#endif
}
@ -1067,10 +1056,8 @@ FARPROC16 MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
*/
void FreeProcInstance16( FARPROC16 func )
{
#ifndef WINELIB
dprintf_task( stddeb, "FreeProcInstance(%08lx)\n", (DWORD)func );
TASK_FreeThunk( hCurrentTask, (SEGPTR)func );
#endif
if (!__winelib) TASK_FreeThunk( hCurrentTask, (SEGPTR)func );
}
@ -1079,10 +1066,11 @@ void FreeProcInstance16( FARPROC16 func )
*/
HANDLE16 GetCodeHandle( FARPROC16 proc )
{
#ifndef WINELIB32
HANDLE16 handle;
BYTE *thunk = (BYTE *)PTR_SEG_TO_LIN( proc );
if (__winelib) return 0;
/* Return the code segment containing 'proc'. */
/* Not sure if this is really correct (shouldn't matter that much). */
@ -1093,9 +1081,6 @@ HANDLE16 GetCodeHandle( FARPROC16 proc )
handle = GlobalHandle16( HIWORD(proc) );
return handle;
#else
return (HANDLE16)proc;
#endif
}
@ -1174,7 +1159,7 @@ void SwitchStackTo( WORD seg, WORD ptr, WORD top )
*
* Note: the function is declared as 'register' in the spec file in order
* to make sure all registers are preserved, but we don't use them in any
* way, so we don't need a SIGCONTEXT* argument.
* way, so we don't need a CONTEXT* argument.
*/
void SwitchStackBack(void)
{
@ -1217,7 +1202,7 @@ void SwitchStackBack(void)
* GetTaskQueueDS (KERNEL.118)
*/
#ifndef WINELIB
void GetTaskQueueDS( SIGCONTEXT *context )
void GetTaskQueueDS( CONTEXT *context )
{
DS_reg(context) = GlobalHandleToSel( GetTaskQueue(0) );
}
@ -1228,7 +1213,7 @@ void GetTaskQueueDS( SIGCONTEXT *context )
* GetTaskQueueES (KERNEL.119)
*/
#ifndef WINELIB
void GetTaskQueueES( SIGCONTEXT *context )
void GetTaskQueueES( CONTEXT *context )
{
ES_reg(context) = GlobalHandleToSel( GetTaskQueue(0) );
}

View File

@ -4,11 +4,11 @@
* Copyright 1996 Alexandre Julliard
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "windows.h"
#include "debugger.h"
#include "selectors.h"
#include "winbase.h"
#include "winerror.h"
@ -187,7 +187,7 @@ static HEAP *HEAP_GetPtr( HANDLE32 heap )
if (debugging_heap && !HeapValidate( heap, 0, NULL ))
{
HEAP_Dump( heapPtr );
DEBUG_EnterDebugger();
assert( FALSE );
SetLastError( ERROR_INVALID_HANDLE );
return NULL;
}
@ -1203,13 +1203,29 @@ 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
*/
LPSTR HEAP_strdupA( HANDLE32 heap, DWORD flags, LPCSTR str )
{
INT32 len = lstrlen32A(str) + 1;
LPSTR p = HeapAlloc( heap, flags, len );
LPSTR p = HEAP_xalloc( heap, flags, lstrlen32A(str) + 1 );
lstrcpy32A( p, str );
return p;
}
@ -1221,7 +1237,7 @@ LPSTR HEAP_strdupA( HANDLE32 heap, DWORD flags, LPCSTR str )
LPWSTR HEAP_strdupW( HANDLE32 heap, DWORD flags, LPCWSTR str )
{
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 );
return p;
}
@ -1235,11 +1251,7 @@ LPWSTR HEAP_strdupAtoW( HANDLE32 heap, DWORD flags, LPCSTR str )
LPWSTR ret;
if (!str) return NULL;
if (!(ret = HeapAlloc( heap, flags, (lstrlen32A(str)+1) * sizeof(WCHAR) )))
{
fprintf( stderr, "Virtual memory exhausted.\n" );
exit(1);
}
ret = HEAP_xalloc( heap, flags, (lstrlen32A(str)+1) * sizeof(WCHAR) );
lstrcpyAtoW( ret, str );
return ret;
}
@ -1253,11 +1265,7 @@ LPSTR HEAP_strdupWtoA( HANDLE32 heap, DWORD flags, LPCWSTR str )
LPSTR ret;
if (!str) return NULL;
if (!(ret = HeapAlloc( heap, flags, lstrlen32W(str) + 1 )))
{
fprintf( stderr, "Virtual memory exhausted.\n" );
exit(1);
}
ret = HEAP_xalloc( heap, flags, lstrlen32W(str) + 1 );
lstrcpyWtoA( ret, str );
return ret;
}

View File

@ -271,14 +271,11 @@ DWORD GetSelectorBase( WORD sel )
base = GET_SEL_BASE(sel);
#ifndef WINELIB
/* if base points into DOSMEM, assume we have to
* return pointer into physical lower 1MB
*/
if ((base >= (DWORD)DOSMEM_dosmem) &&
(base < ((DWORD)DOSMEM_dosmem+0x100000)))
base = base - (DWORD)DOSMEM_dosmem;
#endif
if ((base >= (DWORD)DOSMEM_dosmem) &&
(base < (DWORD)DOSMEM_dosmem+0x100000)) base -= (DWORD)DOSMEM_dosmem;
return base;
}

View File

@ -11,6 +11,7 @@ C_SRCS = \
commdlg.c \
compobj.c \
crtdll.c \
cpu.c \
driver.c \
exec.c \
escape.c \

View File

@ -739,7 +739,7 @@ UINT16 *SetCommEventMask(INT16 fd,UINT16 fuEvtMask)
{
dprintf_comm(stddeb,"SetCommEventMask:fd %d,mask %d\n",fd,fuEvtMask);
eventmask |= fuEvtMask;
return (UINT *)&eventmask; /* FIXME, should be SEGPTR */
return (UINT16 *)&eventmask; /* FIXME, should be SEGPTR */
}
/*****************************************************************************

View File

@ -12,6 +12,7 @@
#include "heap.h"
#include "message.h"
#include "commdlg.h"
#include "dialog.h"
#include "dlgs.h"
#include "module.h"
#include "resource.h"
@ -59,13 +60,22 @@ static BOOL FileDlg_Init()
BOOL GetOpenFileName( SEGPTR ofn )
{
HINSTANCE16 hInst;
HANDLE16 hDlgTmpl, hResInfo;
BOOL bRet;
HANDLE16 hDlgTmpl = 0, hResInfo;
BOOL32 bRet = FALSE, win32Format = FALSE;
HWND32 hwndDialog;
LPOPENFILENAME lpofn = (LPOPENFILENAME)PTR_SEG_TO_LIN(ofn);
LPCVOID template;
if (!lpofn || !FileDlg_Init()) return FALSE;
if (lpofn->Flags & OFN_ENABLETEMPLATEHANDLE) hDlgTmpl = lpofn->hInstance;
if (lpofn->Flags & OFN_ENABLETEMPLATEHANDLE)
{
if (!(template = LockResource16( lpofn->hInstance )))
{
CommDlgLastError = CDERR_LOADRESFAILURE;
return FALSE;
}
}
else if (lpofn->Flags & OFN_ENABLETEMPLATE)
{
if (!(hResInfo = FindResource16(lpofn->hInstance,
@ -74,25 +84,27 @@ BOOL GetOpenFileName( SEGPTR ofn )
CommDlgLastError = CDERR_FINDRESFAILURE;
return FALSE;
}
hDlgTmpl = LoadResource16( lpofn->hInstance, hResInfo );
if (!(hDlgTmpl = LoadResource16( lpofn->hInstance, hResInfo )) ||
!(template = LockResource16( hDlgTmpl )))
{
CommDlgLastError = CDERR_LOADRESFAILURE;
return FALSE;
}
}
else hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_OPEN_FILE );
if (!hDlgTmpl)
else
{
CommDlgLastError = CDERR_LOADRESFAILURE;
return FALSE;
template = SYSRES_GetResPtr( SYSRES_DIALOG_OPEN_FILE );
win32Format = TRUE;
}
hInst = WIN_GetWindowInstance( lpofn->hwndOwner );
bRet = DialogBoxIndirectParam16( hInst, hDlgTmpl, lpofn->hwndOwner,
(DLGPROC16)MODULE_GetWndProcEntry16("FileOpenDlgProc"),
ofn );
hwndDialog = DIALOG_CreateIndirect( hInst, template, win32Format,
lpofn->hwndOwner,
(DLGPROC16)MODULE_GetWndProcEntry16("FileOpenDlgProc"),
ofn, WIN_PROC_16 );
if (hwndDialog) bRet = DIALOG_DoDialogBox( hwndDialog, lpofn->hwndOwner );
if (!(lpofn->Flags & OFN_ENABLETEMPLATEHANDLE))
{
if (lpofn->Flags & OFN_ENABLETEMPLATE) FreeResource16( hDlgTmpl );
else SYSRES_FreeResource( hDlgTmpl );
}
if (hDlgTmpl) FreeResource16( hDlgTmpl );
dprintf_commdlg(stddeb,"GetOpenFileName // return lpstrFile='%s' !\n",
(LPSTR)PTR_SEG_TO_LIN(lpofn->lpstrFile));
@ -106,35 +118,53 @@ BOOL GetOpenFileName( SEGPTR ofn )
BOOL GetSaveFileName( SEGPTR ofn)
{
HINSTANCE16 hInst;
HANDLE16 hDlgTmpl, hResInfo;
BOOL bRet;
HANDLE16 hDlgTmpl = 0;
BOOL32 bRet = FALSE, win32Format = FALSE;
LPOPENFILENAME lpofn = (LPOPENFILENAME)PTR_SEG_TO_LIN(ofn);
LPCVOID template;
HWND32 hwndDialog;
if (!lpofn || !FileDlg_Init()) return FALSE;
if (lpofn->Flags & OFN_ENABLETEMPLATEHANDLE) hDlgTmpl = lpofn->hInstance;
if (lpofn->Flags & OFN_ENABLETEMPLATEHANDLE)
{
if (!(template = LockResource16( lpofn->hInstance )))
{
CommDlgLastError = CDERR_LOADRESFAILURE;
return FALSE;
}
}
else if (lpofn->Flags & OFN_ENABLETEMPLATE)
{
hInst = lpofn->hInstance;
HANDLE16 hResInfo;
if (!(hResInfo = FindResource16(lpofn->hInstance,
lpofn->lpTemplateName, RT_DIALOG )))
lpofn->lpTemplateName, RT_DIALOG)))
{
CommDlgLastError = CDERR_FINDRESFAILURE;
return FALSE;
}
hDlgTmpl = LoadResource16( lpofn->hInstance, hResInfo );
if (!(hDlgTmpl = LoadResource16( lpofn->hInstance, hResInfo )) ||
!(template = LockResource16( hDlgTmpl )))
{
CommDlgLastError = CDERR_LOADRESFAILURE;
return FALSE;
}
}
else
{
template = SYSRES_GetResPtr( SYSRES_DIALOG_SAVE_FILE );
win32Format = TRUE;
}
else hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_SAVE_FILE );
hInst = WIN_GetWindowInstance( lpofn->hwndOwner );
bRet = DialogBoxIndirectParam16( hInst, hDlgTmpl, lpofn->hwndOwner,
(DLGPROC16)MODULE_GetWndProcEntry16("FileSaveDlgProc"),
ofn );
if (!(lpofn->Flags & OFN_ENABLETEMPLATEHANDLE))
{
if (lpofn->Flags & OFN_ENABLETEMPLATE) FreeResource16( hDlgTmpl );
else SYSRES_FreeResource( hDlgTmpl );
}
hwndDialog = DIALOG_CreateIndirect( hInst, template, win32Format,
lpofn->hwndOwner,
(DLGPROC16)MODULE_GetWndProcEntry16("FileSaveDlgProc"),
ofn, WIN_PROC_16 );
if (hwndDialog) bRet = DIALOG_DoDialogBox( hwndDialog, lpofn->hwndOwner );
if (hDlgTmpl) FreeResource16( hDlgTmpl );
dprintf_commdlg(stddeb, "GetSaveFileName // return lpstrFile='%s' !\n",
(LPSTR)PTR_SEG_TO_LIN(lpofn->lpstrFile));
@ -693,10 +723,9 @@ LRESULT FileSaveDlgProc(HWND hWnd, UINT wMsg, WPARAM16 wParam, LPARAM lParam)
/***********************************************************************
* FindTextDlg (COMMDLG.11)
*/
BOOL FindText( SEGPTR find )
HWND16 FindText( SEGPTR find )
{
HANDLE16 hInst, hDlgTmpl;
BOOL bRet;
HANDLE16 hInst;
LPCVOID ptr;
LPFINDREPLACE lpFind = (LPFINDREPLACE)PTR_SEG_TO_LIN(find);
@ -708,25 +737,20 @@ BOOL FindText( SEGPTR find )
* FIXME : We should do error checking on the lpFind structure here
* and make CommDlgExtendedError() return the error condition.
*/
hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_FIND_TEXT );
ptr = SYSRES_GetResPtr( SYSRES_DIALOG_FIND_TEXT );
hInst = WIN_GetWindowInstance( lpFind->hwndOwner );
if (!(ptr = GlobalLock16( hDlgTmpl ))) return -1;
bRet = CreateDialogIndirectParam16( hInst, ptr, lpFind->hwndOwner,
return DIALOG_CreateIndirect( hInst, ptr, TRUE, lpFind->hwndOwner,
(DLGPROC16)MODULE_GetWndProcEntry16("FindTextDlgProc"),
find );
GlobalUnlock16( hDlgTmpl );
SYSRES_FreeResource( hDlgTmpl );
return bRet;
find, WIN_PROC_16 );
}
/***********************************************************************
* ReplaceTextDlg (COMMDLG.12)
* ReplaceText (COMMDLG.12)
*/
BOOL ReplaceText( SEGPTR find )
HWND16 ReplaceText( SEGPTR find )
{
HANDLE16 hInst, hDlgTmpl;
BOOL bRet;
HANDLE16 hInst;
LPCVOID ptr;
LPFINDREPLACE lpFind = (LPFINDREPLACE)PTR_SEG_TO_LIN(find);
@ -738,15 +762,11 @@ BOOL ReplaceText( SEGPTR find )
* FIXME : We should do error checking on the lpFind structure here
* and make CommDlgExtendedError() return the error condition.
*/
hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_REPLACE_TEXT );
ptr = SYSRES_GetResPtr( SYSRES_DIALOG_REPLACE_TEXT );
hInst = WIN_GetWindowInstance( lpFind->hwndOwner );
if (!(ptr = GlobalLock16( hDlgTmpl ))) return -1;
bRet = CreateDialogIndirectParam16( hInst, ptr, lpFind->hwndOwner,
return DIALOG_CreateIndirect( hInst, ptr, TRUE, lpFind->hwndOwner,
(DLGPROC16)MODULE_GetWndProcEntry16("ReplaceTextDlgProc"),
find );
GlobalUnlock16( hDlgTmpl );
SYSRES_FreeResource( hDlgTmpl );
return bRet;
find, WIN_PROC_16 );
}
@ -978,8 +998,10 @@ LRESULT ReplaceTextDlgProc(HWND hWnd, UINT wMsg, WPARAM16 wParam, LPARAM lParam)
*/
BOOL PrintDlg( SEGPTR printdlg )
{
HANDLE16 hInst, hDlgTmpl;
BOOL bRet;
HANDLE16 hInst;
BOOL bRet = FALSE;
LPCVOID template;
HWND32 hwndDialog;
LPPRINTDLG lpPrint = (LPPRINTDLG)PTR_SEG_TO_LIN(printdlg);
dprintf_commdlg(stddeb,"PrintDlg(%p) // Flags=%08lX\n", lpPrint, lpPrint->Flags );
@ -989,17 +1011,18 @@ BOOL PrintDlg( SEGPTR printdlg )
return TRUE;
if (lpPrint->Flags & PD_PRINTSETUP)
hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_PRINT_SETUP );
template = SYSRES_GetResPtr( SYSRES_DIALOG_PRINT_SETUP );
else
hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_PRINT );
template = SYSRES_GetResPtr( SYSRES_DIALOG_PRINT );
hInst = WIN_GetWindowInstance( lpPrint->hwndOwner );
bRet = DialogBoxIndirectParam16( hInst, hDlgTmpl, lpPrint->hwndOwner,
hwndDialog = DIALOG_CreateIndirect( hInst, template, TRUE,
lpPrint->hwndOwner,
(DLGPROC16)((lpPrint->Flags & PD_PRINTSETUP) ?
MODULE_GetWndProcEntry16("PrintSetupDlgProc") :
MODULE_GetWndProcEntry16("PrintDlgProc")),
printdlg );
SYSRES_FreeResource( hDlgTmpl );
printdlg, WIN_PROC_16 );
if (hwndDialog) bRet = DIALOG_DoDialogBox( hwndDialog, lpPrint->hwndOwner);
return bRet;
}
@ -1108,37 +1131,51 @@ short GetFileTitle(LPCSTR lpFile, LPSTR lpTitle, UINT cbBuf)
BOOL ChooseColor(LPCHOOSECOLOR lpChCol)
{
HINSTANCE16 hInst;
HANDLE16 hDlgTmpl, hResInfo;
BOOL bRet;
HANDLE16 hDlgTmpl = 0;
BOOL bRet = FALSE, win32Format = FALSE;
LPCVOID template;
HWND32 hwndDialog;
dprintf_commdlg(stddeb,"ChooseColor\n");
if (!lpChCol) return FALSE;
if (lpChCol->Flags & CC_ENABLETEMPLATEHANDLE) hDlgTmpl = lpChCol->hInstance;
if (lpChCol->Flags & CC_ENABLETEMPLATEHANDLE)
{
if (!(template = LockResource16( lpChCol->hInstance )))
{
CommDlgLastError = CDERR_LOADRESFAILURE;
return FALSE;
}
}
else if (lpChCol->Flags & CC_ENABLETEMPLATE)
{
HANDLE16 hResInfo;
if (!(hResInfo = FindResource16(lpChCol->hInstance,
lpChCol->lpTemplateName, RT_DIALOG)))
{
CommDlgLastError = CDERR_FINDRESFAILURE;
return FALSE;
}
hDlgTmpl = LoadResource16( lpChCol->hInstance, hResInfo );
if (!(hDlgTmpl = LoadResource16( lpChCol->hInstance, hResInfo )) ||
!(template = LockResource16( hDlgTmpl )))
{
CommDlgLastError = CDERR_LOADRESFAILURE;
return FALSE;
}
}
else hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_CHOOSE_COLOR );
if (!hDlgTmpl)
else
{
CommDlgLastError = CDERR_LOADRESFAILURE;
return FALSE;
template = SYSRES_GetResPtr( SYSRES_DIALOG_CHOOSE_COLOR );
win32Format = TRUE;
}
hInst = WIN_GetWindowInstance( lpChCol->hwndOwner );
bRet = DialogBoxIndirectParam16( hInst, hDlgTmpl, lpChCol->hwndOwner,
hwndDialog = DIALOG_CreateIndirect( hInst, template, win32Format,
lpChCol->hwndOwner,
(DLGPROC16)MODULE_GetWndProcEntry16("ColorDlgProc"),
(DWORD)lpChCol);
if (!(lpChCol->Flags & CC_ENABLETEMPLATEHANDLE))
{
if (lpChCol->Flags & CC_ENABLETEMPLATE) FreeResource16( hDlgTmpl );
else SYSRES_FreeResource( hDlgTmpl );
}
(DWORD)lpChCol, WIN_PROC_16 );
if (hwndDialog) bRet = DIALOG_DoDialogBox( hwndDialog, lpChCol->hwndOwner);
if (hDlgTmpl) FreeResource16( hDlgTmpl );
return bRet;
}
@ -2189,37 +2226,52 @@ LRESULT ColorDlgProc(HWND hDlg, UINT message,
BOOL ChooseFont(LPCHOOSEFONT lpChFont)
{
HINSTANCE16 hInst;
HANDLE16 hDlgTmpl, hResInfo;
BOOL bRet;
HANDLE16 hDlgTmpl = 0;
BOOL bRet = FALSE, win32Format = FALSE;
LPCVOID template;
HWND32 hwndDialog;
dprintf_commdlg(stddeb,"ChooseFont\n");
if (!lpChFont) return FALSE;
if (lpChFont->Flags & CF_ENABLETEMPLATEHANDLE) hDlgTmpl = lpChFont->hInstance;
if (lpChFont->Flags & CF_ENABLETEMPLATEHANDLE)
{
if (!(template = LockResource16( lpChFont->hInstance )))
{
CommDlgLastError = CDERR_LOADRESFAILURE;
return FALSE;
}
}
else if (lpChFont->Flags & CF_ENABLETEMPLATE)
{
if (!(hResInfo = FindResource16(lpChFont->hInstance,
lpChFont->lpTemplateName, RT_DIALOG)))
HANDLE16 hResInfo;
if (!(hResInfo = FindResource16( lpChFont->hInstance,
lpChFont->lpTemplateName, RT_DIALOG)))
{
CommDlgLastError = CDERR_FINDRESFAILURE;
return FALSE;
}
hDlgTmpl = LoadResource16( lpChFont->hInstance, hResInfo );
if (!(hDlgTmpl = LoadResource16( lpChFont->hInstance, hResInfo )) ||
!(template = LockResource16( hDlgTmpl )))
{
CommDlgLastError = CDERR_LOADRESFAILURE;
return FALSE;
}
}
else hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_CHOOSE_FONT );
if (!hDlgTmpl)
else
{
CommDlgLastError = CDERR_LOADRESFAILURE;
return FALSE;
template = SYSRES_GetResPtr( SYSRES_DIALOG_CHOOSE_FONT );
win32Format = TRUE;
}
hInst = WIN_GetWindowInstance( lpChFont->hwndOwner );
bRet = DialogBoxIndirectParam16( hInst, hDlgTmpl, lpChFont->hwndOwner,
hwndDialog = DIALOG_CreateIndirect( hInst, template, win32Format,
lpChFont->hwndOwner,
(DLGPROC16)MODULE_GetWndProcEntry16("FormatCharDlgProc"),
(DWORD)lpChFont);
if (!(lpChFont->Flags & CF_ENABLETEMPLATEHANDLE))
{
if (lpChFont->Flags & CF_ENABLETEMPLATE) FreeResource16( hDlgTmpl );
else SYSRES_FreeResource( hDlgTmpl );
}
(DWORD)lpChFont, WIN_PROC_16 );
if (hwndDialog) bRet = DIALOG_DoDialogBox(hwndDialog, lpChFont->hwndOwner);
if (hDlgTmpl) FreeResource16( hDlgTmpl );
return bRet;
}

View File

@ -11,6 +11,9 @@
int runtime_cpu (void)
{
#ifndef __i386__
return 5; /* Might as well pretend to be a Pentium... */
#else /* __i386__ */
static int cache = 0;
#ifdef linux
@ -37,8 +40,8 @@ int runtime_cpu (void)
}
}
return cache;
#else
#endif /* linux */
/* FIXME: how do we do this on other systems? */
return 3;
#endif
#endif /* __i386__ */
}

View File

@ -1,8 +1,8 @@
/*
* Windows Exec & Help
*
*/
* Windows Exec & Help
*/
#define NO_TRANSITION_TYPES /* This file is Win32-clean */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@ -15,21 +15,6 @@
#include "debug.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
@ -38,29 +23,35 @@
* This is the back-end of ExitWindows(), called when all windows
* have agreed to be terminated.
*/
void EXEC_ExitWindows( int retCode )
void EXEC_ExitWindows(void)
{
/* Do the clean-up stuff */
WriteOutProfiles();
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;
BOOL16 result;
BOOL32 result;
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 */
if (!(list = WIN_BuildWinArray( WIN_GetDesktop() ))) return FALSE;
@ -85,24 +76,35 @@ BOOL ExitWindows( DWORD dwReturnCode, WORD wReserved )
}
HeapFree( SystemHeap, 0, list );
if (result) EXEC_ExitWindows( LOWORD(dwReturnCode) );
if (result) EXEC_ExitWindows();
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;
HWND hDest;
HWND32 hDest;
LPWINHELP lpwh;
HGLOBAL16 hwh;
void *data=0;
int size,dsize,nlen;
if (wCommand != HELP_QUIT) /* FIXME */
if(WinExec("winhelp.exe -x",SW_SHOWNORMAL)<=32)
if(WinExec32("winhelp.exe -x",SW_SHOWNORMAL)<=32)
return FALSE;
/* FIXME: Should be directed yield, to let winhelp open the window */
Yield();
@ -131,16 +133,13 @@ BOOL WinHelp(HWND hWnd, LPSTR lpHelpFile, WORD wCommand, DWORD dwData)
case HELP_KEY:
case HELP_PARTIALKEY:
case HELP_COMMAND:
data = PTR_SEG_TO_LIN(dwData);
dsize = strlen(data)+1;
dsize = strlen( (LPSTR)dwData )+1;
break;
case HELP_MULTIKEY:
data = PTR_SEG_TO_LIN(dwData);
dsize = ((LPMULTIKEYHELP)data) -> mkSize;
dsize = ((LPMULTIKEYHELP)dwData)->mkSize;
break;
case HELP_SETWINPOS:
data = PTR_SEG_TO_LIN(dwData);
dsize = ((LPHELPWININFO)data) -> wStructSize;
dsize = ((LPHELPWININFO)dwData)->wStructSize;
break;
default:
fprintf(stderr,"Unknown help command %d\n",wCommand);
@ -160,10 +159,23 @@ BOOL WinHelp(HWND hWnd, LPSTR lpHelpFile, WORD wCommand, DWORD dwData)
strcpy(((char*)lpwh) + sizeof(WINHELP),lpHelpFile);
}
if(dsize) {
memcpy(((char*)lpwh)+sizeof(WINHELP)+nlen,data,dsize);
memcpy(((char*)lpwh)+sizeof(WINHELP)+nlen,(LPSTR)dwData,dsize);
lpwh->ofsData = sizeof(WINHELP)+nlen;
} else
lpwh->ofsData = 0;
GlobalUnlock16(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;
}

View File

@ -12,12 +12,12 @@
#include <ctype.h>
#include "windows.h"
#include "heap.h"
#include "ldt.h"
#include "module.h"
#include "stddebug.h"
#include "debug.h"
#include "xmalloc.h"
#include "string32.h"
#define ToUpper(c) toupper(c)
#define ToLower(c) tolower(c)
@ -173,7 +173,7 @@ SEGPTR AnsiPrev( SEGPTR start, SEGPTR current)
void OutputDebugString( LPCSTR str )
{
char *module;
char *p, *buffer = xmalloc( strlen(str)+1 );
char *p, *buffer = HeapAlloc( GetProcessHeap(), 0, strlen(str)+1 );
/* Remove CRs */
for (p = buffer; *str; str++) if (*str != '\r') *p++ = *str;
*p = '\0';
@ -181,7 +181,7 @@ void OutputDebugString( LPCSTR str )
module = MODULE_GetModuleName( GetExePtr(GetCurrentTask()) );
fprintf( stderr, "OutputDebugString: %s says '%s'\n",
module ? module : "???", buffer );
free( buffer );
HeapFree( GetProcessHeap(), 0, buffer );
}
/***********************************************************************
@ -506,7 +506,7 @@ FormatMessage32A(
fprintf(stdnimp," - line wrapping not supported.\n");
from = NULL;
if (dwFlags & FORMAT_MESSAGE_FROM_STRING)
from = xstrdup((LPSTR)lpSource);
from = HEAP_strdupA( GetProcessHeap(), 0, (LPSTR)lpSource);
if (dwFlags & FORMAT_MESSAGE_FROM_SYSTEM) {
/* gather information from system message tables ... */
fprintf(stdnimp," - FORMAT_MESSAGE_FROM_SYSTEM not implemented.\n");
@ -517,11 +517,11 @@ FormatMessage32A(
dwMessageId &= 0xFFFF;
bufsize=LoadMessage32A(0,dwMessageId,dwLanguageId,NULL,100);
if (bufsize) {
from = (char*)xmalloc(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;
talloced= 100;
*t = 0;
@ -568,12 +568,12 @@ FormatMessage32A(
f++;
if (NULL!=(x=strchr(f,'!'))) {
*x='\0';
fmtstr=(char*)xmalloc(strlen(f)+2);
fmtstr=HeapAlloc(GetProcessHeap(),0,strlen(f)+2);
sprintf(fmtstr,"%%%s",f);
f=x+1;
}
} else
fmtstr=strdup("%s");
fmtstr=HEAP_strdupA(GetProcessHeap(),0,"%s");
if (dwFlags & FORMAT_MESSAGE_ARGUMENT_ARRAY)
argliststart=args+insertnr-1;
else
@ -583,16 +583,16 @@ FormatMessage32A(
argliststart=((DWORD*)&args)+insertnr-1;
if (fmtstr[strlen(fmtstr)]=='s')
sprintfbuf=(char*)xmalloc(strlen((LPSTR)argliststart[0])+1);
sprintfbuf=HeapAlloc(GetProcessHeap(),0,strlen((LPSTR)argliststart[0])+1);
else
sprintfbuf=(char*)xmalloc(100);
sprintfbuf=HeapAlloc(GetProcessHeap(),0,100);
vsprintf(sprintfbuf,fmtstr,argliststart);
x=sprintfbuf;
while (*x) {
ADD_TO_T(*x++);
}
free(sprintfbuf);
free(fmtstr);
HeapFree(GetProcessHeap(),0,sprintfbuf);
HeapFree(GetProcessHeap(),0,fmtstr);
break;
case '0':
nolinefeed=1;
@ -620,8 +620,8 @@ FormatMessage32A(
memcpy(*(LPSTR*)lpBuffer,target,talloced);
} else
strncpy(lpBuffer,target,nSize);
free(target);
if (from) free(from);
HeapFree(GetProcessHeap(),0,target);
if (from) HeapFree(GetProcessHeap(),0,from);
return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ?
strlen(*(LPSTR*)lpBuffer):
strlen(lpBuffer);
@ -689,7 +689,7 @@ FormatMessage32W(
fprintf(stdnimp," - line wrapping not supported.\n");
from = NULL;
if (dwFlags & FORMAT_MESSAGE_FROM_STRING)
from = STRING32_DupUniToAnsi((LPWSTR)lpSource);
from = HEAP_strdupWtoA(GetProcessHeap(),0,(LPWSTR)lpSource);
if (dwFlags & FORMAT_MESSAGE_FROM_SYSTEM) {
/* gather information from system message tables ... */
fprintf(stdnimp," - FORMAT_MESSAGE_FROM_SYSTEM not implemented.\n");
@ -699,12 +699,13 @@ FormatMessage32W(
dwMessageId &= 0xFFFF;
bufsize=LoadMessage32A(0,dwMessageId,dwLanguageId,NULL,100);
if (bufsize) {
from = (char*)xmalloc(bufsize+1);
LoadMessage32A(0,dwMessageId,dwLanguageId,from,bufsize+1);
if (bufsize)
{
from = HeapAlloc( GetProcessHeap(), 0, bufsize + 1 );
LoadMessage32A(0,dwMessageId,dwLanguageId,from,bufsize+1);
}
}
target = (char*)xmalloc(100);
target = HeapAlloc( GetProcessHeap(), 0, 100 );
t = target;
talloced= 100;
*t = 0;
@ -749,14 +750,15 @@ FormatMessage32W(
}
if (*f=='!') {
f++;
if (NULL!=(x=strchr(f,'!'))) {
*x='\0';
fmtstr=(char*)xmalloc(strlen(f)+2);
if (NULL!=(x=strchr(f,'!')))
{
*x='\0';
fmtstr=HeapAlloc( GetProcessHeap(), 0, strlen(f)+2);
sprintf(fmtstr,"%%%s",f);
f=x+1;
}
} else
fmtstr=strdup("%s");
fmtstr=HEAP_strdupA( GetProcessHeap(),0,"%s");
if (dwFlags & FORMAT_MESSAGE_ARGUMENT_ARRAY)
argliststart=args+insertnr-1;
else
@ -768,22 +770,22 @@ FormatMessage32W(
if (fmtstr[strlen(fmtstr)]=='s') {
DWORD xarr[3];
xarr[0]=(DWORD)STRING32_DupUniToAnsi((LPWSTR)(*(argliststart+0)));
xarr[0]=(DWORD)HEAP_strdupWtoA(GetProcessHeap(),0,(LPWSTR)(*(argliststart+0)));
/* possible invalid pointers */
xarr[1]=*(argliststart+1);
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);
} else {
sprintfbuf=(char*)xmalloc(100);
sprintfbuf=HeapAlloc(GetProcessHeap(),0,100);
vsprintf(sprintfbuf,fmtstr,argliststart);
}
x=sprintfbuf;
while (*x) {
ADD_TO_T(*x++);
}
free(sprintfbuf);
free(fmtstr);
HeapFree(GetProcessHeap(),0,sprintfbuf);
HeapFree(GetProcessHeap(),0,fmtstr);
break;
case '0':
nolinefeed=1;
@ -810,8 +812,8 @@ FormatMessage32W(
lstrcpynAtoW(*(LPWSTR*)lpBuffer,target,talloced);
} else
lstrcpynAtoW(lpBuffer,target,nSize);
free(target);
if (from) free(from);
HeapFree(GetProcessHeap(),0,target);
if (from) HeapFree(GetProcessHeap(),0,from);
return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ?
lstrlen32W(*(LPWSTR*)lpBuffer):
lstrlen32W(lpBuffer);

View File

@ -7,6 +7,7 @@
* FIXME: return values might be wrong
*/
#define NO_TRANSITION_TYPES /* This file is Win32-clean */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@ -39,8 +40,8 @@ struct lzfileheader {
static BYTE LZMagic[8]={'S','Z','D','D',0x88,0xf0,0x27,0x33};
static struct lzstate {
HFILE lzfd; /* the handle used by the program */
HFILE realfd; /* the real filedescriptor */
HFILE32 lzfd; /* the handle used by the program */
HFILE32 realfd; /* the real filedescriptor */
CHAR lastchar; /* the last char of the filename */
DWORD reallength; /* the decompressed length of the file */
@ -48,7 +49,7 @@ static struct lzstate {
DWORD realwanted; /* the position the user wants to read from */
BYTE table[0x1000]; /* the rotating LZ table */
UINT curtabent; /* CURrent TABle ENTry */
UINT32 curtabent; /* CURrent TABle ENTry */
BYTE stringlen; /* length and position of current string */
DWORD stringpos; /* from stringtable */
@ -73,8 +74,8 @@ _lzget(struct lzstate *lzs,BYTE *b) {
return 1;
} else {
int ret = _lread32(lzs->realfd,lzs->get,GETLEN);
if (ret==HFILE_ERROR)
return HFILE_ERROR;
if (ret==HFILE_ERROR32)
return HFILE_ERROR32;
if (ret==0)
return 0;
lzs->getlen = ret;
@ -89,11 +90,11 @@ _lzget(struct lzstate *lzs,BYTE *b) {
* return UNKNOWNALG for unknown algorithm
* returns lzfileheader in *head
*/
static INT
read_header(HFILE fd,struct lzfileheader *head) {
static INT32 read_header(HFILE32 fd,struct lzfileheader *head)
{
BYTE buf[14];
if (_llseek(fd,0,SEEK_SET)==-1)
if (_llseek32(fd,0,SEEK_SET)==-1)
return LZERROR_BADINHANDLE;
/* We can't directly read the lzfileheader struct due to
@ -114,18 +115,39 @@ read_header(HFILE fd,struct lzfileheader *head) {
return LZERROR_UNKNOWNALG;
return 1;
}
/*
* LZStart [LZEXPAND.7] [LZ32.6]
/***********************************************************************
* LZStart16 (LZEXPAND.7)
*/
INT16 LZStart(void)
INT16 LZStart16(void)
{
dprintf_file(stddeb,"LZStart(void)\n");
dprintf_file(stddeb,"LZStart16(void)\n");
return 1;
}
/*
* LZInit [LZEXPAND.3] [LZ32.2]
*
/***********************************************************************
* LZStart32 (LZ32.6)
*/
INT32 LZStart32(void)
{
dprintf_file(stddeb,"LZStart32(void)\n");
return 1;
}
/***********************************************************************
* LZInit16 (LZEXPAND.3)
*/
HFILE16 LZInit16( HFILE16 hfSrc )
{
return LZInit32( hfSrc );
}
/***********************************************************************
* LZInit32 (LZ32.2)
*
* initializes internal decompression buffers, returns lzfiledescriptor.
* (return value the same as hfSrc, if hfSrc is not compressed)
* on failure, returns error code <0
@ -135,8 +157,9 @@ INT16 LZStart(void)
* since _llseek uses the same types as libc.lseek, we just use the macros of
* libc
*/
HFILE
LZInit(HFILE hfSrc) {
HFILE32 LZInit32( HFILE32 hfSrc )
{
struct lzfileheader head;
struct lzstate *lzs;
DWORD ret;
@ -144,7 +167,7 @@ LZInit(HFILE hfSrc) {
dprintf_file(stddeb,"LZInit(%d)\n",hfSrc);
ret=read_header(hfSrc,&head);
if (ret<=0) {
_llseek(hfSrc,0,SEEK_SET);
_llseek32(hfSrc,0,SEEK_SET);
return ret?ret:hfSrc;
}
lzstates=xrealloc(lzstates,(++nroflzstates)*sizeof(struct lzstate));
@ -167,17 +190,27 @@ LZInit(HFILE hfSrc) {
return lzs->lzfd;
}
/*
* LZDone [LZEXPAND.9] [LZ32.8]
*/
void
LZDone(void) {
dprintf_file(stddeb,"LZDone()\n");
/***********************************************************************
* LZDone (LZEXPAND.9) (LZ32.8)
*/
void LZDone(void)
{
dprintf_file(stddeb,"LZDone()\n");
}
/*
* GetExpandedName [LZEXPAND.10]
/***********************************************************************
* GetExpandedName16 (LZEXPAND.10)
*/
INT16 GetExpandedName16( LPCSTR in, LPSTR out )
{
return GetExpandedName32A( in, out );
}
/***********************************************************************
* GetExpandedName32A (LZ32.9)
*
* gets the full filename of the compressed file 'in' by opening it
* and reading the header
@ -187,21 +220,21 @@ LZDone(void) {
* "FILE.BL_" (with lastchar 'a') is being translated to "FILE.BLA"
*/
INT16
GetExpandedName16(LPCSTR in,LPSTR out) {
INT32 GetExpandedName32A( LPCSTR in, LPSTR out )
{
struct lzfileheader head;
HFILE fd;
HFILE32 fd;
OFSTRUCT ofs;
INT fnislowercased,ret,len;
INT32 fnislowercased,ret,len;
LPSTR s,t;
dprintf_file(stddeb,"GetExpandedName(%s)\n",in);
fd=OpenFile(in,&ofs,OF_READ);
if (fd==HFILE_ERROR)
fd=OpenFile32(in,&ofs,OF_READ);
if (fd==HFILE_ERROR32)
return LZERROR_BADINHANDLE;
ret=read_header(fd,&head);
if (ret<=0) {
_lclose(fd);
_lclose32(fd);
return LZERROR_BADINHANDLE;
}
@ -219,7 +252,7 @@ GetExpandedName16(LPCSTR in,LPSTR out) {
if (!*s) {
/* FIXME: hmm. shouldn't happen? */
fprintf(stddeb,__FILE__":GetExpandedFileName(), specified a directory or what? (%s)\n",in);
_lclose(fd);
_lclose32(fd);
return 1;
}
/* see if we should use lowercase or uppercase on the last char */
@ -250,15 +283,16 @@ GetExpandedName16(LPCSTR in,LPSTR out) {
t[len]=head.lastchar;
}
} /* else no modification necessary */
_lclose(fd);
_lclose32(fd);
return 1;
}
/*
* GetExpandedNameW [LZ32.11]
/***********************************************************************
* GetExpandedName32W (LZ32.11)
*/
INT32
GetExpandedName32W(LPCWSTR in,LPWSTR out) {
INT32 GetExpandedName32W( LPCWSTR in, LPWSTR out )
{
char *xin,*xout;
INT32 ret;
@ -271,26 +305,21 @@ GetExpandedName32W(LPCWSTR in,LPWSTR out) {
return ret;
}
/*
* GetExpandedNameA [LZ32.9]
/***********************************************************************
* LZRead16 (LZEXPAND.5)
*/
INT32
GetExpandedName32A(LPCSTR in,LPSTR out) {
return GetExpandedName16(in,out);
INT16 LZRead16( HFILE16 fd, LPVOID buf, UINT16 toread )
{
return LZRead32(fd,buf,toread);
}
/*
* LZRead [LZEXPAND.5] [LZ32.4]
* just as normal read, but reads from LZ special fd and uncompresses.
*/
INT16
LZRead16(HFILE fd,SEGPTR segbuf,UINT16 toread) {
dprintf_file(stddeb,"LZRead16(%d,%08lx,%d)\n",fd,(DWORD)segbuf,toread);
return LZRead32(fd,(LPBYTE)PTR_SEG_TO_LIN(segbuf),toread);
}
INT32
LZRead32(HFILE fd,LPVOID vbuf,UINT32 toread) {
/***********************************************************************
* LZRead32 (LZ32.4)
*/
INT32 LZRead32( HFILE32 fd, LPVOID vbuf, UINT32 toread )
{
int i,howmuch;
BYTE b,*buf;
struct lzstate *lzs;
@ -358,7 +387,7 @@ LZRead32(HFILE fd,LPVOID vbuf,UINT32 toread) {
*/
if (lzs->realcurrent>lzs->realwanted) {
/* flush decompressor state */
_llseek(lzs->realfd,14,SEEK_SET);
_llseek32(lzs->realfd,14,SEEK_SET);
GET_FLUSH(lzs);
lzs->realcurrent= 0;
lzs->bytetype = 0;
@ -381,14 +410,21 @@ LZRead32(HFILE fd,LPVOID vbuf,UINT32 toread) {
#undef DECOMPRESS_ONE_BYTE
}
/*
* LZSeek [LZEXPAND.4] [LZ32.3]
*
* works as the usual _llseek
*/
LONG
LZSeek(HFILE fd,LONG off,INT32 type) {
/***********************************************************************
* LZSeek16 (LZEXPAND.4)
*/
LONG LZSeek16( HFILE16 fd, LONG off, INT16 type )
{
return LZSeek32( fd, off, type );
}
/***********************************************************************
* LZSeek32 (LZ32.3)
*/
LONG LZSeek32( HFILE32 fd, LONG off, INT32 type )
{
int i;
struct lzstate *lzs;
LONG newwanted;
@ -399,7 +435,7 @@ LZSeek(HFILE fd,LONG off,INT32 type) {
break;
/* not compressed? just use normal _llseek() */
if (i==nroflzstates)
return _llseek(fd,off,type);
return _llseek32(fd,off,type);
lzs = lzstates+i;
newwanted = lzs->realwanted;
switch (type) {
@ -421,20 +457,30 @@ LZSeek(HFILE fd,LONG off,INT32 type) {
return newwanted;
}
/*
* LZCopy [LZEXPAND.1] [LZ32.0]
/***********************************************************************
* LZCopy16 (LZEXPAND.1)
*/
LONG LZCopy16( HFILE16 src, HFILE16 dest )
{
return LZCopy32( src, dest );
}
/***********************************************************************
* LZCopy32 (LZ32.0)
*
* Copies everything from src to dest
* if src is a LZ compressed file, it will be uncompressed.
* will return the number of bytes written to dest or errors.
*/
LONG
LZCopy(HFILE src,HFILE dest) {
LONG LZCopy32( HFILE32 src, HFILE32 dest )
{
int i,ret,wret;
LONG len;
#define BUFLEN 1000
BYTE buf[BUFLEN];
INT32 (*xread)(HFILE,LPVOID,UINT32);
INT32 (*xread)(HFILE32,LPVOID,UINT32);
dprintf_file(stddeb,"LZCopy(%d,%d)\n",src,dest);
for (i=0;i<nroflzstates;i++)
@ -443,7 +489,7 @@ LZCopy(HFILE src,HFILE dest) {
/* not compressed? just copy */
if (i==nroflzstates)
xread=(INT32(*)(HFILE,LPVOID,UINT32))_lread32;
xread=(INT32(*)(HFILE32,LPVOID,UINT32))_lread32;
else
xread=LZRead32;
len=0;
@ -482,54 +528,58 @@ static LPSTR LZEXPAND_MangleName( LPCSTR fn )
return mfn;
}
/*
* LZOpenFile [LZEXPAND.2]
/***********************************************************************
* LZOpenFile16 (LZEXPAND.2)
*/
HFILE16 LZOpenFile16( LPCSTR fn, LPOFSTRUCT ofs, UINT16 mode )
{
return LZOpenFile32A( fn, ofs, mode );
}
/***********************************************************************
* LZOpenFile32A (LZ32.1)
*
* Opens a file. If not compressed, open it as a normal file.
*/
HFILE
LZOpenFile16(LPCSTR fn,LPOFSTRUCT ofs,UINT16 mode) {
HFILE fd,cfd;
HFILE32 LZOpenFile32A( LPCSTR fn, LPOFSTRUCT ofs, UINT32 mode )
{
HFILE32 fd,cfd;
dprintf_file(stddeb,"LZOpenFile(%s,%p,%d)\n",fn,ofs,mode);
/* 0x70 represents all OF_SHARE_* flags, ignore them for the check */
fd=OpenFile(fn,ofs,mode);
if (fd==HFILE_ERROR)
fd=OpenFile32(fn,ofs,mode);
if (fd==HFILE_ERROR32)
{
LPSTR mfn = LZEXPAND_MangleName(fn);
fd = OpenFile(mfn,ofs,mode);
fd = OpenFile32(mfn,ofs,mode);
free( mfn );
}
if ((mode&~0x70)!=OF_READ)
return fd;
if (fd==HFILE_ERROR)
return HFILE_ERROR;
cfd=LZInit(fd);
if (fd==HFILE_ERROR32)
return HFILE_ERROR32;
cfd=LZInit32(fd);
if (cfd<=0)
return fd;
return cfd;
}
/*
* LZOpenFileA [LZ32.1]
*/
HFILE
LZOpenFile32A(LPCSTR fn,LPOFSTRUCT ofs,UINT32 mode) {
return LZOpenFile16(fn,ofs,mode);
}
/*
* LZOpenFileW [LZ32.10]
/***********************************************************************
* LZOpenFile32W (LZ32.10)
*/
HFILE
LZOpenFile32W(LPCWSTR fn,LPOFSTRUCT ofs,UINT32 mode) {
HFILE32 LZOpenFile32W( LPCWSTR fn, LPOFSTRUCT ofs, UINT32 mode )
{
LPSTR xfn;
LPWSTR yfn;
HFILE ret;
HFILE32 ret;
xfn = HEAP_strdupWtoA( GetProcessHeap(), 0, fn);
ret = LZOpenFile16(xfn,ofs,mode);
HeapFree( GetProcessHeap(), 0, xfn );
if (ret!=HFILE_ERROR) {
if (ret!=HFILE_ERROR32) {
/* ofs->szPathName is an array with the OFSTRUCT */
yfn = HEAP_strdupAtoW( GetProcessHeap(), 0, ofs->szPathName );
memcpy(ofs->szPathName,yfn,lstrlen32W(yfn)*2+2);
@ -538,11 +588,21 @@ LZOpenFile32W(LPCWSTR fn,LPOFSTRUCT ofs,UINT32 mode) {
return ret;
}
/*
* LZClose [LZEXPAND.6] [LZ32.5]
/***********************************************************************
* LZClose16 (LZEXPAND.6)
*/
void
LZClose(HFILE fd) {
void LZClose16( HFILE16 fd )
{
return LZClose32( fd );
}
/***********************************************************************
* LZClose32 (LZ32.5)
*/
void LZClose32( HFILE32 fd )
{
int i;
dprintf_file(stddeb,"LZClose(%d)\n",fd);
@ -550,25 +610,35 @@ LZClose(HFILE fd) {
if (lzstates[i].lzfd==fd)
break;
if (i==nroflzstates) {
_lclose(fd);
_lclose32(fd);
return;
}
if (lzstates[i].get)
free(lzstates[i].get);
_lclose(lzstates[i].realfd);
_lclose32(lzstates[i].realfd);
memcpy(lzstates+i,lzstates+i+1,sizeof(struct lzstate)*(nroflzstates-i-1));
nroflzstates--;
lzstates=xrealloc(lzstates,sizeof(struct lzstate)*nroflzstates);
}
/*
* CopyLZFile [LZEXPAND.8] [LZ32.7]
/***********************************************************************
* CopyLZFile16 (LZEXPAND.8)
*/
LONG CopyLZFile16( HFILE16 src, HFILE16 dest )
{
dprintf_file(stddeb,"CopyLZFile16(%d,%d)\n",src,dest);
return LZCopy32(src,dest);
}
/***********************************************************************
* CopyLZFile32 (LZ32.7)
*
* Copy src to dest (including uncompressing src).
* NOTE: Yes. This is exactly the same function as LZCopy.
*/
LONG
CopyLZFile(HFILE src,HFILE dest) {
dprintf_file(stddeb,"CopyLZFile(%d,%d)\n",src,dest);
return LZCopy(src,dest);
LONG CopyLZFile32( HFILE32 src, HFILE32 dest )
{
dprintf_file(stddeb,"CopyLZFile32(%d,%d)\n",src,dest);
return LZCopy32(src,dest);
}

View File

@ -27,7 +27,6 @@
#include "winsock.h"
#include "options.h"
#include "desktop.h"
#include "registers.h"
#include "shell.h"
#include "winbase.h"
#define DEBUG_DEFINE_VARIABLES
@ -781,11 +780,7 @@ LONG GetWinFlags(void)
long result = 0;
/* There doesn't seem to be any Pentium flag. */
#ifndef WINELIB
long cpuflag = cpuflags[MIN (runtime_cpu (), 4)];
#else
long cpuflag = cpuflags[4];
#endif
switch(Options.mode) {
case MODE_STANDARD:

View File

@ -201,7 +201,7 @@ split_keypath(LPCWSTR wp,LPWSTR **wpv,int *wpc) {
int i,j,len;
LPWSTR ws;
ws = strdupW(wp);
ws = HEAP_strdupW( SystemHeap, 0, wp );
*wpc = 1;
for (i=0;ws[i];i++) {
if (ws[i]=='\\') {
@ -210,7 +210,7 @@ split_keypath(LPCWSTR wp,LPWSTR **wpv,int *wpc) {
}
}
len = i;
*wpv = (LPWSTR*)xmalloc(sizeof(LPWSTR)*(*wpc+2));
*wpv = (LPWSTR*)HeapAlloc( SystemHeap, 0, sizeof(LPWSTR)*(*wpc+2));
(*wpv)[0]= ws;
j = 1;
for (i=1;i<len;i++)
@ -218,7 +218,7 @@ split_keypath(LPCWSTR wp,LPWSTR **wpv,int *wpc) {
(*wpv)[j++]=ws+i;
(*wpv)[j]=NULL;
}
#define FREE_KEY_PATH free(wps[0]);free(wps);
#define FREE_KEY_PATH HeapFree(SystemHeap,0,wps[0]);HeapFree(SystemHeap,0,wps);
/*
* Shell initialisation, allocates keys.
@ -1109,7 +1109,7 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) {
};
struct _w95nr2da *nr2da;
HFILE hfd;
HFILE32 hfd;
int lastmodified;
char magic[5];
unsigned long nr,pos,i,where,version,rgdbsection,end,off_next_rgdb;
@ -1120,8 +1120,8 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) {
BY_HANDLE_FILE_INFORMATION hfdinfo;
dprintf_reg(stddeb,"Loading Win95 registry database '%s'\n",fn);
hfd=OpenFile(fn,&ofs,OF_READ);
if (hfd==HFILE_ERROR)
hfd=OpenFile32(fn,&ofs,OF_READ);
if (hfd==HFILE_ERROR32)
return;
magic[4]=0;
if (4!=_lread32(hfd,magic,4))
@ -1134,7 +1134,7 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) {
return;
if (4!=_lread32(hfd,&rgdbsection,4))
return;
if (-1==_llseek(hfd,0x20,SEEK_SET))
if (-1==_llseek32(hfd,0x20,SEEK_SET))
return;
if (4!=_lread32(hfd,magic,4))
return;
@ -1144,7 +1144,7 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) {
}
/* STEP 1: Keylink structures */
if (-1==_llseek(hfd,0x40,SEEK_SET))
if (-1==_llseek32(hfd,0x40,SEEK_SET))
return;
where = 0x40;
end = rgdbsection;
@ -1231,12 +1231,12 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) {
end = hfdinfo.nFileSizeLow;
lastmodified = DOSFS_FileTimeToUnixTime(&(hfdinfo.ftLastWriteTime));
if (-1==_llseek(hfd,rgdbsection,SEEK_SET))
if (-1==_llseek32(hfd,rgdbsection,SEEK_SET))
return;
data = (char*)xmalloc(end-rgdbsection);
if ((end-rgdbsection)!=_lread32(hfd,data,end-rgdbsection))
return;
_lclose(hfd);
_lclose32(hfd);
curdata = data;
memcpy(magic,curdata,4);
memcpy(&off_next_rgdb,curdata+4,4);
@ -1471,7 +1471,7 @@ __w31_dumptree( unsigned short idx,
void
_w31_loadreg() {
HFILE hf;
HFILE32 hf;
struct _w31_header head;
struct _w31_tabent *tab;
unsigned char *txt;
@ -1482,19 +1482,19 @@ _w31_loadreg() {
HKEY hkey;
LPKEYSTRUCT lpkey;
hf = OpenFile("reg.dat",&ofs,OF_READ);
if (hf==HFILE_ERROR)
hf = OpenFile32("reg.dat",&ofs,OF_READ);
if (hf==HFILE_ERROR32)
return;
/* read & dump header */
if (sizeof(head)!=_lread32(hf,&head,sizeof(head))) {
dprintf_reg(stddeb,"_w31_loadreg:reg.dat is too short.\n");
_lclose(hf);
_lclose32(hf);
return;
}
if (memcmp(head.cookie, "SHCC3.10", sizeof(head.cookie))!=0) {
dprintf_reg(stddeb,"_w31_loadreg:reg.dat has bad signature.\n");
_lclose(hf);
_lclose32(hf);
return;
}
@ -1504,24 +1504,24 @@ _w31_loadreg() {
if (len!=_lread32(hf,tab,len)) {
dprintf_reg(stderr,"_w31_loadreg:couldn't read %d bytes.\n",len);
free(tab);
_lclose(hf);
_lclose32(hf);
return;
}
/* read text */
txt = xmalloc(head.textsize);
if (-1==_llseek(hf,head.textoff,SEEK_SET)) {
if (-1==_llseek32(hf,head.textoff,SEEK_SET)) {
dprintf_reg(stderr,"_w31_loadreg:couldn't seek to textblock.\n");
free(tab);
free(txt);
_lclose(hf);
_lclose32(hf);
return;
}
if (head.textsize!=_lread32(hf,txt,head.textsize)) {
dprintf_reg(stderr,"_w31_loadreg:textblock too short (%d instead of %ld).\n",len,head.textsize);
free(tab);
free(txt);
_lclose(hf);
_lclose32(hf);
return;
}
@ -1529,7 +1529,7 @@ _w31_loadreg() {
dprintf_reg(stderr,"_w31_loadreg:GetFileInformationByHandle failed?.\n");
free(tab);
free(txt);
_lclose(hf);
_lclose32(hf);
return;
}
lastmodified = DOSFS_FileTimeToUnixTime(&(hfinfo.ftLastWriteTime));
@ -1540,7 +1540,7 @@ _w31_loadreg() {
__w31_dumptree(tab[0].w1,txt,tab,&head,lpkey,lastmodified,0);
free(tab);
free(txt);
_lclose(hf);
_lclose32(hf);
return;
}
@ -2800,9 +2800,9 @@ DWORD RegDeleteKey32A(HKEY hkey,LPCSTR lpszSubKey) {
dprintf_reg(stddeb,"RegDeleteKey32A(%x,%s)\n",
hkey,lpszSubKey
);
lpszSubKeyW=strdupA2W(lpszSubKey);
lpszSubKeyW=HEAP_strdupAtoW(GetProcessHeap(),0,lpszSubKey);
ret=RegDeleteKey32W(hkey,lpszSubKeyW);
free(lpszSubKeyW);
HeapFree(GetProcessHeap(),0,lpszSubKeyW);
return ret;
}
@ -2867,13 +2867,9 @@ DWORD RegDeleteValue32A(HKEY hkey,LPSTR lpszValue) {
DWORD ret;
dprintf_reg( stddeb, "RegDeleteValue32A(%x,%s)\n", hkey,lpszValue );
if (lpszValue)
lpszValueW=strdupA2W(lpszValue);
else
lpszValueW=NULL;
lpszValueW=HEAP_strdupAtoW(GetProcessHeap(),0,lpszValue);
ret=RegDeleteValue32W(hkey,lpszValueW);
if (lpszValueW)
free(lpszValueW);
HeapFree(GetProcessHeap(),0,lpszValueW);
return ret;
}

View File

@ -163,12 +163,8 @@ static HINSTANCE16 SHELL_FindExecutable( LPCSTR lpFile,
/* FIXME - should throw a warning, perhaps! */
return 2; /* File not found. Close enough, I guess. */
}
if (SearchPath32A(lpDirectory,lpFile,NULL,sizeof(xlpFile),xlpFile,NULL))
lpFile = xlpFile;
else {
if (SearchPath32A(lpDirectory,lpFile,".exe",sizeof(xlpFile),xlpFile,NULL))
lpFile = xlpFile;
}
if (SearchPath32A(lpDirectory,lpFile,".exe",sizeof(xlpFile),xlpFile,NULL))
lpFile = xlpFile;
/* First thing we need is the file's extension */
extension = strrchr( xlpFile, '.' ); /* Assume last "." is the one; */
@ -321,7 +317,7 @@ HINSTANCE16 ShellExecute(HWND hWnd, LPCSTR lpOperation, LPCSTR lpFile,
}
dprintf_exec(stddeb,"ShellExecute:starting %s\n",cmd);
return WinExec(cmd,iShowCmd);
return WinExec32(cmd,iShowCmd);
}
/*************************************************************************
@ -351,105 +347,124 @@ HINSTANCE16 FindExecutable(LPCSTR lpFile, LPCSTR lpDirectory, LPSTR lpResult)
return retval;
}
static char AppName[128], AppMisc[1536];
typedef struct
{
LPCSTR szApp;
LPCSTR szOtherStuff;
HICON32 hIcon;
} ABOUT_INFO;
/*************************************************************************
* AboutDlgProc [SHELL.33]
* AboutDlgProc32 (not an exported API function)
*/
LRESULT AboutDlgProc(HWND hWnd, UINT msg, WPARAM16 wParam, LPARAM lParam)
LRESULT AboutDlgProc32( HWND32 hWnd, UINT32 msg, WPARAM32 wParam,
LPARAM lParam )
{
char Template[512], AppTitle[512];
switch(msg) {
case WM_INITDIALOG:
SendDlgItemMessage32A(hWnd,stc1,STM_SETICON,lParam,0);
GetWindowText32A(hWnd, Template, sizeof(Template));
sprintf(AppTitle, Template, AppName);
SetWindowText32A(hWnd, AppTitle);
SetWindowText32A(GetDlgItem(hWnd,100), AppMisc);
return 1;
char Template[512], AppTitle[512];
switch(msg)
{
case WM_INITDIALOG:
{
ABOUT_INFO *info = (ABOUT_INFO *)lParam;
if (info)
{
SendDlgItemMessage32A(hWnd, stc1, STM_SETICON, info->hIcon, 0);
GetWindowText32A( hWnd, Template, sizeof(Template) );
sprintf( AppTitle, Template, info->szApp );
SetWindowText32A( hWnd, AppTitle );
SetWindowText32A( GetDlgItem(hWnd,100), info->szOtherStuff );
}
}
return 1;
case WM_COMMAND:
switch (wParam) {
case IDOK:
EndDialog(hWnd, TRUE);
return TRUE;
case WM_COMMAND:
if (wParam == IDOK)
{
EndDialog(hWnd, TRUE);
return TRUE;
}
break;
}
break;
}
return FALSE;
return 0;
}
/*************************************************************************
* AboutDlgProc16 (SHELL.33)
*/
LRESULT AboutDlgProc16( HWND16 hWnd, UINT16 msg, WPARAM16 wParam,
LPARAM lParam )
{
return AboutDlgProc32( hWnd, msg, wParam, lParam );
}
/*************************************************************************
* ShellAbout16 (SHELL.22)
*/
BOOL16 ShellAbout16( HWND16 hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
HICON16 hIcon )
{
return ShellAbout32A( hWnd, szApp, szOtherStuff, hIcon );
}
/*************************************************************************
* ShellAbout [SHELL.22]
* ShellAbout32A (SHELL32.82)
*/
INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON16 hIcon)
BOOL32 ShellAbout32A( HWND32 hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
HICON32 hIcon )
{
HGLOBAL16 handle;
BOOL bRet;
if (szApp) strncpy(AppName, szApp, sizeof(AppName));
else *AppName = 0;
AppName[sizeof(AppName)-1]=0;
if (szOtherStuff) strncpy(AppMisc, szOtherStuff, sizeof(AppMisc));
else *AppMisc = 0;
AppMisc[sizeof(AppMisc)-1]=0;
if (!hIcon) hIcon = LoadIcon16(0,MAKEINTRESOURCE(OIC_WINEICON));
handle = SYSRES_LoadResource( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX );
if (!handle) return FALSE;
bRet = DialogBoxIndirectParam16( WIN_GetWindowInstance( hWnd ),
handle, hWnd,
(DLGPROC16)MODULE_GetWndProcEntry16("AboutDlgProc"),
(LPARAM)hIcon );
SYSRES_FreeResource( handle );
return bRet;
ABOUT_INFO info;
info.szApp = szApp;
info.szOtherStuff = szOtherStuff;
info.hIcon = hIcon;
if (!hIcon) info.hIcon = LoadIcon16( 0, MAKEINTRESOURCE(OIC_WINEICON) );
return DialogBoxIndirectParam32A( WIN_GetWindowInstance( hWnd ),
SYSRES_GetResPtr( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX ),
hWnd, AboutDlgProc32, (LPARAM)&info );
}
/*************************************************************************
* ShellAbout32W [SHELL32.83]
* ShellAbout32W (SHELL32.83)
*/
INT32 ShellAbout32W(HWND32 hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HICON16 hIcon)
BOOL32 ShellAbout32W( HWND32 hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
HICON32 hIcon )
{
HGLOBAL16 handle;
BOOL bRet;
BOOL32 ret;
ABOUT_INFO info;
if (szApp) lstrcpynWtoA(AppName, szApp, sizeof(AppName));
else *AppName = 0;
AppName[sizeof(AppName)-1]=0;
if (szOtherStuff) lstrcpynWtoA(AppMisc, szOtherStuff, sizeof(AppMisc));
else *AppMisc = 0;
AppMisc[sizeof(AppMisc)-1]=0;
if (!hIcon) hIcon = LoadIcon16(0,MAKEINTRESOURCE(OIC_WINEICON));
handle = SYSRES_LoadResource( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX );
if (!handle) return FALSE;
bRet = DialogBoxIndirectParam16( WIN_GetWindowInstance( hWnd ),
handle, hWnd,
(DLGPROC16)MODULE_GetWndProcEntry16("AboutDlgProc"),
(LPARAM)hIcon );
SYSRES_FreeResource( handle );
return bRet;
info.szApp = HEAP_strdupWtoA( GetProcessHeap(), 0, szApp );
info.szOtherStuff = HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff );
info.hIcon = hIcon;
if (!hIcon) info.hIcon = LoadIcon16( 0, MAKEINTRESOURCE(OIC_WINEICON) );
ret = DialogBoxIndirectParam32A( WIN_GetWindowInstance( hWnd ),
SYSRES_GetResPtr( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX ),
hWnd, AboutDlgProc32, (LPARAM)&info );
HeapFree( GetProcessHeap(), 0, (LPSTR)info.szApp );
HeapFree( GetProcessHeap(), 0, (LPSTR)info.szOtherStuff );
return ret;
}
/*************************************************************************
* SHELL_GetResourceTable
*
* FIXME: Implement GetPEResourceTable in w32sys.c and call it here.
*/
static BYTE* SHELL_GetResourceTable(HFILE hFile)
static BYTE* SHELL_GetResourceTable(HFILE32 hFile)
{
struct mz_header_s mz_header;
struct ne_header_s ne_header;
int size;
_llseek( hFile, 0, SEEK_SET );
_llseek32( hFile, 0, SEEK_SET );
if ((_lread32(hFile,&mz_header,sizeof(mz_header)) != sizeof(mz_header)) ||
(mz_header.mz_magic != MZ_SIGNATURE)) return (BYTE*)-1;
_llseek( hFile, mz_header.ne_offset, SEEK_SET );
_llseek32( hFile, mz_header.ne_offset, SEEK_SET );
if (_lread32( hFile, &ne_header, sizeof(ne_header) ) != sizeof(ne_header))
return NULL;
@ -467,7 +482,7 @@ static BYTE* SHELL_GetResourceTable(HFILE hFile)
if( !pTypeInfo ) return NULL;
_llseek(hFile, mz_header.ne_offset+ne_header.resource_tab_offset, SEEK_SET);
_llseek32(hFile, mz_header.ne_offset+ne_header.resource_tab_offset, SEEK_SET);
if( _lread32( hFile, (char*)pTypeInfo, size) != size )
{ free(pTypeInfo); return NULL; }
return pTypeInfo;
@ -480,14 +495,14 @@ static BYTE* SHELL_GetResourceTable(HFILE hFile)
/*************************************************************************
* SHELL_LoadResource
*/
static HGLOBAL16 SHELL_LoadResource(HINSTANCE16 hInst, HFILE hFile, NE_NAMEINFO* pNInfo, WORD sizeShift)
static HGLOBAL16 SHELL_LoadResource(HINSTANCE16 hInst, HFILE32 hFile, NE_NAMEINFO* pNInfo, WORD sizeShift)
{
BYTE* ptr;
HGLOBAL16 handle = DirectResAlloc( hInst, 0x10, (DWORD)pNInfo->length << sizeShift);
if( (ptr = (BYTE*)GlobalLock16( handle )) )
{
_llseek( hFile, (DWORD)pNInfo->offset << sizeShift, SEEK_SET);
_llseek32( hFile, (DWORD)pNInfo->offset << sizeShift, SEEK_SET);
_lread32( hFile, (char*)ptr, pNInfo->length << sizeShift);
return handle;
}
@ -497,14 +512,14 @@ static HGLOBAL16 SHELL_LoadResource(HINSTANCE16 hInst, HFILE hFile, NE_NAMEINFO*
/*************************************************************************
* ICO_LoadIcon
*/
static HGLOBAL16 ICO_LoadIcon(HINSTANCE16 hInst, HFILE hFile, LPicoICONDIRENTRY lpiIDE)
static HGLOBAL16 ICO_LoadIcon(HINSTANCE16 hInst, HFILE32 hFile, LPicoICONDIRENTRY lpiIDE)
{
BYTE* ptr;
HGLOBAL16 handle = DirectResAlloc( hInst, 0x10, lpiIDE->dwBytesInRes);
if( (ptr = (BYTE*)GlobalLock16( handle )) )
{
_llseek( hFile, lpiIDE->dwImageOffset, SEEK_SET);
_llseek32( hFile, lpiIDE->dwImageOffset, SEEK_SET);
_lread32( hFile, (char*)ptr, lpiIDE->dwBytesInRes);
return handle;
}
@ -516,13 +531,13 @@ static HGLOBAL16 ICO_LoadIcon(HINSTANCE16 hInst, HFILE hFile, LPicoICONDIRENTRY
*
* Read .ico file and build phony ICONDIR struct for GetIconID
*/
static HGLOBAL16 ICO_GetIconDirectory(HINSTANCE16 hInst, HFILE hFile, LPicoICONDIR* lplpiID )
static HGLOBAL16 ICO_GetIconDirectory(HINSTANCE16 hInst, HFILE32 hFile, LPicoICONDIR* lplpiID )
{
WORD id[3]; /* idReserved, idType, idCount */
LPicoICONDIR lpiID;
int i;
_llseek( hFile, 0, SEEK_SET );
_llseek32( hFile, 0, SEEK_SET );
if( _lread32(hFile,(char*)id,sizeof(id)) != sizeof(id) ) return 0;
/* check .ICO header
@ -573,12 +588,12 @@ HGLOBAL16 InternalExtractIcon(HINSTANCE16 hInstance, LPCSTR lpszExeFileName, UIN
HGLOBAL16* RetPtr = NULL;
BYTE* pData;
OFSTRUCT ofs;
HFILE hFile = OpenFile( lpszExeFileName, &ofs, OF_READ );
HFILE32 hFile = OpenFile32( lpszExeFileName, &ofs, OF_READ );
dprintf_reg(stddeb, "InternalExtractIcon(%04x, file '%s', start from %d, extract %d\n",
hInstance, lpszExeFileName, nIconIndex, n);
if( hFile == HFILE_ERROR || !n ) return 0;
if( hFile == HFILE_ERROR32 || !n ) return 0;
hRet = GlobalAlloc16( GMEM_FIXED | GMEM_ZEROINIT, sizeof(HICON16)*n);
RetPtr = (HICON16*)GlobalLock16(hRet);
@ -661,7 +676,7 @@ HGLOBAL16 InternalExtractIcon(HINSTANCE16 hInstance, LPCSTR lpszExeFileName, UIN
if( icoFile ) free(lpiID);
else free(pData);
}
_lclose( hFile );
_lclose32( hFile );
/* return array with icon handles */

View File

@ -20,8 +20,6 @@
WORD USER_HeapSel = 0;
extern HTASK16 TASK_GetNextTask(HTASK16);
extern BOOL32 MENU_SwitchTPWndTo(HTASK16);
/***********************************************************************

View File

@ -23,21 +23,21 @@
#define LZREAD(what) \
if (sizeof(*what)!=LZRead32(lzfd,what,sizeof(*what))) return 0;
#define LZTELL(lzfd) LZSeek(lzfd, 0, SEEK_CUR);
#define LZTELL(lzfd) LZSeek32(lzfd, 0, SEEK_CUR);
int
read_ne_header(HFILE lzfd,struct ne_header_s *nehd) {
read_ne_header(HFILE32 lzfd,struct ne_header_s *nehd) {
struct mz_header_s mzh;
LZSeek(lzfd,0,SEEK_SET);
LZSeek32(lzfd,0,SEEK_SET);
if (sizeof(mzh)!=LZRead32(lzfd,&mzh,sizeof(mzh)))
return 0;
if (mzh.mz_magic!=MZ_SIGNATURE)
return 0;
LZSeek(lzfd,mzh.ne_offset,SEEK_SET);
LZSeek32(lzfd,mzh.ne_offset,SEEK_SET);
LZREAD(nehd);
if (nehd->ne_magic == NE_SIGNATURE) {
LZSeek(lzfd,mzh.ne_offset,SEEK_SET);
LZSeek32(lzfd,mzh.ne_offset,SEEK_SET);
return 1;
}
/* must handle PE files too. Later. */
@ -47,7 +47,7 @@ read_ne_header(HFILE lzfd,struct ne_header_s *nehd) {
int
find_ne_resource(
HFILE lzfd,struct ne_header_s *nehd,SEGPTR typeid,SEGPTR resid,
HFILE32 lzfd,struct ne_header_s *nehd,SEGPTR typeid,SEGPTR resid,
BYTE **resdata,int *reslen,DWORD *off
) {
NE_TYPEINFO ti;
@ -57,7 +57,7 @@ find_ne_resource(
DWORD nehdoffset;
nehdoffset = LZTELL(lzfd);
LZSeek(lzfd,nehd->resource_tab_offset,SEEK_CUR);
LZSeek32(lzfd,nehd->resource_tab_offset,SEEK_CUR);
LZREAD(&shiftcount);
dprintf_ver(stddeb,"shiftcount is %d\n",shiftcount);
dprintf_ver(stddeb,"reading resource typeinfo dir.\n");
@ -84,7 +84,7 @@ find_ne_resource(
DWORD whereleft;
whereleft = LZTELL(lzfd);
LZSeek(
LZSeek32(
lzfd,
nehdoffset+nehd->resource_tab_offset+ti.type_id,
SEEK_SET
@ -99,11 +99,11 @@ find_ne_resource(
if (lstrcmpi32A(str,(char*)PTR_SEG_TO_LIN(typeid)))
skipflag=1;
free(str);
LZSeek(lzfd,whereleft,SEEK_SET);
LZSeek32(lzfd,whereleft,SEEK_SET);
}
}
if (skipflag) {
LZSeek(lzfd,ti.count*sizeof(ni),SEEK_CUR);
LZSeek32(lzfd,ti.count*sizeof(ni),SEEK_CUR);
continue;
}
for (i=0;i<ti.count;i++) {
@ -125,7 +125,7 @@ find_ne_resource(
DWORD whereleft;
whereleft = LZTELL(lzfd);
LZSeek(
LZSeek32(
lzfd,
nehdoffset+nehd->resource_tab_offset+ni.id,
SEEK_SET
@ -140,12 +140,12 @@ find_ne_resource(
if (!lstrcmpi32A(str,(char*)PTR_SEG_TO_LIN(typeid)))
skipflag=0;
free(str);
LZSeek(lzfd,whereleft,SEEK_SET);
LZSeek32(lzfd,whereleft,SEEK_SET);
}
}
if (skipflag)
continue;
LZSeek(lzfd,((int)ni.offset<<shiftcount),SEEK_SET);
LZSeek32(lzfd,((int)ni.offset<<shiftcount),SEEK_SET);
*off = (int)ni.offset<<shiftcount;
len = ni.length<<shiftcount;
rdata=(WORD*)xmalloc(len);
@ -164,7 +164,7 @@ find_ne_resource(
/* GetFileResourceSize [VER.2] */
DWORD
GetFileResourceSize(LPCSTR filename,SEGPTR restype,SEGPTR resid,LPDWORD off) {
HFILE lzfd;
HFILE32 lzfd;
OFSTRUCT ofs;
BYTE *resdata;
int reslen;
@ -173,19 +173,19 @@ GetFileResourceSize(LPCSTR filename,SEGPTR restype,SEGPTR resid,LPDWORD off) {
dprintf_ver(stddeb,"GetFileResourceSize(%s,%lx,%lx,%p)\n",
filename,(LONG)restype,(LONG)resid,off
);
lzfd=LZOpenFile16(filename,&ofs,OF_READ);
lzfd=LZOpenFile32A(filename,&ofs,OF_READ);
if (lzfd==0)
return 0;
if (!read_ne_header(lzfd,&nehd)) {
LZClose(lzfd);
LZClose32(lzfd);
return 0;
}
if (!find_ne_resource(lzfd,&nehd,restype,resid,&resdata,&reslen,off)) {
LZClose(lzfd);
LZClose32(lzfd);
return 0;
}
free(resdata);
LZClose(lzfd);
LZClose32(lzfd);
return reslen;
}
@ -194,7 +194,7 @@ DWORD
GetFileResource(LPCSTR filename,SEGPTR restype,SEGPTR resid,
DWORD off,DWORD datalen,LPVOID data
) {
HFILE lzfd;
HFILE32 lzfd;
OFSTRUCT ofs;
BYTE *resdata;
int reslen=datalen;
@ -203,25 +203,25 @@ GetFileResource(LPCSTR filename,SEGPTR restype,SEGPTR resid,
filename,(LONG)restype,(LONG)resid,off,datalen,data
);
lzfd=LZOpenFile16(filename,&ofs,OF_READ);
lzfd=LZOpenFile32A(filename,&ofs,OF_READ);
if (lzfd==0)
return 0;
if (!off) {
if (!read_ne_header(lzfd,&nehd)) {
LZClose(lzfd);
LZClose32(lzfd);
return 0;
}
if (!find_ne_resource(lzfd,&nehd,restype,resid,&resdata,&reslen,&off)) {
LZClose(lzfd);
LZClose32(lzfd);
return 0;
}
free(resdata);
}
LZSeek(lzfd,off,SEEK_SET);
LZSeek32(lzfd,off,SEEK_SET);
if (reslen>datalen)
reslen=datalen;
LZRead32(lzfd,data,reslen);
LZClose(lzfd);
LZClose32(lzfd);
return reslen;
}

View File

@ -6,24 +6,8 @@ VPATH = @srcdir@
MODULE = miscemu
C_SRCS = \
cpu.c \
dosmem.c \
dpmi.c \
emulate.c \
instr.c \
int10.c \
int13.c \
int1a.c \
int21.c \
int25.c \
int26.c \
int2a.c \
int2f.c \
int4b.c \
int5c.c \
interrupts.c \
ioports.c \
vxd.c
instr.c
all: $(MODULE).o

View File

@ -28,11 +28,11 @@ struct Win87EmInfoStruct
*/
/* FIXME: Only skeletal implementation for now */
void WIN87_fpmath( SIGCONTEXT *context )
void WIN87_fpmath( CONTEXT *context )
{
dprintf_int(stddeb, "_fpmath: (cs:eip=%x:%lx es=%x bx=%04x ax=%04x dx==%04x)\n",
CS_reg(context), EIP_reg(context),
ES_reg(context), BX_reg(context),
(WORD)CS_reg(context), EIP_reg(context),
(WORD)ES_reg(context), BX_reg(context),
AX_reg(context), DX_reg(context) );
switch(BX_reg(context))

View File

@ -8,14 +8,15 @@
#include "windows.h"
#include "ldt.h"
#include "miscemu.h"
#include "sigcontext.h"
#define STACK_reg(context) \
((GET_SEL_FLAGS(SS_reg(context)) & LDT_FLAGS_32BIT) ? \
ESP_reg(context) : SP_reg(context))
#define STACK_sig(context) \
((GET_SEL_FLAGS(SS_sig(context)) & LDT_FLAGS_32BIT) ? \
ESP_sig(context) : SP_sig(context))
#define STACK_PTR(context) \
(PTR_SEG_OFF_TO_LIN(SS_reg(context),STACK_reg(context)))
(PTR_SEG_OFF_TO_LIN(SS_sig(context),STACK_sig(context)))
/***********************************************************************
* INSTR_ReplaceSelector
@ -29,7 +30,7 @@ static WORD INSTR_ReplaceSelector( SIGCONTEXT *context, WORD sel)
{
extern void SIGNAL_StartBIOSTimer(void);
fprintf( stderr, "Direct access to segment 0x40 (cs:ip=%04x:%04lx).\n",
CS_reg(context), EIP_reg(context) );
CS_sig(context), EIP_sig(context) );
SIGNAL_StartBIOSTimer();
return DOSMEM_BiosSeg;
}
@ -59,14 +60,14 @@ static BYTE *INSTR_GetOperandAddr( SIGCONTEXT *context, BYTE *instr,
{
switch(rm)
{
case 0: return (BYTE *)&EAX_reg(context);
case 1: return (BYTE *)&ECX_reg(context);
case 2: return (BYTE *)&EDX_reg(context);
case 3: return (BYTE *)&EBX_reg(context);
case 4: return (BYTE *)&ESP_reg(context);
case 5: return (BYTE *)&EBP_reg(context);
case 6: return (BYTE *)&ESI_reg(context);
case 7: return (BYTE *)&EDI_reg(context);
case 0: return (BYTE *)&EAX_sig(context);
case 1: return (BYTE *)&ECX_sig(context);
case 2: return (BYTE *)&EDX_sig(context);
case 3: return (BYTE *)&EBX_sig(context);
case 4: return (BYTE *)&ESP_sig(context);
case 5: return (BYTE *)&EBP_sig(context);
case 6: return (BYTE *)&ESI_sig(context);
case 7: return (BYTE *)&EDI_sig(context);
}
}
@ -80,27 +81,27 @@ static BYTE *INSTR_GetOperandAddr( SIGCONTEXT *context, BYTE *instr,
ss = sib >> 6;
switch(sib >> 3)
{
case 0: index = EAX_reg(context); break;
case 1: index = ECX_reg(context); break;
case 2: index = EDX_reg(context); break;
case 3: index = EBX_reg(context); break;
case 0: index = EAX_sig(context); break;
case 1: index = ECX_sig(context); break;
case 2: index = EDX_sig(context); break;
case 3: index = EBX_sig(context); break;
case 4: index = 0; break;
case 5: index = EBP_reg(context); break;
case 6: index = ESI_reg(context); break;
case 7: index = EDI_reg(context); break;
case 5: index = EBP_sig(context); break;
case 6: index = ESI_sig(context); break;
case 7: index = EDI_sig(context); break;
}
}
switch(rm)
{
case 0: base = EAX_reg(context); seg = DS_reg(context); break;
case 1: base = ECX_reg(context); seg = DS_reg(context); break;
case 2: base = EDX_reg(context); seg = DS_reg(context); break;
case 3: base = EBX_reg(context); seg = DS_reg(context); break;
case 4: base = ESP_reg(context); seg = SS_reg(context); break;
case 5: base = EBP_reg(context); seg = SS_reg(context); break;
case 6: base = ESI_reg(context); seg = DS_reg(context); break;
case 7: base = EDI_reg(context); seg = DS_reg(context); break;
case 0: base = EAX_sig(context); seg = DS_sig(context); break;
case 1: base = ECX_sig(context); seg = DS_sig(context); break;
case 2: base = EDX_sig(context); seg = DS_sig(context); break;
case 3: base = EBX_sig(context); seg = DS_sig(context); break;
case 4: base = ESP_sig(context); seg = SS_sig(context); break;
case 5: base = EBP_sig(context); seg = SS_sig(context); break;
case 6: base = ESI_sig(context); seg = DS_sig(context); break;
case 7: base = EDI_sig(context); seg = DS_sig(context); break;
}
switch (mod)
{
@ -108,7 +109,7 @@ static BYTE *INSTR_GetOperandAddr( SIGCONTEXT *context, BYTE *instr,
if (rm == 5) /* special case: ds:(disp32) */
{
GET_VAL( &base, DWORD );
seg = DS_reg(context);
seg = DS_sig(context);
}
break;
@ -128,36 +129,36 @@ static BYTE *INSTR_GetOperandAddr( SIGCONTEXT *context, BYTE *instr,
switch(rm)
{
case 0: /* ds:(bx,si) */
base = BX_reg(context) + SI_reg(context);
seg = DS_reg(context);
base = BX_sig(context) + SI_sig(context);
seg = DS_sig(context);
break;
case 1: /* ds:(bx,di) */
base = BX_reg(context) + DI_reg(context);
seg = DS_reg(context);
base = BX_sig(context) + DI_sig(context);
seg = DS_sig(context);
break;
case 2: /* ss:(bp,si) */
base = BP_reg(context) + SI_reg(context);
seg = SS_reg(context);
base = BP_sig(context) + SI_sig(context);
seg = SS_sig(context);
break;
case 3: /* ss:(bp,di) */
base = BP_reg(context) + DI_reg(context);
seg = SS_reg(context);
base = BP_sig(context) + DI_sig(context);
seg = SS_sig(context);
break;
case 4: /* ds:(si) */
base = SI_reg(context);
seg = DS_reg(context);
base = SI_sig(context);
seg = DS_sig(context);
break;
case 5: /* ds:(di) */
base = DI_reg(context);
seg = DS_reg(context);
base = DI_sig(context);
seg = DS_sig(context);
break;
case 6: /* ss:(bp) */
base = BP_reg(context);
seg = SS_reg(context);
base = BP_sig(context);
seg = SS_sig(context);
break;
case 7: /* ds:(bx) */
base = BX_reg(context);
seg = DS_reg(context);
base = BX_sig(context);
seg = DS_sig(context);
break;
}
@ -167,7 +168,7 @@ static BYTE *INSTR_GetOperandAddr( SIGCONTEXT *context, BYTE *instr,
if (rm == 6) /* special case: ds:(disp16) */
{
GET_VAL( &base, WORD );
seg = DS_reg(context);
seg = DS_sig(context);
}
break;
@ -187,6 +188,7 @@ static BYTE *INSTR_GetOperandAddr( SIGCONTEXT *context, BYTE *instr,
/* FIXME: should check limit of the segment here */
return (BYTE *)PTR_SEG_OFF_TO_LIN( seg, (base + (index << ss)) );
#undef GET_VAL
}
@ -214,36 +216,36 @@ static BOOL32 INSTR_EmulateLDS( SIGCONTEXT *context, BYTE *instr, int long_op,
switch((*regmodrm >> 3) & 7)
{
case 0:
if (long_op) EAX_reg(context) = *(DWORD *)addr;
else AX_reg(context) = *(WORD *)addr;
if (long_op) EAX_sig(context) = *(DWORD *)addr;
else AX_sig(context) = *(WORD *)addr;
break;
case 1:
if (long_op) ECX_reg(context) = *(DWORD *)addr;
else CX_reg(context) = *(WORD *)addr;
if (long_op) ECX_sig(context) = *(DWORD *)addr;
else CX_sig(context) = *(WORD *)addr;
break;
case 2:
if (long_op) EDX_reg(context) = *(DWORD *)addr;
else DX_reg(context) = *(WORD *)addr;
if (long_op) EDX_sig(context) = *(DWORD *)addr;
else DX_sig(context) = *(WORD *)addr;
break;
case 3:
if (long_op) EBX_reg(context) = *(DWORD *)addr;
else BX_reg(context) = *(WORD *)addr;
if (long_op) EBX_sig(context) = *(DWORD *)addr;
else BX_sig(context) = *(WORD *)addr;
break;
case 4:
if (long_op) ESP_reg(context) = *(DWORD *)addr;
else SP_reg(context) = *(WORD *)addr;
if (long_op) ESP_sig(context) = *(DWORD *)addr;
else SP_sig(context) = *(WORD *)addr;
break;
case 5:
if (long_op) EBP_reg(context) = *(DWORD *)addr;
else BP_reg(context) = *(WORD *)addr;
if (long_op) EBP_sig(context) = *(DWORD *)addr;
else BP_sig(context) = *(WORD *)addr;
break;
case 6:
if (long_op) ESI_reg(context) = *(DWORD *)addr;
else SI_reg(context) = *(WORD *)addr;
if (long_op) ESI_sig(context) = *(DWORD *)addr;
else SI_sig(context) = *(WORD *)addr;
break;
case 7:
if (long_op) EDI_reg(context) = *(DWORD *)addr;
else DI_reg(context) = *(WORD *)addr;
if (long_op) EDI_sig(context) = *(DWORD *)addr;
else DI_sig(context) = *(WORD *)addr;
break;
}
@ -251,16 +253,16 @@ static BOOL32 INSTR_EmulateLDS( SIGCONTEXT *context, BYTE *instr, int long_op,
switch(*instr)
{
case 0xc4: ES_reg(context) = seg; break; /* les */
case 0xc5: DS_reg(context) = seg; break; /* lds */
case 0xc4: ES_sig(context) = seg; break; /* les */
case 0xc5: DS_sig(context) = seg; break; /* lds */
case 0x0f: switch(instr[1])
{
case 0xb2: SS_reg(context) = seg; break; /* lss */
#ifdef FS_reg
case 0xb4: FS_reg(context) = seg; break; /* lfs */
case 0xb2: SS_sig(context) = seg; break; /* lss */
#ifdef FS_sig
case 0xb4: FS_sig(context) = seg; break; /* lfs */
#endif
#ifdef GS_reg
case 0xb5: GS_reg(context) = seg; break; /* lgs */
#ifdef GS_sig
case 0xb5: GS_sig(context) = seg; break; /* lgs */
#endif
}
break;
@ -283,8 +285,8 @@ BOOL32 INSTR_EmulateInstruction( SIGCONTEXT *context )
int prefix, segprefix, prefixlen, len, repX, long_op, long_addr;
BYTE *instr;
long_op = long_addr = (GET_SEL_FLAGS(CS_reg(context)) & LDT_FLAGS_32BIT) != 0;
instr = (BYTE *) PTR_SEG_OFF_TO_LIN( CS_reg(context), EIP_reg(context) );
long_op = long_addr = (GET_SEL_FLAGS(CS_sig(context)) & LDT_FLAGS_32BIT) != 0;
instr = (BYTE *) PTR_SEG_OFF_TO_LIN( CS_sig(context), EIP_sig(context) );
/* First handle any possible prefix */
@ -297,25 +299,25 @@ BOOL32 INSTR_EmulateInstruction( SIGCONTEXT *context )
switch(*instr)
{
case 0x2e:
segprefix = CS_reg(context);
segprefix = CS_sig(context);
break;
case 0x36:
segprefix = SS_reg(context);
segprefix = SS_sig(context);
break;
case 0x3e:
segprefix = DS_reg(context);
segprefix = DS_sig(context);
break;
case 0x26:
segprefix = ES_reg(context);
segprefix = ES_sig(context);
break;
#ifdef FS_reg
#ifdef FS_sig
case 0x64:
segprefix = FS_reg(context);
segprefix = FS_sig(context);
break;
#endif
#ifdef GS_reg
#ifdef GS_sig
case 0x65:
segprefix = GS_reg(context);
segprefix = GS_sig(context);
break;
#endif
case 0x66:
@ -356,12 +358,12 @@ BOOL32 INSTR_EmulateInstruction( SIGCONTEXT *context )
{
switch(*instr)
{
case 0x07: ES_reg(context) = seg; break;
case 0x17: SS_reg(context) = seg; break;
case 0x1f: DS_reg(context) = seg; break;
case 0x07: ES_sig(context) = seg; break;
case 0x17: SS_sig(context) = seg; break;
case 0x1f: DS_sig(context) = seg; break;
}
STACK_reg(context) += long_op ? 4 : 2;
EIP_reg(context) += prefixlen + 1;
STACK_sig(context) += long_op ? 4 : 2;
EIP_sig(context) += prefixlen + 1;
return TRUE;
}
}
@ -370,47 +372,47 @@ BOOL32 INSTR_EmulateInstruction( SIGCONTEXT *context )
case 0x0f: /* extended instruction */
switch(instr[1])
{
#ifdef FS_reg
#ifdef FS_sig
case 0xa1: /* pop fs */
{
WORD seg = *(WORD *)STACK_PTR( context );
if ((seg = INSTR_ReplaceSelector( context, seg )) != 0)
{
FS_reg(context) = seg;
STACK_reg(context) += long_op ? 4 : 2;
EIP_reg(context) += prefixlen + 2;
FS_sig(context) = seg;
STACK_sig(context) += long_op ? 4 : 2;
EIP_sig(context) += prefixlen + 2;
return TRUE;
}
}
break;
#endif /* FS_reg */
#endif /* FS_sig */
#ifdef GS_reg
#ifdef GS_sig
case 0xa9: /* pop gs */
{
WORD seg = *(WORD *)STACK_PTR( context );
if ((seg = INSTR_ReplaceSelector( context, seg )) != 0)
{
GS_reg(context) = seg;
STACK_reg(context) += long_op ? 4 : 2;
EIP_reg(context) += prefixlen + 2;
GS_sig(context) = seg;
STACK_sig(context) += long_op ? 4 : 2;
EIP_sig(context) += prefixlen + 2;
return TRUE;
}
}
break;
#endif /* GS_reg */
#endif /* GS_sig */
case 0xb2: /* lss addr,reg */
#ifdef FS_reg
#ifdef FS_sig
case 0xb4: /* lfs addr,reg */
#endif
#ifdef GS_reg
#ifdef GS_sig
case 0xb5: /* lgs addr,reg */
#endif
if (INSTR_EmulateLDS( context, instr, long_op,
long_addr, segprefix, &len ))
{
EIP_reg(context) += prefixlen + len;
EIP_sig(context) += prefixlen + len;
return TRUE;
}
break;
@ -425,10 +427,10 @@ BOOL32 INSTR_EmulateInstruction( SIGCONTEXT *context )
int typ = *instr; /* Just in case it's overwritten. */
int outp = (typ >= 0x6e);
unsigned long count = repX ?
(long_addr ? ECX_reg(context) : CX_reg(context)) : 1;
(long_addr ? ECX_sig(context) : CX_sig(context)) : 1;
int opsize = (typ & 1) ? (long_op ? 4 : 2) : 1;
int step = (EFL_reg(context) & 0x400) ? -opsize : +opsize;
int seg = outp ? DS_reg(context) : ES_reg(context); /* FIXME: is this right? */
int step = (EFL_sig(context) & 0x400) ? -opsize : +opsize;
int seg = outp ? DS_sig(context) : ES_sig(context); /* FIXME: is this right? */
if (outp)
/* FIXME: Check segment readable. */
@ -439,9 +441,9 @@ BOOL32 INSTR_EmulateInstruction( SIGCONTEXT *context )
if (repX)
if (long_addr)
ECX_reg(context) = 0;
ECX_sig(context) = 0;
else
CX_reg(context) = 0;
CX_sig(context) = 0;
while (count-- > 0)
{
@ -449,41 +451,41 @@ BOOL32 INSTR_EmulateInstruction( SIGCONTEXT *context )
if (outp)
{
data = PTR_SEG_OFF_TO_LIN (seg,
long_addr ? ESI_reg(context) : SI_reg(context));
if (long_addr) ESI_reg(context) += step;
else SI_reg(context) += step;
long_addr ? ESI_sig(context) : SI_sig(context));
if (long_addr) ESI_sig(context) += step;
else SI_sig(context) += step;
}
else
{
data = PTR_SEG_OFF_TO_LIN (seg,
long_addr ? EDI_reg(context) : DI_reg(context));
if (long_addr) EDI_reg(context) += step;
else DI_reg(context) += step;
long_addr ? EDI_sig(context) : DI_sig(context));
if (long_addr) EDI_sig(context) += step;
else DI_sig(context) += step;
}
switch (typ)
{
case 0x6c:
*((BYTE *)data) = inport( DX_reg(context), 1);
*((BYTE *)data) = IO_inport( DX_sig(context), 1);
break;
case 0x6d:
if (long_op)
*((DWORD *)data) = inport( DX_reg(context), 4);
*((DWORD *)data) = IO_inport( DX_sig(context), 4);
else
*((WORD *)data) = inport( DX_reg(context), 2);
*((WORD *)data) = IO_inport( DX_sig(context), 2);
break;
case 0x6e:
outport( DX_reg(context), 1, *((BYTE *)data));
break;
IO_outport( DX_sig(context), 1, *((BYTE *)data));
break;
case 0x6f:
if (long_op)
outport( DX_reg(context), 4, *((DWORD *)data));
else
outport( DX_reg(context), 2, *((WORD *)data));
break;
if (long_op)
IO_outport( DX_sig(context), 4, *((DWORD *)data));
else
IO_outport( DX_sig(context), 2, *((WORD *)data));
break;
}
}
EIP_reg(context) += prefixlen + 1;
EIP_sig(context) += prefixlen + 1;
}
return TRUE;
@ -501,29 +503,29 @@ BOOL32 INSTR_EmulateInstruction( SIGCONTEXT *context )
switch((instr[1] >> 3) & 7)
{
case 0:
ES_reg(context) = seg;
EIP_reg(context) += prefixlen + len + 1;
ES_sig(context) = seg;
EIP_sig(context) += prefixlen + len + 1;
return TRUE;
case 1: /* cs */
break;
case 2:
SS_reg(context) = seg;
EIP_reg(context) += prefixlen + len + 1;
SS_sig(context) = seg;
EIP_sig(context) += prefixlen + len + 1;
return TRUE;
case 3:
DS_reg(context) = seg;
EIP_reg(context) += prefixlen + len + 1;
DS_sig(context) = seg;
EIP_sig(context) += prefixlen + len + 1;
return TRUE;
case 4:
#ifdef FS_reg
FS_reg(context) = seg;
EIP_reg(context) += prefixlen + len + 1;
#ifdef FS_sig
FS_sig(context) = seg;
EIP_sig(context) += prefixlen + len + 1;
return TRUE;
#endif
case 5:
#ifdef GS_reg
GS_reg(context) = seg;
EIP_reg(context) += prefixlen + len + 1;
#ifdef GS_sig
GS_sig(context) = seg;
EIP_sig(context) += prefixlen + len + 1;
return TRUE;
#endif
case 6: /* unused */
@ -538,7 +540,7 @@ BOOL32 INSTR_EmulateInstruction( SIGCONTEXT *context )
if (INSTR_EmulateLDS( context, instr, long_op,
long_addr, segprefix, &len ))
{
EIP_reg(context) += prefixlen + len;
EIP_sig(context) += prefixlen + len;
return TRUE;
}
break; /* Unable to emulate it */
@ -554,13 +556,13 @@ BOOL32 INSTR_EmulateInstruction( SIGCONTEXT *context )
FARPROC16 addr = INT_GetHandler( instr[1] );
WORD *stack = (WORD *)STACK_PTR( context );
/* Push the flags and return address on the stack */
*(--stack) = FL_reg(context);
*(--stack) = CS_reg(context);
*(--stack) = IP_reg(context) + prefixlen + 2;
STACK_reg(context) -= 3 * sizeof(WORD);
*(--stack) = FL_sig(context);
*(--stack) = CS_sig(context);
*(--stack) = IP_sig(context) + prefixlen + 2;
STACK_sig(context) -= 3 * sizeof(WORD);
/* Jump to the interrupt handler */
CS_reg(context) = HIWORD(addr);
EIP_reg(context) = LOWORD(addr);
CS_sig(context) = HIWORD(addr);
EIP_sig(context) = LOWORD(addr);
}
return TRUE;
@ -568,71 +570,71 @@ BOOL32 INSTR_EmulateInstruction( SIGCONTEXT *context )
if (long_op)
{
DWORD *stack = (DWORD *)STACK_PTR( context );
EIP_reg(context) = *stack++;
CS_reg(context) = *stack++;
EFL_reg(context) = *stack;
STACK_reg(context) += 3*sizeof(DWORD); /* Pop the return address and flags */
EIP_sig(context) = *stack++;
CS_sig(context) = *stack++;
EFL_sig(context) = *stack;
STACK_sig(context) += 3*sizeof(DWORD); /* Pop the return address and flags */
}
else
{
WORD *stack = (WORD *)STACK_PTR( context );
EIP_reg(context) = *stack++;
CS_reg(context) = *stack++;
FL_reg(context) = *stack;
STACK_reg(context) += 3*sizeof(WORD); /* Pop the return address and flags */
EIP_sig(context) = *stack++;
CS_sig(context) = *stack++;
FL_sig(context) = *stack;
STACK_sig(context) += 3*sizeof(WORD); /* Pop the return address and flags */
}
return TRUE;
case 0xe4: /* inb al,XX */
AL_reg(context) = inport( instr[1], 1 );
EIP_reg(context) += prefixlen + 2;
AL_sig(context) = IO_inport( instr[1], 1 );
EIP_sig(context) += prefixlen + 2;
return TRUE;
case 0xe5: /* in (e)ax,XX */
if (long_op) EAX_reg(context) = inport( instr[1], 4 );
else AX_reg(context) = inport( instr[1], 2 );
EIP_reg(context) += prefixlen + 2;
if (long_op) EAX_sig(context) = IO_inport( instr[1], 4 );
else AX_sig(context) = IO_inport( instr[1], 2 );
EIP_sig(context) += prefixlen + 2;
return TRUE;
case 0xe6: /* outb XX,al */
outport( instr[1], 1, AL_reg(context) );
EIP_reg(context) += prefixlen + 2;
IO_outport( instr[1], 1, AL_sig(context) );
EIP_sig(context) += prefixlen + 2;
return TRUE;
case 0xe7: /* out XX,(e)ax */
if (long_op) outport( instr[1], 4, EAX_reg(context) );
else outport( instr[1], 2, AX_reg(context) );
EIP_reg(context) += prefixlen + 2;
if (long_op) IO_outport( instr[1], 4, EAX_sig(context) );
else IO_outport( instr[1], 2, AX_sig(context) );
EIP_sig(context) += prefixlen + 2;
return TRUE;
case 0xec: /* inb al,dx */
AL_reg(context) = inport( DX_reg(context), 1 );
EIP_reg(context) += prefixlen + 1;
AL_sig(context) = IO_inport( DX_sig(context), 1 );
EIP_sig(context) += prefixlen + 1;
return TRUE;
case 0xed: /* in (e)ax,dx */
if (long_op) EAX_reg(context) = inport( DX_reg(context), 4 );
else AX_reg(context) = inport( DX_reg(context), 2 );
EIP_reg(context) += prefixlen + 1;
if (long_op) EAX_sig(context) = IO_inport( DX_sig(context), 4 );
else AX_sig(context) = IO_inport( DX_sig(context), 2 );
EIP_sig(context) += prefixlen + 1;
return TRUE;
case 0xee: /* outb dx,al */
outport( DX_reg(context), 1, AL_reg(context) );
EIP_reg(context) += prefixlen + 1;
IO_outport( DX_sig(context), 1, AL_sig(context) );
EIP_sig(context) += prefixlen + 1;
return TRUE;
case 0xef: /* out dx,(e)ax */
if (long_op) outport( DX_reg(context), 4, EAX_reg(context) );
else outport( DX_reg(context), 2, AX_reg(context) );
EIP_reg(context) += prefixlen + 1;
if (long_op) IO_outport( DX_sig(context), 4, EAX_sig(context) );
else IO_outport( DX_sig(context), 2, AX_sig(context) );
EIP_sig(context) += prefixlen + 1;
return TRUE;
case 0xfa: /* cli, ignored */
EIP_reg(context) += prefixlen + 1;
EIP_sig(context) += prefixlen + 1;
return TRUE;
case 0xfb: /* sti, ignored */
EIP_reg(context) += prefixlen + 1;
EIP_sig(context) += prefixlen + 1;
return TRUE;
}
fprintf(stderr, "Unexpected Windows program segfault"

View File

@ -1,28 +0,0 @@
/*
* Int 4B handling
*
*/
#include "miscemu.h"
/***********************************************************************
* INT_Int4bHandler
*
*/
void INT_Int4bHandler( SIGCONTEXT *context )
{
switch(AH_reg(context))
{
case 0x81: /* Virtual DMA Spec (IBM SCSI interface) */
if(AL_reg(context) != 0x02) /* if not install check */
{
SET_CFLAG(context);
AL_reg(context) = 0x0f; /* function is not implemented */
}
break;
default:
INT_BARF(context, 0x4b);
}
}

View File

@ -1,170 +0,0 @@
/*
* Interrupt vectors emulation
*
* Copyright 1995 Alexandre Julliard
*/
#include <sys/types.h>
#include "windows.h"
#include "drive.h"
#include "miscemu.h"
#include "msdos.h"
#include "module.h"
#include "stackframe.h"
#include "stddebug.h"
#include "debug.h"
static FARPROC16 INT_Vectors[256];
/* Ordinal number for interrupt 0 handler in WPROCS.DLL */
#define FIRST_INTERRUPT_ORDINAL 100
/**********************************************************************
* INT_Init
*/
BOOL32 INT_Init(void)
{
WORD vector;
HMODULE16 hModule = GetModuleHandle( "WPROCS" );
for (vector = 0; vector < 256; vector++)
{
if (!(INT_Vectors[vector] = MODULE_GetEntryPoint( hModule,
FIRST_INTERRUPT_ORDINAL+vector )))
{
fprintf(stderr,"Internal error: no vector for int %02x\n",vector);
return FALSE;
}
}
return TRUE;
}
/**********************************************************************
* INT_GetHandler
*
* Return the interrupt vector for a given interrupt.
*/
FARPROC16 INT_GetHandler( BYTE intnum )
{
return INT_Vectors[intnum];
}
/**********************************************************************
* INT_SetHandler
*
* Set the interrupt handler for a given interrupt.
*/
void INT_SetHandler( BYTE intnum, FARPROC16 handler )
{
dprintf_int( stddeb, "Set interrupt vector %02x <- %04x:%04x\n",
intnum, HIWORD(handler), LOWORD(handler) );
INT_Vectors[intnum] = handler;
}
/**********************************************************************
* INT_DummyHandler
*/
void INT_DummyHandler( SIGCONTEXT *context )
{
WORD ordinal;
STACK16FRAME *frame = CURRENT_STACK16;
BUILTIN_GetEntryPoint16( frame->entry_cs, frame->entry_ip, &ordinal );
INT_BARF( context, ordinal - FIRST_INTERRUPT_ORDINAL );
}
/**********************************************************************
* INT_Int11Handler
*
* Handler for int 11h (get equipment list).
*/
void INT_Int11Handler( SIGCONTEXT *context )
{
int diskdrives = 0;
int parallelports = 0;
int serialports = 0;
int x;
/* borrowed from Ralph Brown's interrupt lists
bits 15-14: number of parallel devices
bit 13: [Conv] Internal modem
bit 12: reserved
bits 11- 9: number of serial devices
bit 8: reserved
bits 7- 6: number of diskette drives minus one
bits 5- 4: Initial video mode:
00b = EGA,VGA,PGA
01b = 40 x 25 color
10b = 80 x 25 color
11b = 80 x 25 mono
bit 3: reserved
bit 2: [PS] =1 if pointing device
[non-PS] reserved
bit 1: =1 if math co-processor
bit 0: =1 if diskette available for boot
*/
/* Currently the only of these bits correctly set are:
bits 15-14 } Added by William Owen Smith,
bits 11-9 } wos@dcs.warwick.ac.uk
bits 7-6
bit 2 (always set)
*/
if (DRIVE_IsValid(0)) diskdrives++;
if (DRIVE_IsValid(1)) diskdrives++;
if (diskdrives) diskdrives--;
for (x=0; x!=MAX_PORTS; x++)
{
if (COM[x].devicename)
serialports++;
if (LPT[x].devicename)
parallelports++;
}
if (serialports > 7) /* 3 bits -- maximum value = 7 */
serialports=7;
if (parallelports > 3) /* 2 bits -- maximum value = 3 */
parallelports=3;
AX_reg(context) = (diskdrives << 6) | (serialports << 9) |
(parallelports << 14) | 0x02;
}
/**********************************************************************
* INT_Int12Handler
*
* Handler for int 12h (get memory size).
*/
void INT_Int12Handler( SIGCONTEXT *context )
{
AX_reg(context) = 640;
}
/**********************************************************************
* INT_Int15Handler
*
* Handler for int 15h.
*/
void INT_Int15Handler( SIGCONTEXT *context )
{
INT_BARF( context, 0x15 );
}
/**********************************************************************
* INT_Int16Handler
*
* Handler for int 16h (keyboard).
*/
void INT_Int16Handler( SIGCONTEXT *context )
{
INT_BARF( context, 0x16 );
}

31
msdos/Makefile.in Normal file
View File

@ -0,0 +1,31 @@
DEFS = -D__WINE__ -DNO_TRANSITION_TYPES
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = msdos
C_SRCS = \
dosmem.c \
dpmi.c \
int10.c \
int11.c \
int12.c \
int13.c \
int1a.c \
int21.c \
int25.c \
int26.c \
int2a.c \
int2f.c \
int4b.c \
int5c.c \
interrupts.c \
ioports.c \
vxd.c
all: $(MODULE).o
@MAKE_RULES@
### Dependencies:

View File

@ -85,16 +85,37 @@ struct dosmem_entry {
};
/***********************************************************************
* DOSMEM_InitCollateTable
*
* Initialises the collate table (character sorting, language dependend)
*/
DWORD DOSMEM_CollateTable;
static void DOSMEM_InitCollateTable()
{
DWORD x;
unsigned char *tbl;
int i;
x=GlobalDOSAlloc(258);
DOSMEM_CollateTable=MAKELONG(0,(x>>16));
tbl=DOSMEM_RealMode2Linear(DOSMEM_CollateTable);
*(WORD*)tbl = 0x100;
tbl+=2;
for (i=0;i<0x100;i++)
*tbl++=i;
}
/***********************************************************************
* DOSMEM_Init
*
* Create the dos memory segments, and store them into the KERNEL
* exported values. BUILTIN_Init() must already have been called.
* exported values.
*/
BOOL32 DOSMEM_Init(void)
{
HMODULE16 hModule = GetModuleHandle( "KERNEL" );
/* Allocate 1 MB dosmemory */
/* Yes, allocating 1 MB of memory, which is usually not even used, is a
* waste of memory. But I (MM) don't see any easy method to use
@ -112,44 +133,11 @@ BOOL32 DOSMEM_Init(void)
fprintf( stderr, "Could not allocate DOS memory.\n" );
return FALSE;
}
MODULE_SetEntryPoint( hModule, 183, /* KERNEL.183: __0000H */
GLOBAL_CreateBlock( GMEM_FIXED, DOSMEM_dosmem,
0x10000, hModule, FALSE, FALSE, FALSE, NULL ));
DOSMEM_BiosSeg = GLOBAL_CreateBlock(GMEM_FIXED,DOSMEM_dosmem+0x400,0x100,
hModule, FALSE, FALSE, FALSE, NULL );
MODULE_SetEntryPoint( hModule, 193, /* KERNEL.193: __0040H */
DOSMEM_BiosSeg );
MODULE_SetEntryPoint( hModule, 174, /* KERNEL.174: __A000H */
GLOBAL_CreateBlock( GMEM_FIXED, DOSMEM_dosmem+0xA0000,
0x10000, hModule, FALSE, FALSE, FALSE, NULL ));
MODULE_SetEntryPoint( hModule, 181, /* KERNEL.181: __B000H */
GLOBAL_CreateBlock( GMEM_FIXED, DOSMEM_dosmem+0xB0000,
0x10000, hModule, FALSE, FALSE, FALSE, NULL ));
MODULE_SetEntryPoint( hModule, 182, /* KERNEL.182: __B800H */
GLOBAL_CreateBlock( GMEM_FIXED, DOSMEM_dosmem+0xB8000,
0x10000, hModule, FALSE, FALSE, FALSE, NULL ));
MODULE_SetEntryPoint( hModule, 195, /* KERNEL.195: __C000H */
GLOBAL_CreateBlock( GMEM_FIXED, DOSMEM_dosmem+0xC0000,
0x10000, hModule, FALSE, FALSE, FALSE, NULL ));
MODULE_SetEntryPoint( hModule, 179, /* KERNEL.179: __D000H */
GLOBAL_CreateBlock( GMEM_FIXED, DOSMEM_dosmem+0xD0000,
0x10000, hModule, FALSE, FALSE, FALSE, NULL ));
MODULE_SetEntryPoint( hModule, 190, /* KERNEL.190: __E000H */
GLOBAL_CreateBlock( GMEM_FIXED, DOSMEM_dosmem+0xE0000,
0x10000, hModule, FALSE, FALSE, FALSE, NULL ));
MODULE_SetEntryPoint( hModule, 173, /* KERNEL.173: __ROMBIOS */
GLOBAL_CreateBlock( GMEM_FIXED, DOSMEM_dosmem+0xF0000,
0x10000, hModule, FALSE, FALSE, FALSE, NULL ));
MODULE_SetEntryPoint( hModule, 194, /* KERNEL.194: __F000H */
GLOBAL_CreateBlock( GMEM_FIXED, DOSMEM_dosmem+0xF0000,
0x10000, hModule, FALSE, FALSE, FALSE, NULL ));
0, FALSE, FALSE, FALSE, NULL );
DOSMEM_FillBiosSegment();
DOSMEM_InitMemoryHandling();
DOSMEM_InitCollateTable();
return TRUE;
}
@ -215,29 +203,6 @@ void DOSMEM_FillBiosSegment(void)
pBiosData->KbdBufferEnd = 0x3e;
}
/***********************************************************************
* DOSMEM_InitCollateTable
*
* Initialises the collate table (character sorting, language dependend)
*/
DWORD DOSMEM_CollateTable;
void
DOSMEM_InitCollateTable()
{
DWORD x;
unsigned char *tbl;
int i;
x=GlobalDOSAlloc(258);
DOSMEM_CollateTable=MAKELONG(0,(x>>16));
tbl=DOSMEM_RealMode2Linear(DOSMEM_CollateTable);
*(WORD*)tbl = 0x100;
tbl+=2;
for (i=0;i<0x100;i++)
*tbl++=i;
}
/***********************************************************************
* GlobalDOSAlloc (KERNEL.184)
*
@ -340,7 +305,7 @@ LPVOID DOSMEM_RealMode2Linear(DWORD x)
}
/***********************************************************************
* DOSMEM_RealMode2Linear
* DOSMEM_AllocSelector
*
* Allocates a protected mode selector for a realmode segment.
*/

Some files were not shown because too many files have changed in this diff Show More