diff --git a/ANNOUNCE b/ANNOUNCE index d5d35fef2de..a999ecdc744 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,12 +1,13 @@ -This is release 961102 of Wine, the MS Windows emulator. This is still a +This is release 961117 of Wine, the MS Windows emulator. This is still a developer's only release. There are many bugs and many unimplemented API features. Most applications still do not work correctly. Patches should be submitted to "julliard@lrc.epfl.ch". Please don't forget to include a ChangeLog entry. -WHAT'S NEW with Wine-961102: (see ChangeLog for details) +WHAT'S NEW with Wine-961117: (see ChangeLog for details) - More Win32 functions. + - OffiX-style drag and drop. - Lots of bug fixes. See the README file in the distribution for installation instructions. @@ -15,10 +16,10 @@ Because of lags created by using mirror, this message may reach you before the release is available at the ftp sites. The sources will be available from the following locations: - ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-961102.tar.gz - ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-961102.tar.gz - ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-961102.tar.gz - ftp://aris.com/pub/linux/ALPHA/Wine/development/Wine-961102.tar.gz + ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-961117.tar.gz + ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-961117.tar.gz + ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-961117.tar.gz + ftp://aris.com/pub/linux/ALPHA/Wine/development/Wine-961117.tar.gz It should also be available from any site that mirrors tsx-11 or sunsite. diff --git a/BUGS b/BUGS index 1148443703e..4785851f70d 100644 --- a/BUGS +++ b/BUGS @@ -1,20 +1,45 @@ -1. Messaging: +This is intended to be a place where you should look first if +you want to contribute to Wine development. Add your e-mail +address to the corresponding entry if you are working on/have +done something for one of the problems. You are encouraged to +add new entries and, more importantly, remove those for the +bugs you fixed ;-) +------------------------------------------------------------ +As of Nov 8 1996 - -- Message flow is not correct for multiple tasks -- Dialog Boxes created by WM_CREATE handler aren't visible -- MDI does not send WM_GETMINMAX message. -- resizing of MDI child windows sometimes leaves them unrepainted +General: -2. Controls: + * Combobox code is very inadequate (no notification messages, + dropdown listboxes often stay visible, etc... ). -- Some features are missing (like VK_SHIFT aided multiple selection in listboxes) + * Multicolumn and/or LBS_EXTENDEDSEL style listboxes are still + screwed up. [julliard@lrc.epfl.ch] -3. Miscellaneous: + * Winsock asynchronous functions do not work. -- AllocCSToDSAlias() shouldn't alloc alias for the same segment multiple times. + * Font mapping is too generic. No soft font loading, no rotated + text support. [alex@amadeus.pharm.sunysb.edu] -4. Where to look in source files: + * No thread support in Win32 code. -- grep for FIXME in the source files. + * Very alpha printing code. [john@division.co.uk] + + * No icon titles. + - Windows uses a special window class to display icon titles. + Handles to these title windows are stored in the icon window + properties. + +Miscellaneous: + + * AllocCSToDSAlias() shouldn't alloc alias for the same segment multiple + times. + * ScrollWindowEx() is outdated. + * HCBT_CLICKSKIPPED/HCBT_KEYSKIPPED hook actions are not implemented. + * Write sometimes segfaults in StretchDIBits() (when inside BITBLT_GetRow) + when only lower part of the resulting image is visible. + +Where to look in source files: + + * grep for FIXME in the source files. diff --git a/ChangeLog b/ChangeLog index fec97ddd3b7..d848a918db8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,108 @@ +---------------------------------------------------------------------- +Sun Nov 17 15:01:45 1996 Alexandre Julliard + + * [graphics/bitblt.c] [graphics/x11drv/bitblt.c] + Moved BitBlt operations to the new graphics driver + interface. Implemented PatBlt32, BitBlt32 and StretchBlt32. + + * [memory/global.c] + Unified MemManInfo() and GlobalMemoryStatus(). + + * [objects/text.c] + Fixed ExtTextOut() to always use physical coords for clip rect. + + * [windows/dialog.c] + Implemented DlgDirSelectEx() and Win32 version of DlgDirSelect*. + + * [windows/event.c] + Avoid busy-looping in EVENT_WaitXEvent when no timer is pending + (thanks to Thomas Koenig). + + * [windows/painting.c] + Moved update region clipping for CS_PARENTDC windows to BeginPaint(). + + * [windows/scroll.c] + Implemented Win32 version of ScrollWindow() and ScrollDC(). + +Tue Nov 12 09:52:17 1996 Marcus Meissner + + * [files/*.c] [win32/file.c] + Some win32 filetime conversion functions added. + Fixed behaviour with DOS drives pointing to UNIX / + SetCurrentDirectory() may also get X:\xxx paths. + Fixed FILE_Open when called from CreateFile(). + Added GetFileSize(), MapViewOfFile(), SetFileTime(), GetFileTime(). + + * [misc/crtdll.c] [if1632/crtdll.spec] + Added some new functions. + + * [if1632/user32.spec] + Some thunks into win16 code added. + + * [win32/init.c] + Added GetSystemInfo(), removed GetModuleFileName() stub. + + * [win32/code_page.c] [if1632/thunk.c] + Added EnumSystemCodePages* (untested). + + * [objects/font.c] [if1632/thunk.c] + Added EnumFontFamilies32*. + +Mon Nov 11 14:50:24 1996 Huw D. M. Davies + + * [controls/menu.c] [windows/mdi.c] + Don't delete the MDI `windows' menu if it's already been deleted. + + * [misc/exec.c] + Notepad always calls WinHelp(.., HELP_QUIT, ...) at termination + and complains if it returns FALSE. + + * [windows/winpos.c] + Get maximized MDI child's nonclient area redrawn after resize. + +Thu Nov 7 13:32:34 1996 Lee Jaekil + + * [memory/global.c] + Use /proc filesystem for GlobalMemoryStatus() on Linux. + +Mon Nov 4 18:30:00 1996 Alex Korobka + + * [windows/event.c] + Added OffiX-style file drop handling. File paths must be + DOS-mappable by Wine (via wine.conf). + + * [controls/combo.c] + Added WM_GETTEXT handler. + + * [objects/palette.c] + Added ResizePalette() (untested). + + * [objects/cursoricon.c] + Implemented icon to cursor conversion. + + * [objects/color.c] + Fixed crash on startup when no colorcells are writeable. + +Mon Nov 4 00:49:41 1996 Ulrich Schmid + + * [rc/winerc.c] + Added support for win32 output. + + * [library/libres.c] [include/libres.h] [loader/resource.c] + Renamed LIBRES_FindResource to LIBRES_FindResource16. + Added LIBRES_FindResource32. + +Sun Nov 3 21:21:45 1996 Robert Pouliot + + * [loader/builtin.c] [if1632/Makefile.in] [if1632/wing.spec] + Added the spec file for WinG, it's only stub for now, but it + should be easy to do by someone with Windows programming + knowledge. See: ftp.microsoft.com/SoftLib/MSLFILES/wing10.exe. + + * [if1632/crtdll.spec] + Added some string and memory functions to make sfxed95.exe (of + Warcraft 2) almost work. + ---------------------------------------------------------------------- Sat Nov 2 12:50:40 1996 Alexandre Julliard diff --git a/Make.rules.in b/Make.rules.in index 43d024abb4c..f8d1c909304 100644 --- a/Make.rules.in +++ b/Make.rules.in @@ -52,7 +52,7 @@ OBJS = $(GEN_C_SRCS:.c=.o) $(C_SRCS:.c=.o) $(ASM_SRCS:.S=.o) $(EXTRA_OBJS) echo "#include \"windows.h\"" >winerctmp.c echo WINDOWS_H_ENDS_HERE >>winerctmp.c cat $< >>winerctmp.c - $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) -c -o $* -p $* + $(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) $(RCFLAGS) -c -o $* -p $* $(RM) winerctmp.c .rc.h: diff --git a/controls/button.c b/controls/button.c index 8d92822cf86..3367a66b85d 100644 --- a/controls/button.c +++ b/controls/button.c @@ -284,8 +284,8 @@ static void PB_Paint( WND *wndPtr, HDC32 hDC, WORD action ) { /* draw button shadow: */ SelectObject32(hDC, sysColorObjects.hbrushBtnShadow ); - PatBlt(hDC, rc.left, rc.top, 1, rc.bottom-rc.top, PATCOPY ); - PatBlt(hDC, rc.left, rc.top, rc.right-rc.left, 1, PATCOPY ); + PatBlt32(hDC, rc.left, rc.top, 1, rc.bottom-rc.top, PATCOPY ); + PatBlt32(hDC, rc.left, rc.top, rc.right-rc.left, 1, PATCOPY ); rc.left += 2; /* To position the text down and right */ rc.top += 2; } @@ -352,12 +352,12 @@ void PB_PaintGrayOnGray(HDC32 hDC,HFONT32 hFont,RECT32 *rc,char *text) SelectObject32( hdcMem, hbmMem); hBr = SelectObject32( hdcMem, CreatePatternBrush32(hbm) ); DeleteObject32( hbm ); - PatBlt( hdcMem,0,0,rect.right,rect.bottom,WHITENESS); + PatBlt32( hdcMem,0,0,rect.right,rect.bottom,WHITENESS); if (hFont) SelectObject32( hdcMem, hFont); DrawText32A( hdcMem, text, -1, &rc2, DT_SINGLELINE); - PatBlt( hdcMem,0,0,rect.right,rect.bottom,0xFA0089); + PatBlt32( hdcMem,0,0,rect.right,rect.bottom,0xFA0089); DeleteObject32( SelectObject32( hdcMem,hBr) ); - BitBlt( hDC,rect.left,rect.top,rect.right,rect.bottom,hdcMem,0,0,0x990000); + BitBlt32(hDC,rect.left,rect.top,rect.right,rect.bottom,hdcMem,0,0,0x990000); DeleteDC( hdcMem); DeleteObject32( hbmMem ); } diff --git a/controls/combo.c b/controls/combo.c index c3f429e4277..43a368b22db 100644 --- a/controls/combo.c +++ b/controls/combo.c @@ -21,7 +21,6 @@ #include "graphics.h" #include "heap.h" #include "listbox.h" -#include "dos_fs.h" #include "drive.h" #include "stddebug.h" #include "debug.h" @@ -289,7 +288,7 @@ static LRESULT CBGetDlgCode(HWND hwnd, WPARAM16 wParam, LPARAM lParam) static LRESULT CBLButtonDown(HWND hwnd, WPARAM16 wParam, LPARAM lParam) { LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd); - SendMessage16(hwnd,CB_SHOWDROPDOWN,!lphc->DropDownVisible,0); + SendMessage16(hwnd,CB_SHOWDROPDOWN16,!lphc->DropDownVisible,0); return 0; } @@ -774,6 +773,15 @@ static LRESULT CBSetEditSel(HWND hwnd, WPARAM16 wParam, LPARAM lParam) return SendMessage16(lphc->hWndEdit, EM_SETSEL, 0, lParam); } +/*********************************************************************** + * CBGetText + */ +static LRESULT CBGetText(HWND hwnd, WPARAM16 wParam, LPARAM lParam) +{ + LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd); + + return SendMessage16(lphc->hWndEdit, WM_GETTEXT, wParam, lParam); +} /*********************************************************************** * ComboWndProc @@ -790,31 +798,32 @@ LRESULT ComboBoxWndProc(HWND hwnd, UINT message, WPARAM16 wParam, LPARAM lParam) case WM_SETFONT: return CBSetFont(hwnd, wParam, lParam); case WM_SETREDRAW: return CBSetRedraw(hwnd, wParam, lParam); case WM_PAINT: return CBPaint(hwnd, wParam, lParam); + case WM_GETTEXT: return CBGetText( hwnd, wParam, lParam); case WM_LBUTTONDOWN: return CBLButtonDown(hwnd, wParam, lParam); case WM_SETFOCUS: return CBSetFocus(hwnd, wParam, lParam); case WM_KILLFOCUS: return CBKillFocus(hwnd, wParam, lParam); case WM_SIZE: return CBCheckSize(hwnd); case WM_COMMAND: return CBCommand(hwnd, wParam, lParam); - case CB_RESETCONTENT: return CBResetContent(hwnd, wParam, lParam); - case CB_DIR: return CBDir(hwnd, wParam, lParam); - case CB_ADDSTRING: return CBAddString(hwnd, wParam, lParam); - case CB_INSERTSTRING: return CBInsertString(hwnd, wParam, lParam); - case CB_DELETESTRING: return CBDeleteString(hwnd, wParam, lParam); - case CB_FINDSTRING: return CBFindString(hwnd, wParam, lParam); - case CB_GETCOUNT: return CBGetCount(hwnd, wParam, lParam); - case CB_GETCURSEL: return CBGetCurSel(hwnd, wParam, lParam); - case CB_GETITEMDATA: return CBGetItemData(hwnd, wParam, lParam); - case CB_GETITEMHEIGHT: return CBGetItemHeight(hwnd, wParam, lParam); - case CB_GETLBTEXT: return CBGetLBText(hwnd, wParam, lParam); - case CB_GETLBTEXTLEN: return CBGetLBTextLen(hwnd, wParam, lParam); - case CB_SELECTSTRING: return CBSelectString(hwnd, wParam, lParam); - case CB_SETITEMDATA: return CBSetItemData(hwnd, wParam, lParam); - case CB_SETCURSEL: return CBSetCurSel(hwnd, wParam, lParam); - case CB_SETITEMHEIGHT: return CBSetItemHeight(hwnd, wParam, lParam); - case CB_SHOWDROPDOWN: return CBShowDropDown(hwnd, wParam, lParam); - case CB_GETEDITSEL: return CBGetEditSel(hwnd, wParam, lParam); - case CB_SETEDITSEL: return CBSetEditSel(hwnd, wParam, lParam); - case CB_FINDSTRINGEXACT: return CBFindStringExact(hwnd, wParam, lParam); + case CB_RESETCONTENT16: return CBResetContent(hwnd, wParam, lParam); + case CB_DIR16: return CBDir(hwnd, wParam, lParam); + case CB_ADDSTRING16: return CBAddString(hwnd, wParam, lParam); + case CB_INSERTSTRING16: return CBInsertString(hwnd, wParam, lParam); + case CB_DELETESTRING16: return CBDeleteString(hwnd, wParam, lParam); + case CB_FINDSTRING16: return CBFindString(hwnd, wParam, lParam); + case CB_GETCOUNT16: return CBGetCount(hwnd, wParam, lParam); + case CB_GETCURSEL16: return CBGetCurSel(hwnd, wParam, lParam); + case CB_GETITEMDATA16: return CBGetItemData(hwnd, wParam, lParam); + case CB_GETITEMHEIGHT16: return CBGetItemHeight(hwnd, wParam, lParam); + case CB_GETLBTEXT16: return CBGetLBText(hwnd, wParam, lParam); + case CB_GETLBTEXTLEN16: return CBGetLBTextLen(hwnd, wParam, lParam); + case CB_SELECTSTRING16: return CBSelectString(hwnd, wParam, lParam); + case CB_SETITEMDATA16: return CBSetItemData(hwnd, wParam, lParam); + case CB_SETCURSEL16: return CBSetCurSel(hwnd, wParam, lParam); + case CB_SETITEMHEIGHT16: return CBSetItemHeight(hwnd, wParam, lParam); + case CB_SHOWDROPDOWN16: return CBShowDropDown(hwnd, wParam, lParam); + case CB_GETEDITSEL16: return CBGetEditSel(hwnd, wParam, lParam); + case CB_SETEDITSEL16: return CBSetEditSel(hwnd, wParam, lParam); + case CB_FINDSTRINGEXACT16: return CBFindStringExact(hwnd, wParam, lParam); } return DefWindowProc16(hwnd, message, wParam, lParam); } @@ -988,7 +997,7 @@ static LRESULT CBLPaint( HWND hwnd, WPARAM16 wParam, LPARAM lParam ) */ static LRESULT CBLKillFocus( HWND hwnd, WPARAM16 wParam, LPARAM lParam ) { -/* SendMessage16(CLBoxGetCombo(hwnd),CB_SHOWDROPDOWN,0,0);*/ +/* SendMessage16(CLBoxGetCombo(hwnd),CB_SHOWDROPDOWN16,0,0);*/ return 0; } @@ -998,7 +1007,7 @@ static LRESULT CBLKillFocus( HWND hwnd, WPARAM16 wParam, LPARAM lParam ) static LRESULT CBLActivate( HWND hwnd, WPARAM16 wParam, LPARAM lParam ) { if (wParam == WA_INACTIVE) - SendMessage16(CLBoxGetCombo(hwnd),CB_SHOWDROPDOWN,0,0); + SendMessage16(CLBoxGetCombo(hwnd),CB_SHOWDROPDOWN16,0,0); return 0; } @@ -1042,12 +1051,12 @@ static LRESULT CBLLButtonUp( HWND hwnd, WPARAM16 wParam, LPARAM lParam ) } else if (lphl->PrevFocused != lphl->ItemFocused) { - SendMessage16(CLBoxGetCombo(hwnd),CB_SETCURSEL,lphl->ItemFocused,0); + SendMessage16(CLBoxGetCombo(hwnd),CB_SETCURSEL16,lphl->ItemFocused,0); SendMessage16(GetParent16(hwnd), WM_COMMAND,ID_CLB,MAKELONG(0,CBN_SELCHANGE)); ListBoxSendNotification(lphl, CBN_SELCHANGE); } - SendMessage16(CLBoxGetCombo(hwnd),CB_SHOWDROPDOWN,0,0); + SendMessage16(CLBoxGetCombo(hwnd),CB_SHOWDROPDOWN16,0,0); return 0; } @@ -1225,15 +1234,6 @@ LRESULT ComboLBoxWndProc(HWND hwnd, UINT message, WPARAM16 wParam, LPARAM lParam return DefWindowProc16(hwnd, message, wParam, lParam); } -/************************************************************************ - * DlgDirSelectComboBox [USER.194] - */ -BOOL DlgDirSelectComboBox(HWND hDlg, LPSTR lpStr, INT nIDLBox) -{ - fprintf(stdnimp,"DlgDirSelectComboBox(%04x, '%s', %d) \n", - hDlg, lpStr, nIDLBox); - return TRUE; -} static INT32 COMBO_DlgDirList( HWND32 hDlg, LPARAM path, INT32 idCBox, INT32 idStatic, UINT32 wType, BOOL32 unicode ) @@ -1242,11 +1242,11 @@ static INT32 COMBO_DlgDirList( HWND32 hDlg, LPARAM path, INT32 idCBox, if (idCBox) { - SendDlgItemMessage32A( hDlg, idCBox, CB_RESETCONTENT, 0, 0 ); + SendDlgItemMessage32A( hDlg, idCBox, CB_RESETCONTENT16, 0, 0 ); if (unicode) - res = SendDlgItemMessage32W( hDlg, idCBox, CB_DIR, wType, path ); + res = SendDlgItemMessage32W( hDlg, idCBox, CB_DIR16, wType, path ); else - res = SendDlgItemMessage32A( hDlg, idCBox, CB_DIR, wType, path ); + res = SendDlgItemMessage32A( hDlg, idCBox, CB_DIR16, wType, path ); } if (idStatic) { diff --git a/controls/edit.c b/controls/edit.c index e86af1485c9..66baa585360 100644 --- a/controls/edit.c +++ b/controls/edit.c @@ -1879,7 +1879,7 @@ static LRESULT EDIT_EM_LineScroll(WND *wndPtr, WPARAM32 wParam, LPARAM lParam) if (wndPtr->hwndSelf == GetFocus32()) HideCaret(wndPtr->hwndSelf); if (EDIT_GetRedraw(wndPtr)) - ScrollWindow(wndPtr->hwndSelf, dx, dy, NULL, NULL); + ScrollWindow32(wndPtr->hwndSelf, dx, dy, NULL, NULL); es->FirstVisibleLine = nfv; es->XOffset = nxoff; if (IsVScrollBar(wndPtr)) diff --git a/controls/listbox.c b/controls/listbox.c index 1fe77b25f99..a07645d390b 100644 --- a/controls/listbox.c +++ b/controls/listbox.c @@ -2175,43 +2175,6 @@ LRESULT ListBoxWndProc(HWND hwnd, UINT message, WPARAM16 wParam, LPARAM lParam) } -/********************************************************************** - * DlgDirSelect (USER.99) - */ -BOOL DlgDirSelect( HWND hDlg, LPSTR lpStr, INT id ) -{ - char *buffer; - INT i; - - dprintf_listbox( stddeb, "DlgDirSelect: %04x '%s' %d\n", hDlg, lpStr, id ); - if ((i = SendDlgItemMessage16( hDlg, id, LB_GETCURSEL16, 0, 0 )) == LB_ERR) - return FALSE; - if (!(buffer = SEGPTR_ALLOC( 20 * sizeof(char) ))) return FALSE; - SendDlgItemMessage16(hDlg, id, LB_GETTEXT16, i, (LPARAM)SEGPTR_GET(buffer) ); - if (buffer[0] == '[') /* drive or directory */ - { - if (buffer[1] == '-') /* drive */ - { - lpStr[0] = buffer[2]; - lpStr[1] = ':'; - lpStr[2] = '\0'; - dprintf_listbox( stddeb, "Returning drive '%s'\n", lpStr ); - SEGPTR_FREE(buffer); - return TRUE; - } - strcpy( lpStr, buffer + 1 ); - lpStr[strlen(lpStr)-1] = '\\'; - dprintf_listbox( stddeb, "Returning directory '%s'\n", lpStr ); - SEGPTR_FREE(buffer); - return TRUE; - } - strcpy( lpStr, buffer ); - dprintf_listbox( stddeb, "Returning file '%s'\n", lpStr ); - SEGPTR_FREE(buffer); - return FALSE; -} - - /********************************************************************** * DlgDirList (USER.100) */ diff --git a/controls/menu.c b/controls/menu.c index 84433760b25..59cee2894b3 100644 --- a/controls/menu.c +++ b/controls/menu.c @@ -2173,7 +2173,7 @@ INT GetMenuItemCount(HMENU16 hMenu) LPPOPUPMENU menu; dprintf_menu(stddeb,"GetMenuItemCount(%04x);\n", hMenu); menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu); - if (menu == NULL) return (UINT)-1; + if (menu == NULL || menu->wMagic != MENU_MAGIC) return (UINT)-1; dprintf_menu(stddeb,"GetMenuItemCount(%04x) return %d \n", hMenu, menu->nItems); return menu->nItems; diff --git a/controls/scroll.c b/controls/scroll.c index 481f6cbb4c3..21316a019e2 100644 --- a/controls/scroll.c +++ b/controls/scroll.c @@ -48,7 +48,7 @@ static HBITMAP32 hRgArrowI = 0; #define SCROLL_MIN_RECT 4 /* Minimum size of the thumb in pixels */ -#define SCROLL_MIN_THUMB 4 +#define SCROLL_MIN_THUMB 6 /* Delay (in ms) before first repetition when holding the button down */ #define SCROLL_FIRST_DELAY 200 @@ -316,28 +316,28 @@ static void SCROLL_DrawArrows( HDC32 hdc, SCROLLBAR_INFO *infoPtr, TOP_ARROW(infoPtr->flags, top_pressed) : LEFT_ARROW(infoPtr->flags, top_pressed)); SetStretchBltMode( hdc, STRETCH_DELETESCANS ); - StretchBlt( hdc, rect->left, rect->top, - vertical ? rect->right-rect->left : arrowSize+1, - vertical ? arrowSize+1 : rect->bottom-rect->top, - hdcMem, 0, 0, - SYSMETRICS_CXVSCROLL + 1, SYSMETRICS_CYHSCROLL + 1, - SRCCOPY ); + StretchBlt32( hdc, rect->left, rect->top, + vertical ? rect->right-rect->left : arrowSize+1, + vertical ? arrowSize+1 : rect->bottom-rect->top, + hdcMem, 0, 0, + SYSMETRICS_CXVSCROLL + 1, SYSMETRICS_CYHSCROLL + 1, + SRCCOPY ); SelectObject32( hdcMem, vertical ? BOTTOM_ARROW( infoPtr->flags, bottom_pressed ) : RIGHT_ARROW( infoPtr->flags, bottom_pressed ) ); if (vertical) - StretchBlt( hdc, rect->left, rect->bottom - arrowSize - 1, - rect->right - rect->left, arrowSize + 1, - hdcMem, 0, 0, - SYSMETRICS_CXVSCROLL + 1, SYSMETRICS_CYHSCROLL + 1, - SRCCOPY ); + StretchBlt32( hdc, rect->left, rect->bottom - arrowSize - 1, + rect->right - rect->left, arrowSize + 1, + hdcMem, 0, 0, + SYSMETRICS_CXVSCROLL + 1, SYSMETRICS_CYHSCROLL + 1, + SRCCOPY ); else - StretchBlt( hdc, rect->right - arrowSize - 1, rect->top, - arrowSize + 1, rect->bottom - rect->top, - hdcMem, 0, 0, - SYSMETRICS_CXVSCROLL + 1, SYSMETRICS_CYHSCROLL + 1, - SRCCOPY ); + StretchBlt32( hdc, rect->right - arrowSize - 1, rect->top, + arrowSize + 1, rect->bottom - rect->top, + hdcMem, 0, 0, + SYSMETRICS_CXVSCROLL + 1, SYSMETRICS_CYHSCROLL + 1, + SRCCOPY ); SelectObject32( hdcMem, hbmpPrev ); DeleteDC( hdcMem ); } @@ -432,35 +432,35 @@ static void SCROLL_DrawInterior( HWND32 hwnd, HDC32 hdc, INT32 nBar, if (!thumbPos) /* No thumb to draw */ { - PatBlt( hdc, r.left+1, r.top+1, r.right - r.left - 2, - r.bottom - r.top - 2, PATCOPY ); + PatBlt32( hdc, r.left+1, r.top+1, r.right - r.left - 2, + r.bottom - r.top - 2, PATCOPY ); return; } if (vertical) { - PatBlt( hdc, r.left + 1, r.top + 1, - r.right - r.left - 2, - thumbPos - arrowSize, - top_selected ? 0x0f0000 : PATCOPY ); + PatBlt32( hdc, r.left + 1, r.top + 1, + r.right - r.left - 2, + thumbPos - arrowSize, + top_selected ? 0x0f0000 : PATCOPY ); r.top += thumbPos - arrowSize; - PatBlt( hdc, r.left + 1, r.top + thumbSize + 1, - r.right - r.left - 2, - r.bottom - r.top - thumbSize - 2, - bottom_selected ? 0x0f0000 : PATCOPY ); + PatBlt32( hdc, r.left + 1, r.top + thumbSize + 1, + r.right - r.left - 2, + r.bottom - r.top - thumbSize - 2, + bottom_selected ? 0x0f0000 : PATCOPY ); r.bottom = r.top + thumbSize + 1; } else /* horizontal */ { - PatBlt( hdc, r.left + 1, r.top + 1, - thumbPos - arrowSize, - r.bottom - r.top - 2, - top_selected ? 0x0f0000 : PATCOPY ); + PatBlt32( hdc, r.left + 1, r.top + 1, + thumbPos - arrowSize, + r.bottom - r.top - 2, + top_selected ? 0x0f0000 : PATCOPY ); r.left += thumbPos - arrowSize; - PatBlt( hdc, r.left + thumbSize + 1, r.top + 1, - r.right - r.left - thumbSize - 2, - r.bottom - r.top - 2, - bottom_selected ? 0x0f0000 : PATCOPY ); + PatBlt32( hdc, r.left + thumbSize + 1, r.top + 1, + r.right - r.left - thumbSize - 2, + r.bottom - r.top - 2, + bottom_selected ? 0x0f0000 : PATCOPY ); r.right = r.left + thumbSize + 1; } diff --git a/controls/widgets.c b/controls/widgets.c index 0235053771b..88d01a4b6d7 100644 --- a/controls/widgets.c +++ b/controls/widgets.c @@ -16,6 +16,8 @@ #include "module.h" #include "heap.h" +#define OLD_LISTBOX + typedef struct { UINT16 style; @@ -29,8 +31,10 @@ static const BUILTIN_CLASS_INFO16 WIDGETS_BuiltinClasses16[] = { { CS_GLOBALCLASS | CS_PARENTDC, sizeof(STATICINFO), 0, "StaticWndProc", "STATIC" }, +#ifdef OLD_LISTBOX { CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS, 8, 0, "ListBoxWndProc", "LISTBOX" }, +#endif { CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS, 8, 0, "ComboBoxWndProc", "COMBOBOX" }, { CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS, @@ -53,6 +57,10 @@ static WNDCLASS32A WIDGETS_BuiltinClasses32[] = { { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, ButtonWndProc, 0, sizeof(BUTTONINFO), 0, 0, 0, 0, 0, "BUTTON" }, +#ifndef OLD_LISTBOX + { CS_GLOBALCLASS | CS_DBLCLKS /*| CS_PARENTDC*/, + ListBoxWndProc32, 0, sizeof(void *), 0, 0, 0, 0, 0, "LISTBOX" }, +#endif { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, ScrollBarWndProc, 0, sizeof(SCROLLBAR_INFO), 0, 0, 0, 0, 0, "SCROLLBAR"}, { CS_GLOBALCLASS, DesktopWndProc, 0, sizeof(DESKTOPINFO), diff --git a/documentation/user_module b/documentation/user_module index 4335f9c9515..8cff4cb37e9 100644 --- a/documentation/user_module +++ b/documentation/user_module @@ -213,5 +213,4 @@ located in windows/, controls/, and misc/ directories. and in this case SendMessage has to build some sort of message queue for sent messages. Another issue is what to do with messages sent to the sender when it is blocked inside its own SendMessage. - At this point Wine addresses very few of these problems. diff --git a/files/dos_fs.c b/files/dos_fs.c index 3e3c8dcfa60..77aa5ed2178 100644 --- a/files/dos_fs.c +++ b/files/dos_fs.c @@ -306,6 +306,25 @@ void DOSFS_ToDosDateTime( time_t unixtime, WORD *pDate, WORD *pTime ) + tm->tm_mday; } +/*********************************************************************** + * DOSFS_DosDateTimeToUnixTime + * + * Convert from the DOS (FAT) date/time format into Unix time + * (borrowed from files/file.c) + */ +time_t DOSFS_DosDateTimeToUnixTime( WORD date, WORD time ) +{ + struct tm newtm; + + newtm.tm_sec = (time & 0x1f) * 2; + newtm.tm_min = (time >> 5) & 0x3f; + newtm.tm_hour = (time >> 11); + newtm.tm_mday = (date & 0x1f); + newtm.tm_mon = ((date >> 5) & 0x0f) - 1; + newtm.tm_year = (date >> 9) + 80; + return mktime( &newtm ); +} + /*********************************************************************** * DOSFS_UnixTimeToFileTime @@ -760,7 +779,8 @@ int DOSFS_FindNext( const char *path, const char *short_mask, path, skip, buffer, cur_pos ); cur_pos = skip; if (dir) closedir(dir); - if (!(dir = opendir( path ))) return 0; + if (!*path) path = "/"; + if (!(dir = opendir(path))) return 0; drive_path = path; drive_root = 0; if (DRIVE_FindDriveRoot( &drive_path ) != -1) @@ -876,3 +896,94 @@ DWORD GetFullPathName32A( LPCSTR fn, DWORD buflen, LPSTR buf, LPSTR *lastpart) { *lastpart=strrchr(buf,'\\'); return strlen(fn); } + + +/*********************************************************************** + * DosDateTimeToFileTime (KERNEL32.76) + */ +BOOL32 DosDateTimeToFileTime( WORD fatdate, WORD fattime, LPFILETIME ft ) +{ + time_t unixtime = DOSFS_DosDateTimeToUnixTime(fatdate,fattime); + DOSFS_UnixTimeToFileTime(unixtime,ft); + return TRUE; +} + + +/*********************************************************************** + * FileTimeToDosDateTime (KERNEL32.111) + */ +BOOL32 FileTimeToDosDateTime( LPFILETIME ft, LPWORD fatdate, LPWORD fattime) +{ + time_t unixtime = DOSFS_FileTimeToUnixTime(ft); + DOSFS_ToDosDateTime(unixtime,fatdate,fattime); + return TRUE; +} + + +/*********************************************************************** + * LocalFileTimeToFileTime (KERNEL32.373) + */ +BOOL32 LocalFileTimeToFileTime( LPFILETIME localft, LPFILETIME utcft ) +{ + struct tm *xtm; + + /* convert from local to UTC. Perhaps not correct. FIXME */ + xtm = gmtime((time_t*)&(localft->dwLowDateTime)); + utcft->dwLowDateTime = mktime(xtm); + utcft->dwHighDateTime = 0; + return TRUE; +} + + +/*********************************************************************** + * FileTimeToLocalFileTime (KERNEL32.112) + */ +BOOL32 FileTimeToLocalFileTime( LPFILETIME utcft, LPFILETIME localft ) +{ + struct tm *xtm; + + /* convert from UTC to local. Perhaps not correct. FIXME */ + xtm = localtime((time_t*)&(utcft->dwLowDateTime)); + localft->dwLowDateTime = mktime(xtm); + localft->dwHighDateTime = 0; + return TRUE; +} + + +/*********************************************************************** + * FileTimeToSystemTime (KERNEL32.113) + */ +BOOL32 FileTimeToSystemTime( LPFILETIME ft, LPSYSTEMTIME syst ) +{ + struct tm *xtm; + time_t xtime = DOSFS_FileTimeToUnixTime(ft); + xtm = gmtime(&xtime); + syst->wYear = xtm->tm_year; + syst->wMonth = xtm->tm_mon; + syst->wDayOfWeek = xtm->tm_wday; + syst->wDay = xtm->tm_mday; + syst->wHour = xtm->tm_hour; + syst->wMinute = xtm->tm_min; + syst->wSecond = xtm->tm_sec; + syst->wMilliseconds = 0; /* FIXME */ + return TRUE; +} + + +/*********************************************************************** + * SystemTimeToFileTime (KERNEL32.526) + */ +BOOL32 SystemTimeToFileTime( LPSYSTEMTIME syst, LPFILETIME ft ) +{ + struct tm xtm; + + xtm.tm_year = syst->wYear; + xtm.tm_mon = syst->wMonth; + xtm.tm_wday = syst->wDayOfWeek; + xtm.tm_mday = syst->wDay; + xtm.tm_hour = syst->wHour; + xtm.tm_min = syst->wMinute; + xtm.tm_sec = syst->wSecond; + DOSFS_UnixTimeToFileTime(mktime(&xtm),ft); + return TRUE; +} diff --git a/files/drive.c b/files/drive.c index 9210de7b954..8a5bf5ad585 100644 --- a/files/drive.c +++ b/files/drive.c @@ -136,7 +136,10 @@ int DRIVE_Init(void) { p = path + strlen(path) - 1; while ((p > path) && ((*p == '/') || (*p == '\\'))) *p-- = '\0'; - drive->root = xstrdup( path ); + if (strlen(path)) + drive->root = xstrdup( path ); + else + drive->root = xstrdup( "/" ); drive->dos_cwd = xstrdup( "" ); drive->unix_cwd = xstrdup( "" ); drive->type = DRIVE_GetDriveType( name ); @@ -681,6 +684,17 @@ UINT32 GetCurrentDirectory32W( UINT32 buflen, LPWSTR buf ) */ BOOL32 SetCurrentDirectory( LPCSTR dir ) { + if (dir[0] && (dir[1]==':')) + { + int drive = tolower( *dir ) - 'a'; + if (!DRIVE_IsValid(drive)) + { + DOS_ERROR( ER_InvalidDrive, EC_MediaError, SA_Abort, EL_Disk ); + return 0; + } + dir += 2; + } + /* FIXME: what about empty strings? Add a \\ ? */ return DRIVE_Chdir( DRIVE_GetCurrentDrive(), dir ); } diff --git a/files/file.c b/files/file.c index d8b22b2d860..45ac9f026dc 100644 --- a/files/file.c +++ b/files/file.c @@ -366,8 +366,9 @@ HFILE FILE_Open( LPCSTR path, INT32 mode ) return HFILE_ERROR; } } - else if (!(unixName = DOSFS_GetUnixFileName( path, TRUE ))) - return HFILE_ERROR; + else /* check for filename, don't check for last entry if creating */ + if (!(unixName = DOSFS_GetUnixFileName( path, !(mode & O_CREAT) ))) + return HFILE_ERROR; if (!(file = FILE_OpenUnixFile( unixName, mode ))) return HFILE_ERROR; if ((handle = FILE_AllocTaskHandle( file )) == HFILE_ERROR) @@ -1406,3 +1407,71 @@ DWORD GetFileType( HFILE hFile ) } return file->type; } + + +/*********************************************************************** + * GetFileTime (KERNEL32.221) + */ +BOOL32 GetFileTime( HFILE hFile, FILETIME *lpCreationTime, + FILETIME *lpLastAccessTime, FILETIME *lpLastWriteTime ) +{ + DOS_FILE *file = FILE_GetFile(hFile); + struct stat stbuf; + + if (!file) { + SetLastError( ERROR_INVALID_HANDLE ); + return FILE_TYPE_UNKNOWN; /* FIXME: correct? */ + } + dprintf_file(stddeb,"SetFileTime(%s,%p,%p,%p)\n", + file->unix_name, + lpCreationTime, + lpLastAccessTime, + lpLastWriteTime + ); + if (-1==fstat(file->unix_handle,&stbuf)) { + FILE_SetDosError(); + return FALSE; + } + if (lpLastWriteTime) + DOSFS_UnixTimeToFileTime(stbuf.st_mtime,lpLastWriteTime); + if (lpCreationTime) + DOSFS_UnixTimeToFileTime(stbuf.st_ctime,lpCreationTime); + if (lpLastAccessTime) + DOSFS_UnixTimeToFileTime(stbuf.st_atime,lpLastAccessTime); + return TRUE; +} + + +/*********************************************************************** + * SetFileTime (KERNEL32.493) + */ +BOOL32 SetFileTime( HFILE hFile, FILETIME *lpCreationTime, + FILETIME *lpLastAccessTime, FILETIME *lpLastWriteTime ) +{ + DOS_FILE *file = FILE_GetFile(hFile); + struct utimbuf utimbuf; + + if (!file) { + SetLastError( ERROR_INVALID_HANDLE ); + return FILE_TYPE_UNKNOWN; /* FIXME: correct? */ + } + dprintf_file(stddeb,"SetFileTime(%s,%p,%p,%p)\n", + file->unix_name, + lpCreationTime, + lpLastAccessTime, + lpLastWriteTime + ); + if (lpLastAccessTime) + utimbuf.actime = DOSFS_FileTimeToUnixTime(lpLastAccessTime); + else + utimbuf.actime = 0; /* FIXME */ + if (lpLastWriteTime) + utimbuf.modtime = DOSFS_FileTimeToUnixTime(lpLastWriteTime); + else + utimbuf.modtime = 0; /* FIXME */ + if (-1==utime(file->unix_name,&utimbuf)) { + FILE_SetDosError(); + return FALSE; + } + return TRUE; +} diff --git a/files/profile.c b/files/profile.c index 4570b5e510f..ddb21ed7d93 100644 --- a/files/profile.c +++ b/files/profile.c @@ -10,8 +10,8 @@ #include #include -#include "dos_fs.h" #include "windows.h" +#include "dos_fs.h" #include "xmalloc.h" #include "stddebug.h" #include "debug.h" diff --git a/graphics/Makefile.in b/graphics/Makefile.in index cc4635410f8..9bb95359771 100644 --- a/graphics/Makefile.in +++ b/graphics/Makefile.in @@ -6,6 +6,7 @@ VPATH = @srcdir@ MODULE = graphics C_SRCS = \ + bitblt.c \ driver.c all: $(MODULE).o diff --git a/graphics/bitblt.c b/graphics/bitblt.c new file mode 100644 index 00000000000..2acda698af2 --- /dev/null +++ b/graphics/bitblt.c @@ -0,0 +1,149 @@ +/* + * GDI bit-blit operations + * + * Copyright 1993, 1994 Alexandre Julliard + */ + +#include "gdi.h" +#include "stddebug.h" +#include "debug.h" + + +/*********************************************************************** + * PatBlt16 (GDI.29) + */ +BOOL16 PatBlt16( HDC16 hdc, INT16 left, INT16 top, + INT16 width, INT16 height, DWORD rop) +{ + DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); + if (!dc || !dc->funcs->pPatBlt) return FALSE; + + dprintf_bitblt( stddeb, "PatBlt16: %04x %d,%d %dx%d %06lx\n", + hdc, left, top, width, height, rop ); + return dc->funcs->pPatBlt( dc, left, top, width, height, rop ); +} + + +/*********************************************************************** + * PatBlt32 (GDI32.260) + */ +BOOL32 PatBlt32( HDC32 hdc, INT32 left, INT32 top, + INT32 width, INT32 height, DWORD rop) +{ + DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); + if (!dc || !dc->funcs->pPatBlt) return FALSE; + + dprintf_bitblt( stddeb, "PatBlt32: %04x %d,%d %dx%d %06lx\n", + hdc, left, top, width, height, rop ); + return dc->funcs->pPatBlt( dc, left, top, width, height, rop ); +} + + +/*********************************************************************** + * BitBlt16 (GDI.34) + */ +BOOL16 BitBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst, INT16 width, + INT16 height, HDC16 hdcSrc, INT16 xSrc, INT16 ySrc, DWORD rop) +{ + DC *dcDst, *dcSrc; + + if (!(dcDst = (DC *)GDI_GetObjPtr( hdcDst, DC_MAGIC ))) return FALSE; + if (!dcDst->funcs->pBitBlt) return FALSE; + dcSrc = (DC *) GDI_GetObjPtr( hdcSrc, DC_MAGIC ); + + dprintf_bitblt(stddeb, + "BitBlt16: hdcSrc=%04x %d,%d %d bpp -> hdcDest=%04x %d,%d %dx%dx%d rop=%06lx\n", + hdcSrc, xSrc, ySrc, dcSrc ? dcSrc->w.bitsPerPixel : 0, + hdcDst, xDst, yDst, width, height, dcDst->w.bitsPerPixel, rop); + return dcDst->funcs->pBitBlt( dcDst, xDst, yDst, width, height, + dcSrc, xSrc, ySrc, rop ); +} + + +/*********************************************************************** + * BitBlt32 (GDI32.10) + */ +BOOL32 BitBlt32( HDC32 hdcDst, INT32 xDst, INT32 yDst, INT32 width, + INT32 height, HDC32 hdcSrc, INT32 xSrc, INT32 ySrc, DWORD rop) +{ + DC *dcDst, *dcSrc; + + if (!(dcDst = (DC *)GDI_GetObjPtr( hdcDst, DC_MAGIC ))) return FALSE; + if (!dcDst->funcs->pBitBlt) return FALSE; + dcSrc = (DC *) GDI_GetObjPtr( hdcSrc, DC_MAGIC ); + + dprintf_bitblt(stddeb, + "BitBlt32: hdcSrc=%04x %d,%d %d bpp -> hdcDest=%04x %d,%d %dx%dx%d rop=%06lx\n", + hdcSrc, xSrc, ySrc, dcSrc ? dcSrc->w.bitsPerPixel : 0, + hdcDst, xDst, yDst, width, height, dcDst->w.bitsPerPixel, rop); + return dcDst->funcs->pBitBlt( dcDst, xDst, yDst, width, height, + dcSrc, xSrc, ySrc, rop ); +} + + +/*********************************************************************** + * StretchBlt16 (GDI.35) + */ +BOOL16 StretchBlt16( HDC16 hdcDst, INT16 xDst, INT16 yDst, + INT16 widthDst, INT16 heightDst, + HDC16 hdcSrc, INT16 xSrc, INT16 ySrc, + INT16 widthSrc, INT16 heightSrc, DWORD rop ) +{ + DC *dcDst, *dcSrc; + + if (!(dcDst = (DC *) GDI_GetObjPtr( hdcDst, DC_MAGIC ))) return FALSE; + if (!dcDst->funcs->pStretchBlt) return FALSE; + dcSrc = (DC *) GDI_GetObjPtr( hdcSrc, DC_MAGIC ); + dprintf_bitblt(stddeb, + "StretchBlt16: %04x %d,%d %dx%dx%d -> %04x %d,%d %dx%dx%d rop=%06lx\n", + hdcSrc, xSrc, ySrc, widthSrc, heightSrc, + dcSrc ? dcSrc->w.bitsPerPixel : 0, hdcDst, xDst, yDst, + widthDst, heightDst, dcDst->w.bitsPerPixel, rop ); + return dcDst->funcs->pStretchBlt( dcDst, xDst, yDst, widthDst, heightDst, + dcSrc, xSrc, ySrc, widthSrc, heightSrc, + rop ); +} + + +/*********************************************************************** + * StretchBlt32 (GDI32.350) + */ +BOOL32 StretchBlt32( HDC32 hdcDst, INT32 xDst, INT32 yDst, + INT32 widthDst, INT32 heightDst, + HDC32 hdcSrc, INT32 xSrc, INT32 ySrc, + INT32 widthSrc, INT32 heightSrc, DWORD rop ) +{ + DC *dcDst, *dcSrc; + + if (!(dcDst = (DC *) GDI_GetObjPtr( hdcDst, DC_MAGIC ))) return FALSE; + if (!dcDst->funcs->pStretchBlt) return FALSE; + dcSrc = (DC *) GDI_GetObjPtr( hdcSrc, DC_MAGIC ); + dprintf_bitblt(stddeb, + "StretchBlt32: %04x %d,%d %dx%dx%d -> %04x %d,%d %dx%dx%d rop=%06lx\n", + hdcSrc, xSrc, ySrc, widthSrc, heightSrc, + dcSrc ? dcSrc->w.bitsPerPixel : 0, hdcDst, xDst, yDst, + widthDst, heightDst, dcDst->w.bitsPerPixel, rop ); + return dcDst->funcs->pStretchBlt( dcDst, xDst, yDst, widthDst, heightDst, + dcSrc, xSrc, ySrc, widthSrc, heightSrc, + rop ); +} + + +/*********************************************************************** + * FastWindowFrame (GDI.400) + */ +BOOL16 FastWindowFrame( HDC16 hdc, const RECT16 *rect, + INT16 width, INT16 height, DWORD rop ) +{ + HBRUSH32 hbrush = SelectObject32( hdc, GetStockObject32( GRAY_BRUSH ) ); + PatBlt32( hdc, rect->left, rect->top, + rect->right - rect->left - width, height, rop ); + PatBlt32( hdc, rect->left, rect->top + height, width, + rect->bottom - rect->top - height, rop ); + PatBlt32( hdc, rect->left + width, rect->bottom, + rect->right - rect->left - width, -height, rop ); + PatBlt32( hdc, rect->right, rect->top, -width, + rect->bottom - rect->top - height, rop ); + SelectObject32( hdc, hbrush ); + return TRUE; +} diff --git a/graphics/metafiledrv/Makefile.in b/graphics/metafiledrv/Makefile.in index 1e39e5bfead..02de44ee88e 100644 --- a/graphics/metafiledrv/Makefile.in +++ b/graphics/metafiledrv/Makefile.in @@ -6,6 +6,7 @@ VPATH = @srcdir@ MODULE = metafiledrv C_SRCS = \ + bitblt.c \ init.c all: $(MODULE).o diff --git a/graphics/metafiledrv/bitblt.c b/graphics/metafiledrv/bitblt.c new file mode 100644 index 00000000000..34c6ad68d4a --- /dev/null +++ b/graphics/metafiledrv/bitblt.c @@ -0,0 +1,45 @@ +/* + * GDI bit-blit operations + * + * Copyright 1993, 1994 Alexandre Julliard + */ + +#include "gdi.h" +#include "metafile.h" +#include "metafiledrv.h" + +/*********************************************************************** + * MFDRV_PatBlt + */ +BOOL32 MFDRV_PatBlt( DC *dc, INT32 left, INT32 top, + INT32 width, INT32 height, DWORD rop ) +{ + MF_MetaParam6( dc, META_PATBLT, left, top, width, height, + HIWORD(rop), LOWORD(rop) ); + return TRUE; +} + + +/*********************************************************************** + * MFDRV_BitBlt + */ +BOOL32 MFDRV_BitBlt( DC *dcDst, INT32 xDst, INT32 yDst, + INT32 width, INT32 height, DC *dcSrc, + INT32 xSrc, INT32 ySrc, DWORD rop ) +{ + return MF_BitBlt( dcDst, xDst, yDst, width, height, + dcSrc, xSrc, ySrc, rop ); +} + + +/*********************************************************************** + * MFDRV_StretchBlt + */ +BOOL32 MFDRV_StretchBlt( DC *dcDst, INT32 xDst, INT32 yDst, + INT32 widthDst, INT32 heightDst, + DC *dcSrc, INT32 xSrc, INT32 ySrc, + INT32 widthSrc, INT32 heightSrc, DWORD rop ) +{ + return MF_StretchBlt( dcDst, xDst, yDst, widthDst, heightDst, + dcSrc, xSrc, ySrc, widthSrc, heightSrc, rop ); +} diff --git a/graphics/metafiledrv/init.c b/graphics/metafiledrv/init.c index dc11829ec9e..e8ad11dcc60 100644 --- a/graphics/metafiledrv/init.c +++ b/graphics/metafiledrv/init.c @@ -17,7 +17,7 @@ static BOOL32 MFDRV_DeleteDC( DC *dc ); static const DC_FUNCTIONS MFDRV_Funcs = { NULL, /* pArc */ - NULL, /* pBitBlt */ + MFDRV_BitBlt, /* pBitBlt */ NULL, /* pChord */ NULL, /* pCreateDC */ MFDRV_DeleteDC, /* pDeleteDC */ @@ -42,7 +42,7 @@ static const DC_FUNCTIONS MFDRV_Funcs = NULL, /* pOffsetViewportOrgEx */ NULL, /* pOffsetWindowOrgEx */ NULL, /* pPaintRgn */ - NULL, /* pPatBlt */ + MFDRV_PatBlt, /* pPatBlt */ NULL, /* pPie */ NULL, /* pPolyPolygon */ NULL, /* pPolygon */ @@ -76,7 +76,7 @@ static const DC_FUNCTIONS MFDRV_Funcs = NULL, /* pSetViewportOrgEx */ NULL, /* pSetWindowExtEx */ NULL, /* pSetWindowOrgEx */ - NULL, /* pStretchBlt */ + MFDRV_StretchBlt, /* pStretchBlt */ NULL, /* pStretchDIBits */ NULL /* pTextOut */ }; @@ -146,7 +146,6 @@ HDC16 CreateMetaFile16( LPCSTR filename ) METAFILEDRV_PDEVICE *physDev; HFILE hFile; - printf( "CreateMetafile16: '%s'\n", filename ); dprintf_metafile( stddeb, "CreateMetaFile16: '%s'\n", filename ); if (!(dc = MFDRV_AllocMetaFile())) return 0; diff --git a/graphics/x11drv/Makefile.in b/graphics/x11drv/Makefile.in index a197fd77827..77883a2dcac 100644 --- a/graphics/x11drv/Makefile.in +++ b/graphics/x11drv/Makefile.in @@ -6,6 +6,7 @@ VPATH = @srcdir@ MODULE = x11drv C_SRCS = \ + bitblt.c \ clipping.c \ font.c \ init.c diff --git a/objects/bitblt.c b/graphics/x11drv/bitblt.c similarity index 90% rename from objects/bitblt.c rename to graphics/x11drv/bitblt.c index 1bf865778a9..d037d13d901 100644 --- a/objects/bitblt.c +++ b/graphics/x11drv/bitblt.c @@ -14,8 +14,8 @@ #include "dc.h" #include "metafile.h" #include "options.h" +#include "x11drv.h" #include "stddebug.h" -/* #define DEBUG_BITBLT */ #include "debug.h" #include "xmalloc.h" @@ -521,10 +521,10 @@ main() * Stretch a row of pixels. Helper function for BITBLT_StretchImage. */ static void BITBLT_StretchRow( int *rowSrc, int *rowDst, - short startDst, short widthDst, - int xinc, WORD mode ) + INT32 startDst, INT32 widthDst, + INT32 xinc, WORD mode ) { - register int xsrc = xinc * startDst; + register INT32 xsrc = xinc * startDst; rowDst += startDst; switch(mode) { @@ -550,10 +550,10 @@ static void BITBLT_StretchRow( int *rowSrc, int *rowDst, * Shrink a row of pixels. Helper function for BITBLT_StretchImage. */ static void BITBLT_ShrinkRow( int *rowSrc, int *rowDst, - short startSrc, short widthSrc, - int xinc, WORD mode ) + INT32 startSrc, INT32 widthSrc, + INT32 xinc, WORD mode ) { - register int xdst = xinc * startSrc; + register INT32 xdst = xinc * startSrc; rowSrc += startSrc; switch(mode) { @@ -578,11 +578,11 @@ static void BITBLT_ShrinkRow( int *rowSrc, int *rowDst, * * Retrieve a row from an image. Helper function for BITBLT_StretchImage. */ -static void BITBLT_GetRow( XImage *image, int *pdata, short row, - short start, short width, short depthDst, - int fg, int bg, BOOL swap) +static void BITBLT_GetRow( XImage *image, int *pdata, INT32 row, + INT32 start, INT32 width, INT32 depthDst, + int fg, int bg, BOOL32 swap) { - register short i; + register INT32 i; pdata += swap ? start+width-1 : start; if (image->depth == depthDst) /* color -> color */ @@ -627,17 +627,18 @@ static void BITBLT_GetRow( XImage *image, int *pdata, short row, * BITBLT_StretchImage * * Stretch an X image. + * FIXME: does not work for full 32-bit coordinates. */ static void BITBLT_StretchImage( XImage *srcImage, XImage *dstImage, - short widthSrc, short heightSrc, - short widthDst, short heightDst, - RECT16 *visRectSrc, RECT16 *visRectDst, + INT32 widthSrc, INT32 heightSrc, + INT32 widthDst, INT32 heightDst, + RECT32 *visRectSrc, RECT32 *visRectDst, int foreground, int background, WORD mode ) { int *rowSrc, *rowDst, *pixel; - int xinc, yinc, ysrc, ydst; - register short x, y; - BOOL hstretch, vstretch, hswap, vswap; + INT32 xinc, yinc, ysrc, ydst; + register INT32 x, y; + BOOL32 hstretch, vstretch, hswap, vswap; hswap = ((int)widthSrc * widthDst) < 0; vswap = ((int)heightSrc * heightDst) < 0; @@ -774,18 +775,18 @@ static void BITBLT_StretchImage( XImage *srcImage, XImage *dstImage, */ static void BITBLT_GetSrcAreaStretch( DC *dcSrc, DC *dcDst, Pixmap pixmap, GC gc, - short xSrc, short ySrc, - short widthSrc, short heightSrc, - short xDst, short yDst, - short widthDst, short heightDst, - RECT16 *visRectSrc, RECT16 *visRectDst ) + INT32 xSrc, INT32 ySrc, + INT32 widthSrc, INT32 heightSrc, + INT32 xDst, INT32 yDst, + INT32 widthDst, INT32 heightDst, + RECT32 *visRectSrc, RECT32 *visRectDst ) { XImage *imageSrc, *imageDst; - RECT16 rectSrc = *visRectSrc; - RECT16 rectDst = *visRectDst; - OffsetRect16( &rectSrc, -xSrc, -ySrc ); - OffsetRect16( &rectDst, -xDst, -yDst ); + RECT32 rectSrc = *visRectSrc; + RECT32 rectDst = *visRectDst; + OffsetRect32( &rectSrc, -xSrc, -ySrc ); + OffsetRect32( &rectDst, -xDst, -yDst ); /* FIXME: avoid BadMatch errors */ imageSrc = XGetImage( display, dcSrc->u.x.drawable, visRectSrc->left, visRectSrc->top, @@ -813,13 +814,12 @@ static void BITBLT_GetSrcAreaStretch( DC *dcSrc, DC *dcDst, * pixels to Windows colors. */ static void BITBLT_GetSrcArea( DC *dcSrc, DC *dcDst, Pixmap pixmap, GC gc, - short xSrc, short ySrc, - RECT16 *visRectSrc ) + INT32 xSrc, INT32 ySrc, RECT32 *visRectSrc ) { XImage *imageSrc, *imageDst; - register short x, y; - short width = visRectSrc->right - visRectSrc->left; - short height = visRectSrc->bottom - visRectSrc->top; + register INT32 x, y; + INT32 width = visRectSrc->right - visRectSrc->left; + INT32 height = visRectSrc->bottom - visRectSrc->top; if (dcSrc->w.bitsPerPixel == dcDst->w.bitsPerPixel) { @@ -899,10 +899,10 @@ static void BITBLT_GetSrcArea( DC *dcSrc, DC *dcDst, Pixmap pixmap, GC gc, * Retrieve an area from the destination DC, mapping all the * pixels to Windows colors. */ -static void BITBLT_GetDstArea(DC *dc, Pixmap pixmap, GC gc, RECT16 *visRectDst) +static void BITBLT_GetDstArea(DC *dc, Pixmap pixmap, GC gc, RECT32 *visRectDst) { - short width = visRectDst->right - visRectDst->left; - short height = visRectDst->bottom - visRectDst->top; + INT32 width = visRectDst->right - visRectDst->left; + INT32 height = visRectDst->bottom - visRectDst->top; if (!COLOR_PixelToPalette || (dc->w.bitsPerPixel == 1) || (COLOR_GetSystemPaletteFlags() & COLOR_VIRTUAL) ) @@ -912,7 +912,7 @@ static void BITBLT_GetDstArea(DC *dc, Pixmap pixmap, GC gc, RECT16 *visRectDst) } else { - register short x, y; + register INT32 x, y; XImage *image; if (dc->w.flags & DC_MEMORY) @@ -942,10 +942,10 @@ static void BITBLT_GetDstArea(DC *dc, Pixmap pixmap, GC gc, RECT16 *visRectDst) * Put an area back into the destination DC, mapping the pixel * colors to X pixels. */ -static void BITBLT_PutDstArea(DC *dc, Pixmap pixmap, GC gc, RECT16 *visRectDst) +static void BITBLT_PutDstArea(DC *dc, Pixmap pixmap, GC gc, RECT32 *visRectDst) { - short width = visRectDst->right - visRectDst->left; - short height = visRectDst->bottom - visRectDst->top; + INT32 width = visRectDst->right - visRectDst->left; + INT32 height = visRectDst->bottom - visRectDst->top; /* !COLOR_PaletteToPixel is _NOT_ enough */ @@ -957,7 +957,7 @@ static void BITBLT_PutDstArea(DC *dc, Pixmap pixmap, GC gc, RECT16 *visRectDst) } else { - register short x, y; + register INT32 x, y; XImage *image = XGetImage( display, pixmap, 0, 0, width, height, AllPlanes, ZPixmap ); for (y = 0; y < height; y++) @@ -979,13 +979,13 @@ static void BITBLT_PutDstArea(DC *dc, Pixmap pixmap, GC gc, RECT16 *visRectDst) * Get the source and destination visible rectangles for StretchBlt(). * Return FALSE if one of the rectangles is empty. */ -static BOOL BITBLT_GetVisRectangles( DC *dcDst, short xDst, short yDst, - short widthDst, short heightDst, - DC *dcSrc, short xSrc, short ySrc, - short widthSrc, short heightSrc, - RECT16 *visRectSrc, RECT16 *visRectDst ) +static BOOL32 BITBLT_GetVisRectangles( DC *dcDst, INT32 xDst, INT32 yDst, + INT32 widthDst, INT32 heightDst, + DC *dcSrc, INT32 xSrc, INT32 ySrc, + INT32 widthSrc, INT32 heightSrc, + RECT32 *visRectSrc, RECT32 *visRectDst ) { - RECT16 tmpRect, clipRect; + RECT32 tmpRect, clipRect; if (widthSrc < 0) { widthSrc = -widthSrc; xSrc -= widthSrc; } if (widthDst < 0) { widthDst = -widthDst; xDst -= widthDst; } @@ -994,28 +994,28 @@ static BOOL BITBLT_GetVisRectangles( DC *dcDst, short xDst, short yDst, /* Get the destination visible rectangle */ - SetRect16( &tmpRect, xDst, yDst, xDst + widthDst, yDst + heightDst ); - GetRgnBox16( dcDst->w.hGCClipRgn, &clipRect ); - OffsetRect16( &clipRect, dcDst->w.DCOrgX, dcDst->w.DCOrgY ); - if (!IntersectRect16( visRectDst, &tmpRect, &clipRect )) return FALSE; + SetRect32( &tmpRect, xDst, yDst, xDst + widthDst, yDst + heightDst ); + GetRgnBox32( dcDst->w.hGCClipRgn, &clipRect ); + OffsetRect32( &clipRect, dcDst->w.DCOrgX, dcDst->w.DCOrgY ); + if (!IntersectRect32( visRectDst, &tmpRect, &clipRect )) return FALSE; /* Get the source visible rectangle */ if (!dcSrc) return TRUE; - SetRect16( &tmpRect, xSrc, ySrc, xSrc + widthSrc, ySrc + heightSrc ); + SetRect32( &tmpRect, xSrc, ySrc, xSrc + widthSrc, ySrc + heightSrc ); /* Apparently the clip region is only for output, so use hVisRgn here */ - GetRgnBox16( dcSrc->w.hVisRgn, &clipRect ); - OffsetRect16( &clipRect, dcSrc->w.DCOrgX, dcSrc->w.DCOrgY ); - if (!IntersectRect16( visRectSrc, &tmpRect, &clipRect )) return FALSE; + GetRgnBox32( dcSrc->w.hVisRgn, &clipRect ); + OffsetRect32( &clipRect, dcSrc->w.DCOrgX, dcSrc->w.DCOrgY ); + if (!IntersectRect32( visRectSrc, &tmpRect, &clipRect )) return FALSE; /* Intersect the rectangles */ if ((widthSrc == widthDst) && (heightSrc == heightDst)) /* no stretching */ { - OffsetRect16( visRectSrc, xDst - xSrc, yDst - ySrc ); - if (!IntersectRect16( &tmpRect, visRectSrc, visRectDst )) return FALSE; + OffsetRect32( visRectSrc, xDst - xSrc, yDst - ySrc ); + if (!IntersectRect32( &tmpRect, visRectSrc, visRectDst )) return FALSE; *visRectSrc = *visRectDst = tmpRect; - OffsetRect16( visRectSrc, xSrc - xDst, ySrc - yDst ); + OffsetRect32( visRectSrc, xSrc - xDst, ySrc - yDst ); } else /* stretching */ { @@ -1025,7 +1025,7 @@ static BOOL BITBLT_GetVisRectangles( DC *dcDst, short xDst, short yDst, ((visRectSrc->right-xSrc) * widthDst) / widthSrc; visRectSrc->bottom = yDst + ((visRectSrc->bottom-ySrc) * heightDst) / heightSrc; - if (!IntersectRect16( &tmpRect, visRectSrc, visRectDst )) return FALSE; + if (!IntersectRect32( &tmpRect, visRectSrc, visRectDst )) return FALSE; *visRectSrc = *visRectDst = tmpRect; visRectSrc->left = xSrc + (visRectSrc->left-xDst)*widthSrc/widthDst; visRectSrc->top = ySrc + (visRectSrc->top-yDst)*heightSrc/heightDst; @@ -1033,7 +1033,7 @@ static BOOL BITBLT_GetVisRectangles( DC *dcDst, short xDst, short yDst, ((visRectSrc->right-xDst) * widthSrc) / widthDst; visRectSrc->bottom = ySrc + ((visRectSrc->bottom-yDst) * heightSrc) / heightDst; - if (IsRectEmpty16( visRectSrc )) return FALSE; + if (IsRectEmpty32( visRectSrc )) return FALSE; } return TRUE; } @@ -1044,14 +1044,14 @@ static BOOL BITBLT_GetVisRectangles( DC *dcDst, short xDst, short yDst, * * Implementation of PatBlt(), BitBlt() and StretchBlt(). */ -BOOL BITBLT_InternalStretchBlt( DC *dcDst, short xDst, short yDst, - short widthDst, short heightDst, - DC *dcSrc, short xSrc, short ySrc, - short widthSrc, short heightSrc, DWORD rop ) +BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst, + INT32 widthDst, INT32 heightDst, + DC *dcSrc, INT32 xSrc, INT32 ySrc, + INT32 widthSrc, INT32 heightSrc, DWORD rop ) { - BOOL usePat, useSrc, useDst, destUsed, fStretch, fNullBrush; - RECT16 visRectDst, visRectSrc; - short width, height; + BOOL32 usePat, useSrc, useDst, destUsed, fStretch, fNullBrush; + RECT32 visRectDst, visRectSrc; + INT32 width, height; const BYTE *opcode; Pixmap pixmaps[3] = { 0, 0, 0 }; /* pixmaps for DST, SRC, TMP */ GC tmpGC = 0; @@ -1285,24 +1285,11 @@ BOOL BITBLT_InternalStretchBlt( DC *dcDst, short xDst, short yDst, /*********************************************************************** - * PatBlt (GDI.29) + * X11DRV_PatBlt */ -BOOL PatBlt( HDC16 hdc, short left, short top, - short width, short height, DWORD rop) +BOOL32 X11DRV_PatBlt( DC *dc, INT32 left, INT32 top, + INT32 width, INT32 height, DWORD rop ) { - DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); - if (!dc) - { - dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC); - if (!dc) return FALSE; - MF_MetaParam6(dc, META_PATBLT, left, top, width, height, - HIWORD(rop), LOWORD(rop)); - return TRUE; - } - - dprintf_bitblt(stddeb, "PatBlt: %04x %d,%d %dx%d %06lx\n", - hdc, left, top, width, height, rop ); - return CallTo32_LargeStack( (int(*)())BITBLT_InternalStretchBlt, 11, dc, left, top, width, height, NULL, 0, 0, 0, 0, rop ); @@ -1310,27 +1297,12 @@ BOOL PatBlt( HDC16 hdc, short left, short top, /*********************************************************************** - * BitBlt (GDI.34) + * X11DRV_BitBlt */ -BOOL BitBlt( HDC16 hdcDst, INT xDst, INT yDst, INT width, INT height, - HDC16 hdcSrc, INT xSrc, INT ySrc, DWORD rop ) +BOOL32 X11DRV_BitBlt( DC *dcDst, INT32 xDst, INT32 yDst, + INT32 width, INT32 height, DC *dcSrc, + INT32 xSrc, INT32 ySrc, DWORD rop ) { - DC *dcDst, *dcSrc; - - if (!(dcDst = (DC *)GDI_GetObjPtr( hdcDst, DC_MAGIC ))) - { - dcDst = (DC *)GDI_GetObjPtr( hdcDst, METAFILE_DC_MAGIC ); - if (!dcDst) return FALSE; - return MF_BitBlt( dcDst, xDst, yDst, width, height, - hdcSrc, xSrc, ySrc, rop ); - } - dcSrc = (DC *) GDI_GetObjPtr( hdcSrc, DC_MAGIC ); - - dprintf_bitblt(stddeb, - "BitBlt: hdcSrc=%04x %d,%d %d bpp -> hdcDest=%04x %d,%d %dx%dx%d rop=%06lx\n", - hdcSrc, xSrc, ySrc, dcSrc ? dcSrc->w.bitsPerPixel : 0, - hdcDst, xDst, yDst, width, height, dcDst->w.bitsPerPixel, rop); - return CallTo32_LargeStack( (int(*)())BITBLT_InternalStretchBlt, 11, dcDst, xDst, yDst, width, height, dcSrc, xSrc, ySrc, width, height, rop ); @@ -1338,39 +1310,14 @@ BOOL BitBlt( HDC16 hdcDst, INT xDst, INT yDst, INT width, INT height, /*********************************************************************** - * StretchBlt (GDI.35) + * X11DRV_StretchBlt */ -BOOL StretchBlt( HDC16 hdcDst, short xDst, short yDst, - short widthDst, short heightDst, - HDC16 hdcSrc, short xSrc, short ySrc, - short widthSrc, short heightSrc, DWORD rop ) +BOOL32 X11DRV_StretchBlt( DC *dcDst, INT32 xDst, INT32 yDst, + INT32 widthDst, INT32 heightDst, + DC *dcSrc, INT32 xSrc, INT32 ySrc, + INT32 widthSrc, INT32 heightSrc, DWORD rop ) { - DC *dcDst, *dcSrc; - - if (!(dcDst = (DC *) GDI_GetObjPtr( hdcDst, DC_MAGIC ))) - { - if (!(dcDst = (DC *)GDI_GetObjPtr( hdcDst, METAFILE_DC_MAGIC ))) - return FALSE; - return MF_StretchBlt( dcDst, xDst, yDst, widthDst, heightDst, - hdcSrc, xSrc, ySrc, widthSrc, heightSrc, rop ); - } - - dcSrc = (DC *) GDI_GetObjPtr( hdcSrc, DC_MAGIC ); - dprintf_bitblt(stddeb, - "StretchBlt: %04x %d,%d %dx%dx%d -> %04x %d,%d %dx%dx%d rop=%06lx\n", - hdcSrc, xSrc, ySrc, widthSrc, heightSrc, - dcSrc ? dcSrc->w.bitsPerPixel : 0, hdcDst, xDst, yDst, - widthDst, heightDst, dcDst->w.bitsPerPixel, rop ); - return CallTo32_LargeStack( (int(*)())BITBLT_InternalStretchBlt, 11, dcDst, xDst, yDst, widthDst, heightDst, dcSrc, xSrc, ySrc, widthSrc, heightSrc, rop ); } -/*********************************************************************** - * FastWindowFrame (GDI.400) - */ -WORD -FastWindowFrame(WORD x1,DWORD x2,WORD x3,WORD x4,DWORD x5) { - dprintf_gdi(stdnimp,"FastWindowFrame (%04x, %08lx, %04x, %04x, %08lx) // unimplemented!\n",x1,x2,x3,x4,x5); - return 0xFFFF; /* failed? */ -} diff --git a/graphics/x11drv/init.c b/graphics/x11drv/init.c index 5d43e8ddb63..4841c2b6774 100644 --- a/graphics/x11drv/init.c +++ b/graphics/x11drv/init.c @@ -17,7 +17,7 @@ static BOOL32 X11DRV_DeleteDC( DC *dc ); static const DC_FUNCTIONS X11DRV_Funcs = { NULL, /* pArc */ - NULL, /* pBitBlt */ + X11DRV_BitBlt, /* pBitBlt */ NULL, /* pChord */ X11DRV_CreateDC, /* pCreateDC */ X11DRV_DeleteDC, /* pDeleteDC */ @@ -42,7 +42,7 @@ static const DC_FUNCTIONS X11DRV_Funcs = NULL, /* pOffsetViewportOrgEx */ NULL, /* pOffsetWindowOrgEx */ NULL, /* pPaintRgn */ - NULL, /* pPatBlt */ + X11DRV_PatBlt, /* pPatBlt */ NULL, /* pPie */ NULL, /* pPolyPolygon */ NULL, /* pPolygon */ @@ -76,7 +76,7 @@ static const DC_FUNCTIONS X11DRV_Funcs = NULL, /* pSetViewportOrgEx */ NULL, /* pSetWindowExtEx */ NULL, /* pSetWindowOrgEx */ - NULL, /* pStretchBlt */ + X11DRV_StretchBlt, /* pStretchBlt */ NULL, /* pStretchDIBits */ NULL /* pTextOut */ }; diff --git a/if1632/Makefile.in b/if1632/Makefile.in index 62c579b7cb6..9efa8c964ce 100644 --- a/if1632/Makefile.in +++ b/if1632/Makefile.in @@ -45,6 +45,7 @@ DLLS = \ version.spec \ w32sys.spec \ win87em.spec \ + wing.spec \ winmm.spec \ winsock.spec \ winspool.spec \ diff --git a/if1632/crtdll.spec b/if1632/crtdll.spec index bd0723409ea..6e15693f0b9 100644 --- a/if1632/crtdll.spec +++ b/if1632/crtdll.spec @@ -287,7 +287,7 @@ base 1 282 cdecl _strcmpi(ptr ptr) lstrcmpi32A 283 stub _strdate 284 stub _strdec -285 stub _strdup +285 cdecl _strdup(ptr) CRTDLL__strdup 286 stub _strerror 287 cdecl _stricmp(ptr ptr) lstrcmpi32A 288 stub _stricoll @@ -364,7 +364,7 @@ base 1 359 cdecl exit(long) CRTDLL_exit 360 cdecl exp(long) CRTDLL_exp 361 cdecl fabs(long) CRTDLL_fabs -362 stub fclose +362 cdecl fclose(ptr) CRTDLL_fclose 363 stub feof 364 stub ferror 365 cdecl fflush(ptr) CRTDLL_fflush @@ -433,11 +433,11 @@ base 1 428 stub mblen 429 stub mbstowcs 430 stub mbtowc -431 stub memchr -432 stub memcmp -433 stub memcpy -434 stub memmove -435 stub memset +431 cdecl memchr(ptr long long) memchr +432 cdecl memcmp(ptr ptr long) memcmp +433 cdecl memcpy(ptr ptr long) memcpy +434 cdecl memmove(ptr ptr long) memmove +435 cdecl memset(ptr long long) memset 436 stub mktime 437 stub modf 438 stub perror @@ -460,16 +460,16 @@ base 1 455 stub signal 456 cdecl sin(long) CRTDLL_sin 457 cdecl sinh(long) CRTDLL_sinh -458 stub sprintf +458 cdecl sprintf() CRTDLL_sprintf 459 cdecl sqrt(long) CRTDLL_sqrt 460 cdecl srand(long) CRTDLL_srand 461 stub sscanf 462 cdecl strcat(ptr ptr) lstrcat32A -463 stub strchr +463 cdecl strchr(ptr long) strchr 464 cdecl strcmp(ptr ptr) lstrcmp32A 465 stub strcoll 466 cdecl strcpy(ptr ptr) lstrcpy32A -467 stub strcspn +467 cdecl strcspn(ptr ptr) strcspn 468 stub strerror 469 stub strftime 470 cdecl strlen(ptr) lstrlen32A @@ -478,11 +478,11 @@ base 1 473 cdecl strncpy(ptr ptr long) lstrcpyn32A 474 stub strpbrk 475 stub strrchr -476 stub strspn -477 stub strstr +476 cdecl strspn(ptr ptr) strspn +477 cdecl strstr(ptr ptr) strstr 478 stub strtod -479 stub strtok -480 stub strtol +479 cdecl strtok(ptr ptr) strtok +480 cdecl strtol(ptr ptr long) strtol 481 cdecl strtoul(ptr ptr long) strtoul 482 stub strxfrm 483 stub swprintf diff --git a/if1632/gdi.spec b/if1632/gdi.spec index 2f0433c5002..4a8e1b5fe6d 100644 --- a/if1632/gdi.spec +++ b/if1632/gdi.spec @@ -33,15 +33,15 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) 27 pascal16 Rectangle(word s_word s_word s_word s_word) Rectangle16 28 pascal16 RoundRect(word s_word s_word s_word s_word s_word s_word) RoundRect16 -29 pascal16 PatBlt(word s_word s_word s_word s_word long) PatBlt +29 pascal16 PatBlt(word s_word s_word s_word s_word long) PatBlt16 30 pascal16 SaveDC(word) SaveDC 31 pascal SetPixel(word s_word s_word long) SetPixel16 32 pascal16 OffsetClipRgn(word s_word s_word) OffsetClipRgn16 33 pascal16 TextOut(word s_word s_word ptr word) TextOut16 34 pascal16 BitBlt( word s_word s_word s_word s_word word s_word s_word long) - BitBlt + BitBlt16 35 pascal16 StretchBlt(word s_word s_word s_word s_word word s_word s_word - s_word s_word long) StretchBlt + s_word s_word long) StretchBlt16 36 pascal16 Polygon (word ptr word) Polygon16 37 pascal16 Polyline (word ptr word) Polyline16 38 pascal Escape(word word word segptr segptr) Escape @@ -262,7 +262,7 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) 380 stub ENDPAGE 381 stub SETABORTPROC 382 stub ABORTDOC -400 pascal16 FastWindowFrame(word long word word long) FastWindowFrame +400 pascal16 FastWindowFrame(word ptr s_word s_word long) FastWindowFrame 401 stub GDIMOVEBITMAP 403 stub GDIINIT2 404 stub GetTTGlyphIndexMap diff --git a/if1632/gdi32.spec b/if1632/gdi32.spec index aad949ca84e..6c6853e0545 100644 --- a/if1632/gdi32.spec +++ b/if1632/gdi32.spec @@ -12,7 +12,7 @@ base 1 0007 stdcall Arc(long long long long long long long long long) Arc32 0008 stub ArcTo 0009 stub BeginPath -0010 stdcall BitBlt(long long long long long long long long long) BitBlt +0010 stdcall BitBlt(long long long long long long long long long) BitBlt32 0011 stub CancelDC 0012 stub CheckColorsInGamut 0013 stub ChoosePixelFormat @@ -85,10 +85,10 @@ base 1 0077 stub EndPage 0078 stub EndPath 0079 stub EnumEnhMetaFile -0080 stub EnumFontFamiliesA +0080 stdcall EnumFontFamiliesA(long ptr ptr long) THUNK_EnumFontFamilies32A 0081 stub EnumFontFamiliesExA 0082 stub EnumFontFamiliesExW -0083 stub EnumFontFamiliesW +0083 stdcall EnumFontFamiliesW(long ptr ptr long) THUNK_EnumFontFamilies32W 0084 stub EnumFontsA 0085 stub EnumFontsW 0086 stub EnumICMProfilesA @@ -265,7 +265,7 @@ base 1 0257 stdcall OffsetViewportOrgEx(long long long ptr) OffsetViewportOrgEx32 0258 stdcall OffsetWindowOrgEx(long long long ptr) OffsetWindowOrgEx32 0259 stdcall PaintRgn(long long) PaintRgn32 -0260 stdcall PatBlt(long long long long long long) PatBlt +0260 stdcall PatBlt(long long long long long long) PatBlt32 0261 stub PathToRegion 0262 stdcall Pie(long long long long long long long long long) Pie32 0263 stub PlayEnhMetaFile @@ -356,7 +356,8 @@ base 1 0347 stub StartDocA 0348 stub StartDocW 0349 stub StartPage -0350 stdcall StretchBlt(long long long long long long long long long long long) StretchBlt +0350 stdcall StretchBlt(long long long long long long long long long long long) + StretchBlt32 0351 stdcall StretchDIBits(long long long long long long long long long long long long long) StretchDIBits 0352 stub StrokeAndFillPath diff --git a/if1632/kernel32.spec b/if1632/kernel32.spec index ca3fc9b78e7..ecf60202819 100644 --- a/if1632/kernel32.spec +++ b/if1632/kernel32.spec @@ -78,7 +78,7 @@ base 1 0073 stub DeviceIoControl 0074 stub DisableThreadLibraryCalls 0075 stub DisconnectNamedPipe -0076 stub DosDateTimeToFileTime +0076 stdcall DosDateTimeToFileTime(long long ptr) DosDateTimeToFileTime 0077 stub DuplicateConsoleHandle 0078 stdcall DuplicateHandle(long long long ptr long long long) DuplicateHandle 0079 stub EndUpdateResourceA @@ -94,8 +94,8 @@ base 1 0089 stub EnumResourceNamesW 0090 stub EnumResourceTypesA 0091 stub EnumResourceTypesW -0092 stub EnumSystemCodePagesA -0093 stub EnumSystemCodePagesW +0092 stdcall EnumSystemCodePagesA(ptr long) THUNK_EnumSystemCodePages32A +0093 stdcall EnumSystemCodePagesW(ptr long) THUNK_EnumSystemCodePages32W 0094 stub EnumSystemLocalesA 0095 stub EnumSystemLocalesW 0096 stub EnumTimeFormatsA @@ -113,9 +113,9 @@ base 1 0108 stub FatalAppExitA 0109 stub FatalAppExitW 0110 stub FatalExit -0111 stub FileTimeToDosDateTime -0112 stub FileTimeToLocalFileTime -0113 stub FileTimeToSystemTime +0111 stdcall FileTimeToDosDateTime(ptr ptr ptr) FileTimeToDosDateTime +0112 stdcall FileTimeToLocalFileTime(ptr ptr) FileTimeToLocalFileTime +0113 stdcall FileTimeToSystemTime(ptr ptr) FileTimeToSystemTime 0114 stub FillConsoleOutputAttribute 0115 stub FillConsoleOutputCharacterA 0116 stub FillConsoleOutputCharacterW @@ -222,22 +222,22 @@ base 1 0217 stdcall GetFileAttributesA(ptr) GetFileAttributes32A 0218 stdcall GetFileAttributesW(ptr) GetFileAttributes32W 0219 stdcall GetFileInformationByHandle(long ptr) GetFileInformationByHandle -0220 stub GetFileSize -0221 stub GetFileTime -0222 stdcall GetFileType(long) GetFileType +0220 stdcall GetFileSize(long ptr ptr) GetFileSize +0221 stdcall GetFileTime(long ptr ptr ptr) GetFileTime +0222 stdcall GetFileType(long) GetFileType 0223 stdcall GetFullPathNameA(ptr long ptr ptr) GetFullPathName32A 0224 stub GetFullPathNameW 0225 stub GetHandleInformation 0226 stdcall GetLargestConsoleWindowSize(long) GetLargestConsoleWindowSize -0227 stdcall GetLastError() GetLastError -0228 stdcall GetLocalTime(ptr) GetLocalTime +0227 stdcall GetLastError() GetLastError +0228 stdcall GetLocalTime(ptr) GetLocalTime 0229 stdcall GetLocaleInfoA(long long ptr long) GetLocaleInfoA 0230 stdcall GetLocaleInfoW(long long ptr long) GetLocaleInfo32W 0231 stdcall GetLogicalDriveStringsA(long ptr) GetLogicalDriveStrings32A 0232 stdcall GetLogicalDriveStringsW(long ptr) GetLogicalDriveStrings32W 0233 stdcall GetLogicalDrives() GetLogicalDrives 0234 stub GetMailslotInfo -0235 stdcall GetModuleFileNameA(long ptr long) GetModuleFileNameA +0235 stdcall GetModuleFileNameA(long ptr long) GetModuleFileName 0236 stub GetModuleFileNameW 0237 stdcall GetModuleHandleA(ptr) WIN32_GetModuleHandle 0238 stub GetModuleHandleW @@ -286,7 +286,7 @@ base 1 0281 stdcall GetSystemDefaultLangID() GetSystemDefaultLangID 0282 stdcall GetSystemDirectoryA(ptr long) GetSystemDirectory32A 0283 stdcall GetSystemDirectoryW(ptr long) GetSystemDirectory32W -0284 stub GetSystemInfo +0284 stdcall GetSystemInfo(ptr) GetSystemInfo 0285 stdcall GetSystemTime(ptr) GetSystemTime 0286 stub GetSystemTimeAdjustment 0287 stub GetTapeParameters @@ -375,7 +375,7 @@ base 1 0370 stdcall LoadResource(long long) LoadResource32 0371 stdcall LocalAlloc(long long) LocalAlloc32 0372 stdcall LocalCompact(long) LocalCompact32 -0373 stub LocalFileTimeToFileTime +0373 stdcall LocalFileTimeToFileTime(ptr ptr) LocalFileTimeToFileTime 0374 stdcall LocalFlags(long) LocalFlags32 0375 stdcall LocalFree(long) LocalFree32 0376 stdcall LocalHandle(ptr) LocalHandle32 @@ -387,7 +387,7 @@ base 1 0382 stub LockFile 0383 stub LockFileEx 0384 stdcall LockResource(long) LockResource32 -0385 stub MapViewOfFile +0385 stdcall MapViewOfFile(long long long long long) MapViewOfFile 0386 stdcall MapViewOfFileEx(long long long long long long) MapViewOfFileEx 0387 stdcall MoveFileA(ptr ptr) MoveFile32A 0388 stub MoveFileExA @@ -494,8 +494,8 @@ base 1 0489 stub SetFileApisToOEM 0490 stdcall SetFileAttributesA(ptr long) SetFileAttributes32A 0491 stdcall SetFileAttributesW(ptr long) SetFileAttributes32W -0492 stdcall SetFilePointer(long long ptr long) SetFilePointer -0493 stub SetFileTime +0492 stdcall SetFilePointer(long long ptr long) SetFilePointer +0493 stdcall SetFileTime(long ptr ptr ptr) SetFileTime 0494 stdcall SetHandleCount(long) SetHandleCount32 0495 stub SetHandleInformation 0496 stub SetLastConsoleEventActive @@ -528,7 +528,7 @@ base 1 0523 stdcall Sleep(long) Sleep 0524 stub SleepEx 0525 stub SuspendThread -0526 stub SystemTimeToFileTime +0526 stdcall SystemTimeToFileTime(ptr ptr) SystemTimeToFileTime 0527 stub SystemTimeToTzSpecificLocalTime 0528 stub TerminateProcess 0529 stub TerminateThread @@ -568,7 +568,7 @@ base 1 0563 stub WaitNamedPipeA 0564 stub WaitNamedPipeW 0565 stdcall WideCharToMultiByte(long long ptr long ptr long ptr ptr) WideCharToMultiByte -0566 stub WinExec +0566 stdcall WinExec(ptr long) WinExec 0567 stub WriteConsoleA 0568 stub WriteConsoleInputA 0569 stub WriteConsoleInputVDMA @@ -636,7 +636,7 @@ base 1 0630 stdcall SetSystemPowerState(long long) SetSystemPowerState 0631 stub WritePrivateProfileStructA 0632 stub WritePrivateProfileStructW -0633 stub MakeCriticalSectionGlobal +0633 stdcall MakeCriticalSectionGlobal(ptr) MakeCriticalSectionGlobal #extra late additions 0634 stdcall ThunkConnect32(ptr ptr ptr ptr ptr ptr) ThunkConnect32 0636 stub SUnMapLS diff --git a/if1632/ole32.spec b/if1632/ole32.spec index cf9311712f2..d6ff57b7787 100644 --- a/if1632/ole32.spec +++ b/if1632/ole32.spec @@ -109,7 +109,7 @@ base 1 104 stub OleGetClipboard 105 stub OleGetIconOfClass 106 stub OleGetIconOfFile -107 stub OleInitialize +107 return OleInitialize 4 0 108 stub OleInitializeWOW 109 stub OleIsCurrentClipboard 110 stub OleIsRunning diff --git a/if1632/thunk.c b/if1632/thunk.c index 844154293cf..348606f368d 100644 --- a/if1632/thunk.c +++ b/if1632/thunk.c @@ -139,7 +139,29 @@ INT16 THUNK_EnumFontFamilies16( HDC16 hdc, LPCSTR lpszFamily, FONTENUMPROC16 func, LPARAM lParam ) { DECL_THUNK( thunk, func, CallTo16_word_llwl ); - return EnumFontFamilies( hdc, lpszFamily, (FONTENUMPROC16)&thunk, lParam ); + return EnumFontFamilies16(hdc, lpszFamily, (FONTENUMPROC16)&thunk, lParam); +} + + +/************************************************************************* + * THUNK_EnumFontFamilies32A (GDI32.80) + */ +INT32 THUNK_EnumFontFamilies32A( HDC32 hdc, LPCSTR lpszFamily, + FONTENUMPROC32A func, LPARAM lParam ) +{ + DECL_THUNK( thunk, func, CallTo32_4 ); + return EnumFontFamilies32A(hdc,lpszFamily,(FONTENUMPROC32A)&thunk,lParam); +} + + +/************************************************************************* + * THUNK_EnumFontFamilies32W (GDI32.83) + */ +INT32 THUNK_EnumFontFamilies32W( HDC32 hdc, LPCWSTR lpszFamily, + FONTENUMPROC32W func, LPARAM lParam ) +{ + DECL_THUNK( thunk, func, CallTo32_4 ); + return EnumFontFamilies32W(hdc,lpszFamily,(FONTENUMPROC32W)&thunk,lParam); } @@ -279,6 +301,26 @@ INT32 THUNK_EnumPropsEx32W( HWND32 hwnd, PROPENUMPROCEX32W func, LPARAM lParam) } +/*********************************************************************** + * THUNK_EnumSystemCodePages32A (KERNEL32.92) + */ +BOOL32 THUNK_EnumSystemCodePages32A( CODEPAGE_ENUMPROC32A func, DWORD flags ) +{ + DECL_THUNK( thunk, func, CallTo32_1 ); + return EnumSystemCodePages32A( (CODEPAGE_ENUMPROC32A)&thunk, flags ); +} + + +/*********************************************************************** + * THUNK_EnumSystemCodePages32W (KERNEL32.93) + */ +BOOL32 THUNK_EnumSystemCodePages32W( CODEPAGE_ENUMPROC32W func, DWORD flags ) +{ + DECL_THUNK( thunk, func, CallTo32_1 ); + return EnumSystemCodePages32W( (CODEPAGE_ENUMPROC32W)&thunk, flags ); +} + + /*********************************************************************** * THUNK_GrayString16 (USER.185) */ diff --git a/if1632/user.spec b/if1632/user.spec index 77c3c6286b0..2ca9abf6994 100644 --- a/if1632/user.spec +++ b/if1632/user.spec @@ -61,7 +61,7 @@ heap 65520 58 pascal16 GetClassName(word ptr word) GetClassName16 59 pascal16 SetActiveWindow(word) SetActiveWindow 60 pascal16 GetActiveWindow() GetActiveWindow -61 pascal16 ScrollWindow(word s_word s_word ptr ptr) ScrollWindow +61 pascal16 ScrollWindow(word s_word s_word ptr ptr) ScrollWindow16 62 pascal16 SetScrollPos(word word s_word word) SetScrollPos16 63 pascal16 GetScrollPos(word word) GetScrollPos16 64 pascal16 SetScrollRange(word word s_word s_word word) SetScrollRange16 @@ -221,7 +221,7 @@ heap 65520 218 pascal16 DialogBoxIndirect(word word word segptr) DialogBoxIndirect16 219 pascal16 CreateDialogIndirect(word ptr word segptr) CreateDialogIndirect16 220 pascal16 LoadMenuIndirect(ptr) LoadMenuIndirect16 -221 pascal16 ScrollDC(word s_word s_word ptr ptr word ptr) ScrollDC +221 pascal16 ScrollDC(word s_word s_word ptr ptr word ptr) ScrollDC16 222 pascal16 GetKeyboardState(ptr) GetKeyboardState 223 pascal16 SetKeyboardState(ptr) SetKeyboardState 224 pascal16 GetWindowTask(word) GetWindowTask16 @@ -305,8 +305,7 @@ heap 65520 308 pascal DefDlgProc(word word word long) DefDlgProc16 309 pascal16 GetClipCursor(ptr) GetClipCursor16 314 stub SignalProc -319 pascal16 ScrollWindowEx(word s_word s_word ptr ptr word ptr word) - ScrollWindowEx +319 pascal16 ScrollWindowEx(word s_word s_word ptr ptr word ptr word) ScrollWindowEx16 320 stub SysErrorBox 321 stub SetEventHook 322 stub WinOldAppHackOMatic @@ -374,8 +373,8 @@ heap 65520 418 pascal16 SetMenuItemBitmaps(word word word word word) SetMenuItemBitmaps 420 pascal16 wsprintf() WIN16_wsprintf16 421 pascal16 wvsprintf(ptr ptr ptr) wvsprintf16 -422 stub DlgDirSelectEx -423 stub DlgDirSelectComboBoxEx +422 pascal16 DlgDirSelectEx(word ptr word word) DlgDirSelectEx16 +423 pascal16 DlgDirSelectComboBoxEx(word ptr word word) DlgDirSelectComboBoxEx16 427 pascal16 FindWindowEx(word word segptr ptr) FindWindowEx16 428 stub TileWindows 429 stub CascadeWindows diff --git a/if1632/user32.spec b/if1632/user32.spec index 0c123133300..7a484ba9f46 100644 --- a/if1632/user32.spec +++ b/if1632/user32.spec @@ -150,10 +150,10 @@ base 1 0143 stdcall DlgDirListComboBoxA(long ptr long long long) DlgDirListComboBox32A 0144 stdcall DlgDirListComboBoxW(long ptr long long long) DlgDirListComboBox32W 0145 stub DlgDirListW -0146 stub DlgDirSelectComboBoxExA -0147 stub DlgDirSelectComboBoxExW -0148 stub DlgDirSelectExA -0149 stub DlgDirSelectExW +0146 stdcall DlgDirSelectComboBoxExA(long ptr long long) DlgDirSelectComboBoxEx32A +0147 stdcall DlgDirSelectComboBoxExW(long ptr long long) DlgDirSelectComboBoxEx32W +0148 stdcall DlgDirSelectExA(long ptr long long) DlgDirSelectEx32A +0149 stdcall DlgDirSelectExW(long ptr long long) DlgDirSelectEx32W 0150 stub DragDetect 0151 stub DragObject 0152 stub DrawAnimatedRects @@ -162,7 +162,7 @@ base 1 0155 stdcall DrawFocusRect(long ptr) DrawFocusRect32 0156 stub DrawFrame 0157 stdcall DrawFrameControl(long ptr long long) DrawFrameControl32 -0158 stub DrawIcon +0158 stdcall DrawIcon(long long long long) DrawIcon 0159 stub DrawIconEx 0160 stdcall DrawMenuBar(long) DrawMenuBar 0161 stub DrawStateA @@ -230,7 +230,7 @@ base 1 0223 stub GetClipboardFormatNameW 0224 stub GetClipboardOwner 0225 stdcall GetClipboardViewer(long) GetClipboardViewer -0226 stub GetCursor +0226 stdcall GetCursor() GetCursor 0227 stub GetCursorInfo 0228 stdcall GetCursorPos(ptr) GetCursorPos32 0229 stdcall GetDC(long) GetDC32 @@ -296,7 +296,7 @@ base 1 0289 stdcall GetSysColorBrush(long) GetSysColorBrush32 0290 stdcall GetSystemMenu(long long) GetSystemMenu 0291 stdcall GetSystemMetrics(long) GetSystemMetrics -0292 stub GetTabbedTextExtentA +0292 stdcall GetTabbedTextExtentA(long ptr long long ptr) GetTabbedTextExtent 0293 stub GetTabbedTextExtentW 0294 stub GetThreadDesktop 0295 stub GetTopWindow @@ -452,9 +452,9 @@ base 1 0445 stub ReuseDDElParam 0446 stdcall ScreenToClient(long ptr) ScreenToClient32 0447 stub ScrollChildren -0448 stub ScrollDC -0449 stub ScrollWindow -0450 stub ScrollWindowEx +0448 stdcall ScrollDC(long long long ptr ptr long ptr) ScrollDC32 +0449 stdcall ScrollWindow(long long long ptr ptr) ScrollWindow32 +0450 stdcall ScrollWindowEx(long long long ptr ptr long ptr long) ScrollWindowEx32 0451 stdcall SendDlgItemMessageA(long long long long long) SendDlgItemMessage32A 0452 stdcall SendDlgItemMessageW(long long long long long) SendDlgItemMessage32W 0453 stdcall SendMessageA(long long long long) SendMessage32A @@ -485,7 +485,7 @@ base 1 0478 stdcall SetDlgItemTextW(long long ptr) SetDlgItemText32W 0479 stub SetDoubleClickTime 0480 stdcall SetFocus(long) SetFocus32 -0481 stub SetForegroundWindow +0481 return SetForegroundWindow 4 0 0482 stdcall SetInternalWindowPos(long long ptr ptr) SetInternalWindowPos32 0483 stub SetKeyboardState 0484 stdcall SetLastErrorEx(long long) SetLastErrorEx diff --git a/if1632/wing.spec b/if1632/wing.spec new file mode 100644 index 00000000000..ec1ab43d816 --- /dev/null +++ b/if1632/wing.spec @@ -0,0 +1,20 @@ +name wing +type win16 + +1001 stub WINGCREATEDC +1002 stub WINGRECOMMENDDIBFORMAT +1003 stub WINGCREATEBITMAP +1004 stub WINGGETDIBPOINTER +1005 stub WINGGETDIBCOLORTABLE +1006 stub WINGSETDIBCOLORTABLE +1007 stub WINGCREATEHALFTONEPALETTE +1008 stub WINGCREATEHALFTONEBRUSH +1009 stub WINGSTRETCHBLT +1010 stub WINGBITBLT + +# Seem that 1299 is the limit... weird... +#1500 stub WINGINITIALIZETHUNK16 +#1501 stub WINGTHUNK16 + +#2000 stub REGISTERWINGPAL +#2001 stub EXCEPTIONHANDLER diff --git a/include/callback.h b/include/callback.h index bf94586984b..2f603c24937 100644 --- a/include/callback.h +++ b/include/callback.h @@ -73,6 +73,7 @@ extern WORD CallTo16_regs_( FARPROC16 func, WORD ds, WORD es, WORD bp, WORD ax, /* by the build program to generate the file if1632/callto32.S */ extern LONG CallTo32_0( FARPROC32 ); +extern LONG CallTo32_1( FARPROC32, DWORD ); extern LONG CallTo32_2( FARPROC32, DWORD, DWORD ); extern LONG CallTo32_3( FARPROC32, DWORD, DWORD, DWORD ); extern LONG CallTo32_4( FARPROC32, DWORD, DWORD, DWORD, DWORD ); diff --git a/include/dos_fs.h b/include/dos_fs.h index 303cbbb07bd..4bb2b7f7627 100644 --- a/include/dos_fs.h +++ b/include/dos_fs.h @@ -26,12 +26,15 @@ typedef struct #define IS_END_OF_NAME(ch) (!(ch) || ((ch) == '/') || ((ch) == '\\')) extern void DOSFS_ToDosDateTime( time_t unixtime, WORD *pDate, WORD *pTime ); +extern time_t DOSFS_DosDateTimeToUnixTime(WORD,WORD); extern const char *DOSFS_ToDosFCBFormat( const char *name ); extern const char *DOSFS_ToDosDTAFormat( const char *name ); extern const char *DOSFS_IsDevice( const char *name ); extern const char * DOSFS_GetUnixFileName( const char * name, int check_last ); extern const char * DOSFS_GetDosTrueName( const char *name, int unix_format ); extern int DOSFS_GetDosFileName( const char *name, char *buffer, int len ); +extern time_t DOSFS_FileTimeToUnixTime(LPFILETIME ft); +extern void DOSFS_UnixTimeToFileTime(time_t unixtime,LPFILETIME ft); extern int DOSFS_FindNext( const char *path, const char *short_mask, const char *long_mask, int drive, BYTE attr, int skip, DOS_DIRENT *entry ); diff --git a/include/libres.h b/include/libres.h index 288f5ec302c..6014a3b4765 100644 --- a/include/libres.h +++ b/include/libres.h @@ -11,7 +11,8 @@ extern INT32 LIBRES_AccessResource( HINSTANCE32 hModule, HRSRC32 hRsrc ); extern HGLOBAL32 LIBRES_AllocResource( HINSTANCE32 hModule, HRSRC32 hRsrc, DWORD size ); -extern HRSRC32 LIBRES_FindResource( HINSTANCE32 hModule, LPCSTR name, LPCSTR type ); +extern HRSRC32 LIBRES_FindResource16( HINSTANCE32 hModule, LPCSTR name, LPCSTR type ); +extern HRSRC32 LIBRES_FindResource32( HINSTANCE32 hModule, LPCWSTR name, LPCWSTR type ); extern BOOL32 LIBRES_FreeResource( HGLOBAL32 handle ); extern HGLOBAL32 LIBRES_LoadResource( HINSTANCE32 hModule, HRSRC32 hRsrc ); extern LPVOID LIBRES_LockResource( HGLOBAL32 handle ); diff --git a/include/metafile.h b/include/metafile.h index a6378ddc43e..22e0b619deb 100644 --- a/include/metafile.h +++ b/include/metafile.h @@ -32,9 +32,9 @@ BOOL32 MF_ExtTextOut(DC *dc, short x, short y, UINT16 flags, const RECT16 *rect, LPCSTR str, short count, const INT16 *lpDx); BOOL32 MF_MetaPoly(DC *dc, short func, LPPOINT16 pt, short count); BOOL32 MF_BitBlt(DC *dcDest, short xDest, short yDest, short width, - short height, HDC16 hdcSrc, short xSrc, short ySrc, DWORD rop); + short height, DC *dcSrc, short xSrc, short ySrc, DWORD rop); BOOL32 MF_StretchBlt(DC *dcDest, short xDest, short yDest, short widthDest, - short heightDest, HDC16 hdcSrc, short xSrc, short ySrc, + short heightDest, DC *dcSrc, short xSrc, short ySrc, short widthSrc, short heightSrc, DWORD rop); #endif /* METAFILE_H */ diff --git a/include/metafiledrv.h b/include/metafiledrv.h index 519f3a584a1..14b2da5ad93 100644 --- a/include/metafiledrv.h +++ b/include/metafiledrv.h @@ -13,10 +13,24 @@ #define METAFILE_DISK 1 /* Metafile driver physical DC */ + typedef struct { METAHEADER *mh; /* Pointer to metafile header */ UINT32 nextHandle; /* Next handle number */ } METAFILEDRV_PDEVICE; + +/* Metafile driver functions */ + +extern BOOL32 MFDRV_BitBlt( struct tagDC *dcDst, INT32 xDst, INT32 yDst, + INT32 width, INT32 height, struct tagDC *dcSrc, + INT32 xSrc, INT32 ySrc, DWORD rop ); +extern BOOL32 MFDRV_PatBlt( struct tagDC *dc, INT32 left, INT32 top, + INT32 width, INT32 height, DWORD rop ); +extern BOOL32 MFDRV_StretchBlt( struct tagDC *dcDst, INT32 xDst, INT32 yDst, + INT32 widthDst, INT32 heightDst, + struct tagDC *dcSrc, INT32 xSrc, INT32 ySrc, + INT32 widthSrc, INT32 heightSrc, DWORD rop ); + #endif /* __WINE_METAFILEDRV_H */ diff --git a/include/region.h b/include/region.h index eb44f4f838f..c5818f11c42 100644 --- a/include/region.h +++ b/include/region.h @@ -18,7 +18,7 @@ typedef struct extern BOOL32 REGION_DeleteObject( HRGN32 hrgn, RGNOBJ * obj ); -extern BOOL32 REGION_UnionRectWithRgn( HRGN32 hrgn, LPRECT16 lpRect ); +extern BOOL32 REGION_UnionRectWithRgn( HRGN32 hrgn, const RECT32 *lpRect ); extern BOOL32 REGION_FrameRgn( HRGN32 dest, HRGN32 src, INT32 x, INT32 y ); #endif /* __WINE_REGION_H */ diff --git a/include/shell.h b/include/shell.h index 801d857bec0..4a7e0cd9c77 100644 --- a/include/shell.h +++ b/include/shell.h @@ -32,7 +32,7 @@ extern void SHELL_Init(); typedef struct { /* structure for dropped files */ WORD wSize; POINT16 ptMousePos; - BOOL fInNonClientArea; + BOOL16 fInNonClientArea; /* memory block with filenames follows */ } DROPFILESTRUCT, *LPDROPFILESTRUCT; diff --git a/include/windows.h b/include/windows.h index 7359e0b814b..8e03f4998b6 100644 --- a/include/windows.h +++ b/include/windows.h @@ -1521,11 +1521,15 @@ typedef struct BOOL32 bInheritHandle; } SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; +/* 64 bit number of 100 nanoseconds intervals since January 1, 1601 */ +/* FIXME: currently dwLowDateTime is equivalent to the UNIX time(), + * and dwHighDateTime 0 + */ typedef struct { INT32 dwLowDateTime; INT32 dwHighDateTime; -} FILETIME; +} FILETIME, *LPFILETIME; /* Find* structures */ typedef struct @@ -2427,7 +2431,7 @@ typedef struct /* Window scrolling */ #define SW_SCROLLCHILDREN 0x0001 #define SW_INVALIDATE 0x0002 -#define SW_ERASE 0x0003 +#define SW_ERASE 0x0004 /* CreateWindow() coordinates */ #define CW_USEDEFAULT16 ((INT16)0x8000) @@ -2766,31 +2770,108 @@ typedef struct #define CBS_DISABLENOSCROLL 0x0800L /* Combo box messages */ -#define CB_GETEDITSEL (WM_USER+0) -#define CB_LIMITTEXT (WM_USER+1) -#define CB_SETEDITSEL (WM_USER+2) -#define CB_ADDSTRING (WM_USER+3) -#define CB_DELETESTRING (WM_USER+4) -#define CB_DIR (WM_USER+5) -#define CB_GETCOUNT (WM_USER+6) -#define CB_GETCURSEL (WM_USER+7) -#define CB_GETLBTEXT (WM_USER+8) -#define CB_GETLBTEXTLEN (WM_USER+9) -#define CB_INSERTSTRING (WM_USER+10) -#define CB_RESETCONTENT (WM_USER+11) -#define CB_FINDSTRING (WM_USER+12) -#define CB_SELECTSTRING (WM_USER+13) -#define CB_SETCURSEL (WM_USER+14) -#define CB_SHOWDROPDOWN (WM_USER+15) -#define CB_GETITEMDATA (WM_USER+16) -#define CB_SETITEMDATA (WM_USER+17) -#define CB_GETDROPPEDCONTROLRECT (WM_USER+18) -#define CB_SETITEMHEIGHT (WM_USER+19) -#define CB_GETITEMHEIGHT (WM_USER+20) -#define CB_SETEXTENDEDUI (WM_USER+21) -#define CB_GETEXTENDEDUI (WM_USER+22) -#define CB_GETDROPPEDSTATE (WM_USER+23) -#define CB_FINDSTRINGEXACT (WM_USER+24) +#define CB_GETEDITSEL16 (WM_USER+0) +#define CB_GETEDITSEL32 0x0140 +#define CB_GETEDITSEL WINELIB_NAME(CB_GETEDITSEL) +#define CB_LIMITTEXT16 (WM_USER+1) +#define CB_LIMITTEXT32 0x0141 +#define CB_LIMITTEXT WINELIB_NAME(CB_LIMITTEXT) +#define CB_SETEDITSEL16 (WM_USER+2) +#define CB_SETEDITSEL32 0x0142 +#define CB_SETEDITSEL WINELIB_NAME(CB_SETEDITSEL) +#define CB_ADDSTRING16 (WM_USER+3) +#define CB_ADDSTRING32 0x0143 +#define CB_ADDSTRING WINELIB_NAME(CB_ADDSTRING) +#define CB_DELETESTRING16 (WM_USER+4) +#define CB_DELETESTRING32 0x0144 +#define CB_DELETESTRING WINELIB_NAME(CB_DELETESTRING) +#define CB_DIR16 (WM_USER+5) +#define CB_DIR32 0x0145 +#define CB_DIR WINELIB_NAME(CB_DIR) +#define CB_GETCOUNT16 (WM_USER+6) +#define CB_GETCOUNT32 0x0146 +#define CB_GETCOUNT WINELIB_NAME(CB_GETCOUNT) +#define CB_GETCURSEL16 (WM_USER+7) +#define CB_GETCURSEL32 0x0147 +#define CB_GETCURSEL WINELIB_NAME(CB_GETCURSEL) +#define CB_GETLBTEXT16 (WM_USER+8) +#define CB_GETLBTEXT32 0x0148 +#define CB_GETLBTEXT WINELIB_NAME(CB_GETLBTEXT) +#define CB_GETLBTEXTLEN16 (WM_USER+9) +#define CB_GETLBTEXTLEN32 0x0149 +#define CB_GETLBTEXTLEN WINELIB_NAME(CB_GETLBTEXTLEN) +#define CB_INSERTSTRING16 (WM_USER+10) +#define CB_INSERTSTRING32 0x014a +#define CB_INSERTSTRING WINELIB_NAME(CB_INSERTSTRING) +#define CB_RESETCONTENT16 (WM_USER+11) +#define CB_RESETCONTENT32 0x014b +#define CB_RESETCONTENT WINELIB_NAME(CB_RESETCONTENT) +#define CB_FINDSTRING16 (WM_USER+12) +#define CB_FINDSTRING32 0x014c +#define CB_FINDSTRING WINELIB_NAME(CB_FINDSTRING) +#define CB_SELECTSTRING16 (WM_USER+13) +#define CB_SELECTSTRING32 0x014d +#define CB_SELECTSTRING WINELIB_NAME(CB_SELECTSTRING) +#define CB_SETCURSEL16 (WM_USER+14) +#define CB_SETCURSEL32 0x014e +#define CB_SETCURSEL WINELIB_NAME(CB_SETCURSEL) +#define CB_SHOWDROPDOWN16 (WM_USER+15) +#define CB_SHOWDROPDOWN32 0x014f +#define CB_SHOWDROPDOWN WINELIB_NAME(CB_SHOWDROPDOWN) +#define CB_GETITEMDATA16 (WM_USER+16) +#define CB_GETITEMDATA32 0x0150 +#define CB_GETITEMDATA WINELIB_NAME(CB_GETITEMDATA) +#define CB_SETITEMDATA16 (WM_USER+17) +#define CB_SETITEMDATA32 0x0151 +#define CB_SETITEMDATA WINELIB_NAME(CB_SETITEMDATA) +#define CB_GETDROPPEDCONTROLRECT16 (WM_USER+18) +#define CB_GETDROPPEDCONTROLRECT32 0x0152 +#define CB_GETDROPPEDCONTROLRECT WINELIB_NAME(CB_GETDROPPEDCONTROLRECT) +#define CB_SETITEMHEIGHT16 (WM_USER+19) +#define CB_SETITEMHEIGHT32 0x0153 +#define CB_SETITEMHEIGHT WINELIB_NAME(CB_SETITEMHEIGHT) +#define CB_GETITEMHEIGHT16 (WM_USER+20) +#define CB_GETITEMHEIGHT32 0x0154 +#define CB_GETITEMHEIGHT WINELIB_NAME(CB_GETITEMHEIGHT) +#define CB_SETEXTENDEDUI16 (WM_USER+21) +#define CB_SETEXTENDEDUI32 0x0155 +#define CB_SETEXTENDEDUI WINELIB_NAME(CB_SETEXTENDEDUI) +#define CB_GETEXTENDEDUI16 (WM_USER+22) +#define CB_GETEXTENDEDUI32 0x0156 +#define CB_GETEXTENDEDUI WINELIB_NAME(CB_GETEXTENDEDUI) +#define CB_GETDROPPEDSTATE16 (WM_USER+23) +#define CB_GETDROPPEDSTATE32 0x0157 +#define CB_GETDROPPEDSTATE WINELIB_NAME(CB_GETDROPPEDSTATE) +#define CB_FINDSTRINGEXACT16 (WM_USER+24) +#define CB_FINDSTRINGEXACT32 0x0158 +#define CB_FINDSTRINGEXACT WINELIB_NAME(CB_FINDSTRINGEXACT) +#define CB_SETLOCALE16 WM_NULL /* Not in Win16 */ +#define CB_SETLOCALE32 0x0159 +#define CB_SETLOCALE WINELIB_NAME(CB_SETLOCALE) +#define CB_GETLOCALE16 WM_NULL /* Not in Win16 */ +#define CB_GETLOCALE32 0x015a +#define CB_GETLOCALE WINELIB_NAME(CB_GETLOCALE) +#define CB_GETTOPINDEX16 WM_NULL /* Not in Win16 */ +#define CB_GETTOPINDEX32 0x015b +#define CB_GETTOPINDEX WINELIB_NAME(CB_GETTOPINDEX) +#define CB_SETTOPINDEX16 WM_NULL /* Not in Win16 */ +#define CB_SETTOPINDEX32 0x015c +#define CB_SETTOPINDEX WINELIB_NAME(CB_SETTOPINDEX) +#define CB_GETHORIZONTALEXTENT16 WM_NULL /* Not in Win16 */ +#define CB_GETHORIZONTALEXTENT32 0x015d +#define CB_GETHORIZONTALEXTENT WINELIB_NAME(CB_GETHORIZONTALEXTENT) +#define CB_SETHORIZONTALEXTENT16 WM_NULL /* Not in Win16 */ +#define CB_SETHORIZONTALEXTENT32 0x015e +#define CB_SETHORIZONTALEXTENT WINELIB_NAME(CB_SETHORIZONTALEXTENT) +#define CB_GETDROPPEDWIDTH16 WM_NULL /* Not in Win16 */ +#define CB_GETDROPPEDWIDTH32 0x015f +#define CB_GETDROPPEDWIDTH WINELIB_NAME(CB_GETDROPPEDWIDTH) +#define CB_SETDROPPEDWIDTH16 WM_NULL /* Not in Win16 */ +#define CB_SETDROPPEDWIDTH32 0x0160 +#define CB_SETDROPPEDWIDTH WINELIB_NAME(CB_SETDROPPEDWIDTH) +#define CB_INITSTORAGE16 WM_NULL /* Not in Win16 */ +#define CB_INITSTORAGE32 0x0161 +#define CB_INITSTORAGE WINELIB_NAME(CB_INITSTORAGE) /* Combo box notification codes */ #define CBN_ERRSPACE (-1) @@ -3624,6 +3705,19 @@ typedef BOOL32 (*CODEPAGE_ENUMPROC32A)(LPSTR); typedef BOOL32 (*CODEPAGE_ENUMPROC32W)(LPWSTR); DECL_WINELIB_TYPE_AW(CODEPAGE_ENUMPROC); +typedef struct tagSYSTEM_INFO +{ + DWORD dwOemId; + DWORD dwPageSize; + LPVOID lpMinimumApplicationAddress; + LPVOID lpMaximumApplicationAddress; + DWORD dwActiveProcessorMask; + DWORD dwNumberOfProcessors; + DWORD dwProcessorType; + DWORD dwAllocationGranularity; + DWORD dwReserved; +} SYSTEM_INFO, *LPSYSTEM_INFO; + #pragma pack(4) /* Declarations for functions that exist only in Win16 */ @@ -3638,10 +3732,13 @@ INT16 CloseComm(INT16); BOOL16 DCHook(HDC16,WORD,DWORD,LPARAM); VOID DirectedYield(HTASK16); HGLOBAL16 DirectResAlloc(HINSTANCE16,WORD,UINT16); +BOOL16 DlgDirSelect(HWND16,LPSTR,INT16); +BOOL16 DlgDirSelectComboBox(HWND16,LPSTR,INT16); BOOL16 EnableHardwareInput(BOOL16); INT16 ExcludeVisRect(HDC16,INT16,INT16,INT16,INT16); HANDLE16 FarGetOwner(HGLOBAL16); VOID FarSetOwner(HGLOBAL16,HANDLE16); +BOOL16 FastWindowFrame(HDC16,const RECT16*,INT16,INT16,DWORD); VOID FillWindow(HWND16,HWND16,HDC16,HBRUSH16); INT16 FlushComm(INT16,INT16); WORD FreeSelector(WORD); @@ -3731,11 +3828,18 @@ HFILE CreateFile32W(LPCWSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,H HANDLE32 CreateFileMapping32A(HANDLE32,LPSECURITY_ATTRIBUTES,DWORD,DWORD,DWORD,LPCSTR); HANDLE32 CreateFileMapping32W(HANDLE32,LPSECURITY_ATTRIBUTES,DWORD,DWORD,DWORD,LPCWSTR); #define CreateFileMapping WINELIB_NAME_AW(CreateFileMapping) +BOOL32 DosDateTimeToFileTime(WORD,WORD,LPFILETIME); INT32 EnumPropsEx32A(HWND32,PROPENUMPROCEX32A,LPARAM); INT32 EnumPropsEx32W(HWND32,PROPENUMPROCEX32W,LPARAM); #define EnumPropsEx WINELIB_NAME_AW(EnumPropsEx) +BOOL32 EnumSystemCodePages32A(CODEPAGE_ENUMPROC32A,DWORD); +BOOL32 EnumSystemCodePages32W(CODEPAGE_ENUMPROC32W,DWORD); +#define EnumSystemCodePages WINELIB_NAME_AW(EnumSystemCodePages) BOOL32 EnumThreadWindows(DWORD,WNDENUMPROC32,LPARAM); void ExitProcess(DWORD); +BOOL32 FileTimeToDosDateTime(LPFILETIME,LPWORD,LPWORD); +BOOL32 FileTimeToLocalFileTime(LPFILETIME,LPFILETIME); +BOOL32 FileTimeToSystemTime(LPFILETIME,LPSYSTEMTIME); HRSRC32 FindResourceEx32A(HINSTANCE32,LPCSTR,LPCSTR,WORD); HRSRC32 FindResourceEx32W(HINSTANCE32,LPCWSTR,LPCWSTR,WORD); #define FindResourceEx WINELIB_NAME_AW(FindResourceEx) @@ -3745,6 +3849,8 @@ LPCWSTR GetCommandLine32W(); #define GetCommandLine WINELIB_NAME_AW(GetCommandLine) BOOL32 GetCommTimeouts(INT32,LPCOMMTIMEOUTS); DWORD GetFileInformationByHandle(HFILE,BY_HANDLE_FILE_INFORMATION*); +DWORD GetFileSize(HFILE,LPDWORD); +DWORD GetFileType(HFILE); VOID GetLocalTime(LPSYSTEMTIME); DWORD GetLogicalDrives(void); HANDLE32 GetProcessHeap(void); @@ -3752,6 +3858,7 @@ DWORD GetShortPathName32A(LPCSTR,LPSTR,DWORD); DWORD GetShortPathName32W(LPCWSTR,LPWSTR,DWORD); #define GetShortPathName WINELIB_NAME_AW(GetShortPathName) HFILE GetStdHandle(DWORD); +VOID GetSystemInfo(LPSYSTEM_INFO); BOOL32 GetSystemPowerStatus(LPSYSTEM_POWER_STATUS); VOID GetSystemTime(LPSYSTEMTIME); VOID GlobalMemoryStatus(LPMEMORYSTATUS); @@ -3766,6 +3873,7 @@ DWORD HeapSize(HANDLE32,DWORD,LPVOID); BOOL32 HeapUnlock(HANDLE32); BOOL32 HeapValidate(HANDLE32,DWORD,LPVOID); BOOL32 IsWindowUnicode(HWND32); +BOOL32 LocalFileTimeToFileTime(LPFILETIME,LPFILETIME); LPVOID MapViewOfFileEx(HANDLE32,DWORD,DWORD,DWORD,DWORD,DWORD); BOOL32 MoveFile32A(LPCSTR,LPCSTR); BOOL32 MoveFile32W(LPCWSTR,LPCWSTR); @@ -3777,16 +3885,16 @@ DWORD RegCreateKeyEx32A(HKEY,LPCSTR,DWORD,LPSTR,DWORD,REGSAM, DWORD RegCreateKeyEx32W(HKEY,LPCWSTR,DWORD,LPWSTR,DWORD,REGSAM, LPSECURITY_ATTRIBUTES,LPHKEY,LPDWORD); #define RegCreateKeyEx WINELIB_NAME_AW(RegCreateKeyEx) -DWORD RegEnumKeyEx32A(HKEY,DWORD,LPSTR,LPDWORD,LPDWORD,LPSTR,LPDWORD,FILETIME*); -DWORD RegEnumKeyEx32W(HKEY,DWORD,LPWSTR,LPDWORD,LPDWORD,LPWSTR,LPDWORD,FILETIME*); +DWORD RegEnumKeyEx32A(HKEY,DWORD,LPSTR,LPDWORD,LPDWORD,LPSTR,LPDWORD,LPFILETIME); +DWORD RegEnumKeyEx32W(HKEY,DWORD,LPWSTR,LPDWORD,LPDWORD,LPWSTR,LPDWORD,LPFILETIME); #define RegEnumKeyEx WINELIB_NAME_AW(RegEnumKeyEx) DWORD RegOpenKeyEx32W(HKEY,LPCWSTR,DWORD,REGSAM,LPHKEY); DWORD RegOpenKeyEx32A(HKEY,LPCSTR,DWORD,REGSAM,LPHKEY); #define RegOpenKeyEx WINELIB_NAME_AW(RegOpenKeyEx) DWORD RegQueryInfoKey32W(HKEY,LPWSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD, - LPDWORD,LPDWORD,LPDWORD,LPDWORD,LPDWORD,FILETIME*); + LPDWORD,LPDWORD,LPDWORD,LPDWORD,LPDWORD,LPFILETIME); DWORD RegQueryInfoKey32A(HKEY,LPSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD, - LPDWORD,LPDWORD,LPDWORD,LPDWORD,LPDWORD,FILETIME*); + LPDWORD,LPDWORD,LPDWORD,LPDWORD,LPDWORD,LPFILETIME); #define RegQueryInfoKey WINELIB_NAME_AW(RegQueryInfoKey) VOID RtlFillMemory(LPVOID,UINT32,UINT32); VOID RtlMoveMemory(LPVOID,LPCVOID,UINT32); @@ -3799,10 +3907,12 @@ BOOL32 SetCommMask(INT32,DWORD); BOOL32 SetCommTimeouts(INT32,LPCOMMTIMEOUTS); BOOL32 SetEndOfFile(HFILE); DWORD SetFilePointer(HFILE,LONG,LPLONG,DWORD); +BOOL32 SetFileTime(HFILE,LPFILETIME,LPFILETIME,LPFILETIME); BOOL32 SetTimeZoneInformation(const LPTIME_ZONE_INFORMATION); BOOL32 SetSystemPowerState(BOOL32,BOOL32); BOOL32 SetSystemTime(const SYSTEMTIME*); VOID Sleep(DWORD); +BOOL32 SystemTimeToFileTime(LPSYSTEMTIME,LPFILETIME); LPVOID VirtualAlloc(LPVOID,DWORD,DWORD,DWORD); BOOL32 VirtualFree(LPVOID,DWORD,DWORD); BOOL32 WriteFile(HFILE,LPVOID,DWORD,LPDWORD,LPOVERLAPPED); @@ -3887,6 +3997,9 @@ BOOL32 Arc32(HDC32,INT32,INT32,INT32,INT32,INT32,INT32,INT32,INT32); HDC16 BeginPaint16(HWND16,LPPAINTSTRUCT16); HDC32 BeginPaint32(HWND32,LPPAINTSTRUCT32); #define BeginPaint WINELIB_NAME(BeginPaint) +BOOL16 BitBlt16(HDC16,INT16,INT16,INT16,INT16,HDC16,INT16,INT16,DWORD); +BOOL32 BitBlt32(HDC32,INT32,INT32,INT32,INT32,HDC32,INT32,INT32,DWORD); +#define BitBlt WINELIB_NAME(BitBlt) BOOL16 BuildCommDCB16(LPCSTR,LPDCB16); BOOL32 BuildCommDCB32A(LPCSTR,LPDCB32); BOOL32 BuildCommDCB32W(LPCWSTR,LPDCB32); @@ -4111,6 +4224,14 @@ INT16 DlgDirListComboBox16(HWND16,SEGPTR,INT16,INT16,UINT16); INT32 DlgDirListComboBox32A(HWND32,LPCSTR,INT32,INT32,UINT32); INT32 DlgDirListComboBox32W(HWND32,LPCWSTR,INT32,INT32,UINT32); #define DlgDirListComboBox WINELIB_NAME_AW(DlgDirListComboBox) +BOOL16 DlgDirSelectComboBoxEx16(HWND16,LPSTR,INT16,INT16); +BOOL32 DlgDirSelectComboBoxEx32A(HWND32,LPSTR,INT32,INT32); +BOOL32 DlgDirSelectComboBoxEx32W(HWND32,LPWSTR,INT32,INT32); +#define DlgDirSelectComboBoxEx WINELIB_NAME_AW(DlgDirSelectComboBoxEx) +BOOL16 DlgDirSelectEx16(HWND16,LPSTR,INT16,INT16); +BOOL32 DlgDirSelectEx32A(HWND32,LPSTR,INT32,INT32); +BOOL32 DlgDirSelectEx32W(HWND32,LPWSTR,INT32,INT32); +#define DlgDirSelectEx WINELIB_NAME_AW(DlgDirSelectEx) BOOL16 DPtoLP16(HDC16,LPPOINT16,INT16); BOOL32 DPtoLP32(HDC32,LPPOINT32,INT32); #define DPtoLP WINELIB_NAME(DPtoLP) @@ -4139,6 +4260,10 @@ BOOL32 EndPaint32(HWND32,const PAINTSTRUCT32*); BOOL16 EnumChildWindows16(HWND16,WNDENUMPROC16,LPARAM); BOOL32 EnumChildWindows32(HWND32,WNDENUMPROC32,LPARAM); #define EnumChildWindows WINELIB_NAME(EnumChildWindows) +INT16 EnumFontFamilies16(HDC16,LPCSTR,FONTENUMPROC16,LPARAM); +INT32 EnumFontFamilies32A(HDC32,LPCSTR,FONTENUMPROC32A,LPARAM); +INT32 EnumFontFamilies32W(HDC32,LPCWSTR,FONTENUMPROC32W,LPARAM); +#define EnumFontFamilies WINELIB_NAME_AW(EnumFontFamilies) INT16 EnumObjects16(HDC16,INT16,GOBJENUMPROC16,LPARAM); INT32 EnumObjects32(HDC32,INT32,GOBJENUMPROC32,LPARAM); #define EnumObjects WINELIB_NAME(EnumObjects) @@ -4657,6 +4782,9 @@ BOOL32 OffsetWindowOrgEx32(HDC32,INT32,INT32,LPPOINT32); BOOL16 PaintRgn16(HDC16,HRGN16); BOOL32 PaintRgn32(HDC32,HRGN32); #define PaintRgn WINELIB_NAME(PaintRgn) +BOOL16 PatBlt16(HDC16,INT16,INT16,INT16,INT16,DWORD); +BOOL32 PatBlt32(HDC32,INT32,INT32,INT32,INT32,DWORD); +#define PatBlt WINELIB_NAME(PatBlt) BOOL16 PeekMessage16(LPMSG16,HWND16,UINT16,UINT16,UINT16); BOOL32 PeekMessage32A(LPMSG32,HWND32,UINT32,UINT32,UINT32); BOOL32 PeekMessage32W(LPMSG32,HWND32,UINT32,UINT32,UINT32); @@ -4775,6 +4903,19 @@ BOOL32 ScaleWindowExtEx32(HDC32,INT32,INT32,INT32,INT32,LPSIZE32); void ScreenToClient16(HWND16,LPPOINT16); void ScreenToClient32(HWND32,LPPOINT32); #define ScreenToClient WINELIB_NAME(ScreenToClient) +BOOL16 ScrollDC16(HDC16,INT16,INT16,const RECT16*,const RECT16*, + HRGN16,LPRECT16); +BOOL32 ScrollDC32(HDC32,INT32,INT32,const RECT32*,const RECT32*, + HRGN32,LPRECT32); +#define ScrollDC WINELIB_NAME(ScrollDC) +void ScrollWindow16(HWND16,INT16,INT16,const RECT16*,const RECT16*); +BOOL32 ScrollWindow32(HWND32,INT32,INT32,const RECT32*,const RECT32*); +#define ScrollWindow WINELIB_NAME(ScrollWindow) +INT16 ScrollWindowEx16(HWND16,INT16,INT16,const RECT16*,const RECT16*, + HRGN16,LPRECT16,UINT16); +INT32 ScrollWindowEx32(HWND32,INT32,INT32,const RECT32*,const RECT32*, + HRGN32,LPRECT32,UINT32); +#define ScrollWindowEx WINELIB_NAME(ScrollWindowEx) INT16 SelectClipRgn16(HDC16,HRGN16); INT32 SelectClipRgn32(HDC32,HRGN32); #define SelectClipRgn WINELIB_NAME(SelectClipRgn) @@ -4896,6 +5037,11 @@ void SetWindowText32W(HWND32,LPCWSTR); void ShowScrollBar16(HWND16,INT16,BOOL16); BOOL32 ShowScrollBar32(HWND32,INT32,BOOL32); #define ShowScrollBar WINELIB_NAME(ShowScrollBar) +BOOL16 StretchBlt16(HDC16,INT16,INT16,INT16,INT16,HDC16,INT16,INT16, + INT16,INT16,DWORD); +BOOL32 StretchBlt32(HDC32,INT32,INT32,INT32,INT32,HDC32,INT32,INT32, + INT32,INT32,DWORD); +#define StretchBlt WINELIB_NAME(StretchBlt) BOOL16 SubtractRect16(LPRECT16,const RECT16*,const RECT16*); BOOL32 SubtractRect32(LPRECT32,const RECT32*,const RECT32*); #define SubtractRect WINELIB_NAME(SubtractRect) @@ -5059,7 +5205,6 @@ UINT AnsiUpperBuff(LPSTR,UINT); BOOL AnyPopup(void); UINT ArrangeIconicWindows(HWND); HDWP16 BeginDeferWindowPos(INT); -BOOL BitBlt(HDC16,INT,INT,INT,INT,HDC16,INT,INT,DWORD); BOOL BringWindowToTop(HWND); void CalcChildScroll(HWND,WORD); BOOL CallMsgFilter(SEGPTR,INT); @@ -5094,8 +5239,6 @@ BOOL DestroyMenu(HMENU16); BOOL DestroyWindow(HWND); LONG DispatchMessage(const MSG16*); INT DlgDirList(HWND,SEGPTR,INT,INT,UINT); -BOOL DlgDirSelect(HWND,LPSTR,INT); -BOOL DlgDirSelectComboBox(HWND,LPSTR,INT); BOOL16 DragDetect(HWND16,POINT16); DWORD DragObject(HWND, HWND, WORD, HANDLE16, WORD, HCURSOR16); BOOL DrawIcon(HDC16,INT,INT,HICON16); @@ -5106,7 +5249,6 @@ BOOL EnableMenuItem(HMENU16,UINT,UINT); BOOL EnableWindow(HWND,BOOL); BOOL EndDeferWindowPos(HDWP16); UINT16 EnumClipboardFormats(UINT16); -INT EnumFontFamilies(HDC16,LPCSTR,FONTENUMPROC16,LPARAM); INT EnumFonts(HDC16,LPCSTR,FONTENUMPROC16,LPARAM); BOOL EnumMetaFile(HDC16,HMETAFILE16,MFENUMPROC16,LPARAM); INT Escape(HDC16,INT,INT,SEGPTR,SEGPTR); @@ -5249,7 +5391,6 @@ BOOL OpenClipboard(HWND); BOOL OpenIcon(HWND); int OpenSound(void); void OutputDebugString(LPCSTR); -BOOL PatBlt(HDC16,short,short,short,short,DWORD); BOOL PlayMetaFile(HDC16,HMETAFILE16); void PlayMetaFileRecord(HDC16,LPHANDLETABLE16,LPMETARECORD,WORD); BOOL PostMessage(HWND,WORD,WORD,LONG); @@ -5272,9 +5413,6 @@ BOOL ResizePalette(HPALETTE16,UINT); BOOL RestoreDC(HDC16,short); int SaveDC(HDC16); void ScrollChildren(HWND,UINT,WPARAM16,LPARAM); -BOOL ScrollDC(HDC16,short,short,LPRECT16,LPRECT16,HRGN32,LPRECT16); -void ScrollWindow(HWND,short,short,LPRECT16,LPRECT16); -int ScrollWindowEx(HWND,short,short,LPRECT16,LPRECT16,HRGN32,LPRECT16,WORD); HPALETTE16 SelectPalette(HDC16,HPALETTE16,BOOL); HWND SetActiveWindow(HWND); WORD SetBkMode(HDC16,WORD); @@ -5326,7 +5464,6 @@ BOOL ShowWindow(HWND,int); DWORD SizeofResource(HMODULE16,HRSRC16); int StartSound(void); int StopSound(void); -BOOL StretchBlt(HDC16,short,short,short,short,HDC16,short,short,short,short,DWORD); int StretchDIBits(HDC16,WORD,WORD,WORD,WORD,WORD,WORD,WORD,WORD,LPSTR,LPBITMAPINFO,WORD,DWORD); BOOL SwapMouseButton(BOOL); void SwapRecording(WORD); diff --git a/include/winpos.h b/include/winpos.h index 2b30dd3df36..d8df072e179 100644 --- a/include/winpos.h +++ b/include/winpos.h @@ -35,6 +35,6 @@ extern LONG WINPOS_SendNCCalcSize( HWND32 hwnd, BOOL32 calcValidRect, RECT16 *newClientRect ); extern LONG WINPOS_HandleWindowPosChanging16(WND *wndPtr, WINDOWPOS16 *winpos); extern LONG WINPOS_HandleWindowPosChanging32(WND *wndPtr, WINDOWPOS32 *winpos); -extern INT16 WINPOS_WindowFromPoint( POINT16 pt, WND **ppWnd ); +extern INT16 WINPOS_WindowFromPoint( WND* scopeWnd, POINT16 pt, WND **ppWnd ); #endif /* __WINE_WINPOS_H */ diff --git a/include/x11drv.h b/include/x11drv.h index eea87db19b8..0c811a499ea 100644 --- a/include/x11drv.h +++ b/include/x11drv.h @@ -50,8 +50,17 @@ typedef struct struct tagDC; +extern BOOL32 X11DRV_BitBlt( struct tagDC *dcDst, INT32 xDst, INT32 yDst, + INT32 width, INT32 height, struct tagDC *dcSrc, + INT32 xSrc, INT32 ySrc, DWORD rop ); extern BOOL32 X11DRV_GetTextExtentPoint( struct tagDC *dc, LPCSTR str, INT32 count, LPSIZE32 size ); +extern BOOL32 X11DRV_PatBlt( struct tagDC *dc, INT32 left, INT32 top, + INT32 width, INT32 height, DWORD rop ); extern VOID X11DRV_SetDeviceClipping(struct tagDC *dc); +extern BOOL32 X11DRV_StretchBlt( struct tagDC *dcDst, INT32 xDst, INT32 yDst, + INT32 widthDst, INT32 heightDst, + struct tagDC *dcSrc, INT32 xSrc, INT32 ySrc, + INT32 widthSrc, INT32 heightSrc, DWORD rop ); #endif /* __WINE_X11DRV_H */ diff --git a/library/libres.c b/library/libres.c index c3964ec6fd4..521f7c2bfce 100644 --- a/library/libres.c +++ b/library/libres.c @@ -9,6 +9,7 @@ #include "libres.h" #include "windows.h" #include "xmalloc.h" +#include "string32.h" typedef struct RLE { @@ -30,9 +31,9 @@ void LIBRES_RegisterResources(const struct resource* const * Res) } /********************************************************************** - * LIBRES_FindResource + * LIBRES_FindResource16 */ -HRSRC32 LIBRES_FindResource( HINSTANCE32 hModule, LPCSTR name, LPCSTR type ) +HRSRC32 LIBRES_FindResource16( HINSTANCE32 hModule, LPCSTR name, LPCSTR type ) { int nameid=0,typeid; ResListE* ResBlock; @@ -57,7 +58,7 @@ HRSRC32 LIBRES_FindResource( HINSTANCE32 hModule, LPCSTR name, LPCSTR type ) typeid=atoi(type+1); else { - WINELIB_UNIMP("LIBRES_FindResource(*,*,type=string)"); + WINELIB_UNIMP("LIBRES_FindResource16(*,*,type=string)"); return 0; } } @@ -77,6 +78,61 @@ HRSRC32 LIBRES_FindResource( HINSTANCE32 hModule, LPCSTR name, LPCSTR type ) return 0; } +/********************************************************************** + * LIBRES_FindResource32 + */ +HRSRC32 LIBRES_FindResource32( HINSTANCE32 hModule, LPCWSTR name, LPCWSTR type ) +{ + int nameid=0,typeid; + ResListE* ResBlock; + const struct resource* const * Res; + LPSTR nameA, typeA; + + if(HIWORD(name)) + { + if(*name=='#') + { + nameA = STRING32_DupUniToAnsi(name); + nameid=atoi(nameA+1); + free(nameA); + name=NULL; + } + } + else + { + nameid=LOWORD(name); + name=NULL; + } + if(HIWORD(type)) + { + if(*type=='#') + { + typeA = STRING32_DupUniToAnsi(type); + typeid=atoi(typeA+1); + free(typeA); + } + else + { + WINELIB_UNIMP("LIBRES_FindResource32(*,*,type=string)"); + return 0; + } + } + else + typeid=LOWORD(type); + + for(ResBlock=ResourceList; ResBlock; ResBlock=ResBlock->next) + for(Res=ResBlock->Resources; *Res; Res++) + if(name) + { + if((*Res)->type==typeid && !lstrcmpi32W((*Res)->name,name)) + return (HRSRC32)*Res; + } + else + if((*Res)->type==typeid && (*Res)->id==nameid) + return (HRSRC32)*Res; + return 0; +} + /********************************************************************** * LIBRES_LoadResource diff --git a/loader/builtin.c b/loader/builtin.c index 0b67254b513..0a12bc617ac 100644 --- a/loader/builtin.c +++ b/loader/builtin.c @@ -90,6 +90,7 @@ extern const DLL_DESCRIPTOR DDEML_Descriptor; extern const DLL_DESCRIPTOR LZEXPAND_Descriptor; extern const DLL_DESCRIPTOR VER_Descriptor; extern const DLL_DESCRIPTOR W32SYS_Descriptor; +extern const DLL_DESCRIPTOR WING_Descriptor; /* 32-bit DLLs */ @@ -143,6 +144,7 @@ static BUILTIN_DLL BuiltinDLLs[] = { &LZEXPAND_Descriptor, 0 }, { &VER_Descriptor, 0 }, { &W32SYS_Descriptor, 0 }, + { &WING_Descriptor, 0 }, /* Win32 DLLs */ { &ADVAPI32_Descriptor, 0 }, { &COMCTL32_Descriptor, DLL_FLAG_NOT_USED }, diff --git a/loader/resource.c b/loader/resource.c index 9bf8dba3507..cf7cc0b5fbc 100644 --- a/loader/resource.c +++ b/loader/resource.c @@ -63,7 +63,7 @@ HRSRC16 FindResource16( HMODULE16 hModule, SEGPTR name, SEGPTR type ) } return NE_FindResource( hModule, type, name ); #else - return LIBRES_FindResource( hModule, name, type ); + return LIBRES_FindResource16( hModule, name, type ); #endif } @@ -116,7 +116,7 @@ HRSRC32 FindResourceEx32W( if (!(pModule->flags & NE_FFLAGS_WIN32)) return 0; return PE_FindResourceEx32W(hModule,name,type,lang); #else - return LIBRES_FindResource( hModule, name, type ); + return LIBRES_FindResource32( hModule, name, type ); #endif } @@ -661,6 +661,7 @@ LoadString32A(HINSTANCE32 instance,UINT32 resource_id,LPSTR buffer,int buflen) LPWSTR buffer2 = buffer?(LPWSTR)xmalloc(buflen*2):NULL; INT32 retval = LoadString32W(instance,resource_id,buffer2,buflen); + if (!retval) return 0; if (buffer) { STRING32_UniToAnsi(buffer,buffer2); free(buffer2); diff --git a/memory/global.c b/memory/global.c index 4718a63bdb4..876c6c98ab5 100644 --- a/memory/global.c +++ b/memory/global.c @@ -750,52 +750,23 @@ BOOL16 GlobalEntryModule( GLOBALENTRY *pGlobal, HMODULE16 hModule, WORD wSeg ) /*********************************************************************** * MemManInfo (TOOLHELP.72) */ -BOOL16 MemManInfo( MEMMANINFO *pInfo ) +BOOL16 MemManInfo( MEMMANINFO *info ) { -#ifdef linux - /* FIXME: does not take into account the dwSize member - * could be corrupting memory therefore - */ - /* shamefully stolen from free */ - DWORD availmem = 0; - DWORD totalmem = 0; - FILE *meminfo; - char buf[80]; - int col[5]; - int n; + MEMORYSTATUS status; - if ((meminfo = fopen("/proc/meminfo", "r")) < 0) { - perror("wine: open"); - return FALSE; - } - - fgets(buf, 80, meminfo); /* read first line */ - while ( fgets(buf, 80, meminfo) ) { - n = sscanf( buf, "%*s %d %d %d %d %d", &col[0], &col[1], &col[2], &col[3], &col[4]); - if ( n < 1 ) continue; /* escape the loop at the top */ - totalmem += col[0]; - availmem += col[2] + col[4]; - } - - fprintf(stderr,"MemManInfo called with dwSize = %ld\n",pInfo->dwSize); - if (pInfo->dwSize) { - pInfo->wPageSize = getpagesize(); - pInfo->dwLargestFreeBlock = availmem; - pInfo->dwTotalLinearSpace = totalmem / pInfo->wPageSize; - pInfo->dwMaxPagesAvailable = pInfo->dwLargestFreeBlock / pInfo->wPageSize; - pInfo->dwMaxPagesLockable = pInfo->dwMaxPagesLockable; - /* FIXME: the next three are not quite correct */ - pInfo->dwTotalUnlockedPages = pInfo->dwMaxPagesAvailable; - pInfo->dwFreePages = pInfo->dwMaxPagesAvailable; - pInfo->dwTotalPages = pInfo->dwMaxPagesAvailable; - /* FIXME: the three above are not quite correct */ - pInfo->dwFreeLinearSpace = pInfo->dwMaxPagesAvailable; - pInfo->dwSwapFilePages = 0L; - } + if (info->dwSize < sizeof(MEMMANINFO)) return FALSE; + GlobalMemoryStatus( &status ); + info->wPageSize = getpagesize(); + info->dwLargestFreeBlock = status.dwAvailVirtual; + info->dwMaxPagesAvailable = info->dwLargestFreeBlock / info->wPageSize; + info->dwMaxPagesLockable = info->dwMaxPagesAvailable; + info->dwTotalLinearSpace = status.dwTotalVirtual / info->wPageSize; + info->dwTotalUnlockedPages = info->dwTotalLinearSpace; + info->dwFreePages = info->dwMaxPagesAvailable; + info->dwTotalPages = info->dwTotalLinearSpace; + info->dwFreeLinearSpace = info->dwMaxPagesAvailable; + info->dwSwapFilePages = status.dwTotalPageFile / info->wPageSize; return TRUE; -#else - return TRUE; -#endif } @@ -897,11 +868,46 @@ BOOL32 GlobalUnlock32( HGLOBAL32 handle ) */ VOID GlobalMemoryStatus( LPMEMORYSTATUS lpmem ) { - /* FIXME: should do something like MemManInfo() here */ +#ifdef linux + FILE *f = fopen( "/proc/meminfo", "r" ); + if (f) + { + char buffer[256]; + int total, used, free; + + lpmem->dwTotalPhys = lpmem->dwAvailPhys = 0; + lpmem->dwTotalPageFile = lpmem->dwAvailPageFile = 0; + while (fgets( buffer, sizeof(buffer), f )) + { + if (sscanf( buffer, "Mem: %d %d %d", &total, &used, &free )) + { + lpmem->dwTotalPhys += total; + lpmem->dwAvailPhys += free; + } + else if (sscanf( buffer, "Swap: %d %d %d", &total, &used, &free )) + { + lpmem->dwTotalPageFile += total; + lpmem->dwAvailPageFile += free; + } + } + fclose( f ); + + if (lpmem->dwTotalPhys) + { + lpmem->dwTotalVirtual = lpmem->dwTotalPhys+lpmem->dwTotalPageFile; + lpmem->dwAvailVirtual = lpmem->dwAvailPhys+lpmem->dwAvailPageFile; + lpmem->dwMemoryLoad = (lpmem->dwTotalVirtual-lpmem->dwAvailVirtual) + * 100 / lpmem->dwTotalVirtual; + return; + } + } +#endif + /* FIXME: should do something for other systems */ lpmem->dwMemoryLoad = 0; lpmem->dwTotalPhys = 16*1024*1024; lpmem->dwAvailPhys = 16*1024*1024; - lpmem->dwTotalPageFile = 0; + lpmem->dwTotalPageFile = 16*1024*1024; lpmem->dwAvailPageFile = 16*1024*1024; - lpmem->dwAvailVirtual = 16*1024*1024; + lpmem->dwTotalVirtual = 32*1024*1024; + lpmem->dwAvailVirtual = 32*1024*1024; } diff --git a/misc/commdlg.c b/misc/commdlg.c index 0133f88e0f3..80aa834f6fa 100644 --- a/misc/commdlg.c +++ b/misc/commdlg.c @@ -263,8 +263,8 @@ static LONG FILEDLG_WMDrawItem(HWND hWnd, WPARAM16 wParam, LPARAM lParam,int sav lpdis->rcItem.top, str, strlen(str)); hMemDC = CreateCompatibleDC(lpdis->hDC); hPrevBitmap = SelectObject32(hMemDC, hBitmap); - BitBlt(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, - bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY); + BitBlt32(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, + bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY); SelectObject32(hMemDC, hPrevBitmap); DeleteDC(hMemDC); if (lpdis->itemState != 0) InvertRect16(lpdis->hDC, &lpdis->rcItem); @@ -277,7 +277,7 @@ static LONG FILEDLG_WMDrawItem(HWND hWnd, WPARAM16 wParam, LPARAM lParam,int sav hBrush = SelectObject32(lpdis->hDC, GetStockObject32(LTGRAY_BRUSH)); SelectObject32(lpdis->hDC, hBrush); FillRect16(lpdis->hDC, &lpdis->rcItem, hBrush); - SendMessage16(lpdis->hwndItem, CB_GETLBTEXT, lpdis->itemID, + SendMessage16(lpdis->hwndItem, CB_GETLBTEXT16, lpdis->itemID, (LPARAM)SEGPTR_GET(str)); switch(DRIVE_GetType( str[2] - 'a' )) { @@ -292,8 +292,8 @@ static LONG FILEDLG_WMDrawItem(HWND hWnd, WPARAM16 wParam, LPARAM lParam,int sav lpdis->rcItem.top, str, strlen(str)); hMemDC = CreateCompatibleDC(lpdis->hDC); hPrevBitmap = SelectObject32(hMemDC, hBitmap); - BitBlt(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, - bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY); + BitBlt32( lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, + bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY ); SelectObject32(hMemDC, hPrevBitmap); DeleteDC(hMemDC); if (lpdis->itemState != 0) InvertRect16(lpdis->hDC, &lpdis->rcItem); @@ -351,12 +351,12 @@ static LONG FILEDLG_WMInitDialog(HWND hWnd, WPARAM16 wParam, LPARAM lParam) while(*pstr) { dprintf_commdlg(stddeb,"lpstrCustomFilter // add str='%s' ",pstr); - i = SendDlgItemMessage16(hWnd, cmb1, CB_ADDSTRING, 0, + i = SendDlgItemMessage16(hWnd, cmb1, CB_ADDSTRING16, 0, (LPARAM)lpofn->lpstrCustomFilter + n ); n += strlen(pstr) + 1; pstr += strlen(pstr) + 1; dprintf_commdlg(stddeb,"associated to '%s'\n", pstr); - SendDlgItemMessage16(hWnd, cmb1, CB_SETITEMDATA, i, (LPARAM)pstr); + SendDlgItemMessage16(hWnd, cmb1, CB_SETITEMDATA16, i, (LPARAM)pstr); n += strlen(pstr) + 1; pstr += strlen(pstr) + 1; } @@ -367,12 +367,12 @@ static LONG FILEDLG_WMInitDialog(HWND hWnd, WPARAM16 wParam, LPARAM lParam) n = 0; while(*pstr) { dprintf_commdlg(stddeb,"lpstrFilter // add str='%s' ", pstr); - i = SendDlgItemMessage16(hWnd, cmb1, CB_ADDSTRING, 0, + i = SendDlgItemMessage16(hWnd, cmb1, CB_ADDSTRING16, 0, (LPARAM)lpofn->lpstrFilter + n ); n += strlen(pstr) + 1; pstr += strlen(pstr) + 1; dprintf_commdlg(stddeb,"associated to '%s'\n", pstr); - SendDlgItemMessage16(hWnd, cmb1, CB_SETITEMDATA, i, (LPARAM)pstr); + SendDlgItemMessage16(hWnd, cmb1, CB_SETITEMDATA16, i, (LPARAM)pstr); n += strlen(pstr) + 1; pstr += strlen(pstr) + 1; } @@ -380,7 +380,7 @@ static LONG FILEDLG_WMInitDialog(HWND hWnd, WPARAM16 wParam, LPARAM lParam) /* set default filter */ if (lpofn->nFilterIndex == 0 && lpofn->lpstrCustomFilter == (SEGPTR)NULL) lpofn->nFilterIndex = 1; - SendDlgItemMessage16(hWnd, cmb1, CB_SETCURSEL, lpofn->nFilterIndex - 1, 0); + SendDlgItemMessage16(hWnd, cmb1, CB_SETCURSEL16, lpofn->nFilterIndex - 1, 0); strncpy(tmpstr, FILEDLG_GetFileType(PTR_SEG_TO_LIN(lpofn->lpstrCustomFilter), PTR_SEG_TO_LIN(lpofn->lpstrFilter), lpofn->nFilterIndex - 1),511); tmpstr[511]=0; @@ -407,7 +407,7 @@ static LONG FILEDLG_WMInitDialog(HWND hWnd, WPARAM16 wParam, LPARAM lParam) fprintf(stderr, "FileDlg: couldn't read initial directory %s!\n", tmpstr); /* select current drive in combo 2 */ n = DRIVE_GetCurrentDrive(); - SendDlgItemMessage16(hWnd, cmb2, CB_SETCURSEL, n, 0); + SendDlgItemMessage16(hWnd, cmb2, CB_SETCURSEL16, n, 0); if (!(lpofn->Flags & OFN_SHOWHELP)) ShowWindow(GetDlgItem(hWnd, pshHelp), SW_HIDE); if (lpofn->Flags & OFN_HIDEREADONLY) @@ -486,18 +486,18 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM16 wParam, LPARAM lParam) return TRUE; case cmb2: /* disk drop list */ FILEDLG_StripEditControl(hWnd); - lRet = SendDlgItemMessage16(hWnd, cmb2, CB_GETCURSEL, 0, 0L); + lRet = SendDlgItemMessage16(hWnd, cmb2, CB_GETCURSEL16, 0, 0L); if (lRet == LB_ERR) return 0; pstr = SEGPTR_ALLOC(512); - SendDlgItemMessage16(hWnd, cmb2, CB_GETLBTEXT, lRet, + SendDlgItemMessage16(hWnd, cmb2, CB_GETLBTEXT16, lRet, (LPARAM)SEGPTR_GET(pstr)); sprintf(tmpstr, "%c:", pstr[2]); SEGPTR_FREE(pstr); reset_scan: - lRet = SendDlgItemMessage16(hWnd, cmb1, CB_GETCURSEL, 0, 0); + lRet = SendDlgItemMessage16(hWnd, cmb1, CB_GETCURSEL16, 0, 0); if (lRet == LB_ERR) return TRUE; - pstr = (LPSTR)SendDlgItemMessage16(hWnd, cmb1, CB_GETITEMDATA, lRet, 0); + pstr = (LPSTR)SendDlgItemMessage16(hWnd, cmb1, CB_GETITEMDATA16, lRet, 0); dprintf_commdlg(stddeb,"Selected filter : %s\n", pstr); SetDlgItemText32A( hWnd, edt1, pstr ); FILEDLG_ScanDir(hWnd, tmpstr); @@ -536,7 +536,7 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM16 wParam, LPARAM lParam) pstr2 = tmpstr + strlen(tmpstr); if (pstr == NULL || *(pstr+1) != 0) strcat(tmpstr, "\\"); - lRet = SendDlgItemMessage16(hWnd, cmb1, CB_GETCURSEL, 0, 0); + lRet = SendDlgItemMessage16(hWnd, cmb1, CB_GETCURSEL16, 0, 0); if (lRet == LB_ERR) return TRUE; lpofn->nFilterIndex = lRet + 1; dprintf_commdlg(stddeb,"commdlg: lpofn->nFilterIndex=%ld\n", lpofn->nFilterIndex); @@ -1568,10 +1568,10 @@ static void CC_PaintCross(HWND hDlg,int x,int y) point.x=((long)rect.right*(long)x)/(long)MAXHORI; point.y=rect.bottom-((long)rect.bottom*(long)y)/(long)MAXVERT; if (lpp->oldcross.left!=lpp->oldcross.right) - BitBlt(hDC,lpp->oldcross.left,lpp->oldcross.top, - lpp->oldcross.right-lpp->oldcross.left, - lpp->oldcross.bottom-lpp->oldcross.top, - lpp->hdcMem,lpp->oldcross.left,lpp->oldcross.top,SRCCOPY); + BitBlt32(hDC,lpp->oldcross.left,lpp->oldcross.top, + lpp->oldcross.right-lpp->oldcross.left, + lpp->oldcross.bottom-lpp->oldcross.top, + lpp->hdcMem,lpp->oldcross.left,lpp->oldcross.top,SRCCOPY); lpp->oldcross.left =point.x-w-1; lpp->oldcross.right =point.x+w+1; lpp->oldcross.top =point.y-w-1; @@ -1652,7 +1652,7 @@ static void CC_PaintColorGraph(HWND hDlg) hDC=GetDC32(hwnd); GetClientRect16(hwnd,&rect); if (lpp->hdcMem) - BitBlt(hDC,0,0,rect.right,rect.bottom,lpp->hdcMem,0,0,SRCCOPY); + BitBlt32(hDC,0,0,rect.right,rect.bottom,lpp->hdcMem,0,0,SRCCOPY); else fprintf(stderr,"choose color: hdcMem is not defined\n"); ReleaseDC32(hwnd,hDC); @@ -2285,12 +2285,12 @@ INT16 FontFamilyEnumProc( SEGPTR logfont, SEGPTR metrics, if (!(nFontType & 0x0004)) /* this means 'TRUETYPE_FONTTYPE' */ return 1; - i=SendMessage16(hwnd,CB_ADDSTRING,0, + i=SendMessage16(hwnd,CB_ADDSTRING16,0, (LPARAM)logfont + ((char *)lplf->lfFaceName - (char *)lplf)); if (i!=CB_ERR) { w=(lplf->lfCharSet << 8) | lplf->lfPitchAndFamily; - SendMessage16(hwnd, CB_SETITEMDATA,i,MAKELONG(nFontType,w)); + SendMessage16(hwnd, CB_SETITEMDATA16,i,MAKELONG(nFontType,w)); return 1 ; /* store some important font information */ } else @@ -2330,10 +2330,10 @@ static int SetFontStylesToCombo2(HWND hwnd, HDC16 hdc, LPLOGFONT16 lplf, lptm->tmItalic==fontstyles[i].italic) /* font successful created ? */ { char *str = SEGPTR_STRDUP(fontstyles[i].stname); - j=SendMessage16(hwnd,CB_ADDSTRING,0,(LPARAM)SEGPTR_GET(str) ); + j=SendMessage16(hwnd,CB_ADDSTRING16,0,(LPARAM)SEGPTR_GET(str) ); SEGPTR_FREE(str); if (j==CB_ERR) return 1; - j=SendMessage16(hwnd, CB_SETITEMDATA, j, + j=SendMessage16(hwnd, CB_SETITEMDATA16, j, MAKELONG(fontstyles[i].weight,fontstyles[i].italic)); if (j==CB_ERR) return 1; } @@ -2359,11 +2359,11 @@ static int SetFontSizesToCombo3(HWND hwnd, LPLOGFONT16 lplf, LPCHOOSEFONT lpcf) ((lpcf->Flags & CF_LIMITSIZE) && (h >= lpcf->nSizeMin) && (h <= lpcf->nSizeMax))) { sprintf(buffer,"%2d",h); - j=SendMessage16(hwnd,CB_FINDSTRING,-1,(LPARAM)SEGPTR_GET(buffer)); + j=SendMessage16(hwnd,CB_FINDSTRING16,-1,(LPARAM)SEGPTR_GET(buffer)); if (j==CB_ERR) { - j=SendMessage16(hwnd,CB_ADDSTRING,0,(LPARAM)SEGPTR_GET(buffer)); - if (j!=CB_ERR) j = SendMessage16(hwnd, CB_SETITEMDATA, j, h); + j=SendMessage16(hwnd,CB_ADDSTRING16,0,(LPARAM)SEGPTR_GET(buffer)); + if (j!=CB_ERR) j = SendMessage16(hwnd, CB_SETITEMDATA16, j, h); if (j==CB_ERR) { SEGPTR_FREE(buffer); @@ -2400,7 +2400,7 @@ INT16 FontStyleEnumProc( SEGPTR logfont, SEGPTR metrics, if (SetFontSizesToCombo3(hcmb3, lplf ,lpcf)) return 0; - if (!SendMessage16(hcmb2,CB_GETCOUNT,0,0)) + if (!SendMessage16(hcmb2,CB_GETCOUNT16,0,0)) { HDC32 hdc= (lpcf->Flags & CF_PRINTERFONTS && lpcf->hDC) ? lpcf->hDC : GetDC32(hDlg); i=SetFontStylesToCombo2(hcmb2,hdc,lplf,lptm); @@ -2450,12 +2450,12 @@ LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM16 wParam, LPARAM lParam) /* FIXME: load color name from resource: res=LoadString(...,i+....,buffer,.....); */ char *name = SEGPTR_ALLOC(20); strcpy( name, "[color name]" ); - j=SendDlgItemMessage16(hDlg,cmb4,CB_ADDSTRING,0,(LPARAM)SEGPTR_GET(name)); + j=SendDlgItemMessage16(hDlg,cmb4,CB_ADDSTRING16,0,(LPARAM)SEGPTR_GET(name)); SEGPTR_FREE(name); - SendDlgItemMessage16(hDlg,cmb4, CB_SETITEMDATA,j,textcolors[j]); + SendDlgItemMessage16(hDlg,cmb4, CB_SETITEMDATA16,j,textcolors[j]); /* look for a fitting value in color combobox */ if (textcolors[j]==lpcf->rgbColors) - SendDlgItemMessage16(hDlg,cmb4, CB_SETCURSEL,j,0); + SendDlgItemMessage16(hDlg,cmb4, CB_SETCURSEL16,j,0); } } else @@ -2469,45 +2469,45 @@ LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM16 wParam, LPARAM lParam) hdc= (lpcf->Flags & CF_PRINTERFONTS && lpcf->hDC) ? lpcf->hDC : GetDC32(hDlg); if (hdc) { - if (!EnumFontFamilies (hdc, NULL,FontFamilyEnumProc,(LPARAM)GetDlgItem(hDlg,cmb1))) + if (!EnumFontFamilies16(hdc, NULL,FontFamilyEnumProc,(LPARAM)GetDlgItem(hDlg,cmb1))) dprintf_commdlg(stddeb,"WM_INITDIALOG: EnumFontFamilies returns 0\n"); if (lpcf->Flags & CF_INITTOLOGFONTSTRUCT) { /* look for fitting font name in combobox1 */ - j=SendDlgItemMessage16(hDlg,cmb1,CB_FINDSTRING,-1,(LONG)lpxx->lfFaceName); + j=SendDlgItemMessage16(hDlg,cmb1,CB_FINDSTRING16,-1,(LONG)lpxx->lfFaceName); if (j!=CB_ERR) { - SendDlgItemMessage16(hDlg,cmb1,CB_SETCURSEL,j,0); + SendDlgItemMessage16(hDlg,cmb1,CB_SETCURSEL16,j,0); SendMessage16(hDlg,WM_COMMAND,cmb1,MAKELONG(GetDlgItem(hDlg,cmb1),CBN_SELCHANGE)); init=1; /* look for fitting font style in combobox2 */ l=MAKELONG(lpxx->lfWeight > FW_MEDIUM ? FW_BOLD:FW_NORMAL,lpxx->lfItalic !=0); for (i=0;ilfHeight==(int)SendDlgItemMessage16(hDlg,cmb3, CB_GETITEMDATA,i,0)) - SendDlgItemMessage16(hDlg,cmb3,CB_SETCURSEL,i,0); + if (lpxx->lfHeight==(int)SendDlgItemMessage16(hDlg,cmb3, CB_GETITEMDATA16,i,0)) + SendDlgItemMessage16(hDlg,cmb3,CB_SETCURSEL16,i,0); } } if (!init) { - SendDlgItemMessage16(hDlg,cmb1,CB_SETCURSEL,0,0); + SendDlgItemMessage16(hDlg,cmb1,CB_SETCURSEL16,0,0); SendMessage16(hDlg,WM_COMMAND,cmb1,MAKELONG(GetDlgItem(hDlg,cmb1),CBN_SELCHANGE)); } } if (lpcf->Flags & CF_USESTYLE && lpcf->lpszStyle) { - j=SendDlgItemMessage16(hDlg,cmb2,CB_FINDSTRING,-1,(LONG)lpcf->lpszStyle); + j=SendDlgItemMessage16(hDlg,cmb2,CB_FINDSTRING16,-1,(LONG)lpcf->lpszStyle); if (j!=CB_ERR) { - j=SendDlgItemMessage16(hDlg,cmb2,CB_SETCURSEL,j,0); + j=SendDlgItemMessage16(hDlg,cmb2,CB_SETCURSEL16,j,0); SendMessage16(hDlg,WM_COMMAND,cmb2,MAKELONG(GetDlgItem(hDlg,cmb2),CBN_SELCHANGE)); } } @@ -2580,20 +2580,20 @@ LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM16 wParam, LPARAM lParam) switch (lpdi->CtlID) { case cmb1: /* dprintf_commdlg(stddeb,"WM_Drawitem cmb1\n"); */ - SendMessage16(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, + SendMessage16(lpdi->hwndItem, CB_GETLBTEXT16, lpdi->itemID, (LPARAM)SEGPTR_GET(buffer)); GetObject16( hBitmapTT, sizeof(bm), &bm ); TextOut16(lpdi->hDC, lpdi->rcItem.left + bm.bmWidth + 10, lpdi->rcItem.top, buffer, lstrlen16(buffer)); #if 0 - nFontType = SendMessage16(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L); + nFontType = SendMessage16(lpdi->hwndItem, CB_GETITEMDATA16, lpdi->itemID,0L); /* FIXME: draw bitmap if truetype usage */ if (nFontType&TRUETYPE_FONTTYPE) { hMemDC = CreateCompatibleDC(lpdi->hDC); hBitmap = SelectObject32(hMemDC, hBitmapTT); - BitBlt(lpdi->hDC, lpdi->rcItem.left, lpdi->rcItem.top, - bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY); + BitBlt32(lpdi->hDC, lpdi->rcItem.left, lpdi->rcItem.top, + bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY); SelectObject32(hMemDC, hBitmap); DeleteDC(hMemDC); } @@ -2601,18 +2601,18 @@ LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM16 wParam, LPARAM lParam) break; case cmb2: case cmb3: /* dprintf_commdlg(stddeb,"WM_DRAWITEN cmb2,cmb3\n"); */ - SendMessage16(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, + SendMessage16(lpdi->hwndItem, CB_GETLBTEXT16, lpdi->itemID, (LPARAM)SEGPTR_GET(buffer)); TextOut16(lpdi->hDC, lpdi->rcItem.left, lpdi->rcItem.top, buffer, lstrlen16(buffer)); break; case cmb4: /* dprintf_commdlg(stddeb,"WM_DRAWITEM cmb4 (=COLOR)\n"); */ - SendMessage16(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, + SendMessage16(lpdi->hwndItem, CB_GETLBTEXT16, lpdi->itemID, (LPARAM)SEGPTR_GET(buffer)); TextOut16(lpdi->hDC, lpdi->rcItem.left + 25+5, lpdi->rcItem.top, buffer, lstrlen16(buffer)); - cr = SendMessage16(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L); + cr = SendMessage16(lpdi->hwndItem, CB_GETITEMDATA16, lpdi->itemID,0L); hBrush = CreateSolidBrush32(cr); if (hBrush) { @@ -2674,17 +2674,17 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM16 wParam, LPARAM lParam) hdc=(lpcf->Flags & CF_PRINTERFONTS && lpcf->hDC) ? lpcf->hDC : GetDC32(hDlg); if (hdc) { - SendDlgItemMessage16(hDlg,cmb2,CB_RESETCONTENT,0,0); - SendDlgItemMessage16(hDlg,cmb3,CB_RESETCONTENT,0,0); - i=SendDlgItemMessage16(hDlg,cmb1,CB_GETCURSEL,0,0); + SendDlgItemMessage16(hDlg,cmb2,CB_RESETCONTENT16,0,0); + SendDlgItemMessage16(hDlg,cmb3,CB_RESETCONTENT16,0,0); + i=SendDlgItemMessage16(hDlg,cmb1,CB_GETCURSEL16,0,0); if (i!=CB_ERR) { HCURSOR16 hcursor=SetCursor(LoadCursor16(0,IDC_WAIT)); char *str = SEGPTR_ALLOC(256); - SendDlgItemMessage16(hDlg,cmb1,CB_GETLBTEXT,i, + SendDlgItemMessage16(hDlg,cmb1,CB_GETLBTEXT16,i, (LPARAM)SEGPTR_GET(str)); dprintf_commdlg(stddeb,"WM_COMMAND/cmb1 =>%s\n",str); - EnumFontFamilies(hdc,str,FontStyleEnumProc, + EnumFontFamilies16(hdc,str,FontStyleEnumProc, MAKELONG(GetDlgItem(hDlg,cmb2),GetDlgItem(hDlg,cmb3))); SetCursor(hcursor); SEGPTR_FREE(str); @@ -2706,14 +2706,14 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM16 wParam, LPARAM lParam) { char *str = SEGPTR_ALLOC(256); dprintf_commdlg(stddeb,"WM_COMMAND/cmb2,3 =%08lX\n", lParam); - i=SendDlgItemMessage16(hDlg,cmb1,CB_GETCURSEL,0,0); + i=SendDlgItemMessage16(hDlg,cmb1,CB_GETCURSEL16,0,0); if (i==CB_ERR) i=GetDlgItemText32A( hDlg, cmb1, str, 256 ); else { - SendDlgItemMessage16(hDlg,cmb1,CB_GETLBTEXT,i, + SendDlgItemMessage16(hDlg,cmb1,CB_GETLBTEXT16,i, (LPARAM)SEGPTR_GET(str)); - l=SendDlgItemMessage16(hDlg,cmb1,CB_GETITEMDATA,i,0); + l=SendDlgItemMessage16(hDlg,cmb1,CB_GETITEMDATA16,i,0); j=HIWORD(l); lpcf->nFontType = LOWORD(l); /* FIXME: lpcf->nFontType |= .... SIMULATED_FONTTYPE and so */ @@ -2724,18 +2724,18 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM16 wParam, LPARAM lParam) } strcpy(lpxx->lfFaceName,str); SEGPTR_FREE(str); - i=SendDlgItemMessage16(hDlg,cmb2,CB_GETCURSEL,0,0); + i=SendDlgItemMessage16(hDlg,cmb2,CB_GETCURSEL16,0,0); if (i!=CB_ERR) { - l=SendDlgItemMessage16(hDlg,cmb2,CB_GETITEMDATA,i,0); + l=SendDlgItemMessage16(hDlg,cmb2,CB_GETITEMDATA16,i,0); if (0!=(lpxx->lfItalic=HIWORD(l))) lpcf->nFontType |= ITALIC_FONTTYPE; if ((lpxx->lfWeight=LOWORD(l)) > FW_MEDIUM) lpcf->nFontType |= BOLD_FONTTYPE; } - i=SendDlgItemMessage16(hDlg,cmb3,CB_GETCURSEL,0,0); + i=SendDlgItemMessage16(hDlg,cmb3,CB_GETCURSEL16,0,0); if (i!=CB_ERR) - lpxx->lfHeight=-LOWORD(SendDlgItemMessage16(hDlg,cmb3,CB_GETITEMDATA,i,0)); + lpxx->lfHeight=-LOWORD(SendDlgItemMessage16(hDlg,cmb3,CB_GETITEMDATA16,i,0)); else lpxx->lfHeight=0; lpxx->lfStrikeOut=IsDlgButtonChecked(hDlg,chx1); @@ -2753,7 +2753,7 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM16 wParam, LPARAM lParam) } break; - case cmb4:i=SendDlgItemMessage16(hDlg,cmb4,CB_GETCURSEL,0,0); + case cmb4:i=SendDlgItemMessage16(hDlg,cmb4,CB_GETCURSEL16,0,0); if (i!=CB_ERR) { lpcf->rgbColors=textcolors[i]; diff --git a/misc/crtdll.c b/misc/crtdll.c index 4917a4ec30a..e7a8be6b3a9 100644 --- a/misc/crtdll.c +++ b/misc/crtdll.c @@ -20,6 +20,7 @@ #include "debug.h" #include "module.h" #include "xmalloc.h" +#include "heap.h" UINT32 CRTDLL_argc_dll; /* CRTDLL.23 */ LPSTR *CRTDLL_argv_dll; /* CRTDLL.24 */ @@ -140,6 +141,14 @@ int CRTDLL_printf(DWORD *args) return vfprintf(stdout,(LPSTR)(args[0]),args+1); } +/********************************************************************* + * sprintf (CRTDLL.458) + */ +int CRTDLL_sprintf(DWORD *args) +{ + return vsprintf((LPSTR)(args[0]),(LPSTR)(args[1]),args+2); +} + /********************************************************************* * time (CRTDLL.488) */ @@ -613,3 +622,20 @@ VOID CRTDLL_free(LPVOID ptr) { HeapFree(GetProcessHeap(),0,ptr); } + +/********************************************************************* + * _strdup (CRTDLL.285) + */ +LPSTR CRTDLL__strdup(LPSTR ptr) +{ + return HEAP_strdupA(GetProcessHeap(),0,ptr); +} + +/********************************************************************* + * fclose (CRTDLL.362) + */ +DWORD CRTDLL_fclose(LPVOID x) +{ + dprintf_crtdll(stdnimp,"fclose(%p)\n",x); + return 0; +} diff --git a/misc/exec.c b/misc/exec.c index 55941827a42..c69416d6fa0 100644 --- a/misc/exec.c +++ b/misc/exec.c @@ -113,7 +113,10 @@ BOOL WinHelp(HWND hWnd, LPSTR lpHelpFile, WORD wCommand, DWORD dwData) } hDest = FindWindow32A( "MS_WINHELP", NULL ); if(!hDest) - return FALSE; + if(wCommand == HELP_QUIT) + return TRUE; + else + return FALSE; switch(wCommand) { case HELP_CONTEXT: diff --git a/misc/registry.c b/misc/registry.c index b5ba088a9b3..cdd6751434e 100644 --- a/misc/registry.c +++ b/misc/registry.c @@ -20,6 +20,7 @@ #include "win.h" #include "winerror.h" #include "file.h" +#include "dos_fs.h" #include "string32.h" #include "stddebug.h" #include "debug.h" @@ -1054,8 +1055,6 @@ _w95dkelookup(unsigned long dkeaddr,int n,struct _w95nr2da *nr2da,struct _w95key return NULL; } -extern time_t FileTimeToUnixTime(FILETIME*); - static void _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) { /* Disk Key Entry structure (RGKN part) */ @@ -1211,7 +1210,7 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) { if (!GetFileInformationByHandle(hfd,&hfdinfo)) return; end = hfdinfo.nFileSizeLow; - lastmodified = FileTimeToUnixTime(&(hfdinfo.ftLastWriteTime)); + lastmodified = DOSFS_FileTimeToUnixTime(&(hfdinfo.ftLastWriteTime)); if (-1==_llseek(hfd,rgdbsection,SEEK_SET)) return; diff --git a/misc/shell.c b/misc/shell.c index 3bec8c74382..3a96897f31f 100644 --- a/misc/shell.c +++ b/misc/shell.c @@ -79,11 +79,8 @@ UINT DragQueryFile(HDROP16 hDrop, WORD wFile, LPSTR lpszFile, WORD wLength) hDrop,wFile,lpszFile,wLength); lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock16(hDrop); - if(!lpDropFileStruct) - { - dprintf_reg(stddeb,"DragQueryFile: unable to lock handle!\n"); - return 0; - } + if(!lpDropFileStruct) return 0; + lpCurrent = (LPSTR) lpDropFileStruct + lpDropFileStruct->wSize; i = 0; @@ -100,7 +97,7 @@ UINT DragQueryFile(HDROP16 hDrop, WORD wFile, LPSTR lpszFile, WORD wLength) i = (wLength > i) ? i : wLength-1; strncpy(lpszFile, lpCurrent, i); lpszFile[i] = '\0'; - + GlobalUnlock16(hDrop); return i; } @@ -121,7 +118,7 @@ void DragFinish(HDROP16 h) BOOL DragQueryPoint(HDROP16 hDrop, POINT16 *p) { LPDROPFILESTRUCT lpDropFileStruct; - BOOL bRet; + BOOL16 bRet; lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock16(hDrop); @@ -807,7 +804,7 @@ DWORD DoEnvironmentSubst(LPSTR str,WORD length) */ int RegisterShellHook(void *ptr) { - dprintf_reg(stdnimp, "RegisterShellHook : Empty Stub !!!\n"); + fprintf(stdnimp, "RegisterShellHook : Empty Stub !!!\n"); return 0; } @@ -817,7 +814,7 @@ int RegisterShellHook(void *ptr) */ int ShellHookProc(void) { - dprintf_reg(stdnimp, "ShellHookProc : Empty Stub !!!\n"); + fprintf(stdnimp, "ShellHookProc : Empty Stub !!!\n"); return 0; } diff --git a/misc/spy.c b/misc/spy.c index 3cdf52d2050..57ce9d939ab 100644 --- a/misc/spy.c +++ b/misc/spy.c @@ -215,15 +215,43 @@ static const char * const MessageTypeNames[SPY_MAX_MSGNUM + 1] = NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x0140 - Win32 Comboboxes */ - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + "CB_GETEDITSEL32", /* 0x0140 */ + "CB_LIMITTEXT32", /* 0x0141 */ + "CB_SETEDITSEL32", /* 0x0142 */ + "CB_ADDSTRING32", /* 0x0143 */ + "CB_DELETESTRING32", /* 0x0144 */ + "CB_DIR32", /* 0x0145 */ + "CB_GETCOUNT32", /* 0x0146 */ + "CB_GETCURSEL32", /* 0x0147 */ + "CB_GETLBTEXT32", /* 0x0148 */ + "CB_GETLBTEXTLEN32", /* 0x0149 */ + "CB_INSERTSTRING32", /* 0x014a */ + "CB_RESETCONTENT32", /* 0x014b */ + "CB_FINDSTRING32", /* 0x014c */ + "CB_SELECTSTRING32", /* 0x014d */ + "CB_SETCURSEL32", /* 0x014e */ + "CB_SHOWDROPDOWN32", /* 0x014f */ - /* 0x0150 */ - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + "CB_GETITEMDATA32", /* 0x0150 */ + "CB_SETITEMDATA32", /* 0x0151 */ + "CB_GETDROPPEDCONTROLRECT32",/* 0x0152 */ + "CB_SETITEMHEIGHT32", /* 0x0153 */ + "CB_GETITEMHEIGHT32", /* 0x0154 */ + "CB_SETEXTENDEDUI32", /* 0x0155 */ + "CB_GETEXTENDEDUI32", /* 0x0156 */ + "CB_GETDROPPEDSTATE32", /* 0x0157 */ + "CB_FINDSTRINGEXACT32", /* 0x0158 */ + "CB_SETLOCALE32", /* 0x0159 */ + "CB_GETLOCALE32", /* 0x015a */ + "CB_GETTOPINDEX32", /* 0x015b */ + "CB_SETTOPINDEX32", /* 0x015c */ + "CB_GETHORIZONTALEXTENT32", /* 0x015d */ + "CB_SETHORIZONTALEXTENT32", /* 0x015e */ + "CB_GETDROPPEDWIDTH32", /* 0x015f */ - /* 0x0160 */ - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + "CB_SETDROPPEDWIDTH32", /* 0x0160 */ + "CB_INITSTORAGE32", /* 0x0161 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x0170 - Win32 Static controls */ diff --git a/miscemu/int21.c b/miscemu/int21.c index d701a8bc015..1a4cc96b9d2 100644 --- a/miscemu/int21.c +++ b/miscemu/int21.c @@ -15,10 +15,10 @@ #include #include #include +#include "windows.h" #include "dos_fs.h" #include "drive.h" #include "file.h" -#include "windows.h" #include "msdos.h" #include "ldt.h" #include "task.h" diff --git a/objects/Makefile.in b/objects/Makefile.in index 56b330732c4..953c68d2fc4 100644 --- a/objects/Makefile.in +++ b/objects/Makefile.in @@ -6,7 +6,6 @@ VPATH = @srcdir@ MODULE = objects C_SRCS = \ - bitblt.c \ bitmap.c \ brush.c \ clipping.c \ diff --git a/objects/color.c b/objects/color.c index d5afb9d90c9..bc1615f58e5 100644 --- a/objects/color.c +++ b/objects/color.c @@ -482,9 +482,10 @@ static HPALETTE16 COLOR_InitPalette(void) /* Build free list */ if( COLOR_firstFree != -1 ) + { COLOR_FormatSystemPalette(); - - COLOR_FillDefaultColors(); + COLOR_FillDefaultColors(); + } /* create default palette (20 system colors) */ diff --git a/objects/cursoricon.c b/objects/cursoricon.c index a3388af2d25..df7be52a55b 100644 --- a/objects/cursoricon.c +++ b/objects/cursoricon.c @@ -25,6 +25,7 @@ #include #include #include "windows.h" +#include "color.h" #include "bitmap.h" #include "callback.h" #include "cursoricon.h" @@ -430,34 +431,86 @@ static HGLOBAL16 CURSORICON_Copy( HINSTANCE16 hInstance, HGLOBAL16 handle ) /*********************************************************************** * CURSORICON_IconToCursor * - * Should convert bitmap to mono and truncate if too large - * FIXME: if icon is passed returns a copy of OCR_DRAGOBJECT cursor - * but should actually convert icon to cursor. + * Converts bitmap to mono and truncates if icon is too large */ -HCURSOR16 CURSORICON_IconToCursor(HICON16 hIcon) +HCURSOR16 CURSORICON_IconToCursor(HICON16 hIcon, BOOL32 bSemiTransparent) { + HCURSOR16 hRet = 0; CURSORICONINFO *ptr = NULL; + HTASK16 hTask = GetCurrentTask(); + TDB* pTask = (TDB *)GlobalLock16(hTask); if(hIcon) if (!(ptr = (CURSORICONINFO*)GlobalLock16( hIcon ))) return FALSE; if (ptr->bPlanes * ptr->bBitsPerPixel == 1) + hRet = CURSORICON_Copy( pTask->hInstance, hIcon ); + else { - return hIcon; /* assuming it's a cursor */ + BYTE pAndBits[128]; + BYTE pXorBits[128]; + int x, y, ix, iy, shift; + int bpp = (ptr->bBitsPerPixel>=24)?32:ptr->bBitsPerPixel; /* this sucks */ + BYTE* psPtr = (BYTE *)(ptr + 1) + + ptr->nHeight * BITMAP_WIDTH_BYTES(ptr->nWidth,1); + BYTE* pxbPtr = pXorBits; + unsigned *psc = NULL, val = 0; + unsigned val_base = 0xffffffff >> (32 - bpp); + BYTE* pbc = NULL; + + COLORREF col; + CURSORICONINFO cI; + + if(!pTask) return 0; + + memset(pXorBits, 0, 128); + cI.bBitsPerPixel = 1; cI.bPlanes = 1; + cI.ptHotSpot.x = cI.ptHotSpot.y = 15; + cI.nWidth = 32; cI.nHeight = 32; + cI.nWidthBytes = 4; /* 1bpp */ + + x = (ptr->nWidth > 32) ? 32 : ptr->nWidth; + y = (ptr->nHeight > 32) ? 32 : ptr->nHeight; + + for( iy = 0; iy < y; iy++ ) + { + val = BITMAP_WIDTH_BYTES( ptr->nWidth, 1 ); + memcpy( pAndBits + iy * 4, + (BYTE *)(ptr + 1) + iy * val, (val>4) ? 4 : val); + shift = iy % 2; + + for( ix = 0; ix < x; ix++ ) + { + if( bSemiTransparent && ((ix+shift)%2) ) + { + pbc = pAndBits + iy * 4 + ix/8; + *pbc |= 0x80 >> (ix%8); + } + else + { + psc = (unsigned*)(psPtr + (ix * bpp)/8); + val = ((*psc) >> (ix * bpp)%8) & val_base; + col = COLOR_ToLogical(val); + if( GetRValue(col) > 0xa0 || + GetGValue(col) > 0x80 || + GetBValue(col) > 0xa0 ) + { + pbc = pxbPtr + ix/8; + *pbc |= 0x80 >> (ix%8); + } + } + } + psPtr += ptr->nWidthBytes; + pxbPtr += 4; + } + hRet = CreateCursorIconIndirect( pTask->hInstance , &cI, pAndBits, pXorBits); + + if( !hRet ) /* fall back on default drag cursor */ + hRet = CURSORICON_Copy( pTask->hInstance , + CURSORICON_Load(0,MAKEINTRESOURCE(OCR_DRAGOBJECT), + SYSMETRICS_CXCURSOR, SYSMETRICS_CYCURSOR, 1, TRUE) ); } - else - { - /* kludge */ - TDB* pTask = (TDB *)GlobalLock16( GetCurrentTask() ); - if(!pTask) return 0; - - fprintf( stdnimp, "IconToCursor: Icons are not supported, returning default!\n"); - return CURSORICON_Copy( pTask->hInstance , - CURSORICON_Load(0,MAKEINTRESOURCE(OCR_DRAGOBJECT), - SYSMETRICS_CXCURSOR, SYSMETRICS_CYCURSOR, 1, TRUE) ); - } - - return 0; + return hRet; } /*********************************************************************** @@ -627,9 +680,9 @@ BOOL DrawIcon( HDC16 hdc, INT x, INT y, HICON16 hIcon ) if (hXorBits && hAndBits) { HBITMAP32 hBitTemp = SelectObject32( hMemDC, hAndBits ); - BitBlt( hdc, x, y, ptr->nWidth, ptr->nHeight, hMemDC, 0, 0, SRCAND ); + BitBlt32( hdc, x, y, ptr->nWidth, ptr->nHeight, hMemDC, 0, 0, SRCAND ); SelectObject32( hMemDC, hXorBits ); - BitBlt( hdc, x, y, ptr->nWidth, ptr->nHeight, hMemDC, 0, 0, SRCINVERT); + BitBlt32(hdc, x, y, ptr->nWidth, ptr->nHeight, hMemDC, 0, 0,SRCINVERT); SelectObject32( hMemDC, hBitTemp ); } DeleteDC( hMemDC ); @@ -896,8 +949,8 @@ void GetCursorPos16( POINT16 *pt ) pt->x = pt->y = 0; else { - pt->x = rootX + desktopX; - pt->y = rootY + desktopY; + pt->x = childX; + pt->y = childY; } dprintf_cursor(stddeb, "GetCursorPos: ret=%d,%d\n", pt->x, pt->y ); } diff --git a/objects/dib.c b/objects/dib.c index 8ec1ce16dbc..7a4fcf0ef11 100644 --- a/objects/dib.c +++ b/objects/dib.c @@ -633,8 +633,8 @@ int StretchDIBits( HDC16 hdc, bits, info, wUsage ); hdcMem = CreateCompatibleDC( hdc ); hOldBitmap = SelectObject32( hdcMem, hBitmap ); - StretchBlt( hdc, xDest, yDest, wDestWidth, wDestHeight, - hdcMem, xSrc, ySrc, wSrcWidth, wSrcHeight, dwRop ); + StretchBlt32( hdc, xDest, yDest, wDestWidth, wDestHeight, + hdcMem, xSrc, ySrc, wSrcWidth, wSrcHeight, dwRop ); SelectObject32( hdcMem, hOldBitmap ); DeleteDC( hdcMem ); DeleteObject32( hBitmap ); diff --git a/objects/font.c b/objects/font.c index 0c4f2fe4d31..df3b10968ca 100644 --- a/objects/font.c +++ b/objects/font.c @@ -339,6 +339,78 @@ DWORD GetGlyphOutLine( HDC16 hdc, UINT uChar, UINT fuFormat, return (DWORD)-1; /* failure */ } +void +FONT_LOGFONT32AToLOGFONT16(const LOGFONT32A *font,LPLOGFONT16 font16) { + font16->lfHeight = (INT16)font->lfHeight; + font16->lfWidth = (INT16)font->lfWidth; + font16->lfEscapement = (INT16)font->lfEscapement; + font16->lfOrientation = (INT16)font->lfOrientation; + font16->lfWeight = (INT16)font->lfWeight; + font16->lfItalic = font->lfItalic; + font16->lfUnderline = font->lfUnderline; + font16->lfStrikeOut = font->lfStrikeOut; + font16->lfCharSet = font->lfCharSet; + font16->lfOutPrecision = font->lfOutPrecision; + font16->lfClipPrecision = font->lfClipPrecision; + font16->lfQuality = font->lfQuality; + font16->lfPitchAndFamily = font->lfPitchAndFamily; + lstrcpyn32A( font16->lfFaceName, font->lfFaceName, LF_FACESIZE ); +} + +void +FONT_LOGFONT32WToLOGFONT16(const LOGFONT32W *font,LPLOGFONT16 font16) { + font16->lfHeight = (INT16)font->lfHeight; + font16->lfWidth = (INT16)font->lfWidth; + font16->lfEscapement = (INT16)font->lfEscapement; + font16->lfOrientation = (INT16)font->lfOrientation; + font16->lfWeight = (INT16)font->lfWeight; + font16->lfItalic = font->lfItalic; + font16->lfUnderline = font->lfUnderline; + font16->lfStrikeOut = font->lfStrikeOut; + font16->lfCharSet = font->lfCharSet; + font16->lfOutPrecision = font->lfOutPrecision; + font16->lfClipPrecision = font->lfClipPrecision; + font16->lfQuality = font->lfQuality; + font16->lfPitchAndFamily = font->lfPitchAndFamily; + lstrcpynWtoA( font16->lfFaceName, font->lfFaceName, LF_FACESIZE ); +} + +void +FONT_LOGFONT16ToLOGFONT32A(LPLOGFONT16 font,LPLOGFONT32A font32A) { + font32A->lfHeight = (INT32)font->lfHeight; + font32A->lfWidth = (INT32)font->lfWidth; + font32A->lfEscapement = (INT32)font->lfEscapement; + font32A->lfOrientation = (INT32)font->lfOrientation; + font32A->lfWeight = (INT32)font->lfWeight; + font32A->lfItalic = font->lfItalic; + font32A->lfUnderline = font->lfUnderline; + font32A->lfStrikeOut = font->lfStrikeOut; + font32A->lfCharSet = font->lfCharSet; + font32A->lfOutPrecision = font->lfOutPrecision; + font32A->lfClipPrecision = font->lfClipPrecision; + font32A->lfQuality = font->lfQuality; + font32A->lfPitchAndFamily = font->lfPitchAndFamily; + lstrcpyn32A( font32A->lfFaceName, font->lfFaceName, LF_FACESIZE ); +} + +void +FONT_LOGFONT16ToLOGFONT32W(LPLOGFONT16 font,LPLOGFONT32W font32W) { + font32W->lfHeight = (INT32)font->lfHeight; + font32W->lfWidth = (INT32)font->lfWidth; + font32W->lfEscapement = (INT32)font->lfEscapement; + font32W->lfOrientation = (INT32)font->lfOrientation; + font32W->lfWeight = (INT32)font->lfWeight; + font32W->lfItalic = font->lfItalic; + font32W->lfUnderline = font->lfUnderline; + font32W->lfStrikeOut = font->lfStrikeOut; + font32W->lfCharSet = font->lfCharSet; + font32W->lfOutPrecision = font->lfOutPrecision; + font32W->lfClipPrecision = font->lfClipPrecision; + font32W->lfQuality = font->lfQuality; + font32W->lfPitchAndFamily = font->lfPitchAndFamily; + lstrcpynAtoW( font32W->lfFaceName, font->lfFaceName, LF_FACESIZE ); +} + /*********************************************************************** * CreateScalableFontResource (GDI.310) @@ -387,20 +459,8 @@ HFONT32 CreateFontIndirect32A( const LOGFONT32A *font ) { LOGFONT16 font16; - font16.lfHeight = (INT16)font->lfHeight; - font16.lfWidth = (INT16)font->lfWidth; - font16.lfEscapement = (INT16)font->lfEscapement; - font16.lfOrientation = (INT16)font->lfOrientation; - font16.lfWeight = (INT16)font->lfWeight; - font16.lfItalic = font->lfItalic; - font16.lfUnderline = font->lfUnderline; - font16.lfStrikeOut = font->lfStrikeOut; - font16.lfCharSet = font->lfCharSet; - font16.lfOutPrecision = font->lfOutPrecision; - font16.lfClipPrecision = font->lfClipPrecision; - font16.lfQuality = font->lfQuality; - font16.lfPitchAndFamily = font->lfPitchAndFamily; - lstrcpyn32A( font16.lfFaceName, font->lfFaceName, LF_FACESIZE ); + FONT_LOGFONT32AToLOGFONT16(font,&font16); + return CreateFontIndirect16( &font16 ); } @@ -412,20 +472,7 @@ HFONT32 CreateFontIndirect32W( const LOGFONT32W *font ) { LOGFONT16 font16; - font16.lfHeight = (INT16)font->lfHeight; - font16.lfWidth = (INT16)font->lfWidth; - font16.lfEscapement = (INT16)font->lfEscapement; - font16.lfOrientation = (INT16)font->lfOrientation; - font16.lfWeight = (INT16)font->lfWeight; - font16.lfItalic = font->lfItalic; - font16.lfUnderline = font->lfUnderline; - font16.lfStrikeOut = font->lfStrikeOut; - font16.lfCharSet = font->lfCharSet; - font16.lfOutPrecision = font->lfOutPrecision; - font16.lfClipPrecision = font->lfClipPrecision; - font16.lfQuality = font->lfQuality; - font16.lfPitchAndFamily = font->lfPitchAndFamily; - lstrcpynWtoA( font16.lfFaceName, font->lfFaceName, LF_FACESIZE ); + FONT_LOGFONT32WToLOGFONT16(font,&font16); return CreateFontIndirect16( &font16 ); } @@ -1224,7 +1271,7 @@ INT EnumFonts(HDC16 hDC, LPCSTR lpFaceName, FONTENUMPROC16 lpEnumFunc, LPARAM lp /************************************************************************* * EnumFontFamilies [GDI.330] */ -INT EnumFontFamilies(HDC16 hDC, LPCSTR lpszFamily, FONTENUMPROC16 lpEnumFunc, LPARAM lpData) +INT16 EnumFontFamilies16(HDC16 hDC, LPCSTR lpszFamily, FONTENUMPROC16 lpEnumFunc, LPARAM lpData) { HLOCAL16 hLog; HLOCAL16 hMet; @@ -1290,6 +1337,146 @@ INT EnumFontFamilies(HDC16 hDC, LPCSTR lpszFamily, FONTENUMPROC16 lpEnumFunc, LP return nRet; } +/************************************************************************* + * EnumFontFamiliesA [GDI32.80] + */ +INT32 EnumFontFamilies32A(HDC32 hDC, LPCSTR lpszFamily, FONTENUMPROC32A lpEnumFunc, LPARAM lpData) +{ + HLOCAL16 hLog; + HLOCAL16 hMet; + HFONT32 hFont; + HFONT32 hOldFont; + LPENUMLOGFONT32A lpEnumLogFont; + LPTEXTMETRIC32A lptm; + LPSTR lpOldName; + char FaceName[LF_FACESIZE]; + int nRet = 0; + int i; + + dprintf_font(stddeb,"EnumFontFamilies32A(%04x, %p, %08lx, %08lx)\n", + hDC, lpszFamily, (DWORD)lpEnumFunc, lpData); + if (lpEnumFunc == 0) return 0; + hLog = GDI_HEAP_ALLOC( sizeof(ENUMLOGFONT32A) ); + lpEnumLogFont = (LPENUMLOGFONT32A) GDI_HEAP_LIN_ADDR(hLog); + if (lpEnumLogFont == NULL) { + fprintf(stderr,"EnumFontFamilies // can't alloc LOGFONT struct !\n"); + return 0; + } + hMet = GDI_HEAP_ALLOC( sizeof(TEXTMETRIC32A) ); + lptm = (LPTEXTMETRIC32A) GDI_HEAP_LIN_ADDR(hMet); + if (lptm == NULL) { + GDI_HEAP_FREE(hLog); + fprintf(stderr,"EnumFontFamilies32A // can't alloc TEXTMETRIC struct !\n"); + return 0; + } + lpOldName = NULL; + if (lpszFamily != NULL) { + strcpy(FaceName, lpszFamily); + AnsiUpper(FaceName); + } + if (lpLogFontList[0] == NULL) InitFontsList(); + for(i = 0; lpLogFontList[i] != NULL; i++) { + if (lpszFamily == NULL) { + if (lpOldName != NULL) { + if (strcmp(lpOldName,lpLogFontList[i]->lfFaceName) == 0) continue; + } + lpOldName = lpLogFontList[i]->lfFaceName; + } else { + if (strcmp(FaceName, lpLogFontList[i]->lfFaceName) != 0) continue; + } + FONT_LOGFONT16ToLOGFONT32A(lpLogFontList[i],&(lpEnumLogFont->elfLogFont)); + strcpy(lpEnumLogFont->elfFullName,""); + strcpy(lpEnumLogFont->elfStyle,""); + hFont = CreateFontIndirect32A((LPLOGFONT32A)lpEnumLogFont); + hOldFont = SelectObject32(hDC, hFont); + GetTextMetrics32A(hDC, lptm); + SelectObject32(hDC, hOldFont); + DeleteObject32(hFont); + dprintf_font(stddeb, "EnumFontFamilies32A // i=%d lpLogFont=%p lptm=%p\n", i, lpEnumLogFont, lptm); + + nRet = lpEnumFunc( GDI_HEAP_LIN_ADDR(hLog), GDI_HEAP_LIN_ADDR(hMet), + 0, lpData ); + if (nRet == 0) { + dprintf_font(stddeb,"EnumFontFamilies32A // EnumEnd requested by application !\n"); + break; + } + } + GDI_HEAP_FREE(hMet); + GDI_HEAP_FREE(hLog); + return nRet; +} + +/************************************************************************* + * EnumFontFamiliesW [GDI32.83] + */ +INT32 EnumFontFamilies32W(HDC32 hDC, LPCWSTR lpszFamilyW, FONTENUMPROC32W lpEnumFunc, LPARAM lpData) +{ + HLOCAL16 hLog; + HLOCAL16 hMet; + HFONT32 hFont; + HFONT32 hOldFont; + LPENUMLOGFONT32W lpEnumLogFont; + LPTEXTMETRIC32W lptm; + LPSTR lpOldName; + char FaceName[LF_FACESIZE]; + int nRet = 0; + int i; + LPCSTR lpszFamily=lpszFamilyW?STRING32_DupUniToAnsi(lpszFamilyW):NULL; + + dprintf_font(stddeb,"EnumFontFamilies32W(%04x, %p, %08lx, %08lx)\n", + hDC, lpszFamily, (DWORD)lpEnumFunc, lpData); + if (lpEnumFunc == 0) return 0; + hLog = GDI_HEAP_ALLOC( sizeof(ENUMLOGFONT32W) ); + lpEnumLogFont = (LPENUMLOGFONT32W) GDI_HEAP_LIN_ADDR(hLog); + if (lpEnumLogFont == NULL) { + fprintf(stderr,"EnumFontFamilies32W // can't alloc LOGFONT struct !\n"); + return 0; + } + hMet = GDI_HEAP_ALLOC( sizeof(TEXTMETRIC32W) ); + lptm = (LPTEXTMETRIC32W) GDI_HEAP_LIN_ADDR(hMet); + if (lptm == NULL) { + GDI_HEAP_FREE(hLog); + fprintf(stderr,"EnumFontFamilies32W // can't alloc TEXTMETRIC struct !\n"); + return 0; + } + lpOldName = NULL; + if (lpszFamily != NULL) { + strcpy(FaceName, lpszFamily); + AnsiUpper(FaceName); + } + if (lpLogFontList[0] == NULL) InitFontsList(); + for(i = 0; lpLogFontList[i] != NULL; i++) { + if (lpszFamily == NULL) { + if (lpOldName != NULL) { + if (strcmp(lpOldName,lpLogFontList[i]->lfFaceName) == 0) continue; + } + lpOldName = lpLogFontList[i]->lfFaceName; + } else { + if (strcmp(FaceName, lpLogFontList[i]->lfFaceName) != 0) continue; + } + FONT_LOGFONT16ToLOGFONT32W(lpLogFontList[i],&(lpEnumLogFont->elfLogFont)); + lstrcpynAtoW(lpEnumLogFont->elfFullName,"",1); + lstrcpynAtoW(lpEnumLogFont->elfStyle,"",1); + hFont = CreateFontIndirect32W((LPLOGFONT32W)lpEnumLogFont); + hOldFont = SelectObject32(hDC, hFont); + GetTextMetrics32W(hDC, lptm); + SelectObject32(hDC, hOldFont); + DeleteObject32(hFont); + dprintf_font(stddeb, "EnumFontFamilies32W // i=%d lpLogFont=%p lptm=%p\n", i, lpEnumLogFont, lptm); + + nRet = lpEnumFunc( GDI_HEAP_LIN_ADDR(hLog), GDI_HEAP_LIN_ADDR(hMet), + 0, lpData ); + if (nRet == 0) { + dprintf_font(stddeb,"EnumFontFamilies32W // EnumEnd requested by application !\n"); + break; + } + } + GDI_HEAP_FREE(hMet); + GDI_HEAP_FREE(hLog); + return nRet; +} + + /************************************************************************* * GetRasterizerCaps [GDI.313] */ diff --git a/objects/metafile.c b/objects/metafile.c index ad885d6ca55..65e5484a442 100644 --- a/objects/metafile.c +++ b/objects/metafile.c @@ -522,9 +522,9 @@ void PlayMetaFileRecord(HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr, break; case META_PATBLT: - PatBlt(hdc, *(mr->rdParam + 5), *(mr->rdParam + 4), - *(mr->rdParam + 3), *(mr->rdParam + 2), - MAKELONG(*(mr->rdParam), *(mr->rdParam + 1))); + PatBlt16(hdc, *(mr->rdParam + 5), *(mr->rdParam + 4), + *(mr->rdParam + 3), *(mr->rdParam + 2), + MAKELONG(*(mr->rdParam), *(mr->rdParam + 1))); break; case META_SAVEDC: @@ -705,7 +705,7 @@ void PlayMetaFileRecord(HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr, mr->rdParam[14], /*BitsPixel*/ (LPSTR)&mr->rdParam[15]); /*bits*/ SelectObject32(hdcSrc,hbitmap); - StretchBlt(hdc,mr->rdParam[9],mr->rdParam[8], + StretchBlt32(hdc,mr->rdParam[9],mr->rdParam[8], mr->rdParam[7],mr->rdParam[6], hdcSrc,mr->rdParam[5],mr->rdParam[4], mr->rdParam[3],mr->rdParam[2], @@ -721,11 +721,10 @@ void PlayMetaFileRecord(HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr, mr->rdParam[10]/*Planes*/,mr->rdParam[11]/*BitsPixel*/, (LPSTR)&mr->rdParam[12]/*bits*/); SelectObject32(hdcSrc,hbitmap); - BitBlt(hdc,mr->rdParam[6],mr->rdParam[5], - mr->rdParam[4],mr->rdParam[3], - hdcSrc, - mr->rdParam[2],mr->rdParam[1], - MAKELONG(0,mr->rdParam[0])); + BitBlt32(hdc,mr->rdParam[6],mr->rdParam[5], + mr->rdParam[4],mr->rdParam[3], + hdcSrc, mr->rdParam[2],mr->rdParam[1], + MAKELONG(0,mr->rdParam[0])); DeleteDC(hdcSrc); } break; @@ -1157,16 +1156,14 @@ BOOL32 MF_MetaPoly(DC *dc, short func, LPPOINT16 pt, short count) * MF_BitBlt */ BOOL32 MF_BitBlt(DC *dcDest, short xDest, short yDest, short width, - short height, HDC16 hdcSrc, short xSrc, short ySrc, DWORD rop) + short height, DC *dcSrc, short xSrc, short ySrc, DWORD rop) { BOOL32 ret; DWORD len; HGLOBAL16 hmr; METARECORD *mr; - DC *dcSrc; BITMAP16 BM; - if (!(dcSrc = (DC *) GDI_GetObjPtr( hdcSrc, DC_MAGIC ))) return 0; GetObject16(dcSrc->w.hBitmap, sizeof(BITMAP16), &BM); len = sizeof(METARECORD) + 12 * sizeof(INT16) + BM.bmWidthBytes * BM.bmHeight; if (!(hmr = GlobalAlloc16(GMEM_MOVEABLE, len))) @@ -1207,20 +1204,18 @@ BOOL32 MF_BitBlt(DC *dcDest, short xDest, short yDest, short width, #define STRETCH_VIA_DIB #undef STRETCH_VIA_DIB BOOL32 MF_StretchBlt(DC *dcDest, short xDest, short yDest, short widthDest, - short heightDest, HDC16 hdcSrc, short xSrc, short ySrc, + short heightDest, DC *dcSrc, short xSrc, short ySrc, short widthSrc, short heightSrc, DWORD rop) { BOOL32 ret; DWORD len; HGLOBAL16 hmr; METARECORD *mr; - DC *dcSrc; BITMAP16 BM; #ifdef STRETCH_VIA_DIB LPBITMAPINFOHEADER lpBMI; WORD nBPP; #endif - if (!(dcSrc = (DC *) GDI_GetObjPtr( hdcSrc, DC_MAGIC ))) return 0; GetObject16(dcSrc->w.hBitmap, sizeof(BITMAP16), &BM); #ifdef STRETCH_VIA_DIB nBPP = BM.bmPlanes * BM.bmBitsPixel; @@ -1240,8 +1235,8 @@ BOOL32 MF_StretchBlt(DC *dcDest, short xDest, short yDest, short widthDest, lpBMI->biClrUsed = nBPP != 24 ? 1 << nBPP : 0; lpBMI->biSizeImage = ((lpBMI->biWidth * nBPP + 31) / 32) * 4 * lpBMI->biHeight; lpBMI->biCompression = BI_RGB; - lpBMI->biXPelsPerMeter = MulDiv32(GetDeviceCaps(hdcSrc,LOGPIXELSX),3937,100); - lpBMI->biYPelsPerMeter = MulDiv32(GetDeviceCaps(hdcSrc,LOGPIXELSY),3937,100); + lpBMI->biXPelsPerMeter = MulDiv32(GetDeviceCaps(dcSrc->hSelf,LOGPIXELSX),3937,100); + lpBMI->biYPelsPerMeter = MulDiv32(GetDeviceCaps(dcSrc->hSelf,LOGPIXELSY),3937,100); lpBMI->biClrImportant = 0; /* 1 meter = 39.37 inch */ dprintf_metafile(stddeb,"MF_StretchBltViaDIB->len = %ld rop=%lx PixYPM=%ld Caps=%d\n", diff --git a/objects/palette.c b/objects/palette.c index 39a1ae74fcd..7a67571aaa0 100644 --- a/objects/palette.c +++ b/objects/palette.c @@ -9,8 +9,10 @@ #include #include +#include "gdi.h" #include "color.h" #include "palette.h" +#include "xmalloc.h" #include "stddebug.h" /* #define DEBUG_PALETTE */ #include "debug.h" @@ -120,12 +122,38 @@ WORD SetPaletteEntries( HPALETTE16 hpalette, WORD start, WORD count, */ BOOL ResizePalette(HPALETTE16 hPal, UINT cEntries) { + PALETTEOBJ * palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hPal, PALETTE_MAGIC ); + UINT cPrevEnt, prevVer; + int prevsize, size = sizeof(LOGPALETTE) + (cEntries - 1) * sizeof(PALETTEENTRY); + int* mapping = NULL; - /* should simply realloc memory and zero out - * added entries, if any */ + dprintf_palette(stddeb,"ResizePalette: hpal = %04x, prev = %i, new = %i\n", + hPal, (palPtr)? -1: palPtr->logpalette.palNumEntries, cEntries ); + if( !palPtr ) return FALSE; + cPrevEnt = palPtr->logpalette.palNumEntries; + prevVer = palPtr->logpalette.palVersion; + prevsize = sizeof(LOGPALETTE) + (cPrevEnt - 1) * sizeof(PALETTEENTRY) + + sizeof(int*) + sizeof(GDIOBJHDR); + size += sizeof(int*) + sizeof(GDIOBJHDR); + mapping = palPtr->mapping; - fprintf(stdnimp,"ResizePalette: empty stub! \n"); - return FALSE; + GDI_HEAP_REALLOC( hPal, size ); + palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hPal, PALETTE_MAGIC ); + if( !palPtr ) return FALSE; + + if( mapping ) + palPtr->mapping = (int*) xrealloc( mapping, cEntries * sizeof(int) ); + if( cEntries > cPrevEnt ) + { + if( mapping ) + memset(palPtr->mapping + cPrevEnt, 0, (cEntries - cPrevEnt)*sizeof(int)); + memset( (BYTE*)palPtr + prevsize, 0, size - prevsize ); + PALETTE_ValidateFlags((PALETTEENTRY*)((BYTE*)palPtr + prevsize), + cEntries - cPrevEnt ); + } + palPtr->logpalette.palNumEntries = cEntries; + palPtr->logpalette.palVersion = prevVer; + return TRUE; } /*********************************************************************** diff --git a/objects/region.c b/objects/region.c index 4404062c011..40dae54199f 100644 --- a/objects/region.c +++ b/objects/region.c @@ -487,7 +487,7 @@ static INT32 REGION_CopyRegion( RGNOBJ *src, RGNOBJ *dest ) * * Add rectangle to region */ -BOOL32 REGION_UnionRectWithRgn( HRGN32 hRgn, LPRECT16 rc ) +BOOL32 REGION_UnionRectWithRgn( HRGN32 hRgn, const RECT32 *rc ) { RGNOBJ *rgnObj = (RGNOBJ*) GDI_GetObjPtr( hRgn, REGION_MAGIC ); XRectangle rect = { rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top }; diff --git a/objects/text.c b/objects/text.c index 1862afef58f..782fe70231a 100644 --- a/objects/text.c +++ b/objects/text.c @@ -447,17 +447,9 @@ BOOL16 ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags, if (flags & ETO_CLIPPED) { - if (dc->w.flags & DC_MEMORY) - { - hRgnClip = dc->w.hClipRgn; - CLIPPING_IntersectClipRect(dc, rect.left, rect.top, rect.right, rect.bottom, - CLIP_INTERSECT | CLIP_KEEPRGN); - } - else - { - SaveVisRgn( hdc ); - IntersectVisRect( hdc, rect.left, rect.top, rect.right, rect.bottom ); - } + hRgnClip = dc->w.hClipRgn; + CLIPPING_IntersectClipRect( dc, rect.left, rect.top, rect.right, + rect.bottom, CLIP_INTERSECT|CLIP_KEEPRGN ); } /* Draw the text background if necessary */ @@ -565,11 +557,7 @@ BOOL16 ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags, dc->w.DCOrgX + x + info.width, dc->w.DCOrgY + y - lineAscent ); } - if (flags & ETO_CLIPPED) - { - if (dc->w.flags & DC_MEMORY) SelectClipRgn16( hdc, hRgnClip ); - else RestoreVisRgn( hdc ); - } + if (flags & ETO_CLIPPED) SelectClipRgn32( hdc, hRgnClip ); return TRUE; } diff --git a/programs/progman/Makefile.in b/programs/progman/Makefile.in index ddf06ce12a6..ea2e954086c 100644 --- a/programs/progman/Makefile.in +++ b/programs/progman/Makefile.in @@ -6,6 +6,7 @@ MODULE = none PROGRAMS = progman ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LDLIBS) DEFS = -I$(SRCDIR) +RCFLAGS = -w32 LANGUAGES = En De Fr Fi LICENSELANG = En diff --git a/programs/winhelp/Makefile.in b/programs/winhelp/Makefile.in index cb6a691765f..d70b71624e9 100644 --- a/programs/winhelp/Makefile.in +++ b/programs/winhelp/Makefile.in @@ -5,6 +5,7 @@ VPATH = @srcdir@ MODULE = none PROGRAMS = winhelp hlp2sgml ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LDLIBS) +RCFLAGS = -w32 LANGUAGES = En De Fr Fi diff --git a/rc/winerc.c b/rc/winerc.c index 43a27f3be77..63a9f4e6247 100644 --- a/rc/winerc.c +++ b/rc/winerc.c @@ -21,11 +21,12 @@ char usage[]="winerc -bdvc -p prefix -o outfile < infile \n" " -d Output debugging information\n" " -p prefix Give a prefix for the generated names\n" " -v Show each resource as it is processed\n" - " -o file Output to file.c and file.h\n"; - + " -o file Output to file.c and file.h\n" + " -w 16|32 Select win16 or win32 output\n"; /*might be overwritten by command line*/ char *prefix="_Resource"; +int win32=1; int verbose,constant; gen_res* g_start; FILE *header,*code; @@ -55,7 +56,7 @@ int main(int argc,char *argv[]) char* tmpc; int optc,lose,ret,binary; lose=binary=0; - while((optc=getopt(argc,argv,"bcdp:vo:"))!=EOF) + while((optc=getopt(argc,argv,"bcdp:vo:w:"))!=EOF) switch(optc) { /* bison will print state transitions on stderr */ @@ -76,6 +77,10 @@ int main(int argc,char *argv[]) setbuf(stderr,0); break; case 'o':set_out_file(optarg);break; + case 'w':if(!strcmp(optarg,"16"))win32=0; + else if(!strcmp(optarg,"32"))win32=1; + else lose++; + break; default: lose++;break; } if(lose)return fprintf(stderr,usage),1; @@ -195,6 +200,35 @@ gen_res* insert_bytes(gen_res* res,char* bytes,int start,int length) return res; } +/* insert string into res, starting at start */ +gen_res* insert_string(gen_res* res,unsigned char* string,int start,int terminating0) +{ + unsigned char* p; + int lengthA = strlen(string) + (terminating0 ? 1 : 0); + int length = (win32 ? 2 : 1) * lengthA; + while(res->size+length>res->space)res=grow(res); + save_memcpy(res->res+start+length,res->res+start,res->size-start); + p=res->res+start; + while(lengthA--) + if (win32) + { + put_WORD(p, *string++); + p+=2; + } + else + *p++=*string++; + res->size+=length; + return res; +} + +/* insert string at offset 0, increase num_entries */ +gen_res* insert_string_at_beginning(gen_res* res,char* entry,int terminating0) +{ + res=insert_string(res,entry,0,terminating0); + res->num_entries++; + return res; +} + /*delete len bytes from res, starting at start*/ gen_res* delete_bytes(gen_res* res,int start,int len) { @@ -253,7 +287,7 @@ gen_res* add_vk_accelerator(int ev, int id, int flags, gen_res* prev) /* create a new dialog header, set all items to 0 */ gen_res* new_dialog() { gen_res* ret=new_res(); - ret->size=16; /*all strings "\0", no font*/ + ret->size=win32?24:16; /*all strings "\0", no font*/ return ret; } @@ -266,18 +300,18 @@ gen_res* dialog_style(rc_style* style, gen_res* attr) return attr; } -/* menu name is at offset 13 */ +/* menu name is at offset 13 (win32: 18) */ int dialog_get_menu(gen_res* attr) { - return 13; + return win32?18:13; } /* the class is after the menu name */ int dialog_get_class(gen_res* attr) { int offs=dialog_get_menu(attr); - while(attr->res[offs])offs++; - offs++; + while(attr->res[offs]||(win32&&attr->res[offs+1]))offs+=win32?2:1; + offs+=win32?2:1; return offs; } @@ -285,8 +319,8 @@ int dialog_get_class(gen_res* attr) int dialog_get_caption(gen_res* attr) { int offs=dialog_get_class(attr); - while(attr->res[offs])offs++; - offs++; + while(attr->res[offs]||(win32&&attr->res[offs+1]))offs+=win32?2:1; + offs+=win32?2:1; return offs; } @@ -294,8 +328,8 @@ int dialog_get_caption(gen_res* attr) int dialog_get_fontsize(gen_res* attr) { int offs=dialog_get_caption(attr); - while(attr->res[offs])offs++; - offs++; + while(attr->res[offs]||(win32&&attr->res[offs+1]))offs+=win32?2:1; + offs+=win32?2:1; return offs; } @@ -304,7 +338,7 @@ int dialog_get_fontsize(gen_res* attr) gen_res* dialog_caption(char* cap, gen_res*attr) { /* we don't need the terminating 0 as it's already there */ - return insert_bytes(attr,cap,dialog_get_caption(attr),strlen(cap)); + return insert_string(attr,cap,dialog_get_caption(attr),0); } @@ -318,31 +352,47 @@ gen_res* dialog_font(short size,char* font,gen_res *attr) attr=insert_bytes(attr,c_size,offs,2); offs+=2; /* as there is no font name by default, copy the '\0' */ - return insert_bytes(attr,font,offs,strlen(font)+1); + return insert_string(attr,font,offs,1); } gen_res* dialog_class(char* cap, gen_res*attr) { - return insert_bytes(attr,cap,dialog_get_class(attr),strlen(cap)); + return insert_string(attr,cap,dialog_get_class(attr),0); } gen_res* dialog_menu(char* cap, gen_res*attr) { - return insert_bytes(attr,cap,dialog_get_menu(attr),strlen(cap)); + return insert_string(attr,cap,dialog_get_menu(attr),0); } /* set the dialogs id, position, extent, and style */ gen_res* create_control_desc(int id,int x,int y,int cx, int cy,rc_style *style) { gen_res* ret=new_res(); int s=WS_VISIBLE|WS_CHILD; /*defaults styles for any control*/ - put_WORD(ret->res+0,x); - put_WORD(ret->res+2,y); - put_WORD(ret->res+4,cx); - put_WORD(ret->res+6,cy); - put_WORD(ret->res+8,id); - if(style)s=(s|style->or)&style->and; - put_DWORD(ret->res+10,s); - ret->size=17; /*empty strings, unused byte*/ + if(win32) + { + if(style)s=(s|style->or)&style->and; + put_DWORD(ret->res+0,s); + /* FIXME */ + /* put_WORD(ret->res+4, exStyle); */ + put_WORD(ret->res+8,x); + put_WORD(ret->res+10,y); + put_WORD(ret->res+12,cx); + put_WORD(ret->res+14,cy); + put_WORD(ret->res+16,id); + ret->size=24; /*empty strings, unused byte*/ + } + else + { + put_WORD(ret->res+0,x); + put_WORD(ret->res+2,y); + put_WORD(ret->res+4,cx); + put_WORD(ret->res+6,cy); + put_WORD(ret->res+8,id); + if(style)s=(s|style->or)&style->and; + put_DWORD(ret->res+10,s); + ret->size=17; /*empty strings, unused byte*/ + } return ret; } @@ -350,45 +400,99 @@ gen_res* create_control_desc(int id,int x,int y,int cx, int cy,rc_style *style) gen_res* label_control_desc(char* label,gen_res* cd) { int offs; - if(cd->res[14]&0x80)offs=15; /* one-character class */ - else { - for(offs=14;cd->res[offs];offs++); - offs++; + if(win32) { + if(get_WORD(cd->res+18)==0xffff)offs=20; /* one-character class */ + else { + for(offs=18;get_WORD(cd->res+offs);offs+=2); + offs+=2; + } } - return insert_bytes(cd,label,offs,strlen(label)); + else { + if(cd->res[14]&0x80)offs=15; /* one-character class */ + else { + for(offs=14;cd->res[offs];offs++); + offs++; + } + } + return insert_string(cd,label,offs,0); } /* a CONTROL was specified */ gen_res* create_generic_control(char* label,int id,char* class, rc_style*style,int x,int y,int cx,int cy) -{ char cl; - gen_res* ret=new_res(); - put_WORD(ret->res+0,x); - put_WORD(ret->res+2,y); - put_WORD(ret->res+4,cx); - put_WORD(ret->res+6,cy); - put_WORD(ret->res+8,id); - put_DWORD(ret->res+10,style->or); - ret->size=17; - ret=insert_bytes(ret,label,15,strlen(label)); - /* is it a predefined class? */ - cl=0; - if(!strcmp(class,"BUTTON"))cl=CT_BUTTON; - if(!strcmp(class,"EDIT"))cl=CT_EDIT; - if(!strcmp(class,"STATIC"))cl=CT_STATIC; - if(!strcmp(class,"LISTBOX"))cl=CT_LISTBOX; - if(!strcmp(class,"SCROLLBAR"))cl=CT_SCROLLBAR; - if(!strcmp(class,"COMBOBOX"))cl=CT_COMBOBOX; - if(cl)ret->res[14]=cl; - else ret=insert_bytes(ret,class,14,strlen(class)); +{ gen_res* ret=new_res(); + if(win32) + { + WORD cl; + put_DWORD(ret->res+0,style->or); + /* FIXME */ + /* put_DWORD(ret->res+4,exstyle->or); */ + put_WORD(ret->res+8,x); + put_WORD(ret->res+10,y); + put_WORD(ret->res+12,cx); + put_WORD(ret->res+14,cy); + put_WORD(ret->res+16,id); + ret->size=win32?24:17; + ret=insert_string(ret,label,20,0); + /* is it a predefined class? */ + cl=0; + if(!strcmp(class,"BUTTON"))cl=CT_BUTTON; + if(!strcmp(class,"EDIT"))cl=CT_EDIT; + if(!strcmp(class,"STATIC"))cl=CT_STATIC; + if(!strcmp(class,"LISTBOX"))cl=CT_LISTBOX; + if(!strcmp(class,"SCROLLBAR"))cl=CT_SCROLLBAR; + if(!strcmp(class,"COMBOBOX"))cl=CT_COMBOBOX; + if(cl) { + char ffff[2]={0xff, 0xff}; + ret=insert_bytes(ret,ffff,18,2); + put_WORD(ret->res+20,cl); + } + else ret=insert_string(ret,class,18,0); + } + else + { + char cl; + put_WORD(ret->res+0,x); + put_WORD(ret->res+2,y); + put_WORD(ret->res+4,cx); + put_WORD(ret->res+6,cy); + put_WORD(ret->res+8,id); + put_DWORD(ret->res+10,style->or); + ret->size=17; + ret=insert_string(ret,label,15,0); + /* is it a predefined class? */ + cl=0; + if(!strcmp(class,"BUTTON"))cl=CT_BUTTON; + if(!strcmp(class,"EDIT"))cl=CT_EDIT; + if(!strcmp(class,"STATIC"))cl=CT_STATIC; + if(!strcmp(class,"LISTBOX"))cl=CT_LISTBOX; + if(!strcmp(class,"SCROLLBAR"))cl=CT_SCROLLBAR; + if(!strcmp(class,"COMBOBOX"))cl=CT_COMBOBOX; + if(cl)ret->res[14]=cl; + else ret=insert_string(ret,class,14,0); + } return ret; } /* insert cd into rest, set the type, add flags */ gen_res* add_control(int type,int flags,gen_res*cd,gen_res* rest) { - put_DWORD(cd->res+10,get_DWORD(cd->res+10)|flags); - cd->res[14]=type; + char zeros[4]={0,0,0,0}; + if(win32) + { + char ffff[2]={0xff, 0xff}; + put_DWORD(cd->res+0,get_DWORD(cd->res+0)|flags); + cd=insert_bytes(cd,ffff,18,2); + put_WORD(cd->res+20,type); + } + else + { + put_DWORD(cd->res+10,get_DWORD(cd->res+10)|flags); + cd->res[14]=type; + } + /* WIN32: First control is on dword boundary */ + if(win32 && cd->size%4) + cd=insert_bytes(cd,zeros,cd->size,4-cd->size%4); return insert_at_beginning(rest,cd->res,cd->size); } @@ -412,12 +516,28 @@ gen_res* add_generic_control(gen_res* ctl, gen_res* rest) Set position and extent */ gen_res* make_dialog(gen_res* header,int x,int y,int cx,int cy,gen_res* ctls) { - header->res[4]=ctls->num_entries; - header->type=dlg; - put_WORD(header->res+5,x); - put_WORD(header->res+7,y); - put_WORD(header->res+9,cx); - put_WORD(header->res+11,cy); + char zeros[4]={0,0,0,0}; + if(win32) + { + put_WORD(header->res+8, ctls->num_entries); + header->type=dlg; + put_WORD(header->res+10,x); + put_WORD(header->res+12,y); + put_WORD(header->res+14,cx); + put_WORD(header->res+16,cy); + } + else + { + header->res[4]=ctls->num_entries; + header->type=dlg; + put_WORD(header->res+5,x); + put_WORD(header->res+7,y); + put_WORD(header->res+9,cx); + put_WORD(header->res+11,cy); + } + /* WIN32: First control is on dword boundary */ + if(win32 && header->size%4) + header=insert_bytes(header,zeros,header->size,4-header->size%4); return insert_bytes(header,ctls->res,header->size,ctls->size); } @@ -473,7 +593,7 @@ gen_res *add_menuitem(char* name,int id,int flags,gen_res *res) if(res->num_entries==0)flags|=MF_END; put_WORD(item,flags); put_WORD(item+2,id); - res=insert_at_beginning(res,name,strlen(name)+1); + res=insert_string_at_beginning(res,name,1); res=insert_bytes(res,item,0,4); return res; } @@ -486,7 +606,7 @@ gen_res *add_popup(char *name,short flags, gen_res* body, gen_res*res) if(res->num_entries==0)flags|=MF_END; put_WORD(c_flags,flags); res=insert_at_beginning(res,body->res,body->size); - res=insert_bytes(res,name,0,strlen(name)+1); + res=insert_string(res,name,0,1); res=insert_bytes(res,c_flags,0,2); return res; } @@ -543,27 +663,45 @@ gen_res* add_string_table(gen_res* t) int size,i; gen_res* res; unsigned char* p; - char* q; + unsigned char* q; if(!string_table) return t; for(ste=string_table; ste; ste=ste->next) { for(size=0,i=0; i<16; i++) - size += ste->strings[i] ? strlen(ste->strings[i])+1 : 1; + size += (win32 ? 2 : 1) * (ste->strings[i] ? strlen(ste->strings[i])+1 : 1); res=new_res(); while(res->spacetype=str; res->n.i_name=ste->group; res->n_type=0; res->size=size; - for(p=res->res,i=0; i<16; i++) - if((q=ste->strings[i])==NULL) - *p++ = 0; - else - { - *p++ = strlen(q); - while(*q) *p++ = *q++; - } + if (win32) + for(p=res->res,i=0; i<16; i++) + if((q=ste->strings[i])==NULL) + { + put_WORD(p, 0); + p+=2; + } + else + { + put_WORD(p, strlen(q)); + p+=2; + while(*q) + { + put_WORD(p, *q++); + p+=2; + } + } + else + for(p=res->res,i=0; i<16; i++) + if((q=ste->strings[i])==NULL) + *p++ = 0; + else + { + *p++ = strlen(q); + while(*q) *p++ = *q++; + } t=add_resource(res,t); } return t; @@ -628,8 +766,9 @@ void create_output(gen_res* top) for(it=top;it;it=it->next) { int i; - fprintf( code, "static %sunsigned char %s__bytes[] = {\n", - ISCONSTANT, get_resource_name(it) ); + fprintf( code, "static %sunsigned char %s__bytes[]%s = {\n", + ISCONSTANT, get_resource_name(it), + win32?"\n__attribute__ ((aligned (4)))":""); for (i=0;isize-1;i++) { fprintf(code,"0x%02x, ",it->res[i]); @@ -638,6 +777,25 @@ void create_output(gen_res* top) fprintf(code,"0x%02x };\n\n",it->res[i]); } + /* Print the resources names */ + + if (win32) + for(it=top;it;it=it->next) + { + int i; + char s_buffer[20], *s_name=s_buffer; + if(it->n_type) s_name=it->n.s_name; + else sprintf(s_name,"@%d",it->n.i_name); + fprintf( code, "static %sunsigned char %s__name[] = {\n", + ISCONSTANT, get_resource_name(it) ); + for (i=0;*s_name;i++,s_name++) + { + fprintf(code,"0x%02x, 0x00, ",*s_name); + if ((i&3)==3)fputc('\n',code); + } + fprintf(code,"0x00, 0x00};\n\n"); + } + /* Print the resources */ for (it=top;it;it=it->next) { @@ -655,14 +813,28 @@ void create_output(gen_res* top) case str:type=(int)RT_STRING;break; default:fprintf(stderr,"Unknown restype\n");type=-1;break; } - if(it->n_type) - fprintf(code,"%sstruct resource %s = {0,%d,\"%s\",%s__bytes,%d};\n", - ISCONSTANT, get_resource_name(it), type, it->n.s_name, - get_resource_name(it), it->size ); - else - fprintf(code,"%sstruct resource %s = {%d,%d,\"@%d\",%s__bytes,%d};\n", - ISCONSTANT, get_resource_name(it), it->n.i_name, type, - it->n.i_name, get_resource_name(it), it->size ); + if(win32) + { + if(it->n_type) + fprintf(code,"%sstruct resource %s = {0,%d,%s__name,%s__bytes,%d};\n", + ISCONSTANT, get_resource_name(it), type, get_resource_name(it), + get_resource_name(it), it->size ); + else + fprintf(code,"%sstruct resource %s = {%d,%d,%s__name,%s__bytes,%d};\n", + ISCONSTANT, get_resource_name(it), it->n.i_name, type, + get_resource_name(it), get_resource_name(it), it->size ); + } + else + { + if(it->n_type) + fprintf(code,"%sstruct resource %s = {0,%d,\"%s\",%s__bytes,%d};\n", + ISCONSTANT, get_resource_name(it), type, it->n.s_name, + get_resource_name(it), it->size ); + else + fprintf(code,"%sstruct resource %s = {%d,%d,\"@%d\",%s__bytes,%d};\n", + ISCONSTANT, get_resource_name(it), it->n.i_name, type, + it->n.i_name, get_resource_name(it), it->size ); + } } /* Print the resource table (NULL terminated) */ diff --git a/resources/Makefile.in b/resources/Makefile.in index e24d54f76c5..f4f1e5c3a53 100644 --- a/resources/Makefile.in +++ b/resources/Makefile.in @@ -4,6 +4,7 @@ TOPOBJDIR = .. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = resources +RCFLAGS = -w16 SYSRES_SRCS = \ sysres_Cz.c \ diff --git a/win32/code_page.c b/win32/code_page.c index 731dd45b67e..2d60fc4f0bc 100644 --- a/win32/code_page.c +++ b/win32/code_page.c @@ -5,11 +5,13 @@ */ #include +#include #include "windows.h" #include "winerror.h" #include "winnls.h" #include "stddebug.h" #include "debug.h" +#include "string32.h" /*********************************************************************** @@ -84,4 +86,30 @@ int WideCharToMultiByte(UINT page, DWORD flags, WCHAR *src, int srclen, return count; } - +/*********************************************************************** + * EnumSystemCodePages32A (KERNEL32.92) + */ +BOOL32 +EnumSystemCodePages32A(CODEPAGE_ENUMPROC32A lpfnCodePageEnum,DWORD flags) { + dprintf_win32(stddeb,"EnumSystemCodePages32A(%p,%08lx)\n", + lpfnCodePageEnum,flags + ); + lpfnCodePageEnum("437"); + return TRUE; +} + +/*********************************************************************** + * EnumSystemCodePages32W (KERNEL32.93) + */ +BOOL32 +EnumSystemCodePages32W(CODEPAGE_ENUMPROC32W lpfnCodePageEnum,DWORD flags) { + WCHAR *cp; + dprintf_win32(stddeb,"EnumSystemCodePages32W(%p,%08lx)\n", + lpfnCodePageEnum,flags + ); + + cp=STRING32_DupAnsiToUni("437"); + lpfnCodePageEnum(cp); + free(cp); + return TRUE; +} diff --git a/win32/file.c b/win32/file.c index 150322bcc57..925de51dc75 100644 --- a/win32/file.c +++ b/win32/file.c @@ -26,7 +26,6 @@ #include "debug.h" -static void UnixTimeToFileTime(time_t unix_time, FILETIME *filetime); static int TranslateCreationFlags(DWORD create_flags); static int TranslateAccessFlags(DWORD access_flags); int TranslateProtectionFlags(DWORD); @@ -54,6 +53,9 @@ HANDLE32 CreateFileMapping32A(HANDLE32 h,LPSECURITY_ATTRIBUTES ats, HFILE hfile; FILEMAP_OBJECT *filemap_obj; + dprintf_win32(stddeb,"CreateFileMapping32A(%08x,%p,%ld,%ld,%ld,%s)\n", + h,ats,pot,sh,hlow,lpName + ); if (sh) { SetLastError(ErrnoToLastError(errno)); return INVALID_HANDLE_VALUE; @@ -93,6 +95,16 @@ HANDLE32 CreateFileMapping32W(HANDLE32 h,LPSECURITY_ATTRIBUTES ats, } +/*********************************************************************** + * MapViewOfFile (KERNEL32.385) + * + */ +LPVOID MapViewOfFile(HANDLE32 handle, DWORD access, DWORD offhi, + DWORD offlo, DWORD size) +{ + return MapViewOfFileEx(handle,access,offhi,offlo,size,0); +} + /*********************************************************************** * MapViewOfFileEx (KERNEL32.386) * @@ -138,9 +150,9 @@ DWORD GetFileInformationByHandle(HFILE hFile,BY_HANDLE_FILE_INFORMATION *lpfi) /* Translate the file times. Use the last modification time * for both the creation time and write time. */ - UnixTimeToFileTime(file_stat.st_mtime, &(lpfi->ftCreationTime)); - UnixTimeToFileTime(file_stat.st_mtime, &(lpfi->ftLastWriteTime)); - UnixTimeToFileTime(file_stat.st_atime, &(lpfi->ftLastAccessTime)); + DOSFS_UnixTimeToFileTime(file_stat.st_mtime, &(lpfi->ftCreationTime)); + DOSFS_UnixTimeToFileTime(file_stat.st_mtime, &(lpfi->ftLastWriteTime)); + DOSFS_UnixTimeToFileTime(file_stat.st_atime, &(lpfi->ftLastAccessTime)); lpfi->nFileSizeLow = file_stat.st_size; lpfi->nNumberOfLinks = file_stat.st_nlink; @@ -155,19 +167,18 @@ DWORD GetFileInformationByHandle(HFILE hFile,BY_HANDLE_FILE_INFORMATION *lpfi) return 1; } -static void UnixTimeToFileTime(time_t unix_time, FILETIME *filetime) -{ - /* This isn't anywhere close to being correct, but should - * work for now. - */ - filetime->dwLowDateTime = (unix_time & 0x0000FFFF) << 16; - filetime->dwHighDateTime = (unix_time & 0xFFFF0000) >> 16; -} +/*********************************************************************** + * GetFileSize (KERNEL32.220) + */ +DWORD GetFileSize(HFILE hf,LPDWORD filesizehigh) { + BY_HANDLE_FILE_INFORMATION fi; + DWORD res = GetFileInformationByHandle(hf,&fi); -time_t FileTimeToUnixTime(FILETIME *filetime) -{ - /* reverse of UnixTimeToFileTime */ - return (filetime->dwLowDateTime>>16)+(filetime->dwHighDateTime<<16); + if (!res) + return 0; /* FIXME: correct ? */ + if (filesizehigh) + *filesizehigh = fi.nFileSizeHigh; + return fi.nFileSizeLow; } /*********************************************************************** diff --git a/win32/findfile.c b/win32/findfile.c index 8f9bf5230d1..50bb75d5401 100644 --- a/win32/findfile.c +++ b/win32/findfile.c @@ -188,6 +188,8 @@ BOOL32 FindClose32(HANDLE32 handle) { FindFileContext32 *context; + if (handle==(INVALID_HANDLE_VALUE)) + return TRUE; context = (FindFileContext32 *) handle; if (context->dir) closedir(context->dir); diff --git a/win32/init.c b/win32/init.c index 5fa1b3a63e8..8585a9352c1 100644 --- a/win32/init.c +++ b/win32/init.c @@ -54,15 +54,6 @@ BOOL CloseHandle(KERNEL_OBJECT *handle) return 0; } -/*********************************************************************** - * GetModuleFileNameA (KERNEL32.235) - */ -DWORD GetModuleFileNameA(HMODULE32 hModule, LPSTR lpFilename, DWORD nSize) -{ - strcpy(lpFilename, "c:\\dummy"); - return 8; -} - /*********************************************************************** * GetModuleHandle (KERNEL32.237) */ @@ -99,6 +90,26 @@ VOID GetStartupInfoA(LPSTARTUPINFO lpStartupInfo) lpStartupInfo->hStdError = (HANDLE32)2; } +/*********************************************************************** + * GetStartupInfoA (KERNEL32.284) + * FIXME: perhaps supply better values. + */ +VOID +GetSystemInfo(LPSYSTEM_INFO si) { + si->dwOemId = 0x12345678; + si->dwPageSize = 4096; /* 4K */ + si->lpMinimumApplicationAddress = 0x40000000; + si->lpMaximumApplicationAddress = 0x80000000; + si->dwActiveProcessorMask = 1; + si->dwNumberOfProcessors = 1; +#ifdef WINELIB + si->dwProcessorType = 3; +#else + si->dwProcessorType = runtime_cpu(); +#endif + si->dwAllocationGranularity = 8; /* hmm? */ +} + /* Initialize whatever internal data structures we need. * * Returns 1 on success, 0 on failure. diff --git a/win32/thread.c b/win32/thread.c index 1495f7c4563..37e3c544116 100644 --- a/win32/thread.c +++ b/win32/thread.c @@ -67,8 +67,11 @@ void DeleteCriticalSection(CRITICAL_SECTION* lpCrit) return; } -void -ReinitializeCriticalSection(CRITICAL_SECTION *lpCrit) { +void ReinitializeCriticalSection(CRITICAL_SECTION *lpCrit) { + /* hmm */ +} + +void MakeCriticalSectionGlobal(CRITICAL_SECTION *lpCrit) { /* hmm */ } diff --git a/windows/caret.c b/windows/caret.c index 041eff0c2f3..99c955ff2c0 100644 --- a/windows/caret.c +++ b/windows/caret.c @@ -60,7 +60,7 @@ static void CARET_DisplayCaret( DISPLAY_CARET status ) Caret.on = !Caret.on; if (!(hdc = GetDCEx32( Caret.hwnd, 0, DCX_USESTYLE | DCX_CACHE ))) return; hPrevBrush = SelectObject32( hdc, Caret.hBrush ); - PatBlt( hdc, Caret.x, Caret.y, Caret.width, Caret.height, PATINVERT ); + PatBlt32( hdc, Caret.x, Caret.y, Caret.width, Caret.height, PATINVERT ); SelectObject32( hdc, hPrevBrush ); ReleaseDC32( Caret.hwnd, hdc ); } diff --git a/windows/dce.c b/windows/dce.c index d83b8bb022d..5a7c9e0e404 100644 --- a/windows/dce.c +++ b/windows/dce.c @@ -331,8 +331,8 @@ HRGN32 DCE_GetVisRgn( HWND hwnd, WORD flags ) wndPtr = wndPtr->parent; xoffset -= wndPtr->rectClient.left; yoffset -= wndPtr->rectClient.top; - hrgn = DCE_ClipWindows( wndPtr->parent->child, wndPtr, - hrgn, xoffset, yoffset ); + hrgn = DCE_ClipWindows( wndPtr->parent ? wndPtr->parent->child : NULL, + wndPtr, hrgn, xoffset, yoffset ); if (!hrgn) return 0; } return hrgn; diff --git a/windows/dialog.c b/windows/dialog.c index 17a349a990d..03a0ddf6fe4 100644 --- a/windows/dialog.c +++ b/windows/dialog.c @@ -1320,3 +1320,143 @@ HWND32 GetNextDlgTabItem32( HWND32 hwndDlg, HWND32 hwndCtrl, BOOL32 fPrevious ) } return pWndLast->hwndSelf; } + + +/********************************************************************** + * DIALOG_DlgDirSelect + * + * Helper function for DlgDirSelect* + */ +static BOOL32 DIALOG_DlgDirSelect( HWND32 hwnd, LPSTR str, INT32 len, + INT32 id, BOOL32 win32, BOOL32 unicode, + BOOL32 combo ) +{ + char *buffer, *ptr; + INT32 item, size; + BOOL32 ret; + HWND32 listbox = GetDlgItem( hwnd, id ); + + dprintf_dialog( stddeb, "DlgDirSelect: %04x '%s' %d\n", hwnd, str, id ); + if (!listbox) return FALSE; + if (win32) + { + item = SendMessage32A(listbox, combo ? CB_GETCURSEL32 + : LB_GETCURSEL32, 0, 0 ); + if (item == LB_ERR) return FALSE; + size = SendMessage32A(listbox, combo ? CB_GETLBTEXTLEN32 + : LB_GETTEXTLEN32, 0, 0 ); + if (size == LB_ERR) return FALSE; + } + else + { + item = SendMessage32A(listbox, combo ? CB_GETCURSEL16 + : LB_GETCURSEL16, 0, 0 ); + if (item == LB_ERR) return FALSE; + size = SendMessage32A(listbox, combo ? CB_GETLBTEXTLEN16 + : LB_GETTEXTLEN16, 0, 0 ); + if (size == LB_ERR) return FALSE; + } + + if (!(buffer = SEGPTR_ALLOC( size+1 ))) return FALSE; + + if (win32) + SendMessage32A( listbox, combo ? CB_GETLBTEXT32 : LB_GETTEXT32, + item, (LPARAM)buffer ); + else + SendMessage16( listbox, combo ? CB_GETLBTEXT16 : LB_GETTEXT16, + item, (LPARAM)SEGPTR_GET(buffer) ); + + if ((ret = (buffer[0] == '['))) /* drive or directory */ + { + if (buffer[1] == '-') /* drive */ + { + buffer[3] = ':'; + buffer[4] = 0; + ptr = buffer + 2; + } + else + { + buffer[strlen(buffer)-1] = '\\'; + ptr = buffer + 1; + } + } + else ptr = buffer; + + if (unicode) lstrcpynAtoW( (LPWSTR)str, ptr, len ); + else lstrcpyn32A( str, ptr, len ); + SEGPTR_FREE( buffer ); + dprintf_dialog( stddeb, "Returning %d '%s'\n", ret, str ); + return ret; +} + + +/********************************************************************** + * DlgDirSelect (USER.99) + */ +BOOL16 DlgDirSelect( HWND16 hwnd, LPSTR str, INT16 id ) +{ + return DlgDirSelectEx16( hwnd, str, 128, id ); +} + + +/********************************************************************** + * DlgDirSelectComboBox (USER.194) + */ +BOOL16 DlgDirSelectComboBox( HWND16 hwnd, LPSTR str, INT16 id ) +{ + return DlgDirSelectComboBoxEx16( hwnd, str, 128, id ); +} + + +/********************************************************************** + * DlgDirSelectEx16 (USER.422) + */ +BOOL16 DlgDirSelectEx16( HWND16 hwnd, LPSTR str, INT16 len, INT16 id ) +{ + return DIALOG_DlgDirSelect( hwnd, str, len, id, FALSE, FALSE, FALSE ); +} + + +/********************************************************************** + * DlgDirSelectEx32A (USER32.148) + */ +BOOL32 DlgDirSelectEx32A( HWND32 hwnd, LPSTR str, INT32 len, INT32 id ) +{ + return DIALOG_DlgDirSelect( hwnd, str, len, id, TRUE, FALSE, FALSE ); +} + + +/********************************************************************** + * DlgDirSelectEx32W (USER32.149) + */ +BOOL32 DlgDirSelectEx32W( HWND32 hwnd, LPWSTR str, INT32 len, INT32 id ) +{ + return DIALOG_DlgDirSelect( hwnd, (LPSTR)str, len, id, TRUE, TRUE, FALSE ); +} + + +/********************************************************************** + * DlgDirSelectComboBoxEx16 (USER.423) + */ +BOOL16 DlgDirSelectComboBoxEx16( HWND16 hwnd, LPSTR str, INT16 len, INT16 id ) +{ + return DIALOG_DlgDirSelect( hwnd, str, len, id, FALSE, FALSE, TRUE ); +} + + +/********************************************************************** + * DlgDirSelectComboBoxEx32A (USER32.146) + */ +BOOL32 DlgDirSelectComboBoxEx32A( HWND32 hwnd, LPSTR str, INT32 len, INT32 id ) +{ + return DIALOG_DlgDirSelect( hwnd, str, len, id, TRUE, FALSE, TRUE ); +} + + +/********************************************************************** + * DlgDirSelectComboBoxEx32W (USER32.147) + */ +BOOL32 DlgDirSelectComboBoxEx32W( HWND32 hwnd, LPWSTR str, INT32 len, INT32 id) +{ + return DIALOG_DlgDirSelect( hwnd, (LPSTR)str, len, id, TRUE, TRUE, TRUE ); +} diff --git a/windows/event.c b/windows/event.c index 24ec312f9d8..20100520990 100644 --- a/windows/event.c +++ b/windows/event.c @@ -32,14 +32,30 @@ #include "options.h" #include "queue.h" #include "winpos.h" +#include "drive.h" +#include "dos_fs.h" +#include "shell.h" #include "registers.h" #include "xmalloc.h" #include "stddebug.h" #include "debug.h" #include "dde_proc.h" + #define NB_BUTTONS 3 /* Windows can handle 3 buttons */ +#define DndNotDnd -1 /* OffiX drag&drop */ +#define DndUnknown 0 +#define DndRawData 1 +#define DndFile 2 +#define DndFiles 3 +#define DndText 4 +#define DndDir 5 +#define DndLink 6 +#define DndExe 7 + +#define DndEND 8 + /* X context to associate a hwnd to an X window */ static XContext winContext = 0; @@ -123,6 +139,11 @@ typedef union static BOOL KeyDown = FALSE; +static Atom wmProtocols = None; +static Atom wmDeleteWindow = None; +static Atom dndProtocol = None; +static Atom dndSelection = None; + static const char * const event_names[] = { "", "", "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", @@ -155,6 +176,9 @@ static void EVENT_MapNotify( HWND hwnd, XMapEvent *event ); static void EVENT_EnterNotify( WND *pWnd, XCrossingEvent *event ); */ +extern void FOCUS_SetXFocus( HWND32 ); +extern BOOL16 DRAG_QueryUpdate( HWND, SEGPTR, BOOL32 ); + /*********************************************************************** * EVENT_ProcessEvent * @@ -277,6 +301,15 @@ void EVENT_ProcessEvent( XEvent *event ) */ void EVENT_RegisterWindow( WND *pWnd ) { + if (wmProtocols == None) + wmProtocols = XInternAtom( display, "WM_PROTOCOLS", True ); + if (wmDeleteWindow == None) + wmDeleteWindow = XInternAtom( display, "WM_DELETE_WINDOW", True ); + if( dndProtocol == None ) + dndProtocol = XInternAtom( display, "DndProtocol" , False ); + if( dndSelection == None ) + dndSelection = XInternAtom( display, "DndSelection" , False ); + if (!winContext) winContext = XUniqueContext(); XSaveContext( display, pWnd->window, winContext, (char *)pWnd ); } @@ -291,14 +324,18 @@ void EVENT_RegisterWindow( WND *pWnd ) */ BOOL32 EVENT_WaitXEvent( BOOL32 sleep, BOOL32 peek ) { - fd_set read_set; - struct timeval timeout; XEvent event; - int fd = ConnectionNumber(display); + LONG maxWait = sleep ? TIMER_GetNextExpiration() : 0; - if (!XPending(display)) + /* Wait for an event or a timeout. If maxWait is -1, we have no timeout; + * in this case, we fall through directly to the XNextEvent loop. + */ + + if ((maxWait != -1) && !XPending(display)) { - LONG maxWait = sleep ? TIMER_GetNextExpiration() : 0; + fd_set read_set; + struct timeval timeout; + int fd = ConnectionNumber(display); FD_ZERO( &read_set ); FD_SET( fd, &read_set ); @@ -824,11 +861,11 @@ static void EVENT_SelectionRequest( WND *pWnd, XSelectionRequestEvent *event ) /* remove carriage returns */ lpstr = (char*)xmalloc(size--); - for(i=0,j=0; i < size; i++ ) + for(i=0,j=0; i < size && text[i]; i++ ) { - if( text[i] == '\r' && text[i+1] == '\n' ) continue; + if( text[i] == '\r' && + (text[i+1] == '\n' || text[i+1] == '\0') ) continue; lpstr[j++] = text[i]; - if( text[i] == '\0' ) break; } lpstr[j]='\0'; @@ -886,21 +923,121 @@ static void EVENT_SelectionClear( WND *pWnd, XSelectionClearEvent *event ) */ static void EVENT_ClientMessage( WND *pWnd, XClientMessageEvent *event ) { - static Atom wmProtocols = None; - static Atom wmDeleteWindow = None; - - if (wmProtocols == None) - wmProtocols = XInternAtom( display, "WM_PROTOCOLS", True ); - if (wmDeleteWindow == None) - wmDeleteWindow = XInternAtom( display, "WM_DELETE_WINDOW", True ); - - if ((event->format != 32) || (event->message_type != wmProtocols) || - (((Atom) event->data.l[0]) != wmDeleteWindow)) + if (event->message_type != None && event->format == 32) { - dprintf_event( stddeb, "unrecognized ClientMessage\n" ); - return; + if ((event->message_type == wmProtocols) && + (((Atom) event->data.l[0]) == wmDeleteWindow)) + SendMessage16( pWnd->hwndSelf, WM_SYSCOMMAND, SC_CLOSE, 0 ); + else if ( event->message_type == dndProtocol && + (event->data.l[0] == DndFile || event->data.l[0] == DndFiles) ) + { + unsigned long data_length; + unsigned long aux_long; + unsigned char* p_data = NULL; + union { + Atom atom_aux; + POINT32 pt_aux; + BOOL16 bAccept; + int i; + } u; + int x, y; + HGLOBAL16 hDragInfo = GlobalAlloc16( GMEM_SHARE | GMEM_ZEROINIT, sizeof(DRAGINFO)); + LPDRAGINFO lpDragInfo = (LPDRAGINFO) GlobalLock16(hDragInfo); + SEGPTR spDragInfo = (SEGPTR) WIN16_GlobalLock16(hDragInfo); + Window w_aux_root, w_aux_child; + WND* pDropWnd; + + if( !lpDragInfo || !spDragInfo ) return; + + XQueryPointer( display, pWnd->window, &w_aux_root, &w_aux_child, + &x, &y, &u.pt_aux.x, &u.pt_aux.y, (unsigned int*)&aux_long); + + lpDragInfo->hScope = pWnd->hwndSelf; + lpDragInfo->pt.x = (INT16)x; lpDragInfo->pt.y = (INT16)y; + + /* find out drop point and drop window */ + if( x < 0 || y < 0 || + x > (pWnd->rectWindow.right - pWnd->rectWindow.left) || + y > (pWnd->rectWindow.bottom - pWnd->rectWindow.top) ) + { u.bAccept = pWnd->dwExStyle & WS_EX_ACCEPTFILES; x = y = 0; } + else + { + u.bAccept = DRAG_QueryUpdate( pWnd->hwndSelf, spDragInfo, TRUE ); + x = lpDragInfo->pt.x; y = lpDragInfo->pt.y; + } + pDropWnd = WIN_FindWndPtr( lpDragInfo->hScope ); + GlobalFree16( hDragInfo ); + + if( u.bAccept ) + { + XGetWindowProperty( display, DefaultRootWindow(display), + dndSelection, 0, 65535, FALSE, + AnyPropertyType, &u.atom_aux, &u.pt_aux.y, + &data_length, &aux_long, &p_data); + + if( !aux_long && p_data) /* don't bother if > 64K */ + { + char* p = (char*) p_data; + char* p_filename,*p_drop; + + aux_long = 0; + while( *p ) /* calculate buffer size */ + { + p_drop = p; + if((u.i = *p) != -1 ) + u.i = DRIVE_FindDriveRoot( (const char**)&p_drop ); + if( u.i == -1 ) *p = -1; /* mark as "bad" */ + else + { + p_filename = (char*) DOSFS_GetDosTrueName( (const char*)p, TRUE ); + if( p_filename ) aux_long += strlen(p_filename) + 1; + else *p = -1; + } + p += strlen(p) + 1; + } + if( aux_long && aux_long < 65535 ) + { + HDROP16 hDrop; + LPDROPFILESTRUCT lpDrop; + + aux_long += sizeof(DROPFILESTRUCT) + 1; + hDrop = (HDROP16)GlobalAlloc16( GMEM_SHARE, aux_long ); + lpDrop = (LPDROPFILESTRUCT) GlobalLock16( hDrop ); + + if( lpDrop ) + { + lpDrop->wSize = sizeof(DROPFILESTRUCT); + lpDrop->ptMousePos.x = (INT16)x; + lpDrop->ptMousePos.y = (INT16)y; + lpDrop->fInNonClientArea = (BOOL16) + ( x < (pDropWnd->rectClient.left - pDropWnd->rectWindow.left) || + y < (pDropWnd->rectClient.top - pDropWnd->rectWindow.top) || + x > (pDropWnd->rectClient.right - pDropWnd->rectWindow.left) || + y > (pDropWnd->rectClient.bottom - pDropWnd->rectWindow.top) ); + p_drop = ((char*)lpDrop) + sizeof(DROPFILESTRUCT); + p = p_data; + while(*p) + { + if( *p != -1 ) /* use only "good" entries */ + { + p_filename = (char*) DOSFS_GetDosTrueName( p, TRUE ); + strcpy(p_drop, p_filename); + p_drop += strlen( p_filename ) + 1; + } + p += strlen(p) + 1; + } + *p_drop = '\0'; + PostMessage( pWnd->hwndSelf, WM_DROPFILES, (WPARAM16)hDrop, 0L ); + } + } + } + if( p_data ) XFree(p_data); + + } /* WS_EX_ACCEPTFILES */ + } /* dndProtocol */ + else + dprintf_event( stddeb, "unrecognized ClientMessage\n" ); } - SendMessage16( pWnd->hwndSelf, WM_SYSCOMMAND, SC_CLOSE, 0 ); } /********************************************************************** @@ -918,8 +1055,6 @@ static void EVENT_ClientMessage( WND *pWnd, XClientMessageEvent *event ) } */ -extern void FOCUS_SetXFocus( HWND32 ); - /********************************************************************** * EVENT_MapNotify */ diff --git a/windows/graphics.c b/windows/graphics.c index 78abec27d06..40d1c304954 100644 --- a/windows/graphics.c +++ b/windows/graphics.c @@ -533,8 +533,8 @@ INT16 FillRect16( HDC16 hdc, const RECT16 *rect, HBRUSH16 hbrush ) */ if (!(prevBrush = SelectObject16( hdc, hbrush ))) return 0; - PatBlt( hdc, rect->left, rect->top, - rect->right - rect->left, rect->bottom - rect->top, PATCOPY ); + PatBlt32( hdc, rect->left, rect->top, + rect->right - rect->left, rect->bottom - rect->top, PATCOPY ); SelectObject16( hdc, prevBrush ); return 1; } @@ -548,8 +548,8 @@ INT32 FillRect32( HDC32 hdc, const RECT32 *rect, HBRUSH32 hbrush ) HBRUSH32 prevBrush; if (!(prevBrush = SelectObject32( hdc, hbrush ))) return 0; - PatBlt( hdc, rect->left, rect->top, - rect->right - rect->left, rect->bottom - rect->top, PATCOPY ); + PatBlt32( hdc, rect->left, rect->top, + rect->right - rect->left, rect->bottom - rect->top, PATCOPY ); SelectObject32( hdc, prevBrush ); return 1; } @@ -560,8 +560,8 @@ INT32 FillRect32( HDC32 hdc, const RECT32 *rect, HBRUSH32 hbrush ) */ void InvertRect16( HDC16 hdc, const RECT16 *rect ) { - PatBlt( hdc, rect->left, rect->top, - rect->right - rect->left, rect->bottom - rect->top, DSTINVERT ); + PatBlt32( hdc, rect->left, rect->top, + rect->right - rect->left, rect->bottom - rect->top, DSTINVERT ); } @@ -570,8 +570,8 @@ void InvertRect16( HDC16 hdc, const RECT16 *rect ) */ void InvertRect32( HDC32 hdc, const RECT32 *rect ) { - PatBlt( hdc, rect->left, rect->top, - rect->right - rect->left, rect->bottom - rect->top, DSTINVERT ); + PatBlt32( hdc, rect->left, rect->top, + rect->right - rect->left, rect->bottom - rect->top, DSTINVERT ); } @@ -596,15 +596,15 @@ INT16 FrameRect16( HDC16 hdc, const RECT16 *rect, HBRUSH16 hbrush ) if (DC_SetupGCForBrush( dc )) { - PatBlt( hdc, rect->left, rect->top, 1, - rect->bottom - rect->top, PATCOPY ); - PatBlt( hdc, rect->right - 1, rect->top, 1, - rect->bottom - rect->top, PATCOPY ); - PatBlt( hdc, rect->left, rect->top, - rect->right - rect->left, 1, PATCOPY ); - PatBlt( hdc, rect->left, rect->bottom - 1, - rect->right - rect->left, 1, PATCOPY ); - } + PatBlt32( hdc, rect->left, rect->top, 1, + rect->bottom - rect->top, PATCOPY ); + PatBlt32( hdc, rect->right - 1, rect->top, 1, + rect->bottom - rect->top, PATCOPY ); + PatBlt32( hdc, rect->left, rect->top, + rect->right - rect->left, 1, PATCOPY ); + PatBlt32( hdc, rect->left, rect->bottom - 1, + rect->right - rect->left, 1, PATCOPY ); + } SelectObject16( hdc, prevBrush ); return 1; } @@ -922,20 +922,20 @@ void GRAPH_DrawReliefRect( HDC32 hdc, const RECT32 *rect, INT32 highlight_size, sysColorObjects.hbrushBtnHighlight ); for (i = 0; i < highlight_size; i++) { - PatBlt( hdc, rect->left + i, rect->top, - 1, rect->bottom - rect->top - i, PATCOPY ); - PatBlt( hdc, rect->left, rect->top + i, - rect->right - rect->left - i, 1, PATCOPY ); + PatBlt32( hdc, rect->left + i, rect->top, + 1, rect->bottom - rect->top - i, PATCOPY ); + PatBlt32( hdc, rect->left, rect->top + i, + rect->right - rect->left - i, 1, PATCOPY ); } SelectObject32( hdc, pressed ? sysColorObjects.hbrushBtnHighlight : sysColorObjects.hbrushBtnShadow ); for (i = 0; i < shadow_size; i++) { - PatBlt( hdc, rect->right - i - 1, rect->top + i, - 1, rect->bottom - rect->top - i, PATCOPY ); - PatBlt( hdc, rect->left + i, rect->bottom - i - 1, - rect->right - rect->left - i, 1, PATCOPY ); + PatBlt32( hdc, rect->right - i - 1, rect->top + i, + 1, rect->bottom - rect->top - i, PATCOPY ); + PatBlt32( hdc, rect->left + i, rect->bottom - i - 1, + rect->right - rect->left - i, 1, PATCOPY ); } SelectObject32( hdc, hbrushOld ); @@ -1250,31 +1250,31 @@ BOOL32 DrawEdge32( HDC32 hdc, LPRECT32 rc, UINT32 edge, UINT32 flags ) hbrushOld = SelectObject32( hdc, sysColorObjects.hbrushBtnHighlight ); if (edge & BDR_RAISEDOUTER) { - if (flags & BF_LEFT) PatBlt( hdc, rc->left, rc->top, - 1, rc->bottom - rc->top - 1, PATCOPY ); - if (flags & BF_TOP) PatBlt( hdc, rc->left, rc->top, - rc->right - rc->left - 1, 1, PATCOPY ); + if (flags & BF_LEFT) PatBlt32( hdc, rc->left, rc->top, + 1, rc->bottom - rc->top - 1, PATCOPY ); + if (flags & BF_TOP) PatBlt32( hdc, rc->left, rc->top, + rc->right - rc->left - 1, 1, PATCOPY ); } if (edge & BDR_SUNKENOUTER) { - if (flags & BF_RIGHT) PatBlt( hdc, rc->right - 1, rc->top, - 1, rc->bottom - rc->top, PATCOPY ); - if (flags & BF_BOTTOM) PatBlt( hdc, rc->left, rc->bottom - 1, - rc->right - rc->left, 1, PATCOPY ); + if (flags & BF_RIGHT) PatBlt32( hdc, rc->right - 1, rc->top, + 1, rc->bottom - rc->top, PATCOPY ); + if (flags & BF_BOTTOM) PatBlt32( hdc, rc->left, rc->bottom - 1, + rc->right - rc->left, 1, PATCOPY ); } if (edge & BDR_RAISEDINNER) { - if (flags & BF_LEFT) PatBlt( hdc, rc->left + 1, rc->top + 1, - 1, rc->bottom - rc->top - 2, PATCOPY ); - if (flags & BF_TOP) PatBlt( hdc, rc->left + 1, rc->top + 1, - rc->right - rc->left - 2, 1, PATCOPY ); + if (flags & BF_LEFT) PatBlt32( hdc, rc->left + 1, rc->top + 1, + 1, rc->bottom - rc->top - 2, PATCOPY ); + if (flags & BF_TOP) PatBlt32( hdc, rc->left + 1, rc->top + 1, + rc->right - rc->left - 2, 1, PATCOPY ); } if (edge & BDR_SUNKENINNER) { - if (flags & BF_RIGHT) PatBlt( hdc, rc->right - 2, rc->top + 1, - 1, rc->bottom - rc->top - 2, PATCOPY ); - if (flags & BF_BOTTOM) PatBlt( hdc, rc->left + 1, rc->bottom - 2, - rc->right - rc->left - 2, 1, PATCOPY ); + if (flags & BF_RIGHT) PatBlt32( hdc, rc->right - 2, rc->top + 1, + 1, rc->bottom - rc->top - 2, PATCOPY ); + if (flags & BF_BOTTOM) PatBlt32( hdc, rc->left + 1, rc->bottom - 2, + rc->right - rc->left - 2, 1, PATCOPY ); } /* Then do all the sunken edges */ @@ -1282,31 +1282,31 @@ BOOL32 DrawEdge32( HDC32 hdc, LPRECT32 rc, UINT32 edge, UINT32 flags ) SelectObject32( hdc, sysColorObjects.hbrushBtnShadow ); if (edge & BDR_SUNKENOUTER) { - if (flags & BF_LEFT) PatBlt( hdc, rc->left, rc->top, - 1, rc->bottom - rc->top - 1, PATCOPY ); - if (flags & BF_TOP) PatBlt( hdc, rc->left, rc->top, - rc->right - rc->left - 1, 1, PATCOPY ); + if (flags & BF_LEFT) PatBlt32( hdc, rc->left, rc->top, + 1, rc->bottom - rc->top - 1, PATCOPY ); + if (flags & BF_TOP) PatBlt32( hdc, rc->left, rc->top, + rc->right - rc->left - 1, 1, PATCOPY ); } if (edge & BDR_RAISEDOUTER) { - if (flags & BF_RIGHT) PatBlt( hdc, rc->right - 1, rc->top, - 1, rc->bottom - rc->top, PATCOPY ); - if (flags & BF_BOTTOM) PatBlt( hdc, rc->left, rc->bottom - 1, - rc->right - rc->left, 1, PATCOPY ); + if (flags & BF_RIGHT) PatBlt32( hdc, rc->right - 1, rc->top, + 1, rc->bottom - rc->top, PATCOPY ); + if (flags & BF_BOTTOM) PatBlt32( hdc, rc->left, rc->bottom - 1, + rc->right - rc->left, 1, PATCOPY ); } if (edge & BDR_SUNKENINNER) { - if (flags & BF_LEFT) PatBlt( hdc, rc->left + 1, rc->top + 1, - 1, rc->bottom - rc->top - 2, PATCOPY ); - if (flags & BF_TOP) PatBlt( hdc, rc->left + 1, rc->top + 1, - rc->right - rc->left - 2, 1, PATCOPY ); + if (flags & BF_LEFT) PatBlt32( hdc, rc->left + 1, rc->top + 1, + 1, rc->bottom - rc->top - 2, PATCOPY ); + if (flags & BF_TOP) PatBlt32( hdc, rc->left + 1, rc->top + 1, + rc->right - rc->left - 2, 1, PATCOPY ); } if (edge & BDR_RAISEDINNER) { - if (flags & BF_RIGHT) PatBlt( hdc, rc->right - 2, rc->top + 1, - 1, rc->bottom - rc->top - 2, PATCOPY ); - if (flags & BF_BOTTOM) PatBlt( hdc, rc->left + 1, rc->bottom - 2, - rc->right - rc->left - 2, 1, PATCOPY ); + if (flags & BF_RIGHT) PatBlt32( hdc, rc->right - 2, rc->top + 1, + 1, rc->bottom - rc->top - 2, PATCOPY ); + if (flags & BF_BOTTOM) PatBlt32( hdc, rc->left + 1, rc->bottom - 2, + rc->right - rc->left - 2, 1, PATCOPY ); } SelectObject32( hdc, hbrushOld ); diff --git a/windows/mdi.c b/windows/mdi.c index 1e6b45f2acb..684b3fc4b81 100644 --- a/windows/mdi.c +++ b/windows/mdi.c @@ -672,8 +672,8 @@ HBITMAP16 CreateMDIMenuBitmap(void) hbCopy = CreateCompatibleBitmap(hDCSrc,SYSMETRICS_CXSIZE, SYSMETRICS_CYSIZE); hb_dest = SelectObject32(hDCDest,hbCopy); - BitBlt(hDCDest, 0, 0, SYSMETRICS_CXSIZE, SYSMETRICS_CYSIZE, - hDCSrc, SYSMETRICS_CXSIZE, 0, SRCCOPY); + BitBlt32(hDCDest, 0, 0, SYSMETRICS_CXSIZE, SYSMETRICS_CYSIZE, + hDCSrc, SYSMETRICS_CXSIZE, 0, SRCCOPY); SelectObject32(hDCSrc,hb_src); SelectObject32(hDCDest,hb_dest); @@ -982,7 +982,8 @@ LRESULT MDIClientWndProc(HWND hwnd, UINT message, WPARAM16 wParam, LPARAM lParam RECT16 rect; WND *w = WIN_FindWndPtr(hwnd); WND *frameWnd = w->parent; - + INT nItems; + ci = (MDICLIENTINFO *) w->wExtra; switch (message) @@ -1020,12 +1021,12 @@ LRESULT MDIClientWndProc(HWND hwnd, UINT message, WPARAM16 wParam, LPARAM lParam case WM_DESTROY: if( ci->hwndChildMaximized ) MDI_RestoreFrameMenu(w, frameWnd->hwndSelf); - ci->idFirstChild = GetMenuItemCount(ci->hWindowMenu) - 1; - ci->nActiveChildren++; /* to delete a separator */ - - while( ci->nActiveChildren-- ) - DeleteMenu(ci->hWindowMenu,MF_BYPOSITION,ci->idFirstChild--); - + if((nItems = GetMenuItemCount(ci->hWindowMenu)) > 0) { + ci->idFirstChild = nItems - 1; + ci->nActiveChildren++; /* to delete a separator */ + while( ci->nActiveChildren-- ) + DeleteMenu(ci->hWindowMenu,MF_BYPOSITION,ci->idFirstChild--); + } return 0; case WM_MDIACTIVATE: @@ -1718,8 +1719,8 @@ void ScrollChildren(HWND hWnd, UINT uMsg, WPARAM16 wParam, LPARAM lParam) SetScrollPos32(hWnd, (uMsg == WM_VSCROLL)?SB_VERT:SB_HORZ , newPos, TRUE); if( uMsg == WM_VSCROLL ) - ScrollWindow(hWnd ,0 ,curPos - newPos, NULL, NULL); + ScrollWindow32(hWnd ,0 ,curPos - newPos, NULL, NULL); else - ScrollWindow(hWnd ,curPos - newPos, 0, NULL, NULL); + ScrollWindow32(hWnd ,curPos - newPos, 0, NULL, NULL); } diff --git a/windows/message.c b/windows/message.c index 3e5f253cee9..4ac32f3fb89 100644 --- a/windows/message.c +++ b/windows/message.c @@ -105,7 +105,7 @@ static SYSQ_STATUS MSG_TranslateMouseMsg( MSG16 *msg, BOOL remove ) return ret ? SYSQ_MSG_ACCEPT : SYSQ_MSG_SKIP ; } - hittest = WINPOS_WindowFromPoint( msg->pt, &pWnd ); + hittest = WINPOS_WindowFromPoint( WIN_GetDesktop(), msg->pt, &pWnd ); if (pWnd->hmemTaskQ != GetTaskQueue(0)) { /* Not for the current task */ diff --git a/windows/nonclient.c b/windows/nonclient.c index ec0c986dd7c..d7f70cbb8ea 100644 --- a/windows/nonclient.c +++ b/windows/nonclient.c @@ -56,6 +56,8 @@ static HBITMAP16 hbitmapRestoreD = 0; #define ON_BOTTOM_BORDER(hit) \ (((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT)) +extern HCURSOR16 CURSORICON_IconToCursor( HICON16, BOOL32 ); + /*********************************************************************** * NC_AdjustRect * @@ -443,9 +445,9 @@ void NC_DrawSysButton( HWND hwnd, HDC16 hdc, BOOL down ) NC_GetInsideRect( hwnd, &rect ); hdcMem = CreateCompatibleDC( hdc ); hbitmap = SelectObject32( hdcMem, hbitmapClose ); - BitBlt( hdc, rect.left, rect.top, SYSMETRICS_CXSIZE, SYSMETRICS_CYSIZE, - hdcMem, (wndPtr->dwStyle & WS_CHILD) ? SYSMETRICS_CXSIZE : 0, 0, - down ? NOTSRCCOPY : SRCCOPY ); + BitBlt32(hdc, rect.left, rect.top, SYSMETRICS_CXSIZE, SYSMETRICS_CYSIZE, + hdcMem, (wndPtr->dwStyle & WS_CHILD) ? SYSMETRICS_CXSIZE : 0, 0, + down ? NOTSRCCOPY : SRCCOPY ); SelectObject32( hdcMem, hbitmap ); DeleteDC( hdcMem ); } @@ -517,14 +519,14 @@ static void NC_DrawFrame( HDC16 hdc, RECT16 *rect, BOOL dlgFrame, BOOL active ) } /* Draw frame */ - PatBlt( hdc, rect->left, rect->top, - rect->right - rect->left, height, PATCOPY ); - PatBlt( hdc, rect->left, rect->top, - width, rect->bottom - rect->top, PATCOPY ); - PatBlt( hdc, rect->left, rect->bottom, - rect->right - rect->left, -height, PATCOPY ); - PatBlt( hdc, rect->right, rect->top, - -width, rect->bottom - rect->top, PATCOPY ); + PatBlt32( hdc, rect->left, rect->top, + rect->right - rect->left, height, PATCOPY ); + PatBlt32( hdc, rect->left, rect->top, + width, rect->bottom - rect->top, PATCOPY ); + PatBlt32( hdc, rect->left, rect->bottom, + rect->right - rect->left, -height, PATCOPY ); + PatBlt32( hdc, rect->right, rect->top, + -width, rect->bottom - rect->top, PATCOPY ); if (dlgFrame) { @@ -575,21 +577,8 @@ static void NC_DrawFrame( HDC16 hdc, RECT16 *rect, BOOL dlgFrame, BOOL active ) */ static void NC_DrawMovingFrame( HDC16 hdc, RECT16 *rect, BOOL thickframe ) { - if (thickframe) - { - SelectObject32( hdc, GetStockObject32( GRAY_BRUSH ) ); - PatBlt( hdc, rect->left, rect->top, - rect->right - rect->left - SYSMETRICS_CXFRAME, - SYSMETRICS_CYFRAME, PATINVERT ); - PatBlt( hdc, rect->left, rect->top + SYSMETRICS_CYFRAME, - SYSMETRICS_CXFRAME, - rect->bottom - rect->top - SYSMETRICS_CYFRAME, PATINVERT ); - PatBlt( hdc, rect->left + SYSMETRICS_CXFRAME, rect->bottom, - rect->right - rect->left - SYSMETRICS_CXFRAME, - -SYSMETRICS_CYFRAME, PATINVERT ); - PatBlt( hdc, rect->right, rect->top, -SYSMETRICS_CXFRAME, - rect->bottom - rect->top - SYSMETRICS_CYFRAME, PATINVERT ); - } + if (thickframe) FastWindowFrame( hdc, rect, SYSMETRICS_CXFRAME, + SYSMETRICS_CYFRAME, PATINVERT ); else DrawFocusRect16( hdc, rect ); } @@ -624,9 +613,9 @@ static void NC_DrawCaption( HDC16 hdc, RECT16 *rect, HWND hwnd, if (wndPtr->dwExStyle & WS_EX_DLGMODALFRAME) { HBRUSH32 hbrushOld = SelectObject32(hdc, sysColorObjects.hbrushWindow); - PatBlt( hdc, r.left, r.top, 1, r.bottom-r.top+1,PATCOPY ); - PatBlt( hdc, r.right-1, r.top, 1, r.bottom-r.top+1, PATCOPY ); - PatBlt( hdc, r.left, r.top-1, r.right-r.left, 1, PATCOPY ); + PatBlt32( hdc, r.left, r.top, 1, r.bottom-r.top+1,PATCOPY ); + PatBlt32( hdc, r.right-1, r.top, 1, r.bottom-r.top+1, PATCOPY ); + PatBlt32( hdc, r.left, r.top-1, r.right-r.left, 1, PATCOPY ); r.left++; r.right--; SelectObject32( hdc, hbrushOld ); @@ -992,18 +981,18 @@ static LONG NC_StartSizeMove( HWND hwnd, WPARAM16 wParam, POINT16 *capturePoint static void NC_DoSizeMove( HWND hwnd, WORD wParam, POINT16 pt ) { MSG16 msg; - LONG hittest; RECT16 sizingRect, mouseRect; HDC32 hdc; - BOOL thickframe; - POINT16 minTrack, maxTrack, capturePoint = pt; - WND * wndPtr = WIN_FindWndPtr( hwnd ); - int moved = 0; + LONG hittest = (LONG)(wParam & 0x0f); + HCURSOR16 hDragCursor = 0, hOldCursor = 0; + POINT16 minTrack, maxTrack, capturePoint = pt; + WND * wndPtr = WIN_FindWndPtr( hwnd ); + BOOL32 thickframe = HAS_THICKFRAME( wndPtr->dwStyle ); + BOOL32 iconic = wndPtr->dwStyle & WS_MINIMIZE; + int moved = 0; if (IsZoomed(hwnd) || !IsWindowVisible(hwnd) || (wndPtr->flags & WIN_MANAGED)) return; - hittest = wParam & 0x0f; - thickframe = HAS_THICKFRAME( wndPtr->dwStyle ); if ((wParam & 0xfff0) == SC_MOVE) { @@ -1068,7 +1057,21 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam, POINT16 pt ) hdc = GetDC32( 0 ); if (rootWindow == DefaultRootWindow(display)) XGrabServer( display ); } - NC_DrawMovingFrame( hdc, &sizingRect, thickframe ); + + if( iconic ) + { + HICON16 hIcon = (wndPtr->class->hIcon) + ? wndPtr->class->hIcon + : (HICON16)SendMessage16( hwnd, WM_QUERYDRAGICON, 0, 0L); + if( hIcon ) + { + hDragCursor = CURSORICON_IconToCursor( hIcon, TRUE ); + hOldCursor = SetCursor(hDragCursor); + ShowCursor(1); + } else iconic = FALSE; + } + + if( !iconic ) NC_DrawMovingFrame( hdc, &sizingRect, thickframe ); while(1) { @@ -1117,16 +1120,26 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam, POINT16 pt ) else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx; if (ON_TOP_BORDER(hittest)) newRect.top += dy; else if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy; - NC_DrawMovingFrame( hdc, &sizingRect, thickframe ); - NC_DrawMovingFrame( hdc, &newRect, thickframe ); + if( !iconic ) + { + NC_DrawMovingFrame( hdc, &sizingRect, thickframe ); + NC_DrawMovingFrame( hdc, &newRect, thickframe ); + } capturePoint = pt; sizingRect = newRect; } } } - NC_DrawMovingFrame( hdc, &sizingRect, thickframe ); ReleaseCapture(); + if( iconic ) + { + ShowCursor(0); + SetCursor(hOldCursor); + if( hDragCursor ) DestroyCursor(hDragCursor); + } + else + NC_DrawMovingFrame( hdc, &sizingRect, thickframe ); if (wndPtr->dwStyle & WS_CHILD) ReleaseDC32( wndPtr->parent->hwndSelf, hdc ); diff --git a/windows/painting.c b/windows/painting.c index 3edfe8a3165..b41a6e9944a 100644 --- a/windows/painting.c +++ b/windows/painting.c @@ -115,8 +115,14 @@ HDC16 BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps ) * (because rectClient == rectWindow for WS_MINIMIZE windows). */ - lps->hdc = GetDCEx16(hwnd, hrgnUpdate, DCX_INTERSECTRGN | DCX_WINDOWPAINT | - DCX_USESTYLE | (bIcon ? DCX_WINDOW : 0) ); + if (wndPtr->class->style & CS_PARENTDC) + /* Don't clip the output to the update region for CS_PARENTDC window */ + lps->hdc = GetDCEx16( hwnd, 0, DCX_WINDOWPAINT | DCX_USESTYLE | + (bIcon ? DCX_WINDOW : 0) ); + else + lps->hdc = GetDCEx16(hwnd, hrgnUpdate, DCX_INTERSECTRGN | + DCX_WINDOWPAINT | DCX_USESTYLE | + (bIcon ? DCX_WINDOW : 0) ); dprintf_win(stddeb,"hdc = %04x\n", lps->hdc); @@ -264,13 +270,7 @@ BOOL32 PAINT_RedrawWindow( HWND32 hwnd, const RECT32 *rectUpdate, hwnd, hrgnUpdate, flags); } - if (wndPtr->class->style & CS_PARENTDC) - { - GetClientRect32( wndPtr->parent->hwndSelf, &rectClient ); - OffsetRect32( &rectClient, -wndPtr->rectClient.left, - -wndPtr->rectClient.top ); - } - else GetClientRect32( hwnd, &rectClient ); + GetClientRect32( hwnd, &rectClient ); if (flags & RDW_INVALIDATE) /* Invalidate */ { @@ -410,23 +410,16 @@ BOOL32 PAINT_RedrawWindow( HWND32 hwnd, const RECT32 *rectUpdate, for (wndPtr = wndPtr->child; wndPtr; wndPtr = wndPtr->next) if( wndPtr->dwStyle & WS_VISIBLE ) { - if (wndPtr->class->style & CS_PARENTDC) - { - if (!CombineRgn32( hrgn, hrgnUpdate, 0, RGN_COPY )) - continue; - } - else - { - SetRectRgn( hrgn, wndPtr->rectWindow.left, - wndPtr->rectWindow.top, - wndPtr->rectWindow.right, - wndPtr->rectWindow.bottom ); - if (!CombineRgn32( hrgn, hrgn, hrgnUpdate, RGN_AND )) - continue; - } + SetRectRgn( hrgn, wndPtr->rectWindow.left, + wndPtr->rectWindow.top, + wndPtr->rectWindow.right, + wndPtr->rectWindow.bottom ); + if (!CombineRgn32( hrgn, hrgn, hrgnUpdate, RGN_AND )) + continue; OffsetRgn32( hrgn, -wndPtr->rectClient.left, -wndPtr->rectClient.top ); - PAINT_RedrawWindow( wndPtr->hwndSelf, NULL, hrgn, flags, RDW_C_USEHRGN ); + PAINT_RedrawWindow( wndPtr->hwndSelf, NULL, hrgn, flags, + RDW_C_USEHRGN ); } DeleteObject32( hrgn ); if (control & RDW_C_DELETEHRGN) DeleteObject32( hrgnUpdate ); diff --git a/windows/scroll.c b/windows/scroll.c index b26ba150384..71ecc9826b9 100644 --- a/windows/scroll.c +++ b/windows/scroll.c @@ -7,6 +7,7 @@ * */ +#define NO_TRANSITION_TYPES /* This file is Win32-clean */ #include #include "wintypes.h" #include "class.h" @@ -15,38 +16,54 @@ #include "region.h" #include "sysmetrics.h" #include "stddebug.h" -/* #define DEBUG_SCROLL */ #include "debug.h" -extern HWND CARET_GetHwnd(); /* windows/caret.c */ +extern HWND32 CARET_GetHwnd(); /* windows/caret.c */ extern void CLIPPING_UpdateGCRegion(DC* ); /* objects/clipping.c */ static int RgnType; + /************************************************************************* - * ScrollWindow (USER.61) - * + * ScrollWindow16 (USER.61) */ -void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT16 rect, LPRECT16 clipRect) +void ScrollWindow16( HWND16 hwnd, INT16 dx, INT16 dy, const RECT16 *rect, + const RECT16 *clipRect ) +{ + RECT32 rect32, clipRect32; + + if (rect) CONV_RECT16TO32( rect, &rect32 ); + if (clipRect) CONV_RECT16TO32( clipRect, &clipRect32 ); + ScrollWindow32( hwnd, dx, dy, rect ? &rect32 : NULL, + clipRect ? &clipRect32 : NULL ); +} + + +/************************************************************************* + * ScrollWindow32 (USER32.449) + */ +BOOL32 ScrollWindow32( HWND32 hwnd, INT32 dx, INT32 dy, const RECT32 *rect, + const RECT32 *clipRect ) { HDC32 hdc; HRGN32 hrgnUpdate,hrgnClip; - RECT16 rc, cliprc; - HWND hCaretWnd = CARET_GetHwnd(); + RECT32 rc, cliprc; + HWND32 hCaretWnd = CARET_GetHwnd(); WND* wndScroll = WIN_FindWndPtr( hwnd ); - dprintf_scroll(stddeb,"ScrollWindow: hwnd=%04x, dx=%d, dy=%d, lpRect =%08lx clipRect=%i,%i,%i,%i\n", - hwnd, dx, dy, (LONG)rect, (int)((clipRect)?clipRect->left:0), - (int)((clipRect)?clipRect->top:0), - (int)((clipRect)?clipRect->right:0), - (int)((clipRect)?clipRect->bottom:0)); + dprintf_scroll(stddeb,"ScrollWindow: hwnd=%04x, dx=%d, dy=%d, lpRect =%p clipRect=%i,%i,%i,%i\n", + hwnd, dx, dy, rect, + clipRect ? clipRect->left : 0, + clipRect ? clipRect->top : 0, + clipRect ? clipRect->right : 0, + clipRect ? clipRect->bottom : 0 ); - if ( !wndScroll || !WIN_IsWindowDrawable( wndScroll, TRUE ) ) return; + if ( !wndScroll || !WIN_IsWindowDrawable( wndScroll, TRUE ) ) return TRUE; if ( !rect ) /* do not clip children */ { - GetClientRect16(hwnd, &rc); - hrgnClip = CreateRectRgnIndirect16( &rc ); + GetClientRect32(hwnd, &rc); + hrgnClip = CreateRectRgnIndirect32( &rc ); if ((hCaretWnd == hwnd) || IsChild(hwnd,hCaretWnd)) HideCaret(hCaretWnd); @@ -57,22 +74,21 @@ void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT16 rect, LPRECT16 clipRec } else /* clip children */ { - GetClientRect16(hwnd,&rc); - CopyRect16(&rc, rect); + CopyRect32(&rc, rect); if (hCaretWnd == hwnd) HideCaret(hCaretWnd); else hCaretWnd = 0; - hdc = GetDC32(hwnd); + hdc = GetDCEx32( hwnd, 0, DCX_CACHE | DCX_USESTYLE ); } if (clipRect == NULL) - GetClientRect16(hwnd, &cliprc); + GetClientRect32(hwnd, &cliprc); else - CopyRect16(&cliprc, clipRect); + CopyRect32(&cliprc, clipRect); hrgnUpdate = CreateRectRgn32( 0, 0, 0, 0 ); - ScrollDC(hdc, dx, dy, &rc, &cliprc, hrgnUpdate, NULL); + ScrollDC32( hdc, dx, dy, &rc, &cliprc, hrgnUpdate, NULL ); ReleaseDC32(hwnd, hdc); if( !rect ) /* move child windows and update region */ @@ -94,21 +110,39 @@ void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT16 rect, LPRECT16 clipRec DeleteObject32( hrgnUpdate ); if( hCaretWnd ) ShowCaret(hCaretWnd); + return TRUE; } /************************************************************************* - * ScrollDC (USER.221) - * + * ScrollDC16 (USER.221) */ -BOOL ScrollDC(HDC16 hdc, short dx, short dy, LPRECT16 rc, LPRECT16 cliprc, - HRGN32 hrgnUpdate, LPRECT16 rcUpdate) +BOOL16 ScrollDC16( HDC16 hdc, INT16 dx, INT16 dy, const RECT16 *rect, + const RECT16 *cliprc, HRGN16 hrgnUpdate, LPRECT16 rcUpdate ) +{ + RECT32 rect32, clipRect32, rcUpdate32; + BOOL16 ret; + + if (rect) CONV_RECT16TO32( rect, &rect32 ); + if (cliprc) CONV_RECT16TO32( cliprc, &clipRect32 ); + ret = ScrollDC32( hdc, dx, dy, rect ? &rect32 : NULL, + cliprc ? &clipRect32 : NULL, hrgnUpdate, &rcUpdate32 ); + if (rcUpdate) CONV_RECT32TO16( &rcUpdate32, rcUpdate ); + return ret; +} + + +/************************************************************************* + * ScrollDC32 (USER32.448) + */ +BOOL32 ScrollDC32( HDC32 hdc, INT32 dx, INT32 dy, const RECT32 *rc, + const RECT32 *cliprc, HRGN32 hrgnUpdate, LPRECT32 rcUpdate ) { HRGN32 hrgnClip = 0; HRGN32 hrgnScrollClip = 0; - RECT16 rectClip; - POINT16 src, dest; - short width, height; + RECT32 rectClip; + POINT32 src, dest; + INT32 width, height; DC *dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC); dprintf_scroll(stddeb,"ScrollDC: dx=%d dy=%d, hrgnUpdate=%04x rcUpdate = %p cliprc = %p, rc=%d %d %d %d\n", @@ -119,17 +153,17 @@ BOOL ScrollDC(HDC16 hdc, short dx, short dy, LPRECT16 rc, LPRECT16 cliprc, /* set clipping region */ - if ( !rc ) GetClipBox16( hdc, &rectClip ); + if ( !rc ) GetClipBox32( hdc, &rectClip ); else rectClip = *rc; if (cliprc) - IntersectRect16(&rectClip,&rectClip,cliprc); + IntersectRect32(&rectClip,&rectClip,cliprc); if( rectClip.left >= rectClip.right || rectClip.top >= rectClip.bottom ) return FALSE; hrgnClip = GetClipRgn(hdc); - hrgnScrollClip = CreateRectRgnIndirect16(&rectClip); + hrgnScrollClip = CreateRectRgnIndirect32(&rectClip); if( hrgnClip ) { @@ -142,7 +176,7 @@ BOOL ScrollDC(HDC16 hdc, short dx, short dy, LPRECT16 rc, LPRECT16 cliprc, CLIPPING_UpdateGCRegion( dc ); } else - SelectClipRgn16( hdc, hrgnScrollClip ); + SelectClipRgn32( hdc, hrgnScrollClip ); /* translate coordinates */ @@ -172,8 +206,8 @@ BOOL ScrollDC(HDC16 hdc, short dx, short dy, LPRECT16 rc, LPRECT16 cliprc, /* copy bits */ - if (!BitBlt(hdc, dest.x, dest.y, width, height, hdc, src.x, src.y, - SRCCOPY)) + if (!BitBlt32( hdc, dest.x, dest.y, width, height, hdc, src.x, src.y, + SRCCOPY)) return FALSE; /* compute update areas */ @@ -195,23 +229,23 @@ BOOL ScrollDC(HDC16 hdc, short dx, short dy, LPRECT16 rc, LPRECT16 cliprc, } else { - RECT16 rect; + RECT32 rect; rect = rectClip; /* vertical band */ if (dx > 0) rect.right = rect.left + dx; else if (dx < 0) rect.left = rect.right + dx; - else SetRectEmpty16( &rect ); + else SetRectEmpty32( &rect ); SetRectRgn( hrgn1, rect.left, rect.top, rect.right, rect.bottom ); rect = rectClip; /* horizontal band */ if (dy > 0) rect.bottom = rect.top + dy; else if (dy < 0) rect.top = rect.bottom + dy; - else SetRectEmpty16( &rect ); + else SetRectEmpty32( &rect ); RgnType = REGION_UnionRectWithRgn( hrgn1, &rect ); } - if (rcUpdate) GetRgnBox16( hrgn1, rcUpdate ); + if (rcUpdate) GetRgnBox32( hrgn1, rcUpdate ); if (!hrgnUpdate) DeleteObject32( hrgn1 ); } @@ -225,32 +259,55 @@ BOOL ScrollDC(HDC16 hdc, short dx, short dy, LPRECT16 rc, LPRECT16 cliprc, /************************************************************************* - * ScrollWindowEx (USER.319) + * ScrollWindowEx16 (USER.319) + */ +INT16 ScrollWindowEx16( HWND16 hwnd, INT16 dx, INT16 dy, const RECT16 *rect, + const RECT16 *clipRect, HRGN16 hrgnUpdate, + LPRECT16 rcUpdate, UINT16 flags ) +{ + RECT32 rect32, clipRect32, rcUpdate32; + BOOL16 ret; + + if (rect) CONV_RECT16TO32( rect, &rect32 ); + if (clipRect) CONV_RECT16TO32( clipRect, &clipRect32 ); + ret = ScrollWindowEx32( hwnd, dx, dy, rect ? &rect32 : NULL, + clipRect ? &clipRect32 : NULL, hrgnUpdate, + &rcUpdate32, flags ); + if (rcUpdate) CONV_RECT32TO16( &rcUpdate32, rcUpdate ); + return ret; +} + + +/************************************************************************* + * ScrollWindowEx32 (USER32.450) * * FIXME: broken, is there a program that actually uses it? * */ - -int ScrollWindowEx(HWND hwnd, short dx, short dy, LPRECT16 rect, LPRECT16 clipRect, - HRGN32 hrgnUpdate, LPRECT16 rcUpdate, WORD flags) +INT32 ScrollWindowEx32( HWND32 hwnd, INT32 dx, INT32 dy, const RECT32 *rect, + const RECT32 *clipRect, HRGN32 hrgnUpdate, + LPRECT32 rcUpdate, UINT32 flags ) { HDC32 hdc; - RECT16 rc, cliprc; + RECT32 rc, cliprc; - dprintf_scroll(stddeb,"ScrollWindowEx: dx=%d, dy=%d, wFlags=%04x\n",dx, dy, flags); + fprintf( stderr, "ScrollWindowEx: not fully implemented\n" ); + + dprintf_scroll(stddeb,"ScrollWindowEx: dx=%d, dy=%d, wFlags=%04x\n", + dx, dy, flags); hdc = GetDC32(hwnd); if (rect == NULL) - GetClientRect16(hwnd, &rc); + GetClientRect32(hwnd, &rc); else - CopyRect16(&rc, rect); + CopyRect32(&rc, rect); if (clipRect == NULL) - GetClientRect16(hwnd, &cliprc); + GetClientRect32(hwnd, &cliprc); else - CopyRect16(&cliprc, clipRect); + CopyRect32(&cliprc, clipRect); - ScrollDC(hdc, dx, dy, &rc, &cliprc, hrgnUpdate, rcUpdate); + ScrollDC32( hdc, dx, dy, &rc, &cliprc, hrgnUpdate, rcUpdate ); if (flags | SW_INVALIDATE) { diff --git a/windows/win.c b/windows/win.c index 02216273b4f..f9b70eecfae 100644 --- a/windows/win.c +++ b/windows/win.c @@ -43,7 +43,7 @@ static HWND hwndSysModal = 0; static WORD wDragWidth = 4; static WORD wDragHeight= 3; -extern HCURSOR16 CURSORICON_IconToCursor(HICON16); +extern HCURSOR16 CURSORICON_IconToCursor(HICON16, BOOL32); extern HWND32 CARET_GetHwnd(void); extern BOOL32 WINPOS_ActivateOtherWindow(WND* pWnd); extern void WINPOS_CheckActive(HWND32); @@ -311,6 +311,8 @@ static void WIN_DestroyWindow( WND* wndPtr ) HWND hwnd = wndPtr->hwndSelf; WND* pWnd,*pNext; + dprintf_win( stddeb, "WIN_DestroyWindow: %04x\n", wndPtr->hwndSelf ); + #ifdef CONFIG_IPC if (main_block) DDE_DestroyWindow(wndPtr->hwndSelf); @@ -659,7 +661,6 @@ static HWND WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom, if (!(cs->style & WS_CHILD) && (rootWindow == DefaultRootWindow(display))) { XSetWindowAttributes win_attr; - Atom XA_WM_DELETE_WINDOW; if (Options.managed && ((cs->style & (WS_DLGFRAME | WS_THICKFRAME)) || (cs->dwExStyle & WS_EX_DLGMODALFRAME))) @@ -689,9 +690,6 @@ static HWND WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom, CWEventMask | CWOverrideRedirect | CWColormap | CWCursor | CWSaveUnder | CWBackingStore, &win_attr ); - XA_WM_DELETE_WINDOW = XInternAtom( display, "WM_DELETE_WINDOW", - False ); - XSetWMProtocols( display, wndPtr->window, &XA_WM_DELETE_WINDOW, 1 ); if ((wndPtr->flags & WIN_MANAGED) && (cs->dwExStyle & WS_EX_DLGMODALFRAME)) @@ -2069,13 +2067,13 @@ HWND16 GetSysModalWindow16(void) * recursively find a child that contains spDragInfo->pt point * and send WM_QUERYDROPOBJECT */ -BOOL DRAG_QueryUpdate( HWND hQueryWnd, SEGPTR spDragInfo ) +BOOL16 DRAG_QueryUpdate( HWND hQueryWnd, SEGPTR spDragInfo, BOOL32 bNoSend ) { - BOOL wParam,bResult = 0; + BOOL16 wParam,bResult = 0; POINT16 pt; LPDRAGINFO ptrDragInfo = (LPDRAGINFO) PTR_SEG_TO_LIN(spDragInfo); WND *ptrQueryWnd = WIN_FindWndPtr(hQueryWnd),*ptrWnd; - RECT16 tempRect; /* this sucks */ + RECT16 tempRect; if( !ptrQueryWnd || !ptrDragInfo ) return 0; @@ -2112,7 +2110,7 @@ BOOL DRAG_QueryUpdate( HWND hQueryWnd, SEGPTR spDragInfo ) ptrWnd->hwndSelf, ptrWnd->rectWindow.left, ptrWnd->rectWindow.top, ptrWnd->rectWindow.right, ptrWnd->rectWindow.bottom ); if( !(ptrWnd->dwStyle & WS_DISABLED) ) - bResult = DRAG_QueryUpdate(ptrWnd->hwndSelf, spDragInfo); + bResult = DRAG_QueryUpdate(ptrWnd->hwndSelf, spDragInfo, bNoSend); } if(bResult) return bResult; @@ -2125,7 +2123,9 @@ BOOL DRAG_QueryUpdate( HWND hQueryWnd, SEGPTR spDragInfo ) ptrDragInfo->hScope = hQueryWnd; - bResult = SendMessage16( hQueryWnd ,WM_QUERYDROPOBJECT , + bResult = ( bNoSend ) + ? ptrQueryWnd->dwExStyle & WS_EX_ACCEPTFILES + : SendMessage16( hQueryWnd ,WM_QUERYDROPOBJECT , (WPARAM16)wParam ,(LPARAM) spDragInfo ); if( !bResult ) ptrDragInfo->pt = pt; @@ -2191,7 +2191,7 @@ DWORD DragObject(HWND hwndScope, HWND hWnd, WORD wObj, HANDLE16 hOfStruct, short dragDone = 0; HCURSOR16 hCurrentCursor = 0; HWND hCurrentWnd = 0; - WORD btemp; + BOOL16 b; lpDragInfo = (LPDRAGINFO) GlobalLock16(hDragInfo); spDragInfo = (SEGPTR) WIN16_GlobalLock16(hDragInfo); @@ -2208,7 +2208,7 @@ DWORD DragObject(HWND hwndScope, HWND hWnd, WORD wObj, HANDLE16 hOfStruct, if(hCursor) { - if( !(hDragCursor = CURSORICON_IconToCursor(hCursor)) ) + if( !(hDragCursor = CURSORICON_IconToCursor(hCursor, FALSE)) ) { GlobalFree16(hDragInfo); return 0L; @@ -2244,7 +2244,7 @@ DWORD DragObject(HWND hwndScope, HWND hWnd, WORD wObj, HANDLE16 hOfStruct, /* update DRAGINFO struct */ dprintf_msg(stddeb,"drag: lpDI->hScope = %04x\n",lpDragInfo->hScope); - if( (btemp = (WORD)DRAG_QueryUpdate(hwndScope, spDragInfo)) > 0 ) + if( (b = DRAG_QueryUpdate(hwndScope, spDragInfo, FALSE)) > 0 ) hCurrentCursor = hCursor; else { @@ -2254,7 +2254,7 @@ DWORD DragObject(HWND hwndScope, HWND hWnd, WORD wObj, HANDLE16 hOfStruct, if( hCurrentCursor ) SetCursor(hCurrentCursor); - dprintf_msg(stddeb,"drag: got %04x\n",btemp); + dprintf_msg(stddeb,"drag: got %04x\n", b); /* send WM_DRAGLOOP */ SendMessage16( hWnd, WM_DRAGLOOP, (WPARAM16)(hCurrentCursor != hBummer) , diff --git a/windows/winpos.c b/windows/winpos.c index 7d0dd30ba53..81a727e90ca 100644 --- a/windows/winpos.c +++ b/windows/winpos.c @@ -253,7 +253,7 @@ void ScreenToClient32( HWND32 hwnd, LPPOINT32 lppnt ) * * Find the window and hittest for a given point. */ -INT16 WINPOS_WindowFromPoint( POINT16 pt, WND **ppWnd ) +INT16 WINPOS_WindowFromPoint( WND* wndScope, POINT16 pt, WND **ppWnd ) { WND *wndPtr; INT16 hittest = HTERROR; @@ -262,7 +262,7 @@ INT16 WINPOS_WindowFromPoint( POINT16 pt, WND **ppWnd ) *ppWnd = NULL; x = pt.x; y = pt.y; - wndPtr = WIN_GetDesktop()->child; + wndPtr = wndScope->child; for (;;) { while (wndPtr) @@ -298,11 +298,20 @@ INT16 WINPOS_WindowFromPoint( POINT16 pt, WND **ppWnd ) else wndPtr = wndPtr->next; } - /* If nothing found, return the desktop window */ + /* If nothing found, return the scope window */ if (!*ppWnd) { - *ppWnd = WIN_GetDesktop(); - return HTCLIENT; + *ppWnd = wndScope; + if( pt.x >= (wndScope->rectClient.left - wndScope->rectWindow.left) && + pt.x >= (wndScope->rectClient.top - wndScope->rectWindow.top ) && + pt.x <= (wndScope->rectClient.right - wndScope->rectWindow.left) && + pt.x <= (wndScope->rectClient.bottom - wndScope->rectWindow.top ) ) + return HTCLIENT; + if( pt.x < 0 || pt.y < 0 || + pt.x > (wndScope->rectWindow.right - wndScope->rectWindow.left) || + pt.y > (wndScope->rectWindow.bottom - wndScope->rectWindow.top ) ) + return HTNOWHERE; + return HTCAPTION; /* doesn't matter in this case */ } /* Send the WM_NCHITTEST message (only if to the same task) */ @@ -331,7 +340,7 @@ INT16 WINPOS_WindowFromPoint( POINT16 pt, WND **ppWnd ) HWND16 WindowFromPoint16( POINT16 pt ) { WND *pWnd; - WINPOS_WindowFromPoint( pt, &pWnd ); + WINPOS_WindowFromPoint( WIN_GetDesktop(), pt, &pWnd ); return pWnd->hwndSelf; } @@ -344,7 +353,7 @@ HWND32 WindowFromPoint32( POINT32 pt ) WND *pWnd; POINT16 pt16; CONV_POINT32TO16( &pt, &pt16 ); - WINPOS_WindowFromPoint( pt16, &pWnd ); + WINPOS_WindowFromPoint( WIN_GetDesktop(), pt16, &pWnd ); return (HWND32)pWnd->hwndSelf; } @@ -1419,9 +1428,12 @@ static UINT WINPOS_SizeMoveClean(WND* Wnd, HRGN32 oldVisRgn, LPRECT16 lpOldWndRe if( uFlags & SMC_NOCOPY ) /* invalidate Wnd visible region */ { - if (my != NULLREGION) PAINT_RedrawWindow( Wnd->hwndSelf, NULL, newVisRgn, RDW_INVALIDATE | - RDW_FRAME | RDW_ALLCHILDREN | RDW_ERASE, RDW_C_USEHRGN ); - } + if (my != NULLREGION) + PAINT_RedrawWindow( Wnd->hwndSelf, NULL, newVisRgn, RDW_INVALIDATE | + RDW_FRAME | RDW_ALLCHILDREN | RDW_ERASE, RDW_C_USEHRGN ); + else if(uFlags & SMC_DRAWFRAME) + Wnd->flags |= WIN_NEEDS_NCPAINT; + } else /* bitblt old client area */ { HDC32 hDC; @@ -1471,9 +1483,8 @@ static UINT WINPOS_SizeMoveClean(WND* Wnd, HRGN32 oldVisRgn, LPRECT16 lpOldWndRe DCX_KEEPCLIPRGN | DCX_INTERSECTRGN | DCX_CACHE | DCX_CLIPSIBLINGS); - BitBlt( hDC, xto, yto, width, height, hDC, xfrom, yfrom, SRCCOPY ); - - ReleaseDC32( Wnd->parent->hwndSelf, hDC); + BitBlt32( hDC, xto, yto, width, height, hDC, xfrom, yfrom, SRCCOPY ); + ReleaseDC32( Wnd->parent->hwndSelf, hDC); } if( update != NULLREGION )