diff --git a/ChangeLog b/ChangeLog index 407674d8c1d..001d4add021 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,107 @@ +---------------------------------------------------------------------- +Tue Jun 14 08:09:14 1994 Bob Amstadt (bob@pooh) + + * loader/selector.c (GetCurrentPDB): + Added trivial function GetCurrentPDB() which returns the program + segment prefix selector. + + * memory/heap.c (HEAP_Free): + If free list is empty, make the freed block the free list. + +Fri Jun 10 07:56:49 1994 Bob Amstadt (bob@pooh) + + * controls/edit.c (EDIT_SetTextMsg): + Do not append a newline at the end of the last line. + + * windows/event.c (SetCapture): + Set winHasCursor if mouse capture succeeds. + +Jun 6, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) + + * [controls/listbox.c] + Fix bug in listbox : InsertString should call AddString if -1. + + * [controls/menu.c] + New function GetMenuState(). + + * [controls/scroll.c] [windows/nonclient.c] + Try to make ShowScrollBar() recalc NC_ regions. Not finished ! + + * [objects/text.c] + Add Stub for TabbedTextOut(), which temporarely call Textout(). + + * [windows/keyboard.c] [windows/event.c] + New function GetKeyBoardState() with an KeyStateTable array + & associated handling in function EVENT_key(). + +Mon Jun 13 16:45:24 MET DST 1994 (erik@hacktic.nl) + + * [controls/menu.c] + IsMenu() added. + + * [loader/library.c] + ModuleFirst(), ModuleNext(), ModuleFindName(), ModuleFindHandle() + added. + + * [object/gdiobj.c] + IsGDIObject() added. + + * [miscemu/int2[56].c] + bugfix: both didn't leave flags pushed on 16bit-stack. + (winfile gets a bit further) + + * [miscemu/int16.c] + Added (empty). + +Sat Jun 11 22:56:48 1994 Jon Tombs (jon@esix2.us.es) + * windows/event.c: + Added code to drop redundant motion Events in the XEvent queue. + +Thu Jun 9 10:55:55 MET DST 1994 Jochen Hein ( Hein@Student.TU-Clausthal.de ) + + * [misc/main.c misc/message.c include/texts.h] + Removed the text-constants from message.c into variables + which may be changed from X-resources. + + * [misc/main.c misc/message.c] + added and setlocale() to main.c, used toupper() in message.c + +Mon, 13 Jun 94 09:41:16 -0500 Paul Bramel + + * controls/button.c ( [CR]B_LButton* ) + left rc.right at full window width so click on label also + activates the control (MSWin behavior) + +Sat Jun 11 19:05:40 1994 Olaf Flebbe (flebbe@tat.physik.uni-tuebingen.de) + + * include/windows.h: + functions pointers can not be packed. + (annoying warnings with forthcomming gcc-2.6.x) + + * loader/main.c (InitDLL): + Fixed a printf statement. (for control.exe) + + (InitializeLoadedDLLs): + deleted shadow definition of *wpnt. + (Breaks many programs, because now COMMDLG will be + initialized :-( + + * windows/win.c (SetWindowText): + added missing breaks; (PENSATE starts) + + * windows/graphics.c (FloodFill): + Proper boundarys. (BANGBANG starts) FloodFile_rec should + be rewritten. + + * objects/font.c (FONT_GetMetrics): + TYPO: use font->perchar only if it is defined. (WRITE starts) + +Sun June 12, Peter Broadhurst (pbr@ua.nwl.ac.uk) + controls/scroll.c: + Fixes for improved behaviour when dragging thumb; + Added SB_THUMBPOSITION message when thumb is released. + +---------------------------------------------------------------------- Tue Jun 7 08:41:27 1994 Bob Amstadt (bob@pooh) * loader/selector.c (FixupFunctionPrologs): @@ -69,7 +173,7 @@ Sun Jun 5 17:34:24 1994 Erik Bos (erik@hacktic.nl) Jun 6, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) - * [tools/.c] + * [tools/build.c] Change MAX_ORDINALS define to higher value, 1299 entries. (MMSYSTEM doesn't have succesive numbers, some are around 1200). @@ -83,9 +187,6 @@ Jun 6, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [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. diff --git a/DEVELOPERS-HINTS b/DEVELOPERS-HINTS index da8a5987f6b..2ea1e9fe791 100644 --- a/DEVELOPERS-HINTS +++ b/DEVELOPERS-HINTS @@ -1,16 +1,10 @@ This is intend to be a document to help new developers get started. Existing developers should feel free to add there comments. -RESERVING WINE PROJECT ARES: - -If you wish to work on a specific set of API functions. Send -mail to wine-project@amscons.com. The automatic mail handler -will provide you with instructions. - SUBMITTING YOUR WORK: Submissions of code for inclussion into Wine should be sent to -bob@amscons.com (Bob Amstadt). You MUST provide a suitable +wine-new@amscons.com (Bob Amstadt). You MUST provide a suitable ChangeLog entry for any work that you submit. I prefer new code to be submitted as unified diffs (diff -u) off of the latest release. Releases are every Tuesday evening (approximately 17:00 PST or diff --git a/Imakefile b/Imakefile index f87fc8fe710..fec5a480285 100644 --- a/Imakefile +++ b/Imakefile @@ -100,4 +100,4 @@ depend:: install:: etags:: - etags `find . -name '*.[chS]'` \ No newline at end of file + etags `find . -name '*.[chS]'` diff --git a/README b/README index 5432ca5b932..20e574889d9 100644 --- a/README +++ b/README @@ -38,9 +38,9 @@ You must have one of: NetBSD-current FreeBSD-current or FreeBSD 1.1 -To build Wine, first do a "./Configure" and then a "make". The -executable "wine" will be built. "wine" will load and run 16-bit -Windows' executables. +To build Wine, first do a "./Configure" and then a "make" (or "gmake" +if you're running *BSD). The executable "wine" will be built. "wine" +will load and run 16-bit Windows' executables. diff --git a/controls/button.c b/controls/button.c index 8d968199f70..67de0ab3ee6 100644 --- a/controls/button.c +++ b/controls/button.c @@ -540,7 +540,6 @@ static LONG CB_LButtonDown(HWND hWnd, WORD wParam, LONG lParam) delta = (rc.bottom - rc.top - tm.tmHeight) >> 1; rc.top += delta; rc.bottom = tm.tmHeight + delta; - rc.right = tm.tmHeight; if (PtInRect(&rc, MAKEPOINT(lParam))) { SetFocus(hWnd); @@ -569,7 +568,6 @@ static LONG CB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam) delta = (rc.bottom - rc.top - tm.tmHeight) >> 1; rc.top += delta; rc.bottom = tm.tmHeight + delta; - rc.right = tm.tmHeight; if (PtInRect(&rc, MAKEPOINT(lParam))) { @@ -625,7 +623,6 @@ static LONG CB_LButtonDblClk(HWND hWnd, WORD wParam, LONG lParam) delta = (rc.bottom - rc.top - tm.tmHeight) >> 1; rc.top += delta; rc.bottom = tm.tmHeight + delta; - rc.right = tm.tmHeight; if (PtInRect(&rc, MAKEPOINT(lParam))) NOTIFY_PARENT(hWnd, BN_DOUBLECLICKED); } @@ -744,7 +741,6 @@ static LONG RB_LButtonDown(HWND hWnd, WORD wParam, LONG lParam) delta = (rc.bottom - rc.top - tm.tmHeight) >> 1; rc.top += delta; rc.bottom = tm.tmHeight + delta; - rc.right = tm.tmHeight; if (PtInRect(&rc, MAKEPOINT(lParam))) { SetFocus(hWnd); @@ -773,7 +769,6 @@ static LONG RB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam) delta = (rc.bottom - rc.top - tm.tmHeight) >> 1; rc.top += delta; rc.bottom = tm.tmHeight + delta; - rc.right = tm.tmHeight; if (PtInRect(&rc, MAKEPOINT(lParam))) { @@ -801,7 +796,6 @@ static LONG RB_LButtonDblClk(HWND hWnd, WORD wParam, LONG lParam) delta = (rc.bottom - rc.top - tm.tmHeight) >> 1; rc.top += delta; rc.bottom = tm.tmHeight + delta; - rc.right = tm.tmHeight; if (PtInRect(&rc, MAKEPOINT(lParam))) NOTIFY_PARENT(hWnd, BN_DOUBLECLICKED); } diff --git a/controls/combo.c b/controls/combo.c index 22a1b08fb5e..ef6c3b70d81 100644 --- a/controls/combo.c +++ b/controls/combo.c @@ -103,6 +103,14 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) printf("Combo WM_DESTROY %lX !\n", lphc); #endif return DefWindowProc( hwnd, message, wParam, lParam ); + case WM_SHOWWINDOW: +#ifdef DEBUG_COMBO + printf("ComboBox WM_SHOWWINDOW hWnd=%04X !\n", hwnd); +#endif + if (!(wParam == 0 && lParam == 0L)) { + InvalidateRect(hwnd, NULL, TRUE); + } + break; case WM_COMMAND: wndPtr = WIN_FindWndPtr(hwnd); diff --git a/controls/edit.c b/controls/edit.c index 8d431729ef4..abafcfe967e 100644 --- a/controls/edit.c +++ b/controls/edit.c @@ -15,9 +15,7 @@ static char Copyright[] = "Copyright David W. Metcalfe, 1994"; #include "class.h" #include "user.h" -/* -#define DEBUG_EDIT -*/ +#define DEBUG_EDIT /* */ #define NOTIFY_PARENT(hWndCntrl, wNotifyCode) \ SendMessage(GetParent(hWndCntrl), WM_COMMAND, \ @@ -1993,7 +1991,7 @@ LONG EDIT_SetTextMsg(HWND hwnd, LONG lParam) es->hText = EDIT_HEAP_REALLOC(es->hText, len + 3); text = EDIT_HEAP_ADDR(es->hText); strcpy(text, (char *)lParam); - text[len] = '\n'; +/* text[len] = '\n'; */ /* Removed by Bob Amstadt */ text[len + 1] = '\0'; text[len + 2] = '\0'; EDIT_BuildTextPointers(hwnd); diff --git a/controls/listbox.c b/controls/listbox.c index 522131a6aff..196cb9bdb01 100644 --- a/controls/listbox.c +++ b/controls/listbox.c @@ -833,6 +833,10 @@ int ListBoxInsertString(HWND hwnd, UINT uIndex, LPSTR newstr) HANDLE hTemp; LPSTR str; UINT Count; +#ifdef DEBUG_LISTBOX + printf("ListBoxInsertString(%04X, %d, %08X);\n", hwnd, uIndex, newstr); +#endif + if (uIndex == (UINT)-1) return ListBoxAddString(hwnd, newstr); lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr); if (lphl == NULL) return LB_ERR; if (uIndex >= lphl->ItemsCount) return LB_ERR; @@ -846,7 +850,7 @@ int ListBoxInsertString(HWND hwnd, UINT uIndex, LPSTR newstr) hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(LISTSTRUCT)); lplsnew = (LPLISTSTRUCT) USER_HEAP_ADDR(hTemp); if (lplsnew == NULL) { - printf("ListBoxAddString() // Bad allocation of new item !\n"); + printf("ListBoxInsertString() // Bad allocation of new item !\n"); return LB_ERRSPACE; } ListBoxDefaultItem(hwnd, wndPtr, lphl, lplsnew); @@ -862,6 +866,9 @@ int ListBoxInsertString(HWND hwnd, UINT uIndex, LPSTR newstr) if (str == NULL) return LB_ERRSPACE; strcpy(str, newstr); newstr = str; +#ifdef DEBUG_LISTBOX + printf("ListBoxInsertString // after strcpy '%s'\n", str); +#endif } } lplsnew->lpNext = NULL; @@ -886,6 +893,9 @@ int ListBoxInsertString(HWND hwnd, UINT uIndex, LPSTR newstr) InvalidateRect(hwnd, NULL, TRUE); UpdateWindow(hwnd); } +#ifdef DEBUG_LISTBOX + printf("ListBoxInsertString // count=%d\n", lphl->ItemsCount); +#endif return lphl->ItemsCount; } diff --git a/controls/menu.c b/controls/menu.c index 6470497e295..58a98654030 100644 --- a/controls/menu.c +++ b/controls/menu.c @@ -845,6 +845,9 @@ void StdDrawMenuBar(HDC hDC, LPRECT lprect, LPPOPUPMENU lppop, if (lpitem == NULL) goto EndOfPaint; for(i = 0; i < lppop->nItems; i++) { CopyRect(&rect2, &lpitem->rect); +#ifdef DEBUG_MENU + printf("StdDrawMenuBar // start left=%d\n", rect2.left); +#endif if ((lpitem->item_flags & MF_CHECKED) == MF_CHECKED) { hMemDC = CreateCompatibleDC(hDC); if (lpitem->hCheckBit == 0) { @@ -856,7 +859,11 @@ void StdDrawMenuBar(HDC hDC, LPRECT lprect, LPPOPUPMENU lppop, GetObject(lpitem->hCheckBit, sizeof(BITMAP), (LPSTR)&bm); } BitBlt(hDC, rect2.left, rect2.top + 1, - bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY); + bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY); + rect2.left += bm.bmWidth; +#ifdef DEBUG_MENU + printf("StdDrawMenuBar // MF_CHECKED bm.bmWidth=%d\n", bm.bmWidth); +#endif DeleteDC(hMemDC); } else { @@ -866,6 +873,10 @@ void StdDrawMenuBar(HDC hDC, LPRECT lprect, LPPOPUPMENU lppop, GetObject(lpitem->hUnCheckBit, sizeof(BITMAP), (LPSTR)&bm); BitBlt(hDC, rect2.left, rect2.top + 1, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY); + rect2.left += bm.bmWidth; +#ifdef DEBUG_MENU + printf("StdDrawMenuBar // MF_UNCHECKED bm.bmWidth=%d\n", bm.bmWidth); +#endif DeleteDC(hMemDC); } } @@ -898,6 +909,9 @@ void StdDrawMenuBar(HDC hDC, LPRECT lprect, LPPOPUPMENU lppop, } if ((lpitem->item_flags & MF_HILITE) == MF_HILITE) FillRect(hDC, &rect2, GetStockObject(BLACK_BRUSH)); +#ifdef DEBUG_MENU + printf("StdDrawMenuBar // rect2.left=%d\n", rect2.left); +#endif DrawText(hDC, lpitem->item_text, -1, &rect2, DT_LEFT | DT_VCENTER | DT_SINGLELINE); SetTextColor(hDC, OldTextColor); @@ -1073,13 +1087,15 @@ void MenuBarCalcSize(HDC hDC, LPRECT lprect, LPPOPUPMENU lppop) lprect->left, lprect->top, lprect->right, lprect->bottom); #endif hOldFont = SelectObject(hDC, GetStockObject(SYSTEM_FONT)); - LineHeight = OldHeight = SYSMETRICS_CYMENU + 1; + lppop->CheckWidth = 0; + LineHeight = OldHeight = SYSMETRICS_CYMENU + 2; 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; + rect.right = rect.left; if ((lpitem->item_flags & MF_BITMAP) == MF_BITMAP) { hBitMap = (HBITMAP)LOWORD((LONG)lpitem->item_text); GetObject(hBitMap, sizeof(BITMAP), (LPSTR)&bm); @@ -1095,6 +1111,21 @@ void MenuBarCalcSize(HDC hDC, LPRECT lprect, LPPOPUPMENU lppop) dwRet = max(SYSMETRICS_CYMENU, (HIWORD(dwRet) + 6)); LineHeight = max(LineHeight, (WORD)dwRet); } + if ((lpitem->item_flags & MF_CHECKED) == MF_CHECKED) { + if (lpitem->hCheckBit != 0) + GetObject(lpitem->hCheckBit, sizeof(BITMAP), (LPSTR)&bm); + else + GetObject(hStdCheck, sizeof(BITMAP), (LPSTR)&bm); + rect.right += bm.bmWidth; + LineHeight = max(LineHeight, bm.bmHeight); + } + else { + if (lpitem->hUnCheckBit != 0) { + GetObject(lpitem->hUnCheckBit, sizeof(BITMAP), (LPSTR)&bm); + rect.right += bm.bmWidth; + LineHeight = max(LineHeight, bm.bmHeight); + } + } CopyRect(&lpitem->rect, &rect); rect.left = rect.right; lpitem = (LPMENUITEM)lpitem->next; @@ -1112,7 +1143,7 @@ void MenuBarCalcSize(HDC hDC, LPRECT lprect, LPPOPUPMENU lppop) } } lppop->Width = lprect->right - lprect->left; - lppop->Height = rect.bottom - lprect->top; + lppop->Height = rect.bottom - lprect->top; lprect->bottom = lprect->top + lppop->Height; CopyRect(&lppop->rect, lprect); #ifdef DEBUG_MENUCALC @@ -1362,8 +1393,10 @@ BOOL HiliteMenuItem(HWND hWnd, HMENU hMenu, WORD wItemID, WORD wHilite) { LPPOPUPMENU menu; LPMENUITEM lpitem; +#ifdef DEBUG_MENU printf("HiliteMenuItem(%04X, %04X, %04X, %04X);\n", hWnd, hMenu, wItemID, wHilite); +#endif menu = (LPPOPUPMENU) GlobalLock(hMenu); if (menu == NULL) return FALSE; lpitem = FindMenuItem(hMenu, wItemID, wHilite); @@ -1372,6 +1405,24 @@ BOOL HiliteMenuItem(HWND hWnd, HMENU hMenu, WORD wItemID, WORD wHilite) } +/********************************************************************** + * GetMenuState [USER.250] + */ +WORD GetMenuState(HMENU hMenu, WORD wItemID, WORD wFlags) +{ + LPPOPUPMENU menu; + LPMENUITEM lpitem; +#ifdef DEBUG_MENU + printf("GetMenuState(%04X, %04X, %04X);\n", hMenu, wItemID, wFlags); +#endif + menu = (LPPOPUPMENU) GlobalLock(hMenu); + if (menu == NULL) return -1; + lpitem = FindMenuItem(hMenu, wItemID, wFlags); + if (lpitem == NULL) return -1; + return lpitem->item_flags; +} + + /********************************************************************** * GetMenuItemCount [USER.263] */ @@ -2186,10 +2237,20 @@ void DrawMenuBar(HWND hWnd) #endif lppop = (LPPOPUPMENU) GlobalLock(wndPtr->wIDmenu); if (lppop == NULL) return; - if ((lppop->rect.bottom - lppop->rect.top) != 0) { + if (lppop->Height != 0) { + int oldHeight; + oldHeight = lppop->Height; hDC = GetWindowDC(hWnd); StdDrawMenuBar(hDC, &lppop->rect, lppop, FALSE); ReleaseDC(hWnd, hDC); + if (oldHeight != lppop->Height) { + printf("DrawMenuBar // menubar changed oldHeight=%d != lppop->Height=%d\n", + oldHeight, lppop->Height); + /* Reduce ClientRect according to MenuBar height */ + wndPtr->rectClient.top -= oldHeight; + wndPtr->rectClient.top += lppop->Height; + SendMessage(hWnd, WM_NCPAINT, 1, 0L); + } } else SendMessage(hWnd, WM_NCPAINT, 1, 0L); @@ -2319,4 +2380,17 @@ WORD * ParseMenuResource(WORD *first_item, int level, HMENU hMenu) return next_item; } +/********************************************************************** + * IsMenu(USER.358) + */ +BOOL IsMenu(HMENU hMenu) +{ + LPPOPUPMENU menu; + menu = (LPPOPUPMENU) GlobalLock(hMenu); + if (menu == NULL) + return FALSE; + + GlobalUnlock(hMenu); + return TRUE; +} diff --git a/controls/scroll.c b/controls/scroll.c index af1d12db40e..e962e8c50d6 100644 --- a/controls/scroll.c +++ b/controls/scroll.c @@ -1,8 +1,10 @@ -/* +/* * Interface code to SCROLLBAR widget * * Copyright Martin Ayotte, 1993 * + * Small fixes and implemented SB_THUMBPOSITION + * by Peter Broadhurst, 940611 */ /* @@ -58,6 +60,8 @@ LONG ScrollBarWndProc( HWND hWnd, WORD message, WORD wParam, LONG lParam ) RECT rect, rect2; LPCREATESTRUCT lpCreat; static RECT rectsel; + POINT *pt; + pt=(POINT*)&lParam; switch(message) { case WM_CREATE: lpCreat = (LPCREATESTRUCT)lParam; @@ -95,15 +99,15 @@ LONG ScrollBarWndProc( HWND hWnd, WORD message, WORD wParam, LONG lParam ) case WM_LBUTTONDOWN: SetCapture(hWnd); - ScrollBarButtonDown(hWnd, SB_CTL, LOWORD(lParam), HIWORD(lParam)); + ScrollBarButtonDown(hWnd, SB_CTL, pt->x,pt->y); break; case WM_LBUTTONUP: ReleaseCapture(); - ScrollBarButtonUp(hWnd, SB_CTL, LOWORD(lParam), HIWORD(lParam)); + ScrollBarButtonUp(hWnd, SB_CTL, pt->x,pt->y); break; case WM_MOUSEMOVE: - ScrollBarMouseMove(hWnd, SB_CTL, wParam, LOWORD(lParam), HIWORD(lParam)); + ScrollBarMouseMove(hWnd, SB_CTL, wParam, pt->x,pt->y); break; case WM_KEYDOWN: case WM_KEYUP: @@ -297,7 +301,24 @@ void ScrollBarButtonUp(HWND hWnd, int nBar, int x, int y) printf("ScrollBarButtonUp // x=%d y=%d\n", x, y); #endif lphs = GetScrollObjectStruct(hWnd, nBar); - lphs->ThumbActive = FALSE; + if(lphs->ThumbActive) + { + HWND hWndOwner,hWndParent; + if (nBar == SB_CTL) { + hWndParent = GetParent(hWnd); + hWndOwner = lphs->hWndOwner; + } + else { + hWndParent = hWnd; + hWndOwner = 0; + } + + + SendMessage(hWndParent, lphs->Direction, + SB_THUMBPOSITION, MAKELONG(lphs->ThumbVal, hWndOwner)); + lphs->ThumbActive = FALSE; + } + if (lphs->ButtonDown != 0) { lphs->ButtonDown = 0; if (nBar == SB_CTL) { @@ -337,21 +358,38 @@ void ScrollBarMouseMove(HWND hWnd, int nBar, WORD wParam, int x, int y) printf("ScrollBarButtonMove SB_?SCROLL // x=%d y=%d\n", x, y); #endif } - if (lphs->Direction == WM_VSCROLL) { - int butsiz = lphs->rect.right - lphs->rect.left; - y = y - butsiz - (butsiz >> 1); - } - else { - int butsiz = lphs->rect.bottom - lphs->rect.top; - y = x - butsiz - (butsiz >> 1); - } - x = (y * (lphs->MaxVal - lphs->MinVal) / - lphs->MaxPix) + lphs->MinVal; + + if(xrect.left||x>lphs->rect.right|| + yrect.top||y>lphs->rect.bottom) + { + #ifdef DEBUG_SCROLL - printf("Scroll WM_MOUSEMOVE val=%d pix=%d\n", x, y); + printf("Rejecting thumb position !\n"); +#endif + lphs->ThumbVal=lphs->CurVal;/*revert to last set position*/ + } + else + { + + if (lphs->Direction == WM_VSCROLL) { + int butsiz = lphs->rect.right - lphs->rect.left; + y = y - butsiz - (butsiz >> 1); + } + else { + int butsiz = lphs->rect.bottom - lphs->rect.top; + y = x - butsiz - (butsiz >> 1); + } + if(y<0)y=0; + if(y>lphs->MaxPix)y=lphs->MaxPix; + lphs->ThumbVal = (y * (lphs->MaxVal - lphs->MinVal) / + lphs->MaxPix) + lphs->MinVal; + } + +#ifdef DEBUG_SCROLL + printf("Scroll WM_MOUSEMOVE val=%d pix=%d\n", lphs->ThumbVal, y); #endif SendMessage(hWndParent, lphs->Direction, - SB_THUMBTRACK, MAKELONG(x, hWndOwner)); + SB_THUMBTRACK, MAKELONG(lphs->ThumbVal, hWndOwner)); } @@ -442,9 +480,11 @@ void StdDrawScrollBar(HWND hWnd, HDC hDC, int nBar, LPRECT lprect, LPHEADSCROLL lphs->rectDown.left = rect.right - w2; } if (lphs->MaxVal != lphs->MinVal) - lphs->CurPix = lphs->MaxPix * (abs((short)lphs->CurVal) - abs(lphs->MinVal)) / - (abs(lphs->MaxVal) - abs(lphs->MinVal)); + lphs->CurPix = lphs->MaxPix * (lphs->CurVal - lphs->MinVal) / + (lphs->MaxVal - lphs->MinVal); + if(lphs->CurPix <0)lphs->CurPix=0; if (lphs->CurPix > lphs->MaxPix) lphs->CurPix = lphs->MaxPix; + hMemDC = CreateCompatibleDC(hDC); if (lphs->Direction == WM_VSCROLL) { GetObject(hUpArrow, sizeof(BITMAP), (LPSTR)&bm); @@ -597,6 +637,7 @@ void NC_CreateScrollBars(HWND hWnd) lphs->rect.right = width; lphs->hWndOwner = hWnd; wndPtr->VScroll = lphs; + wndPtr->scroll_flags |= 0x0001; if (wndPtr->dwStyle & WS_HSCROLL) height += SYSMETRICS_CYHSCROLL; } if (wndPtr->dwStyle & WS_HSCROLL) { @@ -609,6 +650,7 @@ void NC_CreateScrollBars(HWND hWnd) lphs->rect.bottom = height; lphs->hWndOwner = hWnd; wndPtr->HScroll = lphs; + wndPtr->scroll_flags |= 0x0002; } } @@ -642,8 +684,10 @@ int SetScrollPos(HWND hWnd, int nBar, int nPos, BOOL bRedraw) nRet = lphs->CurVal; lphs->CurVal = (short)nPos; if (lphs->MaxVal != lphs->MinVal) - lphs->CurPix = lphs->MaxPix * (abs((short)nPos) - abs(lphs->MinVal)) / - (abs(lphs->MaxVal) - abs(lphs->MinVal)); + lphs->CurPix = lphs->MaxPix * (lphs->CurVal - lphs->MinVal) / + (lphs->MaxVal - lphs->MinVal); + if(lphs->CurPix <0)lphs->CurPix=0; + if (lphs->CurPix > lphs->MaxPix) lphs->CurPix = lphs->MaxPix; #ifdef DEBUG_SCROLL printf("SetScrollPos val=%d pixval=%d pixmax%d\n", @@ -691,12 +735,15 @@ void SetScrollRange(HWND hWnd, int nBar, int MinPos, int MaxPos, BOOL bRedraw) HDC hDC; lphs = GetScrollObjectStruct(hWnd, nBar); if (lphs == NULL) return; + +/* should a bad range be rejected here? + */ lphs->MinVal = (short)MinPos; lphs->MaxVal = (short)MaxPos; if (lphs->MaxVal != lphs->MinVal) - lphs->CurPix = abs(lphs->MaxVal) * - (abs(lphs->CurVal) - abs(lphs->MinVal)) / - (abs(lphs->MaxVal) - abs(lphs->MinVal)); + lphs->CurPix = lphs->MaxPix * (lphs->CurVal - lphs->MinVal) / + (lphs->MaxVal - lphs->MinVal); + if(lphs->CurPix <0)lphs->CurPix=0; if (lphs->CurPix > lphs->MaxPix) lphs->CurPix = lphs->MaxPix; #ifdef DEBUG_SCROLL printf("SetScrollRange min=%d max=%d\n", lphs->MinVal, lphs->MaxVal); @@ -737,32 +784,32 @@ void GetScrollRange(HWND hWnd, int nBar, LPINT lpMin, LPINT lpMax) */ void ShowScrollBar(HWND hWnd, WORD wBar, BOOL bFlag) { - WND *wndPtr; + WND *wndPtr; + printf("ShowScrollBar hWnd=%04X wBar=%d bFlag=%d\n", hWnd, wBar, bFlag); #ifdef DEBUG_SCROLL - printf("ShowScrollBar hWnd=%04X wBar=%d bFlag=%d\n", hWnd, wBar, bFlag); + printf("ShowScrollBar hWnd=%04X wBar=%d bFlag=%d\n", hWnd, wBar, bFlag); #endif - if (wBar == SB_CTL) { - if (bFlag) - ShowWindow(hWnd, SW_SHOW); - else - ShowWindow(hWnd, SW_HIDE); - return; - } - wndPtr = WIN_FindWndPtr(hWnd); -/* - if ((wBar == SB_VERT) || (wBar == SB_BOTH)) { - if (bFlag) - wndPtr->dwStyle |= WS_VSCROLL; - else - wndPtr->dwStyle &= 0xFFFFFFFFL ^ WS_VSCROLL; - } - if ((wBar == SB_HORZ) || (wBar == SB_BOTH)) { - if (bFlag) - wndPtr->dwStyle |= WS_HSCROLL; - else - wndPtr->dwStyle &= 0xFFFFFFFFL ^ WS_HSCROLL; - } -*/ + if (wBar == SB_CTL) { + if (bFlag) + ShowWindow(hWnd, SW_SHOW); + else + ShowWindow(hWnd, SW_HIDE); + return; + } + wndPtr = WIN_FindWndPtr(hWnd); + if ((wBar == SB_VERT) || (wBar == SB_BOTH)) { + if (bFlag) + wndPtr->scroll_flags != 0x0001; + else + wndPtr->scroll_flags &= 0xFFFE; + } + if ((wBar == SB_HORZ) || (wBar == SB_BOTH)) { + if (bFlag) + wndPtr->scroll_flags != 0x0002; + else + wndPtr->scroll_flags &= 0xFFFD; + } + SetWindowPos(hWnd, 0, 0, 0, 0, 0, + SWP_NOZORDER | SWP_NOMOVE | + SWP_NOSIZE | SWP_FRAMECHANGED); } - - diff --git a/if1632/gdi.spec b/if1632/gdi.spec index b63e283ae47..bc4a231048c 100644 --- a/if1632/gdi.spec +++ b/if1632/gdi.spec @@ -279,7 +279,7 @@ length 490 #452 pascal GDISEEGDIDO #460 pascal GDITASKTERMINATION 461 return SetObjectOwner 4 0 -#462 pascal ISGDIOBJECT +462 pascal IsGDIObject(word) IsGDIObject(1) #463 pascal MAKEOBJECTPRIVATE #464 pascal FIXUPBOGUSPUBLISHERMETAFILE 465 pascal RectVisible(word ptr) RectVisible(1 2) diff --git a/if1632/kernel.spec b/if1632/kernel.spec index 5f0ed34fa33..668b05a5524 100644 --- a/if1632/kernel.spec +++ b/if1632/kernel.spec @@ -39,7 +39,7 @@ length 415 34 pascal SetTaskQueue(word word) SetTaskQueue(1 2) 35 pascal GetTaskQueue(word) GetTaskQueue(1) 36 pascal GetCurrentTask() GetCurrentTask() -#37 GETCURRENTPDB +37 pascal GetCurrentPDB() GetCurrentPDB() #38 SETTASKSIGNALPROC #41 ENABLEDOS #42 DISABLEDOS diff --git a/if1632/relay.c b/if1632/relay.c index 752fc37a88f..bfd7fcb4b33 100644 --- a/if1632/relay.c +++ b/if1632/relay.c @@ -288,9 +288,9 @@ void winestat(){ perc = implemented * 100.00 / used; else perc = 0.0; - printf("%s: %d %d %3.1f\n", dll_builtin_table[i].dll_name, implemented, used, perc); + printf("%s: %d of %d (%3.1f %%)\n", dll_builtin_table[i].dll_name, implemented, used, perc); }; perc = timplemented * 100.00 / tused; - printf("TOTAL: %d %d %3.1f\n",timplemented, tused, perc); + printf("TOTAL: %d of %d implemented (%3.1f %%)\n",timplemented, tused, perc); } #endif /* WINESTAT */ diff --git a/if1632/toolhelp.spec b/if1632/toolhelp.spec index 0037da9b2d0..fe1e180552e 100644 --- a/if1632/toolhelp.spec +++ b/if1632/toolhelp.spec @@ -1,3 +1,38 @@ name toolhelp id 13 length 83 + +# 50 1 057b GLOBALHANDLETOSEL exported, shared data +# 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 1 0caa TASKFIRST exported, shared data +# 64 1 0ced TASKNEXT exported, shared data +# 65 1 0d2e TASKFINDHANDLE exported, shared data +# 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 1 13f4 MEMMANINFO exported, shared data +# 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 +# 80 1 2dae TIMERCOUNT exported, shared data +# 81 1 0d68 TASKSETCSIP exported, shared data +# 82 1 0d97 TASKGETCSIP exported, shared data +# 83 1 0dc0 TASKSWITCH exported, shared data diff --git a/if1632/user.spec b/if1632/user.spec index 259f377d857..2023ed5dc97 100644 --- a/if1632/user.spec +++ b/if1632/user.spec @@ -199,7 +199,8 @@ length 540 193 pascal IsClipboardFormatAvailable(word) IsClipboardFormatAvailable(1) 194 pascal DlgDirSelectComboBox(word ptr word) DlgDirSelectComboBox(1 2 3) 195 pascal DlgDirListComboBox(word ptr word word word) DlgDirListComboBox(1 2 3 4 5) -#196 TABBEDTEXTOUT +196 pascal TabbedTextOut(word s_word s_word ptr s_word s_word ptr s_word) + TabbedTextOut(1 2 3 4 5 6 7 8) #197 GETTABBEDTEXTEXTENT #198 CASCADECHILDWINDOWS #199 TILECHILDWINDOWS @@ -227,7 +228,7 @@ length 540 220 pascal LoadMenuIndirect(ptr) LoadMenuIndirect(1) 221 pascal ScrollDC(word s_word s_word ptr ptr word ptr) ScrollDC(1 2 3 4 5 6 7) -#222 GETKEYBOARDSTATE +222 pascal GetKeyboardState(ptr) GetKeyboardState(1) #223 SETKEYBOARDSTATE 224 pascal GetWindowTask(word) GetWindowTask(1) 225 pascal EnumTaskWindows(word ptr long) EnumTaskWindows(1 2 3) @@ -259,7 +260,7 @@ length 540 247 pascal GetCursor() GetCursor() 248 pascal GetOpenClipboardWindow() GetOpenClipboardWindow() 249 pascal GetAsyncKeyState(word) GetAsyncKeyState(1) -#250 GETMENUSTATE +250 pascal GetMenuState(word word word) GetMenuState(1 2 3) #251 SENDDRIVERMESSAGE #252 OPENDRIVER #253 CLOSEDRIVER @@ -328,7 +329,7 @@ length 540 #343 GETFILEPORTNAME #356 LOADDIBCURSORHANDLER #357 LOADDIBICONHANDLER -#358 ISMENU +358 pascal IsMenu(word) IsMenu(1) 359 pascal GetDCEx(word word long) GetDCEx(1 2 3) #362 DCHOOK #368 COPYICON @@ -414,7 +415,7 @@ length 540 #510 WNETLOCKQUEUEDATA #511 WNETUNLOCKQUEUEDATA 512 pascal WNetGetConnection(ptr ptr ptr) WNetGetConnection(1 2 3) -#513 WNETGETCAPS +513 pascal WNetGetCaps(word) WNetGetCaps(1) #514 WNETDEVICEMODE #515 WNETBROWSEDIALOG 516 pascal WNetGetUser(ptr ptr ptr) WNetGetUser(1 2 3) diff --git a/include/msdos.h b/include/msdos.h index b394555c2a2..99eccefdbde 100644 --- a/include/msdos.h +++ b/include/msdos.h @@ -30,10 +30,11 @@ struct dosdirent { #define CS context->sc_cs #define DS context->sc_ds #define ES context->sc_es +#define SS context->sc_ss #define DI context->sc_edi #define SI context->sc_esi - +#define SP context->sc_esp #define EFL context->sc_efl #define SetCflag (EFL |= 0x00000001L) @@ -43,8 +44,8 @@ struct dosdirent { #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; +#define setword(a,b) *(BYTE*)(a) = b & 0xff; \ + *((BYTE*)(a + 1)) = (b>>8) & 0xff; #define setdword(a,b) *(BYTE*)a = b & 0xff; \ *((BYTE*)a + 1) = (b>>8) & 0xff; \ diff --git a/include/scroll.h b/include/scroll.h index 76e94f50b89..02ce9d13142 100644 --- a/include/scroll.h +++ b/include/scroll.h @@ -9,6 +9,7 @@ typedef struct tagHEADSSCROLL { short MaxVal; short MaxPix; short CurPix; + short ThumbVal; RECT rect; RECT rectUp; RECT rectDown; diff --git a/include/task.h b/include/task.h index 05aba515723..1c052657cf4 100644 --- a/include/task.h +++ b/include/task.h @@ -5,21 +5,42 @@ #ifndef TASK_H #define TASK_H +#include "toolhelp.h" + +typedef HANDLE HGLOBAL; + typedef struct { - HANDLE hTask; - HANDLE hModule; + DWORD dwSize; + HTASK hTask; + HTASK hTaskParent; HINSTANCE hInst; + HMODULE hModule; + WORD wSS; + WORD wSP; + WORD wStackTop; + WORD wStackMinimum; + WORD wStackBottom; + WORD wcEvents; + HGLOBAL hQueue; + char szModule[MAX_MODULE_NAME + 1]; + WORD wPSPOffset; + HANDLE hNext; +} TASKENTRY; +typedef TASKENTRY *LPTASKENTRY; + +typedef struct { + TASKENTRY te; int unix_pid; HICON hIcon; HWND *lpWndList; void *lpPrevTask; void *lpNextTask; -} TASKENTRY; -typedef TASKENTRY *LPTASKENTRY; +} WINETASKENTRY; +typedef WINETASKENTRY *LPWINETASKENTRY; #define MAXWIN_PER_TASK 256 -HANDLE CreateNewTask(HINSTANCE hInst); +HANDLE CreateNewTask(HINSTANCE hInst, HTASK hTaskParent); BOOL RemoveWindowFromTask(HTASK hTask, HWND hWnd); BOOL AddWindowToTask(HTASK hTask, HWND hWnd); diff --git a/include/texts.h b/include/texts.h new file mode 100644 index 00000000000..343b399e8ac --- /dev/null +++ b/include/texts.h @@ -0,0 +1,26 @@ + +/* + * texts.h - String constants are read from Xresources/app-defaults + * (c) 1994 Jochen Hein ( Hein@Student.TU-Clausthal.de ) + */ + +/* + * Type-description for buttons + */ + +typedef struct tButtonDesc { + char *Label; /* Label of the Button */ + char Hotkey; /* Hotkey to press this Button */ +} ButtonDesc; + +typedef struct tButtonTexts { + ButtonDesc Yes; + ButtonDesc No; + ButtonDesc Ok; + ButtonDesc Cancel; + ButtonDesc Abort; + ButtonDesc Retry; + ButtonDesc Ignore; +} ButtonTexts; + + diff --git a/include/win.h b/include/win.h index 0a4a566f708..192863269cb 100644 --- a/include/win.h +++ b/include/win.h @@ -44,6 +44,7 @@ typedef struct tagWND HANDLE hdce; /* Window DCE (if CS_OWNDC or CS_CLASSDC) */ void *VScroll; /* Vertical ScrollBar Struct Pointer */ void *HScroll; /* Horizontal ScrollBar Struct Pointer */ + WORD scroll_flags; /* scrolls flags (vert & horz visible) */ WORD wIDmenu; /* ID or hmenu (from CreateWindow) */ HANDLE hText; /* Handle of window text */ WORD flags; /* Misc. flags (see below) */ diff --git a/include/windows.h b/include/windows.h index e4ca0e2b360..5281abd12ab 100644 --- a/include/windows.h +++ b/include/windows.h @@ -161,7 +161,7 @@ typedef PAINTSTRUCT *LPPAINTSTRUCT; #ifdef WINELIB typedef LONG (*WNDPROC)(HWND, UINT, WPARAM, LPARAM); #else -typedef LONG (* WNDPROC)() WINE_PACKED; +typedef LONG (* WNDPROC)(); #endif typedef struct { @@ -3008,7 +3008,7 @@ Fg(int,SetDIBits,HDC,a,HANDLE,a2,WORD,b,WORD,c,LPSTR,d,LPBITMAPINFO,e,WORD,f) Fg(BOOL,SetWindowPos,HWND,a,HWND,b,short,c,short,d,short,e,short,f,WORD,g) Fh(BOOL,ExtTextOut,HDC,a,short,b,short,c,WORD,d,LPRECT,e,LPSTR,f,WORD,g,LPINT,h) Fh(HANDLE,DeferWindowPos,HANDLE,hWinPosInfo,HWND,hWnd,HWND,hWndInsertAfter,int,x,int,y,int,cx,int,cy,WORD,wFlags) -Fh(LONG,TabbedTextOut,HDC,a,int,b,int,c,LPSTR,d,int,e,int,f,LPINT,g,int,h) +Fh(LONG,TabbedTextOut,HDC,a,short,b,short,c,LPSTR,d,short,e,short,f,LPINT,g,short,h) Fh(int,ScrollWindowEx,HWND,a,short,b,short,c,LPRECT,d,LPRECT,e,HRGN,f,LPRECT,g,WORD,h) Fi(BOOL,Arc,HDC,a,int,xLeft,int,yTop,int,xRight,int,yBottom,int,xStart,int,yStart,int,xEnd,int,yEnd) Fi(BOOL,Chord,HDC,a,int,xLeft,int,yTop,int,xRight,int,yBottom,int,xStart,int,yStart,int,xEnd,int,yEnd) diff --git a/loader/library.c b/loader/library.c index 02b74d2b536..21898e927f3 100644 --- a/loader/library.c +++ b/loader/library.c @@ -20,10 +20,14 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994"; #include "wine.h" #include "dlls.h" #include "task.h" +#include "toolhelp.h" extern struct w_files *wine_files; extern struct dll_name_table_entry_s dll_builtin_table[]; +struct w_files *GetFileInfo(HANDLE); +char *GetDosFileName(char *); + #define IS_BUILTIN_DLL(handle) ((handle >> 8) == 0xff) /**********************************************************************/ @@ -53,12 +57,17 @@ HANDLE GetModuleHandle(LPSTR lpModuleName) { register struct w_files *w = wine_files; int i; + char dllname[256]; + + if ((int) lpModuleName & 0xffff0000) + ExtractDLLName(lpModuleName, dllname); + if ((int) lpModuleName & 0xffff0000) printf("GetModuleHandle('%s');\n", lpModuleName); else printf("GetModuleHandle('%x');\n", lpModuleName); - printf("GetModuleHandle // searching in builtin libraries\n"); +/* 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) { @@ -68,7 +77,7 @@ HANDLE GetModuleHandle(LPSTR lpModuleName) return 0xFF00 + i; } } - else if (strcasecmp(dll_builtin_table[i].dll_name, lpModuleName) == 0) { + else if (strcasecmp(dll_builtin_table[i].dll_name, dllname) == 0) { printf("GetModuleHandle('%x') return %04X \n", lpModuleName, 0xFF00 + i); return (0xFF00 + i); @@ -85,7 +94,7 @@ HANDLE GetModuleHandle(LPSTR lpModuleName) return w->hinstance; } } - else if (strcasecmp(w->name, lpModuleName) == 0) { + else if (strcasecmp(w->name, dllname) == 0) { printf("GetModuleHandle('%s') return %04X \n", lpModuleName, w->hinstance); return w->hinstance; @@ -309,3 +318,97 @@ FARPROC GetProcAddress(HANDLE hModule, char *proc_name) #endif /* ifndef WINELIB */ +/* internal dlls */ +static void +FillModStructBuiltIn(MODULEENTRY *lpModule, struct dll_name_table_entry_s *dll) +{ + lpModule->dwSize = dll->dll_table_length * 1024; + strcpy(lpModule->szModule, dll->dll_name); + lpModule->hModule = 0xff00 + dll->dll_number; + lpModule->wcUsage = GetModuleUsage(lpModule->hModule); + GetModuleFileName(lpModule->hModule, lpModule->szExePath, MAX_PATH + 1); + lpModule->wNext = 0; +} + +/* loaded dlls */ +static void +FillModStructLoaded(MODULEENTRY *lpModule, struct w_files *dll) +{ + lpModule->dwSize = 16384; + strcpy(lpModule->szModule, dll->name); + lpModule->hModule = dll->hinstance; + lpModule->wcUsage = GetModuleUsage(lpModule->hModule); + GetModuleFileName(lpModule->hModule, lpModule->szExePath, MAX_PATH + 1); + lpModule->wNext = 0; +} + +/********************************************************************** + * ModuleFirst [TOOHELP.59] + */ +BOOL ModuleFirst(MODULEENTRY *lpModule) +{ + printf("ModuleFirst(%08X)\n", lpModule); + + FillModStructBuiltIn(lpModule, &dll_builtin_table[0]); + return TRUE; +} + +/********************************************************************** + * ModuleNext [TOOHELP.60] + */ +BOOL ModuleNext(MODULEENTRY *lpModule) +{ + struct w_files *w; + + printf("ModuleNext(%08X)\n", lpModule); + + if (IS_BUILTIN_DLL(lpModule->hModule)) { + /* last built-in ? */ + if ((lpModule->hModule & 0xff) == (N_BUILTINS - 1) ) { + if (wine_files) { + FillModStructLoaded(lpModule, wine_files); + return TRUE; + } else + return FALSE; + } + FillModStructBuiltIn(lpModule, &dll_builtin_table[(lpModule->hModule & 0xff)+1]); + return TRUE; + } + w = GetFileInfo(lpModule->hModule); + if (w->next) { + FillModStructLoaded(lpModule, w->next); + return TRUE; + } + return FALSE; +} + +/********************************************************************** + * ModuleFindHandle [TOOHELP.62] + */ +HMODULE ModuleFindHandle(MODULEENTRY *lpModule, HMODULE hModule) +{ + struct w_files *w; + + printf("ModuleFindHandle(%08X, %04X)\n", lpModule, hModule); + + /* built-in dll ? */ + if (IS_BUILTIN_DLL(hModule)) { + FillModStructBuiltIn(lpModule, &dll_builtin_table[hModule & 0xff]); + return hModule; + } + + /* check loaded dlls */ + if ((w = GetFileInfo(hModule)) == NULL) + return (HMODULE) NULL; + + FillModStructLoaded(lpModule, w); + return w->hinstance; +} + +/********************************************************************** + * ModuleFindName [TOOHELP.61] + */ +HMODULE ModuleFindName(MODULEENTRY *lpModule, LPCSTR lpstrName) +{ + return (ModuleFindHandle(lpModule, GetModuleHandle((char*)lpstrName))); +} diff --git a/loader/main.c b/loader/main.c index 119d00f3462..90ec7e516d9 100644 --- a/loader/main.c +++ b/loader/main.c @@ -132,7 +132,7 @@ HINSTANCE LoadImage(char *module, int filetype, int change_dir) char buffer[256], header[2], modulename[64], *fullname; ExtractDLLName(module, modulename); - + printf("%sLoadImage \n", module); /* built-in one ? */ if (FindDLLTable(modulename)) { return GetModuleHandle(modulename); @@ -212,7 +212,8 @@ HINSTANCE LoadImage(char *module, int filetype, int change_dir) 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) + if (wpnt->mz_header->must_be_0x40 != 0x40 && + wpnt->mz_header->must_be_0x40 != 0x1e) myerror("This is not a Windows program"); /* read first two bytes to determine filetype */ @@ -361,7 +362,8 @@ void InitializeLoadedDLLs(struct w_files *wpnt) { static flagReadyToRun = 0; struct w_files *final_wpnt; - struct w_files * wpnt; + + printf("InitializeLoadedDLLs %08X\n", wpnt); if (wpnt == NULL) { diff --git a/loader/selector.c b/loader/selector.c index b9b66bd5967..c2faab80227 100644 --- a/loader/selector.c +++ b/loader/selector.c @@ -823,6 +823,13 @@ CreateEnvironment(void) return s; } +/********************************************************************** + */ +WORD GetCurrentPDB() +{ + return PSPSelector; +} + /********************************************************************** * CreatePSP */ diff --git a/loader/signal.c b/loader/signal.c index 7e8bc0fff5b..861c04e7422 100644 --- a/loader/signal.c +++ b/loader/signal.c @@ -57,6 +57,7 @@ int do_int(int intnum, struct sigcontext_struct *scp) return 1; /* get base mem size */ case 0x15: return do_int15(scp); + case 0x16: return do_int16(scp); case 0x1A: return do_int1A(scp); case 0x21: return do_int21(scp); diff --git a/loader/task.c b/loader/task.c index 856f634c9d3..569c64bff6b 100644 --- a/loader/task.c +++ b/loader/task.c @@ -14,7 +14,7 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994"; #include "wine.h" #include "task.h" -static LPTASKENTRY lpTaskList = NULL; +static LPWINETASKENTRY lpTaskList = NULL; static int nTaskCount = 0; @@ -23,7 +23,7 @@ static int nTaskCount = 0; */ HTASK GetCurrentTask() { - LPTASKENTRY lpTask = lpTaskList; + LPWINETASKENTRY lpTask = lpTaskList; int pid = getpid(); #ifdef DEBUG_TASK printf("GetCurrentTask() // unix_pid=%08X !\n", pid); @@ -35,9 +35,9 @@ HTASK GetCurrentTask() lpTask = lpTask->lpNextTask; } #ifdef DEBUG_TASK - printf("GetCurrentTask() returned hTask=%04X !\n", lpTask->hTask); + printf("GetCurrentTask() returned hTask=%04X !\n", lpTask->te.hTask); #endif - return lpTask->hTask; + return lpTask->te.hTask; } @@ -58,7 +58,7 @@ HTASK GetWindowTask(HWND hWnd) { HWND *wptr; int count; - LPTASKENTRY lpTask = lpTaskList; + LPWINETASKENTRY lpTask = lpTaskList; printf("GetWindowTask(%04X) !\n", hWnd); while (lpTask != NULL) { wptr = lpTask->lpWndList; @@ -66,11 +66,11 @@ HTASK GetWindowTask(HWND hWnd) count = 0; while (++count < MAXWIN_PER_TASK) { printf("GetWindowTask // searching %04X %04X !\n", - lpTask->hTask, *(wptr)); + lpTask->te.hTask, *(wptr)); if (*(wptr) == hWnd) { printf("GetWindowTask(%04X) found hTask=%04X !\n", - hWnd, lpTask->hTask); - return lpTask->hTask; + hWnd, lpTask->te.hTask); + return lpTask->te.hTask; } wptr++; } @@ -89,10 +89,10 @@ BOOL EnumTaskWindows(HANDLE hTask, FARPROC lpEnumFunc, LONG lParam) HWND *wptr, hWnd; BOOL bRet; int count = 0; - LPTASKENTRY lpTask = lpTaskList; + LPWINETASKENTRY lpTask = lpTaskList; printf("EnumTaskWindows(%04X, %08X, %08X) !\n", hTask, lpEnumFunc, lParam); while (TRUE) { - if (lpTask->hTask == hTask) break; + if (lpTask->te.hTask == hTask) break; if (lpTask == NULL) { printf("EnumTaskWindows // hTask=%04X not found !\n", hTask); return FALSE; @@ -120,19 +120,19 @@ BOOL EnumTaskWindows(HANDLE hTask, FARPROC lpEnumFunc, LONG lParam) /********************************************************************** * CreateNewTask [internal] */ -HANDLE CreateNewTask(HINSTANCE hInst) +HANDLE CreateNewTask(HINSTANCE hInst, HTASK hTaskParent) { HANDLE hTask; - LPTASKENTRY lpTask = lpTaskList; - LPTASKENTRY lpNewTask; + LPWINETASKENTRY lpTask = lpTaskList; + LPWINETASKENTRY lpNewTask; if (lpTask != NULL) { while (TRUE) { if (lpTask->lpNextTask == NULL) break; lpTask = lpTask->lpNextTask; } } - hTask = GlobalAlloc(GMEM_MOVEABLE, sizeof(TASKENTRY)); - lpNewTask = (LPTASKENTRY) GlobalLock(hTask); + hTask = GlobalAlloc(GMEM_MOVEABLE, sizeof(WINETASKENTRY)); + lpNewTask = (LPWINETASKENTRY) GlobalLock(hTask); #ifdef DEBUG_TASK printf("CreateNewTask entry allocated %08X\n", lpNewTask); #endif @@ -143,13 +143,25 @@ HANDLE CreateNewTask(HINSTANCE hInst) } else { lpTask->lpNextTask = lpNewTask; + lpTask->te.hNext = lpNewTask->te.hTask; lpNewTask->lpPrevTask = lpTask; } lpNewTask->lpNextTask = NULL; lpNewTask->hIcon = 0; - lpNewTask->hModule = 0; - lpNewTask->hInst = hInst; - lpNewTask->hTask = hTask; + lpNewTask->te.dwSize = sizeof(TASKENTRY); + lpNewTask->te.hModule = 0; + lpNewTask->te.hInst = hInst; + lpNewTask->te.hTask = hTask; + lpNewTask->te.hTaskParent = hTaskParent; + lpNewTask->te.wSS = 0; + lpNewTask->te.wSP = 0; + lpNewTask->te.wStackTop = 0; + lpNewTask->te.wStackMinimum = 0; + lpNewTask->te.wStackBottom = 0; + lpNewTask->te.wcEvents = 0; + lpNewTask->te.hQueue = 0; + sprintf(lpNewTask->te.szModule, "TASK%04X", hInst); + lpNewTask->te.wPSPOffset = 0; lpNewTask->unix_pid = getpid(); lpNewTask->lpWndList = (HWND *) malloc(MAXWIN_PER_TASK * sizeof(HWND)); if (lpNewTask->lpWndList != NULL) @@ -171,12 +183,12 @@ BOOL AddWindowToTask(HTASK hTask, HWND hWnd) { HWND *wptr; int count = 0; - LPTASKENTRY lpTask = lpTaskList; + LPWINETASKENTRY lpTask = lpTaskList; #ifdef DEBUG_TASK printf("AddWindowToTask(%04X, %04X); !\n", hTask, hWnd); #endif while (TRUE) { - if (lpTask->hTask == hTask) break; + if (lpTask->te.hTask == hTask) break; if (lpTask == NULL) { printf("AddWindowToTask // hTask=%04X not found !\n", hTask); return FALSE; @@ -204,12 +216,12 @@ BOOL RemoveWindowFromTask(HTASK hTask, HWND hWnd) { HWND *wptr; int count = 0; - LPTASKENTRY lpTask = lpTaskList; + LPWINETASKENTRY lpTask = lpTaskList; #ifdef DEBUG_TASK printf("RemoveWindowToTask(%04X, %04X); !\n", hTask, hWnd); #endif while (TRUE) { - if (lpTask->hTask == hTask) break; + if (lpTask->te.hTask == hTask) break; if (lpTask == NULL) { printf("RemoveWindowFromTask // hTask=%04X not found !\n", hTask); return FALSE; diff --git a/memory/heap.c b/memory/heap.c index ceaa85b375c..734520a8f16 100644 --- a/memory/heap.c +++ b/memory/heap.c @@ -245,8 +245,24 @@ HEAP_Free(MDESC **free_list, void *block) * Validate pointer. */ m_free = (MDESC *) block - 1; - if (m_free->prev != m_free || m_free->next != m_free || - ((int) m_free & 0xffff0000) != ((int) *free_list & 0xffff0000)) + if (m_free->prev != m_free || m_free->next != m_free) + { +#ifdef DEBUG_HEAP + printf("Attempt to free bad pointer," + "m_free = %08x, *free_list = %08x\n", + m_free, free_list); +#endif + return -1; + } + + if (*free_list == NULL) + { + *free_list = m_free; + (*free_list)->next = NULL; + (*free_list)->prev = NULL; + return 0; + } + else if (((int) m_free & 0xffff0000) != ((int) *free_list & 0xffff0000)) { #ifdef DEBUG_HEAP printf("Attempt to free bad pointer," diff --git a/misc/main.c b/misc/main.c index ab3c2e75516..ae0d5c9f686 100644 --- a/misc/main.c +++ b/misc/main.c @@ -9,6 +9,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1994"; #include #include #include +#include #include #include #include @@ -17,6 +18,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1994"; #include "windows.h" #include "options.h" #include "prototypes.h" +#include "texts.h" #define WINE_CLASS "Wine" /* Class name for resources */ @@ -32,6 +34,7 @@ int screenDepth = 0; /* Screen depth to use */ int desktopX = 0, desktopY = 0; /* Desktop window position (if any) */ char *ProgramName; /* Used by resource.c with WINELIB */ +extern ButtonTexts ButtonText; struct options Options = { /* default options */ @@ -140,6 +143,54 @@ static int MAIN_GetResource( XrmDatabase db, char *name, XrmValue *value ) } +/*********************************************************************** + * MAIN_GetButtonText + * + * Fetch the value of resource 'name' using the correct instance name. + * 'name' must begin with '.' or '*' + * + * The address of the string got from the XResoure is stored in Button.Label. + * The corresponding hotkey is taken from this string. + */ + +static void MAIN_GetButtonText( XrmDatabase db, char *name, ButtonDesc *Button) +{ + XrmValue value; + char Hotkey; + char *i; + + if (MAIN_GetResource( db, name, &value)) + { + Button->Label = value.addr; + i = strchr(Button->Label,'&'); + if ( i == NULL ) + Button->Hotkey = '\0'; + else if ( i++ == '\0' ) + Button->Hotkey = '\0'; + else + Button->Hotkey = *i; + } + Button->Hotkey = toupper(Button->Hotkey); +} + +/*********************************************************************** + * MAIN_GetAllButtonTexts + * + * Read all Button-labels from X11-resources if they exist. + */ + +static void MAIN_GetAllButtonTexts(XrmDatabase db) +{ + MAIN_GetButtonText(db, ".YesLabel", &ButtonText.Yes); + MAIN_GetButtonText(db, ".NoLabel", &ButtonText.No); + MAIN_GetButtonText(db, ".OkLabel", &ButtonText.Ok); + MAIN_GetButtonText(db, ".CancelLabel", &ButtonText.Cancel); + MAIN_GetButtonText(db, ".AbortLabel", &ButtonText.Abort); + MAIN_GetButtonText(db, ".RetryLabel", &ButtonText.Retry); + MAIN_GetButtonText(db, ".IgnoreLabel", &ButtonText.Ignore); + MAIN_GetButtonText(db, ".CancelLabel", &ButtonText.Cancel); +} + /*********************************************************************** * MAIN_ParseOptions * @@ -152,10 +203,10 @@ static void MAIN_ParseOptions( int *argc, char *argv[] ) XrmDatabase db = NULL; /* Parse command line */ - Options.programName = MAIN_GetProgramName( *argc, argv ); XrmParseCommand( &db, optionsTable, NB_OPTIONS, Options.programName, argc, argv ); + #ifdef WINELIB /* Need to assemble command line and pass it to WinMain */ #else @@ -175,8 +226,10 @@ static void MAIN_ParseOptions( int *argc, char *argv[] ) exit(1); } - /* Get all options */ + /* Use app-defaults */ + display->db = db; + /* Get all options */ if (MAIN_GetResource( db, ".iconic", &value )) Options.cmdShow = SW_SHOWMINIMIZED; if (MAIN_GetResource( db, ".privatemap", &value )) @@ -197,6 +250,9 @@ static void MAIN_ParseOptions( int *argc, char *argv[] ) screenDepth = atoi( value.addr ); if (MAIN_GetResource( db, ".desktop", &value)) Options.desktopGeometry = value.addr; + +/* MAIN_GetAllButtonTexts(db); */ + } @@ -311,7 +367,9 @@ int main( int argc, char *argv[] ) int ret_val; int depth_count, i; int *depth_list; - + + setlocale(LC_CTYPE,""); + XrmInitialize(); MAIN_ParseOptions( &argc, argv ); diff --git a/misc/message.c b/misc/message.c index d9669b61822..825e2247cb3 100644 --- a/misc/message.c +++ b/misc/message.c @@ -19,6 +19,21 @@ static char Copyright[] = "Copyright Martin Ayotte, 1993"; #include "prototypes.h" #include "heap.h" #include "win.h" +#include "texts.h" + +/* + * Defaults for button-texts + */ + +ButtonTexts ButtonText = { + "&Yes", 'Y', + "&No", 'N', + "&Ok", 'O', + "&Cancel", 'C', + "&Abort", 'A', + "&Retry", 'R', + "&Ignore", 'I' +}; extern HINSTANCE hSysRes; extern HBITMAP hUpArrow; @@ -175,7 +190,7 @@ LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam) switch(message) { case WM_CREATE: #ifdef DEBUG_MSGBOX - printf("MessageBox WM_CREATE !\n"); + printf("MessageBox WM_CREATE hWnd=%04X !\n", hWnd); #endif wndPtr = WIN_FindWndPtr(hWnd); createStruct = (CREATESTRUCT *)lParam; @@ -191,55 +206,55 @@ LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam) lpmb->rectStr.bottom -= 32; switch(lpmb->wType & MB_TYPEMASK) { case MB_OK : - lpmb->hWndYes = CreateWindow("BUTTON", "&Ok", + lpmb->hWndYes = CreateWindow("BUTTON", ButtonText.Ok.Label, WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON, rect.right / 2 - 30, rect.bottom - 25, 60, 18, hWnd, IDOK, wndPtr->hInstance, 0L); break; case MB_OKCANCEL : - lpmb->hWndYes = CreateWindow("BUTTON", "&Ok", + lpmb->hWndYes = CreateWindow("BUTTON", ButtonText.Ok.Label, WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON, rect.right / 2 - 65, rect.bottom - 25, 60, 18, hWnd, IDOK, wndPtr->hInstance, 0L); - lpmb->hWndCancel = CreateWindow("BUTTON", "&Cancel", + lpmb->hWndCancel = CreateWindow("BUTTON", ButtonText.Cancel.Label, WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON, rect.right / 2 + 5, rect.bottom - 25, 60, 18, hWnd, IDCANCEL, wndPtr->hInstance, 0L); break; case MB_ABORTRETRYIGNORE : - lpmb->hWndYes = CreateWindow("BUTTON", "&Retry", + lpmb->hWndYes = CreateWindow("BUTTON", ButtonText.Retry.Label, WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON, rect.right / 2 - 100, rect.bottom - 25, 60, 18, hWnd, IDRETRY, wndPtr->hInstance, 0L); - lpmb->hWndNo = CreateWindow("BUTTON", "&Ignore", + lpmb->hWndNo = CreateWindow("BUTTON", ButtonText.Ignore.Label, WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON, rect.right / 2 - 30, rect.bottom - 25, 60, 18, hWnd, IDIGNORE, wndPtr->hInstance, 0L); - lpmb->hWndCancel = CreateWindow("BUTTON", "&Abort", + lpmb->hWndCancel = CreateWindow("BUTTON", ButtonText.Abort.Label, WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON, rect.right / 2 + 40, rect.bottom - 25, 60, 18, hWnd, IDABORT, wndPtr->hInstance, 0L); break; case MB_YESNO : - lpmb->hWndYes = CreateWindow("BUTTON", "&Yes", + lpmb->hWndYes = CreateWindow("BUTTON", ButtonText.Yes.Label, WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON, rect.right / 2 - 65, rect.bottom - 25, 60, 18, hWnd, IDYES, wndPtr->hInstance, 0L); - lpmb->hWndNo = CreateWindow("BUTTON", "&No", + lpmb->hWndNo = CreateWindow("BUTTON", ButtonText.No.Label, WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON, rect.right / 2 + 5, rect.bottom - 25, 60, 18, hWnd, IDNO, wndPtr->hInstance, 0L); break; case MB_YESNOCANCEL : - lpmb->hWndYes = CreateWindow("BUTTON", "&Yes", + lpmb->hWndYes = CreateWindow("BUTTON", ButtonText.Yes.Label, WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON, rect.right / 2 - 100, rect.bottom - 25, 60, 18, hWnd, IDYES, wndPtr->hInstance, 0L); - lpmb->hWndNo = CreateWindow("BUTTON", "&No", + lpmb->hWndNo = CreateWindow("BUTTON", ButtonText.No.Label, WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON, rect.right / 2 - 30, rect.bottom - 25, 60, 18, hWnd, IDNO, wndPtr->hInstance, 0L); - lpmb->hWndCancel = CreateWindow("BUTTON", "&Cancel", + lpmb->hWndCancel = CreateWindow("BUTTON", ButtonText.Cancel.Label, WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON, rect.right / 2 + 40, rect.bottom - 25, 60, 18, hWnd, IDCANCEL, wndPtr->hInstance, 0L); @@ -271,6 +286,9 @@ LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam) } break; case WM_SHOWWINDOW: +#ifdef DEBUG_MSGBOX + printf("MessageBox WM_SHOWWINDOW hWnd=%04X !\n", hWnd); +#endif if (!(wParam == 0 && lParam == 0L)) { InvalidateRect(hWnd, NULL, TRUE); } @@ -281,7 +299,12 @@ LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam) #endif lpmb = MsgBoxGetStorageHeader(hWnd); if (lpmb == NULL) break; + if (!lpmb->ActiveFlg) break; hDC = BeginPaint(hWnd, &ps); + if (hDC == 0) { + printf("MessageBox WM_PAINT // BeginPaint returned BAD hDC !\n"); + break; + } GetClientRect(hWnd, &rect); FillRect(hDC, &rect, GetStockObject(WHITE_BRUSH)); CopyRect(&rect, &lpmb->rectStr); @@ -307,7 +330,6 @@ LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam) ReleaseCapture(); lpmb = MsgBoxGetStorageHeader(hWnd); if (lpmb == NULL) break; - lpmb->ActiveFlg = FALSE; if (lpmb->hIcon) DestroyIcon(lpmb->hIcon); if (lpmb->hWndYes) DestroyWindow(lpmb->hWndYes); if (lpmb->hWndNo) DestroyWindow(lpmb->hWndNo); @@ -315,6 +337,7 @@ LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam) #ifdef DEBUG_MSGBOX printf("MessageBox WM_DESTROY end !\n"); #endif + lpmb->ActiveFlg = FALSE; break; case WM_COMMAND: lpmb = MsgBoxGetStorageHeader(hWnd); @@ -328,36 +351,28 @@ LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam) break; case WM_CHAR: lpmb = MsgBoxGetStorageHeader(hWnd); +/* if (wParam >= 'a' || wParam <= 'z') wParam -= 'a' - 'A'; */ + wParam = toupper(wParam); + if (wParam == ButtonText.Yes.Hotkey) + lpmb->wRetVal = IDYES; + else if (wParam == ButtonText.Ok.Hotkey) + lpmb->wRetVal = IDOK; + else if (wParam == ButtonText.Retry.Hotkey) + lpmb->wRetVal = IDRETRY; + else if (wParam == ButtonText.Abort.Hotkey) + lpmb->wRetVal = IDABORT; + else if (wParam == ButtonText.No.Hotkey) + lpmb->wRetVal = IDNO; + else if (wParam == ButtonText.Ignore.Hotkey) + lpmb->wRetVal = IDIGNORE; + else if ((wParam == ButtonText.Ok.Hotkey) || (wParam == VK_ESCAPE)) + lpmb->wRetVal = IDCANCEL; + else + return 0; if (lpmb == NULL) break; - if (wParam >= 'a' || wParam <= 'z') wParam -= 'a' - 'A'; - switch(wParam) { - case 'Y': - lpmb->wRetVal = IDYES; - break; - case 'O': - lpmb->wRetVal = IDOK; - break; - case 'R': - lpmb->wRetVal = IDRETRY; - break; - case 'A': - lpmb->wRetVal = IDABORT; - break; - case 'N': - lpmb->wRetVal = IDNO; - break; - case 'I': - lpmb->wRetVal = IDIGNORE; - break; - case 'C': - case VK_ESCAPE: - lpmb->wRetVal = IDCANCEL; - break; - default: - return 0; - } - PostMessage(hWnd, WM_CLOSE, 0, 0L); - break; + ShowWindow(hWnd, SW_HIDE); + PostMessage(hWnd, WM_CLOSE, 0, 0L); + break; default: return DefWindowProc(hWnd, message, wParam, lParam ); } diff --git a/misc/network.c b/misc/network.c index 60a4bb34ba6..779d6aad093 100644 --- a/misc/network.c +++ b/misc/network.c @@ -42,6 +42,14 @@ int WNetGetConnection(LPSTR lpLocalName, return WN_NET_ERROR; } +/************************************************************************** + * WNetGetCaps [USER.513] + */ +int WNetGetCaps(WORD capability) +{ + return 0; +} + /************************************************************************** * WNetGetUser [USER.516] */ diff --git a/miscemu/Imakefile b/miscemu/Imakefile index 65c043fb4cc..27798bbe358 100644 --- a/miscemu/Imakefile +++ b/miscemu/Imakefile @@ -6,6 +6,7 @@ SRCS = \ emulate.c \ int10.c \ int15.c \ + int16.c \ int1a.c \ int21.c \ int25.c \ diff --git a/miscemu/int16.c b/miscemu/int16.c new file mode 100644 index 00000000000..88ff49d4ce6 --- /dev/null +++ b/miscemu/int16.c @@ -0,0 +1,16 @@ +#include +#include +#include "msdos.h" +#include "wine.h" + +int do_int16(struct sigcontext_struct *context) +{ + switch((context->sc_eax >> 8) & 0xff) + { + case 0xc0: + + default: + IntBarf(0x16, context); + }; + return 1; +} diff --git a/miscemu/int25.c b/miscemu/int25.c index 89d188de34f..9a9a366aec6 100644 --- a/miscemu/int25.c +++ b/miscemu/int25.c @@ -11,9 +11,7 @@ int do_int25(struct sigcontext_struct *context) if( (ECX & 0xffff) == 0xffff) { begin = getdword(dataptr); - length = getword(&dataptr[4]); - dataptr = (BYTE *) getdword(&dataptr[6]); } else { @@ -23,6 +21,19 @@ int do_int25(struct sigcontext_struct *context) fprintf(stderr, "int25: abs diskread, drive %d, sector %d, " "count %d, buffer %d\n", EAX & 0xff, begin, length, (int) dataptr); + memset(dataptr, 0, length * 512); + + if (begin == 0 && length > 1) + *(dataptr + 512) = 0xf8; + + if (begin == 1) + *dataptr = 0xf8; + ResetCflag; + + /* push flags on stack */ + SP -= sizeof(WORD); + setword(pointer(SS,SP), (WORD) EFL); + return 1; } diff --git a/miscemu/int26.c b/miscemu/int26.c index 5fb86a399a3..0308d376973 100644 --- a/miscemu/int26.c +++ b/miscemu/int26.c @@ -23,5 +23,10 @@ int do_int26(struct sigcontext_struct *context) " buffer %d\n", EAX & 0xff, begin, length, (int) dataptr); ResetCflag; + + /* push flags on stack */ + SP -= sizeof(WORD); + setword(pointer(SS,SP), (WORD) EFL); + return 1; } diff --git a/miscemu/int2f.c b/miscemu/int2f.c index 8c50267ccbe..0a7d14e6076 100644 --- a/miscemu/int2f.c +++ b/miscemu/int2f.c @@ -5,11 +5,21 @@ int do_int2f(struct sigcontext_struct *context) { - switch(context->sc_eax & 0xffff) + switch((context->sc_eax >> 8) & 0xff) { - case 0x1600: /* windows enhanced mode install check */ - /* don't return anything as we're running in standard mode */ - break; + case 0x15: /* mscdex */ + /* ignore requests */ + return 1; + + case 0x16: + switch(context->sc_eax & 0xff) + { + case 0x00: /* windows enhanced mode install check */ + /* don't return anything as we're running in standard mode */ + return 1; + + default: + } default: IntBarf(0x2f, context); diff --git a/objects/font.c b/objects/font.c index 5963b96ceb5..fba3ab2ee15 100644 --- a/objects/font.c +++ b/objects/font.c @@ -47,7 +47,8 @@ static XFontStruct * FONT_MatchFont( LOGFONT * font ) case FF_DECORATIVE: family = "*"; break; default: family = "*"; break; } - AnsiLower(family); + else + AnsiLower(family); while (TRUE) { /* Width==0 seems not to be a valid wildcard on SGI's, using * instead */ @@ -111,7 +112,7 @@ void FONT_GetMetrics( LOGFONT * logfont, XFontStruct * xfont, metrics->tmDigitizedAspectX = 1; metrics->tmDigitizedAspectY = 1; - if (xfont->per_char) average = metrics->tmMaxCharWidth; + if (!xfont->per_char) average = metrics->tmMaxCharWidth; else { XCharStruct * charPtr = xfont->per_char; diff --git a/objects/gdiobj.c b/objects/gdiobj.c index 4f7fa670dae..7937282c4a6 100644 --- a/objects/gdiobj.c +++ b/objects/gdiobj.c @@ -553,3 +553,17 @@ int EnumObjects(HDC hDC, int nObjType, FARPROC lpEnumFunc, LPSTR lpData) printf("EnumObjects // End of enumeration !\n"); return 0; } + +/*********************************************************************** + * IsGDIObject(GDI.462) + */ +BOOL IsGDIObject(HANDLE handle) +{ + GDIOBJHDR *object; + + object = (GDIOBJHDR *) GDI_HEAP_ADDR( handle ); + if (object) + return TRUE; + else + return FALSE; +} diff --git a/objects/text.c b/objects/text.c index d4448a9605e..53c5bb0b636 100644 --- a/objects/text.c +++ b/objects/text.c @@ -421,6 +421,21 @@ BOOL GrayString(HDC hdc, HBRUSH hbr, FARPROC gsprc, LPARAM lParam, } } +/*********************************************************************** + * TabbedTextOut [USER.196] + */ +LONG TabbedTextOut(HDC hDC, short x, short y, LPSTR lpStr, short nCount, + short nTabCount, LPINT lpTabPos, short nTabOrg) +{ + WORD width, height; + printf("EMPTY STUB !!! TabbedTextOut(); ! call TextOut() for now !\n"); + height = HIWORD(GetTextExtent(hDC, lpStr, nCount)); + width = LOWORD(GetTextExtent(hDC, lpStr, nCount)); + TextOut(hDC, x, y, lpStr, nCount); + return MAKELONG(width, height); +} + + /*********************************************************************** * ExtTextOut [GDI.351] */ @@ -432,3 +447,4 @@ BOOL ExtTextOut(HDC hDC, short x, short y, WORD wOptions, LPRECT lprect, return FALSE; } + diff --git a/windows/event.c b/windows/event.c index 861f95fc2c5..b873befc71b 100644 --- a/windows/event.c +++ b/windows/event.c @@ -35,6 +35,7 @@ static XContext winContext = 0; /* State variables */ BOOL MouseButtonsStates[NB_BUTTONS] = { FALSE, FALSE, FALSE }; BOOL AsyncMouseButtonsStates[NB_BUTTONS] = { FALSE, FALSE, FALSE }; +BYTE KeyStateTable[256]; static WORD ALTKeyState; static HWND captureWnd = 0; Window winHasCursor = 0; @@ -164,6 +165,16 @@ void EVENT_ProcessEvent( XEvent *event ) break; case MotionNotify: + /* Wine between two fast machines across the overloaded campus + ethernet gets very boged down in MotionEvents. The following + simply finds the last motion event in the queue and drops + the rest. On a good link events are servered before they build + up so this doesn't take place. On a slow link this may cause + problems if the event order is important. I'm not yet seen + of any problems. Jon 7/6/96. + */ + while (XCheckTypedWindowEvent(display, ((XAnyEvent *)event)->window, + MotionNotify, event)); EVENT_MotionNotify( (XMotionEvent*)event ); break; @@ -310,6 +321,7 @@ static void EVENT_key( HWND hwnd, XKeyEvent *event ) if (event->type == KeyPress) { if (vkey == VK_MENU) ALTKeyState = TRUE; + KeyStateTable[vkey] = 1; keylp.lp1.count = 1; keylp.lp1.code = LOBYTE(event->keycode); keylp.lp1.extended = (extended ? 1 : 0); @@ -341,6 +353,7 @@ static void EVENT_key( HWND hwnd, XKeyEvent *event ) else { if (vkey == VK_MENU) ALTKeyState = FALSE; + KeyStateTable[vkey] = 1; keylp.lp1.count = 1; keylp.lp1.code = LOBYTE(event->keycode); keylp.lp1.extended = (extended ? 1 : 0); @@ -462,6 +475,7 @@ HWND SetCapture(HWND wnd) if (rv == GrabSuccess) { + winHasCursor = wnd_p->window; captureWnd = wnd; return old_capture_wnd; } diff --git a/windows/graphics.c b/windows/graphics.c index 4a1abe13535..dda491a1df2 100644 --- a/windows/graphics.c +++ b/windows/graphics.c @@ -673,24 +673,31 @@ static BOOL FloodFill_rec(XImage *image, int x, int y, if (x > endx || x < orgx || y > endy || y < orgy) return FALSE; XPutPixel(image, x, y, fillp); - - testp = XGetPixel(image, x+1, y+1); - if (testp != borderp && testp != fillp) - FloodFill_rec(image, x+1, y+1, orgx, orgy, - endx, endy, borderp, fillp); - - testp = XGetPixel(image, x+1, y-1); - if (testp != borderp && testp != fillp) + + if ((x+1 <= endx) && (y+1 <= endy)) { + testp = XGetPixel(image, x+1, y+1); + if (testp != borderp && testp != fillp) + FloodFill_rec(image, x+1, y+1, orgx, orgy, + endx, endy, borderp, fillp); + } + if ((x+1 <= endx) && (y-1 >= orgy)) { + testp = XGetPixel(image, x+1, y-1); + if (testp != borderp && testp != fillp) FloodFill_rec(image, x+1, y-1, orgx, orgy, endx, endy, borderp, fillp); - testp = XGetPixel(image, x-1, y+1); - if (testp != borderp && testp != fillp) - FloodFill_rec(image, x-1, y+1, orgx, orgy, - endx, endy, borderp, fillp); - testp = XGetPixel(image, x-1, y-1); - if (testp != borderp && testp != fillp) - FloodFill_rec(image, x-1, y-1, orgx, orgy, - endx, endy, borderp, fillp); + } + if ((x-1 >= orgx) && (y+1 <= endy)) { + testp = XGetPixel(image, x-1, y+1); + if (testp != borderp && testp != fillp) + FloodFill_rec(image, x-1, y+1, orgx, orgy, + endx, endy, borderp, fillp); + } + if ((x-1 >= orgx) && (y-1 >= orgy)) { + testp = XGetPixel(image, x-1, y-1); + if (testp != borderp && testp != fillp) + FloodFill_rec(image, x-1, y-1, orgx, orgy, + endx, endy, borderp, fillp); + } return TRUE; } @@ -737,8 +744,8 @@ BOOL FloodFill(HDC hdc, short x, short y, DWORD crColor) return FALSE; if (!FloodFill_rec(image, x, y, 0, 0, - dc->w.DCOrgX + dc->w.DCSizeX, - dc->w.DCOrgY + dc->w.DCSizeY, + dc->w.DCSizeX-1, + dc->w.DCSizeY-1, boundrypixel, dc->u.x.brush.pixel)) { XDestroyImage(image); return FALSE; diff --git a/windows/keyboard.c b/windows/keyboard.c index ffa57779447..bdde31ebf67 100644 --- a/windows/keyboard.c +++ b/windows/keyboard.c @@ -11,9 +11,10 @@ static char Copyright[] = "Copyright Bob Amstadt, 1993"; extern BOOL MouseButtonsStates[3]; extern BOOL AsyncMouseButtonsStates[3]; +extern BYTE KeyStateTable[256]; /********************************************************************** - * GetKeyState (USER.106) + * GetKeyState [USER.106] */ int GetKeyState(int keycode) { @@ -29,6 +30,15 @@ int GetKeyState(int keycode) } } +/********************************************************************** + * GetKeyboardState [USER.222] + */ +void GetKeyboardState(BYTE FAR *lpKeyState) +{ + if (lpKeyState != NULL) { + memcpy(lpKeyState, KeyStateTable, 256); + } +} /********************************************************************** * diff --git a/windows/mdi.c b/windows/mdi.c index 00c02f129f2..08f45bba119 100644 --- a/windows/mdi.c +++ b/windows/mdi.c @@ -14,7 +14,7 @@ #include "sysmetrics.h" #include "menu.h" -/* #define DEBUG_MDI /* */ +#define DEBUG_MDI /* */ /********************************************************************** * MDIRecreateMenuList @@ -683,32 +683,37 @@ LONG DefFrameProc(HWND hwnd, HWND hwndMDIClient, WORD message, WORD wParam, LONG lParam) { - switch (message) + if (hwndMDIClient) { - case WM_COMMAND: - MDIBringChildToTop(hwndMDIClient, wParam, TRUE, FALSE); - break; + switch (message) + { + case WM_COMMAND: + MDIBringChildToTop(hwndMDIClient, wParam, TRUE, FALSE); + break; - case WM_NCLBUTTONDOWN: - if (MDIHandleLButton(hwnd, hwndMDIClient, wParam, lParam)) - return 0; - break; + case WM_NCLBUTTONDOWN: + if (MDIHandleLButton(hwnd, hwndMDIClient, wParam, lParam)) + return 0; + break; + + case WM_NCACTIVATE: + SendMessage(hwndMDIClient, message, wParam, lParam); + return MDIPaintMaximized(hwnd, hwndMDIClient, + message, wParam, lParam); - case WM_NCACTIVATE: - SendMessage(hwndMDIClient, message, wParam, lParam); - return MDIPaintMaximized(hwnd, hwndMDIClient, message, wParam, lParam); - - case WM_NCPAINT: - return MDIPaintMaximized(hwnd, hwndMDIClient, message, wParam, lParam); + case WM_NCPAINT: + return MDIPaintMaximized(hwnd, hwndMDIClient, + message, wParam, lParam); - case WM_SETFOCUS: - SendMessage(hwndMDIClient, WM_SETFOCUS, wParam, lParam); - break; - - case WM_SIZE: - MoveWindow(hwndMDIClient, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE); - break; + case WM_SETFOCUS: + SendMessage(hwndMDIClient, WM_SETFOCUS, wParam, lParam); + break; + case WM_SIZE: + MoveWindow(hwndMDIClient, 0, 0, + LOWORD(lParam), HIWORD(lParam), TRUE); + break; + } } return DefWindowProc(hwnd, message, wParam, lParam); diff --git a/windows/nonclient.c b/windows/nonclient.c index d8fedc0b567..e31a8752d3d 100644 --- a/windows/nonclient.c +++ b/windows/nonclient.c @@ -599,22 +599,24 @@ void NC_DoNCPaint( HWND hwnd, HRGN hrgn, BOOL active, BOOL suppress_menupaint ) 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) { + printf("NC_DoNCPaint // menubar changed oldHeight=%d != lpMenu->Height=%d\n", + oldHeight, lpMenu->Height); /* Reduce ClientRect according to MenuBar height */ wndPtr->rectClient.top -= oldHeight; wndPtr->rectClient.top += lpMenu->Height; } + GlobalUnlock(wndPtr->wIDmenu); } } if (wndPtr->dwStyle & (WS_VSCROLL | WS_HSCROLL)) { - if (wndPtr->dwStyle & WS_VSCROLL) { + if ((wndPtr->dwStyle & WS_VSCROLL) && (wndPtr->VScroll != NULL) && + (wndPtr->scroll_flags & 0x0001)) { int bottom = rect.bottom; - if (wndPtr->dwStyle & WS_HSCROLL) bottom -= SYSMETRICS_CYHSCROLL; + if ((wndPtr->dwStyle & WS_HSCROLL) && (wndPtr->scroll_flags & 0x0001)) + bottom -= SYSMETRICS_CYHSCROLL; SetRect(&rect2, rect.right - SYSMETRICS_CXVSCROLL, rect.top, rect.right, bottom); if (wndPtr->dwStyle & WS_CAPTION) rect.top += SYSMETRICS_CYSIZE; @@ -622,21 +624,23 @@ void NC_DoNCPaint( HWND hwnd, HRGN hrgn, BOOL active, BOOL suppress_menupaint ) rect2.top += SYSMETRICS_CYMENU + 1; StdDrawScrollBar(hwnd, hdc, SB_VERT, &rect2, (LPHEADSCROLL)wndPtr->VScroll); } - if (wndPtr->dwStyle & WS_HSCROLL) { + if ((wndPtr->dwStyle & WS_HSCROLL) && wndPtr->HScroll != NULL && + (wndPtr->scroll_flags & 0x0002)) { int right = rect.right; - if (wndPtr->dwStyle & WS_VSCROLL) right -= SYSMETRICS_CYVSCROLL; + if ((wndPtr->dwStyle & WS_VSCROLL) && (wndPtr->scroll_flags & 0x0001)) + right -= SYSMETRICS_CYVSCROLL; SetRect(&rect2, rect.left, rect.bottom - SYSMETRICS_CYHSCROLL, right, rect.bottom); StdDrawScrollBar(hwnd, hdc, SB_HORZ, &rect2, (LPHEADSCROLL)wndPtr->HScroll); } - if ((wndPtr->dwStyle & WS_VSCROLL) && (wndPtr->dwStyle & WS_HSCROLL)) - { - RECT r = rect; - r.left = r.right - SYSMETRICS_CXVSCROLL; - r.top = r.bottom - SYSMETRICS_CYHSCROLL; - FillRect( hdc, &r, sysColorObjects.hbrushScrollbar ); - } + if ((wndPtr->dwStyle & WS_VSCROLL) && (wndPtr->dwStyle & WS_HSCROLL) && + (wndPtr->scroll_flags & 0x0003) == 0x0003) { + RECT r = rect; + r.left = r.right - SYSMETRICS_CXVSCROLL; + r.top = r.bottom - SYSMETRICS_CYHSCROLL; + FillRect( hdc, &r, sysColorObjects.hbrushScrollbar ); + } } ReleaseDC( hwnd, hdc ); diff --git a/windows/win.c b/windows/win.c index 1f0a8f74b66..041c2274c01 100644 --- a/windows/win.c +++ b/windows/win.c @@ -201,6 +201,7 @@ BOOL WIN_CreateDesktopWindow() wndPtr->hdce = 0; wndPtr->VScroll = NULL; wndPtr->HScroll = NULL; + wndPtr->scroll_flags = 0; wndPtr->wIDmenu = 0; wndPtr->hText = 0; wndPtr->flags = 0; @@ -318,6 +319,7 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName, wndPtr->flags = 0; wndPtr->VScroll = NULL; wndPtr->HScroll = NULL; + wndPtr->scroll_flags = 0; wndPtr->hSysMenu = 0; wndPtr->hProp = 0; wndPtr->hTask = 0; @@ -692,8 +694,11 @@ LONG SetWindowLong( HWND hwnd, short offset, LONG newval ) else switch(offset) { case GWL_STYLE: ptr = &wndPtr->dwStyle; + break; case GWL_EXSTYLE: ptr = &wndPtr->dwExStyle; + break; case GWL_WNDPROC: ptr = (LONG *)(&wndPtr->lpfnWndProc); + break; default: return 0; } retval = *ptr;