Commit e2abbb1b authored by Alexandre Julliard's avatar Alexandre Julliard

Release 950319

Sun Mar 19 16:30:20 1995 Alexandre Julliard (julliard@sunsite.unc.edu) * [*/*] Implemented a new memory mapping scheme. There's no longer a one-to-one mapping between 16-bit and 32-bit pointers. Please see file DEVELOPERS-HINTS for technical details. * [controls/scroll.c] Fixed bug when dragging mouse in horizontal scrollbars. * [tools/build.c] [if1632/*.spec] Removed support for C callback functions and for re-ordering of the 32-bit arguments, as these were never used. This should allow a more efficient callback scheme to be implemented. * [if1632/olecli.spec] Reduced the number of entries to make the 16-bit code fit in 64k. This limitation will soon be removed. * [loader/ldt.c] Rewrote LDT manipulation functions and implemented LDT_GetEntry(). * [memory/global.c] Rewrote Global*() routines to use the new selector allocation mechanism. * [memory/local.c] Rewrote local heap handling to use a Windows-compatible layout (not really finished yet). Implemented TOOLHELP heap-walking routines. * [memory/selector.c] Implemented LDT manipulation API functions. Tue Mar 14 19:50:28 EST 1995 William Magro (wmagro@tc.cornell.edu) * [windows/defdlg.c] Fixed problem where dialogs closed using the System menu ('Close' item or double click on close box) would hang Wine. Sun Mar 12 14:28:13 1995 Michael Patra <micky@marie.physik.TU-Berlin.DE> * [controls/listbox.c] Removed most of the statements for sending a notification message ListBoxDirectory(), DlgDirSelect(), DlgDirList(): Improved the code; Borland's standard file open dialog will work now. * [misc/main.c], [misc/file.c], [miscemu/int21.c] Added support for new command line option "-allowreadonly". If set an attempt to open a read only file in write mode will be converted to opening it read only (many programs try to open all files in read/write mode even if they only intend to read it - this might cause a few under problems under an unix-like environment where most files are read only for a "normal" user) * [loader/selector.c] GetMemoryReference(): Added support for __AHIncr and __AHShift * [misc/dos_fs.c] DOS_SimplifyPath(): This routine simplifies path names ( e.g., it will change "/usr///local/bin/../lib//a" to "/usr/local/lib/a" ) match(): rewritten * [objects/text.c] TEXT_NextLine(): Removed a bug in the handling of LF's * [miscemu/int21.c] GetFileDateTime(): Fixed. SetFileDateTime() is still broken. Sat Mar 11 19:46:19 1995 Martin von Loewis <loewis@informatik.hu-berlin.de> * [controls/menu.c] ChangeMenu: defaults to MF_INSERT InsertMenu: allow insertion even if position is one after last item * [if1632/Imakefile] [if1632/compobj.spec] [if1632/relay.c] [if1632/storage.spec] [include/dlls.h] Added stubs for STORAGE.DLL and COMPOBJ.DLL * [if1632/user.spec] [windows/message.c] InSendMessage: new function * [include/neexe.h][include/ne_image.c] NE_FixupSegment: fixed handling of additive records * [loader/selector.c] GetEntryDLLName: return NULL instead of pointer to DLL.0 if not found * [loader/signal.c] win_fault: Enter debugger on SIGFPE, too Wed Mar 1 21:47:42 1995 Cameron Heide (heide@ee.ualberta.ca) * [miscemu/int*.c] Various minor modifications to the clock tick counter, FindFirst/FindNext funcs, and DPB handling.
parent 6abb89c3
This is release 950302 of Wine the MS Windows emulator. This is still a This is release 950319 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-950302: (see ChangeLog for details) WHAT'S NEW with Wine-950319: (see ChangeLog for details)
- You now need libXpm to be able to compile. - New memory management scheme. This will probably cause many
- OLE stubs and run-time option to disable them. new problems, please report them. I'm particularly interested
- Support for special selectors like __0040H. to hear how it works for the *BSD people.
- Many fixes in file and directory handling.
- Handling of additive fixup records.
- 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 +19,12 @@ Because of lags created by using mirror, this message may reach you before ...@@ -17,11 +19,12 @@ 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-950302.tar.gz sunsite.unc.edu:/pub/Linux/ALPHA/wine/Wine-950319.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-950302.tar.gz tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-950319.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-950302.tar.gz ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-950319.tar.gz
ftp.funet.fi:/pub/OS/Linux/ALPHA/Wine/Wine-950302.tar.gz ftp.funet.fi:/pub/OS/Linux/ALPHA/Wine/Wine-950319.tar.gz
ftp.wonderland.org:/Wine/Wine-950302.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite.
If you submitted a patch, please check to make sure it has been If you submitted a patch, please check to make sure it has been
included in the new release. included in the new release.
......
---------------------------------------------------------------------- ----------------------------------------------------------------------
Sun Mar 19 16:30:20 1995 Alexandre Julliard (julliard@sunsite.unc.edu)
* [*/*]
Implemented a new memory mapping scheme. There's no longer a
one-to-one mapping between 16-bit and 32-bit pointers. Please see
file DEVELOPERS-HINTS for technical details.
* [controls/scroll.c]
Fixed bug when dragging mouse in horizontal scrollbars.
* [tools/build.c] [if1632/*.spec]
Removed support for C callback functions and for re-ordering
of the 32-bit arguments, as these were never used. This should
allow a more efficient callback scheme to be implemented.
* [if1632/olecli.spec]
Reduced the number of entries to make the 16-bit code fit in 64k.
This limitation will soon be removed.
* [loader/ldt.c]
Rewrote LDT manipulation functions and implemented LDT_GetEntry().
* [memory/global.c]
Rewrote Global*() routines to use the new selector allocation
mechanism.
* [memory/local.c]
Rewrote local heap handling to use a Windows-compatible layout
(not really finished yet).
Implemented TOOLHELP heap-walking routines.
* [memory/selector.c]
Implemented LDT manipulation API functions.
Tue Mar 14 19:50:28 EST 1995 William Magro (wmagro@tc.cornell.edu)
* [windows/defdlg.c]
Fixed problem where dialogs closed using the System menu
('Close' item or double click on close box) would
hang Wine.
Sun Mar 12 14:28:13 1995 Michael Patra <micky@marie.physik.TU-Berlin.DE>
* [controls/listbox.c]
Removed most of the statements for sending a notification message
ListBoxDirectory(), DlgDirSelect(), DlgDirList(): Improved the
code; Borland's standard file open dialog will work now.
* [misc/main.c], [misc/file.c], [miscemu/int21.c]
Added support for new command line option "-allowreadonly". If set
an attempt to open a read only file in write mode will be converted
to opening it read only (many programs try to open all files in
read/write mode even if they only intend to read it - this might
cause a few under problems under an unix-like environment where most
files are read only for a "normal" user)
* [loader/selector.c]
GetMemoryReference(): Added support for __AHIncr and __AHShift
* [misc/dos_fs.c]
DOS_SimplifyPath(): This routine simplifies path names ( e.g., it
will change "/usr///local/bin/../lib//a" to "/usr/local/lib/a" )
match(): rewritten
* [objects/text.c]
TEXT_NextLine(): Removed a bug in the handling of LF's
* [miscemu/int21.c]
GetFileDateTime(): Fixed. SetFileDateTime() is still broken.
Sat Mar 11 19:46:19 1995 Martin von Loewis <loewis@informatik.hu-berlin.de>
* [controls/menu.c]
ChangeMenu: defaults to MF_INSERT
InsertMenu: allow insertion even if position is one after last item
* [if1632/Imakefile] [if1632/compobj.spec] [if1632/relay.c]
[if1632/storage.spec] [include/dlls.h]
Added stubs for STORAGE.DLL and COMPOBJ.DLL
* [if1632/user.spec] [windows/message.c]
InSendMessage: new function
* [include/neexe.h][include/ne_image.c]
NE_FixupSegment: fixed handling of additive records
* [loader/selector.c]
GetEntryDLLName: return NULL instead of pointer to DLL.0 if not found
* [loader/signal.c]
win_fault: Enter debugger on SIGFPE, too
Wed Mar 1 21:47:42 1995 Cameron Heide (heide@ee.ualberta.ca)
* [miscemu/int*.c]
Various minor modifications to the clock tick counter,
FindFirst/FindNext funcs, and DPB handling.
----------------------------------------------------------------------
Thu Mar 2 17:44:32 1995 Alexandre Julliard (julliard@sunsite.unc.edu) Thu Mar 2 17:44:32 1995 Alexandre Julliard (julliard@sunsite.unc.edu)
* [loader/resource.c] [objects/oembitmap.c] * [loader/resource.c] [objects/oembitmap.c]
......
...@@ -194,11 +194,6 @@ else ...@@ -194,11 +194,6 @@ else
fi fi
fi fi
if grep -s seg_not_present /usr/include/linux/ldt.h 2> /dev/null
then
ALLDEFINES="$ALLDEFINES -DNEW_LDT_STRUCT"
fi
cat > autoconf.h << EOF cat > autoconf.h << EOF
/* autoconf.h generated automatically. Run Configure. */ /* autoconf.h generated automatically. Run Configure. */
$WINELIB $WINELIB
......
This is intend to be a document to help new developers get started. This is intended to be a document to help new developers get started.
Existing developers should feel free to add their comments. Existing developers should feel free to add their comments.
MEMORY AND SEGMENTS: MEMORY AND SEGMENTS:
NE (Win16) executables consist of multiple segments. The Wine loader NE (Win16) executables consist of multiple segments. The Wine loader
loads each segment into a unique location the Wine processes memory loads each segment into a unique location in the Wine processes memory
and assigns a selector to that segment. To make address conversion and assigns a selector to that segment. Because of this, it's not
simpler, Wine loads the segments in such a way that the segmented possible to exchange addresses freely between 16-bit and 32-bit code.
address (16:16) is stored in memory the same way as the 32-bit linear Addresses used by 16-bit code are segmented addresses (16:16), formed
address. For example, the segmented address 1237:89AB can be at the by a 16-bit selector and a 16-bit offset. Those used by the Wine code
address 0x123789AB in the Wine process space. are regular 32-bit linear addresses.
This also implies that a Win16 program cannot access any arbitrary There's three ways to obtain a segmented pointer:
memory location. If a pointer needs to be returned to a Win16 program, - Allocate a block of memory from the global heap and use
then the memory block must be allocated using either GlobalAlloc() WIN16_GlobalLock to get its segmented address.
or HEAP_Alloc(). The HEAP_* functions are faster than the Global* - Allocate a block of memory from a local heap, and build the
functions but are only capable of managing a 64k memory block. The segmented address from the local heap selector (see the
HEAP_* functions are used to implement local heaps. Wine should USER_HEAP_* macros for an example of this).
never call Local* functions. These functions are reserved for use - Declare the argument as 'segptr' instead of 'ptr' in the spec file
by Win16 programs only! for a given API function.
The following code fragment should be used to establish a new Wine Once you have a segmented pointer, it must be converted to a linear
local heap: pointer before you can use it from 32-bit code. This can be done with
the PTR_SEG_TO_LIN() and PTR_SEG_OFF_TO_LIN() macros. The linear
#include "heap.h" pointer can then be used freely with standard Unix functions like
memcpy() etc. without worrying about 64k boundaries. Note: there's no
#define MY_HEAP_SIZE 0x10000 /* Must be <= 64k */ easy way to convert back from a linear to a segmented address.
int MyHeapHandle; In most cases, you don't need to worry about segmented address, as the
void *MyHeapBase; conversion is made automatically by the callback code and the API
MDESC *MyHeap; functions only see linear addresses. However, in some cases it is
necessary to manipulate segmented addresses; the most frequent cases
... are:
- API functions that return a pointer
int InitMyHeap() - lParam of Windows messages that point to a structure
{ - Pointers contained inside structures accessed by 16-bit code.
MyHeapHandle = GlobalAlloc(GMEM_FIXED, MY_HEAP_SIZE);
if (MyHeapHandle == 0) It is usually a good practice to used the type 'SEGPTR' for segmented
return -1; pointers, instead of something like 'LPSTR' or 'char *'. As SEGPTR is
MyHeapBase = GlobalLock(MyHeapHandle); defined as a DWORD, you'll get a compilation warning if you mistakenly
HEAP_Init(&MyHeap, MyHeapBase, MY_HEAP_SIZE); use it as a regular 32-bit pointer.
return 0;
}
Memory blocks greater than 64 kilobytes in length must be allocated
using GlobalAlloc(). Because of our special memory mapping, GlobalLock()
cannot be used to obtain the address of a linearly accessible memory
block that is greater than 64kB in length. Instead GlobalLinearLock()
should be used. The inverse function GlobalLinearUnlock() must be
called before the block can be freed with GlobalFree().
API ENTRY POINTS: API ENTRY POINTS:
...@@ -69,7 +60,7 @@ documented in the file "tools/build-spec.txt". ...@@ -69,7 +60,7 @@ documented in the file "tools/build-spec.txt".
REGISTER FUNCTIONS: REGISTER FUNCTIONS:
Some functions are defined as type "register" in the DLL specification files. Some functions are defined as type "register" in the DLL specification files.
Inorder to return values in the registers to the WIN16 program, the handler In order to return values in the registers to the WIN16 program, the handler
function must exit by calling ReturnFromRegisterFunc(). Look at the function function must exit by calling ReturnFromRegisterFunc(). Look at the function
DOS3Call() for an example of how this works. DOS3Call() for an example of how this works.
......
...@@ -5,8 +5,8 @@ If you want to contribute code to Wine, read the DEVELOPER-HINTS. The ...@@ -5,8 +5,8 @@ If you want to contribute code to Wine, read the DEVELOPER-HINTS. The
primary source of information to developers is the ChangeLog (next to primary source of information to developers is the ChangeLog (next to
the source, of course). the source, of course).
1. make: No rule to make target xxx/xxx.o. Stop. 1. make: No rule to make target foo/foo.o. Stop.
This frequently happens when a prior attempt to make xxx.o failed. This frequently happens when a prior attempt to make foo.o failed.
In the current setup, make does not terminate then, but continues and In the current setup, make does not terminate then, but continues and
realises the problem later on. 'make' again and watch the output. Be realises the problem later on. 'make' again and watch the output. Be
sure to analyze the problem before you report it to the newsgroup. sure to analyze the problem before you report it to the newsgroup.
...@@ -26,4 +26,8 @@ to a trace file name. If your system supports another way of malloc ...@@ -26,4 +26,8 @@ to a trace file name. If your system supports another way of malloc
debugging, feel free to add it. debugging, feel free to add it.
Config file: Sets the Wine environment. See README for details. Config file: Sets the Wine environment. See README for details.
3. BAR.EXE used to work, but does not work anymore
Look at the ChangeLog to see what files have been changed. Try to undo
the particular patch and go partially back to the previous version. If
you have any suspicions, report them to the author or to the newsgroup.
...@@ -180,7 +180,7 @@ LONG ButtonWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam) ...@@ -180,7 +180,7 @@ LONG ButtonWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam)
break; break;
case WM_SETTEXT: case WM_SETTEXT:
DEFWND_SetText( hWnd, (LPSTR)lParam ); DEFWND_SetText( hWnd, (LPSTR)PTR_SEG_TO_LIN(lParam) );
PAINT_BUTTON( hWnd, style, ODA_DRAWENTIRE ); PAINT_BUTTON( hWnd, style, ODA_DRAWENTIRE );
return 0; return 0;
...@@ -306,7 +306,7 @@ static void PB_Paint( HWND hButton, HDC hDC, WORD action ) ...@@ -306,7 +306,7 @@ static void PB_Paint( HWND hButton, HDC hDC, WORD action )
else GRAPH_DrawReliefRect( hDC, &rc, 2, 2, FALSE ); else GRAPH_DrawReliefRect( hDC, &rc, 2, 2, FALSE );
/* draw button label, if any: */ /* draw button label, if any: */
text = USER_HEAP_ADDR( wndPtr->hText ); text = USER_HEAP_LIN_ADDR( wndPtr->hText );
if (text[0]) if (text[0])
{ {
SetTextColor( hDC, (wndPtr->dwStyle & WS_DISABLED) ? SetTextColor( hDC, (wndPtr->dwStyle & WS_DISABLED) ?
...@@ -356,7 +356,7 @@ static void CB_Paint( HWND hWnd, HDC hDC, WORD action ) ...@@ -356,7 +356,7 @@ static void CB_Paint( HWND hWnd, HDC hDC, WORD action )
GetTextMetrics(hDC, &tm); GetTextMetrics(hDC, &tm);
delta = (rc.bottom - rc.top - tm.tmHeight) >> 1; delta = (rc.bottom - rc.top - tm.tmHeight) >> 1;
text = USER_HEAP_ADDR( wndPtr->hText ); text = USER_HEAP_LIN_ADDR( wndPtr->hText );
textlen = strlen( text ); textlen = strlen( text );
/* Draw the check-box bitmap */ /* Draw the check-box bitmap */
...@@ -433,7 +433,7 @@ static void GB_Paint( HWND hWnd, HDC hDC, WORD action ) ...@@ -433,7 +433,7 @@ static void GB_Paint( HWND hWnd, HDC hDC, WORD action )
LineTo( hDC, rc.left, rc.bottom-1 ); LineTo( hDC, rc.left, rc.bottom-1 );
LineTo( hDC, rc.left, rc.top+2 ); LineTo( hDC, rc.left, rc.top+2 );
text = USER_HEAP_ADDR( wndPtr->hText ); text = USER_HEAP_LIN_ADDR( wndPtr->hText );
GetTextExtentPoint(hDC, text, strlen(text), &size); GetTextExtentPoint(hDC, text, strlen(text), &size);
rc.left += 10; rc.left += 10;
rc.right = rc.left + size.cx + 1; rc.right = rc.left + size.cx + 1;
...@@ -481,9 +481,8 @@ static void OB_Paint( HWND hWnd, HDC hDC, WORD action ) ...@@ -481,9 +481,8 @@ static void OB_Paint( HWND hWnd, HDC hDC, WORD action )
WND *wndPtr = WIN_FindWndPtr( hWnd ); WND *wndPtr = WIN_FindWndPtr( hWnd );
BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra; BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
if (!(hDis = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(DRAWITEMSTRUCT)))) if (!(hDis = USER_HEAP_ALLOC( sizeof(DRAWITEMSTRUCT) ))) return;
return; lpdis = (LPDRAWITEMSTRUCT)USER_HEAP_LIN_ADDR(hDis);
lpdis = (LPDRAWITEMSTRUCT)USER_HEAP_ADDR(hDis);
lpdis->CtlType = ODT_BUTTON; lpdis->CtlType = ODT_BUTTON;
lpdis->CtlID = wndPtr->wIDmenu; lpdis->CtlID = wndPtr->wIDmenu;
lpdis->itemID = 0; lpdis->itemID = 0;
...@@ -495,7 +494,7 @@ static void OB_Paint( HWND hWnd, HDC hDC, WORD action ) ...@@ -495,7 +494,7 @@ static void OB_Paint( HWND hWnd, HDC hDC, WORD action )
lpdis->hDC = hDC; lpdis->hDC = hDC;
GetClientRect( hWnd, &lpdis->rcItem ); GetClientRect( hWnd, &lpdis->rcItem );
lpdis->itemData = 0; lpdis->itemData = 0;
SendMessage(GetParent(hWnd), WM_DRAWITEM, 1, (LPARAM)lpdis); SendMessage(GetParent(hWnd), WM_DRAWITEM, 1, USER_HEAP_SEG_ADDR(hDis) );
USER_HEAP_FREE(hDis); USER_HEAP_FREE(hDis);
} }
......
...@@ -14,7 +14,6 @@ static char Copyright[] = "Copyright Martin Ayotte, 1993"; ...@@ -14,7 +14,6 @@ static char Copyright[] = "Copyright Martin Ayotte, 1993";
#include "windows.h" #include "windows.h"
#include "combo.h" #include "combo.h"
#include "user.h" #include "user.h"
#include "heap.h"
#include "win.h" #include "win.h"
#include "stddebug.h" #include "stddebug.h"
/* #define DEBUG_COMBO */ /* #define DEBUG_COMBO */
...@@ -40,10 +39,11 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -40,10 +39,11 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
LPHEADCOMBO lphc; LPHEADCOMBO lphc;
HDC hDC; HDC hDC;
BITMAP bm; BITMAP bm;
char str[128];
PAINTSTRUCT paintstruct; PAINTSTRUCT paintstruct;
LPDRAWITEMSTRUCT lpdis; LPDRAWITEMSTRUCT lpdis;
DWORD dwStyle; DWORD dwStyle;
HANDLE hStr;
switch(message) { switch(message) {
case WM_CREATE: case WM_CREATE:
wndPtr = WIN_FindWndPtr(hwnd); wndPtr = WIN_FindWndPtr(hwnd);
...@@ -95,7 +95,7 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -95,7 +95,7 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
lphc->hWndLBox = CreateWindow("LISTBOX", "", dwStyle, lphc->hWndLBox = CreateWindow("LISTBOX", "", dwStyle,
rect.left, rect.top + bm.bmHeight, rect.left, rect.top + bm.bmHeight,
width, height, wndPtr->hwndParent, 0, width, height, wndPtr->hwndParent, 0,
wndPtr->hInstance, (LPSTR)MAKELONG(0, hwnd)); wndPtr->hInstance, (SEGPTR)MAKELONG(0, hwnd));
ShowWindow(lphc->hWndLBox, SW_HIDE); ShowWindow(lphc->hWndLBox, SW_HIDE);
dprintf_combo(stddeb,"Combo Creation LBox=%X!\n", lphc->hWndLBox); dprintf_combo(stddeb,"Combo Creation LBox=%X!\n", lphc->hWndLBox);
return 0; return 0;
...@@ -126,15 +126,16 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -126,15 +126,16 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL || wndPtr == NULL) return 0; if (lphc == NULL || wndPtr == NULL) return 0;
if (LOWORD(lParam) == lphc->hWndLBox) { if (LOWORD(lParam) == lphc->hWndLBox) {
hStr = USER_HEAP_ALLOC( 256 );
switch(HIWORD(lParam)) { switch(HIWORD(lParam)) {
case LBN_SELCHANGE: case LBN_SELCHANGE:
lphc->dwState = lphc->dwState & (CB_SHOWDROPDOWN ^ 0xFFFFFFFFL); lphc->dwState = lphc->dwState & (CB_SHOWDROPDOWN ^ 0xFFFFFFFFL);
ShowWindow(lphc->hWndLBox, SW_HIDE); ShowWindow(lphc->hWndLBox, SW_HIDE);
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L); y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
if (y != LB_ERR) { if (y != LB_ERR) {
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str); SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, USER_HEAP_SEG_ADDR(hStr));
if (lphc->hWndEdit != 0) if (lphc->hWndEdit != 0)
SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str); SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, USER_HEAP_SEG_ADDR(hStr));
else { else {
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd); UpdateWindow(hwnd);
...@@ -148,6 +149,7 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -148,6 +149,7 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
MAKELONG(hwnd, CBN_DBLCLK)); MAKELONG(hwnd, CBN_DBLCLK));
break; break;
} }
USER_HEAP_FREE( hStr );
} }
break; break;
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
...@@ -174,9 +176,11 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -174,9 +176,11 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
dprintf_combo(stddeb,"before Combo List GetCurSel !\n"); dprintf_combo(stddeb,"before Combo List GetCurSel !\n");
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L); y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
if (y != LB_ERR) { if (y != LB_ERR) {
hStr = USER_HEAP_ALLOC( 256 );
dprintf_combo(stddeb,"before Combo List GetText !\n"); dprintf_combo(stddeb,"before Combo List GetText !\n");
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str); SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, USER_HEAP_SEG_ADDR(hStr));
SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str); SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, USER_HEAP_SEG_ADDR(hStr));
USER_HEAP_FREE( hStr );
} }
dprintf_combo(stddeb,"End of Combo List Hide !\n"); dprintf_combo(stddeb,"End of Combo List Hide !\n");
} }
...@@ -211,9 +215,11 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -211,9 +215,11 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
ShowWindow(lphc->hWndLBox, SW_HIDE); ShowWindow(lphc->hWndLBox, SW_HIDE);
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L); y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
if (y != LB_ERR) { if (y != LB_ERR) {
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str); hStr = USER_HEAP_ALLOC( 256 );
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, USER_HEAP_SEG_ADDR(hStr));
if (lphc->hWndEdit != 0) if (lphc->hWndEdit != 0)
SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str); SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, USER_HEAP_SEG_ADDR(hStr));
USER_HEAP_FREE( hStr );
} }
} }
} }
...@@ -236,11 +242,13 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -236,11 +242,13 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
if (y >= count) y = count - 1; if (y >= count) y = count - 1;
lphc->LastSel = y; lphc->LastSel = y;
SendMessage(lphc->hWndLBox, LB_SETCURSEL, y, 0L); SendMessage(lphc->hWndLBox, LB_SETCURSEL, y, 0L);
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str); hStr = USER_HEAP_ALLOC( 256 );
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, USER_HEAP_SEG_ADDR(hStr));
if (lphc->hWndEdit != 0) if (lphc->hWndEdit != 0)
SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str); SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, USER_HEAP_SEG_ADDR(hStr));
SendMessage(GetParent(hwnd), WM_COMMAND, wndPtr->wIDmenu, SendMessage(GetParent(hwnd), WM_COMMAND, wndPtr->wIDmenu,
MAKELONG(hwnd, CBN_SELCHANGE)); MAKELONG(hwnd, CBN_SELCHANGE));
USER_HEAP_FREE( hStr );
} }
break; break;
case WM_MEASUREITEM: case WM_MEASUREITEM:
...@@ -258,7 +266,7 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -258,7 +266,7 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
dprintf_combo(stddeb,"ComboBoxWndProc // WM_DRAWITEM w=%04X l=%08lX\n", wParam, lParam); dprintf_combo(stddeb,"ComboBoxWndProc // WM_DRAWITEM w=%04X l=%08lX\n", wParam, lParam);
wndPtr = WIN_FindWndPtr(hwnd); wndPtr = WIN_FindWndPtr(hwnd);
if (wndPtr == NULL) break; if (wndPtr == NULL) break;
lpdis = (LPDRAWITEMSTRUCT)lParam; lpdis = (LPDRAWITEMSTRUCT)PTR_SEG_TO_LIN(lParam);
if (lpdis == NULL) break; if (lpdis == NULL) break;
lpdis->CtlType = ODT_COMBOBOX; lpdis->CtlType = ODT_COMBOBOX;
lpdis->CtlID = wndPtr->wIDmenu; lpdis->CtlID = wndPtr->wIDmenu;
...@@ -299,13 +307,15 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -299,13 +307,15 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
ShowWindow(lphc->hWndLBox, SW_HIDE); ShowWindow(lphc->hWndLBox, SW_HIDE);
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L); y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
if (y != LB_ERR) { if (y != LB_ERR) {
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str); hStr = USER_HEAP_ALLOC( 256 );
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, USER_HEAP_SEG_ADDR(hStr));
if (lphc->hWndEdit != 0) if (lphc->hWndEdit != 0)
SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str); SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, USER_HEAP_SEG_ADDR(hStr));
USER_HEAP_FREE( hStr );
} }
break; break;
case CB_ADDSTRING: case CB_ADDSTRING:
dprintf_combo(stddeb,"CB_ADDSTRING '%s' !\n", (LPSTR)lParam); dprintf_combo(stddeb,"CB_ADDSTRING '%s' !\n", (LPSTR)PTR_SEG_TO_LIN(lParam));
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_ADDSTRING, wParam, lParam)); return(SendMessage(lphc->hWndLBox, LB_ADDSTRING, wParam, lParam));
...@@ -320,7 +330,7 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -320,7 +330,7 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_GETTEXTLEN, wParam, lParam)); return(SendMessage(lphc->hWndLBox, LB_GETTEXTLEN, wParam, lParam));
case CB_INSERTSTRING: case CB_INSERTSTRING:
dprintf_combo(stddeb,"CB_INSERTSTRING '%s' !\n",(LPSTR)lParam); dprintf_combo(stddeb,"CB_INSERTSTRING '%s' !\n",(LPSTR)PTR_SEG_TO_LIN(lParam));
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam)); return(SendMessage(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam));
...@@ -463,7 +473,6 @@ void ComboBoxStaticOwnerDraw(HWND hWnd, LPHEADCOMBO lphc) ...@@ -463,7 +473,6 @@ void ComboBoxStaticOwnerDraw(HWND hWnd, LPHEADCOMBO lphc)
HDC hDC; HDC hDC;
HBRUSH hBrush; HBRUSH hBrush;
short y; short y;
char str[64];
LPSTR ptr = NULL; LPSTR ptr = NULL;
HANDLE hTemp; HANDLE hTemp;
WND *wndPtr; WND *wndPtr;
...@@ -471,7 +480,6 @@ void ComboBoxStaticOwnerDraw(HWND hWnd, LPHEADCOMBO lphc) ...@@ -471,7 +480,6 @@ void ComboBoxStaticOwnerDraw(HWND hWnd, LPHEADCOMBO lphc)
dprintf_combo(stddeb,"ComboBoxStaticOwnerDraw(%04X, %p) !\n", hWnd, lphc); dprintf_combo(stddeb,"ComboBoxStaticOwnerDraw(%04X, %p) !\n", hWnd, lphc);
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L); y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
if (y != LB_ERR) { if (y != LB_ERR) {
SendMessage(lphc->hWndLBox, LB_GETTEXT, y, (LPARAM)str);
ptr = (LPSTR)SendMessage(lphc->hWndLBox, LB_GETITEMDATA, y, 0L); ptr = (LPSTR)SendMessage(lphc->hWndLBox, LB_GETITEMDATA, y, 0L);
} }
hDC = GetDC(hWnd); hDC = GetDC(hWnd);
...@@ -480,8 +488,8 @@ void ComboBoxStaticOwnerDraw(HWND hWnd, LPHEADCOMBO lphc) ...@@ -480,8 +488,8 @@ void ComboBoxStaticOwnerDraw(HWND hWnd, LPHEADCOMBO lphc)
if (hBrush == (HBRUSH)NULL) hBrush = GetStockObject(WHITE_BRUSH); if (hBrush == (HBRUSH)NULL) hBrush = GetStockObject(WHITE_BRUSH);
wndPtr = WIN_FindWndPtr(hWnd); wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr == NULL) return; if (wndPtr == NULL) return;
hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(DRAWITEMSTRUCT)); hTemp = USER_HEAP_ALLOC( sizeof(DRAWITEMSTRUCT) );
lpdis = (LPDRAWITEMSTRUCT) USER_HEAP_ADDR(hTemp); lpdis = (LPDRAWITEMSTRUCT) USER_HEAP_LIN_ADDR(hTemp);
if (lpdis == NULL) { if (lpdis == NULL) {
printf("ComboBox Ownerdraw // Error allocating DRAWITEMSTRUCT !\n"); printf("ComboBox Ownerdraw // Error allocating DRAWITEMSTRUCT !\n");
ReleaseDC( hWnd, hDC ); ReleaseDC( hWnd, hDC );
...@@ -495,7 +503,7 @@ void ComboBoxStaticOwnerDraw(HWND hWnd, LPHEADCOMBO lphc) ...@@ -495,7 +503,7 @@ void ComboBoxStaticOwnerDraw(HWND hWnd, LPHEADCOMBO lphc)
lpdis->itemAction = ODA_DRAWENTIRE; lpdis->itemAction = ODA_DRAWENTIRE;
lpdis->CtlType = ODT_COMBOBOX; lpdis->CtlType = ODT_COMBOBOX;
lpdis->CtlID = wndPtr->wIDmenu; lpdis->CtlID = wndPtr->wIDmenu;
SendMessage(GetParent(hWnd), WM_DRAWITEM, y, (LPARAM)lpdis); SendMessage(GetParent(hWnd), WM_DRAWITEM, y,USER_HEAP_SEG_ADDR(hTemp));
USER_HEAP_FREE(hTemp); USER_HEAP_FREE(hTemp);
ReleaseDC(hWnd, hDC); ReleaseDC(hWnd, hDC);
} }
...@@ -515,13 +523,13 @@ BOOL DlgDirSelectComboBox(HWND hDlg, LPSTR lpStr, int nIDLBox) ...@@ -515,13 +523,13 @@ BOOL DlgDirSelectComboBox(HWND hDlg, LPSTR lpStr, int nIDLBox)
/************************************************************************ /************************************************************************
* DlgDirListComboBox [USER.195] * DlgDirListComboBox [USER.195]
*/ */
int DlgDirListComboBox(HWND hDlg, LPSTR lpPathSpec, int DlgDirListComboBox(HWND hDlg, SEGPTR lpPathSpec,
int nIDLBox, int nIDStat, WORD wType) int nIDLBox, int nIDStat, WORD wType)
{ {
HWND hWnd; HWND hWnd;
LPHEADCOMBO lphc; LPHEADCOMBO lphc;
dprintf_combo(stddeb,"DlgDirListComboBox(%04X, '%s', %d, %d, %04X) \n", dprintf_combo(stddeb,"DlgDirListComboBox(%04X, '%s', %d, %d, %04X) \n",
hDlg, lpPathSpec, nIDLBox, nIDStat, wType); hDlg, (char *)PTR_SEG_TO_LIN(lpPathSpec), nIDLBox, nIDStat, wType);
hWnd = GetDlgItem(hDlg, nIDLBox); hWnd = GetDlgItem(hDlg, nIDLBox);
lphc = ComboGetStorageHeader(hWnd); lphc = ComboGetStorageHeader(hWnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
......
...@@ -12,7 +12,7 @@ static char Copyright[] = "Copyright David W. Metcalfe, 1994"; ...@@ -12,7 +12,7 @@ static char Copyright[] = "Copyright David W. Metcalfe, 1994";
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <windows.h> #include <windows.h>
#include <heap.h> #include "local.h"
#include "win.h" #include "win.h"
#include "class.h" #include "class.h"
#include "user.h" #include "user.h"
...@@ -231,7 +231,7 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam) ...@@ -231,7 +231,7 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam)
break; break;
case EM_GETRECT: case EM_GETRECT:
GetWindowRect(hwnd, (LPRECT)lParam); GetWindowRect(hwnd, (LPRECT)PTR_SEG_TO_LIN(lParam));
break; break;
case EM_GETSEL: case EM_GETSEL:
...@@ -359,7 +359,7 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam) ...@@ -359,7 +359,7 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam)
textPtr = EDIT_HeapAddr(hwnd, es->hText); textPtr = EDIT_HeapAddr(hwnd, es->hText);
if ((int)wParam > (len = strlen(textPtr))) if ((int)wParam > (len = strlen(textPtr)))
{ {
strcpy((char *)lParam, textPtr); strcpy((char *)PTR_SEG_TO_LIN(lParam), textPtr);
lResult = (DWORD)len ; lResult = (DWORD)len ;
} }
else else
...@@ -469,7 +469,7 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam) ...@@ -469,7 +469,7 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam)
long EDIT_NCCreateMsg(HWND hwnd, LONG lParam) long EDIT_NCCreateMsg(HWND hwnd, LONG lParam)
{ {
CREATESTRUCT *createStruct = (CREATESTRUCT *)lParam; CREATESTRUCT *createStruct = (CREATESTRUCT *)PTR_SEG_TO_LIN(lParam);
WND *wndPtr = WIN_FindWndPtr(hwnd); WND *wndPtr = WIN_FindWndPtr(hwnd);
EDITSTATE *es; EDITSTATE *es;
unsigned int *textPtrs; unsigned int *textPtrs;
...@@ -477,6 +477,7 @@ long EDIT_NCCreateMsg(HWND hwnd, LONG lParam) ...@@ -477,6 +477,7 @@ long EDIT_NCCreateMsg(HWND hwnd, LONG lParam)
/* store pointer to local or global heap in window structure so that */ /* store pointer to local or global heap in window structure so that */
/* EDITSTATE structure itself can be stored on local heap */ /* EDITSTATE structure itself can be stored on local heap */
#if 0
if (HEAP_LocalFindHeap(createStruct->hInstance)!=NULL) if (HEAP_LocalFindHeap(createStruct->hInstance)!=NULL)
(MDESC **)*(LONG *)(wndPtr->wExtra + 2) = (MDESC **)*(LONG *)(wndPtr->wExtra + 2) =
&HEAP_LocalFindHeap(createStruct->hInstance)->free_list; &HEAP_LocalFindHeap(createStruct->hInstance)->free_list;
...@@ -486,6 +487,7 @@ long EDIT_NCCreateMsg(HWND hwnd, LONG lParam) ...@@ -486,6 +487,7 @@ long EDIT_NCCreateMsg(HWND hwnd, LONG lParam)
GlobalLock(createStruct->hInstance); GlobalLock(createStruct->hInstance);
/* GlobalUnlock(createStruct->hInstance); */ /* GlobalUnlock(createStruct->hInstance); */
} }
#endif
/* allocate space for state variable structure */ /* allocate space for state variable structure */
(HANDLE)(*(wndPtr->wExtra)) = EDIT_HeapAlloc(hwnd, sizeof(EDITSTATE)); (HANDLE)(*(wndPtr->wExtra)) = EDIT_HeapAlloc(hwnd, sizeof(EDITSTATE));
es = (EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra))); es = (EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra)));
...@@ -507,21 +509,21 @@ long EDIT_NCCreateMsg(HWND hwnd, LONG lParam) ...@@ -507,21 +509,21 @@ long EDIT_NCCreateMsg(HWND hwnd, LONG lParam)
} }
else else
{ {
if (strlen(createStruct->lpszName) < EditBufLen(wndPtr)) char *windowName = (char *)PTR_SEG_TO_LIN( createStruct->lpszName );
if (strlen(windowName) < EditBufLen(wndPtr))
{ {
es->textlen = EditBufLen(wndPtr) + 1; es->textlen = EditBufLen(wndPtr) + 1;
es->hText = EDIT_HeapAlloc(hwnd, EditBufLen(wndPtr) + 2); es->hText = EDIT_HeapAlloc(hwnd, EditBufLen(wndPtr) + 2);
text = EDIT_HeapAddr(hwnd, es->hText); text = EDIT_HeapAddr(hwnd, es->hText);
strcpy(text, createStruct->lpszName); strcpy(text, windowName);
*(text + es->textlen) = '\0'; *(text + es->textlen) = '\0';
} }
else else
{ {
es->hText = EDIT_HeapAlloc(hwnd, es->hText = EDIT_HeapAlloc(hwnd, strlen(windowName) + 2);
strlen(createStruct->lpszName) + 2);
text = EDIT_HeapAddr(hwnd, es->hText); text = EDIT_HeapAddr(hwnd, es->hText);
strcpy(text, createStruct->lpszName); strcpy(text, windowName);
es->textlen = strlen(createStruct->lpszName) + 1; es->textlen = strlen(windowName) + 1;
} }
*(text + es->textlen + 1) = '\0'; *(text + es->textlen + 1) = '\0';
EDIT_BuildTextPointers(hwnd); EDIT_BuildTextPointers(hwnd);
...@@ -998,7 +1000,7 @@ void EDIT_WriteText(HWND hwnd, char *lp, int off, int len, int row, ...@@ -998,7 +1000,7 @@ void EDIT_WriteText(HWND hwnd, char *lp, int off, int len, int row,
HDC hdc; HDC hdc;
HANDLE hStr; HANDLE hStr;
char *str, *cp, *cp1; char *str, *cp, *cp1;
int diff, num_spaces, tabwidth, scol; int diff=0, num_spaces, tabwidth, scol;
HRGN hrgnClip; HRGN hrgnClip;
COLORREF oldTextColor, oldBkgdColor; COLORREF oldTextColor, oldBkgdColor;
HFONT oldfont; HFONT oldfont;
...@@ -1010,6 +1012,12 @@ void EDIT_WriteText(HWND hwnd, char *lp, int off, int len, int row, ...@@ -1010,6 +1012,12 @@ void EDIT_WriteText(HWND hwnd, char *lp, int off, int len, int row,
dprintf_edit(stddeb,"EDIT_WriteText lp=%s, off=%d, len=%d, row=%d, col=%d, reverse=%d\n", lp, off, len, row, col, reverse); dprintf_edit(stddeb,"EDIT_WriteText lp=%s, off=%d, len=%d, row=%d, col=%d, reverse=%d\n", lp, off, len, row, col, reverse);
if( off < 0 ) {
len += off;
col -= off;
off = 0;
}
hdc = GetDC(hwnd); hdc = GetDC(hwnd);
hStr = EDIT_GetStr(hwnd, lp, off, len, &diff); hStr = EDIT_GetStr(hwnd, lp, off, len, &diff);
str = (char *)EDIT_HeapAddr(hwnd, hStr); str = (char *)EDIT_HeapAddr(hwnd, hStr);
...@@ -1166,7 +1174,7 @@ void EDIT_CharMsg(HWND hwnd, WORD wParam) ...@@ -1166,7 +1174,7 @@ void EDIT_CharMsg(HWND hwnd, WORD wParam)
break; break;
default: default:
if (wParam >= 20 && wParam <= 126) if (wParam >= 20 && wParam <= 254 && wParam != 127 )
EDIT_KeyTyped(hwnd, wParam); EDIT_KeyTyped(hwnd, wParam);
break; break;
} }
...@@ -2232,15 +2240,15 @@ LONG EDIT_SetTextMsg(HWND hwnd, LONG lParam) ...@@ -2232,15 +2240,15 @@ LONG EDIT_SetTextMsg(HWND hwnd, LONG lParam)
EDITSTATE *es = EDITSTATE *es =
(EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra))); (EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra)));
if (strlen((char *)lParam) <= es->MaxTextLen) if (strlen((char *)PTR_SEG_TO_LIN(lParam)) <= es->MaxTextLen)
{ {
len = ( lParam? strlen((char *)lParam) : 0 ); len = ( lParam? strlen((char *)PTR_SEG_TO_LIN(lParam)) : 0 );
EDIT_ClearText(hwnd); EDIT_ClearText(hwnd);
es->textlen = len; es->textlen = len;
es->hText = EDIT_HeapReAlloc(hwnd, es->hText, len + 3); es->hText = EDIT_HeapReAlloc(hwnd, es->hText, len + 3);
text = EDIT_HeapAddr(hwnd, es->hText); text = EDIT_HeapAddr(hwnd, es->hText);
if (lParam) if (lParam)
strcpy(text, (char *)lParam); strcpy(text, (char *)PTR_SEG_TO_LIN(lParam));
text[len] = '\0'; text[len] = '\0';
text[len + 1] = '\0'; text[len + 1] = '\0';
text[len + 2] = '\0'; text[len + 2] = '\0';
...@@ -2392,7 +2400,7 @@ void EDIT_GetLineCol(HWND hwnd, int off, int *line, int *col) ...@@ -2392,7 +2400,7 @@ void EDIT_GetLineCol(HWND hwnd, int off, int *line, int *col)
(unsigned int *)EDIT_HeapAddr(hwnd, es->hTextPtrs); (unsigned int *)EDIT_HeapAddr(hwnd, es->hTextPtrs);
/* check for (0,0) */ /* check for (0,0) */
if (!off) if (!off || !es->wlines)
{ {
*line = 0; *line = 0;
*col = 0; *col = 0;
...@@ -2739,7 +2747,8 @@ LONG EDIT_GetSelMsg(HWND hwnd) ...@@ -2739,7 +2747,8 @@ LONG EDIT_GetSelMsg(HWND hwnd)
void EDIT_ReplaceSel(HWND hwnd, LONG lParam) void EDIT_ReplaceSel(HWND hwnd, LONG lParam)
{ {
EDIT_DeleteSel(hwnd); EDIT_DeleteSel(hwnd);
EDIT_InsertText(hwnd, (char *)lParam, strlen((char *)lParam)); EDIT_InsertText(hwnd, (char *)PTR_SEG_TO_LIN(lParam),
strlen((char *)PTR_SEG_TO_LIN(lParam)));
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd); UpdateWindow(hwnd);
} }
...@@ -3000,9 +3009,8 @@ unsigned int EDIT_HeapAlloc(HWND hwnd, int bytes) ...@@ -3000,9 +3009,8 @@ unsigned int EDIT_HeapAlloc(HWND hwnd, int bytes)
{ {
WND *wndPtr = WIN_FindWndPtr(hwnd); WND *wndPtr = WIN_FindWndPtr(hwnd);
unsigned int ret; unsigned int ret;
ret = ((unsigned int)HEAP_Alloc((MDESC **)
*(LONG *)(wndPtr->wExtra + 2), ret = LOCAL_Alloc( wndPtr->hInstance, LMEM_FIXED, bytes );
GMEM_MOVEABLE, bytes) & 0xffff);
if (ret == 0) if (ret == 0)
printf("EDIT_HeapAlloc: Out of heap-memory\n"); printf("EDIT_HeapAlloc: Out of heap-memory\n");
return ret; return ret;
...@@ -3018,10 +3026,7 @@ unsigned int EDIT_HeapAlloc(HWND hwnd, int bytes) ...@@ -3018,10 +3026,7 @@ unsigned int EDIT_HeapAlloc(HWND hwnd, int bytes)
void *EDIT_HeapAddr(HWND hwnd, unsigned int handle) void *EDIT_HeapAddr(HWND hwnd, unsigned int handle)
{ {
WND *wndPtr = WIN_FindWndPtr(hwnd); WND *wndPtr = WIN_FindWndPtr(hwnd);
return handle ? PTR_SEG_OFF_TO_LIN( wndPtr->hInstance, handle ) : 0;
return ((void *)((handle) ? ((handle) | ((unsigned int)
(*(MDESC **)*(LONG *)(wndPtr->wExtra + 2))
& 0xffff0000)) : 0));
} }
...@@ -3035,10 +3040,7 @@ unsigned int EDIT_HeapReAlloc(HWND hwnd, unsigned int handle, int bytes) ...@@ -3035,10 +3040,7 @@ unsigned int EDIT_HeapReAlloc(HWND hwnd, unsigned int handle, int bytes)
{ {
WND *wndPtr = WIN_FindWndPtr(hwnd); WND *wndPtr = WIN_FindWndPtr(hwnd);
return ((unsigned int)HEAP_ReAlloc((MDESC **) return LOCAL_ReAlloc( wndPtr->hInstance, handle, bytes, LMEM_FIXED );
*(LONG *)(wndPtr->wExtra + 2),
EDIT_HeapAddr(hwnd, handle),
bytes, GMEM_MOVEABLE) & 0xffff);
} }
...@@ -3052,8 +3054,7 @@ void EDIT_HeapFree(HWND hwnd, unsigned int handle) ...@@ -3052,8 +3054,7 @@ void EDIT_HeapFree(HWND hwnd, unsigned int handle)
{ {
WND *wndPtr = WIN_FindWndPtr(hwnd); WND *wndPtr = WIN_FindWndPtr(hwnd);
HEAP_Free((MDESC **)*(LONG *)(wndPtr->wExtra + 2), LOCAL_Free( wndPtr->hInstance, handle );
EDIT_HeapAddr(hwnd, handle));
} }
...@@ -3067,7 +3068,10 @@ unsigned int EDIT_HeapSize(HWND hwnd, unsigned int handle) ...@@ -3067,7 +3068,10 @@ unsigned int EDIT_HeapSize(HWND hwnd, unsigned int handle)
{ {
WND *wndPtr = WIN_FindWndPtr(hwnd); WND *wndPtr = WIN_FindWndPtr(hwnd);
#if 0
return HEAP_LocalSize((MDESC **)*(LONG *)(wndPtr->wExtra + 2), handle); return HEAP_LocalSize((MDESC **)*(LONG *)(wndPtr->wExtra + 2), handle);
#endif
return LOCAL_Size( wndPtr->hInstance, handle );
} }
......
...@@ -109,9 +109,9 @@ static SCROLLINFO *SCROLL_GetScrollInfo( HWND hwnd, int nBar ) ...@@ -109,9 +109,9 @@ static SCROLLINFO *SCROLL_GetScrollInfo( HWND hwnd, int nBar )
if (!handle) /* Create the info structure if needed */ if (!handle) /* Create the info structure if needed */
{ {
if ((handle = USER_HEAP_ALLOC( GMEM_MOVEABLE, sizeof(SCROLLINFO) ))) if ((handle = USER_HEAP_ALLOC( sizeof(SCROLLINFO) )))
{ {
SCROLLINFO *infoPtr = (SCROLLINFO *) USER_HEAP_ADDR( handle ); SCROLLINFO *infoPtr = (SCROLLINFO *) USER_HEAP_LIN_ADDR( handle );
infoPtr->MinVal = infoPtr->CurVal = 0; infoPtr->MinVal = infoPtr->CurVal = 0;
infoPtr->MaxVal = 100; infoPtr->MaxVal = 100;
infoPtr->flags = ESB_ENABLE_BOTH; infoPtr->flags = ESB_ENABLE_BOTH;
...@@ -120,7 +120,7 @@ static SCROLLINFO *SCROLL_GetScrollInfo( HWND hwnd, int nBar ) ...@@ -120,7 +120,7 @@ static SCROLLINFO *SCROLL_GetScrollInfo( HWND hwnd, int nBar )
} }
if (!hUpArrow) SCROLL_LoadBitmaps(); if (!hUpArrow) SCROLL_LoadBitmaps();
} }
return (SCROLLINFO *) USER_HEAP_ADDR( handle ); return (SCROLLINFO *) USER_HEAP_LIN_ADDR( handle );
} }
...@@ -204,7 +204,7 @@ static BOOL SCROLL_GetScrollBarRect( HWND hwnd, int nBar, RECT *lprect, ...@@ -204,7 +204,7 @@ static BOOL SCROLL_GetScrollBarRect( HWND hwnd, int nBar, RECT *lprect,
* from the top of the scroll-bar. * from the top of the scroll-bar.
*/ */
static UINT SCROLL_GetThumbVal( SCROLLINFO *infoPtr, RECT *rect, static UINT SCROLL_GetThumbVal( SCROLLINFO *infoPtr, RECT *rect,
WORD arrowSize, BOOL vertical, WORD pos ) BOOL vertical, WORD pos )
{ {
int pixels = vertical ? rect->bottom-rect->top : rect->right-rect->left; int pixels = vertical ? rect->bottom-rect->top : rect->right-rect->left;
if ((pixels -= 3*SYSMETRICS_CXVSCROLL+1) <= 0) return infoPtr->MinVal; if ((pixels -= 3*SYSMETRICS_CXVSCROLL+1) <= 0) return infoPtr->MinVal;
...@@ -631,7 +631,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt ) ...@@ -631,7 +631,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt )
SCROLL_DrawMovingThumb( hdc, &rect, vertical, arrowSize, SCROLL_DrawMovingThumb( hdc, &rect, vertical, arrowSize,
trackThumbPos + pos - lastClickPos ); trackThumbPos + pos - lastClickPos );
lastMousePos = pos; lastMousePos = pos;
val = SCROLL_GetThumbVal( infoPtr, &rect, vertical, arrowSize, val = SCROLL_GetThumbVal( infoPtr, &rect, vertical,
trackThumbPos + lastMousePos - lastClickPos ); trackThumbPos + lastMousePos - lastClickPos );
SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
SB_THUMBTRACK, MAKELONG( val, hwndCtl )); SB_THUMBTRACK, MAKELONG( val, hwndCtl ));
...@@ -673,7 +673,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt ) ...@@ -673,7 +673,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt )
{ {
if (trackHitTest == SCROLL_THUMB) if (trackHitTest == SCROLL_THUMB)
{ {
UINT val = SCROLL_GetThumbVal( infoPtr, &rect, vertical, arrowSize, UINT val = SCROLL_GetThumbVal( infoPtr, &rect, vertical,
trackThumbPos + lastMousePos - lastClickPos ); trackThumbPos + lastMousePos - lastClickPos );
SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
SB_THUMBPOSITION, MAKELONG( val, hwndCtl ) ); SB_THUMBPOSITION, MAKELONG( val, hwndCtl ) );
...@@ -697,7 +697,7 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -697,7 +697,7 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
{ {
case WM_CREATE: case WM_CREATE:
{ {
CREATESTRUCT *lpCreat = (CREATESTRUCT *)lParam; CREATESTRUCT *lpCreat = (CREATESTRUCT *)PTR_SEG_TO_LIN(lParam);
if (lpCreat->style & SBS_SIZEBOX) if (lpCreat->style & SBS_SIZEBOX)
{ {
fprintf( stdnimp, "Unimplemented style SBS_SIZEBOX.\n" ); fprintf( stdnimp, "Unimplemented style SBS_SIZEBOX.\n" );
......
...@@ -88,10 +88,10 @@ LONG StaticWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam) ...@@ -88,10 +88,10 @@ LONG StaticWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam)
case WM_NCCREATE: case WM_NCCREATE:
if (style == SS_ICON) if (style == SS_ICON)
{ {
CREATESTRUCT * createStruct = (CREATESTRUCT *)lParam; CREATESTRUCT * createStruct = (CREATESTRUCT *)PTR_SEG_TO_LIN(lParam);
if (createStruct->lpszName) if (createStruct->lpszName)
STATIC_SetIcon( hWnd, LoadIcon( createStruct->hInstance, STATIC_SetIcon( hWnd, LoadIcon( createStruct->hInstance,
createStruct->lpszName )); (SEGPTR)createStruct->lpszName ));
return 1; return 1;
} }
return DefWindowProc(hWnd, uMsg, wParam, lParam); return DefWindowProc(hWnd, uMsg, wParam, lParam);
...@@ -136,9 +136,9 @@ LONG StaticWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam) ...@@ -136,9 +136,9 @@ LONG StaticWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam)
case WM_SETTEXT: case WM_SETTEXT:
if (style == SS_ICON) if (style == SS_ICON)
STATIC_SetIcon( hWnd, LoadIcon( wndPtr->hInstance, STATIC_SetIcon( hWnd, LoadIcon( wndPtr->hInstance,
(LPSTR)lParam ) ); (SEGPTR)lParam ));
else else
DEFWND_SetText( hWnd, (LPSTR)lParam ); DEFWND_SetText( hWnd, (LPSTR)PTR_SEG_TO_LIN(lParam) );
InvalidateRect( hWnd, NULL, FALSE ); InvalidateRect( hWnd, NULL, FALSE );
UpdateWindow( hWnd ); UpdateWindow( hWnd );
break; break;
...@@ -192,7 +192,7 @@ static void PaintTextfn( HWND hwnd, HDC hdc ) ...@@ -192,7 +192,7 @@ static void PaintTextfn( HWND hwnd, HDC hdc )
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra; STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
GetClientRect(hwnd, &rc); GetClientRect(hwnd, &rc);
text = USER_HEAP_ADDR( wndPtr->hText ); text = USER_HEAP_LIN_ADDR( wndPtr->hText );
switch (style & 0x0000000F) switch (style & 0x0000000F)
{ {
......
...@@ -13,6 +13,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993"; ...@@ -13,6 +13,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "desktop.h" #include "desktop.h"
#include "mdi.h" #include "mdi.h"
#include "gdi.h" #include "gdi.h"
#include "user.h"
LONG ListBoxWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam ); LONG ListBoxWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
LONG ComboBoxWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam ); LONG ComboBoxWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
...@@ -34,7 +35,7 @@ static WNDCLASS WIDGETS_BuiltinClasses[] = ...@@ -34,7 +35,7 @@ static WNDCLASS WIDGETS_BuiltinClasses[] =
0, 0, 0, 0, NULL, "LISTBOX" }, 0, 0, 0, 0, NULL, "LISTBOX" },
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS, ComboBoxWndProc, 0, 8, { CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS, ComboBoxWndProc, 0, 8,
0, 0, 0, 0, NULL, "COMBOBOX" }, 0, 0, 0, 0, NULL, "COMBOBOX" },
{ CS_GLOBALCLASS | CS_PARENTDC, EditWndProc, 0, 4, { CS_GLOBALCLASS | CS_PARENTDC, EditWndProc, 0, sizeof(WORD),
0, 0, 0, 0, NULL, "EDIT" }, 0, 0, 0, 0, NULL, "EDIT" },
{ CS_GLOBALCLASS | CS_SAVEBITS, PopupMenuWndProc, 0, 8, { CS_GLOBALCLASS | CS_SAVEBITS, PopupMenuWndProc, 0, 8,
0, 0, 0, 0, NULL, POPUPMENU_CLASS_NAME }, 0, 0, 0, 0, NULL, POPUPMENU_CLASS_NAME },
...@@ -58,12 +59,19 @@ static WNDCLASS WIDGETS_BuiltinClasses[] = ...@@ -58,12 +59,19 @@ static WNDCLASS WIDGETS_BuiltinClasses[] =
BOOL WIDGETS_Init(void) BOOL WIDGETS_Init(void)
{ {
int i; int i;
HANDLE hName;
char *name;
WNDCLASS *class = WIDGETS_BuiltinClasses; WNDCLASS *class = WIDGETS_BuiltinClasses;
if (!(hName = USER_HEAP_ALLOC( 20 ))) return FALSE;
name = USER_HEAP_LIN_ADDR( hName );
for (i = 0; i < NB_BUILTIN_CLASSES; i++, class++) for (i = 0; i < NB_BUILTIN_CLASSES; i++, class++)
{ {
strcpy( name, class->lpszClassName );
class->lpszClassName = (LPSTR)USER_HEAP_SEG_ADDR( hName );
class->hCursor = LoadCursor( 0, IDC_ARROW ); class->hCursor = LoadCursor( 0, IDC_ARROW );
if (!RegisterClass( class )) return FALSE; if (!RegisterClass( class )) return FALSE;
} }
USER_HEAP_FREE( hName );
return TRUE; return TRUE;
} }
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <sys/utsname.h> #include <sys/utsname.h>
#endif #endif
#include <windows.h> #include <windows.h>
#include "db_disasm.h"
#define N_BP 25 #define N_BP 25
...@@ -140,7 +141,7 @@ void toggle_next(int num) ...@@ -140,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=addr+print_insn(addr,addr,stderr,dbg_mode); wbp[num].next_addr = db_disasm( addr, 0, (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;
} }
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
#endif #endif
#include <stdio.h> #include <stdio.h>
#include "db_disasm.h" #include "db_disasm.h"
#include "ldt.h"
/* /*
* Switch to disassemble 16-bit code. * Switch to disassemble 16-bit code.
...@@ -888,9 +889,10 @@ static int db_lengths[] = { ...@@ -888,9 +889,10 @@ static int db_lengths[] = {
10, /* EXTR */ 10, /* EXTR */
}; };
unsigned int db_get_task_value(unsigned int loc, int size, int is_signed) static unsigned int db_get_task_value(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);
switch(size) switch(size)
{ {
case 4: case 4:
...@@ -921,7 +923,8 @@ unsigned int db_get_task_value(unsigned int loc, int size, int is_signed) ...@@ -921,7 +923,8 @@ unsigned int db_get_task_value(unsigned int loc, int size, int is_signed)
#define get_value_inc(result, loc, size, is_signed) \ #define get_value_inc(result, loc, size, is_signed) \
result = db_get_task_value((loc), (size), (is_signed)); \ result = db_get_task_value((loc), (size), (is_signed)); \
(loc) += (size); if (!db_disasm_16) (loc) += (size); \
else (loc) = ((loc) & 0xffff0000) | (((loc) + (size)) & 0xffff);
/* /*
* Read address at location and return updated location. * Read address at location and return updated location.
...@@ -1011,6 +1014,23 @@ db_read_address(loc, short_addr, regmodrm, addrp) ...@@ -1011,6 +1014,23 @@ db_read_address(loc, short_addr, regmodrm, addrp)
return (loc); return (loc);
} }
static void db_task_printsym(unsigned int addr, int size)
{
extern void print_address(unsigned int addr, FILE * outfile, int addrlen);
switch(size)
{
case BYTE:
fprintf(stderr, "0x%2.2x", addr & 0xff );
break;
case WORD:
fprintf(stderr, "0x%4.4x", addr & 0xffff );
break;
case LONG:
print_address(addr, stderr, db_disasm_16 ? 16 : 32);
break;
}
}
void void
db_print_address(seg, size, addrp) db_print_address(seg, size, addrp)
char * seg; char * seg;
...@@ -1035,7 +1055,7 @@ db_print_address(seg, size, addrp) ...@@ -1035,7 +1055,7 @@ db_print_address(seg, size, addrp)
fprintf(stderr,",%s,%d", addrp->index, 1<<addrp->ss); fprintf(stderr,",%s,%d", addrp->index, 1<<addrp->ss);
fprintf(stderr,")"); fprintf(stderr,")");
} else } else
db_task_printsym((db_addr_t)addrp->disp); db_task_printsym((db_addr_t)addrp->disp, size);
} }
/* /*
...@@ -1418,7 +1438,8 @@ db_disasm(loc, altfmt, flag16) ...@@ -1418,7 +1438,8 @@ db_disasm(loc, altfmt, flag16)
if (seg) if (seg)
fprintf(stderr,"%s:%d",seg, displ); fprintf(stderr,"%s:%d",seg, displ);
else else
db_task_printsym((db_addr_t)displ); db_task_printsym((db_addr_t)displ,
short_addr ? WORD : LONG);
break; break;
case Db: case Db:
...@@ -1430,7 +1451,8 @@ db_disasm(loc, altfmt, flag16) ...@@ -1430,7 +1451,8 @@ db_disasm(loc, altfmt, flag16)
} }
else else
displ = displ + loc; displ = displ + loc;
db_task_printsym((db_addr_t)displ); db_task_printsym((db_addr_t)displ,
short_addr ? WORD : LONG);
break; break;
case Dl: case Dl:
...@@ -1444,7 +1466,8 @@ db_disasm(loc, altfmt, flag16) ...@@ -1444,7 +1466,8 @@ db_disasm(loc, altfmt, flag16)
get_value_inc(displ, loc, 4, TRUE); get_value_inc(displ, loc, 4, TRUE);
displ = displ + loc; displ = displ + loc;
} }
db_task_printsym((db_addr_t)displ); db_task_printsym((db_addr_t)displ,
short_addr ? WORD : LONG);
break; break;
case o1: case o1:
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <stdio.h> #include <stdio.h>
#include <signal.h> #include <signal.h>
#include "ldt.h"
#define YYSTYPE int #define YYSTYPE int
...@@ -116,8 +117,8 @@ print: ...@@ -116,8 +117,8 @@ print:
infocmd: INFO REGS { info_reg(); } infocmd: INFO REGS { info_reg(); }
| INFO STACK { info_stack(); } | INFO STACK { info_stack(); }
| INFO SEGMENTS { LDT_Print(); }
| INFO BREAK { info_break(); } | INFO BREAK { info_break(); }
| INFO SEGMENTS { print_ldt(); }
%% %%
...@@ -197,7 +198,7 @@ wine_debug(int signal, int * regs) ...@@ -197,7 +198,7 @@ wine_debug(int signal, int * regs)
int bpnum; int bpnum;
addr = SC_EIP(dbg_mask); addr = SC_EIP(dbg_mask);
if((addr & 0xffff0000) == 0 && dbg_mode == 16) if((addr & 0xffff0000) == 0 && dbg_mode == 16)
addr |= SC_CS << 16; 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;
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <neexe.h> #include <neexe.h>
#include <segmem.h>
#include "selectors.h" #include "selectors.h"
#include <wine.h> #include <wine.h>
#include <dlls.h> #include <dlls.h>
...@@ -168,7 +167,7 @@ load_entrypoints(){ ...@@ -168,7 +167,7 @@ load_entrypoints(){
j = GetEntryPointFromOrdinal(wpnt, ordinal); j = GetEntryPointFromOrdinal(wpnt, ordinal);
address = j & 0xffff; address = j & 0xffff;
j = j >> 16; j = j >> 16;
address |= (wpnt->ne->selector_table[j].selector) << 16; address |= wpnt->ne->selector_table[j] << 16;
fprintf(stderr,"%s -> %x\n", buffer, address); fprintf(stderr,"%s -> %x\n", buffer, address);
add_hash(buffer, (unsigned int *) address); add_hash(buffer, (unsigned int *) address);
cpnt += len + 2; cpnt += len + 2;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "ldt.h"
#include "db_disasm.h" #include "db_disasm.h"
#include "regpos.h" #include "regpos.h"
...@@ -18,60 +19,24 @@ void application_not_running() ...@@ -18,60 +19,24 @@ void application_not_running()
fprintf(stderr,"Application not running\n"); fprintf(stderr,"Application not running\n");
} }
void print_address(unsigned int addr, FILE * outfile){ void print_address(unsigned int addr, FILE * outfile, int addrlen)
char * name; {
if (addrlen == 16)
{
fprintf( outfile, "%4.4x:%4.4x", addr >> 16, addr & 0xffff );
}
else
{
extern char * find_nearest_symbol(unsigned int *); extern char * find_nearest_symbol(unsigned int *);
name = find_nearest_symbol((unsigned int *) addr); char * name = find_nearest_symbol((unsigned int *) addr);
if(name) if(name)
fprintf(outfile,"0x%8.8x(%s)", addr, name); fprintf(outfile,"0x%8.8x(%s)", addr, name);
else else
fprintf(outfile,"0x%8.8x", addr); fprintf(outfile,"0x%8.8x", addr);
}
#ifdef GNU_DISASM
void print_address_info(bfd_vma addr, disassemble_info * info){
print_address((unsigned int) addr, info->stream);
}
int print_insn(char *realmemaddr, char *memaddr, FILE *stream, int addrlen){
static disassemble_info info;
static int initialized = 0;
if (!initialized) {
INIT_DISASSEMBLE_INFO(info, stderr);
info.print_address_func = print_address_info;
initialized = 1;
} }
info.stream = stream;
info.buffer = memaddr;
info.buffer_vma = (bfd_vma) realmemaddr;
info.buffer_length = 1024;
if (addrlen == 16)
return print_insn_i286((bfd_vma) realmemaddr, &info);
if (addrlen == 32)
return print_insn_i386((bfd_vma) realmemaddr, &info);
fprintf(stderr, "invalid address length %d.\n", addrlen);
return 0;
}
#else
void db_task_printsym(unsigned int addr){
print_address(addr, stderr);
} }
int print_insn(char *realmemaddr, char *memaddr, FILE *stream, int addrlen)
{
if (addrlen == 16)
return db_disasm((unsigned int) realmemaddr, 0, 1) -
((unsigned int) realmemaddr);
if (addrlen == 32)
return db_disasm((unsigned int) realmemaddr, 0, 0) -
((unsigned int) realmemaddr);
fprintf(stderr, "invalid address length %d.\n", addrlen);
return 0;
}
#endif
void info_reg(){ void info_reg(){
...@@ -130,16 +95,15 @@ void examine_memory(int addr, int count, char format){ ...@@ -130,16 +95,15 @@ void examine_memory(int addr, int count, char format){
if((addr & 0xffff0000) == 0 && dbg_mode == 16) if((addr & 0xffff0000) == 0 && dbg_mode == 16)
addr |= (format == 'i' ? SC_CS : SC_DS) << 16; addr |= (format == 'i' ? SC_CS : SC_DS) << 16;
if(format != 'i' && count > 1) { if(format != 'i' && count > 1) {
print_address(addr, stderr); print_address(addr, stderr, dbg_mode);
fprintf(stderr,": "); fprintf(stderr,": ");
}; };
switch(format){ switch(format){
case 's': case 's':
pnt = (char *) addr; 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);
...@@ -150,20 +114,22 @@ void examine_memory(int addr, int count, char format){ ...@@ -150,20 +114,22 @@ 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); print_address(addr, stderr, dbg_mode);
fprintf(stderr,": "); fprintf(stderr,": ");
addr += print_insn((char *) addr, (char *) addr, stderr, dbg_mode); addr = db_disasm( addr, 0, (dbg_mode == 16) );
fprintf(stderr,"\n"); fprintf(stderr,"\n");
}; };
return; return;
case 'x': case 'x':
dump = (unsigned int *) addr; dump = dbg_mode == 16 ? (unsigned int *)PTR_SEG_TO_LIN(addr)
: (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;
if ((i % 8) == 7) { if ((i % 8) == 7) {
fprintf(stderr,"\n"); fprintf(stderr,"\n");
print_address((unsigned int) dump, stderr); print_address(addr, stderr, dbg_mode);
fprintf(stderr,": "); fprintf(stderr,": ");
}; };
} }
...@@ -171,13 +137,15 @@ void examine_memory(int addr, int count, char format){ ...@@ -171,13 +137,15 @@ void examine_memory(int addr, int count, char format){
return; return;
case 'd': case 'd':
dump = (unsigned int *) addr; dump = dbg_mode == 16 ? (unsigned int *)PTR_SEG_TO_LIN(addr)
: (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;
if ((i % 8) == 7) { if ((i % 8) == 7) {
fprintf(stderr,"\n"); fprintf(stderr,"\n");
print_address((unsigned int) dump, stderr); print_address(addr, stderr, dbg_mode);
fprintf(stderr,": "); fprintf(stderr,": ");
}; };
} }
...@@ -185,13 +153,15 @@ void examine_memory(int addr, int count, char format){ ...@@ -185,13 +153,15 @@ void examine_memory(int addr, int count, char format){
return; return;
case 'w': case 'w':
wdump = (unsigned short int *) addr; wdump = dbg_mode == 16 ? (unsigned short *)PTR_SEG_TO_LIN(addr)
: (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;
if ((i % 10) == 7) { if ((i % 10) == 7) {
fprintf(stderr,"\n"); fprintf(stderr,"\n");
print_address((unsigned int) wdump, stderr); print_address(addr, stderr, dbg_mode);
fprintf(stderr,": "); fprintf(stderr,": ");
}; };
} }
...@@ -199,7 +169,8 @@ void examine_memory(int addr, int count, char format){ ...@@ -199,7 +169,8 @@ void examine_memory(int addr, int count, char format){
return; return;
case 'c': case 'c':
pnt = (char *) addr; 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) {
...@@ -207,9 +178,10 @@ void examine_memory(int addr, int count, char format){ ...@@ -207,9 +178,10 @@ void examine_memory(int addr, int count, char format){
pnt++; pnt++;
} else } else
fprintf(stderr," %c", *pnt++); fprintf(stderr," %c", *pnt++);
addr++;
if ((i % 32) == 7) { if ((i % 32) == 7) {
fprintf(stderr,"\n"); fprintf(stderr,"\n");
print_address((unsigned int) pnt, stderr); print_address(addr, stderr, dbg_mode);
fprintf(stderr,": "); fprintf(stderr,": ");
}; };
} }
...@@ -217,13 +189,15 @@ void examine_memory(int addr, int count, char format){ ...@@ -217,13 +189,15 @@ void examine_memory(int addr, int count, char format){
return; return;
case 'b': case 'b':
pnt = (char *) addr; 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++;
if ((i % 32) == 7) { if ((i % 32) == 7) {
fprintf(stderr,"\n"); fprintf(stderr,"\n");
print_address((unsigned int) pnt, stderr); print_address(addr, stderr, dbg_mode);
fprintf(stderr,": "); fprintf(stderr,": ");
}; };
} }
...@@ -293,26 +267,32 @@ void dbg_bt(){ ...@@ -293,26 +267,32 @@ void dbg_bt(){
return; return;
} }
frame = (struct frame *) ((SC_EBP(dbg_mask) & ~1) | (SC_SS << 16)); if (dbg_mode == 16)
frame = (struct frame *)PTR_SEG_OFF_TO_LIN( SC_SS, SC_BP & ~1 );
else
frame = (struct frame *)SC_EBP(dbg_mask);
fprintf(stderr,"Backtrace:\n"); fprintf(stderr,"Backtrace:\n");
fprintf(stderr,"%d ",frameno);
print_address(frame->u.win32.saved_ip,stderr);
cs = SC_CS; cs = SC_CS;
while((cs & 3) == 3) { while((cs & 3) == 3) {
/* 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) {
void CallTo32(); void CallTo32();
fprintf(stderr,"\n%d ",frameno++); fprintf(stderr,"%d ",frameno++);
print_address(frame->u.win32.saved_ip,stderr); print_address(frame->u.win32.saved_ip,stderr,32);
fprintf( stderr, "\n" );
if(frame->u.win32.saved_ip<((unsigned long)CallTo32+1000))break; if(frame->u.win32.saved_ip<((unsigned long)CallTo32+1000))break;
frame = (struct frame *) frame->u.win32.saved_bp; frame = (struct frame *) frame->u.win32.saved_bp;
} else { } else {
cs = frame->u.win16.saved_cs; if (frame->u.win16.saved_bp & 1) cs = frame->u.win16.saved_cs;
fprintf(stderr,"%d %4.4x:%4.4x\n", frameno++, cs, fprintf(stderr,"%d %4.4x:%4.4x\n", frameno++, cs,
frame->u.win16.saved_ip); frame->u.win16.saved_ip);
frame = (struct frame *) ((frame->u.win16.saved_bp & ~1) | frame = (struct frame *) PTR_SEG_OFF_TO_LIN( SC_SS, frame->u.win16.saved_bp & ~1);
(SC_SS << 16)); if ((cs & 7) != 7) /* switching to 32-bit mode */
{
extern int IF1632_Saved32_ebp;
frame = (struct frame *)IF1632_Saved32_ebp;
}
} }
} }
putchar('\n'); putchar('\n');
......
...@@ -64,6 +64,14 @@ ...@@ -64,6 +64,14 @@
#define SC_EDX(dbg_mask) (regval[RN_EDX] & dbg_mask) #define SC_EDX(dbg_mask) (regval[RN_EDX] & dbg_mask)
#define SC_ECX(dbg_mask) (regval[RN_ECX] & dbg_mask) #define SC_ECX(dbg_mask) (regval[RN_ECX] & dbg_mask)
#define SC_EAX(dbg_mask) (regval[RN_EAX] & dbg_mask) #define SC_EAX(dbg_mask) (regval[RN_EAX] & dbg_mask)
#define SC_DI (regval[RN_EDI] & 0xffff)
#define SC_SI (regval[RN_ESI] & 0xffff)
#define SC_BP (regval[RN_EBP] & 0xffff)
#define SC_SP (regval[RN_ESP] & 0xffff)
#define SC_BX (regval[RN_EBX] & 0xffff)
#define SC_DX (regval[RN_EDX] & 0xffff)
#define SC_CX (regval[RN_ECX] & 0xffff)
#define SC_AX (regval[RN_EAX] & 0xffff)
#define SC_TRAPNO regval[RN_TRAPNO] #define SC_TRAPNO regval[RN_TRAPNO]
#define SC_ERR regval[RN_ERR] #define SC_ERR regval[RN_ERR]
#define SC_EIP(dbg_mask) (regval[RN_EIP] & dbg_mask) #define SC_EIP(dbg_mask) (regval[RN_EIP] & dbg_mask)
......
...@@ -14,6 +14,7 @@ DLLOBJS = ...@@ -14,6 +14,7 @@ DLLOBJS =
CALLOBJS = call.o CALLOBJS = call.o
DLLOBJS = \ DLLOBJS = \
dll_commdlg.o \ dll_commdlg.o \
dll_compobj.o \
dll_gdi.o \ dll_gdi.o \
dll_kernel.o \ dll_kernel.o \
dll_keyboard.o \ dll_keyboard.o \
...@@ -28,10 +29,10 @@ DLLOBJS = \ ...@@ -28,10 +29,10 @@ DLLOBJS = \
dll_olesvr.o \ dll_olesvr.o \
dll_shell.o \ dll_shell.o \
dll_sound.o \ dll_sound.o \
dll_storage.o \
dll_stress.o \ dll_stress.o \
dll_system.o \ dll_system.o \
dll_toolhelp.o \ dll_toolhelp.o \
dll_unixlib.o \
dll_user.o \ dll_user.o \
dll_win87em.o \ dll_win87em.o \
dll_winsock.o dll_winsock.o
...@@ -47,6 +48,7 @@ OBJS = $(CALLOBJS) $(DLLOBJS) $(SRCS:.c=.o) $(DLLOBJS:.o=_tab.o) $(DLLOBJS:dll_. ...@@ -47,6 +48,7 @@ OBJS = $(CALLOBJS) $(DLLOBJS) $(SRCS:.c=.o) $(DLLOBJS:.o=_tab.o) $(DLLOBJS:dll_.
* If you add a new spec file, copy one of these lines * If you add a new spec file, copy one of these lines
*/ */
MakeDllFromSpec(commdlg) MakeDllFromSpec(commdlg)
MakeDllFromSpec(compobj)
MakeDllFromSpec(gdi) MakeDllFromSpec(gdi)
MakeDllFromSpec(kernel) MakeDllFromSpec(kernel)
MakeDllFromSpec(keyboard) MakeDllFromSpec(keyboard)
...@@ -61,10 +63,10 @@ MakeDllFromSpec(ole2prox) ...@@ -61,10 +63,10 @@ MakeDllFromSpec(ole2prox)
MakeDllFromSpec(olecli) MakeDllFromSpec(olecli)
MakeDllFromSpec(olesvr) MakeDllFromSpec(olesvr)
MakeDllFromSpec(sound) MakeDllFromSpec(sound)
MakeDllFromSpec(storage)
MakeDllFromSpec(stress) MakeDllFromSpec(stress)
MakeDllFromSpec(system) MakeDllFromSpec(system)
MakeDllFromSpec(toolhelp) MakeDllFromSpec(toolhelp)
MakeDllFromSpec(unixlib)
MakeDllFromSpec(user) MakeDllFromSpec(user)
MakeDllFromSpec(win87em) MakeDllFromSpec(win87em)
MakeDllFromSpec(winsock) MakeDllFromSpec(winsock)
......
...@@ -321,7 +321,6 @@ A(CallTo32:) ...@@ -321,7 +321,6 @@ A(CallTo32:)
* Save registers. 286 mode does not have fs or gs. * Save registers. 286 mode does not have fs or gs.
*/ */
pushw %ds pushw %ds
pushw %es
/* /*
* Restore segment registers. * Restore segment registers.
...@@ -372,7 +371,6 @@ A(CallTo32:) ...@@ -372,7 +371,6 @@ A(CallTo32:)
popw A(IF1632_Saved16_bp) popw A(IF1632_Saved16_bp)
popw A(IF1632_Saved16_sp) popw A(IF1632_Saved16_sp)
popw %es
popw %ds popw %ds
popw %bp popw %bp
...@@ -423,7 +421,6 @@ A(CallTo32_16:) ...@@ -423,7 +421,6 @@ A(CallTo32_16:)
* Save registers. 286 mode does not have fs or gs. * Save registers. 286 mode does not have fs or gs.
*/ */
pushw %ds pushw %ds
pushw %es
/* /*
* Restore segment registers. * Restore segment registers.
...@@ -474,7 +471,6 @@ A(CallTo32_16:) ...@@ -474,7 +471,6 @@ A(CallTo32_16:)
popw A(IF1632_Saved16_bp) popw A(IF1632_Saved16_bp)
popw A(IF1632_Saved16_sp) popw A(IF1632_Saved16_sp)
popw %es
popw %ds popw %ds
popw %bp popw %bp
...@@ -515,7 +511,6 @@ A(ReturnFromRegisterFunc:) ...@@ -515,7 +511,6 @@ A(ReturnFromRegisterFunc:)
popw A(IF1632_Saved16_bp) popw A(IF1632_Saved16_bp)
popw A(IF1632_Saved16_sp) popw A(IF1632_Saved16_sp)
popw %es
popw %ds popw %ds
popw %bp popw %bp
......
...@@ -6,32 +6,39 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; ...@@ -6,32 +6,39 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <strings.h>
#include "windows.h" #include "windows.h"
#include "callback.h" #include "callback.h"
#include "wine.h" #include "wine.h"
#include "segmem.h"
#include <setjmp.h> #include <setjmp.h>
#include "ldt.h"
#include "stackframe.h" #include "stackframe.h"
#include "dlls.h" #include "dlls.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
#include "if1632.h" #include "if1632.h"
extern unsigned short IF1632_Saved16_ss;
extern unsigned short IF1632_Saved16_bp;
extern unsigned short IF1632_Saved16_sp;
extern unsigned short IF1632_Saved32_ss; extern unsigned short IF1632_Saved32_ss;
extern unsigned long IF1632_Saved32_ebp; extern unsigned long IF1632_Saved32_ebp;
extern unsigned long IF1632_Saved32_esp; extern unsigned long IF1632_Saved32_esp;
extern struct segment_descriptor_s *MakeProcThunks; static WORD ThunkSelector = 0;
struct thunk_s struct thunk_s
{ {
int used; int used;
unsigned char thunk[10]; unsigned char thunk[8];
}; };
#ifdef __ELF__
#define FIRST_SELECTOR 2
#define IS_16_BIT_ADDRESS(addr) \
(((unsigned int)(addr) < 0x8000000) || ((unsigned int)(addr) >= 0x8400000))
#else
#define FIRST_SELECTOR 8
#define IS_16_BIT_ADDRESS(addr) \
((unsigned int)(addr) >= (((FIRST_SELECTOR << __AHSHIFT) | 7) << 16))
#endif
/********************************************************************** /**********************************************************************
* PushOn16 * PushOn16
...@@ -39,8 +46,7 @@ struct thunk_s ...@@ -39,8 +46,7 @@ struct thunk_s
static void static void
PushOn16(int size, unsigned int value) PushOn16(int size, unsigned int value)
{ {
char *p = (char *) (((unsigned int)IF1632_Saved16_ss << 16) + char *p = PTR_SEG_OFF_TO_LIN( IF1632_Saved16_ss, IF1632_Saved16_sp );
IF1632_Saved16_sp);
if (size) if (size)
{ {
unsigned long *lp = (unsigned long *) p - 1; unsigned long *lp = (unsigned long *) p - 1;
...@@ -67,6 +73,7 @@ CallBack16(void *func, int n_args, ...) ...@@ -67,6 +73,7 @@ CallBack16(void *func, int n_args, ...)
va_list ap; va_list ap;
int i; int i;
int arg_type, arg_value; int arg_type, arg_value;
WORD ds = CURRENT_DS;
va_start(ap, n_args); va_start(ap, n_args);
...@@ -79,36 +86,50 @@ CallBack16(void *func, int n_args, ...) ...@@ -79,36 +86,50 @@ CallBack16(void *func, int n_args, ...)
va_end(ap); va_end(ap);
return CallTo16((unsigned int) func, pStack16Frame->ds ); return CallTo16((unsigned int) func, ds );
} }
/********************************************************************** /**********************************************************************
* CALLBACK_MakeProcInstance * MakeProcInstance
*/ */
void * FARPROC MakeProcInstance( FARPROC func, WORD instance )
CALLBACK_MakeProcInstance(void *func, int instance)
{ {
char *thunks;
struct thunk_s *tp; struct thunk_s *tp;
int i; int i;
tp = (struct thunk_s *) MakeProcThunks->base_addr; if (!ThunkSelector)
{
ldt_entry entry;
/* Allocate a segment for thunks */
ThunkSelector = AllocSelector( 0 );
entry.base = (unsigned long) malloc( 0x10000 );
entry.limit = 0xffff;
entry.seg_32bit = 0;
entry.limit_in_pages = 0;
entry.type = SEGMENT_CODE;
entry.read_only = 0;
memset( (char *)entry.base, 0, 0x10000 );
LDT_SetEntry( SELECTOR_TO_ENTRY(ThunkSelector), &entry );
}
thunks = (char *)PTR_SEG_OFF_TO_LIN( ThunkSelector, 0 );
tp = (struct thunk_s *) thunks;
for (i = 0; i < 0x10000 / sizeof(*tp); i++, tp++) for (i = 0; i < 0x10000 / sizeof(*tp); i++, tp++)
if (!tp->used) if (!tp->used)
break; break;
if (tp->used) if (tp->used) return (FARPROC)0;
return (void *) 0;
tp->thunk[0] = 0xb8; tp->thunk[0] = 0xb8; /* movw instance, %ax */
tp->thunk[1] = (unsigned char) instance; tp->thunk[1] = (unsigned char) instance;
tp->thunk[2] = (unsigned char) (instance >> 8); tp->thunk[2] = (unsigned char) (instance >> 8);
tp->thunk[3] = 0x8e; tp->thunk[3] = 0xea; /* ljmp func */
tp->thunk[4] = 0xd8; *(LONG *)&tp->thunk[4] = (LONG)func;
tp->thunk[5] = 0xea;
memcpy(&tp->thunk[6], &func, 4);
tp->used = 1; tp->used = 1;
return tp->thunk; return (FARPROC)MAKELONG( (char *)tp->thunk - thunks, ThunkSelector );
} }
/********************************************************************** /**********************************************************************
...@@ -119,7 +140,7 @@ void FreeProcInstance(FARPROC func) ...@@ -119,7 +140,7 @@ void FreeProcInstance(FARPROC func)
struct thunk_s *tp; struct thunk_s *tp;
int i; int i;
tp = (struct thunk_s *) MakeProcThunks->base_addr; tp = (struct thunk_s *) PTR_SEG_OFF_TO_LIN( ThunkSelector, 0 );
for (i = 0; i < 0x10000 / sizeof(*tp); i++, tp++) for (i = 0; i < 0x10000 / sizeof(*tp); i++, tp++)
{ {
if ((void *) tp->thunk == (void *) func) if ((void *) tp->thunk == (void *) func)
...@@ -183,13 +204,14 @@ LONG CallWindowProc( WNDPROC func, HWND hwnd, WORD message, ...@@ -183,13 +204,14 @@ LONG CallWindowProc( WNDPROC func, HWND hwnd, WORD message,
} }
else if (IS_16_BIT_ADDRESS(func)) else if (IS_16_BIT_ADDRESS(func))
{ {
WORD ds = CURRENT_DS;
dprintf_callback(stddeb, "CallWindowProc // 16bit func=%08x ds=%04x!\n", dprintf_callback(stddeb, "CallWindowProc // 16bit func=%08x ds=%04x!\n",
(unsigned int) func, pStack16Frame->ds ); (unsigned int) func, ds );
PushOn16( CALLBACK_SIZE_WORD, hwnd ); PushOn16( CALLBACK_SIZE_WORD, hwnd );
PushOn16( CALLBACK_SIZE_WORD, message ); PushOn16( CALLBACK_SIZE_WORD, message );
PushOn16( CALLBACK_SIZE_WORD, wParam ); PushOn16( CALLBACK_SIZE_WORD, wParam );
PushOn16( CALLBACK_SIZE_LONG, lParam ); PushOn16( CALLBACK_SIZE_LONG, lParam );
return CallTo16((unsigned int) func, pStack16Frame->ds ); return CallTo16((unsigned int) func, ds );
} }
else else
{ {
...@@ -204,12 +226,13 @@ LONG CallWindowProc( WNDPROC func, HWND hwnd, WORD message, ...@@ -204,12 +226,13 @@ LONG CallWindowProc( WNDPROC func, HWND hwnd, WORD message,
*/ */
void CallLineDDAProc(FARPROC func, short xPos, short yPos, long lParam) void CallLineDDAProc(FARPROC func, short xPos, short yPos, long lParam)
{ {
WORD ds = CURRENT_DS;
if (IS_16_BIT_ADDRESS(func)) if (IS_16_BIT_ADDRESS(func))
{ {
PushOn16( CALLBACK_SIZE_WORD, xPos ); PushOn16( CALLBACK_SIZE_WORD, xPos );
PushOn16( CALLBACK_SIZE_WORD, yPos ); PushOn16( CALLBACK_SIZE_WORD, yPos );
PushOn16( CALLBACK_SIZE_LONG, lParam ); PushOn16( CALLBACK_SIZE_LONG, lParam );
CallTo16((unsigned int) func, pStack16Frame->ds ); CallTo16((unsigned int) func, ds );
} }
else else
{ {
...@@ -222,12 +245,13 @@ void CallLineDDAProc(FARPROC func, short xPos, short yPos, long lParam) ...@@ -222,12 +245,13 @@ void CallLineDDAProc(FARPROC func, short xPos, short yPos, long lParam)
*/ */
DWORD CallHookProc( HOOKPROC func, short code, WPARAM wParam, LPARAM lParam ) DWORD CallHookProc( HOOKPROC func, short code, WPARAM wParam, LPARAM lParam )
{ {
WORD ds = CURRENT_DS;
if (IS_16_BIT_ADDRESS(func)) if (IS_16_BIT_ADDRESS(func))
{ {
PushOn16( CALLBACK_SIZE_WORD, code ); PushOn16( CALLBACK_SIZE_WORD, code );
PushOn16( CALLBACK_SIZE_WORD, wParam ); PushOn16( CALLBACK_SIZE_WORD, wParam );
PushOn16( CALLBACK_SIZE_LONG, lParam ); PushOn16( CALLBACK_SIZE_LONG, lParam );
return CallTo16((unsigned int) func, pStack16Frame->ds ); return CallTo16((unsigned int) func, ds );
} }
else else
{ {
...@@ -240,12 +264,13 @@ DWORD CallHookProc( HOOKPROC func, short code, WPARAM wParam, LPARAM lParam ) ...@@ -240,12 +264,13 @@ DWORD CallHookProc( HOOKPROC func, short code, WPARAM wParam, LPARAM lParam )
*/ */
BOOL CallGrayStringProc(FARPROC func, HDC hdc, LPARAM lParam, INT cch ) BOOL CallGrayStringProc(FARPROC func, HDC hdc, LPARAM lParam, INT cch )
{ {
WORD ds = CURRENT_DS;
if (IS_16_BIT_ADDRESS(func)) if (IS_16_BIT_ADDRESS(func))
{ {
PushOn16( CALLBACK_SIZE_WORD, hdc ); PushOn16( CALLBACK_SIZE_WORD, hdc );
PushOn16( CALLBACK_SIZE_LONG, lParam ); PushOn16( CALLBACK_SIZE_LONG, lParam );
PushOn16( CALLBACK_SIZE_WORD, cch ); PushOn16( CALLBACK_SIZE_WORD, cch );
return CallTo16((unsigned int) func, pStack16Frame->ds ); return CallTo16((unsigned int) func, ds );
} }
else else
{ {
......
# $Id: commdlg.spec,v 1.3 1994/20/08 04:04:21 root Exp root $ # $Id: commdlg.spec,v 1.3 1994/20/08 04:04:21 root Exp root $
# #
name commdlg name commdlg
id 15 id 14
length 31 length 31
1 pascal GETOPENFILENAME(ptr) GetOpenFileName(1) 1 pascal GETOPENFILENAME(ptr) GetOpenFileName
2 pascal GETSAVEFILENAME(ptr) GetSaveFileName(1) 2 pascal GETSAVEFILENAME(ptr) GetSaveFileName
5 pascal CHOOSECOLOR(ptr) ChooseColor(1) 5 pascal CHOOSECOLOR(ptr) ChooseColor
6 pascal FILEOPENDLGPROC(word word word long) FileOpenDlgProc(1 2 3 4) 6 pascal FILEOPENDLGPROC(word word word long) FileOpenDlgProc
7 pascal FILESAVEDLGPROC(word word word long) FileSaveDlgProc(1 2 3 4) 7 pascal FILESAVEDLGPROC(word word word long) FileSaveDlgProc
8 pascal COLORDLGPROC(word word word long) ColorDlgProc(1 2 3 4) 8 pascal COLORDLGPROC(word word word long) ColorDlgProc
# 9 pascal LOADALTERBITMAP exported, shared data # 9 pascal LOADALTERBITMAP exported, shared data
11 pascal FINDTEXT(ptr) FindText(1) 11 pascal FINDTEXT(ptr) FindText
12 pascal REPLACETEXT(ptr) ReplaceText(1) 12 pascal REPLACETEXT(ptr) ReplaceText
13 pascal FINDTEXTDLGPROC(word word word long) FindTextDlgProc(1 2 3 4) 13 pascal FINDTEXTDLGPROC(word word word long) FindTextDlgProc
14 pascal REPLACETEXTDLGPROC(word word word long) ReplaceTextDlgProc(1 2 3 4) 14 pascal REPLACETEXTDLGPROC(word word word long) ReplaceTextDlgProc
# 15 pascal CHOOSEFONT exported, shared data # 15 pascal CHOOSEFONT exported, shared data
# 16 pascal FORMATCHARDLGPROC exported, shared data # 16 pascal FORMATCHARDLGPROC exported, shared data
# 18 pascal FONTSTYLEENUMPROC exported, shared data # 18 pascal FONTSTYLEENUMPROC exported, shared data
# 19 pascal FONTFAMILYENUMPROC exported, shared data # 19 pascal FONTFAMILYENUMPROC exported, shared data
20 pascal PRINTDLG(ptr) PrintDlg(1) 20 pascal PRINTDLG(ptr) PrintDlg
21 pascal PRINTDLGPROC(word word word long) PrintDlgProc(1 2 3 4) 21 pascal PRINTDLGPROC(word word word long) PrintDlgProc
22 pascal PRINTSETUPDLGPROC(word word word long) PrintSetupDlgProc(1 2 3 4) 22 pascal PRINTSETUPDLGPROC(word word word long) PrintSetupDlgProc
# 23 pascal EDITINTEGERONLY exported, shared data # 23 pascal EDITINTEGERONLY exported, shared data
# 25 pascal WANTARROWS exported, shared data # 25 pascal WANTARROWS exported, shared data
26 pascal COMMDLGEXTENDEDERROR() CommDlgExtendError() 26 pascal COMMDLGEXTENDEDERROR() CommDlgExtendError
27 pascal GETFILETITLE(ptr ptr word) GetFileTitle(1 2 3) 27 pascal GETFILETITLE(ptr ptr word) GetFileTitle
# 28 pascal WEP exported, shared data # 28 pascal WEP exported, shared data
# 29 pascal DWLBSUBCLASS exported, shared data # 29 pascal DWLBSUBCLASS exported, shared data
# 30 pascal DWUPARROWHACK exported, shared data # 30 pascal DWUPARROWHACK exported, shared data
......
name compobj
id 22
length 163
#1 COBUILDVERSION
#2 COINITIALIZE
#3 COUNINITIALIZE
#4 COGETMALLOC
#5 COREGISTERCLASSOBJECT
#6 COREVOKECLASSOBJECT
#7 COGETCLASSOBJECT
#8 COMARSHALINTERFACE
#9 COUNMARSHALINTERFACE
#10 COLOADLIBRARY
#11 COFREELIBRARY
#12 COFREEALLLIBRARIES
#13 COCREATEINSTANCE
#14 STRINGFROMIID
#15 CODISCONNECTOBJECT
#16 CORELEASEMARSHALDATA
#17 COFREEUNUSEDLIBRARIES
#18 ISEQUALGUID
#19 STRINGFROMCLSID
#20 CLSIDFROMSTRING
#21 ISVALIDPTRIN
#22 ISVALIDPTROUT
#23 ISVALIDINTERFACE
#24 ISVALIDIID
#25 RESULTFROMSCODE
#26 GETSCODE
#27 COREGISTERMESSAGEFILTER
#28 COISHANDLERCONNECTED
#29 WEP
#30 COFILETIMETODOSDATETIME
#31 CODOSDATETIMETOFILETIME
#32 COMARSHALHRESULT
#33 COUNMARSHALHRESULT
#34 COGETCURRENTPROCESS
#35 ___EXPORTEDSTUB
#36 COISOLE1CLASS
#37 _GUID_NULL
#38 _IID_IUNKNOWN
#39 _IID_ICLASSFACTORY
#40 _IID_IMALLOC
#41 _IID_IMARSHAL
#42 _IID_IRPCCHANNEL
#43 _IID_IRPCSTUB
#44 _IID_ISTUBMANAGER
#45 _IID_IRPCPROXY
#46 _IID_IPROXYMANAGER
#47 _IID_IPSFACTORY
#48 _IID_ILOCKBYTES
#49 _IID_ISTORAGE
#50 _IID_ISTREAM
#51 _IID_IENUMSTATSTG
#52 _IID_IBINDCTX
#53 _IID_IMONIKER
#54 _IID_IRUNNINGOBJECTTABLE
#55 _IID_IINTERNALMONIKER
#56 _IID_IROOTSTORAGE
#57 _IID_IDFRESERVED1
#58 _IID_IDFRESERVED2
#59 _IID_IDFRESERVED3
#60 _IID_IMESSAGEFILTER
#61 CLSIDFROMPROGID
#62 PROGIDFROMCLSID
#63 COLOCKOBJECTEXTERNAL
#64 _CLSID_STDMARSHAL
#65 COGETTREATASCLASS
#66 COTREATASCLASS
#67 COGETSTANDARDMARSHAL
#68 PROPAGATERESULT
#69 IIDFROMSTRING
#70 _IID_ISTDMARSHALINFO
#71 COCREATESTANDARDMALLOC
#72 _IID_IEXTERNALCONNECTION
#73 COCREATEGUID
#75 FNASSERT
#76 STRINGFROMGUID2
#77 COGETCLASSEXT
#78 OLE1CLASSFROMCLSID2
#79 CLSIDFROMOLE1CLASS
#80 COOPENCLASSKEY
#81 GUIDFROMSTRING
#82 COFILETIMENOW
#83 REMALLOCOID
#84 REMFREEOID
#85 REMCREATEREMOTEHANDLER
#86 REMCONNECTTOOBJECT
#87 REMGETINFOFORCID
#88 LRPCCALL
#89 LRPCDISPATCH
#90 LRPCREGISTERMONITOR
#91 LRPCREVOKEMONITOR
#92 LRPCGETTHREADWINDOW
#93 TIMERCALLBACKPROC
#94 LOOKUPETASK
#95 SETETASK
#96 LRPCFREEMONITORDATA
#97 REMLOOKUPSHUNK
#100 ??0CARRAYFVALUE@@REC@KI@Z
#101 ??1CARRAYFVALUE@@REC@XZ
#102 ?ASSERTVALID@CARRAYFVALUE@@RFCXXZ
#103 ?FREEEXTRA@CARRAYFVALUE@@RECXXZ
#104 ?_GETAT@CARRAYFVALUE@@RFCPEXH@Z
#105 ?GETSIZE@CARRAYFVALUE@@RFCHXZ
#108 ?INDEXOF@CARRAYFVALUE@@RECHPEXII@Z
#109 ?INSERTAT@CARRAYFVALUE@@RECHHPEXH@Z
#111 ?REMOVEAT@CARRAYFVALUE@@RECXHH@Z
#112 ?SETAT@CARRAYFVALUE@@RECXHPEX@Z
#113 ?SETATGROW@CARRAYFVALUE@@RECHHPEX@Z
#114 ?SETSIZE@CARRAYFVALUE@@RECHHH@Z
#120 ?GETASSOCAT@CMAPKEYTOVALUE@@BFCPEUCASSOC@1@PEXIAEI@Z
#121 ?SETASSOCKEY@CMAPKEYTOVALUE@@BFCHPEUCASSOC@1@PEXI@Z
#122 ??1CMAPKEYTOVALUE@@REC@XZ
#123 ?GETASSOCKEYPTR@CMAPKEYTOVALUE@@BFCXPEUCASSOC@1@PEPEXPEI@Z
#124 ?NEWASSOC@CMAPKEYTOVALUE@@BECPEUCASSOC@1@IPEXI0@Z
#125 ?SIZEASSOC@CMAPKEYTOVALUE@@BFCIXZ
#126 ?FREEASSOC@CMAPKEYTOVALUE@@BECXPEUCASSOC@1@@Z
#127 ?GETSTARTPOSITION@CMAPKEYTOVALUE@@RFCPEXXZ
#128 ?GETNEXTASSOC@CMAPKEYTOVALUE@@RFCXPEPEXPEXPEI1@Z
#129 ?COMPAREASSOCKEY@CMAPKEYTOVALUE@@BFCHPEUCASSOC@1@PEXI@Z
#130 ?REMOVEHKEY@CMAPKEYTOVALUE@@RECHK@Z
#131 ?GETHKEY@CMAPKEYTOVALUE@@RFCKPEXI@Z
#132 ?GETCOUNT@CMAPKEYTOVALUE@@RFCHXZ
#133 ?LOOKUP@CMAPKEYTOVALUE@@RFCHPEXI0@Z
#134 ?GETASSOCVALUE@CMAPKEYTOVALUE@@BFCXPEUCASSOC@1@PEX@Z
#135 ?REMOVEKEY@CMAPKEYTOVALUE@@RECHPEXI@Z
#136 ?REMOVEALL@CMAPKEYTOVALUE@@RECXXZ
#138 ?FREEASSOCKEY@CMAPKEYTOVALUE@@BFCXPEUCASSOC@1@@Z
#139 ?SETAT@CMAPKEYTOVALUE@@RECHPEXI0@Z
#140 ?LOOKUPHKEY@CMAPKEYTOVALUE@@RFCHKPEX@Z
#141 ?ASSERTVALID@CMAPKEYTOVALUE@@RFCXXZ
#142 ?SETASSOCVALUE@CMAPKEYTOVALUE@@BFCXPEUCASSOC@1@PEX@Z
#143 ?SETATHKEY@CMAPKEYTOVALUE@@RECHKPEX@Z
#144 ??0CMAPKEYTOVALUE@@REC@KIIHP7CIPEXI@ZI@Z
#145 ?INITHASHTABLE@CMAPKEYTOVALUE@@BECHXZ
#146 ?GETASSOCVALUEPTR@CMAPKEYTOVALUE@@BFCXPEUCASSOC@1@PEPEX@Z
#147 ?LOOKUPADD@CMAPKEYTOVALUE@@RFCHPEXI0@Z
#148 MKVDEFAULTHASHKEY
#150 COMEMCTXOF
#151 COMEMALLOC
#152 COMEMFREE
#160 CORUNMODALLOOP
#161 COHANDLEINCOMINGCALL
#162 COSETACKSTATE
# $Id: keyboard.spec,v 1.1 1993/09/10 05:32:12 scott Exp $ # $Id: keyboard.spec,v 1.1 1993/09/10 05:32:12 scott Exp $
# #
name keyboard name keyboard
id 8 id 7
length 137 length 137
#1 pascal Inquire #1 pascal Inquire
#2 pascal Enable #2 pascal Enable
#3 pascal Disable #3 pascal Disable
4 pascal ToAscii(word word ptr ptr word) ToAscii(1 2 3 4 5) 4 pascal ToAscii(word word ptr ptr word) ToAscii
5 pascal AnsiToOem(ptr ptr) AnsiToOem(1 2) 5 pascal AnsiToOem(ptr ptr) AnsiToOem
6 pascal OemToAnsi(ptr ptr) OemToAnsi(1 2) 6 pascal OemToAnsi(ptr ptr) OemToAnsi
#7 pascal SetSpeed #7 pascal SetSpeed
#100 pascal ScreenSwitchEnable #100 pascal ScreenSwitchEnable
#126 pascal GetTableSeg #126 pascal GetTableSeg
#127 pascal NewTable #127 pascal NewTable
128 pascal OemKeyScan(word) OemKeyScan(1) 128 pascal OemKeyScan(word) OemKeyScan
129 pascal VkKeyScan(byte) VkKeyScan(1) 129 pascal VkKeyScan(byte) VkKeyScan
130 pascal GetKeyboardType(byte) GetKeyboardType(1) 130 pascal GetKeyboardType(byte) GetKeyboardType
131 pascal MapVirtualKey(word word) MapVirtualKey(1 2) 131 pascal MapVirtualKey(word word) MapVirtualKey
132 pascal GetKbCodePage() GetKbCodePage() 132 pascal GetKbCodePage() GetKbCodePage
133 pascal GetKeyNameText(long ptr word) GetKeyNameText(1 2 3) 133 pascal GetKeyNameText(long ptr word) GetKeyNameText
134 pascal AnsiToOemBuff(ptr ptr word) AnsiToOemBuff(1 2 3) 134 pascal AnsiToOemBuff(ptr ptr word) AnsiToOemBuff
135 pascal OemToAnsiBuff(ptr ptr word) OemToAnsiBuff(1 2 3) 135 pascal OemToAnsiBuff(ptr ptr word) OemToAnsiBuff
#136 pascal EnableKbSysReq #136 pascal EnableKbSysReq
#137 pascal GetBiosKeyProc #137 pascal GetBiosKeyProc
name mouse name mouse
id 14 id 13
length 8 length 8
#1 pascal INQUIRE #1 pascal INQUIRE
......
name OLE2 name OLE2
id 16 id 15
length 161 length 161
#1 OLEBUILDVERSION #1 OLEBUILDVERSION
......
name ole2conv name ole2conv
id 17 id 16
length 10 length 10
#1 GETFILTERINFO #1 GETFILTERINFO
#2 IMPORTGR #2 IMPORTGR
......
name ole2disp name ole2disp
id 18 id 17
length 110 length 110
#1 DLLGETCLASSOBJECT #1 DLLGETCLASSOBJECT
#2 SYSALLOCSTRING #2 SYSALLOCSTRING
......
name ole2nls name ole2nls
id 19 id 18
length 11 length 11
#1 GETUSERDEFAULTLCID #1 GETUSERDEFAULTLCID
#2 GETSYSTEMDEFAULTLCID #2 GETSYSTEMDEFAULTLCID
......
name ole2prox name ole2prox
id 20 id 19
length 3 length 3
#1 DLLGETCLASSOBJECT #1 DLLGETCLASSOBJECT
#2 WEP #2 WEP
......
name olecli name olecli
id 21 id 20
length 954 length 43
## 954 is too large for now
##length 954
#1 WEP #1 WEP
#2 OLEDELETE #2 OLEDELETE
#3 OLESAVETOSTREAM #3 OLESAVETOSTREAM
...@@ -40,9 +43,9 @@ length 954 ...@@ -40,9 +43,9 @@ length 954
#38 OLECREATEFROMFILE #38 OLECREATEFROMFILE
#39 OLECREATELINKFROMFILE #39 OLECREATELINKFROMFILE
#40 OLERELEASE #40 OLERELEASE
41 pascal OleRegisterClientDoc(ptr ptr long ptr) OleRegisterClientDoc(1 2 3 4) 41 pascal OleRegisterClientDoc(ptr ptr long ptr) OleRegisterClientDoc
42 pascal OleRevokeClientDoc(long) OleRevokeClientDoc(1) 42 pascal OleRevokeClientDoc(long) OleRevokeClientDoc
43 pascal OleRenameClientDoc(long ptr) OleRenameClientDoc(1 2) 43 pascal OleRenameClientDoc(long ptr) OleRenameClientDoc
#44 OLEREVERTCLIENTDOC #44 OLEREVERTCLIENTDOC
#45 OLESAVEDCLIENTDOC #45 OLESAVEDCLIENTDOC
#46 OLERENAME #46 OLERENAME
......
name olesvr name olesvr
id 22 id 21
length 31 length 31
#1 WEP #1 WEP
2 pascal OleRegisterServer(ptr ptr ptr word word) OleRegisterServer(1 2 3 4 5) 2 pascal OleRegisterServer(ptr ptr ptr word word) OleRegisterServer
3 pascal OleRevokeServer(long) OleRevokeServer(1) 3 pascal OleRevokeServer(long) OleRevokeServer
4 pascal OleBlockServer(long) OleBlockServer(1) 4 pascal OleBlockServer(long) OleBlockServer
5 pascal OleUnblockServer(long ptr) OleUnblockServer(1 2) 5 pascal OleUnblockServer(long ptr) OleUnblockServer
6 pascal OleRegisterServerDoc(long ptr ptr ptr) OleRegisterServerDoc(1 2 3 4) 6 pascal OleRegisterServerDoc(long ptr ptr ptr) OleRegisterServerDoc
7 pascal OleRevokeServerDoc(long) OleRevokeServerDoc(1) 7 pascal OleRevokeServerDoc(long) OleRevokeServerDoc
#8 OLERENAMESERVERDOC #8 OLERENAMESERVERDOC
#9 OLEREVERTSERVERDOC #9 OLEREVERTSERVERDOC
#10 OLESAVEDSERVERDOC #10 OLESAVEDSERVERDOC
......
...@@ -17,8 +17,9 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; ...@@ -17,8 +17,9 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <linux/ldt.h> #include <linux/ldt.h>
#endif #endif
#include "ldt.h"
#include "neexe.h" #include "neexe.h"
#include "segmem.h"
#include "prototypes.h" #include "prototypes.h"
#include "dlls.h" #include "dlls.h"
#include "options.h" #include "options.h"
...@@ -45,25 +46,26 @@ struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] = ...@@ -45,25 +46,26 @@ struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] =
{ "KERNEL", WineLibSkip(KERNEL_table), 410, 1, 1 }, { "KERNEL", WineLibSkip(KERNEL_table), 410, 1, 1 },
{ "USER", WineLibSkip(USER_table), 540, 2, 1 }, { "USER", WineLibSkip(USER_table), 540, 2, 1 },
{ "GDI", WineLibSkip(GDI_table), 490, 3, 1 }, { "GDI", WineLibSkip(GDI_table), 490, 3, 1 },
{ "UNIXLIB", WineLibSkip(UNIXLIB_table), 10, 4, 1 }, { "WIN87EM", WineLibSkip(WIN87EM_table), 10, 4, 1 },
{ "WIN87EM", WineLibSkip(WIN87EM_table), 10, 5, 1 }, { "SHELL", WineLibSkip(SHELL_table), 103, 5, 1 },
{ "SHELL", WineLibSkip(SHELL_table), 103, 6, 1 }, { "SOUND", WineLibSkip(SOUND_table), 20, 6, 1 },
{ "SOUND", WineLibSkip(SOUND_table), 20, 7, 1 }, { "KEYBOARD",WineLibSkip(KEYBOARD_table),137, 7, 1 },
{ "KEYBOARD",WineLibSkip(KEYBOARD_table),137, 8, 1 }, { "WINSOCK", WineLibSkip(WINSOCK_table), 155, 8, 1 },
{ "WINSOCK", WineLibSkip(WINSOCK_table), 155, 9, 1 }, { "STRESS", WineLibSkip(STRESS_table), 15, 9, 1},
{ "STRESS", WineLibSkip(STRESS_table), 15, 10, 1}, { "MMSYSTEM",WineLibSkip(MMSYSTEM_table),1226,10, 1},
{ "MMSYSTEM",WineLibSkip(MMSYSTEM_table),1226,11, 1}, { "SYSTEM", WineLibSkip(SYSTEM_table), 20 ,11, 1},
{ "SYSTEM", WineLibSkip(SYSTEM_table), 20 ,12, 1}, { "TOOLHELP",WineLibSkip(TOOLHELP_table), 83, 12, 1},
{ "TOOLHELP",WineLibSkip(TOOLHELP_table), 83, 13, 1}, { "MOUSE", WineLibSkip(MOUSE_table), 8, 13, 1},
{ "MOUSE", WineLibSkip(MOUSE_table), 8, 14, 1}, { "COMMDLG", WineLibSkip(COMMDLG_table), 31, 14, 1},
{ "COMMDLG", WineLibSkip(COMMDLG_table), 31, 15, 1}, { "OLE2", WineLibSkip(OLE2_table), 31, 15, 1},
{ "OLE2", WineLibSkip(OLE2_table), 31, 16, 1}, { "OLE2CONV",WineLibSkip(OLE2CONV_table), 31, 16, 1},
{ "OLE2CONV",WineLibSkip(OLE2CONV_table), 31, 17, 1}, { "OLE2DISP",WineLibSkip(OLE2DISP_table), 31, 17, 1},
{ "OLE2DISP",WineLibSkip(OLE2DISP_table), 31, 18, 1}, { "OLE2NLS", WineLibSkip(OLE2NLS_table), 31, 18, 1},
{ "OLE2NLS", WineLibSkip(OLE2NLS_table), 31, 19, 1}, { "OLE2PROX",WineLibSkip(OLE2PROX_table), 31, 19, 1},
{ "OLE2PROX",WineLibSkip(OLE2PROX_table), 31, 20, 1}, { "OLECLI", WineLibSkip(OLECLI_table), 31, 20, 1},
{ "OLECLI", WineLibSkip(OLECLI_table), 31, 21, 1}, { "OLESVR", WineLibSkip(OLESVR_table), 31, 21, 1},
{ "OLESVR", WineLibSkip(OLESVR_table), 31, 22, 1}, { "COMPOBJ", WineLibSkip(COMPOBJ_table), 31, 22, 1},
{ "STORAGE", WineLibSkip(STORAGE_table), 31, 23, 1}
}; };
/* don't forget to increase N_BUILTINS in dll.h if you add a dll */ /* don't forget to increase N_BUILTINS in dll.h if you add a dll */
...@@ -72,38 +74,53 @@ struct dll_conversions { ...@@ -72,38 +74,53 @@ struct dll_conversions {
unsigned short *dst_args; /* Offsets to arguments on stack */ unsigned short *dst_args; /* Offsets to arguments on stack */
unsigned char *src_types; /* Argument types */ unsigned char *src_types; /* Argument types */
} dll_conversion_table[N_BUILTINS]= { } dll_conversion_table[N_BUILTINS]= {
KERNEL_offsets, KERNEL_types, /* KERNEL */ { KERNEL_offsets, KERNEL_types }, /* KERNEL */
USER_offsets, USER_types, /* USER */ { USER_offsets, USER_types }, /* USER */
GDI_offsets, GDI_types, /* GDI */ { GDI_offsets, GDI_types }, /* GDI */
UNIXLIB_offsets, UNIXLIB_types, /* UNIXLIB */ { WIN87EM_offsets, WIN87EM_types }, /* WIN87EM */
WIN87EM_offsets, WIN87EM_types, /* WIN87EM */ { SHELL_offsets, SHELL_types }, /* SHELL */
SHELL_offsets, SHELL_types, /* SHELL */ { SOUND_offsets, SOUND_types }, /* SOUND */
SOUND_offsets, SOUND_types, /* SOUND */ { KEYBOARD_offsets, KEYBOARD_types }, /* KEYBOARD */
KEYBOARD_offsets, KEYBOARD_types, /* KEYBOARD */ { WINSOCK_offsets, WINSOCK_types }, /* WINSOCK */
WINSOCK_offsets, WINSOCK_types, /* WINSOCK */ { STRESS_offsets, STRESS_types }, /* STRESS, */
STRESS_offsets, STRESS_types, /* STRESS, */ { MMSYSTEM_offsets, MMSYSTEM_types }, /* MMSYSTEM */
MMSYSTEM_offsets, MMSYSTEM_types, /* MMSYSTEM */ { SYSTEM_offsets, SYSTEM_types }, /* SYSTEM */
SYSTEM_offsets, SYSTEM_types, /* SYSTEM */ { TOOLHELP_offsets, TOOLHELP_types }, /* TOOLHELP */
TOOLHELP_offsets, TOOLHELP_types, /* TOOLHELP */ { MOUSE_offsets, MOUSE_types }, /* MOUSE */
MOUSE_offsets, MOUSE_types, /* MOUSE */ { COMMDLG_offsets, COMMDLG_types }, /* EMUCOMMDLG */
COMMDLG_offsets, COMMDLG_types, /* EMUCOMMDLG */ { OLE2_offsets, OLE2_types }, /* OLE2 */
OLE2_offsets, OLE2_types, /* OLE2 */ { OLE2CONV_offsets, OLE2CONV_types }, /* OLE2CONV */
OLE2CONV_offsets, OLE2CONV_types, /* OLE2CONV */ { OLE2DISP_offsets, OLE2DISP_types }, /* OLE2DISP */
OLE2DISP_offsets, OLE2DISP_types, /* OLE2DISP */ { OLE2NLS_offsets, OLE2NLS_types }, /* OLE2NLS */
OLE2NLS_offsets, OLE2NLS_types, /* OLE2NLS */ { OLE2DISP_offsets, OLE2DISP_types }, /* OLE2PROX */
OLE2DISP_offsets, OLE2DISP_types, /* OLE2PROX */ { OLECLI_offsets, OLECLI_types }, /* OLE2CLI */
OLECLI_offsets, OLECLI_types, /* OLE2CLI */ { OLESVR_offsets, OLESVR_types }, /* OLE2CLI */
OLESVR_offsets, OLESVR_types /* OLE2CLI */ { COMPOBJ_offsets, COMPOBJ_types }, /* COMPOBJ */
{ STORAGE_offsets, STORAGE_types } /* STORAGE */
}; };
#ifndef WINELIB #ifndef WINELIB
STACK16FRAME *pStack16Frame;
extern unsigned short IF1632_Saved16_sp; extern unsigned short IF1632_Saved16_sp;
extern unsigned short IF1632_Saved16_bp; extern unsigned short IF1632_Saved16_bp;
extern unsigned short IF1632_Saved16_ss; extern unsigned short IF1632_Saved16_ss;
void RelayDebug( unsigned int func_num )
{
unsigned int dll_id, ordinal;
if (debugging_relay)
{
dll_id = ((func_num >> 16) & 0xffff) - 1;
ordinal = func_num & 0xffff;
printf( "Calling %s.%d\n",
dll_builtin_table[dll_id].dll_table[ordinal].export_name,
ordinal );
}
}
/********************************************************************** /**********************************************************************
* DLLRelay * DLLRelay
* *
...@@ -126,7 +143,7 @@ int ...@@ -126,7 +143,7 @@ int
DLLRelay(unsigned int func_num, unsigned int seg_off) DLLRelay(unsigned int func_num, unsigned int seg_off)
{ {
struct dll_table_entry_s *dll_p; struct dll_table_entry_s *dll_p;
STACK16FRAME *pOldStack16Frame; STACK16FRAME *pStack16Frame;
unsigned int offset; unsigned int offset;
unsigned int dll_id; unsigned int dll_id;
unsigned int ordinal; unsigned int ordinal;
...@@ -138,12 +155,12 @@ DLLRelay(unsigned int func_num, unsigned int seg_off) ...@@ -138,12 +155,12 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
int conv_ref; int conv_ref;
unsigned char *type_conv; unsigned char *type_conv;
unsigned short *offset_conv; unsigned short *offset_conv;
STACK16FRAME stackFrameCopy;
/* /*
* Determine address of arguments. * Determine address of arguments.
*/ */
pOldStack16Frame = pStack16Frame; pStack16Frame = (STACK16FRAME *) PTR_SEG_TO_LIN(seg_off);
pStack16Frame = (STACK16FRAME *) seg_off;
arg_ptr = (void *)pStack16Frame->args; arg_ptr = (void *)pStack16Frame->args;
/* /*
...@@ -153,20 +170,17 @@ DLLRelay(unsigned int func_num, unsigned int seg_off) ...@@ -153,20 +170,17 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
ordinal = func_num & 0xffff; ordinal = func_num & 0xffff;
dll_p = &dll_builtin_table[dll_id].dll_table[ordinal]; dll_p = &dll_builtin_table[dll_id].dll_table[ordinal];
if (debugging_relay) dprintf_relay( stddeb, "Call %s (%s.%d), stack=%04x:%04x ret=%04x:%04x ds=%04x bp=%04x args=%d\n",
{
printf( "Call %s (%s.%d), stack=%04x:%04x, ret=%04x:%04x",
dll_p->export_name, dll_p->export_name,
dll_builtin_table[dll_id].dll_name, ordinal, dll_builtin_table[dll_id].dll_name, ordinal,
seg_off >> 16, seg_off & 0xffff, seg_off >> 16, seg_off & 0xffff,
pStack16Frame->cs, pStack16Frame->ip ); pStack16Frame->cs, pStack16Frame->ip,
printf(" bp=%04x ds=%04x args=%d\n", pStack16Frame->ds, pStack16Frame->bp,
pStack16Frame->bp, pStack16Frame->ds,
pStack16Frame->arg_length ); pStack16Frame->arg_length );
if(debugging_stack) if(debugging_stack)
{ {
unsigned short *stack_p = (unsigned short *) seg_off; unsigned short *stack_p = (unsigned short *) pStack16Frame;
/* FIXME: Is there an end-of-stack-pointer somewhere ? */ /* FIXME: Is there an end-of-stack-pointer somewhere ? */
int n = min(24, (0x10000 - (seg_off & 0xffff)) / sizeof(*stack_p)); int n = min(24, (0x10000 - (seg_off & 0xffff)) / sizeof(*stack_p));
for (i = 0; i < n; i++, stack_p++) for (i = 0; i < n; i++, stack_p++)
...@@ -177,7 +191,6 @@ DLLRelay(unsigned int func_num, unsigned int seg_off) ...@@ -177,7 +191,6 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
} }
printf("\n"); printf("\n");
} }
} /* DEBUG_RELAY */
/* /*
* Make sure we have a handler defined for this call. * Make sure we have a handler defined for this call.
...@@ -202,7 +215,10 @@ DLLRelay(unsigned int func_num, unsigned int seg_off) ...@@ -202,7 +215,10 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
if (dll_p->n_args == 0) if (dll_p->n_args == 0)
{ {
ret_val = (*func_ptr)(arg_ptr); ret_val = (*func_ptr)(arg_ptr);
pStack16Frame = pOldStack16Frame; dprintf_relay( stddeb, "Returning %08x from %s (%s.%d) ds=%04x\n",
ret_val, dll_p->export_name,
dll_builtin_table[dll_id].dll_name, ordinal,
pStack16Frame->ds );
return ret_val; return ret_val;
} }
...@@ -238,14 +254,14 @@ DLLRelay(unsigned int func_num, unsigned int seg_off) ...@@ -238,14 +254,14 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
case DLL_ARGTYPE_FARPTR: case DLL_ARGTYPE_FARPTR:
ip = (int *) ((char *) arg_ptr + offset); ip = (int *) ((char *) arg_ptr + offset);
if (*ip & 0xffff0000) arg_table[i] = (unsigned int) PTR_SEG_TO_LIN( *ip );
arg_table[i] = FIXPTR(*ip);
else
arg_table[i] = *ip;
break; break;
} }
} }
if (debugging_relay)
memcpy( &stackFrameCopy, pStack16Frame, sizeof(stackFrameCopy) );
/* /*
* Call the handler * Call the handler
*/ */
...@@ -256,10 +272,12 @@ DLLRelay(unsigned int func_num, unsigned int seg_off) ...@@ -256,10 +272,12 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
arg_table[12], arg_table[13], arg_table[14], arg_table[12], arg_table[13], arg_table[14],
arg_table[15]); arg_table[15]);
pStack16Frame = pOldStack16Frame;
if (debugging_relay) if (debugging_relay)
{ {
if (memcmp( &stackFrameCopy, pStack16Frame, sizeof(stackFrameCopy) ))
{
printf( "**** 16-bit stack corrupted!\n" );
}
printf("Returning %08x from %s (%s.%d) ds=%04x\n", printf("Returning %08x from %s (%s.%d) ds=%04x\n",
ret_val, ret_val,
dll_p->export_name, dll_p->export_name,
......
# $Id: shell.spec,v 1.3 1993/07/04 04:04:21 root Exp root $ # $Id: shell.spec,v 1.3 1993/07/04 04:04:21 root Exp root $
# #
name shell name shell
id 6 id 5
length 103 length 103
# #
...@@ -9,24 +9,24 @@ length 103 ...@@ -9,24 +9,24 @@ length 103
# 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 2 3) 1 pascal RegOpenKey(word ptr ptr) RegOpenKey
2 pascal RegCreateKey(word ptr ptr) RegCreateKey(1 2 3) 2 pascal RegCreateKey(word ptr ptr) RegCreateKey
3 pascal RegCloseKey(word) RegCloseKey(1) 3 pascal RegCloseKey(word) RegCloseKey
4 pascal RegDeleteKey(word ptr) RegDeleteKey(1 2) 4 pascal RegDeleteKey(word ptr) RegDeleteKey
5 pascal RegSetValue(word ptr long ptr long) RegSetValue(1 2 3 4 5) 5 pascal RegSetValue(word ptr long ptr long) RegSetValue
6 pascal RegQueryValue(word ptr ptr ptr) RegQueryValue(1 2 3 4) 6 pascal RegQueryValue(word ptr ptr ptr) RegQueryValue
7 pascal RegEnumKey(word long ptr long) RegEnumKey(1 2 3 4) 7 pascal RegEnumKey(word long ptr long) RegEnumKey
9 pascal DragAcceptFiles(word word) DragAcceptFiles(1 2) 9 pascal DragAcceptFiles(word word) DragAcceptFiles
11 pascal DragQueryFile(word s_word ptr s_word) DragQueryFile(1 2 3 4) 11 pascal DragQueryFile(word s_word ptr s_word) DragQueryFile
12 pascal DragFinish(word) DragFinish(1) 12 pascal DragFinish(word) DragFinish
13 pascal DragQueryPoint(word ptr) DragQueryPoint(1 2) 13 pascal DragQueryPoint(word ptr) DragQueryPoint
20 pascal ShellExecute(word ptr ptr ptr ptr s_word) ShellExecute(1 2 3 4 5 6) 20 pascal ShellExecute(word ptr ptr ptr ptr s_word) ShellExecute
21 pascal FindExecutable(ptr ptr ptr) FindExecutable(1 2 3) 21 pascal FindExecutable(ptr ptr ptr) FindExecutable
22 pascal ShellAbout(word ptr ptr word) ShellAbout(1 2 3 4) 22 pascal ShellAbout(word ptr ptr word) ShellAbout
33 pascal AboutDlgProc(word word word long) AboutDlgProc(1 2 3 4) 33 pascal AboutDlgProc(word word word long) AboutDlgProc
34 pascal ExtractIcon(word ptr s_word) ExtractIcon(1 2 3) 34 pascal ExtractIcon(word ptr s_word) ExtractIcon
102 pascal RegisterShellHook(ptr) RegisterShellHook(1) 102 pascal RegisterShellHook(ptr) RegisterShellHook
103 pascal ShellHookProc() ShellHookProc() 103 pascal 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
......
# $Id: sound.spec,v 1.3 1993/07/04 04:04:21 root Exp root $ # $Id: sound.spec,v 1.3 1993/07/04 04:04:21 root Exp root $
# #
name sound name sound
id 7 id 6
length 20 length 20
1 pascal OPENSOUND() OpenSound() 1 pascal OPENSOUND() OpenSound
2 pascal CLOSESOUND() CloseSound() 2 pascal CLOSESOUND() CloseSound
3 pascal SETVOICEQUEUESIZE(word word) SetVoiceQueueSize(1 2) 3 pascal SETVOICEQUEUESIZE(word word) SetVoiceQueueSize
4 pascal SETVOICENOTE(word word word word) SetVoiceNote(1 2 3 4) 4 pascal SETVOICENOTE(word word word word) SetVoiceNote
5 pascal SETVOICEACCENT(word word word word word) 5 pascal SETVOICEACCENT(word word word word word)
SetVoiceAccent(1 2 3 4 5) SetVoiceAccent
6 pascal SETVOICEENVELOPE(word word word) SetVoiceEnvelope(1 2 3) 6 pascal SETVOICEENVELOPE(word word word) SetVoiceEnvelope
7 pascal SETSOUNDNOISE(word word) SetSoundNoise(1 2) 7 pascal SETSOUNDNOISE(word word) SetSoundNoise
8 pascal SETVOICESOUND(word long word) SetVoiceSound(1 2 3) 8 pascal SETVOICESOUND(word long word) SetVoiceSound
9 pascal STARTSOUND() StartSound() 9 pascal STARTSOUND() StartSound
10 pascal STOPSOUND() StopSound() 10 pascal STOPSOUND() StopSound
11 pascal WAITSOUNDSTATE(word) WaitSoundState(1) 11 pascal WAITSOUNDSTATE(word) WaitSoundState
12 pascal SYNCALLVOICES() SyncAllVoices() 12 pascal SYNCALLVOICES() SyncAllVoices
13 pascal COUNTVOICENOTES(word) CountVoiceNotes(1) 13 pascal COUNTVOICENOTES(word) CountVoiceNotes
14 pascal GETTHRESHOLDEVENT() GetThresholdEvent() 14 pascal GETTHRESHOLDEVENT() GetThresholdEvent
15 pascal GETTHRESHOLDSTATUS() GetThresholdStatus() 15 pascal GETTHRESHOLDSTATUS() GetThresholdStatus
16 pascal SETVOICETHRESHOLD(word word) SetVoiceThreshold(1 2) 16 pascal SETVOICETHRESHOLD(word word) SetVoiceThreshold
17 pascal DOBEEP() DoBeep() 17 pascal DOBEEP() DoBeep
name storage
id 23
length 104
#1 STGCREATEDOCFILE
#2 STGCREATEDOCFILEONILOCKBYTES
#3 STGOPENSTORAGE
#4 STGOPENSTORAGEONILOCKBYTES
#5 STGISSTORAGEFILE
#6 STGISSTORAGEILOCKBYTES
#7 STGSETTIMES
#8 WEP
#9 ___EXPORTEDSTUB
#103 DLLGETCLASSOBJECT
# summary: resource modification dll # summary: resource modification dll
# #
name stress name stress
id 10 id 9
length 15 length 15
2 pascal allocmem(long) AllocMem(1) 2 pascal allocmem(long) AllocMem
3 pascal freeallmem() FreeAllMem() 3 pascal freeallmem() FreeAllMem
6 pascal allocfilehandles(word) AllocFileHandles(1) 6 pascal allocfilehandles(word) AllocFileHandles
7 pascal unallocfilehandles() UnAllocFileHandles() 7 pascal unallocfilehandles() UnAllocFileHandles
8 pascal getfreefilehandles() GetFreeFileHandles() 8 pascal getfreefilehandles() GetFreeFileHandles
10 pascal allocdiskspace(long word) AllocDiskSpace(1 2) 10 pascal allocdiskspace(long word) AllocDiskSpace
11 pascal unallocdiskspace(word) UnAllocDiskSpace(1) 11 pascal unallocdiskspace(word) UnAllocDiskSpace
12 pascal allocusermem(word) AllocUserMem(1) 12 pascal allocusermem(word) AllocUserMem
13 pascal freeallusermem() FreeAllUserMem() 13 pascal freeallusermem() FreeAllUserMem
14 pascal allocgdimem(word) AllocGDIMem(1) 14 pascal allocgdimem(word) AllocGDIMem
15 pascal freeallgdimem() FreeAllGDIMem() 15 pascal freeallgdimem() FreeAllGDIMem
name system name system
id 12 id 11
length 20 length 20
6 pascal GetSystemmsecCount() GetTickCount() 6 pascal GetSystemmsecCount() GetTickCount
name toolhelp name toolhelp
id 13 id 12
length 83 length 83
# 50 1 057b GLOBALHANDLETOSEL exported, shared data 50 pascal16 GlobalHandleToSel(word) GlobalHandleToSel
# 51 1 0318 GLOBALFIRST exported, shared data # 51 1 0318 GLOBALFIRST exported, shared data
# 52 1 0399 GLOBALNEXT exported, shared data # 52 1 0399 GLOBALNEXT exported, shared data
# 53 1 02a2 GLOBALINFO exported, shared data # 53 1 02a2 GLOBALINFO exported, shared data
# 54 1 0417 GLOBALENTRYHANDLE exported, shared data # 54 1 0417 GLOBALENTRYHANDLE exported, shared data
# 55 1 04a9 GLOBALENTRYMODULE exported, shared data # 55 1 04a9 GLOBALENTRYMODULE exported, shared data
# 56 1 090e LOCALINFO exported, shared data 56 pascal16 LocalInfo(ptr word) LocalInfo
# 57 1 095e LOCALFIRST exported, shared data 57 pascal16 LocalFirst(ptr word) LocalFirst
# 58 1 09e9 LOCALNEXT exported, shared data 58 pascal16 LocalNext(ptr) LocalNext
59 pascal ModuleFirst(ptr) ModuleFirst(1) 59 pascal16 ModuleFirst(ptr) ModuleFirst
60 pascal ModuleNext(ptr) ModuleNext(1) 60 pascal16 ModuleNext(ptr) ModuleNext
61 pascal ModuleFindName(ptr ptr) ModuleFindName(1 2) 61 pascal16 ModuleFindName(ptr ptr) ModuleFindName
62 pascal ModuleFindHandle(ptr word) ModuleFindHandle(1 2) 62 pascal16 ModuleFindHandle(ptr word) ModuleFindHandle
63 pascal16 TaskFirst(ptr) TaskFirst(1) 63 pascal16 TaskFirst(ptr) TaskFirst
64 pascal16 TaskNext(ptr) TaskNext(1) 64 pascal16 TaskNext(ptr) TaskNext
65 pascal16 TaskFindHandle(ptr word) TaskFindHandle(1 2) 65 pascal16 TaskFindHandle(ptr word) TaskFindHandle
# 66 1 0f1c STACKTRACEFIRST exported, shared data # 66 1 0f1c STACKTRACEFIRST exported, shared data
# 67 1 0f67 STACKTRACECSIPFIRST exported, shared data # 67 1 0f67 STACKTRACECSIPFIRST exported, shared data
# 68 1 0fca STACKTRACENEXT exported, shared data # 68 1 0fca STACKTRACENEXT exported, shared data
# 69 1 28b0 CLASSFIRST exported, shared data 69 pascal16 ClassFirst(ptr) ClassFirst
# 70 1 2925 CLASSNEXT exported, shared data 70 pascal16 ClassNext(ptr) ClassNext
# 71 1 11ce SYSTEMHEAPINFO exported, shared data 71 pascal16 SystemHeapInfo(ptr) SystemHeapInfo
72 pascal16 MemManInfo(ptr) MemManInfo(1) #72 pascal16 MemManInfo(ptr) MemManInfo
# 73 1 1b72 NOTIFYREGISTER exported, shared data # 73 1 1b72 NOTIFYREGISTER exported, shared data
# 74 1 1c29 NOTIFYUNREGISTER exported, shared data # 74 1 1c29 NOTIFYUNREGISTER exported, shared data
# 75 1 2060 INTERRUPTREGISTER exported, shared data # 75 1 2060 INTERRUPTREGISTER exported, shared data
# 76 1 2111 INTERRUPTUNREGISTER exported, shared data # 76 1 2111 INTERRUPTUNREGISTER exported, shared data
# 77 1 26ea TERMINATEAPP exported, shared data # 77 1 26ea TERMINATEAPP exported, shared data
# 78 1 29c4 MEMORYREAD exported, shared data 78 pascal MemoryRead(word long ptr long) MemoryRead
# 79 1 2b6c MEMORYWRITE exported, shared data 79 pascal MemoryWrite(word long ptr long) MemoryWrite
# 80 1 2dae TIMERCOUNT exported, shared data # 80 1 2dae TIMERCOUNT exported, shared data
# 81 1 0d68 TASKSETCSIP exported, shared data # 81 1 0d68 TASKSETCSIP exported, shared data
# 82 1 0d97 TASKGETCSIP exported, shared data # 82 1 0d97 TASKGETCSIP exported, shared data
......
# $Id: unixlib.spec,v 1.3 1993/07/04 04:04:21 root Exp root $
#
name unixlib
id 4
length 10
1 c _DebugPrintString(ptr) DebugPrintString(1)
# $Id: win87em.spec,v 1.3 1993/07/04 04:04:21 root Exp root $
#
name win87em name win87em
id 5 id 4
length 10 length 10
1 register _fpMath(word word word word 1 register _fpMath() WIN87_fpmath
word word word word) WIN87_fpmath() 3 pascal __WinEm87Info(ptr word) WIN87_WinEm87Info
3 pascal __WinEm87Info(ptr word) WIN87_WinEm87Info(1 2) 4 pascal __WinEm87Restore(ptr word) WIN87_WinEm87Restore
4 pascal __WinEm87Restore(ptr word) WIN87_WinEm87Restore(1 2) 5 pascal __WinEm87Save(ptr word) WIN87_WinEm87Save
5 pascal __WinEm87Save(ptr word) WIN87_WinEm87Save(1 2)
...@@ -4,64 +4,59 @@ ...@@ -4,64 +4,59 @@
# Summary: Module definition file for Windows Sockets DLL. # Summary: Module definition file for Windows Sockets DLL.
# #
name winsock name winsock
id 9 id 8
length 155 length 155
1 pascal16 accept(word ptr ptr) WINSOCK_accept(1 2 3) 1 pascal16 accept(word ptr ptr) WINSOCK_accept
2 pascal16 bind(word ptr word) WINSOCK_bind(1 2 3) 2 pascal16 bind(word ptr word) WINSOCK_bind
3 pascal16 closesocket(word) WINSOCK_closesocket(1) 3 pascal16 closesocket(word) WINSOCK_closesocket
4 pascal16 connect(word ptr word) WINSOCK_connect(1 2 3) 4 pascal16 connect(word ptr word) WINSOCK_connect
5 pascal16 getpeername(word ptr ptr) WINSOCK_getpeername(1 2 3) 5 pascal16 getpeername(word ptr ptr) WINSOCK_getpeername
6 pascal16 getsockname(word ptr ptr) WINSOCK_getsockname(1 2 3) 6 pascal16 getsockname(word ptr ptr) WINSOCK_getsockname
7 pascal16 getsockopt(word word word ptr ptr) WINSOCK_getsockopt(1 2 3 4 5) 7 pascal16 getsockopt(word word word ptr ptr) WINSOCK_getsockopt
8 pascal htonl(long) WINSOCK_htonl(1) 8 pascal htonl(long) WINSOCK_htonl
9 pascal16 htons(word) WINSOCK_htons(1) 9 pascal16 htons(word) WINSOCK_htons
10 pascal inet_addr(long) WINSOCK_inet_addr(1) 10 pascal inet_addr(long) WINSOCK_inet_addr
11 pascal inet_ntoa(long) WINSOCK_inet_ntoa(1) 11 pascal inet_ntoa(long) WINSOCK_inet_ntoa
12 pascal16 ioctlsocket(word long ptr) WINSOCK_ioctlsocket(1 2 3) 12 pascal16 ioctlsocket(word long ptr) WINSOCK_ioctlsocket
13 pascal16 listen(word word) WINSOCK_listen(1 2) 13 pascal16 listen(word word) WINSOCK_listen
14 pascal ntohl(long) WINSOCK_ntohl(1) 14 pascal ntohl(long) WINSOCK_ntohl
15 pascal16 ntohs(word) WINSOCK_ntohs(1) 15 pascal16 ntohs(word) WINSOCK_ntohs
16 pascal16 recv(word ptr word word) WINSOCK_recv(1 2 3 4) 16 pascal16 recv(word ptr word word) WINSOCK_recv
17 pascal16 recvfrom(word ptr word word ptr ptr) 17 pascal16 recvfrom(word ptr word word ptr ptr) WINSOCK_recvfrom
WINSOCK_recvfrom(1 2 3 4 5 6) 18 pascal16 select(word ptr ptr ptr ptr word) WINSOCK_select
18 pascal16 select(word ptr ptr ptr ptr word) 19 pascal16 send(word ptr word word) WINSOCK_send
WINSOCK_select(1 2 3 4 5 6) 20 pascal16 sendto(word ptr word word ptr ptr) WINSOCK_sendto
19 pascal16 send(word ptr word word) WINSOCK_send(1 2 3 4) 21 pascal16 setsockopt(word word word ptr word) WINSOCK_setsockopt
20 pascal16 sendto(word ptr word word ptr ptr) 22 pascal16 shutdown(word word) WINSOCK_shutdown
WINSOCK_sendto(1 2 3 4 5 6) 23 pascal16 socket(word word word) WINSOCK_socket
21 pascal16 setsockopt(word word word ptr word) 51 pascal gethostbyaddr(ptr word word) WINSOCK_gethostbyaddr
WINSOCK_setsockopt(1 2 3 4 5) 52 pascal gethostbyname(ptr) WINSOCK_gethostbyname
22 pascal16 shutdown(word word) WINSOCK_shutdown(1 2) 53 pascal getprotobyname(ptr) WINSOCK_getprotobyname
23 pascal16 socket(word word word) WINSOCK_socket(1 2 3) 54 pascal getprotobynumber(word) WINSOCK_getprotobynumber
51 pascal gethostbyaddr(ptr word word) WINSOCK_gethostbyaddr(1 2 3) 55 pascal getservbyname(ptr ptr) WINSOCK_getservbyname
52 pascal gethostbyname(ptr) WINSOCK_gethostbyname(1) 56 pascal getservbyport(word ptr) WINSOCK_getservbyport
53 pascal getprotobyname(ptr) WINSOCK_getprotobyname(1) 57 pascal gethostname(ptr word) WINSOCK_gethostname
54 pascal getprotobynumber(word) WINSOCK_getprotobynumber(1) 101 pascal16 WSAAsyncSelect(word word word long) WSAAsyncSelect
55 pascal getservbyname(ptr ptr) WINSOCK_getservbyname(1 2)
56 pascal getservbyport(word ptr) WINSOCK_getservbyport(1 2)
57 pascal gethostname(ptr word) WINSOCK_gethostname(1 2)
101 pascal16 WSAAsyncSelect(word word word long)
WSAAsyncSelect(1 2 3 4)
102 pascal16 WSAAsyncGetHostByAddr(word word ptr word word ptr word) 102 pascal16 WSAAsyncGetHostByAddr(word word ptr word word ptr word)
WSAAsyncGetHostByAddr(1 2 3 4 5 6 7) WSAAsyncGetHostByAddr
103 pascal16 WSAAsyncGetHostByName(word word ptr ptr word) 103 pascal16 WSAAsyncGetHostByName(word word ptr ptr word)
WSAAsyncGetHostByName(1 2 3 4 5) WSAAsyncGetHostByName
104 pascal16 WSAAsyncGetProtoByNumber(word word word ptr word) 104 pascal16 WSAAsyncGetProtoByNumber(word word word ptr word)
WSAAsyncGetProtoByNumber(1 2 3 4 5) WSAAsyncGetProtoByNumber
105 pascal16 WSAAsyncGetProtoByName(word word ptr ptr word) 105 pascal16 WSAAsyncGetProtoByName(word word ptr ptr word)
WSAAsyncGetProtoByName(1 2 3 4 5) WSAAsyncGetProtoByName
106 pascal16 WSAAsyncGetServByPort(word word word ptr ptr word) 106 pascal16 WSAAsyncGetServByPort(word word word ptr ptr word)
WSAAsyncGetServByPort(1 2 3 4 5 6) WSAAsyncGetServByPort
107 pascal16 WSAAsyncGetServByName(word word ptr ptr ptr word) 107 pascal16 WSAAsyncGetServByName(word word ptr ptr ptr word)
WSAAsyncGetServByName(1 2 3 4 5 6) WSAAsyncGetServByName
108 pascal16 WSACancelAsyncRequest(word) WSACancelAsyncRequest(1) 108 pascal16 WSACancelAsyncRequest(word) WSACancelAsyncRequest
109 pascal16 WSASetBlockingHook() WSASetBlockingHook() 109 pascal16 WSASetBlockingHook() WSASetBlockingHook
110 pascal16 WSAUnhookBlockingHook() WSAUnhookBlockingHook() 110 pascal16 WSAUnhookBlockingHook() WSAUnhookBlockingHook
111 pascal16 WSAGetLastError() WSAGetLastError() 111 pascal16 WSAGetLastError() WSAGetLastError
112 pascal WSASetLastError(word) WSASetLastError(1) 112 pascal WSASetLastError(word) WSASetLastError
113 pascal16 WSACancelBlockingCall() WSACancelBlockingCall() 113 pascal16 WSACancelBlockingCall() WSACancelBlockingCall
114 pascal16 WSAIsBlocking() WSAIsBlocking() 114 pascal16 WSAIsBlocking() WSAIsBlocking
115 pascal WSAStartup(word ptr) WSAStartup(1 2) 115 pascal WSAStartup(word ptr) WSAStartup
116 pascal WSACleanup() WSACleanup() 116 pascal WSACleanup() WSACleanup
151 pascal16 __WSAFDIsSet(word ptr) WSAFDIsSet(1 2) 151 pascal16 __WSAFDIsSet(word ptr) WSAFDIsSet
...@@ -28,10 +28,7 @@ typedef struct ...@@ -28,10 +28,7 @@ typedef struct
#ifdef WINELIB #ifdef WINELIB
#define LocalAlign(flags,bytes) LocalAlloc (flags|LMEM_WINE_ALIGN,bytes) #define LocalAlign(flags,bytes) LocalAlloc (flags|LMEM_WINE_ALIGN,bytes)
#else #else
#define LocalAlign(flags,bytes) WIN16_LocalAlloc((flags),(bytes)) #define LocalAlign(flags,bytes) LocalAlloc((flags),(bytes))
#define LocalAlloc WIN16_LocalAlloc
#define LocalLock WIN16_LocalLock
#define LocalFree WIN16_LocalFree
#endif #endif
#endif /* ATOM_H */ #endif /* ATOM_H */
...@@ -29,6 +29,7 @@ typedef struct tagDCE ...@@ -29,6 +29,7 @@ typedef struct tagDCE
} DCE; } DCE;
extern void DCE_Init(void);
extern HANDLE DCE_AllocDCE( DCE_TYPE type ); extern HANDLE DCE_AllocDCE( DCE_TYPE type );
extern void DCE_FreeDCE( HANDLE hdce ); extern void DCE_FreeDCE( HANDLE hdce );
......
...@@ -20,7 +20,7 @@ typedef struct resource_name_table ...@@ -20,7 +20,7 @@ typedef struct resource_name_table
struct ne_data { struct ne_data {
struct ne_header_s *ne_header; struct ne_header_s *ne_header;
struct ne_segment_table_entry_s *seg_table; struct ne_segment_table_entry_s *seg_table;
struct segment_descriptor_s *selector_table; unsigned short *selector_table;
char *lookup_table; char *lookup_table;
char *nrname_table; char *nrname_table;
char *rname_table; char *rname_table;
...@@ -61,7 +61,6 @@ extern struct w_files *wine_files; ...@@ -61,7 +61,6 @@ extern struct w_files *wine_files;
#define DLL_MAX_ARGS 16 #define DLL_MAX_ARGS 16
#define DLL_HANDLERTYPE_PASCAL 16 #define DLL_HANDLERTYPE_PASCAL 16
#define DLL_HANDLERTYPE_C 17
struct dll_table_entry_s struct dll_table_entry_s
{ {
...@@ -76,7 +75,6 @@ struct dll_table_entry_s ...@@ -76,7 +75,6 @@ struct dll_table_entry_s
*/ */
char *export_name; char *export_name;
void *handler; /* Address of function to process request */ void *handler; /* Address of function to process request */
char handler_type; /* C or PASCAL calling convention */
char n_args; /* Number of arguments passed to function */ char n_args; /* Number of arguments passed to function */
short conv_reference ; /* reference to Argument conversion data */ short conv_reference ; /* reference to Argument conversion data */
#ifdef WINESTAT #ifdef WINESTAT
...@@ -97,7 +95,6 @@ struct dll_name_table_entry_s ...@@ -97,7 +95,6 @@ struct dll_name_table_entry_s
extern struct dll_table_entry_s KERNEL_table[]; extern struct dll_table_entry_s KERNEL_table[];
extern struct dll_table_entry_s USER_table[]; extern struct dll_table_entry_s USER_table[];
extern struct dll_table_entry_s GDI_table[]; extern struct dll_table_entry_s GDI_table[];
extern struct dll_table_entry_s UNIXLIB_table[];
extern struct dll_table_entry_s WIN87EM_table[]; extern struct dll_table_entry_s WIN87EM_table[];
extern struct dll_table_entry_s MMSYSTEM_table[]; extern struct dll_table_entry_s MMSYSTEM_table[];
extern struct dll_table_entry_s SHELL_table[]; extern struct dll_table_entry_s SHELL_table[];
...@@ -116,12 +113,13 @@ extern struct dll_table_entry_s OLE2NLS_table[]; ...@@ -116,12 +113,13 @@ extern struct dll_table_entry_s OLE2NLS_table[];
extern struct dll_table_entry_s OLE2PROX_table[]; extern struct dll_table_entry_s OLE2PROX_table[];
extern struct dll_table_entry_s OLECLI_table[]; extern struct dll_table_entry_s OLECLI_table[];
extern struct dll_table_entry_s OLESVR_table[]; extern struct dll_table_entry_s OLESVR_table[];
extern struct dll_table_entry_s COMPOBJ_table[];
extern struct dll_table_entry_s STORAGE_table[];
extern unsigned short KERNEL_offsets[]; extern unsigned short KERNEL_offsets[];
extern unsigned short USER_offsets[]; extern unsigned short USER_offsets[];
extern unsigned short GDI_offsets[]; extern unsigned short GDI_offsets[];
extern unsigned short UNIXLIB_offsets[];
extern unsigned short WIN87EM_offsets[]; extern unsigned short WIN87EM_offsets[];
extern unsigned short MMSYSTEM_offsets[]; extern unsigned short MMSYSTEM_offsets[];
extern unsigned short SHELL_offsets[]; extern unsigned short SHELL_offsets[];
...@@ -140,12 +138,13 @@ extern unsigned short OLE2NLS_offsets[]; ...@@ -140,12 +138,13 @@ extern unsigned short OLE2NLS_offsets[];
extern unsigned short OLE2PROX_offsets[]; extern unsigned short OLE2PROX_offsets[];
extern unsigned short OLECLI_offsets[]; extern unsigned short OLECLI_offsets[];
extern unsigned short OLESVR_offsets[]; extern unsigned short OLESVR_offsets[];
extern unsigned short COMPOBJ_offsets[];
extern unsigned short STORAGE_offsets[];
extern unsigned char KERNEL_types[]; extern unsigned char KERNEL_types[];
extern unsigned char USER_types[]; extern unsigned char USER_types[];
extern unsigned char GDI_types[]; extern unsigned char GDI_types[];
extern unsigned char UNIXLIB_types[];
extern unsigned char WIN87EM_types[]; extern unsigned char WIN87EM_types[];
extern unsigned char MMSYSTEM_types[]; extern unsigned char MMSYSTEM_types[];
extern unsigned char SHELL_types[]; extern unsigned char SHELL_types[];
...@@ -164,8 +163,10 @@ extern unsigned char OLE2NLS_types[]; ...@@ -164,8 +163,10 @@ extern unsigned char OLE2NLS_types[];
extern unsigned char OLE2PROX_types[]; extern unsigned char OLE2PROX_types[];
extern unsigned char OLECLI_types[]; extern unsigned char OLECLI_types[];
extern unsigned char OLESVR_types[]; extern unsigned char OLESVR_types[];
extern unsigned char COMPOBJ_types[];
extern unsigned char STORAGE_types[];
#define N_BUILTINS 22 #define N_BUILTINS 23
#endif /* DLLS_H */ #endif /* DLLS_H */
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include "windows.h" #include "windows.h"
#include "segmem.h" #include "ldt.h"
#include "heap.h" #include "local.h"
/* GDI objects magic numbers */ /* GDI objects magic numbers */
#define PEN_MAGIC 0x4f47 #define PEN_MAGIC 0x4f47
...@@ -246,17 +246,25 @@ typedef struct tagDC ...@@ -246,17 +246,25 @@ typedef struct tagDC
#ifdef WINELIB #ifdef WINELIB
#define GDI_HEAP_ALLOC(f,size) LocalAlloc (f,size) #define GDI_HEAP_ALLOC(f,size) LocalAlloc (f,size)
#define GDI_HEAP_ADDR(handle) LocalLock (handle) #define GDI_HEAP_LIN_ADDR(handle) LocalLock (handle)
#define GDI_HEAP_SEG_ADDR(handle) LocalLock (handle)
#define GDI_HEAP_FREE(handle) LocalFree (handle) #define GDI_HEAP_FREE(handle) LocalFree (handle)
#else #else
extern MDESC *GDI_Heap; extern LPSTR GDI_Heap;
extern WORD GDI_HeapSel;
#define GDI_HEAP_ALLOC(f,size) ((int)HEAP_Alloc(&GDI_Heap,f,size) & 0xffff)
#define GDI_HEAP_FREE(handle) (HEAP_Free(&GDI_Heap,GDI_HEAP_ADDR(handle))) #define GDI_HEAP_ALLOC(size) \
#define GDI_HEAP_ADDR(handle) \ LOCAL_Alloc( GDI_HeapSel, LMEM_FIXED, (size) )
((void *)((handle) ? ((handle) | ((int)GDI_Heap & 0xffff0000)) : 0)) #define GDI_HEAP_REALLOC(handle,size) \
LOCAL_ReAlloc( GDI_HeapSel, (handle), (size), LMEM_FIXED )
#define GDI_HEAP_FREE(handle) \
LOCAL_Free( GDI_HeapSel, (handle) )
#define GDI_HEAP_LIN_ADDR(handle) \
((handle) ? PTR_SEG_OFF_TO_LIN(GDI_HeapSel, (handle)) : NULL)
#define GDI_HEAP_SEG_ADDR(handle) \
((handle) ? MAKELONG((handle), GDI_HeapSel) : 0)
#endif #endif
......
/* $Id: heap.h,v 1.2 1993/07/04 04:04:21 root Exp root $
*/
/*
* Copyright Robert J. Amstadt, 1993
*/
#ifndef HEAP_H
#define HEAP_H
#include "segmem.h"
#include "atom.h"
#include "stackframe.h"
/**********************************************************************
* LOCAL HEAP STRUCTURES AND FUNCTIONS
*/
typedef struct heap_mem_desc_s
{
struct heap_mem_desc_s *prev, *next;
unsigned short length;
unsigned char lock;
unsigned char flags;
} MDESC;
typedef struct heap_local_heap_s
{
struct heap_local_heap_s *next;
MDESC *free_list;
ATOMTABLE *local_table;
unsigned short selector;
unsigned short delta; /* Number saved for Windows compat. */
} LHEAP;
extern void HEAP_Init(MDESC **free_list, void *start, int length);
extern void *HEAP_Alloc(MDESC **free_list, int flags, int bytes);
extern int HEAP_Free(MDESC **free_list, void *block);
extern void *HEAP_ReAlloc(MDESC **free_list, void *old_block,
int new_size, unsigned int flags);
extern LHEAP *HEAP_LocalFindHeap(unsigned short owner);
extern unsigned int HEAP_LocalSize(MDESC **free_list, unsigned int handle);
extern void HEAP_LocalInit(unsigned short owner, void *start, int length);
extern void *WIN16_LocalAlloc(int flags, int bytes);
extern int WIN16_LocalCompact(int min_free);
extern unsigned int WIN16_LocalFlags(unsigned int handle);
extern unsigned int WIN16_LocalFree(unsigned int handle);
extern void *WIN16_LocalLock(unsigned int handle);
extern void *WIN16_LocalReAlloc(unsigned int handle, int flags, int bytes);
extern unsigned int WIN16_LocalUnlock(unsigned int handle);
/* Use ds instead of owner of cs */
#define HEAP_OWNER (pStack16Frame->ds)
#define LOCALHEAP() (&HEAP_LocalFindHeap(HEAP_OWNER)->free_list)
#define LOCALATOMTABLE() (&HEAP_LocalFindHeap(HEAP_OWNER)->local_table)
/**********************************************************************
* GLOBAL HEAP STRUCTURES AND FUNCTIONS:
*
* Global memory pool descriptor. Segments MUST be maintained in segment
* ascending order. If not the reallocation routine will die a horrible
* death.
*
* handle = 0, this descriptor contains the address of a free pool.
* != 0, this describes an allocated block.
*
* sequence = 0, this is not a huge block
* > 0, this is a portion of a huge block
* =-1, this is a free segment
*
* addr - address of this memory block.
*
* length - used to maintain huge blocks.
*/
typedef struct global_mem_desc_s
{
struct global_mem_desc_s *next; /* Next GDESC in list */
struct global_mem_desc_s *prev; /* Previous GDESC in list */
unsigned short handle; /* Handle of this block. */
short sequence; /* Block sequence # in huge block */
void *addr; /* Address allocated with mmap() */
int length; /* Length of block */
int lock_count; /* Block lock count */
unsigned short alias; /* Offset-zero alias selector */
unsigned int alias_key; /* Offset-zero alias sh. mem. key */
void *linear_addr; /* Linear address of huge block */
int linear_key; /* Linear shared memory key */
int linear_count; /* Linear lock count */
} GDESC;
extern GDESC *GlobalList;
extern void *GlobalQuickAlloc(int size);
extern unsigned int GlobalHandleFromPointer(void *block);
extern GDESC *GlobalGetGDesc(unsigned int block);
extern void *GlobalLinearLock(unsigned int block);
extern unsigned int GlobalLinearUnlock(unsigned int block);
#endif /* HEAP_H */
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#define HOOK_H #define HOOK_H
#include "windows.h" #include "windows.h"
#include "user.h" #include "ldt.h"
/* Hook data (pointed to by a HHOOK) */ /* Hook data (pointed to by a HHOOK) */
typedef struct typedef struct
...@@ -26,7 +26,8 @@ typedef struct ...@@ -26,7 +26,8 @@ typedef struct
#define SYSTEM_HOOK(id) (systemHooks[(id)-FIRST_HOOK]) #define SYSTEM_HOOK(id) (systemHooks[(id)-FIRST_HOOK])
#define TASK_HOOK(id) (taskHooks[(id)-FIRST_HOOK]) #define TASK_HOOK(id) (taskHooks[(id)-FIRST_HOOK])
#define INTERNAL_CALL_HOOK(hhook,code,wparam,lparam) \ #define INTERNAL_CALL_HOOK(hhook,code,wparam,lparam) \
((hhook) ? CallHookProc(((HOOKDATA*)(hhook))->proc,code,wparam,lparam) : 0) ((hhook) ? CallHookProc(((HOOKDATA*)PTR_SEG_TO_LIN(hhook))->proc,\
code, wparam, lparam) : 0)
#define CALL_SYSTEM_HOOK(id,code,wparam,lparam) \ #define CALL_SYSTEM_HOOK(id,code,wparam,lparam) \
INTERNAL_CALL_HOOK(SYSTEM_HOOK(id),code,wparam,lparam) INTERNAL_CALL_HOOK(SYSTEM_HOOK(id),code,wparam,lparam)
......
...@@ -8,7 +8,6 @@ extern int CallToInit16(unsigned long csip, unsigned long sssp, ...@@ -8,7 +8,6 @@ extern int CallToInit16(unsigned long csip, unsigned long sssp,
extern int CallTo16cx(unsigned long csip, unsigned long dscx); extern int CallTo16cx(unsigned long csip, unsigned long dscx);
extern int CallToDllEntry(unsigned long csip, unsigned long dscx, unsigned short di); extern int CallToDllEntry(unsigned long csip, unsigned long dscx, unsigned short di);
extern int CallBack16(void *func, int n_args, ...); extern int CallBack16(void *func, int n_args, ...);
extern void *CALLBACK_MakeProcInstance(void *func, int instance);
extern void CallLineDDAProc(FARPROC func, short xPos, short yPos, long lParam); extern void CallLineDDAProc(FARPROC func, short xPos, short yPos, long lParam);
extern void winestat(void); extern void winestat(void);
extern int DLLRelay(unsigned int func_num, unsigned int seg_off); extern int DLLRelay(unsigned int func_num, unsigned int seg_off);
......
/*
* Instance data declaration
*
* Copyright 1995 Alexandre Julliard
*/
#ifndef __WINE_INSTANCE_H
#define __WINE_INSTANCE_H
#include "wintypes.h"
/* This structure is always located at offset 0 of the DGROUP segment */
typedef struct
{
WORD null; /* Always 0 */
WORD old_sp; /* Stack pointer; used by SwitchTaskTo() */
WORD old_ss; /* Stack segment; used by SwitchTaskTo() */
WORD heap; /* Pointer to the local heap information (if any) */
WORD atomtable; /* Pointer to the local atom table (if any) */
WORD stacktop; /* Top of the stack */
WORD stackmin; /* Lowest stack address used so far */
WORD stackbottom; /* Bottom of the stack */
} INSTANCEDATA;
#endif /* __WINE_INSTANCE_H */
/*
* LDT copy
*
* Copyright 1995 Alexandre Julliard
*/
#ifndef _WINE_LDT_H
#define _WINE_LDT_H
enum seg_type
{
SEGMENT_DATA = 0,
SEGMENT_STACK = 1,
SEGMENT_CODE = 2
};
/* This structure represents a real LDT entry. */
/* It is used by get_ldt_entry() and set_ldt_entry(). */
typedef struct
{
unsigned long base; /* base address */
unsigned long limit; /* segment limit */
int seg_32bit; /* is segment 32-bit? */
int read_only; /* is segment read-only? */
int limit_in_pages; /* is the limit in pages or bytes? */
enum seg_type type; /* segment type */
} ldt_entry;
extern int LDT_GetEntry( int entry, ldt_entry *content );
extern int LDT_SetEntry( int entry, ldt_entry *content );
extern void LDT_Print();
/* This structure is used to build the local copy of the LDT. */
typedef struct
{
unsigned long base; /* base address or 0 if entry is free */
unsigned long limit; /* limit in bytes or 0 if entry is free */
} ldt_copy_entry;
#define LDT_SIZE 8192
extern ldt_copy_entry ldt_copy[LDT_SIZE];
#define __AHSHIFT 3
#define __AHINCR (1 << __AHSHIFT)
#define SELECTOR_TO_ENTRY(sel) ((int)(sel) >> __AHSHIFT)
#define ENTRY_TO_SELECTOR(i) ((i) ? (((int)(i) << __AHSHIFT) | 7) : 0)
#define IS_LDT_ENTRY_FREE(i) (!(ldt_copy[(i)].base || ldt_copy[(i)].limit))
#define IS_SELECTOR_FREE(sel) (IS_LDT_ENTRY_FREE(SELECTOR_TO_ENTRY(sel)))
#define GET_SEL_BASE(sel) (ldt_copy[SELECTOR_TO_ENTRY(sel)].base)
#define GET_SEL_LIMIT(sel) (ldt_copy[SELECTOR_TO_ENTRY(sel)].limit)
/* Convert a segmented ptr (16:16) to a linear (32) pointer */
#define PTR_SEG_TO_LIN(ptr) \
((void*)(GET_SEL_BASE((int)(ptr) >> 16) + ((int)(ptr) & 0xffff)))
#define PTR_SEG_OFF_TO_LIN(seg,off) \
((void*)(GET_SEL_BASE(seg) + ((int)(off) & 0xffff)))
#endif /* _WINE_LDT_H */
...@@ -30,7 +30,7 @@ typedef struct tagHEADLIST { ...@@ -30,7 +30,7 @@ typedef struct tagHEADLIST {
HWND hWndLogicParent; HWND hWndLogicParent;
HFONT hFont; HFONT hFont;
BOOL bRedrawFlag; BOOL bRedrawFlag;
MDESC *Heap; /* MDESC *Heap; */
} HEADLIST; } HEADLIST;
typedef HEADLIST FAR* LPHEADLIST; typedef HEADLIST FAR* LPHEADLIST;
......
/*
* Local heap declarations
*
* Copyright 1995 Alexandre Julliard
*/
#ifndef __WINE_HEAP_H
#define __WINE_HEAP_H
#include "wintypes.h"
/* These function are equivalent to the Local* API functions, */
/* excepted that they need DS as the first parameter. This */
/* allows managing several heaps from the emulation library. */
extern HLOCAL LOCAL_Alloc( WORD ds, WORD flags, WORD size );
extern HLOCAL LOCAL_ReAlloc( WORD ds, HLOCAL handle, WORD size, WORD flags );
extern HLOCAL LOCAL_Free( WORD ds, HLOCAL handle );
extern HLOCAL LOCAL_Handle( WORD ds, WORD addr );
extern WORD LOCAL_Size( WORD ds, HLOCAL handle );
extern WORD LOCAL_Flags( WORD ds, HLOCAL handle );
extern WORD LOCAL_HeapSize( WORD ds );
#endif /* __WINE_HEAP_H */
...@@ -54,7 +54,7 @@ extern BOOL MSG_CreateSysMsgQueue( int size ); ...@@ -54,7 +54,7 @@ extern BOOL MSG_CreateSysMsgQueue( int size );
extern void hardware_event( WORD message, WORD wParam, LONG lParam, extern void hardware_event( WORD message, WORD wParam, LONG lParam,
int xPos, int yPos, DWORD time, DWORD extraInfo ); int xPos, int yPos, DWORD time, DWORD extraInfo );
extern BOOL MSG_GetHardwareMessage( LPMSG msg ); extern BOOL MSG_GetHardwareMessage( LPMSG msg );
extern BOOL MSG_InternalGetMessage( LPMSG msg, HWND hwnd, HWND hwndOwner, extern BOOL MSG_InternalGetMessage( SEGPTR msg, HWND hwnd, HWND hwndOwner,
short code, WORD flags, BOOL sendIdle ); short code, WORD flags, BOOL sendIdle );
#endif /* MESSAGE_H */ #endif /* MESSAGE_H */
...@@ -15,6 +15,7 @@ struct dosdirent { ...@@ -15,6 +15,7 @@ struct dosdirent {
char search_attribute; char search_attribute;
long filesize; long filesize;
long filetime; long filetime;
short entnum; /* Directory entry number */
}; };
struct fcb { struct fcb {
...@@ -29,16 +30,13 @@ struct fcb { ...@@ -29,16 +30,13 @@ struct fcb {
BYTE dummy2[9]; BYTE dummy2[9];
}; };
#define DOSVERSION 0x0330; #define DOSVERSION 0x0500; /* Might as well pretend we're DOS 5.0 */
#define MAX_DOS_DRIVES 26 #define MAX_DOS_DRIVES 26
extern WORD ExtendedError; extern WORD ExtendedError;
extern struct DosDeviceStruct COM[MAX_PORTS]; extern struct DosDeviceStruct COM[MAX_PORTS];
extern struct DosDeviceStruct LPT[MAX_PORTS]; extern struct DosDeviceStruct LPT[MAX_PORTS];
#define segment(a) ((DWORD)(a) >> 16)
#define offset(a) ((DWORD)(a) & 0xffff)
#define setword(a,b) *(BYTE*)(a) = (b) & 0xff; \ #define setword(a,b) *(BYTE*)(a) = (b) & 0xff; \
*((BYTE*)((a)+1)) = ((b)>>8) & 0xff; *((BYTE*)((a)+1)) = ((b)>>8) & 0xff;
......
...@@ -133,11 +133,7 @@ struct relocation_entry_s ...@@ -133,11 +133,7 @@ struct relocation_entry_s
#define NE_RELTYPE_ORDINAL 1 #define NE_RELTYPE_ORDINAL 1
#define NE_RELTYPE_NAME 2 #define NE_RELTYPE_NAME 2
#define NE_RELTYPE_OSFIXUP 3 #define NE_RELTYPE_OSFIXUP 3
/* Used by Windows 3.0 programs, like when getting selector to be #define NE_RELFLAG_ADDITIVE 4
given to makeprocinst */
#define NE_RELTYPE_INT1 4
#define NE_RELTYPE_ORDINALADD 5
#define NE_RELTYPE_NAMEADD 6
/* /*
* DOS PSP * DOS PSP
......
...@@ -17,6 +17,8 @@ struct options ...@@ -17,6 +17,8 @@ struct options
int backingstore; /* Use backing store */ int backingstore; /* Use backing store */
short cmdShow; short cmdShow;
int debug; int debug;
int allowReadOnly; /* Opening a read only file will succeed even
if write access is requested */
}; };
extern struct options Options; extern struct options Options;
......
...@@ -9,22 +9,11 @@ ...@@ -9,22 +9,11 @@
#include <sys/types.h> #include <sys/types.h>
#include "neexe.h" #include "neexe.h"
#include "segmem.h"
#include "heap.h"
#include "msdos.h" #include "msdos.h"
#include "windows.h" #include "windows.h"
#ifndef WINELIB #ifndef WINELIB
/* loader/ldtlib.c */
struct segment_descriptor *
make_sd(unsigned base, unsigned limit, int contents, int read_exec_only, int seg32, int inpgs);
int get_ldt(void *buffer);
int set_ldt_entry(int entry, unsigned long base, unsigned int limit,
int seg_32bit_flag, int contents, int read_only_flag,
int limit_in_pages_flag);
/* loader/resource.c */ /* loader/resource.c */
extern HBITMAP ConvertCoreBitmap( HDC hdc, BITMAPCOREHEADER * image ); extern HBITMAP ConvertCoreBitmap( HDC hdc, BITMAPCOREHEADER * image );
...@@ -44,11 +33,6 @@ extern HINSTANCE LoadImage(char *modulename, int filetype, int change_dir); ...@@ -44,11 +33,6 @@ extern HINSTANCE LoadImage(char *modulename, int filetype, int change_dir);
extern int _WinMain(int argc, char **argv); extern int _WinMain(int argc, char **argv);
extern void InitializeLoadedDLLs(); extern void InitializeLoadedDLLs();
extern int KERNEL_LockSegment(int segment);
extern int KERNEL_UnlockSegment(int segment);
extern void KERNEL_InitTask(void);
extern int KERNEL_WaitEvent(int task);
/* misc/spy.c */ /* misc/spy.c */
extern void SpyInit(void); extern void SpyInit(void);
...@@ -57,9 +41,5 @@ extern void SpyInit(void); ...@@ -57,9 +41,5 @@ extern void SpyInit(void);
extern BOOL WIDGETS_Init(void); extern BOOL WIDGETS_Init(void);
/* windows/dce.c */
extern void DCE_Init(void);
#endif /* WINELIB */ #endif /* WINELIB */
#endif /* _WINE_PROTOTYPES_H */ #endif /* _WINE_PROTOTYPES_H */
...@@ -7,13 +7,11 @@ ...@@ -7,13 +7,11 @@
#include "wine.h" #include "wine.h"
#include "stackframe.h" #include "stackframe.h"
#define _CONTEXT ((struct sigcontext_struct *) pStack16Frame->args) #define _CONTEXT ((struct sigcontext_struct *) CURRENT_STACK16->args)
#define _AX (_CONTEXT->sc_eax) #define _AX (_CONTEXT->sc_eax)
#define _BX (_CONTEXT->sc_ebx) #define _BX (_CONTEXT->sc_ebx)
#define _CX (_CONTEXT->sc_ecx) #define _CX (_CONTEXT->sc_ecx)
#define _DX (_CONTEXT->sc_edx) #define _DX (_CONTEXT->sc_edx)
#define _SP (_CONTEXT->sc_esp)
#define _BP (_CONTEXT->sc_ebp)
#define _SI (_CONTEXT->sc_esi) #define _SI (_CONTEXT->sc_esi)
#define _DI (_CONTEXT->sc_edi) #define _DI (_CONTEXT->sc_edi)
#define _DS (_CONTEXT->sc_ds) #define _DS (_CONTEXT->sc_ds)
......
/* $Id: segmem.h,v 1.3 1993/07/04 04:04:21 root Exp root $
*/
/*
* Copyright Robert J. Amstadt, 1993
*/
#ifndef SEGMEM_H
#define SEGMEM_H
#include "wine.h"
#ifdef __linux__
#define HAVE_IPC
#include <sys/ipc.h>
#include <sys/shm.h>
#endif
#if defined(__NetBSD__) || defined(__FreeBSD__)
#define HAVE_IPC
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#define SHMSEG 32 /* XXX SEMMNI /usr/src/sys/conf/param.h */
#define SHM_RANGE_START 0x40000000
#endif
/*
* Array to track selector allocation.
*/
#define SELECTOR_ISFREE 0x8000
#define SELECTOR_IS32BIT 0x4000
#define SELECTOR_INDEXMASK 0x0fff
#define __AHSHIFT 3
#define __AHINCR (1 << __AHSHIFT)
extern unsigned short* SelectorMap;
#ifdef HAVE_IPC
#define SAFEMAKEPTR(s, o) ((void *)(((int) (s) << 16) | ((o) & 0xffff)))
#define FIXPTR(p) (p)
#else
#define SAFEMAKEPTR(s, o) \
((void*)(((int)SelectorMap[SelectorMap[(s)>>__AHSHIFT] & SELECTOR_INDEXMASK]\
<< (16 + __AHSHIFT)) | 0x70000 | ((o) & 0xffff)))
#define FIXPTR(p) SAFEMAKEPTR((unsigned long) (p) >> 16, (p))
#endif
#define MAKESELECTOR(fp) ((unsigned short) (fp >> (16 + __AHSHIFT)))
/*
* Structure to hold info about each selector we create.
*/
typedef struct segment_descriptor_s
{
void *base_addr; /* Pointer to segment in flat memory */
unsigned int length; /* Length of segment */
unsigned int flags; /* Segment flags (see neexe.h and below)*/
unsigned short selector; /* Selector used to access this segment */
unsigned short owner; /* Handle of owner program */
unsigned char type; /* DATA or CODE */
#ifdef HAVE_IPC
key_t shm_key; /* Shared memory key or -1 */
#endif
} SEGDESC;
extern int IPCCopySelector(int i_old, unsigned long new, int swap_type);
/*
* Additional flags
*/
#define NE_SEGFLAGS_MALLOCED 0x00010000 /* Memory allocated with malloc() */
/*
* Global memory flags
*/
#define GLOBAL_FLAGS_MOVEABLE 0x0002
#define GLOBAL_FLAGS_ZEROINIT 0x0040
#define GLOBAL_FLAGS_CODE 0x00010000
#define GLOBAL_FLAGS_EXECUTEONLY 0x00020000
#define GLOBAL_FLAGS_READONLY 0x00020000
#ifdef __ELF__
#define FIRST_SELECTOR 2
#define IS_16_BIT_ADDRESS(addr) \
(!(SelectorMap[(unsigned int)(addr) >> (16+__AHSHIFT)]& SELECTOR_IS32BIT))
#else
#define FIRST_SELECTOR 8
#define IS_16_BIT_ADDRESS(addr) \
((unsigned int)(addr) >= (((FIRST_SELECTOR << __AHSHIFT) | 7) << 16))
#endif
extern SEGDESC* Segments;
#endif /* SEGMEM_H */
/*
* Selector definitions
*
* Copyright 1995 Alexandre Julliard
*/
#ifndef __WINE_SELECTORS_H #ifndef __WINE_SELECTORS_H
#define __WINE_SELECTORS_H #define __WINE_SELECTORS_H
#include "dlls.h"
#include "segmem.h"
#include "windows.h" #include "windows.h"
#include "ldt.h"
extern int FindUnusedSelectors(int n_selectors); extern WORD SELECTOR_AllocBlock( void *base, DWORD size, enum seg_type type,
extern int IPCCopySelector(int i_old, unsigned long new, int swap_type); BOOL is32bit, BOOL readonly );
extern WORD AllocSelector(WORD old_selector); extern WORD SELECTOR_ReallocBlock( WORD sel, void *base, DWORD size,
extern unsigned int PrestoChangoSelector(unsigned src_selector, unsigned dst_selector); enum seg_type type, BOOL is32bit,
extern WORD AllocDStoCSAlias(WORD ds_selector); BOOL readonly );
extern SEGDESC *CreateSelectors(struct w_files * wpnt);
extern WORD FreeSelector(WORD sel); #include "dlls.h"
extern SEGDESC *CreateNewSegments(int code_flag, int read_only, int length, extern WORD *CreateSelectors( struct w_files * wpnt );
int n_segments);
extern SEGDESC *GetNextSegment(unsigned int flags, unsigned int limit);
extern unsigned int GetEntryDLLName(char *dll_name, char *function, int *sel, extern unsigned int GetEntryDLLName(char *dll_name, char *function, WORD *sel,
int *addr); int *addr);
extern unsigned int GetEntryDLLOrdinal(char *dll_name, int ordinal, int *sel, extern unsigned int GetEntryDLLOrdinal(char *dll_name, int ordinal, WORD *sel,
int *addr); int *addr);
extern unsigned int GetEntryPointFromOrdinal(struct w_files * wpnt, extern unsigned int GetEntryPointFromOrdinal(struct w_files * wpnt,
int ordinal); int ordinal);
......
...@@ -8,13 +8,13 @@ ...@@ -8,13 +8,13 @@
#define WINE_STACKFRAME_H #define WINE_STACKFRAME_H
#include <windows.h> #include <windows.h>
#include "ldt.h"
typedef struct typedef struct
{ {
WORD saved_ss; WORD saved_ss;
WORD saved_bp; WORD saved_bp;
WORD saved_sp; WORD saved_sp;
WORD es;
WORD ds; WORD ds;
WORD bp; WORD bp;
WORD arg_length; WORD arg_length;
...@@ -23,7 +23,13 @@ typedef struct ...@@ -23,7 +23,13 @@ typedef struct
WORD args[1]; WORD args[1];
} STACK16FRAME; } STACK16FRAME;
extern WORD IF1632_Saved16_ss;
extern WORD IF1632_Saved16_sp;
extern WORD IF1632_Saved16_bp;
extern STACK16FRAME *pStack16Frame; #define CURRENT_STACK16 \
((STACK16FRAME *)PTR_SEG_OFF_TO_LIN(IF1632_Saved16_ss,IF1632_Saved16_sp))
#define CURRENT_DS (CURRENT_STACK16->ds)
#endif /* WINE_STACKFRAME_H */ #endif /* WINE_STACKFRAME_H */
...@@ -102,6 +102,7 @@ ...@@ -102,6 +102,7 @@
#undef DEBUG_FIXUP #undef DEBUG_FIXUP
#undef DEBUG_FONT #undef DEBUG_FONT
#undef DEBUG_GDI #undef DEBUG_GDI
#undef DEBUG_GLOBAL
#undef DEBUG_GRAPHICS #undef DEBUG_GRAPHICS
#undef DEBUG_HEAP #undef DEBUG_HEAP
#undef DEBUG_ICON #undef DEBUG_ICON
...@@ -110,6 +111,7 @@ ...@@ -110,6 +111,7 @@
#undef DEBUG_KEYBOARD #undef DEBUG_KEYBOARD
#undef DEBUG_LDT #undef DEBUG_LDT
#undef DEBUG_LISTBOX #undef DEBUG_LISTBOX
#undef DEBUG_LOCAL
#undef DEBUG_MALLOC #undef DEBUG_MALLOC
#undef DEBUG_MCI #undef DEBUG_MCI
#undef DEBUG_MCIANIM #undef DEBUG_MCIANIM
...@@ -135,6 +137,7 @@ ...@@ -135,6 +137,7 @@
#undef DEBUG_RELAY #undef DEBUG_RELAY
#undef DEBUG_RESOURCE #undef DEBUG_RESOURCE
#undef DEBUG_SCROLL #undef DEBUG_SCROLL
#undef DEBUG_SELECTOR
#undef DEBUG_SELECTORS #undef DEBUG_SELECTORS
#undef DEBUG_STACK #undef DEBUG_STACK
#undef DEBUG_STRESS #undef DEBUG_STRESS
...@@ -142,6 +145,7 @@ ...@@ -142,6 +145,7 @@
#undef DEBUG_TASK #undef DEBUG_TASK
#undef DEBUG_TEXT #undef DEBUG_TEXT
#undef DEBUG_TIMER #undef DEBUG_TIMER
#undef DEBUG_TOOLHELP
#undef DEBUG_UTILITY #undef DEBUG_UTILITY
#undef DEBUG_WIN #undef DEBUG_WIN
#undef DEBUG_WINSOCK #undef DEBUG_WINSOCK
...@@ -174,6 +178,7 @@ ...@@ -174,6 +178,7 @@
#define DEBUG_FIXUP #define DEBUG_FIXUP
#define DEBUG_FONT #define DEBUG_FONT
#define DEBUG_GDI #define DEBUG_GDI
#define DEBUG_GLOBAL
#define DEBUG_GRAPHICS #define DEBUG_GRAPHICS
#define DEBUG_HEAP #define DEBUG_HEAP
#define DEBUG_ICON #define DEBUG_ICON
...@@ -182,6 +187,7 @@ ...@@ -182,6 +187,7 @@
#define DEBUG_KEYBOARD #define DEBUG_KEYBOARD
#define DEBUG_LDT #define DEBUG_LDT
#define DEBUG_LISTBOX #define DEBUG_LISTBOX
#define DEBUG_LOCAL
#define DEBUG_MALLOC #define DEBUG_MALLOC
#define DEBUG_MCI #define DEBUG_MCI
#define DEBUG_MCIANIM #define DEBUG_MCIANIM
...@@ -207,6 +213,7 @@ ...@@ -207,6 +213,7 @@
#define DEBUG_RELAY #define DEBUG_RELAY
#define DEBUG_RESOURCE #define DEBUG_RESOURCE
#define DEBUG_SCROLL #define DEBUG_SCROLL
#define DEBUG_SELECTOR
#define DEBUG_SELECTORS #define DEBUG_SELECTORS
#define DEBUG_STACK #define DEBUG_STACK
#define DEBUG_STRESS #define DEBUG_STRESS
...@@ -214,6 +221,7 @@ ...@@ -214,6 +221,7 @@
#define DEBUG_TASK #define DEBUG_TASK
#define DEBUG_TEXT #define DEBUG_TEXT
#define DEBUG_TIMER #define DEBUG_TIMER
#define DEBUG_TOOLHELP
#define DEBUG_UTILITY #define DEBUG_UTILITY
#define DEBUG_WIN #define DEBUG_WIN
#define DEBUG_WINSOCK #define DEBUG_WINSOCK
......
...@@ -3,14 +3,93 @@ ...@@ -3,14 +3,93 @@
#include "windows.h" #include "windows.h"
DECLARE_HANDLE(HMODULE);
DECLARE_HANDLE(HGLOBAL);
#define MAX_DATA 11 #define MAX_DATA 11
#define MAX_MODULE_NAME 9 #define MAX_MODULE_NAME 9
#define MAX_PATH 255 #define MAX_PATH 255
#define MAX_CLASSNAME 255 #define MAX_CLASSNAME 255
/* Global heap */
WORD GlobalHandleToSel( HANDLE handle );
/* Local heap */
typedef struct
{
DWORD dwSize;
WORD wcItems;
} LOCALINFO;
typedef struct
{
DWORD dwSize;
HLOCAL hHandle;
WORD wAddress;
WORD wSize;
WORD wFlags;
WORD wcLock;
WORD wType;
WORD hHeap;
WORD wHeapType;
WORD wNext;
} LOCALENTRY;
/* wHeapType values */
#define NORMAL_HEAP 0
#define USER_HEAP 1
#define GDI_HEAP 2
/* wFlags values */
#define LF_FIXED 1
#define LF_FREE 2
#define LF_MOVEABLE 4
/* wType values */
#define LT_NORMAL 0
#define LT_FREE 0xff
#define LT_GDI_PEN 1 /* LT_GDI_* is for GDI's heap */
#define LT_GDI_BRUSH 2
#define LT_GDI_FONT 3
#define LT_GDI_PALETTE 4
#define LT_GDI_BITMAP 5
#define LT_GDI_RGN 6
#define LT_GDI_DC 7
#define LT_GDI_DISABLED_DC 8
#define LT_GDI_METADC 9
#define LT_GDI_METAFILE 10
#define LT_GDI_MAX LT_GDI_METAFILE
#define LT_USER_CLASS 1 /* LT_USER_* is for USER's heap */
#define LT_USER_WND 2
#define LT_USER_STRING 3
#define LT_USER_MENU 4
#define LT_USER_CLIP 5
#define LT_USER_CBOX 6
#define LT_USER_PALETTE 7
#define LT_USER_ED 8
#define LT_USER_BWL 9
#define LT_USER_OWNERDRAW 10
#define LT_USER_SPB 11
#define LT_USER_CHECKPOINT 12
#define LT_USER_DCE 13
#define LT_USER_MWP 14
#define LT_USER_PROP 15
#define LT_USER_LBIV 16
#define LT_USER_MISC 17
#define LT_USER_ATOMS 18
#define LT_USER_LOCKINPUTSTATE 19
#define LT_USER_HOOKLIST 20
#define LT_USER_USERSEEUSERDOALLOC 21
#define LT_USER_HOTKEYLIST 22
#define LT_USER_POPUPMENU 23
#define LT_USER_HANDLETABLE 32
#define LT_USER_MAX LT_USER_HANDLETABLE
BOOL LocalInfo( LOCALINFO *pLocalInfo, HGLOBAL handle );
BOOL LocalFirst( LOCALENTRY *pLocalEntry, HGLOBAL handle );
BOOL LocalNext( LOCALENTRY *pLocalEntry );
/* modules */ /* modules */
typedef struct { typedef struct {
...@@ -73,16 +152,37 @@ typedef struct tagMEMMANINFO { ...@@ -73,16 +152,37 @@ typedef struct tagMEMMANINFO {
} MEMMANINFO; } MEMMANINFO;
typedef MEMMANINFO *LPMEMMANINFO; typedef MEMMANINFO *LPMEMMANINFO;
typedef struct tagSYSHEAPINFO { typedef struct
{
DWORD dwSize; DWORD dwSize;
WORD wUserFreePercent; WORD wUserFreePercent;
WORD wGDIFreePercent; WORD wGDIFreePercent;
HGLOBAL hUserSegment; HGLOBAL hUserSegment;
HGLOBAL hGDISegment; HGLOBAL hGDISegment;
} SYSHEAPINFO; } SYSHEAPINFO;
typedef SYSHEAPINFO *LPSYSHEAPINFO;
BOOL MemManInfo(LPMEMMANINFO lpEnhMode); BOOL MemManInfo(LPMEMMANINFO lpEnhMode);
BOOL SystemHeapInfo(LPSYSHEAPINFO lpSysHeap); BOOL SystemHeapInfo( SYSHEAPINFO *pHeapInfo );
/* Window classes */
typedef struct
{
DWORD dwSize;
HMODULE hInst; /* This is really an hModule */
char szClassName[MAX_CLASSNAME + 1];
WORD wNext;
} CLASSENTRY;
BOOL ClassFirst( CLASSENTRY *pClassEntry );
BOOL ClassNext( CLASSENTRY *pClassEntry );
/* Memory read/write */
DWORD MemoryRead( WORD sel, DWORD offset, void *buffer, DWORD count );
DWORD MemoryWrite( WORD sel, DWORD offset, void *buffer, DWORD count );
#endif /* __TOOLHELP_H */ #endif /* __TOOLHELP_H */
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#ifndef USER_H #ifndef USER_H
#define USER_H #define USER_H
#include "segmem.h" #include "ldt.h"
#include "heap.h" #include "local.h"
/* USER local heap */ /* USER local heap */
...@@ -16,18 +16,24 @@ ...@@ -16,18 +16,24 @@
#define USER_HEAP_ALLOC(f,size) LocalAlloc (f, size) #define USER_HEAP_ALLOC(f,size) LocalAlloc (f, size)
#define USER_HEAP_REALLOC(handle,size,f) LocalReAlloc (handle,size,f) #define USER_HEAP_REALLOC(handle,size,f) LocalReAlloc (handle,size,f)
#define USER_HEAP_ADDR(handle) LocalLock (handle) #define USER_HEAP_LIN_ADDR(handle) LocalLock (handle)
#define USER_HEAP_SEG_ADDR(handle) LocalLock (handle)
#define USER_HEAP_FREE(handle) LocalFree (handle) #define USER_HEAP_FREE(handle) LocalFree (handle)
#else #else
extern MDESC *USER_Heap; extern LPSTR USER_Heap;
extern WORD USER_HeapSel;
#define USER_HEAP_ALLOC(f,size) ((int)HEAP_Alloc(&USER_Heap,f,size) & 0xffff)
#define USER_HEAP_REALLOC(handle,size,f) ((int)HEAP_ReAlloc(&USER_Heap, \ #define USER_HEAP_ALLOC(size) \
USER_HEAP_ADDR(handle),size,f) & 0xffff) LOCAL_Alloc( USER_HeapSel, LMEM_FIXED, (size) )
#define USER_HEAP_FREE(handle) (HEAP_Free(&USER_Heap,USER_HEAP_ADDR(handle))) #define USER_HEAP_REALLOC(handle,size) \
#define USER_HEAP_ADDR(handle) \ LOCAL_ReAlloc( USER_HeapSel, (handle), (size), LMEM_FIXED )
((void *)((handle) ? ((handle) | ((int)USER_Heap & 0xffff0000)) : 0)) #define USER_HEAP_FREE(handle) \
LOCAL_Free( USER_HeapSel, (handle) )
#define USER_HEAP_LIN_ADDR(handle) \
((handle) ? PTR_SEG_OFF_TO_LIN(USER_HeapSel, (handle)) : NULL)
#define USER_HEAP_SEG_ADDR(handle) \
((handle) ? MAKELONG((handle), USER_HeapSel) : 0)
#endif /* WINELIB */ #endif /* WINELIB */
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include "ldt.h"
#include "class.h" #include "class.h"
#define WND_MAGIC 0x444e4957 /* 'WIND' */ #define WND_MAGIC 0x444e4957 /* 'WIND' */
......
...@@ -13,6 +13,7 @@ typedef LONG LPARAM; ...@@ -13,6 +13,7 @@ typedef LONG LPARAM;
typedef LONG LRESULT; typedef LONG LRESULT;
typedef WORD HANDLE; typedef WORD HANDLE;
typedef DWORD HHOOK; typedef DWORD HHOOK;
typedef DWORD SEGPTR;
typedef char *LPSTR; typedef char *LPSTR;
typedef const char *LPCSTR; typedef const char *LPCSTR;
typedef char *NPSTR; typedef char *NPSTR;
...@@ -30,25 +31,28 @@ typedef FARPROC HOOKPROC; ...@@ -30,25 +31,28 @@ typedef FARPROC HOOKPROC;
#define DECLARE_HANDLE(a) typedef HANDLE a; #define DECLARE_HANDLE(a) typedef HANDLE a;
DECLARE_HANDLE(HTASK); DECLARE_HANDLE(HBITMAP);
DECLARE_HANDLE(HDRVR); DECLARE_HANDLE(HBRUSH);
DECLARE_HANDLE(HWND);
DECLARE_HANDLE(HDC);
DECLARE_HANDLE(HCLASS); DECLARE_HANDLE(HCLASS);
DECLARE_HANDLE(HCURSOR); DECLARE_HANDLE(HCURSOR);
DECLARE_HANDLE(HDC);
DECLARE_HANDLE(HDROP);
DECLARE_HANDLE(HDRVR);
DECLARE_HANDLE(HDWP);
DECLARE_HANDLE(HFONT); DECLARE_HANDLE(HFONT);
DECLARE_HANDLE(HPEN); DECLARE_HANDLE(HGLOBAL);
DECLARE_HANDLE(HRGN);
DECLARE_HANDLE(HPALETTE);
DECLARE_HANDLE(HICON); DECLARE_HANDLE(HICON);
DECLARE_HANDLE(HINSTANCE); DECLARE_HANDLE(HINSTANCE);
DECLARE_HANDLE(HLOCAL);
DECLARE_HANDLE(HMENU); DECLARE_HANDLE(HMENU);
DECLARE_HANDLE(HBITMAP);
DECLARE_HANDLE(HBRUSH);
DECLARE_HANDLE(LOCALHANDLE);
DECLARE_HANDLE(HMETAFILE); DECLARE_HANDLE(HMETAFILE);
DECLARE_HANDLE(HDWP); DECLARE_HANDLE(HMODULE);
DECLARE_HANDLE(HDROP); DECLARE_HANDLE(HPALETTE);
DECLARE_HANDLE(HPEN);
DECLARE_HANDLE(HRGN);
DECLARE_HANDLE(HTASK);
DECLARE_HANDLE(HWND);
DECLARE_HANDLE(LOCALHANDLE);
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0
...@@ -70,15 +74,18 @@ DECLARE_HANDLE(HDROP); ...@@ -70,15 +74,18 @@ DECLARE_HANDLE(HDROP);
#define WINE_PACKED __attribute__ ((packed)) #define WINE_PACKED __attribute__ ((packed))
#endif #endif
#define LOBYTE(w) ((BYTE)(w)) #define LOBYTE(w) ((BYTE)(UINT)(w))
#define HIBYTE(w) ((BYTE)((UINT)(w) >> 8)) #define HIBYTE(w) ((BYTE)((UINT)(w) >> 8))
#define LOWORD(l) ((WORD)(l)) #define LOWORD(l) ((WORD)(DWORD)(l))
#define HIWORD(l) ((WORD)((DWORD)(l) >> 16)) #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
#define MAKELONG(low, high) ((LONG)(((WORD)(low)) | \ #define MAKELONG(low, high) ((LONG)(((WORD)(low)) | \
(((DWORD)((WORD)(high))) << 16))) (((DWORD)((WORD)(high))) << 16)))
#define SELECTOROF(ptr) (HIWORD(ptr))
#define OFFSETOF(ptr) (LOWORD(ptr))
#ifndef max #ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b)) #define max(a,b) (((a) > (b)) ? (a) : (b))
#endif #endif
......
...@@ -5,7 +5,6 @@ MODULE = loader ...@@ -5,7 +5,6 @@ MODULE = loader
SRCS = \ SRCS = \
dump.c \ dump.c \
ldt.c \ ldt.c \
ldtlib.c \
main.c \ main.c \
ne_image.c \ ne_image.c \
ne_resource.c \ ne_resource.c \
......
...@@ -16,7 +16,6 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; ...@@ -16,7 +16,6 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#endif #endif
#include <errno.h> #include <errno.h>
#include "neexe.h" #include "neexe.h"
#include "segmem.h"
#include "prototypes.h" #include "prototypes.h"
/********************************************************************** /**********************************************************************
......
#ifndef WINELIB
/* /*
static char RCSId[] = "$Id: ldt.c,v 1.2 1993/07/04 04:04:21 root Exp root $"; * LDT manipulation functions
static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; *
*/ * Copyright 1993 Robert J. Amstadt
* Copyright 1995 Alexandre Julliard
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <strings.h>
#include <errno.h> #include <errno.h>
#include "prototypes.h" #include "ldt.h"
#include "stddebug.h"
#include "debug.h"
#ifndef WINELIB
#ifdef linux
#include <linux/unistd.h>
#include <linux/head.h>
#include <linux/ldt.h>
_syscall3(int, modify_ldt, int, func, void *, ptr, unsigned long, bytecount)
#endif /* linux */
#if defined(__NetBSD__) || defined(__FreeBSD__) #if defined(__NetBSD__) || defined(__FreeBSD__)
#include <machine/segments.h> #include <machine/segments.h>
#endif
/********************************************************************** extern int i386_get_ldt(int, union descriptor *, int);
* print_ldt extern int i386_set_ldt(int, union descriptor *, int);
#endif /* __NetBSD__ || __FreeBSD__ */
#endif /* ifndef WINELIB */
/***********************************************************************
* LDT_BytesToEntry
*
* Convert the raw bytes of the descriptor to an ldt_entry structure.
*/
static void LDT_BytesToEntry( unsigned long *buffer, ldt_entry *content )
{
content->base = (*buffer >> 16) & 0x0000ffff;
content->limit = *buffer & 0x0000ffff;
buffer++;
content->base |= (*buffer & 0xff000000) | ((*buffer << 16) & 0x00ff0000);
content->limit |= (*buffer & 0x000f0000);
content->type = (*buffer >> 10) & 3;
content->seg_32bit = (*buffer & 0x00400000) != 0;
content->read_only = (*buffer & 0x00000200) == 0;
content->limit_in_pages = (*buffer & 0x00800000) != 0;
}
/***********************************************************************
* LDT_GetEntry
*
* Retrieve an LDT entry.
*/ */
/* XXX These are *real* 386 descriptors !! */ int LDT_GetEntry( int entry, ldt_entry *content )
void
print_ldt()
{ {
char buffer[0x10000]; int ret = 0;
unsigned long *lp;
unsigned long base_addr, limit; #ifdef WINELIB
int type, dpl, i; content->base = ldt_copy[entry].base;
content->limit = ldt_copy[entry].limit;
content->type = SEGMENT_DATA;
content->seg_32bit = 0;
content->read_only = 0;
content->limit_in_pages = 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__) #if defined(__NetBSD__) || defined(__FreeBSD__)
struct segment_descriptor *sd; long buffer[2];
#endif ret = i386_get_ldt( entry, (union descriptor *)buffer, 1 );
LDT_BytesToEntry( buffer, content );
#endif /* __NetBSD__ || __FreeBSD__ */
#endif /* WINELIB */
return ret;
}
if (get_ldt(buffer) < 0)
exit(1);
lp = (unsigned long *) buffer; /***********************************************************************
* LDT_SetEntry
*
* Set an LDT entry.
*/
int LDT_SetEntry( int entry, ldt_entry *content )
{
int ret = 0;
dprintf_ldt(stddeb,
"LDT_SetEntry: entry=%04x base=%08lx limit=%05lx %s %d-bit flags=%c%c%c\n",
entry, content->base, content->limit,
content->limit_in_pages ? "pages" : "bytes",
content->seg_32bit ? 32 : 16,
content->read_only && (content->type & SEGMENT_CODE) ? '-' : 'r',
content->read_only || (content->type & SEGMENT_CODE) ? '-' : 'w',
(content->type & SEGMENT_CODE) ? 'x' : '-' );
#ifndef WINELIB
#ifdef linux
{
struct modify_ldt_ldt_s ldt_info;
memset( &ldt_info, 0, sizeof(ldt_info) );
ldt_info.entry_number = entry;
ldt_info.base_addr = content->base;
ldt_info.limit = content->limit;
ldt_info.seg_32bit = content->seg_32bit != 0;
ldt_info.contents = content->type;
ldt_info.read_exec_only = content->read_only != 0;
ldt_info.limit_in_pages = content->limit_in_pages != 0;
ret = modify_ldt(1, &ldt_info, sizeof(ldt_info));
}
#endif /* linux */
#if defined(__NetBSD__) || defined(__FreeBSD__) #if defined(__NetBSD__) || defined(__FreeBSD__)
sd = (struct segment_descriptor *) buffer; {
#endif long d[2];
d[0] = ((content->base & 0x0000ffff) << 16) |
(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);
if (ret < 0)
{
perror("i386_set_ldt");
fprintf(stderr,
"Did you reconfigure the kernel with \"options USER_LDT\"?\n");
exit(1);
}
}
#endif /* __NetBSD__ || __FreeBSD__ */
#endif /* ifndef WINELIB */
if (ret < 0) return ret;
ldt_copy[entry].base = content->base;
if (!content->limit_in_pages) ldt_copy[entry].limit = content->limit;
else ldt_copy[entry].limit = (content->limit << 12) | 0x0fff;
return ret;
}
/***********************************************************************
* LDT_Print
*
* Print the content of the LDT on stdout.
*/
void LDT_Print()
{
int i;
for (i = 0; i < 32; i++, lp++) #ifdef WINELIB
for (i = 0; i < LDT_SIZE; i++)
{
if (ldt_copy[i].base || ldt_copy[i].limit)
{ {
/* First 32 bits of descriptor */ fprintf( stderr, "%04x: sel=%04x base=%08x limit=%05x\n",
base_addr = (*lp >> 16) & 0x0000FFFF; i, ENTRY_TO_SELECTOR(i),
limit = *lp & 0x0000FFFF; ldt_copy[i].base, ldt_copy[i].limit );
lp++; }
}
/* First 32 bits of descriptor */ #else /* WINELIB */
base_addr |= (*lp & 0xFF000000) | ((*lp << 16) & 0x00FF0000);
limit |= (*lp & 0x000F0000);
#ifdef linux #ifdef linux
type = (*lp >> 10) & 5; long buffer[2*LDT_SIZE];
dpl = (*lp >> 13) & 3; ldt_entry content;
#endif
#if defined(__NetBSD__) || defined(__FreeBSD__) modify_ldt( 0, buffer, sizeof(buffer) );
type = sd->sd_type; for (i = 0; i < LDT_SIZE; i++)
dpl = sd->sd_dpl; {
sd++; LDT_BytesToEntry( &buffer[2*i], &content );
#endif if (content.base || content.limit)
if (*lp & 1000)
{ {
printf("Entry %2d: Base %08lx, Limit %05lx, DPL %d, Type %d\n", fprintf( stderr, "%04x: sel=%04x base=%08lx limit=%05lx %s type=%d\n",
i, base_addr, limit, dpl, type); i, ENTRY_TO_SELECTOR(i),
printf(" "); content.base, content.limit,
if (*lp & 0x100) content.limit_in_pages ? "(pages)" : "(bytes)",
printf("Accessed, "); content.type );
if (*lp & 8000)
printf("Present, ");
if (*lp & 0x100000)
printf("User, ");
if (*lp & 0x200000)
printf("X, ");
if (*lp & 0x400000)
printf("32, ");
else
printf("16, ");
if (*lp & 0x800000)
printf("page limit, ");
else
printf("byte limit, ");
printf("\n");
printf(" %08lx %08lx\n", *(lp), *(lp-1));
} }
else }
#endif /* linux */
#if defined(__NetBSD__) || defined(__FreeBSD__)
long buffer[2*LDT_SIZE];
ldt_entry content;
i386_get_ldt( 0, (union descriptor *)buffer, LDT_SIZE );
for (i = 0; i < LDT_SIZE; i++)
{ {
printf("Entry %2d: Base %08lx, Limit %05lx, DPL %d, Type %d\n", LDT_BytesToEntry( buffer[2*i], &content );
i, base_addr, limit, dpl, type); if (content.base || content.limit)
printf(" SYSTEM: %08lx %08lx\n", *lp, *(lp-1)); {
fprintf( stderr, "%04x: sel=%04x base=%08lx limit=%05lx %s type=%d\n",
i, ENTRY_TO_SELECTOR(i),
content.base, content.limit,
content.limit_in_pages ? "(pages)" : "(bytes)",
content.type );
} }
} }
#endif /* __NetBSD__ || __FreeBSD__ */
#endif /* WINELIB */
} }
#endif /* ifndef WINELIB */
#ifndef WINELIB
/*
static char RCSId[] = "$Id: ldtlib.c,v 1.2 1993/07/04 04:04:21 root Exp root $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
*/
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "stddebug.h"
#include "debug.h"
#ifdef linux
#include <linux/unistd.h>
#include <linux/head.h>
#include <linux/ldt.h>
_syscall3(int, modify_ldt, int, func, void *, ptr, unsigned long, bytecount)
#endif
#if defined(__NetBSD__) || defined(__FreeBSD__)
#include <machine/segments.h>
extern int i386_get_ldt(int, union descriptor *, int);
extern int i386_set_ldt(int, union descriptor *, int);
struct segment_descriptor *
make_sd(unsigned base, unsigned limit, int contents, int read_exec_only, int seg32, int inpgs)
{
static long d[2];
d[0] = ((base & 0x0000ffff) << 16) |
(limit & 0x0ffff);
d[1] = (base & 0xff000000) |
((base & 0x00ff0000)>>16) |
(limit & 0xf0000) |
(contents << 10) |
((read_exec_only ^ 1) << 9) |
(seg32 << 22) |
(inpgs << 23) |
0xf000;
return ((struct segment_descriptor *)d);
}
#endif
int
get_ldt(void *buffer)
{
#ifdef linux
return modify_ldt(0, buffer, 32 * sizeof(struct modify_ldt_ldt_s));
#endif
#if defined(__NetBSD__) || defined(__FreeBSD__)
return i386_get_ldt(0, (union descriptor *)buffer, 32);
#endif
}
int
set_ldt_entry(int entry, unsigned long base, unsigned int limit,
int seg_32bit_flag, int contents, int read_only_flag,
int limit_in_pages_flag)
{
#ifdef linux
struct modify_ldt_ldt_s ldt_info;
ldt_info.entry_number = entry;
ldt_info.base_addr = base;
ldt_info.limit = limit;
ldt_info.seg_32bit = seg_32bit_flag;
ldt_info.contents = contents;
ldt_info.read_exec_only = read_only_flag;
ldt_info.limit_in_pages = limit_in_pages_flag;
#ifdef NEW_LDT_STRUCT
ldt_info.seg_not_present = 0;
#endif
return modify_ldt(1, &ldt_info, sizeof(ldt_info));
#endif
#if defined(__NetBSD__) || defined(__FreeBSD__)
struct segment_descriptor *sd;
int ret;
dprintf_ldt(stddeb,
"set_ldt_entry: entry=%x base=%x limit=%x%s %s-bit contents=%d %s\n",
entry, base, limit, limit_in_pages_flag?"-pages":"",
seg_32bit_flag?"32":"16",
contents, read_only_flag?"read-only":"");
sd = make_sd(base, limit, contents, read_only_flag, seg_32bit_flag, limit_in_pages_flag);
ret = i386_set_ldt(entry, (union descriptor *)sd, 1);
if (ret < 0) {
perror("i386_set_ldt");
fprintf(stderr,
"Did you reconfigure the kernel with \"options USER_LDT\"?\n");
exit(1);
}
return ret;
#endif
}
#endif /* ifndef WINELIB */
...@@ -11,7 +11,6 @@ static char Copyright[] = "Copyright 1993, 1994 Martin Ayotte, Robert J. Amstadt ...@@ -11,7 +11,6 @@ static char Copyright[] = "Copyright 1993, 1994 Martin Ayotte, Robert J. Amstadt
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include "neexe.h" #include "neexe.h"
#include "segmem.h"
#include "dlls.h" #include "dlls.h"
#include "if1632.h" #include "if1632.h"
#include "wineopts.h" #include "wineopts.h"
...@@ -436,7 +435,8 @@ FARPROC GetProcAddress(HANDLE hModule, char *proc_name) ...@@ -436,7 +435,8 @@ FARPROC GetProcAddress(HANDLE hModule, char *proc_name)
#ifdef WINELIB #ifdef WINELIB
WINELIB_UNIMP ("GetProcAddress"); WINELIB_UNIMP ("GetProcAddress");
#else #else
int sel, addr, ret; int addr, ret;
WORD sel;
register struct w_files *w = wine_files; register struct w_files *w = wine_files;
int ordinal, len; int ordinal, len;
char * cpnt; char * cpnt;
......
...@@ -11,12 +11,12 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; ...@@ -11,12 +11,12 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include "neexe.h" #include "neexe.h"
#include "segmem.h"
#include "dos_fs.h" #include "dos_fs.h"
#include "dlls.h" #include "dlls.h"
#include "library.h" #include "library.h"
#include "windows.h" #include "windows.h"
#include "wineopts.h" #include "wineopts.h"
#include "wine.h"
#include "task.h" #include "task.h"
#include "prototypes.h" #include "prototypes.h"
#include "options.h" #include "options.h"
......
...@@ -12,7 +12,6 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; ...@@ -12,7 +12,6 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include "neexe.h" #include "neexe.h"
#include "segmem.h"
#include "dlls.h" #include "dlls.h"
#include "windows.h" #include "windows.h"
#include "arch.h" #include "arch.h"
...@@ -82,20 +81,20 @@ static char *NE_GetModuleName(struct w_files *wpnt, int index, char *buffer) ...@@ -82,20 +81,20 @@ static char *NE_GetModuleName(struct w_files *wpnt, int index, char *buffer)
*/ */
int NE_FixupSegment(struct w_files *wpnt, int segment_num) int NE_FixupSegment(struct w_files *wpnt, int segment_num)
{ {
struct segment_descriptor_s *selector_table = wpnt->ne->selector_table; WORD *selector_table = wpnt->ne->selector_table;
WORD selector, sel, offset;
struct relocation_entry_s *rep, *rep1; struct relocation_entry_s *rep, *rep1;
struct ne_segment_table_entry_s *seg; struct ne_segment_table_entry_s *seg;
struct segment_descriptor_s *sel;
int status, ordinal, i, n_entries, additive; int status, ordinal, i, n_entries, additive;
unsigned short *sp; unsigned short *sp;
unsigned int selector, address, next_addr; unsigned int address;
unsigned char dll_name[257], func_name[257]; unsigned char dll_name[257], func_name[257];
seg = &wpnt->ne->seg_table[segment_num]; seg = &wpnt->ne->seg_table[segment_num];
sel = &selector_table[segment_num]; sel = selector_table[segment_num];
dprintf_fixup(stddeb, "Segment fixups for %s, segment %d, selector %x\n", dprintf_fixup(stddeb, "Segment fixups for %s, segment %d, selector %04x\n",
wpnt->name, segment_num, (int) sel->base_addr >> 16); wpnt->name, segment_num, sel );
if ((seg->seg_data_offset == 0) || if ((seg->seg_data_offset == 0) ||
!(seg->seg_flags & NE_SEGFLAGS_RELOC_DATA)) !(seg->seg_flags & NE_SEGFLAGS_RELOC_DATA))
...@@ -128,13 +127,14 @@ int NE_FixupSegment(struct w_files *wpnt, int segment_num) ...@@ -128,13 +127,14 @@ int NE_FixupSegment(struct w_files *wpnt, int segment_num)
/* /*
* Get the target address corresponding to this entry. * Get the target address corresponding to this entry.
*/ */
additive = 0;
/* If additive, there is no target chain list. Instead, add source
and target */
additive = rep->relocation_type & NE_RELFLAG_ADDITIVE;
rep->relocation_type &= 0x3;
switch (rep->relocation_type) switch (rep->relocation_type)
{ {
case NE_RELTYPE_ORDINALADD:
additive = 1;
case NE_RELTYPE_ORDINAL: case NE_RELTYPE_ORDINAL:
if (NE_GetModuleName(wpnt, rep->target1, if (NE_GetModuleName(wpnt, rep->target1,
dll_name) == NULL) dll_name) == NULL)
...@@ -160,9 +160,6 @@ int NE_FixupSegment(struct w_files *wpnt, int segment_num) ...@@ -160,9 +160,6 @@ int NE_FixupSegment(struct w_files *wpnt, int segment_num)
dll_name, ordinal, selector, address); dll_name, ordinal, selector, address);
break; break;
case NE_RELTYPE_NAMEADD:
additive = 1;
case NE_RELTYPE_NAME: case NE_RELTYPE_NAME:
if (NE_GetModuleName(wpnt, rep->target1, dll_name) == NULL) { if (NE_GetModuleName(wpnt, rep->target1, dll_name) == NULL) {
fprintf(stderr,"NE_RELTYPE_NAME failed"); fprintf(stderr,"NE_RELTYPE_NAME failed");
...@@ -189,7 +186,6 @@ int NE_FixupSegment(struct w_files *wpnt, int segment_num) ...@@ -189,7 +186,6 @@ int NE_FixupSegment(struct w_files *wpnt, int segment_num)
break; break;
case NE_RELTYPE_INTERNAL: case NE_RELTYPE_INTERNAL:
case NE_RELTYPE_INT1:
if (rep->target1 == 0x00ff) if (rep->target1 == 0x00ff)
{ {
address = GetEntryPointFromOrdinal(wpnt, rep->target2); address = GetEntryPointFromOrdinal(wpnt, rep->target2);
...@@ -198,7 +194,7 @@ int NE_FixupSegment(struct w_files *wpnt, int segment_num) ...@@ -198,7 +194,7 @@ int NE_FixupSegment(struct w_files *wpnt, int segment_num)
} }
else else
{ {
selector = selector_table[rep->target1-1].selector; selector = selector_table[rep->target1-1];
address = rep->target2; address = rep->target2;
} }
...@@ -206,7 +202,7 @@ int NE_FixupSegment(struct w_files *wpnt, int segment_num) ...@@ -206,7 +202,7 @@ int NE_FixupSegment(struct w_files *wpnt, int segment_num)
i + 1, selector, address); i + 1, selector, address);
break; break;
case 7: case NE_RELTYPE_OSFIXUP:
/* Relocation type 7: /* Relocation type 7:
* *
* These appear to be used as fixups for the Windows * These appear to be used as fixups for the Windows
...@@ -234,69 +230,70 @@ int NE_FixupSegment(struct w_files *wpnt, int segment_num) ...@@ -234,69 +230,70 @@ int NE_FixupSegment(struct w_files *wpnt, int segment_num)
return -1; return -1;
} }
/* /* I'm not sure why a DLL entry point fixup could be additive.
* Stuff the right size result in. Old code used to ignore additive if the target is a built-in
*/ DLL. This doesn't seem to work for __AHSHIFT */
sp = (unsigned short *) ((char *) sel->base_addr + rep->offset); if (additive && FindDLLTable(dll_name) != NULL)
if (additive) dprintf_fixup(stddeb,"Additive for builtin???\n"
{ "%d: ADDR TYPE %d, TYPE %d, OFFSET %04x, "
if (FindDLLTable(dll_name) == NULL) "TARGET %04x %04x\n",
additive = 2; i+1, rep->address_type, rep->relocation_type,
dprintf_fixup(stddeb, rep->offset, rep->target1, rep->target2);
"%d: ADDR TYPE %d, TYPE %d, OFFSET %04x, ",
i + 1, rep->address_type, rep->relocation_type, offset = rep->offset;
rep->offset);
dprintf_fixup(stddeb,"TARGET %04x %04x\n",
rep->target1, rep->target2);
dprintf_fixup(stddeb, " Additive = %d\n", additive);
}
switch (rep->address_type) switch (rep->address_type)
{ {
case NE_RADDR_LOWBYTE: case NE_RADDR_LOWBYTE:
dprintf_fixup(stddeb,"Unhandled address type NE_RADDR_LOWBYTE\n"); do {
return -1; sp = PTR_SEG_OFF_TO_LIN( sel, offset );
dprintf_fixup(stddeb," %04x:%04x:%04x BYTE%s\n",
sel, offset, *sp, additive ? " additive":"");
offset = *sp;
if(additive)
*(unsigned char*)sp = (unsigned char)(address & 0xFF);
else
*(unsigned char*)sp = (unsigned char)((address+offset) & 0xFF);
}
while (offset != 0xffff && !additive);
break;
case NE_RADDR_OFFSET16: case NE_RADDR_OFFSET16:
do { do {
dprintf_fixup(stddeb," %04x:%04x:%04x OFFSET16\n", sp = PTR_SEG_OFF_TO_LIN( sel, offset );
(unsigned int) sp >> 16, (int) sp & 0xFFFF, *sp); dprintf_fixup(stddeb," %04x:%04x:%04x OFFSET16%s\n",
next_addr = *sp; sel, offset, *sp, additive ? " additive" : "" );
offset = *sp;
*sp = (unsigned short) address; *sp = (unsigned short) address;
if (additive == 2) if (additive) *sp += offset;
*sp += next_addr;
sp = (unsigned short *) ((char *) sel->base_addr + next_addr);
} }
while (next_addr != 0xffff && !additive); while (offset != 0xffff && !additive);
break; break;
case NE_RADDR_POINTER32: case NE_RADDR_POINTER32:
do { do {
dprintf_fixup(stddeb," %04x:%04x:%04x POINTER32\n", sp = PTR_SEG_OFF_TO_LIN( sel, offset );
(unsigned int) sp >> 16, (int) sp & 0xFFFF, *sp); dprintf_fixup(stddeb," %04x:%04x:%04x POINTER32%s\n",
next_addr = *sp; sel, offset, *sp, additive ? " additive" : "" );
offset = *sp;
*sp = (unsigned short) address; *sp = (unsigned short) address;
if (additive == 2) if (additive) *sp += offset;
*sp += next_addr; *(sp+1) = selector;
*(sp+1) = (unsigned short) selector;
sp = (unsigned short *) ((char *) sel->base_addr + next_addr);
} }
while (next_addr != 0xffff && !additive); while (offset != 0xffff && !additive);
break; break;
case NE_RADDR_SELECTOR: case NE_RADDR_SELECTOR:
do { do {
dprintf_fixup(stddeb," %04x:%04x:%04x SELECTOR\n", sp = PTR_SEG_OFF_TO_LIN( sel, offset );
(unsigned int) sp >> 16, (int) sp & 0xFFFF, *sp); dprintf_fixup(stddeb," %04x:%04x:%04x SELECTOR%s\n",
next_addr = *sp; sel, offset, *sp, additive ? " additive" : "" );
offset = *sp;
*sp = (unsigned short) selector; *sp = (unsigned short) selector;
sp = (unsigned short *) ((char *) sel->base_addr + next_addr); if(additive)
if (rep->relocation_type == NE_RELTYPE_INT1) fprintf(stderr,"Additive selector, please report\n");
break;
} }
while (next_addr != 0xffff && !additive); while (offset != 0xffff && !additive);
break; break;
default: default:
...@@ -331,10 +328,10 @@ int NE_StartProgram(struct w_files *wpnt) ...@@ -331,10 +328,10 @@ int NE_StartProgram(struct w_files *wpnt)
WIN_StackSize = wpnt->ne->ne_header->stack_length; WIN_StackSize = wpnt->ne->ne_header->stack_length;
WIN_HeapSize = wpnt->ne->ne_header->local_heap_length; WIN_HeapSize = wpnt->ne->ne_header->local_heap_length;
ds_reg = wpnt->ne->selector_table[wpnt->ne->ne_header->auto_data_seg-1].selector; ds_reg = wpnt->ne->selector_table[wpnt->ne->ne_header->auto_data_seg-1];
cs_reg = wpnt->ne->selector_table[wpnt->ne->ne_header->cs-1].selector; cs_reg = wpnt->ne->selector_table[wpnt->ne->ne_header->cs-1];
ip_reg = wpnt->ne->ne_header->ip; ip_reg = wpnt->ne->ne_header->ip;
ss_reg = wpnt->ne->selector_table[wpnt->ne->ne_header->ss-1].selector; ss_reg = wpnt->ne->selector_table[wpnt->ne->ne_header->ss-1];
sp_reg = wpnt->ne->ne_header->sp; sp_reg = wpnt->ne->ne_header->sp;
return CallToInit16(cs_reg << 16 | ip_reg, ss_reg << 16 | sp_reg, ds_reg); return CallToInit16(cs_reg << 16 | ip_reg, ss_reg << 16 | sp_reg, ds_reg);
...@@ -358,15 +355,15 @@ void NE_InitDLL(struct w_files *wpnt) ...@@ -358,15 +355,15 @@ void NE_InitDLL(struct w_files *wpnt)
exit(1); exit(1);
} else { /* DATA NONE DLL */ } else { /* DATA NONE DLL */
ds_reg = current_exe->ne->selector_table[ ds_reg = current_exe->ne->selector_table[
current_exe->ne->ne_header->auto_data_seg-1].selector; current_exe->ne->ne_header->auto_data_seg-1];
cx_reg = 0; cx_reg = 0;
} else { /* DATA SINGLE DLL */ } else { /* DATA SINGLE DLL */
ds_reg = wpnt->ne->selector_table[wpnt->ne-> ds_reg = wpnt->ne->selector_table[wpnt->ne->
ne_header->auto_data_seg-1].selector; ne_header->auto_data_seg-1];
cx_reg = wpnt->ne->ne_header->local_heap_length; cx_reg = wpnt->ne->ne_header->local_heap_length;
} }
cs_reg = wpnt->ne->selector_table[wpnt->ne->ne_header->cs-1].selector; cs_reg = wpnt->ne->selector_table[wpnt->ne->ne_header->cs-1];
ip_reg = wpnt->ne->ne_header->ip; ip_reg = wpnt->ne->ne_header->ip;
di_reg = wpnt->hinstance; di_reg = wpnt->hinstance;
...@@ -423,8 +420,7 @@ HINSTANCE NE_LoadImage(struct w_files *wpnt) ...@@ -423,8 +420,7 @@ HINSTANCE NE_LoadImage(struct w_files *wpnt)
wpnt->hinstance=current_nodata++; wpnt->hinstance=current_nodata++;
} else } else
wpnt->hinstance = (wpnt->ne-> wpnt->hinstance = (wpnt->ne->
selector_table[wpnt->ne->ne_header->auto_data_seg-1]. selector_table[wpnt->ne->ne_header->auto_data_seg-1]);
selector);
if (wpnt->hinstance == 0) if (wpnt->hinstance == 0)
wpnt->hinstance = 0xf000; wpnt->hinstance = 0xf000;
#endif #endif
......
...@@ -10,12 +10,12 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; ...@@ -10,12 +10,12 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include "windows.h" #include "windows.h"
#include "ldt.h"
#include "neexe.h" #include "neexe.h"
#include "peexe.h" #include "peexe.h"
#include "arch.h" #include "arch.h"
#include "dlls.h" #include "dlls.h"
#include "library.h" #include "library.h"
#include "heap.h"
#include "resource.h" #include "resource.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
...@@ -75,7 +75,7 @@ static void NE_LoadNameTable(struct w_files *wpnt) ...@@ -75,7 +75,7 @@ static void NE_LoadNameTable(struct w_files *wpnt)
read(wpnt->fd, &len, sizeof(len)); read(wpnt->fd, &len, sizeof(len));
while (len) while (len)
{ {
new = (RESNAMTAB *) GlobalQuickAlloc(sizeof(*new)); new = (RESNAMTAB *) GlobalLock(GlobalAlloc(GMEM_MOVEABLE,sizeof(*new)));
new->next = top; new->next = top;
top = new; top = new;
...@@ -337,12 +337,13 @@ int GetRsrcCount(HINSTANCE hInst, int type_id) ...@@ -337,12 +337,13 @@ int GetRsrcCount(HINSTANCE hInst, int type_id)
/********************************************************************** /**********************************************************************
* NE_FindResource [KERNEL.60] * NE_FindResource [KERNEL.60]
*/ */
int NE_FindResource(HANDLE instance, LPSTR resource_name, LPSTR type_name, int NE_FindResource(HANDLE instance, SEGPTR resource_name, SEGPTR type_name,
RESOURCE *r) RESOURCE *r)
{ {
int type, x; int type, x;
char *type_name_ptr, *resource_name_ptr;
dprintf_resource(stddeb, "NE_FindResource hInst=%04X typename=%p resname=%p\n", dprintf_resource(stddeb, "NE_FindResource hInst=%04X typename=%08lx resname=%08lx\n",
instance, type_name, resource_name); instance, type_name, resource_name);
r->size = r->offset = 0; r->size = r->offset = 0;
...@@ -351,30 +352,32 @@ int NE_FindResource(HANDLE instance, LPSTR resource_name, LPSTR type_name, ...@@ -351,30 +352,32 @@ int NE_FindResource(HANDLE instance, LPSTR resource_name, LPSTR type_name,
if (r->wpnt->ne->resnamtab == NULL) if (r->wpnt->ne->resnamtab == NULL)
NE_LoadNameTable(r->wpnt); NE_LoadNameTable(r->wpnt);
if (((int) type_name & 0xffff0000) == 0) if (HIWORD(type_name) == 0)
type = (int) type_name; type = (int) type_name;
else { else {
if (type_name[0] == '\0') type_name_ptr = PTR_SEG_TO_LIN( type_name );
if (type_name_ptr[0] == '\0')
type = -1; type = -1;
if (type_name[0] == '#') if (type_name_ptr[0] == '#')
type = atoi(type_name + 1); type = atoi(type_name_ptr + 1);
else else
type = (int) type_name; type = (int) type_name_ptr;
} }
if (((int) resource_name & 0xffff0000) == 0) if (HIWORD(resource_name) == 0)
x = FindResourceByNumber(r, type, (int) resource_name | 0x8000); x = FindResourceByNumber(r, type, LOWORD(resource_name) | 0x8000);
else { else {
if (resource_name[0] == '\0') resource_name_ptr = PTR_SEG_TO_LIN( resource_name );
if (resource_name_ptr[0] == '\0')
x = FindResourceByNumber(r, type, -1); x = FindResourceByNumber(r, type, -1);
if (resource_name[0] == '#') if (resource_name_ptr[0] == '#')
x = FindResourceByNumber(r, type, atoi(resource_name + 1)); x = FindResourceByNumber(r, type, atoi(resource_name_ptr + 1));
else else
x = FindResourceByName(r, type, resource_name); x = FindResourceByName(r, type, resource_name_ptr);
} }
if (x == -1) { if (x == -1) {
printf("NE_FindResource hInst=%04X typename=%08X resname=%08X not found!\n", printf("NE_FindResource hInst=%04x typename=%p resname=%p not found!\n",
instance, (int) type_name, (int) resource_name); instance, type_name_ptr, resource_name_ptr);
return 0; return 0;
} }
return 1; return 1;
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include "windows.h" #include "windows.h"
#include "ldt.h"
#include "neexe.h" #include "neexe.h"
#include "peexe.h" #include "peexe.h"
#include "dlls.h" #include "dlls.h"
...@@ -124,18 +125,26 @@ find_type(struct PE_Resource_Directory *resource, LPSTR resource_name, ...@@ -124,18 +125,26 @@ find_type(struct PE_Resource_Directory *resource, LPSTR resource_name,
* PE_FindResource [KERNEL.60] * PE_FindResource [KERNEL.60]
*/ */
int int
PE_FindResource(HANDLE instance, LPSTR resource_name, LPSTR type_name, PE_FindResource(HANDLE instance, SEGPTR resource_name, SEGPTR type_name,
RESOURCE *r) RESOURCE *r)
{ {
dprintf_resource(stddeb, "PE_FindResource hInst=%04X typename=%08X resname=%08X\n", dprintf_resource(stddeb, "PE_FindResource hInst=%04X typename=%08X resname=%08X\n",
instance, (int) type_name, (int) resource_name); instance, (int) type_name, (int) resource_name);
if (HIWORD((DWORD)resource_name)) if (HIWORD(resource_name))
if (resource_name[0] == '#') {
resource_name = (LPSTR) atoi(resource_name + 1); char *resource_name_ptr = PTR_SEG_TO_LIN( resource_name );
if (resource_name_ptr[0] == '#')
if (HIWORD((DWORD)type_name)) resource_name = (SEGPTR) atoi(resource_name_ptr + 1);
if (type_name[0] == '#') else
type_name = (LPSTR) atoi(type_name + 1); resource_name = (SEGPTR)resource_name_ptr;
}
if (HIWORD(type_name))
{
char *type_name_ptr = PTR_SEG_TO_LIN( type_name );
if (type_name_ptr[0] == '#')
type_name = (SEGPTR) atoi(type_name_ptr + 1);
else
type_name = (SEGPTR) type_name_ptr;
}
return find_type(r->wpnt->pe->pe_resource, resource_name, type_name,r); return find_type(r->wpnt->pe->pe_resource, resource_name, type_name,r);
} }
...@@ -27,19 +27,19 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; ...@@ -27,19 +27,19 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
RESOURCE *Top = NULL; RESOURCE *Top = NULL;
extern int NE_FindResource(HANDLE, LPSTR, LPSTR, RESOURCE *); extern int NE_FindResource(HANDLE, SEGPTR, SEGPTR, RESOURCE *);
extern int PE_FindResource(HANDLE, LPSTR, LPSTR, RESOURCE *); extern int PE_FindResource(HANDLE, SEGPTR, SEGPTR, RESOURCE *);
#define PrintId(name) \ #define PrintId(name) \
if (HIWORD((DWORD)name)) \ if (HIWORD((DWORD)name)) \
printf(", %s", name); \ printf(", '%s'", (char *)PTR_SEG_TO_LIN(name)); \
else \ else \
printf(", #%d", (int) name); printf(", #%d", LOWORD(name));
/********************************************************************** /**********************************************************************
* FindResource [KERNEL.60] * FindResource [KERNEL.60]
*/ */
HANDLE FindResource(HANDLE instance, LPSTR name, LPSTR type) HANDLE FindResource(HANDLE instance, SEGPTR name, SEGPTR type)
{ {
int status; int status;
RESOURCE *r; RESOURCE *r;
...@@ -64,14 +64,14 @@ HANDLE FindResource(HANDLE instance, LPSTR name, LPSTR type) ...@@ -64,14 +64,14 @@ HANDLE FindResource(HANDLE instance, LPSTR name, LPSTR type)
r->rsc_mem = 0; r->rsc_mem = 0;
r->count = 0; r->count = 0;
if (HIWORD((DWORD)name)) if (HIWORD((DWORD)name))
r->name = strdup(name); r->name = strdup(PTR_SEG_TO_LIN(name));
else else
r->name = name; r->name = (LPSTR)name;
if (HIWORD((DWORD)type)) if (HIWORD((DWORD)type))
r->type = strdup(type); r->type = strdup(PTR_SEG_TO_LIN(type));
else else
r->type = type; r->type = (LPSTR)type;
r->wpnt = GetFileInfo(instance); r->wpnt = GetFileInfo(instance);
r->fd = dup(r->wpnt->fd); r->fd = dup(r->wpnt->fd);
...@@ -178,7 +178,7 @@ HANDLE LoadResource(HANDLE instance, HANDLE hResInfo) ...@@ -178,7 +178,7 @@ HANDLE LoadResource(HANDLE instance, HANDLE hResInfo)
return 0; return 0;
h = r->rsc_mem = AllocResource(instance, hResInfo, 0); h = r->rsc_mem = AllocResource(instance, hResInfo, 0);
image = GlobalLinearLock(h); image = GlobalLock(h);
image_size = r->size; image_size = r->size;
fd = AccessResource(instance, hResInfo); fd = AccessResource(instance, hResInfo);
...@@ -189,7 +189,7 @@ HANDLE LoadResource(HANDLE instance, HANDLE hResInfo) ...@@ -189,7 +189,7 @@ HANDLE LoadResource(HANDLE instance, HANDLE hResInfo)
} }
r->count++; r->count++;
close(fd); close(fd);
GlobalLinearUnlock(h); GlobalUnlock(h);
GlobalUnlock(hResInfo); GlobalUnlock(hResInfo);
return h; return h;
} }
...@@ -197,6 +197,14 @@ HANDLE LoadResource(HANDLE instance, HANDLE hResInfo) ...@@ -197,6 +197,14 @@ HANDLE LoadResource(HANDLE instance, HANDLE hResInfo)
/********************************************************************** /**********************************************************************
* LockResource [KERNEL.62] * LockResource [KERNEL.62]
*/ */
/* 16-bit version */
SEGPTR WIN16_LockResource(HANDLE hResData)
{
return WIN16_GlobalLock(hResData);
}
/* 32-bit version */
LPSTR LockResource(HANDLE hResData) LPSTR LockResource(HANDLE hResData)
{ {
return GlobalLock(hResData); return GlobalLock(hResData);
...@@ -302,15 +310,15 @@ HBITMAP ConvertInfoBitmap( HDC hdc, BITMAPINFO * image ) ...@@ -302,15 +310,15 @@ HBITMAP ConvertInfoBitmap( HDC hdc, BITMAPINFO * image )
* RSC_LoadResource * RSC_LoadResource
*/ */
HANDLE HANDLE
RSC_LoadResource(int instance, LPSTR rsc_name, LPSTR type, int *image_size_ret) RSC_LoadResource(int instance, SEGPTR rsc_name, SEGPTR type, int *image_size_ret)
{ {
HANDLE hResInfo; HANDLE hResInfo;
RESOURCE *r; RESOURCE *r;
dprintf_resource(stddeb, "RSC_LoadResource: instance = %04x, name = %08x, type = %08x\n", dprintf_resource(stddeb, "RSC_LoadResource: instance = %04x, name = %08lx, type = %08lx\n",
instance, (int) rsc_name, (int) type); instance, rsc_name, type);
if ((hResInfo = FindResource(instance, rsc_name, (LPSTR) type)) == (HANDLE) NULL) { if ((hResInfo = FindResource(instance, rsc_name, type)) == (HANDLE) NULL) {
return (HANDLE)NULL; return (HANDLE)NULL;
} }
r = (RESOURCE *)GlobalLock(hResInfo); r = (RESOURCE *)GlobalLock(hResInfo);
...@@ -324,7 +332,7 @@ RSC_LoadResource(int instance, LPSTR rsc_name, LPSTR type, int *image_size_ret) ...@@ -324,7 +332,7 @@ RSC_LoadResource(int instance, LPSTR rsc_name, LPSTR type, int *image_size_ret)
/********************************************************************** /**********************************************************************
* LoadIcon [USER.174] * LoadIcon [USER.174]
*/ */
HICON LoadIcon(HANDLE instance, LPSTR icon_name) HICON LoadIcon( HANDLE instance, SEGPTR icon_name )
{ {
HICON hIcon; HICON hIcon;
HANDLE rsc_mem; HANDLE rsc_mem;
...@@ -338,11 +346,12 @@ HICON LoadIcon(HANDLE instance, LPSTR icon_name) ...@@ -338,11 +346,12 @@ HICON LoadIcon(HANDLE instance, LPSTR icon_name)
HDC hdc; HDC hdc;
int image_size; int image_size;
if(debugging_resource){ if (HIWORD(icon_name))
printf("LoadIcon(%04X", instance); dprintf_resource( stddeb, "LoadIcon: %04x '%s'\n",
PrintId(icon_name); instance, (char *)PTR_SEG_TO_LIN( icon_name ) );
printf(")\n"); else
} dprintf_resource( stddeb, "LoadIcon: %04x %04x\n",
instance, LOWORD(icon_name) );
if (!instance) if (!instance)
{ {
...@@ -351,10 +360,10 @@ HICON LoadIcon(HANDLE instance, LPSTR icon_name) ...@@ -351,10 +360,10 @@ HICON LoadIcon(HANDLE instance, LPSTR icon_name)
} }
if (!(hdc = GetDC(GetDesktopWindow()))) return 0; if (!(hdc = GetDC(GetDesktopWindow()))) return 0;
rsc_mem = RSC_LoadResource(instance, icon_name, (LPSTR) NE_RSCTYPE_GROUP_ICON, rsc_mem = RSC_LoadResource(instance, icon_name,
&image_size); (SEGPTR) NE_RSCTYPE_GROUP_ICON, &image_size);
if (rsc_mem == (HANDLE)NULL) { if (rsc_mem == (HANDLE)NULL) {
printf("LoadIcon / Icon %04X not Found !\n", (int) icon_name); printf("LoadIcon / Icon %08x not Found !\n", (int) icon_name);
ReleaseDC(GetDesktopWindow(), hdc); ReleaseDC(GetDesktopWindow(), hdc);
return 0; return 0;
} }
...@@ -377,11 +386,11 @@ HICON LoadIcon(HANDLE instance, LPSTR icon_name) ...@@ -377,11 +386,11 @@ HICON LoadIcon(HANDLE instance, LPSTR icon_name)
height = lpicodesc->Height; height = lpicodesc->Height;
GlobalUnlock(rsc_mem); GlobalUnlock(rsc_mem);
GlobalFree(rsc_mem); GlobalFree(rsc_mem);
rsc_mem = RSC_LoadResource(instance, rsc_mem = RSC_LoadResource( instance,
MAKEINTRESOURCE(lpicodesc->icoDIBOffset), MAKEINTRESOURCE(lpicodesc->icoDIBOffset),
(LPSTR) NE_RSCTYPE_ICON, &image_size); (SEGPTR) NE_RSCTYPE_ICON, &image_size );
if (rsc_mem == (HANDLE)NULL) { if (rsc_mem == (HANDLE)NULL) {
printf("LoadIcon / Icon %04X Bitmaps not Found !\n", (int) icon_name); printf("LoadIcon / Icon %08lx Bitmaps not Found !\n", icon_name );
ReleaseDC(GetDesktopWindow(), hdc); ReleaseDC(GetDesktopWindow(), hdc);
return 0; return 0;
} }
...@@ -503,7 +512,7 @@ BOOL DestroyIcon(HICON hIcon) ...@@ -503,7 +512,7 @@ BOOL DestroyIcon(HICON hIcon)
/********************************************************************** /**********************************************************************
* LoadAccelerators [USER.177] * LoadAccelerators [USER.177]
*/ */
HANDLE LoadAccelerators(HANDLE instance, LPSTR lpTableName) HANDLE LoadAccelerators(HANDLE instance, SEGPTR lpTableName)
{ {
HANDLE hAccel; HANDLE hAccel;
HANDLE rsc_mem; HANDLE rsc_mem;
...@@ -511,18 +520,17 @@ HANDLE LoadAccelerators(HANDLE instance, LPSTR lpTableName) ...@@ -511,18 +520,17 @@ HANDLE LoadAccelerators(HANDLE instance, LPSTR lpTableName)
ACCELHEADER *lpAccelTbl; ACCELHEADER *lpAccelTbl;
int i, image_size, n; int i, image_size, n;
if(debugging_accel){ if (HIWORD(lpTableName))
printf("LoadAccelerators(%04X", instance); dprintf_accel( stddeb, "LoadAccelerators: %04x '%s'\n",
PrintId(lpTableName); instance, (char *)PTR_SEG_TO_LIN( lpTableName ) );
printf(")\n"); else
} dprintf_accel( stddeb, "LoadAccelerators: %04x %04x\n",
instance, LOWORD(lpTableName) );
rsc_mem = RSC_LoadResource(instance, lpTableName, (LPSTR) NE_RSCTYPE_ACCELERATOR, rsc_mem = RSC_LoadResource( instance, lpTableName,
&image_size); (SEGPTR) NE_RSCTYPE_ACCELERATOR, &image_size );
if (rsc_mem == (HANDLE)NULL) { if (rsc_mem == (HANDLE)NULL) {
printf("LoadAccelerators(%04X", instance); printf("LoadAccelerators(%08lx) not found!\n", lpTableName );
PrintId(lpTableName);
printf(") not found !\n");
return 0; return 0;
} }
lp = (BYTE *)GlobalLock(rsc_mem); lp = (BYTE *)GlobalLock(rsc_mem);
...@@ -624,8 +632,8 @@ LoadString(HANDLE instance, WORD resource_id, LPSTR buffer, int buflen) ...@@ -624,8 +632,8 @@ LoadString(HANDLE instance, WORD resource_id, LPSTR buffer, int buflen)
dprintf_resource(stddeb, "LoadString: instance = %04x, id = %d, buffer = %08x, " dprintf_resource(stddeb, "LoadString: instance = %04x, id = %d, buffer = %08x, "
"length = %d\n", instance, resource_id, (int) buffer, buflen); "length = %d\n", instance, resource_id, (int) buffer, buflen);
hmem = RSC_LoadResource(instance, (char *) ((resource_id >> 4) + 1), hmem = RSC_LoadResource(instance, (SEGPTR)((resource_id >> 4) + 1),
(LPSTR) NE_RSCTYPE_STRING, &rsc_size); (SEGPTR) NE_RSCTYPE_STRING, &rsc_size );
if (hmem == 0) if (hmem == 0)
return 0; return 0;
...@@ -656,21 +664,23 @@ LoadString(HANDLE instance, WORD resource_id, LPSTR buffer, int buflen) ...@@ -656,21 +664,23 @@ LoadString(HANDLE instance, WORD resource_id, LPSTR buffer, int buflen)
/********************************************************************** /**********************************************************************
* LoadMenu [USER.150] * LoadMenu [USER.150]
*/ */
HMENU LoadMenu(HINSTANCE instance, char *menu_name) HMENU LoadMenu( HINSTANCE instance, SEGPTR menu_name )
{ {
HMENU hMenu; HMENU hMenu;
HANDLE hMenu_desc; HANDLE hMenu_desc;
MENU_HEADER *menu_desc; MENU_HEADER *menu_desc;
if(debugging_menu){ if (HIWORD(menu_name))
printf("LoadMenu(%04X", instance); dprintf_resource( stddeb, "LoadMenu(%04x,'%s')\n",
PrintId(menu_name); instance, (char *)PTR_SEG_TO_LIN( menu_name ) );
printf(")\n"); else
} dprintf_resource( stddeb, "LoadMenu(%04x,%04x)\n",
if (menu_name == NULL) instance, LOWORD(menu_name) );
return 0;
if (!menu_name) return 0;
if ((hMenu_desc = RSC_LoadResource(instance, menu_name, (LPSTR) NE_RSCTYPE_MENU, NULL)) == (HANDLE) NULL) if (!(hMenu_desc = RSC_LoadResource( instance, menu_name,
(SEGPTR) NE_RSCTYPE_MENU, NULL )))
return 0; return 0;
menu_desc = (MENU_HEADER *) GlobalLock(hMenu_desc); menu_desc = (MENU_HEADER *) GlobalLock(hMenu_desc);
...@@ -681,8 +691,7 @@ HMENU LoadMenu(HINSTANCE instance, char *menu_name) ...@@ -681,8 +691,7 @@ HMENU LoadMenu(HINSTANCE instance, char *menu_name)
/********************************************************************** /**********************************************************************
* LoadBitmap * LoadBitmap
*/ */
HBITMAP HBITMAP LoadBitmap( HANDLE instance, SEGPTR bmp_name )
LoadBitmap(HANDLE instance, LPSTR bmp_name)
{ {
HBITMAP hbitmap; HBITMAP hbitmap;
HANDLE rsc_mem; HANDLE rsc_mem;
...@@ -691,11 +700,12 @@ LoadBitmap(HANDLE instance, LPSTR bmp_name) ...@@ -691,11 +700,12 @@ LoadBitmap(HANDLE instance, LPSTR bmp_name)
int image_size; int image_size;
int size; int size;
if(debugging_resource){ if (HIWORD(bmp_name))
printf("LoadBitmap(%04X", instance); dprintf_resource( stddeb, "LoadBitmap(%04x,'%s')\n",
PrintId(bmp_name); instance, (char *)PTR_SEG_TO_LIN( bmp_name ) );
printf(")\n"); else
} dprintf_resource( stddeb, "LoadBitmap(%04x,%04x)\n",
instance, LOWORD( bmp_name ) );
if (!instance) if (!instance)
{ {
...@@ -703,20 +713,19 @@ LoadBitmap(HANDLE instance, LPSTR bmp_name) ...@@ -703,20 +713,19 @@ LoadBitmap(HANDLE instance, LPSTR bmp_name)
return OBM_LoadBitmap( LOWORD((int)bmp_name) ); return OBM_LoadBitmap( LOWORD((int)bmp_name) );
} }
rsc_mem = RSC_LoadResource(instance, bmp_name, (LPSTR) NE_RSCTYPE_BITMAP, rsc_mem = RSC_LoadResource(instance, bmp_name, (SEGPTR) NE_RSCTYPE_BITMAP,
&image_size); &image_size);
if (rsc_mem == (HANDLE)NULL) { if (rsc_mem == (HANDLE)NULL) {
printf("LoadBitmap(%04X", instance); printf("LoadBitmap(%04x,%08lx)\n", instance, bmp_name);
PrintId(bmp_name);
printf(") NOT found!\n");
return 0; return 0;
} }
lp = (long *) GlobalLinearLock(rsc_mem); lp = (long *) GlobalLock(rsc_mem);
if (lp == NULL) if (lp == NULL)
{ {
GlobalFree(rsc_mem); GlobalFree(rsc_mem);
return 0; return 0;
} }
if (!(hdc = GetDC(0))) lp = NULL; if (!(hdc = GetDC(0))) lp = NULL;
size = CONV_LONG (*lp); size = CONV_LONG (*lp);
if (size == sizeof(BITMAPCOREHEADER)){ if (size == sizeof(BITMAPCOREHEADER)){
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "wine.h" #include "wine.h"
#include "dos_fs.h" #include "dos_fs.h"
#include "segmem.h"
#include "prototypes.h" #include "prototypes.h"
#include "miscemu.h" #include "miscemu.h"
#include "win.h" #include "win.h"
...@@ -77,6 +76,10 @@ int do_int(int intnum, struct sigcontext_struct *scp) ...@@ -77,6 +76,10 @@ int do_int(int intnum, struct sigcontext_struct *scp)
case 0x2a: return do_int2a(scp); case 0x2a: return do_int2a(scp);
case 0x2f: return do_int2f(scp); case 0x2f: return do_int2f(scp);
case 0x31: return do_int31(scp); case 0x31: return do_int31(scp);
default:
printf("int%02x: Unimplemented!\n", intnum);
break;
} }
return 0; return 0;
} }
...@@ -98,6 +101,7 @@ static void win_fault(int signal, int code, struct sigcontext *scp) ...@@ -98,6 +101,7 @@ static void win_fault(int signal, int code, struct sigcontext *scp)
#ifdef linux #ifdef linux
if(signal != SIGSEGV if(signal != SIGSEGV
&& signal != SIGILL && signal != SIGILL
&& signal != SIGFPE
#ifdef SIGBUS #ifdef SIGBUS
&& signal != SIGBUS && signal != SIGBUS
#endif #endif
...@@ -131,7 +135,7 @@ static void win_fault(int signal, int code, struct sigcontext *scp) ...@@ -131,7 +135,7 @@ static void win_fault(int signal, int code, struct sigcontext *scp)
/* Now take a look at the actual instruction where the program /* Now take a look at the actual instruction where the program
bombed */ bombed */
instr = (unsigned char *) SAFEMAKEPTR(scp->sc_cs, scp->sc_eip); instr = (unsigned char *) PTR_SEG_OFF_TO_LIN(scp->sc_cs, scp->sc_eip);
switch(*instr) switch(*instr)
{ {
...@@ -233,6 +237,7 @@ void init_wine_signals(void) ...@@ -233,6 +237,7 @@ void init_wine_signals(void)
(void (*)()) (((unsigned int)(cstack) + sizeof(cstack) - 4) & ~3); (void (*)()) (((unsigned int)(cstack) + sizeof(cstack) - 4) & ~3);
wine_sigaction(SIGSEGV, &segv_act, NULL); wine_sigaction(SIGSEGV, &segv_act, NULL);
wine_sigaction(SIGILL, &segv_act, NULL); wine_sigaction(SIGILL, &segv_act, NULL);
wine_sigaction(SIGFPE, &segv_act, NULL);
#ifdef SIGBUS #ifdef SIGBUS
wine_sigaction(SIGBUS, &segv_act, NULL); wine_sigaction(SIGBUS, &segv_act, NULL);
#endif #endif
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
MODULE = memory MODULE = memory
SRCS = \ SRCS = \
selector.c \
global.c \ global.c \
heap.c \ local.c
linear.c
OBJS = $(SRCS:.c=.o) OBJS = $(SRCS:.c=.o)
......
/*
static char RCSId[] = "$Id$";
static char Copyright[] = "Copyright Robert J. Amstadt, 1994";
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "prototypes.h"
#include "heap.h"
#include "segmem.h"
#ifdef HAVE_IPC
static key_t MemoryKeys[SHMSEG]; /* Keep track of keys were using */
static int LinearInitialized = 0;
#endif
#ifdef HAVE_IPC
/**********************************************************************
* LinearFindSpace
*/
int
LinearFindSpace(int n_segments)
{
int i, n;
if (!LinearInitialized)
{
memset(MemoryKeys, -1, sizeof(MemoryKeys));
return 0;
}
for (i = 0, n = 0; i < SHMSEG, n != n_segments; i++)
{
if (MemoryKeys[i] < 0)
n++;
else
n = 0;
}
if (n != n_segments)
return -1;
else
return i - n;
}
#endif /* HAVE_IPC */
/**********************************************************************
* GlobalLinearLock
*
* OK, this is an evil beast. We will do one of two things:
*
* 1. If the data item <= 64k, then just call GlobalLock().
* 2. If the data item > 64k, then map memory.
*/
void *
GlobalLinearLock(unsigned int block)
{
GDESC *g, *g_first;
int loc_idx;
unsigned long addr;
int i;
/******************************************************************
* Get GDESC for this block.
*/
g_first = GlobalGetGDesc(block);
if (g_first == NULL)
return 0;
/******************************************************************
* Is block less then 64k in length?
*/
if (g_first->sequence != 1 || g_first->length == 1)
{
return (void *) GlobalLock(block);
}
/******************************************************************
* If there is already a linear lock on this memory, then
* just return a pointer to it.
*/
if (g_first->linear_count)
{
g_first->linear_count++;
return g_first->linear_addr;
}
/******************************************************************
* No luck. We need to do the linear mapping right now.
*/
#ifdef HAVE_IPC
loc_idx = LinearFindSpace(g_first->length);
if (loc_idx < 0)
return NULL;
addr = (unsigned long) SHM_RANGE_START + (0x10000 * loc_idx);
g = g_first;
for (i = loc_idx;
i < loc_idx + g_first->length;
i++, addr += 0x10000, g = g->next)
{
if ((MemoryKeys[i] = IPCCopySelector(g->handle >> __AHSHIFT,
addr, 0)) < 0)
return NULL;
g->linear_addr = (void *) addr;
g->linear_count = 1;
}
#endif /* HAVE_IPC */
return g_first->linear_addr;
}
/**********************************************************************
* GlobalLinearUnlock
*
*/
unsigned int
GlobalLinearUnlock(unsigned int block)
{
GDESC *g, *g_first;
int loc_idx;
int i;
/******************************************************************
* Get GDESC for this block.
*/
g_first = GlobalGetGDesc(block);
if (g_first == NULL)
return block;
/******************************************************************
* Is block less then 64k in length?
*/
if (g_first->sequence != 1 || g_first->length == 1)
{
return GlobalUnlock(block);
}
/******************************************************************
* Make sure we have a lock on this block.
*/
#ifdef HAVE_IPC
if (g_first->linear_count > 1)
{
g_first->linear_count--;
}
else if (g_first->linear_count == 1)
{
g = g_first;
loc_idx = (((unsigned int) g_first - (unsigned int) SHM_RANGE_START)
/ 0x10000);
for (i = 0; i < g_first->length; i++, g = g->next)
{
shmdt(g->linear_addr);
g->linear_addr = NULL;
MemoryKeys[i] = -1;
}
g_first->linear_count = 0;
return 0;
}
#endif /* HAVE_IPC */
return 0;
}
/**********************************************************************/
void LinearTest()
{
#if 0
unsigned int handle;
int *seg_ptr;
int *lin_ptr;
int seg, i;
int *p;
handle = GlobalAlloc(0, 0x40000);
seg_ptr = GlobalLock(handle);
lin_ptr = GlobalLinearLock(handle);
for (seg = 0; seg < 4; seg++)
{
p = (int *) ((char *) seg_ptr + (0x80000 * seg));
for (i = 0; i < (0x10000 / sizeof(int)); i++, p++)
*p = (seg * (0x10000 / sizeof(int))) + i;
}
p = lin_ptr;
for (i = 0; i < (0x40000 / sizeof(int)); i++, p++)
{
if (*p != i)
printf("lin_ptr[%x] = %x\n", i, *p);
}
#endif
}
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment