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

Release 970101

Wed Jan 1 15:36:17 1997 Alexandre Julliard <julliard@lrc.epfl.ch> * [controls/listbox.c] Use FindFirstFile/FindNextFile in LISTBOX_Directory. * [files/dos_fs.c] Rewrote FindFirstFile/FindNextFile to use DOSFS_FindNext(). * [files/file.c] [files/directory.c] Use Win32 kernel objects and handles for file handles. Unified SearchPath() and OpenFile(). * [loader/builtin.c] Moved to if1632/ directory. * [tools/build.c] [debugger/*] [miscemu/*] Win16 register functions now receive the same CONTEXT * structure as Win32 functions. * [include/sigcontext.h] [miscemu/instr.c] Added new macros to get register values from the SIGCONTEXT structure (only used for instruction emulation now). * [scheduler/process.c] [scheduler/thread.c] (New files) Allocate process and thread structures. * [scheduler/process.c] [win32/k32obj.c] Added Win32 kernel objects and handles management. * [loader/task.c] Create a Win32 process and thread for every Win16 task. * [misc/commdlg.c] [misc/shell.c] [windows/msgbox.c] Built-in resources are now in Win32 format. This also avoids 16-bit callbacks for built-in dialogs. * [misc/lzexpand.c] Differentiate between 16-bit and 32-bit file handles. * [miscemu/int*.c] Moved all int emulation to msdos/ directory. * [msdos/*] New directory msdos/ contains all MS-DOS emulation code that can also be used for Winelib; this should enable Winelib apps to use DOS3Call and related functions. * [rc/winerc.c] A few bug fixes for Win32 resource format. * [windows/winpos.c] Hack in WINPOS_ReorderOwnerPopups() to avoid X crashed (still not right though). Sun Dec 29 17:47:55 1996 O. Flebbe <flebbe@science-computing.uni-tuebingen.de> * [loader/pe_image.c] Make sure BSS of a PE_Image is zero. Sat Dec 28 22:15:34 1996 Alex Korobka <alex@trantor.pharm.sunysb.edu> * [windows/scroll.c] ScrollWindowEx() rewrite, ScrollDC() fix. * [windows/nonclient.c] [controls/menu.c] Fixed Alt-Space crashes in dialogs. * [windows/event.c] [windows/message.c] Some changes in mouse message generation. Thu Dec 26 09:25:24 1996 Philippe De Muyter <phdm@info.ucl.ac.be> * [debugger/stabs.c] Dummy DEBUG_ReadExecutableDbgInfo provided for !__ELF__ case. Tue Dec 24 00:59:05 MET 1996 Martin Buck <martin-2.buck@student.uni-ulm.de> * [windows/event.c] Changed XK_Page_{Up,Down} to XK_{Prior,Next} for X11R5 compatibility.
parent 7ebe1a41
This is release 961222 of Wine, the MS Windows emulator. This is still a
This is release 970101 of Wine, the MS Windows emulator. This is still a
developer's only release. There are many bugs and many unimplemented API
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.
......
----------------------------------------------------------------------
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>
* [graphics/metafiledrv/init.c] [graphisc/metafiledrv/mapping.c]
......
......@@ -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
......
......@@ -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 "}
......
......@@ -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 ])
......
......@@ -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 ) );
......
......@@ -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;
/* FIXME: should use FindFirstFile/FindNextFile */
HANDLE32 handle;
LRESULT ret = LB_OKAY;
WIN32_FIND_DATA32A entry;
int pos;
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 ) );
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 & (FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_ARCHIVE)) !=
(entry.attr & (FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_ARCHIVE))))
((attrib & ATTRIBS) != (entry.dwFileAttributes & ATTRIBS)))
continue;
if (long_names) strcpy( buffer, entry.unixname );
else strcpy( buffer, DOSFS_ToDosDTAFormat( entry.name ) );
#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:
......
......@@ -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 );
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, wndPtr->wIDmenu, 0 );
MENU_TrackMenu( (HMENU16)wndPtr->wIDmenu, TPM_LEFTALIGN | TPM_LEFTBUTTON,
pt.x, pt.y, hwnd, NULL );
SendMessage16( hwnd, WM_EXITMENULOOP, 0, 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,53 +1883,48 @@ 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) )
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;
if( IsMenu( hTrackMenu ) )
{
HideCaret(0);
SendMessage16( wndPtr->hwndSelf, WM_ENTERMENULOOP, 0, 0 );
SendMessage16( wndPtr->hwndSelf, WM_INITMENU, wndPtr->wIDmenu, 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 );
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);
SendMessage16( wndPtr->hwndSelf, WM_EXITMENULOOP, 0, 0 );
ShowCaret(0);
return;
if( uItem == 0xFFFF ) MessageBeep(0);
htMenu = 0;
}
}
switch( htMenu )
{
case HTMENU:
MENU_SelectItem( wndPtr->hwndSelf, hTrackMenu, uItem, TRUE );
if( uItem == NO_SELECTED_ITEM )
MENU_SelectItemRel( wndPtr->hwndSelf, hTrackMenu, ITEM_NEXT );
......@@ -1893,9 +1933,17 @@ void MENU_TrackKbdMenuBar( WND* wndPtr, UINT wParam, INT vkey)
MENU_TrackMenu( hTrackMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON,
0, 0, wndPtr->hwndSelf, NULL );
break;
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)
......
......@@ -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 ------------------------- */
......
......@@ -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;
}
}
......@@ -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.
*/
void DEBUG_EnterDebugger(void)
{
kill( getpid(), SIGHUP );
}
/***********************************************************************
* DebugBreak16 (KERNEL.203)
* Debugger main loop.
*/
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);
......
......@@ -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\.~@]*
%%
......
......@@ -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;
}
......
......@@ -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 );
......
......@@ -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)
{
......
......@@ -372,4 +372,12 @@ leave:
}
#else /* !__ELF__ */
int
DEBUG_ReadExecutableDbgInfo(void)
{
return FALSE;
}
#endif /* __ELF__ */
......@@ -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) );
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);
......
prefix = @prefix@
sysconfdir = @sysconfdir@
DEFS = -D__WINE__ -DETCDIR=\"$(sysconfdir)\"
DEFS = -D__WINE__ -DNO_TRANSITION_TYPES -DETCDIR=\"$(sysconfdir)\"
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ..
SRCDIR = @srcdir@
......
......@@ -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,
......
......@@ -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;
......
......@@ -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 */
......
......@@ -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 )
......
......@@ -55,6 +55,7 @@ DLLS = \
SPEC_FILES = $(DLLS:.spec=.s)
C_SRCS = \
builtin.c \
dummy.c \
relay.c \
thunk.c
......
......@@ -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 */
......@@ -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
......
......@@ -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,7 +201,7 @@ base 1
0196 stdcall GetCurrentDirectoryA(long ptr) GetCurrentDirectory32A
0197 stdcall GetCurrentDirectoryW(long ptr) GetCurrentDirectory32W
0198 stdcall GetCurrentProcess() GetCurrentProcess
0199 stdcall GetCurrentProcessId() GetCurrentThreadId
0199 stdcall GetCurrentProcessId() GetCurrentProcessId
0200 stdcall GetCurrentThread() GetCurrentThread
0201 stdcall GetCurrentThreadId() GetCurrentThreadId
0202 stub GetDateFormatA
......@@ -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
......@@ -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
......
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
......
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
......
......@@ -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;
}
}
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -9,6 +9,7 @@
#include <X11/extensions/XShm.h>
#include "gdi.h"
#include "xmalloc.h"
#ifdef PRELIMINARY_WING16_SUPPORT
......
......@@ -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);
......
......@@ -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
......
......@@ -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);
......
......@@ -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 */
/*
* DOS directory handling declarations
*
* Copyright 1996 Alexandre Julliard
*/
#ifndef __WINE_DIRECTORY_H
#define __WINE_DIRECTORY_H
extern int DIR_Init(void);
extern UINT32 DIR_GetWindowsUnixDir( LPSTR path, UINT32 count );
extern UINT32 DIR_GetSystemUnixDir( LPSTR path, UINT32 count );
extern UINT32 DIR_GetTempUnixDir( LPSTR path, UINT32 count );
extern UINT32 DIR_GetDosPath( INT32 element, LPSTR path, UINT32 count );
extern UINT32 DIR_GetUnixPath( INT32 element, LPSTR path, UINT32 count );
#endif /* __WINE_DIRECTORY_H */
......@@ -8,21 +8,10 @@
#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 */
......@@ -6,8 +6,7 @@
#ifndef __WINE_EXCEPT_H
#define __WINE_EXCEPT_H
#include "wintypes.h"
#include "registers.h"
#include "winnt.h"
/*
* exception codes
*/
......
......@@ -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 */
/*
* 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 */
......@@ -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 );
......
......@@ -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,
......
......@@ -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 */
......@@ -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 */
extern DWORD INT1A_GetTicksSinceMidnight(void);
/* miscemu/int21.c */
extern BOOL32 INT21_Init(void);
/* msdos/ioports.c */
extern DWORD IO_inport( int port, int count );
extern void IO_outport( int port, int count, DWORD value );
/* miscemu/ioports.c */
extern DWORD inport( int port, int count );
extern void outport( int port, int count, DWORD value );
/* msdos/int1a.c */
extern DWORD INT1A_GetTicksSinceMidnight(void);
/* 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 */
......@@ -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 */
......
/*
* Process definitions
*
* Copyright 1996 Alexandre Julliard
*/
#ifndef __WINE_PROCESS_H
#define __WINE_PROCESS_H
#include "windows.h"
#include "winbase.h"
#include "handle32.h"
/* Process handle entry */
typedef struct
{
DWORD flags; /* Handle flags */
K32OBJ *ptr; /* Object ptr */
} HANDLE_ENTRY;
/* Process handle table */
typedef struct
{
DWORD count;
HANDLE_ENTRY entries[1];
} HANDLE_TABLE;
/* Win32 process environment database */
typedef struct
{
LPSTR environ; /* 00 Process environment strings */
DWORD unknown1; /* 04 Unknown */
LPSTR cmd_line; /* 08 Command line */
LPSTR cur_dir; /* 0c Current directory */
STARTUPINFO32A *startup_info; /* 10 Startup information */
HANDLE32 hStdin; /* 14 Handle for standard input */
HANDLE32 hStdout; /* 18 Handle for standard output */
HANDLE32 hStderr; /* 1c Handle for standard error */
DWORD unknown2; /* 20 Unknown */
DWORD inherit_console; /* 24 Inherit console flag */
DWORD break_type; /* 28 Console events flag */
K32OBJ *break_sem; /* 2c SetConsoleCtrlHandler semaphore */
K32OBJ *break_event; /* 30 SetConsoleCtrlHandler event */
K32OBJ *break_thread; /* 34 SetConsoleCtrlHandler thread */
void *break_handlers; /* 38 List of console handlers */
} ENVDB;
/* Win32 process database */
typedef struct _PDB32
{
K32OBJ header; /* 00 Kernel object header */
DWORD unknown1; /* 08 Unknown */
K32OBJ *event; /* 0c Pointer to an event object */
DWORD exit_code; /* 10 Process exit code */
DWORD unknown2; /* 14 Unknown */
HANDLE32 heap; /* 18 Default process heap */
HANDLE32 mem_context; /* 1c Process memory context */
DWORD flags; /* 20 Flags */
void *pdb16; /* 24 DOS PSP */
WORD PSP_sel; /* 28 Selector to DOS PSP */
WORD module; /* 2a IMTE for the process module */
WORD threads; /* 2c Number of threads */
WORD running_threads; /* 2e Number of running threads */
WORD unknown3; /* 30 Unknown */
WORD ring0_threads; /* 32 Number of ring 0 threads */
HANDLE32 system_heap; /* 34 System heap to allocate handles */
HTASK32 task; /* 38 Win16 task */
void *mem_map_files; /* 3c Pointer to mem-mapped files */
ENVDB *env_DB; /* 40 Environment database */
HANDLE_TABLE *handle_table; /* 44 Handle table */
struct _PDB32 *parent; /* 48 Parent process */
void *modref_list; /* 4c MODREF list */
void *thread_list; /* 50 List of threads */
void *debuggee_CB; /* 54 Debuggee context block */
void *local_heap_free; /* 58 Head of local heap free list */
DWORD unknown4; /* 5c Unknown */
CRITICAL_SECTION crit_section; /* 60 Critical section */
DWORD unknown5[3]; /* 78 Unknown */
K32OBJ *console; /* 84 Console */
DWORD tls_bits[2]; /* 88 TLS in-use bits */
DWORD process_dword; /* 90 Unknown */
struct _PDB32 *group; /* 94 Process group */
void *exe_modref; /* 98 MODREF for the process EXE */
void *top_exc_filter; /* 9c Top exception filter */
DWORD priority; /* a0 Priority level */
HANDLE32 heap_list; /* a4 Head of process heap list */
void *heap_handles; /* a8 Head of heap handles list */
DWORD unknown6; /* ac Unknown */
K32OBJ *console_provider; /* b0 Console provider (??) */
WORD env_selector; /* b4 Selector to process environment */
WORD error_mode; /* b6 Error mode */
K32OBJ *load_done_evt; /* b8 Event for process loading done */
DWORD unknown7; /* bc Unknown */
} PDB32;
extern HANDLE32 PROCESS_AllocHandle( K32OBJ *ptr, DWORD flags);
extern K32OBJ *PROCESS_GetObjPtr( HANDLE32 handle, K32OBJ_TYPE type );
extern BOOL32 PROCESS_SetObjPtr( HANDLE32 handle, K32OBJ *ptr, DWORD flags );
extern PDB32 *PROCESS_Create(void);
extern void PROCESS_Destroy( K32OBJ *ptr );
extern PDB32 *pCurrentProcess;
#endif /* __WINE_PROCESS_H */
/*
* Register definitions
*
* Copyright 1995 Alexandre Julliard
*/
#ifndef __WINE_REGISTERS_H
#define __WINE_REGISTERS_H
#include "wintypes.h"
/* The Win32 register context */
#define CONTEXT_i386 0x00010000
#define CONTEXT_i486 CONTEXT_i386
#define CONTEXT_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
#define CONTEXT_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
#define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
#define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
#define SIZE_OF_80387_REGISTERS 80
typedef struct
{
DWORD ControlWord;
DWORD StatusWord;
DWORD TagWord;
DWORD ErrorOffset;
DWORD ErrorSelector;
DWORD DataOffset;
DWORD DataSelector;
BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
DWORD Cr0NpxState;
} FLOATING_SAVE_AREA;
typedef struct
{
DWORD ContextFlags;
/* These are selected by CONTEXT_DEBUG_REGISTERS */
DWORD Dr0;
DWORD Dr1;
DWORD Dr2;
DWORD Dr3;
DWORD Dr6;
DWORD Dr7;
/* These are selected by CONTEXT_FLOATING_POINT */
FLOATING_SAVE_AREA FloatSave;
/* These are selected by CONTEXT_SEGMENTS */
DWORD SegGs;
DWORD SegFs;
DWORD SegEs;
DWORD SegDs;
/* These are selected by CONTEXT_INTEGER */
DWORD Edi;
DWORD Esi;
DWORD Ebx;
DWORD Edx;
DWORD Ecx;
DWORD Eax;
/* These are selected by CONTEXT_CONTROL */
DWORD Ebp;
DWORD Eip;
DWORD SegCs;
DWORD EFlags;
DWORD Esp;
DWORD SegSs;
} CONTEXT, *PCONTEXT;
#ifndef WINELIB
#ifdef i386
extern int runtime_cpu (void);
#else
static inline int runtime_cpu(void) { return 3; }
#endif
#ifdef linux
typedef struct
{
unsigned short sc_gs, __gsh;
unsigned short sc_fs, __fsh;
unsigned short sc_es, __esh;
unsigned short sc_ds, __dsh;
unsigned long sc_edi;
unsigned long sc_esi;
unsigned long sc_ebp;
unsigned long sc_esp;
unsigned long sc_ebx;
unsigned long sc_edx;
unsigned long sc_ecx;
unsigned long sc_eax;
unsigned long sc_trapno;
unsigned long sc_err;
unsigned long sc_eip;
unsigned short sc_cs, __csh;
unsigned long sc_eflags;
unsigned long esp_at_signal;
unsigned short sc_ss, __ssh;
unsigned long i387;
unsigned long oldmask;
unsigned long cr2;
} SIGCONTEXT;
#define WINE_DATA_SELECTOR 0x2b
#define WINE_CODE_SELECTOR 0x23
#endif /* linux */
#ifdef __NetBSD__
#include <signal.h>
typedef struct sigcontext SIGCONTEXT;
#define WINE_DATA_SELECTOR 0x1f
#define WINE_CODE_SELECTOR 0x17
#endif /* NetBSD */
#if defined(__svr4__) || defined(_SCO_DS)
#include <signal.h>
#ifdef _SCO_DS
#include <sys/regset.h>
#endif
#include <sys/ucontext.h>
typedef struct ucontext SIGCONTEXT;
#define WINE_DATA_SELECTOR 0x1f
#define WINE_CODE_SELECTOR 0x17
#endif /* svr4 || SCO_DS */
#ifdef __FreeBSD__
#include <signal.h>
typedef struct sigcontext SIGCONTEXT;
#define WINE_DATA_SELECTOR 0x27
#define WINE_CODE_SELECTOR 0x1f
#endif /* FreeBSD */
#if !defined(__svr4__) && !defined(_SCO_DS)
#define EAX_reg(context) ((context)->sc_eax)
#define EBX_reg(context) ((context)->sc_ebx)
#define ECX_reg(context) ((context)->sc_ecx)
#define EDX_reg(context) ((context)->sc_edx)
#define ESI_reg(context) ((context)->sc_esi)
#define EDI_reg(context) ((context)->sc_edi)
#define EBP_reg(context) ((context)->sc_ebp)
#define CS_reg(context) ((context)->sc_cs)
#define DS_reg(context) ((context)->sc_ds)
#define ES_reg(context) ((context)->sc_es)
#define SS_reg(context) ((context)->sc_ss)
#ifdef linux
/* fs and gs are not supported on *BSD. Hopefully we won't need them. */
#define FS_reg(context) ((context)->sc_fs)
#define GS_reg(context) ((context)->sc_gs)
#endif
#ifndef __FreeBSD__
#define EFL_reg(context) ((context)->sc_eflags)
#else
#define EFL_reg(context) ((context)->sc_efl)
#endif
#define EIP_reg(context) ((context)->sc_eip)
#define ESP_reg(context) ((context)->sc_esp)
#else /* __svr4__ || _SCO_DS */
#ifdef _SCO_DS
#define gregs regs
#endif
#define EAX_reg(context) ((context)->uc_mcontext.gregs[EAX])
#define EBX_reg(context) ((context)->uc_mcontext.gregs[EBX])
#define ECX_reg(context) ((context)->uc_mcontext.gregs[ECX])
#define EDX_reg(context) ((context)->uc_mcontext.gregs[EDX])
#define ESI_reg(context) ((context)->uc_mcontext.gregs[ESI])
#define EDI_reg(context) ((context)->uc_mcontext.gregs[EDI])
#define EBP_reg(context) ((context)->uc_mcontext.gregs[EBP])
#define CS_reg(context) ((context)->uc_mcontext.gregs[CS])
#define DS_reg(context) ((context)->uc_mcontext.gregs[DS])
#define ES_reg(context) ((context)->uc_mcontext.gregs[ES])
#define SS_reg(context) ((context)->uc_mcontext.gregs[SS])
#define FS_reg(context) ((context)->uc_mcontext.gregs[FS])
#define GS_reg(context) ((context)->uc_mcontext.gregs[GS])
#define EFL_reg(context) ((context)->uc_mcontext.gregs[EFL])
#define EIP_reg(context) ((context)->uc_mcontext.gregs[EIP])
#ifdef R_ESP
#define ESP_reg(context) ((context)->uc_mcontext.gregs[R_ESP])
#else
#define ESP_reg(context) ((context)->uc_mcontext.gregs[ESP])
#endif
#endif /* __svr4__ || _SCO_DS */
#define AX_reg(context) (*(WORD*)&EAX_reg(context))
#define BX_reg(context) (*(WORD*)&EBX_reg(context))
#define CX_reg(context) (*(WORD*)&ECX_reg(context))
#define DX_reg(context) (*(WORD*)&EDX_reg(context))
#define SI_reg(context) (*(WORD*)&ESI_reg(context))
#define DI_reg(context) (*(WORD*)&EDI_reg(context))
#define BP_reg(context) (*(WORD*)&EBP_reg(context))
#define AL_reg(context) (*(BYTE*)&EAX_reg(context))
#define AH_reg(context) (*((BYTE*)&EAX_reg(context)+1))
#define BL_reg(context) (*(BYTE*)&EBX_reg(context))
#define BH_reg(context) (*((BYTE*)&EBX_reg(context)+1))
#define CL_reg(context) (*(BYTE*)&ECX_reg(context))
#define CH_reg(context) (*((BYTE*)&ECX_reg(context)+1))
#define DL_reg(context) (*(BYTE*)&EDX_reg(context))
#define DH_reg(context) (*((BYTE*)&EDX_reg(context)+1))
#define IP_reg(context) (*(WORD*)&EIP_reg(context))
#define SP_reg(context) (*(WORD*)&ESP_reg(context))
#define FL_reg(context) (*(WORD*)&EFL_reg(context))
#define SET_CFLAG(context) (EFL_reg(context) |= 0x0001)
#define RESET_CFLAG(context) (EFL_reg(context) &= 0xfffffffe)
#else /* ifndef WINELIB */
typedef void SIGCONTEXT;
#define WINE_DATA_SELECTOR 0x00
#define WINE_CODE_SELECTOR 0x00
#endif /* ifndef WINELIB */
#endif /* __WINE_REGISTERS_H */
......@@ -54,5 +54,6 @@ extern HGLOBAL16 NE_LoadResource( HMODULE16 hModule, HRSRC16 hRsrc );
extern HGLOBAL16 SYSRES_LoadResource( SYSTEM_RESOURCE id );
extern void SYSRES_FreeResource( HGLOBAL16 handle );
extern LPCVOID SYSRES_GetResPtr( SYSTEM_RESOURCE id );
#endif /* __WINE_RESOURCE_H */
......@@ -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 */
......@@ -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 */
/*
* Signal context definitions
*
* Copyright 1995 Alexandre Julliard
*/
#ifndef __WINE_SIGCONTEXT_H
#define __WINE_SIGCONTEXT_H
#ifdef WINELIB
#error This file must not be used in Winelib
#endif
#ifdef linux
typedef struct
{
unsigned short sc_gs, __gsh;
unsigned short sc_fs, __fsh;
unsigned short sc_es, __esh;
unsigned short sc_ds, __dsh;
unsigned long sc_edi;
unsigned long sc_esi;
unsigned long sc_ebp;
unsigned long sc_esp;
unsigned long sc_ebx;
unsigned long sc_edx;
unsigned long sc_ecx;
unsigned long sc_eax;
unsigned long sc_trapno;
unsigned long sc_err;
unsigned long sc_eip;
unsigned short sc_cs, __csh;
unsigned long sc_eflags;
unsigned long esp_at_signal;
unsigned short sc_ss, __ssh;
unsigned long i387;
unsigned long oldmask;
unsigned long cr2;
} SIGCONTEXT;
#endif /* linux */
#ifdef __NetBSD__
#include <signal.h>
typedef struct sigcontext SIGCONTEXT;
#endif /* NetBSD */
#if defined(__svr4__) || defined(_SCO_DS)
#include <signal.h>
#ifdef _SCO_DS
#include <sys/regset.h>
#endif
#include <sys/ucontext.h>
typedef struct ucontext SIGCONTEXT;
#endif /* svr4 || SCO_DS */
#ifdef __FreeBSD__
#include <signal.h>
typedef struct sigcontext SIGCONTEXT;
#endif /* FreeBSD */
#if !defined(__svr4__) && !defined(_SCO_DS)
#define EAX_sig(context) ((context)->sc_eax)
#define EBX_sig(context) ((context)->sc_ebx)
#define ECX_sig(context) ((context)->sc_ecx)
#define EDX_sig(context) ((context)->sc_edx)
#define ESI_sig(context) ((context)->sc_esi)
#define EDI_sig(context) ((context)->sc_edi)
#define EBP_sig(context) ((context)->sc_ebp)
#define CS_sig(context) ((context)->sc_cs)
#define DS_sig(context) ((context)->sc_ds)
#define ES_sig(context) ((context)->sc_es)
#define SS_sig(context) ((context)->sc_ss)
#ifdef linux
/* fs and gs are not supported on *BSD. Hopefully we won't need them. */
#define FS_sig(context) ((context)->sc_fs)
#define GS_sig(context) ((context)->sc_gs)
#endif
#ifndef __FreeBSD__
#define EFL_sig(context) ((context)->sc_eflags)
#else
#define EFL_sig(context) ((context)->sc_efl)
#endif
#define EIP_sig(context) ((context)->sc_eip)
#define ESP_sig(context) ((context)->sc_esp)
#else /* __svr4__ || _SCO_DS */
#ifdef _SCO_DS
#define gregs regs
#endif
#define EAX_sig(context) ((context)->uc_mcontext.gregs[EAX])
#define EBX_sig(context) ((context)->uc_mcontext.gregs[EBX])
#define ECX_sig(context) ((context)->uc_mcontext.gregs[ECX])
#define EDX_sig(context) ((context)->uc_mcontext.gregs[EDX])
#define ESI_sig(context) ((context)->uc_mcontext.gregs[ESI])
#define EDI_sig(context) ((context)->uc_mcontext.gregs[EDI])
#define EBP_sig(context) ((context)->uc_mcontext.gregs[EBP])
#define CS_sig(context) ((context)->uc_mcontext.gregs[CS])
#define DS_sig(context) ((context)->uc_mcontext.gregs[DS])
#define ES_sig(context) ((context)->uc_mcontext.gregs[ES])
#define SS_sig(context) ((context)->uc_mcontext.gregs[SS])
#define FS_sig(context) ((context)->uc_mcontext.gregs[FS])
#define GS_sig(context) ((context)->uc_mcontext.gregs[GS])
#define EFL_sig(context) ((context)->uc_mcontext.gregs[EFL])
#define EIP_sig(context) ((context)->uc_mcontext.gregs[EIP])
#ifdef R_ESP
#define ESP_sig(context) ((context)->uc_mcontext.gregs[R_ESP])
#else
#define ESP_sig(context) ((context)->uc_mcontext.gregs[ESP])
#endif
#endif /* __svr4__ || _SCO_DS */
#define AX_sig(context) (*(WORD*)&EAX_sig(context))
#define BX_sig(context) (*(WORD*)&EBX_sig(context))
#define CX_sig(context) (*(WORD*)&ECX_sig(context))
#define DX_sig(context) (*(WORD*)&EDX_sig(context))
#define SI_sig(context) (*(WORD*)&ESI_sig(context))
#define DI_sig(context) (*(WORD*)&EDI_sig(context))
#define BP_sig(context) (*(WORD*)&EBP_sig(context))
#define AL_sig(context) (*(BYTE*)&EAX_sig(context))
#define AH_sig(context) (*((BYTE*)&EAX_sig(context)+1))
#define BL_sig(context) (*(BYTE*)&EBX_sig(context))
#define BH_sig(context) (*((BYTE*)&EBX_sig(context)+1))
#define CL_sig(context) (*(BYTE*)&ECX_sig(context))
#define CH_sig(context) (*((BYTE*)&ECX_sig(context)+1))
#define DL_sig(context) (*(BYTE*)&EDX_sig(context))
#define DH_sig(context) (*((BYTE*)&EDX_sig(context)+1))
#define IP_sig(context) (*(WORD*)&EIP_sig(context))
#define SP_sig(context) (*(WORD*)&ESP_sig(context))
#define FL_sig(context) (*(WORD*)&EFL_sig(context))
#endif /* __WINE_SIGCONTEXT_H */
......@@ -51,7 +51,6 @@ extern WORD IF1632_Saved16_sp;
/* 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;
......
......@@ -10,7 +10,6 @@
#include "wintypes.h"
LPSTR STRING32_DupUniToAnsi(LPCWSTR src);
LPWSTR STRING32_DupAnsiToUni(LPCSTR src);
LPWSTR STRING32_strdupW(LPCWSTR);
......
......@@ -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 */
/*
* Thread definitions
*
* Copyright 1996 Alexandre Julliard
*/
#ifndef __WINE_THREAD_H
#define __WINE_THREAD_H
#include "process.h"
/* Thread exception block */
typedef struct _TEB
{
void *except; /* 00 Head of exception handling chain */
void *stack_top; /* 04 Top of thread stack */
void *stack_low; /* 08 Stack low-water mark */
HTASK16 htask16; /* 0c Win16 task handle */
WORD stack_sel; /* 0e 16-bit stack selector */
DWORD selman_list; /* 10 Selector manager list */
DWORD user_ptr; /* 14 User pointer */
struct _TEB *self; /* 18 Pointer to this structure */
WORD flags; /* 1c Flags */
WORD mutex_count; /* 1e Win16 mutex count */
DWORD debug_context; /* 20 Debug context */
DWORD *ppriority; /* 24 Pointer to current priority */
HQUEUE16 queue; /* 28 Message queue */
WORD pad1; /* 2a */
LPVOID *tls_ptr; /* 2c Pointer to TLS array */
} TEB;
/* Thread database */
typedef struct _THDB
{
K32OBJ header; /* 00 Kernel object header */
PDB32 *process; /* 08 Process owning this thread */
K32OBJ *event; /* 0c Thread event */
TEB teb; /* 10 Thread information block */
PDB32 *process2; /* 40 Same as offset 08 (?) */
DWORD flags; /* 44 Flags */
DWORD exit_code; /* 48 Termination status */
WORD teb_sel; /* 4c Selector to TEB */
WORD emu_sel; /* 4e 80387 emulator selector */
DWORD unknown1; /* 50 Unknown */
void *wait_list; /* 54 Event waiting list */
DWORD unknown2; /* 58 Unknown */
void *ring0_thread; /* 5c Pointer to ring 0 thread */
void *ptdbx; /* 60 Pointer to TDBX structure */
void *stack_base; /* 64 Base of the stack */
void *exit_stack; /* 68 Stack pointer on thread exit */
void *emu_data; /* 6c Related to 80387 emulation */
DWORD last_error; /* 70 Last error code */
void *debugger_CB; /* 74 Debugger context block */
DWORD debug_thread; /* 78 Thread debugging this one (?) */
void *context; /* 7c Thread register context */
DWORD unknown3[3]; /* 80 Unknown */
WORD current_ss; /* 8c Another 16-bit stack selector */
WORD pad2; /* 8e */
void *ss_table; /* 90 Pointer to info about 16-bit stack */
WORD thunk_ss; /* 94 Yet another 16-bit stack selector */
WORD pad3; /* 96 */
LPVOID tls_array[64]; /* 98 Thread local storage */
DWORD delta_priority; /* 198 Priority delta */
DWORD unknown4[7]; /* 19c Unknown */
void *create_data; /* 1b8 Pointer to creation structure */
DWORD suspend_count; /* 1bc SuspendThread() counter */
DWORD unknown5[9]; /* 1c0 Unknown */
K32OBJ *crit_section; /* 1e4 Some critical section */
K32OBJ *win16_mutex; /* 1e8 Pointer to Win16 mutex */
K32OBJ *win32_mutex; /* 1ec Pointer to KERNEL32 mutex */
K32OBJ *crit_section2; /* 1f0 Another critical section */
DWORD unknown6[2]; /* 1f4 Unknown */
} THDB;
extern THDB *THREAD_Create( PDB32 *pdb, DWORD stack_size );
extern void THREAD_Destroy( K32OBJ *ptr );
extern THDB *pCurrentThread;
#endif /* __WINE_THREAD_H */
......@@ -3,8 +3,6 @@
#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);
......
......@@ -9,11 +9,13 @@ extern int WIN32_LastError;
#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
......
......@@ -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 */
......@@ -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);
......
/*
* USER definitions
*
* Copyright 1996 Alexandre Julliard
*/
#ifndef __WINE_WINUSER_H
#define __WINE_WINUSER_H
#include "wintypes.h"
/* Window classes */
typedef struct
{
UINT32 style;
WNDPROC32 lpfnWndProc;
INT32 cbClsExtra;
INT32 cbWndExtra;
HINSTANCE32 hInstance;
HICON32 hIcon;
HCURSOR32 hCursor;
HBRUSH32 hbrBackground;
LPCSTR lpszMenuName;
LPCSTR lpszClassName;
} WNDCLASS32A, *LPWNDCLASS32A;
typedef struct
{
UINT32 style;
WNDPROC32 lpfnWndProc;
INT32 cbClsExtra;
INT32 cbWndExtra;
HINSTANCE32 hInstance;
HICON32 hIcon;
HCURSOR32 hCursor;
HBRUSH32 hbrBackground;
LPCWSTR lpszMenuName;
LPCWSTR lpszClassName;
} WNDCLASS32W, *LPWNDCLASS32W;
#pragma pack(1)
typedef struct
{
UINT16 style;
WNDPROC16 lpfnWndProc WINE_PACKED;
INT16 cbClsExtra;
INT16 cbWndExtra;
HANDLE16 hInstance;
HICON16 hIcon;
HCURSOR16 hCursor;
HBRUSH16 hbrBackground;
SEGPTR lpszMenuName WINE_PACKED;
SEGPTR lpszClassName WINE_PACKED;
} WNDCLASS16, *LPWNDCLASS16;
#pragma pack(4)
typedef struct
{
UINT32 cbSize;
UINT32 style;
WNDPROC32 lpfnWndProc;
INT32 cbClsExtra;
INT32 cbWndExtra;
HINSTANCE32 hInstance;
HICON32 hIcon;
HCURSOR32 hCursor;
HBRUSH32 hbrBackground;
LPCSTR lpszMenuName;
LPCSTR lpszClassName;
HICON32 hIconSm;
} WNDCLASSEX32A, *LPWNDCLASSEX32A;
typedef struct
{
UINT32 cbSize;
UINT32 style;
WNDPROC32 lpfnWndProc;
INT32 cbClsExtra;
INT32 cbWndExtra;
HINSTANCE32 hInstance;
HICON32 hIcon;
HCURSOR32 hCursor;
HBRUSH32 hbrBackground;
LPCWSTR lpszMenuName;
LPCWSTR lpszClassName;
HICON32 hIconSm;
} WNDCLASSEX32W, *LPWNDCLASSEX32W;
typedef struct
{
UINT32 cbSize;
UINT32 style;
WNDPROC16 lpfnWndProc;
INT16 cbClsExtra;
INT16 cbWndExtra;
HANDLE16 hInstance;
HICON16 hIcon;
HCURSOR16 hCursor;
HBRUSH16 hbrBackground;
SEGPTR lpszMenuName;
SEGPTR lpszClassName;
HICON16 hIconSm;
} WNDCLASSEX16, *LPWNDCLASSEX16;
DECL_WINELIB_TYPE_AW(WNDCLASS);
DECL_WINELIB_TYPE_AW(LPWNDCLASS);
DECL_WINELIB_TYPE_AW(WNDCLASSEX);
DECL_WINELIB_TYPE_AW(LPWNDCLASSEX);
#define CS_VREDRAW 0x0001
#define CS_HREDRAW 0x0002
#define CS_KEYCVTWINDOW 0x0004
#define CS_DBLCLKS 0x0008
#define CS_OWNDC 0x0020
#define CS_CLASSDC 0x0040
#define CS_PARENTDC 0x0080
#define CS_NOKEYCVT 0x0100
#define CS_NOCLOSE 0x0200
#define CS_SAVEBITS 0x0800
#define CS_BYTEALIGNCLIENT 0x1000
#define CS_BYTEALIGNWINDOW 0x2000
#define CS_GLOBALCLASS 0x4000
/* Offsets for GetClassLong() and GetClassWord() */
#define GCL_MENUNAME (-8)
#define GCW_HBRBACKGROUND (-10)
#define GCL_HBRBACKGROUND GCW_HBRBACKGROUND
#define GCW_HCURSOR (-12)
#define GCL_HCURSOR GCW_HCURSOR
#define GCW_HICON (-14)
#define GCL_HICON GCW_HICON
#define GCW_HMODULE (-16)
#define GCL_HMODULE GCW_HMODULE
#define GCW_CBWNDEXTRA (-18)
#define GCL_CBWNDEXTRA GCW_CBWNDEXTRA
#define GCW_CBCLSEXTRA (-20)
#define GCL_CBCLSEXTRA GCW_CBCLSEXTRA
#define GCL_WNDPROC (-24)
#define GCW_STYLE (-26)
#define GCL_STYLE GCW_STYLE
#define GCW_ATOM (-32)
#define GCW_HICONSM (-34)
#define GCL_HICONSM GCW_HICONSM
#endif /* __WINE_WINUSER_H */
......@@ -11,7 +11,6 @@
#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;
......
......@@ -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 );
......
......@@ -6,7 +6,6 @@ VPATH = @srcdir@
MODULE = loader
C_SRCS = \
builtin.c \
main.c \
module.c \
ne_image.c \
......
......@@ -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)
......
......@@ -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
......
......@@ -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;
}
......
......@@ -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"
......@@ -420,6 +419,7 @@ problem needs to be fixed properly at some stage */
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;
......
......@@ -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 );
}
......
......@@ -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;
}
......@@ -1204,12 +1204,28 @@ BOOL32 HeapWalk( HANDLE32 heap, void *entry )
/***********************************************************************
* HEAP_xalloc
*
* Same as HeapAlloc(), but die on failure.
*/
LPVOID HEAP_xalloc( HANDLE32 heap, DWORD flags, DWORD size )
{
LPVOID p = HeapAlloc( heap, flags, size );
if (!p)
{
fprintf( stderr, "Virtual memory exhausted.\n" );
exit(1);
}
return p;
}
/***********************************************************************
* HEAP_strdupA
*/
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;
}
......@@ -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
(base < (DWORD)DOSMEM_dosmem+0x100000)) base -= (DWORD)DOSMEM_dosmem;
return base;
}
......
......@@ -11,6 +11,7 @@ C_SRCS = \
commdlg.c \
compobj.c \
crtdll.c \
cpu.c \
driver.c \
exec.c \
escape.c \
......
......@@ -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 */
}
/*****************************************************************************
......
......@@ -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__ */
}
/*
* 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;
}
......@@ -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);
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,'!'))) {
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
......@@ -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);
......
......@@ -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:
......
......@@ -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;
}
......
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment