Release 940815

Tue Aug  9 23:58:29 MET DST 1994	<erik@hacktic.nl>

	* [misc/file.c]
	OpenFile(): Completly rewritten.

	* [miscemu/int21.c]
	CreateFile(): Fixed wrong mode in call to open.
	OpenExistingFile(): Implemented file sharing.
	FindNext(): Fixed.
	CreateNewFile(): Fixed wrong mode in call to open.
	fLock(): Added to handle record locking.
	GetFileAttribute(): Added.
	As a result, AH = 0x5c, 0x09, and 0x0b were changed.

	* [miscemu/int2f.c]
	AH = 0x10: SHARE installation check
 
	* [loader/resource.c]
	AccessResource(): Fixed. A new file descriptor will be returned by
	every call to AccessResource().

	* [windows/utility.c]
	wvsprintf(): Fixed.

	* [controls/menu.c]
	FindMenuItem(): Fixed (handling for nPos == -1 added).	

	* [windows/win.c]
	CreateWindowEx(): Added call to WINPOS_GetMinMaxInfo.

	* [Configure]
	Added two options for a processor emulator that might be
	plugged in later..

	* [loader/task.c] [include/toolhelp.h] [if1632/toolhelp.spec]
	CreateNewTask() stores real modulename instead of 'TASKxxxx'.
	Added TaskFirst(), TaskNext(), TaskFindHandle().

	* [memory/global.c]
	Added stub for MemManInfo().

	* [objects/text.c]
	Added stub for GetTabbedTextExt().

	* [miscemu/*]
	Changed all references to registers. Please don't access
 	the context structure.
	fix for GetSystemTime() by <jspeter@birch.ee.vt.edu> added.

	* [misc/lstr.c]
	Fixed bug in AnsiUpper() & AnsiLower().

	* [misc/winsocket.c]
	bugfix in getsockopt()/setsockopt(): winsock uses different values
	than unix.

	* [objects/dib.c]
	Added DIB_SetImageBits_RLE[48] to support compressed bitmaps.

Mon Aug  8 21:12:33 1994  David Metcalfe <david@prism.demon.co.uk>

	* [controls/edit.c]
	Added support for WM_COPY, WM_CUT and WM_PASTE messages.

	* [windows/dialog.c] [windows/defdlg.c] [include/dialog.h]
	Modified dialog code to create new heap for edit controls
	unless DS_LOCALEDIT style is set.

Thu Aug  4 18:50:56 1994  Alexandre Julliard  (julliard@lamisun.epfl.ch)

	* [controls/button.c] [controls/edit.c] [controls/static.c]
	Removed unneeded GlobalUnlock() calls.

	* [controls/menu.c] [include/menu.h]
	Lots of changes, fixed a lot of old bugs and introduced a lot of
	new ones :-)
	- Changed message loop to use MSG_GetInternalMessage().
	- Fixed a bug that caused the main window to lose activation when
	  displaying a menu.
	- Correctly send initialisation messages (WM_INITMENUPOPUP).
	- Implemented EndMenu() and LookupMenuHandle().
	- Changed internal structures to be as compatible as possible with
	  MS-Windows.
	- Allocated everything on the USER heap instead of the global heap.
	- Prefixed all internal function names with MENU_ and declared
	  them static.
	- Moved "About Wine..." handling to NC_HandleSysCommand().
	- Multi-line menus should now work correctly.

	* [loader/resource.c] [objects/bitmap.c]
	Added the possibility to create OEM bitmaps directly as X bitmaps.

	* [objects/dcvalues.c] [windows/dc.c]
	Fixed GetDCOrg() to return screen coordinates.

	* [windows/message.c]
	Fixed double-click checks when the message is not removed from the
	queue.
	Fixed MSG_GetInternalMessage() to send WM_ENTERIDLE messages.

	* [windows/nonclient.c]
	Bug fix in system menu hit-test calculation.
	A few changes for new menu functions.

Thu Aug 11 17:51:02 1994  Thomas Sandford <t.d.g.sandford@bradford.ac.uk>

        * [controls/edit.c]
        Bug fix in Edit_NCCreateMessage
        es->textlen was being used before being set

        * [controls/menu.c]
        Bug fix in MENU_DrawMenuItem
        don't try to write text if NULL pointer passed
This commit is contained in:
Alexandre Julliard 1994-08-16 15:43:11 +00:00
parent 7e50df392b
commit 3f2abfaa0a
56 changed files with 2823 additions and 2123 deletions

115
ChangeLog
View File

@ -1,3 +1,118 @@
----------------------------------------------------------------------
Tue Aug 9 23:58:29 MET DST 1994 <erik@hacktic.nl>
* [misc/file.c]
OpenFile(): Completly rewritten.
* [miscemu/int21.c]
CreateFile(): Fixed wrong mode in call to open.
OpenExistingFile(): Implemented file sharing.
FindNext(): Fixed.
CreateNewFile(): Fixed wrong mode in call to open.
fLock(): Added to handle record locking.
GetFileAttribute(): Added.
As a result, AH = 0x5c, 0x09, and 0x0b were changed.
* [miscemu/int2f.c]
AH = 0x10: SHARE installation check
* [loader/resource.c]
AccessResource(): Fixed. A new file descriptor will be returned by
every call to AccessResource().
* [windows/utility.c]
wvsprintf(): Fixed.
* [controls/menu.c]
FindMenuItem(): Fixed (handling for nPos == -1 added).
* [windows/win.c]
CreateWindowEx(): Added call to WINPOS_GetMinMaxInfo.
* [Configure]
Added two options for a processor emulator that might be
plugged in later..
* [loader/task.c] [include/toolhelp.h] [if1632/toolhelp.spec]
CreateNewTask() stores real modulename instead of 'TASKxxxx'.
Added TaskFirst(), TaskNext(), TaskFindHandle().
* [memory/global.c]
Added stub for MemManInfo().
* [objects/text.c]
Added stub for GetTabbedTextExt().
* [miscemu/*]
Changed all references to registers. Please don't access
the context structure.
fix for GetSystemTime() by <jspeter@birch.ee.vt.edu> added.
* [misc/lstr.c]
Fixed bug in AnsiUpper() & AnsiLower().
* [misc/winsocket.c]
bugfix in getsockopt()/setsockopt(): winsock uses different values
than unix.
* [objects/dib.c]
Added DIB_SetImageBits_RLE[48] to support compressed bitmaps.
Mon Aug 8 21:12:33 1994 David Metcalfe <david@prism.demon.co.uk>
* [controls/edit.c]
Added support for WM_COPY, WM_CUT and WM_PASTE messages.
* [windows/dialog.c] [windows/defdlg.c] [include/dialog.h]
Modified dialog code to create new heap for edit controls
unless DS_LOCALEDIT style is set.
Thu Aug 4 18:50:56 1994 Alexandre Julliard (julliard@lamisun.epfl.ch)
* [controls/button.c] [controls/edit.c] [controls/static.c]
Removed unneeded GlobalUnlock() calls.
* [controls/menu.c] [include/menu.h]
Lots of changes, fixed a lot of old bugs and introduced a lot of
new ones :-)
- Changed message loop to use MSG_GetInternalMessage().
- Fixed a bug that caused the main window to lose activation when
displaying a menu.
- Correctly send initialisation messages (WM_INITMENUPOPUP).
- Implemented EndMenu() and LookupMenuHandle().
- Changed internal structures to be as compatible as possible with
MS-Windows.
- Allocated everything on the USER heap instead of the global heap.
- Prefixed all internal function names with MENU_ and declared
them static.
- Moved "About Wine..." handling to NC_HandleSysCommand().
- Multi-line menus should now work correctly.
* [loader/resource.c] [objects/bitmap.c]
Added the possibility to create OEM bitmaps directly as X bitmaps.
* [objects/dcvalues.c] [windows/dc.c]
Fixed GetDCOrg() to return screen coordinates.
* [windows/message.c]
Fixed double-click checks when the message is not removed from the
queue.
Fixed MSG_GetInternalMessage() to send WM_ENTERIDLE messages.
* [windows/nonclient.c]
Bug fix in system menu hit-test calculation.
A few changes for new menu functions.
Thu Aug 11 17:51:02 1994 Thomas Sandford <t.d.g.sandford@bradford.ac.uk>
* [controls/edit.c]
Bug fix in Edit_NCCreateMessage
es->textlen was being used before being set
* [controls/menu.c]
Bug fix in MENU_DrawMenuItem
don't try to write text if NULL pointer passed
---------------------------------------------------------------------- ----------------------------------------------------------------------
Thu Aug 4 07:18:02 1994 Michael Patra <micky@marie.physik.tu-berlin.de> Thu Aug 4 07:18:02 1994 Michael Patra <micky@marie.physik.tu-berlin.de>

View File

@ -11,8 +11,23 @@ then
ALLDEFINES="$ALLDEFINES -DWINELIB" ALLDEFINES="$ALLDEFINES -DWINELIB"
else else
WINELIB='' WINELIB=''
echo -n 'Use processor emulator (*DOES*NOT*WORK*YET*) (Y/N) [N]? '
read input
if [ "$input" = 'y' -o "$input" = 'Y' ]
then
PROCEMU='#define PROCEMU'
echo -n 'bochs directory [/usr/src/bochs]? '
read input
if [ "$input" = '' ]
then
ALLDEFINES="$ALLDEFINES -DPROC_EMU_DIR=/usr/src/bochs"
else
ALLDEFINES="$ALLDEFINES -DPROC_EMU_DIR="$input
fi
fi
fi fi
echo
echo -n 'Short filenames (Y/N) [N]? ' echo -n 'Short filenames (Y/N) [N]? '
read input read input
if [ "$input" = 'y' -o "$input" = 'Y' ] if [ "$input" = 'y' -o "$input" = 'Y' ]
@ -47,17 +62,13 @@ else
NEWBUILD='' NEWBUILD=''
fi fi
NEWLINUXLDT=''
if [ -f /usr/include/linux/ldt.h ] if [ -f /usr/include/linux/ldt.h ]
then then
if grep -q seg_not_present /usr/include/linux/ldt.h if grep seg_not_present /usr/include/linux/ldt.h
then then
NEWLINUXLDT='#define NewLinuxLdt -DNEW_LDT_STRUCT' NEWLINUXLDT='#define NEW_LDT_STRUCT'
ALLDEFINES="$ALLDEFINES -DNEW_LDT_STRUCT"
else
NEWLINUXLDT=''
fi fi
else
NEWLINUXLDT=''
fi fi
echo '/* autoconf.h generated automatically. Run Configure. */' > autoconf.h echo '/* autoconf.h generated automatically. Run Configure. */' > autoconf.h
@ -66,6 +77,9 @@ echo $SHORTNAMES >> autoconf.h
echo $NEWBUILD >> autoconf.h echo $NEWBUILD >> autoconf.h
echo $WINE_INI_GLOBAL >> autoconf.h echo $WINE_INI_GLOBAL >> autoconf.h
echo $NEWLINUXLDT >> autoconf.h echo $NEWLINUXLDT >> autoconf.h
echo $ENDIAN >> autoconf.h
echo $PROCEMU >> autoconf.h
echo $PROCEMUDIR >> autoconf.h
echo "#define AutoDefines $ALLDEFINES" >> autoconf.h echo "#define AutoDefines $ALLDEFINES" >> autoconf.h
xmkmf -a xmkmf -a

View File

@ -254,7 +254,6 @@ LONG ButtonWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam)
break; break;
} }
GlobalUnlock(hWnd);
return lResult; return lResult;
} }
@ -522,7 +521,6 @@ static LONG CB_Paint(HWND hWnd)
SelectObject(hDC, hOldPen); SelectObject(hDC, hOldPen);
USER_HEAP_FREE(hText); USER_HEAP_FREE(hText);
GlobalUnlock(hWnd);
EndPaint(hWnd, &ps); EndPaint(hWnd, &ps);
} }
@ -604,7 +602,6 @@ static LONG CB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam)
} }
NOTIFY_PARENT(hWnd, BN_CLICKED); NOTIFY_PARENT(hWnd, BN_CLICKED);
} }
GlobalUnlock(hWnd);
InvalidateRect(hWnd, NULL, FALSE); InvalidateRect(hWnd, NULL, FALSE);
UpdateWindow(hWnd); UpdateWindow(hWnd);
} }
@ -644,7 +641,6 @@ static LONG CB_SetCheck(HWND hWnd, WORD wParam)
InvalidateRect(hWnd, NULL, FALSE); InvalidateRect(hWnd, NULL, FALSE);
UpdateWindow(hWnd); UpdateWindow(hWnd);
} }
GlobalUnlock(hWnd);
} }
static LONG CB_GetCheck(HWND hWnd) static LONG CB_GetCheck(HWND hWnd)
@ -653,7 +649,6 @@ static LONG CB_GetCheck(HWND hWnd)
WND *wndPtr = WIN_FindWndPtr(hWnd); WND *wndPtr = WIN_FindWndPtr(hWnd);
wResult = (WORD)(*(wndPtr->wExtra)); wResult = (WORD)(*(wndPtr->wExtra));
GlobalUnlock(hWnd);
return (LONG)wResult; return (LONG)wResult;
} }
@ -723,7 +718,6 @@ static LONG RB_Paint(HWND hWnd)
SelectObject(hDC, hOldPen ); SelectObject(hDC, hOldPen );
USER_HEAP_FREE(hText); USER_HEAP_FREE(hText);
GlobalUnlock(hWnd);
EndPaint(hWnd, &ps); EndPaint(hWnd, &ps);
} }
@ -777,7 +771,6 @@ static LONG RB_LButtonUp(HWND hWnd, WORD wParam, LONG lParam)
(WORD)(*(wndPtr->wExtra)) = 1; (WORD)(*(wndPtr->wExtra)) = 1;
NOTIFY_PARENT(hWnd, BN_CLICKED); NOTIFY_PARENT(hWnd, BN_CLICKED);
} }
GlobalUnlock(hWnd);
InvalidateRect(hWnd, NULL, FALSE); InvalidateRect(hWnd, NULL, FALSE);
UpdateWindow(hWnd); UpdateWindow(hWnd);
} }
@ -817,7 +810,6 @@ static LONG RB_SetCheck(HWND hWnd, WORD wParam)
InvalidateRect(hWnd, NULL, FALSE); InvalidateRect(hWnd, NULL, FALSE);
UpdateWindow(hWnd); UpdateWindow(hWnd);
} }
GlobalUnlock(hWnd);
} }
static LONG RB_GetCheck(HWND hWnd) static LONG RB_GetCheck(HWND hWnd)
@ -826,7 +818,6 @@ static LONG RB_GetCheck(HWND hWnd)
WND *wndPtr = WIN_FindWndPtr(hWnd); WND *wndPtr = WIN_FindWndPtr(hWnd);
wResult = (WORD)(*(wndPtr->wExtra)); wResult = (WORD)(*(wndPtr->wExtra));
GlobalUnlock(hWnd);
return (LONG)wResult; return (LONG)wResult;
} }

View File

@ -17,12 +17,6 @@ static char Copyright[] = "Copyright David W. Metcalfe, 1994";
#include "user.h" #include "user.h"
#include "scroll.h" #include "scroll.h"
#define EDIT_HEAP_ALLOC(size) USER_HEAP_ALLOC(GMEM_MOVEABLE,size)
#define EDIT_HEAP_REALLOC(handle,size) USER_HEAP_REALLOC(handle,size,\
GMEM_MOVEABLE)
#define EDIT_HEAP_ADDR(handle) USER_HEAP_ADDR(handle)
#define EDIT_HEAP_FREE(handle) USER_HEAP_FREE(handle)
/* #define DEBUG_EDIT /* */ /* #define DEBUG_EDIT /* */
#define NOTIFY_PARENT(hWndCntrl, wNotifyCode) \ #define NOTIFY_PARENT(hWndCntrl, wNotifyCode) \
@ -37,7 +31,6 @@ static char Copyright[] = "Copyright David W. Metcalfe, 1994";
#define HSCROLLDIM (ClientWidth(wndPtr) / 3) #define HSCROLLDIM (ClientWidth(wndPtr) / 3)
/* "line" dimension for horizontal scroll */ /* "line" dimension for horizontal scroll */
typedef struct typedef struct
{ {
int wlines; /* number of lines of text */ int wlines; /* number of lines of text */
@ -172,6 +165,8 @@ void EDIT_HeapFree(HWND hwnd, unsigned int handle);
unsigned int EDIT_HeapSize(HWND hwnd, unsigned int handle); unsigned int EDIT_HeapSize(HWND hwnd, unsigned int handle);
void EDIT_SetHandleMsg(HWND hwnd, WORD wParam); void EDIT_SetHandleMsg(HWND hwnd, WORD wParam);
LONG EDIT_SetTabStopsMsg(HWND hwnd, WORD wParam, LONG lParam); LONG EDIT_SetTabStopsMsg(HWND hwnd, WORD wParam, LONG lParam);
void EDIT_CopyToClipboard(HWND hwnd);
void EDIT_PasteMsg(HWND hwnd);
void swap(int *a, int *b); void swap(int *a, int *b);
@ -326,10 +321,20 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam)
EDIT_CharMsg(hwnd, wParam); EDIT_CharMsg(hwnd, wParam);
break; break;
case WM_COPY:
EDIT_CopyToClipboard(hwnd);
EDIT_ClearSel(hwnd);
break;
case WM_CREATE: case WM_CREATE:
lResult = EDIT_CreateMsg(hwnd, lParam); lResult = EDIT_CreateMsg(hwnd, lParam);
break; break;
case WM_CUT:
EDIT_CopyToClipboard(hwnd);
EDIT_DeleteSel(hwnd);
break;
case WM_DESTROY: case WM_DESTROY:
EDIT_HeapFree(hwnd, es->hTextPtrs); EDIT_HeapFree(hwnd, es->hTextPtrs);
EDIT_HeapFree(hwnd, es->hCharWidths); EDIT_HeapFree(hwnd, es->hCharWidths);
@ -403,6 +408,10 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam)
EDIT_PaintMsg(hwnd); EDIT_PaintMsg(hwnd);
break; break;
case WM_PASTE:
EDIT_PasteMsg(hwnd);
break;
case WM_SETFOCUS: case WM_SETFOCUS:
CreateCaret(hwnd, 0, 2, es->txtht); CreateCaret(hwnd, 0, 2, es->txtht);
SetCaretPos(es->WndCol, es->WndRow * es->txtht); SetCaretPos(es->WndCol, es->WndRow * es->txtht);
@ -435,7 +444,6 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam)
break; break;
} }
GlobalUnlock(hwnd);
return lResult; return lResult;
} }
@ -479,11 +487,11 @@ long EDIT_NCCreateMsg(HWND hwnd, LONG lParam)
{ {
if (strlen(createStruct->lpszName) < EditBufLen(wndPtr)) if (strlen(createStruct->lpszName) < EditBufLen(wndPtr))
{ {
es->textlen = EditBufLen(wndPtr) + 1;
es->hText = EDIT_HeapAlloc(hwnd, EditBufLen(wndPtr) + 2); es->hText = EDIT_HeapAlloc(hwnd, EditBufLen(wndPtr) + 2);
text = EDIT_HeapAddr(hwnd, es->hText); text = EDIT_HeapAddr(hwnd, es->hText);
strcpy(text, createStruct->lpszName); strcpy(text, createStruct->lpszName);
*(text + es->textlen) = '\0'; *(text + es->textlen) = '\0';
es->textlen = EditBufLen(wndPtr) + 1;
} }
else else
{ {
@ -3145,6 +3153,65 @@ LONG EDIT_SetTabStopsMsg(HWND hwnd, WORD wParam, LONG lParam)
} }
/*********************************************************************
* EDIT_CopyToClipboard
*
* Copy the specified text to the clipboard.
*/
void EDIT_CopyToClipboard(HWND hwnd)
{
HANDLE hMem;
char *lpMem;
int i, len;
char *bbl, *bel;
WND *wndPtr = WIN_FindWndPtr(hwnd);
EDITSTATE *es =
(EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra)));
bbl = EDIT_TextLine(hwnd, es->SelBegLine) + es->SelBegCol;
bel = EDIT_TextLine(hwnd, es->SelEndLine) + es->SelEndCol;
len = (int)(bel - bbl);
hMem = GlobalAlloc(GHND, (DWORD)(len + 1));
lpMem = GlobalLock(hMem);
for (i = 0; i < len; i++)
*lpMem++ = *bbl++;
GlobalUnlock(hMem);
OpenClipboard(hwnd);
EmptyClipboard();
SetClipboardData(CF_TEXT, hMem);
CloseClipboard();
}
/*********************************************************************
* WM_PASTE message function
*/
void EDIT_PasteMsg(HWND hwnd)
{
HANDLE hClipMem;
char *lpClipMem;
OpenClipboard(hwnd);
if (!(hClipMem = GetClipboardData(CF_TEXT)))
{
/* no text in clipboard */
CloseClipboard();
return;
}
lpClipMem = GlobalLock(hClipMem);
EDIT_InsertText(hwnd, lpClipMem, strlen(lpClipMem));
GlobalUnlock(hClipMem);
CloseClipboard();
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
}
/********************************************************************* /*********************************************************************
* Utility functions * Utility functions
*/ */

File diff suppressed because it is too large Load Diff

View File

@ -127,7 +127,6 @@ LONG StaticWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam)
break; break;
} }
GlobalUnlock(hWnd);
return lResult; return lResult;
} }
@ -187,7 +186,6 @@ static LONG PaintTextfn(HWND hwnd)
DrawText(hdc, text, textlen, &rc, wFormat); DrawText(hdc, text, textlen, &rc, wFormat);
USER_HEAP_FREE(hText); USER_HEAP_FREE(hText);
GlobalUnlock(hwnd);
EndPaint(hwnd, &ps); EndPaint(hwnd, &ps);
} }
@ -231,7 +229,6 @@ static LONG PaintRectfn(HWND hwnd)
DeleteObject((HANDLE)hPen); DeleteObject((HANDLE)hPen);
DeleteObject((HANDLE)hBrush); DeleteObject((HANDLE)hBrush);
GlobalUnlock(hwnd);
EndPaint(hwnd, &ps); EndPaint(hwnd, &ps);
} }
@ -273,7 +270,6 @@ static LONG PaintFramefn(HWND hwnd)
DeleteObject((HANDLE)hPen); DeleteObject((HANDLE)hPen);
DeleteObject((HANDLE)hBrush); DeleteObject((HANDLE)hBrush);
GlobalUnlock(hwnd);
EndPaint(hwnd, &ps); EndPaint(hwnd, &ps);
} }
@ -304,7 +300,6 @@ static LONG PaintIconfn(HWND hwnd)
hIcon = LoadIcon(wndPtr->hInstance, textPtr); hIcon = LoadIcon(wndPtr->hInstance, textPtr);
DrawIcon(hdc, rc.left, rc.top, hIcon); DrawIcon(hdc, rc.left, rc.top, hIcon);
EndPaint(hwnd, &ps); EndPaint(hwnd, &ps);
GlobalUnlock(hwnd);
} }

View File

@ -290,7 +290,7 @@ void winestat(){
used++; used++;
if (table[j].handler) implemented++; if (table[j].handler) implemented++;
else else
printf("%s.%d\n", printf("%s.%d not implemented\n",
dll_builtin_table[i].dll_name, dll_builtin_table[i].dll_name,
j); j);
}; };
@ -301,10 +301,11 @@ void winestat(){
perc = implemented * 100.00 / used; perc = implemented * 100.00 / used;
else else
perc = 0.0; perc = 0.0;
printf("%s: %d of %d (%3.1f %%)\n", dll_builtin_table[i].dll_name, implemented, used, perc); if (used)
printf("%s: %d of %d (%3.1f %%)\n", dll_builtin_table[i].dll_name, implemented, used, perc);
}; };
perc = timplemented * 100.00 / tused; perc = timplemented * 100.00 / tused;
printf("TOTAL: %d of %d implemented (%3.1f %%)\n",timplemented, tused, perc); printf("TOTAL: %d of %d winapi functions implemented (%3.1f %%)\n",timplemented, tused, perc);
} }
#endif /* WINESTAT */ #endif /* WINESTAT */
#endif /* !WINELIB */ #endif /* !WINELIB */

View File

@ -15,16 +15,16 @@ length 83
60 pascal ModuleNext(ptr) ModuleNext(1) 60 pascal ModuleNext(ptr) ModuleNext(1)
61 pascal ModuleFindName(ptr ptr) ModuleFindName(1 2) 61 pascal ModuleFindName(ptr ptr) ModuleFindName(1 2)
62 pascal ModuleFindHandle(ptr word) ModuleFindHandle(1 2) 62 pascal ModuleFindHandle(ptr word) ModuleFindHandle(1 2)
# 63 1 0caa TASKFIRST exported, shared data 63 pascal16 TaskFirst(ptr) TaskFirst(1)
# 64 1 0ced TASKNEXT exported, shared data 64 pascal16 TaskNext(ptr) TaskNext(1)
# 65 1 0d2e TASKFINDHANDLE exported, shared data 65 pascal16 TaskFindHandle(ptr word) TaskFindHandle(1 2)
# 66 1 0f1c STACKTRACEFIRST exported, shared data # 66 1 0f1c STACKTRACEFIRST exported, shared data
# 67 1 0f67 STACKTRACECSIPFIRST exported, shared data # 67 1 0f67 STACKTRACECSIPFIRST exported, shared data
# 68 1 0fca STACKTRACENEXT exported, shared data # 68 1 0fca STACKTRACENEXT exported, shared data
# 69 1 28b0 CLASSFIRST exported, shared data # 69 1 28b0 CLASSFIRST exported, shared data
# 70 1 2925 CLASSNEXT exported, shared data # 70 1 2925 CLASSNEXT exported, shared data
# 71 1 11ce SYSTEMHEAPINFO exported, shared data # 71 1 11ce SYSTEMHEAPINFO exported, shared data
# 72 1 13f4 MEMMANINFO exported, shared data 72 pascal16 MemManInfo(ptr) MemManInfo(1)
# 73 1 1b72 NOTIFYREGISTER exported, shared data # 73 1 1b72 NOTIFYREGISTER exported, shared data
# 74 1 1c29 NOTIFYUNREGISTER exported, shared data # 74 1 1c29 NOTIFYUNREGISTER exported, shared data
# 75 1 2060 INTERRUPTREGISTER exported, shared data # 75 1 2060 INTERRUPTREGISTER exported, shared data

View File

@ -190,7 +190,7 @@ length 540
185 pascal GrayString(word word ptr ptr word word word word word) 185 pascal GrayString(word word ptr ptr word word word word word)
GrayString(1 2 3 4 5 6 7 8 9) GrayString(1 2 3 4 5 6 7 8 9)
186 pascal SwapMouseButton(word) SwapMouseButton(1) 186 pascal SwapMouseButton(word) SwapMouseButton(1)
#187 ENDMENU 187 pascal EndMenu() EndMenu()
188 pascal SetSysModalWindow(word) SetSysModalWindow(1) 188 pascal SetSysModalWindow(word) SetSysModalWindow(1)
189 pascal GetSysModalWindow() GetSysModalWindow() 189 pascal GetSysModalWindow() GetSysModalWindow()
190 pascal GetUpdateRect(word ptr word) GetUpdateRect(1 2 3) 190 pascal GetUpdateRect(word ptr word) GetUpdateRect(1 2 3)
@ -201,7 +201,8 @@ length 540
195 pascal DlgDirListComboBox(word ptr word word word) DlgDirListComboBox(1 2 3 4 5) 195 pascal DlgDirListComboBox(word ptr word word word) DlgDirListComboBox(1 2 3 4 5)
196 pascal TabbedTextOut(word s_word s_word ptr s_word s_word ptr s_word) 196 pascal TabbedTextOut(word s_word s_word ptr s_word s_word ptr s_word)
TabbedTextOut(1 2 3 4 5 6 7 8) TabbedTextOut(1 2 3 4 5 6 7 8)
#197 GETTABBEDTEXTEXTENT 197 pascal GETTABBEDTEXTEXTENT(word ptr word word ptr)
GetTabbedTextExtent(1 2 3 4 5)
#198 CASCADECHILDWINDOWS #198 CASCADECHILDWINDOWS
#199 TILECHILDWINDOWS #199 TILECHILDWINDOWS
200 pascal OpenComm(ptr word word) OpenComm(1 2 3) 200 pascal OpenComm(ptr word word) OpenComm(1 2 3)
@ -221,7 +222,7 @@ length 540
214 pascal EscapeCommFunction(word word) EscapeCommFunction(1 2) 214 pascal EscapeCommFunction(word word) EscapeCommFunction(1 2)
215 pascal FlushComm(word word) FlushComm(1 2) 215 pascal FlushComm(word word) FlushComm(1 2)
#216 USERSEEUSERDO #216 USERSEEUSERDO
#217 LOOKUPMENUHANDLE 217 pascal LookupMenuHandle(word s_word) LookupMenuHandle(1 2)
218 pascal DialogBoxIndirect(word word word ptr) DialogBoxIndirect(1 2 3 4) 218 pascal DialogBoxIndirect(word word word ptr) DialogBoxIndirect(1 2 3 4)
219 pascal CreateDialogIndirect(word ptr word ptr) 219 pascal CreateDialogIndirect(word ptr word ptr)
CreateDialogIndirect(1 2 3 4) CreateDialogIndirect(1 2 3 4)

View File

@ -1,7 +0,0 @@
#define check_bitmap_width 10
#define check_bitmap_height 10
#define check_bitmap_x_hot 0
#define check_bitmap_y_hot 0
static char check_bitmap_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x80, 0x01, 0xc0, 0x00,
0x63, 0x00, 0x36, 0x00, 0x1c, 0x00, 0x08, 0x00};

View File

@ -0,0 +1,6 @@
#define check_mark_width 14
#define check_mark_height 14
static char check_mark_bits[] = {
0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x04, 0x00, 0x06,
0x30, 0x02, 0x60, 0x03, 0x40, 0x01, 0xc0, 0x01, 0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00};

View File

@ -0,0 +1,4 @@
#define menu_arrow_width 7
#define menu_arrow_height 11
static char menu_arrow_bits[] = {
0x00, 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00};

View File

@ -1,7 +0,0 @@
#define nocheck_bitmap_width 10
#define nocheck_bitmap_height 10
#define nocheck_bitmap_x_hot 0
#define nocheck_bitmap_y_hot 0
static char nocheck_bitmap_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

View File

@ -25,6 +25,7 @@ typedef struct
WORD xBaseUnit; WORD xBaseUnit;
WORD yBaseUnit; WORD yBaseUnit;
WORD fEnd; WORD fEnd;
HANDLE hDialogHeap;
} DIALOGINFO; } DIALOGINFO;

View File

@ -6,42 +6,34 @@
#ifndef MENU_H #ifndef MENU_H
#define MENU_H #define MENU_H
#define MENU_MAGIC 0x554d /* 'MU' */
typedef struct tagMENUITEM typedef struct tagMENUITEM
{ {
struct tagMENUITEM *next;
struct tagMENUITEM *prev;
HANDLE hItem;
WORD item_flags; WORD item_flags;
WORD item_id; WORD item_id;
WORD sel_key;
char *item_text;
HANDLE hText;
RECT rect; RECT rect;
WORD sel_key;
HBITMAP hCheckBit; HBITMAP hCheckBit;
HBITMAP hUnCheckBit; HBITMAP hUnCheckBit;
char *item_text;
HANDLE hText;
} MENUITEM, *LPMENUITEM; } MENUITEM, *LPMENUITEM;
typedef struct tagPOPUPMENU typedef struct tagPOPUPMENU
{ {
HWND hWnd; /* PopupMenu window handle */ HMENU hNext; /* Next menu (compatibility only, always 0) */
HWND hWndParent; /* Parent PopupMenu window handle */ WORD wFlags; /* Menu flags (MF_POPUP, MF_SYSMENU) */
HWND ownerWnd; /* Owner window */ WORD wMagic; /* Magic number */
HWND hWndPrev; /* Previous Window Focus Owner */ HANDLE hTaskQ; /* Task queue for this menu */
WORD nItems; /* Number of items on menu */ WORD Width; /* Width of the whole menu */
MENUITEM *firstItem; WORD Height; /* Height of the whole menu */
WORD FocusedItem; WORD nItems; /* Number of items in the menu */
WORD MouseFlags; HWND hWnd; /* Window containing the menu */
BOOL BarFlag; /* TRUE if menu is a MENUBAR */ HANDLE hItems; /* Handle to the items array */
BOOL SysFlag; /* TRUE if menu is a SYSMENU */ WORD FocusedItem; /* Currently focused item */
BOOL ChildFlag; /* TRUE if child of other menu */
WORD Width;
WORD Height;
WORD CheckWidth;
WORD PopWidth;
RECT rect;
} POPUPMENU, *LPPOPUPMENU; } POPUPMENU, *LPPOPUPMENU;
typedef struct typedef struct
@ -63,11 +55,4 @@ typedef struct
char item_text[1]; /* Text for menu item */ char item_text[1]; /* Text for menu item */
} MENUITEMTEMPLATE; } MENUITEMTEMPLATE;
void StdDrawMenuBar(HDC hDC, LPRECT lprect, LPPOPUPMENU lppop,
BOOL suppress_draw);
BOOL MenuButtonDown(HWND hWnd, LPPOPUPMENU lppop, int x, int y);
void MenuButtonUp(HWND hWnd, LPPOPUPMENU lppop, int x, int y);
void MenuMouseMove(HWND hWnd, LPPOPUPMENU lppop, WORD wParam, int x, int y);
extern void NC_TrackSysMenu(HWND hwnd);
#endif /* MENU_H */ #endif /* MENU_H */

View File

@ -53,7 +53,7 @@ extern BOOL MSG_CreateSysMsgQueue( int size );
extern void hardware_event( WORD message, WORD wParam, LONG lParam, extern void hardware_event( WORD message, WORD wParam, LONG lParam,
int xPos, int yPos, DWORD time, DWORD extraInfo ); int xPos, int yPos, DWORD time, DWORD extraInfo );
extern BOOL MSG_GetHardwareMessage( LPMSG msg ); extern BOOL MSG_GetHardwareMessage( LPMSG msg );
extern BOOL MSG_InternalGetMessage( LPMSG msg, HWND hwnd, extern BOOL MSG_InternalGetMessage( LPMSG msg, HWND hwnd, HWND hwndOwner,
short code, BOOL sendIdle ); short code, WORD flags, BOOL sendIdle );
#endif /* MESSAGE_H */ #endif /* MESSAGE_H */

View File

@ -17,29 +17,6 @@ struct dosdirent {
#define DOSVERSION 0x0330; #define DOSVERSION 0x0330;
#define MAX_DOS_DRIVES 26 #define MAX_DOS_DRIVES 26
#define EAX context->sc_eax
#define EBX context->sc_ebx
#define ECX context->sc_ecx
#define EDX context->sc_edx
#define AX (context->sc_eax & 0x0000ffffL)
#define BX (context->sc_ebx & 0x0000ffffL)
#define CX (context->sc_ecx & 0x0000ffffL)
#define DX (context->sc_edx & 0x0000ffffL)
#define CS context->sc_cs
#define DS context->sc_ds
#define ES context->sc_es
#define SS context->sc_ss
#define DI context->sc_edi
#define SI context->sc_esi
#define SP context->sc_esp
#define EFL context->sc_efl
#define SetCflag (EFL |= 0x00000001L)
#define ResetCflag (EFL &= 0xfffffffeL)
#define pointer(a,b) (BYTE*)(((WORD) a << 16) | b) #define pointer(a,b) (BYTE*)(((WORD) a << 16) | b)
#define segment(a) ((DWORD)a >> 16) #define segment(a) ((DWORD)a >> 16)
#define offset(a) ((DWORD)a & 0xffff) #define offset(a) ((DWORD)a & 0xffff)

50
include/registers.h Normal file
View File

@ -0,0 +1,50 @@
#ifndef __WINE_REGISTERS_H
#define __WINE_REGISTERS_H
#include <windows.h>
#include "autoconf.h"
#ifndef PROCEMU
#define EAX context->sc_eax
#define EBX context->sc_ebx
#define ECX context->sc_ecx
#define EDX context->sc_edx
#define AX *(WORD*)&context->sc_eax
#define BX *(WORD*)&context->sc_ebx
#define CX *(WORD*)&context->sc_ecx
#define DX *(WORD*)&context->sc_edx
#define AL *(BYTE*)&context->sc_eax
#define AH *(((BYTE*)&context->sc_eax)+1)
#define BL *(BYTE*)&context->sc_ebx
#define BH *(((BYTE*)&context->sc_ebx)+1)
#define CL *(BYTE*)&context->sc_ecx
#define CH *(((BYTE*)&context->sc_ecx)+1)
#define DL *(BYTE*)&context->sc_edx
#define DH *(((BYTE*)&context->sc_edx)+1)
#define CS context->sc_cs
#define DS context->sc_ds
#define ES context->sc_es
#define SS context->sc_ss
#define DI context->sc_edi
#define SI context->sc_esi
#define SP context->sc_esp
#define EFL context->sc_efl
#define EIP context->sc_eip
#define SetCflag (EFL |= 0x00000001)
#define ResetCflag (EFL &= 0xfffffffe)
#else
#include "bx_bochs.h"
#define SetCflag bx_STC()
#define ResetCflag bx_CLC()
#endif /* PROCEMU */
#endif /* __WINE_REGISTERS_H */

View File

@ -7,30 +7,9 @@
#include "toolhelp.h" #include "toolhelp.h"
typedef HANDLE HGLOBAL;
typedef struct {
DWORD dwSize;
HTASK hTask;
HTASK hTaskParent;
HINSTANCE hInst;
HMODULE hModule;
WORD wSS;
WORD wSP;
WORD wStackTop;
WORD wStackMinimum;
WORD wStackBottom;
WORD wcEvents;
HGLOBAL hQueue;
char szModule[MAX_MODULE_NAME + 1];
WORD wPSPOffset;
HANDLE hNext;
} TASKENTRY;
typedef TASKENTRY *LPTASKENTRY;
typedef struct { typedef struct {
TASKENTRY te; TASKENTRY te;
int unix_pid; int unix_pid;
HICON hIcon; HICON hIcon;
HWND *lpWndList; HWND *lpWndList;
void *lpPrevTask; void *lpPrevTask;

View File

@ -4,9 +4,14 @@
#include "windows.h" #include "windows.h"
DECLARE_HANDLE(HMODULE); DECLARE_HANDLE(HMODULE);
DECLARE_HANDLE(HGLOBAL);
#define MAX_MODULE_NAME 9 #define MAX_DATA 11
#define MAX_PATH 255 #define MAX_MODULE_NAME 9
#define MAX_PATH 255
#define MAX_CLASSNAME 255
/* modules */
typedef struct { typedef struct {
DWORD dwSize; DWORD dwSize;
@ -23,4 +28,61 @@ BOOL ModuleNext(MODULEENTRY *lpModule);
HMODULE ModuleFindName(MODULEENTRY *lpModule, LPCSTR lpstrName); HMODULE ModuleFindName(MODULEENTRY *lpModule, LPCSTR lpstrName);
HMODULE ModuleFindHandle(MODULEENTRY *lpModule, HMODULE hModule); HMODULE ModuleFindHandle(MODULEENTRY *lpModule, HMODULE hModule);
/* tasks */
typedef struct tagTASKENTRY {
DWORD dwSize;
HTASK hTask;
HTASK hTaskParent;
HINSTANCE hInst;
HMODULE hModule;
WORD wSS;
WORD wSP;
WORD wStackTop;
WORD wStackMinimum;
WORD wStackBottom;
WORD wcEvents;
HGLOBAL hQueue;
char szModule[MAX_MODULE_NAME + 1];
WORD wPSPOffset;
HANDLE hNext;
} TASKENTRY;
typedef TASKENTRY *LPTASKENTRY;
BOOL TaskFirst(LPTASKENTRY lpTask);
BOOL TaskNext(LPTASKENTRY lpTask);
BOOL TaskFindHandle(LPTASKENTRY lpTask, HTASK hTask);
DWORD TaskSetCSIP(HTASK hTask, WORD wCS, WORD wIP);
DWORD TaskGetCSIP(HTASK hTask);
BOOL TaskSwitch(HTASK hTask, DWORD dwNewCSIP);
/* mem info */
typedef struct tagMEMMANINFO {
DWORD dwSize;
DWORD dwLargestFreeBlock;
DWORD dwMaxPagesAvailable;
DWORD dwMaxPagesLockable;
DWORD dwTotalLinearSpace;
DWORD dwTotalUnlockedPages;
DWORD dwFreePages;
DWORD dwTotalPages;
DWORD dwFreeLinearSpace;
DWORD dwSwapFilePages;
WORD wPageSize;
} MEMMANINFO;
typedef MEMMANINFO *LPMEMMANINFO;
typedef struct tagSYSHEAPINFO {
DWORD dwSize;
WORD wUserFreePercent;
WORD wGDIFreePercent;
HGLOBAL hUserSegment;
HGLOBAL hGDISegment;
} SYSHEAPINFO;
typedef SYSHEAPINFO *LPSYSHEAPINFO;
BOOL MemManInfo(LPMEMMANINFO lpEnhMode);
BOOL SystemHeapInfo(LPSYSHEAPINFO lpSysHeap);
#endif /* __TOOLHELP_H */ #endif /* __TOOLHELP_H */

View File

@ -1496,6 +1496,8 @@ enum { WM_NULL, WM_CREATE, WM_DESTROY, WM_MOVE, WM_UNUSED0, WM_SIZE, WM_ACTIVATE
#define WM_HSCROLL 0x0114 #define WM_HSCROLL 0x0114
#define WM_VSCROLL 0x0115 #define WM_VSCROLL 0x0115
#define WM_ENTERIDLE 0x0121
/* Mouse messages */ /* Mouse messages */
#define WM_MOUSEMOVE 0x0200 #define WM_MOUSEMOVE 0x0200
#define WM_LBUTTONDOWN 0x0201 #define WM_LBUTTONDOWN 0x0201
@ -2714,6 +2716,7 @@ Fb(HPALETTE,GDISelectPalette,HDC,a,HPALETTE,b)
Fb(HMENU,GetSubMenu,HMENU,a,short,b) Fb(HMENU,GetSubMenu,HMENU,a,short,b)
Fb(HMENU,GetSystemMenu,HWND,a,BOOL,b) Fb(HMENU,GetSystemMenu,HWND,a,BOOL,b)
Fb(HMENU,LoadMenu,HANDLE,a,LPSTR,b) Fb(HMENU,LoadMenu,HANDLE,a,LPSTR,b)
Fb(HMENU,LookupMenuHandle,HMENU,a,INT,b)
Fb(HWND,ChildWindowFromPoint,HWND,a,POINT,b) Fb(HWND,ChildWindowFromPoint,HWND,a,POINT,b)
Fb(HWND,FindWindow,LPSTR,a,LPSTR,b) Fb(HWND,FindWindow,LPSTR,a,LPSTR,b)
Fb(HWND,GetDlgItem,HWND,a,WORD,b) Fb(HWND,GetDlgItem,HWND,a,WORD,b)

View File

@ -5,6 +5,8 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include "autoconf.h"
#ifdef linux #ifdef linux
#include <linux/unistd.h> #include <linux/unistd.h>
#include <linux/head.h> #include <linux/head.h>

View File

@ -37,6 +37,8 @@ static struct w_files *ResourceFileInfo = NULL;
static RESOURCE *Top = NULL; static RESOURCE *Top = NULL;
extern HINSTANCE hSysRes; extern HINSTANCE hSysRes;
extern HBITMAP BITMAP_LoadOEMBitmap( WORD id ); /* objects/bitmap.c */
HANDLE RSC_LoadResource(int instance, char *rsc_name, int type, HANDLE RSC_LoadResource(int instance, char *rsc_name, int type,
int *image_size_ret); int *image_size_ret);
void RSC_LoadNameTable(void); void RSC_LoadNameTable(void);
@ -1153,8 +1155,14 @@ LoadBitmap(HANDLE instance, LPSTR bmp_name)
printf("LoadBitmap: instance = %04x, name = %08x\n", printf("LoadBitmap: instance = %04x, name = %08x\n",
instance, bmp_name); instance, bmp_name);
#endif #endif
if (instance == (HANDLE)NULL) instance = hSysRes; if (!instance)
if (!(hdc = GetDC(GetDesktopWindow()))) return 0; {
/* Try to create an OEM bitmap */
hbitmap = BITMAP_LoadOEMBitmap( ((int)bmp_name) & 0xffff );
if (hbitmap) return hbitmap;
/* Failed -> load it from sysres.dll */
instance = hSysRes;
}
rsc_mem = RSC_LoadResource(instance, bmp_name, NE_RSCTYPE_BITMAP, rsc_mem = RSC_LoadResource(instance, bmp_name, NE_RSCTYPE_BITMAP,
&image_size); &image_size);
@ -1163,6 +1171,7 @@ LoadBitmap(HANDLE instance, LPSTR bmp_name)
return 0; return 0;
} }
lp = (long *) GlobalLinearLock(rsc_mem); lp = (long *) GlobalLinearLock(rsc_mem);
if (!(hdc = GetDC(0))) lp = NULL;
if (lp == NULL) if (lp == NULL)
{ {
GlobalFree(rsc_mem); GlobalFree(rsc_mem);

View File

@ -10,6 +10,8 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994";
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include "windows.h" #include "windows.h"
#include "wine.h" #include "wine.h"
#include "task.h" #include "task.h"
@ -17,7 +19,6 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994";
static LPWINETASKENTRY lpTaskList = NULL; static LPWINETASKENTRY lpTaskList = NULL;
static int nTaskCount = 0; static int nTaskCount = 0;
/********************************************************************** /**********************************************************************
* GetCurrentTask [KERNEL.36] * GetCurrentTask [KERNEL.36]
*/ */
@ -122,9 +123,14 @@ BOOL EnumTaskWindows(HANDLE hTask, FARPROC lpEnumFunc, LONG lParam)
*/ */
HANDLE CreateNewTask(HINSTANCE hInst, HTASK hTaskParent) HANDLE CreateNewTask(HINSTANCE hInst, HTASK hTaskParent)
{ {
HANDLE hTask; HANDLE hTask;
LPWINETASKENTRY lpTask = lpTaskList; LPWINETASKENTRY lpTask = lpTaskList;
LPWINETASKENTRY lpNewTask; LPWINETASKENTRY lpNewTask;
MODULEENTRY module;
module.dwSize = sizeof(module);
ModuleFindHandle(&module, hInst);
if (lpTask != NULL) { if (lpTask != NULL) {
while (TRUE) { while (TRUE) {
if (lpTask->lpNextTask == NULL) break; if (lpTask->lpNextTask == NULL) break;
@ -160,7 +166,7 @@ HANDLE CreateNewTask(HINSTANCE hInst, HTASK hTaskParent)
lpNewTask->te.wStackBottom = 0; lpNewTask->te.wStackBottom = 0;
lpNewTask->te.wcEvents = 0; lpNewTask->te.wcEvents = 0;
lpNewTask->te.hQueue = 0; lpNewTask->te.hQueue = 0;
sprintf(lpNewTask->te.szModule, "TASK%04X", hInst); strcpy(lpNewTask->te.szModule, module.szModule);
lpNewTask->te.wPSPOffset = 0; lpNewTask->te.wPSPOffset = 0;
lpNewTask->unix_pid = getpid(); lpNewTask->unix_pid = getpid();
lpNewTask->lpWndList = (HWND *) malloc(MAXWIN_PER_TASK * sizeof(HWND)); lpNewTask->lpWndList = (HWND *) malloc(MAXWIN_PER_TASK * sizeof(HWND));
@ -245,4 +251,55 @@ BOOL RemoveWindowFromTask(HTASK hTask, HWND hWnd)
return TRUE; return TRUE;
} }
BOOL TaskFirst(LPTASKENTRY lpTask)
{
printf("TaskFirst(%8x)\n", (int) lpTask);
if (lpTaskList) {
memcpy(lpTask, &lpTaskList->te, lpTask->dwSize);
return TRUE;
} else
return FALSE;
}
BOOL TaskNext(LPTASKENTRY lpTask)
{
LPWINETASKENTRY list;
printf("TaskNext(%8x)\n", (int) lpTask);
list = lpTaskList;
while (list) {
if (list->te.hTask == lpTask->hTask) {
list = list->lpNextTask;
if (list) {
memcpy(lpTask, &list->te, lpTask->dwSize);
return TRUE;
} else
return FALSE;
}
list = list->lpNextTask;
}
return FALSE;
}
BOOL TaskFindHandle(LPTASKENTRY lpTask, HTASK hTask)
{
static LPWINETASKENTRY list;
printf("TaskFindHandle(%8x,%4x)\n", (int) lpTask, hTask);
list = lpTaskList;
while (list) {
if (list->te.hTask == hTask) {
list = list->lpNextTask;
if (list) {
memcpy(lpTask, &list->te, lpTask->dwSize);
return TRUE;
} else
return FALSE;
}
list = list->lpNextTask;
}
return FALSE;
}

View File

@ -8,6 +8,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "prototypes.h" #include "prototypes.h"
#include "toolhelp.h"
#include "heap.h" #include "heap.h"
#include "segmem.h" #include "segmem.h"
@ -807,3 +808,11 @@ DWORD GetFreeSpace(UINT wFlags)
printf("GetFreeSpace // return %ld !\n", total_free << 16); printf("GetFreeSpace // return %ld !\n", total_free << 16);
return total_free << 16; return total_free << 16;
} }
/**********************************************************************
* MemManInfo (toolhelp.72)
*/
BOOL MemManInfo(LPMEMMANINFO lpmmi)
{
return 1;
}

View File

@ -23,13 +23,28 @@
#include <unistd.h> #include <unistd.h>
#include <time.h> #include <time.h>
#include <windows.h> #include <windows.h>
#include <sys/stat.h>
#include "prototypes.h" #include "prototypes.h"
#include "regfunc.h"
#include "windows.h"
#include "wine.h"
#include "msdos.h"
#include "registers.h"
#include "options.h"
#define MAX_PATH 255
/* #define DEBUG_FILE /* */ /* #define DEBUG_FILE /* */
char WindowsDirectory[256], SystemDirectory[256], TempDirectory[256]; char WindowsDirectory[256], SystemDirectory[256], TempDirectory[256];
extern char WindowsPath[256]; extern char WindowsPath[256];
extern char WindowsPath[];
extern WORD ExtendedError;
char *GetDosFileName(char *unixfilename);
/*************************************************************************** /***************************************************************************
_lopen _lopen
@ -116,83 +131,153 @@ INT _lclose (INT hFile)
/************************************************************************** /**************************************************************************
OpenFile OpenFile
Warning: This is nearly totally untested. It compiles, that's it...
-SL 9/13/93
**************************************************************************/ **************************************************************************/
INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle) INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle)
{ {
int base, flags; int handle;
int handle; struct sigcontext_struct ccontext;
char buf[256]; /* To make macros like EAX happy */
struct sigcontext_struct *context=&ccontext;
#ifdef DEBUG_FILE char filename[MAX_PATH+1];
fprintf(stderr,"OpenFile(%s,<struct>,%04X)\n",lpFileName,wStyle); int action;
#endif struct stat s;
struct tm *now;
base = wStyle & 0xF; int res;
flags = wStyle & 0xFFF0; int verify_time;
flags &= 0xFF0F; /* strip SHARE bits for now */ #ifdef DEBUG_FILE
flags &= 0xD7FF; /* strip PROMPT & CANCEL bits for now */ fprintf(stderr,"Openfile(%s,<struct>,%d) ",lpFileName,wStyle);
flags &= 0x7FFF; /* strip REOPEN bit for now */ #endif
flags &= 0xFBFF; /* strib VERIFY bit for now */
if (flags & OF_CREATE) action = wStyle & 0xff00;
{
base |= O_CREAT;
flags &= 0xEFFF; /* OF_CREATE is completly different from all other options, so
} handle it first */
#ifdef DEBUG_FILE if (action & OF_CREATE)
fprintf(stderr,"now %d,%d\n",base,flags); {
#endif int handle;
char *unixfilename;
if (flags & OF_EXIST) if (!(action & OF_REOPEN))
{ strcpy(ofs->szPathName, lpFileName);
printf("OpenFile // OF_EXIST '%s' !\n", lpFileName); ofs->cBytes = sizeof(OFSTRUCT);
handle = _lopen (lpFileName, wStyle); ofs->fFixedDisk = FALSE;
if (handle == -1) { ofs->nErrCode = 0;
/* Try again with WindowsPath */ *((int*)ofs->reserved) = 0;
if (FindFile(buf, sizeof(buf), lpFileName, NULL, WindowsPath) != NULL) {
handle = _lopen (buf, wStyle);
}
}
close(handle);
return handle;
}
if (flags & OF_DELETE)
{
printf("OpenFile // OF_DELETE '%s' !\n", lpFileName);
return unlink(lpFileName);
}
else
{
int handle;
char *UnixFileName;
if ((UnixFileName = GetUnixFileName(lpFileName)) == NULL)
return HFILE_ERROR;
handle = open(UnixFileName, base, 0666);
if (handle == -1) {
/* Try again with WindowsPath */
if (FindFile(buf, sizeof(buf), lpFileName, NULL, WindowsPath) != NULL) {
#ifdef DEBUG_FILE
printf("OpenFile // file '%s' found !\n", buf);
#endif
UnixFileName = buf;
handle = open(UnixFileName, base, 0666);
}
}
#ifdef DEBUG_FILE if ((unixfilename = GetUnixFileName (ofs->szPathName)) == NULL)
fprintf(stderr, "OpenFile: returning %04.4x\n", handle); {
#endif errno_to_doserr();
ofs->nErrCode = ExtendedError;
return -1;
}
handle = open (ofs->szPathName, (wStyle & 0x0003) | O_CREAT, 0x666);
if (handle == -1)
{
errno_to_doserr();
ofs->nErrCode = ExtendedError;
}
return handle;
}
if (handle == -1)
return HFILE_ERROR; /* If path isn't given, try to find the file. */
if (!(action & OF_REOPEN))
{
if( !( index(lpFileName,'\\') || index(lpFileName,'/') ||
index(lpFileName,':')))
while(1)
{
char temp[MAX_PATH+1];
strcpy (filename, lpFileName);
if ( (!stat(GetUnixFileName(filename), &s)) && (S_ISREG(s.st_mode)) )
break;
GetWindowsDirectory (filename,MAX_PATH);
if (filename[1] != ':')
strcat(filename,'\\');
strcat (filename, lpFileName);
if ( (!stat(GetUnixFileName(filename), &s)) && (S_ISREG(s.st_mode)) )
break;
GetSystemDirectory (filename,MAX_PATH);
if (filename[1] != ':')
strcat(filename,'\\');
strcat (filename, lpFileName);
if ( (!stat(GetUnixFileName(filename), &s)) && (S_ISREG(s.st_mode)) )
break;
if (!FindFile(temp,MAX_PATH,lpFileName,NULL,WindowsPath))
{
strcpy(filename, GetDosFileName(temp));
break;
}
strcpy (filename, lpFileName);
break;
}
else else
return handle; strcpy (filename,lpFileName);
ofs->cBytes = sizeof(OFSTRUCT);
ofs->fFixedDisk = FALSE;
strcpy(ofs->szPathName, filename);
ofs->nErrCode = 0;
if (!(action & OF_VERIFY))
*((int*)ofs->reserved) = 0;
} }
if (action & OF_PARSE)
return 0;
if (action & OF_DELETE)
return unlink(ofs->szPathName);
/* Now on to getting some information about that file */
if (res = stat(GetUnixFileName(ofs->szPathName), &s))
{
errno_to_doserr();
ofs->nErrCode = ExtendedError;
return -1;
}
now = localtime (&s.st_mtime);
if (action & OF_VERIFY)
verify_time = *((int*)ofs->reserved);
*((WORD*)(&ofs->reserved[2]))=
((now->tm_hour * 0x2000) + (now->tm_min * 0x20) + (now->tm_sec / 2));
*((WORD*)(&ofs->reserved[0]))=
((now->tm_year * 0x200) + (now->tm_mon * 0x20) + now->tm_mday);
if (action & OF_EXIST)
return 0;
if (action & OF_VERIFY)
return (verify_time != *((int*)ofs->reserved));
/* Now we are actually going to open the file. According to Microsoft's
Knowledge Basis, this is done by calling int 21h, ax=3dh. */
EAX = 0x00003d00;
EAX = (EAX & 0xffffff0f) | (wStyle & 0x0070); /* Handle OF_SHARE_xxx etc. */
EAX = (EAX & 0xfffffff0) | (wStyle & 0x0003); /* Handle OF_READ etc. */
DS = segment (ofs->szPathName);
EDX = (EDX & 0xffff0000) | offset (ofs->szPathName);
OpenExistingFile (context);
if (EFL & 0x00000001) /* Cflag */
{
ofs->nErrCode = (AX & 0x00ff);
return -1;
}
return AX;
} }
/************************************************************************** /**************************************************************************

View File

@ -12,8 +12,10 @@ static char Copyright[] = "Copyright Yngvi Sigurjonsson (yngvi@hafro.is), 1993"
#include "regfunc.h" #include "regfunc.h"
#include "windows.h" #include "windows.h"
#define ToUpper(c) toupper(c)
#define ToLower(c) tolower(c)
/* Funny to divide them between user and kernel. */ /* Funny to divide them between user and kernel. */
/* KERNEL.89 */ /* KERNEL.89 */
LPSTR lstrcat(LPSTR target,LPCSTR source) LPSTR lstrcat(LPSTR target,LPCSTR source)
@ -58,44 +60,50 @@ INT lstrlen(LPCSTR str)
return strlen(str); return strlen(str);
} }
/* IsCharAlpha USER 433 */
/* AnsiUpper USER.431 */ BOOL IsCharAlpha(char ch)
char FAR* AnsiUpper(char FAR* strOrChar)
{ {
/* I am not sure if the locale stuff works with toupper, but then again return isalpha(ch); /* This is probably not right for NLS */
I am not sure if the Linux libc locale stuffs works at all */
/* if((int)strOrChar<256)
return (char FAR*) toupper((int)strOrChar);
else {
int i;
for(i=0;(i<65536) && strOrChar[i];i++)
strOrChar[i]=toupper(strOrChar[i]);
return strOrChar;
} */
int i;
for (i = 0; (i < 65536 && strOrChar[i]);i++)
strOrChar[i] = (strOrChar[i] >= 'a' && strOrChar[i] <= 'z') ?
strOrChar[i] - ('a' - 'A') : strOrChar[i];
return strOrChar;
} }
/* AnsiLower USER.432 */ /* IsCharAlphanumeric USER 434 */
char FAR* AnsiLower(char FAR* strOrChar) BOOL IsCharAlphanumeric(char ch)
{ {
/* I am not sure if the locale stuff works with tolower, but then again return (ch<'0')?0:(ch<'9');
}
/* IsCharUpper USER 435 */
BOOL IsCharUpper(char ch)
{
return isupper(ch);
}
/* IsCharLower USER 436 */
BOOL IsCharLower(char ch)
{
return islower(ch);
}
/* AnsiUpper USER.431 */
LPSTR AnsiUpper(LPSTR strOrChar)
{
char *s = strOrChar;
/* I am not sure if the locale stuff works with toupper, but then again
I am not sure if the Linux libc locale stuffs works at all */ I am not sure if the Linux libc locale stuffs works at all */
/* if((int)strOrChar<256)
return (char FAR*)tolower((int)strOrChar); /* uppercase only one char if strOrChar < 0x10000 */
else { if(HIWORD((DWORD)strOrChar)) {
int i; while (*s) {
for(i=0;(i<65536)&&strOrChar[i];i++) if (IsCharLower(*s))
strOrChar[i]=tolower(strOrChar[i]); *s = ToUpper(*s);
return strOrChar; s++;
}*/ }
int i; return strOrChar;
for (i = 0; (i < 65536 && strOrChar[i]);i++) } else
strOrChar[i] = (strOrChar[i] >= 'A' && strOrChar[i] <= 'Z') ? if (IsCharLower((char) strOrChar))
strOrChar[i] + ('a' - 'A') : strOrChar[i]; return (LPSTR) ToUpper(strOrChar);
else
return (LPSTR) strOrChar;
} }
/* AnsiUpperBuff USER.437 */ /* AnsiUpperBuff USER.437 */
@ -109,6 +117,28 @@ UINT AnsiUpperBuff(LPSTR str,UINT len)
return i; return i;
} }
/* AnsiLower USER.432 */
LPSTR AnsiLower(LPSTR strOrChar)
{
char *s = strOrChar;
/* I am not sure if the locale stuff works with toupper, but then again
I am not sure if the Linux libc locale stuffs works at all */
/* lowercase only one char if strOrChar < 0x10000 */
if(HIWORD((DWORD)strOrChar)) {
while (*s) {
if (IsCharUpper(*s))
*s = ToLower(*s);
s++;
}
return strOrChar;
} else
if (IsCharUpper((char) strOrChar))
return (LPSTR) ToLower(strOrChar);
else
return (LPSTR) strOrChar;
}
/* AnsiLowerBuff USER.438 */ /* AnsiLowerBuff USER.438 */
UINT AnsiLowerBuff(LPSTR str,UINT len) UINT AnsiLowerBuff(LPSTR str,UINT len)
{ {
@ -134,29 +164,6 @@ char FAR* AnsiPrev(/*const*/ char FAR* start,char FAR* current)
return (current==start)?start:current-1; return (current==start)?start:current-1;
} }
/* IsCharAlpha USER 433 */
BOOL IsCharAlpha(char ch)
{
return isalpha(ch); /* This is probably not right for NLS */
}
/* IsCharAlphanumeric USER 434 */
BOOL IsCharAlphanumeric(char ch)
{
return (ch<'0')?0:(ch<'9');
}
/* IsCharUpper USER 435 */
BOOL IsCharUpper(char ch)
{
return isupper(ch);
}
/* IsCharUpper USER 436 */
BOOL IsCharLower(char ch)
{
return islower(ch);
}
static char Oem2Ansi[256]; static char Oem2Ansi[256];
static char Ansi2Oem[256]; static char Ansi2Oem[256];

View File

@ -153,7 +153,8 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
"WM_TIMER", /* 0x0113 */ "WM_TIMER", /* 0x0113 */
"WM_HSCROLL", /* 0x0114 */ "WM_HSCROLL", /* 0x0114 */
"WM_VSCROLL", /* 0x0115 */ "WM_VSCROLL", /* 0x0115 */
NULL, NULL, "WM_INITMENU", /* 0x0116 */
"WM_INITMENUPOPUP", /* 0x0117 */
"WM_SYSTIMER", /* 0x0118 */ "WM_SYSTIMER", /* 0x0118 */
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

View File

@ -17,6 +17,7 @@ MDESC *USER_Heap = NULL;
extern BOOL ATOM_Init(); extern BOOL ATOM_Init();
extern BOOL GDI_Init(); extern BOOL GDI_Init();
extern void SYSMETRICS_Init(); extern void SYSMETRICS_Init();
extern BOOL MENU_Init();
extern BOOL WIN_CreateDesktopWindow(); extern BOOL WIN_CreateDesktopWindow();
#ifndef WINELIB #ifndef WINELIB
@ -69,6 +70,9 @@ USER_InitApp(int hInstance)
/* Initialize dialog manager */ /* Initialize dialog manager */
if (!DIALOG_Init()) return 0; if (!DIALOG_Init()) return 0;
/* Initialize menus */
if (!MENU_Init()) return 0;
/* Create system message queue */ /* Create system message queue */
queueSize = GetProfileInt( "windows", "TypeAhead", 120 ); queueSize = GetProfileInt( "windows", "TypeAhead", 120 );
if (!MSG_CreateSysMsgQueue( queueSize )) return 0; if (!MSG_CreateSysMsgQueue( queueSize )) return 0;

View File

@ -136,8 +136,47 @@ static WORD errno_to_wsaerrno(void)
{ {
wsa_errno = wsaerrno(); wsa_errno = wsaerrno();
} }
SOCKET Winsock_accept(SOCKET s, struct sockaddr FAR *addr, INT FAR *addrlen) static void convert_sockopt(INT *level, INT *optname)
{
/* $%#%!@! why couldn't they use the same values for both winsock and unix ? */
switch (*level) {
case -1:
*level = SOL_SOCKET;
switch (*optname) {
case 0x01: *optname = SO_DEBUG;
break;
case 0x04: *optname = SO_REUSEADDR;
break;
case 0x08: *optname = SO_KEEPALIVE;
break;
case 0x10: *optname = SO_DONTROUTE;
break;
case 0x20: *optname = SO_BROADCAST;
break;
case 0x80: *optname = SO_LINGER;
break;
case 0x100: *optname = SO_OOBINLINE;
break;
case 0x1001: *optname = SO_SNDBUF;
break;
case 0x1002: *optname = SO_RCVBUF;
break;
case 0x1007: *optname = SO_ERROR;
break;
case 0x1008: *optname = SO_TYPE;
break;
default:
fprintf(stderr, "convert_sockopt() unknown optname %d\n", optname);
break;
}
break;
case 6: *optname = IPPROTO_TCP;
}
}
SOCKET Winsock_accept(SOCKET s, struct sockaddr *addr, INT *addrlen)
{ {
int sock; int sock;
@ -152,7 +191,7 @@ SOCKET Winsock_accept(SOCKET s, struct sockaddr FAR *addr, INT FAR *addrlen)
return sock; return sock;
} }
INT Winsock_bind(SOCKET s, struct sockaddr FAR *name, INT namelen) INT Winsock_bind(SOCKET s, struct sockaddr *name, INT namelen)
{ {
#ifdef DEBUG_WINSOCK #ifdef DEBUG_WINSOCK
fprintf(stderr, "WSA_bind: socket %d, ptr %8x, length %d\n", s, (int) name, namelen); fprintf(stderr, "WSA_bind: socket %d, ptr %8x, length %d\n", s, (int) name, namelen);
@ -181,7 +220,7 @@ INT Winsock_closesocket(SOCKET s)
return 0; return 0;
} }
INT Winsock_connect(SOCKET s, struct sockaddr FAR *name, INT namelen) INT Winsock_connect(SOCKET s, struct sockaddr *name, INT namelen)
{ {
#ifdef DEBUG_WINSOCK #ifdef DEBUG_WINSOCK
fprintf(stderr, "WSA_connect: socket %d, ptr %8x, length %d\n", s, (int) name, namelen); fprintf(stderr, "WSA_connect: socket %d, ptr %8x, length %d\n", s, (int) name, namelen);
@ -195,7 +234,7 @@ INT Winsock_connect(SOCKET s, struct sockaddr FAR *name, INT namelen)
return 0; return 0;
} }
INT Winsock_getpeername(SOCKET s, struct sockaddr FAR *name, INT FAR *namelen) INT Winsock_getpeername(SOCKET s, struct sockaddr *name, INT *namelen)
{ {
#ifdef DEBUG_WINSOCK #ifdef DEBUG_WINSOCK
fprintf(stderr, "WSA_getpeername: socket: %d, ptr %8x, ptr %8x\n", s, (int) name, *namelen); fprintf(stderr, "WSA_getpeername: socket: %d, ptr %8x, ptr %8x\n", s, (int) name, *namelen);
@ -209,7 +248,7 @@ INT Winsock_getpeername(SOCKET s, struct sockaddr FAR *name, INT FAR *namelen)
return 0; return 0;
} }
INT Winsock_getsockname(SOCKET s, struct sockaddr FAR *name, INT FAR *namelen) INT Winsock_getsockname(SOCKET s, struct sockaddr *name, INT *namelen)
{ {
#ifdef DEBUG_WINSOCK #ifdef DEBUG_WINSOCK
fprintf(stderr, "WSA_getsockname: socket: %d, ptr %8x, ptr %8x\n", s, (int) name, (int) *namelen); fprintf(stderr, "WSA_getsockname: socket: %d, ptr %8x, ptr %8x\n", s, (int) name, (int) *namelen);
@ -221,12 +260,15 @@ INT Winsock_getsockname(SOCKET s, struct sockaddr FAR *name, INT FAR *namelen)
return 0; return 0;
} }
INT Winsock_getsockopt(SOCKET s, INT loptname, char FAR *optval, INT FAR *optlen) INT
Winsock_getsockopt(SOCKET s, INT level, INT optname, char *optval, INT *optlen)
{ {
#ifdef DEBUG_WINSOCK #ifdef DEBUG_WINSOCK
fprintf(stderr, "WSA_getsockopt: socket: %d, opt %d, ptr %8x, ptr %8x\n", s, loptname, (int) optval, (int) *optlen); fprintf(stderr, "WSA_getsockopt: socket: %d, opt %d, ptr %8x, ptr %8x\n", s, level, (int) optval, (int) *optlen);
#endif #endif
if (getsockopt(s, 0, (int) loptname, optval, (int *) optlen) < 0) { convert_sockopt(&level, &optname);
if (getsockopt(s, (int) level, optname, optval, (int *) optlen) < 0) {
errno_to_wsaerrno(); errno_to_wsaerrno();
return SOCKET_ERROR; return SOCKET_ERROR;
} }
@ -243,7 +285,7 @@ u_short Winsock_htons(u_short hostshort)
return( htons(hostshort) ); return( htons(hostshort) );
} }
u_long Winsock_inet_addr(char FAR *cp) u_long Winsock_inet_addr(char *cp)
{ {
return( inet_addr(cp) ); return( inet_addr(cp) );
} }
@ -266,7 +308,7 @@ char *Winsock_inet_ntoa(struct in_addr in)
return (char *) &heap->ntoa_buffer; return (char *) &heap->ntoa_buffer;
} }
INT Winsock_ioctlsocket(SOCKET s, long cmd, u_long FAR *argp) INT Winsock_ioctlsocket(SOCKET s, long cmd, u_long *argp)
{ {
#ifdef DEBUG_WINSOCK #ifdef DEBUG_WINSOCK
fprintf(stderr, "WSA_ioctl: socket %d, cmd %d, ptr %8x\n", s, cmd, (int) argp); fprintf(stderr, "WSA_ioctl: socket %d, cmd %d, ptr %8x\n", s, cmd, (int) argp);
@ -302,7 +344,7 @@ u_short Winsock_ntohs(u_short netshort)
return( ntohs(netshort) ); return( ntohs(netshort) );
} }
INT Winsock_recv(SOCKET s, char FAR *buf, INT len, INT flags) INT Winsock_recv(SOCKET s, char *buf, INT len, INT flags)
{ {
int length; int length;
@ -317,8 +359,8 @@ INT Winsock_recv(SOCKET s, char FAR *buf, INT len, INT flags)
return length; return length;
} }
INT Winsock_recvfrom(SOCKET s, char FAR *buf, INT len, INT flags, INT Winsock_recvfrom(SOCKET s, char *buf, INT len, INT flags,
struct sockaddr FAR *from, int FAR *fromlen) struct sockaddr *from, int *fromlen)
{ {
int length; int length;
@ -333,8 +375,8 @@ INT Winsock_recvfrom(SOCKET s, char FAR *buf, INT len, INT flags,
return length; return length;
} }
INT Winsock_select(INT nfds, fd_set FAR *readfds, fd_set FAR *writefds, INT Winsock_select(INT nfds, fd_set *readfds, fd_set *writefds,
fd_set FAR *exceptfds, struct timeval FAR *timeout) fd_set *exceptfds, struct timeval *timeout)
{ {
#ifdef DEBUG_WINSOCK #ifdef DEBUG_WINSOCK
fprintf(stderr, "WSA_select: fd # %d, ptr %8x, ptr %8x, ptr %*X\n", nfds, readfds, writefds, exceptfds); fprintf(stderr, "WSA_select: fd # %d, ptr %8x, ptr %8x, ptr %*X\n", nfds, readfds, writefds, exceptfds);
@ -343,7 +385,7 @@ INT Winsock_select(INT nfds, fd_set FAR *readfds, fd_set FAR *writefds,
return(select(nfds, readfds, writefds, exceptfds, timeout)); return(select(nfds, readfds, writefds, exceptfds, timeout));
} }
INT Winsock_send(SOCKET s, char FAR *buf, INT len, INT flags) INT Winsock_send(SOCKET s, char *buf, INT len, INT flags)
{ {
int length; int length;
@ -358,8 +400,8 @@ INT Winsock_send(SOCKET s, char FAR *buf, INT len, INT flags)
return length; return length;
} }
INT Winsock_sendto(SOCKET s, char FAR *buf, INT len, INT flags, INT Winsock_sendto(SOCKET s, char *buf, INT len, INT flags,
struct sockaddr FAR *to, INT tolen) struct sockaddr *to, INT tolen)
{ {
int length; int length;
@ -374,13 +416,14 @@ INT Winsock_sendto(SOCKET s, char FAR *buf, INT len, INT flags,
return length; return length;
} }
INT Winsock_setsockopt(SOCKET s, INT level, INT optname, const char FAR *optval, INT Winsock_setsockopt(SOCKET s, INT level, INT optname, const char *optval,
INT optlen) INT optlen)
{ {
#ifdef DEBUG_WINSOCK #ifdef DEBUG_WINSOCK
fprintf(stderr, "WSA_setsockopt: socket %d, level %d, opt %d, ptr %8x, len %d\n", s, level, optname, (int) optval, optlen); fprintf(stderr, "WSA_setsockopt: socket %d, level %d, opt %d, ptr %8x, len %d\n", s, level, optname, (int) optval, optlen);
#endif #endif
convert_sockopt(&level, &optname);
if (setsockopt(s, level, optname, optval, optlen) < 0) { if (setsockopt(s, level, optname, optval, optlen) < 0) {
errno_to_wsaerrno(); errno_to_wsaerrno();
return SOCKET_ERROR; return SOCKET_ERROR;
@ -430,7 +473,7 @@ SOCKET Winsock_socket(INT af, INT type, INT protocol)
return sock; return sock;
} }
struct hostent *Winsock_gethostbyaddr(const char FAR *addr, INT len, INT type) struct hostent *Winsock_gethostbyaddr(const char *addr, INT len, INT type)
{ {
struct hostent *host; struct hostent *host;
@ -447,7 +490,7 @@ struct hostent *Winsock_gethostbyaddr(const char FAR *addr, INT len, INT type)
return (struct hostent *) &heap->hostent_addr; return (struct hostent *) &heap->hostent_addr;
} }
struct hostent *Winsock_gethostbyname(const char FAR *name) struct hostent *Winsock_gethostbyname(const char *name)
{ {
struct hostent *host; struct hostent *host;
@ -464,7 +507,7 @@ struct hostent *Winsock_gethostbyname(const char FAR *name)
return (struct hostent *) &heap->hostent_name; return (struct hostent *) &heap->hostent_name;
} }
int Winsock_gethostname(char FAR *name, INT namelen) int Winsock_gethostname(char *name, INT namelen)
{ {
#ifdef DEBUG_WINSOCK #ifdef DEBUG_WINSOCK
@ -478,7 +521,7 @@ int Winsock_gethostname(char FAR *name, INT namelen)
return 0; return 0;
} }
struct protoent *Winsock_getprotobyname(char FAR *name) struct protoent *Winsock_getprotobyname(char *name)
{ {
struct protoent *proto; struct protoent *proto;
@ -512,7 +555,7 @@ struct protoent *Winsock_getprotobynumber(INT number)
return (struct protoent *) &heap->protoent_number; return (struct protoent *) &heap->protoent_number;
} }
struct servent *Winsock_getservbyname(const char FAR *name, const char FAR *proto) struct servent *Winsock_getservbyname(const char *name, const char *proto)
{ {
struct servent *service; struct servent *service;
@ -529,7 +572,7 @@ struct servent *Winsock_getservbyname(const char FAR *name, const char FAR *prot
return (struct servent *) &heap->servent_name; return (struct servent *) &heap->servent_name;
} }
struct servent *Winsock_getservbyport(INT port, const char FAR *proto) struct servent *Winsock_getservbyport(INT port, const char *proto)
{ {
struct servent *service; struct servent *service;
@ -597,8 +640,8 @@ static void send_message(HANDLE handle, HWND hWnd, u_int wMsg, long lParam)
} }
HANDLE WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, const char FAR *addr, HANDLE WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, const char *addr,
INT len, INT type, char FAR *buf, INT buflen) INT len, INT type, char *buf, INT buflen)
{ {
HANDLE handle; HANDLE handle;
struct hostent *host; struct hostent *host;
@ -619,8 +662,8 @@ HANDLE WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, const char FAR *addr,
} }
HANDLE WSAAsyncGetHostByName(HWND hWnd, u_int wMsg, const char FAR *name, HANDLE WSAAsyncGetHostByName(HWND hWnd, u_int wMsg, const char *name,
char FAR *buf, INT buflen) char *buf, INT buflen)
{ {
HANDLE handle; HANDLE handle;
struct hostent *host; struct hostent *host;
@ -641,8 +684,8 @@ HANDLE WSAAsyncGetHostByName(HWND hWnd, u_int wMsg, const char FAR *name,
} }
HANDLE WSAAsyncGetProtoByName(HWND hWnd, u_int wMsg, const char FAR *name, HANDLE WSAAsyncGetProtoByName(HWND hWnd, u_int wMsg, const char *name,
char FAR *buf, INT buflen) char *buf, INT buflen)
{ {
HANDLE handle; HANDLE handle;
struct protoent *proto; struct protoent *proto;
@ -664,7 +707,7 @@ HANDLE WSAAsyncGetProtoByName(HWND hWnd, u_int wMsg, const char FAR *name,
HANDLE WSAAsyncGetProtoByNumber(HWND hWnd, u_int wMsg, INT number, HANDLE WSAAsyncGetProtoByNumber(HWND hWnd, u_int wMsg, INT number,
char FAR *buf, INT buflen) char *buf, INT buflen)
{ {
HANDLE handle; HANDLE handle;
struct protoent *proto; struct protoent *proto;
@ -685,8 +728,8 @@ HANDLE WSAAsyncGetProtoByNumber(HWND hWnd, u_int wMsg, INT number,
} }
HANDLE WSAAsyncGetServByName(HWND hWnd, u_int wMsg, const char FAR *name, HANDLE WSAAsyncGetServByName(HWND hWnd, u_int wMsg, const char *name,
const char FAR *proto, char FAR *buf, INT buflen) const char *proto, char *buf, INT buflen)
{ {
HANDLE handle; HANDLE handle;
struct servent *service; struct servent *service;
@ -707,8 +750,8 @@ HANDLE WSAAsyncGetServByName(HWND hWnd, u_int wMsg, const char FAR *name,
} }
HANDLE WSAAsyncGetServByPort(HWND hWnd, u_int wMsg, INT port, const char FAR HANDLE WSAAsyncGetServByPort(HWND hWnd, u_int wMsg, INT port, const char
*proto, char FAR *buf, INT buflen) *proto, char *buf, INT buflen)
{ {
HANDLE handle; HANDLE handle;
struct servent *service; struct servent *service;

View File

@ -28,19 +28,19 @@ WIN87_fpmath()
} }
int void
WIN87_WinEm87Info(struct Win87EmInfoStruct *pWIS, int cbWin87EmInfoStruct) WIN87_WinEm87Info(struct Win87EmInfoStruct *pWIS, int cbWin87EmInfoStruct)
{ {
printf( "__WinEm87Info(%p,%d)\n",pWIS,cbWin87EmInfoStruct); printf( "__WinEm87Info(%p,%d)\n",pWIS,cbWin87EmInfoStruct);
} }
int void
WIN87_WinEm87Restore(void *pWin87EmSaveArea, int cbWin87EmSaveArea) WIN87_WinEm87Restore(void *pWin87EmSaveArea, int cbWin87EmSaveArea)
{ {
printf( "__WinEm87Restore(%p,%d)\n",pWin87EmSaveArea,cbWin87EmSaveArea); printf( "__WinEm87Restore(%p,%d)\n",pWin87EmSaveArea,cbWin87EmSaveArea);
} }
int void
WIN87_WinEm87Save(void *pWin87EmSaveArea, int cbWin87EmSaveArea) WIN87_WinEm87Save(void *pWin87EmSaveArea, int cbWin87EmSaveArea)
{ {
printf( "__WinEm87Save(%p,%d)\n",pWin87EmSaveArea,cbWin87EmSaveArea); printf( "__WinEm87Save(%p,%d)\n",pWin87EmSaveArea,cbWin87EmSaveArea);

View File

@ -1,6 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "msdos.h" #include "registers.h"
#include "wine.h" #include "wine.h"
void IntBarf(int i, struct sigcontext_struct *context) void IntBarf(int i, struct sigcontext_struct *context)
@ -13,23 +13,22 @@ void IntBarf(int i, struct sigcontext_struct *context)
int do_int10(struct sigcontext_struct *context) int do_int10(struct sigcontext_struct *context)
{ {
switch((context->sc_eax >> 8) & 0xff) switch(AH) {
{
case 0x0f: case 0x0f:
EAX = (EAX & 0xffffff00) | 0x5b; AL = 0x5b;
break; break;
case 0x12: case 0x12:
if ((EBX & 0xff) == 0x10) { if (BL == 0x10) {
EBX = (EBX & 0xffff0000) | 0x0003; BX = 0x0003;
ECX = (ECX & 0xffff0000) | 0x0009; CX = 0x0009;
} }
break; break;
case 0x1a: case 0x1a:
EBX = (EBX & 0xffff0000) | 0x0008; BX = 0x0008;
break; break;
default: default:
IntBarf(0x10, context); IntBarf(0x10, context);
}; };

View File

@ -1,29 +1,28 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "msdos.h" #include "registers.h"
#include "wine.h" #include "wine.h"
int do_int13(struct sigcontext_struct *context) int do_int13(struct sigcontext_struct *context)
{ {
switch((context->sc_eax >> 8) & 0xff) switch(AH) {
{
case 0x00: /* RESET DISK SYSTEM */ case 0x00: /* RESET DISK SYSTEM */
case 0x04: /* VERIFY DISK SECTOR(S) */ case 0x04: /* VERIFY DISK SECTOR(S) */
EAX = (EAX & 0xffff00ff); AH = 0;
break; break;
case 0x05: /* FORMAT TRACK */ case 0x05: /* FORMAT TRACK */
EAX = (EAX & 0xffff00ff) | 0x0c; AH = 0x0c;
SetCflag; SetCflag;
break; break;
case 0x06: /* FORMAT TRACK AND SET BAD SECTOR FLAGS */ case 0x06: /* FORMAT TRACK AND SET BAD SECTOR FLAGS */
case 0x07: /* FORMAT DRIVE STARTING AT GIVEN TRACK */ case 0x07: /* FORMAT DRIVE STARTING AT GIVEN TRACK */
EAX = (EAX & 0xffff00ff) | 0x0c; AH = 0x0c;
break; break;
case 0x08: /* GET DRIVE PARAMETERS */ case 0x08: /* GET DRIVE PARAMETERS */
EAX = (EAX & 0xffff00ff) | ((EDX & 0x00000080)? 0x07: 0x01); AH = (DL & 0x80) ? 0x07 : 0x01;
SetCflag; SetCflag;
break; break;
@ -33,20 +32,17 @@ int do_int13(struct sigcontext_struct *context)
case 0x10: /* CHECK IF DRIVE READY */ case 0x10: /* CHECK IF DRIVE READY */
case 0x11: /* RECALIBRATE DRIVE */ case 0x11: /* RECALIBRATE DRIVE */
case 0x14: /* CONTROLLER INTERNAL DIAGNOSTIC */ case 0x14: /* CONTROLLER INTERNAL DIAGNOSTIC */
EAX = (EAX & 0xffff00ff); AH = 0;
break; break;
case 0x0e: /* READ SECTOR BUFFER (XT only) */ case 0x0e: /* READ SECTOR BUFFER (XT only) */
case 0x0f: /* WRITE SECTOR BUFFER (XT only) */ case 0x0f: /* WRITE SECTOR BUFFER (XT only) */
case 0x12: /* CONTROLLER RAM DIAGNOSTIC (XT,PS) */ case 0x12: /* CONTROLLER RAM DIAGNOSTIC (XT,PS) */
case 0x13: /* DRIVE DIAGNOSTIC (XT,PS) */ case 0x13: /* DRIVE DIAGNOSTIC (XT,PS) */
EAX = (EAX & 0xffff00ff) | 0x01; AH = 0x01;
SetCflag; SetCflag;
break; break;
default: default:
IntBarf(0x13, context); IntBarf(0x13, context);
}; };

View File

@ -1,12 +1,11 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "msdos.h" #include "registers.h"
#include "wine.h" #include "wine.h"
int do_int15(struct sigcontext_struct *context) int do_int15(struct sigcontext_struct *context)
{ {
switch((context->sc_eax >> 8) & 0xff) switch(AH) {
{
case 0xc0: case 0xc0:
default: default:

View File

@ -1,12 +1,11 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "msdos.h" #include "registers.h"
#include "wine.h" #include "wine.h"
int do_int16(struct sigcontext_struct *context) int do_int16(struct sigcontext_struct *context)
{ {
switch((context->sc_eax >> 8) & 0xff) switch(AH) {
{
case 0xc0: case 0xc0:
default: default:

View File

@ -1,7 +1,7 @@
#include <time.h> #include <time.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "msdos.h" #include "registers.h"
#include "wine.h" #include "wine.h"
#include "options.h" #include "options.h"
@ -23,13 +23,13 @@ int do_int1A(struct sigcontext_struct * context){
AX, BX, CX, DX, SI, DI, DS, ES); AX, BX, CX, DX, SI, DI, DS, ES);
} }
switch((context->sc_eax >> 8) & 0xff){ switch(AH) {
case 0: case 0:
ltime = time(NULL); ltime = time(NULL);
ticks = (int) (ltime * HZ); ticks = (int) (ltime * HZ);
context->sc_ecx = ticks >> 16; CX = ticks >> 16;
context->sc_edx = ticks & 0x0000FFFF; DX = ticks & 0x0000FFFF;
context->sc_eax = 0; /* No midnight rollover */ AX = 0; /* No midnight rollover */
printf("int1a_00 // ltime=%ld ticks=%ld\n", ltime, ticks); printf("int1a_00 // ltime=%ld ticks=%ld\n", ltime, ticks);
break; break;
@ -37,14 +37,14 @@ int do_int1A(struct sigcontext_struct * context){
ltime = time(NULL); ltime = time(NULL);
bdtime = localtime(&ltime); bdtime = localtime(&ltime);
context->sc_ecx = (BIN_TO_BCD(bdtime->tm_hour)<<8) | BIN_TO_BCD(bdtime->tm_min); CX = (BIN_TO_BCD(bdtime->tm_hour)<<8) | BIN_TO_BCD(bdtime->tm_min);
context->sc_edx = (BIN_TO_BCD(bdtime->tm_sec)<<8); DX = (BIN_TO_BCD(bdtime->tm_sec)<<8);
case 4: case 4:
ltime = time(NULL); ltime = time(NULL);
bdtime = localtime(&ltime); bdtime = localtime(&ltime);
context->sc_ecx = (BIN_TO_BCD(bdtime->tm_year/100)<<8) | BIN_TO_BCD((bdtime->tm_year-1900)%100); CX = (BIN_TO_BCD(bdtime->tm_year/100)<<8) | BIN_TO_BCD((bdtime->tm_year-1900)%100);
context->sc_edx = (BIN_TO_BCD(bdtime->tm_mon)<<8) | BIN_TO_BCD(bdtime->tm_mday); DX = (BIN_TO_BCD(bdtime->tm_mon)<<8) | BIN_TO_BCD(bdtime->tm_mday);
break; break;
/* setting the time,date or RTC is not allow -EB */ /* setting the time,date or RTC is not allow -EB */

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "registers.h"
#include "msdos.h" #include "msdos.h"
#include "wine.h" #include "wine.h"
@ -8,15 +9,14 @@ int do_int25(struct sigcontext_struct *context)
BYTE *dataptr = pointer(DS, BX); BYTE *dataptr = pointer(DS, BX);
DWORD begin, length; DWORD begin, length;
if( (ECX & 0xffff) == 0xffff) if (CX == 0xffff) {
{
begin = getdword(dataptr); begin = getdword(dataptr);
length = getword(&dataptr[4]); length = getword(&dataptr[4]);
dataptr = (BYTE *) getdword(&dataptr[6]); dataptr = (BYTE *) getdword(&dataptr[6]);
} else { } else {
begin = EDX & 0xffff; begin = DX;
length = ECX & 0xffff; length = CX;
} }
fprintf(stderr, "int25: abs diskread, drive %d, sector %d, " fprintf(stderr, "int25: abs diskread, drive %d, sector %d, "
"count %d, buffer %d\n", EAX & 0xff, begin, length, (int) dataptr); "count %d, buffer %d\n", EAX & 0xff, begin, length, (int) dataptr);

View File

@ -1,5 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "registers.h"
#include "msdos.h" #include "msdos.h"
#include "wine.h" #include "wine.h"
@ -8,15 +9,14 @@ int do_int26(struct sigcontext_struct *context)
BYTE *dataptr = pointer(DS, BX); BYTE *dataptr = pointer(DS, BX);
DWORD begin, length; DWORD begin, length;
if( (ECX & 0xffff) == 0xffff) if (CX == 0xffff) {
{
begin = getdword(dataptr); begin = getdword(dataptr);
length = getword(&dataptr[4]); length = getword(&dataptr[4]);
dataptr = (BYTE *) getdword(&dataptr[6]); dataptr = (BYTE *) getdword(&dataptr[6]);
} else { } else {
begin = EDX & 0xffff; begin = DX;
length = ECX & 0xffff; length = CX;
} }
fprintf(stderr,"int26: abs diskwrite, drive %d, sector %d, count %d," fprintf(stderr,"int26: abs diskwrite, drive %d, sector %d, count %d,"

View File

@ -1,6 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "msdos.h" #include "registers.h"
#include "wine.h" #include "wine.h"
int do_int2f_16(struct sigcontext_struct *context); int do_int2f_16(struct sigcontext_struct *context);
@ -10,8 +10,8 @@ int do_int2f(struct sigcontext_struct *context)
{ {
switch((context->sc_eax >> 8) & 0xff) switch((context->sc_eax >> 8) & 0xff)
{ {
case 0x10: /* share isn't installed */ case 0x10: /* share is installed */
EAX = (EAX & 0xffffff00) | 0x01; EAX = (EAX & 0xffffff00) | 0xff;
break; break;
case 0x15: /* mscdex */ case 0x15: /* mscdex */

View File

@ -1,6 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "msdos.h" #include "registers.h"
#include "wine.h" #include "wine.h"
typedef struct { typedef struct {

View File

@ -1,7 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
#include "msdos.h" #include "registers.h"
#include "wine.h" #include "wine.h"
static BYTE cmosaddress; static BYTE cmosaddress;
@ -18,15 +18,14 @@ static BYTE cmosimage[64] = {
void inportb(struct sigcontext_struct *context) void inportb(struct sigcontext_struct *context)
{ {
fprintf(stderr, "IO: inb (%x)\n", EDX & 0xffff); fprintf(stderr, "IO: inb (%x)\n", DX);
switch(EDX & 0xffff) switch(DX) {
{
case 0x70: case 0x70:
EAX = (EAX & 0xffffff00L) | cmosaddress; AL = cmosaddress;
break; break;
case 0x71: case 0x71:
EAX = (EAX & 0xffffff00L) | cmosimage[cmosaddress & 0x3f]; AL = cmosimage[cmosaddress & 0x3f];
break; break;
default: default:
} }
@ -34,22 +33,22 @@ void inportb(struct sigcontext_struct *context)
void inport(struct sigcontext_struct *context) void inport(struct sigcontext_struct *context)
{ {
fprintf(stderr, "IO: in (%x)\n", EDX & 0xffff); fprintf(stderr, "IO: in (%x)\n", DX);
EAX = (EAX & 0xffff0000L) | 0xffff; AX = 0xffff;
} }
void outportb(struct sigcontext_struct *context) void outportb(struct sigcontext_struct *context)
{ {
fprintf(stderr, "IO: outb (%x), %x\n", EDX & 0xffff, EAX & 0xff); fprintf(stderr, "IO: outb (%x), %x\n", DX, AX);
switch (EDX & 0xffff) switch (EDX & 0xffff)
{ {
case 0x70: case 0x70:
cmosaddress = EAX & 0x7f; cmosaddress = AL & 0x7f;
break; break;
case 0x71: case 0x71:
cmosimage[cmosaddress & 0x3f] = EAX & 0xff; cmosimage[cmosaddress & 0x3f] = AL;
break; break;
default: default:
} }
@ -57,5 +56,5 @@ void outportb(struct sigcontext_struct *context)
void outport(struct sigcontext_struct *context) void outport(struct sigcontext_struct *context)
{ {
fprintf(stderr, "IO: out (%x), %x\n", EDX & 0xffff, EAX & 0xffff); fprintf(stderr, "IO: out (%x), %x\n", DX, AX);
} }

View File

@ -12,6 +12,9 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "gdi.h" #include "gdi.h"
#include "bitmap.h" #include "bitmap.h"
/* Include OEM bitmaps */
#include "bitmaps/check_mark"
#include "bitmaps/menu_arrow"
/* Handle of the bitmap selected by default in a memory DC */ /* Handle of the bitmap selected by default in a memory DC */
HBITMAP BITMAP_hbitmapMemDC = 0; HBITMAP BITMAP_hbitmapMemDC = 0;
@ -73,6 +76,59 @@ static XImage *BITMAP_BmpToImage( BITMAP * bmp, void * bmpData )
} }
/***********************************************************************
* BITMAP_LoadOEMBitmap
*/
HBITMAP BITMAP_LoadOEMBitmap( WORD id )
{
BITMAPOBJ * bmpObjPtr;
HBITMAP hbitmap;
WORD width, height;
char *data;
switch(id)
{
case OBM_MNARROW:
width = menu_arrow_width;
height = menu_arrow_height;
data = menu_arrow_bits;
break;
case OBM_CHECK:
width = check_mark_width;
height = check_mark_height;
data = check_mark_bits;
break;
default:
return 0;
}
/* Create the BITMAPOBJ */
if (!(hbitmap = GDI_AllocObject( sizeof(BITMAPOBJ), BITMAP_MAGIC )))
return 0;
bmpObjPtr = (BITMAPOBJ *) GDI_HEAP_ADDR( hbitmap );
bmpObjPtr->size.cx = 0;
bmpObjPtr->size.cy = 0;
bmpObjPtr->bitmap.bmType = 0;
bmpObjPtr->bitmap.bmWidth = width;
bmpObjPtr->bitmap.bmHeight = height;
bmpObjPtr->bitmap.bmWidthBytes = (width + 15) / 16 * 2;
bmpObjPtr->bitmap.bmPlanes = 1;
bmpObjPtr->bitmap.bmBitsPixel = 1;
bmpObjPtr->bitmap.bmBits = NULL;
/* Create the pixmap */
if (!(bmpObjPtr->pixmap = XCreateBitmapFromData( display, rootWindow,
data, width, height )))
{
GDI_HEAP_FREE( hbitmap );
return 0;
}
return hbitmap;
}
/*********************************************************************** /***********************************************************************
* CreateBitmap (GDI.48) * CreateBitmap (GDI.48)
*/ */

View File

@ -73,7 +73,7 @@ func_type func_name( HDC hdc ) \
{ \ { \
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \ DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
if (!dc) return 0; \ if (!dc) return 0; \
return dc->w.ret_x | (dc->w.ret_y << 16); \ return MAKELONG( dc->w.ret_x, dc->w.ret_y << 16 ); \
} }
#define DC_GET_VAL_EX( func_name, ret_x, ret_y ) \ #define DC_GET_VAL_EX( func_name, ret_x, ret_y ) \
@ -127,7 +127,6 @@ DC_SET_MODE( SetStretchBltMode, stretchBltMode,
DC_GET_VAL( COLORREF, GetBkColor, backgroundColor ) /* GDI.75 */ DC_GET_VAL( COLORREF, GetBkColor, backgroundColor ) /* GDI.75 */
DC_GET_VAL( WORD, GetBkMode, backgroundMode ) /* GDI.76 */ DC_GET_VAL( WORD, GetBkMode, backgroundMode ) /* GDI.76 */
DC_GET_X_Y( DWORD, GetCurrentPosition, CursPosX, CursPosY ) /* GDI.78 */ DC_GET_X_Y( DWORD, GetCurrentPosition, CursPosX, CursPosY ) /* GDI.78 */
DC_GET_X_Y( DWORD, GetDCOrg, DCOrgX, DCOrgY ) /* GDI.79 */
DC_GET_VAL( WORD, GetMapMode, MapMode ) /* GDI.81 */ DC_GET_VAL( WORD, GetMapMode, MapMode ) /* GDI.81 */
DC_GET_VAL( WORD, GetPolyFillMode, polyFillMode ) /* GDI.84 */ DC_GET_VAL( WORD, GetPolyFillMode, polyFillMode ) /* GDI.84 */
DC_GET_VAL( WORD, GetROP2, ROPmode ) /* GDI.85 */ DC_GET_VAL( WORD, GetROP2, ROPmode ) /* GDI.85 */

View File

@ -128,6 +128,71 @@ static void DIB_SetImageBits_4( WORD lines, BYTE *bits, WORD width,
} }
} }
#define check_xy(x,y) \
if (x > width) { \
x = 0; \
if (lines) \
lines--; \
}
/***********************************************************************
* DIB_SetImageBits_RLE4
*
* SetDIBits for a 4-bit deep compressed DIB.
*/
static void DIB_SetImageBits_RLE4( WORD lines, BYTE *bits, WORD width,
WORD *colors, XImage *bmpImage )
{
int x = 0, c, length;
BYTE *begin = bits;
lines--;
while (1) {
length = *bits++;
if (length) { /* encoded */
c = *bits++;
while (length--) {
XPutPixel(bmpImage, x++, lines, colors[c >> 4]);
check_xy(x, y);
if (length) {
length--;
XPutPixel(bmpImage, x++, lines, colors[c & 0xf]);
check_xy(x, y);
}
}
} else {
length = *bits++;
switch (length) {
case 0: /* eol */
x = 0;
lines--;
continue;
case 1: /* eopicture */
return;
case 2: /* delta */
x += *bits++;
lines -= *bits++;
continue;
default: /* absolute */
while (length--) {
c = *bits++;
XPutPixel(bmpImage, x++, lines, colors[c >> 4]);
check_xy(x, y);
if (length) {
length--;
XPutPixel(bmpImage, x++, lines, colors[c & 0xf]);
check_xy(x, y);
}
}
if ((bits - begin) & 1)
bits++;
}
}
}
}
/*********************************************************************** /***********************************************************************
* DIB_SetImageBits_8 * DIB_SetImageBits_8
@ -148,6 +213,62 @@ static void DIB_SetImageBits_8( WORD lines, BYTE *bits, WORD width,
} }
} }
/***********************************************************************
* DIB_SetImageBits_RLE8
*
* SetDIBits for an 8-bit deep compressed DIB.
*/
static void DIB_SetImageBits_RLE8( WORD lines, BYTE *bits, WORD width,
WORD *colors, XImage *bmpImage )
{
int x = 0, i, length;
BYTE *begin = bits;
lines--;
while (1) {
length = *bits++;
if (length) { /* encoded */
while (length--) {
XPutPixel(bmpImage, x++, lines, colors[*bits]);
if (x > width) {
x = 0;
if (lines)
lines--;
}
}
bits++;
} else {
length = *bits++;
switch (length) {
case 0: /* eol */
x = 0;
lines--;
continue;
case 1: /* eopicture */
return;
case 2: /* delta */
x += *bits++;
lines -= *bits++;
continue;
default: /* absolute */
for (i = length; i ; i--) {
XPutPixel(bmpImage, x++, lines,
colors[*bits++]);
if (x > width) {
x = 0;
if (lines)
lines--;
}
}
if ((bits - begin) & 1)
bits++;
}
}
}
}
/*********************************************************************** /***********************************************************************
* DIB_SetImageBits_24 * DIB_SetImageBits_24
@ -228,11 +349,19 @@ static int DIB_SetImageBits( DC *dc, WORD lines, WORD depth, LPSTR bits,
colorMapping, bmpImage ); colorMapping, bmpImage );
break; break;
case 4: case 4:
DIB_SetImageBits_4( lines, bits, info->bmiHeader.biWidth, if (info->bmiHeader.biCompression)
DIB_SetImageBits_RLE4( lines, bits, info->bmiHeader.biWidth,
colorMapping, bmpImage );
else
DIB_SetImageBits_4( lines, bits, info->bmiHeader.biWidth,
colorMapping, bmpImage ); colorMapping, bmpImage );
break; break;
case 8: case 8:
DIB_SetImageBits_8( lines, bits, info->bmiHeader.biWidth, if (info->bmiHeader.biCompression)
DIB_SetImageBits_RLE8( lines, bits, info->bmiHeader.biWidth,
colorMapping, bmpImage );
else
DIB_SetImageBits_8( lines, bits, info->bmiHeader.biWidth,
colorMapping, bmpImage ); colorMapping, bmpImage );
break; break;
case 24: case 24:

View File

@ -103,8 +103,8 @@ HMETAFILE CloseMetaFile(HDC hdc)
mf = (METAFILE *)GlobalLock(dc->w.hMetaFile); mf = (METAFILE *)GlobalLock(dc->w.hMetaFile);
mh = (METAHEADER *)GlobalLock(mf->hMetaHdr); mh = (METAHEADER *)GlobalLock(mf->hMetaHdr);
/* Construct the end of metafile record - this is undocumented /* Construct the end of metafile record - this is documented
* but is created by MS Windows 3.1. * in SDK Knowledgebase Q99334.
*/ */
if (!MF_MetaParam0(dc, META_EOF)) if (!MF_MetaParam0(dc, META_EOF))
{ {

View File

@ -451,4 +451,15 @@ BOOL ExtTextOut(HDC hDC, short x, short y, WORD wOptions, LPRECT lprect,
return FALSE; return FALSE;
} }
/***********************************************************************
* GetTabbedTextExtent [USER.197]
*/
DWORD GetTabbedTextExtent(HDC hDC, LPSTR lpString, int nCount,
int nTabPositions, LPINT lpnTabStopPositions)
{
printf("EMPTY STUB !!! GetTabbedTextExtent(); !\n");
return (18 << 16) | (nCount * 18);
}

View File

@ -531,6 +531,23 @@ COLORREF SetTextColor( HDC hdc, COLORREF color )
} }
/***********************************************************************
* GetDCOrg (GDI.79)
*/
DWORD GetDCOrg( HDC hdc )
{
Window root;
int x, y, w, h, border, depth;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return 0;
if (dc->w.flags & DC_MEMORY) return 0;
XGetGeometry( display, dc->u.x.drawable, &root,
&x, &y, &w, &h, &border, &depth );
return MAKELONG( dc->w.DCOrgX + (WORD)x, dc->w.DCOrgY + (WORD)y );
}
/*********************************************************************** /***********************************************************************
* SetDCOrg (GDI.117) * SetDCOrg (GDI.117)
*/ */

View File

@ -50,6 +50,14 @@ LONG DefDlgProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
case WM_NCDESTROY: case WM_NCDESTROY:
/* Free dialog heap (if created) */
if (dlgInfo->hDialogHeap)
{
GlobalUnlock(dlgInfo->hDialogHeap);
GlobalFree(dlgInfo->hDialogHeap);
dlgInfo->hDialogHeap = 0;
}
/* Delete font */ /* Delete font */
if (dlgInfo->hUserFont) if (dlgInfo->hUserFont)
{ {

View File

@ -26,9 +26,6 @@ extern LONG NC_HandleNCLButtonDblClk( HWND hwnd, WORD wParam, LONG lParam );
extern LONG NC_HandleSysCommand( HWND hwnd, WORD wParam, POINT pt ); extern LONG NC_HandleSysCommand( HWND hwnd, WORD wParam, POINT pt );
extern LONG NC_HandleSetCursor( HWND hwnd, WORD wParam, LONG lParam ); extern LONG NC_HandleSetCursor( HWND hwnd, WORD wParam, LONG lParam );
extern LONG WINPOS_HandleWindowPosChanging( WINDOWPOS *winpos ); /* winpos.c */ extern LONG WINPOS_HandleWindowPosChanging( WINDOWPOS *winpos ); /* winpos.c */
extern void NC_TrackSysMenu( HWND hwnd ); /* menu.c */
extern BOOL ActivateMenuBarFocus(HWND hWnd); /* menu.c */
/*********************************************************************** /***********************************************************************
@ -229,13 +226,12 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
return NC_HandleSysCommand( hwnd, wParam, MAKEPOINT(lParam) ); return NC_HandleSysCommand( hwnd, wParam, MAKEPOINT(lParam) );
case WM_SYSKEYDOWN: case WM_SYSKEYDOWN:
if (wParam == VK_MENU) ActivateMenuBarFocus(hwnd); if (wParam == VK_MENU)
break; SendMessage( hwnd, WM_SYSCOMMAND, SC_KEYMENU, 0L );
break;
case WM_SYSKEYUP: case WM_SYSKEYUP:
break; break;
case WM_MENUCHAR:
MessageBeep(0);
break;
case WM_MEASUREITEM: case WM_MEASUREITEM:
measure = (MEASUREITEMSTRUCT *)lParam; measure = (MEASUREITEMSTRUCT *)lParam;
switch(measure->CtlType) { switch(measure->CtlType) {

View File

@ -15,6 +15,8 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "dialog.h" #include "dialog.h"
#include "win.h" #include "win.h"
#include "user.h" #include "user.h"
#include "message.h"
#include "heap.h"
/* Dialog base units */ /* Dialog base units */
@ -208,6 +210,8 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, LPCSTR dlgTemplate,
DWORD exStyle = 0; DWORD exStyle = 0;
WORD xUnit = xBaseUnit; WORD xUnit = xBaseUnit;
WORD yUnit = yBaseUnit; WORD yUnit = yBaseUnit;
void *dlgHeapBase;
MDESC *dlgHeap;
/* Parse dialog template */ /* Parse dialog template */
@ -278,15 +282,16 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, LPCSTR dlgTemplate,
return 0; return 0;
} }
ShowWindow(hwnd, SW_SHOWNORMAL);
UpdateWindow(hwnd);
/* Create control windows */ /* Create control windows */
#ifdef DEBUG_DIALOG #ifdef DEBUG_DIALOG
printf( " BEGIN\n" ); printf( " BEGIN\n" );
#endif #endif
wndPtr = WIN_FindWndPtr( hwnd );
dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
dlgInfo->hDialogHeap = 0;
for (i = 0; i < template.header->nbItems; i++) for (i = 0; i < template.header->nbItems; i++)
{ {
DLGCONTROLHEADER * next_header; DLGCONTROLHEADER * next_header;
@ -303,16 +308,39 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, LPCSTR dlgTemplate,
printf(" %d, %d, %d, %d, %d, %08x\n", header->id, header->x, header->y, printf(" %d, %d, %d, %d, %d, %08x\n", header->id, header->x, header->y,
header->cx, header->cy, header->style ); header->cx, header->cy, header->style );
#endif #endif
if ((strcmp(class, "STATIC") == 0) & ((header->style & SS_ICON) == SS_ICON)) {
header->cx = 32; if ((strcmp(class, "EDIT") == 0) &&
header->cy = 32; ((header->style & DS_LOCALEDIT) != DS_LOCALEDIT)) {
if (!dlgInfo->hDialogHeap) {
dlgInfo->hDialogHeap = GlobalAlloc(GMEM_FIXED, 0x10000);
if (!dlgInfo->hDialogHeap) {
printf("CreateDialogIndirectParam: Insufficient memory ",
"to create heap for edit control\n");
continue;
}
dlgHeapBase = GlobalLock(dlgInfo->hDialogHeap);
HEAP_Init(&dlgHeap, dlgHeapBase, 0x10000);
} }
header->style |= WS_CHILD; header->style |= WS_CHILD;
CreateWindowEx( WS_EX_NOPARENTNOTIFY, CreateWindowEx( WS_EX_NOPARENTNOTIFY,
class, text, header->style, class, text, header->style,
header->x * xUnit / 4, header->y * yUnit / 8, header->x * xUnit / 4, header->y * yUnit / 8,
header->cx * xUnit / 4, header->cy * yUnit / 8, header->cx * xUnit / 4, header->cy * yUnit / 8,
hwnd, header->id, hInst, NULL ); hwnd, header->id, HIWORD((LONG)dlgHeapBase), NULL );
}
else {
if ((strcmp(class, "STATIC") == 0) &
((header->style & SS_ICON) == SS_ICON)) {
header->cx = 32;
header->cy = 32;
}
header->style |= WS_CHILD;
CreateWindowEx( WS_EX_NOPARENTNOTIFY,
class, text, header->style,
header->x * xUnit / 4, header->y * yUnit / 8,
header->cx * xUnit / 4, header->cy * yUnit / 8,
hwnd, header->id, hInst, NULL );
}
header = next_header; header = next_header;
} }
@ -322,8 +350,6 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, LPCSTR dlgTemplate,
/* Initialise dialog extra data */ /* Initialise dialog extra data */
wndPtr = WIN_FindWndPtr( hwnd );
dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
dlgInfo->dlgProc = dlgProc; dlgInfo->dlgProc = dlgProc;
dlgInfo->hUserFont = hFont; dlgInfo->hUserFont = hFont;
dlgInfo->hMenu = hMenu; dlgInfo->hMenu = hMenu;
@ -346,7 +372,7 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, LPCSTR dlgTemplate,
/*********************************************************************** /***********************************************************************
* DIALOG_DoDialogBox * DIALOG_DoDialogBox
*/ */
static int DIALOG_DoDialogBox( HWND hwnd ) static int DIALOG_DoDialogBox( HWND hwnd, HWND owner )
{ {
WND * wndPtr; WND * wndPtr;
DIALOGINFO * dlgInfo; DIALOGINFO * dlgInfo;
@ -360,7 +386,8 @@ static int DIALOG_DoDialogBox( HWND hwnd )
dlgInfo = (DIALOGINFO *)wndPtr->wExtra; dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
ShowWindow( hwnd, SW_SHOW ); ShowWindow( hwnd, SW_SHOW );
while (MSG_InternalGetMessage( lpmsg, hwnd, MSGF_DIALOGBOX, TRUE )) while (MSG_InternalGetMessage( lpmsg, hwnd, owner, MSGF_DIALOGBOX,
PM_REMOVE, TRUE ))
{ {
if (!IsDialogMessage( hwnd, lpmsg)) if (!IsDialogMessage( hwnd, lpmsg))
{ {
@ -399,7 +426,7 @@ int DialogBoxParam( HINSTANCE hInst, LPCSTR dlgTemplate,
hInst, dlgTemplate, owner, dlgProc, param ); hInst, dlgTemplate, owner, dlgProc, param );
#endif #endif
hwnd = CreateDialogParam( hInst, dlgTemplate, owner, dlgProc, param ); hwnd = CreateDialogParam( hInst, dlgTemplate, owner, dlgProc, param );
if (hwnd) return DIALOG_DoDialogBox( hwnd ); if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
return -1; return -1;
} }
@ -426,7 +453,7 @@ int DialogBoxIndirectParam( HINSTANCE hInst, HANDLE dlgTemplate,
if (!(ptr = GlobalLock( dlgTemplate ))) return -1; if (!(ptr = GlobalLock( dlgTemplate ))) return -1;
hwnd = CreateDialogIndirectParam( hInst, ptr, owner, dlgProc, param ); hwnd = CreateDialogIndirectParam( hInst, ptr, owner, dlgProc, param );
GlobalUnlock( dlgTemplate ); GlobalUnlock( dlgTemplate );
if (hwnd) return DIALOG_DoDialogBox( hwnd ); if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
return -1; return -1;
} }

View File

@ -12,10 +12,12 @@
#include "mdi.h" #include "mdi.h"
#include "user.h" #include "user.h"
#include "sysmetrics.h" #include "sysmetrics.h"
#include "menu.h"
#define DEBUG_MDI /* */ #define DEBUG_MDI /* */
extern WORD MENU_DrawMenuBar( HDC hDC, LPRECT lprect,
HMENU hmenu, BOOL suppress_draw ); /* menu.c */
/********************************************************************** /**********************************************************************
* MDIRecreateMenuList * MDIRecreateMenuList
*/ */
@ -80,7 +82,7 @@ MDICreateChild(WND *w, MDICLIENTINFO *ci, HWND parent, LPMDICREATESTRUCT cs)
WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SYSMENU |
WS_THICKFRAME | WS_VISIBLE | cs->style, WS_THICKFRAME | WS_VISIBLE | cs->style,
cs->x, cs->y, cs->cx, cs->cy, parent, (HMENU) 0, cs->x, cs->y, cs->cx, cs->cy, parent, (HMENU) 0,
w->hInstance, (LPSTR) cs->lParam); w->hInstance, (LPSTR) cs);
if (hwnd) if (hwnd)
{ {
@ -569,9 +571,7 @@ LONG MDIPaintMaximized(HWND hwndFrame, HWND hwndClient, WORD message,
rect.right -= SYSMETRICS_CXSIZE; rect.right -= SYSMETRICS_CXSIZE;
rect.bottom = rect.top + SYSMETRICS_CYMENU; rect.bottom = rect.top + SYSMETRICS_CYMENU;
StdDrawMenuBar(hdc, &rect, (LPPOPUPMENU) GlobalLock(wndPtr->wIDmenu), MENU_DrawMenuBar(hdc, &rect, wndPtr->wIDmenu, FALSE);
FALSE);
GlobalUnlock(wndPtr->wIDmenu);
DeleteDC(hdcMem); DeleteDC(hdcMem);
ReleaseDC(hwndFrame, hdc); ReleaseDC(hwndFrame, hdc);

View File

@ -205,7 +205,7 @@ static void MSG_RemoveMsg( MESSAGEQUEUE * msgQueue, int pos )
* the coordinates to client coordinates. * the coordinates to client coordinates.
* - Send the WM_SETCURSOR message. * - Send the WM_SETCURSOR message.
*/ */
static BOOL MSG_TranslateMouseMsg( MSG *msg ) static BOOL MSG_TranslateMouseMsg( MSG *msg, BOOL remove )
{ {
BOOL eatMsg = FALSE; BOOL eatMsg = FALSE;
static DWORD lastClickTime = 0; static DWORD lastClickTime = 0;
@ -280,9 +280,12 @@ static BOOL MSG_TranslateMouseMsg( MSG *msg )
case WM_MBUTTONDOWN: msg->message = WM_MBUTTONDBLCLK; break; case WM_MBUTTONDOWN: msg->message = WM_MBUTTONDBLCLK; break;
} }
lastClickTime = msg->time; if (remove)
lastClickMsg = msg->message; {
lastClickPos = msg->pt; lastClickTime = msg->time;
lastClickMsg = msg->message;
lastClickPos = msg->pt;
}
} }
/* Build the translated message */ /* Build the translated message */
@ -631,7 +634,7 @@ static BOOL MSG_PeekMessage( MESSAGEQUEUE * msgQueue, LPMSG msg, HWND hwnd,
if ((msg->message >= WM_MOUSEFIRST) && if ((msg->message >= WM_MOUSEFIRST) &&
(msg->message <= WM_MOUSELAST)) (msg->message <= WM_MOUSELAST))
if (!MSG_TranslateMouseMsg( msg )) if (!MSG_TranslateMouseMsg( msg, flags & PM_REMOVE ))
{ {
MSG_RemoveMsg( sysMsgQueue, pos ); MSG_RemoveMsg( sysMsgQueue, pos );
continue; continue;
@ -690,20 +693,30 @@ static BOOL MSG_PeekMessage( MESSAGEQUEUE * msgQueue, LPMSG msg, HWND hwnd,
* 'hwnd' must be the handle of the dialog or menu window. * 'hwnd' must be the handle of the dialog or menu window.
* 'code' is the message filter value (MSGF_??? codes). * 'code' is the message filter value (MSGF_??? codes).
*/ */
BOOL MSG_InternalGetMessage( LPMSG msg, HWND hwnd, short code, BOOL sendIdle ) BOOL MSG_InternalGetMessage( LPMSG msg, HWND hwnd, HWND hwndOwner, short code,
WORD flags, BOOL sendIdle )
{ {
do for (;;)
{ {
if (sendIdle) if (sendIdle)
{ {
if (MSG_PeekMessage(appMsgQueue, msg, 0, 0, 0, PM_REMOVE, TRUE)) if (!MSG_PeekMessage( appMsgQueue, msg, 0, 0, 0, flags, TRUE ))
continue; {
/* FIXME: to which window should we send this? */ /* No message present -> send ENTERIDLE and wait */
/* SendMessage( hwnd, WM_ENTERIDLE, code, (LPARAM)hwnd ); */ SendMessage( hwndOwner, WM_ENTERIDLE, code, (LPARAM)hwnd );
MSG_PeekMessage( appMsgQueue, msg, 0, 0, 0, flags, FALSE );
}
} }
MSG_PeekMessage( appMsgQueue, msg, 0, 0, 0, PM_REMOVE, FALSE ); else /* Always wait for a message */
} while (CallMsgFilter( msg, code ) != 0); MSG_PeekMessage( appMsgQueue, msg, 0, 0, 0, flags, FALSE );
return (msg->message != WM_QUIT);
if (!CallMsgFilter( msg, code )) return (msg->message != WM_QUIT);
/* Message filtered -> remove it from the queue */
/* if it's still there. */
if (!(flags & PM_REMOVE))
MSG_PeekMessage( appMsgQueue, msg, 0, 0, 0, PM_REMOVE, TRUE );
}
} }

View File

@ -12,7 +12,6 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1994";
#include "sysmetrics.h" #include "sysmetrics.h"
#include "user.h" #include "user.h"
#include "scroll.h" #include "scroll.h"
#include "menu.h"
#include "syscolor.h" #include "syscolor.h"
static HBITMAP hbitmapClose = 0; static HBITMAP hbitmapClose = 0;
@ -24,11 +23,19 @@ static HBITMAP hbitmapMaximizeD = 0;
static HBITMAP hbitmapRestore = 0; static HBITMAP hbitmapRestore = 0;
static HBITMAP hbitmapRestoreD = 0; static HBITMAP hbitmapRestoreD = 0;
#define SC_ABOUTWINE (SC_SCREENSAVE+1)
extern HINSTANCE hSysRes;
extern BOOL AboutWine_Proc( HWND hDlg, WORD msg, WORD wParam, LONG lParam );
extern void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos, extern void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos,
POINT *minTrack, POINT *maxTrack ); /* winpos.c */ POINT *minTrack, POINT *maxTrack ); /* winpos.c */
extern void CURSOR_SetWinCursor( HWND hwnd, HCURSOR hcursor ); /* cursor.c */ extern void CURSOR_SetWinCursor( HWND hwnd, HCURSOR hcursor ); /* cursor.c */
extern WORD MENU_GetMenuBarHeight( HWND hwnd, WORD menubarWidth, extern WORD MENU_GetMenuBarHeight( HWND hwnd, WORD menubarWidth,
int orgX, int orgY ); /* menu.c */ int orgX, int orgY ); /* menu.c */
extern void MENU_TrackMouseMenuBar( HWND hwnd, POINT pt ); /* menu.c */
extern void MENU_TrackKbdMenuBar( HWND hwnd, WORD wParam ); /* menu.c */
extern WORD MENU_DrawMenuBar( HDC hDC, LPRECT lprect,
HMENU hmenu, BOOL suppress_draw ); /* menu.c */
/* Some useful macros */ /* Some useful macros */
@ -70,8 +77,8 @@ static void NC_AdjustRect( LPRECT rect, DWORD style, BOOL menu, DWORD exStyle )
} }
if ((style & WS_CAPTION) == WS_CAPTION) if ((style & WS_CAPTION) == WS_CAPTION)
rect->top -= SYSMETRICS_CYCAPTION - 1; rect->top -= SYSMETRICS_CYCAPTION - SYSMETRICS_CYBORDER;
if (menu) rect->top -= SYSMETRICS_CYMENU + 1; if (menu) rect->top -= SYSMETRICS_CYMENU + SYSMETRICS_CYBORDER;
if (style & WS_VSCROLL) rect->right += SYSMETRICS_CXVSCROLL; if (style & WS_VSCROLL) rect->right += SYSMETRICS_CXVSCROLL;
if (style & WS_HSCROLL) rect->bottom += SYSMETRICS_CYHSCROLL; if (style & WS_HSCROLL) rect->bottom += SYSMETRICS_CYHSCROLL;
@ -237,8 +244,9 @@ static LONG NC_InternalNCHitTest( HWND hwnd, POINT pt )
if (!PtInRect( &rect, pt )) if (!PtInRect( &rect, pt ))
{ {
/* Check system menu */ /* Check system menu */
if ((wndPtr->dwStyle & WS_SYSMENU) && (pt.x <= SYSMETRICS_CXSIZE)) if (wndPtr->dwStyle & WS_SYSMENU)
return HTSYSMENU; rect.left += SYSMETRICS_CXSIZE;
if (pt.x <= rect.left) return HTSYSMENU;
/* Check maximize box */ /* Check maximize box */
if (wndPtr->dwStyle & WS_MAXIMIZEBOX) if (wndPtr->dwStyle & WS_MAXIMIZEBOX)
rect.right -= SYSMETRICS_CXSIZE + 1; rect.right -= SYSMETRICS_CXSIZE + 1;
@ -311,7 +319,7 @@ LONG NC_HandleNCHitTest( HWND hwnd, POINT pt )
/*********************************************************************** /***********************************************************************
* NC_DrawSysButton * NC_DrawSysButton
*/ */
static void NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down ) void NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down )
{ {
RECT rect; RECT rect;
WND *wndPtr = WIN_FindWndPtr( hwnd ); WND *wndPtr = WIN_FindWndPtr( hwnd );
@ -611,19 +619,17 @@ void NC_DoNCPaint( HWND hwnd, HRGN hrgn, BOOL active, BOOL suppress_menupaint )
if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION) if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION)
{ {
RECT r = rect; RECT r = rect;
rect.top += SYSMETRICS_CYSIZE + 1; r.bottom = rect.top + SYSMETRICS_CYSIZE;
r.bottom = rect.top - 1; rect.top += SYSMETRICS_CYSIZE + SYSMETRICS_CYBORDER;
NC_DrawCaption( hdc, &r, hwnd, wndPtr->dwStyle, active ); NC_DrawCaption( hdc, &r, hwnd, wndPtr->dwStyle, active );
} }
if (HAS_MENU(wndPtr)) if (HAS_MENU(wndPtr))
{ {
LPPOPUPMENU lpMenu = (LPPOPUPMENU) GlobalLock( wndPtr->wIDmenu );
RECT r = rect; RECT r = rect;
r.bottom = rect.top + lpMenu->Height; r.bottom = rect.top + SYSMETRICS_CYMENU; /* default height */
rect.top += lpMenu->Height; rect.top += MENU_DrawMenuBar( hdc, &r, (HMENU)wndPtr->wIDmenu,
StdDrawMenuBar( hdc, &r, lpMenu, suppress_menupaint ); suppress_menupaint );
GlobalUnlock( wndPtr->wIDmenu );
} }
if (wndPtr->dwStyle & (WS_VSCROLL | WS_HSCROLL)) { if (wndPtr->dwStyle & (WS_VSCROLL | WS_HSCROLL)) {
@ -1111,27 +1117,33 @@ static void NC_TrackScrollBar( HWND hwnd, WORD wParam, POINT pt )
ReleaseCapture(); ReleaseCapture();
} }
/*********************************************************************** /***********************************************************************
* NC_TrackMouseMenuBar * NC_TrackSysMenu
* *
* Track a mouse events for the MenuBar. * Track a mouse button press on the system menu.
*/ */
static void NC_TrackMouseMenuBar( HWND hwnd, WORD wParam, POINT pt ) static void NC_TrackSysMenu( HWND hwnd, HDC hdc, POINT pt )
{ {
WND *wndPtr; RECT rect;
LPPOPUPMENU lppop; WND *wndPtr = WIN_FindWndPtr( hwnd );
MSG msg;
wndPtr = WIN_FindWndPtr(hwnd); if (!(wndPtr->dwStyle & WS_SYSMENU)) return;
lppop = (LPPOPUPMENU)GlobalLock(wndPtr->wIDmenu); /* If window has a menu, track the menu bar normally */
#ifdef DEBUG_MENU if (HAS_MENU(wndPtr)) MENU_TrackMouseMenuBar( hwnd, pt );
printf("NC_TrackMouseMenuBar // wndPtr=%08X lppop=%08X !\n", wndPtr, lppop); else
#endif {
ScreenToClient(hwnd, &pt); /* Otherwise track the system menu like a normal popup menu */
pt.y += lppop->rect.bottom; NC_GetInsideRect( hwnd, &rect );
SetCapture(hwnd); OffsetRect( &rect, wndPtr->rectWindow.left, wndPtr->rectWindow.top );
MenuButtonDown(hwnd, lppop, pt.x, pt.y); if (wndPtr->dwStyle & WS_CHILD)
GlobalUnlock(wndPtr->wIDmenu); ClientToScreen( wndPtr->hwndParent, (POINT *)&rect );
rect.right = rect.left + SYSMETRICS_CXSIZE;
rect.bottom = rect.top + SYSMETRICS_CYSIZE;
NC_DrawSysButton( hwnd, hdc, TRUE );
TrackPopupMenu( wndPtr->hSysMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON,
rect.left, rect.bottom, 0, hwnd, &rect );
NC_DrawSysButton( hwnd, hdc, FALSE );
}
} }
@ -1151,8 +1163,7 @@ LONG NC_HandleNCLButtonDown( HWND hwnd, WORD wParam, LONG lParam )
break; break;
case HTSYSMENU: case HTSYSMENU:
NC_DrawSysButton( hwnd, hdc, TRUE ); NC_TrackSysMenu( hwnd, hdc, MAKEPOINT(lParam) );
NC_TrackSysMenu(hwnd);
break; break;
case HTMENU: case HTMENU:
@ -1263,22 +1274,28 @@ LONG NC_HandleSysCommand( HWND hwnd, WORD wParam, POINT pt )
break; break;
case SC_MOUSEMENU: case SC_MOUSEMENU:
NC_TrackMouseMenuBar( hwnd, wParam, pt ); MENU_TrackMouseMenuBar( hwnd, pt );
break; break;
case SC_KEYMENU: case SC_KEYMENU:
/* NC_KeyMenuBar( hwnd, wParam, pt ); */ MENU_TrackKbdMenuBar( hwnd, wParam );
break; break;
case SC_ARRANGE: case SC_ARRANGE:
break; break;
case SC_TASKLIST: case SC_TASKLIST:
case SC_SCREENSAVE: /* WinExec( "taskman.exe", SW_SHOWNORMAL ); */
break;
case SC_HOTKEY: case SC_HOTKEY:
break; break;
case SC_SCREENSAVE:
if (wParam == SC_ABOUTWINE)
DialogBox( hSysRes, MAKEINTRESOURCE(2),
hwnd, (FARPROC)AboutWine_Proc );
break;
} }
return 0; return 0;
} }

View File

@ -382,21 +382,14 @@ int wsprintf(LPSTR lpOutput, LPSTR lpFormat, ...)
int wvsprintf(LPSTR buf, LPSTR format, LPSTR args) int wvsprintf(LPSTR buf, LPSTR format, LPSTR args)
{ {
char qualified_fmt[1536];
char *newargs; char *newargs;
int result; int result;
/* 1.5K is a safe value as wvsprintf can only handle buffers up to
1K and in a worst case such a buffer would look like "%i%i%i..." */
if(!buf || !format) return 0; if(!buf || !format) return 0;
/* Change the format string so that ints are handled as short by
default */
/* Convert agruments to 32-bit values */ /* Convert agruments to 32-bit values */
newargs = UTILITY_convertArgs(format, args); newargs = UTILITY_convertArgs(format, args);
result = vsprintf(buf, qualified_fmt, newargs); result = vsprintf(buf, format, newargs);
free(newargs); free(newargs);
return result; return result;

View File

@ -247,6 +247,7 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
HANDLE class, hwnd; HANDLE class, hwnd;
CLASS *classPtr; CLASS *classPtr;
WND *wndPtr, *parentPtr = NULL; WND *wndPtr, *parentPtr = NULL;
POINT maxSize, maxPos, minTrack, maxTrack;
CREATESTRUCT *createStruct; CREATESTRUCT *createStruct;
HANDLE hcreateStruct; HANDLE hcreateStruct;
int wmcreate; int wmcreate;
@ -379,6 +380,19 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
win_attr.save_under = ((classPtr->wc.style & CS_SAVEBITS) != 0); win_attr.save_under = ((classPtr->wc.style & CS_SAVEBITS) != 0);
WINPOS_GetMinMaxInfo( hwnd, &maxSize, &maxPos, &minTrack, &maxTrack );
if ( maxSize.x < width)
{
width = maxSize.x;
wndPtr->rectWindow.right = x + width;
}
if ( maxSize.y < height)
{
height = maxSize.y;
wndPtr->rectWindow.bottom = y + height;
}
wndPtr->window = XCreateWindow( display, parentPtr->window, wndPtr->window = XCreateWindow( display, parentPtr->window,
x + parentPtr->rectClient.left - parentPtr->rectWindow.left, x + parentPtr->rectClient.left - parentPtr->rectWindow.left,
y + parentPtr->rectClient.top - parentPtr->rectWindow.top, y + parentPtr->rectClient.top - parentPtr->rectWindow.top,