Release 940510

May 9, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)

	* [controls/scroll.c]
	Make thumbtrack button disappear if scroll box ratio < 3:1.
	Make arrow buttons rectangular if scroll box ratio < 2:1.
	Add code for SBS_TOPALIGN, SBS_BOTTOMALIGN, 
				SBS_LEFTALIGN & SBS_RIGHTALIGN.
	Bug fix in NC_CreateScrollBars(), no more bigbutt in calendar.exe... :-)

	* [loader/library.c] [loader/task.c] [misc/exec.c]
	Continue playing around trying to get a second task running.

	* [windows/mdi.c]
	Change OBM_CLOSE for OBM_OLD_CLOSE, a smaller dot button when maximized.

	* [everywhere]
	Adding previous works of the Apr 25, 94.

Tue May 10 18:09:14 1994 Erik Bos (erik@trashcan.hacktic.nl)

	* [if1632/mmsystem.spec] [misc/mmsystem.c] [include/mmsystem.h]
	Added Martin's mmsystem.dll stubs.

	* [misc/sound.c]
	Added remaining stubs for sound.dll.

	* [if1632/shell.spec] [misc/shell.c]
	Fixed prototypes (I found them in BC 4) and added ShellAbout()
	and AboutDlgProc().
This commit is contained in:
Alexandre Julliard 1994-05-11 12:18:19 +00:00
parent 1d62f6b9c2
commit d18872de33
45 changed files with 1349 additions and 572 deletions

View File

@ -1,3 +1,34 @@
----------------------------------------------------------------------
May 9, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [controls/scroll.c]
Make thumbtrack button disappear if scroll box ratio < 3:1.
Make arrow buttons rectangular if scroll box ratio < 2:1.
Add code for SBS_TOPALIGN, SBS_BOTTOMALIGN,
SBS_LEFTALIGN & SBS_RIGHTALIGN.
Bug fix in NC_CreateScrollBars(), no more bigbutt in calendar.exe... :-)
* [loader/library.c] [loader/task.c] [misc/exec.c]
Continue playing around trying to get a second task running.
* [windows/mdi.c]
Change OBM_CLOSE for OBM_OLD_CLOSE, a smaller dot button when maximized.
* [everywhere]
Adding previous works of the Apr 25, 94.
Tue May 10 18:09:14 1994 Erik Bos (erik@trashcan.hacktic.nl)
* [if1632/mmsystem.spec] [misc/mmsystem.c] [include/mmsystem.h]
Added Martin's mmsystem.dll stubs.
* [misc/sound.c]
Added remaining stubs for sound.dll.
* [if1632/shell.spec] [misc/shell.c]
Fixed prototypes (I found them in BC 4) and added ShellAbout()
and AboutDlgProc().
---------------------------------------------------------------------- ----------------------------------------------------------------------
May 1, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) May 1, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
@ -39,7 +70,42 @@ Wed Apr 20 23:58:58 1994 Scott A. Laird (scott@curly)
path when given a simple file name. Fixed GetSetProfile to allow path when given a simple file name. Fixed GetSetProfile to allow
enumerating all key names when KeyName is null. enumerating all key names when KeyName is null.
Apr 25, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [objects/bitblt.c]
Add protection to BitBlt() & StretchBlt() for width or height = 0.
* [windows/nonclient.c]
Avoid painting in NC_DoNCPaint() if IsWindowVisible().
Simplify NC_TrackMouseMenuBar() because code moved to MenuFocusLoop().
* [windows/win.c]
CreateWindowEx() & DestroyWindow() now call respectively
AddWindowToTask() & RemoveWindowFromTask().
New empty stub for function AnyPopup().
* [loader/library.c]
Bug Fix : GetModuleFileName() now return full path filename.
* [include/menu.h] [controls/menu.c]
Add hText handle and remove obsolete MENUITEM struct members.
Add a ReleaseCapture() in SetMenu() when menubar changed while captured.
Add MenuMouseMove() MenuButtonUp() in function MenuFocusLoop().
* [misc/file.c]
GetTempFilename() now create a file.
_lcreate() use unix open (name, mode, perm), with perm=O666.
* [if1632/relay.c]
Remove temporarly builtin SHELL.DLL, Add MMSYSTEM.DLL in builtin list.
* New file [misc/mmsystem.c]
* New file [include/mmsystem.h]
* New file [if1632/mmsystem.spec]
Many, many empty stubs ... :-)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Wed Apr 20 14:53:35 1994 Bob Amstadt (bob@pooh) Wed Apr 20 14:53:35 1994 Bob Amstadt (bob@pooh)
* [tools/build.c] [if1632/call.S] [if1632/Imakefile] * [tools/build.c] [if1632/call.S] [if1632/Imakefile]
@ -68,8 +134,6 @@ Apr 18, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
Move functions GetWindowTask(), GetNumTask(), EnumTaskWindows() Move functions GetWindowTask(), GetNumTask(), EnumTaskWindows()
from 'loader/library.c'. from 'loader/library.c'.
* [loader/library.c]
* [if1632/user.c] [if1632/kernel.c] * [if1632/user.c] [if1632/kernel.c]
Put Atoms functions entries. Put Atoms functions entries.

View File

@ -1,7 +1,7 @@
#include "autoconf.h" #include "autoconf.h"
#include "Wine.tmpl" #include "Wine.tmpl"
#if defined(i386FreeBsd) #if defined(i386FreeBsd) || defined(FreeBSDArchitecture)
MAKE = gmake MAKE = gmake
CC = gcc -D__FreeBSD__ CC = gcc -D__FreeBSD__
#endif #endif
@ -77,7 +77,7 @@ OBJS = $(COMMONOBJS) $(LIBOBJS)
#ifdef i386BsdArchitecture #ifdef i386BsdArchitecture
SYSLIBS = -ll -lm -li386 -lgnumalloc SYSLIBS = -ll -lm -li386 -lgnumalloc
#endif #endif
#ifdef i386FreeBsd #if defined(i386FreeBsd) || defined(FreeBSDArchitecture)
SYSLIBS = -ll -lm -lgnumalloc SYSLIBS = -ll -lm -lgnumalloc
#endif #endif
#ifdef LinuxArchitecture #ifdef LinuxArchitecture

6
README
View File

@ -171,6 +171,12 @@ bob@amscons.com
7. WHAT'S NEW 7. WHAT'S NEW
WHAT'S NEW with Wine-940510: (see ChangeLog for details)
- debugger improvements
- mmsystem
- ShellAbout() and AboutDlgProc()
- and many many bug fixes!
WHAT'S NEW with Wine-940505: (see ChangeLog for details) WHAT'S NEW with Wine-940505: (see ChangeLog for details)
- faster color_stretch() - faster color_stretch()
- SetSysMenu(), GetCursor(), GetDesktopWindow() - SetSysMenu(), GetCursor(), GetDesktopWindow()

View File

@ -5,6 +5,7 @@
* *
*/ */
#define DEBUG_COMBO
/* /*
#define DEBUG_COMBO #define DEBUG_COMBO
*/ */
@ -66,7 +67,8 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
if (wndPtr->dwStyle & CBS_SIMPLE) if (wndPtr->dwStyle & CBS_SIMPLE)
lphc->hWndEdit = CreateWindow("EDIT", "", /* lphc->hWndEdit = CreateWindow("EDIT", "", */
lphc->hWndEdit = CreateWindow("STATIC", "",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | SS_LEFT, WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | SS_LEFT,
0, 0, width - bm.bmHeight, bm.bmHeight, 0, 0, width - bm.bmHeight, bm.bmHeight,
hwnd, 1, wndPtr->hInstance, 0L); hwnd, 1, wndPtr->hInstance, 0L);
@ -114,7 +116,7 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L); y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
if (y != LB_ERR) { if (y != LB_ERR) {
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str); SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str);
SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str); SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str);
} }
SendMessage(GetParent(hwnd), WM_COMMAND, wndPtr->wIDmenu, SendMessage(GetParent(hwnd), WM_COMMAND, wndPtr->wIDmenu,
MAKELONG(hwnd, CBN_SELCHANGE)); MAKELONG(hwnd, CBN_SELCHANGE));
@ -136,20 +138,26 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
ReleaseDC(hwnd, hDC); ReleaseDC(hwnd, hDC);
wndPtr = WIN_FindWndPtr(hwnd); wndPtr = WIN_FindWndPtr(hwnd);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
lphc->dwState = lphc->dwState ^ CB_SHOWDROPDOWN; lphc->dwState = lphc->dwState ^ CB_SHOWDROPDOWN;
if ((lphc->dwState & CB_SHOWDROPDOWN) == CB_SHOWDROPDOWN) { if ((lphc->dwState & CB_SHOWDROPDOWN) == CB_SHOWDROPDOWN) {
ShowWindow(lphc->hWndLBox, SW_SHOW); ShowWindow(lphc->hWndLBox, SW_SHOW);
SetFocus(lphc->hWndLBox); SetFocus(lphc->hWndLBox);
} }
else { else {
SetFocus(lphc->hWndEdit); printf("before Combo Restore Focus !\n");
SetFocus(lphc->hWndEdit);
printf("before Combo List Hide !\n");
ShowWindow(lphc->hWndLBox, SW_HIDE); ShowWindow(lphc->hWndLBox, SW_HIDE);
printf("before Combo List GetCurSel !\n");
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L); y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
if (y != LB_ERR) { if (y != LB_ERR) {
printf("before Combo List GetText !\n");
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str); SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str);
SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str); SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str);
}
printf("End of Combo List Hide !\n");
} }
}
break; break;
case WM_LBUTTONUP: case WM_LBUTTONUP:
printf("Combo WM_LBUTTONUP wParam=%x lParam=%lX !\n", wParam, lParam); printf("Combo WM_LBUTTONUP wParam=%x lParam=%lX !\n", wParam, lParam);
@ -163,6 +171,7 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
case WM_KEYDOWN: case WM_KEYDOWN:
wndPtr = WIN_FindWndPtr(hwnd); wndPtr = WIN_FindWndPtr(hwnd);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L); y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
count = SendMessage(lphc->hWndLBox, LB_GETCOUNT, 0, 0L); count = SendMessage(lphc->hWndLBox, LB_GETCOUNT, 0, 0L);
printf("COMBOBOX // GetKeyState(VK_MENU)=%d\n", GetKeyState(VK_MENU)); printf("COMBOBOX // GetKeyState(VK_MENU)=%d\n", GetKeyState(VK_MENU));
@ -214,13 +223,16 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
GetClientRect(hwnd, &rect); GetClientRect(hwnd, &rect);
hDC = BeginPaint(hwnd, &paintstruct); hDC = BeginPaint(hwnd, &paintstruct);
hMemDC = CreateCompatibleDC(hDC); hMemDC = CreateCompatibleDC(hDC);
GetObject(hComboBit, sizeof(BITMAP), (LPSTR)&bm); if (hMemDC != 0 && hComboBit != 0) {
SelectObject(hMemDC, hComboBit); GetObject(hComboBit, sizeof(BITMAP), (LPSTR)&bm);
BitBlt(hDC, rect.right - bm.bmWidth, 0, SelectObject(hMemDC, hComboBit);
bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY); BitBlt(hDC, rect.right - bm.bmWidth, 0,
bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
}
DeleteDC(hMemDC); DeleteDC(hMemDC);
EndPaint(hwnd, &paintstruct); EndPaint(hwnd, &paintstruct);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
InvalidateRect(lphc->hWndEdit, NULL, TRUE); InvalidateRect(lphc->hWndEdit, NULL, TRUE);
UpdateWindow(lphc->hWndEdit); UpdateWindow(lphc->hWndEdit);
if ((lphc->dwState & CB_SHOWDROPDOWN) == CB_SHOWDROPDOWN) { if ((lphc->dwState & CB_SHOWDROPDOWN) == CB_SHOWDROPDOWN) {
@ -230,10 +242,12 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
break; break;
case WM_SETFOCUS: case WM_SETFOCUS:
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
SetFocus(lphc->hWndEdit); SetFocus(lphc->hWndEdit);
break; break;
case WM_KILLFOCUS: case WM_KILLFOCUS:
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
ShowWindow(lphc->hWndLBox, SW_HIDE); ShowWindow(lphc->hWndLBox, SW_HIDE);
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L); y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
if (y != LB_ERR) { if (y != LB_ERR) {
@ -246,62 +260,76 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
printf("CB_ADDSTRING '%s' !\n", (LPSTR)lParam); printf("CB_ADDSTRING '%s' !\n", (LPSTR)lParam);
#endif #endif
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_ADDSTRING, wParam, lParam)); return(SendMessage(lphc->hWndLBox, LB_ADDSTRING, wParam, lParam));
case CB_GETLBTEXT: case CB_GETLBTEXT:
printf("CB_GETLBTEXT #%u !\n", wParam); printf("CB_GETLBTEXT #%u !\n", wParam);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_GETTEXT, wParam, lParam)); return(SendMessage(lphc->hWndLBox, LB_GETTEXT, wParam, lParam));
case CB_GETLBTEXTLEN: case CB_GETLBTEXTLEN:
printf("CB_GETLBTEXTLEN !\n"); printf("CB_GETLBTEXTLEN !\n");
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_GETTEXTLEN, wParam, lParam)); return(SendMessage(lphc->hWndLBox, LB_GETTEXTLEN, wParam, lParam));
case CB_INSERTSTRING: case CB_INSERTSTRING:
printf("CB_INSERTSTRING '%s' !\n", (LPSTR)lParam); printf("CB_INSERTSTRING '%s' !\n", (LPSTR)lParam);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam)); return(SendMessage(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam));
case CB_DELETESTRING: case CB_DELETESTRING:
printf("CB_DELETESTRING #%u !\n", wParam); printf("CB_DELETESTRING #%u !\n", wParam);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_DELETESTRING, wParam, 0L)); return(SendMessage(lphc->hWndLBox, LB_DELETESTRING, wParam, 0L));
case CB_RESETCONTENT: case CB_RESETCONTENT:
printf("CB_RESETCONTENT !\n"); printf("CB_RESETCONTENT !\n");
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_RESETCONTENT, 0, 0L)); return(SendMessage(lphc->hWndLBox, LB_RESETCONTENT, 0, 0L));
case CB_DIR: case CB_DIR:
printf("ComboBox CB_DIR !\n"); printf("ComboBox CB_DIR !\n");
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_DIR, wParam, lParam)); return(SendMessage(lphc->hWndLBox, LB_DIR, wParam, lParam));
case CB_FINDSTRING: case CB_FINDSTRING:
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
return(SendMessage(lphc->hWndLBox, LB_FINDSTRING, wParam, lParam)); return(SendMessage(lphc->hWndLBox, LB_FINDSTRING, wParam, lParam));
case CB_GETCOUNT: case CB_GETCOUNT:
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_GETCOUNT, 0, 0L)); return(SendMessage(lphc->hWndLBox, LB_GETCOUNT, 0, 0L));
case CB_GETCURSEL: case CB_GETCURSEL:
printf("ComboBox CB_GETCURSEL !\n"); printf("ComboBox CB_GETCURSEL !\n");
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L)); return(SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L));
case CB_SETCURSEL: case CB_SETCURSEL:
printf("ComboBox CB_SETCURSEL wParam=%X !\n", wParam); printf("ComboBox CB_SETCURSEL wParam=%X !\n", wParam);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_SETCURSEL, wParam, 0L)); return(SendMessage(lphc->hWndLBox, LB_SETCURSEL, wParam, 0L));
case CB_GETEDITSEL: case CB_GETEDITSEL:
printf("ComboBox CB_GETEDITSEL !\n"); printf("ComboBox CB_GETEDITSEL !\n");
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
/* return(SendMessage(lphc->hWndEdit, EM_GETSEL, 0, 0L)); */ /* return(SendMessage(lphc->hWndEdit, EM_GETSEL, 0, 0L)); */
break; break;
case CB_SETEDITSEL: case CB_SETEDITSEL:
printf("ComboBox CB_SETEDITSEL lParam=%lX !\n", lParam); printf("ComboBox CB_SETEDITSEL lParam=%lX !\n", lParam);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
/* return(SendMessage(lphc->hWndEdit, EM_SETSEL, 0, lParam)); */ /* return(SendMessage(lphc->hWndEdit, EM_SETSEL, 0, lParam)); */
break; break;
case CB_SELECTSTRING: case CB_SELECTSTRING:
printf("ComboBox CB_SELECTSTRING !\n"); printf("ComboBox CB_SELECTSTRING !\n");
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
break; break;
case CB_SHOWDROPDOWN: case CB_SHOWDROPDOWN:
printf("ComboBox CB_SHOWDROPDOWN !\n"); printf("ComboBox CB_SHOWDROPDOWN !\n");
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
lphc->dwState = lphc->dwState | CB_SHOWDROPDOWN; lphc->dwState = lphc->dwState | CB_SHOWDROPDOWN;
if (wParam != 0) { if (wParam != 0) {
ShowWindow(lphc->hWndLBox, SW_SHOW); ShowWindow(lphc->hWndLBox, SW_SHOW);
@ -316,16 +344,19 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
case CB_GETITEMDATA: case CB_GETITEMDATA:
printf("ComboBox CB_GETITEMDATA wParam=%X !\n", wParam); printf("ComboBox CB_GETITEMDATA wParam=%X !\n", wParam);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_GETITEMDATA, wParam, 0L)); return(SendMessage(lphc->hWndLBox, LB_GETITEMDATA, wParam, 0L));
break; break;
case CB_SETITEMDATA: case CB_SETITEMDATA:
printf("ComboBox CB_SETITEMDATA wParam=%X lParam=%lX !\n", wParam, lParam); printf("ComboBox CB_SETITEMDATA wParam=%X lParam=%lX !\n", wParam, lParam);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_SETITEMDATA, wParam, lParam)); return(SendMessage(lphc->hWndLBox, LB_SETITEMDATA, wParam, lParam));
break; break;
case CB_LIMITTEXT: case CB_LIMITTEXT:
printf("ComboBox CB_LIMITTEXT !\n"); printf("ComboBox CB_LIMITTEXT !\n");
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0;
/* return(SendMessage(lphc->hWndEdit, EM_LIMITTEXT, wParam, 0L)); */ /* return(SendMessage(lphc->hWndEdit, EM_LIMITTEXT, wParam, 0L)); */
break; break;
@ -390,6 +421,7 @@ int DlgDirListComboBox(HWND hDlg, LPSTR lpPathSpec,
hDlg, lpPathSpec, nIDLBox, nIDStat, wType); hDlg, lpPathSpec, nIDLBox, nIDStat, wType);
hWnd = GetDlgItem(hDlg, nIDLBox); hWnd = GetDlgItem(hDlg, nIDLBox);
lphc = ComboGetStorageHeader(hWnd); lphc = ComboGetStorageHeader(hWnd);
if (lphc == NULL) return 0;
SendMessage(lphc->hWndLBox, LB_RESETCONTENT, 0, 0L); SendMessage(lphc->hWndLBox, LB_RESETCONTENT, 0, 0L);
return SendMessage(lphc->hWndLBox, LB_DIR, wType, (DWORD)lpPathSpec); return SendMessage(lphc->hWndLBox, LB_DIR, wType, (DWORD)lpPathSpec);
} }

View File

@ -72,6 +72,7 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
#ifdef DEBUG_LISTBOX #ifdef DEBUG_LISTBOX
printf("ListBox WM_CREATE %lX !\n", lphl); printf("ListBox WM_CREATE %lX !\n", lphl);
#endif #endif
if (lphl == NULL) return 0;
createStruct = (CREATESTRUCT *)lParam; createStruct = (CREATESTRUCT *)lParam;
if (HIWORD(createStruct->lpCreateParams) != 0) if (HIWORD(createStruct->lpCreateParams) != 0)
lphl->hWndLogicParent = (HWND)HIWORD(createStruct->lpCreateParams); lphl->hWndLogicParent = (HWND)HIWORD(createStruct->lpCreateParams);
@ -91,7 +92,7 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
return 0; return 0;
case WM_DESTROY: case WM_DESTROY:
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr); lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
if (lphl == 0) return 0; if (lphl == NULL) return 0;
ListBoxResetContent(hwnd); ListBoxResetContent(hwnd);
free(lphl); free(lphl);
*((LPHEADLIST *)&wndPtr->wExtra[1]) = 0; *((LPHEADLIST *)&wndPtr->wExtra[1]) = 0;
@ -189,7 +190,7 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
SetFocus(hwnd); SetFocus(hwnd);
SetCapture(hwnd); SetCapture(hwnd);
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr); lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
if (lphl == NULL) return 0; if (lphl == NULL) return 0;
lphl->PrevFocused = lphl->ItemFocused; lphl->PrevFocused = lphl->ItemFocused;
y = ListBoxFindMouse(hwnd, LOWORD(lParam), HIWORD(lParam)); y = ListBoxFindMouse(hwnd, LOWORD(lParam), HIWORD(lParam));
if ((wndPtr->dwStyle & LBS_MULTIPLESEL) == LBS_MULTIPLESEL) { if ((wndPtr->dwStyle & LBS_MULTIPLESEL) == LBS_MULTIPLESEL) {
@ -225,6 +226,7 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
y = HIWORD(lParam); y = HIWORD(lParam);
if (y < 4) { if (y < 4) {
lphl = ListBoxGetStorageHeader(hwnd); lphl = ListBoxGetStorageHeader(hwnd);
if (lphl == NULL) return 0;
if (lphl->FirstVisible > 1) { if (lphl->FirstVisible > 1) {
lphl->FirstVisible--; lphl->FirstVisible--;
if (wndPtr->dwStyle & WS_VSCROLL) if (wndPtr->dwStyle & WS_VSCROLL)
@ -237,6 +239,7 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
GetClientRect(hwnd, &rect); GetClientRect(hwnd, &rect);
if (y > (rect.bottom - 4)) { if (y > (rect.bottom - 4)) {
lphl = ListBoxGetStorageHeader(hwnd); lphl = ListBoxGetStorageHeader(hwnd);
if (lphl == NULL) return 0;
if (lphl->FirstVisible < lphl->ItemsCount) { if (lphl->FirstVisible < lphl->ItemsCount) {
lphl->FirstVisible++; lphl->FirstVisible++;
if (wndPtr->dwStyle & WS_VSCROLL) if (wndPtr->dwStyle & WS_VSCROLL)
@ -248,6 +251,8 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
} }
if ((y > 0) && (y < (rect.bottom - 4))) { if ((y > 0) && (y < (rect.bottom - 4))) {
if ((y < rectsel.top) || (y > rectsel.bottom)) { if ((y < rectsel.top) || (y > rectsel.bottom)) {
lphl = ListBoxGetStorageHeader(hwnd);
if (lphl == NULL) return 0;
wRet = ListBoxFindMouse(hwnd, LOWORD(lParam), HIWORD(lParam)); wRet = ListBoxFindMouse(hwnd, LOWORD(lParam), HIWORD(lParam));
if ((wndPtr->dwStyle & LBS_MULTIPLESEL) == LBS_MULTIPLESEL) { if ((wndPtr->dwStyle & LBS_MULTIPLESEL) == LBS_MULTIPLESEL) {
lphl->ItemFocused = wRet; lphl->ItemFocused = wRet;
@ -722,7 +727,10 @@ void ListBoxAskMeasure(WND *wndPtr, LPHEADLIST lphl, LPLISTSTRUCT lpls)
MEASUREITEMSTRUCT *measure; MEASUREITEMSTRUCT *measure;
HANDLE hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(MEASUREITEMSTRUCT)); HANDLE hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(MEASUREITEMSTRUCT));
measure = (MEASUREITEMSTRUCT *) USER_HEAP_ADDR(hTemp); measure = (MEASUREITEMSTRUCT *) USER_HEAP_ADDR(hTemp);
if (measure == NULL) return; if (measure == NULL) {
printf("ListBoxAskMeasure() // Bad allocation of Measure struct !\n");
return;
}
measure->CtlType = ODT_LISTBOX; measure->CtlType = ODT_LISTBOX;
measure->CtlID = wndPtr->wIDmenu; measure->CtlID = wndPtr->wIDmenu;
measure->itemID = lpls->dis.itemID; measure->itemID = lpls->dis.itemID;
@ -747,6 +755,10 @@ int ListBoxAddString(HWND hwnd, LPSTR newstr)
if (lphl == NULL) return LB_ERR; if (lphl == NULL) return LB_ERR;
hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(LISTSTRUCT)); hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(LISTSTRUCT));
lplsnew = (LPLISTSTRUCT) USER_HEAP_ADDR(hTemp); lplsnew = (LPLISTSTRUCT) USER_HEAP_ADDR(hTemp);
if (lplsnew == NULL) {
printf("ListBoxAddString() // Bad allocation of new item !\n");
return LB_ERRSPACE;
}
lpls = lphl->lpFirst; lpls = lphl->lpFirst;
if (lpls != NULL) { if (lpls != NULL) {
while(lpls->lpNext != NULL) { while(lpls->lpNext != NULL) {
@ -822,6 +834,10 @@ int ListBoxInsertString(HWND hwnd, UINT uIndex, LPSTR newstr)
} }
hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(LISTSTRUCT)); hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(LISTSTRUCT));
lplsnew = (LPLISTSTRUCT) USER_HEAP_ADDR(hTemp); lplsnew = (LPLISTSTRUCT) USER_HEAP_ADDR(hTemp);
if (lplsnew == NULL) {
printf("ListBoxAddString() // Bad allocation of new item !\n");
return LB_ERRSPACE;
}
ListBoxDefaultItem(hwnd, wndPtr, lphl, lplsnew); ListBoxDefaultItem(hwnd, wndPtr, lphl, lplsnew);
lplsnew->hMem = hTemp; lplsnew->hMem = hTemp;
lpls->lpNext = lplsnew; lpls->lpNext = lplsnew;
@ -981,9 +997,8 @@ int ListBoxResetContent(HWND hwnd)
lphl->ItemFocused = 0; lphl->ItemFocused = 0;
lphl->PrevFocused = 0; lphl->PrevFocused = 0;
if ((wndPtr->dwStyle && LBS_NOTIFY) != 0) if ((wndPtr->dwStyle && LBS_NOTIFY) != 0)
SendMessage(wndPtr->hwndParent, WM_COMMAND, SendMessage(lphl->hWndLogicParent, WM_COMMAND,
wndPtr->wIDmenu, MAKELONG(hwnd, LBN_SELCHANGE)); wndPtr->wIDmenu, MAKELONG(hwnd, LBN_SELCHANGE));
if (wndPtr->dwStyle & WS_VSCROLL) if (wndPtr->dwStyle & WS_VSCROLL)
SetScrollRange(hwnd, SB_VERT, 1, lphl->ItemsCount, TRUE); SetScrollRange(hwnd, SB_VERT, 1, lphl->ItemsCount, TRUE);
if ((wndPtr->dwStyle & WS_HSCROLL) && lphl->ItemsPerColumn != 0) if ((wndPtr->dwStyle & WS_HSCROLL) && lphl->ItemsPerColumn != 0)
@ -1007,7 +1022,7 @@ int ListBoxSetCurSel(HWND hwnd, WORD wIndex)
UINT i; UINT i;
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr); lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
if (lphl == NULL) return LB_ERR; if (lphl == NULL) return LB_ERR;
lphl->ItemFocused = LB_ERR; lphl->ItemFocused = LB_ERR;
if (wIndex >= lphl->ItemsCount) return LB_ERR; if (wIndex >= lphl->ItemsCount) return LB_ERR;
lpls = lphl->lpFirst; lpls = lphl->lpFirst;
if (lpls == NULL) return LB_ERR; if (lpls == NULL) return LB_ERR;
@ -1023,7 +1038,7 @@ int ListBoxSetCurSel(HWND hwnd, WORD wIndex)
} }
lphl->ItemFocused = wIndex; lphl->ItemFocused = wIndex;
if ((wndPtr->dwStyle && LBS_NOTIFY) != 0) if ((wndPtr->dwStyle && LBS_NOTIFY) != 0)
SendMessage(wndPtr->hwndParent, WM_COMMAND, SendMessage(lphl->hWndLogicParent, WM_COMMAND,
wndPtr->wIDmenu, MAKELONG(hwnd, LBN_SELCHANGE)); wndPtr->wIDmenu, MAKELONG(hwnd, LBN_SELCHANGE));
return LB_ERR; return LB_ERR;
} }
@ -1183,6 +1198,10 @@ int ListBoxDefaultItem(HWND hwnd, WND *wndPtr,
LPHEADLIST lphl, LPLISTSTRUCT lpls) LPHEADLIST lphl, LPLISTSTRUCT lpls)
{ {
RECT rect; RECT rect;
if (wndPtr == NULL || lphl == NULL || lpls == NULL) {
printf("ListBoxDefaultItem() // Bad Pointers !\n");
return FALSE;
}
GetClientRect(hwnd, &rect); GetClientRect(hwnd, &rect);
SetRect(&lpls->dis.rcItem, 0, 0, rect.right, lphl->StdItemHeight); SetRect(&lpls->dis.rcItem, 0, 0, rect.right, lphl->StdItemHeight);
lpls->dis.CtlType = lphl->DrawCtlType; lpls->dis.CtlType = lphl->DrawCtlType;
@ -1193,6 +1212,7 @@ int ListBoxDefaultItem(HWND hwnd, WND *wndPtr,
lpls->dis.hwndItem = hwnd; lpls->dis.hwndItem = hwnd;
lpls->dis.hDC = 0; lpls->dis.hDC = 0;
lpls->dis.itemData = 0; lpls->dis.itemData = 0;
return TRUE;
} }

View File

@ -408,8 +408,6 @@ BOOL MenuButtonDown(HWND hWnd, LPPOPUPMENU lppop, int x, int y)
LPPOPUPMENU lppop2; LPPOPUPMENU lppop2;
if (lppop == NULL) return; if (lppop == NULL) return;
lpitem = MenuFindItem(lppop, x, y, &wRet); lpitem = MenuFindItem(lppop, x, y, &wRet);
printf("MenuButtonDown hWnd=%04X x=%d y=%d // wRet=%d lpitem=%08X !\n",
hWnd, x, y, wRet, lpitem);
#ifdef DEBUG_MENU #ifdef DEBUG_MENU
printf("MenuButtonDown hWnd=%04X x=%d y=%d // wRet=%d lpitem=%08X !\n", printf("MenuButtonDown hWnd=%04X x=%d y=%d // wRet=%d lpitem=%08X !\n",
hWnd, x, y, wRet, lpitem); hWnd, x, y, wRet, lpitem);
@ -449,6 +447,10 @@ BOOL MenuButtonDown(HWND hWnd, LPPOPUPMENU lppop, int x, int y)
0, lppop->ownerWnd, (LPRECT)NULL); 0, lppop->ownerWnd, (LPRECT)NULL);
} }
GlobalUnlock(hSubMenu); GlobalUnlock(hSubMenu);
return TRUE;
}
if (lppop->BarFlag && !MenuHasFocus) {
MenuFocusLoop(hWnd, lppop);
} }
return TRUE; return TRUE;
} }
@ -506,7 +508,8 @@ void MenuMouseMove(HWND hWnd, LPPOPUPMENU lppop, WORD wParam, int x, int y)
LPMENUITEM lpitem, lpitem2; LPMENUITEM lpitem, lpitem2;
LPPOPUPMENU lppop2; LPPOPUPMENU lppop2;
WORD wRet; WORD wRet;
if ((wParam & MK_LBUTTON) != 0) { /* if ((wParam & MK_LBUTTON) != 0) { */
if (GetKeyState(VK_LBUTTON) != 0) {
lpitem = MenuFindItem(lppop, x, y, &wRet); lpitem = MenuFindItem(lppop, x, y, &wRet);
#ifdef DEBUG_MENU #ifdef DEBUG_MENU
printf("MenuMouseMove // x=%d y=%d // wRet=%d lpitem=%08X !\n", printf("MenuMouseMove // x=%d y=%d // wRet=%d lpitem=%08X !\n",
@ -1319,12 +1322,13 @@ BOOL InsertMenu(HMENU hMenu, WORD nPos, WORD wFlags, WORD wItemID, LPSTR lpNewIt
GlobalUnlock(hMenu); GlobalUnlock(hMenu);
return FALSE; return FALSE;
} }
lpitem2->hItem = hNewItem;
lpitem2->item_flags = wFlags; lpitem2->item_flags = wFlags;
lpitem2->item_id = wItemID; lpitem2->item_id = wItemID;
if (!(wFlags & (MF_BITMAP | MF_OWNERDRAW | MF_MENUBARBREAK | if (!(wFlags & (MF_BITMAP | MF_OWNERDRAW | MF_MENUBARBREAK |
MF_MENUBREAK | MF_SEPARATOR))) { MF_MENUBREAK | MF_SEPARATOR))) {
/* lpitem2->item_text = GlobalQuickAlloc(strlen(lpNewItem) + 1); */ lpitem2->hText = GlobalAlloc(GMEM_MOVEABLE, strlen(lpNewItem) + 1);
lpitem2->item_text = GlobalLock(GlobalAlloc(GMEM_MOVEABLE, strlen(lpNewItem) + 1)); lpitem2->item_text = GlobalLock(lpitem2->hText);
if (lpitem2->item_text != NULL) if (lpitem2->item_text != NULL)
strcpy(lpitem2->item_text, lpNewItem); strcpy(lpitem2->item_text, lpNewItem);
else { else {
@ -1347,8 +1351,6 @@ BOOL InsertMenu(HMENU hMenu, WORD nPos, WORD wFlags, WORD wItemID, LPSTR lpNewIt
if (lpitem2->next != NULL) lpitem2->next->prev = lpitem2; if (lpitem2->next != NULL) lpitem2->next->prev = lpitem2;
lpitem->next = lpitem2; lpitem->next = lpitem2;
} }
lpitem2->child = NULL;
lpitem2->parent = NULL;
menu->nItems++; menu->nItems++;
GlobalUnlock(hMenu); GlobalUnlock(hMenu);
return TRUE; return TRUE;
@ -1386,6 +1388,7 @@ BOOL AppendMenu(HMENU hMenu, WORD wFlags, WORD wItemID, LPSTR lpNewItem)
return FALSE; return FALSE;
} }
lpitem2 = (LPMENUITEM)GlobalLock(hNewItem); lpitem2 = (LPMENUITEM)GlobalLock(hNewItem);
lpitem2->hItem = hNewItem;
if (lpitem2 == NULL) { if (lpitem2 == NULL) {
GlobalFree(hNewItem); GlobalFree(hNewItem);
GlobalUnlock(hMenu); GlobalUnlock(hMenu);
@ -1395,8 +1398,8 @@ BOOL AppendMenu(HMENU hMenu, WORD wFlags, WORD wItemID, LPSTR lpNewItem)
lpitem2->item_id = wItemID; lpitem2->item_id = wItemID;
if (!(wFlags & (MF_BITMAP | MF_OWNERDRAW | MF_MENUBARBREAK | if (!(wFlags & (MF_BITMAP | MF_OWNERDRAW | MF_MENUBARBREAK |
MF_MENUBREAK | MF_SEPARATOR))) { MF_MENUBREAK | MF_SEPARATOR))) {
/* lpitem2->item_text = GlobalQuickAlloc(strlen(lpNewItem) + 1); */ lpitem2->hText = GlobalAlloc(GMEM_MOVEABLE, strlen(lpNewItem) + 1);
lpitem2->item_text = GlobalLock(GlobalAlloc(GMEM_MOVEABLE, strlen(lpNewItem) + 1)); lpitem2->item_text = GlobalLock(lpitem2->hText);
if (lpitem2->item_text != NULL) if (lpitem2->item_text != NULL)
strcpy(lpitem2->item_text, lpNewItem); strcpy(lpitem2->item_text, lpNewItem);
else { else {
@ -1414,8 +1417,6 @@ BOOL AppendMenu(HMENU hMenu, WORD wFlags, WORD wItemID, LPSTR lpNewItem)
lpitem->next = lpitem2; lpitem->next = lpitem2;
lpitem2->prev = lpitem; lpitem2->prev = lpitem;
lpitem2->next = NULL; lpitem2->next = NULL;
lpitem2->child = NULL;
lpitem2->parent = NULL;
lpitem2->hCheckBit = (HBITMAP)NULL; lpitem2->hCheckBit = (HBITMAP)NULL;
lpitem2->hUnCheckBit = (HBITMAP)NULL; lpitem2->hUnCheckBit = (HBITMAP)NULL;
menu->nItems++; menu->nItems++;
@ -1447,9 +1448,10 @@ BOOL RemoveMenu(HMENU hMenu, WORD nPos, WORD wFlags)
if (!(lpitem->item_flags & if (!(lpitem->item_flags &
(MF_BITMAP | MF_OWNERDRAW | MF_MENUBARBREAK | (MF_BITMAP | MF_OWNERDRAW | MF_MENUBARBREAK |
MF_MENUBREAK | MF_SEPARATOR))) { MF_MENUBREAK | MF_SEPARATOR))) {
GlobalFree((HANDLE)lpitem->item_text); GlobalUnlock(lpitem->hText);
GlobalFree(lpitem->hText);
} }
GlobalFree(lpitem); GlobalFree(lpitem->hItem);
GlobalUnlock(hMenu); GlobalUnlock(hMenu);
return TRUE; return TRUE;
} }
@ -1485,11 +1487,12 @@ BOOL DeleteMenu(HMENU hMenu, WORD nPos, WORD wFlags)
if (!(lpitem->item_flags & if (!(lpitem->item_flags &
(MF_BITMAP | MF_OWNERDRAW | MF_MENUBARBREAK | (MF_BITMAP | MF_OWNERDRAW | MF_MENUBARBREAK |
MF_MENUBREAK | MF_SEPARATOR))) { MF_MENUBREAK | MF_SEPARATOR))) {
GlobalFree((HANDLE)lpitem->item_text); GlobalUnlock(lpitem->hText);
GlobalFree(lpitem->hText);
} }
if (lpitem->prev) lpitem->prev->next = lpitem->next; if (lpitem->prev) lpitem->prev->next = lpitem->next;
if (lpitem->next) lpitem->next->prev = lpitem->prev; if (lpitem->next) lpitem->next->prev = lpitem->prev;
GlobalFree(lpitem); GlobalFree(lpitem->hItem);
GlobalUnlock(hMenu); GlobalUnlock(hMenu);
return TRUE; return TRUE;
} }
@ -1522,9 +1525,10 @@ BOOL ModifyMenu(HMENU hMenu, WORD nPos, WORD wFlags, WORD wItemID, LPSTR lpNewIt
if (!(lpitem->item_flags & if (!(lpitem->item_flags &
(MF_BITMAP | MF_OWNERDRAW | MF_MENUBARBREAK | (MF_BITMAP | MF_OWNERDRAW | MF_MENUBARBREAK |
MF_MENUBREAK | MF_SEPARATOR))) { MF_MENUBREAK | MF_SEPARATOR))) {
GlobalFree((HANDLE)lpitem->item_text); GlobalUnlock(lpitem->hText);
/* lpitem->item_text = GlobalQuickAlloc(strlen(lpNewItem) + 1); */ GlobalFree(lpitem->hText);
lpitem->item_text = GlobalLock(GlobalAlloc(GMEM_MOVEABLE, strlen(lpNewItem) + 1)); lpitem->hText = GlobalAlloc(GMEM_MOVEABLE, strlen(lpNewItem) + 1);
lpitem->item_text = GlobalLock(lpitem->hText);
printf("ModifyMenu %08X %08X '%s') !\n", printf("ModifyMenu %08X %08X '%s') !\n",
lpitem->item_text, lpNewItem, lpNewItem); lpitem->item_text, lpNewItem, lpNewItem);
if (lpitem->item_text != NULL) if (lpitem->item_text != NULL)
@ -1689,13 +1693,26 @@ BOOL MenuFocusLoop(HWND hWnd, LPPOPUPMENU lpmenu)
HideAllSubPopupMenu(lpmenu); HideAllSubPopupMenu(lpmenu);
break; break;
} }
ScreenToClient(hWnd, &msg.pt);
msg.pt.y += lpmenu->rect.bottom;
switch(msg.message) { switch(msg.message) {
case WM_LBUTTONDOWN:
case WM_NCLBUTTONDOWN:
SetCapture(hWnd);
MenuButtonDown(hWnd, lpmenu, msg.pt.x, msg.pt.y);
break;
case WM_LBUTTONUP:
case WM_NCLBUTTONUP:
MenuButtonUp(hWnd, lpmenu, msg.pt.x, msg.pt.y);
ReleaseCapture();
break;
case WM_MOUSEMOVE:
case WM_NCMOUSEMOVE:
MenuMouseMove(hWnd, lpmenu, msg.wParam, msg.pt.x, msg.pt.y);
break;
case WM_KEYDOWN: case WM_KEYDOWN:
case WM_KEYUP: case WM_KEYUP:
case WM_CHAR: case WM_CHAR:
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_MOUSEMOVE:
PopupMenuWndProc(hWnd, msg.message, msg.wParam, msg.lParam); PopupMenuWndProc(hWnd, msg.message, msg.wParam, msg.lParam);
default: default:
DispatchMessage(&msg); DispatchMessage(&msg);
@ -1967,12 +1984,15 @@ BOOL SetMenu(HWND hWnd, HMENU hMenu)
return FALSE; return FALSE;
} }
lpmenu->ownerWnd = hWnd; lpmenu->ownerWnd = hWnd;
printf("SetMenu(%04X, %04X) // %04X\n", hWnd, hMenu, lpmenu->ownerWnd);
ResetHiliteFlags(lpmenu); ResetHiliteFlags(lpmenu);
if (GetCapture() == hWnd) ReleaseCapture();
GlobalUnlock(hMenu); GlobalUnlock(hMenu);
return TRUE; return TRUE;
} }
/********************************************************************** /**********************************************************************
* GetSubMenu [USER.159] * GetSubMenu [USER.159]
*/ */

View File

@ -47,97 +47,115 @@ LPHEADSCROLL AllocScrollBar(DWORD dwStyle, int width, int height);
*/ */
LONG ScrollBarWndProc( HWND hWnd, WORD message, WORD wParam, LONG lParam ) LONG ScrollBarWndProc( HWND hWnd, WORD message, WORD wParam, LONG lParam )
{ {
WORD wRet; WORD wRet;
short x, y; short x, y;
short width, height; short width, height;
WND *wndPtr; WND *wndPtr;
LPHEADSCROLL lphs; LPHEADSCROLL lphs;
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC hDC; HDC hDC;
BITMAP bm; BITMAP bm;
RECT rect, rect2; RECT rect, rect2;
static RECT rectsel; LPCREATESTRUCT lpCreat;
switch(message) static RECT rectsel;
{ switch(message) {
case WM_CREATE: case WM_CREATE:
CreateScrollBarStruct(hWnd); lpCreat = (LPCREATESTRUCT)lParam;
if (lpCreat->style & SBS_VERT) {
if (lpCreat->style & SBS_LEFTALIGN)
SetWindowPos(hWnd, 0, 0, 0, 16, lpCreat->cy,
SWP_NOZORDER | SWP_NOMOVE);
if (lpCreat->style & SBS_RIGHTALIGN)
SetWindowPos(hWnd, 0, lpCreat->x + lpCreat->cx - 16,
lpCreat->y, 16, lpCreat->cy, SWP_NOZORDER);
}
if (lpCreat->style & SBS_HORZ) {
if (lpCreat->style & SBS_TOPALIGN)
SetWindowPos(hWnd, 0, 0, 0, lpCreat->cx, 16,
SWP_NOZORDER | SWP_NOMOVE);
if (lpCreat->style & SBS_BOTTOMALIGN)
SetWindowPos(hWnd, 0, lpCreat->x,
lpCreat->y + lpCreat->cy - 16,
lpCreat->cx, 16, SWP_NOZORDER);
}
CreateScrollBarStruct(hWnd);
#ifdef DEBUG_SCROLL #ifdef DEBUG_SCROLL
printf("ScrollBar Creation !\n"); printf("ScrollBar Creation !\n");
#endif #endif
return 0; return 0;
case WM_DESTROY: case WM_DESTROY:
lphs = ScrollBarGetWindowAndStorage(hWnd, &wndPtr); lphs = ScrollBarGetWindowAndStorage(hWnd, &wndPtr);
if (lphs == 0) return 0; if (lphs == 0) return 0;
#ifdef DEBUG_SCROLL #ifdef DEBUG_SCROLL
printf("ScrollBar WM_DESTROY %lX !\n", lphs); printf("ScrollBar WM_DESTROY %lX !\n", lphs);
#endif #endif
free(lphs); free(lphs);
*((LPHEADSCROLL *)&wndPtr->wExtra[1]) = 0; *((LPHEADSCROLL *)&wndPtr->wExtra[1]) = 0;
return 0; return 0;
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
SetCapture(hWnd); SetCapture(hWnd);
ScrollBarButtonDown(hWnd, SB_CTL, LOWORD(lParam), HIWORD(lParam)); ScrollBarButtonDown(hWnd, SB_CTL, LOWORD(lParam), HIWORD(lParam));
break; break;
case WM_LBUTTONUP: case WM_LBUTTONUP:
ReleaseCapture(); ReleaseCapture();
ScrollBarButtonUp(hWnd, SB_CTL, LOWORD(lParam), HIWORD(lParam)); ScrollBarButtonUp(hWnd, SB_CTL, LOWORD(lParam), HIWORD(lParam));
break; break;
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
ScrollBarMouseMove(hWnd, SB_CTL, wParam, LOWORD(lParam), HIWORD(lParam)); ScrollBarMouseMove(hWnd, SB_CTL, wParam, LOWORD(lParam), HIWORD(lParam));
break; break;
case WM_KEYDOWN: case WM_KEYDOWN:
case WM_KEYUP: case WM_KEYUP:
case WM_CHAR: case WM_CHAR:
lphs = ScrollBarGetWindowAndStorage(hWnd, &wndPtr); lphs = ScrollBarGetWindowAndStorage(hWnd, &wndPtr);
return(SendMessage(wndPtr->hwndParent, message, wParam, lParam)); return(SendMessage(wndPtr->hwndParent, message, wParam, lParam));
case WM_TIMER: case WM_TIMER:
#ifdef DEBUG_SCROLL #ifdef DEBUG_SCROLL
printf("ScrollBar WM_TIMER wParam=%X lParam=%lX !\n", wParam, lParam); printf("ScrollBar WM_TIMER wParam=%X lParam=%lX !\n", wParam, lParam);
#endif #endif
lphs = ScrollBarGetWindowAndStorage(hWnd, &wndPtr); lphs = ScrollBarGetWindowAndStorage(hWnd, &wndPtr);
KillTimer(hWnd, wParam); KillTimer(hWnd, wParam);
switch(lphs->ButtonDown) { switch(lphs->ButtonDown) {
case 0: case 0:
lphs->TimerPending = FALSE; lphs->TimerPending = FALSE;
return 0;
case 1:
case 3:
SendMessage(wndPtr->hwndParent, lphs->Direction,
SB_LINEUP, MAKELONG(0, hWnd));
break;
case 2:
case 4:
SendMessage(wndPtr->hwndParent, lphs->Direction,
SB_LINEDOWN, MAKELONG(0, hWnd));
break;
case 5:
SendMessage(wndPtr->hwndParent, lphs->Direction,
SB_PAGEUP, MAKELONG(0, hWnd));
break;
case 6:
SendMessage(wndPtr->hwndParent, lphs->Direction,
SB_PAGEDOWN, MAKELONG(0, hWnd));
break;
}
SetTimer(hWnd, 1, 100, NULL);
return 0; return 0;
case 1:
case 3:
SendMessage(wndPtr->hwndParent, lphs->Direction,
SB_LINEUP, MAKELONG(0, hWnd));
break;
case 2:
case 4:
SendMessage(wndPtr->hwndParent, lphs->Direction,
SB_LINEDOWN, MAKELONG(0, hWnd));
break;
case 5:
SendMessage(wndPtr->hwndParent, lphs->Direction,
SB_PAGEUP, MAKELONG(0, hWnd));
break;
case 6:
SendMessage(wndPtr->hwndParent, lphs->Direction,
SB_PAGEDOWN, MAKELONG(0, hWnd));
break;
}
SetTimer(hWnd, 1, 100, NULL);
return 0;
case WM_PAINT: case WM_PAINT:
hDC = BeginPaint(hWnd, &ps); hDC = BeginPaint(hWnd, &ps);
lphs = ScrollBarGetStorageHeader(hWnd); lphs = ScrollBarGetStorageHeader(hWnd);
if (lphs != NULL) { if (lphs != NULL) {
GetClientRect(hWnd, &rect); GetClientRect(hWnd, &rect);
StdDrawScrollBar(hWnd, hDC, SB_CTL, &rect, lphs); StdDrawScrollBar(hWnd, hDC, SB_CTL, &rect, lphs);
} }
EndPaint(hWnd, &ps); EndPaint(hWnd, &ps);
break; break;
default: default:
return DefWindowProc( hWnd, message, wParam, lParam ); return DefWindowProc( hWnd, message, wParam, lParam );
} }
return(0); return(0);
} }
@ -174,50 +192,42 @@ void ScrollBarButtonDown(HWND hWnd, int nBar, int x, int y)
#endif #endif
if (lphs->Direction == WM_VSCROLL) { if (lphs->Direction == WM_VSCROLL) {
width = rect.right - rect.left; width = rect.right - rect.left;
if (y < (lphs->CurPix + width)) { if (y <= lphs->rectUp.bottom) {
if (y < width) { lphs->ButtonDown = 1;
lphs->ButtonDown = 1; InvalidateRect(lphs->hWndOwner, &lphs->rectUp, TRUE);
CopyRect(&rect2, &rect);
rect2.bottom = rect2.top + width;
InvalidateRect(lphs->hWndOwner, &rect2, TRUE);
#ifdef DEBUG_SCROLL #ifdef DEBUG_SCROLL
printf("ScrollBarButtonDown send SB_LINEUP\n"); printf("ScrollBarButtonDown send SB_LINEUP\n");
#endif #endif
SendMessage(hWndParent, lphs->Direction, SendMessage(hWndParent, lphs->Direction,
SB_LINEUP, dwOwner); SB_LINEUP, dwOwner);
}
else {
lphs->ButtonDown = 5;
#ifdef DEBUG_SCROLL
printf("ScrollBarButtonDown send SB_PAGEUP\n");
#endif
SendMessage(hWndParent, lphs->Direction,
SB_PAGEUP, dwOwner);
}
} }
if (y > (lphs->CurPix + (width << 1))) { if (y >= lphs->rectDown.top) {
if (y > (rect.bottom - rect.top - width)) { lphs->ButtonDown = 2;
lphs->ButtonDown = 2; InvalidateRect(lphs->hWndOwner, &lphs->rectDown, TRUE);
CopyRect(&rect2, &rect);
rect2.top = rect2.bottom - width;
InvalidateRect(lphs->hWndOwner, &rect2, TRUE);
#ifdef DEBUG_SCROLL #ifdef DEBUG_SCROLL
printf("ScrollBarButtonDown send SB_LINEDOWN\n"); printf("ScrollBarButtonDown send SB_LINEDOWN\n");
#endif #endif
SendMessage(hWndParent, lphs->Direction, SendMessage(hWndParent, lphs->Direction,
SB_LINEDOWN, dwOwner); SB_LINEDOWN, dwOwner);
}
else {
lphs->ButtonDown = 6;
#ifdef DEBUG_SCROLL
printf("ScrollBarButtonDown send SB_PAGEDOWN\n");
#endif
SendMessage(hWndParent, lphs->Direction,
SB_PAGEDOWN, dwOwner);
}
} }
if ((y > (lphs->CurPix + width)) && if (y > lphs->rectUp.bottom && y < (lphs->CurPix + width)) {
(y < (lphs->CurPix + (width << 1)))) { lphs->ButtonDown = 5;
#ifdef DEBUG_SCROLL
printf("ScrollBarButtonDown send SB_PAGEUP\n");
#endif
SendMessage(hWndParent, lphs->Direction,
SB_PAGEUP, dwOwner);
}
if (y < lphs->rectDown.top && y > (lphs->CurPix + (width << 1))) {
lphs->ButtonDown = 6;
#ifdef DEBUG_SCROLL
printf("ScrollBarButtonDown send SB_PAGEDOWN\n");
#endif
SendMessage(hWndParent, lphs->Direction,
SB_PAGEDOWN, dwOwner);
}
if (lphs->MaxPix > 0 && y > (lphs->CurPix + width) &&
y < (lphs->CurPix + (width << 1))) {
lphs->ThumbActive = TRUE; lphs->ThumbActive = TRUE;
#ifdef DEBUG_SCROLL #ifdef DEBUG_SCROLL
printf("THUMB DOWN !\n"); printf("THUMB DOWN !\n");
@ -226,50 +236,42 @@ void ScrollBarButtonDown(HWND hWnd, int nBar, int x, int y)
} }
else { else {
height = rect.bottom - rect.top; height = rect.bottom - rect.top;
if (x < (lphs->CurPix + height)) { if (x <= lphs->rectUp.right) {
if (x < height) { lphs->ButtonDown = 3;
lphs->ButtonDown = 3; InvalidateRect(lphs->hWndOwner, &lphs->rectUp, TRUE);
CopyRect(&rect2, &rect);
rect2.right = rect2.left + height;
InvalidateRect(lphs->hWndOwner, &rect2, TRUE);
#ifdef DEBUG_SCROLL #ifdef DEBUG_SCROLL
printf("ScrollBarButtonDown send SB_LINEUP\n"); printf("ScrollBarButtonDown send SB_LINEUP\n");
#endif #endif
SendMessage(hWndParent, lphs->Direction, SendMessage(hWndParent, lphs->Direction,
SB_LINEUP, dwOwner); SB_LINEUP, dwOwner);
}
else {
lphs->ButtonDown = 5;
#ifdef DEBUG_SCROLL
printf("ScrollBarButtonDown send SB_PAGEUP\n");
#endif
SendMessage(hWndParent, lphs->Direction,
SB_PAGEUP, dwOwner);
}
} }
if (x > (lphs->CurPix + (height << 1))) { if (x >= lphs->rectDown.left) {
if (x > (rect.right - rect.left - height)) { lphs->ButtonDown = 4;
lphs->ButtonDown = 4; InvalidateRect(lphs->hWndOwner, &lphs->rectDown, TRUE);
CopyRect(&rect2, &rect);
rect2.left = rect2.right - height;
InvalidateRect(lphs->hWndOwner, &rect2, TRUE);
#ifdef DEBUG_SCROLL #ifdef DEBUG_SCROLL
printf("ScrollBarButtonDown send SB_LINEDOWN\n"); printf("ScrollBarButtonDown send SB_LINEDOWN\n");
#endif #endif
SendMessage(hWndParent, lphs->Direction, SendMessage(hWndParent, lphs->Direction,
SB_LINEDOWN, dwOwner); SB_LINEDOWN, dwOwner);
}
else {
lphs->ButtonDown = 6;
#ifdef DEBUG_SCROLL
printf("ScrollBarButtonDown send SB_PAGEDOWN\n");
#endif
SendMessage(hWndParent, lphs->Direction,
SB_PAGEDOWN, dwOwner);
}
} }
if ((x > (lphs->CurPix + height)) && if (x > lphs->rectUp.right && x < (lphs->CurPix + height)) {
(x < (lphs->CurPix + (height << 1)))) { lphs->ButtonDown = 5;
#ifdef DEBUG_SCROLL
printf("ScrollBarButtonDown send SB_PAGEUP\n");
#endif
SendMessage(hWndParent, lphs->Direction,
SB_PAGEUP, dwOwner);
}
if (x < lphs->rectDown.left && x > (lphs->CurPix + (height << 1))) {
lphs->ButtonDown = 6;
#ifdef DEBUG_SCROLL
printf("ScrollBarButtonDown send SB_PAGEDOWN\n");
#endif
SendMessage(hWndParent, lphs->Direction,
SB_PAGEDOWN, dwOwner);
}
if (lphs->MaxPix > 0 && x > (lphs->CurPix + height) &&
x < (lphs->CurPix + (height << 1))) {
lphs->ThumbActive = TRUE; lphs->ThumbActive = TRUE;
#ifdef DEBUG_SCROLL #ifdef DEBUG_SCROLL
printf("THUMB DOWN !\n"); printf("THUMB DOWN !\n");
@ -298,8 +300,8 @@ void ScrollBarButtonUp(HWND hWnd, int nBar, int x, int y)
lphs->ThumbActive = FALSE; lphs->ThumbActive = FALSE;
if (lphs->ButtonDown != 0) { if (lphs->ButtonDown != 0) {
lphs->ButtonDown = 0; lphs->ButtonDown = 0;
GetClientRect(lphs->hWndOwner, &rect);
if (nBar == SB_CTL) { if (nBar == SB_CTL) {
GetClientRect(lphs->hWndOwner, &rect);
InvalidateRect(lphs->hWndOwner, &rect, TRUE); InvalidateRect(lphs->hWndOwner, &rect, TRUE);
UpdateWindow(lphs->hWndOwner); UpdateWindow(lphs->hWndOwner);
} }
@ -384,100 +386,118 @@ LPHEADSCROLL ScrollBarGetStorageHeader(HWND hWnd)
void StdDrawScrollBar(HWND hWnd, HDC hDC, int nBar, LPRECT lprect, LPHEADSCROLL lphs) void StdDrawScrollBar(HWND hWnd, HDC hDC, int nBar, LPRECT lprect, LPHEADSCROLL lphs)
{ {
HWND hWndParent; HWND hWndParent;
HBRUSH hBrush; HBRUSH hBrush;
HDC hMemDC; HDC hMemDC;
BITMAP bm; BITMAP bm;
RECT rect; RECT rect;
UINT i, w, h, siz; UINT i, w, w2, h, h2, siz;
char C[128]; char C[128];
if (lphs == NULL) return; if (lphs == NULL) return;
#ifdef DEBUG_SCROLL #ifdef DEBUG_SCROLL
if (lphs->Direction == WM_VSCROLL) printf("StdDrawScrollBar nBar=%04X !\n", nBar);
printf("StdDrawScrollBar Vertical left=%d top=%d right=%d bottom=%d !\n", if (lphs->Direction == WM_VSCROLL)
lprect->left, lprect->top, lprect->right, lprect->bottom); printf("StdDrawScrollBar Vertical left=%d top=%d right=%d bottom=%d !\n",
else lprect->left, lprect->top, lprect->right, lprect->bottom);
printf("StdDrawScrollBar Horizontal left=%d top=%d right=%d bottom=%d !\n", else
lprect->left, lprect->top, lprect->right, lprect->bottom); printf("StdDrawScrollBar Horizontal left=%d top=%d right=%d bottom=%d !\n",
lprect->left, lprect->top, lprect->right, lprect->bottom);
#endif #endif
if (nBar == SB_CTL) if (nBar == SB_CTL)
hWndParent = GetParent(hWnd); hWndParent = GetParent(hWnd);
else else
hWndParent = lphs->hWndOwner; hWndParent = lphs->hWndOwner;
hBrush = SendMessage(hWndParent, WM_CTLCOLOR, (WORD)hDC, hBrush = SendMessage(hWndParent, WM_CTLCOLOR, (WORD)hDC,
MAKELONG(hWnd, CTLCOLOR_SCROLLBAR)); MAKELONG(hWnd, CTLCOLOR_SCROLLBAR));
if (hBrush == (HBRUSH)NULL) hBrush = GetStockObject(LTGRAY_BRUSH); if (hBrush == (HBRUSH)NULL) hBrush = GetStockObject(LTGRAY_BRUSH);
CopyRect(&lphs->rect, lprect); CopyRect(&lphs->rect, lprect);
CopyRect(&rect, lprect); CopyRect(&lphs->rectUp, lprect);
w = rect.right - rect.left; CopyRect(&lphs->rectDown, lprect);
h = rect.bottom - rect.top; CopyRect(&rect, lprect);
if (lphs->Direction == WM_VSCROLL) w = rect.right - rect.left;
lphs->MaxPix = h - 3 * w; h = rect.bottom - rect.top;
else if (w == 0 || h == 0) return;
lphs->MaxPix = w - 3 * h; if (lphs->Direction == WM_VSCROLL) {
if (lphs->MaxVal != lphs->MinVal) if (h > 3 * w)
lphs->MaxPix = h - 3 * w;
else
lphs->MaxPix = 0;
if (h > 2 * w)
h2 = w;
else
h2 = (h - 4) / 2;
lphs->rectUp.bottom = h2;
lphs->rectDown.top = rect.bottom - h2;
}
else {
if (w > 3 * h)
lphs->MaxPix = w - 3 * h;
else
lphs->MaxPix = 0;
if (w > 2 * h)
w2 = h;
else
w2 = (w - 4) / 2;
lphs->rectUp.right = w2;
lphs->rectDown.left = rect.right - w2;
}
if (lphs->MaxVal != lphs->MinVal)
lphs->CurPix = lphs->MaxPix * (abs((short)lphs->CurVal) - abs(lphs->MinVal)) / lphs->CurPix = lphs->MaxPix * (abs((short)lphs->CurVal) - abs(lphs->MinVal)) /
(abs(lphs->MaxVal) - abs(lphs->MinVal)); (abs(lphs->MaxVal) - abs(lphs->MinVal));
if (lphs->CurPix > lphs->MaxPix) lphs->CurPix = lphs->MaxPix; if (lphs->CurPix > lphs->MaxPix) lphs->CurPix = lphs->MaxPix;
hMemDC = CreateCompatibleDC(hDC); hMemDC = CreateCompatibleDC(hDC);
if (lphs->Direction == WM_VSCROLL) { if (lphs->Direction == WM_VSCROLL) {
GetObject(hUpArrow, sizeof(BITMAP), (LPSTR)&bm); GetObject(hUpArrow, sizeof(BITMAP), (LPSTR)&bm);
if (lphs->ButtonDown == 1) if (lphs->ButtonDown == 1)
SelectObject(hMemDC, hUpArrowD); SelectObject(hMemDC, hUpArrowD);
else else
SelectObject(hMemDC, hUpArrow); SelectObject(hMemDC, hUpArrow);
StretchBlt(hDC, rect.left, rect.top, w, w, hMemDC, StretchBlt(hDC, rect.left, rect.top, w, h2, hMemDC,
0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
GetObject(hDnArrow, sizeof(BITMAP), (LPSTR)&bm); GetObject(hDnArrow, sizeof(BITMAP), (LPSTR)&bm);
if (lphs->ButtonDown == 2) if (lphs->ButtonDown == 2)
SelectObject(hMemDC, hDnArrowD); SelectObject(hMemDC, hDnArrowD);
else else
SelectObject(hMemDC, hDnArrow); SelectObject(hMemDC, hDnArrow);
StretchBlt(hDC, rect.left, rect.bottom - w, w, w, hMemDC, StretchBlt(hDC, rect.left, rect.bottom - h2, w, h2, hMemDC,
0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
rect.top += w; rect.top += h2;
rect.bottom -= w; rect.bottom -= h2;
} }
else { else {
GetObject(hLfArrow, sizeof(BITMAP), (LPSTR)&bm); GetObject(hLfArrow, sizeof(BITMAP), (LPSTR)&bm);
if (lphs->ButtonDown == 3) if (lphs->ButtonDown == 3)
SelectObject(hMemDC, hLfArrowD); SelectObject(hMemDC, hLfArrowD);
else else
SelectObject(hMemDC, hLfArrow); SelectObject(hMemDC, hLfArrow);
StretchBlt(hDC, rect.left, rect.top, h, h, hMemDC, StretchBlt(hDC, rect.left, rect.top, w2, h, hMemDC,
0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
GetObject(hRgArrow, sizeof(BITMAP), (LPSTR)&bm); GetObject(hRgArrow, sizeof(BITMAP), (LPSTR)&bm);
if (lphs->ButtonDown == 4) if (lphs->ButtonDown == 4)
SelectObject(hMemDC, hRgArrowD); SelectObject(hMemDC, hRgArrowD);
else else
SelectObject(hMemDC, hRgArrow); SelectObject(hMemDC, hRgArrow);
StretchBlt(hDC, rect.right - h, rect.top, h, h, hMemDC, StretchBlt(hDC, rect.right - w2, rect.top, w2, h, hMemDC,
0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
rect.left += h; rect.left += w2;
rect.right -= h; rect.right -= w2;
} }
DeleteDC(hMemDC); DeleteDC(hMemDC);
FillRect(hDC, &rect, hBrush); FillRect(hDC, &rect, hBrush);
if (lphs->Direction == WM_VSCROLL) if (lphs->MaxPix != 0) {
SetRect(&rect, rect.left, rect.top + lphs->CurPix, if (lphs->Direction == WM_VSCROLL)
rect.left + w, rect.top + lphs->CurPix + w); SetRect(&rect, rect.left, rect.top + lphs->CurPix,
else rect.left + w, rect.top + lphs->CurPix + h2);
SetRect(&rect, rect.left + lphs->CurPix, rect.top, else
rect.left + lphs->CurPix + h, rect.top + h); SetRect(&rect, rect.left + lphs->CurPix, rect.top,
/* rect.left + lphs->CurPix + w2, rect.top + h);
if (lphs->Direction == WM_VSCROLL) FrameRect(hDC, &rect, GetStockObject(BLACK_BRUSH));
SetRect(&rect, rect.left, rect.top + lphs->CurPix + w, InflateRect(&rect, -1, -1);
rect.left + w, rect.top + lphs->CurPix + (w << 1)); FillRect(hDC, &rect, GetStockObject(LTGRAY_BRUSH));
else DrawReliefRect(hDC, rect, 2, 0);
SetRect(&rect, rect.left + lphs->CurPix + h, rect.top, InflateRect(&rect, -3, -3);
rect.left + lphs->CurPix + (h << 1), rect.top + h); DrawReliefRect(hDC, rect, 1, 1);
*/ }
FrameRect(hDC, &rect, GetStockObject(BLACK_BRUSH));
InflateRect(&rect, -1, -1);
FillRect(hDC, &rect, GetStockObject(LTGRAY_BRUSH));
DrawReliefRect(hDC, rect, 2, 0);
InflateRect(&rect, -3, -3);
DrawReliefRect(hDC, rect, 1, 1);
} }
@ -508,75 +528,88 @@ int CreateScrollBarStruct(HWND hWnd)
LPHEADSCROLL AllocScrollBar(DWORD dwStyle, int width, int height) LPHEADSCROLL AllocScrollBar(DWORD dwStyle, int width, int height)
{ {
LPHEADSCROLL lphs; LPHEADSCROLL lphs;
if (hUpArrow == (HBITMAP)NULL) if (hUpArrow == (HBITMAP)NULL)
hUpArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROWI)); hUpArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROWI));
if (hDnArrow == (HBITMAP)NULL) if (hDnArrow == (HBITMAP)NULL)
hDnArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROWI)); hDnArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROWI));
if (hLfArrow == (HBITMAP)NULL) if (hLfArrow == (HBITMAP)NULL)
hLfArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROWI)); hLfArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROWI));
if (hRgArrow == (HBITMAP)NULL) if (hRgArrow == (HBITMAP)NULL)
hRgArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROWI)); hRgArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROWI));
if (hUpArrowD == (HBITMAP)NULL) if (hUpArrowD == (HBITMAP)NULL)
hUpArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROWD)); hUpArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROWD));
if (hDnArrowD == (HBITMAP)NULL) if (hDnArrowD == (HBITMAP)NULL)
hDnArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROWD)); hDnArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROWD));
if (hLfArrowD == (HBITMAP)NULL) if (hLfArrowD == (HBITMAP)NULL)
hLfArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROWD)); hLfArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROWD));
if (hRgArrowD == (HBITMAP)NULL) if (hRgArrowD == (HBITMAP)NULL)
hRgArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROWD)); hRgArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROWD));
lphs = (LPHEADSCROLL)malloc(sizeof(HEADSCROLL)); lphs = (LPHEADSCROLL)malloc(sizeof(HEADSCROLL));
if (lphs == 0) { if (lphs == 0) {
printf("Bad Memory Alloc on ScrollBar !\n"); printf("Bad Memory Alloc on ScrollBar !\n");
return NULL; return NULL;
} }
lphs->ThumbActive = FALSE; lphs->ThumbActive = FALSE;
lphs->TimerPending = FALSE; lphs->TimerPending = FALSE;
lphs->ButtonDown = 0; lphs->ButtonDown = 0;
lphs->MinVal = 0; lphs->MinVal = 0;
lphs->MaxVal = 100; lphs->MaxVal = 100;
lphs->CurVal = 0; lphs->CurVal = 0;
lphs->CurPix = 0; lphs->CurPix = 0;
if (dwStyle & WS_VSCROLL) { SetRect(&lphs->rect, 0, 0, width, height);
lphs->MaxPix = height - 3 * width; if (dwStyle & WS_VSCROLL) {
lphs->Direction = WM_VSCROLL; if (height > 3 * width)
} lphs->MaxPix = height - 3 * width;
else { else
lphs->MaxPix = width - 3 * height; lphs->MaxPix = 0;
lphs->Direction = WM_HSCROLL; lphs->Direction = WM_VSCROLL;
} }
if (lphs->MaxPix < 1) lphs->MaxPix = 1; else {
return lphs; if (width > 3 * height)
lphs->MaxPix = width - 3 * height;
else
lphs->MaxPix = 0;
lphs->Direction = WM_HSCROLL;
}
if (lphs->MaxPix < 1) lphs->MaxPix = 1;
return lphs;
} }
void NC_CreateScrollBars(HWND hWnd) void NC_CreateScrollBars(HWND hWnd)
{ {
RECT rect; RECT rect;
int width, height; int width, height;
WND *wndPtr; WND *wndPtr;
LPHEADSCROLL lphs; LPHEADSCROLL lphs;
wndPtr = WIN_FindWndPtr(hWnd); wndPtr = WIN_FindWndPtr(hWnd);
width = wndPtr->rectClient.right - wndPtr->rectClient.left; GetWindowRect(hWnd, &rect);
height = wndPtr->rectClient.bottom - wndPtr->rectClient.top; width = rect.right - rect.left;
if (wndPtr->dwStyle & WS_VSCROLL) { height = rect.bottom - rect.top;
if (wndPtr->dwStyle & WS_HSCROLL) height -= SYSMETRICS_CYHSCROLL; if (wndPtr->dwStyle & WS_VSCROLL) {
lphs = AllocScrollBar(WS_VSCROLL, SYSMETRICS_CXVSCROLL, height); if (wndPtr->dwStyle & WS_HSCROLL) height -= SYSMETRICS_CYHSCROLL;
lphs = AllocScrollBar(WS_VSCROLL, SYSMETRICS_CXVSCROLL, height);
#ifdef DEBUG_SCROLL #ifdef DEBUG_SCROLL
printf("NC_CreateScrollBars Vertical %lX !\n", lphs); printf("NC_CreateScrollBars Vertical %lX !\n", lphs);
#endif #endif
lphs->hWndOwner = hWnd; lphs->rect.left = width - SYSMETRICS_CYVSCROLL;
wndPtr->VScroll = lphs; lphs->rect.right = width;
} lphs->hWndOwner = hWnd;
if (wndPtr->dwStyle & WS_HSCROLL) { wndPtr->VScroll = lphs;
if (wndPtr->dwStyle & WS_VSCROLL) width -= SYSMETRICS_CYVSCROLL; if (wndPtr->dwStyle & WS_HSCROLL) height += SYSMETRICS_CYHSCROLL;
lphs = AllocScrollBar(WS_HSCROLL, width, SYSMETRICS_CYHSCROLL); }
if (wndPtr->dwStyle & WS_HSCROLL) {
if (wndPtr->dwStyle & WS_VSCROLL) width -= SYSMETRICS_CYVSCROLL;
lphs = AllocScrollBar(WS_HSCROLL, width, SYSMETRICS_CYHSCROLL);
#ifdef DEBUG_SCROLL #ifdef DEBUG_SCROLL
printf("NC_CreateScrollBars Horizontal %lX !\n", lphs); printf("NC_CreateScrollBars Horizontal %lX !\n", lphs);
#endif #endif
lphs->hWndOwner = hWnd; lphs->rect.top = height - SYSMETRICS_CYHSCROLL;
wndPtr->HScroll = lphs; lphs->rect.bottom = height;
} lphs->hWndOwner = hWnd;
wndPtr->HScroll = lphs;
}
} }

View File

@ -1,18 +1,21 @@
#include "../Wine.tmpl" #include "../Wine.tmpl"
#define IHavSubDirs #define IHavSubDirs
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' 'CC=$(CC)' #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' 'CC=$(CC)' 'MAKE=$(MAKE)'
MODULE = debugger MODULE = debugger
SUBDIRS = readline SUBDIRS = readline
DEFINES = -DUSE_READLINE
/* Quick and dirt hack, since i386 is defined as 1. sigh */ /* Quick and dirt hack, since i386 is defined as 1. sigh */
#define temp i386 #define temp i386
#undef i386 #undef i386
SRCS = \ SRCS = \
dbg.tab.c \ dbg.tab.c \
break.c \
hash.c \ hash.c \
lex.yy.c \ lex.yy.c \
info.c \ info.c \
@ -20,6 +23,7 @@ SRCS = \
OBJS = \ OBJS = \
dbg.tab.o \ dbg.tab.o \
break.o \
hash.o \ hash.o \
lex.yy.o \ lex.yy.o \
info.o \ info.o \

View File

@ -9,6 +9,8 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <signal.h>
#define YYSTYPE int #define YYSTYPE int
#include "regpos.h" #include "regpos.h"
@ -24,12 +26,17 @@ void issue_prompt();
%token CONT %token CONT
%token QUIT %token QUIT
%token HELP %token HELP
%token BACKTRACE
%token INFO %token INFO
%token STACK %token STACK
%token REG %token REG
%token REGS %token REGS
%token NUM %token NUM
%token ENABLE
%token DISABLE
%token BREAK
%token SET %token SET
%token MODE
%token PRINT %token PRINT
%token IDENTIFIER %token IDENTIFIER
%token NO_SYMBOL %token NO_SYMBOL
@ -49,12 +56,17 @@ void issue_prompt();
| CONT '\n' { return; }; | CONT '\n' { return; };
| SYMBOLFILE IDENTIFIER '\n' { read_symboltable($2); }; | SYMBOLFILE IDENTIFIER '\n' { read_symboltable($2); };
| DEFINE IDENTIFIER expr '\n' { add_hash($2, $3); }; | DEFINE IDENTIFIER expr '\n' { add_hash($2, $3); };
| MODE NUM { mode_command($2); };
| ENABLE NUM { enable_break($2); };
| DISABLE NUM { disable_break($2); };
| BREAK '*' expr { add_break($3); };
| x_command | x_command
| BACKTRACE '\n' { dbg_bt(); };
| print_command | print_command
| deposit_command | deposit_command
deposit_command: deposit_command:
SET REG '=' expr '\n' { regval[$2] = $4; } SET REG '=' expr '\n' { if(regval) regval[$2] = $4; else application_not_running();}
| SET '*' expr '=' expr '\n' { *((unsigned int *) $3) = $5; } | SET '*' expr '=' expr '\n' { *((unsigned int *) $3) = $5; }
| SET symbol '=' expr '\n' { *((unsigned int *) $2) = $4; } | SET symbol '=' expr '\n' { *((unsigned int *) $2) = $4; }
@ -83,7 +95,7 @@ x_command:
}; };
expr: NUM { $$ = $1; } expr: NUM { $$ = $1; }
| REG { $$ = regval[$1]; } | REG { if(regval) $$ = regval[$1]; else application_not_running();}
| symbol { $$ = *((unsigned int *) $1); } | symbol { $$ = *((unsigned int *) $1); }
| expr '+' NUM { $$ = $1 + $3; } | expr '+' NUM { $$ = $1 + $3; }
| expr '-' NUM { $$ = $1 - $3; }; | expr '-' NUM { $$ = $1 - $3; };
@ -92,6 +104,7 @@ x_command:
infocmd: INFO REGS { info_reg(); } infocmd: INFO REGS { info_reg(); }
| INFO STACK { info_stack(); }; | INFO STACK { info_stack(); };
| INFO BREAK { info_break(); };
%% %%
@ -103,10 +116,25 @@ issue_prompt(){
#endif #endif
} }
void mode_command(int newmode)
{
if(newmode == 16){
dbg_mask = 0xffff;
dbg_mode = 16;
return;
}
if(newmode == 32){
dbg_mask = 0xffffffff;
dbg_mode = 32;
return;
}
fprintf(stderr,"Invalid mode (use 16 or 32)\n");
}
static int loaded_symbols = 0; static int loaded_symbols = 0;
void void
wine_debug(int * regs) wine_debug(int signal, int * regs)
{ {
int i; int i;
#ifdef YYDEBUG #ifdef YYDEBUG
@ -143,13 +171,31 @@ wine_debug(int * regs)
}; };
#endif #endif
/* Remove the breakpoints from memory... */
insert_break(0);
/* If we stopped on a breakpoint, report this fact */
if(signal == SIGTRAP)
{
unsigned int addr;
addr = SC_EIP(dbg_mask);
if((addr & 0xffff0000) == 0 && dbg_mode == 16)
addr |= SC_CS << 16;
fprintf(stderr,"Stopped on breakpoint %d\n", get_bpnum(addr));
}
/* Show where we crashed */ /* Show where we crashed */
examine_memory(SC_EIP(dbg_mask), 1, 'i'); if(regval)
examine_memory(SC_EIP(dbg_mask), 1, 'i');
issue_prompt(); issue_prompt();
yyparse(); yyparse();
flush_symbols(); flush_symbols();
/* Re-insert the breakpoints from memory... */
insert_break(1);
fprintf(stderr,"Returning to Wine...\n"); fprintf(stderr,"Returning to Wine...\n");
} }

View File

@ -58,7 +58,7 @@ IDENTIFIER [_a-zA-Z\.~][_a-zA-Z0-9\.~]*
} }
{DIGIT}+ { {DIGIT}+ {
sscanf(yytext, "%lx", &yylval); sscanf(yytext, "%ld", &yylval);
return NUM; return NUM;
} }
@ -74,14 +74,25 @@ $edx { yylval = RN_EDX; return REG;}
$esi { yylval = RN_ESI; return REG;} $esi { yylval = RN_ESI; return REG;}
$edi { yylval = RN_EDI; return REG;} $edi { yylval = RN_EDI; return REG;}
$es { yylval = RN_ES; return REG;}
$ds { yylval = RN_DS; return REG;}
$cs { yylval = RN_CS; return REG;}
$ss { yylval = RN_SS; return REG;}
info|inf|in { return INFO; } info|inf|in { return INFO; }
break|brea|bre { return BREAK; }
enable|enabl|enab|ena { return ENABLE;}
disable|disabl|disab|disa|dis { return DISABLE; }
quit|qui|qu { return QUIT; } quit|qui|qu { return QUIT; }
help|hel|he { return HELP; } help|hel|he { return HELP; }
set|se { return SET; } set|se { return SET; }
bt { return BACKTRACE; }
cont|con|co { return CONT; } cont|con|co { return CONT; }
symbolfile|symbolfil|symbolfi|symbolf|symbol|symbo|symb { return SYMBOLFILE; } symbolfile|symbolfil|symbolfi|symbolf|symbol|symbo|symb { return SYMBOLFILE; }
@ -89,6 +100,8 @@ symbolfile|symbolfil|symbolfi|symbolf|symbol|symbo|symb { return SYMBOLFILE; }
define|defin|defi|def|de { return DEFINE; } define|defin|defi|def|de { return DEFINE; }
print|prin|pri|pr { return PRINT; } print|prin|pri|pr { return PRINT; }
mode { return MODE; }
regs|reg|re { return REGS; } regs|reg|re { return REGS; }
stack|stac|sta|st { return STACK; } stack|stac|sta|st { return STACK; }

View File

@ -16,6 +16,11 @@ extern int print_insn(char * memaddr, char * realaddr, FILE * stream, int addrle
/* THese three helper functions eliminate the need for patching the /* THese three helper functions eliminate the need for patching the
module from gdb for disassembly of code */ module from gdb for disassembly of code */
void application_not_running()
{
fprintf(stderr,"Application not running\n");
}
void read_memory(char * memaddr, char * buffer, int len){ void read_memory(char * memaddr, char * buffer, int len){
memcpy(buffer, memaddr, len); memcpy(buffer, memaddr, len);
} }
@ -36,6 +41,12 @@ void print_address(unsigned int addr, FILE * outfile){
void info_reg(){ void info_reg(){
if(!regval) {
application_not_running();
return 0;
}
fprintf(stderr,"Register dump:\n"); fprintf(stderr,"Register dump:\n");
/* First get the segment registers out of the way */ /* First get the segment registers out of the way */
fprintf(stderr," CS:%4.4x SS:%4.4x DS:%4.4x ES:%4.4x GS:%4.4x FS:%4.4x\n", fprintf(stderr," CS:%4.4x SS:%4.4x DS:%4.4x ES:%4.4x GS:%4.4x FS:%4.4x\n",
@ -60,6 +71,10 @@ void info_stack(){
unsigned int * dump; unsigned int * dump;
int i; int i;
if(!regval) {
application_not_running();
return 0;
}
fprintf(stderr,"Stack dump:\n"); fprintf(stderr,"Stack dump:\n");
dump = (int*) SC_EIP(dbg_mask); dump = (int*) SC_EIP(dbg_mask);
@ -192,11 +207,15 @@ char * helptext[] = {
"The commands accepted by the Wine debugger are a small subset", "The commands accepted by the Wine debugger are a small subset",
"of the commands that gdb would accept. The commands currently", "of the commands that gdb would accept. The commands currently",
"are:\n", "are:\n",
" info reg", " info [reg,stack,break]",
" info stack", " break <addr>",
" enable bpnum",
" disable bpnum",
" help", " help",
" quit", " quit",
" print <expr>", " print <expr>",
" bt",
" mode [16,32]",
" symbolfile <filename>", " symbolfile <filename>",
" define <identifier> <expr>", " define <identifier> <expr>",
" x <expr>", " x <expr>",
@ -228,3 +247,52 @@ void dbg_help(){
while(helptext[i]) fprintf(stderr,"%s\n", helptext[i++]); while(helptext[i]) fprintf(stderr,"%s\n", helptext[i++]);
} }
struct frame{
union{
struct {
unsigned short saved_bp;
unsigned short saved_ip;
unsigned short saved_cs;
} win16;
struct {
unsigned long saved_bp;
unsigned long saved_ip;
unsigned short saved_cs;
} win32;
} u;
};
void dbg_bt(){
struct frame * frame;
unsigned short cs;
int frameno = 0;
if(!regval) {
application_not_running();
return 0;
}
fprintf(stderr,"Backtrace:\n");
fprintf(stderr,"%d: %4.4x:%4.4x\n", frameno++, SC_CS, SC_EIP(dbg_mask));
cs = SC_CS;
frame = (struct frame *) ((SC_EBP(dbg_mask) & ~1) | (SC_SS << 16));
while((cs & 3) == 3) {
/* See if in 32 bit mode or not. Assume GDT means 32 bit. */
if ((cs & 7) != 7) {
cs = frame->u.win32.saved_cs;
fprintf(stderr,"%d %4.4x:%4.4x\n", frameno++, cs,
frame->u.win32.saved_ip);
frame = (struct frame *) frame->u.win32.saved_bp;
} else {
cs = frame->u.win16.saved_cs;
fprintf(stderr,"%d %4.4x:%4.4x\n", frameno++, cs,
frame->u.win16.saved_ip);
frame = (struct frame *) ((frame->u.win16.saved_bp & ~1) |
(SC_SS << 16));
}
}
}

View File

@ -12,6 +12,7 @@ DLLOBJS = \
dll_gdi.o \ dll_gdi.o \
dll_kernel.o \ dll_kernel.o \
dll_keyboard.o \ dll_keyboard.o \
dll_mmsystem.o \
dll_shell.o \ dll_shell.o \
dll_sound.o \ dll_sound.o \
dll_stress.o \ dll_stress.o \
@ -35,6 +36,7 @@ MakeDllFromSpec(gdi,$(TOP)/$(MODULE))
MakeDllFromSpec(kernel,$(TOP)/$(MODULE)) MakeDllFromSpec(kernel,$(TOP)/$(MODULE))
MakeDllFromSpec(keyboard,$(TOP)/$(MODULE)) MakeDllFromSpec(keyboard,$(TOP)/$(MODULE))
MakeDllFromSpec(shell,$(TOP)/$(MODULE)) MakeDllFromSpec(shell,$(TOP)/$(MODULE))
MakeDllFromSpec(mmsystem,$(TOP)/$(MODULE))
MakeDllFromSpec(sound,$(TOP)/$(MODULE)) MakeDllFromSpec(sound,$(TOP)/$(MODULE))
MakeDllFromSpec(stress,$(TOP)/$(MODULE)) MakeDllFromSpec(stress,$(TOP)/$(MODULE))
MakeDllFromSpec(unixlib,$(TOP)/$(MODULE)) MakeDllFromSpec(unixlib,$(TOP)/$(MODULE))

View File

@ -31,7 +31,7 @@ length 415
25 pascal GlobalCompact(long) GlobalCompact(1) 25 pascal GlobalCompact(long) GlobalCompact(1)
#26 GLOBALFREEALL #26 GLOBALFREEALL
#28 GLOBALMASTERHANDLE #28 GLOBALMASTERHANDLE
29 pascal Yield() Yield() 29 return Yield 0 0
30 pascal WaitEvent(word) KERNEL_WaitEvent(1) 30 pascal WaitEvent(word) KERNEL_WaitEvent(1)
#31 POSTEVENT #31 POSTEVENT
#32 SETPRIORITY #32 SETPRIORITY
@ -119,7 +119,7 @@ length 415
#114 __AHINCR #114 __AHINCR
115 pascal OutputDebugString(ptr) OutputDebugString(1) 115 pascal OutputDebugString(ptr) OutputDebugString(1)
#116 INITLIB #116 INITLIB
117 pascal OldYield() Yield() 117 return OldYield 0 0
#118 GETTASKQUEUEDS #118 GETTASKQUEUEDS
#119 GETTASKQUEUEES #119 GETTASKQUEUEES
#120 UNDEFDYNLINK #120 UNDEFDYNLINK
@ -147,7 +147,7 @@ length 415
#139 DOSIGNAL #139 DOSIGNAL
#140 SETSIGHANDLER #140 SETSIGHANDLER
#141 INITTASK1 #141 INITTASK1
150 pascal DirectedYield() Yield() 150 return DirectedYield 2 0
#151 WINOLDAPCALL #151 WINOLDAPCALL
152 pascal GetNumTasks() GetNumTasks() 152 pascal GetNumTasks() GetNumTasks()
154 return GlobalNotify 4 0 154 return GlobalNotify 4 0

View File

@ -1,16 +0,0 @@
add $8,%esp
popw %es
add $2,%esp
popw %ds
add $2,%esp
popl %edi
popl %esi
popl %ebp
add $4,%esp
popl %ebx
popl %edx
popl %ecx
popl %eax
add $16,%esp
popfl
add $20,%esp

View File

@ -24,7 +24,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#define DEBUG_RELAY /* */ #define DEBUG_RELAY /* */
#define N_BUILTINS 10 #define N_BUILTINS 11
struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] = struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] =
{ {
@ -37,7 +37,8 @@ struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] =
{ "SOUND", SOUND_table, 20, 7 }, { "SOUND", SOUND_table, 20, 7 },
{ "KEYBOARD",KEYBOARD_table,137, 8 }, { "KEYBOARD",KEYBOARD_table,137, 8 },
{ "WINSOCK", WINSOCK_table, 155, 9 }, { "WINSOCK", WINSOCK_table, 155, 9 },
{ "STRESS", STRESS_table, 15,10 }, { "STRESS", STRESS_table, 15, 10},
{ "MMSYSTEM",MMSYSTEM_table,1023,11},
}; };
unsigned short *Stack16Frame; unsigned short *Stack16Frame;

View File

@ -13,6 +13,7 @@ length 103
2 pascal RegCreateKey() RegCreateKey() 2 pascal RegCreateKey() RegCreateKey()
3 pascal RegCloseKey() RegCloseKey() 3 pascal RegCloseKey() RegCloseKey()
4 pascal RegDeleteKey() RegDeleteKey() 4 pascal RegDeleteKey() RegDeleteKey()
9 pascal DragAcceptFiles() DragAcceptFiles()
20 pascal ShellExecute(ptr) ShellExecute(1) 20 pascal ShellExecute(ptr) ShellExecute(1)
102 pascal RegisterShellHook(ptr) RegisterShellHook(1) 102 pascal RegisterShellHook(ptr) RegisterShellHook(1)
103 pascal ShellHookProc() ShellHookProc() 103 pascal ShellHookProc() ShellHookProc()
@ -21,7 +22,6 @@ length 103
# 33 9 0136 ABOUTDLGPROC exported, shared data # 33 9 0136 ABOUTDLGPROC exported, shared data
# 34 10 021a EXTRACTICON exported, shared data # 34 10 021a EXTRACTICON exported, shared data
# 21 4 1154 FINDEXECUTABLE exported, shared data # 21 4 1154 FINDEXECUTABLE exported, shared data
# 9 6 0052 DRAGACCEPTFILES exported, shared data
#100 4 0550 HERETHARBETYGARS exported, shared data #100 4 0550 HERETHARBETYGARS exported, shared data
# 38 5 0000 FINDENVIRONMENTSTRING exported, shared data # 38 5 0000 FINDENVIRONMENTSTRING exported, shared data
# 7 2 14dc REGENUMKEY exported, shared data # 7 2 14dc REGENUMKEY exported, shared data

View File

@ -15,3 +15,10 @@ length 20
8 pascal SETVOICESOUND(word long word) SetVoiceSound(1 2 3) 8 pascal SETVOICESOUND(word long word) SetVoiceSound(1 2 3)
9 pascal STARTSOUND() StartSound() 9 pascal STARTSOUND() StartSound()
10 pascal STOPSOUND() StopSound() 10 pascal STOPSOUND() StopSound()
11 pascal WAITSOUNDSTATE(word) WaitSoundState(1)
12 pascal SYNCALLVOICES() SyncAllVoices()
13 pascal COUNTVOICENOTES(word) CountVoiceNotes(1)
14 pascal GETTHRESHOLDEVENT() GetThresholdEvent()
15 pascal GETTHRESHOLDSTATUS() GetThresholdStatus()
16 pascal SETVOICETHRESHOLD(word word) SetVoiceThreshold(1 2)
17 pascal DOBEEP() DoBeep()

View File

@ -54,7 +54,7 @@ length 540
49 pascal IsWindowVisible(word) IsWindowVisible(1) 49 pascal IsWindowVisible(word) IsWindowVisible(1)
50 pascal FindWindow(ptr ptr) FindWindow(1 2) 50 pascal FindWindow(ptr ptr) FindWindow(1 2)
#51 BEAR51 #51 BEAR51
#52 ANYPOPUP 52 pascal AnyPopup() AnyPopup()
53 pascal DestroyWindow(word) DestroyWindow(1) 53 pascal DestroyWindow(word) DestroyWindow(1)
54 pascal EnumWindows(ptr long) EnumWindows(1 2) 54 pascal EnumWindows(ptr long) EnumWindows(1 2)
55 pascal EnumChildWindows(word ptr long) EnumChildWindows(1 2 3) 55 pascal EnumChildWindows(word ptr long) EnumChildWindows(1 2 3)
@ -317,7 +317,7 @@ length 540
325 pascal PaintRect(word word word word ptr) PaintRect(1 2 3 4 5) 325 pascal PaintRect(word word word word ptr) PaintRect(1 2 3 4 5)
#326 GETCONTROLBRUSH #326 GETCONTROLBRUSH
#331 ENABLEHARDWAREINPUT #331 ENABLEHARDWAREINPUT
332 pascal UserYield() Yield() 332 return UserYield 0 0
#333 ISUSERIDLE #333 ISUSERIDLE
334 pascal GetQueueStatus(word) GetQueueStatus(1) 334 pascal GetQueueStatus(word) GetQueueStatus(1)
335 pascal GetInputState() GetInputState() 335 pascal GetInputState() GetInputState()

View File

@ -59,6 +59,7 @@ extern struct dll_table_entry_s USER_table[];
extern struct dll_table_entry_s GDI_table[]; extern struct dll_table_entry_s GDI_table[];
extern struct dll_table_entry_s UNIXLIB_table[]; extern struct dll_table_entry_s UNIXLIB_table[];
extern struct dll_table_entry_s WIN87EM_table[]; extern struct dll_table_entry_s WIN87EM_table[];
extern struct dll_table_entry_s MMSYSTEM_table[];
extern struct dll_table_entry_s SHELL_table[]; extern struct dll_table_entry_s SHELL_table[];
extern struct dll_table_entry_s SOUND_table[]; extern struct dll_table_entry_s SOUND_table[];
extern struct dll_table_entry_s KEYBOARD_table[]; extern struct dll_table_entry_s KEYBOARD_table[];

View File

@ -12,14 +12,12 @@ typedef struct tagMENUITEM
{ {
struct tagMENUITEM *next; struct tagMENUITEM *next;
struct tagMENUITEM *prev; struct tagMENUITEM *prev;
struct tagMENUITEM *child; HANDLE hItem;
struct tagMENUITEM *parent;
WORD item_flags; WORD item_flags;
WORD item_id; WORD item_id;
WORD sel_key; WORD sel_key;
char *shortcut;
char *item_text; char *item_text;
char menu_name[10]; HANDLE hText;
RECT rect; RECT rect;
HBITMAP hCheckBit; HBITMAP hCheckBit;
HBITMAP hUnCheckBit; HBITMAP hUnCheckBit;

View File

@ -16,6 +16,7 @@ struct options
int synchronous; int synchronous;
short cmdShow; short cmdShow;
int relay_debug; int relay_debug;
int debug;
}; };
extern struct options Options; extern struct options Options;

View File

@ -10,6 +10,8 @@ typedef struct tagHEADSSCROLL {
short MaxPix; short MaxPix;
short CurPix; short CurPix;
RECT rect; RECT rect;
RECT rectUp;
RECT rectDown;
BOOL ThumbActive; BOOL ThumbActive;
BOOL TimerPending; BOOL TimerPending;
WORD ButtonDown; WORD ButtonDown;

View File

@ -65,6 +65,15 @@ struct sigcontext_struct {
}; };
#endif #endif
#ifdef linux
#define WINE_DATA_SELECTOR 0x2b
#define WINE_CODE_SELECTOR 0x23
#endif
#if defined(__NetBSD__) || defined(__FreeBSD__)
#define WINE_DATA_SELECTOR 0x27
#define WINE_CODE_SELECTOR 0x1f
#endif
#if defined(__NetBSD__) || defined(__FreeBSD__) #if defined(__NetBSD__) || defined(__FreeBSD__)
#include <signal.h> #include <signal.h>
#define sigcontext_struct sigcontext #define sigcontext_struct sigcontext

View File

@ -3,6 +3,10 @@
*/ */
static char Copyright[] = "Copyright Martin Ayotte, 1994"; static char Copyright[] = "Copyright Martin Ayotte, 1994";
/*
#define DEBUG_MODULE
*/
#ifndef WINELIB #ifndef WINELIB
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -31,7 +35,7 @@ typedef MODULEENTRY *LPMODULEENTRY;
static LPMODULEENTRY lpModList = NULL; static LPMODULEENTRY lpModList = NULL;
extern struct w_files * wine_files; extern struct w_files * wine_files;
#define N_BUILTINS 10 #define N_BUILTINS 11
extern struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS]; extern struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS];
@ -43,6 +47,7 @@ HANDLE GetModuleHandle(LPSTR lpModuleName)
register struct w_files *w = wine_files; register struct w_files *w = wine_files;
int i; int i;
printf("GetModuleHandle('%s');\n", lpModuleName); printf("GetModuleHandle('%s');\n", lpModuleName);
printf("GetModuleHandle // searching in loaded modules\n");
while (w) { while (w) {
/* printf("GetModuleHandle // '%s' \n", w->name); */ /* printf("GetModuleHandle // '%s' \n", w->name); */
if (strcmp(w->name, lpModuleName) == 0) { if (strcmp(w->name, lpModuleName) == 0) {
@ -52,7 +57,9 @@ HANDLE GetModuleHandle(LPSTR lpModuleName)
} }
w = w->next; w = w->next;
} }
printf("GetModuleHandle // searching in builtin libraries\n");
for (i = 0; i < N_BUILTINS; i++) { for (i = 0; i < N_BUILTINS; i++) {
if (dll_builtin_table[i].dll_name == NULL) break;
if (strcmp(dll_builtin_table[i].dll_name, lpModuleName) == 0) { if (strcmp(dll_builtin_table[i].dll_name, lpModuleName) == 0) {
printf("GetModuleHandle('%s') return %04X \n", printf("GetModuleHandle('%s') return %04X \n",
lpModuleName, 0xFF00 + i); lpModuleName, 0xFF00 + i);
@ -83,12 +90,17 @@ int GetModuleUsage(HANDLE hModule)
int GetModuleFileName(HANDLE hModule, LPSTR lpFileName, short nSize) int GetModuleFileName(HANDLE hModule, LPSTR lpFileName, short nSize)
{ {
struct w_files *w; struct w_files *w;
LPSTR str;
printf("GetModuleFileName(%04X, %08X, %d);\n", hModule, lpFileName, nSize); printf("GetModuleFileName(%04X, %08X, %d);\n", hModule, lpFileName, nSize);
if (lpFileName == NULL) return 0; if (lpFileName == NULL) return 0;
if (nSize < 1) return 0;
w = GetFileInfo(hModule); w = GetFileInfo(hModule);
if (w == NULL) return 0; if (w == NULL) return 0;
if (nSize > strlen(w->name)) nSize = strlen(w->name) + 1; str = w->filename;
strncpy(lpFileName, w->name, nSize); if (str[0] == '/') str++;
if (nSize > strlen(str)) nSize = strlen(str) + 1;
strncpy(lpFileName, str, nSize);
ToDos(lpFileName);
printf("GetModuleFileName copied '%s' return %d \n", lpFileName, nSize); printf("GetModuleFileName copied '%s' return %d \n", lpFileName, nSize);
return nSize - 1; return nSize - 1;
} }
@ -100,43 +112,59 @@ int GetModuleFileName(HANDLE hModule, LPSTR lpFileName, short nSize)
HANDLE LoadLibrary(LPSTR libname) HANDLE LoadLibrary(LPSTR libname)
{ {
HANDLE hModule; HANDLE hModule;
LPMODULEENTRY lpMod = lpModList; LPMODULEENTRY lpMod = lpModList;
LPMODULEENTRY lpNewMod; LPMODULEENTRY lpNewMod;
if (FindDLLTable(libname))
{
return WINE_CODE_SELECTOR;
}
printf("LoadLibrary '%s'\n", libname); printf("LoadLibrary '%s'\n", libname);
if (lpMod != NULL) { if (lpMod != NULL)
while (TRUE) { {
if (strcmp(libname, lpMod->FileName) == 0) { while (TRUE)
lpMod->Count++; {
printf("LoadLibrary // already loaded hInst=%04X\n", lpMod->hInst); if (strcmp(libname, lpMod->FileName) == 0)
return lpMod->hInst; {
} lpMod->Count++;
if (lpMod->lpNextModule == NULL) break; printf("LoadLibrary // already loaded hInst=%04X\n",
lpMod = lpMod->lpNextModule; lpMod->hInst);
} return lpMod->hInst;
} }
hModule = GlobalAlloc(GMEM_MOVEABLE, sizeof(MODULEENTRY)); if (lpMod->lpNextModule == NULL) break;
lpNewMod = (LPMODULEENTRY) GlobalLock(hModule); lpMod = lpMod->lpNextModule;
}
}
hModule = GlobalAlloc(GMEM_MOVEABLE, sizeof(MODULEENTRY));
lpNewMod = (LPMODULEENTRY) GlobalLock(hModule);
#ifdef DEBUG_LIBRARY #ifdef DEBUG_LIBRARY
printf("LoadLibrary // creating new module entry %08X\n", lpNewMod); printf("LoadLibrary // creating new module entry %08X\n", lpNewMod);
#endif #endif
if (lpNewMod == NULL) return 0; if (lpNewMod == NULL)
if (lpModList == NULL) { return 0;
lpModList = lpNewMod; if (lpModList == NULL)
lpNewMod->lpPrevModule = NULL; {
} lpModList = lpNewMod;
else { lpNewMod->lpPrevModule = NULL;
lpMod->lpNextModule = lpNewMod; }
lpNewMod->lpPrevModule = lpMod; else
} {
lpNewMod->lpNextModule = NULL; lpMod->lpNextModule = lpNewMod;
lpNewMod->hModule = hModule; lpNewMod->lpPrevModule = lpMod;
lpNewMod->ModuleName = NULL; }
lpNewMod->FileName = (LPSTR) malloc(strlen(libname));
if (lpNewMod->FileName != NULL) strcpy(lpNewMod->FileName, libname); lpNewMod->lpNextModule = NULL;
lpNewMod->hInst = LoadImage(libname, DLL); lpNewMod->hModule = hModule;
lpNewMod->Count = 1; lpNewMod->ModuleName = NULL;
lpNewMod->FileName = (LPSTR) malloc(strlen(libname));
if (lpNewMod->FileName != NULL)
strcpy(lpNewMod->FileName, libname);
lpNewMod->hInst = LoadImage(libname, DLL);
lpNewMod->Count = 1;
printf("LoadLibrary returned Library hInst=%04X\n", lpNewMod->hInst); printf("LoadLibrary returned Library hInst=%04X\n", lpNewMod->hInst);
GlobalUnlock(hModule); GlobalUnlock(hModule);
return lpNewMod->hInst; return lpNewMod->hInst;
} }
@ -219,10 +247,11 @@ FARPROC GetProcAddress(HANDLE hModule, char *proc_name)
strncpy(C, cpnt, len); strncpy(C, cpnt, len);
C[len] = '\0'; C[len] = '\0';
#ifdef DEBUG_MODULE #ifdef DEBUG_MODULE
printf("pointing Function '%s' !\n", C); printf("pointing Function '%s' ordinal=%d !\n",
C, *((unsigned short *)(cpnt + len)));
#endif #endif
if (strncmp(cpnt, proc_name, len) == 0) { if (strncmp(cpnt, proc_name, len) == 0) {
ordinal = *((unsigned short *) (cpnt + len)); ordinal = *((unsigned short *)(cpnt + len));
break; break;
} }
cpnt += len + 2; cpnt += len + 2;

View File

@ -890,9 +890,14 @@ LoadString(HANDLE instance, WORD resource_id, LPSTR buffer, int buflen)
p += *p + 1; p += *p + 1;
i = MIN(buflen - 1, *p); i = MIN(buflen - 1, *p);
memcpy(buffer, p + 1, i); if (i > 0) {
buffer[i] = '\0'; memcpy(buffer, p + 1, i);
buffer[i] = '\0';
}
else {
printf("LoadString // I dont know why , but caller give buflen=%d *p=%d !\n", buflen, *p);
printf("LoadString // and try to obtain string '%s'\n", p + 1);
}
GlobalFree(hmem); GlobalFree(hmem);
#ifdef DEBUG_RESOURCE #ifdef DEBUG_RESOURCE

View File

@ -56,8 +56,15 @@ static void win_fault(int signal, int code, struct sigcontext *scp)
/* First take care of a few preliminaries */ /* First take care of a few preliminaries */
#ifdef linux #ifdef linux
if(signal != SIGSEGV) if(signal != SIGSEGV && signal != SIGTRAP)
exit(1); exit(1);
/* And back up over the int3 instruction. */
if(signal == SIGTRAP) {
scp->sc_eip--;
goto oops;
};
if((scp->sc_cs & 7) != 7) if((scp->sc_cs & 7) != 7)
{ {
#endif #endif
@ -168,7 +175,7 @@ static void win_fault(int signal, int code, struct sigcontext *scp)
XFlush(display); XFlush(display);
fprintf(stderr,"In win_fault %x:%x\n", scp->sc_cs, scp->sc_eip); fprintf(stderr,"In win_fault %x:%x\n", scp->sc_cs, scp->sc_eip);
#ifdef linux #ifdef linux
wine_debug(scp); /* Enter our debugger */ wine_debug(signal, scp); /* Enter our debugger */
#else #else
fprintf(stderr,"Stack: %x:%x\n", scp->sc_ss, scp->sc_esp); fprintf(stderr,"Stack: %x:%x\n", scp->sc_ss, scp->sc_esp);
dump = (int*) scp; dump = (int*) scp;
@ -192,6 +199,7 @@ int init_wine_signals(void)
segv_act.sa_restorer = segv_act.sa_restorer =
(void (*)()) (((unsigned int)(cstack) + sizeof(cstack) - 4) & ~3); (void (*)()) (((unsigned int)(cstack) + sizeof(cstack) - 4) & ~3);
wine_sigaction(SIGSEGV, &segv_act, NULL); wine_sigaction(SIGSEGV, &segv_act, NULL);
wine_sigaction(SIGTRAP, &segv_act, NULL); /* For breakpoints */
#endif #endif
#if defined(__NetBSD__) || defined(__FreeBSD__) #if defined(__NetBSD__) || defined(__FreeBSD__)
struct sigstack ss; struct sigstack ss;

View File

@ -3,6 +3,10 @@
*/ */
static char Copyright[] = "Copyright Martin Ayotte, 1994"; static char Copyright[] = "Copyright Martin Ayotte, 1994";
/*
#define DEBUG_TASK
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -14,7 +18,6 @@ static LPTASKENTRY lpTaskList = NULL;
static int nTaskCount = 0; static int nTaskCount = 0;
/********************************************************************** /**********************************************************************
* GetCurrentTask [KERNEL.36] * GetCurrentTask [KERNEL.36]
*/ */
@ -22,15 +25,18 @@ HTASK GetCurrentTask()
{ {
LPTASKENTRY lpTask = lpTaskList; LPTASKENTRY lpTask = lpTaskList;
int pid = getpid(); int pid = getpid();
#ifdef DEBUG_TASK
printf("GetCurrentTask() // unix_pid=%08X !\n", pid); printf("GetCurrentTask() // unix_pid=%08X !\n", pid);
#endif
if (lpTask == NULL) return 0; if (lpTask == NULL) return 0;
while (TRUE) { while (TRUE) {
printf("GetCurrentTask() // searching lpTask->unix_pid=%08 !\n", lpTask->unix_pid);
if (lpTask->unix_pid == pid) break; if (lpTask->unix_pid == pid) break;
if (lpTask->lpNextTask == NULL) return 0; if (lpTask->lpNextTask == NULL) return 0;
lpTask = lpTask->lpNextTask; lpTask = lpTask->lpNextTask;
} }
#ifdef DEBUG_TASK
printf("GetCurrentTask() returned hTask=%04X !\n", lpTask->hTask); printf("GetCurrentTask() returned hTask=%04X !\n", lpTask->hTask);
#endif
return lpTask->hTask; return lpTask->hTask;
} }
@ -50,7 +56,27 @@ WORD GetNumTasks()
*/ */
HTASK GetWindowTask(HWND hWnd) HTASK GetWindowTask(HWND hWnd)
{ {
HWND *wptr;
int count;
LPTASKENTRY lpTask = lpTaskList;
printf("GetWindowTask(%04X) !\n", hWnd); printf("GetWindowTask(%04X) !\n", hWnd);
while (lpTask != NULL) {
wptr = lpTask->lpWndList;
if (wptr != NULL) {
count = 0;
while (++count < MAXWIN_PER_TASK) {
printf("GetWindowTask // searching %04X %04X !\n",
lpTask->hTask, *(wptr));
if (*(wptr) == hWnd) {
printf("GetWindowTask(%04X) found hTask=%04X !\n",
hWnd, lpTask->hTask);
return lpTask->hTask;
}
wptr++;
}
}
lpTask = lpTask->lpNextTask;
}
return 0; return 0;
} }
@ -60,8 +86,34 @@ HTASK GetWindowTask(HWND hWnd)
*/ */
BOOL EnumTaskWindows(HANDLE hTask, FARPROC lpEnumFunc, LONG lParam) BOOL EnumTaskWindows(HANDLE hTask, FARPROC lpEnumFunc, LONG lParam)
{ {
HWND *wptr, hWnd;
BOOL bRet;
int count = 0;
LPTASKENTRY lpTask = lpTaskList;
printf("EnumTaskWindows(%04X, %08X, %08X) !\n", hTask, lpEnumFunc, lParam); printf("EnumTaskWindows(%04X, %08X, %08X) !\n", hTask, lpEnumFunc, lParam);
return FALSE; while (TRUE) {
if (lpTask->hTask == hTask) break;
if (lpTask == NULL) {
printf("EnumTaskWindows // hTask=%04X not found !\n", hTask);
return FALSE;
}
lpTask = lpTask->lpNextTask;
}
printf("EnumTaskWindows // found hTask=%04X !\n", hTask);
wptr = lpTask->lpWndList;
if (wptr == NULL) return FALSE;
while ((hWnd = *(wptr++)) != 0) {
if (++count >= MAXWIN_PER_TASK) return FALSE;
printf("EnumTaskWindows // hWnd=%04X count=%d !\n", hWnd, count);
#ifdef WINELIB
if (lpEnumFunc != NULL) bRet = (*lpEnumFunc)(hWnd, lParam);
#else
if (lpEnumFunc != NULL)
bRet = CallBack16(lpEnumFunc, 2, lParam, (int) hWnd);
#endif
if (bRet == 0) break;
}
return TRUE;
} }
@ -96,15 +148,18 @@ HANDLE CreateNewTask(HINSTANCE hInst)
lpNewTask->lpNextTask = NULL; lpNewTask->lpNextTask = NULL;
lpNewTask->hIcon = 0; lpNewTask->hIcon = 0;
lpNewTask->hModule = 0; lpNewTask->hModule = 0;
lpNewTask->hInst = hInst;
lpNewTask->hTask = hTask; lpNewTask->hTask = hTask;
lpNewTask->unix_pid = getpid();
lpNewTask->lpWndList = (HWND *) malloc(MAXWIN_PER_TASK * sizeof(HWND)); lpNewTask->lpWndList = (HWND *) malloc(MAXWIN_PER_TASK * sizeof(HWND));
if (lpNewTask->lpWndList != NULL) if (lpNewTask->lpWndList != NULL)
memset((LPSTR)lpNewTask->lpWndList, 0, MAXWIN_PER_TASK * sizeof(HWND)); memset((LPSTR)lpNewTask->lpWndList, 0, MAXWIN_PER_TASK * sizeof(HWND));
lpNewTask->hInst = hInst; #ifdef DEBUG_TASK
lpNewTask->unix_pid = getpid();
printf("CreateNewTask // unix_pid=%08X return hTask=%04X\n", printf("CreateNewTask // unix_pid=%08X return hTask=%04X\n",
lpNewTask->unix_pid, hTask); lpNewTask->unix_pid, hTask);
#endif
GlobalUnlock(hTask); GlobalUnlock(hTask);
nTaskCount++;
return hTask; return hTask;
} }
@ -117,18 +172,27 @@ BOOL AddWindowToTask(HTASK hTask, HWND hWnd)
HWND *wptr; HWND *wptr;
int count = 0; int count = 0;
LPTASKENTRY lpTask = lpTaskList; LPTASKENTRY lpTask = lpTaskList;
#ifdef DEBUG_TASK
printf("AddWindowToTask(%04X, %04X); !\n", hTask, hWnd); printf("AddWindowToTask(%04X, %04X); !\n", hTask, hWnd);
#endif
while (TRUE) { while (TRUE) {
if (lpTask->hTask == hTask) break; if (lpTask->hTask == hTask) break;
if (lpTask == NULL) return FALSE; if (lpTask == NULL) {
printf("AddWindowToTask // hTask=%04X not found !\n", hTask);
return FALSE;
}
lpTask = lpTask->lpNextTask; lpTask = lpTask->lpNextTask;
} }
wptr = lpTask->lpWndList; wptr = lpTask->lpWndList;
if (wptr == NULL) return FALSE; if (wptr == NULL) return FALSE;
while (*(wptr++) != 0) { while (*(wptr) != 0) {
if (++count >= MAXWIN_PER_TASK) return FALSE; if (++count >= MAXWIN_PER_TASK) return FALSE;
wptr++;
} }
*wptr = hWnd; *wptr = hWnd;
#ifdef DEBUG_TASK
printf("AddWindowToTask // window added, count=%d !\n", count);
#endif
return TRUE; return TRUE;
} }
@ -141,18 +205,31 @@ BOOL RemoveWindowFromTask(HTASK hTask, HWND hWnd)
HWND *wptr; HWND *wptr;
int count = 0; int count = 0;
LPTASKENTRY lpTask = lpTaskList; LPTASKENTRY lpTask = lpTaskList;
printf("AddWindowToTask(%04X, %04X); !\n", hTask, hWnd); #ifdef DEBUG_TASK
printf("RemoveWindowToTask(%04X, %04X); !\n", hTask, hWnd);
#endif
while (TRUE) { while (TRUE) {
if (lpTask->hTask == hTask) break; if (lpTask->hTask == hTask) break;
if (lpTask == NULL) return FALSE; if (lpTask == NULL) {
printf("RemoveWindowFromTask // hTask=%04X not found !\n", hTask);
return FALSE;
}
lpTask = lpTask->lpNextTask; lpTask = lpTask->lpNextTask;
} }
wptr = lpTask->lpWndList; wptr = lpTask->lpWndList;
if (wptr == NULL) return FALSE; if (wptr == NULL) return FALSE;
while (*(wptr++) != hWnd) { while (*(wptr) != hWnd) {
if (++count >= MAXWIN_PER_TASK) return FALSE; if (++count >= MAXWIN_PER_TASK) return FALSE;
wptr++;
} }
*wptr = 0; while (*(wptr) != 0) {
*(wptr) = *(wptr + 1);
if (++count >= MAXWIN_PER_TASK) return FALSE;
wptr++;
}
#ifdef DEBUG_TASK
printf("RemoveWindowFromTask // window removed, count=%d !\n", --count);
#endif
return TRUE; return TRUE;
} }

View File

@ -23,6 +23,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "windows.h" #include "windows.h"
#include "wineopts.h" #include "wineopts.h"
#include "arch.h" #include "arch.h"
#include "options.h"
/* #define DEBUG_FIXUP */ /* #define DEBUG_FIXUP */
@ -350,6 +351,8 @@ _WinMain(int argc, char **argv)
ss_reg = wine_files->selector_table[wine_files->ne_header->ss-1].selector; ss_reg = wine_files->selector_table[wine_files->ne_header->ss-1].selector;
sp_reg = wine_files->ne_header->sp; 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); rv = CallToInit16(cs_reg << 16 | ip_reg, ss_reg << 16 | sp_reg, ds_reg);
printf ("rv = %x\n", rv); printf ("rv = %x\n", rv);
} }

View File

@ -163,6 +163,10 @@ GlobalAlloc(unsigned int flags, unsigned long size)
GDESC *g_prev; GDESC *g_prev;
void *m; void *m;
#ifdef DEBUG_HEAP
printf("GlobalAlloc flags %4X, size %d\n", flags, size);
#endif
/* /*
* If this block is fixed or very big we need to allocate entire * If this block is fixed or very big we need to allocate entire
* segments. * segments.

View File

@ -116,14 +116,23 @@ HEAP_ReAlloc(MDESC **free_list, void *old_block,
{ {
MDESC *m_free; MDESC *m_free;
MDESC *m; MDESC *m;
/* /*
* Check validity of block * Check validity of block
*/ */
m = (MDESC *) old_block - 1; m = (MDESC *) old_block - 1;
if (m->prev != m || m->next != m || #ifdef DEBUG_HEAP
printf("HEAP_ReAlloc new_size=%d !\n", new_size);
printf("HEAP_ReAlloc old_block=%08X !\n", old_block);
printf("HEAP_ReAlloc m=%08X free_list=%08X !\n", m, free_list);
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);
#endif
if (m->prev != m || m->next != m ||
((int) m & 0xffff0000) != ((int) *free_list & 0xffff0000)) ((int) m & 0xffff0000) != ((int) *free_list & 0xffff0000))
{ {
printf("Attempt to resize bad pointer, m = %08x, *free_list = %08x\n",
m, free_list);
#ifdef DEBUG_HEAP #ifdef DEBUG_HEAP
printf("Attempt to resize bad pointer, m = %08x, *free_list = %08x\n", printf("Attempt to resize bad pointer, m = %08x, *free_list = %08x\n",
m, free_list); m, free_list);
@ -134,6 +143,9 @@ HEAP_ReAlloc(MDESC **free_list, void *old_block,
/* /*
* Check for grow block * Check for grow block
*/ */
#ifdef DEBUG_HEAP
printf("HEAP_ReAlloc Check for grow block !\n");
#endif
if (new_size > m->length) if (new_size > m->length)
{ {
m_free = m + 1 + m->length / sizeof(MDESC); m_free = m + 1 + m->length / sizeof(MDESC);
@ -142,7 +154,6 @@ HEAP_ReAlloc(MDESC **free_list, void *old_block,
m_free->length + sizeof(MDESC) < new_size) m_free->length + sizeof(MDESC) < new_size)
{ {
void *new_p = HEAP_Alloc(free_list, flags, new_size); void *new_p = HEAP_Alloc(free_list, flags, new_size);
if (new_p ==NULL) if (new_p ==NULL)
return NULL; return NULL;
memcpy(new_p, old_block, m->length); memcpy(new_p, old_block, m->length);
@ -159,6 +170,9 @@ HEAP_ReAlloc(MDESC **free_list, void *old_block,
m_free->next->prev = m_free->prev; m_free->next->prev = m_free->prev;
m->length += sizeof(MDESC) + m_free->length; m->length += sizeof(MDESC) + m_free->length;
#ifdef DEBUG_HEAP
printf("HEAP_ReAlloc before GLOBAL_FLAGS_ZEROINIT !\n");
#endif
if (flags & GLOBAL_FLAGS_ZEROINIT) if (flags & GLOBAL_FLAGS_ZEROINIT)
memset(m_free, '\0', sizeof(MDESC) + m_free->length); memset(m_free, '\0', sizeof(MDESC) + m_free->length);
} }
@ -166,6 +180,9 @@ HEAP_ReAlloc(MDESC **free_list, void *old_block,
/* /*
* Check for shrink block. * Check for shrink block.
*/ */
#ifdef DEBUG_HEAP
printf("HEAP_ReAlloc Check for shrink block !\n");
#endif
if (new_size < m->length - 4 * sizeof(MDESC)) if (new_size < m->length - 4 * sizeof(MDESC))
{ {
m_free = m + new_size / sizeof(MDESC) + 2; m_free = m + new_size / sizeof(MDESC) + 2;
@ -422,7 +439,7 @@ WIN16_LocalInit(unsigned int segment, unsigned int start, unsigned int end)
HEAP_Init(&lh->free_list, HEAP_Init(&lh->free_list,
(void *) ((segment << 16) | start), end - start + 1); (void *) ((segment << 16) | start), end - start + 1);
} }
printf("WIN16_LocalInit // return segment=%04X !\n", segment);
return segment; return segment;
} }
@ -447,10 +464,14 @@ WIN16_LocalLock(unsigned int handle)
* WIN16_LocalReAlloc * WIN16_LocalReAlloc
*/ */
void * void *
WIN16_LocalReAlloc(unsigned int handle, int flags, int bytes) WIN16_LocalReAlloc(unsigned int handle, int bytes, int flags)
{ {
void *m; void *m;
#ifdef DEBUG_HEAP
printf("WIN16_LocalReAlloc(%04X, %d, %04X); !\n", handle, bytes, flags);
printf("WIN16_LocalReAlloc // LOCALHEAP()=%08X !\n", LOCALHEAP());
printf("WIN16_LocalReAlloc // *LOCALHEAP()=%08X !\n", *LOCALHEAP());
#endif
m = HEAP_ReAlloc(LOCALHEAP(), (void *) m = HEAP_ReAlloc(LOCALHEAP(), (void *)
(((int) *LOCALHEAP() & 0xffff0000) | (handle & 0xffff)), (((int) *LOCALHEAP() & 0xffff0000) | (handle & 0xffff)),
bytes, flags); bytes, flags);

View File

@ -14,6 +14,7 @@ SRCS = \
lstr.c \ lstr.c \
main.c \ main.c \
message.c \ message.c \
mmsystem.c \
profile.c \ profile.c \
property.c \ property.c \
rect.c \ rect.c \

View File

@ -53,23 +53,30 @@ static struct dosdirent DosDirs[MAX_OPEN_DIRS];
static void ExpandTildeString(char *s) static void ExpandTildeString(char *s)
{ {
struct passwd *entry; struct passwd *entry;
char temp[1024], *ptr = temp; char temp[1024], *ptr = temp;
strcpy(temp, s); strcpy(temp, s);
while (*ptr)
{ while (*ptr)
if (*ptr != '~') { {
*s++ = *ptr++; if (*ptr != '~')
continue; {
} *s++ = *ptr++;
ptr++; continue;
if ( (entry = getpwuid(getuid())) == NULL) {
continue;
}
strcpy(s, entry->pw_dir);
s += strlen(entry->pw_dir);
} }
ptr++;
if ( (entry = getpwuid(getuid())) == NULL)
{
continue;
}
strcpy(s, entry->pw_dir);
s += strlen(entry->pw_dir);
}
*s = 0;
} }
void ChopOffSlash(char *path) void ChopOffSlash(char *path)

View File

@ -7,6 +7,11 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include "neexe.h"
#include "segmem.h"
#include "prototypes.h"
#include "dlls.h"
#include "wine.h"
#include "windows.h" #include "windows.h"
#define HELP_CONTEXT 0x0001 #define HELP_CONTEXT 0x0001
@ -24,6 +29,8 @@
#define HELP_MULTIKEY 0x0201 #define HELP_MULTIKEY 0x0201
#define HELP_SETWINPOS 0x0203 #define HELP_SETWINPOS 0x0203
extern struct w_files * wine_files;
typedef struct { typedef struct {
WORD wEnvSeg; WORD wEnvSeg;
LPSTR lpCmdLine; LPSTR lpCmdLine;
@ -31,8 +38,97 @@ typedef struct {
DWORD dwReserved; DWORD dwReserved;
} PARAMBLOCK; } PARAMBLOCK;
typedef BOOL (CALLBACK * LPFNWINMAIN)(HANDLE, HANDLE, LPSTR, int);
extern int CallToInit16(unsigned long csip, unsigned long sssp,
unsigned short ds);
HANDLE CreateNewTask(HINSTANCE hInst); HANDLE CreateNewTask(HINSTANCE hInst);
void InitializeLoadedNewDLLs(HINSTANCE hInst)
{
struct w_files * w;
struct w_files * wpnt;
int cs_reg, ds_reg, ip_reg;
int rv;
fprintf(stderr, "Initializing New DLLs\n");
/*
* Initialize libraries
*/
printf("InitializeLoadedNewDLLs() before searching hInst=%04X !\n", hInst);
w = wine_files;
while (w && w->hinstance != hInst) w = w->next;
if (w == NULL) return;
printf("InitializeLoadedNewDLLs() // before InitLoop !\n");
for(wpnt = w; wpnt; wpnt = wpnt->next)
{
/*
* 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;
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);
}
}
}
void StartNewTask(HINSTANCE hInst)
{
struct w_files * wpnt;
struct w_files * w;
int cs_reg, ds_reg, ss_reg, ip_reg, sp_reg;
int rv;
int segment;
printf("StartNewTask() before searching hInst=%04X !\n", hInst);
wpnt = wine_files;
while (wpnt && wpnt->hinstance != hInst) wpnt = wpnt->next;
if (wpnt == NULL) return;
printf("StartNewTask() // before FixupSegment !\n");
for(w = wpnt; w; w = w->next) {
for (segment = 0; segment < w->ne_header->n_segment_tab; segment++) {
if (FixupSegment(w, segment) < 0) {
myerror("fixup failed.");
}
}
}
printf("StartNewTask() before InitializeLoadedNewDLLs !\n");
InitializeLoadedNewDLLs(hInst);
printf("StartNewTask() before setup register !\n");
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;
ss_reg = wpnt->selector_table[wpnt->ne_header->ss-1].selector;
sp_reg = wpnt->ne_header->sp;
printf("StartNewTask() before CallToInit16() !\n");
rv = CallToInit16(cs_reg << 16 | ip_reg, ss_reg << 16 | sp_reg, ds_reg);
printf ("rv = %x\n", rv);
}
/********************************************************************** /**********************************************************************
* LoadModule [KERNEL.45] * LoadModule [KERNEL.45]
*/ */
@ -52,43 +148,57 @@ HANDLE LoadModule(LPSTR modulefile, LPVOID lpParamBlk)
*/ */
WORD WinExec(LPSTR lpCmdLine, WORD nCmdShow) WORD WinExec(LPSTR lpCmdLine, WORD nCmdShow)
{ {
int X, X2, C; int c = 0;
char *ArgV[20]; int x, x2;
HANDLE hTask = 0; char *ArgV[20];
LPFNWINMAIN lpfnMain;
HINSTANCE hInst = 0;
HANDLE hTask = 0;
printf("WinExec('%s', %04X)\n", lpCmdLine, nCmdShow); printf("WinExec('%s', %04X)\n", lpCmdLine, nCmdShow);
ArgV[0] = "wine"; /* ArgV[0] = "wine";
C = 1; c = 1; */
for (X = X2 = 0; X < strlen(lpCmdLine) + 1; X++) { for (x = x2 = 0; x < strlen(lpCmdLine) + 1; x++) {
if ((lpCmdLine[X] == ' ') || (lpCmdLine[X] == '\0')) { if ((lpCmdLine[x] == ' ') || (lpCmdLine[x] == '\0')) {
ArgV[C] = (char *)malloc(X - X2 + 1); ArgV[c] = (char *)malloc(x - x2 + 1);
strncpy(ArgV[C], &lpCmdLine[X2], X - X2); strncpy(ArgV[c], &lpCmdLine[x2], x - x2);
ArgV[C][X - X2] = '\0'; ArgV[c][x - x2] = '\0';
C++; X2 = X + 1; c++; x2 = x + 1;
} }
} }
ArgV[C] = NULL; ArgV[c] = NULL;
for (C = 0; ; C++) { for (c = 0; ArgV[c] != NULL; c++) printf("--> '%s' \n", ArgV[c]);
if (ArgV[C] == NULL) break;
printf("--> '%s' \n", ArgV[C]);
}
switch(fork()) { switch(fork()) {
case -1: case -1:
printf("Can't 'fork' process !\n"); printf("Can't 'fork' process !\n");
break; break;
case 0: case 0:
hTask = CreateNewTask(0); if ((hInst = LoadImage(ArgV[0], EXE)) == (HINSTANCE) NULL ) {
fprintf(stderr, "wine: can't find %s!.\n", ArgV[0]);
printf("Child process died !\n");
exit(1);
}
hTask = CreateNewTask(hInst);
printf("WinExec // hTask=%04X hInst=%04X !\n", hTask, hInst);
StartNewTask(hInst);
/*
lpfnMain = (LPFNWINMAIN)GetProcAddress(hInst, (LPSTR)0L);
printf("WineExec() // lpfnMain=%08X\n", (LONG)lpfnMain);
if (lpfnMain != NULL) {
(lpfnMain)(hInst, 0, lpCmdLine, nCmdShow);
printf("WineExec() // after lpfnMain\n");
}
*/
/* hTask = CreateNewTask(0);
printf("WinExec // New Task hTask=%04X !\n", hTask); printf("WinExec // New Task hTask=%04X !\n", hTask);
execvp(ArgV[0], ArgV); execvp(ArgV[0], ArgV); */
printf("Child process died !\n"); printf("Child process died !\n");
exit(1); exit(1);
default: default:
printf("WinExec (Main process stay alive) hTask=%04X !\n", hTask); printf("WinExec (Main process stay alive) hTask=%04X !\n", hTask);
break; break;
} }
for (C = 0; ; C++) { for (c = 0; ArgV[c] != NULL; c++) free(ArgV[c]);
if (ArgV[C] == NULL) break;
free(ArgV[C]);
}
return hTask; return hTask;
} }

View File

@ -27,6 +27,8 @@
#include <windows.h> #include <windows.h>
#include "prototypes.h" #include "prototypes.h"
#define DEBUG_FILE
char WindowsDirectory[256], SystemDirectory[256], TempDirectory[256]; char WindowsDirectory[256], SystemDirectory[256], TempDirectory[256];
/*************************************************************************** /***************************************************************************
@ -119,33 +121,38 @@ INT _lclose (INT hFile)
**************************************************************************/ **************************************************************************/
INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle) INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle)
{ {
int base,flags; int base,flags;
int handle;
#ifdef DEBUG_FILE
fprintf(stderr,"Openfile(%s,<struct>,%d) ",lpFileName,wStyle);
#endif
base=wStyle&0xF;
flags=wStyle&0xFFF0;
flags&=0xFF0F; /* strip SHARE bits for now */
flags&=0xD7FF; /* strip PROMPT & CANCEL bits for now */
flags&=0x7FFF; /* strip REOPEN bit for now */
flags&=0xFBFF; /* strib VERIFY bit for now */
if(flags&OF_CREATE) { base |=O_CREAT; flags &=0xEFFF; }
#ifdef DEBUG_FILE #ifdef DEBUG_FILE
fprintf(stderr,"Openfile(%s,<struct>,%d) ",lpFileName,wStyle); fprintf(stderr,"now %d,%d\n",base,flags);
#endif #endif
base=wStyle&0xF; if (flags & OF_EXIST) {
flags=wStyle&0xFFF0; printf("OpenFile // OF_EXIST '%s' !\n", lpFileName);
handle = _lopen (lpFileName, wStyle);
flags&=0xFF0F; /* strip SHARE bits for now */ close(handle);
flags&=0xD7FF; /* strip PROMPT & CANCEL bits for now */ return handle;
flags&=0x7FFF; /* strip REOPEN bit for now */ }
flags&=0xFBFF; /* strib VERIFY bit for now */ if (flags & OF_DELETE) {
printf("OpenFile // OF_DELETE '%s' !\n", lpFileName);
if(flags&OF_CREATE) { base |=O_CREAT; flags &=0xEFFF; } return unlink(lpFileName);
}
fprintf(stderr,"now %d,%d\n",base,flags); else {
return _lopen (lpFileName, wStyle);
if(flags&(OF_DELETE|OF_EXIST)) }
{
fprintf(stderr,"Unsupported OpenFile option\n");
return -1;
}
else
{
return _lopen (lpFileName, wStyle);
}
} }
/************************************************************************** /**************************************************************************
@ -200,11 +207,9 @@ INT _lcreate (LPSTR lpszFilename, INT fnAttribute)
fprintf(stderr, "_lcreate: filename %s, attributes %d\n",lpszFilename, fprintf(stderr, "_lcreate: filename %s, attributes %d\n",lpszFilename,
fnAttribute); fnAttribute);
#endif #endif
if ((UnixFileName = GetUnixFileName(lpszFilename)) == NULL) if ((UnixFileName = GetUnixFileName(lpszFilename)) == NULL)
return HFILE_ERROR; return HFILE_ERROR;
handle = open (UnixFileName, O_CREAT | O_TRUNC | O_WRONLY, 426);
handle = open (UnixFileName, O_CREAT | O_TRUNC | O_WRONLY );
if (handle == -1) if (handle == -1)
return HFILE_ERROR; return HFILE_ERROR;
@ -282,6 +287,7 @@ UINT GetSystemDirectory(LPSTR lpszSysPath, UINT cbSysPath)
INT GetTempFileName(BYTE bDriveLetter, LPCSTR lpszPrefixString, UINT uUnique, LPSTR lpszTempFileName) INT GetTempFileName(BYTE bDriveLetter, LPCSTR lpszPrefixString, UINT uUnique, LPSTR lpszTempFileName)
{ {
int unique; int unique;
int handle;
char tempname[256]; char tempname[256];
if (uUnique == 0) if (uUnique == 0)
@ -301,6 +307,11 @@ INT GetTempFileName(BYTE bDriveLetter, LPCSTR lpszPrefixString, UINT uUnique, LP
fprintf(stderr,"GetTempFilename: %c %s %d => %s\n",bDriveLetter, fprintf(stderr,"GetTempFilename: %c %s %d => %s\n",bDriveLetter,
lpszPrefixString,uUnique,lpszTempFileName); lpszPrefixString,uUnique,lpszTempFileName);
#endif #endif
if ((handle = _lcreate (lpszTempFileName, 0x0000)) == -1) {
fprintf(stderr,"GetTempFilename: can't create temp file '%s' !\n", lpszTempFileName);
}
else
close(handle);
return unique; return unique;
} }

View File

@ -18,7 +18,9 @@ static char Copyright[] = "Copyright Yngvi Sigurjonsson (yngvi@hafro.is), 1993"
/* KERNEL.89 */ /* KERNEL.89 */
LPSTR lstrcat(LPSTR target,LPCSTR source) LPSTR lstrcat(LPSTR target,LPCSTR source)
{ {
#ifdef DEBUG_STRING
fprintf(stderr,"lstrcat(%s,%s)\n",target,source); fprintf(stderr,"lstrcat(%s,%s)\n",target,source);
#endif
return strcat(target,source); return strcat(target,source);
} }

View File

@ -54,6 +54,7 @@ static XrmOptionDescRec optionsTable[] =
{ "-privatemap", ".privatemap", XrmoptionNoArg, (caddr_t)"on" }, { "-privatemap", ".privatemap", XrmoptionNoArg, (caddr_t)"on" },
{ "-synchronous", ".synchronous", XrmoptionNoArg, (caddr_t)"on" }, { "-synchronous", ".synchronous", XrmoptionNoArg, (caddr_t)"on" },
{ "-spy", ".spy", XrmoptionSepArg, (caddr_t)NULL }, { "-spy", ".spy", XrmoptionSepArg, (caddr_t)NULL },
{ "-debug", ".debug", XrmoptionNoArg, (caddr_t)"on" },
{ "-relaydbg", ".relaydbg", XrmoptionNoArg, (caddr_t)"on" } { "-relaydbg", ".relaydbg", XrmoptionNoArg, (caddr_t)"on" }
}; };
@ -67,6 +68,7 @@ static XrmOptionDescRec optionsTable[] =
" -desktop geom Use a desktop window of the given geometry\n" \ " -desktop geom Use a desktop window of the given geometry\n" \
" -display name Use the specified display\n" \ " -display name Use the specified display\n" \
" -iconic Start as an icon\n" \ " -iconic Start as an icon\n" \
" -debug Enter debugger before starting application\n" \
" -name name Set the application name\n" \ " -name name Set the application name\n" \
" -privatemap Use a private color map\n" \ " -privatemap Use a private color map\n" \
" -synchronous Turn on synchronous display mode\n" \ " -synchronous Turn on synchronous display mode\n" \
@ -176,6 +178,8 @@ static void MAIN_ParseOptions( int *argc, char *argv[] )
Options.synchronous = TRUE; Options.synchronous = TRUE;
if (MAIN_GetResource( db, ".relaydbg", &value )) if (MAIN_GetResource( db, ".relaydbg", &value ))
Options.relay_debug = TRUE; Options.relay_debug = TRUE;
if (MAIN_GetResource( db, ".debug", &value ))
Options.debug = TRUE;
if (MAIN_GetResource( db, ".spy", &value)) if (MAIN_GetResource( db, ".spy", &value))
Options.spyFilename = value.addr; Options.spyFilename = value.addr;
if (MAIN_GetResource( db, ".depth", &value)) if (MAIN_GetResource( db, ".depth", &value))
@ -274,6 +278,7 @@ static void called_at_exit(void)
Comm_DeInit(); Comm_DeInit();
sync_profiles(); sync_profiles();
MAIN_RestoreSetup(); MAIN_RestoreSetup();
WSACleanup();
} }
/*********************************************************************** /***********************************************************************
@ -505,14 +510,6 @@ void Copy(LPVOID lpSource, LPVOID lpDest, WORD nBytes)
memcpy(lpDest, lpSource, nBytes); memcpy(lpDest, lpSource, nBytes);
} }
/***********************************************************************
* YIELD (KERNEL.29)
*/
void Yield(void)
{
;
}
/*********************************************************************** /***********************************************************************
* SWAPMOUSEBUTTON (USER.186) * SWAPMOUSEBUTTON (USER.186)
*/ */

View File

@ -50,9 +50,10 @@ int MessageBox(HWND hWnd, LPSTR str, LPSTR title, WORD type)
WND *wndPtr; WND *wndPtr;
WNDCLASS wndClass; WNDCLASS wndClass;
MSG msg; MSG msg;
MSGBOX mb; LPMSGBOX lpmb;
DWORD dwStyle; DWORD dwStyle;
HINSTANCE hInst; HINSTANCE hInst;
int nRet;
wndPtr = WIN_FindWndPtr(hWnd); wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr == NULL) { if (wndPtr == NULL) {
hInst = hSysRes; hInst = hSysRes;
@ -66,6 +67,16 @@ int MessageBox(HWND hWnd, LPSTR str, LPSTR title, WORD type)
printf("MessageBox(%04X, '%s', '%s', %04X)\n", hWnd, str, title, type); printf("MessageBox(%04X, '%s', '%s', %04X)\n", hWnd, str, title, type);
#endif #endif
} }
lpmb = (LPMSGBOX) malloc(sizeof(MSGBOX));
memset(lpmb, 0, sizeof(MSGBOX));
/* lpmb->Title = title;*/
lpmb->Title = (LPSTR) malloc(strlen(title) + 1);
strcpy(lpmb->Title, title);
/* lpmb->Str = str;*/
lpmb->Str = (LPSTR) malloc(strlen(str) + 1);
strcpy(lpmb->Str, str);
lpmb->wType = type;
lpmb->ActiveFlg = TRUE;
wndClass.style = CS_HREDRAW | CS_VREDRAW ; wndClass.style = CS_HREDRAW | CS_VREDRAW ;
wndClass.lpfnWndProc = (WNDPROC)SystemMessageBoxProc; wndClass.lpfnWndProc = (WNDPROC)SystemMessageBoxProc;
wndClass.cbClsExtra = 0; wndClass.cbClsExtra = 0;
@ -76,29 +87,29 @@ int MessageBox(HWND hWnd, LPSTR str, LPSTR title, WORD type)
wndClass.hbrBackground = GetStockObject(WHITE_BRUSH); wndClass.hbrBackground = GetStockObject(WHITE_BRUSH);
wndClass.lpszMenuName = NULL; wndClass.lpszMenuName = NULL;
wndClass.lpszClassName = "MESSAGEBOX"; wndClass.lpszClassName = "MESSAGEBOX";
#ifdef DEBUG_MSGBOX
printf( "MessageBox // before RegisterClass, '%s' '%s' !\n", str, title);
#endif
if (!RegisterClass(&wndClass)) { if (!RegisterClass(&wndClass)) {
printf("Unable to Register class 'MESSAGEBOX' !\n"); printf("Unable to Register class 'MESSAGEBOX' !\n");
if (lpmb != NULL) free(lpmb);
return 0; return 0;
} }
memset(&mb, 0, sizeof(MSGBOX));
mb.Title = title;
mb.Str = str;
mb.wType = type;
mb.ActiveFlg = TRUE;
dwStyle = WS_POPUP | WS_DLGFRAME | WS_VISIBLE; dwStyle = WS_POPUP | WS_DLGFRAME | WS_VISIBLE;
if ((type & (MB_SYSTEMMODAL | MB_TASKMODAL)) == 0) dwStyle |= WS_CAPTION; if ((type & (MB_SYSTEMMODAL | MB_TASKMODAL)) == 0) dwStyle |= WS_CAPTION;
hWndOld = GetFocus(); hWndOld = GetFocus();
hDlg = CreateWindow("MESSAGEBOX", title, dwStyle, 100, 150, 400, 120, hDlg = CreateWindow("MESSAGEBOX", lpmb->Title, dwStyle, 100, 150, 400, 160,
(HWND)NULL, (HMENU)NULL, hInst, (LPSTR)&mb); (HWND)NULL, (HMENU)NULL, hInst, (LPSTR)lpmb);
if (hDlg == 0) { if (hDlg == 0) {
printf("Unable to create 'MESSAGEBOX' window !\n"); printf("Unable to create 'MESSAGEBOX' window !\n");
if (lpmb != NULL) free(lpmb);
return 0; return 0;
} }
#ifdef DEBUG_MSGBOX #ifdef DEBUG_MSGBOX
printf( "MessageBox // before Msg Loop !\n"); printf( "MessageBox // before Msg Loop !\n");
#endif #endif
while(TRUE) { while(TRUE) {
if (!mb.ActiveFlg) break; if (!lpmb->ActiveFlg) break;
if (!GetMessage(&msg, (HWND)NULL, 0, 0)) break; if (!GetMessage(&msg, (HWND)NULL, 0, 0)) break;
TranslateMessage(&msg); TranslateMessage(&msg);
if ((type & (MB_SYSTEMMODAL | MB_TASKMODAL)) != 0 && if ((type & (MB_SYSTEMMODAL | MB_TASKMODAL)) != 0 &&
@ -115,11 +126,13 @@ int MessageBox(HWND hWnd, LPSTR str, LPSTR title, WORD type)
DispatchMessage(&msg); DispatchMessage(&msg);
} }
SetFocus(hWndOld); SetFocus(hWndOld);
nRet = lpmb->wRetVal;
if (lpmb != NULL) free(lpmb);
if (!UnregisterClass("MESSAGEBOX", hInst)) return 0; if (!UnregisterClass("MESSAGEBOX", hInst)) return 0;
#ifdef DEBUG_MSGBOX #ifdef DEBUG_MSGBOX
printf( "MessageBox return %04X !\n", mb.wRetVal); printf( "MessageBox return %04X !\n", nRet);
#endif #endif
return(mb.wRetVal); return(nRet);
} }
@ -148,7 +161,6 @@ LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam)
DWORD OldTextColor; DWORD OldTextColor;
RECT rect; RECT rect;
LPMSGBOX lpmb; LPMSGBOX lpmb;
LPMSGBOX lpmbInit;
BITMAP bm; BITMAP bm;
HBITMAP hBitMap; HBITMAP hBitMap;
HDC hMemDC; HDC hMemDC;
@ -162,10 +174,13 @@ LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam)
#endif #endif
wndPtr = WIN_FindWndPtr(hWnd); wndPtr = WIN_FindWndPtr(hWnd);
createStruct = (CREATESTRUCT *)lParam; createStruct = (CREATESTRUCT *)lParam;
lpmbInit = (LPMSGBOX)createStruct->lpCreateParams; lpmb = (LPMSGBOX)createStruct->lpCreateParams;
if (lpmbInit == 0) break; if (lpmb == NULL) break;
*((LPMSGBOX *)&wndPtr->wExtra[1]) = lpmbInit; *((LPMSGBOX *)&wndPtr->wExtra[1]) = lpmb;
lpmb = MsgBoxGetStorageHeader(hWnd); #ifdef DEBUG_MSGBOX
printf("MessageBox WM_CREATE title='%s' str='%s' !\n",
lpmb->Title, lpmb->Str);
#endif
GetClientRect(hWnd, &rect); GetClientRect(hWnd, &rect);
CopyRect(&lpmb->rectStr, &rect); CopyRect(&lpmb->rectStr, &rect);
lpmb->rectStr.bottom -= 32; lpmb->rectStr.bottom -= 32;
@ -255,6 +270,7 @@ LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam)
printf("MessageBox WM_PAINT !\n"); printf("MessageBox WM_PAINT !\n");
#endif #endif
lpmb = MsgBoxGetStorageHeader(hWnd); lpmb = MsgBoxGetStorageHeader(hWnd);
if (lpmb == NULL) break;
CopyRect(&rect, &lpmb->rectStr); CopyRect(&rect, &lpmb->rectStr);
hDC = BeginPaint(hWnd, &ps); hDC = BeginPaint(hWnd, &ps);
OldTextColor = SetTextColor(hDC, 0x00000000); OldTextColor = SetTextColor(hDC, 0x00000000);
@ -278,6 +294,7 @@ LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam)
#endif #endif
ReleaseCapture(); ReleaseCapture();
lpmb = MsgBoxGetStorageHeader(hWnd); lpmb = MsgBoxGetStorageHeader(hWnd);
if (lpmb == NULL) break;
lpmb->ActiveFlg = FALSE; lpmb->ActiveFlg = FALSE;
if (lpmb->hIcon) DestroyIcon(lpmb->hIcon); if (lpmb->hIcon) DestroyIcon(lpmb->hIcon);
if (lpmb->hWndYes) DestroyWindow(lpmb->hWndYes); if (lpmb->hWndYes) DestroyWindow(lpmb->hWndYes);
@ -289,6 +306,7 @@ LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam)
break; break;
case WM_COMMAND: case WM_COMMAND:
lpmb = MsgBoxGetStorageHeader(hWnd); lpmb = MsgBoxGetStorageHeader(hWnd);
if (lpmb == NULL) break;
if (wParam < IDOK || wParam > IDNO) return(0); if (wParam < IDOK || wParam > IDNO) return(0);
lpmb->wRetVal = wParam; lpmb->wRetVal = wParam;
#ifdef DEBUG_MSGBOX #ifdef DEBUG_MSGBOX
@ -298,6 +316,7 @@ LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam)
break; break;
case WM_CHAR: case WM_CHAR:
lpmb = MsgBoxGetStorageHeader(hWnd); lpmb = MsgBoxGetStorageHeader(hWnd);
if (lpmb == NULL) break;
if (wParam >= 'a' || wParam <= 'z') wParam -= 'a' - 'A'; if (wParam >= 'a' || wParam <= 'z') wParam -= 'a' - 'A';
switch(wParam) { switch(wParam) {
case 'Y': case 'Y':

View File

@ -8,64 +8,202 @@
#include <unistd.h> #include <unistd.h>
#include "windows.h" #include "windows.h"
typedef DWORD HKEY;
typedef FAR LONG *LPWORD;
DECLARE_HANDLE(HDROP);
extern HINSTANCE hSysRes;
/************************************************************************* /*************************************************************************
* RegOpenKey [SHELL.1] * RegOpenKey [SHELL.1]
*/ */
int RegOpenKey(void) LONG RegOpenKey(HKEY k, LPCSTR s, HKEY FAR *p)
{ {
printf("RegOpenKey : Empty Stub !!!\n"); fprintf(stderr, "RegOpenKey : Empty Stub !!!\n");
} }
/************************************************************************* /*************************************************************************
* RegCreateKey [SHELL.2] * RegCreateKey [SHELL.2]
*/ */
int RegCreateKey(void) LONG RegCreateKey(HKEY k, LPCSTR s, HKEY FAR *p)
{ {
printf("RegCreateKey : Empty Stub !!!\n"); fprintf(stderr, "RegCreateKey : Empty Stub !!!\n");
} }
/************************************************************************* /*************************************************************************
* RegCloseKey [SHELL.3] * RegCloseKey [SHELL.3]
*/ */
int RegCloseKey(void) LONG RegCloseKey(HKEY k)
{ {
printf("RegCloseKey : Empty Stub !!!\n"); fprintf(stderr, "RegCloseKey : Empty Stub !!!\n");
} }
/************************************************************************* /*************************************************************************
* RegDeleteKey [SHELL.4] * RegDeleteKey [SHELL.4]
*/ */
int RegDeleteKey(void) LONG RegDeleteKey(HKEY k, LPCSTR s)
{ {
printf("RegDeleteKey : Empty Stub !!!\n"); fprintf(stderr, "RegDeleteKey : Empty Stub !!!\n");
}
/*************************************************************************
* RegSetValue [SHELL.5]
*/
LONG RegSetValue(HKEY k, LPCSTR s1, DWORD dw, LPCSTR s2, DWORD dw2)
{
fprintf(stderr, "RegSetValue : Empty Stub !!!\n");
}
/*************************************************************************
* RegQueryValue [SHELL.6]
*/
LONG RegQueryValue(HKEY k, LPCSTR s, LPSTR s2, LONG FAR *p)
{
fprintf(stderr, "RegQueryValue : Empty Stub !!!\n");
}
/*************************************************************************
* RegEnumKey [SHELL.7]
*/
LONG RegEnumKey(HKEY k, DWORD dw, LPSTR s, DWORD dw2)
{
fprintf(stderr, "RegEnumKey : Empty Stub !!!\n");
}
/*************************************************************************
* DragAcceptFiles [SHELL.9]
*/
void DragAcceptFiles(HWND hWnd, BOOL b)
{
fprintf(stderr, "DragAcceptFiles : Empty Stub !!!\n");
}
/*************************************************************************
* DragQueryFile [SHELL.11]
*/
void DragQueryFile(HDROP h, UINT u, LPSTR u2, UINT u3)
{
fprintf(stderr, "DragQueryFile : Empty Stub !!!\n");
}
/*************************************************************************
* DragFinish [SHELL.12]
*/
void DragFinish(HDROP h)
{
fprintf(stderr, "DragFinish : Empty Stub !!!\n");
}
/*************************************************************************
* DragQueryPoint [SHELL.13]
*/
BOOL DragQueryPoint(HDROP h, POINT FAR *p)
{
fprintf(stderr, "DragQueryPoinyt : Empty Stub !!!\n");
} }
/************************************************************************* /*************************************************************************
* ShellExecute [SHELL.20] * ShellExecute [SHELL.20]
*/ */
int ShellExecute(LPSTR ptr) HINSTANCE ShellExecute(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, int iShowCmd)
{ {
printf("ShellExecute : Empty Stub !!!\n"); fprintf(stderr, "ShellExecute : Empty Stub !!!\n");
} }
/*************************************************************************
* FindExecutable [SHELL.21]
*/
HINSTANCE FindExecutable(LPCSTR lpFile, LPCSTR lpDirectory, LPSTR lpResult)
{
fprintf(stderr, "FindExecutable : Empty Stub !!!\n");
}
char AppName[256], AppMisc[256];
/*************************************************************************
* AboutDlgProc [SHELL.33]
*/
INT AboutDlgProc(HWND hWnd, WORD msg, WORD wParam, LONG lParam)
{
char temp[256];
switch(msg) {
case WM_INITDIALOG:
sprintf(temp, "About %s", AppName);
/* SetDlgItemText(hWnd, 0, temp);*/
SetDlgItemText(hWnd, 100, AppMisc);
break;
case WM_COMMAND:
switch (wParam) {
case IDOK:
EndDialog(hWnd, TRUE);
return TRUE;
}
}
return FALSE;
}
/*************************************************************************
* ShellAbout [SHELL.22]
*/
INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon)
{
fprintf(stderr, "ShellAbout ! (%s, %s)\n", szApp, szOtherStuff);
strcpy(AppName, szApp);
strcpy(AppMisc, szOtherStuff);
return DialogBox(hSysRes, "SHELL_ABOUT_MSGBOX", hWnd, (FARPROC)AboutDlgProc);
}
/*************************************************************************
* ExtractIcon [SHELL.34]
*/
HICON ExtractIcon(HINSTANCE hInst, LPCSTR lpszExeFileName, UINT nIconIndex)
{
fprintf(stderr, "ExtractIcon : Empty Stub !!!\n");
}
/*************************************************************************
* ExtractAssociatedIcon [SHELL.36]
*/
HICON ExtractAssociatedIcon(HINSTANCE hInst,LPSTR lpIconPath, LPWORD lpiIcon)
{
fprintf(stderr, "ExtractAssociatedIcon : Empty Stub !!!\n");
}
/************************************************************************* /*************************************************************************
* RegisterShellHook [SHELL.102] * RegisterShellHook [SHELL.102]
*/ */
int RegisterShellHook(void *ptr) int RegisterShellHook(void *ptr)
{ {
printf("RegisterShellHook : Empty Stub !!!\n"); fprintf(stderr, "RegisterShellHook : Empty Stub !!!\n");
} }
/************************************************************************* /*************************************************************************
* ShellHookProc [SHELL.103] * ShellHookProc [SHELL.103]
*/ */
int ShellHookProc(void) int ShellHookProc(void)
{ {
printf("ShellHookProc : Empty Stub !!!\n"); fprintf(stderr, "ShellHookProc : Empty Stub !!!\n");
} }

View File

@ -63,6 +63,40 @@ int StopSound(void)
return 0; return 0;
} }
int WaitSoundState(int x)
{
fprintf(stderr, "WaitSoundState(%d)\n", x);
}
SyncAllVoices(void)
{
fprintf(stderr, "SyncAllVoices()\n");
}
int CountVoiceNotes(int x)
{
fprintf(stderr, "CountVoiceNotes(%d)\n", x);
}
LPINT GetThresholdEvent(void)
{
fprintf(stderr, "GetThresholdEvent()\n");
}
GetThresholdStatus(void)
{
fprintf(stderr, "GetThresholdStatus()\n");
}
int SetVoiceThreshold(int a, int b)
{
fprintf(stderr, "SetVoiceThreshold(%d,%d)\n", a, b);
}
void DoBeep(void)
{
fprintf(stderr, "BEEP!\n");
}
/* /*
11 pascal WAITSOUNDSTATE(word) WaitSoundState(1) 11 pascal WAITSOUNDSTATE(word) WaitSoundState(1)
@ -71,7 +105,4 @@ int StopSound(void)
14 pascal GETTHRESHOLDEVENT() GetThresholdEvent() 14 pascal GETTHRESHOLDEVENT() GetThresholdEvent()
15 pascal GETTHRESHOLDSTATUS() GetThresholdStatus() 15 pascal GETTHRESHOLDSTATUS() GetThresholdStatus()
16 pascal SETVOICETHRESHOLD(word word) SetVoiceThreshold(1 2) 16 pascal SETVOICETHRESHOLD(word word) SetVoiceThreshold(1 2)
*/ */

View File

@ -18,8 +18,8 @@ struct Win87EmInfoStruct {
int int
WIN87_fpmath() WIN87_fpmath()
{ {
printf( "_fpmath: (%d)\n",_BX); printf( "_fpmath: (%x:%x %x %x)\n",_CONTEXT->sc_cs, _CONTEXT->sc_eip,
_CONTEXT->sc_es, _BX);
switch(_BX ) switch(_BX )
{ {

View File

@ -63,7 +63,7 @@ BOOL BitBlt( HDC hdcDest, short xDest, short yDest, short width, short height,
printf( "BitBlt: %d %d,%d %dx%d %d %d,%d %08x\n", printf( "BitBlt: %d %d,%d %dx%d %d %d,%d %08x\n",
hdcDest, xDest, yDest, width, height, hdcSrc, xSrc, ySrc, rop ); hdcDest, xDest, yDest, width, height, hdcSrc, xSrc, ySrc, rop );
#endif #endif
if (width == 0 || height == 0) return FALSE;
if ((rop & 0xcc0000) == ((rop & 0x330000) << 2)) if ((rop & 0xcc0000) == ((rop & 0x330000) << 2))
return PatBlt( hdcDest, xDest, yDest, width, height, rop ); return PatBlt( hdcDest, xDest, yDest, width, height, rop );
@ -311,6 +311,7 @@ BOOL StretchBlt( HDC hdcDest, short xDest, short yDest, short widthDest, short h
DC *dcDest, *dcSrc; DC *dcDest, *dcSrc;
XImage *sxi, *dxi; XImage *sxi, *dxi;
WORD stretchmode; WORD stretchmode;
BOOL flg;
#ifdef DEBUG_GDI #ifdef DEBUG_GDI
fprintf(stderr, "StretchBlt: %d %d,%d %dx%d %d %d,%d %dx%d %08x\n", fprintf(stderr, "StretchBlt: %d %d,%d %dx%d %d %d,%d %dx%d %08x\n",
@ -320,6 +321,8 @@ BOOL StretchBlt( HDC hdcDest, short xDest, short yDest, short widthDest, short h
((DC *)GDI_GetObjPtr(hdcDest, DC_MAGIC))->w.stretchBltMode); ((DC *)GDI_GetObjPtr(hdcDest, DC_MAGIC))->w.stretchBltMode);
#endif #endif
if (widthDest == 0 || heightDest == 0) return FALSE;
if (widthSrc == 0 || heightSrc == 0) return FALSE;
if ((rop & 0xcc0000) == ((rop & 0x330000) << 2)) if ((rop & 0xcc0000) == ((rop & 0x330000) << 2))
return PatBlt( hdcDest, xDest, yDest, widthDest, heightDest, rop ); return PatBlt( hdcDest, xDest, yDest, widthDest, heightDest, rop );

View File

@ -17,9 +17,11 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "class.h" #include "class.h"
#include "message.h" #include "message.h"
#ifdef ndef
#ifndef FamilyAmoeba #ifndef FamilyAmoeba
typedef char *XPointer; typedef char *XPointer;
#endif #endif
#endif
#define NB_BUTTONS 3 /* Windows can handle 3 buttons */ #define NB_BUTTONS 3 /* Windows can handle 3 buttons */

View File

@ -531,7 +531,7 @@ LONG MDIPaintMaximized(HWND hwndFrame, HWND hwndClient, WORD message,
if (hbitmapClose == 0) if (hbitmapClose == 0)
{ {
hbitmapClose = LoadBitmap(0, MAKEINTRESOURCE(OBM_CLOSE)); hbitmapClose = LoadBitmap(0, MAKEINTRESOURCE(OBM_OLD_CLOSE));
hbitmapMaximized = LoadBitmap(0, MAKEINTRESOURCE(OBM_RESTORE)); hbitmapMaximized = LoadBitmap(0, MAKEINTRESOURCE(OBM_RESTORE));
} }

View File

@ -524,9 +524,9 @@ void NC_DoNCPaint( HWND hwnd, HRGN hrgn, BOOL active, BOOL suppress_menupaint )
WND *wndPtr = WIN_FindWndPtr( hwnd ); WND *wndPtr = WIN_FindWndPtr( hwnd );
#ifdef DEBUG_NONCLIENT #ifdef DEBUG_NONCLIENT
printf( "NC_HandleNCPaint: %d %d\n", hwnd, hrgn ); printf( "NC_DoNCPaint: %d %d\n", hwnd, hrgn );
#endif #endif
if (!IsWindowVisible(hwnd)) return;
if (!wndPtr || !hrgn) return; if (!wndPtr || !hrgn) return;
if (!(wndPtr->dwStyle & (WS_BORDER | WS_DLGFRAME | WS_THICKFRAME))) if (!(wndPtr->dwStyle & (WS_BORDER | WS_DLGFRAME | WS_THICKFRAME)))
return; /* Nothing to do! */ return; /* Nothing to do! */
@ -1058,26 +1058,7 @@ static void NC_TrackMouseMenuBar( HWND hwnd, WORD wParam, POINT pt )
ScreenToClient(hwnd, &pt); ScreenToClient(hwnd, &pt);
pt.y += lppop->rect.bottom; pt.y += lppop->rect.bottom;
SetCapture(hwnd); SetCapture(hwnd);
if (!MenuButtonDown(hwnd, lppop, pt.x, pt.y)) { MenuButtonDown(hwnd, lppop, pt.x, pt.y);
do {
if (!GetMessage(&msg, (HWND)NULL, 0, 0)) break;
ScreenToClient(hwnd, &msg.pt);
msg.pt.y += lppop->rect.bottom;
switch(msg.message) {
case WM_LBUTTONUP:
MenuButtonUp(hwnd, lppop, msg.pt.x, msg.pt.y);
break;
case WM_MOUSEMOVE:
MenuMouseMove(hwnd, lppop, msg.wParam, msg.pt.x, msg.pt.y);
break;
default:
TranslateMessage(&msg);
DispatchMessage(&msg);
break;
}
} while (msg.message != WM_LBUTTONUP);
ReleaseCapture();
}
GlobalUnlock(wndPtr->wIDmenu); GlobalUnlock(wndPtr->wIDmenu);
} }

View File

@ -245,8 +245,9 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
XSetWindowAttributes win_attr; XSetWindowAttributes win_attr;
#ifdef DEBUG_WIN #ifdef DEBUG_WIN
printf( "CreateWindowEx: %d '%s' '%s' %d,%d %dx%d %08x %x\n", printf( "CreateWindowEx: %04X '%s' '%s' %04X %d,%d %dx%d %04X %04X %04X %08X\n",
exStyle, className, windowName, x, y, width, height, style, parent); exStyle, className, windowName, style, x, y, width, height,
parent, menu, instance, data);
#endif #endif
if (x == CW_USEDEFAULT) x = y = 0; if (x == CW_USEDEFAULT) x = y = 0;
@ -431,6 +432,9 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
/* Create a copy of SysMenu */ /* Create a copy of SysMenu */
if (style & WS_SYSMENU) wndPtr->hSysMenu = CopySysMenu(); if (style & WS_SYSMENU) wndPtr->hSysMenu = CopySysMenu();
/* Register window in current task windows list */
AddWindowToTask(GetCurrentTask(), hwnd);
/* Set window cursor */ /* Set window cursor */
if (classPtr->wc.hCursor) CURSOR_SetWinCursor( hwnd, classPtr->wc.hCursor); if (classPtr->wc.hCursor) CURSOR_SetWinCursor( hwnd, classPtr->wc.hCursor);
else CURSOR_SetWinCursor( hwnd, LoadCursor( 0, IDC_ARROW )); else CURSOR_SetWinCursor( hwnd, LoadCursor( 0, IDC_ARROW ));
@ -474,8 +478,10 @@ BOOL DestroyWindow( HWND hwnd )
DestroyWindow( wndPtr->hwndChild ); DestroyWindow( wndPtr->hwndChild );
SendMessage( hwnd, WM_NCDESTROY, 0, 0 ); SendMessage( hwnd, WM_NCDESTROY, 0, 0 );
/* Remove the window from the linked list */ /* Remove the window from current task windows list */
RemoveWindowFromTask(GetCurrentTask(), hwnd);
/* Remove the window from the linked list */
WIN_UnlinkWindow( hwnd ); WIN_UnlinkWindow( hwnd );
/* Destroy the window */ /* Destroy the window */
@ -956,6 +962,16 @@ BOOL EnumChildWindows(HWND hwnd, FARPROC wndenumprc, LPARAM lParam)
return WIN_EnumChildWin(hwnd, wndenumprc, lParam); return WIN_EnumChildWin(hwnd, wndenumprc, lParam);
} }
/*******************************************************************
* AnyPopup [USER.52]
*/
BOOL AnyPopup()
{
printf("EMPTY STUB !! AnyPopup !\n");
return FALSE;
}
/******************************************************************* /*******************************************************************
* SetSysModalWindow [USER.188] * SetSysModalWindow [USER.188]
*/ */
@ -967,6 +983,7 @@ HWND SetSysModalWindow(HWND hWnd)
return hWndOldModal; return hWndOldModal;
} }
/******************************************************************* /*******************************************************************
* GetSysModalWindow [USER.189] * GetSysModalWindow [USER.189]
*/ */