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
features. Most applications still do not work.
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.
WHAT'S NEW with Wine-950302: (see ChangeLog for details)
- You now need libXpm to be able to compile.
- OLE stubs and run-time option to disable them.
- Support for special selectors like __0040H.
WHAT'S NEW with Wine-950319: (see ChangeLog for details)
- New memory management scheme. This will probably cause many
new problems, please report them. I'm particularly interested
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
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
the release is available at the ftp sites. The sources will be available
from the following locations:
sunsite.unc.edu:/pub/Linux/ALPHA/wine/Wine-950302.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-950302.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-950302.tar.gz
ftp.funet.fi:/pub/OS/Linux/ALPHA/Wine/Wine-950302.tar.gz
ftp.wonderland.org:/Wine/Wine-950302.tar.gz
sunsite.unc.edu:/pub/Linux/ALPHA/wine/Wine-950319.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-950319.tar.gz
ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-950319.tar.gz
ftp.funet.fi:/pub/OS/Linux/ALPHA/Wine/Wine-950319.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
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)
* [loader/resource.c] [objects/oembitmap.c]
......
......@@ -194,11 +194,6 @@ else
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
/* autoconf.h generated automatically. Run Configure. */
$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.
MEMORY AND SEGMENTS:
NE (Win16) executables consist of multiple segments. The Wine loader
loads each segment into a unique location the Wine processes memory
and assigns a selector to that segment. To make address conversion
simpler, Wine loads the segments in such a way that the segmented
address (16:16) is stored in memory the same way as the 32-bit linear
address. For example, the segmented address 1237:89AB can be at the
address 0x123789AB in the Wine process space.
This also implies that a Win16 program cannot access any arbitrary
memory location. If a pointer needs to be returned to a Win16 program,
then the memory block must be allocated using either GlobalAlloc()
or HEAP_Alloc(). The HEAP_* functions are faster than the Global*
functions but are only capable of managing a 64k memory block. The
HEAP_* functions are used to implement local heaps. Wine should
never call Local* functions. These functions are reserved for use
by Win16 programs only!
The following code fragment should be used to establish a new Wine
local heap:
#include "heap.h"
#define MY_HEAP_SIZE 0x10000 /* Must be <= 64k */
int MyHeapHandle;
void *MyHeapBase;
MDESC *MyHeap;
...
int InitMyHeap()
{
MyHeapHandle = GlobalAlloc(GMEM_FIXED, MY_HEAP_SIZE);
if (MyHeapHandle == 0)
return -1;
MyHeapBase = GlobalLock(MyHeapHandle);
HEAP_Init(&MyHeap, MyHeapBase, MY_HEAP_SIZE);
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().
loads each segment into a unique location in the Wine processes memory
and assigns a selector to that segment. Because of this, it's not
possible to exchange addresses freely between 16-bit and 32-bit code.
Addresses used by 16-bit code are segmented addresses (16:16), formed
by a 16-bit selector and a 16-bit offset. Those used by the Wine code
are regular 32-bit linear addresses.
There's three ways to obtain a segmented pointer:
- Allocate a block of memory from the global heap and use
WIN16_GlobalLock to get its segmented address.
- Allocate a block of memory from a local heap, and build the
segmented address from the local heap selector (see the
USER_HEAP_* macros for an example of this).
- Declare the argument as 'segptr' instead of 'ptr' in the spec file
for a given API function.
Once you have a segmented pointer, it must be converted to a linear
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
pointer can then be used freely with standard Unix functions like
memcpy() etc. without worrying about 64k boundaries. Note: there's no
easy way to convert back from a linear to a segmented address.
In most cases, you don't need to worry about segmented address, as the
conversion is made automatically by the callback code and the API
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
- lParam of Windows messages that point to a structure
- Pointers contained inside structures accessed by 16-bit code.
It is usually a good practice to used the type 'SEGPTR' for segmented
pointers, instead of something like 'LPSTR' or 'char *'. As SEGPTR is
defined as a DWORD, you'll get a compilation warning if you mistakenly
use it as a regular 32-bit pointer.
API ENTRY POINTS:
......@@ -69,7 +60,7 @@ documented in the file "tools/build-spec.txt".
REGISTER FUNCTIONS:
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
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
primary source of information to developers is the ChangeLog (next to
the source, of course).
1. make: No rule to make target xxx/xxx.o. Stop.
This frequently happens when a prior attempt to make xxx.o failed.
1. make: No rule to make target foo/foo.o. Stop.
This frequently happens when a prior attempt to make foo.o failed.
In the current setup, make does not terminate then, but continues and
realises the problem later on. 'make' again and watch the output. Be
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
debugging, feel free to add it.
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)
break;
case WM_SETTEXT:
DEFWND_SetText( hWnd, (LPSTR)lParam );
DEFWND_SetText( hWnd, (LPSTR)PTR_SEG_TO_LIN(lParam) );
PAINT_BUTTON( hWnd, style, ODA_DRAWENTIRE );
return 0;
......@@ -306,7 +306,7 @@ static void PB_Paint( HWND hButton, HDC hDC, WORD action )
else GRAPH_DrawReliefRect( hDC, &rc, 2, 2, FALSE );
/* draw button label, if any: */
text = USER_HEAP_ADDR( wndPtr->hText );
text = USER_HEAP_LIN_ADDR( wndPtr->hText );
if (text[0])
{
SetTextColor( hDC, (wndPtr->dwStyle & WS_DISABLED) ?
......@@ -356,7 +356,7 @@ static void CB_Paint( HWND hWnd, HDC hDC, WORD action )
GetTextMetrics(hDC, &tm);
delta = (rc.bottom - rc.top - tm.tmHeight) >> 1;
text = USER_HEAP_ADDR( wndPtr->hText );
text = USER_HEAP_LIN_ADDR( wndPtr->hText );
textlen = strlen( text );
/* Draw the check-box bitmap */
......@@ -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.top+2 );
text = USER_HEAP_ADDR( wndPtr->hText );
text = USER_HEAP_LIN_ADDR( wndPtr->hText );
GetTextExtentPoint(hDC, text, strlen(text), &size);
rc.left += 10;
rc.right = rc.left + size.cx + 1;
......@@ -481,9 +481,8 @@ static void OB_Paint( HWND hWnd, HDC hDC, WORD action )
WND *wndPtr = WIN_FindWndPtr( hWnd );
BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
if (!(hDis = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(DRAWITEMSTRUCT))))
return;
lpdis = (LPDRAWITEMSTRUCT)USER_HEAP_ADDR(hDis);
if (!(hDis = USER_HEAP_ALLOC( sizeof(DRAWITEMSTRUCT) ))) return;
lpdis = (LPDRAWITEMSTRUCT)USER_HEAP_LIN_ADDR(hDis);
lpdis->CtlType = ODT_BUTTON;
lpdis->CtlID = wndPtr->wIDmenu;
lpdis->itemID = 0;
......@@ -495,7 +494,7 @@ static void OB_Paint( HWND hWnd, HDC hDC, WORD action )
lpdis->hDC = hDC;
GetClientRect( hWnd, &lpdis->rcItem );
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);
}
......
......@@ -14,7 +14,6 @@ static char Copyright[] = "Copyright Martin Ayotte, 1993";
#include "windows.h"
#include "combo.h"
#include "user.h"
#include "heap.h"
#include "win.h"
#include "stddebug.h"
/* #define DEBUG_COMBO */
......@@ -40,10 +39,11 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
LPHEADCOMBO lphc;
HDC hDC;
BITMAP bm;
char str[128];
PAINTSTRUCT paintstruct;
LPDRAWITEMSTRUCT lpdis;
DWORD dwStyle;
HANDLE hStr;
switch(message) {
case WM_CREATE:
wndPtr = WIN_FindWndPtr(hwnd);
......@@ -95,7 +95,7 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
lphc->hWndLBox = CreateWindow("LISTBOX", "", dwStyle,
rect.left, rect.top + bm.bmHeight,
width, height, wndPtr->hwndParent, 0,
wndPtr->hInstance, (LPSTR)MAKELONG(0, hwnd));
wndPtr->hInstance, (SEGPTR)MAKELONG(0, hwnd));
ShowWindow(lphc->hWndLBox, SW_HIDE);
dprintf_combo(stddeb,"Combo Creation LBox=%X!\n", lphc->hWndLBox);
return 0;
......@@ -126,15 +126,16 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL || wndPtr == NULL) return 0;
if (LOWORD(lParam) == lphc->hWndLBox) {
hStr = USER_HEAP_ALLOC( 256 );
switch(HIWORD(lParam)) {
case LBN_SELCHANGE:
lphc->dwState = lphc->dwState & (CB_SHOWDROPDOWN ^ 0xFFFFFFFFL);
ShowWindow(lphc->hWndLBox, SW_HIDE);
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
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)
SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str);
SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, USER_HEAP_SEG_ADDR(hStr));
else {
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
......@@ -148,6 +149,7 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
MAKELONG(hwnd, CBN_DBLCLK));
break;
}
USER_HEAP_FREE( hStr );
}
break;
case WM_LBUTTONDOWN:
......@@ -174,9 +176,11 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
dprintf_combo(stddeb,"before Combo List GetCurSel !\n");
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
if (y != LB_ERR) {
hStr = USER_HEAP_ALLOC( 256 );
dprintf_combo(stddeb,"before Combo List GetText !\n");
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str);
SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str);
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, USER_HEAP_SEG_ADDR(hStr));
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");
}
......@@ -211,9 +215,11 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
ShowWindow(lphc->hWndLBox, SW_HIDE);
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
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)
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 )
if (y >= count) y = count - 1;
lphc->LastSel = y;
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)
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,
MAKELONG(hwnd, CBN_SELCHANGE));
USER_HEAP_FREE( hStr );
}
break;
case WM_MEASUREITEM:
......@@ -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);
wndPtr = WIN_FindWndPtr(hwnd);
if (wndPtr == NULL) break;
lpdis = (LPDRAWITEMSTRUCT)lParam;
lpdis = (LPDRAWITEMSTRUCT)PTR_SEG_TO_LIN(lParam);
if (lpdis == NULL) break;
lpdis->CtlType = ODT_COMBOBOX;
lpdis->CtlID = wndPtr->wIDmenu;
......@@ -299,13 +307,15 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
ShowWindow(lphc->hWndLBox, SW_HIDE);
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
if (y != LB_ERR) {
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str);
if (lphc->hWndEdit != 0)
SendMessage(lphc->hWndEdit, WM_SETTEXT, (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)
SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, USER_HEAP_SEG_ADDR(hStr));
USER_HEAP_FREE( hStr );
}
break;
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);
if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_ADDSTRING, wParam, lParam));
......@@ -320,7 +330,7 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_GETTEXTLEN, wParam, lParam));
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);
if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam));
......@@ -463,7 +473,6 @@ void ComboBoxStaticOwnerDraw(HWND hWnd, LPHEADCOMBO lphc)
HDC hDC;
HBRUSH hBrush;
short y;
char str[64];
LPSTR ptr = NULL;
HANDLE hTemp;
WND *wndPtr;
......@@ -471,7 +480,6 @@ void ComboBoxStaticOwnerDraw(HWND hWnd, LPHEADCOMBO lphc)
dprintf_combo(stddeb,"ComboBoxStaticOwnerDraw(%04X, %p) !\n", hWnd, lphc);
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
if (y != LB_ERR) {
SendMessage(lphc->hWndLBox, LB_GETTEXT, y, (LPARAM)str);
ptr = (LPSTR)SendMessage(lphc->hWndLBox, LB_GETITEMDATA, y, 0L);
}
hDC = GetDC(hWnd);
......@@ -480,8 +488,8 @@ void ComboBoxStaticOwnerDraw(HWND hWnd, LPHEADCOMBO lphc)
if (hBrush == (HBRUSH)NULL) hBrush = GetStockObject(WHITE_BRUSH);
wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr == NULL) return;
hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(DRAWITEMSTRUCT));
lpdis = (LPDRAWITEMSTRUCT) USER_HEAP_ADDR(hTemp);
hTemp = USER_HEAP_ALLOC( sizeof(DRAWITEMSTRUCT) );
lpdis = (LPDRAWITEMSTRUCT) USER_HEAP_LIN_ADDR(hTemp);
if (lpdis == NULL) {
printf("ComboBox Ownerdraw // Error allocating DRAWITEMSTRUCT !\n");
ReleaseDC( hWnd, hDC );
......@@ -495,7 +503,7 @@ void ComboBoxStaticOwnerDraw(HWND hWnd, LPHEADCOMBO lphc)
lpdis->itemAction = ODA_DRAWENTIRE;
lpdis->CtlType = ODT_COMBOBOX;
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);
ReleaseDC(hWnd, hDC);
}
......@@ -515,13 +523,13 @@ BOOL DlgDirSelectComboBox(HWND hDlg, LPSTR lpStr, int nIDLBox)
/************************************************************************
* DlgDirListComboBox [USER.195]
*/
int DlgDirListComboBox(HWND hDlg, LPSTR lpPathSpec,
int DlgDirListComboBox(HWND hDlg, SEGPTR lpPathSpec,
int nIDLBox, int nIDStat, WORD wType)
{
HWND hWnd;
LPHEADCOMBO lphc;
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);
lphc = ComboGetStorageHeader(hWnd);
if (lphc == NULL) return 0;
......
......@@ -12,7 +12,7 @@ static char Copyright[] = "Copyright David W. Metcalfe, 1994";
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include <heap.h>
#include "local.h"
#include "win.h"
#include "class.h"
#include "user.h"
......@@ -231,7 +231,7 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam)
break;
case EM_GETRECT:
GetWindowRect(hwnd, (LPRECT)lParam);
GetWindowRect(hwnd, (LPRECT)PTR_SEG_TO_LIN(lParam));
break;
case EM_GETSEL:
......@@ -359,7 +359,7 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam)
textPtr = EDIT_HeapAddr(hwnd, es->hText);
if ((int)wParam > (len = strlen(textPtr)))
{
strcpy((char *)lParam, textPtr);
strcpy((char *)PTR_SEG_TO_LIN(lParam), textPtr);
lResult = (DWORD)len ;
}
else
......@@ -469,7 +469,7 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, 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);
EDITSTATE *es;
unsigned int *textPtrs;
......@@ -477,6 +477,7 @@ long EDIT_NCCreateMsg(HWND hwnd, LONG lParam)
/* store pointer to local or global heap in window structure so that */
/* EDITSTATE structure itself can be stored on local heap */
#if 0
if (HEAP_LocalFindHeap(createStruct->hInstance)!=NULL)
(MDESC **)*(LONG *)(wndPtr->wExtra + 2) =
&HEAP_LocalFindHeap(createStruct->hInstance)->free_list;
......@@ -486,6 +487,7 @@ long EDIT_NCCreateMsg(HWND hwnd, LONG lParam)
GlobalLock(createStruct->hInstance);
/* GlobalUnlock(createStruct->hInstance); */
}
#endif
/* allocate space for state variable structure */
(HANDLE)(*(wndPtr->wExtra)) = EDIT_HeapAlloc(hwnd, sizeof(EDITSTATE));
es = (EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra)));
......@@ -507,21 +509,21 @@ long EDIT_NCCreateMsg(HWND hwnd, LONG lParam)
}
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->hText = EDIT_HeapAlloc(hwnd, EditBufLen(wndPtr) + 2);
text = EDIT_HeapAddr(hwnd, es->hText);
strcpy(text, createStruct->lpszName);
strcpy(text, windowName);
*(text + es->textlen) = '\0';
}
else
{
es->hText = EDIT_HeapAlloc(hwnd,
strlen(createStruct->lpszName) + 2);
es->hText = EDIT_HeapAlloc(hwnd, strlen(windowName) + 2);
text = EDIT_HeapAddr(hwnd, es->hText);
strcpy(text, createStruct->lpszName);
es->textlen = strlen(createStruct->lpszName) + 1;
strcpy(text, windowName);
es->textlen = strlen(windowName) + 1;
}
*(text + es->textlen + 1) = '\0';
EDIT_BuildTextPointers(hwnd);
......@@ -970,10 +972,10 @@ void EDIT_WriteTextLine(HWND hwnd, RECT *rect, int y)
}
}
}
else
else
EDIT_WriteText(hwnd, lp, off, len, y - es->wtop, rc.left, &rc,
TRUE, FALSE);
EDIT_HeapFree(hwnd, hLine);
}
......@@ -998,7 +1000,7 @@ void EDIT_WriteText(HWND hwnd, char *lp, int off, int len, int row,
HDC hdc;
HANDLE hStr;
char *str, *cp, *cp1;
int diff, num_spaces, tabwidth, scol;
int diff=0, num_spaces, tabwidth, scol;
HRGN hrgnClip;
COLORREF oldTextColor, oldBkgdColor;
HFONT oldfont;
......@@ -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);
if( off < 0 ) {
len += off;
col -= off;
off = 0;
}
hdc = GetDC(hwnd);
hStr = EDIT_GetStr(hwnd, lp, off, len, &diff);
str = (char *)EDIT_HeapAddr(hwnd, hStr);
......@@ -1166,7 +1174,7 @@ void EDIT_CharMsg(HWND hwnd, WORD wParam)
break;
default:
if (wParam >= 20 && wParam <= 126)
if (wParam >= 20 && wParam <= 254 && wParam != 127 )
EDIT_KeyTyped(hwnd, wParam);
break;
}
......@@ -2232,15 +2240,15 @@ LONG EDIT_SetTextMsg(HWND hwnd, LONG lParam)
EDITSTATE *es =
(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);
es->textlen = len;
es->hText = EDIT_HeapReAlloc(hwnd, es->hText, len + 3);
text = EDIT_HeapAddr(hwnd, es->hText);
if (lParam)
strcpy(text, (char *)lParam);
strcpy(text, (char *)PTR_SEG_TO_LIN(lParam));
text[len] = '\0';
text[len + 1] = '\0';
text[len + 2] = '\0';
......@@ -2392,7 +2400,7 @@ void EDIT_GetLineCol(HWND hwnd, int off, int *line, int *col)
(unsigned int *)EDIT_HeapAddr(hwnd, es->hTextPtrs);
/* check for (0,0) */
if (!off)
if (!off || !es->wlines)
{
*line = 0;
*col = 0;
......@@ -2739,7 +2747,8 @@ LONG EDIT_GetSelMsg(HWND hwnd)
void EDIT_ReplaceSel(HWND hwnd, LONG lParam)
{
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);
UpdateWindow(hwnd);
}
......@@ -3000,9 +3009,8 @@ unsigned int EDIT_HeapAlloc(HWND hwnd, int bytes)
{
WND *wndPtr = WIN_FindWndPtr(hwnd);
unsigned int ret;
ret = ((unsigned int)HEAP_Alloc((MDESC **)
*(LONG *)(wndPtr->wExtra + 2),
GMEM_MOVEABLE, bytes) & 0xffff);
ret = LOCAL_Alloc( wndPtr->hInstance, LMEM_FIXED, bytes );
if (ret == 0)
printf("EDIT_HeapAlloc: Out of heap-memory\n");
return ret;
......@@ -3018,10 +3026,7 @@ unsigned int EDIT_HeapAlloc(HWND hwnd, int bytes)
void *EDIT_HeapAddr(HWND hwnd, unsigned int handle)
{
WND *wndPtr = WIN_FindWndPtr(hwnd);
return ((void *)((handle) ? ((handle) | ((unsigned int)
(*(MDESC **)*(LONG *)(wndPtr->wExtra + 2))
& 0xffff0000)) : 0));
return handle ? PTR_SEG_OFF_TO_LIN( wndPtr->hInstance, handle ) : 0;
}
......@@ -3035,10 +3040,7 @@ unsigned int EDIT_HeapReAlloc(HWND hwnd, unsigned int handle, int bytes)
{
WND *wndPtr = WIN_FindWndPtr(hwnd);
return ((unsigned int)HEAP_ReAlloc((MDESC **)
*(LONG *)(wndPtr->wExtra + 2),
EDIT_HeapAddr(hwnd, handle),
bytes, GMEM_MOVEABLE) & 0xffff);
return LOCAL_ReAlloc( wndPtr->hInstance, handle, bytes, LMEM_FIXED );
}
......@@ -3052,8 +3054,7 @@ void EDIT_HeapFree(HWND hwnd, unsigned int handle)
{
WND *wndPtr = WIN_FindWndPtr(hwnd);
HEAP_Free((MDESC **)*(LONG *)(wndPtr->wExtra + 2),
EDIT_HeapAddr(hwnd, handle));
LOCAL_Free( wndPtr->hInstance, handle );
}
......@@ -3067,7 +3068,10 @@ unsigned int EDIT_HeapSize(HWND hwnd, unsigned int handle)
{
WND *wndPtr = WIN_FindWndPtr(hwnd);
#if 0
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 )
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->MaxVal = 100;
infoPtr->flags = ESB_ENABLE_BOTH;
......@@ -120,7 +120,7 @@ static SCROLLINFO *SCROLL_GetScrollInfo( HWND hwnd, int nBar )
}
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,
* from the top of the scroll-bar.
*/
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;
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 )
SCROLL_DrawMovingThumb( hdc, &rect, vertical, arrowSize,
trackThumbPos + pos - lastClickPos );
lastMousePos = pos;
val = SCROLL_GetThumbVal( infoPtr, &rect, vertical, arrowSize,
val = SCROLL_GetThumbVal( infoPtr, &rect, vertical,
trackThumbPos + lastMousePos - lastClickPos );
SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
SB_THUMBTRACK, MAKELONG( val, hwndCtl ));
......@@ -673,7 +673,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt )
{
if (trackHitTest == SCROLL_THUMB)
{
UINT val = SCROLL_GetThumbVal( infoPtr, &rect, vertical, arrowSize,
UINT val = SCROLL_GetThumbVal( infoPtr, &rect, vertical,
trackThumbPos + lastMousePos - lastClickPos );
SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
SB_THUMBPOSITION, MAKELONG( val, hwndCtl ) );
......@@ -697,7 +697,7 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
{
case WM_CREATE:
{
CREATESTRUCT *lpCreat = (CREATESTRUCT *)lParam;
CREATESTRUCT *lpCreat = (CREATESTRUCT *)PTR_SEG_TO_LIN(lParam);
if (lpCreat->style & SBS_SIZEBOX)
{
fprintf( stdnimp, "Unimplemented style SBS_SIZEBOX.\n" );
......
......@@ -88,10 +88,10 @@ LONG StaticWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam)
case WM_NCCREATE:
if (style == SS_ICON)
{
CREATESTRUCT * createStruct = (CREATESTRUCT *)lParam;
CREATESTRUCT * createStruct = (CREATESTRUCT *)PTR_SEG_TO_LIN(lParam);
if (createStruct->lpszName)
STATIC_SetIcon( hWnd, LoadIcon( createStruct->hInstance,
createStruct->lpszName ));
(SEGPTR)createStruct->lpszName ));
return 1;
}
return DefWindowProc(hWnd, uMsg, wParam, lParam);
......@@ -136,9 +136,9 @@ LONG StaticWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam)
case WM_SETTEXT:
if (style == SS_ICON)
STATIC_SetIcon( hWnd, LoadIcon( wndPtr->hInstance,
(LPSTR)lParam ) );
(SEGPTR)lParam ));
else
DEFWND_SetText( hWnd, (LPSTR)lParam );
DEFWND_SetText( hWnd, (LPSTR)PTR_SEG_TO_LIN(lParam) );
InvalidateRect( hWnd, NULL, FALSE );
UpdateWindow( hWnd );
break;
......@@ -192,7 +192,7 @@ static void PaintTextfn( HWND hwnd, HDC hdc )
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
GetClientRect(hwnd, &rc);
text = USER_HEAP_ADDR( wndPtr->hText );
text = USER_HEAP_LIN_ADDR( wndPtr->hText );
switch (style & 0x0000000F)
{
......
......@@ -13,6 +13,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "desktop.h"
#include "mdi.h"
#include "gdi.h"
#include "user.h"
LONG ListBoxWndProc ( 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[] =
0, 0, 0, 0, NULL, "LISTBOX" },
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS, ComboBoxWndProc, 0, 8,
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" },
{ CS_GLOBALCLASS | CS_SAVEBITS, PopupMenuWndProc, 0, 8,
0, 0, 0, 0, NULL, POPUPMENU_CLASS_NAME },
......@@ -58,12 +59,19 @@ static WNDCLASS WIDGETS_BuiltinClasses[] =
BOOL WIDGETS_Init(void)
{
int i;
HANDLE hName;
char *name;
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++)
{
strcpy( name, class->lpszClassName );
class->lpszClassName = (LPSTR)USER_HEAP_SEG_ADDR( hName );
class->hCursor = LoadCursor( 0, IDC_ARROW );
if (!RegisterClass( class )) return FALSE;
}
USER_HEAP_FREE( hName );
return TRUE;
}
......@@ -6,6 +6,7 @@
#include <sys/utsname.h>
#endif
#include <windows.h>
#include "db_disasm.h"
#define N_BP 25
......@@ -140,7 +141,7 @@ void toggle_next(int num)
unsigned int addr;
addr=wbp[num].addr;
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].next_addr=addr;
}
......
......@@ -72,6 +72,7 @@
#endif
#include <stdio.h>
#include "db_disasm.h"
#include "ldt.h"
/*
* Switch to disassemble 16-bit code.
......@@ -888,9 +889,10 @@ static int db_lengths[] = {
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;
if (db_disasm_16) loc = (unsigned int)PTR_SEG_TO_LIN(loc);
switch(size)
{
case 4:
......@@ -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) \
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.
......@@ -1011,6 +1014,23 @@ db_read_address(loc, short_addr, regmodrm, addrp)
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
db_print_address(seg, size, addrp)
char * seg;
......@@ -1035,7 +1055,7 @@ db_print_address(seg, size, addrp)
fprintf(stderr,",%s,%d", addrp->index, 1<<addrp->ss);
fprintf(stderr,")");
} 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)
if (seg)
fprintf(stderr,"%s:%d",seg, displ);
else
db_task_printsym((db_addr_t)displ);
db_task_printsym((db_addr_t)displ,
short_addr ? WORD : LONG);
break;
case Db:
......@@ -1430,7 +1451,8 @@ db_disasm(loc, altfmt, flag16)
}
else
displ = displ + loc;
db_task_printsym((db_addr_t)displ);
db_task_printsym((db_addr_t)displ,
short_addr ? WORD : LONG);
break;
case Dl:
......@@ -1444,7 +1466,8 @@ db_disasm(loc, altfmt, flag16)
get_value_inc(displ, loc, 4, TRUE);
displ = displ + loc;
}
db_task_printsym((db_addr_t)displ);
db_task_printsym((db_addr_t)displ,
short_addr ? WORD : LONG);
break;
case o1:
......
......@@ -10,6 +10,7 @@
#include <stdio.h>
#include <signal.h>
#include "ldt.h"
#define YYSTYPE int
......@@ -116,8 +117,8 @@ print:
infocmd: INFO REGS { info_reg(); }
| INFO STACK { info_stack(); }
| INFO SEGMENTS { LDT_Print(); }
| INFO BREAK { info_break(); }
| INFO SEGMENTS { print_ldt(); }
%%
......@@ -197,7 +198,7 @@ wine_debug(int signal, int * regs)
int bpnum;
addr = SC_EIP(dbg_mask);
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))){
insert_break(1);
return;
......
......@@ -10,7 +10,6 @@
#include <string.h>
#include <sys/types.h>
#include <neexe.h>
#include <segmem.h>
#include "selectors.h"
#include <wine.h>
#include <dlls.h>
......@@ -168,7 +167,7 @@ load_entrypoints(){
j = GetEntryPointFromOrdinal(wpnt, ordinal);
address = j & 0xffff;
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);
add_hash(buffer, (unsigned int *) address);
cpnt += len + 2;
......
......@@ -6,6 +6,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "ldt.h"
#include "db_disasm.h"
#include "regpos.h"
......@@ -18,60 +19,24 @@ void application_not_running()
fprintf(stderr,"Application not running\n");
}
void print_address(unsigned int addr, FILE * outfile){
char * name;
extern char * find_nearest_symbol(unsigned int *);
void print_address(unsigned int addr, FILE * outfile, int addrlen)
{
if (addrlen == 16)
{
fprintf( outfile, "%4.4x:%4.4x", addr >> 16, addr & 0xffff );
}
else
{
extern char * find_nearest_symbol(unsigned int *);
name = find_nearest_symbol((unsigned int *) addr);
char * name = find_nearest_symbol((unsigned int *) addr);
if(name)
fprintf(outfile,"0x%8.8x(%s)", addr, name);
else
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(){
......@@ -128,18 +93,17 @@ void examine_memory(int addr, int count, char format){
int i;
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) {
print_address(addr, stderr);
print_address(addr, stderr, dbg_mode);
fprintf(stderr,": ");
};
switch(format){
case 's':
pnt = (char *) addr;
pnt = dbg_mode == 16 ? (char *)PTR_SEG_TO_LIN(addr)
: (char *)addr;
if (count == 1) count = 256;
while(*pnt && count) {
fputc( *pnt++, stderr);
......@@ -150,20 +114,22 @@ void examine_memory(int addr, int count, char format){
case 'i':
for(i=0; i<count; i++) {
print_address(addr, stderr);
print_address(addr, stderr, dbg_mode);
fprintf(stderr,": ");
addr += print_insn((char *) addr, (char *) addr, stderr, dbg_mode);
addr = db_disasm( addr, 0, (dbg_mode == 16) );
fprintf(stderr,"\n");
};
return;
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++)
{
fprintf(stderr," %8.8x", *dump++);
addr += 4;
if ((i % 8) == 7) {
fprintf(stderr,"\n");
print_address((unsigned int) dump, stderr);
print_address(addr, stderr, dbg_mode);
fprintf(stderr,": ");
};
}
......@@ -171,13 +137,15 @@ void examine_memory(int addr, int count, char format){
return;
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++)
{
fprintf(stderr," %d", *dump++);
addr += 4;
if ((i % 8) == 7) {
fprintf(stderr,"\n");
print_address((unsigned int) dump, stderr);
print_address(addr, stderr, dbg_mode);
fprintf(stderr,": ");
};
}
......@@ -185,13 +153,15 @@ void examine_memory(int addr, int count, char format){
return;
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++)
{
fprintf(stderr," %x", *wdump++);
addr += 2;
if ((i % 10) == 7) {
fprintf(stderr,"\n");
print_address((unsigned int) wdump, stderr);
print_address(addr, stderr, dbg_mode);
fprintf(stderr,": ");
};
}
......@@ -199,7 +169,8 @@ void examine_memory(int addr, int count, char format){
return;
case 'c':
pnt = (char *) addr;
pnt = dbg_mode == 16 ? (char *)PTR_SEG_TO_LIN(addr)
: (char *)addr;
for(i=0; i<count; i++)
{
if(*pnt < 0x20) {
......@@ -207,9 +178,10 @@ void examine_memory(int addr, int count, char format){
pnt++;
} else
fprintf(stderr," %c", *pnt++);
addr++;
if ((i % 32) == 7) {
fprintf(stderr,"\n");
print_address((unsigned int) pnt, stderr);
print_address(addr, stderr, dbg_mode);
fprintf(stderr,": ");
};
}
......@@ -217,13 +189,15 @@ void examine_memory(int addr, int count, char format){
return;
case 'b':
pnt = (char *) addr;
pnt = dbg_mode == 16 ? (char *)PTR_SEG_TO_LIN(addr)
: (char *)addr;
for(i=0; i<count; i++)
{
fprintf(stderr," %02x", (*pnt++) & 0xff);
addr++;
if ((i % 32) == 7) {
fprintf(stderr,"\n");
print_address((unsigned int) pnt, stderr);
print_address(addr, stderr, dbg_mode);
fprintf(stderr,": ");
};
}
......@@ -293,26 +267,32 @@ void dbg_bt(){
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,"%d ",frameno);
print_address(frame->u.win32.saved_ip,stderr);
cs = SC_CS;
while((cs & 3) == 3) {
/* See if in 32 bit mode or not. Assume GDT means 32 bit. */
if ((cs & 7) != 7) {
void CallTo32();
fprintf(stderr,"\n%d ",frameno++);
print_address(frame->u.win32.saved_ip,stderr);
fprintf(stderr,"%d ",frameno++);
print_address(frame->u.win32.saved_ip,stderr,32);
fprintf( stderr, "\n" );
if(frame->u.win32.saved_ip<((unsigned long)CallTo32+1000))break;
frame = (struct frame *) frame->u.win32.saved_bp;
} 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,
frame->u.win16.saved_ip);
frame = (struct frame *) ((frame->u.win16.saved_bp & ~1) |
(SC_SS << 16));
frame = (struct frame *) PTR_SEG_OFF_TO_LIN( SC_SS, frame->u.win16.saved_bp & ~1);
if ((cs & 7) != 7) /* switching to 32-bit mode */
{
extern int IF1632_Saved32_ebp;
frame = (struct frame *)IF1632_Saved32_ebp;
}
}
}
putchar('\n');
......
......@@ -64,6 +64,14 @@
#define SC_EDX(dbg_mask) (regval[RN_EDX] & dbg_mask)
#define SC_ECX(dbg_mask) (regval[RN_ECX] & 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_ERR regval[RN_ERR]
#define SC_EIP(dbg_mask) (regval[RN_EIP] & dbg_mask)
......
......@@ -14,6 +14,7 @@ DLLOBJS =
CALLOBJS = call.o
DLLOBJS = \
dll_commdlg.o \
dll_compobj.o \
dll_gdi.o \
dll_kernel.o \
dll_keyboard.o \
......@@ -28,10 +29,10 @@ DLLOBJS = \
dll_olesvr.o \
dll_shell.o \
dll_sound.o \
dll_storage.o \
dll_stress.o \
dll_system.o \
dll_toolhelp.o \
dll_unixlib.o \
dll_user.o \
dll_win87em.o \
dll_winsock.o
......@@ -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
*/
MakeDllFromSpec(commdlg)
MakeDllFromSpec(compobj)
MakeDllFromSpec(gdi)
MakeDllFromSpec(kernel)
MakeDllFromSpec(keyboard)
......@@ -61,10 +63,10 @@ MakeDllFromSpec(ole2prox)
MakeDllFromSpec(olecli)
MakeDllFromSpec(olesvr)
MakeDllFromSpec(sound)
MakeDllFromSpec(storage)
MakeDllFromSpec(stress)
MakeDllFromSpec(system)
MakeDllFromSpec(toolhelp)
MakeDllFromSpec(unixlib)
MakeDllFromSpec(user)
MakeDllFromSpec(win87em)
MakeDllFromSpec(winsock)
......
......@@ -321,7 +321,6 @@ A(CallTo32:)
* Save registers. 286 mode does not have fs or gs.
*/
pushw %ds
pushw %es
/*
* Restore segment registers.
......@@ -372,7 +371,6 @@ A(CallTo32:)
popw A(IF1632_Saved16_bp)
popw A(IF1632_Saved16_sp)
popw %es
popw %ds
popw %bp
......@@ -423,7 +421,6 @@ A(CallTo32_16:)
* Save registers. 286 mode does not have fs or gs.
*/
pushw %ds
pushw %es
/*
* Restore segment registers.
......@@ -474,7 +471,6 @@ A(CallTo32_16:)
popw A(IF1632_Saved16_bp)
popw A(IF1632_Saved16_sp)
popw %es
popw %ds
popw %bp
......@@ -515,7 +511,6 @@ A(ReturnFromRegisterFunc:)
popw A(IF1632_Saved16_bp)
popw A(IF1632_Saved16_sp)
popw %es
popw %ds
popw %bp
......
......@@ -6,32 +6,39 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include "windows.h"
#include "callback.h"
#include "wine.h"
#include "segmem.h"
#include <setjmp.h>
#include "ldt.h"
#include "stackframe.h"
#include "dlls.h"
#include "stddebug.h"
#include "debug.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 long IF1632_Saved32_ebp;
extern unsigned long IF1632_Saved32_esp;
extern struct segment_descriptor_s *MakeProcThunks;
static WORD ThunkSelector = 0;
struct thunk_s
{
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
......@@ -39,8 +46,7 @@ struct thunk_s
static void
PushOn16(int size, unsigned int value)
{
char *p = (char *) (((unsigned int)IF1632_Saved16_ss << 16) +
IF1632_Saved16_sp);
char *p = PTR_SEG_OFF_TO_LIN( IF1632_Saved16_ss, IF1632_Saved16_sp );
if (size)
{
unsigned long *lp = (unsigned long *) p - 1;
......@@ -67,7 +73,8 @@ CallBack16(void *func, int n_args, ...)
va_list ap;
int i;
int arg_type, arg_value;
WORD ds = CURRENT_DS;
va_start(ap, n_args);
for (i = 0; i < n_args; i++)
......@@ -79,36 +86,50 @@ CallBack16(void *func, int n_args, ...)
va_end(ap);
return CallTo16((unsigned int) func, pStack16Frame->ds );
return CallTo16((unsigned int) func, ds );
}
/**********************************************************************
* CALLBACK_MakeProcInstance
* MakeProcInstance
*/
void *
CALLBACK_MakeProcInstance(void *func, int instance)
FARPROC MakeProcInstance( FARPROC func, WORD instance )
{
char *thunks;
struct thunk_s *tp;
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++)
if (!tp->used)
break;
if (tp->used)
return (void *) 0;
if (tp->used) return (FARPROC)0;
tp->thunk[0] = 0xb8;
tp->thunk[0] = 0xb8; /* movw instance, %ax */
tp->thunk[1] = (unsigned char) instance;
tp->thunk[2] = (unsigned char) (instance >> 8);
tp->thunk[3] = 0x8e;
tp->thunk[4] = 0xd8;
tp->thunk[5] = 0xea;
memcpy(&tp->thunk[6], &func, 4);
tp->thunk[3] = 0xea; /* ljmp func */
*(LONG *)&tp->thunk[4] = (LONG)func;
tp->used = 1;
return tp->thunk;
return (FARPROC)MAKELONG( (char *)tp->thunk - thunks, ThunkSelector );
}
/**********************************************************************
......@@ -119,7 +140,7 @@ void FreeProcInstance(FARPROC func)
struct thunk_s *tp;
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++)
{
if ((void *) tp->thunk == (void *) func)
......@@ -183,13 +204,14 @@ LONG CallWindowProc( WNDPROC func, HWND hwnd, WORD message,
}
else if (IS_16_BIT_ADDRESS(func))
{
WORD ds = CURRENT_DS;
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, message );
PushOn16( CALLBACK_SIZE_WORD, wParam );
PushOn16( CALLBACK_SIZE_LONG, lParam );
return CallTo16((unsigned int) func, pStack16Frame->ds );
return CallTo16((unsigned int) func, ds );
}
else
{
......@@ -204,12 +226,13 @@ LONG CallWindowProc( WNDPROC func, HWND hwnd, WORD message,
*/
void CallLineDDAProc(FARPROC func, short xPos, short yPos, long lParam)
{
WORD ds = CURRENT_DS;
if (IS_16_BIT_ADDRESS(func))
{
PushOn16( CALLBACK_SIZE_WORD, xPos );
PushOn16( CALLBACK_SIZE_WORD, yPos );
PushOn16( CALLBACK_SIZE_LONG, lParam );
CallTo16((unsigned int) func, pStack16Frame->ds );
CallTo16((unsigned int) func, ds );
}
else
{
......@@ -222,12 +245,13 @@ void CallLineDDAProc(FARPROC func, short xPos, short yPos, long lParam)
*/
DWORD CallHookProc( HOOKPROC func, short code, WPARAM wParam, LPARAM lParam )
{
WORD ds = CURRENT_DS;
if (IS_16_BIT_ADDRESS(func))
{
PushOn16( CALLBACK_SIZE_WORD, code );
PushOn16( CALLBACK_SIZE_WORD, wParam );
PushOn16( CALLBACK_SIZE_LONG, lParam );
return CallTo16((unsigned int) func, pStack16Frame->ds );
return CallTo16((unsigned int) func, ds );
}
else
{
......@@ -240,12 +264,13 @@ DWORD CallHookProc( HOOKPROC func, short code, WPARAM wParam, LPARAM lParam )
*/
BOOL CallGrayStringProc(FARPROC func, HDC hdc, LPARAM lParam, INT cch )
{
WORD ds = CURRENT_DS;
if (IS_16_BIT_ADDRESS(func))
{
PushOn16( CALLBACK_SIZE_WORD, hdc );
PushOn16( CALLBACK_SIZE_LONG, lParam );
PushOn16( CALLBACK_SIZE_WORD, cch );
return CallTo16((unsigned int) func, pStack16Frame->ds );
return CallTo16((unsigned int) func, ds );
}
else
{
......
# $Id: commdlg.spec,v 1.3 1994/20/08 04:04:21 root Exp root $
#
name commdlg
id 15
id 14
length 31
1 pascal GETOPENFILENAME(ptr) GetOpenFileName(1)
2 pascal GETSAVEFILENAME(ptr) GetSaveFileName(1)
5 pascal CHOOSECOLOR(ptr) ChooseColor(1)
6 pascal FILEOPENDLGPROC(word word word long) FileOpenDlgProc(1 2 3 4)
7 pascal FILESAVEDLGPROC(word word word long) FileSaveDlgProc(1 2 3 4)
8 pascal COLORDLGPROC(word word word long) ColorDlgProc(1 2 3 4)
1 pascal GETOPENFILENAME(ptr) GetOpenFileName
2 pascal GETSAVEFILENAME(ptr) GetSaveFileName
5 pascal CHOOSECOLOR(ptr) ChooseColor
6 pascal FILEOPENDLGPROC(word word word long) FileOpenDlgProc
7 pascal FILESAVEDLGPROC(word word word long) FileSaveDlgProc
8 pascal COLORDLGPROC(word word word long) ColorDlgProc
# 9 pascal LOADALTERBITMAP exported, shared data
11 pascal FINDTEXT(ptr) FindText(1)
12 pascal REPLACETEXT(ptr) ReplaceText(1)
13 pascal FINDTEXTDLGPROC(word word word long) FindTextDlgProc(1 2 3 4)
14 pascal REPLACETEXTDLGPROC(word word word long) ReplaceTextDlgProc(1 2 3 4)
11 pascal FINDTEXT(ptr) FindText
12 pascal REPLACETEXT(ptr) ReplaceText
13 pascal FINDTEXTDLGPROC(word word word long) FindTextDlgProc
14 pascal REPLACETEXTDLGPROC(word word word long) ReplaceTextDlgProc
# 15 pascal CHOOSEFONT exported, shared data
# 16 pascal FORMATCHARDLGPROC exported, shared data
# 18 pascal FONTSTYLEENUMPROC exported, shared data
# 19 pascal FONTFAMILYENUMPROC exported, shared data
20 pascal PRINTDLG(ptr) PrintDlg(1)
21 pascal PRINTDLGPROC(word word word long) PrintDlgProc(1 2 3 4)
22 pascal PRINTSETUPDLGPROC(word word word long) PrintSetupDlgProc(1 2 3 4)
20 pascal PRINTDLG(ptr) PrintDlg
21 pascal PRINTDLGPROC(word word word long) PrintDlgProc
22 pascal PRINTSETUPDLGPROC(word word word long) PrintSetupDlgProc
# 23 pascal EDITINTEGERONLY exported, shared data
# 25 pascal WANTARROWS exported, shared data
26 pascal COMMDLGEXTENDEDERROR() CommDlgExtendError()
27 pascal GETFILETITLE(ptr ptr word) GetFileTitle(1 2 3)
26 pascal COMMDLGEXTENDEDERROR() CommDlgExtendError
27 pascal GETFILETITLE(ptr ptr word) GetFileTitle
# 28 pascal WEP exported, shared data
# 29 pascal DWLBSUBCLASS 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 $
#
name keyboard
id 8
id 7
length 137
#1 pascal Inquire
#2 pascal Enable
#3 pascal Disable
4 pascal ToAscii(word word ptr ptr word) ToAscii(1 2 3 4 5)
5 pascal AnsiToOem(ptr ptr) AnsiToOem(1 2)
6 pascal OemToAnsi(ptr ptr) OemToAnsi(1 2)
4 pascal ToAscii(word word ptr ptr word) ToAscii
5 pascal AnsiToOem(ptr ptr) AnsiToOem
6 pascal OemToAnsi(ptr ptr) OemToAnsi
#7 pascal SetSpeed
#100 pascal ScreenSwitchEnable
#126 pascal GetTableSeg
#127 pascal NewTable
128 pascal OemKeyScan(word) OemKeyScan(1)
129 pascal VkKeyScan(byte) VkKeyScan(1)
130 pascal GetKeyboardType(byte) GetKeyboardType(1)
131 pascal MapVirtualKey(word word) MapVirtualKey(1 2)
132 pascal GetKbCodePage() GetKbCodePage()
133 pascal GetKeyNameText(long ptr word) GetKeyNameText(1 2 3)
134 pascal AnsiToOemBuff(ptr ptr word) AnsiToOemBuff(1 2 3)
135 pascal OemToAnsiBuff(ptr ptr word) OemToAnsiBuff(1 2 3)
128 pascal OemKeyScan(word) OemKeyScan
129 pascal VkKeyScan(byte) VkKeyScan
130 pascal GetKeyboardType(byte) GetKeyboardType
131 pascal MapVirtualKey(word word) MapVirtualKey
132 pascal GetKbCodePage() GetKbCodePage
133 pascal GetKeyNameText(long ptr word) GetKeyNameText
134 pascal AnsiToOemBuff(ptr ptr word) AnsiToOemBuff
135 pascal OemToAnsiBuff(ptr ptr word) OemToAnsiBuff
#136 pascal EnableKbSysReq
#137 pascal GetBiosKeyProc
name mouse
id 14
id 13
length 8
#1 pascal INQUIRE
......
name OLE2
id 16
id 15
length 161
#1 OLEBUILDVERSION
......
name ole2conv
id 17
id 16
length 10
#1 GETFILTERINFO
#2 IMPORTGR
......
name ole2disp
id 18
id 17
length 110
#1 DLLGETCLASSOBJECT
#2 SYSALLOCSTRING
......
name ole2nls
id 19
id 18
length 11
#1 GETUSERDEFAULTLCID
#2 GETSYSTEMDEFAULTLCID
......
name ole2prox
id 20
id 19
length 3
#1 DLLGETCLASSOBJECT
#2 WEP
......
name olecli
id 21
length 954
id 20
length 43
## 954 is too large for now
##length 954
#1 WEP
#2 OLEDELETE
#3 OLESAVETOSTREAM
......@@ -40,9 +43,9 @@ length 954
#38 OLECREATEFROMFILE
#39 OLECREATELINKFROMFILE
#40 OLERELEASE
41 pascal OleRegisterClientDoc(ptr ptr long ptr) OleRegisterClientDoc(1 2 3 4)
42 pascal OleRevokeClientDoc(long) OleRevokeClientDoc(1)
43 pascal OleRenameClientDoc(long ptr) OleRenameClientDoc(1 2)
41 pascal OleRegisterClientDoc(ptr ptr long ptr) OleRegisterClientDoc
42 pascal OleRevokeClientDoc(long) OleRevokeClientDoc
43 pascal OleRenameClientDoc(long ptr) OleRenameClientDoc
#44 OLEREVERTCLIENTDOC
#45 OLESAVEDCLIENTDOC
#46 OLERENAME
......
name olesvr
id 22
id 21
length 31
#1 WEP
2 pascal OleRegisterServer(ptr ptr ptr word word) OleRegisterServer(1 2 3 4 5)
3 pascal OleRevokeServer(long) OleRevokeServer(1)
4 pascal OleBlockServer(long) OleBlockServer(1)
5 pascal OleUnblockServer(long ptr) OleUnblockServer(1 2)
6 pascal OleRegisterServerDoc(long ptr ptr ptr) OleRegisterServerDoc(1 2 3 4)
7 pascal OleRevokeServerDoc(long) OleRevokeServerDoc(1)
2 pascal OleRegisterServer(ptr ptr ptr word word) OleRegisterServer
3 pascal OleRevokeServer(long) OleRevokeServer
4 pascal OleBlockServer(long) OleBlockServer
5 pascal OleUnblockServer(long ptr) OleUnblockServer
6 pascal OleRegisterServerDoc(long ptr ptr ptr) OleRegisterServerDoc
7 pascal OleRevokeServerDoc(long) OleRevokeServerDoc
#8 OLERENAMESERVERDOC
#9 OLEREVERTSERVERDOC
#10 OLESAVEDSERVERDOC
......
# $Id: shell.spec,v 1.3 1993/07/04 04:04:21 root Exp root $
#
name shell
id 6
id 5
length 103
#
......@@ -9,24 +9,24 @@ length 103
# proper parameters. It's just to have stub for PROGMAN.EXE ...
#
1 pascal RegOpenKey(word ptr ptr) RegOpenKey(1 2 3)
2 pascal RegCreateKey(word ptr ptr) RegCreateKey(1 2 3)
3 pascal RegCloseKey(word) RegCloseKey(1)
4 pascal RegDeleteKey(word ptr) RegDeleteKey(1 2)
5 pascal RegSetValue(word ptr long ptr long) RegSetValue(1 2 3 4 5)
6 pascal RegQueryValue(word ptr ptr ptr) RegQueryValue(1 2 3 4)
7 pascal RegEnumKey(word long ptr long) RegEnumKey(1 2 3 4)
9 pascal DragAcceptFiles(word word) DragAcceptFiles(1 2)
11 pascal DragQueryFile(word s_word ptr s_word) DragQueryFile(1 2 3 4)
12 pascal DragFinish(word) DragFinish(1)
13 pascal DragQueryPoint(word ptr) DragQueryPoint(1 2)
20 pascal ShellExecute(word ptr ptr ptr ptr s_word) ShellExecute(1 2 3 4 5 6)
21 pascal FindExecutable(ptr ptr ptr) FindExecutable(1 2 3)
22 pascal ShellAbout(word ptr ptr word) ShellAbout(1 2 3 4)
33 pascal AboutDlgProc(word word word long) AboutDlgProc(1 2 3 4)
34 pascal ExtractIcon(word ptr s_word) ExtractIcon(1 2 3)
102 pascal RegisterShellHook(ptr) RegisterShellHook(1)
103 pascal ShellHookProc() ShellHookProc()
1 pascal RegOpenKey(word ptr ptr) RegOpenKey
2 pascal RegCreateKey(word ptr ptr) RegCreateKey
3 pascal RegCloseKey(word) RegCloseKey
4 pascal RegDeleteKey(word ptr) RegDeleteKey
5 pascal RegSetValue(word ptr long ptr long) RegSetValue
6 pascal RegQueryValue(word ptr ptr ptr) RegQueryValue
7 pascal RegEnumKey(word long ptr long) RegEnumKey
9 pascal DragAcceptFiles(word word) DragAcceptFiles
11 pascal DragQueryFile(word s_word ptr s_word) DragQueryFile
12 pascal DragFinish(word) DragFinish
13 pascal DragQueryPoint(word ptr) DragQueryPoint
20 pascal ShellExecute(word ptr ptr ptr ptr s_word) ShellExecute
21 pascal FindExecutable(ptr ptr ptr) FindExecutable
22 pascal ShellAbout(word ptr ptr word) ShellAbout
33 pascal AboutDlgProc(word word word long) AboutDlgProc
34 pascal ExtractIcon(word ptr s_word) ExtractIcon
102 pascal RegisterShellHook(ptr) RegisterShellHook
103 pascal ShellHookProc() ShellHookProc
# 8 7 0000 WEP 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 $
#
name sound
id 7
id 6
length 20
1 pascal OPENSOUND() OpenSound()
2 pascal CLOSESOUND() CloseSound()
3 pascal SETVOICEQUEUESIZE(word word) SetVoiceQueueSize(1 2)
4 pascal SETVOICENOTE(word word word word) SetVoiceNote(1 2 3 4)
1 pascal OPENSOUND() OpenSound
2 pascal CLOSESOUND() CloseSound
3 pascal SETVOICEQUEUESIZE(word word) SetVoiceQueueSize
4 pascal SETVOICENOTE(word word word word) SetVoiceNote
5 pascal SETVOICEACCENT(word word word word word)
SetVoiceAccent(1 2 3 4 5)
6 pascal SETVOICEENVELOPE(word word word) SetVoiceEnvelope(1 2 3)
7 pascal SETSOUNDNOISE(word word) SetSoundNoise(1 2)
8 pascal SETVOICESOUND(word long word) SetVoiceSound(1 2 3)
9 pascal STARTSOUND() StartSound()
10 pascal STOPSOUND() StopSound()
11 pascal WAITSOUNDSTATE(word) WaitSoundState(1)
12 pascal SYNCALLVOICES() SyncAllVoices()
13 pascal COUNTVOICENOTES(word) CountVoiceNotes(1)
14 pascal GETTHRESHOLDEVENT() GetThresholdEvent()
15 pascal GETTHRESHOLDSTATUS() GetThresholdStatus()
16 pascal SETVOICETHRESHOLD(word word) SetVoiceThreshold(1 2)
17 pascal DOBEEP() DoBeep()
SetVoiceAccent
6 pascal SETVOICEENVELOPE(word word word) SetVoiceEnvelope
7 pascal SETSOUNDNOISE(word word) SetSoundNoise
8 pascal SETVOICESOUND(word long word) SetVoiceSound
9 pascal STARTSOUND() StartSound
10 pascal STOPSOUND() StopSound
11 pascal WAITSOUNDSTATE(word) WaitSoundState
12 pascal SYNCALLVOICES() SyncAllVoices
13 pascal COUNTVOICENOTES(word) CountVoiceNotes
14 pascal GETTHRESHOLDEVENT() GetThresholdEvent
15 pascal GETTHRESHOLDSTATUS() GetThresholdStatus
16 pascal SETVOICETHRESHOLD(word word) SetVoiceThreshold
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
#
name stress
id 10
id 9
length 15
2 pascal allocmem(long) AllocMem(1)
3 pascal freeallmem() FreeAllMem()
6 pascal allocfilehandles(word) AllocFileHandles(1)
7 pascal unallocfilehandles() UnAllocFileHandles()
8 pascal getfreefilehandles() GetFreeFileHandles()
10 pascal allocdiskspace(long word) AllocDiskSpace(1 2)
11 pascal unallocdiskspace(word) UnAllocDiskSpace(1)
12 pascal allocusermem(word) AllocUserMem(1)
13 pascal freeallusermem() FreeAllUserMem()
14 pascal allocgdimem(word) AllocGDIMem(1)
15 pascal freeallgdimem() FreeAllGDIMem()
2 pascal allocmem(long) AllocMem
3 pascal freeallmem() FreeAllMem
6 pascal allocfilehandles(word) AllocFileHandles
7 pascal unallocfilehandles() UnAllocFileHandles
8 pascal getfreefilehandles() GetFreeFileHandles
10 pascal allocdiskspace(long word) AllocDiskSpace
11 pascal unallocdiskspace(word) UnAllocDiskSpace
12 pascal allocusermem(word) AllocUserMem
13 pascal freeallusermem() FreeAllUserMem
14 pascal allocgdimem(word) AllocGDIMem
15 pascal freeallgdimem() FreeAllGDIMem
name system
id 12
id 11
length 20
6 pascal GetSystemmsecCount() GetTickCount()
6 pascal GetSystemmsecCount() GetTickCount
name toolhelp
id 13
id 12
length 83
# 50 1 057b GLOBALHANDLETOSEL exported, shared data
50 pascal16 GlobalHandleToSel(word) GlobalHandleToSel
# 51 1 0318 GLOBALFIRST exported, shared data
# 52 1 0399 GLOBALNEXT exported, shared data
# 53 1 02a2 GLOBALINFO exported, shared data
# 54 1 0417 GLOBALENTRYHANDLE exported, shared data
# 55 1 04a9 GLOBALENTRYMODULE exported, shared data
# 56 1 090e LOCALINFO exported, shared data
# 57 1 095e LOCALFIRST exported, shared data
# 58 1 09e9 LOCALNEXT exported, shared data
59 pascal ModuleFirst(ptr) ModuleFirst(1)
60 pascal ModuleNext(ptr) ModuleNext(1)
61 pascal ModuleFindName(ptr ptr) ModuleFindName(1 2)
62 pascal ModuleFindHandle(ptr word) ModuleFindHandle(1 2)
63 pascal16 TaskFirst(ptr) TaskFirst(1)
64 pascal16 TaskNext(ptr) TaskNext(1)
65 pascal16 TaskFindHandle(ptr word) TaskFindHandle(1 2)
56 pascal16 LocalInfo(ptr word) LocalInfo
57 pascal16 LocalFirst(ptr word) LocalFirst
58 pascal16 LocalNext(ptr) LocalNext
59 pascal16 ModuleFirst(ptr) ModuleFirst
60 pascal16 ModuleNext(ptr) ModuleNext
61 pascal16 ModuleFindName(ptr ptr) ModuleFindName
62 pascal16 ModuleFindHandle(ptr word) ModuleFindHandle
63 pascal16 TaskFirst(ptr) TaskFirst
64 pascal16 TaskNext(ptr) TaskNext
65 pascal16 TaskFindHandle(ptr word) TaskFindHandle
# 66 1 0f1c STACKTRACEFIRST exported, shared data
# 67 1 0f67 STACKTRACECSIPFIRST exported, shared data
# 68 1 0fca STACKTRACENEXT exported, shared data
# 69 1 28b0 CLASSFIRST exported, shared data
# 70 1 2925 CLASSNEXT exported, shared data
# 71 1 11ce SYSTEMHEAPINFO exported, shared data
72 pascal16 MemManInfo(ptr) MemManInfo(1)
69 pascal16 ClassFirst(ptr) ClassFirst
70 pascal16 ClassNext(ptr) ClassNext
71 pascal16 SystemHeapInfo(ptr) SystemHeapInfo
#72 pascal16 MemManInfo(ptr) MemManInfo
# 73 1 1b72 NOTIFYREGISTER exported, shared data
# 74 1 1c29 NOTIFYUNREGISTER exported, shared data
# 75 1 2060 INTERRUPTREGISTER exported, shared data
# 76 1 2111 INTERRUPTUNREGISTER exported, shared data
# 77 1 26ea TERMINATEAPP exported, shared data
# 78 1 29c4 MEMORYREAD exported, shared data
# 79 1 2b6c MEMORYWRITE exported, shared data
78 pascal MemoryRead(word long ptr long) MemoryRead
79 pascal MemoryWrite(word long ptr long) MemoryWrite
# 80 1 2dae TIMERCOUNT exported, shared data
# 81 1 0d68 TASKSETCSIP 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
id 5
id 4
length 10
1 register _fpMath(word word word word
word word word word) WIN87_fpmath()
3 pascal __WinEm87Info(ptr word) WIN87_WinEm87Info(1 2)
4 pascal __WinEm87Restore(ptr word) WIN87_WinEm87Restore(1 2)
5 pascal __WinEm87Save(ptr word) WIN87_WinEm87Save(1 2)
1 register _fpMath() WIN87_fpmath
3 pascal __WinEm87Info(ptr word) WIN87_WinEm87Info
4 pascal __WinEm87Restore(ptr word) WIN87_WinEm87Restore
5 pascal __WinEm87Save(ptr word) WIN87_WinEm87Save
......@@ -4,64 +4,59 @@
# Summary: Module definition file for Windows Sockets DLL.
#
name winsock
id 9
id 8
length 155
1 pascal16 accept(word ptr ptr) WINSOCK_accept(1 2 3)
2 pascal16 bind(word ptr word) WINSOCK_bind(1 2 3)
3 pascal16 closesocket(word) WINSOCK_closesocket(1)
4 pascal16 connect(word ptr word) WINSOCK_connect(1 2 3)
5 pascal16 getpeername(word ptr ptr) WINSOCK_getpeername(1 2 3)
6 pascal16 getsockname(word ptr ptr) WINSOCK_getsockname(1 2 3)
7 pascal16 getsockopt(word word word ptr ptr) WINSOCK_getsockopt(1 2 3 4 5)
8 pascal htonl(long) WINSOCK_htonl(1)
9 pascal16 htons(word) WINSOCK_htons(1)
10 pascal inet_addr(long) WINSOCK_inet_addr(1)
11 pascal inet_ntoa(long) WINSOCK_inet_ntoa(1)
12 pascal16 ioctlsocket(word long ptr) WINSOCK_ioctlsocket(1 2 3)
13 pascal16 listen(word word) WINSOCK_listen(1 2)
14 pascal ntohl(long) WINSOCK_ntohl(1)
15 pascal16 ntohs(word) WINSOCK_ntohs(1)
16 pascal16 recv(word ptr word word) WINSOCK_recv(1 2 3 4)
17 pascal16 recvfrom(word ptr word word ptr ptr)
WINSOCK_recvfrom(1 2 3 4 5 6)
18 pascal16 select(word ptr ptr ptr ptr word)
WINSOCK_select(1 2 3 4 5 6)
19 pascal16 send(word ptr word word) WINSOCK_send(1 2 3 4)
20 pascal16 sendto(word ptr word word ptr ptr)
WINSOCK_sendto(1 2 3 4 5 6)
21 pascal16 setsockopt(word word word ptr word)
WINSOCK_setsockopt(1 2 3 4 5)
22 pascal16 shutdown(word word) WINSOCK_shutdown(1 2)
23 pascal16 socket(word word word) WINSOCK_socket(1 2 3)
51 pascal gethostbyaddr(ptr word word) WINSOCK_gethostbyaddr(1 2 3)
52 pascal gethostbyname(ptr) WINSOCK_gethostbyname(1)
53 pascal getprotobyname(ptr) WINSOCK_getprotobyname(1)
54 pascal getprotobynumber(word) WINSOCK_getprotobynumber(1)
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)
1 pascal16 accept(word ptr ptr) WINSOCK_accept
2 pascal16 bind(word ptr word) WINSOCK_bind
3 pascal16 closesocket(word) WINSOCK_closesocket
4 pascal16 connect(word ptr word) WINSOCK_connect
5 pascal16 getpeername(word ptr ptr) WINSOCK_getpeername
6 pascal16 getsockname(word ptr ptr) WINSOCK_getsockname
7 pascal16 getsockopt(word word word ptr ptr) WINSOCK_getsockopt
8 pascal htonl(long) WINSOCK_htonl
9 pascal16 htons(word) WINSOCK_htons
10 pascal inet_addr(long) WINSOCK_inet_addr
11 pascal inet_ntoa(long) WINSOCK_inet_ntoa
12 pascal16 ioctlsocket(word long ptr) WINSOCK_ioctlsocket
13 pascal16 listen(word word) WINSOCK_listen
14 pascal ntohl(long) WINSOCK_ntohl
15 pascal16 ntohs(word) WINSOCK_ntohs
16 pascal16 recv(word ptr word word) WINSOCK_recv
17 pascal16 recvfrom(word ptr word word ptr ptr) WINSOCK_recvfrom
18 pascal16 select(word ptr ptr ptr ptr word) WINSOCK_select
19 pascal16 send(word ptr word word) WINSOCK_send
20 pascal16 sendto(word ptr word word ptr ptr) WINSOCK_sendto
21 pascal16 setsockopt(word word word ptr word) WINSOCK_setsockopt
22 pascal16 shutdown(word word) WINSOCK_shutdown
23 pascal16 socket(word word word) WINSOCK_socket
51 pascal gethostbyaddr(ptr word word) WINSOCK_gethostbyaddr
52 pascal gethostbyname(ptr) WINSOCK_gethostbyname
53 pascal getprotobyname(ptr) WINSOCK_getprotobyname
54 pascal getprotobynumber(word) WINSOCK_getprotobynumber
55 pascal getservbyname(ptr ptr) WINSOCK_getservbyname
56 pascal getservbyport(word ptr) WINSOCK_getservbyport
57 pascal gethostname(ptr word) WINSOCK_gethostname
101 pascal16 WSAAsyncSelect(word word word long) WSAAsyncSelect
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)
WSAAsyncGetHostByName(1 2 3 4 5)
WSAAsyncGetHostByName
104 pascal16 WSAAsyncGetProtoByNumber(word word word ptr word)
WSAAsyncGetProtoByNumber(1 2 3 4 5)
WSAAsyncGetProtoByNumber
105 pascal16 WSAAsyncGetProtoByName(word word ptr ptr word)
WSAAsyncGetProtoByName(1 2 3 4 5)
WSAAsyncGetProtoByName
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)
WSAAsyncGetServByName(1 2 3 4 5 6)
108 pascal16 WSACancelAsyncRequest(word) WSACancelAsyncRequest(1)
109 pascal16 WSASetBlockingHook() WSASetBlockingHook()
110 pascal16 WSAUnhookBlockingHook() WSAUnhookBlockingHook()
111 pascal16 WSAGetLastError() WSAGetLastError()
112 pascal WSASetLastError(word) WSASetLastError(1)
113 pascal16 WSACancelBlockingCall() WSACancelBlockingCall()
114 pascal16 WSAIsBlocking() WSAIsBlocking()
115 pascal WSAStartup(word ptr) WSAStartup(1 2)
116 pascal WSACleanup() WSACleanup()
151 pascal16 __WSAFDIsSet(word ptr) WSAFDIsSet(1 2)
WSAAsyncGetServByName
108 pascal16 WSACancelAsyncRequest(word) WSACancelAsyncRequest
109 pascal16 WSASetBlockingHook() WSASetBlockingHook
110 pascal16 WSAUnhookBlockingHook() WSAUnhookBlockingHook
111 pascal16 WSAGetLastError() WSAGetLastError
112 pascal WSASetLastError(word) WSASetLastError
113 pascal16 WSACancelBlockingCall() WSACancelBlockingCall
114 pascal16 WSAIsBlocking() WSAIsBlocking
115 pascal WSAStartup(word ptr) WSAStartup
116 pascal WSACleanup() WSACleanup
151 pascal16 __WSAFDIsSet(word ptr) WSAFDIsSet
......@@ -28,10 +28,7 @@ typedef struct
#ifdef WINELIB
#define LocalAlign(flags,bytes) LocalAlloc (flags|LMEM_WINE_ALIGN,bytes)
#else
#define LocalAlign(flags,bytes) WIN16_LocalAlloc((flags),(bytes))
#define LocalAlloc WIN16_LocalAlloc
#define LocalLock WIN16_LocalLock
#define LocalFree WIN16_LocalFree
#define LocalAlign(flags,bytes) LocalAlloc((flags),(bytes))
#endif
#endif /* ATOM_H */
......@@ -29,6 +29,7 @@ typedef struct tagDCE
} DCE;
extern void DCE_Init(void);
extern HANDLE DCE_AllocDCE( DCE_TYPE type );
extern void DCE_FreeDCE( HANDLE hdce );
......
......@@ -20,7 +20,7 @@ typedef struct resource_name_table
struct ne_data {
struct ne_header_s *ne_header;
struct ne_segment_table_entry_s *seg_table;
struct segment_descriptor_s *selector_table;
unsigned short *selector_table;
char *lookup_table;
char *nrname_table;
char *rname_table;
......@@ -61,7 +61,6 @@ extern struct w_files *wine_files;
#define DLL_MAX_ARGS 16
#define DLL_HANDLERTYPE_PASCAL 16
#define DLL_HANDLERTYPE_C 17
struct dll_table_entry_s
{
......@@ -76,7 +75,6 @@ struct dll_table_entry_s
*/
char *export_name;
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 */
short conv_reference ; /* reference to Argument conversion data */
#ifdef WINESTAT
......@@ -97,7 +95,6 @@ struct dll_name_table_entry_s
extern struct dll_table_entry_s KERNEL_table[];
extern struct dll_table_entry_s USER_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 MMSYSTEM_table[];
extern struct dll_table_entry_s SHELL_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 OLECLI_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 USER_offsets[];
extern unsigned short GDI_offsets[];
extern unsigned short UNIXLIB_offsets[];
extern unsigned short WIN87EM_offsets[];
extern unsigned short MMSYSTEM_offsets[];
extern unsigned short SHELL_offsets[];
......@@ -140,12 +138,13 @@ extern unsigned short OLE2NLS_offsets[];
extern unsigned short OLE2PROX_offsets[];
extern unsigned short OLECLI_offsets[];
extern unsigned short OLESVR_offsets[];
extern unsigned short COMPOBJ_offsets[];
extern unsigned short STORAGE_offsets[];
extern unsigned char KERNEL_types[];
extern unsigned char USER_types[];
extern unsigned char GDI_types[];
extern unsigned char UNIXLIB_types[];
extern unsigned char WIN87EM_types[];
extern unsigned char MMSYSTEM_types[];
extern unsigned char SHELL_types[];
......@@ -164,8 +163,10 @@ extern unsigned char OLE2NLS_types[];
extern unsigned char OLE2PROX_types[];
extern unsigned char OLECLI_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 */
......
......@@ -11,8 +11,8 @@
#include <X11/Xutil.h>
#include "windows.h"
#include "segmem.h"
#include "heap.h"
#include "ldt.h"
#include "local.h"
/* GDI objects magic numbers */
#define PEN_MAGIC 0x4f47
......@@ -245,18 +245,26 @@ typedef struct tagDC
#ifdef WINELIB
#define GDI_HEAP_ALLOC(f,size) LocalAlloc (f,size)
#define GDI_HEAP_ADDR(handle) LocalLock (handle)
#define GDI_HEAP_FREE(handle) LocalFree (handle)
#define GDI_HEAP_ALLOC(f,size) LocalAlloc (f,size)
#define GDI_HEAP_LIN_ADDR(handle) LocalLock (handle)
#define GDI_HEAP_SEG_ADDR(handle) LocalLock (handle)
#define GDI_HEAP_FREE(handle) LocalFree (handle)
#else
extern MDESC *GDI_Heap;
#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_ADDR(handle) \
((void *)((handle) ? ((handle) | ((int)GDI_Heap & 0xffff0000)) : 0))
extern LPSTR GDI_Heap;
extern WORD GDI_HeapSel;
#define GDI_HEAP_ALLOC(size) \
LOCAL_Alloc( GDI_HeapSel, LMEM_FIXED, (size) )
#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
......
/* $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 @@
#define HOOK_H
#include "windows.h"
#include "user.h"
#include "ldt.h"
/* Hook data (pointed to by a HHOOK) */
typedef struct
......@@ -26,7 +26,8 @@ typedef struct
#define SYSTEM_HOOK(id) (systemHooks[(id)-FIRST_HOOK])
#define TASK_HOOK(id) (taskHooks[(id)-FIRST_HOOK])
#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) \
INTERNAL_CALL_HOOK(SYSTEM_HOOK(id),code,wparam,lparam)
......
......@@ -8,7 +8,6 @@ extern int CallToInit16(unsigned long csip, unsigned long sssp,
extern int CallTo16cx(unsigned long csip, unsigned long dscx);
extern int CallToDllEntry(unsigned long csip, unsigned long dscx, unsigned short di);
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 winestat(void);
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 {
HWND hWndLogicParent;
HFONT hFont;
BOOL bRedrawFlag;
MDESC *Heap;
/* MDESC *Heap; */
} HEADLIST;
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 );
extern void hardware_event( WORD message, WORD wParam, LONG lParam,
int xPos, int yPos, DWORD time, DWORD extraInfo );
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 );
#endif /* MESSAGE_H */
......@@ -15,6 +15,7 @@ struct dosdirent {
char search_attribute;
long filesize;
long filetime;
short entnum; /* Directory entry number */
};
struct fcb {
......@@ -29,16 +30,13 @@ struct fcb {
BYTE dummy2[9];
};
#define DOSVERSION 0x0330;
#define DOSVERSION 0x0500; /* Might as well pretend we're DOS 5.0 */
#define MAX_DOS_DRIVES 26
extern WORD ExtendedError;
extern struct DosDeviceStruct COM[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; \
*((BYTE*)((a)+1)) = ((b)>>8) & 0xff;
......
......@@ -133,11 +133,7 @@ struct relocation_entry_s
#define NE_RELTYPE_ORDINAL 1
#define NE_RELTYPE_NAME 2
#define NE_RELTYPE_OSFIXUP 3
/* Used by Windows 3.0 programs, like when getting selector to be
given to makeprocinst */
#define NE_RELTYPE_INT1 4
#define NE_RELTYPE_ORDINALADD 5
#define NE_RELTYPE_NAMEADD 6
#define NE_RELFLAG_ADDITIVE 4
/*
* DOS PSP
......
......@@ -17,6 +17,8 @@ struct options
int backingstore; /* Use backing store */
short cmdShow;
int debug;
int allowReadOnly; /* Opening a read only file will succeed even
if write access is requested */
};
extern struct options Options;
......
......@@ -9,22 +9,11 @@
#include <sys/types.h>
#include "neexe.h"
#include "segmem.h"
#include "heap.h"
#include "msdos.h"
#include "windows.h"
#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 */
extern HBITMAP ConvertCoreBitmap( HDC hdc, BITMAPCOREHEADER * image );
......@@ -44,11 +33,6 @@ extern HINSTANCE LoadImage(char *modulename, int filetype, int change_dir);
extern int _WinMain(int argc, char **argv);
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 */
extern void SpyInit(void);
......@@ -57,9 +41,5 @@ extern void SpyInit(void);
extern BOOL WIDGETS_Init(void);
/* windows/dce.c */
extern void DCE_Init(void);
#endif /* WINELIB */
#endif /* _WINE_PROTOTYPES_H */
......@@ -7,13 +7,11 @@
#include "wine.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 _BX (_CONTEXT->sc_ebx)
#define _CX (_CONTEXT->sc_ecx)
#define _DX (_CONTEXT->sc_edx)
#define _SP (_CONTEXT->sc_esp)
#define _BP (_CONTEXT->sc_ebp)
#define _SI (_CONTEXT->sc_esi)
#define _DI (_CONTEXT->sc_edi)
#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
#define __WINE_SELECTORS_H
#include "dlls.h"
#include "segmem.h"
#include "windows.h"
#include "ldt.h"
extern int FindUnusedSelectors(int n_selectors);
extern int IPCCopySelector(int i_old, unsigned long new, int swap_type);
extern WORD AllocSelector(WORD old_selector);
extern unsigned int PrestoChangoSelector(unsigned src_selector, unsigned dst_selector);
extern WORD AllocDStoCSAlias(WORD ds_selector);
extern SEGDESC *CreateSelectors(struct w_files * wpnt);
extern WORD FreeSelector(WORD sel);
extern WORD SELECTOR_AllocBlock( void *base, DWORD size, enum seg_type type,
BOOL is32bit, BOOL readonly );
extern WORD SELECTOR_ReallocBlock( WORD sel, void *base, DWORD size,
enum seg_type type, BOOL is32bit,
BOOL readonly );
#include "dlls.h"
extern SEGDESC *CreateNewSegments(int code_flag, int read_only, int length,
int n_segments);
extern SEGDESC *GetNextSegment(unsigned int flags, unsigned int limit);
extern WORD *CreateSelectors( struct w_files * wpnt );
extern unsigned int GetEntryDLLName(char *dll_name, char *function, int *sel,
extern unsigned int GetEntryDLLName(char *dll_name, char *function, WORD *sel,
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);
extern unsigned int GetEntryPointFromOrdinal(struct w_files * wpnt,
int ordinal);
......
......@@ -8,13 +8,13 @@
#define WINE_STACKFRAME_H
#include <windows.h>
#include "ldt.h"
typedef struct
{
WORD saved_ss;
WORD saved_bp;
WORD saved_sp;
WORD es;
WORD ds;
WORD bp;
WORD arg_length;
......@@ -23,7 +23,13 @@ typedef struct
WORD args[1];
} 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 */
......@@ -102,6 +102,7 @@
#undef DEBUG_FIXUP
#undef DEBUG_FONT
#undef DEBUG_GDI
#undef DEBUG_GLOBAL
#undef DEBUG_GRAPHICS
#undef DEBUG_HEAP
#undef DEBUG_ICON
......@@ -110,6 +111,7 @@
#undef DEBUG_KEYBOARD
#undef DEBUG_LDT
#undef DEBUG_LISTBOX
#undef DEBUG_LOCAL
#undef DEBUG_MALLOC
#undef DEBUG_MCI
#undef DEBUG_MCIANIM
......@@ -135,6 +137,7 @@
#undef DEBUG_RELAY
#undef DEBUG_RESOURCE
#undef DEBUG_SCROLL
#undef DEBUG_SELECTOR
#undef DEBUG_SELECTORS
#undef DEBUG_STACK
#undef DEBUG_STRESS
......@@ -142,6 +145,7 @@
#undef DEBUG_TASK
#undef DEBUG_TEXT
#undef DEBUG_TIMER
#undef DEBUG_TOOLHELP
#undef DEBUG_UTILITY
#undef DEBUG_WIN
#undef DEBUG_WINSOCK
......@@ -174,6 +178,7 @@
#define DEBUG_FIXUP
#define DEBUG_FONT
#define DEBUG_GDI
#define DEBUG_GLOBAL
#define DEBUG_GRAPHICS
#define DEBUG_HEAP
#define DEBUG_ICON
......@@ -182,6 +187,7 @@
#define DEBUG_KEYBOARD
#define DEBUG_LDT
#define DEBUG_LISTBOX
#define DEBUG_LOCAL
#define DEBUG_MALLOC
#define DEBUG_MCI
#define DEBUG_MCIANIM
......@@ -207,6 +213,7 @@
#define DEBUG_RELAY
#define DEBUG_RESOURCE
#define DEBUG_SCROLL
#define DEBUG_SELECTOR
#define DEBUG_SELECTORS
#define DEBUG_STACK
#define DEBUG_STRESS
......@@ -214,6 +221,7 @@
#define DEBUG_TASK
#define DEBUG_TEXT
#define DEBUG_TIMER
#define DEBUG_TOOLHELP
#define DEBUG_UTILITY
#define DEBUG_WIN
#define DEBUG_WINSOCK
......
......@@ -3,14 +3,93 @@
#include "windows.h"
DECLARE_HANDLE(HMODULE);
DECLARE_HANDLE(HGLOBAL);
#define MAX_DATA 11
#define MAX_MODULE_NAME 9
#define MAX_PATH 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 */
typedef struct {
......@@ -73,16 +152,37 @@ typedef struct tagMEMMANINFO {
} MEMMANINFO;
typedef MEMMANINFO *LPMEMMANINFO;
typedef struct tagSYSHEAPINFO {
DWORD dwSize;
WORD wUserFreePercent;
WORD wGDIFreePercent;
HGLOBAL hUserSegment;
HGLOBAL hGDISegment;
typedef struct
{
DWORD dwSize;
WORD wUserFreePercent;
WORD wGDIFreePercent;
HGLOBAL hUserSegment;
HGLOBAL hGDISegment;
} SYSHEAPINFO;
typedef SYSHEAPINFO *LPSYSHEAPINFO;
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 */
......@@ -7,8 +7,8 @@
#ifndef USER_H
#define USER_H
#include "segmem.h"
#include "heap.h"
#include "ldt.h"
#include "local.h"
/* USER local heap */
......@@ -16,18 +16,24 @@
#define USER_HEAP_ALLOC(f,size) LocalAlloc (f, size)
#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)
#else
extern MDESC *USER_Heap;
#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, \
USER_HEAP_ADDR(handle),size,f) & 0xffff)
#define USER_HEAP_FREE(handle) (HEAP_Free(&USER_Heap,USER_HEAP_ADDR(handle)))
#define USER_HEAP_ADDR(handle) \
((void *)((handle) ? ((handle) | ((int)USER_Heap & 0xffff0000)) : 0))
extern LPSTR USER_Heap;
extern WORD USER_HeapSel;
#define USER_HEAP_ALLOC(size) \
LOCAL_Alloc( USER_HeapSel, LMEM_FIXED, (size) )
#define USER_HEAP_REALLOC(handle,size) \
LOCAL_ReAlloc( USER_HeapSel, (handle), (size), LMEM_FIXED )
#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 */
......
......@@ -9,6 +9,7 @@
#include <X11/Xlib.h>
#include "ldt.h"
#include "class.h"
#define WND_MAGIC 0x444e4957 /* 'WIND' */
......
......@@ -13,6 +13,7 @@ typedef LONG LPARAM;
typedef LONG LRESULT;
typedef WORD HANDLE;
typedef DWORD HHOOK;
typedef DWORD SEGPTR;
typedef char *LPSTR;
typedef const char *LPCSTR;
typedef char *NPSTR;
......@@ -30,25 +31,28 @@ typedef FARPROC HOOKPROC;
#define DECLARE_HANDLE(a) typedef HANDLE a;
DECLARE_HANDLE(HTASK);
DECLARE_HANDLE(HDRVR);
DECLARE_HANDLE(HWND);
DECLARE_HANDLE(HDC);
DECLARE_HANDLE(HBITMAP);
DECLARE_HANDLE(HBRUSH);
DECLARE_HANDLE(HCLASS);
DECLARE_HANDLE(HCURSOR);
DECLARE_HANDLE(HDC);
DECLARE_HANDLE(HDROP);
DECLARE_HANDLE(HDRVR);
DECLARE_HANDLE(HDWP);
DECLARE_HANDLE(HFONT);
DECLARE_HANDLE(HPEN);
DECLARE_HANDLE(HRGN);
DECLARE_HANDLE(HPALETTE);
DECLARE_HANDLE(HGLOBAL);
DECLARE_HANDLE(HICON);
DECLARE_HANDLE(HINSTANCE);
DECLARE_HANDLE(HLOCAL);
DECLARE_HANDLE(HMENU);
DECLARE_HANDLE(HBITMAP);
DECLARE_HANDLE(HBRUSH);
DECLARE_HANDLE(LOCALHANDLE);
DECLARE_HANDLE(HMETAFILE);
DECLARE_HANDLE(HDWP);
DECLARE_HANDLE(HDROP);
DECLARE_HANDLE(HMODULE);
DECLARE_HANDLE(HPALETTE);
DECLARE_HANDLE(HPEN);
DECLARE_HANDLE(HRGN);
DECLARE_HANDLE(HTASK);
DECLARE_HANDLE(HWND);
DECLARE_HANDLE(LOCALHANDLE);
#define TRUE 1
#define FALSE 0
......@@ -70,15 +74,18 @@ DECLARE_HANDLE(HDROP);
#define WINE_PACKED __attribute__ ((packed))
#endif
#define LOBYTE(w) ((BYTE)(w))
#define LOBYTE(w) ((BYTE)(UINT)(w))
#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 MAKELONG(low, high) ((LONG)(((WORD)(low)) | \
(((DWORD)((WORD)(high))) << 16)))
#define SELECTOROF(ptr) (HIWORD(ptr))
#define OFFSETOF(ptr) (LOWORD(ptr))
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
......
......@@ -5,7 +5,6 @@ MODULE = loader
SRCS = \
dump.c \
ldt.c \
ldtlib.c \
main.c \
ne_image.c \
ne_resource.c \
......
......@@ -16,7 +16,6 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#endif
#include <errno.h>
#include "neexe.h"
#include "segmem.h"
#include "prototypes.h"
/**********************************************************************
......
#ifndef WINELIB
/*
static char RCSId[] = "$Id: ldt.c,v 1.2 1993/07/04 04:04:21 root Exp root $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
*/
* LDT manipulation functions
*
* Copyright 1993 Robert J. Amstadt
* Copyright 1995 Alexandre Julliard
*/
#include <stdio.h>
#include <stdlib.h>
#include <strings.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__)
#include <machine/segments.h>
#endif
/**********************************************************************
* print_ldt
extern int i386_get_ldt(int, union descriptor *, int);
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 !! */
void
print_ldt()
int LDT_GetEntry( int entry, ldt_entry *content )
{
char buffer[0x10000];
unsigned long *lp;
unsigned long base_addr, limit;
int type, dpl, i;
int ret = 0;
#ifdef WINELIB
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__)
struct segment_descriptor *sd;
#endif
if (get_ldt(buffer) < 0)
exit(1);
lp = (unsigned long *) buffer;
long buffer[2];
ret = i386_get_ldt( entry, (union descriptor *)buffer, 1 );
LDT_BytesToEntry( buffer, content );
#endif /* __NetBSD__ || __FreeBSD__ */
#endif /* WINELIB */
return ret;
}
/***********************************************************************
* 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__)
sd = (struct segment_descriptor *) buffer;
#endif
for (i = 0; i < 32; i++, lp++)
{
/* First 32 bits of descriptor */
base_addr = (*lp >> 16) & 0x0000FFFF;
limit = *lp & 0x0000FFFF;
lp++;
/* First 32 bits of descriptor */
base_addr |= (*lp & 0xFF000000) | ((*lp << 16) & 0x00FF0000);
limit |= (*lp & 0x000F0000);
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;
#ifdef WINELIB
for (i = 0; i < LDT_SIZE; i++)
{
if (ldt_copy[i].base || ldt_copy[i].limit)
{
fprintf( stderr, "%04x: sel=%04x base=%08x limit=%05x\n",
i, ENTRY_TO_SELECTOR(i),
ldt_copy[i].base, ldt_copy[i].limit );
}
}
#else /* WINELIB */
#ifdef linux
type = (*lp >> 10) & 5;
dpl = (*lp >> 13) & 3;
#endif
long buffer[2*LDT_SIZE];
ldt_entry content;
modify_ldt( 0, buffer, sizeof(buffer) );
for (i = 0; i < LDT_SIZE; i++)
{
LDT_BytesToEntry( &buffer[2*i], &content );
if (content.base || content.limit)
{
fprintf( stderr, "%04x: sel=%04x base=%08lx limit=%05lx %s type=%d\n",
i, ENTRY_TO_SELECTOR(i),
content.base, content.limit,
content.limit_in_pages ? "(pages)" : "(bytes)",
content.type );
}
}
#endif /* linux */
#if defined(__NetBSD__) || defined(__FreeBSD__)
type = sd->sd_type;
dpl = sd->sd_dpl;
sd++;
#endif
if (*lp & 1000)
{
printf("Entry %2d: Base %08lx, Limit %05lx, DPL %d, Type %d\n",
i, base_addr, limit, dpl, type);
printf(" ");
if (*lp & 0x100)
printf("Accessed, ");
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
{
printf("Entry %2d: Base %08lx, Limit %05lx, DPL %d, Type %d\n",
i, base_addr, limit, dpl, type);
printf(" SYSTEM: %08lx %08lx\n", *lp, *(lp-1));
}
long buffer[2*LDT_SIZE];
ldt_entry content;
i386_get_ldt( 0, (union descriptor *)buffer, LDT_SIZE );
for (i = 0; i < LDT_SIZE; i++)
{
LDT_BytesToEntry( buffer[2*i], &content );
if (content.base || content.limit)
{
fprintf( stderr, "%04x: sel=%04x base=%08lx limit=%05lx %s type=%d\n",
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
#include <fcntl.h>
#include <unistd.h>
#include "neexe.h"
#include "segmem.h"
#include "dlls.h"
#include "if1632.h"
#include "wineopts.h"
......@@ -436,7 +435,8 @@ FARPROC GetProcAddress(HANDLE hModule, char *proc_name)
#ifdef WINELIB
WINELIB_UNIMP ("GetProcAddress");
#else
int sel, addr, ret;
int addr, ret;
WORD sel;
register struct w_files *w = wine_files;
int ordinal, len;
char * cpnt;
......
......@@ -11,12 +11,12 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <string.h>
#include <errno.h>
#include "neexe.h"
#include "segmem.h"
#include "dos_fs.h"
#include "dlls.h"
#include "library.h"
#include "windows.h"
#include "wineopts.h"
#include "wine.h"
#include "task.h"
#include "prototypes.h"
#include "options.h"
......
......@@ -12,7 +12,6 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <string.h>
#include <errno.h>
#include "neexe.h"
#include "segmem.h"
#include "dlls.h"
#include "windows.h"
#include "arch.h"
......@@ -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)
{
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 ne_segment_table_entry_s *seg;
struct segment_descriptor_s *sel;
int status, ordinal, i, n_entries, additive;
unsigned short *sp;
unsigned int selector, address, next_addr;
unsigned int address;
unsigned char dll_name[257], func_name[257];
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",
wpnt->name, segment_num, (int) sel->base_addr >> 16);
dprintf_fixup(stddeb, "Segment fixups for %s, segment %d, selector %04x\n",
wpnt->name, segment_num, sel );
if ((seg->seg_data_offset == 0) ||
!(seg->seg_flags & NE_SEGFLAGS_RELOC_DATA))
......@@ -128,13 +127,14 @@ int NE_FixupSegment(struct w_files *wpnt, int segment_num)
/*
* 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)
{
case NE_RELTYPE_ORDINALADD:
additive = 1;
case NE_RELTYPE_ORDINAL:
if (NE_GetModuleName(wpnt, rep->target1,
dll_name) == NULL)
......@@ -160,9 +160,6 @@ int NE_FixupSegment(struct w_files *wpnt, int segment_num)
dll_name, ordinal, selector, address);
break;
case NE_RELTYPE_NAMEADD:
additive = 1;
case NE_RELTYPE_NAME:
if (NE_GetModuleName(wpnt, rep->target1, dll_name) == NULL) {
fprintf(stderr,"NE_RELTYPE_NAME failed");
......@@ -189,7 +186,6 @@ int NE_FixupSegment(struct w_files *wpnt, int segment_num)
break;
case NE_RELTYPE_INTERNAL:
case NE_RELTYPE_INT1:
if (rep->target1 == 0x00ff)
{
address = GetEntryPointFromOrdinal(wpnt, rep->target2);
......@@ -198,7 +194,7 @@ int NE_FixupSegment(struct w_files *wpnt, int segment_num)
}
else
{
selector = selector_table[rep->target1-1].selector;
selector = selector_table[rep->target1-1];
address = rep->target2;
}
......@@ -206,7 +202,7 @@ int NE_FixupSegment(struct w_files *wpnt, int segment_num)
i + 1, selector, address);
break;
case 7:
case NE_RELTYPE_OSFIXUP:
/* Relocation type 7:
*
* These appear to be used as fixups for the Windows
......@@ -234,69 +230,70 @@ int NE_FixupSegment(struct w_files *wpnt, int segment_num)
return -1;
}
/*
* Stuff the right size result in.
*/
sp = (unsigned short *) ((char *) sel->base_addr + rep->offset);
if (additive)
{
if (FindDLLTable(dll_name) == NULL)
additive = 2;
dprintf_fixup(stddeb,
"%d: ADDR TYPE %d, TYPE %d, OFFSET %04x, ",
i + 1, rep->address_type, rep->relocation_type,
rep->offset);
dprintf_fixup(stddeb,"TARGET %04x %04x\n",
rep->target1, rep->target2);
dprintf_fixup(stddeb, " Additive = %d\n", additive);
}
/* I'm not sure why a DLL entry point fixup could be additive.
Old code used to ignore additive if the target is a built-in
DLL. This doesn't seem to work for __AHSHIFT */
if (additive && FindDLLTable(dll_name) != NULL)
dprintf_fixup(stddeb,"Additive for builtin???\n"
"%d: ADDR TYPE %d, TYPE %d, OFFSET %04x, "
"TARGET %04x %04x\n",
i+1, rep->address_type, rep->relocation_type,
rep->offset, rep->target1, rep->target2);
offset = rep->offset;
switch (rep->address_type)
{
case NE_RADDR_LOWBYTE:
dprintf_fixup(stddeb,"Unhandled address type NE_RADDR_LOWBYTE\n");
return -1;
do {
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:
do {
dprintf_fixup(stddeb," %04x:%04x:%04x OFFSET16\n",
(unsigned int) sp >> 16, (int) sp & 0xFFFF, *sp);
next_addr = *sp;
sp = PTR_SEG_OFF_TO_LIN( sel, offset );
dprintf_fixup(stddeb," %04x:%04x:%04x OFFSET16%s\n",
sel, offset, *sp, additive ? " additive" : "" );
offset = *sp;
*sp = (unsigned short) address;
if (additive == 2)
*sp += next_addr;
sp = (unsigned short *) ((char *) sel->base_addr + next_addr);
if (additive) *sp += offset;
}
while (next_addr != 0xffff && !additive);
while (offset != 0xffff && !additive);
break;
case NE_RADDR_POINTER32:
do {
dprintf_fixup(stddeb," %04x:%04x:%04x POINTER32\n",
(unsigned int) sp >> 16, (int) sp & 0xFFFF, *sp);
next_addr = *sp;
*sp = (unsigned short) address;
if (additive == 2)
*sp += next_addr;
*(sp+1) = (unsigned short) selector;
sp = (unsigned short *) ((char *) sel->base_addr + next_addr);
sp = PTR_SEG_OFF_TO_LIN( sel, offset );
dprintf_fixup(stddeb," %04x:%04x:%04x POINTER32%s\n",
sel, offset, *sp, additive ? " additive" : "" );
offset = *sp;
*sp = (unsigned short) address;
if (additive) *sp += offset;
*(sp+1) = selector;
}
while (next_addr != 0xffff && !additive);
while (offset != 0xffff && !additive);
break;
case NE_RADDR_SELECTOR:
do {
dprintf_fixup(stddeb," %04x:%04x:%04x SELECTOR\n",
(unsigned int) sp >> 16, (int) sp & 0xFFFF, *sp);
next_addr = *sp;
*sp = (unsigned short) selector;
sp = (unsigned short *) ((char *) sel->base_addr + next_addr);
if (rep->relocation_type == NE_RELTYPE_INT1)
break;
sp = PTR_SEG_OFF_TO_LIN( sel, offset );
dprintf_fixup(stddeb," %04x:%04x:%04x SELECTOR%s\n",
sel, offset, *sp, additive ? " additive" : "" );
offset = *sp;
*sp = (unsigned short) selector;
if(additive)
fprintf(stderr,"Additive selector, please report\n");
}
while (next_addr != 0xffff && !additive);
while (offset != 0xffff && !additive);
break;
default:
......@@ -331,10 +328,10 @@ int NE_StartProgram(struct w_files *wpnt)
WIN_StackSize = wpnt->ne->ne_header->stack_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;
cs_reg = wpnt->ne->selector_table[wpnt->ne->ne_header->cs-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];
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;
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)
exit(1);
} else { /* DATA NONE DLL */
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;
} else { /* DATA SINGLE DLL */
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;
}
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;
di_reg = wpnt->hinstance;
......@@ -423,8 +420,7 @@ HINSTANCE NE_LoadImage(struct w_files *wpnt)
wpnt->hinstance=current_nodata++;
} else
wpnt->hinstance = (wpnt->ne->
selector_table[wpnt->ne->ne_header->auto_data_seg-1].
selector);
selector_table[wpnt->ne->ne_header->auto_data_seg-1]);
if (wpnt->hinstance == 0)
wpnt->hinstance = 0xf000;
#endif
......
......@@ -10,12 +10,12 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <fcntl.h>
#include <unistd.h>
#include "windows.h"
#include "ldt.h"
#include "neexe.h"
#include "peexe.h"
#include "arch.h"
#include "dlls.h"
#include "library.h"
#include "heap.h"
#include "resource.h"
#include "stddebug.h"
#include "debug.h"
......@@ -75,7 +75,7 @@ static void NE_LoadNameTable(struct w_files *wpnt)
read(wpnt->fd, &len, sizeof(len));
while (len)
{
new = (RESNAMTAB *) GlobalQuickAlloc(sizeof(*new));
new = (RESNAMTAB *) GlobalLock(GlobalAlloc(GMEM_MOVEABLE,sizeof(*new)));
new->next = top;
top = new;
......@@ -337,12 +337,13 @@ int GetRsrcCount(HINSTANCE hInst, int type_id)
/**********************************************************************
* NE_FindResource [KERNEL.60]
*/
int NE_FindResource(HANDLE instance, LPSTR resource_name, LPSTR type_name,
RESOURCE *r)
int NE_FindResource(HANDLE instance, SEGPTR resource_name, SEGPTR type_name,
RESOURCE *r)
{
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);
r->size = r->offset = 0;
......@@ -351,30 +352,32 @@ int NE_FindResource(HANDLE instance, LPSTR resource_name, LPSTR type_name,
if (r->wpnt->ne->resnamtab == NULL)
NE_LoadNameTable(r->wpnt);
if (((int) type_name & 0xffff0000) == 0)
if (HIWORD(type_name) == 0)
type = (int) type_name;
else {
if (type_name[0] == '\0')
type_name_ptr = PTR_SEG_TO_LIN( type_name );
if (type_name_ptr[0] == '\0')
type = -1;
if (type_name[0] == '#')
type = atoi(type_name + 1);
if (type_name_ptr[0] == '#')
type = atoi(type_name_ptr + 1);
else
type = (int) type_name;
type = (int) type_name_ptr;
}
if (((int) resource_name & 0xffff0000) == 0)
x = FindResourceByNumber(r, type, (int) resource_name | 0x8000);
if (HIWORD(resource_name) == 0)
x = FindResourceByNumber(r, type, LOWORD(resource_name) | 0x8000);
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);
if (resource_name[0] == '#')
x = FindResourceByNumber(r, type, atoi(resource_name + 1));
if (resource_name_ptr[0] == '#')
x = FindResourceByNumber(r, type, atoi(resource_name_ptr + 1));
else
x = FindResourceByName(r, type, resource_name);
x = FindResourceByName(r, type, resource_name_ptr);
}
if (x == -1) {
printf("NE_FindResource hInst=%04X typename=%08X resname=%08X not found!\n",
instance, (int) type_name, (int) resource_name);
printf("NE_FindResource hInst=%04x typename=%p resname=%p not found!\n",
instance, type_name_ptr, resource_name_ptr);
return 0;
}
return 1;
......
......@@ -14,6 +14,7 @@
#include <fcntl.h>
#include <unistd.h>
#include "windows.h"
#include "ldt.h"
#include "neexe.h"
#include "peexe.h"
#include "dlls.h"
......@@ -124,18 +125,26 @@ find_type(struct PE_Resource_Directory *resource, LPSTR resource_name,
* PE_FindResource [KERNEL.60]
*/
int
PE_FindResource(HANDLE instance, LPSTR resource_name, LPSTR type_name,
PE_FindResource(HANDLE instance, SEGPTR resource_name, SEGPTR type_name,
RESOURCE *r)
{
dprintf_resource(stddeb, "PE_FindResource hInst=%04X typename=%08X resname=%08X\n",
instance, (int) type_name, (int) resource_name);
if (HIWORD((DWORD)resource_name))
if (resource_name[0] == '#')
resource_name = (LPSTR) atoi(resource_name + 1);
if (HIWORD((DWORD)type_name))
if (type_name[0] == '#')
type_name = (LPSTR) atoi(type_name + 1);
if (HIWORD(resource_name))
{
char *resource_name_ptr = PTR_SEG_TO_LIN( resource_name );
if (resource_name_ptr[0] == '#')
resource_name = (SEGPTR) atoi(resource_name_ptr + 1);
else
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);
}
......@@ -16,7 +16,6 @@
#include "wine.h"
#include "dos_fs.h"
#include "segmem.h"
#include "prototypes.h"
#include "miscemu.h"
#include "win.h"
......@@ -72,11 +71,15 @@ int do_int(int intnum, struct sigcontext_struct *scp)
scp->sc_edx = 0xdef0;
return 1;
case 0x25: return do_int25(scp);
case 0x26: return do_int26(scp);
case 0x25: return do_int25(scp);
case 0x26: return do_int26(scp);
case 0x2a: return do_int2a(scp);
case 0x2f: return do_int2f(scp);
case 0x31: return do_int31(scp);
default:
printf("int%02x: Unimplemented!\n", intnum);
break;
}
return 0;
}
......@@ -98,6 +101,7 @@ static void win_fault(int signal, int code, struct sigcontext *scp)
#ifdef linux
if(signal != SIGSEGV
&& signal != SIGILL
&& signal != SIGFPE
#ifdef SIGBUS
&& signal != SIGBUS
#endif
......@@ -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
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)
{
......@@ -233,6 +237,7 @@ void init_wine_signals(void)
(void (*)()) (((unsigned int)(cstack) + sizeof(cstack) - 4) & ~3);
wine_sigaction(SIGSEGV, &segv_act, NULL);
wine_sigaction(SIGILL, &segv_act, NULL);
wine_sigaction(SIGFPE, &segv_act, NULL);
#ifdef SIGBUS
wine_sigaction(SIGBUS, &segv_act, NULL);
#endif
......
......@@ -3,9 +3,9 @@
MODULE = memory
SRCS = \
selector.c \
global.c \
heap.c \
linear.c
local.c
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