Commit bd34d4ff authored by Alexandre Julliard's avatar Alexandre Julliard

Release 950620

Mon Jun 19 20:29:50 1995 Alexandre Julliard (julliard@sunsite.unc.edu) * [debugger/*.c] Modified debugger to use segmented pointers everywhere. * [if1632/shell.spec] [if1632/sound.spec] [if1632/user.spec] Declared all functions that return only 16-bit as 'pascal16'. * [include/ldt.h] [memory/ldt.c] Export LDT_EntryToBytes (new) and LDT_BytesToEntry for DPMI. Maintain a copy of the selector flags, removing the need to make a system call to retrieve an LDT entry. * [loader/module.c] Fixed bug with module file handle cache. * [loader/ne_resource.c] Fixed file name bug in NE_AccessResource(). * [loader/resource.c] Fixed bug in LoadIcon() that caused wrong colors to be used for the icon mask. * [loader/signal.c] Moved instruction emulation to miscemu/instr.c. * [misc/dos_fs.c] [miscemu/int21.c] Lots of small fixes, thanks to Morten Welinder. * [miscemu/dpmi.c] More complete DPMI emulation. * [miscemu/instr.c] Added support for prefixes in instructions to emulate. * [miscemu/int2f.c] Use register macros instead of destroying the high part of 32-bit registers. * [objects/dc.c] Fixed bug in GetDCState() that failed to clear the new DC. * [rc/sysres.rc] Removed dialogs 11 and 12 that were never used. * [tools/build.c] 'pascal16' generated functions did not save %dx. Removed use of %fs to access the stack. %ds is no longer initialized before calling a 16-bit routine. * [windows/defwnd.c] Accept a NULL pointer as window title. * [windows/mdi.c] MDICascade: skip iconic windows. Implemented CalcChildScroll(). * [windows/utility.c] Fixed MulDiv() for illegal values. * [windows/win.c] Fixed X error in CreateWindowEx() when WM_NCCALCSIZE returned a zero width or height. Sun Jun 18 22:22:30 MET DST 1995 Fons Botman (botman@inter.nl.net) * [controls/edit.c] Fixed "uninitalized" message which -Wall couldnt see to be ok in EDIT_WriteText. * [include/debug.h] Added define for extra checks in API definitions during debugging. * [loader/ne_image.c] Added newline in NE_FixupPrologs to avoid long lines. * [misc/dos_fs.c] Added extra safety check in DOS_ValidDrive. * [misc/exec.c] Fixed definition of ExitWindows. Sun Jun 18 21:16:08 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [controls/edit.c] Some fixes, mostly for memory management, but also for text selection and tab postitions. General cleanup. Notepad.exe now works. * [controls/combo.c] Fix: the hwnd field of the DRAWITEMSTRUCT should always be that of the combo box, not the ComboLBox that belongs to it. * [controls/listbox.c] Handle itemID field correctly throughout. * [memory/local.c] Implemented flag LMEM_ZEROINIT. LocalReAlloc() could trash the heap. Fixed. * [objects/font.c] FONT_MatchFont(): don't get confused by negative widths. Fixed a segfault in EnumFonts(). * [objects/text.c] DrawText(): DT_CALCRECT implies DT_NOCLIP. * [objects/dcvalues.c] MAKELONG was used with bad parameters in DC_GET_X_Y. * [windows/dialog.c] Don't show the dialog if WS_VISIBLE isn't set in the template. * [windows/utility.c] UTILITY_convertArgs(): Never pass an expression containing ++ into a macro... * [windows/win.c] SetParent() should unlink the window before changing the parent. * [windows/message.c] Don't call timer functions via CallWindowProc(), since it checks whether hwnd==0 and does not call the function in that case. * [miscemu/instr.c] Ignore interrupt 0x3D, for VBRUN300.DLL. * [misc/commdlg.c] Don't rely on the itemData field of the DRAWITEMSTRUCT to contain a pointer to the item text. * [if1632/relay.c] Disable OLE and DDEML DLLs by default, since they contain nothing but stubs anyway. SHELL, COMMDLG and WIN87EM are left enabled, although some programs may work better without them. * [multimedia/*.c] [include/multimedia.h] [include/driver.h] Begun cleaning things up a little. Replaced printfs with dprintf_ macros, made functions static where possible, and some other minor changes. Sun Jun 11 23:19:10 1995 Martin von Loewis <martin@informatik.hu-berlin.de> * [debugger/dbg.y][debugger/dbg.l] Removed special handling for FILE_IDENTIFER, because it caused problems with x/<format> statements. * [debugger/info.c] Use SC_ESP instead of SC_EIP for stack dump. * [misc/compobj.c][if1632/compobj.spec] CoBuildVersion, CoInitialize, CoUninitialize: new functions * [misc/ole2.c][if1632/ole2.spec][misc/Imakefile][include/ole2.h] New files ole2.c, ole2.h OleBuildVersion, OleInitialize, OleUninitialize: new functions * [if1632/ole2disp.spec] Added missing ordinals above 109 * [misc/ole2nls.c][if1632/ole2nls.spec][include/winnls.h] New file winnls.h GetLocaleInfoA: new function * [if1632/shell.spec] Added FindEnvironmentString as stub * [misc/olecli.c][if1632/olecli.spec] OleIsDcMeta: New function * [objects/font][misc/gdi.spec] GetKerningPairs: new function * [misc/shell.c] ShellExecute: Implemented support for starting programs * [if1632/user.spec] Inserted missing relay to GetClipCursor Sun Jun 11 20:34:47 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [controls/edit.c] Fix a problem with the local heap. * [include/wintypes.h] Fixed wrong declarations of CATCHBUF and LPCATCHBUF. * [include/mdi.h] [windows/mdi.c] This code still assumed segmented address==linear address. Fixed. * [include/msdos.h] [misc/dos_fs.c] The filemask field of the dosdirent structure could be overrun. Fixed. If you had a file called foobar and a file called foo, trying to FindFile(foo) could accidentally find file foobar instead. Fixed. * [misc/file.c] OpenFile(): Always return the full pathname in ofs->szPathName. This also fixes GetModuleFilename(). Prevent _lclose() from closing stderr or stdout. * [misc/profile.c] Search for .ini files in the path of the current module as well. (Needed by Lotus Organizer.) * [loader/task.c] [loader/ne_image.c] [loader/module.c] [memory/local.c] Local heaps are now initialized by InitTask() for executables. DLLs have to call LocalInit() themselves, LocalInit() has to put the heap at the end of the segment when called with start==0. We no longer allocate the DGROUP with 64k on startup, but grow the local heap in LOCAL_GetBlock() when necessary. * [loader/module.c] LoadLibrary() should call LoadModule() in all cases, even if the DLL is already loaded, to ensure that the reference count is correct. * [loader/ne_image.c] Some changes to function prolog fixup. Does anyone know exactly how this is supposed to work? I am only guessing here. In NE_InitializeDLLs(), initialize the DLLs a module refers to before the module itself. * [loader/task.c] Initialize instance data at the beginning of the DGROUP in InitTask(). * [memory/local.c] Some fixes for moveable blocks. * [memory/selector.c] All the IsBad*Pointer() functions returned exactly the wrong boolean value in all cases! * [objects/bitblt.c] Fixed another null pointer dereference in debugging output. * [objects/font.c] Some more recovery possibilities for FONT_MatchFont() if a specified font does not exist. * [windows/win.c] The dialog code may call CreateWindowEx with an integer in windowName. This happens for static icon controls that expect a resource ID as the window name. CreateWindowEx() used to crash. Fixed. * [windows/class.c] [windows/win.c] Window classes are owned by modules, not instances. Changed RegisterClass(), UnregisterClass(), GetClassInfo() and CreateWindowEx() accordingly. Sat Jun 10 16:10:53 1995 Olaf Flebbe <o.flebbe@science-computing.uni-tuebingen.de> * [miscemu/int21.c] clock.exe was displaying incorrect year. Fri Jun 9 20:36:56 1995 Victor Schneider <tailor@crl.com> * [include/cursor.h] [windows/cursor.c] Implemented CreateCursorIconIndirect().
parent a2f2e019
This is release 950606 of Wine the MS Windows emulator. This is still a This is release 950620 of Wine the MS Windows emulator. This is still a
developer's only release. There are many bugs and many unimplemented API developer's only release. There are many bugs and many unimplemented API
features. Most applications still do not work. features. Most applications still do not work.
Patches should be submitted to "wine-new@amscons.com". Please don't forget Patches should be submitted to "wine-new@amscons.com". Please don't forget
to include a ChangeLog entry. I'll make a new release every other Sunday. to include a ChangeLog entry. I'll make a new release every other Sunday.
WHAT'S NEW with Wine-950606: (see ChangeLog for details) WHAT'S NEW with Wine-950620: (see ChangeLog for details)
- Lots of module fixes. - Many fixes to edit and listbox controls.
- Better interrupt vectors emulation. - Better MDI code.
- Stack no longer limited to 64k when calling X bitmap functions. - Many local heap fixes.
- Some built-in DLLs are now disabled by default.
- Lots of bug fixes. - Lots of bug fixes.
See the README file in the distribution for installation instructions. See the README file in the distribution for installation instructions.
...@@ -17,11 +18,11 @@ Because of lags created by using mirror, this message may reach you before ...@@ -17,11 +18,11 @@ Because of lags created by using mirror, this message may reach you before
the release is available at the ftp sites. The sources will be available the release is available at the ftp sites. The sources will be available
from the following locations: from the following locations:
sunsite.unc.edu:/pub/Linux/ALPHA/wine/Wine-950606.tar.gz sunsite.unc.edu:/pub/Linux/ALPHA/wine/Wine-950620.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-950606.tar.gz tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-950620.tar.gz
ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-950606.tar.gz ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-950620.tar.gz
ftp.funet.fi:/pub/OS/Linux/ALPHA/Wine/Wine-950606.tar.gz ftp.funet.fi:/pub/OS/Linux/ALPHA/Wine/Wine-950620.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-950606.tar.gz aris.com:/pub/linux/ALPHA/Wine/development/Wine-950620.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite. It should also be available from any site that mirrors tsx-11 or sunsite.
......
---------------------------------------------------------------------- ----------------------------------------------------------------------
Mon Jun 19 20:29:50 1995 Alexandre Julliard (julliard@sunsite.unc.edu)
* [debugger/*.c]
Modified debugger to use segmented pointers everywhere.
* [if1632/shell.spec] [if1632/sound.spec] [if1632/user.spec]
Declared all functions that return only 16-bit as 'pascal16'.
* [include/ldt.h] [memory/ldt.c]
Export LDT_EntryToBytes (new) and LDT_BytesToEntry for DPMI.
Maintain a copy of the selector flags, removing the need to make a
system call to retrieve an LDT entry.
* [loader/module.c]
Fixed bug with module file handle cache.
* [loader/ne_resource.c]
Fixed file name bug in NE_AccessResource().
* [loader/resource.c]
Fixed bug in LoadIcon() that caused wrong colors to be used for
the icon mask.
* [loader/signal.c]
Moved instruction emulation to miscemu/instr.c.
* [misc/dos_fs.c] [miscemu/int21.c]
Lots of small fixes, thanks to Morten Welinder.
* [miscemu/dpmi.c]
More complete DPMI emulation.
* [miscemu/instr.c]
Added support for prefixes in instructions to emulate.
* [miscemu/int2f.c]
Use register macros instead of destroying the high part of 32-bit
registers.
* [objects/dc.c]
Fixed bug in GetDCState() that failed to clear the new DC.
* [rc/sysres.rc]
Removed dialogs 11 and 12 that were never used.
* [tools/build.c]
'pascal16' generated functions did not save %dx.
Removed use of %fs to access the stack.
%ds is no longer initialized before calling a 16-bit routine.
* [windows/defwnd.c]
Accept a NULL pointer as window title.
* [windows/mdi.c]
MDICascade: skip iconic windows.
Implemented CalcChildScroll().
* [windows/utility.c]
Fixed MulDiv() for illegal values.
* [windows/win.c]
Fixed X error in CreateWindowEx() when WM_NCCALCSIZE returned
a zero width or height.
Sun Jun 18 22:22:30 MET DST 1995 Fons Botman (botman@inter.nl.net)
* [controls/edit.c]
Fixed "uninitalized" message which -Wall couldnt see to be ok
in EDIT_WriteText.
* [include/debug.h]
Added define for extra checks in API definitions during debugging.
* [loader/ne_image.c]
Added newline in NE_FixupPrologs to avoid long lines.
* [misc/dos_fs.c]
Added extra safety check in DOS_ValidDrive.
* [misc/exec.c]
Fixed definition of ExitWindows.
Sun Jun 18 21:16:08 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
* [controls/edit.c]
Some fixes, mostly for memory management, but also for text selection
and tab postitions. General cleanup. Notepad.exe now works.
* [controls/combo.c]
Fix: the hwnd field of the DRAWITEMSTRUCT should always be that of
the combo box, not the ComboLBox that belongs to it.
* [controls/listbox.c]
Handle itemID field correctly throughout.
* [memory/local.c]
Implemented flag LMEM_ZEROINIT.
LocalReAlloc() could trash the heap. Fixed.
* [objects/font.c]
FONT_MatchFont(): don't get confused by negative widths.
Fixed a segfault in EnumFonts().
* [objects/text.c]
DrawText(): DT_CALCRECT implies DT_NOCLIP.
* [objects/dcvalues.c]
MAKELONG was used with bad parameters in DC_GET_X_Y.
* [windows/dialog.c]
Don't show the dialog if WS_VISIBLE isn't set in the template.
* [windows/utility.c]
UTILITY_convertArgs(): Never pass an expression containing ++ into a
macro...
* [windows/win.c]
SetParent() should unlink the window before changing the parent.
* [windows/message.c]
Don't call timer functions via CallWindowProc(), since it checks
whether hwnd==0 and does not call the function in that case.
* [miscemu/instr.c]
Ignore interrupt 0x3D, for VBRUN300.DLL.
* [misc/commdlg.c]
Don't rely on the itemData field of the DRAWITEMSTRUCT to contain a
pointer to the item text.
* [if1632/relay.c]
Disable OLE and DDEML DLLs by default, since they contain nothing but
stubs anyway. SHELL, COMMDLG and WIN87EM are left enabled, although
some programs may work better without them.
* [multimedia/*.c] [include/multimedia.h] [include/driver.h]
Begun cleaning things up a little. Replaced printfs with dprintf_
macros, made functions static where possible, and some other minor
changes.
Sun Jun 11 23:19:10 1995 Martin von Loewis <martin@informatik.hu-berlin.de>
* [debugger/dbg.y][debugger/dbg.l]
Removed special handling for FILE_IDENTIFER, because it caused
problems with x/<format> statements.
* [debugger/info.c]
Use SC_ESP instead of SC_EIP for stack dump.
* [misc/compobj.c][if1632/compobj.spec]
CoBuildVersion, CoInitialize, CoUninitialize: new functions
* [misc/ole2.c][if1632/ole2.spec][misc/Imakefile][include/ole2.h]
New files ole2.c, ole2.h
OleBuildVersion, OleInitialize, OleUninitialize: new functions
* [if1632/ole2disp.spec]
Added missing ordinals above 109
* [misc/ole2nls.c][if1632/ole2nls.spec][include/winnls.h]
New file winnls.h
GetLocaleInfoA: new function
* [if1632/shell.spec]
Added FindEnvironmentString as stub
* [misc/olecli.c][if1632/olecli.spec]
OleIsDcMeta: New function
* [objects/font][misc/gdi.spec]
GetKerningPairs: new function
* [misc/shell.c]
ShellExecute: Implemented support for starting programs
* [if1632/user.spec]
Inserted missing relay to GetClipCursor
Sun Jun 11 20:34:47 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
* [controls/edit.c]
Fix a problem with the local heap.
* [include/wintypes.h]
Fixed wrong declarations of CATCHBUF and LPCATCHBUF.
* [include/mdi.h] [windows/mdi.c]
This code still assumed segmented address==linear address. Fixed.
* [include/msdos.h] [misc/dos_fs.c]
The filemask field of the dosdirent structure could be overrun. Fixed.
If you had a file called foobar and a file called foo, trying to
FindFile(foo) could accidentally find file foobar instead. Fixed.
* [misc/file.c]
OpenFile(): Always return the full pathname in ofs->szPathName. This
also fixes GetModuleFilename().
Prevent _lclose() from closing stderr or stdout.
* [misc/profile.c]
Search for .ini files in the path of the current module as well.
(Needed by Lotus Organizer.)
* [loader/task.c] [loader/ne_image.c] [loader/module.c]
[memory/local.c]
Local heaps are now initialized by InitTask() for executables. DLLs
have to call LocalInit() themselves, LocalInit() has to put the
heap at the end of the segment when called with start==0. We no longer
allocate the DGROUP with 64k on startup, but grow the local heap
in LOCAL_GetBlock() when necessary.
* [loader/module.c]
LoadLibrary() should call LoadModule() in all cases, even if the
DLL is already loaded, to ensure that the reference count is correct.
* [loader/ne_image.c]
Some changes to function prolog fixup. Does anyone know exactly how
this is supposed to work? I am only guessing here.
In NE_InitializeDLLs(), initialize the DLLs a module refers to before
the module itself.
* [loader/task.c]
Initialize instance data at the beginning of the DGROUP in InitTask().
* [memory/local.c]
Some fixes for moveable blocks.
* [memory/selector.c]
All the IsBad*Pointer() functions returned exactly the wrong boolean
value in all cases!
* [objects/bitblt.c]
Fixed another null pointer dereference in debugging output.
* [objects/font.c]
Some more recovery possibilities for FONT_MatchFont() if a specified
font does not exist.
* [windows/win.c]
The dialog code may call CreateWindowEx with an integer in windowName.
This happens for static icon controls that expect a resource ID as
the window name. CreateWindowEx() used to crash. Fixed.
* [windows/class.c] [windows/win.c]
Window classes are owned by modules, not instances. Changed
RegisterClass(), UnregisterClass(), GetClassInfo() and CreateWindowEx()
accordingly.
Sat Jun 10 16:10:53 1995 Olaf Flebbe <o.flebbe@science-computing.uni-tuebingen.de>
* [miscemu/int21.c]
clock.exe was displaying incorrect year.
Fri Jun 9 20:36:56 1995 Victor Schneider <tailor@crl.com>
* [include/cursor.h] [windows/cursor.c]
Implemented CreateCursorIconIndirect().
----------------------------------------------------------------------
Tue Jun 6 12:11:41 1995 Alexandre Julliard (julliard@sunsite.unc.edu) Tue Jun 6 12:11:41 1995 Alexandre Julliard (julliard@sunsite.unc.edu)
* [controls/menu.c] * [controls/menu.c]
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "user.h" #include "user.h"
#include "win.h" #include "win.h"
#include "stddebug.h" #include "stddebug.h"
/* #define DEBUG_COMBO */
#include "debug.h" #include "debug.h"
#include "graphics.h" #include "graphics.h"
#include "listbox.h" #include "listbox.h"
...@@ -791,6 +790,7 @@ static LONG CBLPaint( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -791,6 +790,7 @@ static LONG CBLPaint( HWND hwnd, WORD message, WORD wParam, LONG lParam )
PAINTSTRUCT ps; PAINTSTRUCT ps;
HBRUSH hBrush; HBRUSH hBrush;
HFONT hOldFont; HFONT hOldFont;
HWND combohwnd = CLBoxGetCombo(hwnd);
HDC hdc; HDC hdc;
RECT rect; RECT rect;
int i, top, height; int i, top, height;
...@@ -829,15 +829,15 @@ static LONG CBLPaint( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -829,15 +829,15 @@ static LONG CBLPaint( HWND hwnd, WORD message, WORD wParam, LONG lParam )
dprintf_listbox(stddeb,"drawing item: %d %d %d %d %d\n",rect.left,top,rect.right,top+height,lpls->itemState); dprintf_listbox(stddeb,"drawing item: %d %d %d %d %d\n",rect.left,top,rect.right,top+height,lpls->itemState);
if (OWNER_DRAWN(lphl)) { if (OWNER_DRAWN(lphl)) {
ListBoxDrawItem (hwnd, lphl, hdc, lpls, &lpls->itemRect, ODA_DRAWENTIRE, 0); ListBoxDrawItem (combohwnd, lphl, hdc, lpls, &lpls->itemRect, ODA_DRAWENTIRE, 0);
if (lpls->itemState) if (lpls->itemState)
ListBoxDrawItem (hwnd, lphl, hdc, lpls, &lpls->itemRect, ODA_SELECT, ODS_SELECTED); ListBoxDrawItem (combohwnd, lphl, hdc, lpls, &lpls->itemRect, ODA_SELECT, ODS_SELECTED);
} else { } else {
ListBoxDrawItem (hwnd, lphl, hdc, lpls, &lpls->itemRect, ODA_DRAWENTIRE, ListBoxDrawItem (combohwnd, lphl, hdc, lpls, &lpls->itemRect, ODA_DRAWENTIRE,
lpls->itemState); lpls->itemState);
} }
if ((lphl->ItemFocused == i) && GetFocus() == hwnd) if ((lphl->ItemFocused == i) && GetFocus() == hwnd)
ListBoxDrawItem (hwnd,lphl, hdc, lpls, &lpls->itemRect, ODA_FOCUS, ODS_FOCUS); ListBoxDrawItem (combohwnd, lphl, hdc, lpls, &lpls->itemRect, ODA_FOCUS, ODS_FOCUS);
top += height; top += height;
lphl->ItemsVisible++; lphl->ItemsVisible++;
...@@ -876,7 +876,6 @@ static LONG CBLActivate( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -876,7 +876,6 @@ static LONG CBLActivate( HWND hwnd, WORD message, WORD wParam, LONG lParam )
static LONG CBLLButtonDown( HWND hwnd, WORD message, WORD wParam, LONG lParam ) static LONG CBLLButtonDown( HWND hwnd, WORD message, WORD wParam, LONG lParam )
{ {
LPHEADLIST lphl = CLBoxGetListHeader(hwnd); LPHEADLIST lphl = CLBoxGetListHeader(hwnd);
WORD wRet;
int y; int y;
RECT rectsel; RECT rectsel;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -386,8 +386,7 @@ void ListBoxAskMeasure(LPHEADLIST lphl, LPLISTSTRUCT lpls) ...@@ -386,8 +386,7 @@ void ListBoxAskMeasure(LPHEADLIST lphl, LPLISTSTRUCT lpls)
*lpmeasure = lpls->mis; *lpmeasure = lpls->mis;
lpmeasure->itemHeight = lphl->StdItemHeight; lpmeasure->itemHeight = lphl->StdItemHeight;
SendMessage(lphl->hParent, WM_MEASUREITEM, SendMessage(lphl->hParent, WM_MEASUREITEM, 0, USER_HEAP_SEG_ADDR(hTemp));
0, USER_HEAP_SEG_ADDR(hTemp));
if (lphl->dwStyle & LBS_OWNERDRAWFIXED) { if (lphl->dwStyle & LBS_OWNERDRAWFIXED) {
lphl->StdItemHeight = lpmeasure->itemHeight; lphl->StdItemHeight = lpmeasure->itemHeight;
...@@ -419,7 +418,7 @@ LPLISTSTRUCT ListBoxCreateItem(LPHEADLIST lphl, int id) ...@@ -419,7 +418,7 @@ LPLISTSTRUCT ListBoxCreateItem(LPHEADLIST lphl, int id)
int ListBoxInsertString(LPHEADLIST lphl, UINT uIndex, LPSTR newstr) int ListBoxInsertString(LPHEADLIST lphl, UINT uIndex, LPSTR newstr)
{ {
LPLISTSTRUCT *lppls, lplsnew; LPLISTSTRUCT *lppls, lplsnew, lpls;
HANDLE hStr; HANDLE hStr;
LPSTR str; LPSTR str;
UINT Count; UINT Count;
...@@ -448,20 +447,25 @@ int ListBoxInsertString(LPHEADLIST lphl, UINT uIndex, LPSTR newstr) ...@@ -448,20 +447,25 @@ int ListBoxInsertString(LPHEADLIST lphl, UINT uIndex, LPSTR newstr)
hStr = 0; hStr = 0;
if (HasStrings(lphl)) { if (HasStrings(lphl)) {
hStr = LIST_HEAP_ALLOC(lphl, GMEM_MOVEABLE, strlen(newstr) + 1); hStr = LIST_HEAP_ALLOC(lphl, LMEM_MOVEABLE, strlen(newstr) + 1);
str = (LPSTR)LIST_HEAP_ADDR(lphl, hStr); str = (LPSTR)LIST_HEAP_ADDR(lphl, hStr);
if (str == NULL) return LB_ERRSPACE; if (str == NULL) return LB_ERRSPACE;
strcpy(str, newstr); strcpy(str, newstr);
lplsnew->itemText = str; lplsnew->itemText = str;
/* I'm not so sure about the next one */ /* I'm not so sure about the next one */
lplsnew->mis.itemData = LIST_HEAP_SEG_ADDR(lphl,hStr); lplsnew->mis.itemData = 0;
} else { } else {
lplsnew->itemText = NULL; lplsnew->itemText = NULL;
lplsnew->mis.itemData = (DWORD)newstr; lplsnew->mis.itemData = (DWORD)newstr;
} }
lplsnew->mis.itemID = lphl->ItemsCount; lplsnew->mis.itemID = uIndex;
lplsnew->hData = hStr; lplsnew->hData = hStr;
/* adjust the itemID field of the following entries */
for(lpls = lplsnew->lpNext; lpls != NULL; lpls = lpls->lpNext) {
lpls->mis.itemID++;
}
if (lphl->needMeasure) { if (lphl->needMeasure) {
ListBoxAskMeasure(lphl, lplsnew); ListBoxAskMeasure(lphl, lplsnew);
...@@ -530,7 +534,7 @@ int ListBoxSetItemData(LPHEADLIST lphl, UINT uIndex, DWORD ItemData) ...@@ -530,7 +534,7 @@ int ListBoxSetItemData(LPHEADLIST lphl, UINT uIndex, DWORD ItemData)
int ListBoxDeleteString(LPHEADLIST lphl, UINT uIndex) int ListBoxDeleteString(LPHEADLIST lphl, UINT uIndex)
{ {
LPLISTSTRUCT lpls; LPLISTSTRUCT lpls, lpls2;
UINT Count; UINT Count;
if (uIndex >= lphl->ItemsCount) return LB_ERR; if (uIndex >= lphl->ItemsCount) return LB_ERR;
...@@ -548,9 +552,14 @@ int ListBoxDeleteString(LPHEADLIST lphl, UINT uIndex) ...@@ -548,9 +552,14 @@ int ListBoxDeleteString(LPHEADLIST lphl, UINT uIndex)
lpls2 = lpls; lpls2 = lpls;
lpls = (LPLISTSTRUCT)lpls->lpNext; lpls = (LPLISTSTRUCT)lpls->lpNext;
} }
lpls2->lpNext = (LPLISTSTRUCT)lpls->lpNext; lpls2->lpNext = lpls->lpNext;
} }
/* adjust the itemID field of the following entries */
for(lpls2 = lpls->lpNext; lpls2 != NULL; lpls2 = lpls2->lpNext) {
lpls2->mis.itemID--;
}
lphl->ItemsCount--; lphl->ItemsCount--;
if (lpls->hData != 0) LIST_HEAP_FREE(lphl, lpls->hData); if (lpls->hData != 0) LIST_HEAP_FREE(lphl, lpls->hData);
......
...@@ -141,7 +141,7 @@ void toggle_next(int num) ...@@ -141,7 +141,7 @@ void toggle_next(int num)
unsigned int addr; unsigned int addr;
addr=wbp[num].addr; addr=wbp[num].addr;
if(wbp[num].next_addr == 0) if(wbp[num].next_addr == 0)
wbp[num].next_addr = db_disasm( addr, 0, (dbg_mode == 16) ); wbp[num].next_addr = db_disasm( 0, addr, (dbg_mode == 16) );
wbp[num].addr=wbp[num].next_addr; wbp[num].addr=wbp[num].next_addr;
wbp[num].next_addr=addr; wbp[num].next_addr=addr;
} }
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
#include "db_disasm.h" #include "db_disasm.h"
#include "ldt.h" #include "ldt.h"
extern void print_address(unsigned int addr, FILE * outfile, int addrlen); extern void print_address( unsigned int seg, unsigned int addr, int addrlen );
/* /*
* Switch to disassemble 16-bit code. * Switch to disassemble 16-bit code.
...@@ -891,10 +891,11 @@ static int db_lengths[] = { ...@@ -891,10 +891,11 @@ static int db_lengths[] = {
10, /* EXTR */ 10, /* EXTR */
}; };
static unsigned int db_get_task_value(unsigned int loc, int size, int is_signed) static unsigned int db_get_task_value( unsigned int segment, unsigned int loc,
int size, int is_signed)
{ {
unsigned int result; unsigned int result;
if (db_disasm_16) loc = (unsigned int)PTR_SEG_TO_LIN(loc); if (segment) loc = (unsigned int)PTR_SEG_OFF_TO_LIN( segment, loc );
switch(size) switch(size)
{ {
case 4: case 4:
...@@ -923,8 +924,8 @@ static unsigned int db_get_task_value(unsigned int loc, int size, int is_signed) ...@@ -923,8 +924,8 @@ static unsigned int db_get_task_value(unsigned int loc, int size, int is_signed)
return result; return result;
} }
#define get_value_inc(result, loc, size, is_signed) \ #define get_value_inc(result, segment, loc, size, is_signed) \
result = db_get_task_value((loc), (size), (is_signed)); \ result = db_get_task_value((segment), (loc), (size), (is_signed)); \
if (!db_disasm_16) (loc) += (size); \ if (!db_disasm_16) (loc) += (size); \
else (loc) = ((loc) & 0xffff0000) | (((loc) + (size)) & 0xffff); else (loc) = ((loc) & 0xffff0000) | (((loc) + (size)) & 0xffff);
...@@ -932,7 +933,8 @@ static unsigned int db_get_task_value(unsigned int loc, int size, int is_signed) ...@@ -932,7 +933,8 @@ static unsigned int db_get_task_value(unsigned int loc, int size, int is_signed)
* Read address at location and return updated location. * Read address at location and return updated location.
*/ */
db_addr_t db_addr_t
db_read_address(loc, short_addr, regmodrm, addrp) db_read_address(segment, loc, short_addr, regmodrm, addrp)
unsigned int segment;
db_addr_t loc; db_addr_t loc;
int short_addr; int short_addr;
int regmodrm; int regmodrm;
...@@ -957,7 +959,7 @@ db_read_address(loc, short_addr, regmodrm, addrp) ...@@ -957,7 +959,7 @@ db_read_address(loc, short_addr, regmodrm, addrp)
switch (mod) { switch (mod) {
case 0: case 0:
if (rm == 6) { if (rm == 6) {
get_value_inc(disp, loc, 2, TRUE); get_value_inc(disp, segment, loc, 2, TRUE);
addrp->disp = disp; addrp->disp = disp;
addrp->base = 0; addrp->base = 0;
} }
...@@ -967,12 +969,12 @@ db_read_address(loc, short_addr, regmodrm, addrp) ...@@ -967,12 +969,12 @@ db_read_address(loc, short_addr, regmodrm, addrp)
} }
break; break;
case 1: case 1:
get_value_inc(disp, loc, 1, TRUE); get_value_inc(disp, segment, loc, 1, TRUE);
addrp->disp = disp; addrp->disp = disp;
addrp->base = db_index_reg_16[rm]; addrp->base = db_index_reg_16[rm];
break; break;
case 2: case 2:
get_value_inc(disp, loc, 2, TRUE); get_value_inc(disp, segment, loc, 2, TRUE);
addrp->disp = disp; addrp->disp = disp;
addrp->base = db_index_reg_16[rm]; addrp->base = db_index_reg_16[rm];
break; break;
...@@ -980,7 +982,7 @@ db_read_address(loc, short_addr, regmodrm, addrp) ...@@ -980,7 +982,7 @@ db_read_address(loc, short_addr, regmodrm, addrp)
} }
else { else {
if (mod != 3 && rm == 4) { if (mod != 3 && rm == 4) {
get_value_inc(sib, loc, 1, FALSE); get_value_inc(sib, segment, loc, 1, FALSE);
rm = sib_base(sib); rm = sib_base(sib);
index = sib_index(sib); index = sib_index(sib);
if (index != 4) if (index != 4)
...@@ -991,7 +993,7 @@ db_read_address(loc, short_addr, regmodrm, addrp) ...@@ -991,7 +993,7 @@ db_read_address(loc, short_addr, regmodrm, addrp)
switch (mod) { switch (mod) {
case 0: case 0:
if (rm == 5) { if (rm == 5) {
get_value_inc(addrp->disp, loc, 4, FALSE); get_value_inc(addrp->disp, segment, loc, 4, FALSE);
addrp->base = 0; addrp->base = 0;
} }
else { else {
...@@ -1001,13 +1003,13 @@ db_read_address(loc, short_addr, regmodrm, addrp) ...@@ -1001,13 +1003,13 @@ db_read_address(loc, short_addr, regmodrm, addrp)
break; break;
case 1: case 1:
get_value_inc(disp, loc, 1, TRUE); get_value_inc(disp, segment, loc, 1, TRUE);
addrp->disp = disp; addrp->disp = disp;
addrp->base = db_reg[LONG][rm]; addrp->base = db_reg[LONG][rm];
break; break;
case 2: case 2:
get_value_inc(disp, loc, 4, FALSE); get_value_inc(disp, segment, loc, 4, FALSE);
addrp->disp = disp; addrp->disp = disp;
addrp->base = db_reg[LONG][rm]; addrp->base = db_reg[LONG][rm];
break; break;
...@@ -1027,7 +1029,7 @@ static void db_task_printsym(unsigned int addr, int size) ...@@ -1027,7 +1029,7 @@ static void db_task_printsym(unsigned int addr, int size)
fprintf(stderr, "0x%4.4x", addr & 0xffff ); fprintf(stderr, "0x%4.4x", addr & 0xffff );
break; break;
case LONG: case LONG:
print_address(addr, stderr, db_disasm_16 ? 16 : 32); print_address(0, addr, db_disasm_16 ? 16 : 32);
break; break;
} }
} }
...@@ -1064,7 +1066,8 @@ db_print_address(seg, size, addrp) ...@@ -1064,7 +1066,8 @@ db_print_address(seg, size, addrp)
* and return updated location. * and return updated location.
*/ */
db_addr_t db_addr_t
db_disasm_esc(loc, inst, short_addr, size, seg) db_disasm_esc(segment, loc, inst, short_addr, size, seg)
unsigned int segment;
db_addr_t loc; db_addr_t loc;
int inst; int inst;
int short_addr; int short_addr;
...@@ -1077,14 +1080,14 @@ db_disasm_esc(loc, inst, short_addr, size, seg) ...@@ -1077,14 +1080,14 @@ db_disasm_esc(loc, inst, short_addr, size, seg)
struct i_addr address; struct i_addr address;
char * name; char * name;
get_value_inc(regmodrm, loc, 1, FALSE); get_value_inc(regmodrm, segment, loc, 1, FALSE);
fp = &db_Esc_inst[inst - 0xd8][f_reg(regmodrm)]; fp = &db_Esc_inst[inst - 0xd8][f_reg(regmodrm)];
mod = f_mod(regmodrm); mod = f_mod(regmodrm);
if (mod != 3) { if (mod != 3) {
/* /*
* Normal address modes. * Normal address modes.
*/ */
loc = db_read_address(loc, short_addr, regmodrm, &address); loc = db_read_address(segment,loc, short_addr, regmodrm, &address);
fprintf(stderr,fp->f_name); fprintf(stderr,fp->f_name);
switch(fp->f_size) { switch(fp->f_size) {
case SNGL: case SNGL:
...@@ -1145,14 +1148,13 @@ db_disasm_esc(loc, inst, short_addr, size, seg) ...@@ -1145,14 +1148,13 @@ db_disasm_esc(loc, inst, short_addr, size, seg)
} }
/* /*
* Disassemble instruction at 'loc'. 'altfmt' specifies an * Disassemble instruction at 'loc'. Return address of start of
* (optional) alternate format. Return address of start of
* next instruction. * next instruction.
*/ */
db_addr_t db_addr_t
db_disasm(loc, altfmt, flag16) db_disasm(segment, loc, flag16)
unsigned int segment;
db_addr_t loc; db_addr_t loc;
boolean_t altfmt;
boolean_t flag16; boolean_t flag16;
{ {
int inst; int inst;
...@@ -1163,7 +1165,7 @@ db_disasm(loc, altfmt, flag16) ...@@ -1163,7 +1165,7 @@ db_disasm(loc, altfmt, flag16)
char * i_name; char * i_name;
int i_size; int i_size;
int i_mode; int i_mode;
int regmodrm; int regmodrm = 0;
boolean_t first; boolean_t first;
int displ; int displ;
int prefix; int prefix;
...@@ -1174,7 +1176,7 @@ db_disasm(loc, altfmt, flag16) ...@@ -1174,7 +1176,7 @@ db_disasm(loc, altfmt, flag16)
db_disasm_16 = flag16; db_disasm_16 = flag16;
get_value_inc(inst, loc, 1, FALSE); get_value_inc(inst, segment, loc, 1, FALSE);
if (db_disasm_16) { if (db_disasm_16) {
short_addr = TRUE; short_addr = TRUE;
...@@ -1233,7 +1235,7 @@ db_disasm(loc, altfmt, flag16) ...@@ -1233,7 +1235,7 @@ db_disasm(loc, altfmt, flag16)
break; break;
} }
if (prefix) { if (prefix) {
get_value_inc(inst, loc, 1, FALSE); get_value_inc(inst, segment, loc, 1, FALSE);
} }
} while (prefix); } while (prefix);
...@@ -1244,7 +1246,7 @@ db_disasm(loc, altfmt, flag16) ...@@ -1244,7 +1246,7 @@ db_disasm(loc, altfmt, flag16)
} }
if (inst == 0x0f) { if (inst == 0x0f) {
get_value_inc(inst, loc, 1, FALSE); get_value_inc(inst, segment, loc, 1, FALSE);
ip = db_inst_0f[inst>>4]; ip = db_inst_0f[inst>>4];
if (ip == 0) { if (ip == 0) {
ip = &db_bad_inst; ip = &db_bad_inst;
...@@ -1257,8 +1259,8 @@ db_disasm(loc, altfmt, flag16) ...@@ -1257,8 +1259,8 @@ db_disasm(loc, altfmt, flag16)
ip = &db_inst_table[inst]; ip = &db_inst_table[inst];
if (ip->i_has_modrm) { if (ip->i_has_modrm) {
get_value_inc(regmodrm, loc, 1, FALSE); get_value_inc(regmodrm, segment, loc, 1, FALSE);
loc = db_read_address(loc, short_addr, regmodrm, &address); loc = db_read_address(segment,loc, short_addr, regmodrm, &address);
} }
i_name = ip->i_name; i_name = ip->i_name;
...@@ -1399,42 +1401,42 @@ db_disasm(loc, altfmt, flag16) ...@@ -1399,42 +1401,42 @@ db_disasm(loc, altfmt, flag16)
case I: case I:
len = db_lengths[size]; len = db_lengths[size];
get_value_inc(imm, loc, len, FALSE);/* unsigned */ get_value_inc(imm, segment, loc, len, FALSE);/* unsigned */
fprintf(stderr,"$0x%x", imm); fprintf(stderr,"$0x%x", imm);
break; break;
case Is: case Is:
len = db_lengths[size]; len = db_lengths[size];
get_value_inc(imm, loc, len, TRUE); /* signed */ get_value_inc(imm, segment, loc, len, TRUE); /* signed */
fprintf(stderr,"$%d", imm); fprintf(stderr,"$%d", imm);
break; break;
case Ib: case Ib:
get_value_inc(imm, loc, 1, FALSE); /* unsigned */ get_value_inc(imm, segment, loc, 1, FALSE); /* unsigned */
fprintf(stderr,"$0x%x", imm); fprintf(stderr,"$0x%x", imm);
break; break;
case Ibs: case Ibs:
get_value_inc(imm, loc, 1, TRUE); /* signed */ get_value_inc(imm, segment, loc, 1, TRUE); /* signed */
fprintf(stderr,"$%d", imm); fprintf(stderr,"$%d", imm);
break; break;
case Iw: case Iw:
get_value_inc(imm, loc, 2, FALSE); /* unsigned */ get_value_inc(imm, segment, loc, 2, FALSE); /* unsigned */
fprintf(stderr,"$0x%x", imm); fprintf(stderr,"$0x%x", imm);
break; break;
case Il: case Il:
get_value_inc(imm, loc, 4, FALSE); get_value_inc(imm, segment, loc, 4, FALSE);
fprintf(stderr,"$0x%x", imm); fprintf(stderr,"$0x%x", imm);
break; break;
case O: case O:
if (short_addr) { if (short_addr) {
get_value_inc(displ, loc, 2, TRUE); get_value_inc(displ, segment, loc, 2, TRUE);
} }
else { else {
get_value_inc(displ, loc, 4, TRUE); get_value_inc(displ, segment, loc, 4, TRUE);
} }
if (seg) if (seg)
fprintf(stderr,"%s:%d",seg, displ); fprintf(stderr,"%s:%d",seg, displ);
...@@ -1444,7 +1446,7 @@ db_disasm(loc, altfmt, flag16) ...@@ -1444,7 +1446,7 @@ db_disasm(loc, altfmt, flag16)
break; break;
case Db: case Db:
get_value_inc(displ, loc, 1, TRUE); get_value_inc(displ, segment, loc, 1, TRUE);
if (short_addr) { if (short_addr) {
/* offset only affects low 16 bits */ /* offset only affects low 16 bits */
displ = (loc & 0xffff0000) displ = (loc & 0xffff0000)
...@@ -1458,13 +1460,13 @@ db_disasm(loc, altfmt, flag16) ...@@ -1458,13 +1460,13 @@ db_disasm(loc, altfmt, flag16)
case Dl: case Dl:
if (short_addr) { if (short_addr) {
get_value_inc(displ, loc, 2, TRUE); get_value_inc(displ, segment, loc, 2, TRUE);
/* offset only affects low 16 bits */ /* offset only affects low 16 bits */
displ = (loc & 0xffff0000) displ = (loc & 0xffff0000)
| ((loc + displ) & 0xffff); | ((loc + displ) & 0xffff);
} }
else { else {
get_value_inc(displ, loc, 4, TRUE); get_value_inc(displ, segment, loc, 4, TRUE);
displ = displ + loc; displ = displ + loc;
} }
db_task_printsym((db_addr_t)displ, db_task_printsym((db_addr_t)displ,
...@@ -1481,30 +1483,17 @@ db_disasm(loc, altfmt, flag16) ...@@ -1481,30 +1483,17 @@ db_disasm(loc, altfmt, flag16)
case OS: case OS:
if (short_addr) { if (short_addr) {
get_value_inc(imm, loc, 2, FALSE); /* offset */ get_value_inc(imm, segment, loc, 2, FALSE);/* offset */
} }
else { else {
get_value_inc(imm, loc, 4, FALSE); /* offset */ get_value_inc(imm, segment, loc, 4, FALSE);/* offset */
} }
get_value_inc(imm2, loc, 2, FALSE); /* segment */ get_value_inc(imm2, segment, loc, 2, FALSE); /* segment */
if (short_addr) print_address( imm2, imm, short_addr ? 16 : 32 );
print_address( (imm2 << 16) | imm, stderr, 16 );
else
fprintf(stderr,"$0x%x,0x%08x", imm2, imm);
break; break;
} }
} }
if (altfmt == 0 && !db_disasm_16) {
if (inst == 0xe9 || inst == 0xeb) {
/*
* GAS pads to longword boundary after unconditional jumps.
*/
#if 0
loc = (loc + (4-1)) & ~(4-1);
#endif
}
}
return (loc); return (loc);
} }
...@@ -4,4 +4,5 @@ ...@@ -4,4 +4,5 @@
typedef unsigned char boolean_t; typedef unsigned char boolean_t;
typedef unsigned long db_addr_t; typedef unsigned long db_addr_t;
extern db_addr_t db_disasm(db_addr_t loc, boolean_t altfmt, boolean_t flag16); extern db_addr_t db_disasm(unsigned int segment, db_addr_t loc,
boolean_t flag16);
...@@ -43,7 +43,6 @@ void mode_command(int); ...@@ -43,7 +43,6 @@ void mode_command(int);
%token SET %token SET
%token MODE %token MODE
%token PRINT %token PRINT
%token FILE_IDENTIFIER
%token IDENTIFIER %token IDENTIFIER
%token NO_SYMBOL %token NO_SYMBOL
%token SYMBOLFILE %token SYMBOLFILE
...@@ -64,7 +63,7 @@ void mode_command(int); ...@@ -64,7 +63,7 @@ void mode_command(int);
| CONT '\n' { return 0; } | CONT '\n' { return 0; }
| 'c' '\n' { return 0; } | 'c' '\n' { return 0; }
| ABORT '\n' { kill(getpid(), SIGABRT); } | ABORT '\n' { kill(getpid(), SIGABRT); }
| SYMBOLFILE FILE_IDENTIFIER '\n' { read_symboltable($2); } | SYMBOLFILE IDENTIFIER '\n' { read_symboltable($2); }
| DEFINE IDENTIFIER expr '\n' { add_hash($2, 0, $3); } | DEFINE IDENTIFIER expr '\n' { add_hash($2, 0, $3); }
| MODE NUM { mode_command($2); } | MODE NUM { mode_command($2); }
| ENABLE NUM { enable_break($2); } | ENABLE NUM { enable_break($2); }
...@@ -82,18 +81,17 @@ deposit_command: ...@@ -82,18 +81,17 @@ deposit_command:
x_command: x_command:
'x' expr '\n' { examine_memory($2, 1, 'x'); } 'x' expr '\n' { examine_memory( 0xffffffff, $2, 1, 'x'); }
| 'x' '/' fmt expr '\n' { examine_memory($4, 1, $3); } | 'x' '/' fmt expr '\n' { examine_memory( 0xffffffff, $4, 1, $3); }
| 'x' '/' NUM fmt expr '\n' { examine_memory($5, $3, $4); } | 'x' '/' NUM fmt expr '\n' { examine_memory( 0xffffffff, $5, $3, $4); }
print: print:
'p' 'p'
| PRINT | PRINT
print_command: print_command:
print expr '\n' { examine_memory(((unsigned int) &$2 ), 1, 'x'); } print expr '\n' { examine_memory( 0, ((unsigned int) &$2 ), 1, 'x'); }
| print '/' fmt expr '\n' { examine_memory((unsigned int) &$4, 1, $3); } | print '/' fmt expr '\n' { examine_memory( 0, (unsigned int) &$4, 1, $3); }
| print '/' NUM fmt expr '\n' { examine_memory((unsigned int) &$5, $3, $4); }
fmt: 'x' { $$ = 'x'; } fmt: 'x' { $$ = 'x'; }
| 'd' { $$ = 'd'; } | 'd' { $$ = 'd'; }
...@@ -162,15 +160,10 @@ wine_debug(int signal, int * regs) ...@@ -162,15 +160,10 @@ wine_debug(int signal, int * regs)
yyin = stdin; yyin = stdin;
regval = regs ? regs : dummy_regs; regval = regs ? regs : dummy_regs;
if (SC_CS == WINE_CODE_SELECTOR) if (SC_CS == WINE_CODE_SELECTOR) dbg_mode = 32;
{ else dbg_mode = (GET_SEL_FLAGS(SC_CS) & LDT_FLAGS_32BIT) ? 32 : 16;
dbg_mask = 0xffffffff; dbg_mask = (dbg_mode == 32) ? 0xffffffff : 0xffff;
dbg_mode = 32;
} else
{
dbg_mask = 0xffff;
dbg_mode = 16;
}
fprintf(stderr,"In %d bit mode.\n", dbg_mode); fprintf(stderr,"In %d bit mode.\n", dbg_mode);
if(dbg_mode == 32 && !loaded_symbols) if(dbg_mode == 32 && !loaded_symbols)
...@@ -190,8 +183,7 @@ wine_debug(int signal, int * regs) ...@@ -190,8 +183,7 @@ wine_debug(int signal, int * regs)
unsigned int addr; unsigned int addr;
int bpnum; int bpnum;
addr = SC_EIP(dbg_mask); addr = SC_EIP(dbg_mask);
if((addr & 0xffff0000) == 0 && dbg_mode == 16) if (dbg_mode == 16) addr = PTR_SEG_OFF_TO_LIN( SC_CS, addr );
addr = PTR_SEG_OFF_TO_LIN( SC_CS, addr );
if(should_continue(bpnum=get_bpnum(addr))){ if(should_continue(bpnum=get_bpnum(addr))){
insert_break(1); insert_break(1);
return; return;
...@@ -201,7 +193,7 @@ wine_debug(int signal, int * regs) ...@@ -201,7 +193,7 @@ wine_debug(int signal, int * regs)
/* Show where we crashed */ /* Show where we crashed */
if(regs) if(regs)
examine_memory(SC_EIP(dbg_mask), 1, 'i'); examine_memory(0xffffffff, SC_EIP(dbg_mask), 1, 'i');
issue_prompt(); issue_prompt();
......
...@@ -29,7 +29,6 @@ DIGIT [0-9] ...@@ -29,7 +29,6 @@ DIGIT [0-9]
HEXDIGIT [0-9a-fA-F] HEXDIGIT [0-9a-fA-F]
IDENTIFIER [_a-zA-Z\.~][_a-zA-Z0-9\.~]* IDENTIFIER [_a-zA-Z\.~][_a-zA-Z0-9\.~]*
FILE_IDENTIFIER [_a-zA-Z\.~/][_a-zA-Z\.~/]*
%% %%
...@@ -120,10 +119,6 @@ q { return 'q'; } ...@@ -120,10 +119,6 @@ q { return 'q'; }
return IDENTIFIER; return IDENTIFIER;
} }
{FILE_IDENTIFIER} {yylval = (int) make_symbol(yytext);
return FILE_IDENTIFIER;
}
[ \t]+ /* Eat up whitespace */ [ \t]+ /* Eat up whitespace */
. { if(syntax_error == 0) { . { if(syntax_error == 0) {
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
struct name_hash{ struct name_hash{
struct name_hash * next; struct name_hash * next;
unsigned short segment; unsigned int segment;
unsigned int * address; unsigned int address;
char * name; char * name;
}; };
...@@ -37,7 +37,7 @@ static unsigned int name_hash(const char * name){ ...@@ -37,7 +37,7 @@ static unsigned int name_hash(const char * name){
} }
void add_hash(char * name, unsigned short segment, unsigned int * address) void add_hash(char * name, unsigned int segment, unsigned int address)
{ {
struct name_hash * new; struct name_hash * new;
int hash; int hash;
...@@ -54,7 +54,7 @@ void add_hash(char * name, unsigned short segment, unsigned int * address) ...@@ -54,7 +54,7 @@ void add_hash(char * name, unsigned short segment, unsigned int * address)
name_hash_table[hash] = new; name_hash_table[hash] = new;
} }
unsigned int * find_hash(char * name) unsigned int find_hash(char * name)
{ {
char buffer[256]; char buffer[256];
struct name_hash * nh; struct name_hash * nh;
...@@ -70,32 +70,39 @@ unsigned int * find_hash(char * name) ...@@ -70,32 +70,39 @@ unsigned int * find_hash(char * name)
}; };
return (unsigned int *) 0xffffffff; return 0xffffffff;
} }
static char name_buffer[256]; static char name_buffer[256];
char * find_nearest_symbol(unsigned int segment, unsigned int * address) char * find_nearest_symbol(unsigned int segment, unsigned int address)
{ {
struct name_hash * nearest; struct name_hash * nearest;
struct name_hash start;
struct name_hash * nh; struct name_hash * nh;
unsigned int nearest_address;
int i; int i;
nearest = &start; nearest = NULL;
start.address = (unsigned int *) 0; nearest_address = 0;
for(i=0; i<NR_NAME_HASH; i++) { for(i=0; i<NR_NAME_HASH; i++) {
for(nh = name_hash_table[i]; nh; nh = nh->next) for(nh = name_hash_table[i]; nh; nh = nh->next)
if (nh->segment == segment && if (nh->segment == segment &&
nh->address <= address && nh->address <= address &&
nh->address > nearest->address) nearest = nh; nh->address >= nearest_address)
}; {
if((unsigned int) nearest->address == 0) return NULL; nearest_address = nh->address;
nearest = nh;
sprintf(name_buffer, "%s+0x%x", nearest->name, ((unsigned int) address) - }
((unsigned int) nearest->address)); }
if (!nearest) return NULL;
if (address == nearest->address)
sprintf( name_buffer, "%s", nearest->name );
else
sprintf( name_buffer, "%s+0x%x", nearest->name,
address - nearest->address );
return name_buffer; return name_buffer;
} }
...@@ -142,7 +149,7 @@ read_symboltable(char * filename){ ...@@ -142,7 +149,7 @@ read_symboltable(char * filename){
}; };
nargs = sscanf(buffer, "%x %c %s", &addr, &type, name); nargs = sscanf(buffer, "%x %c %s", &addr, &type, name);
add_hash(name, 0, (unsigned int *) addr); add_hash(name, 0, addr);
}; };
fclose(symbolfile); fclose(symbolfile);
} }
...@@ -172,8 +179,7 @@ void load_entrypoints( HMODULE hModule ) ...@@ -172,8 +179,7 @@ void load_entrypoints( HMODULE hModule )
sprintf( buffer, "%*.*s.%*.*s", *name, *name, name + 1, sprintf( buffer, "%*.*s.%*.*s", *name, *name, name + 1,
*cpnt, *cpnt, cpnt + 1 ); *cpnt, *cpnt, cpnt + 1 );
address = MODULE_GetEntryPoint( hModule, *(WORD *)(cpnt + *cpnt + 1) ); address = MODULE_GetEntryPoint( hModule, *(WORD *)(cpnt + *cpnt + 1) );
if (address) if (address) add_hash( buffer, HIWORD(address), LOWORD(address) );
add_hash(buffer, address >> 16, (unsigned int*)(address & 0xffff));
} }
/* Now search the non-resident names table */ /* Now search the non-resident names table */
...@@ -186,7 +192,6 @@ void load_entrypoints( HMODULE hModule ) ...@@ -186,7 +192,6 @@ void load_entrypoints( HMODULE hModule )
sprintf( buffer, "%*.*s.%*.*s", *name, *name, name + 1, sprintf( buffer, "%*.*s.%*.*s", *name, *name, name + 1,
*cpnt, *cpnt, cpnt + 1 ); *cpnt, *cpnt, cpnt + 1 );
address = MODULE_GetEntryPoint( hModule, *(WORD *)(cpnt + *cpnt + 1) ); address = MODULE_GetEntryPoint( hModule, *(WORD *)(cpnt + *cpnt + 1) );
if (address) if (address) add_hash( buffer, HIWORD(address), LOWORD(address) );
add_hash(buffer, address >> 16, (unsigned int*)(address & 0xffff));
} }
} }
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#include "db_disasm.h" #include "db_disasm.h"
#include "regpos.h" #include "regpos.h"
extern char * find_nearest_symbol( unsigned int seg, unsigned int addr );
extern int * regval; extern int * regval;
extern unsigned int dbg_mask; extern unsigned int dbg_mask;
extern unsigned int dbg_mode; extern unsigned int dbg_mode;
...@@ -19,29 +21,14 @@ void application_not_running() ...@@ -19,29 +21,14 @@ void application_not_running()
fprintf(stderr,"Application not running\n"); fprintf(stderr,"Application not running\n");
} }
void print_address(unsigned int addr, FILE * outfile, int addrlen) void print_address( unsigned int segment, unsigned int addr, int addrlen )
{ {
extern char * find_nearest_symbol(unsigned short, unsigned int *); char *name = find_nearest_symbol( segment, addr );
char *name;
if (addrlen == 16) if (segment) fprintf( stderr, "0x%04x:", segment );
{ if (addrlen == 16) fprintf( stderr, "0x%04x", addr );
name = find_nearest_symbol( addr >> 16, else fprintf( stderr, "0x%08x", addr );
(unsigned int *)(addr & 0xffff) ); if (name) fprintf( stderr, " (%s)", name );
if (name)
fprintf( outfile, "0x%4.4x:0x%4.4x (%s)",
addr >> 16, addr & 0xffff, name );
else
fprintf( outfile, "0x%4.4x:0x%4.4x", addr >> 16, addr & 0xffff );
}
else
{
name = find_nearest_symbol(0, (unsigned int *) addr);
if(name)
fprintf(outfile,"0x%8.8x(%s)", addr, name);
else
fprintf(outfile,"0x%8.8x", addr);
}
} }
...@@ -82,7 +69,7 @@ void info_stack(){ ...@@ -82,7 +69,7 @@ void info_stack(){
} }
fprintf(stderr,"Stack dump:\n"); fprintf(stderr,"Stack dump:\n");
dump = (int*) SC_EIP(dbg_mask); dump = (int*) SC_ESP(dbg_mask);
for(i=0; i<22; i++) for(i=0; i<22; i++)
{ {
fprintf(stderr," %8.8x", *dump++); fprintf(stderr," %8.8x", *dump++);
...@@ -93,24 +80,28 @@ void info_stack(){ ...@@ -93,24 +80,28 @@ void info_stack(){
} }
void examine_memory(int addr, int count, char format){ void examine_memory( unsigned int segment, unsigned int addr,
char * pnt; int count, char format )
unsigned int * dump; {
unsigned short int * wdump; char * pnt;
int i; unsigned int * dump;
unsigned short int * wdump;
if((addr & 0xffff0000) == 0 && dbg_mode == 16) int i;
addr |= (format == 'i' ? SC_CS : SC_DS) << 16;
if (segment == 0xffffffff)
segment = (dbg_mode == 32) ? 0 : (format == 'i' ? SC_CS : SC_DS);
if (format != 'i' && count > 1)
{
print_address( segment, addr, dbg_mode );
fprintf(stderr,": ");
}
if(format != 'i' && count > 1) { pnt = segment ? (char *)PTR_SEG_OFF_TO_LIN(segment,addr) : (char *)addr;
print_address(addr, stderr, dbg_mode);
fprintf(stderr,": ");
};
switch(format){ switch(format)
{
case 's': case 's':
pnt = dbg_mode == 16 ? (char *)PTR_SEG_TO_LIN(addr)
: (char *)addr;
if (count == 1) count = 256; if (count == 1) count = 256;
while(*pnt && count) { while(*pnt && count) {
fputc( *pnt++, stderr); fputc( *pnt++, stderr);
...@@ -121,22 +112,21 @@ void examine_memory(int addr, int count, char format){ ...@@ -121,22 +112,21 @@ void examine_memory(int addr, int count, char format){
case 'i': case 'i':
for(i=0; i<count; i++) { for(i=0; i<count; i++) {
print_address(addr, stderr, dbg_mode); print_address( segment, addr, dbg_mode );
fprintf(stderr,": "); fprintf(stderr,": ");
addr = db_disasm( addr, 0, (dbg_mode == 16) ); addr = db_disasm( segment, addr, (dbg_mode == 16) );
fprintf(stderr,"\n"); fprintf(stderr,"\n");
}; };
return; return;
case 'x': case 'x':
dump = dbg_mode == 16 ? (unsigned int *)PTR_SEG_TO_LIN(addr) dump = (unsigned int *)pnt;
: (unsigned int *)addr;
for(i=0; i<count; i++) for(i=0; i<count; i++)
{ {
fprintf(stderr," %8.8x", *dump++); fprintf(stderr," %8.8x", *dump++);
addr += 4; addr += 4;
if ((i % 8) == 7) { if ((i % 8) == 7) {
fprintf(stderr,"\n"); fprintf(stderr,"\n");
print_address(addr, stderr, dbg_mode); print_address( segment, addr, dbg_mode );
fprintf(stderr,": "); fprintf(stderr,": ");
}; };
} }
...@@ -144,15 +134,14 @@ void examine_memory(int addr, int count, char format){ ...@@ -144,15 +134,14 @@ void examine_memory(int addr, int count, char format){
return; return;
case 'd': case 'd':
dump = dbg_mode == 16 ? (unsigned int *)PTR_SEG_TO_LIN(addr) dump = (unsigned int *)pnt;
: (unsigned int *)addr;
for(i=0; i<count; i++) for(i=0; i<count; i++)
{ {
fprintf(stderr," %d", *dump++); fprintf(stderr," %d", *dump++);
addr += 4; addr += 4;
if ((i % 8) == 7) { if ((i % 8) == 7) {
fprintf(stderr,"\n"); fprintf(stderr,"\n");
print_address(addr, stderr, dbg_mode); print_address( segment, addr, dbg_mode );
fprintf(stderr,": "); fprintf(stderr,": ");
}; };
} }
...@@ -160,15 +149,14 @@ void examine_memory(int addr, int count, char format){ ...@@ -160,15 +149,14 @@ void examine_memory(int addr, int count, char format){
return; return;
case 'w': case 'w':
wdump = dbg_mode == 16 ? (unsigned short *)PTR_SEG_TO_LIN(addr) wdump = (unsigned short *)pnt;
: (unsigned short *)addr;
for(i=0; i<count; i++) for(i=0; i<count; i++)
{ {
fprintf(stderr," %x", *wdump++); fprintf(stderr," %x", *wdump++);
addr += 2; addr += 2;
if ((i % 10) == 7) { if ((i % 10) == 7) {
fprintf(stderr,"\n"); fprintf(stderr,"\n");
print_address(addr, stderr, dbg_mode); print_address( segment, addr, dbg_mode );
fprintf(stderr,": "); fprintf(stderr,": ");
}; };
} }
...@@ -176,8 +164,6 @@ void examine_memory(int addr, int count, char format){ ...@@ -176,8 +164,6 @@ void examine_memory(int addr, int count, char format){
return; return;
case 'c': case 'c':
pnt = dbg_mode == 16 ? (char *)PTR_SEG_TO_LIN(addr)
: (char *)addr;
for(i=0; i<count; i++) for(i=0; i<count; i++)
{ {
if(*pnt < 0x20) { if(*pnt < 0x20) {
...@@ -188,7 +174,7 @@ void examine_memory(int addr, int count, char format){ ...@@ -188,7 +174,7 @@ void examine_memory(int addr, int count, char format){
addr++; addr++;
if ((i % 32) == 7) { if ((i % 32) == 7) {
fprintf(stderr,"\n"); fprintf(stderr,"\n");
print_address(addr, stderr, dbg_mode); print_address( segment, addr, dbg_mode );
fprintf(stderr,": "); fprintf(stderr,": ");
}; };
} }
...@@ -196,15 +182,13 @@ void examine_memory(int addr, int count, char format){ ...@@ -196,15 +182,13 @@ void examine_memory(int addr, int count, char format){
return; return;
case 'b': case 'b':
pnt = dbg_mode == 16 ? (char *)PTR_SEG_TO_LIN(addr)
: (char *)addr;
for(i=0; i<count; i++) for(i=0; i<count; i++)
{ {
fprintf(stderr," %02x", (*pnt++) & 0xff); fprintf(stderr," %02x", (*pnt++) & 0xff);
addr++; addr++;
if ((i % 32) == 7) { if ((i % 32) == 7) {
fprintf(stderr,"\n"); fprintf(stderr,"\n");
print_address(addr, stderr, dbg_mode); print_address( segment, addr, dbg_mode );
fprintf(stderr,": "); fprintf(stderr,": ");
}; };
} }
...@@ -285,7 +269,7 @@ void dbg_bt(){ ...@@ -285,7 +269,7 @@ void dbg_bt(){
/* See if in 32 bit mode or not. Assume GDT means 32 bit. */ /* See if in 32 bit mode or not. Assume GDT means 32 bit. */
if ((cs & 7) != 7) { if ((cs & 7) != 7) {
fprintf(stderr,"%d ",frameno++); fprintf(stderr,"%d ",frameno++);
print_address(frame->u.win32.saved_ip,stderr,32); print_address( 0, frame->u.win32.saved_ip, 32 );
fprintf( stderr, "\n" ); fprintf( stderr, "\n" );
if (!frame->u.win32.saved_ip) break; if (!frame->u.win32.saved_ip) break;
frame = (struct frame *) frame->u.win32.saved_bp; frame = (struct frame *) frame->u.win32.saved_bp;
......
## $Revision: 1.2 $
##
## OS-9 makefile for editline library.
##
.SUFFIXES:
RFILES = editline.r complete.r sysos9.r
%.r: %.c
cc68 -r -Dstrchr=index -Dstrrchr=rindex -DNEED_STRDUP -DSYS_OS9 $*.c
testit: testit.r editline.lib
cc68 -f=testit testit.r -l=editline.lib
$(RFILES): $(RFILES:%.r=%.c)
editline.lib: $(RFILES)
cat $(RFILES) >$@
/* $Revision: 1.1 $
**
** Editline system header file for OS-9 (on 68k).
*/
#define CRLF "\r\l"
#define FORWARD extern
#include <dir.h>
typedef struct direct DIRENTRY;
/* $Revision: 1.1 $
**
** OS-9 system-dependant routines for editline library.
*/
#include "editline.h"
#include <sgstat.h>
#include <modes.h>
void
rl_ttyset(Reset)
int Reset;
{
static struct sgbuf old;
struct sgbuf new;
if (Reset == 0) {
_gs_opt(0, &old);
_gs_opt(0, &new);
new.sg_backsp = 0; new.sg_delete = 0; new.sg_echo = 0;
new.sg_alf = 0; new.sg_nulls = 0; new.sg_pause = 0;
new.sg_page = 0; new.sg_bspch = 0; new.sg_dlnch = 0;
new.sg_eorch = 0; new.sg_eofch = 0; new.sg_rlnch = 0;
new.sg_dulnch = 0; new.sg_psch = 0; new.sg_kbich = 0;
new.sg_kbach = 0; new.sg_bsech = 0; new.sg_bellch = 0;
new.sg_xon = 0; new.sg_xoff = 0; new.sg_tabcr = 0;
new.sg_tabsiz = 0;
_ss_opt(0, &new);
rl_erase = old.sg_bspch;
rl_kill = old.sg_dlnch;
rl_eof = old.sg_eofch;
rl_intr = old.sg_kbich;
rl_quit = -1;
}
else
_ss_opt(0, &old);
}
void
rl_add_slash(path, p)
char *path;
char *p;
{
(void)strcat(p, access(path, S_IREAD | S_IFDIR) ? " " : "/");
}
const char version_string[] = "1.234";
static char foobar[]="foobar";
const char * foo_string = foobar;
name compobj name compobj
id 22 id 22
1 stub COBUILDVERSION 1 pascal CoBuildVersion() CoBuildVersion
2 stub COINITIALIZE 2 pascal CoInitialize(ptr) CoInitialize
3 stub COUNINITIALIZE 3 pascal CoUninitialize() CoUnitialize
4 stub COGETMALLOC 4 stub COGETMALLOC
5 stub COREGISTERCLASSOBJECT 5 stub COREGISTERCLASSOBJECT
6 stub COREVOKECLASSOBJECT 6 stub COREVOKECLASSOBJECT
......
...@@ -20,7 +20,7 @@ id 3 ...@@ -20,7 +20,7 @@ id 3
17 pascal OffsetViewportOrg(word s_word s_word) OffsetViewportOrg 17 pascal OffsetViewportOrg(word s_word s_word) OffsetViewportOrg
18 pascal ScaleViewportExt(word s_word s_word s_word s_word) ScaleViewportExt 18 pascal ScaleViewportExt(word s_word s_word s_word s_word) ScaleViewportExt
19 pascal16 LineTo(word s_word s_word) LineTo 19 pascal16 LineTo(word s_word s_word) LineTo
20 pascal MoveTo(word s_word s_word) MoveTo 20 pascal MoveTo(word s_word s_word) MoveTo
21 pascal16 ExcludeClipRect(word s_word s_word s_word s_word) ExcludeClipRect 21 pascal16 ExcludeClipRect(word s_word s_word s_word s_word) ExcludeClipRect
22 pascal16 IntersectClipRect(word s_word s_word s_word s_word) 22 pascal16 IntersectClipRect(word s_word s_word s_word s_word)
IntersectClipRect IntersectClipRect
...@@ -35,7 +35,7 @@ id 3 ...@@ -35,7 +35,7 @@ id 3
RoundRect RoundRect
29 pascal16 PatBlt(word s_word s_word s_word s_word long) PatBlt 29 pascal16 PatBlt(word s_word s_word s_word s_word long) PatBlt
30 pascal16 SaveDC(word) SaveDC 30 pascal16 SaveDC(word) SaveDC
31 pascal SetPixel(word s_word s_word long) SetPixel 31 pascal SetPixel(word s_word s_word long) SetPixel
32 pascal16 OffsetClipRgn(word s_word s_word) OffsetClipRgn 32 pascal16 OffsetClipRgn(word s_word s_word) OffsetClipRgn
33 pascal16 TextOut(word s_word s_word ptr word) TextOut 33 pascal16 TextOut(word s_word s_word ptr word) TextOut
34 pascal16 BitBlt( word s_word s_word s_word s_word word s_word s_word long) 34 pascal16 BitBlt( word s_word s_word s_word s_word word s_word s_word long)
...@@ -123,7 +123,7 @@ id 3 ...@@ -123,7 +123,7 @@ id 3
125 pascal16 CreateMetaFile(ptr) CreateMetaFile 125 pascal16 CreateMetaFile(ptr) CreateMetaFile
126 pascal16 CloseMetaFile(word) CloseMetaFile 126 pascal16 CloseMetaFile(word) CloseMetaFile
127 pascal16 DeleteMetaFile(word) DeleteMetaFile 127 pascal16 DeleteMetaFile(word) DeleteMetaFile
128 pascal MulDiv(s_word s_word s_word) MulDiv 128 pascal16 MulDiv(s_word s_word s_word) MulDiv
129 pascal16 SaveVisRgn(word) SaveVisRgn 129 pascal16 SaveVisRgn(word) SaveVisRgn
130 pascal16 RestoreVisRgn(word) RestoreVisRgn 130 pascal16 RestoreVisRgn(word) RestoreVisRgn
131 pascal16 InquireVisRgn(word) InquireVisRgn 131 pascal16 InquireVisRgn(word) InquireVisRgn
...@@ -212,7 +212,7 @@ id 3 ...@@ -212,7 +212,7 @@ id 3
313 pascal16 GetRasterizerCaps(ptr word) GetRasterizerCaps 313 pascal16 GetRasterizerCaps(ptr word) GetRasterizerCaps
314 stub EngineExtTextOut 314 stub EngineExtTextOut
330 pascal16 EnumFontFamilies(word ptr segptr long) EnumFontFamilies 330 pascal16 EnumFontFamilies(word ptr segptr long) EnumFontFamilies
332 stub GetKerningPairs 332 pascal16 GetKerningPairs(word word ptr) GetKerningPairs
345 pascal16 GetTextAlign(word) GetTextAlign 345 pascal16 GetTextAlign(word) GetTextAlign
346 pascal16 SetTextAlign(word word) SetTextAlign 346 pascal16 SetTextAlign(word word) SetTextAlign
348 pascal16 Chord(word s_word s_word s_word s_word s_word s_word 348 pascal16 Chord(word s_word s_word s_word s_word s_word s_word
......
...@@ -211,7 +211,7 @@ id 1 ...@@ -211,7 +211,7 @@ id 1
#327 K327 #327 K327
328 stub _DebugOutput 328 stub _DebugOutput
#329 K329 #329 K329
332 stub THHOOK #332 stub THHOOK
334 pascal16 IsBadReadPtr(segptr word) IsBadReadPtr 334 pascal16 IsBadReadPtr(segptr word) IsBadReadPtr
335 pascal16 IsBadWritePtr(segptr word) IsBadWritePtr 335 pascal16 IsBadWritePtr(segptr word) IsBadWritePtr
336 pascal16 IsBadCodePtr(segptr) IsBadCodePtr 336 pascal16 IsBadCodePtr(segptr) IsBadCodePtr
......
name OLE2 name OLE2
id 15 id 15
1 stub OLEBUILDVERSION 1 stub OleBuildVersion
2 stub OLEINITIALIZE 2 pascal OleInitialize(ptr) OleInitialize
3 stub OLEUNINITIALIZE 3 pascal OleUninitialize() OleUninitialize
4 stub DLLGETCLASSOBJECT 4 stub DLLGETCLASSOBJECT
#5 WEP #5 WEP
6 stub OLEQUERYLINKFROMDATA 6 stub OLEQUERYLINKFROMDATA
......
...@@ -109,5 +109,30 @@ id 17 ...@@ -109,5 +109,30 @@ id 17
106 stub VARBOOLFROMDISP 106 stub VARBOOLFROMDISP
107 stub DOINVOKEMETHOD 107 stub DOINVOKEMETHOD
108 stub VARIANTCHANGETYPEEX 108 stub VARIANTCHANGETYPEEX
#109 WEP 109 stub SAFEARRAYPTROFINDEX
#110 ___EXPORTEDSTUB 110 stub SETERRORINFO
111 stub GETERRORINFO
112 stub CREATEERRORINFO
113 stub _IID_IERRORINFO
114 stub _IID_ICREATEERRORINFO
115 stub _IID_ISUPPORTERRORINFO
116 stub VARUI1FROMI2
117 stub VARUI1FROMI4
118 stub VARUI1FROMR4
119 stub VARUI1FROMR8
120 stub VARUI1FROMCY
121 stub VARUI1FROMDATE
122 stub VARUI1FROMSTR
123 stub VARUI1FROMDISP
124 stub VARUI1FROMBOOL
125 stub VARI2FROMUI1
126 stub VARI4FROMUI1
127 stub VARR4FROMUI1
128 stub VARR8FROMUI1
129 stub VARDATEFROMUI1
130 stub VARCYFROMUI1
131 stub VARBSTRFROMUI1
132 stub VARBOOLFROMUI1
133 stub DLLCANUNLOADNOW
#134 stub WEP
#135 stub ___EXPORTEDSTUB
...@@ -5,7 +5,7 @@ id 18 ...@@ -5,7 +5,7 @@ id 18
2 pascal GetSystemDefaultLCID() GetSystemDefaultLCID 2 pascal GetSystemDefaultLCID() GetSystemDefaultLCID
3 pascal GetUserDefaultLangID() GetUserDefaultLangID 3 pascal GetUserDefaultLangID() GetUserDefaultLangID
4 pascal GetSystemDefaultLangID() GetSystemDefaultLangID 4 pascal GetSystemDefaultLangID() GetSystemDefaultLangID
5 stub GETLOCALEINFOA 5 pascal GetLocaleInfoA(long long ptr word) GetLocaleInfoA
6 stub LCMAPSTRINGA 6 stub LCMAPSTRINGA
7 stub GETSTRINGTYPEA 7 stub GETSTRINGTYPEA
8 stub COMPARESTRINGA 8 stub COMPARESTRINGA
......
...@@ -56,7 +56,7 @@ id 20 ...@@ -56,7 +56,7 @@ id 20
57 stub OLEEXECUTE 57 stub OLEEXECUTE
58 stub OLECREATEINVISIBLE 58 stub OLECREATEINVISIBLE
59 stub OLEQUERYCLIENTVERSION 59 stub OLEQUERYCLIENTVERSION
60 stub OLEISDCMETA 60 pascal16 OleIsDcMeta(word) OleIsDcMeta
100 stub DOCWNDPROC 100 stub DOCWNDPROC
101 stub SRVRWNDPROC 101 stub SRVRWNDPROC
102 stub MFCALLBACKFUNC 102 stub MFCALLBACKFUNC
......
...@@ -21,6 +21,9 @@ dprintf_relay ...@@ -21,6 +21,9 @@ dprintf_relay
#define DLL_ENTRY(name) \ #define DLL_ENTRY(name) \
{ #name, name##_Code_Start, name##_Data_Start, \ { #name, name##_Code_Start, name##_Data_Start, \
name##_Module_Start, name##_Module_End, TRUE, 0 } name##_Module_Start, name##_Module_End, TRUE, 0 }
#define DLL_ENTRY_NOTUSED(name) \
{ #name, name##_Code_Start, name##_Data_Start, \
name##_Module_Start, name##_Module_End, FALSE, 0 }
struct dll_table_s dll_builtin_table[N_BUILTINS] = struct dll_table_s dll_builtin_table[N_BUILTINS] =
{ {
...@@ -38,17 +41,17 @@ struct dll_table_s dll_builtin_table[N_BUILTINS] = ...@@ -38,17 +41,17 @@ struct dll_table_s dll_builtin_table[N_BUILTINS] =
DLL_ENTRY(TOOLHELP), DLL_ENTRY(TOOLHELP),
DLL_ENTRY(MOUSE), DLL_ENTRY(MOUSE),
DLL_ENTRY(COMMDLG), DLL_ENTRY(COMMDLG),
DLL_ENTRY(OLE2), DLL_ENTRY_NOTUSED(OLE2),
DLL_ENTRY(OLE2CONV), DLL_ENTRY_NOTUSED(OLE2CONV),
DLL_ENTRY(OLE2DISP), DLL_ENTRY_NOTUSED(OLE2DISP),
DLL_ENTRY(OLE2NLS), DLL_ENTRY_NOTUSED(OLE2NLS),
DLL_ENTRY(OLE2PROX), DLL_ENTRY_NOTUSED(OLE2PROX),
DLL_ENTRY(OLECLI), DLL_ENTRY_NOTUSED(OLECLI),
DLL_ENTRY(OLESVR), DLL_ENTRY_NOTUSED(OLESVR),
DLL_ENTRY(COMPOBJ), DLL_ENTRY_NOTUSED(COMPOBJ),
DLL_ENTRY(STORAGE), DLL_ENTRY_NOTUSED(STORAGE),
DLL_ENTRY(WINPROCS), DLL_ENTRY(WINPROCS),
DLL_ENTRY(DDEML) DLL_ENTRY_NOTUSED(DDEML)
}; };
/* don't forget to increase N_BUILTINS in dlls.h if you add a dll */ /* don't forget to increase N_BUILTINS in dlls.h if you add a dll */
...@@ -153,7 +156,7 @@ void RELAY_DebugCall32( char *args ) ...@@ -153,7 +156,7 @@ void RELAY_DebugCall32( char *args )
/*********************************************************************** /***********************************************************************
* RELAY_DebugReturn * RELAY_DebugReturn
*/ */
void RELAY_DebugReturn( int short_ret, int ret_val ) void RELAY_DebugReturn( int func_type, int ret_val )
{ {
STACK16FRAME *frame; STACK16FRAME *frame;
struct dll_table_s *table; struct dll_table_s *table;
...@@ -166,8 +169,18 @@ void RELAY_DebugReturn( int short_ret, int ret_val ) ...@@ -166,8 +169,18 @@ void RELAY_DebugReturn( int short_ret, int ret_val )
name = MODULE_GetEntryPointName( table->hModule, frame->ordinal_number ); name = MODULE_GetEntryPointName( table->hModule, frame->ordinal_number );
printf( "Ret %s.%d: %*.*s() ", printf( "Ret %s.%d: %*.*s() ",
table->name, frame->ordinal_number, *name, *name, name + 1 ); table->name, frame->ordinal_number, *name, *name, name + 1 );
if (short_ret) printf( "retval=0x%04x\n", ret_val & 0xffff ); switch(func_type)
else printf( "retval=0x%08x\n", ret_val ); {
case 0: /* long */
printf( "retval=0x%08x ds=%04x\n", ret_val, frame->ds );
break;
case 1: /* word */
printf( "retval=0x%04x ds=%04x\n", ret_val & 0xffff, frame->ds );
break;
case 2: /* regs */
printf( "retval=none ds=%04x\n", frame->ds );
break;
}
} }
......
...@@ -6,27 +6,28 @@ id 5 ...@@ -6,27 +6,28 @@ id 5
# proper parameters. It's just to have stub for PROGMAN.EXE ... # proper parameters. It's just to have stub for PROGMAN.EXE ...
# #
1 pascal RegOpenKey(word ptr ptr) RegOpenKey 1 pascal RegOpenKey(word ptr ptr) RegOpenKey
2 pascal RegCreateKey(word ptr ptr) RegCreateKey 2 pascal RegCreateKey(word ptr ptr) RegCreateKey
3 pascal RegCloseKey(word) RegCloseKey 3 pascal RegCloseKey(word) RegCloseKey
4 pascal RegDeleteKey(word ptr) RegDeleteKey 4 pascal RegDeleteKey(word ptr) RegDeleteKey
5 pascal RegSetValue(word ptr long ptr long) RegSetValue 5 pascal RegSetValue(word ptr long ptr long) RegSetValue
6 pascal RegQueryValue(word ptr ptr ptr) RegQueryValue 6 pascal RegQueryValue(word ptr ptr ptr) RegQueryValue
7 pascal RegEnumKey(word long ptr long) RegEnumKey 7 pascal RegEnumKey(word long ptr long) RegEnumKey
9 pascal DragAcceptFiles(word word) DragAcceptFiles 9 pascal16 DragAcceptFiles(word word) DragAcceptFiles
11 pascal DragQueryFile(word s_word ptr s_word) DragQueryFile 11 pascal16 DragQueryFile(word s_word ptr s_word) DragQueryFile
12 pascal DragFinish(word) DragFinish 12 pascal16 DragFinish(word) DragFinish
13 pascal DragQueryPoint(word ptr) DragQueryPoint 13 pascal16 DragQueryPoint(word ptr) DragQueryPoint
20 pascal ShellExecute(word ptr ptr ptr ptr s_word) ShellExecute 20 pascal16 ShellExecute(word ptr ptr ptr ptr s_word) ShellExecute
21 pascal FindExecutable(ptr ptr ptr) FindExecutable 21 pascal16 FindExecutable(ptr ptr ptr) FindExecutable
22 pascal ShellAbout(word ptr ptr word) ShellAbout 22 pascal16 ShellAbout(word ptr ptr word) ShellAbout
33 pascal AboutDlgProc(word word word long) AboutDlgProc 33 pascal16 AboutDlgProc(word word word long) AboutDlgProc
34 pascal ExtractIcon(word ptr s_word) ExtractIcon 34 pascal16 ExtractIcon(word ptr s_word) ExtractIcon
36 pascal ExtractAssociatedIcon(word ptr ptr) ExtractAssociatedIcon 36 pascal16 ExtractAssociatedIcon(word ptr ptr) ExtractAssociatedIcon
37 pascal DoEnvironmentSubst(ptr word) DoEnvironmentSubst 37 pascal DoEnvironmentSubst(ptr word) DoEnvironmentSubst
38 stub FindEnvironmentString
39 stub InternalExtractIcon 39 stub InternalExtractIcon
102 pascal RegisterShellHook(ptr) RegisterShellHook 102 pascal16 RegisterShellHook(ptr) RegisterShellHook
103 pascal ShellHookProc() ShellHookProc 103 pascal16 ShellHookProc() ShellHookProc
# 8 7 0000 WEP exported, shared data # 8 7 0000 WEP exported, shared data
#100 4 0550 HERETHARBETYGARS exported, shared data #100 4 0550 HERETHARBETYGARS exported, shared data
......
name sound name sound
id 6 id 6
1 pascal OPENSOUND() OpenSound 1 pascal16 OpenSound() OpenSound
2 pascal CLOSESOUND() CloseSound 2 pascal16 CloseSound() CloseSound
3 pascal SETVOICEQUEUESIZE(word word) SetVoiceQueueSize 3 pascal16 SetVoiceQueueSize(word word) SetVoiceQueueSize
4 pascal SETVOICENOTE(word word word word) SetVoiceNote 4 pascal16 SetVoiceNote(word word word word) SetVoiceNote
5 pascal SETVOICEACCENT(word word word word word) 5 pascal16 SetVoiceAccent(word word word word word) SetVoiceAccent
SetVoiceAccent 6 pascal16 SetVoiceEnvelope(word word word) SetVoiceEnvelope
6 pascal SETVOICEENVELOPE(word word word) SetVoiceEnvelope 7 pascal16 SetSoundNoise(word word) SetSoundNoise
7 pascal SETSOUNDNOISE(word word) SetSoundNoise 8 pascal16 SetVoiceSound(word long word) SetVoiceSound
8 pascal SETVOICESOUND(word long word) SetVoiceSound 9 pascal16 StartSound() StartSound
9 pascal STARTSOUND() StartSound 10 pascal16 StopSound() StopSound
10 pascal STOPSOUND() StopSound 11 pascal16 WaitSoundState(word) WaitSoundState
11 pascal WAITSOUNDSTATE(word) WaitSoundState 12 pascal16 SyncAllVoices() SyncAllVoices
12 pascal SYNCALLVOICES() SyncAllVoices 13 pascal16 CountVoiceNotes(word) CountVoiceNotes
13 pascal COUNTVOICENOTES(word) CountVoiceNotes 14 pascal GetThresholdEvent() GetThresholdEvent
14 pascal GETTHRESHOLDEVENT() GetThresholdEvent 15 pascal16 GetThresholdStatus() GetThresholdStatus
15 pascal GETTHRESHOLDSTATUS() GetThresholdStatus 16 pascal16 SetVoiceThreshold(word word) SetVoiceThreshold
16 pascal SETVOICETHRESHOLD(word word) SetVoiceThreshold 17 pascal16 DoBeep() DoBeep
17 pascal DOBEEP() DoBeep
...@@ -7,7 +7,7 @@ id 11 ...@@ -7,7 +7,7 @@ id 11
4 stub EnableSystemTimers 4 stub EnableSystemTimers
5 stub DisableSystemTimers 5 stub DisableSystemTimers
6 pascal GetSystemmsecCount() GetTickCount 6 pascal GetSystemmsecCount() GetTickCount
7 stub Get80x87SaveSize 7 return Get80x87SaveSize 0 94
8 stub Save80x87State 8 stub Save80x87State
9 stub Restore80x87State 9 stub Restore80x87State
#20 stub A20_Proc #20 stub A20_Proc
...@@ -29,8 +29,8 @@ id 12 ...@@ -29,8 +29,8 @@ id 12
75 stub INTERRUPTREGISTER 75 stub INTERRUPTREGISTER
76 stub INTERRUPTUNREGISTER 76 stub INTERRUPTUNREGISTER
77 stub TERMINATEAPP 77 stub TERMINATEAPP
78 pascal MemoryRead(word long ptr long) MemoryRead 78 pascal MemoryRead(word long ptr long) MemoryRead
79 pascal MemoryWrite(word long ptr long) MemoryWrite 79 pascal MemoryWrite(word long ptr long) MemoryWrite
80 stub TIMERCOUNT 80 stub TIMERCOUNT
81 stub TASKSETCSIP 81 stub TASKSETCSIP
82 stub TASKGETCSIP 82 stub TASKGETCSIP
......
...@@ -2,6 +2,6 @@ name win87em ...@@ -2,6 +2,6 @@ name win87em
id 4 id 4
1 register _fpMath() WIN87_fpmath 1 register _fpMath() WIN87_fpmath
3 pascal __WinEm87Info(ptr word) WIN87_WinEm87Info 3 pascal16 __WinEm87Info(ptr word) WIN87_WinEm87Info
4 pascal __WinEm87Restore(ptr word) WIN87_WinEm87Restore 4 pascal16 __WinEm87Restore(ptr word) WIN87_WinEm87Restore
5 pascal __WinEm87Save(ptr word) WIN87_WinEm87Save 5 pascal16 __WinEm87Save(ptr word) WIN87_WinEm87Save
...@@ -7,6 +7,16 @@ ...@@ -7,6 +7,16 @@
#ifndef __WINE_CURSOR_H #ifndef __WINE_CURSOR_H
#define __WINE_CURSOR_H #define __WINE_CURSOR_H
typedef struct {
POINT pntHotSpot; /* cursor hot spot */
WORD nWidth; /* width of bitmap in pixels */
WORD nHeight;
WORD nWidthBytes;
BYTE byPlanes; /* number of bit planes */
BYTE byBitsPix; /* bits per pixel */
} CURSORICONINFO, FAR *LPCURSORICONINFO;
typedef struct { typedef struct {
BYTE Width; BYTE Width;
BYTE Reserved1; BYTE Reserved1;
......
...@@ -46,7 +46,7 @@ typedef struct { ...@@ -46,7 +46,7 @@ typedef struct {
} DRIVERINFOSTRUCT; } DRIVERINFOSTRUCT;
typedef DRIVERINFOSTRUCT FAR* LPDRIVERINFOSTRUCT; typedef DRIVERINFOSTRUCT FAR* LPDRIVERINFOSTRUCT;
typedef LRESULT (CALLBACK* DRIVERPROC)(DWORD, HDRVR, UINT, LPARAM, LPARAM); typedef LONG (CALLBACK* DRIVERPROC)(DWORD, HDRVR, UINT, LPARAM, LPARAM);
typedef struct { typedef struct {
DRIVERINFOSTRUCT dis; DRIVERINFOSTRUCT dis;
...@@ -59,12 +59,12 @@ typedef DRIVERITEM FAR* LPDRIVERITEM; ...@@ -59,12 +59,12 @@ typedef DRIVERITEM FAR* LPDRIVERITEM;
LRESULT DefDriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg, LRESULT DefDriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
DWORD dwParam1, DWORD dwParam2); DWORD dwParam1, DWORD dwParam2);
HDRVR WINAPI OpenDriver(LPSTR szDriverName, LPSTR szSectionName, LPARAM lParam2); HDRVR OpenDriver(LPSTR szDriverName, LPSTR szSectionName, LPARAM lParam2);
LRESULT WINAPI CloseDriver(HDRVR hDriver, LPARAM lParam1, LPARAM lParam2); LRESULT CloseDriver(HDRVR hDriver, LPARAM lParam1, LPARAM lParam2);
LRESULT WINAPI SendDriverMessage(HDRVR hDriver, WORD message, LPARAM lParam1, LPARAM lParam2); LRESULT SendDriverMessage(HDRVR hDriver, WORD message, LPARAM lParam1, LPARAM lParam2);
HINSTANCE WINAPI GetDriverModuleHandle(HDRVR hDriver); HINSTANCE GetDriverModuleHandle(HDRVR hDriver);
HDRVR WINAPI GetNextDriver(HDRVR, DWORD); HDRVR GetNextDriver(HDRVR, DWORD);
BOOL WINAPI GetDriverInfo(HDRVR, DRIVERINFOSTRUCT FAR*); BOOL GetDriverInfo(HDRVR, DRIVERINFOSTRUCT FAR*);
...@@ -26,8 +26,10 @@ typedef struct ...@@ -26,8 +26,10 @@ typedef struct
enum seg_type type; /* segment type */ enum seg_type type; /* segment type */
} ldt_entry; } ldt_entry;
extern void LDT_BytesToEntry( const unsigned long *buffer, ldt_entry *content);
extern void LDT_EntryToBytes( unsigned long *buffer, const ldt_entry *content);
extern int LDT_GetEntry( int entry, ldt_entry *content ); extern int LDT_GetEntry( int entry, ldt_entry *content );
extern int LDT_SetEntry( int entry, ldt_entry *content ); extern int LDT_SetEntry( int entry, const ldt_entry *content );
extern void LDT_Print(); extern void LDT_Print();
...@@ -57,6 +59,17 @@ extern ldt_copy_entry ldt_copy[LDT_SIZE]; ...@@ -57,6 +59,17 @@ extern ldt_copy_entry ldt_copy[LDT_SIZE];
((void*)(GET_SEL_BASE((int)(ptr) >> 16) + ((int)(ptr) & 0xffff))) ((void*)(GET_SEL_BASE((int)(ptr) >> 16) + ((int)(ptr) & 0xffff)))
#define PTR_SEG_OFF_TO_LIN(seg,off) \ #define PTR_SEG_OFF_TO_LIN(seg,off) \
((void*)(GET_SEL_BASE(seg) + ((int)(off) & 0xffff))) ((void*)(GET_SEL_BASE(seg) + (unsigned int)(off)))
extern unsigned char ldt_flags_copy[LDT_SIZE];
#define LDT_FLAGS_TYPE 0x03 /* Mask for segment type */
#define LDT_FLAGS_READONLY 0x04 /* Segment is read-only (data) */
#define LDT_FLAGS_EXECONLY 0x04 /* Segment is execute-only (code) */
#define LDT_FLAGS_32BIT 0x08 /* Segment is 32-bit (code or stack) */
#define LDT_FLAGS_BIG 0x10 /* Segment is big (limit is in pages) */
#define GET_SEL_FLAGS(sel) (ldt_flags_copy[SELECTOR_TO_ENTRY(sel)])
#endif /* _WINE_LDT_H */ #endif /* _WINE_LDT_H */
...@@ -20,5 +20,7 @@ extern HLOCAL LOCAL_Handle( WORD ds, WORD addr ); ...@@ -20,5 +20,7 @@ extern HLOCAL LOCAL_Handle( WORD ds, WORD addr );
extern WORD LOCAL_Size( WORD ds, HLOCAL handle ); extern WORD LOCAL_Size( WORD ds, HLOCAL handle );
extern WORD LOCAL_Flags( WORD ds, HLOCAL handle ); extern WORD LOCAL_Flags( WORD ds, HLOCAL handle );
extern WORD LOCAL_HeapSize( WORD ds ); extern WORD LOCAL_HeapSize( WORD ds );
extern WORD LOCAL_Lock( WORD ds, HLOCAL handle );
extern BOOL LOCAL_Unlock( WORD ds, HLOCAL handle );
#endif /* __WINE_LOCAL_H */ #endif /* __WINE_LOCAL_H */
...@@ -15,24 +15,24 @@ extern LONG MDIClientWndProc(HWND hwnd, WORD message, ...@@ -15,24 +15,24 @@ extern LONG MDIClientWndProc(HWND hwnd, WORD message,
WORD wParam, LONG lParam); /* mdi.c */ WORD wParam, LONG lParam); /* mdi.c */
typedef struct mdi_child_info_s typedef struct
{ {
struct mdi_child_info_s *next, *prev; HLOCAL next, prev;
HWND hwnd; HWND hwnd;
} MDICHILDINFO; } MDICHILDINFO;
typedef struct typedef struct
{ {
HMENU hWindowMenu; HMENU hWindowMenu;
MDICHILDINFO *infoActiveChildren; HLOCAL infoActiveChildren;
WORD nActiveChildren; WORD nActiveChildren;
WORD idFirstChild; WORD idFirstChild;
HWND hwndActiveChild; HWND hwndActiveChild;
HWND hwndHitTest; HWND hwndHitTest;
BOOL flagMenuAltered; BOOL flagMenuAltered;
BOOL flagChildMaximized; BOOL flagChildMaximized;
RECT rectMaximize; RECT rectMaximize;
RECT rectRestore; RECT rectRestore;
} MDICLIENTINFO; } MDICLIENTINFO;
#endif /* MDI_H */ #endif /* MDI_H */
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "wintypes.h" #include "wintypes.h"
#include "wine.h" #include "wine.h"
extern BOOL INSTR_HandleInstruction( struct sigcontext_struct *context );
extern int do_int10(struct sigcontext_struct *); extern int do_int10(struct sigcontext_struct *);
extern int do_int13(struct sigcontext_struct *); extern int do_int13(struct sigcontext_struct *);
extern int do_int15(struct sigcontext_struct *); extern int do_int15(struct sigcontext_struct *);
...@@ -17,14 +19,14 @@ extern int do_int2f(struct sigcontext_struct *); ...@@ -17,14 +19,14 @@ extern int do_int2f(struct sigcontext_struct *);
extern int do_int31(struct sigcontext_struct *); extern int do_int31(struct sigcontext_struct *);
extern int do_int5c(struct sigcontext_struct *); extern int do_int5c(struct sigcontext_struct *);
extern void inportb(struct sigcontext_struct *context); extern void inportb( struct sigcontext_struct *context );
extern void inport(struct sigcontext_struct *context); extern void inport( struct sigcontext_struct *context, int long_op );
extern void outportb(struct sigcontext_struct *context); extern void outportb( struct sigcontext_struct *context );
extern void outport(struct sigcontext_struct *context); extern void outport( struct sigcontext_struct *context, int long_op );
extern void inportb_abs(struct sigcontext_struct *context); extern void inportb_abs( struct sigcontext_struct *context);
extern void inport_abs(struct sigcontext_struct *context); extern void inport_abs( struct sigcontext_struct *context, int long_op );
extern void outportb_abs(struct sigcontext_struct *context); extern void outportb_abs( struct sigcontext_struct *context );
extern void outport_abs(struct sigcontext_struct *context); extern void outport_abs( struct sigcontext_struct *context, int long_op );
extern void IntBarf(int i, struct sigcontext_struct *context); extern void IntBarf(int i, struct sigcontext_struct *context);
......
...@@ -10,7 +10,7 @@ struct dosdirent { ...@@ -10,7 +10,7 @@ struct dosdirent {
DIR *ds; DIR *ds;
char unixpath[256]; char unixpath[256];
char filename[256]; char filename[256];
char filemask[12]; char filemask[13];
char attribute; char attribute;
char search_attribute; char search_attribute;
long filesize; long filesize;
...@@ -30,7 +30,9 @@ struct fcb { ...@@ -30,7 +30,9 @@ struct fcb {
BYTE dummy2[9]; BYTE dummy2[9];
}; };
#define DOSVERSION 0x0005; /* Major version in low byte: DOS 5.00 */ #define DOSVERSION 0x0005 /* Major version in low byte: DOS 5.00 */
#define WINVERSION 0x0a03 /* Windows version 3.10 */
#define MAX_DOS_DRIVES 26 #define MAX_DOS_DRIVES 26
extern WORD ExtendedError; extern WORD ExtendedError;
......
/*
* ole2.h - Declarations for OLE2
*/
typedef LONG HRESULT;
#define S_OK 0
#define S_FALSE 1
/* OLE version */
#define rmm 23
#define rup 639
...@@ -7,39 +7,45 @@ ...@@ -7,39 +7,45 @@
#include "wine.h" #include "wine.h"
#define EAX context->sc_eax #define EAX (context->sc_eax)
#define EBX context->sc_ebx #define EBX (context->sc_ebx)
#define ECX context->sc_ecx #define ECX (context->sc_ecx)
#define EDX context->sc_edx #define EDX (context->sc_edx)
#define ESI (context->sc_esi)
#define AX *(WORD*)&context->sc_eax #define EDI (context->sc_edi)
#define BX *(WORD*)&context->sc_ebx
#define CX *(WORD*)&context->sc_ecx #define AX (*(WORD*)&context->sc_eax)
#define DX *(WORD*)&context->sc_edx #define BX (*(WORD*)&context->sc_ebx)
#define CX (*(WORD*)&context->sc_ecx)
#define AL *(BYTE*)&context->sc_eax #define DX (*(WORD*)&context->sc_edx)
#define AH *(((BYTE*)&context->sc_eax)+1) #define SI (*(WORD*)&context->sc_esi)
#define BL *(BYTE*)&context->sc_ebx #define DI (*(WORD*)&context->sc_edi)
#define BH *(((BYTE*)&context->sc_ebx)+1)
#define CL *(BYTE*)&context->sc_ecx #define AL (*(BYTE*)&context->sc_eax)
#define CH *(((BYTE*)&context->sc_ecx)+1) #define AH (*(((BYTE*)&context->sc_eax)+1))
#define DL *(BYTE*)&context->sc_edx #define BL (*(BYTE*)&context->sc_ebx)
#define DH *(((BYTE*)&context->sc_edx)+1) #define BH (*(((BYTE*)&context->sc_ebx)+1))
#define CL (*(BYTE*)&context->sc_ecx)
#define CS context->sc_cs #define CH (*(((BYTE*)&context->sc_ecx)+1))
#define DS context->sc_ds #define DL (*(BYTE*)&context->sc_edx)
#define ES context->sc_es #define DH (*(((BYTE*)&context->sc_edx)+1))
#define SS context->sc_ss
#define CS (context->sc_cs)
#define DI ((WORD)context->sc_edi) #define DS (context->sc_ds)
#define SI ((WORD)context->sc_esi) #define ES (context->sc_es)
#define SP context->sc_esp #define SS (context->sc_ss)
#ifndef __FreeBSD__ #ifndef __FreeBSD__
#define EFL context->sc_eflags #define EFL (context->sc_eflags)
#else #else
#define EFL context->sc_efl #define EFL (context->sc_efl)
#endif #endif
#define EIP context->sc_eip
#define EIP (context->sc_eip)
#define ESP (context->sc_esp)
#define IP (*(WORD*)&context->sc_eip)
#define SP (*(WORD*)&context->sc_esp)
#define SetCflag (EFL |= 0x00000001) #define SetCflag (EFL |= 0x00000001)
#define ResetCflag (EFL &= 0xfffffffe) #define ResetCflag (EFL &= 0xfffffffe)
......
...@@ -79,7 +79,6 @@ ...@@ -79,7 +79,6 @@
#undef DEBUG_ACCEL #undef DEBUG_ACCEL
#undef DEBUG_BITBLT #undef DEBUG_BITBLT
#undef DEBUG_BITMAP #undef DEBUG_BITMAP
#undef DEBUG_CALLBACK
#undef DEBUG_CARET #undef DEBUG_CARET
#undef DEBUG_CATCH #undef DEBUG_CATCH
#undef DEBUG_CDAUDIO #undef DEBUG_CDAUDIO
...@@ -104,7 +103,6 @@ ...@@ -104,7 +103,6 @@
#undef DEBUG_GDI #undef DEBUG_GDI
#undef DEBUG_GLOBAL #undef DEBUG_GLOBAL
#undef DEBUG_GRAPHICS #undef DEBUG_GRAPHICS
#undef DEBUG_HEAP
#undef DEBUG_ICON #undef DEBUG_ICON
#undef DEBUG_INT #undef DEBUG_INT
#undef DEBUG_KEY #undef DEBUG_KEY
...@@ -123,10 +121,10 @@ ...@@ -123,10 +121,10 @@
#undef DEBUG_METAFILE #undef DEBUG_METAFILE
#undef DEBUG_MIDI #undef DEBUG_MIDI
#undef DEBUG_MMIO #undef DEBUG_MMIO
#undef DEBUG_MMSYS
#undef DEBUG_MMTIME #undef DEBUG_MMTIME
#undef DEBUG_MODULE #undef DEBUG_MODULE
#undef DEBUG_MSG #undef DEBUG_MSG
#undef DEBUG_MSGBOX
#undef DEBUG_NONCLIENT #undef DEBUG_NONCLIENT
#undef DEBUG_OLE #undef DEBUG_OLE
#undef DEBUG_PALETTE #undef DEBUG_PALETTE
...@@ -154,7 +152,6 @@ ...@@ -154,7 +152,6 @@
#define DEBUG_ACCEL #define DEBUG_ACCEL
#define DEBUG_BITBLT #define DEBUG_BITBLT
#define DEBUG_BITMAP #define DEBUG_BITMAP
#define DEBUG_CALLBACK
#define DEBUG_CARET #define DEBUG_CARET
#define DEBUG_CATCH #define DEBUG_CATCH
#define DEBUG_CDAUDIO #define DEBUG_CDAUDIO
...@@ -179,7 +176,6 @@ ...@@ -179,7 +176,6 @@
#define DEBUG_GDI #define DEBUG_GDI
#define DEBUG_GLOBAL #define DEBUG_GLOBAL
#define DEBUG_GRAPHICS #define DEBUG_GRAPHICS
#define DEBUG_HEAP
#define DEBUG_ICON #define DEBUG_ICON
#define DEBUG_INT #define DEBUG_INT
#define DEBUG_KEY #define DEBUG_KEY
...@@ -198,10 +194,10 @@ ...@@ -198,10 +194,10 @@
#define DEBUG_METAFILE #define DEBUG_METAFILE
#define DEBUG_MIDI #define DEBUG_MIDI
#define DEBUG_MMIO #define DEBUG_MMIO
#define DEBUG_MMSYS
#define DEBUG_MMTIME #define DEBUG_MMTIME
#define DEBUG_MODULE #define DEBUG_MODULE
#define DEBUG_MSG #define DEBUG_MSG
#define DEBUG_MSGBOX
#define DEBUG_NONCLIENT #define DEBUG_NONCLIENT
#define DEBUG_OLE #define DEBUG_OLE
#define DEBUG_PALETTE #define DEBUG_PALETTE
......
...@@ -2125,6 +2125,8 @@ typedef COMPAREITEMSTRUCT FAR* LPCOMPAREITEMSTRUCT; ...@@ -2125,6 +2125,8 @@ typedef COMPAREITEMSTRUCT FAR* LPCOMPAREITEMSTRUCT;
#define LMEM_FIXED 0 #define LMEM_FIXED 0
#define LMEM_MOVEABLE 0x0002 #define LMEM_MOVEABLE 0x0002
#define LMEM_NOCOMPACT 0x0010
#define LMEM_NODISCARD 0x0020
#define LMEM_ZEROINIT 0x0040 #define LMEM_ZEROINIT 0x0040
#define LMEM_MODIFY 0x0080 #define LMEM_MODIFY 0x0080
#define LMEM_DISCARDABLE 0x0F00 #define LMEM_DISCARDABLE 0x0F00
...@@ -2815,9 +2817,9 @@ Fc(HWND,GetNextDlgTabItem,HWND,a,HWND,b,BOOL,c) ...@@ -2815,9 +2817,9 @@ Fc(HWND,GetNextDlgTabItem,HWND,a,HWND,b,BOOL,c)
Fc(INT,GetTextFace,HDC,a,INT,b,LPSTR,c) Fc(INT,GetTextFace,HDC,a,INT,b,LPSTR,c)
Fc(INT,OpenFile,LPSTR,a,LPOFSTRUCT,b,WORD,c) Fc(INT,OpenFile,LPSTR,a,LPOFSTRUCT,b,WORD,c)
Fc(INT,_lread,INT,a,LPSTR,b,WORD,c) Fc(INT,_lread,INT,a,LPSTR,b,WORD,c)
Fc(INT,_lwrite,INT,a,LPSTR,b,WORD,c) Fc(INT,_lwrite,INT,a,LPCSTR,b,WORD,c)
Fc(LONG,_hread,INT,a,LPSTR,b,LONG,c) Fc(LONG,_hread,INT,a,LPSTR,b,LONG,c)
Fc(LONG,_hwrite,INT,a,LPSTR,b,LONG,c) Fc(LONG,_hwrite,INT,a,LPCSTR,b,LONG,c)
Fc(LONG,GetBitmapBits,HBITMAP,a,LONG,b,LPSTR,c) Fc(LONG,GetBitmapBits,HBITMAP,a,LONG,b,LPSTR,c)
Fc(LONG,SetBitmapBits,HBITMAP,a,LONG,b,LPSTR,c) Fc(LONG,SetBitmapBits,HBITMAP,a,LONG,b,LPSTR,c)
Fc(LONG,SetClassLong,HWND,a,short,b,LONG,c) Fc(LONG,SetClassLong,HWND,a,short,b,LONG,c)
......
#define LOCALE_ILANGUAGE 0x00000001
#define LOCALE_SLANGUAGE 0x00000002
#define LOCALE_SENGLANGUAGE 0x00001001
#define LOCALE_SABBREVLANGNAME 0x00000003
#define LOCALE_SNATIVELANGNAME 0x00000004
#define LOCALE_ICOUNTRY 0x00000005
#define LOCALE_SCOUNTRY 0x00000006
#define LOCALE_SENGCOUNTRY 0x00001002
#define LOCALE_SABBREVCTRYNAME 0x00000007
#define LOCALE_SNATIVECTRYNAME 0x00000008
#define LOCALE_IDEFAULTLANGUAGE 0x00000009
#define LOCALE_IDEFAULTCOUNTRY 0x0000000A
#define LOCALE_IDEFAULTCODEPAGE 0x0000000B
#define LOCALE_IDEFAULTANSICODEPAGE 0x00001004
#define LOCALE_SLIST 0x0000000C
#define LOCALE_IMEASURE 0x0000000D
#define LOCALE_SDECIMAL 0x0000000E
#define LOCALE_STHOUSAND 0x0000000F
#define LOCALE_SGROUPING 0x00000010
#define LOCALE_IDIGITS 0x00000011
#define LOCALE_ILZERO 0x00000012
#define LOCALE_INEGNUMBER 0x00001010
#define LOCALE_SNATIVEDIGITS 0x00000013
#define LOCALE_SCURRENCY 0x00000014
#define LOCALE_SINTLSYMBOL 0x00000015
#define LOCALE_SMONDECIMALSEP 0x00000016
#define LOCALE_SMONTHOUSANDSEP 0x00000017
#define LOCALE_SMONGROUPING 0x00000018
#define LOCALE_ICURRDIGITS 0x00000019
#define LOCALE_IINTLCURRDIGITS 0x0000001A
#define LOCALE_ICURRENCY 0x0000001B
#define LOCALE_INEGCURR 0x0000001C
#define LOCALE_SDATE 0x0000001D
#define LOCALE_STIME 0x0000001E
#define LOCALE_SSHORTDATE 0x0000001F
#define LOCALE_SLONGDATE 0x00000020
#define LOCALE_STIMEFORMAT 0x00001003
#define LOCALE_IDATE 0x00000021
#define LOCALE_ILDATE 0x00000022
#define LOCALE_ITIME 0x00000023
#define LOCALE_ITIMEMARKPOSN 0x00001005
#define LOCALE_ICENTURY 0x00000024
#define LOCALE_ITLZERO 0x00000025
#define LOCALE_IDAYLZERO 0x00000026
#define LOCALE_IMONLZERO 0x00000027
#define LOCALE_S1159 0x00000028
#define LOCALE_S2359 0x00000029
#define LOCALE_ICALENDARTYPE 0x00001009
#define LOCALE_IOPTIONALCALENDAR 0x0000100B
#define LOCALE_IFIRSTDAYOFWEEK 0x0000100C
#define LOCALE_IFIRSTWEEKOFYEAR 0x0000100D
#define LOCALE_SDAYNAME1 0x0000002A
#define LOCALE_SDAYNAME2 0x0000002B
#define LOCALE_SDAYNAME3 0x0000002C
#define LOCALE_SDAYNAME4 0x0000002D
#define LOCALE_SDAYNAME5 0x0000002E
#define LOCALE_SDAYNAME6 0x0000002F
#define LOCALE_SDAYNAME7 0x00000030
#define LOCALE_SABBREVDAYNAME1 0x00000031
#define LOCALE_SABBREVDAYNAME2 0x00000032
#define LOCALE_SABBREVDAYNAME3 0x00000033
#define LOCALE_SABBREVDAYNAME4 0x00000034
#define LOCALE_SABBREVDAYNAME5 0x00000035
#define LOCALE_SABBREVDAYNAME6 0x00000036
#define LOCALE_SABBREVDAYNAME7 0x00000037
#define LOCALE_SMONTHNAME1 0x00000038
#define LOCALE_SMONTHNAME2 0x00000039
#define LOCALE_SMONTHNAME3 0x0000003A
#define LOCALE_SMONTHNAME4 0x0000003B
#define LOCALE_SMONTHNAME5 0x0000003C
#define LOCALE_SMONTHNAME6 0x0000003D
#define LOCALE_SMONTHNAME7 0x0000003E
#define LOCALE_SMONTHNAME8 0x0000003F
#define LOCALE_SMONTHNAME9 0x00000040
#define LOCALE_SMONTHNAME10 0x00000041
#define LOCALE_SMONTHNAME11 0x00000042
#define LOCALE_SMONTHNAME12 0x00000043
#define LOCALE_SMONTHNAME13 0x0000100E
#define LOCALE_SABBREVMONTHNAME1 0x00000044
#define LOCALE_SABBREVMONTHNAME2 0x00000045
#define LOCALE_SABBREVMONTHNAME3 0x00000046
#define LOCALE_SABBREVMONTHNAME4 0x00000047
#define LOCALE_SABBREVMONTHNAME5 0x00000048
#define LOCALE_SABBREVMONTHNAME6 0x00000049
#define LOCALE_SABBREVMONTHNAME7 0x0000004A
#define LOCALE_SABBREVMONTHNAME8 0x0000004B
#define LOCALE_SABBREVMONTHNAME9 0x0000004C
#define LOCALE_SABBREVMONTHNAME10 0x0000004D
#define LOCALE_SABBREVMONTHNAME11 0x0000004E
#define LOCALE_SABBREVMONTHNAME12 0x0000004F
#define LOCALE_SABBREVMONTHNAME13 0x0000100F
#define LOCALE_SPOSITIVESIGN 0x00000050
#define LOCALE_SNEGATIVESIGN 0x00000051
#define LOCALE_IPOSSIGNPOSN 0x00000052
#define LOCALE_INEGSIGNPOSN 0x00000053
#define LOCALE_IPOSSYMPRECEDES 0x00000054
#define LOCALE_IPOSSEPBYSPACE 0x00000055
#define LOCALE_INEGSYMPRECEDES 0x00000056
#define LOCALE_INEGSEPBYSPACE 0x00000057
...@@ -31,8 +31,8 @@ typedef SEGPTR FARPROC; ...@@ -31,8 +31,8 @@ typedef SEGPTR FARPROC;
typedef SEGPTR WNDPROC; typedef SEGPTR WNDPROC;
#endif #endif
typedef FARPROC DLGPROC; typedef FARPROC DLGPROC;
typedef int CATCHBUF[9]; typedef WORD CATCHBUF[9];
typedef int *LPCATCHBUF; typedef WORD *LPCATCHBUF;
typedef FARPROC HOOKPROC; typedef FARPROC HOOKPROC;
#define DECLARE_HANDLE(a) typedef HANDLE a; #define DECLARE_HANDLE(a) typedef HANDLE a;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
static HMODULE hFirstModule = 0; static HMODULE hFirstModule = 0;
static HMODULE hCachedModule = 0; /* Module cached by MODULE_OpenFile */
/*********************************************************************** /***********************************************************************
...@@ -271,7 +272,6 @@ int MODULE_OpenFile( HMODULE hModule ) ...@@ -271,7 +272,6 @@ int MODULE_OpenFile( HMODULE hModule )
NE_MODULE *pModule; NE_MODULE *pModule;
char *name; char *name;
static HMODULE hCachedModule = 0;
static int cachedfd = -1; static int cachedfd = -1;
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
...@@ -306,8 +306,10 @@ static BOOL MODULE_CreateSegments( HMODULE hModule ) ...@@ -306,8 +306,10 @@ static BOOL MODULE_CreateSegments( HMODULE hModule )
if (i == pModule->ss) minsize += pModule->stack_size; if (i == pModule->ss) minsize += pModule->stack_size;
if (i == pModule->dgroup) if (i == pModule->dgroup)
{ {
#if 0
/* FIXME: this is needed because heap growing is not implemented */ /* FIXME: this is needed because heap growing is not implemented */
pModule->heap_size = 0x10000 - minsize; pModule->heap_size = 0x10000 - minsize;
#endif
/* The DGROUP is allocated by MODULE_CreateInstance */ /* The DGROUP is allocated by MODULE_CreateInstance */
continue; continue;
} }
...@@ -865,6 +867,10 @@ static void MODULE_FreeModule( HMODULE hModule ) ...@@ -865,6 +867,10 @@ static void MODULE_FreeModule( HMODULE hModule )
if (pModule->nrname_handle) GlobalFree( pModule->nrname_handle ); if (pModule->nrname_handle) GlobalFree( pModule->nrname_handle );
if (pModule->dlls_to_init) GlobalFree( pModule->dlls_to_init ); if (pModule->dlls_to_init) GlobalFree( pModule->dlls_to_init );
GlobalFree( hModule ); GlobalFree( hModule );
/* Remove module from cache */
if (hCachedModule == hModule) hCachedModule = 0;
} }
...@@ -997,6 +1003,8 @@ BOOL FreeModule( HANDLE hModule ) ...@@ -997,6 +1003,8 @@ BOOL FreeModule( HANDLE hModule )
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return FALSE; if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return FALSE;
dprintf_module( stddeb, "FreeModule: %s count %d\n",
MODULE_GetModuleName(hModule), pModule->count );
if (--pModule->count == 0) MODULE_FreeModule( hModule ); if (--pModule->count == 0) MODULE_FreeModule( hModule );
return TRUE; return TRUE;
} }
...@@ -1052,8 +1060,10 @@ HANDLE LoadLibrary( LPCSTR libname ) ...@@ -1052,8 +1060,10 @@ HANDLE LoadLibrary( LPCSTR libname )
HANDLE handle; HANDLE handle;
dprintf_module( stddeb, "LoadLibrary: (%08x) %s\n", (int)libname, libname); dprintf_module( stddeb, "LoadLibrary: (%08x) %s\n", (int)libname, libname);
/* This does not increment the module reference count, and will
* therefore cause crashes on FreeLibrary calls.
if ((handle = MODULE_FindModule( libname )) != 0) return handle; if ((handle = MODULE_FindModule( libname )) != 0) return handle;
*/
handle = LoadModule( libname, (LPVOID)-1 ); handle = LoadModule( libname, (LPVOID)-1 );
if (handle == 2) /* file not found */ if (handle == 2) /* file not found */
{ {
......
...@@ -48,6 +48,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum ) ...@@ -48,6 +48,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
pSegTable = NE_SEG_TABLE( pModule ); pSegTable = NE_SEG_TABLE( pModule );
pSeg = pSegTable + segnum - 1; pSeg = pSegTable + segnum - 1;
pModuleTable = NE_MODULE_TABLE( pModule ); pModuleTable = NE_MODULE_TABLE( pModule );
if (!pSeg->filepos) return TRUE; /* No file image, just return */ if (!pSeg->filepos) return TRUE; /* No file image, just return */
fd = MODULE_OpenFile( hModule ); fd = MODULE_OpenFile( hModule );
...@@ -56,14 +57,6 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum ) ...@@ -56,14 +57,6 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
lseek( fd, pSeg->filepos << pModule->alignment, SEEK_SET ); lseek( fd, pSeg->filepos << pModule->alignment, SEEK_SET );
read( fd, GlobalLock( pSeg->selector ), pSeg->size ? pSeg->size : 0x10000); read( fd, GlobalLock( pSeg->selector ), pSeg->size ? pSeg->size : 0x10000);
if ( pModule->heap_size && pModule->dgroup == segnum )
{
/* Initialize the local heap */
WORD heapstart = pSeg->minsize;
if (pModule->ss == pModule->dgroup) heapstart += pModule->stack_size;
LocalInit( pSeg->selector, heapstart, heapstart + pModule->heap_size );
}
if (!(pSeg->flags & NE_SEGFLAGS_RELOC_DATA)) if (!(pSeg->flags & NE_SEGFLAGS_RELOC_DATA))
return TRUE; /* No relocation data, we are done */ return TRUE; /* No relocation data, we are done */
...@@ -316,36 +309,51 @@ void NE_FixupPrologs( HMODULE hModule ) ...@@ -316,36 +309,51 @@ void NE_FixupPrologs( HMODULE hModule )
p += 2; p += 2;
while (count-- > 0) while (count-- > 0)
{ {
dprintf_module( stddeb,"Flags: %04x ", *p ); dprintf_module( stddeb,"Flags: %04x, sel %02x ", *p, sel);
/* FIXME: Does anyone know the exact meaning of these flags? */ /* According to the output generated by TDUMP, the flags mean:
/* 0x0001 seems to mean: Fix up the function prolog */ * 0x0001 function is exported
* 0x0002 Single data (seems to occur only in DLLs)
*/
if (sel == 0xff) { /* moveable */
dprintf_module( stddeb, "(%02x) o %04x ", p[3], *(WORD *)(p+4) );
fixup_ptr = (char *)GET_SEL_BASE(pSegTable[p[3]-1].selector) + *(WORD *)(p + 4);
} else { /* fixed */
dprintf_module( stddeb, "offset %04x ", *(WORD *)(p+1) );
fixup_ptr = (char *)GET_SEL_BASE(pSegTable[sel-1].selector) + *(WORD *)(p + 1);
}
dprintf_module( stddeb, "Signature: %02x %02x %02x,ff %x\n",
fixup_ptr[0], fixup_ptr[1], fixup_ptr[2],
pModule->flags );
if (*p & 0x0001) if (*p & 0x0001)
{ {
if (sel == 0xff) /* moveable */
fixup_ptr = (char *)GET_SEL_BASE(pSegTable[p[3]-1].selector) + *(WORD *)(p + 4);
else /* fixed */
fixup_ptr = (char *)GET_SEL_BASE(pSegTable[sel-1].selector) + *(WORD *)(p + 1);
dprintf_module( stddeb, "Signature: %02x %02x %02x,ff %x\n",
fixup_ptr[0], fixup_ptr[1], fixup_ptr[2],
pModule->flags );
/* Verify the signature */ /* Verify the signature */
if (((fixup_ptr[0] == 0x1e && fixup_ptr[1] == 0x58) if (((fixup_ptr[0] == 0x1e && fixup_ptr[1] == 0x58)
|| (fixup_ptr[0] == 0x8c && fixup_ptr[1] == 0xd8)) || (fixup_ptr[0] == 0x8c && fixup_ptr[1] == 0xd8))
&& fixup_ptr[2] == 0x90) && fixup_ptr[2] == 0x90)
{ {
if (pModule->flags & NE_FFLAGS_SINGLEDATA) if (*p & 0x0002)
{ {
if (pModule->flags & NE_FFLAGS_MULTIPLEDATA) {
/* can this happen? */
fprintf( stderr, "FixupPrologs got confused\n" );
}
*fixup_ptr = 0xb8; /* MOV AX, */ *fixup_ptr = 0xb8; /* MOV AX, */
*(WORD *)(fixup_ptr+1) = dgroup; *(WORD *)(fixup_ptr+1) = dgroup;
} }
else else
{ {
fixup_ptr[0] = 0x90; /* non-library: NOPs */ if (pModule->flags & NE_FFLAGS_MULTIPLEDATA) {
fixup_ptr[1] = 0x90; fixup_ptr[0] = 0x90; /* non-library: NOPs */
fixup_ptr[2] = 0x90; fixup_ptr[1] = 0x90;
fixup_ptr[2] = 0x90;
}
} }
} } else {
dprintf_fixup( stddeb, "Unknown signature\n" );
}
} }
else
dprintf_module( stddeb,"\n");
p += (sel == 0xff) ? 6 : 3; p += (sel == 0xff) ? 6 : 3;
} }
} }
...@@ -423,13 +431,14 @@ void NE_InitializeDLLs( HMODULE hModule ) ...@@ -423,13 +431,14 @@ void NE_InitializeDLLs( HMODULE hModule )
pModule = (NE_MODULE *)GlobalLock( hModule ); pModule = (NE_MODULE *)GlobalLock( hModule );
if (pModule->dlls_to_init) if (pModule->dlls_to_init)
{ {
for (pDLL = (WORD *)GlobalLock( pModule->dlls_to_init ); *pDLL; pDLL++) HANDLE to_init = pModule->dlls_to_init;
pModule->dlls_to_init = 0;
for (pDLL = (WORD *)GlobalLock( to_init ); *pDLL; pDLL++)
{ {
NE_InitDLL( *pDLL );
NE_InitializeDLLs( *pDLL ); NE_InitializeDLLs( *pDLL );
NE_InitDLL( *pDLL );
} }
GlobalFree( pModule->dlls_to_init ); GlobalFree( to_init );
pModule->dlls_to_init = 0;
} }
NE_InitDLL( hModule ); NE_InitDLL( hModule );
} }
...@@ -248,7 +248,7 @@ int NE_AccessResource( HMODULE hModule, HRSRC hRsrc ) ...@@ -248,7 +248,7 @@ int NE_AccessResource( HMODULE hModule, HRSRC hRsrc )
pNameInfo = (NE_NAMEINFO*)((char*)pModule + hRsrc); pNameInfo = (NE_NAMEINFO*)((char*)pModule + hRsrc);
name = ((LOADEDFILEINFO*)((char*)pModule + pModule->fileinfo))->filename; name = ((LOADEDFILEINFO*)((char*)pModule + pModule->fileinfo))->filename;
fd = open( name, O_RDONLY ); fd = open( DOS_GetUnixFileName(name), O_RDONLY );
sizeShift = *(WORD *)((char *)pModule + pModule->res_table); sizeShift = *(WORD *)((char *)pModule + pModule->res_table);
lseek( fd, (int)pNameInfo->offset << sizeShift, SEEK_SET ); lseek( fd, (int)pNameInfo->offset << sizeShift, SEEK_SET );
return fd; return fd;
......
...@@ -372,6 +372,7 @@ HICON LoadIcon( HANDLE instance, SEGPTR icon_name ) ...@@ -372,6 +372,7 @@ HICON LoadIcon( HANDLE instance, SEGPTR icon_name )
if (bih->biSize != sizeof(BITMAPINFOHEADER)) return 0; if (bih->biSize != sizeof(BITMAPINFOHEADER)) return 0;
lpico->hBitmap = CreateDIBitmap( hdc, &pInfo->bmiHeader, CBM_INIT, lpico->hBitmap = CreateDIBitmap( hdc, &pInfo->bmiHeader, CBM_INIT,
(char*)bmi + size, pInfo, DIB_RGB_COLORS ); (char*)bmi + size, pInfo, DIB_RGB_COLORS );
if (bih->biSizeImage == 0) if (bih->biSizeImage == 0)
{ {
if (bih->biCompression != BI_RGB) if (bih->biCompression != BI_RGB)
...@@ -381,20 +382,18 @@ HICON LoadIcon( HANDLE instance, SEGPTR icon_name ) ...@@ -381,20 +382,18 @@ HICON LoadIcon( HANDLE instance, SEGPTR icon_name )
ReleaseDC( 0, hdc); ReleaseDC( 0, hdc);
return 0; return 0;
} }
bih->biSizeImage = DIB_GetImageWidthBytes(bih->biWidth,bih->biBitCount) bih->biSizeImage = (DIB_GetImageWidthBytes(bih->biWidth,bih->biBitCount) +
* bih->biHeight; DIB_GetImageWidthBytes(bih->biWidth,1)) * bih->biHeight/2;
} }
bits = (char *)bmi + size + bits = (char *)bmi + size +
bih->biSizeImage * bih->biBitCount / (bih->biBitCount+1); bih->biSizeImage * bih->biBitCount / (bih->biBitCount+1);
bih->biBitCount = 1; bih->biBitCount = 1;
bih->biClrUsed = bih->biClrImportant = 2; bih->biClrUsed = bih->biClrImportant = 2;
rgbq = &bmi->bmiColors[0]; rgbq = &pInfo->bmiColors[0];
rgbq[0].rgbBlue = rgbq[0].rgbGreen = rgbq[0].rgbRed = 0x00; rgbq[0].rgbBlue = rgbq[0].rgbGreen = rgbq[0].rgbRed = 0x00;
rgbq[1].rgbBlue = rgbq[1].rgbGreen = rgbq[1].rgbRed = 0xff; rgbq[1].rgbBlue = rgbq[1].rgbGreen = rgbq[1].rgbRed = 0xff;
rgbq[0].rgbReserved = rgbq[1].rgbReserved = 0; rgbq[0].rgbReserved = rgbq[1].rgbReserved = 0;
lpico->hBitMask = CreateDIBitmap(hdc, &pInfo->bmiHeader, CBM_INIT, lpico->hBitMask = CreateDIBitmap(hdc, &pInfo->bmiHeader, CBM_INIT,
/* (LPSTR)bmi + bih->biSizeImage - sizeof(BITMAPINFOHEADER) / 2 - 4,
(LPSTR)lp + bih->biSizeImage + bih->biSize + 4*lpicodesc->ColorCount, */
bits, pInfo, DIB_RGB_COLORS ); bits, pInfo, DIB_RGB_COLORS );
FreeResource( rsc_mem ); FreeResource( rsc_mem );
ReleaseDC( 0, hdc); ReleaseDC( 0, hdc);
...@@ -612,19 +611,20 @@ LoadString(HANDLE instance, WORD resource_id, LPSTR buffer, int buflen) ...@@ -612,19 +611,20 @@ LoadString(HANDLE instance, WORD resource_id, LPSTR buffer, int buflen)
for (i = 0; i < string_num; i++) for (i = 0; i < string_num; i++)
p += *p + 1; p += *p + 1;
dprintf_resource( stddeb, "strlen = %d\n", (int)*p );
i = min(buflen - 1, *p); i = min(buflen - 1, *p);
if (i > 0) { if (i > 0) {
memcpy(buffer, p + 1, i); memcpy(buffer, p + 1, i);
buffer[i] = '\0'; buffer[i] = '\0';
} } else {
else { if (buflen > 1) {
if (buflen > 1) { buffer[0] = '\0';
buffer[0] = '\0'; return 0;
return 0; }
} fprintf(stderr,"LoadString // I dont know why , but caller give buflen=%d *p=%d !\n", buflen, *p);
fprintf(stderr,"LoadString // I dont know why , but caller give buflen=%d *p=%d !\n", buflen, *p); fprintf(stderr,"LoadString // and try to obtain string '%s'\n", p + 1);
fprintf(stderr,"LoadString // and try to obtain string '%s'\n", p + 1); }
}
FreeResource( hmem ); FreeResource( hmem );
dprintf_resource(stddeb,"LoadString // '%s' copied !\n", buffer); dprintf_resource(stddeb,"LoadString // '%s' copied !\n", buffer);
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#endif #endif
#include "wine.h" #include "wine.h"
#include "dos_fs.h"
#include "prototypes.h" #include "prototypes.h"
#include "miscemu.h" #include "miscemu.h"
#include "registers.h" #include "registers.h"
...@@ -45,46 +44,6 @@ wine_sigaction(int sig,struct sigaction * new, struct sigaction * old) ...@@ -45,46 +44,6 @@ wine_sigaction(int sig,struct sigaction * new, struct sigaction * old)
} }
#endif #endif
int do_int(int intnum, struct sigcontext_struct *context)
{
switch(intnum)
{
case 0x10: return do_int10(context);
case 0x11:
AX = DOS_GetEquipment();
return 1;
case 0x12:
AX = 640;
return 1; /* get base mem size */
case 0x13: return do_int13(context);
case 0x15: return do_int15(context);
case 0x16: return do_int16(context);
case 0x1a: return do_int1a(context);
case 0x21: return do_int21(context);
case 0x22:
AX = 0x1234;
BX = 0x5678;
CX = 0x9abc;
DX = 0xdef0;
return 1;
case 0x25: return do_int25(context);
case 0x26: return do_int26(context);
case 0x2a: return do_int2a(context);
case 0x2f: return do_int2f(context);
case 0x31: return do_int31(context);
case 0x5c: return do_int5c(context);
default:
fprintf(stderr,"int%02x: Unimplemented!\n", intnum);
break;
}
return 0;
}
#ifdef linux #ifdef linux
static void win_fault(int signal, struct sigcontext_struct context_struct) static void win_fault(int signal, struct sigcontext_struct context_struct)
...@@ -94,131 +53,19 @@ static void win_fault(int signal, struct sigcontext_struct context_struct) ...@@ -94,131 +53,19 @@ static void win_fault(int signal, struct sigcontext_struct context_struct)
static void win_fault(int signal, int code, struct sigcontext *context) static void win_fault(int signal, int code, struct sigcontext *context)
{ {
#endif #endif
unsigned char * instr;
WORD *stack;
#if !(defined (linux) || defined (__NetBSD__)) #if !(defined (linux) || defined (__NetBSD__))
int i, *dump; int i, *dump;
#endif #endif
/* First take care of a few preliminaries */ if(signal == SIGTRAP) EIP--; /* Back up over the int3 instruction. */
#ifdef linux else if (CS == WINE_CODE_SELECTOR)
if(signal != SIGSEGV
&& signal != SIGILL
&& signal != SIGFPE
#ifdef SIGBUS
&& signal != SIGBUS
#endif
&& signal != SIGTRAP)
{
exit(1);
}
/* And back up over the int3 instruction. */
if(signal == SIGTRAP) {
EIP--;
goto oops;
}
#endif
#ifdef __NetBSD__
/* set_es(0x1f); set_ds(0x1f); */
if(signal != SIGBUS && signal != SIGSEGV && signal != SIGTRAP)
exit(1);
#endif
#ifdef __FreeBSD__
/* set_es(0x27); set_ds(0x27); */
if(signal != SIGBUS && signal != SIGSEGV && signal != SIGTRAP)
exit(1);
#endif
if (CS == WINE_CODE_SELECTOR)
{
fprintf(stderr,
"Segmentation fault in Wine program (%x:%lx)."
" Please debug\n", CS, EIP );
goto oops;
}
/* Now take a look at the actual instruction where the program
bombed */
instr = (unsigned char *) PTR_SEG_OFF_TO_LIN( CS, EIP );
switch(*instr)
{ {
case 0xcd: /* int <XX> */ fprintf(stderr, "Segmentation fault in Wine program (%x:%lx)."
instr++; " Please debug\n", CS, EIP );
if (!do_int(*instr, context)) {
fprintf(stderr,"Unexpected Windows interrupt %x\n", *instr);
goto oops;
}
EIP += 2; /* Bypass the int instruction */
break;
case 0xcf: /* iret */
stack = (WORD *)PTR_SEG_OFF_TO_LIN( SS, SP );
EIP = *stack++;
CS = *stack++;
EFL = *stack;
SP += 6; /* Pop the return address and flags */
break;
case 0xe4: /* inb al,XX */
inportb_abs(context);
EIP += 2;
break;
case 0xe5: /* in ax,XX */
inport_abs(context);
EIP += 2;
break;
case 0xe6: /* outb XX,al */
outportb_abs(context);
EIP += 2;
break;
case 0xe7: /* out XX,ax */
outport_abs(context);
EIP += 2;
break;
case 0xec: /* inb al,dx */
inportb(context);
EIP++;
break;
case 0xed: /* in ax,dx */
inport(context);
EIP++;
break;
case 0xee: /* outb dx,al */
outportb(context);
EIP++;
break;
case 0xef: /* out dx,ax */
outport(context);
EIP++;
break;
case 0xfa: /* cli, ignored */
EIP++;
break;
case 0xfb: /* sti, ignored */
EIP++;
break;
default:
fprintf(stderr, "Unexpected Windows program segfault"
" - opcode = %x\n", *instr);
goto oops;
} }
else if (INSTR_EmulateInstruction( context )) return;
/* OK, done handling the interrupt */
return;
oops:
XUngrabPointer(display, CurrentTime); XUngrabPointer(display, CurrentTime);
XUngrabServer(display); XUngrabServer(display);
XFlush(display); XFlush(display);
......
...@@ -529,6 +529,9 @@ void InitTask( struct sigcontext_struct context ) ...@@ -529,6 +529,9 @@ void InitTask( struct sigcontext_struct context )
static int firstTask = 1; static int firstTask = 1;
TDB *pTask; TDB *pTask;
NE_MODULE *pModule; NE_MODULE *pModule;
SEGTABLEENTRY *pSegTable;
INSTANCEDATA *pinstance;
LONG stacklow, stackhi;
context.sc_eax = 0; context.sc_eax = 0;
if (!(pTask = (TDB *)GlobalLock( hCurrentTask ))) return; if (!(pTask = (TDB *)GlobalLock( hCurrentTask ))) return;
...@@ -567,6 +570,23 @@ void InitTask( struct sigcontext_struct context ) ...@@ -567,6 +570,23 @@ void InitTask( struct sigcontext_struct context )
context.sc_esi = pTask->hPrevInstance; context.sc_esi = pTask->hPrevInstance;
context.sc_edi = pTask->hInstance; context.sc_edi = pTask->hInstance;
context.sc_es = pTask->hPDB; context.sc_es = pTask->hPDB;
/* Initialize the local heap */
if ( pModule->heap_size )
{
LocalInit( pTask->hInstance, 0, pModule->heap_size );
}
/* Initialize the INSTANCEDATA structure */
pSegTable = NE_SEG_TABLE( pModule );
stacklow = pSegTable[pModule->ss - 1].minsize;
stackhi = stacklow + pModule->stack_size;
if (stackhi > 0xffff) stackhi = 0xffff;
pinstance = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN(CURRENT_DS, 0);
pinstance->stackbottom = stackhi; /* yup, that's right. Confused me too. */
pinstance->stacktop = stacklow;
pinstance->stackmin = IF1632_Saved16_sp;
} }
...@@ -585,8 +605,8 @@ BOOL WaitEvent( HTASK hTask ) ...@@ -585,8 +605,8 @@ BOOL WaitEvent( HTASK hTask )
return FALSE; return FALSE;
} }
TASK_SCHEDULE(); TASK_SCHEDULE();
/* When we get back here, we have an event */ /* When we get back here, we have an event (or the task is the only one) */
pTask->nEvents--; if (pTask->nEvents > 0) pTask->nEvents--;
return TRUE; return TRUE;
} }
......
...@@ -307,7 +307,6 @@ SEGPTR WIN16_GlobalLock( HGLOBAL handle ) ...@@ -307,7 +307,6 @@ SEGPTR WIN16_GlobalLock( HGLOBAL handle )
*/ */
LPSTR GlobalLock( HGLOBAL handle ) LPSTR GlobalLock( HGLOBAL handle )
{ {
dprintf_global( stddeb, "GlobalLock: %04x\n", handle );
if (!handle) return 0; if (!handle) return 0;
return (LPSTR)GET_ARENA_PTR(handle)->base; return (LPSTR)GET_ARENA_PTR(handle)->base;
} }
...@@ -452,7 +451,7 @@ WORD GlobalDOSFree( WORD sel ) ...@@ -452,7 +451,7 @@ WORD GlobalDOSFree( WORD sel )
*/ */
LONG SetSwapAreaSize( WORD size ) LONG SetSwapAreaSize( WORD size )
{ {
dprintf_heap(stdnimp, "STUB: SetSwapAreaSize(%d)\n", size ); dprintf_global(stdnimp, "STUB: SetSwapAreaSize(%d)\n", size );
return MAKELONG( size, 0xffff ); return MAKELONG( size, 0xffff );
} }
......
...@@ -32,13 +32,17 @@ extern int i386_set_ldt(int, union descriptor *, int); ...@@ -32,13 +32,17 @@ extern int i386_set_ldt(int, union descriptor *, int);
#endif /* ifndef WINELIB */ #endif /* ifndef WINELIB */
ldt_copy_entry ldt_copy[LDT_SIZE] = { {0,0}, };
unsigned char ldt_flags_copy[LDT_SIZE] = { 0, };
/*********************************************************************** /***********************************************************************
* LDT_BytesToEntry * LDT_BytesToEntry
* *
* Convert the raw bytes of the descriptor to an ldt_entry structure. * Convert the raw bytes of the descriptor to an ldt_entry structure.
*/ */
static void LDT_BytesToEntry( unsigned long *buffer, ldt_entry *content ) void LDT_BytesToEntry( const unsigned long *buffer, ldt_entry *content )
{ {
content->base = (*buffer >> 16) & 0x0000ffff; content->base = (*buffer >> 16) & 0x0000ffff;
content->limit = *buffer & 0x0000ffff; content->limit = *buffer & 0x0000ffff;
...@@ -53,6 +57,26 @@ static void LDT_BytesToEntry( unsigned long *buffer, ldt_entry *content ) ...@@ -53,6 +57,26 @@ static void LDT_BytesToEntry( unsigned long *buffer, ldt_entry *content )
/*********************************************************************** /***********************************************************************
* LDT_EntryToBytes
*
* Convert an ldt_entry structure to the raw bytes of the descriptor.
*/
void LDT_EntryToBytes( unsigned long *buffer, const ldt_entry *content )
{
*buffer++ = ((content->base & 0x0000ffff) << 16) |
(content->limit & 0x0ffff);
*buffer = (content->base & 0xff000000) |
((content->base & 0x00ff0000)>>16) |
(content->limit & 0xf0000) |
(content->type << 10) |
((content->read_only == 0) << 9) |
((content->seg_32bit != 0) << 22) |
((content->limit_in_pages != 0) << 23) |
0xf000;
}
/***********************************************************************
* LDT_GetEntry * LDT_GetEntry
* *
* Retrieve an LDT entry. * Retrieve an LDT entry.
...@@ -61,31 +85,12 @@ int LDT_GetEntry( int entry, ldt_entry *content ) ...@@ -61,31 +85,12 @@ int LDT_GetEntry( int entry, ldt_entry *content )
{ {
int ret = 0; int ret = 0;
#ifdef WINELIB
content->base = ldt_copy[entry].base; content->base = ldt_copy[entry].base;
content->limit = ldt_copy[entry].limit; content->limit = ldt_copy[entry].limit;
content->type = SEGMENT_DATA; content->type = (ldt_flags_copy[entry] & LDT_FLAGS_TYPE);
content->seg_32bit = 0; content->seg_32bit = (ldt_flags_copy[entry] & LDT_FLAGS_32BIT) != 0;
content->read_only = 0; content->read_only = (ldt_flags_copy[entry] & LDT_FLAGS_READONLY) !=0;
content->limit_in_pages = 0; content->limit_in_pages = (ldt_flags_copy[entry] & LDT_FLAGS_BIG) !=0;
#else /* WINELIB */
#ifdef linux
int size = (entry + 1) * 2 * sizeof(long);
long *buffer = (long *) malloc( size );
ret = modify_ldt( 0, buffer, size );
LDT_BytesToEntry( &buffer[entry*2], content );
free( buffer );
#endif /* linux */
#if defined(__NetBSD__) || defined(__FreeBSD__)
long buffer[2];
ret = i386_get_ldt( entry, (union descriptor *)buffer, 1 );
LDT_BytesToEntry( buffer, content );
#endif /* __NetBSD__ || __FreeBSD__ */
#endif /* WINELIB */
return ret; return ret;
} }
...@@ -95,7 +100,7 @@ int LDT_GetEntry( int entry, ldt_entry *content ) ...@@ -95,7 +100,7 @@ int LDT_GetEntry( int entry, ldt_entry *content )
* *
* Set an LDT entry. * Set an LDT entry.
*/ */
int LDT_SetEntry( int entry, ldt_entry *content ) int LDT_SetEntry( int entry, const ldt_entry *content )
{ {
int ret = 0; int ret = 0;
...@@ -108,6 +113,9 @@ int LDT_SetEntry( int entry, ldt_entry *content ) ...@@ -108,6 +113,9 @@ int LDT_SetEntry( int entry, ldt_entry *content )
content->read_only || (content->type & SEGMENT_CODE) ? '-' : 'w', content->read_only || (content->type & SEGMENT_CODE) ? '-' : 'w',
(content->type & SEGMENT_CODE) ? 'x' : '-' ); (content->type & SEGMENT_CODE) ? 'x' : '-' );
/* Entry 0 must not be modified; its base and limit are always 0 */
if (!entry) return 0;
#ifndef WINELIB #ifndef WINELIB
#ifdef linux #ifdef linux
{ {
...@@ -129,16 +137,7 @@ int LDT_SetEntry( int entry, ldt_entry *content ) ...@@ -129,16 +137,7 @@ int LDT_SetEntry( int entry, ldt_entry *content )
{ {
long d[2]; long d[2];
d[0] = ((content->base & 0x0000ffff) << 16) | LDT_EntryToBytes( d, content );
(content->limit & 0x0ffff);
d[1] = (content->base & 0xff000000) |
((content->base & 0x00ff0000)>>16) |
(content->limit & 0xf0000) |
(content->type << 10) |
((content->read_only == 0) << 9) |
((content->seg_32bit != 0) << 22) |
((content->limit_in_pages != 0) << 23) |
0xf000;
ret = i386_set_ldt(entry, (union descriptor *)d, 1); ret = i386_set_ldt(entry, (union descriptor *)d, 1);
if (ret < 0) if (ret < 0)
{ {
...@@ -155,6 +154,10 @@ int LDT_SetEntry( int entry, ldt_entry *content ) ...@@ -155,6 +154,10 @@ int LDT_SetEntry( int entry, ldt_entry *content )
ldt_copy[entry].base = content->base; ldt_copy[entry].base = content->base;
if (!content->limit_in_pages) ldt_copy[entry].limit = content->limit; if (!content->limit_in_pages) ldt_copy[entry].limit = content->limit;
else ldt_copy[entry].limit = (content->limit << 12) | 0x0fff; else ldt_copy[entry].limit = (content->limit << 12) | 0x0fff;
ldt_flags_copy[entry] = (content->type & LDT_FLAGS_TYPE) |
(content->read_only ? LDT_FLAGS_READONLY : 0) |
(content->seg_32bit ? LDT_FLAGS_32BIT : 0) |
(content->limit_in_pages ? LDT_FLAGS_BIG : 0);
return ret; return ret;
} }
...@@ -167,40 +170,28 @@ int LDT_SetEntry( int entry, ldt_entry *content ) ...@@ -167,40 +170,28 @@ int LDT_SetEntry( int entry, ldt_entry *content )
void LDT_Print() void LDT_Print()
{ {
int i; int i;
char flags[3];
#ifdef WINELIB
for (i = 0; i < LDT_SIZE; i++) for (i = 0; i < LDT_SIZE; i++)
{ {
if (ldt_copy[i].base || ldt_copy[i].limit) if (!ldt_copy[i].base && !ldt_copy[i].limit) continue; /* Free entry */
if ((ldt_flags_copy[i] & LDT_FLAGS_TYPE) == SEGMENT_CODE)
{ {
fprintf( stderr, "%04x: sel=%04x base=%08x limit=%05x\n", flags[0] = (ldt_flags_copy[i] & LDT_FLAGS_EXECONLY) ? '-' : 'r';
i, ENTRY_TO_SELECTOR(i), flags[1] = '-';
ldt_copy[i].base, ldt_copy[i].limit ); flags[2] = 'x';
} }
} else
#else /* WINELIB */
long buffer[2*LDT_SIZE];
ldt_entry content;
int n;
#ifdef linux
n = modify_ldt( 0, buffer, sizeof(buffer) ) / 8;
#endif /* linux */
#if defined(__NetBSD__) || defined(__FreeBSD__)
n = i386_get_ldt( 0, (union descriptor *)buffer, LDT_SIZE );
#endif /* __NetBSD__ || __FreeBSD__ */
for (i = 0; i < n; i++)
{
LDT_BytesToEntry( &buffer[2*i], &content );
if (content.base || content.limit)
{ {
fprintf( stderr, "%04x: sel=%04x base=%08lx limit=%05lx %s type=%d\n", flags[0] = 'r';
i, ENTRY_TO_SELECTOR(i), flags[1] = (ldt_flags_copy[i] & LDT_FLAGS_READONLY) ? '-' : 'w';
content.base, content.limit, flags[2] = '-';
content.limit_in_pages ? "(pages)" : "(bytes)",
content.type );
} }
printf("%04x: sel=%04x base=%08lx limit=%05lx %s %d-bit %c%c%c\n",
i, ENTRY_TO_SELECTOR(i),
ldt_copy[i].base, ldt_copy[i].limit,
ldt_flags_copy[i] & LDT_FLAGS_BIG ? "(pages)" : "(bytes)",
ldt_flags_copy[i] & LDT_FLAGS_32BIT ? 32 : 16,
flags[0], flags[1], flags[2] );
} }
#endif /* WINELIB */
} }
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
ldt_copy_entry ldt_copy[LDT_SIZE] = { {0,0}, };
#define FIRST_LDT_ENTRY_TO_ALLOC 6 #define FIRST_LDT_ENTRY_TO_ALLOC 6
...@@ -323,12 +322,12 @@ BOOL IsBadCodePtr( SEGPTR lpfn ) ...@@ -323,12 +322,12 @@ BOOL IsBadCodePtr( SEGPTR lpfn )
ldt_entry entry; ldt_entry entry;
sel = SELECTOROF(lpfn); sel = SELECTOROF(lpfn);
if (!sel) return FALSE; if (!sel) return TRUE;
if (IS_SELECTOR_FREE(sel)) return FALSE; if (IS_SELECTOR_FREE(sel)) return TRUE;
LDT_GetEntry( SELECTOR_TO_ENTRY(sel), &entry ); LDT_GetEntry( SELECTOR_TO_ENTRY(sel), &entry );
if (entry.type != SEGMENT_CODE) return FALSE; if (entry.type != SEGMENT_CODE) return TRUE;
if (OFFSETOF(lpfn) > entry.limit) return FALSE; if (OFFSETOF(lpfn) > entry.limit) return TRUE;
return TRUE; return FALSE;
} }
...@@ -341,13 +340,13 @@ BOOL IsBadStringPtr( SEGPTR ptr, WORD size ) ...@@ -341,13 +340,13 @@ BOOL IsBadStringPtr( SEGPTR ptr, WORD size )
ldt_entry entry; ldt_entry entry;
sel = SELECTOROF(ptr); sel = SELECTOROF(ptr);
if (!sel) return FALSE; if (!sel) return TRUE;
if (IS_SELECTOR_FREE(sel)) return FALSE; if (IS_SELECTOR_FREE(sel)) return TRUE;
LDT_GetEntry( SELECTOR_TO_ENTRY(sel), &entry ); LDT_GetEntry( SELECTOR_TO_ENTRY(sel), &entry );
if ((entry.type == SEGMENT_CODE) && entry.read_only) return FALSE; if ((entry.type == SEGMENT_CODE) && entry.read_only) return TRUE;
if (strlen(PTR_SEG_TO_LIN(ptr)) < size) size = strlen(PTR_SEG_TO_LIN(ptr)); if (strlen(PTR_SEG_TO_LIN(ptr)) < size) size = strlen(PTR_SEG_TO_LIN(ptr));
if (OFFSETOF(ptr) + size > entry.limit) return FALSE; if (OFFSETOF(ptr) + size > entry.limit) return TRUE;
return TRUE; return FALSE;
} }
...@@ -360,12 +359,12 @@ BOOL IsBadHugeReadPtr( SEGPTR ptr, DWORD size ) ...@@ -360,12 +359,12 @@ BOOL IsBadHugeReadPtr( SEGPTR ptr, DWORD size )
ldt_entry entry; ldt_entry entry;
sel = SELECTOROF(ptr); sel = SELECTOROF(ptr);
if (!sel) return FALSE; if (!sel) return TRUE;
if (IS_SELECTOR_FREE(sel)) return FALSE; if (IS_SELECTOR_FREE(sel)) return TRUE;
LDT_GetEntry( SELECTOR_TO_ENTRY(sel), &entry ); LDT_GetEntry( SELECTOR_TO_ENTRY(sel), &entry );
if ((entry.type == SEGMENT_CODE) && entry.read_only) return FALSE; if ((entry.type == SEGMENT_CODE) && entry.read_only) return TRUE;
if (OFFSETOF(ptr) + size > entry.limit) return FALSE; if (OFFSETOF(ptr) + size > entry.limit) return TRUE;
return TRUE; return FALSE;
} }
...@@ -378,12 +377,12 @@ BOOL IsBadHugeWritePtr( SEGPTR ptr, DWORD size ) ...@@ -378,12 +377,12 @@ BOOL IsBadHugeWritePtr( SEGPTR ptr, DWORD size )
ldt_entry entry; ldt_entry entry;
sel = SELECTOROF(ptr); sel = SELECTOROF(ptr);
if (!sel) return FALSE; if (!sel) return TRUE;
if (IS_SELECTOR_FREE(sel)) return FALSE; if (IS_SELECTOR_FREE(sel)) return TRUE;
LDT_GetEntry( SELECTOR_TO_ENTRY(sel), &entry ); LDT_GetEntry( SELECTOR_TO_ENTRY(sel), &entry );
if ((entry.type == SEGMENT_CODE) || entry.read_only) return FALSE; if ((entry.type == SEGMENT_CODE) || entry.read_only) return TRUE;
if (OFFSETOF(ptr) + size > entry.limit) return FALSE; if (OFFSETOF(ptr) + size > entry.limit) return TRUE;
return TRUE; return FALSE;
} }
/*********************************************************************** /***********************************************************************
......
...@@ -17,6 +17,7 @@ SRCS = \ ...@@ -17,6 +17,7 @@ SRCS = \
kernel32.c \ kernel32.c \
lstr.c \ lstr.c \
main.c \ main.c \
ole2.c \
ole2nls.c \ ole2nls.c \
olecli.c \ olecli.c \
olesvr.c \ olesvr.c \
......
...@@ -210,23 +210,23 @@ static LPSTR FILEDLG_GetFileType(LPSTR ptr, WORD index) ...@@ -210,23 +210,23 @@ static LPSTR FILEDLG_GetFileType(LPSTR ptr, WORD index)
static LONG FILEDLG_WMDrawItem(HWND hWnd, WORD wParam, LONG lParam) static LONG FILEDLG_WMDrawItem(HWND hWnd, WORD wParam, LONG lParam)
{ {
LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)PTR_SEG_TO_LIN(lParam); LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)PTR_SEG_TO_LIN(lParam);
LPSTR str; char str[512];
HBRUSH hBrush; HBRUSH hBrush;
HBITMAP hBitmap, hPrevBitmap; HBITMAP hBitmap, hPrevBitmap;
BITMAP bm; BITMAP bm;
HDC hMemDC; HDC hMemDC;
strcpy(str, "");
if (lpdis->CtlType == ODT_LISTBOX && lpdis->CtlID == lst1) { if (lpdis->CtlType == ODT_LISTBOX && lpdis->CtlID == lst1) {
hBrush = SelectObject(lpdis->hDC, GetStockObject(LTGRAY_BRUSH)); hBrush = SelectObject(lpdis->hDC, GetStockObject(LTGRAY_BRUSH));
SelectObject(lpdis->hDC, hBrush); SelectObject(lpdis->hDC, hBrush);
FillRect(lpdis->hDC, &lpdis->rcItem, hBrush); FillRect(lpdis->hDC, &lpdis->rcItem, hBrush);
str = (LPSTR) PTR_SEG_TO_LIN(lpdis->itemData); SendMessage(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID,
if (str != NULL) { MAKE_SEGPTR(str));
TextOut(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, TextOut(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top,
str, strlen(str)); str, strlen(str));
if (lpdis->itemState != 0) { if (lpdis->itemState != 0) {
InvertRect(lpdis->hDC, &lpdis->rcItem); InvertRect(lpdis->hDC, &lpdis->rcItem);
}
} }
return TRUE; return TRUE;
} }
...@@ -235,21 +235,21 @@ static LONG FILEDLG_WMDrawItem(HWND hWnd, WORD wParam, LONG lParam) ...@@ -235,21 +235,21 @@ static LONG FILEDLG_WMDrawItem(HWND hWnd, WORD wParam, LONG lParam)
hBrush = SelectObject(lpdis->hDC, GetStockObject(LTGRAY_BRUSH)); hBrush = SelectObject(lpdis->hDC, GetStockObject(LTGRAY_BRUSH));
SelectObject(lpdis->hDC, hBrush); SelectObject(lpdis->hDC, hBrush);
FillRect(lpdis->hDC, &lpdis->rcItem, hBrush); FillRect(lpdis->hDC, &lpdis->rcItem, hBrush);
str = (LPSTR) PTR_SEG_TO_LIN(lpdis->itemData); SendMessage(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID,
if (str != NULL) { MAKE_SEGPTR(str));
hBitmap = hFolder;
GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm); hBitmap = hFolder;
TextOut(lpdis->hDC, lpdis->rcItem.left + bm.bmWidth, GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm);
lpdis->rcItem.top, str, strlen(str)); TextOut(lpdis->hDC, lpdis->rcItem.left + bm.bmWidth,
hMemDC = CreateCompatibleDC(lpdis->hDC); lpdis->rcItem.top, str, strlen(str));
hPrevBitmap = SelectObject(hMemDC, hBitmap); hMemDC = CreateCompatibleDC(lpdis->hDC);
BitBlt(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hPrevBitmap = SelectObject(hMemDC, hBitmap);
bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY); BitBlt(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top,
SelectObject(hMemDC, hPrevBitmap); bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
DeleteDC(hMemDC); SelectObject(hMemDC, hPrevBitmap);
if (lpdis->itemState != 0) { DeleteDC(hMemDC);
InvertRect(lpdis->hDC, &lpdis->rcItem); if (lpdis->itemState != 0) {
} InvertRect(lpdis->hDC, &lpdis->rcItem);
} }
return TRUE; return TRUE;
} }
...@@ -257,28 +257,27 @@ static LONG FILEDLG_WMDrawItem(HWND hWnd, WORD wParam, LONG lParam) ...@@ -257,28 +257,27 @@ static LONG FILEDLG_WMDrawItem(HWND hWnd, WORD wParam, LONG lParam)
hBrush = SelectObject(lpdis->hDC, GetStockObject(LTGRAY_BRUSH)); hBrush = SelectObject(lpdis->hDC, GetStockObject(LTGRAY_BRUSH));
SelectObject(lpdis->hDC, hBrush); SelectObject(lpdis->hDC, hBrush);
FillRect(lpdis->hDC, &lpdis->rcItem, hBrush); FillRect(lpdis->hDC, &lpdis->rcItem, hBrush);
str = (LPSTR) PTR_SEG_TO_LIN(lpdis->itemData); SendMessage(lpdis->hwndItem, CB_GETLBTEXT, lpdis->itemID,
if (str != NULL) { MAKE_SEGPTR(str));
switch(str[2]) { switch(str[2]) {
case 'a': case 'b': case 'a': case 'b':
hBitmap = hFloppy; hBitmap = hFloppy;
break; break;
default: default:
hBitmap = hHDisk; hBitmap = hHDisk;
break; break;
} }
GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm); GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm);
TextOut(lpdis->hDC, lpdis->rcItem.left + bm.bmWidth, TextOut(lpdis->hDC, lpdis->rcItem.left + bm.bmWidth,
lpdis->rcItem.top, str, strlen(str)); lpdis->rcItem.top, str, strlen(str));
hMemDC = CreateCompatibleDC(lpdis->hDC); hMemDC = CreateCompatibleDC(lpdis->hDC);
hPrevBitmap = SelectObject(hMemDC, hBitmap); hPrevBitmap = SelectObject(hMemDC, hBitmap);
BitBlt(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, BitBlt(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top,
bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY); bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
SelectObject(hMemDC, hPrevBitmap); SelectObject(hMemDC, hPrevBitmap);
DeleteDC(hMemDC); DeleteDC(hMemDC);
if (lpdis->itemState != 0) { if (lpdis->itemState != 0) {
InvertRect(lpdis->hDC, &lpdis->rcItem); InvertRect(lpdis->hDC, &lpdis->rcItem);
}
} }
return TRUE; return TRUE;
} }
......
...@@ -10,10 +10,37 @@ ...@@ -10,10 +10,37 @@
#include "windows.h" #include "windows.h"
#include "compobj.h" #include "compobj.h"
#include "ole.h" #include "ole.h"
#include "ole2.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
/*********************************************************************** /***********************************************************************
* CoBuildVersion [COMPOBJ.1]
*/
DWORD WINAPI CoBuildVersion()
{
dprintf_ole(stddeb,"CoBuildVersion()\n");
return (rmm<<16)+rup;
}
/***********************************************************************
* CoInitialize [COMPOBJ.2]
*/
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
{
dprintf_ole(stdnimp,"CoInitialize\n");
return S_OK;
}
/***********************************************************************
* CoUnitialize [COMPOBJ.3]
*/
void CoUnitialize()
{
dprintf_ole(stdnimp,"CoUnitialize()\n");
}
/***********************************************************************
* CoDisconnectObject * CoDisconnectObject
*/ */
OLESTATUS WINAPI CoDisconnectObject( OLESTATUS WINAPI CoDisconnectObject(
......
...@@ -301,7 +301,7 @@ int DOS_ValidDrive(int drive) ...@@ -301,7 +301,7 @@ int DOS_ValidDrive(int drive)
dprintf_dosfs(stddeb,"ValidDrive %c (%d) -- ",'A'+drive,drive); dprintf_dosfs(stddeb,"ValidDrive %c (%d) -- ",'A'+drive,drive);
if (drive >= MAX_DOS_DRIVES) if (drive < 0 || drive >= MAX_DOS_DRIVES)
valid = 0; valid = 0;
if (DosDrives[drive].rootdir == NULL) if (DosDrives[drive].rootdir == NULL)
valid = 0; valid = 0;
...@@ -446,12 +446,14 @@ static void GetUnixDirName(char *rootdir, char *name) ...@@ -446,12 +446,14 @@ static void GetUnixDirName(char *rootdir, char *name)
char *DOS_GetUnixFileName(char *dosfilename) char *DOS_GetUnixFileName(char *dosfilename)
{ {
/* a:\windows\system.ini => /dos/windows/system.ini */ /* a:\windows\system.ini => /dos/windows/system.ini */
/* FIXME: should handle devices here (like LPT: or NUL:) */
static char temp[256]; static char temp[256];
static char dostemp[256]; static char dostemp[256];
int drive; int drive;
if (dosfilename[1] == ':') if (dosfilename[0] && (dosfilename[1] == ':'))
{ {
drive = (islower(*dosfilename) ? toupper(*dosfilename) : *dosfilename) - 'A'; drive = (islower(*dosfilename) ? toupper(*dosfilename) : *dosfilename) - 'A';
...@@ -463,7 +465,8 @@ char *DOS_GetUnixFileName(char *dosfilename) ...@@ -463,7 +465,8 @@ char *DOS_GetUnixFileName(char *dosfilename)
drive = CurrentDrive; drive = CurrentDrive;
/* Consider dosfilename const */ /* Consider dosfilename const */
strcpy(dostemp,dosfilename); strncpy( dostemp, dosfilename, 255 );
dostemp[255] = '\0';
/* Expand the filename to it's full path if it doesn't /* Expand the filename to it's full path if it doesn't
* start from the root. * start from the root.
...@@ -675,7 +678,7 @@ char *DOS_FindFile(char *buffer, int buflen, char *filename, char **extensions, ...@@ -675,7 +678,7 @@ char *DOS_FindFile(char *buffer, int buflen, char *filename, char **extensions,
char *workingpath, *dirname, *rootname, **e; char *workingpath, *dirname, *rootname, **e;
DIR *d; DIR *d;
struct dirent *f; struct dirent *f;
int rootnamelen, found = 0; int rootnamelen;
struct stat filestat; struct stat filestat;
if (strchr(filename, '\\') != NULL) if (strchr(filename, '\\') != NULL)
...@@ -713,41 +716,35 @@ char *DOS_FindFile(char *buffer, int buflen, char *filename, char **extensions, ...@@ -713,41 +716,35 @@ char *DOS_FindFile(char *buffer, int buflen, char *filename, char **extensions,
if (d != NULL) if (d != NULL)
{ {
while ((f = readdir(d)) != NULL) while ((f = readdir(d)) != NULL)
{ {
if (strncasecmp(rootname, f->d_name, rootnamelen) == 0) if (strcasecmp(rootname, f->d_name) != 0) {
{ if (strncasecmp(rootname, f->d_name, rootnamelen) != 0
if (extensions == NULL || || extensions == NULL
strcasecmp(rootname, f->d_name) == 0) || f->d_name[rootnamelen] != '.')
found = 1; continue;
else
if (f->d_name[rootnamelen] == '.') for (e = extensions; *e != NULL; e++) {
for (e = extensions; *e != NULL; e++) if (strcasecmp(*e, f->d_name + rootnamelen + 1) == 0)
if (strcasecmp(*e, f->d_name + rootnamelen + 1) break;
== 0)
{
found = 1;
break;
}
if (found)
{
if (strchr(dirname, '\\') != NULL)
strncpy(buffer, DOS_GetUnixFileName(dirname), buflen);
else
strncpy(buffer, dirname, buflen);
strncat(buffer, "/", buflen - strlen(buffer));
strncat(buffer, f->d_name, buflen - strlen(buffer));
stat(buffer, &filestat);
if (S_ISREG(filestat.st_mode)) {
closedir(d);
free(rootname);
return buffer;
} else
found = 0;
} }
if (*e == NULL) continue;
}
if (strchr(dirname, '\\') != NULL) {
strncpy(buffer, DOS_GetUnixFileName(dirname), buflen);
} else {
strncpy(buffer, dirname, buflen);
} }
strncat(buffer, "/", buflen - strlen(buffer));
strncat(buffer, f->d_name, buflen - strlen(buffer));
stat(buffer, &filestat);
if (S_ISREG(filestat.st_mode)) {
closedir(d);
free(rootname);
return buffer;
}
} }
closedir(d); closedir(d);
} }
...@@ -897,7 +894,8 @@ struct dosdirent *DOS_opendir(char *dosdirname) ...@@ -897,7 +894,8 @@ struct dosdirent *DOS_opendir(char *dosdirname)
if (strcmp(DosDirs[x].unixpath,temp) == 0) break; if (strcmp(DosDirs[x].unixpath,temp) == 0) break;
} }
strcpy(DosDirs[x].filemask, unixdirname); strncpy(DosDirs[x].filemask, unixdirname, 12);
DosDirs[x].filemask[12] = 0;
ToDos(DosDirs[x].filemask); ToDos(DosDirs[x].filemask);
dprintf_dosfs(stddeb,"DOS_opendir: %s / %s\n", unixdirname, temp); dprintf_dosfs(stddeb,"DOS_opendir: %s / %s\n", unixdirname, temp);
......
...@@ -34,12 +34,15 @@ ...@@ -34,12 +34,15 @@
/********************************************************************** /**********************************************************************
* ExitWindows [USER.7] * ExitWindows [USER.7]
*/ */
BOOL ExitWindows(DWORD dwReserved, WORD wRetCode) BOOL ExitWindows(DWORD dwReturnCode, WORD wReserved)
{ {
dprintf_exec(stdnimp,"EMPTY STUB !!! ExitWindows(%08lX, %04X) !\n", api_assert("ExitWindows", wReserved == 0);
dwReserved, wRetCode); api_assert("ExitWindows", HIWORD(dwReturnCode) == 0);
exit(wRetCode); dprintf_exec( stdnimp,"PARTIAL STUB ExitWindows(%08lX, %04X)\n",
dwReturnCode, wReserved);
exit( LOWORD(dwReturnCode) );
} }
......
...@@ -86,19 +86,19 @@ INT _lread (INT hFile, LPSTR lpBuffer, WORD wBytes) ...@@ -86,19 +86,19 @@ INT _lread (INT hFile, LPSTR lpBuffer, WORD wBytes)
/**************************************************************************** /****************************************************************************
_lwrite _lwrite
****************************************************************************/ ****************************************************************************/
INT _lwrite (INT hFile, LPSTR lpBuffer, WORD wBytes) INT _lwrite (INT hFile, LPCSTR lpBuffer, WORD wBytes)
{ {
int result; int result;
dprintf_file(stddeb, "_lwrite: handle %d, buffer = %ld, length = %d\n", dprintf_file(stddeb, "_lwrite: handle %d, buffer = %ld, length = %d\n",
hFile, (long) lpBuffer, wBytes); hFile, (long) lpBuffer, wBytes);
result = write (hFile, lpBuffer, wBytes); result = write (hFile, lpBuffer, wBytes);
if (result == -1) if (result == -1)
return HFILE_ERROR; return HFILE_ERROR;
else else
return result; return result;
} }
/*************************************************************************** /***************************************************************************
...@@ -106,11 +106,16 @@ INT _lwrite (INT hFile, LPSTR lpBuffer, WORD wBytes) ...@@ -106,11 +106,16 @@ INT _lwrite (INT hFile, LPSTR lpBuffer, WORD wBytes)
***************************************************************************/ ***************************************************************************/
INT _lclose (INT hFile) INT _lclose (INT hFile)
{ {
dprintf_file(stddeb, "_lclose: handle %d\n", hFile); dprintf_file(stddeb, "_lclose: handle %d\n", hFile);
if (close (hFile))
return HFILE_ERROR; if (hFile == 1 || hFile == 2) {
else fprintf( stderr, "Program attempted to close stdout or stderr!\n" );
return 0; return 0;
}
if (close (hFile))
return HFILE_ERROR;
else
return 0;
} }
/************************************************************************** /**************************************************************************
...@@ -123,7 +128,7 @@ INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle) ...@@ -123,7 +128,7 @@ INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle)
struct stat s; struct stat s;
struct tm *now; struct tm *now;
int res, handle; int res, handle;
int verify_time; int verify_time = 0;
dprintf_file(stddeb,"Openfile(%s,<struct>,%d)\n",lpFileName,wStyle); dprintf_file(stddeb,"Openfile(%s,<struct>,%d)\n",lpFileName,wStyle);
...@@ -162,64 +167,62 @@ INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle) ...@@ -162,64 +167,62 @@ INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle)
/* If path isn't given, try to find the file. */ /* If path isn't given, try to find the file. */
if (!(action & OF_REOPEN)) if (!(action & OF_REOPEN))
{ {
if( !( index(lpFileName,'\\') || index(lpFileName,'/') || char temp[MAX_PATH + 1];
index(lpFileName,':')))
while(1) if(index(lpFileName,'\\') || index(lpFileName,'/') ||
index(lpFileName,':'))
{ {
char temp[MAX_PATH+1]; strcpy (filename,lpFileName);
/* Try current directory */ goto found;
strcpy (filename, lpFileName); }
if ( (!stat(DOS_GetUnixFileName(filename), &s)) && (S_ISREG(s.st_mode)) ) /* Try current directory */
break; if (DOS_FindFile(temp, MAX_PATH, lpFileName, NULL, ".")) {
strcpy(filename, DOS_GetDosFileName(temp));
/* Try Windows directory */ goto found;
}
GetWindowsDirectory (filename,MAX_PATH);
if ((!filename[0])||(filename[strlen(filename)-1]!='\\')) /* Try Windows directory */
strcat(filename, "\\"); GetWindowsDirectory(filename, MAX_PATH);
strcat (filename, lpFileName); if (DOS_FindFile(temp, MAX_PATH, lpFileName, NULL, filename)) {
if ( (!stat(DOS_GetUnixFileName(filename), &s)) && (S_ISREG(s.st_mode)) ) strcpy(filename, DOS_GetDosFileName(temp));
break; goto found;
}
/* Try Windows system directory */
/* Try Windows system directory */
GetSystemDirectory (filename,MAX_PATH); GetSystemDirectory(filename, MAX_PATH);
if ((!filename[0])||(filename[strlen(filename)-1]!='\\')) if (DOS_FindFile(temp, MAX_PATH, lpFileName, NULL, filename)) {
strcat(filename, "\\"); strcpy(filename, DOS_GetDosFileName(temp));
strcat (filename, lpFileName); goto found;
if ( (!stat(DOS_GetUnixFileName(filename), &s)) && (S_ISREG(s.st_mode)) )
break;
/* Try the path of the current executable */
if (GetCurrentTask())
{
char *p;
GetModuleFileName( GetCurrentTask(), filename, MAX_PATH );
if ((p = strrchr( filename, '\\' )))
{
p[1] = '\0';
strcat( filename, lpFileName );
if ((!stat(DOS_GetUnixFileName(filename), &s)) &&
(S_ISREG(s.st_mode)) )
break;
}
}
/* Try all directories in path */
if (DOS_FindFile(temp,MAX_PATH,lpFileName,NULL,WindowsPath))
{
strcpy(filename, DOS_GetDosFileName(temp));
break;
}
strcpy (filename, lpFileName);
break;
} }
else
strcpy (filename,lpFileName);
/* Try the path of the current executable */
if (GetCurrentTask())
{
char *p;
GetModuleFileName( GetCurrentTask(), filename, MAX_PATH );
if ((p = strrchr( filename, '\\' )))
{
p[1] = '\0';
if (DOS_FindFile(temp, MAX_PATH, lpFileName, NULL, filename)) {
strcpy(filename, DOS_GetDosFileName(temp));
goto found;
}
}
}
/* Try all directories in path */
if (DOS_FindFile(temp,MAX_PATH,lpFileName,NULL,WindowsPath))
{
strcpy(filename, DOS_GetDosFileName(temp));
goto found;
}
/* ??? shouldn't we give an error here? */
strcpy (filename, lpFileName);
found:
ofs->cBytes = sizeof(OFSTRUCT); ofs->cBytes = sizeof(OFSTRUCT);
ofs->fFixedDisk = FALSE; ofs->fFixedDisk = FALSE;
strcpy(ofs->szPathName, filename); strcpy(ofs->szPathName, filename);
...@@ -305,9 +308,9 @@ LONG _llseek (INT hFile, LONG lOffset, INT nOrigin) ...@@ -305,9 +308,9 @@ LONG _llseek (INT hFile, LONG lOffset, INT nOrigin)
break; break;
default: origin = SEEK_SET; default: origin = SEEK_SET;
break; break;
} }
return ( lseek(hFile, lOffset, origin) ); return lseek(hFile, lOffset, origin);
} }
/*************************************************************************** /***************************************************************************
...@@ -413,7 +416,7 @@ INT GetTempFileName(BYTE bDriveLetter, LPCSTR lpszPrefixString, UINT uUnique, LP ...@@ -413,7 +416,7 @@ INT GetTempFileName(BYTE bDriveLetter, LPCSTR lpszPrefixString, UINT uUnique, LP
lpszPrefixString,uUnique,lpszTempFileName); lpszPrefixString,uUnique,lpszTempFileName);
if ((handle = _lcreat (lpszTempFileName, 0x0000)) == -1) { if ((handle = _lcreat (lpszTempFileName, 0x0000)) == -1) {
fprintf(stderr,"GetTempFilename: can't create temp file '%s' !\n", lpszTempFileName); fprintf(stderr,"GetTempFilename: can't create temp file '%s' !\n", lpszTempFileName);
} }
else else
close(handle); close(handle);
...@@ -440,7 +443,7 @@ LONG _hread(INT hf, LPSTR hpvBuffer, LONG cbBuffer) ...@@ -440,7 +443,7 @@ LONG _hread(INT hf, LPSTR hpvBuffer, LONG cbBuffer)
/*************************************************************************** /***************************************************************************
_hwrite _hwrite
***************************************************************************/ ***************************************************************************/
LONG _hwrite(INT hf, const LPSTR hpvBuffer, LONG cbBuffer) LONG _hwrite(INT hf, LPCSTR hpvBuffer, LONG cbBuffer)
{ {
return write(hf, hpvBuffer, cbBuffer); return write(hf, hpvBuffer, cbBuffer);
} }
...@@ -550,7 +550,7 @@ void MessageBeep(WORD i) ...@@ -550,7 +550,7 @@ void MessageBeep(WORD i)
*/ */
LONG GetVersion(void) LONG GetVersion(void)
{ {
return( 0x03300a03 ); /* dos 3.30 & win 3.10 */ return MAKELONG( WINVERSION, DOSVERSION );
} }
/*********************************************************************** /***********************************************************************
......
/*
* OLE2 library
*
* Copyright 1995 Martin von Loewis
*/
/* At the moment, these are only empty stubs.
*/
#include "windows.h"
#include "ole2.h"
#include "stddebug.h"
#include "debug.h"
/***********************************************************************
* OleBuildVersion [OLE.1]
*/
DWORD OleBuildVersion()
{
dprintf_ole(stddeb,"OleBuildVersion()\n");
return (rmm<<16)+rup;
}
/***********************************************************************
* OleInitialize [OLE2.2]
*/
HRESULT WINAPI OleInitialize(LPVOID reserved)
{
dprintf_ole(stdnimp,"OleInitialize\n");
return S_OK;
}
/***********************************************************************
* OleUnitialize [OLE2.3]
*/
void WINAPI OleUninitialize()
{
dprintf_ole(stdnimp,"OleUninitialize()\n");
}
...@@ -7,8 +7,10 @@ ...@@ -7,8 +7,10 @@
/* At the moment, these are only empty stubs. /* At the moment, these are only empty stubs.
*/ */
#include <string.h>
#include "windows.h" #include "windows.h"
#include "ole.h" #include "ole.h"
#include "winnls.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
...@@ -53,3 +55,277 @@ WORD WINAPI GetSystemDefaultLangID() ...@@ -53,3 +55,277 @@ WORD WINAPI GetSystemDefaultLangID()
{ {
return GetUserDefaultLangID(); return GetUserDefaultLangID();
} }
/***********************************************************************
* GetLocaleInfoA (OLE2NLS.5)
* Is the last parameter really WORD for Win16?
*/
int WINAPI GetLocaleInfoA(DWORD lcid,DWORD LCType,LPSTR buf,WORD len)
{
char *retString;
int retLen;
dprintf_ole(stddeb,"GetLocaleInfoA(%8lX,%8lX,%p,%4X)\n",
lcid,LCType,buf,len);
/* Wine is supporting only the default locale */
if(lcid!=GetUserDefaultLCID())
{
dprintf_ole(stdnimp,"GetLocaleInfoA: Unknown locale\n");
return 0;
}
/* As an option, we could obtain the value from win.ini.
This would not match the Wine compile-time option.
Also, not all identifiers are available from win.ini */
retString=0;
retLen=0;
/* If we are through all of this, retLen should not be zero anymore.
If it is, the value is not supported */
#define LOCVAL(type,value) if(type==LCType) \
{retLen=strlen(value)+1;\
retString=value; \
}
#define UNSUPPORTED(type) if(type==lcid)retString=#type;
/* I really wish I would know a better way to do this */
UNSUPPORTED(LOCALE_ILANGUAGE)
UNSUPPORTED(LOCALE_SLANGUAGE)
UNSUPPORTED(LOCALE_SENGLANGUAGE)
UNSUPPORTED(LOCALE_SABBREVLANGNAME)
UNSUPPORTED(LOCALE_SNATIVELANGNAME)
UNSUPPORTED(LOCALE_ICOUNTRY)
UNSUPPORTED(LOCALE_SCOUNTRY)
UNSUPPORTED(LOCALE_SENGCOUNTRY)
UNSUPPORTED(LOCALE_SABBREVCTRYNAME)
UNSUPPORTED(LOCALE_SNATIVECTRYNAME)
UNSUPPORTED(LOCALE_IDEFAULTLANGUAGE)
UNSUPPORTED(LOCALE_IDEFAULTCOUNTRY)
UNSUPPORTED(LOCALE_IDEFAULTCODEPAGE)
UNSUPPORTED(LOCALE_IDEFAULTANSICODEPAGE)
UNSUPPORTED(LOCALE_SLIST)
UNSUPPORTED(LOCALE_IMEASURE)
UNSUPPORTED(LOCALE_SDECIMAL)
UNSUPPORTED(LOCALE_STHOUSAND)
UNSUPPORTED(LOCALE_SGROUPING)
UNSUPPORTED(LOCALE_IDIGITS)
UNSUPPORTED(LOCALE_ILZERO)
UNSUPPORTED(LOCALE_INEGNUMBER)
UNSUPPORTED(LOCALE_SNATIVEDIGITS)
UNSUPPORTED(LOCALE_SCURRENCY)
UNSUPPORTED(LOCALE_SINTLSYMBOL)
UNSUPPORTED(LOCALE_SMONDECIMALSEP)
UNSUPPORTED(LOCALE_SMONTHOUSANDSEP)
UNSUPPORTED(LOCALE_SMONGROUPING)
UNSUPPORTED(LOCALE_ICURRDIGITS)
UNSUPPORTED(LOCALE_IINTLCURRDIGITS)
UNSUPPORTED(LOCALE_ICURRENCY)
UNSUPPORTED(LOCALE_INEGCURR)
UNSUPPORTED(LOCALE_SDATE)
UNSUPPORTED(LOCALE_STIME)
UNSUPPORTED(LOCALE_SSHORTDATE)
UNSUPPORTED(LOCALE_SLONGDATE)
UNSUPPORTED(LOCALE_STIMEFORMAT)
UNSUPPORTED(LOCALE_IDATE)
UNSUPPORTED(LOCALE_ILDATE)
UNSUPPORTED(LOCALE_ITIME)
UNSUPPORTED(LOCALE_ITIMEMARKPOSN)
UNSUPPORTED(LOCALE_ICENTURY)
UNSUPPORTED(LOCALE_ITLZERO)
UNSUPPORTED(LOCALE_IDAYLZERO)
UNSUPPORTED(LOCALE_IMONLZERO)
UNSUPPORTED(LOCALE_S1159)
UNSUPPORTED(LOCALE_S2359)
UNSUPPORTED(LOCALE_ICALENDARTYPE)
UNSUPPORTED(LOCALE_IOPTIONALCALENDAR)
UNSUPPORTED(LOCALE_IFIRSTDAYOFWEEK)
UNSUPPORTED(LOCALE_IFIRSTWEEKOFYEAR)
UNSUPPORTED(LOCALE_SDAYNAME1)
UNSUPPORTED(LOCALE_SDAYNAME2)
UNSUPPORTED(LOCALE_SDAYNAME3)
UNSUPPORTED(LOCALE_SDAYNAME4)
UNSUPPORTED(LOCALE_SDAYNAME5)
UNSUPPORTED(LOCALE_SDAYNAME6)
UNSUPPORTED(LOCALE_SDAYNAME7)
UNSUPPORTED(LOCALE_SABBREVDAYNAME1)
UNSUPPORTED(LOCALE_SABBREVDAYNAME2)
UNSUPPORTED(LOCALE_SABBREVDAYNAME3)
UNSUPPORTED(LOCALE_SABBREVDAYNAME4)
UNSUPPORTED(LOCALE_SABBREVDAYNAME5)
UNSUPPORTED(LOCALE_SABBREVDAYNAME6)
UNSUPPORTED(LOCALE_SABBREVDAYNAME7)
UNSUPPORTED(LOCALE_SMONTHNAME1)
UNSUPPORTED(LOCALE_SMONTHNAME2)
UNSUPPORTED(LOCALE_SMONTHNAME3)
UNSUPPORTED(LOCALE_SMONTHNAME4)
UNSUPPORTED(LOCALE_SMONTHNAME5)
UNSUPPORTED(LOCALE_SMONTHNAME6)
UNSUPPORTED(LOCALE_SMONTHNAME7)
UNSUPPORTED(LOCALE_SMONTHNAME8)
UNSUPPORTED(LOCALE_SMONTHNAME9)
UNSUPPORTED(LOCALE_SMONTHNAME10)
UNSUPPORTED(LOCALE_SMONTHNAME11)
UNSUPPORTED(LOCALE_SMONTHNAME12)
UNSUPPORTED(LOCALE_SMONTHNAME13)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME1)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME2)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME3)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME4)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME5)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME6)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME7)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME8)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME9)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME10)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME11)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME12)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME13)
UNSUPPORTED(LOCALE_SPOSITIVESIGN)
UNSUPPORTED(LOCALE_SNEGATIVESIGN)
UNSUPPORTED(LOCALE_IPOSSIGNPOSN)
UNSUPPORTED(LOCALE_INEGSIGNPOSN)
UNSUPPORTED(LOCALE_IPOSSYMPRECEDES)
UNSUPPORTED(LOCALE_IPOSSEPBYSPACE)
UNSUPPORTED(LOCALE_INEGSYMPRECEDES)
UNSUPPORTED(LOCALE_INEGSEPBYSPACE)
/* Now, the language specific definitions. They don't have to be
complete */
#if #LANG(De)
/* This definitions apply to Germany only. Users in Austria
or Switzerland might want to modify them */
LOCVAL(LOCALE_ILANGUAGE,"9")
LOCVAL(LOCALE_SLANGUAGE,"Deutsch")
LOCVAL(LOCALE_SENGLANGUAGE,"German")
LOCVAL(LOCALE_SABBREVLANGNAME,"deu")
LOCVAL(LOCALE_SNATIVELANGNAME,"Deutsch")
LOCVAL(LOCALE_ICOUNTRY,"49")
LOCVAL(LOCALE_SCOUNTRY,"Deutschland")
LOCVAL(LOCALE_SENGCOUNTRY,"Deutschland")
LOCVAL(LOCALE_SABBREVCTRYNAME,"De")
LOCVAL(LOCALE_SNATIVECTRYNAME,"Deutschland")
LOCVAL(LOCALE_IDEFAULTLANGUAGE,"9")
LOCVAL(LOCALE_IDEFAULTCOUNTRY,"49")
/* Dunno
LOCVAL(LOCALE_IDEFAULTCODEPAGE)
LOCVAL(LOCALE_IDEFAULTANSICODEPAGE)
*/
LOCVAL(LOCALE_SLIST,";")
LOCVAL(LOCALE_IMEASURE,"0")
LOCVAL(LOCALE_SDECIMAL,",")
LOCVAL(LOCALE_STHOUSAND,".")
/*
LOCVAL(LOCALE_SGROUPING)
*/
LOCVAL(LOCALE_IDIGITS,"2")
LOCVAL(LOCALE_ILZERO,"1")
/*
LOCVAL(LOCALE_INEGNUMBER)
Is this "0123456789" ??
LOCVAL(LOCALE_SNATIVEDIGITS)
*/
LOCVAL(LOCALE_SCURRENCY,"DM")
/*
LOCVAL(LOCALE_SINTLSYMBOL)
LOCVAL(LOCALE_SMONDECIMALSEP)
LOCVAL(LOCALE_SMONTHOUSANDSEP)
LOCVAL(LOCALE_SMONGROUPING)
*/
LOCVAL(LOCALE_ICURRDIGITS,"2")
/*
LOCVAL(LOCALE_IINTLCURRDIGITS)
*/
LOCVAL(LOCALE_ICURRENCY,"3")
LOCVAL(LOCALE_INEGCURR,"8")
LOCVAL(LOCALE_SDATE,".")
LOCVAL(LOCALE_STIME,":")
LOCVAL(LOCALE_SSHORTDATE,"dd.MM.yyyy")
LOCVAL(LOCALE_SLONGDATEi,"ddd, d. MMMM yyyy")
/*
LOCVAL(LOCALE_STIMEFORMAT)
*/
LOCVAL(LOCALE_IDATE,"1")
/*
LOCVAL(LOCALE_ILDATE)
*/
LOCVAL(LOCALE_ITIME,"1")
/*
LOCVAL(LOCALE_ITIMEMARKPOSN)
LOCVAL(LOCALE_ICENTURY)
*/
LOCVAL(LOCALE_ITLZERO,"1")
/*
LOCVAL(LOCALE_IDAYLZERO)
LOCVAL(LOCALE_IMONLZERO)
LOCVAL(LOCALE_S1159)
LOCVAL(LOCALE_S2359)
LOCVAL(LOCALE_ICALENDARTYPE)
LOCVAL(LOCALE_IOPTIONALCALENDAR)
LOCVAL(LOCALE_IFIRSTDAYOFWEEK)
LOCVAL(LOCALE_IFIRSTWEEKOFYEAR)
*/
LOCVAL(LOCALE_SDAYNAME1,"Montag")
LOCVAL(LOCALE_SDAYNAME2,"Dienstag")
LOCVAL(LOCALE_SDAYNAME3,"Mittwoch")
LOCVAL(LOCALE_SDAYNAME4,"Donnerstag")
LOCVAL(LOCALE_SDAYNAME5,"Freitag")
LOCVAL(LOCALE_SDAYNAME6,"Sonnabend")
LOCVAL(LOCALE_SDAYNAME7,"Sonntag")
LOCVAL(LOCALE_SABBREVDAYNAME1,"Mo")
LOCVAL(LOCALE_SABBREVDAYNAME2,"Di")
LOCVAL(LOCALE_SABBREVDAYNAME3,"Mi")
LOCVAL(LOCALE_SABBREVDAYNAME4,"Do")
LOCVAL(LOCALE_SABBREVDAYNAME5,"Fr")
LOCVAL(LOCALE_SABBREVDAYNAME6,"Sa")
LOCVAL(LOCALE_SABBREVDAYNAME7,"So")
LOCVAL(LOCALE_SMONTHNAME1,"Januar")
LOCVAL(LOCALE_SMONTHNAME2,"Februar")
LOCVAL(LOCALE_SMONTHNAME3,"Mrz")
LOCVAL(LOCALE_SMONTHNAME4,"April")
LOCVAL(LOCALE_SMONTHNAME5,"Mai")
LOCVAL(LOCALE_SMONTHNAME6,"Juni")
LOCVAL(LOCALE_SMONTHNAME7,"Juli")
LOCVAL(LOCALE_SMONTHNAME8,"August")
LOCVAL(LOCALE_SMONTHNAME9,"September")
LOCVAL(LOCALE_SMONTHNAME10,"Oktober")
LOCVAL(LOCALE_SMONTHNAME11,"November")
LOCVAL(LOCALE_SMONTHNAME12,"Dezember")
LOCVAL(LOCALE_SMONTHNAME13,"")
LOCVAL(LOCALE_SABBREVMONTHNAME1,"Jan")
LOCVAL(LOCALE_SABBREVMONTHNAME2,"Feb")
LOCVAL(LOCALE_SABBREVMONTHNAME3,"Mr")
LOCVAL(LOCALE_SABBREVMONTHNAME4,"Apr")
LOCVAL(LOCALE_SABBREVMONTHNAME5,"Mai")
LOCVAL(LOCALE_SABBREVMONTHNAME6,"Jun")
LOCVAL(LOCALE_SABBREVMONTHNAME7,"Jul")
LOCVAL(LOCALE_SABBREVMONTHNAME8,"Aug")
LOCVAL(LOCALE_SABBREVMONTHNAME9,"Sep")
LOCVAL(LOCALE_SABBREVMONTHNAME10,"Okt")
LOCVAL(LOCALE_SABBREVMONTHNAME11,"Nov")
LOCVAL(LOCALE_SABBREVMONTHNAME12,"Dez")
LOCVAL(LOCALE_SABBREVMONTHNAME13,"")
/*
LOCVAL(LOCALE_SPOSITIVESIGN)
LOCVAL(LOCALE_SNEGATIVESIGN)
LOCVAL(LOCALE_IPOSSIGNPOSN)
LOCVAL(LOCALE_INEGSIGNPOSN)
LOCVAL(LOCALE_IPOSSYMPRECEDES)
LOCVAL(LOCALE_IPOSSEPBYSPACE)
LOCVAL(LOCALE_INEGSYMPRECEDES)
LOCVAL(LOCALE_INEGSEPBYSPACE)
*/
#endif /* LANG(De) */
/*Insert other languages here*/
if(!retLen)
{
if(!retString)fprintf(stderr,"Unkown LC type %lX\n",LCType);
else fprintf(stderr,"'%s' not supported for your language.\n",
retString);
return 0;
}
if(retLen>len)retLen=len;
strncpy(buf,retString,len);
return retLen;
}
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "windows.h" #include "windows.h"
#include "ole.h" #include "ole.h"
#include "gdi.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
...@@ -45,3 +46,12 @@ OLESTATUS WINAPI OleRevokeClientDoc(LHCLIENTDOC hServerDoc) ...@@ -45,3 +46,12 @@ OLESTATUS WINAPI OleRevokeClientDoc(LHCLIENTDOC hServerDoc)
dprintf_ole(stdnimp,"OleRevokeClientDoc:%ld\n",hServerDoc); dprintf_ole(stdnimp,"OleRevokeClientDoc:%ld\n",hServerDoc);
return OLE_OK; return OLE_OK;
} }
/***********************************************************************
* OleIsDcMeta
*/
BOOL WINAPI OleIsDcMeta(HDC hdc)
{
dprintf_ole(stddeb,"OleIsDCMeta(%04X)\n",hdc);
return GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC ) != 0;
}
...@@ -24,6 +24,8 @@ static char Copyright [] = "Copyright (C) 1993 Miguel de Icaza"; ...@@ -24,6 +24,8 @@ static char Copyright [] = "Copyright (C) 1993 Miguel de Icaza";
#include "wine.h" #include "wine.h"
#include "windows.h" #include "windows.h"
#include "dos_fs.h" #include "dos_fs.h"
#include "module.h"
#include "toolhelp.h"
#include "stddebug.h" #include "stddebug.h"
/* #define DEBUG_PROFILE */ /* #define DEBUG_PROFILE */
#include "debug.h" #include "debug.h"
...@@ -48,6 +50,7 @@ typedef struct TSecHeader { ...@@ -48,6 +50,7 @@ typedef struct TSecHeader {
typedef struct TProfile { typedef struct TProfile {
char *FileName; char *FileName;
char *FullName;
TSecHeader *Section; TSecHeader *Section;
struct TProfile *link; struct TProfile *link;
int changed; int changed;
...@@ -70,7 +73,7 @@ static TSecHeader *is_loaded (char *FileName) ...@@ -70,7 +73,7 @@ static TSecHeader *is_loaded (char *FileName)
return 0; return 0;
} }
static char *GetIniFileName(char *name) static char *GetIniFileName(char *name, char *dir)
{ {
char temp[256]; char temp[256];
...@@ -79,15 +82,15 @@ static char *GetIniFileName(char *name) ...@@ -79,15 +82,15 @@ static char *GetIniFileName(char *name)
if (strchr(name, '\\')) if (strchr(name, '\\'))
return DOS_GetUnixFileName(name); return DOS_GetUnixFileName(name);
GetWindowsDirectory(temp, sizeof(temp) ); strcpy(temp, dir);
strcat(temp, "\\"); strcat(temp, "\\");
strcat(temp, name); strcat(temp, name);
return DOS_GetUnixFileName(temp); return DOS_GetUnixFileName(temp);
} }
static TSecHeader *load (char *filename) static TSecHeader *load (char *filename, char **pfullname)
{ {
FILE *f; FILE *f;
int state; int state;
...@@ -95,13 +98,37 @@ static TSecHeader *load (char *filename) ...@@ -95,13 +98,37 @@ static TSecHeader *load (char *filename)
char CharBuffer [STRSIZE]; char CharBuffer [STRSIZE];
char *next, *file; char *next, *file;
char c; char c;
char path[MAX_PATH+1];
/* Try the Windows directory */
file = GetIniFileName(filename); GetWindowsDirectory(path, sizeof(path));
file = GetIniFileName(filename, path);
dprintf_profile(stddeb,"Load %s\n", file); dprintf_profile(stddeb,"Load %s\n", file);
if ((f = fopen (file, "r"))==NULL) f = fopen(file, "r");
if (f == NULL) {
/* Try the path of the current executable */
if (GetCurrentTask())
{
char *p;
GetModuleFileName( GetCurrentTask(), path, MAX_PATH );
if ((p = strrchr( path, '\\' )))
{
p[1] = '\0';
file = GetIniFileName(filename, path);
f = fopen(file, "r");
}
}
}
if (f == NULL) {
fprintf(stderr, "profile.c: load() can't find file %s\n", filename);
return NULL; return NULL;
}
*pfullname = strdup(file);
dprintf_profile(stddeb,"Loading %s\n", file); dprintf_profile(stddeb,"Loading %s\n", file);
...@@ -220,7 +247,7 @@ static short GetSetProfile (int set, LPSTR AppName, LPSTR KeyName, ...@@ -220,7 +247,7 @@ static short GetSetProfile (int set, LPSTR AppName, LPSTR KeyName,
New = (TProfile *) xmalloc (sizeof (TProfile)); New = (TProfile *) xmalloc (sizeof (TProfile));
New->link = Base; New->link = Base;
New->FileName = strdup (FileName); New->FileName = strdup (FileName);
New->Section = load (FileName); New->Section = load (FileName, &New->FullName);
New->changed = FALSE; New->changed = FALSE;
Base = New; Base = New;
section = New->Section; section = New->Section;
...@@ -242,7 +269,7 @@ static short GetSetProfile (int set, LPSTR AppName, LPSTR KeyName, ...@@ -242,7 +269,7 @@ static short GetSetProfile (int set, LPSTR AppName, LPSTR KeyName,
if (left < 1) { if (left < 1) {
dprintf_profile(stddeb,"GetSetProfile // No more storage for enum !\n"); dprintf_profile(stddeb,"GetSetProfile // No more storage for enum !\n");
return (Size - 2); return (Size - 2);
} }
slen = min(strlen(key->KeyName) + 1, left); slen = min(strlen(key->KeyName) + 1, left);
dprintf_profile(stddeb,"GetSetProfile // strncpy(%p, %p, %d);\n", dprintf_profile(stddeb,"GetSetProfile // strncpy(%p, %p, %d);\n",
ReturnedString, key->Value, slen); ReturnedString, key->Value, slen);
...@@ -376,7 +403,7 @@ static void dump_profile (TProfile *p) ...@@ -376,7 +403,7 @@ static void dump_profile (TProfile *p)
dump_profile (p->link); dump_profile (p->link);
if(!p->changed) if(!p->changed)
return; return;
if ((profile = fopen (GetIniFileName(p->FileName), "w")) != NULL){ if ((profile = fopen (p->FullName, "w")) != NULL){
dump_sections (profile, p->Section); dump_sections (profile, p->Section);
fclose (profile); fclose (profile);
} }
......
...@@ -351,15 +351,32 @@ BOOL DragQueryPoint(HDROP h, POINT FAR *p) ...@@ -351,15 +351,32 @@ BOOL DragQueryPoint(HDROP h, POINT FAR *p)
*/ */
HINSTANCE ShellExecute(HWND hWnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, int iShowCmd) HINSTANCE ShellExecute(HWND hWnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, int iShowCmd)
{ {
fprintf(stdnimp, "ShellExecute: empty stub\n"); char cmd[400];
dprintf_exec(stddeb, "ShellExecute(%4X,'%s','%s','%s','%s',%x)\n",
hWnd, lpOperation ? lpOperation:"<null>", lpFile ? lpFile:"<null>",
lpParameters ? lpParameters : "<null>",
lpDirectory ? lpDirectory : "<null>", iShowCmd);
if(lpOperation && !strcasecmp(lpOperation,"print"))
{
fprintf(stderr, "Shell print %s: not supported\n", lpFile);
return 2; /* file not found */
}
if(lpOperation && !strcasecmp(lpOperation,"open"))
{
fprintf(stderr, "ShellExecute: Unknown operation %s\n",lpOperation);
return 2; return 2;
fprintf(stdnimp, "ShellExecute // hWnd=%04X\n", hWnd); }
fprintf(stdnimp, "ShellExecute // lpOperation='%s'\n", lpOperation); /* OK. We are supposed to lookup the program associated with lpFile,
fprintf(stdnimp, "ShellExecute // lpFile='%s'\n", lpFile); then to execute it using that program. If lpFile is a program,
fprintf(stdnimp, "ShellExecute // lpParameters='%s'\n", lpParameters); we have to pass the parameters. If an instance is already running,
fprintf(stdnimp, "ShellExecute // lpDirectory='%s'\n", lpDirectory); we might have to send DDE commands.
fprintf(stdnimp, "ShellExecute // iShowCmd=%04X\n", iShowCmd); This implementation does none of that. It assumes lpFile is a program.
return 2; /* file not found */ Plain WinExec will do what we need */
if(lpParameters)
sprintf(cmd,"%s %s",lpFile,lpParameters);
else
strcpy(cmd,lpFile);
return WinExec(cmd,iShowCmd);
} }
...@@ -430,8 +447,9 @@ HICON ExtractIcon(HINSTANCE hInst, LPCSTR lpszExeFileName, UINT nIconIndex) ...@@ -430,8 +447,9 @@ HICON ExtractIcon(HINSTANCE hInst, LPCSTR lpszExeFileName, UINT nIconIndex)
HINSTANCE hInst2 = hInst; HINSTANCE hInst2 = hInst;
dprintf_reg(stddeb, "ExtractIcon(%04X, '%s', %d\n", dprintf_reg(stddeb, "ExtractIcon(%04X, '%s', %d\n",
hInst, lpszExeFileName, nIconIndex); hInst, lpszExeFileName, nIconIndex);
return 0;
if (lpszExeFileName != NULL) { if (lpszExeFileName != NULL) {
hInst2 = LoadLibrary(lpszExeFileName); hInst2 = LoadModule(lpszExeFileName,(LPVOID)-1);
} }
if (hInst2 != 0 && nIconIndex == (UINT)-1) { if (hInst2 != 0 && nIconIndex == (UINT)-1) {
#if 0 #if 0
......
...@@ -288,6 +288,7 @@ void SpyMessage(HWND hwnd, WORD msg, WORD wParam, LONG lParam) ...@@ -288,6 +288,7 @@ void SpyMessage(HWND hwnd, WORD msg, WORD wParam, LONG lParam)
*/ */
void SpyInit(void) void SpyInit(void)
{ {
#ifndef NOSPY
char filename[100]; char filename[100];
if (SpyFp != NULL) if (SpyFp != NULL)
...@@ -322,4 +323,5 @@ void SpyInit(void) ...@@ -322,4 +323,5 @@ void SpyInit(void)
if (*SpyFilters != 0) { if (*SpyFilters != 0) {
strcat(SpyFilters, ";"); strcat(SpyFilters, ";");
} }
#endif
} }
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
MODULE = miscemu MODULE = miscemu
SRCS = \ SRCS = \
dpmi.c \
emulate.c \ emulate.c \
instr.c \
int10.c \ int10.c \
int13.c \ int13.c \
int15.c \ int15.c \
...@@ -14,7 +16,6 @@ SRCS = \ ...@@ -14,7 +16,6 @@ SRCS = \
int26.c \ int26.c \
int2a.c \ int2a.c \
int2f.c \ int2f.c \
int31.c \
int5c.c \ int5c.c \
interrupts.c \ interrupts.c \
ioports.c ioports.c
......
/*
* DPMI 0.9 emulation
*
* Copyright 1995 Alexandre Julliard
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "windows.h"
#include "ldt.h"
#include "registers.h"
#include "wine.h"
#include "miscemu.h"
#include "stddebug.h"
/* #define DEBUG_INT */
#include "debug.h"
/**********************************************************************
* do_int31
*
* Handle the DPMI interrupt (int 31h).
*/
int do_int31( struct sigcontext_struct *context )
{
DWORD dw;
BYTE *ptr;
dprintf_int( stddeb, "int31 (DPMI): AX %04x, BX %04x, CX %04x, DX %04x, "
"SI %04x, DI %04x, DS %04x, ES %04x\n",
AX, BX, CX, DX, SI, DI, DS, ES );
ResetCflag;
switch(AX)
{
case 0x0000: /* Allocate LDT descriptors */
if (!(AX = AllocSelectorArray( CX )))
{
AX = 0x8011; /* descriptor unavailable */
SetCflag;
}
break;
case 0x0001: /* Free LDT descriptor */
if (FreeSelector( BX ))
{
AX = 0x8022; /* invalid selector */
SetCflag;
}
break;
case 0x0003: /* Get next selector increment */
AX = __AHINCR;
break;
case 0x0004: /* Lock selector (not supported) */
AX = 0; /* FIXME: is this a correct return value? */
break;
case 0x0005: /* Unlock selector (not supported) */
AX = 0; /* FIXME: is this a correct return value? */
break;
case 0x0006: /* Get selector base address */
if (!(dw = GetSelectorBase( BX )))
{
AX = 0x8022; /* invalid selector */
SetCflag;
}
else
{
CX = HIWORD(dw);
DX = LOWORD(dw);
}
break;
case 0x0007: /* Set selector base address */
SetSelectorBase( BX, MAKELONG( DX, CX ) );
break;
case 0x0008: /* Set selector limit */
SetSelectorLimit( BX, MAKELONG( DX, CX ) );
break;
case 0x0009: /* Set selector access rights */
SelectorAccessRights( BX, 1, CX );
case 0x000a: /* Allocate selector alias */
if (!(AX = AllocCStoDSAlias( BX )))
{
AX = 0x8011; /* descriptor unavailable */
SetCflag;
}
break;
case 0x000b: /* Get descriptor */
{
ldt_entry entry;
LDT_GetEntry( SELECTOR_TO_ENTRY(BX), &entry );
/* FIXME: should use ES:EDI for 32-bit clients */
LDT_EntryToBytes( PTR_SEG_OFF_TO_LIN( ES, DI ), &entry );
}
break;
case 0x000c: /* Set descriptor */
{
ldt_entry entry;
LDT_BytesToEntry( PTR_SEG_OFF_TO_LIN( ES, DI ), &entry );
LDT_GetEntry( SELECTOR_TO_ENTRY(BX), &entry );
}
break;
case 0x000d: /* Allocate specific LDT descriptor */
AX = 0x8011; /* descriptor unavailable */
SetCflag;
break;
case 0x0400: /* Get DPMI version */
AX = 0x0009; /* DPMI version 0.9 */
BX = 0x0005; /* Flags: 32-bit, virtual memory */
CL = 4; /* CPU type: 486 */
DX = 0x0102; /* Master and slave interrupt controller base */
break;
case 0x0500: /* Get free memory information */
memset( PTR_SEG_OFF_TO_LIN( ES, DI ),
0xff, 0x30 ); /* No information supported */
break;
case 0x0501: /* Allocate memory block */
if (!(ptr = (BYTE *)malloc( MAKELONG( CX, BX ) )))
{
AX = 0x8012; /* linear memory not available */
SetCflag;
}
else
{
BX = SI = HIWORD(ptr);
CX = DI = LOWORD(ptr);
}
break;
case 0x0502: /* Free memory block */
free( (void *)MAKELONG( DI, SI ) );
break;
case 0x0503: /* Resize memory block */
if (!(ptr = (BYTE *)realloc( (void *)MAKELONG(DI,SI),MAKELONG(CX,BX))))
{
AX = 0x8012; /* linear memory not available */
SetCflag;
}
else
{
BX = SI = HIWORD(ptr);
CX = DI = LOWORD(ptr);
}
break;
case 0x0600: /* Lock linear region */
break; /* Just ignore it */
case 0x0601: /* Unlock linear region */
break; /* Just ignore it */
default:
AX = 0x8001; /* unsupported function */
SetCflag;
break;
}
return 1;
}
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "wine.h" #include "wine.h"
#include "registers.h"
#include "stddebug.h" #include "stddebug.h"
/* #define DEBUG_INT */ /* #define DEBUG_INT */
#include "debug.h" #include "debug.h"
...@@ -15,18 +16,20 @@ struct Win87EmInfoStruct { ...@@ -15,18 +16,20 @@ struct Win87EmInfoStruct {
}; };
void void
WIN87_fpmath( struct sigcontext_struct context ) WIN87_fpmath( struct sigcontext_struct sigcontext )
{ {
dprintf_int(stddeb, "_fpmath: (%x:%lx %x %x)\n",context.sc_cs, /* Declare a context pointer so that registers macros work */
context.sc_eip, context.sc_es, (int)context.sc_ebx & 0xffff ); struct sigcontext_struct *context = &sigcontext;
switch(context.sc_ebx & 0xffff) dprintf_int(stddeb, "_fpmath: (%x:%lx %x %x)\n", CS, EIP, ES, BX );
switch(BX)
{ {
case 11: case 11:
context.sc_eax = 1; AX = 1;
break; break;
default: default:
context.sc_eax = 0; AX = 0;
break; break;
} }
} }
......
/*
* Emulation of priviledged instructions
*
* Copyright 1995 Alexandre Julliard
*/
#include <stdio.h>
#include "windows.h"
#include "dos_fs.h"
#include "ldt.h"
#include "miscemu.h"
#include "registers.h"
static int do_int(int intnum, struct sigcontext_struct *context)
{
switch(intnum)
{
case 0x10: return do_int10(context);
case 0x11:
AX = DOS_GetEquipment();
return 1;
case 0x12:
AX = 640;
return 1; /* get base mem size */
case 0x13: return do_int13(context);
case 0x15: return do_int15(context);
case 0x16: return do_int16(context);
case 0x1a: return do_int1a(context);
case 0x21: return do_int21(context);
case 0x22:
AX = 0x1234;
BX = 0x5678;
CX = 0x9abc;
DX = 0xdef0;
return 1;
case 0x25: return do_int25(context);
case 0x26: return do_int26(context);
case 0x2a: return do_int2a(context);
case 0x2f: return do_int2f(context);
case 0x31: return do_int31(context);
case 0x3d: return 1;
case 0x5c: return do_int5c(context);
default:
fprintf(stderr,"int%02x: Unimplemented!\n", intnum);
break;
}
return 0;
}
/***********************************************************************
* INSTR_EmulateInstruction
*
* Emulate a priviledged instruction. Returns TRUE if emulation successful.
*/
BOOL INSTR_EmulateInstruction( struct sigcontext_struct *context )
{
int prefix, segprefix, long_op, long_addr;
BYTE *instr = (BYTE *) PTR_SEG_OFF_TO_LIN( CS, IP );
/* First handle any possible prefix */
long_op = long_addr = (GET_SEL_FLAGS(CS) & LDT_FLAGS_32BIT) != 0;
segprefix = 0; /* no prefix */
prefix = 1;
while(prefix)
{
switch(*instr)
{
case 0x2e:
segprefix = 1; /* CS */
break;
case 0x36:
segprefix = 2; /* SS */
break;
case 0x3e:
segprefix = 3; /* DS */
break;
case 0x26:
segprefix = 4; /* ES */
break;
case 0x64:
segprefix = 5; /* FS */
break;
case 0x65:
segprefix = 6; /* GS */
break;
case 0x66:
long_op = !long_op; /* opcode size prefix */
break;
case 0x67:
long_addr = !long_addr; /* addr size prefix */
break;
default:
prefix = 0; /* no more prefixes */
break;
}
if (prefix)
{
instr++;
EIP++;
}
}
/* Now look at the actual instruction */
switch(*instr)
{
case 0xcd: /* int <XX> */
instr++;
if (!do_int(*instr, context))
{
fprintf(stderr,"Unexpected Windows interrupt %x\n", *instr);
return FALSE;
}
EIP += 2; /* Bypass the int instruction */
break;
case 0xcf: /* iret */
if (long_op)
{
/* FIXME: should check the stack 'big' bit */
DWORD *stack = (WORD *)PTR_SEG_OFF_TO_LIN( SS, SP );
EIP = *stack++;
CS = *stack++;
EFL = *stack;
SP += 3*sizeof(DWORD); /* Pop the return address and flags */
}
else
{
/* FIXME: should check the stack 'big' bit */
WORD *stack = (WORD *)PTR_SEG_OFF_TO_LIN( SS, SP );
EIP = *stack++;
CS = *stack++;
EFL = (EFL & 0xffff0000) | *stack;
SP += 3*sizeof(WORD); /* Pop the return address and flags */
}
break;
case 0xe4: /* inb al,XX */
inportb_abs(context);
EIP += 2;
break;
case 0xe5: /* in ax,XX */
inport_abs( context, long_op );
EIP += 2;
break;
case 0xe6: /* outb XX,al */
outportb_abs(context);
EIP += 2;
break;
case 0xe7: /* out XX,ax */
outport_abs( context, long_op );
EIP += 2;
break;
case 0xec: /* inb al,dx */
inportb(context);
EIP++;
break;
case 0xed: /* in ax,dx */
inport( context, long_op );
EIP++;
break;
case 0xee: /* outb dx,al */
outportb(context);
EIP++;
break;
case 0xef: /* out dx,ax */
outport( context, long_op );
EIP++;
break;
case 0xfa: /* cli, ignored */
EIP++;
break;
case 0xfb: /* sti, ignored */
EIP++;
break;
default:
fprintf(stderr, "Unexpected Windows program segfault"
" - opcode = %x\n", *instr);
return FALSE; /* Unable to emulate it */
}
return TRUE;
}
...@@ -37,7 +37,7 @@ int do_int25(struct sigcontext_struct *context) ...@@ -37,7 +37,7 @@ int do_int25(struct sigcontext_struct *context)
length = CX; length = CX;
} }
dprintf_int(stdnimp, "int25: abs diskread, drive %d, sector %ld, " dprintf_int(stdnimp, "int25: abs diskread, drive %d, sector %ld, "
"count %ld, buffer %d\n", (int)EAX & 0xff, begin, length, (int) dataptr); "count %ld, buffer %d\n", AL, begin, length, (int) dataptr);
memset(dataptr, 0, length * 512); memset(dataptr, 0, length * 512);
......
...@@ -37,7 +37,7 @@ int do_int26(struct sigcontext_struct *context) ...@@ -37,7 +37,7 @@ int do_int26(struct sigcontext_struct *context)
} }
dprintf_int(stdnimp,"int26: abs diskwrite, drive %d, sector %ld, " dprintf_int(stdnimp,"int26: abs diskwrite, drive %d, sector %ld, "
"count %ld, buffer %d\n", (int)EAX & 0xff, begin, length, (int) dataptr); "count %ld, buffer %d\n", AL, begin, length, (int) dataptr);
ResetCflag; ResetCflag;
......
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
#include <stdlib.h> #include <stdlib.h>
#include "registers.h" #include "registers.h"
#include "wine.h" #include "wine.h"
#include "msdos.h"
#include "miscemu.h" #include "miscemu.h"
#include "options.h"
#include "stddebug.h" #include "stddebug.h"
/* #define DEBUG_INT */ /* #define DEBUG_INT */
#include "debug.h" #include "debug.h"
...@@ -15,10 +17,10 @@ int do_int2f(struct sigcontext_struct *context) ...@@ -15,10 +17,10 @@ int do_int2f(struct sigcontext_struct *context)
"SI %04x, DI %04x, DS %04x, ES %04x\n", "SI %04x, DI %04x, DS %04x, ES %04x\n",
AX, BX, CX, DX, SI, DI, DS, ES); AX, BX, CX, DX, SI, DI, DS, ES);
switch((context->sc_eax >> 8) & 0xff) switch(AH)
{ {
case 0x10: /* share is installed */ case 0x10:
EAX = (EAX & 0xffffff00) | 0xff; AL = 0xff; /* share is installed */
break; break;
case 0x15: /* mscdex */ case 0x15: /* mscdex */
...@@ -37,30 +39,36 @@ int do_int2f(struct sigcontext_struct *context) ...@@ -37,30 +39,36 @@ int do_int2f(struct sigcontext_struct *context)
int do_int2f_16(struct sigcontext_struct *context) int do_int2f_16(struct sigcontext_struct *context)
{ {
switch(context->sc_eax & 0xff) { switch(AL)
case 0x00: {
/* return 'major/minor' for MSWin 3.1 */ case 0x00: /* Windows enhanced mode installation check */
dprintf_int(stddeb,"do_int2f_16 // return 'major/minor' for MSWin 3.1 !\n"); AX = Options.enhanced ? WINVERSION : 0;
context->sc_eax = 0x0310; break;
return 1;
case 0x86: case 0x0a: /* Get Windows version and type */
/* operating in protected mode under DPMI */ AX = 0;
dprintf_int(stddeb,"do_int2f_16 // operating in protected mode under DPMI !\n"); BX = (WINVERSION >> 8) | ((WINVERSION << 8) & 0xff00);
context->sc_eax = 0x0000; CX = Options.enhanced ? 3 : 2;
return 1; break;
case 0x87:
dprintf_int(stddeb,"do_int2f_16 // return DPMI flags !\n"); case 0x86: /* DPMI detect mode */
context->sc_eax = 0x0000; /* DPMI Installed */ AX = 0; /* Running under DPMI */
context->sc_ebx = 0x0001; /* 32bits available */ break;
context->sc_ecx = 0x04; /* processor 486 */
context->sc_edx = 0x0100; /* DPMI major/minor */ case 0x87: /* DPMI installation check */
context->sc_esi = 0; /* # of para. of DOS */ AX = 0x0000; /* DPMI Installed */
/* extended private data */ BX = 0x0001; /* 32bits available */
return 1; CX = 0x04; /* processor 486 */
default: DX = 0x0009; /* DPMI major/minor 0.9 */
IntBarf(0x2f, context); SI = 0; /* # of para. of DOS extended private data */
} ES = 0; /* ES:DI is DPMI switch entry point */
return 1; DI = 0;
break;
default:
IntBarf(0x2f, context);
}
return 1;
} }
#include <stdio.h>
#include <stdlib.h>
#include "registers.h"
#include "wine.h"
#include "miscemu.h"
#include "stddebug.h"
/* #define DEBUG_INT */
#include "debug.h"
typedef struct {
WORD accessed : 1;
WORD read_write : 1;
WORD conf_exp : 1;
WORD code : 1;
WORD xsystem : 1;
WORD dpl : 2;
WORD present : 1;
WORD dummy : 8;
} ACCESS;
typedef ACCESS *LPACCESS;
typedef struct {
WORD Limit;
WORD addr_lo;
BYTE addr_hi;
ACCESS access;
WORD reserved;
} DESCRIPTOR;
typedef DESCRIPTOR *LPDESCRIPTOR;
HANDLE DPMI_GetNewSelector(WORD selcount);
BOOL DPMI_FreeSelector(HANDLE pmSel);
BOOL DPMI_SetDescriptor(HANDLE pmSel, LPDESCRIPTOR lpDesc);
/*************************************************************************/
int do_int31(struct sigcontext_struct *context)
{
LPDESCRIPTOR lpDesc;
dprintf_int(stddeb,"do_int31 // context->sc_eax=%08lX\n",
context->sc_eax);
switch(context->sc_eax)
{
case 0x0000:
context->sc_eax = DPMI_GetNewSelector(context->sc_ecx);
break;
case 0x0001:
context->sc_eax = DPMI_FreeSelector(context->sc_ebx);
break;
case 0x000C:
lpDesc = (LPDESCRIPTOR) MAKELONG(context->sc_edi,
context->sc_es);
context->sc_eax = DPMI_SetDescriptor(context->sc_ebx, lpDesc);
break;
default:
IntBarf(0x31, context);
};
return 1;
}
/*************************************************************************/
HANDLE DPMI_GetNewSelector(WORD selcount)
{
LPSTR ptr;
HANDLE pmSel;
dprintf_int(stddeb,"DPMI_GetNewSelector(%d); !\n", selcount);
pmSel = GlobalAlloc(GMEM_FIXED, 4096);
ptr = GlobalLock(pmSel);
dprintf_int(stddeb,"DPMI_GetNewSelector() return %04X !\n", pmSel);
return pmSel;
}
BOOL DPMI_FreeSelector(HANDLE pmSel)
{
dprintf_int(stddeb,"DPMI_FreeSelector(%04X); !\n", pmSel);
GlobalFree(pmSel);
return 0;
}
BOOL DPMI_SetDescriptor(HANDLE pmSel, LPDESCRIPTOR lpDesc)
{
dprintf_int(stdnimp,"DPMI_SetDescriptor(%04X, %p); !\n",
pmSel, lpDesc);
dprintf_int(stdnimp,"DPMI lpDesc->Limit=%u \n", lpDesc->Limit);
dprintf_int(stdnimp,"DPMI lpDesc->addr_lo=%04X \n", lpDesc->addr_lo);
dprintf_int(stdnimp,"DPMI lpDesc->addr_hi=%02X \n", lpDesc->addr_hi);
dprintf_int(stdnimp,"DPMI lpDesc->access.accessed=%u \n",
lpDesc->access.accessed);
dprintf_int(stdnimp,"DPMI lpDesc->access.read_write=%u \n",
lpDesc->access.read_write);
dprintf_int(stdnimp,"DPMI lpDesc->access.conf_exp=%u \n",
lpDesc->access.conf_exp);
dprintf_int(stdnimp,"DPMI lpDesc->access.code=%u \n",
lpDesc->access.code);
dprintf_int(stdnimp,"DPMI lpDesc->access.xsystem=%u \n",
lpDesc->access.xsystem);
dprintf_int(stdnimp,"DPMI lpDesc->access.dpl=%u \n",
lpDesc->access.dpl);
dprintf_int(stdnimp,"DPMI lpDesc->access.present=%u \n",
lpDesc->access.present);
dprintf_int(stdnimp,"DPMI lpDesc->reserved=%04X \n", lpDesc->reserved);
return FALSE;
}
...@@ -34,11 +34,11 @@ void inportb(struct sigcontext_struct *context) ...@@ -34,11 +34,11 @@ void inportb(struct sigcontext_struct *context)
} }
} }
void inport(struct sigcontext_struct *context) void inport( struct sigcontext_struct *context, int long_op )
{ {
dprintf_int(stdnimp, "IO: in (%x)\n", DX); dprintf_int(stdnimp, "IO: in (%x)\n", DX);
if (long_op) EAX = 0xffffffff;
AX = 0xffff; else AX = 0xffff;
} }
void inportb_abs(struct sigcontext_struct *context) void inportb_abs(struct sigcontext_struct *context)
...@@ -47,10 +47,11 @@ void inportb_abs(struct sigcontext_struct *context) ...@@ -47,10 +47,11 @@ void inportb_abs(struct sigcontext_struct *context)
AL = 0xff; AL = 0xff;
} }
void inport_abs(struct sigcontext_struct *context) void inport_abs( struct sigcontext_struct *context, int long_op )
{ {
dprintf_int(stdnimp, "IO: in (%x)\n", *(BYTE *)(EIP+1)); dprintf_int(stdnimp, "IO: in (%x)\n", *(BYTE *)(EIP+1));
AX = 0xffff; if (long_op) EAX = 0xffffffff;
else AX = 0xffff;
} }
void outportb(struct sigcontext_struct *context) void outportb(struct sigcontext_struct *context)
...@@ -69,9 +70,9 @@ void outportb(struct sigcontext_struct *context) ...@@ -69,9 +70,9 @@ void outportb(struct sigcontext_struct *context)
} }
} }
void outport(struct sigcontext_struct *context) void outport( struct sigcontext_struct *context, int long_op )
{ {
dprintf_int(stdnimp, "IO: out (%x), %x\n", DX, AX); dprintf_int(stdnimp, "IO: out (%x), %lx\n", DX, long_op ? EAX : AX);
} }
void outportb_abs(struct sigcontext_struct *context) void outportb_abs(struct sigcontext_struct *context)
...@@ -79,7 +80,8 @@ void outportb_abs(struct sigcontext_struct *context) ...@@ -79,7 +80,8 @@ void outportb_abs(struct sigcontext_struct *context)
dprintf_int(stdnimp, "IO: out (%x), %x\n", *(BYTE *)(EIP+1), AL); dprintf_int(stdnimp, "IO: out (%x), %x\n", *(BYTE *)(EIP+1), AL);
} }
void outport_abs(struct sigcontext_struct *context) void outport_abs( struct sigcontext_struct *context, int long_op )
{ {
dprintf_int(stdnimp, "IO: out (%x), %x\n", *(BYTE *)(EIP+1), AX); dprintf_int(stdnimp, "IO: out (%x), %lx\n", *(BYTE *)(EIP+1),
long_op ? EAX : AX);
} }
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