Commit 490a27e0 authored by Alexandre Julliard's avatar Alexandre Julliard

Release 940607

Tue Jun 7 08:41:27 1994 Bob Amstadt (bob@pooh) * loader/selector.c (FixupFunctionPrologs): New function to fixup loaded DLL function prologs. It replaces the do nothing code with code that loads DS with the appropriate data segment for the DLL. * misc/cursor.c (LoadCursor): Disabled cursor loading from .EXE or .DLL. The code needs to handle the possibility of multiple cursors in a single directory. Also, it should check to see if the cursor is the right size. * objects/font.c (EnumFonts): Checked for lpLogFontList[i] == NULL * objects/gdiobj.c (SetObjectOwner): Removed stub. Replaced with simple return in gdi.spec. This function is not defined for the retail version of Windows. * memory/heap.c (WIN16_LocalHandleDelta): New function. This is really a dummy that imitates the proper return values. * loader/library.c (GetProcAddress): Fixed definition of IS_BUILTIN_DLL() macro. Mon Jun 6 18:15:40 1994 Bob Amstadt (bob@pooh) * miscemu/int21.c (SeekFile): Needed to return current position in DX:AX. * windows/utility.c (windows_wsprintf): Added support for '#' in format, and fixed bug with "ptr" being incremented too many times. * miscemu/int21.c (OpenExistingFile): Add code to handle opening files read-only and write-only. * loader/wine.c: Segment fixups now done in LoadImage instead of _WinMain. This is necessary to support LoadLibrary(). Sun Jun 5 17:34:24 1994 Erik Bos (erik@hacktic.nl) * [loader/*] - fixed: GetModuleHandle() sometimes returned a wrong handle. - don't init dlls when cs == 0 (lzexpand, doesn't seem to have a init function) - LoadLibrary & LoadImage now return error instead of stopping wine. - moved most of NE-functions into one file. - LoadLibrary() uses w_files list instead of its own list. - NE exectables are now fixed-up and initialised when loaded instead of only once before calling InitTask. * [miscemu/int15.c] [miscemu/int31.c] Added. * [loader/selector.c] Stubs added for {Get|Set}SelectorLimit(), {Get|Set}SelectorBase(). * [misc/main.c] Stub added for IsRomModule(). * [miscemu/int21.c] Some cleanup, added heap for returning data. Jun 6, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [tools/build.c] Change MAX_ORDINALS define to higher value, 1299 entries. (MMSYSTEM doesn't have succesive numbers, some are around 1200). * [windows/utility.c] Bug fix in windows_wsprintf(), (twice increments ...). * [windows/winpos.c] Bug fix in SetWindowPos(), redraw was done if flag was set to SWP_NOREDRAW while SWP_SHOWWINDOW). * [misc/message.c] [controls/combo.c] Add an InvalidateRect() in WM_SHOWWINDOW to statisfy the new 'saveunder'. * [windows/win.c] In CreateWindowEx(), do SetMenu() calls after window creation, just before sending to WM_NCCALCSIZE. * [controls/menu.c] In function SetMenu(), now use SetWindowPos() with flags SWP_FRAMECHANGED to readjust menu area. Function MenuBarCalcSize() redone. Sun May 29 11:08:24 1994 David B. Thomas (dt@yenta.abq.nm.us) * [objects/text.c] Fixed problems associated with DT_WORDBREAK flag. String length was not being properly decremented when lines were folded, and wrapping was not performed when DT_NOCLIP and DT_NOPREFIX were both on in addition to DT_WORDBREAK. Windows does wrapping in this case, and now so does wine. Sun Jun 5 19:17:49 1994 Olaf Flebbe (olaf@dragon) * [edit.c] cp1 was uninitialized iff lineno == 0 * FindFile tests for existance of file even if a full filename was supplied. What about unix file names? * [controls/listbox ] wndPtr was uninitialized for LB_SETTOPINDEX * [misc/property.c] Do not free lpProp. Is it really allocated by malloc? {edited by Bob Amstadt: changed free() to GlobalFree()}
parent 36ca1368
......@@ -3,3 +3,4 @@
- RegisterClass() with hbrBackground = COLOR_APPWORKSPACE+1 does not work.
- MDI does not send WM_GETMINMAX message.
- InitializeLoadedDLLs() can't init LZEXPAND.DLL. (cs:ip => 0:0)
- LoadCursor does not correctly handle bitmap cursors
Tue Jun 7 08:41:27 1994 Bob Amstadt (bob@pooh)
* loader/selector.c (FixupFunctionPrologs):
New function to fixup loaded DLL function prologs. It replaces the
do nothing code with code that loads DS with the appropriate data
segment for the DLL.
* misc/cursor.c (LoadCursor):
Disabled cursor loading from .EXE or .DLL. The code needs to handle
the possibility of multiple cursors in a single directory. Also,
it should check to see if the cursor is the right size.
* objects/font.c (EnumFonts):
Checked for lpLogFontList[i] == NULL
* objects/gdiobj.c (SetObjectOwner):
Removed stub. Replaced with simple return in gdi.spec. This
function is not defined for the retail version of Windows.
* memory/heap.c (WIN16_LocalHandleDelta):
New function. This is really a dummy that imitates the proper
return values.
* loader/library.c (GetProcAddress):
Fixed definition of IS_BUILTIN_DLL() macro.
Mon Jun 6 18:15:40 1994 Bob Amstadt (bob@pooh)
* miscemu/int21.c (SeekFile):
Needed to return current position in DX:AX.
* windows/utility.c (windows_wsprintf):
Added support for '#' in format, and fixed bug with "ptr" being
incremented too many times.
* miscemu/int21.c (OpenExistingFile):
Add code to handle opening files read-only and write-only.
* loader/wine.c:
Segment fixups now done in LoadImage instead of _WinMain. This
is necessary to support LoadLibrary().
Sun Jun 5 17:34:24 1994 Erik Bos (erik@hacktic.nl)
* [loader/*]
- fixed: GetModuleHandle() sometimes returned
a wrong handle.
- don't init dlls when cs == 0 (lzexpand, doesn't
seem to have a init function)
- LoadLibrary & LoadImage now return error instead
of stopping wine.
- moved most of NE-functions into one file.
- LoadLibrary() uses w_files list instead of its
own list.
- NE exectables are now fixed-up and initialised when
loaded instead of only once before calling InitTask.
* [miscemu/int15.c] [miscemu/int31.c]
Added.
* [loader/selector.c]
Stubs added for {Get|Set}SelectorLimit(), {Get|Set}SelectorBase().
* [misc/main.c]
Stub added for IsRomModule().
* [miscemu/int21.c]
Some cleanup, added heap for returning data.
Jun 6, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [tools/.c]
Change MAX_ORDINALS define to higher value, 1299 entries.
(MMSYSTEM doesn't have succesive numbers, some are around 1200).
* [windows/utility.c]
Bug fix in windows_wsprintf(), (twice increments ...).
* [windows/winpos.c]
Bug fix in SetWindowPos(), redraw was done if flag
was set to SWP_NOREDRAW while SWP_SHOWWINDOW).
* [misc/message.c] [controls/combo.c]
Add an InvalidateRect() in WM_SHOWWINDOW to statisfy the new 'saveunder'.
* [windows/winpos.c]
Bug fix in SetWindowPos(), (redraw was done if SWP_NOREDRAW set).
* [windows/win.c]
In CreateWindowEx(), do SetMenu() calls after window creation,
just before sending to WM_NCCALCSIZE.
* [controls/menu.c]
In function SetMenu(), now use SetWindowPos() with
flags SWP_FRAMECHANGED to readjust menu area.
Function MenuBarCalcSize() redone.
Sun May 29 11:08:24 1994 David B. Thomas (dt@yenta.abq.nm.us)
* [objects/text.c]
Fixed problems associated with DT_WORDBREAK flag. String length
was not being properly decremented when lines were folded, and
wrapping was not performed when DT_NOCLIP and DT_NOPREFIX were
both on in addition to DT_WORDBREAK. Windows does wrapping in
this case, and now so does wine.
Sun Jun 5 19:17:49 1994 Olaf Flebbe (olaf@dragon)
* [edit.c]
cp1 was uninitialized iff lineno == 0
* FindFile tests for existance of file even if a full
filename was supplied. What about unix file names?
* [controls/listbox ]
wndPtr was uninitialized for LB_SETTOPINDEX
* [misc/property.c]
Do not free lpProp. Is it really allocated by malloc?
{edited by Bob Amstadt: changed free() to GlobalFree()}
----------------------------------------------------------------------
Sat May 28 12:03:23 1994 Bob Amstadt (bob@pooh)
......
......@@ -2084,6 +2084,7 @@ void EDIT_GetLineCol(HWND hwnd, int off, int *line, int *col)
unsigned int *textPtrs = (unsigned int *)EDIT_HEAP_ADDR(es->hTextPtrs);
if (off > strlen(text)) off = strlen(text);
cp1 = text;
for (lineno = 0; lineno < es->wlines; lineno++)
{
cp = text + *(textPtrs + lineno);
......
......@@ -462,8 +462,9 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
printf("ListBox LB_SETTOPINDEX wParam=%x !\n", wParam);
lphl = ListBoxGetStorageHeader(hwnd);
lphl->FirstVisible = wParam;
wndPtr = WIN_FindWndPtr(hwnd);
if (wndPtr->dwStyle & WS_VSCROLL)
SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
break;
......
......@@ -103,7 +103,6 @@ LONG PopupMenuWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
#endif
lppop = PopupMenuGetWindowAndStorage(hwnd, &wndPtr);
if (lppop == NULL) break;
/* if (!lppop->BarFlag) ShowWindow(hwnd, SW_HIDE); */
if (lppop->SysFlag) {
MenuHasFocus = FALSE;
if (wParam == SC_ABOUTWINE) {
......@@ -112,12 +111,12 @@ LONG PopupMenuWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
DialogBox(hSysRes, MAKEINTRESOURCE(2),
GetParent(hwnd), (FARPROC)AboutWine_Proc);
}
else
else {
#ifdef DEBUG_MENU
printf("PopupMenuWndProc // push to Owner WM_SYSCOMMAND !\n");
#endif
PostMessage(lppop->ownerWnd, WM_SYSCOMMAND, wParam, lParam);
/* PostMessage(lppop->hWndParent, WM_SYSCOMMAND, wParam, lParam); */
}
break;
}
#ifdef DEBUG_MENU
......@@ -125,7 +124,6 @@ LONG PopupMenuWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
#endif
MenuHasFocus = FALSE;
PostMessage(lppop->hWndParent, WM_COMMAND, wParam, lParam);
/* PostMessage(lppop->ownerWnd, WM_COMMAND, wParam, lParam); */
break;
case WM_SHOWWINDOW:
#ifdef DEBUG_MENU
......@@ -152,7 +150,7 @@ LONG PopupMenuWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
hwnd, lppop->Width, lppop->Height);
#endif
SetWindowPos(hwnd, 0, 0, 0, lppop->Width + 2, lppop->Height,
SWP_NOZORDER | SWP_NOMOVE);
SWP_NOZORDER | SWP_NOMOVE);
#ifdef DEBUG_MENU
printf("PopupMenuWndProc // End of WM_SHOWWINDOW !\n");
#endif
......@@ -414,11 +412,23 @@ BOOL MenuButtonDown(HWND hWnd, LPPOPUPMENU lppop, int x, int y)
hWnd, x, y, wRet, lpitem);
#endif
if (lpitem != NULL) {
if (lppop->FocusedItem != (WORD)-1 && wRet == lppop->FocusedItem) {
lpitem2 = GetMenuItemPtr(lppop, lppop->FocusedItem);
if ((lpitem2->item_flags & MF_POPUP) == MF_POPUP) {
hSubMenu = (HMENU)lpitem2->item_id;
lppop2 = (LPPOPUPMENU) GlobalLock(hSubMenu);
if (lppop2 == NULL) return FALSE;
if (IsWindowVisible(lppop2->hWnd)) {
ShowWindow(lppop2->hWnd, SW_HIDE);
return TRUE;
}
}
}
MenuItemSelect(hWnd, lppop, wRet);
if ((lpitem->item_flags & MF_POPUP) == MF_POPUP) {
hSubMenu = (HMENU)lpitem->item_id;
lppop2 = (LPPOPUPMENU) GlobalLock(hSubMenu);
if (lppop2 == NULL) return;
if (lppop2 == NULL) return FALSE;
lppop2->hWndParent = hWnd;
if (lppop->BarFlag) {
GetWindowRect(hWnd, &rect);
......@@ -456,6 +466,7 @@ BOOL MenuButtonDown(HWND hWnd, LPPOPUPMENU lppop, int x, int y)
return TRUE;
}
printf("MenuButtonDown // x=%d y=%d // Not Found !\n", x, y);
if (GetCapture() != 0) ReleaseCapture();
MenuHasFocus = FALSE;
ShowWindow(lppop->hWnd, SW_HIDE);
return FALSE;
......@@ -557,11 +568,14 @@ void ResetHiliteFlags(LPPOPUPMENU lppop)
{
LPMENUITEM lpitem;
int i;
#ifdef DEBUG_MENU
printf("ResetHiliteFlags lppop=%08X\n", lppop);
#endif
if (lppop == NULL) return;
lpitem = lppop->firstItem;
for(i = 0; i < lppop->nItems; i++) {
if (lpitem == NULL) return;
lpitem->item_flags &= MF_HILITE ^ 0xFFFF;
lpitem->item_flags &= 0xFFFF ^ MF_HILITE;
lpitem = (LPMENUITEM)lpitem->next;
}
}
......@@ -1042,12 +1056,15 @@ CalcAGAIN:
void MenuBarCalcSize(HDC hDC, LPRECT lprect, LPPOPUPMENU lppop)
{
LPMENUITEM lpitem;
LPMENUITEM lpitem2;
RECT rect;
HBITMAP hBitMap;
BITMAP bm;
HFONT hOldFont;
UINT i, OldHeight;
UINT i, j;
UINT OldHeight, LineHeight;
DWORD dwRet;
if (lprect == NULL) return;
if (lppop == NULL) return;
if (lppop->nItems == 0) return;
InitStdBitmaps();
......@@ -1056,39 +1073,47 @@ void MenuBarCalcSize(HDC hDC, LPRECT lprect, LPPOPUPMENU lppop)
lprect->left, lprect->top, lprect->right, lprect->bottom);
#endif
hOldFont = SelectObject(hDC, GetStockObject(SYSTEM_FONT));
lppop->Height = lprect->bottom - lprect->top;
CalcAGAIN:
OldHeight = lppop->Height;
SetRect(&rect, lprect->left, lprect->top, 0, lprect->top + OldHeight);
lpitem = lppop->firstItem;
for(i = 0; i < lppop->nItems; i++) {
if (lpitem == NULL) break;
rect.bottom = lprect->top + lppop->Height;
if (rect.right > lprect->right)
SetRect(&rect, lprect->left, rect.bottom,
0, rect.bottom + SYSMETRICS_CYMENU);
if ((lpitem->item_flags & MF_BITMAP) == MF_BITMAP) {
hBitMap = (HBITMAP)LOWORD((LONG)lpitem->item_text);
GetObject(hBitMap, sizeof(BITMAP), (LPSTR)&bm);
rect.right = rect.left + bm.bmWidth;
lppop->Height = max(lppop->Height, bm.bmHeight);
LineHeight = OldHeight = SYSMETRICS_CYMENU + 1;
SetRect(&rect, lprect->left, lprect->top, 0, lprect->top + LineHeight);
lpitem2 = lppop->firstItem;
while (lpitem != NULL) {
lpitem = lpitem2;
while(rect.right < lprect->right) {
if (lpitem == NULL) break;
if ((lpitem->item_flags & MF_BITMAP) == MF_BITMAP) {
hBitMap = (HBITMAP)LOWORD((LONG)lpitem->item_text);
GetObject(hBitMap, sizeof(BITMAP), (LPSTR)&bm);
rect.right = rect.left + bm.bmWidth;
LineHeight = max(LineHeight, bm.bmHeight);
}
if (((lpitem->item_flags & MF_BITMAP) != MF_BITMAP) &&
((lpitem->item_flags & MF_SEPARATOR) != MF_SEPARATOR) &&
((lpitem->item_flags & MF_MENUBREAK) != MF_MENUBREAK)) {
dwRet = GetTextExtent(hDC, (char *)lpitem->item_text,
strlen((char *)lpitem->item_text));
rect.right = rect.left + LOWORD(dwRet) + 10;
dwRet = max(SYSMETRICS_CYMENU, (HIWORD(dwRet) + 6));
LineHeight = max(LineHeight, (WORD)dwRet);
}
CopyRect(&lpitem->rect, &rect);
rect.left = rect.right;
lpitem = (LPMENUITEM)lpitem->next;
}
if (((lpitem->item_flags & MF_BITMAP) != MF_BITMAP) &&
((lpitem->item_flags & MF_SEPARATOR) != MF_SEPARATOR) &&
((lpitem->item_flags & MF_MENUBREAK) != MF_MENUBREAK)) {
dwRet = GetTextExtent(hDC, (char *)lpitem->item_text,
strlen((char *)lpitem->item_text));
rect.right = rect.left + LOWORD(dwRet) + 10;
dwRet = max(SYSMETRICS_CYMENU, (HIWORD(dwRet) + 6));
lppop->Height = max(lppop->Height, (WORD)dwRet);
if (LineHeight == OldHeight) {
lpitem2 = lpitem;
LineHeight = OldHeight = SYSMETRICS_CYMENU + 1;
if (lpitem != NULL)
SetRect(&rect, lprect->left, rect.bottom,
0, rect.bottom + LineHeight);
}
else {
OldHeight = LineHeight;
SetRect(&rect, lprect->left, rect.top, 0, rect.top + LineHeight);
}
CopyRect(&lpitem->rect, &rect);
rect.left = rect.right;
lpitem = (LPMENUITEM)lpitem->next;
}
if (OldHeight < lppop->Height) goto CalcAGAIN;
lppop->Width = rect.right;
lprect->bottom = lprect->top + lppop->Height;
lppop->Width = lprect->right - lprect->left;
lppop->Height = rect.bottom - lprect->top;
lprect->bottom = lprect->top + lppop->Height;
CopyRect(&lppop->rect, lprect);
#ifdef DEBUG_MENUCALC
printf("MenuBarCalcSize w=%d h=%d !\n", lppop->Width, lppop->Height);
......@@ -2074,8 +2099,7 @@ BOOL SetMenu(HWND hWnd, HMENU hMenu)
{
RECT rect;
LPPOPUPMENU lpmenu;
NCCALCSIZE_PARAMS *params;
HANDLE hparams;
WORD flags;
WND * wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr == NULL) {
printf("SetMenu(%04X, %04X) // Bad window handle !\n", hWnd, hMenu);
......@@ -2085,20 +2109,17 @@ BOOL SetMenu(HWND hWnd, HMENU hMenu)
printf("SetMenu(%04X, %04X);\n", hWnd, hMenu);
#endif
if (GetCapture() == hWnd) ReleaseCapture();
wndPtr->wIDmenu = hMenu;
if (hMenu == 0) {
printf("SetMenu(%04X, %04X) // Menu removed !\n", hWnd, hMenu);
hparams = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(NCCALCSIZE_PARAMS));
if (hparams) {
params = (NCCALCSIZE_PARAMS *) USER_HEAP_ADDR(hparams);
params->rgrc[0] = wndPtr->rectWindow;
params->lppos = NULL;
SendMessage(hWnd, WM_NCCALCSIZE, FALSE, (LONG)params);
wndPtr->rectClient = params->rgrc[0];
USER_HEAP_FREE(hparams);
}
SendMessage(hWnd, WM_NCPAINT, 0, 0L);
return TRUE;
if (wndPtr->window != 0) {
flags = SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED;
if (!IsWindowVisible(hWnd)) flags |= SWP_NOREDRAW;
if (hMenu == 0) {
wndPtr->wIDmenu = hMenu;
printf("SetMenu(%04X, %04X) // Menu removed, need NC recalc!\n", hWnd, hMenu);
SetWindowPos(hWnd, 0, 0, 0, 0, 0, flags);
return TRUE;
}
wndPtr->wIDmenu = hMenu;
SetWindowPos(hWnd, 0, 0, 0, 0, 0, flags);
}
lpmenu = (LPPOPUPMENU) GlobalLock(hMenu);
if (lpmenu == NULL) {
......@@ -2222,9 +2243,9 @@ HMENU CopySysMenu()
printf("CopySysMenu entry !\n");
#endif
if (hSysMenu == 0) {
hSysMenu = LoadMenu((HINSTANCE)NULL, MAKEINTRESOURCE(1));
/* hSysMenu = LoadMenu((HINSTANCE)NULL, MAKEINTRESOURCE(1)); */
/* hSysMenu = LoadMenu((HINSTANCE)NULL, MAKEINTRESOURCE(SC_SYSMENU));*/
/* hSysMenu = LoadMenu((HINSTANCE)NULL, "SYSMENU"); */
hSysMenu = LoadMenu((HINSTANCE)NULL, "SYSMENU");
if (hSysMenu == 0) {
printf("SysMenu not found in system resources !\n");
return (HMENU)NULL;
......
......@@ -13,6 +13,7 @@
#include <segmem.h>
#include <prototypes.h>
#include <wine.h>
#include <dlls.h>
struct name_hash{
struct name_hash * next;
......
......@@ -8,7 +8,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "wine.h"
#include "segmem.h"
#include <setjmp.h>
#include "dlls.h"
extern SEGDESC Segments[];
extern unsigned short IF1632_Saved16_ss;
extern unsigned long IF1632_Saved16_ebp;
......
......@@ -50,7 +50,7 @@ length 490
StretchBlt(1 2 3 4 5 6 7 8 9 10 11)
36 pascal Polygon (word ptr word) Polygon (1 2 3)
37 pascal Polyline (word ptr word) Polyline (1 2 3)
#38 pascal Escape
38 pascal Escape(word word word ptr ptr) Escape(1 2 3 4 5)
39 pascal RestoreDC(word s_word) RestoreDC(1 2)
40 pascal FillRgn(word word word) FillRgn(1 2 3)
#41 pascal FrameRgn
......@@ -278,7 +278,7 @@ length 490
CreatePolyPolygonRgn(1 2 3 4)
#452 pascal GDISEEGDIDO
#460 pascal GDITASKTERMINATION
461 pascal SetObjectOwner(word) SetObjectOwner(1)
461 return SetObjectOwner 4 0
#462 pascal ISGDIOBJECT
#463 pascal MAKEOBJECTPRIVATE
#464 pascal FIXUPBOGUSPUBLISHERMETAFILE
......
......@@ -143,7 +143,8 @@ length 415
135 pascal GetSystemDirectory(ptr word) GetSystemDirectory(1 2)
136 pascal GetDriveType(byte) GetDriveType(1)
137 pascal FatalAppExit(word ptr) FatalAppExit(1 2)
#138 GETHEAPSPACES
#138 GETHEAPSPACES - This is not correct but may fake out most apps
138 return GetHeapSpaces 2 0x80004000
#139 DOSIGNAL
#140 SETSIGHANDLER
#141 INITTASK1
......@@ -182,10 +183,10 @@ length 415
#183 __0000H
184 return GlobalDOSAlloc 4 0
185 return GlobalDOSFree 2 0
#186 GETSELECTORBASE
#187 SETSELECTORBASE
#188 GETSELECTORLIMIT
#189 SETSELECTORLIMIT
186 pascal GetSelectorBase(word) GetSelectorBase(1)
187 pascal SetSelectorBase(word long) SetSelectorBase(1 2)
188 pascal GetSelectorLimit(word) GetSelectorLimit(1)
189 pascal SetSelectorLimit(word long) SetSelectorLimit(1 2)
#190 __E000H
191 pascal GlobalPageLock(word) GlobalLock(1)
192 pascal GlobalPageUnlock(word) GlobalUnlock(1)
......@@ -204,7 +205,7 @@ length 415
#205 CVWBREAK
#206 ALLOCSELECTORARRAY
207 return IsDBCSLeadByte 2 0
#310 LOCALHANDLEDELTA
310 pascal LocalHandleDelta(word) WIN16_LocalHandleDelta(1)
#311 GETSETKERNELDOSPROC
#314 DEBUGDEFINESEGMENT
315 pascal WriteOutProfiles() sync_profiles()
......@@ -212,7 +213,7 @@ length 415
#318 FATALEXITHOOK
#319 FLUSHCACHEDFILEHANDLE
#320 ISTASK
#323 ISROMMODULE
323 pascal IsRomModule() IsRomModule()
#324 LOGERROR
#325 LOGPARAMERROR
#326 ISROMFILE
......
......@@ -2,12 +2,25 @@
#
name mmsystem
id 11
length 706
length 1226
1 pascal LIBMAIN(word word word ptr) MCI_LibMain(1 2 3 4)
1 pascal MMSYSTEM_WEP(word word word ptr) MMSYSTEM_WEP(1 2 3 4)
2 pascal SNDPLAYSOUND(ptr word) sndPlaySound(1 2)
5 pascal MMSYSTEMGETVERSION() mmsystemGetVersion()
6 pascal DriverProc(long word word long long) DriverProc(1 2 3 4 5)
30 pascal OUTPUTDEBUGSTR(ptr) OutputDebugStr(1)
31 pascal DriverCallback(long word word word long long long) DriverCallback(1 2 3 4 5 6 7)
#32 pascal STACKENTER()
#33 pascal STACKLEAVE()
#34 pascal MMDRVINSTALL()
101 pascal JOYGETNUMDEVS() JoyGetNumDevs()
102 pascal JOYGETDEVCAPS(word ptr word) JoyGetDevCaps(1 2 3)
103 pascal JOYGETPOS(word ptr) JoyGetPos(1 2)
104 pascal JOYGETTHRESHOLD(word ptr) JoyGetThreshold(1 2)
105 pascal JOYRELEASECAPTURE(word) JoyReleaseCapture(1)
106 pascal JOYSETCAPTURE(word word word word) JoySetCapture(1 2 3 4)
107 pascal JOYSETTHRESHOLD(word word) JoySetThreshold(1 2)
109 pascal JOYSETCALIBRATION(word) JoySetCalibration(1)
201 pascal MIDIOUTGETNUMDEVS() midiOutGetNumDevs()
202 pascal MIDIOUTGETDEVCAPS(word ptr word) midiOutGetDevCaps(1 2 3)
203 pascal MIDIOUTGETERRORTEXT(word ptr word) midiOutGetErrorText(1 2 3)
......@@ -73,27 +86,32 @@ length 706
702 pascal MCISENDSTRING(ptr ptr word word) mciSendString(1 2 3 4)
703 pascal MCIGETDEVICEID(ptr) mciSendCommand(1)
706 pascal MCIGETERRORSTRING(long ptr word) mciGetErrorString(1 2 3)
#1100 pascal DRVOPEN
#1101 pascal DRVCLOSE
#1102 pascal DRVSENDMESSAGE
#1103 pascal DRVGETMODULEHANDLE
#1104 pascal DRVDEFDRIVERPROC
#1210 pascal MMIOOPEN
#1211 pascal MMIOCLOSE
#1212 pascal MMIOREAD
#1213 pascal MMIOWRITE
#1214 pascal MMIOSEEK
#1215 pascal MMIOGETINFO
#1216 pascal MMIOSETINFO
#1217 pascal MMIOSETBUFFER
#1218 pascal MMIOFLUSH
#1219 pascal MMIOADVANCE
#1220 pascal MMIOSTRINGTOFOURCC
#1221 pascal MMIOINSTALLIOPROC
#1222 pascal MMIOSENDMESSAGE
#1223 pascal MMIODESCEND
#1224 pascal MMIOASCEND
#1225 pascal MMIOCREATECHUNK
#1226 pascal MMIORENAME
#900 pascal MMTASKCREATE()
#902 pascal MMTASKBLOCK()
#903 pascal MMTASKSIGNAL()
#904 pascal MMGETCURRENTTASK()
#905 pascal MMTASKYIELD()
1100 pascal DRVOPEN(ptr ptr long) DrvOpen(1 2 3)
1101 pascal DRVCLOSE(word long long) DrvClose(1 2 3)
1102 pascal DRVSENDMESSAGE(word word long long) DrvSendMessage(1 2 3 4)
1103 pascal DRVGETMODULEHANDLE(word) DrvGetModuleHandle(1)
1104 pascal DRVDEFDRIVERPROC(long word word long long) DrvDefDriverProc(1 2 3 4 5)
1210 pascal MMIOOPEN(ptr ptr long) mmioOpen(1 2 3)
1211 pascal MMIOCLOSE(word word) mmioClose(1 2)
1212 pascal MMIOREAD(word ptr long) mmioRead(1 2 3)
1213 pascal MMIOWRITE(word ptr long) mmioWrite(1 2 3)
1214 pascal MMIOSEEK(word long word) mmioSeek(1 2 3)
1215 pascal MMIOGETINFO(word ptr word) mmioGetInfo(1 2 3)
1216 pascal MMIOSETINFO(word ptr word) mmioSetInfo(1 2 3)
1217 pascal MMIOSETBUFFER(word ptr long word) mmioSetBuffer(1 2 3 4)
1218 pascal MMIOFLUSH(word word) mmioFlush(1 2)
1219 pascal MMIOADVANCE(word ptr word) mmioAdvance(1 2 3)
1220 pascal MMIOSTRINGTOFOURCC(ptr word) mmioStringToFOURCC(1 2)
1221 pascal MMIOINSTALLIOPROC(long ptr long) mmioInstallIOProc(1 2 3)
1222 pascal MMIOSENDMESSAGE(word word long long) mmioSendMessage(1 2 3 4)
1223 pascal MMIODESCEND(word ptr ptr word) mmioDescend(1 2 3 4)
1224 pascal MMIOASCEND(word ptr word) mmioAscend(1 2 3)
1225 pascal MMIOCREATECHUNK(word ptr word) mmioCreateChunk(1 2 3)
1226 pascal MMIORENAME(ptr ptr ptr long) mmioRename(1 2 3 4)
......@@ -36,7 +36,7 @@ struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] =
{ "KEYBOARD",KEYBOARD_table,137, 8 },
{ "WINSOCK", WINSOCK_table, 155, 9 },
{ "STRESS", STRESS_table, 15, 10},
{ "MMSYSTEM",MMSYSTEM_table,1023,11},
{ "MMSYSTEM",MMSYSTEM_table,1226,11},
{ "SYSTEM", SYSTEM_table, 20 ,12},
{ "TOOLHELP",TOOLHELP_table, 83, 13},
};
......
......@@ -7,6 +7,35 @@
#ifndef DLLS_H
#define DLLS_H
#define MAX_NAME_LENGTH 64
typedef struct resource_name_table
{
struct resource_name_table *next;
unsigned short type_ord;
unsigned short id_ord;
char id[MAX_NAME_LENGTH];
} RESNAMTAB;
struct w_files
{
struct w_files * next;
char * name; /* Name, as it appears in the windows binaries */
char * filename; /* Actual name of the unix file that satisfies this */
int fd;
struct mz_header_s *mz_header;
struct ne_header_s *ne_header;
struct ne_segment_table_entry_s *seg_table;
struct segment_descriptor_s *selector_table;
char * lookup_table;
char * nrname_table;
char * rname_table;
unsigned short hinstance;
RESNAMTAB *resnamtab;
};
extern struct w_files *wine_files;
typedef struct dll_arg_relocation_s
{
unsigned short dst_arg; /* Offset to argument on stack */
......
......@@ -27,6 +27,7 @@ typedef struct heap_local_heap_s
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);
......
......@@ -66,9 +66,6 @@ extern unsigned int GetEntryDLLName(char *dll_name, char *function, int *sel,
int *addr);
extern unsigned int GetEntryDLLOrdinal(char *dll_name, int ordinal, int *sel,
int *addr);
extern unsigned int GetEntryPointFromOrdinal(struct w_files * wpnt,
int ordinal);
extern SEGDESC *CreateSelectors(struct w_files * wpnt);
/* loader/signal.c */
......@@ -81,16 +78,9 @@ extern void load_mz_header (int, struct mz_header_s *);
extern void load_ne_header (int, struct ne_header_s *);
extern char *GetFilenameFromInstance(unsigned short instance);
extern struct w_files *GetFileInfo(unsigned short instance);
extern HINSTANCE LoadImage(char *modulename, int filetype, int change_dir);
extern int _WinMain(int argc, char **argv);
extern void InitializeLoadedDLLs();
extern int FixupSegment(struct w_files * wpnt, int segment_num);
/*
extern struct mz_header_s *CurrentMZHeader;
extern struct ne_header_s *CurrentNEHeader;
extern int CurrentNEFile;
*/
/* if1632/relay.c */
......
#ifndef __TOOLHELP_H
#define __TOOLHELP_H
#include "windows.h"
DECLARE_HANDLE(HMODULE);
#define MAX_MODULE_NAME 9
#define MAX_PATH 255
typedef struct {
DWORD dwSize;
char szModule[MAX_MODULE_NAME + 1];
HMODULE hModule;
WORD wcUsage;
char szExePath[MAX_PATH + 1];
WORD wNext;
} MODULEENTRY;
typedef MODULEENTRY *LPMODULEENTRY;
BOOL ModuleFirst(MODULEENTRY *lpModule);
BOOL ModuleNext(MODULEENTRY *lpModule);
HMODULE ModuleFindName(MODULEENTRY *lpModule, LPCSTR lpstrName);
HMODULE ModuleFindHandle(MODULEENTRY *lpModule, HMODULE hModule);
#endif /* __TOOLHELP_H */
......@@ -11,22 +11,26 @@ typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef unsigned short BOOL;
typedef unsigned char BYTE;
typedef long LONG;
typedef UINT WPARAM;
typedef LONG LPARAM;
typedef LONG LRESULT;
typedef WORD HANDLE;
typedef DWORD HHOOK;
typedef char *LPSTR;
typedef const char *LPCSTR;
typedef char *NPSTR;
typedef INT *LPINT;
typedef UINT *LPUINT;
typedef WORD *LPWORD;
typedef DWORD *LPDWORD;
typedef LONG *LPLONG;
typedef void *LPVOID;
typedef long (*FARPROC)();
typedef FARPROC DLGPROC;
typedef int CATCHBUF[9];
typedef int *LPCATCHBUF;
typedef FARPROC HOOKPROC;
typedef long LONG;
typedef UINT WPARAM;
typedef LONG LPARAM;
typedef LONG LRESULT;
typedef WORD HANDLE;
typedef DWORD HHOOK;
#define DECLARE_HANDLE(a) typedef HANDLE a;
DECLARE_HANDLE(HTASK);
......
#ifndef WINE_H
#define WINE_H
#include "dlls.h"
#define MAX_NAME_LENGTH 64
typedef struct resource_name_table
{
struct resource_name_table *next;
unsigned short type_ord;
unsigned short id_ord;
char id[MAX_NAME_LENGTH];
} RESNAMTAB;
struct w_files
{
struct w_files * next;
char * name; /* Name, as it appears in the windows binaries */
char * filename; /* Actual name of the unix file that satisfies this */
int fd;
struct mz_header_s *mz_header;
struct ne_header_s *ne_header;
struct ne_segment_table_entry_s *seg_table;
struct segment_descriptor_s *selector_table;
char * lookup_table;
char * nrname_table;
char * rname_table;
unsigned short hinstance;
RESNAMTAB *resnamtab;
};
extern struct w_files * wine_files;
extern char *WineIniFileName(void);
extern char *WinIniFileName(void);
......
......@@ -6,12 +6,13 @@ SRCS = \
dump.c \
ldt.c \
ldtlib.c \
main.c \
ne_image.c \
selector.c \
signal.c \
library.c \
resource.c \
task.c \
wine.c
task.c
OBJS = $(SRCS:.c=.o)
......
......@@ -21,23 +21,30 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994";
#include "dlls.h"
#include "task.h"
typedef struct {
LPSTR ModuleName;
LPSTR FileName;
WORD Count;
HANDLE hModule;
HINSTANCE hInst;
void *lpPrevModule;
void *lpNextModule;
} MODULEENTRY;
typedef MODULEENTRY *LPMODULEENTRY;
extern struct w_files *wine_files;
extern struct dll_name_table_entry_s dll_builtin_table[];
static LPMODULEENTRY lpModList = NULL;
#define IS_BUILTIN_DLL(handle) ((handle >> 8) == 0xff)
extern struct w_files * wine_files;
extern struct dll_name_table_entry_s dll_builtin_table[];
/**********************************************************************/
#define IS_BUILTIN_DLL(handle) ((handle >> 16) == 0xff)
void ExtractDLLName(char *libname, char *temp)
{
int i;
strcpy(temp, libname);
if (strchr(temp, '\\') || strchr(temp, '/'))
for (i = strlen(temp) - 1; i ; i--)
if (temp[i] == '\\' || temp[i] == '/') {
strcpy(temp, temp + i + 1);
break;
}
for (i = strlen(temp) - 1; i ; i--)
if (temp[i] == '.') {
temp[i] = 0;
break;
}
}
/**********************************************************************
* GetModuleHandle [KERNEL.47]
......@@ -46,7 +53,28 @@ HANDLE GetModuleHandle(LPSTR lpModuleName)
{
register struct w_files *w = wine_files;
int i;
printf("GetModuleHandle('%x');\n", lpModuleName);
if ((int) lpModuleName & 0xffff0000)
printf("GetModuleHandle('%s');\n", lpModuleName);
else
printf("GetModuleHandle('%x');\n", lpModuleName);
printf("GetModuleHandle // searching in builtin libraries\n");
for (i = 0; i < N_BUILTINS; i++) {
if (dll_builtin_table[i].dll_name == NULL) break;
if (((int) lpModuleName & 0xffff0000) == 0) {
if (0xFF00 + i == (int) lpModuleName) {
printf("GetModuleHandle('%s') return %04X \n",
lpModuleName, 0xff00 + i);
return 0xFF00 + i;
}
}
else if (strcasecmp(dll_builtin_table[i].dll_name, lpModuleName) == 0) {
printf("GetModuleHandle('%x') return %04X \n",
lpModuleName, 0xFF00 + i);
return (0xFF00 + i);
}
}
printf("GetModuleHandle // searching in loaded modules\n");
while (w) {
/* printf("GetModuleHandle // '%x' \n", w->name); */
......@@ -64,22 +92,6 @@ HANDLE GetModuleHandle(LPSTR lpModuleName)
}
w = w->next;
}
printf("GetModuleHandle // searching in builtin libraries\n");
for (i = 0; i < N_BUILTINS; i++) {
if (dll_builtin_table[i].dll_name == NULL) break;
if (((int) lpModuleName & 0xffff0000) == 0) {
if (0xFF00 + i == (int) lpModuleName) {
printf("GetModuleHandle('%s') return %04X \n",
lpModuleName, w->hinstance);
return 0xFF + i;
}
}
else if (strcasecmp(dll_builtin_table[i].dll_name, lpModuleName) == 0) {
printf("GetModuleHandle('%x') return %04X \n",
lpModuleName, 0xFF00 + i);
return (0xFF00 + i);
}
}
printf("GetModuleHandle('%x') not found !\n", lpModuleName);
return 0;
}
......@@ -91,7 +103,13 @@ HANDLE GetModuleHandle(LPSTR lpModuleName)
int GetModuleUsage(HANDLE hModule)
{
struct w_files *w;
printf("GetModuleUsage(%04X);\n", hModule);
/* built-in dll ? */
if (IS_BUILTIN_DLL(hModule))
return 2;
w = GetFileInfo(hModule);
/* return w->Usage; */
return 1;
......@@ -138,79 +156,15 @@ int GetModuleFileName(HANDLE hModule, LPSTR lpFileName, short nSize)
*/
HANDLE LoadLibrary(LPSTR libname)
{
HANDLE hModule;
LPMODULEENTRY lpMod = lpModList;
LPMODULEENTRY lpNewMod;
int i;
char temp[64];
printf("LoadLibrary '%s'\n", libname);
/* extract dllname */
strcpy(temp, libname);
if (strchr(temp, '\\') || strchr(temp, '/'))
for (i = strlen(temp) - 1; i ; i--)
if (temp[i] == '\\' || temp[i] == '/') {
strcpy(temp, temp + i + 1);
break;
}
for (i = strlen(temp) - 1; i ; i--)
if (temp[i] == '.') {
temp[i] = 0;
break;
}
if (FindDLLTable(temp))
{
printf("Library was a builtin - \n");
return GetModuleHandle(temp);
}
if (lpMod != NULL)
{
while (TRUE)
{
if (strcmp(libname, lpMod->FileName) == 0)
{
lpMod->Count++;
printf("LoadLibrary // already loaded hInst=%04X\n",
lpMod->hInst);
return lpMod->hInst;
}
if (lpMod->lpNextModule == NULL) break;
lpMod = lpMod->lpNextModule;
}
}
hModule = GlobalAlloc(GMEM_MOVEABLE, sizeof(MODULEENTRY));
lpNewMod = (LPMODULEENTRY) GlobalLock(hModule);
#ifdef DEBUG_LIBRARY
printf("LoadLibrary // creating new module entry %08X\n", lpNewMod);
#endif
if (lpNewMod == NULL)
return 0;
if (lpModList == NULL)
{
lpModList = lpNewMod;
lpNewMod->lpPrevModule = NULL;
}
else
{
lpMod->lpNextModule = lpNewMod;
lpNewMod->lpPrevModule = lpMod;
}
lpNewMod->lpNextModule = NULL;
lpNewMod->hModule = hModule;
lpNewMod->ModuleName = NULL;
lpNewMod->FileName = (LPSTR) malloc(strlen(libname));
if (lpNewMod->FileName != NULL)
strcpy(lpNewMod->FileName, libname);
lpNewMod->hInst = LoadImage(libname, DLL, 0);
lpNewMod->Count = 1;
printf("LoadLibrary returned Library hInst=%04X\n", lpNewMod->hInst);
GlobalUnlock(hModule);
return lpNewMod->hInst;
HANDLE h;
if ((h = LoadImage(libname, DLL, 0)) < 32)
return h;
if (!IS_BUILTIN_DLL(h))
InitDLL(GetFileInfo(h));
return h;
}
......@@ -219,14 +173,13 @@ HANDLE LoadLibrary(LPSTR libname)
*/
void FreeLibrary(HANDLE hLib)
{
LPMODULEENTRY lpMod = lpModList;
printf("FreeLibrary(%04X);\n", hLib);
/* built-in dll ? */
if (IS_BUILTIN_DLL(hLib))
return;
/*
while (lpMod != NULL) {
if (lpMod->hInst == hLib) {
if (lpMod->Count == 1) {
......@@ -243,6 +196,7 @@ void FreeLibrary(HANDLE hLib)
}
lpMod = lpMod->lpNextModule;
}
*/
}
......
static char RCSId[] = "$Id: wine.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 <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#ifdef linux
#include <linux/unistd.h>
#include <linux/head.h>
#include <linux/ldt.h>
#include <linux/segment.h>
#endif
#include "neexe.h"
#include "segmem.h"
#include "prototypes.h"
#include "dlls.h"
#include "wine.h"
#include "windows.h"
#include "wineopts.h"
#include "arch.h"
#include "options.h"
/* #define DEBUG_FIXUP */
extern HANDLE CreateNewTask(HINSTANCE hInst);
extern int CallToInit16(unsigned long csip, unsigned long sssp,
unsigned short ds);
extern void CallTo32();
char *GetDosFileName(char *unixfilename);
char *GetModuleName(struct w_files * wpnt, int index, char *buffer);
extern unsigned char ran_out;
extern char WindowsPath[256];
char *WIN_ProgramName;
unsigned short WIN_StackSize;
unsigned short WIN_HeapSize;
struct w_files * wine_files = NULL;
char **Argv;
int Argc;
HINSTANCE hSysRes;
static char *DLL_Extensions[] = { "dll", NULL };
static char *EXE_Extensions[] = { "exe", NULL };
/**********************************************************************
* myerror
*/
void
myerror(const char *s)
{
if (s == NULL)
perror("wine");
else
fprintf(stderr, "wine: %s\n", s);
exit(1);
}
/**********************************************************************
* GetFilenameFromInstance
*/
char *
GetFilenameFromInstance(unsigned short instance)
{
register struct w_files *w = wine_files;
while (w && w->hinstance != instance)
w = w->next;
if (w)
return w->filename;
else
return NULL;
}
struct w_files *
GetFileInfo(unsigned short instance)
{
register struct w_files *w = wine_files;
while (w && w->hinstance != instance)
w = w->next;
return w;
}
/**********************************************************************
*
* Load MZ Header
*/
void load_mz_header(int fd, struct mz_header_s *mz_header)
{
if (read(fd, mz_header, sizeof(struct mz_header_s)) !=
sizeof(struct mz_header_s))
{
myerror("Unable to read MZ header from file");
}
}
int IsDLLLoaded(char *name)
{
struct w_files *wpnt;
if(FindDLLTable(name))
return 1;
for(wpnt = wine_files; wpnt; wpnt = wpnt->next)
if(strcmp(wpnt->name, name) == 0)
return 1;
return 0;
}
/**********************************************************************
* LoadImage
* Load one executable into memory
*/
HINSTANCE LoadImage(char *module, int filetype, int change_dir)
{
unsigned int read_size;
int i;
struct w_files * wpnt, *wpnt1;
unsigned int status;
char buffer[256], header[2], modulename[64], *fullname;
ExtractDLLName(module, modulename);
/* built-in one ? */
if (FindDLLTable(modulename)) {
return GetModuleHandle(modulename);
}
/* already loaded ? */
for (wpnt = wine_files ; wpnt ; wpnt = wpnt->next)
if (strcasecmp(wpnt->name, modulename) == 0)
return wpnt->hinstance;
/*
* search file
*/
fullname = FindFile(buffer, sizeof(buffer), module,
(filetype == EXE ? EXE_Extensions : DLL_Extensions),
WindowsPath);
if (fullname == NULL)
{
fprintf(stderr, "LoadImage: I can't find %s.dll | %s.exe !\n",
module, module);
return 2;
}
fullname = GetDosFileName(fullname);
WIN_ProgramName = strdup(fullname);
fprintf(stderr,"LoadImage: loading %s (%s)\n [%s]\n",
module, buffer, WIN_ProgramName);
if (change_dir && fullname)
{
char dirname[256];
char *p;
strcpy(dirname, fullname);
p = strrchr(dirname, '\\');
*p = '\0';
DOS_SetDefaultDrive(dirname[0] - 'A');
DOS_ChangeDir(dirname[0] - 'A', dirname + 2);
}
/* First allocate a spot to store the info we collect, and add it to
* our linked list.
*/
wpnt = (struct w_files *) malloc(sizeof(struct w_files));
if(wine_files == NULL)
wine_files = wpnt;
else {
wpnt1 = wine_files;
while(wpnt1->next) wpnt1 = wpnt1->next;
wpnt1->next = wpnt;
};
wpnt->next = NULL;
wpnt->resnamtab = (RESNAMTAB *) -1;
/*
* Open file for reading.
*/
wpnt->fd = open(buffer, O_RDONLY);
if (wpnt->fd < 0)
return 2;
/*
* Establish header pointers.
*/
wpnt->filename = strdup(buffer);
wpnt->name = strdup(modulename);
/* if(module) {
wpnt->name = strdup(module);
ToDos(wpnt->name);
}*/
/* read mz header */
wpnt->mz_header = (struct mz_header_s *) malloc(sizeof(struct mz_header_s));;
status = lseek(wpnt->fd, 0, SEEK_SET);
load_mz_header (wpnt->fd, wpnt->mz_header);
if (wpnt->mz_header->must_be_0x40 != 0x40)
myerror("This is not a Windows program");
/* read first two bytes to determine filetype */
status = lseek(wpnt->fd, wpnt->mz_header->ne_offset, SEEK_SET);
read(wpnt->fd, &header, sizeof(header));
if (header[0] == 'N' && header[1] == 'E')
return (LoadNEImage(wpnt));
if (header[0] == 'P' && header[1] == 'E') {
printf("win32 applications are not supported");
return 14;
}
fprintf(stderr, "wine: (%s) unknown fileformat !\n", wpnt->filename);
return 14;
}
#ifndef WINELIB
/**********************************************************************
* main
*/
int _WinMain(int argc, char **argv)
{
int segment;
char *p;
char *sysresname;
char filename[256];
HANDLE hTaskMain;
HINSTANCE hInstMain;
#ifdef WINESTAT
char * cp;
#endif
struct w_files * wpnt;
int cs_reg, ds_reg, ss_reg, ip_reg, sp_reg;
int rv;
Argc = argc - 1;
Argv = argv + 1;
if (strchr(Argv[0], '\\') || strchr(Argv[0],'/')) {
for (p = Argv[0] + strlen(Argv[0]); *p != '\\' && *p !='/'; p--)
/* NOTHING */;
strncpy(filename, Argv[0], p - Argv[0]);
filename[p - Argv[0]] = '\0';
strcat(WindowsPath, ";");
strcat(WindowsPath, filename);
}
if ((hInstMain = LoadImage(Argv[0], EXE, 1)) < 32) {
fprintf(stderr, "wine: can't load %s!.\n", Argv[0]);
exit(1);
}
hTaskMain = CreateNewTask(hInstMain);
printf("_WinMain // hTaskMain=%04X hInstMain=%04X !\n", hTaskMain, hInstMain);
GetPrivateProfileString("wine", "SystemResources", "sysres.dll",
filename, sizeof(filename), WINE_INI);
hSysRes = LoadImage(filename, DLL, 0);
if (hSysRes < 32) {
fprintf(stderr, "wine: can't load %s!.\n", filename);
exit(1);
} else
printf("System Resources Loaded // hSysRes='%04X'\n", hSysRes);
/*
* Fixup references.
*/
/* wpnt = wine_files;
for(wpnt = wine_files; wpnt; wpnt = wpnt->next)
for (segment = 0; segment < wpnt->ne_header->n_segment_tab; segment++)
if (FixupSegment(wpnt, segment) < 0)
myerror("fixup failed.");
*/
#ifdef WINESTAT
cp = strrchr(argv[0], '/');
if(!cp) cp = argv[0];
else cp++;
if(strcmp(cp,"winestat") == 0) {
winestat();
exit(0);
};
#endif
/*
* Initialize signal handling.
*/
init_wine_signals();
/*
* Fixup stack and jump to start.
*/
WIN_StackSize = wine_files->ne_header->stack_length;
WIN_HeapSize = wine_files->ne_header->local_heap_length;
ds_reg = (wine_files->
selector_table[wine_files->ne_header->auto_data_seg-1].selector);
cs_reg = wine_files->selector_table[wine_files->ne_header->cs-1].selector;
ip_reg = wine_files->ne_header->ip;
ss_reg = wine_files->selector_table[wine_files->ne_header->ss-1].selector;
sp_reg = wine_files->ne_header->sp;
if (Options.debug) wine_debug(0, NULL);
rv = CallToInit16(cs_reg << 16 | ip_reg, ss_reg << 16 | sp_reg, ds_reg);
printf ("rv = %x\n", rv);
}
void InitDLL(struct w_files *wpnt)
{
int cs_reg, ds_reg, ip_reg, rv;
/*
* Is this a library?
*/
if (wpnt->ne_header->format_flags & 0x8000)
{
if (!(wpnt->ne_header->format_flags & 0x0001))
{
/* Not SINGLEDATA */
fprintf(stderr, "Library is not marked SINGLEDATA\n");
exit(1);
}
ds_reg = wpnt->selector_table[wpnt->
ne_header->auto_data_seg-1].selector;
cs_reg = wpnt->selector_table[wpnt->ne_header->cs-1].selector;
ip_reg = wpnt->ne_header->ip;
if (cs_reg) {
fprintf(stderr, "Initializing %s, cs:ip %04x:%04x, ds %04x\n",
wpnt->name, cs_reg, ip_reg, ds_reg);
rv = CallTo16(cs_reg << 16 | ip_reg, ds_reg);
printf ("rv = %x\n", rv);
} else
printf("%s skipped\n");
}
}
void InitializeLoadedDLLs(struct w_files *wpnt)
{
static flagReadyToRun = 0;
struct w_files *final_wpnt;
struct w_files * wpnt;
if (wpnt == NULL)
{
flagReadyToRun = 1;
fprintf(stderr, "Initializing DLLs\n");
}
if (!flagReadyToRun)
return;
#if 1
if (wpnt != NULL)
fprintf(stderr, "Initializing %s\n", wpnt->name);
#endif
/*
* Initialize libraries
*/
if (!wpnt)
{
wpnt = wine_files;
final_wpnt = NULL;
}
else
{
final_wpnt = wpnt->next;
}
for( ; wpnt != final_wpnt; wpnt = wpnt->next)
InitDLL(wpnt);
}
#endif
......@@ -16,6 +16,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "wine.h"
#include "icon.h"
#include "accel.h"
#include "dlls.h"
/* #define DEBUG_RESOURCE */
......@@ -922,14 +923,14 @@ RSC_LoadResource(int instance, char *rsc_name, int type, int *image_size_ret)
if (image_size_ret != NULL)
*image_size_ret = image_size;
hmem = GlobalAlloc(GMEM_MOVEABLE, image_size);
image = GlobalLock(hmem);
image = GlobalLinearLock(hmem);
if (image == NULL || read(ResourceFd, image, image_size) != image_size)
{
GlobalFree(hmem);
return 0;
}
GlobalUnlock(hmem);
GlobalLinearUnlock(hmem);
return hmem;
}
......@@ -1021,7 +1022,7 @@ LoadBitmap(HANDLE instance, LPSTR bmp_name)
printf("LoadBitmap / BitMap %04X not Found !\n", bmp_name);
return 0;
}
lp = (long *) GlobalLock(rsc_mem);
lp = (long *) GlobalLinearLock(rsc_mem);
if (lp == NULL)
{
GlobalFree(rsc_mem);
......
......@@ -22,14 +22,14 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <sys/mman.h>
#include <machine/segments.h>
#endif
#include "dlls.h"
#include "neexe.h"
#include "segmem.h"
#include "wine.h"
#include "windows.h"
#include "prototypes.h"
/* #define DEBUG_SELECTORS */
/* #define DEBUG_SELECTORS /* */
#ifdef linux
#define DEV_ZERO
......@@ -579,7 +579,7 @@ unsigned int GetEntryDLLName(char * dll_name, char * function, int * sel,
/* We need a means of determining the ordinal for the function. */
/* Not a builtin symbol, look to see what the file has for us */
for(wpnt = wine_files; wpnt; wpnt = wpnt->next){
if(strcmp(wpnt->name, dll_name)) continue;
if(strcasecmp(wpnt->name, dll_name)) continue;
cpnt = wpnt->nrname_table;
while(1==1){
if( ((int) cpnt) - ((int)wpnt->nrname_table) >
......@@ -618,7 +618,7 @@ unsigned int GetEntryDLLOrdinal(char * dll_name, int ordinal, int * sel,
/* Not a builtin symbol, look to see what the file has for us */
for(wpnt = wine_files; wpnt; wpnt = wpnt->next){
if(strcmp(wpnt->name, dll_name)) continue;
if(strcasecmp(wpnt->name, dll_name)) continue;
j = GetEntryPointFromOrdinal(wpnt, ordinal);
*addr = j & 0xffff;
j = j >> 16;
......@@ -699,6 +699,73 @@ GetEntryPointFromOrdinal(struct w_files * wpnt, int ordinal)
}
/**********************************************************************
*/
void
FixupFunctionPrologs(struct w_files * wpnt)
{
struct mz_header_s *mz_header = wpnt->mz_header;
struct ne_header_s *ne_header = wpnt->ne_header;
union lookup entry_tab_pointer;
struct entry_tab_header_s *eth;
struct entry_tab_movable_s *etm;
struct entry_tab_fixed_s *etf;
unsigned char *fixup_ptr;
int i;
if (!(ne_header->format_flags & 0x0001))
return;
entry_tab_pointer.cpnt = wpnt->lookup_table;
/*
* Let's walk through the table and fixup prologs as we go.
*/
while (1)
{
/* Get bundle header */
eth = entry_tab_pointer.eth++;
/* Check for end of table */
if (eth->n_entries == 0)
return;
/* Check for empty bundle */
if (eth->seg_number == 0)
continue;
/* Examine each bundle */
for (i = 0; i < eth->n_entries; i++)
{
/* Moveable segment */
if (eth->seg_number >= 0xfe)
{
etm = entry_tab_pointer.etm++;
fixup_ptr = (wpnt->selector_table[etm->seg_number-1].base_addr
+ etm->offset);
}
else
{
etf = entry_tab_pointer.etf++;
fixup_ptr = (wpnt->selector_table[eth->seg_number-1].base_addr
+ (int) etf->offset[0]
+ ((int) etf->offset[1] << 8));
}
/* Verify the signature */
if (((fixup_ptr[0] == 0x1e && fixup_ptr[1] == 0x58)
|| (fixup_ptr[0] == 0x8c && fixup_ptr[1] == 0xd8))
&& fixup_ptr[2] == 0x90)
{
fixup_ptr[0] = 0xb8; /* MOV AX, */
fixup_ptr[1] = wpnt->hinstance;
fixup_ptr[2] = (wpnt->hinstance >> 8);
}
}
}
}
/**********************************************************************
* GetDOSEnvironment
*/
LPSTR GetDOSEnvironment(void)
......@@ -897,10 +964,21 @@ CreateSelectors(struct w_files * wpnt)
read_only = 1;
}
#if 0
stmp = CreateNewSegments(!(s->flags & NE_SEGFLAGS_DATA), read_only,
s->length, 1);
s->base_addr = stmp->base_addr;
s->selector = stmp->selector;
#endif
s->selector = GlobalAlloc(GMEM_FIXED, s->length);
if (s->selector == 0)
myerror("CreateSelectors: GlobalAlloc() failed");
s->base_addr = (void *) ((LONG) s->selector << 16);
if (!(s->flags & NE_SEGFLAGS_DATA))
PrestoChangoSelector(s->selector, s->selector);
else
memset(s->base_addr, 0, s->length);
if (seg_table[i].seg_data_offset != 0)
{
......@@ -942,4 +1020,41 @@ CreateSelectors(struct w_files * wpnt)
return selectors;
}
/***********************************************************************
* GetSelectorBase (KERNEL.186)
*/
DWORD GetSelectorBase(WORD wSelector)
{
fprintf(stderr, "GetSelectorBase(selector %4X) stub!\n", wSelector);
}
/***********************************************************************
* SetSelectorBase (KERNEL.187)
*/
void SetSelectorBase(WORD wSelector, DWORD dwBase)
{
fprintf(stderr, "SetSelectorBase(selector %4X, base %8X) stub!\n",
wSelector, dwBase);
}
/***********************************************************************
* GetSelectorLimit (KERNEL.188)
*/
DWORD GetSelectorLimit(WORD wSelector)
{
fprintf(stderr, "GetSelectorLimit(selector %4X) stub!\n", wSelector);
return 0xffff;
}
/***********************************************************************
* SetSelectorLimit (KERNEL.189)
*/
void SetSelectorLimit(WORD wSelector, DWORD dwLimit)
{
fprintf(stderr, "SetSelectorLimit(selector %4X, base %8X) stub!\n",
wSelector, dwLimit);
}
#endif /* ifndef WINELIB */
......@@ -42,6 +42,39 @@ wine_sigaction(int sig,struct sigaction * new, struct sigaction * old)
return -1;
}
int do_int(int intnum, struct sigcontext_struct *scp)
{
switch(intnum)
{
case 0x10: return do_int10(scp);
case 0x11:
scp->sc_eax = (scp->sc_eax & 0xffff0000L) | DOS_GetEquipment();
return 1;
case 0x12:
scp->sc_eax = (scp->sc_eax & 0xffff0000L) | 640L;
return 1; /* get base mem size */
case 0x15: return do_int15(scp);
case 0x1A: return do_int1A(scp);
case 0x21: return do_int21(scp);
case 0x22:
scp->sc_eax = 0x1234;
scp->sc_ebx = 0x5678;
scp->sc_ecx = 0x9abc;
scp->sc_edx = 0xdef0;
return 1;
case 0x25: return do_int25(scp);
case 0x26: return do_int26(scp);
case 0x2f: return do_int2f(scp);
case 0x31: return do_int31(scp);
}
return 0;
}
#ifdef linux
static void win_fault(int signal, struct sigcontext_struct context)
{
......@@ -90,54 +123,7 @@ static void win_fault(int signal, int code, struct sigcontext *scp)
{
case 0xcd: /* int <XX> */
instr++;
switch(*instr)
{
case 0x10:
if(!do_int10(scp))
goto oops;
break;
case 0x11:
scp->sc_eax = (scp->sc_eax & 0xffff0000L) | DOS_GetEquipment();
break;
case 0x12:
scp->sc_eax = (scp->sc_eax & 0xffff0000L) | 640L;
break; /* get base mem size */
case 0x1A:
if(!do_int1A(scp))
goto oops;
break;
case 0x21:
if (!do_int21(scp))
goto oops;
break;
case 0x22:
scp->sc_eax = 0x1234;
scp->sc_ebx = 0x5678;
scp->sc_ecx = 0x9abc;
scp->sc_edx = 0xdef0;
break;
case 0x25:
if (!do_int25(scp))
goto oops;
break;
case 0x26:
if (!do_int26(scp))
goto oops;
break;
case 0x2f:
if (!do_int2f(scp))
goto oops;
break;
default:
if (!do_int(*instr, scp)) {
fprintf(stderr,"Unexpected Windows interrupt %x\n", *instr);
goto oops;
}
......
......@@ -187,7 +187,7 @@ GlobalAlloc(unsigned int flags, unsigned long size)
*/
if (size > 0x8000 || !(flags & GLOBAL_FLAGS_MOVEABLE))
{
int segments = (size >> 16) + 1;
int segments = ((size - 1) >> 16) + 1;
g = GlobalGetFreeSegments(flags, segments);
if (g == NULL)
......@@ -666,14 +666,25 @@ GlobalReAlloc(unsigned int block, unsigned int new_size, unsigned int flags)
else if (n_segments < g->length)
{
GDESC *g_free;
int old_length = g->length;
g_free = g;
for (i = 0; i < n_segments; i++)
{
if (g_free->sequence != i + 1)
return 0;
g_free->length = n_segments;
g_free = g_free->next;
}
for ( ; i < old_length; i++)
{
g_free->length = 0x10000;
g_free->sequence = -1;
g_free = g_free->next;
}
return g->handle;
}
/*
......
......@@ -13,6 +13,16 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
LHEAP *LocalHeaps = NULL;
void
HEAP_CheckHeap(MDESC **free_list)
{
MDESC *m;
for (m = *free_list; m != NULL; m = m->next)
if (((int) m & 0xffff0000) != ((int) *free_list & 0xffff0000))
*(char *)0 = 0;
}
/**********************************************************************
* HEAP_Init
*/
......@@ -23,8 +33,8 @@ HEAP_Init(MDESC **free_list, void *start, int length)
return;
*free_list = (MDESC *) start;
(*free_list)->prev = NULL;
(*free_list)->next = NULL;
(*free_list)->prev = NULL;
(*free_list)->next = NULL;
(*free_list)->length = length - sizeof(MDESC);
}
......@@ -39,6 +49,7 @@ HEAP_Alloc(MDESC **free_list, int flags, int bytes)
#ifdef DEBUG_HEAP
printf("HeapAlloc: free_list %08x, flags %x, bytes %d\n",
free_list, flags, bytes);
HEAP_CheckHeap(free_list);
#endif
/*
......@@ -74,6 +85,7 @@ HEAP_Alloc(MDESC **free_list, int flags, int bytes)
memset(m + 1, 0, bytes);
#ifdef DEBUG_HEAP
printf("HeapAlloc: returning %08x\n", (m + 1));
HEAP_CheckHeap(free_list);
#endif
return (void *) (m + 1);
}
......@@ -97,12 +109,14 @@ HEAP_Alloc(MDESC **free_list, int flags, int bytes)
memset(m + 1, 0, bytes);
#ifdef DEBUG_HEAP
printf("HeapAlloc: returning %08x\n", (m + 1));
HEAP_CheckHeap(free_list);
#endif
return (void *) (m + 1);
}
#ifdef DEBUG_HEAP
printf("HeapAlloc: returning %08x\n", 0);
HEAP_CheckHeap(free_list);
#endif
return 0;
}
......@@ -133,6 +147,7 @@ HEAP_ReAlloc(MDESC **free_list, void *old_block,
printf("HEAP_ReAlloc m->prev=%08X !\n", m->prev);
printf("HEAP_ReAlloc m->next=%08X !\n", m->next);
printf("HEAP_ReAlloc *free_list=%08X !\n", *free_list);
HEAP_CheckHeap(free_list);
#endif
if (m->prev != m || m->next != m ||
......@@ -141,6 +156,7 @@ HEAP_ReAlloc(MDESC **free_list, void *old_block,
#ifdef DEBUG_HEAP
printf("Attempt to resize bad pointer, m = %08x, *free_list = %08x\n",
m, free_list);
HEAP_CheckHeap(free_list);
#endif
return NULL;
}
......@@ -164,6 +180,9 @@ HEAP_ReAlloc(MDESC **free_list, void *old_block,
return NULL;
memcpy(new_p, old_block, m->length);
HEAP_Free(free_list, old_block);
#ifdef DEBUG_HEAP
HEAP_CheckHeap(free_list);
#endif
return new_p;
}
......@@ -199,6 +218,9 @@ HEAP_ReAlloc(MDESC **free_list, void *old_block,
HEAP_Free(free_list, m_free + 1);
}
#ifdef DEBUG_HEAP
HEAP_CheckHeap(free_list);
#endif
return old_block;
}
......@@ -213,6 +235,12 @@ HEAP_Free(MDESC **free_list, void *block)
MDESC *m;
MDESC *m_prev;
#ifdef DEBUG_HEAP
printf("HeapFree: free_list %08x, block %08x\n",
free_list, block);
HEAP_CheckHeap(free_list);
#endif
/*
* Validate pointer.
*/
......@@ -300,6 +328,9 @@ HEAP_Free(MDESC **free_list, void *block)
m_free->next = NULL;
}
#ifdef DEBUG_HEAP
HEAP_CheckHeap(free_list);
#endif
return 0;
}
......@@ -347,6 +378,7 @@ HEAP_LocalInit(unsigned short owner, void *start, int length)
lh->next = LocalHeaps;
lh->selector = owner;
lh->local_table = NULL;
lh->delta = 0x20;
HEAP_Init(&lh->free_list, start, length);
LocalHeaps = lh;
}
......@@ -521,6 +553,24 @@ WIN16_LocalUnlock(unsigned int handle)
}
/**********************************************************************
* WIN16_LocalHandleDelta
*/
unsigned int
WIN16_LocalHandleDelta(unsigned int new_delta)
{
LHEAP *lh;
lh = HEAP_LocalFindHeap(HEAP_OWNER);
if (lh == NULL)
return 0;
if (new_delta)
lh->delta = new_delta;
return lh->delta;
}
/**********************************************************************
* GetFreeSystemResources (user.284)
*/
......
......@@ -11,6 +11,7 @@ SRCS = \
dos_fs.c \
driver.c \
exec.c \
escape.c \
file.c \
keyboard.c \
lstr.c \
......
......@@ -15,9 +15,9 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994";
/**************************************************************************
* DriverProc [sample driver]
* AUDIO_DriverProc [sample driver]
*/
LRESULT DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
LRESULT AUDIO_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
DWORD dwParam1, DWORD dwParam2)
{
switch(wMsg) {
......
......@@ -127,6 +127,13 @@ HCURSOR LoadCursor(HANDLE instance, LPSTR cursor_name)
break;
}
}
#if 1
lpcur->xcursor = XCreateFontCursor(XT_display, XC_top_left_arrow);
GlobalUnlock(hCursor);
return hCursor;
#endif
if (!(hdc = GetDC(GetDesktopWindow()))) return 0;
rsc_mem = RSC_LoadResource(instance, cursor_name, NE_RSCTYPE_GROUP_CURSOR,
&image_size);
......
......@@ -128,17 +128,13 @@ void DOS_InitFS(void)
continue;
}
ExpandTildeString(temp);
if ((ptr = (char *) malloc(strlen(temp)+1)) == NULL) {
fprintf(stderr,"DOSFS: can't malloc for drive info!");
continue;
}
ChopOffSlash(temp);
DosDrives[x].rootdir = ptr;
strcpy(DosDrives[x].rootdir, temp);
strcpy(DosDrives[x].cwd, "/windows/");
strcpy(DosDrives[x].label, "DRIVE-");
strcat(DosDrives[x].label, drive);
DosDrives[x].disabled = 0;
ChopOffSlash(temp);
DosDrives[x].rootdir = strdup(temp);
strcpy(DosDrives[x].rootdir, temp);
strcpy(DosDrives[x].cwd, "/windows/");
strcpy(DosDrives[x].label, "DRIVE-");
strcat(DosDrives[x].label, drive);
DosDrives[x].disabled = 0;
}
DOS_SetDefaultDrive(2);
......@@ -393,19 +389,22 @@ char *GetUnixFileName(char *dosfilename)
char *GetDosFileName(char *unixfilename)
{
int i;
static char temp[256];
static char temp[256], rootdir[256];
/* /dos/windows/system.ini => c:\windows\system.ini */
for (i = 0 ; i != MAX_DOS_DRIVES; i++) {
if (DosDrives[i].rootdir != NULL) {
if (strncmp(DosDrives[i].rootdir, unixfilename, strlen(DosDrives[i].rootdir)) == 0) {
sprintf(temp, "%c:\\%s", 'A' + i, unixfilename + strlen(DosDrives[i].rootdir) + 1);
ToDos(temp);
return temp;
}
strcpy(rootdir, DosDrives[i].rootdir);
strcat(rootdir, "/");
ToUnix(rootdir);
if (strncmp(rootdir, unixfilename, strlen(rootdir)) == 0) {
sprintf(temp, "%c:\\%s", 'A' + i, unixfilename + strlen(rootdir));
ToDos(temp);
return temp;
}
}
}
strcpy(temp, unixfilename);
sprintf(temp, "UNIX:%s", unixfilename);
ToDos(temp);
return(temp);
}
......@@ -534,7 +533,11 @@ char *FindFile(char *buffer, int buflen, char *filename, char **extensions,
{
strncpy(buffer, GetUnixFileName(filename), buflen);
ToUnix(buffer);
return buffer;
stat( buffer, &filestat);
if (S_ISREG(filestat.st_mode))
return buffer;
else
return NULL;
}
if (strchr(filename, '/') != NULL)
......
......@@ -6,10 +6,11 @@
static char Copyright[] = "Copyright Martin Ayotte, 1994";
#include "stdio.h"
#include <stdio.h>
#include "windows.h"
#include "win.h"
#include "user.h"
#include "dlls.h"
#include "driver.h"
LPDRIVERITEM lpDrvItemList = NULL;
......@@ -47,7 +48,7 @@ HDRVR OpenDriver(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
lpnewdrv = (LPDRIVERITEM) GlobalLock(hDrvr);
if (lpnewdrv == NULL) return 0;
lpnewdrv->dis.length = sizeof(DRIVERINFOSTRUCT);
lpnewdrv->dis.hModule = LoadImage("DrvName", DLL);
lpnewdrv->dis.hModule = LoadImage("DrvName", DLL, 0);
if (lpnewdrv->dis.hModule == 0) {
GlobalUnlock(hDrvr);
GlobalFree(hDrvr);
......
/*
* Escape() function.
*
* Copyright 1994 Bob Amstadt
*/
static char Copyright[] = "Copyright Bob Amstadt, 1994";
#include <stdlib.h>
#include <stdio.h>
#include "windows.h"
int Escape(HDC hdc, int nEscape, int cbInput,
LPSTR lpszInData, LPSTR lpvOutData)
{
fprintf(stderr, "Escape(nEscape = %04x)\n", nEscape);
return 0;
}
......@@ -342,6 +342,7 @@ int main( int argc, char *argv[] )
MAIN_SaveSetup();
DOS_InitFS();
Comm_Init();
INT21_Init();
#ifndef sunos
atexit(called_at_exit);
......@@ -557,3 +558,13 @@ BOOL SwapMouseButton(BOOL fSwap)
return 0; /* don't swap */
}
/***********************************************************************
* ISROMMODULE (KERNEL.323)
*/
BOOL IsRomModule(HANDLE x)
{
/* I don't know the prototype, I assume that it returns true
if the dll is located in rom */
return FALSE;
}
......@@ -270,14 +270,21 @@ LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam)
lpmb->rectStr.left += 64;
}
break;
case WM_SHOWWINDOW:
if (!(wParam == 0 && lParam == 0L)) {
InvalidateRect(hWnd, NULL, TRUE);
}
break;
case WM_PAINT:
#ifdef DEBUG_MSGBOX
printf("MessageBox WM_PAINT !\n");
printf("MessageBox WM_PAINT hWnd=%04X !\n", hWnd);
#endif
lpmb = MsgBoxGetStorageHeader(hWnd);
if (lpmb == NULL) break;
CopyRect(&rect, &lpmb->rectStr);
hDC = BeginPaint(hWnd, &ps);
GetClientRect(hWnd, &rect);
FillRect(hDC, &rect, GetStockObject(WHITE_BRUSH));
CopyRect(&rect, &lpmb->rectStr);
OldTextColor = SetTextColor(hDC, 0x00000000);
if (lpmb->hIcon)
DrawIcon(hDC, lpmb->rectIcon.left,
......
......@@ -8,6 +8,7 @@ static char Copyright[] = "Copyright Martin Ayotte, 1993";
#include "stdio.h"
#include "win.h"
#include "driver.h"
#include "mmsystem.h"
static WORD mciActiveDev = 0;
......@@ -17,7 +18,10 @@ UINT WINAPI midiGetErrorText(UINT uError, LPSTR lpText, UINT uSize);
UINT WINAPI waveGetErrorText(UINT uError, LPSTR lpText, UINT uSize);
int MCI_LibMain(HANDLE hInstance, WORD wDataSeg,
/**************************************************************************
* MMSYSTEM_WEP [MMSYSTEM.1]
*/
int MMSYSTEM_WEP(HANDLE hInstance, WORD wDataSeg,
WORD cbHeapSize, LPSTR lpCmdLine)
{
printf("MMSYSTEM DLL INIT ... hInst=%04X \n", hInstance);
......@@ -29,7 +33,7 @@ int MCI_LibMain(HANDLE hInstance, WORD wDataSeg,
*/
BOOL WINAPI sndPlaySound(LPCSTR lpszSoundName, UINT uFlags)
{
printf("sndPlaySound // lpszSoundName='%s' uFlags=%04X !\n",
printf("EMPTY STUB !!! sndPlaySound // SoundName='%s' uFlags=%04X !\n",
lpszSoundName, uFlags);
return 0;
}
......@@ -44,14 +48,107 @@ WORD WINAPI mmsystemGetVersion()
}
/**************************************************************************
* DriverProc [MMSYSTEM.6]
*/
LRESULT DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
DWORD dwParam1, DWORD dwParam2)
{
return DrvDefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
}
/**************************************************************************
* OutputDebugStr [MMSYSTEM.30]
*/
void WINAPI OutputDebugStr(LPCSTR str)
{
printf("OutputDebugStr('%s');\n", str);
printf("EMPTY STUB !!! OutputDebugStr('%s');\n", str);
}
/**************************************************************************
* DriverCallback [MMSYSTEM.31]
*/
BOOL DriverCallback(DWORD dwCallBack, UINT uFlags, HANDLE hDev,
WORD wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2)
{
printf("EMPTY STUB !!! DriverCallback() !\n");
}
/**************************************************************************
* JoyGetNumDevs [MMSYSTEM.101]
*/
WORD JoyGetNumDevs()
{
printf("EMPTY STUB !!! JoyGetNumDevs();\n");
return 0;
}
/**************************************************************************
* JoyGetDevCaps [MMSYSTEM.102]
*/
WORD JoyGetDevCaps(WORD wID, LPJOYCAPS lpCaps, WORD wSize)
{
printf("EMPTY STUB !!! JoyGetDevCaps(%04X, %08X, %d);\n",
wID, lpCaps, wSize);
return MMSYSERR_NODRIVER;
}
/**************************************************************************
* JoyGetPos [MMSYSTEM.103]
*/
WORD JoyGetPos(WORD wID, LPJOYINFO lpInfo)
{
printf("EMPTY STUB !!! JoyGetPos(%04X, %08X);\n", wID, lpInfo);
return MMSYSERR_NODRIVER;
}
/**************************************************************************
* JoyGetThreshold [MMSYSTEM.104]
*/
WORD JoyGetThreshold(WORD wID, LPWORD lpThreshold)
{
printf("EMPTY STUB !!! JoyGetThreshold(%04X, %08X);\n", wID, lpThreshold);
return MMSYSERR_NODRIVER;
}
/**************************************************************************
* JoyReleaseCapture [MMSYSTEM.105]
*/
WORD JoyReleaseCapture(WORD wID)
{
printf("EMPTY STUB !!! JoyReleaseCapture(%04X);\n", wID);
return MMSYSERR_NODRIVER;
}
/**************************************************************************
* JoySetCapture [MMSYSTEM.106]
*/
WORD JoySetCapture(HWND hWnd, WORD wID, WORD wPeriod, BOOL bChanged)
{
printf("EMPTY STUB !!! JoySetCapture(%04X, %04X, %d, %d);\n",
hWnd, wID, wPeriod, bChanged);
return MMSYSERR_NODRIVER;
}
/**************************************************************************
* JoySetThreshold [MMSYSTEM.107]
*/
WORD JoySetThreshold(WORD wID, WORD wThreshold)
{
printf("EMPTY STUB !!! JoySetThreshold(%04X, %d);\n", wID, wThreshold);
return MMSYSERR_NODRIVER;
}
/**************************************************************************
* JoySetCalibration [MMSYSTEM.109]
*/
WORD JoySetCalibration(WORD wID)
{
printf("EMPTY STUB !!! JoySetCalibration(%04X);\n", wID);
return MMSYSERR_NODRIVER;
}
/**************************************************************************
* auxGetNumDevs [MMSYSTEM.350]
*/
UINT WINAPI auxGetNumDevs()
......@@ -1511,6 +1608,17 @@ UINT WINAPI mmioCreateChunk(HMMIO hmmio, MMCKINFO FAR* lpck, UINT uFlags)
/**************************************************************************
* mmioRename [MMSYSTEM.1226]
*/
UINT WINAPI mmioRename(LPCSTR szFileName, LPCSTR szNewFileName,
MMIOINFO FAR* lpmmioinfo, DWORD dwRenameFlags)
{
printf("mmioRename('%s', '%s', %08X, %08X);\n",
szFileName, szNewFileName, lpmmioinfo, dwRenameFlags);
return 0;
}
/**************************************************************************
* DrvOpen [MMSYSTEM.1100]
*/
HDRVR DrvOpen(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
......
......@@ -62,7 +62,7 @@ HANDLE RemoveProp(HWND hWnd, LPSTR lpStr)
((LPPROPENTRY)lpProp->lpNextProp)->lpPrevProp =
lpProp->lpPrevProp;
if (lpProp->PropName != NULL) free(lpProp->PropName);
free(lpProp);
GlobalFree(lpProp);
GlobalUnlock(wndPtr->hProp);
return hOldData;
}
......
......@@ -14,7 +14,6 @@
LPKEYSTRUCT lphRootKey = NULL;
typedef FAR LONG *LPWORD;
DECLARE_HANDLE(HDROP);
extern HINSTANCE hSysRes;
......
......@@ -80,11 +80,9 @@ USER_InitApp(int hInstance)
/* Create desktop window */
if (!WIN_CreateDesktopWindow()) return 0;
#if 1
#ifndef WINELIB
/* Initialize DLLs */
InitializeLoadedDLLs();
#endif
InitializeLoadedDLLs(NULL);
#endif
return 1;
......
......@@ -5,11 +5,13 @@ MODULE = miscemu
SRCS = \
emulate.c \
int10.c \
int15.c \
int1a.c \
int21.c \
int25.c \
int26.c \
int2f.c \
int31.c \
ioports.c \
kernel.c
......
......@@ -3,12 +3,12 @@
#include "msdos.h"
#include "wine.h"
static void Barf(struct sigcontext_struct *context)
void IntBarf(int i, struct sigcontext_struct *context)
{
fprintf(stderr, "int10: unknown/not implemented parameters:\n");
fprintf(stderr, "int10: AX %04x, BX %04x, CX %04x, DX %04x, "
fprintf(stderr, "int%x: unknown/not implemented parameters:\n", i);
fprintf(stderr, "int%x: AX %04x, BX %04x, CX %04x, DX %04x, "
"SI %04x, DI %04x, DS %04x, ES %04x\n",
AX, BX, CX, DX, SI, DI, DS, ES);
i, AX, BX, CX, DX, SI, DI, DS, ES);
}
int do_int10(struct sigcontext_struct *context)
......@@ -31,7 +31,7 @@ int do_int10(struct sigcontext_struct *context)
break;
default:
Barf(context);
IntBarf(0x10, context);
};
return 1;
}
#include <stdio.h>
#include <stdlib.h>
#include "msdos.h"
#include "wine.h"
int do_int15(struct sigcontext_struct *context)
{
switch((context->sc_eax >> 8) & 0xff)
{
case 0xc0:
default:
IntBarf(0x15, context);
};
return 1;
}
......@@ -53,7 +53,7 @@ int do_int1A(struct sigcontext_struct * context){
break;
default:
fprintf(stderr,"Unable to handle int 0x1A AX %04x\n", context->sc_eax & 0xffffL);
IntBarf(0x1a, context);
return 1;
};
return 1;
......
......@@ -3,14 +3,6 @@
#include "msdos.h"
#include "wine.h"
static void Barf(struct sigcontext_struct *context)
{
fprintf(stderr, "int2f: unknown/not implemented parameters:\n");
fprintf(stderr, "int2f: AX %04x, BX %04x, CX %04x, DX %04x, "
"SI %04x, DI %04x, DS %04x, ES %04x\n",
AX, BX, CX, DX, SI, DI, DS, ES);
}
int do_int2f(struct sigcontext_struct *context)
{
switch(context->sc_eax & 0xffff)
......@@ -20,7 +12,7 @@ int do_int2f(struct sigcontext_struct *context)
break;
default:
Barf(context);
IntBarf(0x2f, context);
};
return 1;
}
#include <stdio.h>
#include <stdlib.h>
#include "msdos.h"
#include "wine.h"
int do_int31(struct sigcontext_struct *context)
{
switch((context->sc_eax >> 8) & 0xff)
{
default:
IntBarf(0x31, context);
};
return 1;
}
......@@ -46,7 +46,7 @@ void outportb(struct sigcontext_struct *context)
switch (EDX & 0xffff)
{
case 0x70:
cmosaddress = EAX & 0xff;
cmosaddress = EAX & 0x7f;
break;
case 0x71:
cmosimage[cmosaddress & 0x3f] = EAX & 0xff;
......
......@@ -586,6 +586,7 @@ int EnumFonts(HDC hDC, LPSTR lpFaceName, FARPROC lpEnumFunc, LPSTR lpData)
if (lpFaceList[j] == NULL) break;
if (strcmp(lpFaceList[j], lpLogFontList[i]->lfFaceName) == 0) {
i++; j = 0;
if (lpLogFontList[i] == NULL) break;
}
}
if (lpLogFontList[i] == NULL) break;
......
......@@ -553,13 +553,3 @@ int EnumObjects(HDC hDC, int nObjType, FARPROC lpEnumFunc, LPSTR lpData)
printf("EnumObjects // End of enumeration !\n");
return 0;
}
/***********************************************************************
* SetObjectOwner (GDI.461)
*/
int SetObjectOwner(HANDLE hObj)
{
printf("EMPTY STUB !!! SetObjectOwner() (I don't know its prototype !\n");
return 0;
}
......@@ -62,14 +62,15 @@ static char *TEXT_NextLine(HDC hdc, char *str, int *count, char *dest,
return (&str[i]);
}
dest[j++] = str[i++];
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX))
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
(format & DT_WORDBREAK))
{
if (!GetTextExtentPoint(hdc, &dest[j-1], 1, &size))
return NULL;
plen += size.cx;
}
break;
case PREFIX:
if (!(format & DT_NOPREFIX))
{
......@@ -79,7 +80,7 @@ static char *TEXT_NextLine(HDC hdc, char *str, int *count, char *dest,
else
{
dest[j++] = str[i++];
if (!(format & DT_NOCLIP))
if (!(format & DT_NOCLIP) || (format & DT_WORDBREAK))
{
if (!GetTextExtentPoint(hdc, &dest[j-1], 1, &size))
return NULL;
......@@ -87,7 +88,7 @@ static char *TEXT_NextLine(HDC hdc, char *str, int *count, char *dest,
}
}
break;
case TAB:
if (format & DT_EXPANDTABS)
{
......@@ -108,7 +109,8 @@ static char *TEXT_NextLine(HDC hdc, char *str, int *count, char *dest,
else
{
dest[j++] = str[i++];
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX))
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
(format & DT_WORDBREAK))
{
if (!GetTextExtentPoint(hdc, &dest[j-1], 1, &size))
return NULL;
......@@ -119,7 +121,8 @@ static char *TEXT_NextLine(HDC hdc, char *str, int *count, char *dest,
case SPACE:
dest[j++] = str[i++];
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX))
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
(format & DT_WORDBREAK))
{
wb_i = i;
wb_j = j - 1;
......@@ -132,7 +135,8 @@ static char *TEXT_NextLine(HDC hdc, char *str, int *count, char *dest,
default:
dest[j++] = str[i++];
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX))
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
(format & DT_WORDBREAK))
{
if (!GetTextExtentPoint(hdc, &dest[j-1], 1, &size))
return NULL;
......@@ -148,7 +152,7 @@ static char *TEXT_NextLine(HDC hdc, char *str, int *count, char *dest,
if (format & DT_WORDBREAK)
{
*len = wb_j;
*count = wb_count;
*count = wb_count - 1;
return (&str[wb_i]);
}
else
......@@ -178,6 +182,11 @@ int DrawText( HDC hdc, LPSTR str, int count, LPRECT rect, WORD flags )
int x = rect->left, y = rect->top;
int width = rect->right - rect->left;
#ifdef DEBUG_TEXT
printf( "DrawText: '%s', %d , [(%d,%d),(%d,%d)]\n", str, count,
rect->left, rect->top, rect->right, rect->bottom);
#endif
if (count == -1) count = strlen(str);
strPtr = str;
......@@ -423,5 +432,3 @@ BOOL ExtTextOut(HDC hDC, short x, short y, WORD wOptions, LPRECT lprect,
return FALSE;
}
......@@ -27,7 +27,8 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#define EQUATETYPE_ABS 18
#define TYPE_RETURN 20
#define MAX_ORDINALS 1024
/*#define MAX_ORDINALS 1024*/
#define MAX_ORDINALS 1299
#define PUSH_0 "\tpushl\t$0\n"
#define PUSH_SS "\tpushw\t$0\n\tpushw\t%%ss\n"
......
......@@ -6,6 +6,7 @@
*/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "windows.h"
#include "win.h"
#include "mdi.h"
......
......@@ -69,7 +69,6 @@ static void NC_AdjustRect( LPRECT rect, DWORD style, BOOL menu, DWORD exStyle )
if ((style & WS_CAPTION) == WS_CAPTION)
rect->top -= SYSMETRICS_CYCAPTION - 1;
if (menu) rect->top -= SYSMETRICS_CYMENU + 1;
if (style & WS_VSCROLL) rect->right += SYSMETRICS_CXVSCROLL;
......@@ -592,15 +591,24 @@ void NC_DoNCPaint( HWND hwnd, HRGN hrgn, BOOL active, BOOL suppress_menupaint )
if (wndPtr->wIDmenu != 0 &&
(wndPtr->dwStyle & WS_CHILD) != WS_CHILD) {
int oldbottom;
CopyRect(&rect2, &rect);
/* Default MenuBar height */
oldbottom = rect2.bottom = rect2.top + SYSMETRICS_CYMENU;
StdDrawMenuBar(hdc, &rect2, (LPPOPUPMENU)GlobalLock(wndPtr->wIDmenu),
suppress_menupaint);
GlobalUnlock(wndPtr->wIDmenu);
/* Reduce ClientRect according to MenuBar height */
rect.top += rect2.bottom - oldbottom;
LPPOPUPMENU lpMenu = (LPPOPUPMENU) GlobalLock(wndPtr->wIDmenu);
if (lpMenu != NULL) {
int oldHeight;
CopyRect(&rect2, &rect);
/* Default MenuBar height */
if (lpMenu->Height == 0) lpMenu->Height = SYSMETRICS_CYMENU + 1;
oldHeight = lpMenu->Height;
rect2.bottom = rect2.top + oldHeight;
/* printf("NC_DoNCPaint // menubar old Height=%d\n", oldHeight); */
StdDrawMenuBar(hdc, &rect2, lpMenu, suppress_menupaint);
GlobalUnlock(wndPtr->wIDmenu);
/* printf("NC_DoNCPaint // menubar new Height=%d\n", lpMenu->Height); */
if (oldHeight != lpMenu->Height) {
/* Reduce ClientRect according to MenuBar height */
wndPtr->rectClient.top -= oldHeight;
wndPtr->rectClient.top += lpMenu->Height;
}
}
}
if (wndPtr->dwStyle & (WS_VSCROLL | WS_HSCROLL)) {
......@@ -611,7 +619,7 @@ void NC_DoNCPaint( HWND hwnd, HRGN hrgn, BOOL active, BOOL suppress_menupaint )
rect.top, rect.right, bottom);
if (wndPtr->dwStyle & WS_CAPTION) rect.top += SYSMETRICS_CYSIZE;
if (wndPtr->wIDmenu != 0 && (wndPtr->dwStyle & WS_CHILD) != WS_CHILD)
rect2.top += SYSMETRICS_CYMENU;
rect2.top += SYSMETRICS_CYMENU + 1;
StdDrawScrollBar(hwnd, hdc, SB_VERT, &rect2, (LPHEADSCROLL)wndPtr->VScroll);
}
if (wndPtr->dwStyle & WS_HSCROLL) {
......
......@@ -301,10 +301,10 @@ INT windows_wsprintf(BYTE *win_stack)
/* skip width/precision */
while (*ptr == '-' || *ptr == '+' || *ptr == '.' ||
*ptr == ' ' || isdigit(*ptr))
*ptr == ' ' || isdigit(*ptr) || *ptr == '#')
ptr++;
switch (*ptr++) {
switch (*ptr) {
case 's':
*(DWORD*)stack_ptr = *(DWORD*)win_stack;
stack_ptr += 4;
......
......@@ -290,6 +290,7 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
wndPtr = (WND *) USER_HEAP_ADDR( hwnd );
wndPtr->hwndNext = 0;
wndPtr->hwndChild = 0;
wndPtr->window = 0;
wndPtr->dwMagic = WND_MAGIC;
wndPtr->hwndParent = (style & WS_CHILD) ? parent : hwndDesktop;
wndPtr->hwndOwner = (style & WS_CHILD) ? 0 : parent;
......@@ -312,22 +313,7 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
wndPtr->lpfnWndProc = classPtr->wc.lpfnWndProc;
wndPtr->dwStyle = style;
wndPtr->dwExStyle = exStyle;
#ifdef DEBUG_MENU
printf("CreateWindowEx // menu=%04X instance=%04X classmenu=%08X !\n",
menu, instance, classPtr->wc.lpszMenuName);
#endif
if ((style & WS_CAPTION) && (style & WS_CHILD) == 0) {
if (menu != 0)
SetMenu(hwnd, menu);
else {
if (classPtr->wc.lpszMenuName != NULL)
SetMenu(hwnd, LoadMenu(instance, classPtr->wc.lpszMenuName));
else
wndPtr->wIDmenu = 0;
}
}
else
wndPtr->wIDmenu = menu;
wndPtr->wIDmenu = 0;
wndPtr->hText = 0;
wndPtr->flags = 0;
wndPtr->VScroll = NULL;
......@@ -390,6 +376,21 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
CWSaveUnder | CWBackingStore, &win_attr );
XStoreName( display, wndPtr->window, windowName );
#ifdef DEBUG_MENU
printf("CreateWindowEx // menu=%04X instance=%04X classmenu=%08X !\n",
menu, instance, classPtr->wc.lpszMenuName);
#endif
if ((style & WS_CAPTION) && (style & WS_CHILD) == 0) {
if (menu != 0)
SetMenu(hwnd, menu);
else {
if (classPtr->wc.lpszMenuName != NULL)
SetMenu(hwnd, LoadMenu(instance, classPtr->wc.lpszMenuName));
}
}
else
wndPtr->wIDmenu = menu;
/* Send the WM_CREATE message */
hcreateStruct = USER_HEAP_ALLOC( GMEM_MOVEABLE, sizeof(CREATESTRUCT) );
......
......@@ -604,8 +604,8 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, short x, short y,
wndPtr->dwStyle |= WS_VISIBLE;
XMapWindow( display, wndPtr->window );
MSG_Synchronize();
if (winPos->flags & SWP_NOREDRAW)
RedrawWindow( hwnd, NULL, 0, RDW_VALIDATE );
/* if (winPos->flags & SWP_NOREDRAW)
RedrawWindow( hwnd, NULL, 0, RDW_VALIDATE ); */
}
else if (winPos->flags & SWP_HIDEWINDOW)
{
......@@ -639,6 +639,10 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, short x, short y,
(!(winPos->flags & SWP_NOACTIVATE)) ||
(!(winPos->flags & SWP_NOZORDER)))
SendMessage( hwnd, WM_NCPAINT, 1, 0L );
if ((winPos->flags & (SWP_FRAMECHANGED | SWP_SHOWWINDOW)) &&
(!(winPos->flags & SWP_NOREDRAW)) &&
(wndPtr->dwStyle & WS_VISIBLE) && IsWindowVisible(hwnd))
InvalidateRect(hwnd, NULL, TRUE);
/* Finally send the WM_WINDOWPOSCHANGED message */
wndPtr->rectWindow = newWindowRect;
......
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