Commit 59730ae1 authored by Alexandre Julliard's avatar Alexandre Julliard

Release 960324

Sun Mar 24 13:13:11 1996 Alexandre Julliard <julliard@lrc.epfl.ch> * [include/win.h] [windows/*.c] Replaced next, parent, child and owner handles by pointers in WND structure. This should improve performance, and should be reasonably safe since Microsoft did the same in Win95. * [include/wintypes.h] [*/*] Redefined HANDLE to be UINT instead of a pointer for Winelib. This allows removing a lot of unnecessary casts and NPFMTs. * [windows/caret.c] Create the caret brush upon CreateCaret(); use the bitmap dimensions for the caret. Fixed CARET_DisplayCaret() to use PatBlt(). Fri Mar 22 16:00:00 1996 Anand Kumria <akumria@ozemail.com.au> * [misc/winsocket.c] More sanity checks, fixup some erroneous return codes. * [documentation/winsock] Description of how compatible the winsock is currently. Fri Mar 22 13:05:34 1996 Ulrich Schmid <uschmid@mail.hh.provi.de> * [library/winmain.c] Set `lpszCmdParam' by concatenating arguments. * [loader/module.c] WinExec: accept Unix commands, use Wine emulator. Mon Mar 18 12:16:27 1996 Martin von Loewis <loewis@informatik.hu-berlin.de> * [if1632/kernel32.spec][win32/thread.c][include/kernel32.h] DeleteCriticalSection, EnterCriticalSection, InitializeCriticalSection, LeaveCriticalSection, TlsAlloc, TlsFree, TlsGetValue, TlsSetValue: new functions. CRITICAL_SECTION: new structure. * [if1632/kernel32.spec][win32/code_page.c] WideCharToMultiByte: new function. * [if1632/kernel32.spec][win32/file.c] GetFileAttributesA: new function. * [if1632/kernel32.spec][misc/main.c] GetEnvironmentStringsW, FreeEnvironmentStringsA, FreeEnvironmentStringsW: new functions. * [if1632/user.spec][win32/cursoricon32.c][win32/Makefile.in] cursoricon32.c: new file. LoadCursorA, LoadCursorW: modified implementation from LoadCursor to WIN32_*. LoadIconA, LoadIconW: modified implementation from LoadIconA32 to WIN32_*. * [include/struct32.h] pragma pack inserted. CURSORICON32 structures added. * [include/winnls.h] Constants CP_* and WC_* added. * [loader/pe_image.c] PE_LoadModule: call PE_InitDLL with hModule rather than wpnt. Sun Mar 17 16:59:12 1996 Albrecht Kleine <kleine@ak.sax.de> * [misc/commdlg.c] Introduced hook function handling in file dialog. Removed an unnecessary ShowWindow call in FILEDLG_WMCommand(). Thu Mar 14 10:50:00 1996 Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk> * [if1632/gdi32.spec] Added GetNearestColor. * [if1632/kernel32.spec] Added GlobalAddAtomA. * [win32/param32.c] Added stackframe.h to includes. WIN32_GlobalAddAtomA() - new function.
parent b817f4fb
This is release 960314 of Wine the MS Windows emulator. This is still a This is release 960324 of Wine the MS Windows emulator. This is still a
developer's only release. There are many bugs and many unimplemented API developer's only release. There are many bugs and many unimplemented API
features. Most applications still do not work. features. Most applications still do not work.
Patches should be submitted to "julliard@lrc.epfl.ch". Please don't Patches should be submitted to "julliard@lrc.epfl.ch". Please don't
forget to include a ChangeLog entry. forget to include a ChangeLog entry.
WHAT'S NEW with Wine-960314: (see ChangeLog for details) WHAT'S NEW with Wine-960324: (see ChangeLog for details)
- Many combo and listbox fixes. - Many Win32 and Winelib improvements.
- Win32 exception handling.
- Lots of bug fixes. - Lots of bug fixes.
See the README file in the distribution for installation instructions. See the README file in the distribution for installation instructions.
...@@ -16,10 +15,10 @@ Because of lags created by using mirror, this message may reach you before ...@@ -16,10 +15,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 the release is available at the ftp sites. The sources will be available
from the following locations: from the following locations:
sunsite.unc.edu:/pub/Linux/ALPHA/wine/development/Wine-960314.tar.gz sunsite.unc.edu:/pub/Linux/ALPHA/wine/development/Wine-960324.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-960314.tar.gz tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-960324.tar.gz
ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-960314.tar.gz ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-960324.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-960314.tar.gz aris.com:/pub/linux/ALPHA/Wine/development/Wine-960324.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite. It should also be available from any site that mirrors tsx-11 or sunsite.
......
---------------------------------------------------------------------- ----------------------------------------------------------------------
Sun Mar 24 13:13:11 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [include/win.h] [windows/*.c]
Replaced next, parent, child and owner handles by pointers in WND
structure. This should improve performance, and should be
reasonably safe since Microsoft did the same in Win95.
* [include/wintypes.h] [*/*]
Redefined HANDLE to be UINT instead of a pointer for Winelib. This
allows removing a lot of unnecessary casts and NPFMTs.
* [windows/caret.c]
Create the caret brush upon CreateCaret(); use the bitmap
dimensions for the caret.
Fixed CARET_DisplayCaret() to use PatBlt().
Fri Mar 22 16:00:00 1996 Anand Kumria <akumria@ozemail.com.au>
* [misc/winsocket.c]
More sanity checks, fixup some erroneous return codes.
* [documentation/winsock]
Description of how compatible the winsock is currently.
Fri Mar 22 13:05:34 1996 Ulrich Schmid <uschmid@mail.hh.provi.de>
* [library/winmain.c]
Set `lpszCmdParam' by concatenating arguments.
* [loader/module.c]
WinExec: accept Unix commands, use Wine emulator.
Mon Mar 18 12:16:27 1996 Martin von Loewis <loewis@informatik.hu-berlin.de>
* [if1632/kernel32.spec][win32/thread.c][include/kernel32.h]
DeleteCriticalSection, EnterCriticalSection,
InitializeCriticalSection, LeaveCriticalSection, TlsAlloc,
TlsFree, TlsGetValue, TlsSetValue: new functions.
CRITICAL_SECTION: new structure.
* [if1632/kernel32.spec][win32/code_page.c]
WideCharToMultiByte: new function.
* [if1632/kernel32.spec][win32/file.c]
GetFileAttributesA: new function.
* [if1632/kernel32.spec][misc/main.c]
GetEnvironmentStringsW, FreeEnvironmentStringsA,
FreeEnvironmentStringsW: new functions.
* [if1632/user.spec][win32/cursoricon32.c][win32/Makefile.in]
cursoricon32.c: new file.
LoadCursorA, LoadCursorW: modified implementation from LoadCursor
to WIN32_*.
LoadIconA, LoadIconW: modified implementation from LoadIconA32
to WIN32_*.
* [include/struct32.h]
pragma pack inserted.
CURSORICON32 structures added.
* [include/winnls.h]
Constants CP_* and WC_* added.
* [loader/pe_image.c]
PE_LoadModule: call PE_InitDLL with hModule rather than wpnt.
Sun Mar 17 16:59:12 1996 Albrecht Kleine <kleine@ak.sax.de>
* [misc/commdlg.c]
Introduced hook function handling in file dialog.
Removed an unnecessary ShowWindow call in FILEDLG_WMCommand().
Thu Mar 14 10:50:00 1996 Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk>
* [if1632/gdi32.spec]
Added GetNearestColor.
* [if1632/kernel32.spec]
Added GlobalAddAtomA.
* [win32/param32.c]
Added stackframe.h to includes.
WIN32_GlobalAddAtomA() - new function.
----------------------------------------------------------------------
Wed Mar 13 19:46:50 1996 Alexandre Julliard <julliard@lrc.epfl.ch> Wed Mar 13 19:46:50 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [controls/edit.c] * [controls/edit.c]
......
...@@ -161,8 +161,7 @@ LRESULT ButtonWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ...@@ -161,8 +161,7 @@ LRESULT ButtonWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
#ifdef WINELIB32 #ifdef WINELIB32
SendMessage( GetParent(hWnd), WM_COMMAND, SendMessage( GetParent(hWnd), WM_COMMAND,
MAKEWPARAM(wndPtr->wIDmenu,BN_CLICKED), MAKEWPARAM(wndPtr->wIDmenu,BN_CLICKED), hWnd);
(LPARAM) hWnd );
#else #else
SendMessage( GetParent(hWnd), WM_COMMAND, SendMessage( GetParent(hWnd), WM_COMMAND,
wndPtr->wIDmenu, MAKELPARAM(hWnd,BN_CLICKED)); wndPtr->wIDmenu, MAKELPARAM(hWnd,BN_CLICKED));
...@@ -199,7 +198,7 @@ LRESULT ButtonWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ...@@ -199,7 +198,7 @@ LRESULT ButtonWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
break; break;
case WM_GETFONT: case WM_GETFONT:
return (LONG) infoPtr->hFont; return infoPtr->hFont;
case WM_SETFOCUS: case WM_SETFOCUS:
infoPtr->state |= BUTTON_HASFOCUS; infoPtr->state |= BUTTON_HASFOCUS;
...@@ -281,8 +280,7 @@ static void PB_Paint( HWND hButton, HDC hDC, WORD action ) ...@@ -281,8 +280,7 @@ static void PB_Paint( HWND hButton, HDC hDC, WORD action )
/* Send WM_CTLCOLOR to allow changing the font (the colors are fixed) */ /* Send WM_CTLCOLOR to allow changing the font (the colors are fixed) */
if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont ); if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
#ifdef WINELIB32 #ifdef WINELIB32
SendMessage( GetParent(hButton), WM_CTLCOLORBTN, SendMessage( GetParent(hButton), WM_CTLCOLORBTN, hDC, hButton );
(WPARAM)hDC, (LPARAM)hButton );
#else #else
SendMessage( GetParent(hButton), WM_CTLCOLOR, (WORD)hDC, SendMessage( GetParent(hButton), WM_CTLCOLOR, (WORD)hDC,
MAKELPARAM(hButton, CTLCOLOR_BTN) ); MAKELPARAM(hButton, CTLCOLOR_BTN) );
...@@ -340,8 +338,8 @@ static void PB_Paint( HWND hButton, HDC hDC, WORD action ) ...@@ -340,8 +338,8 @@ static void PB_Paint( HWND hButton, HDC hDC, WORD action )
} }
} }
SelectObject(hDC, (HANDLE)hOldPen); SelectObject( hDC, hOldPen );
SelectObject(hDC, (HANDLE)hOldBrush); SelectObject( hDC, hOldBrush );
} }
...@@ -364,10 +362,9 @@ static void CB_Paint( HWND hWnd, HDC hDC, WORD action ) ...@@ -364,10 +362,9 @@ static void CB_Paint( HWND hWnd, HDC hDC, WORD action )
if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont ); if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
#ifdef WINELIB32 /* JBP: Different in Win32 */ #ifdef WINELIB32 /* JBP: Different in Win32 */
hBrush = (HBRUSH) SendMessage(GetParent(hWnd), WM_CTLCOLORBTN, (WPARAM)hDC, hBrush = SendMessage(GetParent(hWnd), WM_CTLCOLORBTN, hDC, hWnd);
(LPARAM)hWnd);
#else #else
hBrush = SendMessage(GetParent(hWnd), WM_CTLCOLOR, (WORD)hDC, hBrush = SendMessage(GetParent(hWnd), WM_CTLCOLOR, hDC,
MAKELPARAM(hWnd, CTLCOLOR_BTN)); MAKELPARAM(hWnd, CTLCOLOR_BTN));
#endif #endif
if (action == ODA_DRAWENTIRE) FillRect(hDC, &rc, hBrush); if (action == ODA_DRAWENTIRE) FillRect(hDC, &rc, hBrush);
...@@ -444,9 +441,9 @@ static void GB_Paint( HWND hWnd, HDC hDC, WORD action ) ...@@ -444,9 +441,9 @@ static void GB_Paint( HWND hWnd, HDC hDC, WORD action )
if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont ); if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
#ifdef WINELIB32 #ifdef WINELIB32
SendMessage( GetParent(hWnd), WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)hWnd ); SendMessage( GetParent(hWnd), WM_CTLCOLORBTN, hDC, hWnd );
#else #else
SendMessage( GetParent(hWnd), WM_CTLCOLOR, (WORD)hDC, SendMessage( GetParent(hWnd), WM_CTLCOLOR, hDC,
MAKELPARAM(hWnd, CTLCOLOR_BTN)); MAKELPARAM(hWnd, CTLCOLOR_BTN));
#endif #endif
SelectObject( hDC, sysColorObjects.hpenWindowFrame ); SelectObject( hDC, sysColorObjects.hpenWindowFrame );
...@@ -487,8 +484,7 @@ static void UB_Paint( HWND hWnd, HDC hDC, WORD action ) ...@@ -487,8 +484,7 @@ static void UB_Paint( HWND hWnd, HDC hDC, WORD action )
if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont ); if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont );
#ifdef WINELIB32 #ifdef WINELIB32
hBrush = (HBRUSH) SendMessage(GetParent(hWnd), WM_CTLCOLORBTN, (WPARAM)hDC, hBrush = SendMessage( GetParent(hWnd), WM_CTLCOLORBTN, hDC, hWnd );
(LPARAM)hWnd);
#else #else
hBrush = SendMessage(GetParent(hWnd), WM_CTLCOLOR, (WORD)hDC, hBrush = SendMessage(GetParent(hWnd), WM_CTLCOLOR, (WORD)hDC,
MAKELPARAM(hWnd, CTLCOLOR_BTN)); MAKELPARAM(hWnd, CTLCOLOR_BTN));
......
...@@ -175,7 +175,7 @@ static LRESULT CBCreate(HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -175,7 +175,7 @@ static LRESULT CBCreate(HWND hwnd, WPARAM wParam, LPARAM lParam)
0, 0, WIN_GetWindowInstance(hwnd), 0, 0, WIN_GetWindowInstance(hwnd),
(SEGPTR)hwnd ); (SEGPTR)hwnd );
ShowWindow(lphc->hWndLBox, SW_HIDE); ShowWindow(lphc->hWndLBox, SW_HIDE);
dprintf_combo(stddeb,"Combo Creation LBox="NPFMT"!\n", lphc->hWndLBox); dprintf_combo(stddeb,"Combo Creation LBox=%04x\n", lphc->hWndLBox);
return 0; return 0;
} }
...@@ -226,8 +226,7 @@ static LRESULT CBPaint(HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -226,8 +226,7 @@ static LRESULT CBPaint(HWND hwnd, WPARAM wParam, LPARAM lParam)
hOldFont = SelectObject(hdc, lphl->hFont); hOldFont = SelectObject(hdc, lphl->hFont);
#ifdef WINELIB32 #ifdef WINELIB32
hBrush = (HBRUSH) SendMessage(lphl->hParent, WM_CTLCOLORLISTBOX, (WPARAM)hdc, hBrush = SendMessage(lphl->hParent, WM_CTLCOLORLISTBOX, hdc, hwnd);
(LPARAM)hwnd);
#else #else
hBrush = SendMessage(lphl->hParent, WM_CTLCOLOR, hdc, hBrush = SendMessage(lphl->hParent, WM_CTLCOLOR, hdc,
MAKELONG(hwnd, CTLCOLOR_LISTBOX)); MAKELONG(hwnd, CTLCOLOR_LISTBOX));
...@@ -473,7 +472,7 @@ static LRESULT CBSetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -473,7 +472,7 @@ static LRESULT CBSetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam)
wRet = ListBoxSetCurSel(lphl, wParam); wRet = ListBoxSetCurSel(lphl, wParam);
dprintf_combo(stddeb,"CBSetCurSel: hwnd "NPFMT" wp %x lp %lx wRet %d\n", dprintf_combo(stddeb,"CBSetCurSel: hwnd %04x wp %x lp %lx wRet %d\n",
hwnd,wParam,lParam,wRet); hwnd,wParam,lParam,wRet);
/* SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);*/ /* SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);*/
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);
...@@ -756,8 +755,7 @@ static LRESULT CBLPaint( HWND hwnd, WPARAM wParam, LPARAM lParam ) ...@@ -756,8 +755,7 @@ static LRESULT CBLPaint( HWND hwnd, WPARAM wParam, LPARAM lParam )
hOldFont = SelectObject(hdc, lphl->hFont); hOldFont = SelectObject(hdc, lphl->hFont);
#ifdef WINELIB32 #ifdef WINELIB32
hBrush = (HBRUSH) SendMessage(lphl->hParent, WM_CTLCOLORLISTBOX, (WPARAM)hdc, hBrush = SendMessage(lphl->hParent, WM_CTLCOLORLISTBOX, hdc, hwnd);
(LPARAM)hwnd);
#else #else
hBrush = SendMessage(lphl->hParent, WM_CTLCOLOR, hdc, hBrush = SendMessage(lphl->hParent, WM_CTLCOLOR, hdc,
MAKELONG(hwnd, CTLCOLOR_LISTBOX)); MAKELONG(hwnd, CTLCOLOR_LISTBOX));
...@@ -783,7 +781,8 @@ static LRESULT CBLPaint( HWND hwnd, WPARAM wParam, LPARAM lParam ) ...@@ -783,7 +781,8 @@ static LRESULT CBLPaint( HWND hwnd, WPARAM wParam, LPARAM lParam )
lpls->itemRect.left = rect.left; lpls->itemRect.left = rect.left;
lpls->itemRect.right = rect.right; lpls->itemRect.right = rect.right;
dprintf_listbox(stddeb,"drawing item: %ld %d %ld %d %d\n",(LONG)rect.left,top,(LONG)rect.right,top+height,lpls->itemState); dprintf_listbox(stddeb,"drawing item: %d %d %d %d %d\n",
rect.left,top,rect.right,top+height,lpls->itemState);
if (lphl->OwnerDrawn) { if (lphl->OwnerDrawn) {
ListBoxDrawItem (combohwnd, lphl, hdc, lpls, &lpls->itemRect, ODA_DRAWENTIRE, 0); ListBoxDrawItem (combohwnd, lphl, hdc, lpls, &lpls->itemRect, ODA_DRAWENTIRE, 0);
if (lpls->itemState) if (lpls->itemState)
...@@ -891,7 +890,7 @@ static LRESULT CBLMouseMove( HWND hwnd, WPARAM wParam, LPARAM lParam ) ...@@ -891,7 +890,7 @@ static LRESULT CBLMouseMove( HWND hwnd, WPARAM wParam, LPARAM lParam )
ListBoxGetItemRect(lphl, wRet, &rectsel); ListBoxGetItemRect(lphl, wRet, &rectsel);
GetClientRect(hwnd, &rect); GetClientRect(hwnd, &rect);
dprintf_combo(stddeb,"CBLMouseMove: hwnd "NPFMT" wp %x lp %lx y %d if %d wret %d %d,%d-%d,%d\n", dprintf_combo(stddeb,"CBLMouseMove: hwnd %04x wp %x lp %lx y %d if %d wret %d %d,%d-%d,%d\n",
hwnd,wParam,lParam,y,lphl->ItemFocused,wRet,rectsel.left,rectsel.top,rectsel.right,rectsel.bottom); hwnd,wParam,lParam,y,lphl->ItemFocused,wRet,rectsel.left,rectsel.top,rectsel.right,rectsel.bottom);
if ((wParam & MK_LBUTTON) != 0) { if ((wParam & MK_LBUTTON) != 0) {
...@@ -997,7 +996,7 @@ LRESULT ComboLBoxWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) ...@@ -997,7 +996,7 @@ LRESULT ComboLBoxWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
*/ */
BOOL DlgDirSelectComboBox(HWND hDlg, LPSTR lpStr, INT nIDLBox) BOOL DlgDirSelectComboBox(HWND hDlg, LPSTR lpStr, INT nIDLBox)
{ {
fprintf(stdnimp,"DlgDirSelectComboBox("NPFMT", '%s', %d) \n", fprintf(stdnimp,"DlgDirSelectComboBox(%04x, '%s', %d) \n",
hDlg, lpStr, nIDLBox); hDlg, lpStr, nIDLBox);
return TRUE; return TRUE;
} }
...@@ -1011,7 +1010,7 @@ INT DlgDirListComboBox( HWND hDlg, SEGPTR path, INT idCBox, ...@@ -1011,7 +1010,7 @@ INT DlgDirListComboBox( HWND hDlg, SEGPTR path, INT idCBox,
{ {
INT ret = 0; INT ret = 0;
dprintf_combo( stddeb,"DlgDirListComboBox("NPFMT",%08lx,%d,%d,%04X) \n", dprintf_combo( stddeb,"DlgDirListComboBox(%04x,%08lx,%d,%d,%04X) \n",
hDlg, (DWORD)path, idCBox, idStatic, wType ); hDlg, (DWORD)path, idCBox, idStatic, wType );
if (idCBox) if (idCBox)
......
...@@ -743,14 +743,14 @@ static void EDIT_WriteTextLine(HWND hwnd, RECT *rect, int y) ...@@ -743,14 +743,14 @@ static void EDIT_WriteTextLine(HWND hwnd, RECT *rect, int y)
/* make sure rectangle is within window */ /* make sure rectangle is within window */
if (rc.left >= es->ClientWidth - 1) if (rc.left >= es->ClientWidth - 1)
{ {
dprintf_edit(stddeb,"EDIT_WriteTextLine: rc.left (%ld) is greater than right edge\n", dprintf_edit(stddeb,"EDIT_WriteTextLine: rc.left (%d) is greater than right edge\n",
(LONG)rc.left); rc.left);
return; return;
} }
if (rc.right <= 0) if (rc.right <= 0)
{ {
dprintf_edit(stddeb,"EDIT_WriteTextLine: rc.right (%ld) is less than left edge\n", dprintf_edit(stddeb,"EDIT_WriteTextLine: rc.right (%d) is less than left edge\n",
(LONG)rc.right); rc.right);
return; return;
} }
if (y - es->wtop < (rc.top / es->txtht) || if (y - es->wtop < (rc.top / es->txtht) ||
...@@ -2008,8 +2008,8 @@ static void EDIT_SetHandleMsg(HWND hwnd, WPARAM wParam) ...@@ -2008,8 +2008,8 @@ static void EDIT_SetHandleMsg(HWND hwnd, WPARAM wParam)
es->textwidth = 0; es->textwidth = 0;
es->SelBegLine = es->SelBegCol = 0; es->SelBegLine = es->SelBegCol = 0;
es->SelEndLine = es->SelEndCol = 0; es->SelEndLine = es->SelEndCol = 0;
dprintf_edit(stddeb, "EDIT_SetHandleMsg: handle %04lx, textlen=%d\n", dprintf_edit(stddeb, "EDIT_SetHandleMsg: handle %04x, textlen=%d\n",
(DWORD)wParam, es->textlen); wParam, es->textlen);
EDIT_BuildTextPointers(hwnd); EDIT_BuildTextPointers(hwnd);
es->PaintBkgd = TRUE; es->PaintBkgd = TRUE;
...@@ -2353,8 +2353,8 @@ static void EDIT_WM_Paint(HWND hwnd) ...@@ -2353,8 +2353,8 @@ static void EDIT_WM_Paint(HWND hwnd)
GetClientRect(hwnd, &rc); GetClientRect(hwnd, &rc);
IntersectClipRect(hdc, rc.left, rc.top, rc.right, rc.bottom); IntersectClipRect(hdc, rc.left, rc.top, rc.right, rc.bottom);
dprintf_edit(stddeb,"WM_PAINT: rc=(%ld,%ld), (%ld,%ld)\n", (LONG)rc.left, dprintf_edit(stddeb,"WM_PAINT: rc=(%d,%d), (%d,%d)\n",
(LONG)rc.top, (LONG)rc.right, (LONG)rc.bottom); rc.left, rc.top, rc.right, rc.bottom);
if (es->PaintBkgd) if (es->PaintBkgd)
FillWindow(GetParent(hwnd), hwnd, hdc, (HBRUSH)CTLCOLOR_EDIT); FillWindow(GetParent(hwnd), hwnd, hdc, (HBRUSH)CTLCOLOR_EDIT);
......
...@@ -1253,7 +1253,7 @@ static LONG LBSetRedraw(HWND hwnd, WORD wParam, LONG lParam) ...@@ -1253,7 +1253,7 @@ static LONG LBSetRedraw(HWND hwnd, WORD wParam, LONG lParam)
{ {
LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd); LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
dprintf_listbox(stddeb,"ListBox WM_SETREDRAW hWnd="NPFMT" w=%04X !\n", dprintf_listbox(stddeb,"ListBox WM_SETREDRAW hWnd=%04x w=%04x !\n",
hwnd, wParam); hwnd, wParam);
lphl->bRedrawFlag = wParam; lphl->bRedrawFlag = wParam;
...@@ -1365,8 +1365,8 @@ static LONG LBPaint(HWND hwnd, WORD wParam, LONG lParam) ...@@ -1365,8 +1365,8 @@ static LONG LBPaint(HWND hwnd, WORD wParam, LONG lParam)
if( IntersectRect(&scratchRect,&paintRect,&lpls->itemRect) ) if( IntersectRect(&scratchRect,&paintRect,&lpls->itemRect) )
{ {
dprintf_listbox(stddeb,"LBPaint: drawing item: %ld %d %ld %d %d\n",(LONG)rect.left,top, dprintf_listbox(stddeb,"LBPaint: drawing item: %d %d %d %d %d\n",
(LONG)rect.right,top+height,lpls->itemState); rect.left,top,rect.right,top+height,lpls->itemState);
if (lphl->OwnerDrawn && (lphl->ItemFocused == i) && GetFocus() == hwnd) if (lphl->OwnerDrawn && (lphl->ItemFocused == i) && GetFocus() == hwnd)
{ {
...@@ -1401,7 +1401,7 @@ static LONG LBSetFocus(HWND hwnd, WORD wParam, LONG lParam) ...@@ -1401,7 +1401,7 @@ static LONG LBSetFocus(HWND hwnd, WORD wParam, LONG lParam)
{ {
LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd); LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
dprintf_listbox(stddeb,"ListBox WM_SETFOCUS for "NPFMT"\n",hwnd); dprintf_listbox(stddeb,"ListBox WM_SETFOCUS for %04x\n",hwnd);
if(!(lphl->dwStyle & LBS_MULTIPLESEL) ) if(!(lphl->dwStyle & LBS_MULTIPLESEL) )
if( lphl->ItemsCount && lphl->ItemFocused != -1) if( lphl->ItemsCount && lphl->ItemFocused != -1)
{ {
...@@ -1429,7 +1429,7 @@ static LONG LBKillFocus(HWND hwnd, WORD wParam, LONG lParam) ...@@ -1429,7 +1429,7 @@ static LONG LBKillFocus(HWND hwnd, WORD wParam, LONG lParam)
{ {
LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd); LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
dprintf_listbox(stddeb,"ListBox WM_KILLFOCUS for "NPFMT"\n",hwnd); dprintf_listbox(stddeb,"ListBox WM_KILLFOCUS for %04x\n",hwnd);
if (!(lphl->dwStyle & LBS_MULTIPLESEL)) if (!(lphl->dwStyle & LBS_MULTIPLESEL))
{ {
if( lphl->ItemsCount ) if( lphl->ItemsCount )
...@@ -1780,7 +1780,7 @@ static LONG LBSetCaretIndex(HWND hwnd, WORD wParam, LONG lParam) ...@@ -1780,7 +1780,7 @@ static LONG LBSetCaretIndex(HWND hwnd, WORD wParam, LONG lParam)
if (!(lphl->dwStyle & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL) )) return 0; if (!(lphl->dwStyle & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL) )) return 0;
dprintf_listbox(stddeb,"LBSetCaretIndex: hwnd "NPFMT" n=%i\n",hwnd,wParam); dprintf_listbox(stddeb,"LBSetCaretIndex: hwnd %04x n=%i\n",hwnd,wParam);
if (wParam >= lphl->ItemsCount) return LB_ERR; if (wParam >= lphl->ItemsCount) return LB_ERR;
...@@ -1946,9 +1946,9 @@ static LRESULT LBPassToParent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa ...@@ -1946,9 +1946,9 @@ static LRESULT LBPassToParent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
WND* ptrWnd = WIN_FindWndPtr(hwnd); WND* ptrWnd = WIN_FindWndPtr(hwnd);
if( ptrWnd ) if( ptrWnd )
if( /* !(ptrWnd->dwExStyle & WS_EX_NOPARENTNOTIFY) && */ if( /* !(ptrWnd->dwExStyle & WS_EX_NOPARENTNOTIFY) && */
ptrWnd->hwndParent ) ptrWnd->parent )
return SendMessage(ptrWnd->hwndParent,message,wParam,lParam); return SendMessage(ptrWnd->parent->hwndSelf,message,wParam,lParam);
return 0; return 0;
} }
...@@ -2044,8 +2044,7 @@ BOOL DlgDirSelect( HWND hDlg, LPSTR lpStr, INT id ) ...@@ -2044,8 +2044,7 @@ BOOL DlgDirSelect( HWND hDlg, LPSTR lpStr, INT id )
char buffer[20]; char buffer[20];
INT i; INT i;
dprintf_listbox( stddeb, "DlgDirSelect: "NPFMT" '%s' %d\n", dprintf_listbox( stddeb, "DlgDirSelect: %04x '%s' %d\n", hDlg, lpStr, id );
hDlg, lpStr, id );
if ((i = SendDlgItemMessage( hDlg, id, LB_GETCURSEL, 0, 0 )) == LB_ERR) if ((i = SendDlgItemMessage( hDlg, id, LB_GETCURSEL, 0, 0 )) == LB_ERR)
return FALSE; return FALSE;
SendDlgItemMessage( hDlg, id, LB_GETTEXT, i, MAKE_SEGPTR(buffer) ); SendDlgItemMessage( hDlg, id, LB_GETTEXT, i, MAKE_SEGPTR(buffer) );
...@@ -2083,7 +2082,7 @@ INT DlgDirList( HWND hDlg, SEGPTR spec, INT idLBox, INT idStatic, UINT attrib ) ...@@ -2083,7 +2082,7 @@ INT DlgDirList( HWND hDlg, SEGPTR spec, INT idLBox, INT idStatic, UINT attrib )
((attrib & DDL_POSTMSGS) ? PostMessage( hwnd, msg, wparam, lparam ) \ ((attrib & DDL_POSTMSGS) ? PostMessage( hwnd, msg, wparam, lparam ) \
: SendMessage( hwnd, msg, wparam, lparam )) : SendMessage( hwnd, msg, wparam, lparam ))
dprintf_listbox( stddeb, "DlgDirList: "NPFMT" '%s' %d %d %04x\n", dprintf_listbox( stddeb, "DlgDirList: %04x '%s' %d %d %04x\n",
hDlg, filespec ? filespec : "NULL", hDlg, filespec ? filespec : "NULL",
idLBox, idStatic, attrib ); idLBox, idStatic, attrib );
......
...@@ -358,9 +358,8 @@ static void SCROLL_DrawInterior( HWND hwnd, HDC hdc, int nBar, RECT *rect, ...@@ -358,9 +358,8 @@ static void SCROLL_DrawInterior( HWND hwnd, HDC hdc, int nBar, RECT *rect,
if (nBar == SB_CTL) /* Only scrollbar controls send WM_CTLCOLOR */ if (nBar == SB_CTL) /* Only scrollbar controls send WM_CTLCOLOR */
{ {
#ifdef WINELIB32 #ifdef WINELIB32
HBRUSH hbrush = (HBRUSH)SendMessage( GetParent(hwnd), HBRUSH hbrush = SendMessage( GetParent(hwnd), WM_CTLCOLORSCROLLBAR,
WM_CTLCOLORSCROLLBAR, hdc, hwnd );
(WPARAM)hdc, (LPARAM)hwnd );
#else #else
HBRUSH hbrush = SendMessage( GetParent(hwnd), WM_CTLCOLOR, hdc, HBRUSH hbrush = SendMessage( GetParent(hwnd), WM_CTLCOLOR, hdc,
MAKELONG(hwnd, CTLCOLOR_SCROLLBAR) ); MAKELONG(hwnd, CTLCOLOR_SCROLLBAR) );
...@@ -505,7 +504,7 @@ static void SCROLL_RefreshScrollBar( HWND hwnd, int nBar ) ...@@ -505,7 +504,7 @@ static void SCROLL_RefreshScrollBar( HWND hwnd, int nBar )
static void SCROLL_HandleKbdEvent( HWND hwnd, WORD wParam ) static void SCROLL_HandleKbdEvent( HWND hwnd, WORD wParam )
{ {
WND *wndPtr = WIN_FindWndPtr( hwnd ); WND *wndPtr = WIN_FindWndPtr( hwnd );
WORD msg; WPARAM msg;
switch(wParam) switch(wParam)
{ {
...@@ -521,7 +520,7 @@ static void SCROLL_HandleKbdEvent( HWND hwnd, WORD wParam ) ...@@ -521,7 +520,7 @@ static void SCROLL_HandleKbdEvent( HWND hwnd, WORD wParam )
#ifdef WINELIB32 #ifdef WINELIB32
SendMessage( GetParent(hwnd), SendMessage( GetParent(hwnd),
(wndPtr->dwStyle & SBS_VERT) ? WM_VSCROLL : WM_HSCROLL, (wndPtr->dwStyle & SBS_VERT) ? WM_VSCROLL : WM_HSCROLL,
(WPARAM)msg, (LPARAM)hwnd ); msg, hwnd );
#else #else
SendMessage( GetParent(hwnd), SendMessage( GetParent(hwnd),
(wndPtr->dwStyle & SBS_VERT) ? WM_VSCROLL : WM_HSCROLL, (wndPtr->dwStyle & SBS_VERT) ? WM_VSCROLL : WM_HSCROLL,
...@@ -598,8 +597,8 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt ) ...@@ -598,8 +597,8 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt )
return; /* Should never happen */ return; /* Should never happen */
} }
dprintf_scroll( stddeb, "ScrollBar Event: hwnd="NPFMT" bar=%d msg=%x pt=%ld,%ld hit=%d\n", dprintf_scroll( stddeb, "ScrollBar Event: hwnd=%04x bar=%d msg=%x pt=%d,%d hit=%d\n",
hwnd, nBar, msg, (LONG)pt.x, (LONG)pt.y, hittest ); hwnd, nBar, msg, pt.x, pt.y, hittest );
switch(trackHitTest) switch(trackHitTest)
{ {
...@@ -615,7 +614,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt ) ...@@ -615,7 +614,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt )
{ {
#ifdef WINELIB32 #ifdef WINELIB32
SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
(WPARAM)SB_LINEUP, (LPARAM)hwndCtl ); SB_LINEUP, hwndCtl );
#else #else
SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
SB_LINEUP, MAKELONG( 0, hwndCtl )); SB_LINEUP, MAKELONG( 0, hwndCtl ));
...@@ -638,7 +637,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt ) ...@@ -638,7 +637,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt )
{ {
#ifdef WINELIB32 #ifdef WINELIB32
SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
(WPARAM)SB_PAGEUP, (LPARAM)hwndCtl ); SB_PAGEUP, hwndCtl );
#else #else
SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
SB_PAGEUP, MAKELONG( 0, hwndCtl )); SB_PAGEUP, MAKELONG( 0, hwndCtl ));
...@@ -682,7 +681,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt ) ...@@ -682,7 +681,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt )
uTrackingPos = trackThumbPos + pos - lastClickPos; uTrackingPos = trackThumbPos + pos - lastClickPos;
#ifdef WINELIB32 #ifdef WINELIB32
SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
MAKEWPARAM(SB_THUMBTRACK,val), (LPARAM)hwndCtl ); MAKEWPARAM(SB_THUMBTRACK,val), hwndCtl );
#else #else
SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
SB_THUMBTRACK, MAKELONG( val, hwndCtl )); SB_THUMBTRACK, MAKELONG( val, hwndCtl ));
...@@ -703,7 +702,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt ) ...@@ -703,7 +702,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt )
{ {
#ifdef WINELIB32 #ifdef WINELIB32
SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
(WPARAM)SB_PAGEDOWN, (LPARAM)hwndCtl ); SB_PAGEDOWN, hwndCtl );
#else #else
SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
SB_PAGEDOWN, MAKELONG( 0, hwndCtl )); SB_PAGEDOWN, MAKELONG( 0, hwndCtl ));
...@@ -725,7 +724,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt ) ...@@ -725,7 +724,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt )
{ {
#ifdef WINELIB32 #ifdef WINELIB32
SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
(WPARAM)SB_LINEDOWN, (LPARAM)hwndCtl ); SB_LINEDOWN, hwndCtl );
#else #else
SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
SB_LINEDOWN, MAKELONG( 0, hwndCtl )); SB_LINEDOWN, MAKELONG( 0, hwndCtl ));
...@@ -747,7 +746,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt ) ...@@ -747,7 +746,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt )
trackThumbPos + lastMousePos - lastClickPos ); trackThumbPos + lastMousePos - lastClickPos );
#ifdef WINELIB32 #ifdef WINELIB32
SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
MAKEWPARAM(SB_THUMBPOSITION,val), (LPARAM)hwndCtl ); MAKEWPARAM(SB_THUMBPOSITION,val), hwndCtl );
#else #else
SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
SB_THUMBPOSITION, MAKELONG( val, hwndCtl ) ); SB_THUMBPOSITION, MAKELONG( val, hwndCtl ) );
...@@ -756,7 +755,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt ) ...@@ -756,7 +755,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt )
else else
#ifdef WINELIB32 #ifdef WINELIB32
SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
(WPARAM)SB_ENDSCROLL, (LPARAM)hwndCtl ); SB_ENDSCROLL, hwndCtl );
#else #else
SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL, SendMessage( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
SB_ENDSCROLL, MAKELONG( 0, hwndCtl ) ); SB_ENDSCROLL, MAKELONG( 0, hwndCtl ) );
...@@ -812,7 +811,7 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) ...@@ -812,7 +811,7 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
} }
} }
if (!hUpArrow) SCROLL_LoadBitmaps(); if (!hUpArrow) SCROLL_LoadBitmaps();
dprintf_scroll( stddeb, "ScrollBar creation, hwnd="NPFMT"\n", hwnd ); dprintf_scroll( stddeb, "ScrollBar creation, hwnd=%04x\n", hwnd );
return 0; return 0;
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
...@@ -898,7 +897,7 @@ void SetScrollRange(HWND hwnd, int nBar, int MinVal, int MaxVal, BOOL bRedraw) ...@@ -898,7 +897,7 @@ void SetScrollRange(HWND hwnd, int nBar, int MinVal, int MaxVal, BOOL bRedraw)
if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return; if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return;
dprintf_scroll( stddeb,"SetScrollRange hwnd="NPFMT" bar=%d min=%d max=%d\n", dprintf_scroll( stddeb,"SetScrollRange hwnd=%04x bar=%d min=%d max=%d\n",
hwnd, nBar, MinVal, MaxVal ); hwnd, nBar, MinVal, MaxVal );
/* Invalid range -> range is set to (0,0) */ /* Invalid range -> range is set to (0,0) */
...@@ -936,7 +935,7 @@ void ShowScrollBar( HWND hwnd, WORD wBar, BOOL fShow ) ...@@ -936,7 +935,7 @@ void ShowScrollBar( HWND hwnd, WORD wBar, BOOL fShow )
WND *wndPtr = WIN_FindWndPtr( hwnd ); WND *wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return; if (!wndPtr) return;
dprintf_scroll( stddeb, "ShowScrollBar: hwnd="NPFMT" bar=%d on=%d\n", hwnd, wBar, fShow ); dprintf_scroll( stddeb, "ShowScrollBar: hwnd=%04x bar=%d on=%d\n", hwnd, wBar, fShow );
switch(wBar) switch(wBar)
{ {
...@@ -1002,7 +1001,7 @@ BOOL EnableScrollBar( HWND hwnd, UINT nBar, UINT flags ) ...@@ -1002,7 +1001,7 @@ BOOL EnableScrollBar( HWND hwnd, UINT nBar, UINT flags )
HDC hdc; HDC hdc;
if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return FALSE; if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ))) return FALSE;
dprintf_scroll( stddeb, "EnableScrollBar: "NPFMT" %d %d\n", hwnd, nBar, flags ); dprintf_scroll( stddeb, "EnableScrollBar: %04x %d %d\n", hwnd, nBar, flags );
flags &= ESB_DISABLE_BOTH; flags &= ESB_DISABLE_BOTH;
if (infoPtr->flags == flags) return FALSE; if (infoPtr->flags == flags) return FALSE;
infoPtr->flags = flags; infoPtr->flags = flags;
......
...@@ -91,9 +91,9 @@ LONG StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ...@@ -91,9 +91,9 @@ LONG StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (createStruct->lpszName) if (createStruct->lpszName)
{ {
HICON hicon = LoadIcon( createStruct->hInstance, HICON hicon = LoadIcon( createStruct->hInstance,
(SEGPTR)createStruct->lpszName ); createStruct->lpszName );
if (!hicon) /* Try OEM icon (FIXME: is this right?) */ if (!hicon) /* Try OEM icon (FIXME: is this right?) */
hicon = LoadIcon( 0, (SEGPTR)createStruct->lpszName ); hicon = LoadIcon( 0, createStruct->lpszName );
STATIC_SetIcon( hWnd, hicon ); STATIC_SetIcon( hWnd, hicon );
} }
return 1; return 1;
...@@ -159,7 +159,7 @@ LONG StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ...@@ -159,7 +159,7 @@ LONG StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
break; break;
case WM_GETFONT: case WM_GETFONT:
return (LONG)infoPtr->hFont; return infoPtr->hFont;
case WM_NCHITTEST: case WM_NCHITTEST:
return HTTRANSPARENT; return HTTRANSPARENT;
...@@ -168,10 +168,10 @@ LONG StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ...@@ -168,10 +168,10 @@ LONG StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return DLGC_STATIC; return DLGC_STATIC;
case STM_GETICON: case STM_GETICON:
return (LONG)infoPtr->hIcon; return infoPtr->hIcon;
case STM_SETICON: case STM_SETICON:
lResult = (LONG)STATIC_SetIcon( hWnd, (HICON)wParam ); lResult = STATIC_SetIcon( hWnd, (HICON)wParam );
InvalidateRect( hWnd, NULL, FALSE ); InvalidateRect( hWnd, NULL, FALSE );
UpdateWindow( hWnd ); UpdateWindow( hWnd );
break; break;
...@@ -230,16 +230,14 @@ static void PaintTextfn( HWND hwnd, HDC hdc ) ...@@ -230,16 +230,14 @@ static void PaintTextfn( HWND hwnd, HDC hdc )
if (infoPtr->hFont) SelectObject( hdc, infoPtr->hFont ); if (infoPtr->hFont) SelectObject( hdc, infoPtr->hFont );
#ifdef WINELIB32 #ifdef WINELIB32
hBrush = (HBRUSH)SendMessage( wndPtr->hwndParent, WM_CTLCOLORSTATIC, hBrush = SendMessage( GetParent(hwnd), WM_CTLCOLORSTATIC, hdc, hwnd );
(WPARAM)hdc, (LPARAM)hwnd );
#else #else
hBrush = SendMessage( wndPtr->hwndParent, WM_CTLCOLOR, (WORD)hdc, hBrush = SendMessage( GetParent(hwnd), WM_CTLCOLOR, (WORD)hdc,
MAKELONG(hwnd, CTLCOLOR_STATIC)); MAKELONG(hwnd, CTLCOLOR_STATIC));
#endif #endif
if (hBrush == (HBRUSH)NULL) hBrush = GetStockObject(WHITE_BRUSH); if (!hBrush) hBrush = GetStockObject(WHITE_BRUSH);
FillRect(hdc, &rc, hBrush); FillRect(hdc, &rc, hBrush);
if (text) if (text) DrawText( hdc, text, -1, &rc, wFormat );
DrawText(hdc, text, -1, &rc, wFormat);
} }
static void PaintRectfn( HWND hwnd, HDC hdc ) static void PaintRectfn( HWND hwnd, HDC hdc )
...@@ -293,10 +291,9 @@ static void PaintIconfn( HWND hwnd, HDC hdc ) ...@@ -293,10 +291,9 @@ static void PaintIconfn( HWND hwnd, HDC hdc )
GetClientRect(hwnd, &rc); GetClientRect(hwnd, &rc);
#ifdef WINELIB32 #ifdef WINELIB32
hbrush = (HBRUSH)SendMessage( wndPtr->hwndParent, WM_CTLCOLORSTATIC, hbrush = SendMessage( GetParent(hwnd), WM_CTLCOLORSTATIC, hdc, hwnd );
(WPARAM)hdc, (LPARAM)hwnd );
#else #else
hbrush = SendMessage( wndPtr->hwndParent, WM_CTLCOLOR, hdc, hbrush = SendMessage( GetParent(hwnd), WM_CTLCOLOR, hdc,
MAKELONG(hwnd, CTLCOLOR_STATIC)); MAKELONG(hwnd, CTLCOLOR_STATIC));
#endif #endif
FillRect( hdc, &rc, hbrush ); FillRect( hdc, &rc, hbrush );
......
Winsock
Platform 1.
Windows NT 3.51, build 1057, Service Pack 2
Platform 2.
Windows 3.1 with Trumpet Sockets (2.1f)
Testing
-------
Testing was done using the Windows Sockets API Tester (WSAT), available
from rhino.microsoft.com/wsat/wsat594.exe. I found a number of tests that
would not run under Wine, some that failed under Trumpet, and others under
NT. So, I decided to use tests that at least succeeded IN FULL on all the
test platforms.
These are only the local tests.
Any program which makes use of the WSAAsync* calls, pretty much won't
work. Other program which work correctly will work ... mostly. Programs
which are incorrect, will probably crash and burn fairly quickly.
I have tried to make WINESockets as close as possible to Trumpet's.
The numbers in brackets next to each platform indicate how many tests failed,
the numbers listed on the variations line are the test that failed.
Investigated
============
BINDT.TST NT (00) Trumpet (10) Wine (10)
BINDU.TST NT (00) Trumpet (10) Wine (10)
HOST.TST NT (01) Trumpet (06) Wine (38)*3
HOSTHOST.TST NT (01)*1 Trumpet (01)*1 Wine (00)
HOSTNAME.TST NT (01) Trumpet (00) Wine (00)*2
INET.TST NT (01) Trumpet (24)*1 Wine (01)
IOCTLT.TST NT (00) Trumpet (00) Wine (06)
IOCTLU.TST NT (00) Trumpet (00) Wine (04)
PROTO.TST NT (00) Trumpet (00) Wine (41)*3
SERV.TST NT (00) Trumpet (00) Wine (50)*3
SOCKETT.TST NT (01) Trumpet (00) Wine (00)
SOCKETU.TST NT (03) Trumpet (00) Wine (00)
START.TST NT (00) Trumpet (00) Wine (08)*3
STARTL.TST NT (00)*4 Trumpet (00) Wine (00)
STARTH.TST Wine crashed with two messages (from the program, methinks)
indicating "FREE - HEAPBADNODE - bad node in head."
Unchecked
=========
ENOBUFST.TST ENOBUFSU.TST
GETOPTT.TST GETOPTU.TST
SETOPTT.TST SETOPTU.TST
All the client/server tests
*1 errors in the NT and/or Trumpet were caused
by a mistake I made while configuring this test.
*2 Wine passes these tests, because they aren't done
correctly not because it does everything correctly.
*3 Wine crashed part way through the testing process,
hence the large value of tests failed.
*4 NT actually supports Winsock 1.0 as well.
...@@ -1048,8 +1048,8 @@ WORD SetHandleCount( WORD count ) ...@@ -1048,8 +1048,8 @@ WORD SetHandleCount( WORD count )
{ {
memcpy( pdb->fileHandles, files, 20 ); memcpy( pdb->fileHandles, files, 20 );
#ifdef WINELIB #ifdef WINELIB
GlobalFree( pdb->fileHandlesPtr ); GlobalFree( (HGLOBAL)pdb->fileHandlesPtr );
pdb->fileHandlesPtr = pdb->fileHandles; pdb->fileHandlesPtr = (SEGPTR)pdb->fileHandles;
#else #else
GlobalFree( GlobalHandle( SELECTOROF(pdb->fileHandlesPtr) )); GlobalFree( GlobalHandle( SELECTOROF(pdb->fileHandlesPtr) ));
pdb->fileHandlesPtr = (SEGPTR)MAKELONG( 0x18, pdb->fileHandlesPtr = (SEGPTR)MAKELONG( 0x18,
...@@ -1075,7 +1075,7 @@ WORD SetHandleCount( WORD count ) ...@@ -1075,7 +1075,7 @@ WORD SetHandleCount( WORD count )
} }
else memcpy( newfiles, files, count ); else memcpy( newfiles, files, count );
#ifdef WINELIB #ifdef WINELIB
if (pdb->nbFiles > 20) GlobalFree( pdb->fileHandlesPtr ); if (pdb->nbFiles > 20) GlobalFree( (HGLOBAL)pdb->fileHandlesPtr );
#else #else
if (pdb->nbFiles > 20) if (pdb->nbFiles > 20)
GlobalFree( GlobalHandle( SELECTOROF(pdb->fileHandlesPtr) )); GlobalFree( GlobalHandle( SELECTOROF(pdb->fileHandlesPtr) ));
......
...@@ -203,7 +203,7 @@ base 1 ...@@ -203,7 +203,7 @@ base 1
0199 stub GetMetaFileW 0199 stub GetMetaFileW
0200 stub GetMetaRgn 0200 stub GetMetaRgn
0201 stub GetMiterLimit 0201 stub GetMiterLimit
0202 stub GetNearestColor 0202 stdcall GetNearestColor(long long) GetNearestColor
0203 stub GetNearestPaletteIndex 0203 stub GetNearestPaletteIndex
0204 stdcall GetObjectA(long long ptr) WIN32_GetObject 0204 stdcall GetObjectA(long long ptr) WIN32_GetObject
0205 stub GetObjectType 0205 stub GetObjectType
......
...@@ -71,7 +71,7 @@ base 1 ...@@ -71,7 +71,7 @@ base 1
0067 stub DefineDosDeviceA 0067 stub DefineDosDeviceA
0068 stub DefineDosDeviceW 0068 stub DefineDosDeviceW
0069 stub DeleteAtom 0069 stub DeleteAtom
0070 stub DeleteCriticalSection 0070 stdcall DeleteCriticalSection(ptr) DeleteCriticalSection
0071 stub DeleteFileA 0071 stub DeleteFileA
0072 stub DeleteFileW 0072 stub DeleteFileW
0073 stub DeviceIoControl 0073 stub DeviceIoControl
...@@ -82,7 +82,7 @@ base 1 ...@@ -82,7 +82,7 @@ base 1
0078 stdcall DuplicateHandle(long long long ptr long long long) DuplicateHandle 0078 stdcall DuplicateHandle(long long long ptr long long long) DuplicateHandle
0079 stub EndUpdateResourceA 0079 stub EndUpdateResourceA
0080 stub EndUpdateResourceW 0080 stub EndUpdateResourceW
0081 stub EnterCriticalSection 0081 stdcall EnterCriticalSection(ptr) EnterCriticalSection
0082 stub EnumCalendarInfoA 0082 stub EnumCalendarInfoA
0083 stub EnumCalendarInfoW 0083 stub EnumCalendarInfoW
0084 stub EnumDateFormatsA 0084 stub EnumDateFormatsA
...@@ -142,8 +142,8 @@ base 1 ...@@ -142,8 +142,8 @@ base 1
0138 stub FormatMessageA 0138 stub FormatMessageA
0139 stub FormatMessageW 0139 stub FormatMessageW
0140 stub FreeConsole 0140 stub FreeConsole
0141 stub FreeEnvironmentStringsA 0141 stdcall FreeEnvironmentStringsA(ptr) FreeEnvironmentStringsA
0142 stub FreeEnvironmentStringsW 0142 stdcall FreeEnvironmentStringsW(ptr) FreeEnvironmentStringsW
0143 stub FreeLibrary 0143 stub FreeLibrary
0144 stub FreeLibraryAndExitThread 0144 stub FreeLibraryAndExitThread
0145 stdcall FreeResource(long) FreeResource32 0145 stdcall FreeResource(long) FreeResource32
...@@ -213,12 +213,12 @@ base 1 ...@@ -213,12 +213,12 @@ base 1
0209 stub GetDriveTypeW 0209 stub GetDriveTypeW
0210 stdcall GetEnvironmentStrings() GetEnvironmentStrings 0210 stdcall GetEnvironmentStrings() GetEnvironmentStrings
0211 stub GetEnvironmentStringsA 0211 stub GetEnvironmentStringsA
0212 stub GetEnvironmentStringsW 0212 stdcall GetEnvironmentStringsW() GetEnvironmentStringsW
0213 stdcall GetEnvironmentVariableA(ptr ptr long) GetEnvironmentVariableA 0213 stdcall GetEnvironmentVariableA(ptr ptr long) GetEnvironmentVariableA
0214 stub GetEnvironmentVariableW 0214 stub GetEnvironmentVariableW
0215 stub GetExitCodeProcess 0215 stub GetExitCodeProcess
0216 stub GetExitCodeThread 0216 stub GetExitCodeThread
0217 stub GetFileAttributesA 0217 stdcall GetFileAttributesA(ptr) GetFileAttributesA
0218 stub GetFileAttributesW 0218 stub GetFileAttributesW
0219 stdcall GetFileInformationByHandle(long ptr) GetFileInformationByHandle 0219 stdcall GetFileInformationByHandle(long ptr) GetFileInformationByHandle
0220 stub GetFileSize 0220 stub GetFileSize
...@@ -315,7 +315,7 @@ base 1 ...@@ -315,7 +315,7 @@ base 1
0310 stub GetVolumeInformationW 0310 stub GetVolumeInformationW
0311 stub GetWindowsDirectoryA 0311 stub GetWindowsDirectoryA
0312 stub GetWindowsDirectoryW 0312 stub GetWindowsDirectoryW
0313 stub GlobalAddAtomA 0313 stdcall GlobalAddAtomA(long) WIN32_GlobalAddAtomA
0314 stub GlobalAddAtomW 0314 stub GlobalAddAtomW
0315 stdcall GlobalAlloc(long long) GlobalAlloc32 0315 stdcall GlobalAlloc(long long) GlobalAlloc32
0316 stub GlobalCompact 0316 stub GlobalCompact
...@@ -348,7 +348,7 @@ base 1 ...@@ -348,7 +348,7 @@ base 1
0343 stub HeapValidate 0343 stub HeapValidate
0344 stub HeapWalk 0344 stub HeapWalk
0345 stub InitAtomTable 0345 stub InitAtomTable
0346 stub InitializeCriticalSection 0346 stdcall InitializeCriticalSection(ptr) InitializeCriticalSection
0347 stub InterlockedDecrement 0347 stub InterlockedDecrement
0348 stub InterlockedExchange 0348 stub InterlockedExchange
0349 stub InterlockedIncrement 0349 stub InterlockedIncrement
...@@ -366,7 +366,7 @@ base 1 ...@@ -366,7 +366,7 @@ base 1
0361 stub IsValidLocale 0361 stub IsValidLocale
0362 stub LCMapStringA 0362 stub LCMapStringA
0363 stub LCMapStringW 0363 stub LCMapStringW
0364 stub LeaveCriticalSection 0364 stdcall LeaveCriticalSection(ptr) LeaveCriticalSection
0365 stdcall LoadLibraryA(long) LoadLibraryA 0365 stdcall LoadLibraryA(long) LoadLibraryA
0366 stub LoadLibraryExA 0366 stub LoadLibraryExA
0367 stub LoadLibraryExW 0367 stub LoadLibraryExW
...@@ -532,10 +532,10 @@ base 1 ...@@ -532,10 +532,10 @@ base 1
0527 stub SystemTimeToTzSpecificLocalTime 0527 stub SystemTimeToTzSpecificLocalTime
0528 stub TerminateProcess 0528 stub TerminateProcess
0529 stub TerminateThread 0529 stub TerminateThread
0530 stub TlsAlloc 0530 stdcall TlsAlloc() TlsAlloc
0531 stub TlsFree 0531 stdcall TlsFree(long) TlsFree
0532 stub TlsGetValue 0532 stdcall TlsGetValue(long) TlsGetValue
0533 stub TlsSetValue 0533 stdcall TlsSetValue(long ptr) TlsSetValue
0534 stub TransactNamedPipe 0534 stub TransactNamedPipe
0535 stub TransmitCommChar 0535 stub TransmitCommChar
0536 stub TrimVirtualBuffer 0536 stub TrimVirtualBuffer
...@@ -567,7 +567,7 @@ base 1 ...@@ -567,7 +567,7 @@ base 1
0562 stub WaitForSingleObjectEx 0562 stub WaitForSingleObjectEx
0563 stub WaitNamedPipeA 0563 stub WaitNamedPipeA
0564 stub WaitNamedPipeW 0564 stub WaitNamedPipeW
0565 stub WideCharToMultiByte 0565 stdcall WideCharToMultiByte(long long ptr long ptr long ptr ptr) WideCharToMultiByte
0566 stub WinExec 0566 stub WinExec
0567 stub WriteConsoleA 0567 stub WriteConsoleA
0568 stub WriteConsoleInputA 0568 stub WriteConsoleInputA
......
...@@ -366,13 +366,12 @@ base 1 ...@@ -366,13 +366,12 @@ base 1
0355 stdcall LoadAcceleratorsW(long ptr) WIN32_LoadAcceleratorsW 0355 stdcall LoadAcceleratorsW(long ptr) WIN32_LoadAcceleratorsW
0356 stdcall LoadBitmapA(long ptr) WIN32_LoadBitmapA 0356 stdcall LoadBitmapA(long ptr) WIN32_LoadBitmapA
0357 stdcall LoadBitmapW(long ptr) WIN32_LoadBitmapW 0357 stdcall LoadBitmapW(long ptr) WIN32_LoadBitmapW
0357 stub LoadBitmapW 0358 stdcall LoadCursorA(long ptr) WIN32_LoadCursorA
0358 stdcall LoadCursorA(long ptr) LoadCursor
0359 stub LoadCursorFromFileA 0359 stub LoadCursorFromFileA
0360 stub LoadCursorFromFileW 0360 stub LoadCursorFromFileW
0361 stub LoadCursorW 0361 stdcall LoadCursorW(long ptr) WIN32_LoadCursorW
0362 stdcall LoadIconA(long ptr) LoadIconA32 0362 stdcall LoadIconA(long ptr) WIN32_LoadIconA
0363 stdcall LoadIconW(long ptr) LoadIconW32 0363 stdcall LoadIconW(long ptr) WIN32_LoadIconW
0364 stub LoadImageA 0364 stub LoadImageA
0365 stub LoadImageW 0365 stub LoadImageW
0366 stub LoadKeyboardLayoutA 0366 stub LoadKeyboardLayoutA
......
...@@ -81,7 +81,7 @@ extern WORD CallTo16_regs_( FARPROC func, WORD ds, WORD es, WORD bp, WORD ax, ...@@ -81,7 +81,7 @@ extern WORD CallTo16_regs_( FARPROC func, WORD ds, WORD es, WORD bp, WORD ax,
#define CallEnumObjectsProc( func, lpobj, lParam ) \ #define CallEnumObjectsProc( func, lpobj, lParam ) \
(*func)( lpobj, lParam ) (*func)( lpobj, lParam )
#define CallEnumPropProc( func, hwnd, lpstr, data ) \ #define CallEnumPropProc( func, hwnd, lpstr, data ) \
(*func)( hwnd, lpstr, data ) (*func)( hwnd, (LPCTSTR)(lpstr), data )
#define CallEnumTaskWndProc( func, hwnd, lParam ) \ #define CallEnumTaskWndProc( func, hwnd, lParam ) \
(*func)( hwnd, lParam ) (*func)( hwnd, lParam )
#define CallEnumWindowsProc( func, hwnd, lParam ) \ #define CallEnumWindowsProc( func, hwnd, lParam ) \
......
...@@ -133,4 +133,14 @@ typedef struct ...@@ -133,4 +133,14 @@ typedef struct
#define FILE_ATTRIBUTE_ATOMIC_WRITE 0x0200 #define FILE_ATTRIBUTE_ATOMIC_WRITE 0x0200
#define FILE_ATTRIBUTE_XACTION_WRITE 0x0400 #define FILE_ATTRIBUTE_XACTION_WRITE 0x0400
/* Could this type be considered opaque? */
typedef struct {
LPVOID DebugInfo;
LONG LockCount;
LONG RecursionCount;
HANDLE OwningThread;
HANDLE LockSemaphore;
DWORD Reserved;
}CRITICAL_SECTION;
#endif /* __WINE_KERNEL32_H */ #endif /* __WINE_KERNEL32_H */
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
#define _STRUCT32_H #define _STRUCT32_H
#include "handle32.h" #include "handle32.h"
#ifndef WINELIB
#pragma pack(1)
#endif
typedef struct tagRECT32 typedef struct tagRECT32
{ {
LONG left; LONG left;
...@@ -45,21 +49,21 @@ void STRUCT32_MINMAXINFO16to32(const MINMAXINFO*,MINMAXINFO32*); ...@@ -45,21 +49,21 @@ void STRUCT32_MINMAXINFO16to32(const MINMAXINFO*,MINMAXINFO32*);
typedef struct { typedef struct {
DWORD style; DWORD style;
DWORD dwExtendedStyle; DWORD dwExtendedStyle;
WORD noOfItems; WORD noOfItems WINE_PACKED;
short x; short x WINE_PACKED;
short y; short y WINE_PACKED;
WORD cx; WORD cx WINE_PACKED;
WORD cy; WORD cy WINE_PACKED;
} DLGTEMPLATE32; } DLGTEMPLATE32;
typedef struct { typedef struct {
DWORD style; DWORD style;
DWORD dwExtendedStyle; DWORD dwExtendedStyle;
short x; short x WINE_PACKED;
short y; short y WINE_PACKED;
short cx; short cx WINE_PACKED;
short cy; short cy WINE_PACKED;
WORD id; WORD id WINE_PACKED;
} DLGITEMTEMPLATE32; } DLGITEMTEMPLATE32;
#define CW_USEDEFAULT32 0x80000000 #define CW_USEDEFAULT32 0x80000000
...@@ -132,4 +136,45 @@ typedef CREATESTRUCT32 CREATESTRUCTA; ...@@ -132,4 +136,45 @@ typedef CREATESTRUCT32 CREATESTRUCTA;
void STRUCT32_CREATESTRUCT32to16(const CREATESTRUCT32*,CREATESTRUCT*); void STRUCT32_CREATESTRUCT32to16(const CREATESTRUCT32*,CREATESTRUCT*);
void STRUCT32_CREATESTRUCT16to32(const CREATESTRUCT*,CREATESTRUCT32*); void STRUCT32_CREATESTRUCT16to32(const CREATESTRUCT*,CREATESTRUCT32*);
typedef struct {
BYTE bWidth;
BYTE bHeight;
BYTE bColorCount;
BYTE bReserved;
WORD wPlanes;
WORD wBitCount;
DWORD dwBytesInRes;
WORD wResId WINE_PACKED;
/*WORD padding; Spec is wrong, no padding here*/
} ICONDIRENTRY32;
typedef struct {
WORD wWidth;
WORD wHeight;
WORD wPlanes;
WORD wBitCount;
DWORD dwBytesInRes;
WORD wResId WINE_PACKED;
/*WORD padding;*/
} CURSORDIRENTRY32;
typedef union{
ICONDIRENTRY32 icon;
CURSORDIRENTRY32 cursor;
} CURSORICONDIRENTRY32;
typedef struct {
WORD idReserved;
WORD idType;
WORD idCount;
/*WORD padding;*/
CURSORICONDIRENTRY32 idEntries[1];
} CURSORICONDIR32;
#ifndef WINELIB
#pragma pack(4)
#endif
#endif #endif
...@@ -20,7 +20,8 @@ extern BOOL USER_HeapInit(void); ...@@ -20,7 +20,8 @@ extern BOOL USER_HeapInit(void);
#define USER_HEAP_LIN_ADDR(handle) LocalLock (handle) #define USER_HEAP_LIN_ADDR(handle) LocalLock (handle)
#define USER_HEAP_SEG_ADDR(handle) LocalLock (handle) #define USER_HEAP_SEG_ADDR(handle) LocalLock (handle)
#define USER_HEAP_FREE(handle) LocalFree (handle) #define USER_HEAP_FREE(handle) LocalFree (handle)
#else
#else /* WINELIB */
extern LPSTR USER_Heap; extern LPSTR USER_Heap;
extern WORD USER_HeapSel; extern WORD USER_HeapSel;
......
...@@ -29,11 +29,12 @@ ...@@ -29,11 +29,12 @@
typedef struct tagWND typedef struct tagWND
{ {
HWND hwndNext; /* Next sibling */ struct tagWND *next; /* Next sibling */
HWND hwndChild; /* First child */ struct tagWND *child; /* First child */
struct tagWND *parent; /* Window parent (from CreateWindow) */
struct tagWND *owner; /* Window owner */
DWORD dwMagic; /* Magic number (must be WND_MAGIC) */ DWORD dwMagic; /* Magic number (must be WND_MAGIC) */
HWND hwndParent; /* Window parent (from CreateWindow) */ HWND hwndSelf; /* Handle of this window */
HWND hwndOwner; /* Window owner */
HCLASS hClass; /* Window class */ HCLASS hClass; /* Window class */
HANDLE hInstance; /* Window hInstance (from CreateWindow) */ HANDLE hInstance; /* Window hInstance (from CreateWindow) */
RECT rectClient; /* Client area rel. to parent client area */ RECT rectClient; /* Client area rel. to parent client area */
...@@ -75,6 +76,7 @@ typedef struct tagWND ...@@ -75,6 +76,7 @@ typedef struct tagWND
/* Window functions */ /* Window functions */
extern WND *WIN_FindWndPtr( HWND hwnd ); extern WND *WIN_FindWndPtr( HWND hwnd );
extern WND *WIN_GetDesktop(void);
extern void WIN_DumpWindow( HWND hwnd ); extern void WIN_DumpWindow( HWND hwnd );
extern void WIN_WalkWindows( HWND hwnd, int indent ); extern void WIN_WalkWindows( HWND hwnd, int indent );
extern Window WIN_GetXWindow( HWND hwnd ); extern Window WIN_GetXWindow( HWND hwnd );
......
...@@ -9,10 +9,7 @@ ...@@ -9,10 +9,7 @@
#pragma pack(1) #pragma pack(1)
#endif #endif
#ifdef WINELIB32 #ifndef WINELIB32
typedef struct { SHORT x,y; } POINTS;
#define MAKEPOINTS(l) (*((POINTS *)&(l)))
#else
#define MAKEPOINT(l) (*((POINT *)&(l))) #define MAKEPOINT(l) (*((POINT *)&(l)))
#endif #endif
typedef struct { INT cx,cy; } SIZE, *LPSIZE; typedef struct { INT cx,cy; } SIZE, *LPSIZE;
...@@ -541,11 +538,7 @@ typedef struct tagLOGBRUSH ...@@ -541,11 +538,7 @@ typedef struct tagLOGBRUSH
{ {
WORD lbStyle; WORD lbStyle;
COLORREF lbColor WINE_PACKED; COLORREF lbColor WINE_PACKED;
#ifdef WINELIB32 INT lbHatch;
LONG lbHatch;
#else
INT lbHatch;
#endif
} LOGBRUSH, *PLOGBRUSH, *NPLOGBRUSH, *LPLOGBRUSH; } LOGBRUSH, *PLOGBRUSH, *NPLOGBRUSH, *LPLOGBRUSH;
/* Brush styles */ /* Brush styles */
...@@ -2801,7 +2794,7 @@ BOOL ExtFloodFill(HDC,INT,INT,COLORREF,WORD); ...@@ -2801,7 +2794,7 @@ BOOL ExtFloodFill(HDC,INT,INT,COLORREF,WORD);
BOOL ExtTextOut(HDC,short,short,WORD,LPRECT,LPSTR,WORD,LPINT); BOOL ExtTextOut(HDC,short,short,WORD,LPRECT,LPSTR,WORD,LPINT);
HICON ExtractIcon(HINSTANCE,LPCSTR,UINT); HICON ExtractIcon(HINSTANCE,LPCSTR,UINT);
WORD FarGetOwner(HANDLE); WORD FarGetOwner(HANDLE);
void FarSetOwner(HANDLE,WORD); void FarSetOwner(HANDLE,HANDLE);
void FatalAppExit(UINT,LPCSTR); void FatalAppExit(UINT,LPCSTR);
void FatalExit(int); void FatalExit(int);
int FillRect(HDC,LPRECT,HBRUSH); int FillRect(HDC,LPRECT,HBRUSH);
......
...@@ -106,4 +106,13 @@ ...@@ -106,4 +106,13 @@
#define NORM_IGNORESYMBOLS 4 #define NORM_IGNORESYMBOLS 4
#define NORM_STRINGSORT 0x1000 #define NORM_STRINGSORT 0x1000
#define CP_ACP 0
#define CP_OEMCP 1
#define WC_DEFAULTCHECK 0x00000100
#define WC_COMPOSITECHECK 0x00000200
#define WC_DISCARDNS 0x00000010
#define WC_SEPCHARS 0x00000020
#define WC_DEFAULTCHAR 0x00000040
#endif /* __WINE_WINNLS_H */ #endif /* __WINE_WINNLS_H */
...@@ -4,8 +4,10 @@ ...@@ -4,8 +4,10 @@
* Copyright 1994 Alexandre Julliard * Copyright 1994 Alexandre Julliard
*/ */
#ifndef WINPOS_H #ifndef __WINE_WINPOS_H
#define WINPOS_H #define __WINE_WINPOS_H
#include "win.h"
#define DWP_MAGIC 0x5057 /* 'WP' */ #define DWP_MAGIC 0x5057 /* 'WP' */
...@@ -34,6 +36,6 @@ extern LONG WINPOS_SendNCCalcSize( HWND hwnd, BOOL calcValidRect, ...@@ -34,6 +36,6 @@ extern LONG WINPOS_SendNCCalcSize( HWND hwnd, BOOL calcValidRect,
RECT *oldClientRect, WINDOWPOS *winpos, RECT *oldClientRect, WINDOWPOS *winpos,
RECT *newClientRect ); RECT *newClientRect );
extern LONG WINPOS_HandleWindowPosChanging( WINDOWPOS *winpos ); extern LONG WINPOS_HandleWindowPosChanging( WINDOWPOS *winpos );
extern INT WINPOS_WindowFromPoint( POINT pt, HWND *phwnd ); extern INT WINPOS_WindowFromPoint( POINT pt, WND **ppWnd );
#endif /* WINPOS_H */ #endif /* __WINE_WINPOS_H */
...@@ -31,31 +31,19 @@ typedef unsigned short WCHAR; ...@@ -31,31 +31,19 @@ typedef unsigned short WCHAR;
#ifdef WINELIB32 #ifdef WINELIB32
typedef int INT; typedef int INT;
typedef unsigned int UINT; typedef unsigned int UINT;
typedef short SHORT; typedef char TCHAR; /* Should probably eventually be unsigned short */
typedef LONG WPARAM;
typedef void* HANDLE;
typedef void* NPVOID; typedef void* NPVOID;
typedef void* SEGPTR; typedef void* SEGPTR;
#define UIFMT "%u" #else /* WINELIB32 */
#define NPFMT "%p"
#define SPFMT "%p"
/* Should probably eventually be unsigned short, but not now */
typedef char TCHAR;
#else
typedef short INT; typedef short INT;
typedef unsigned short UINT; typedef unsigned short UINT;
typedef UINT WPARAM; typedef char TCHAR; /* TCHAR is just char in Win16 */
typedef WORD HANDLE;
typedef WORD NPVOID; typedef WORD NPVOID;
typedef DWORD SEGPTR; typedef DWORD SEGPTR;
#define UIFMT "%hu" #endif /* WINELIB32 */
#define NPFMT "%04x"
#define SPFMT "%08lx"
/* TCHAR is just char in Win16 */ typedef UINT HANDLE;
typedef char TCHAR; typedef UINT WPARAM;
#endif
typedef LONG LPARAM; typedef LONG LPARAM;
typedef LONG LRESULT; typedef LONG LRESULT;
typedef INT HFILE; typedef INT HFILE;
......
...@@ -386,8 +386,7 @@ int DDE_GetRemoteMessage() ...@@ -386,8 +386,7 @@ int DDE_GetRemoteMessage()
struct msg_dat msg_dat; struct msg_dat msg_dat;
BOOL was_sent; /* sent/received */ BOOL was_sent; /* sent/received */
BOOL passed; BOOL passed;
HWND hwnd; WND *wndPtr;
WND *window;
if (curr_proc_idx==-1) /* do we have DDE initialized ? */ if (curr_proc_idx==-1) /* do we have DDE initialized ? */
return 0; return 0;
...@@ -476,16 +475,17 @@ int DDE_GetRemoteMessage() ...@@ -476,16 +475,17 @@ int DDE_GetRemoteMessage()
} }
/* iterate through all the windows */ /* iterate through all the windows */
for (hwnd = GetTopWindow(GetDesktopWindow()); for (wndPtr = WIN_FindWndPtr(GetTopWindow(GetDesktopWindow()));
hwnd && (window = WIN_FindWndPtr(hwnd))!=NULL ; wndPtr != NULL;
hwnd = window->hwndNext) { wndPtr = wndPtr->next)
if (window->dwStyle & WS_POPUP || window->dwStyle & WS_CAPTION) { {
if (wndPtr->dwStyle & WS_POPUP || wndPtr->dwStyle & WS_CAPTION) {
if (was_sent) if (was_sent)
SendMessage( hwnd, remote_message->message, SendMessage( wndPtr->hwndSelf, remote_message->message,
remote_message->wParam, remote_message->lParam ); remote_message->wParam, remote_message->lParam );
else else
PostMessage( hwnd, remote_message->message, PostMessage( wndPtr->hwndSelf, remote_message->message,
remote_message->wParam, remote_message->lParam ); remote_message->wParam, remote_message->lParam );
} /* if */ } /* if */
} /* for */ } /* for */
......
...@@ -97,7 +97,7 @@ WND *WIN_FindWndPtr(HWND hwnd) ...@@ -97,7 +97,7 @@ WND *WIN_FindWndPtr(HWND hwnd)
printf("WIN_FindWndPtr(%d)\n",hwnd); printf("WIN_FindWndPtr(%d)\n",hwnd);
if (hwnd==0) if (hwnd==0)
return NULL; return NULL;
win.hwndNext=0; win.next=NULL;
win.dwStyle=WS_POPUP; win.dwStyle=WS_POPUP;
return &win; return &win;
......
...@@ -222,7 +222,7 @@ HANDLE HEAP_Alloc (WORD flags, DWORD bytes) ...@@ -222,7 +222,7 @@ HANDLE HEAP_Alloc (WORD flags, DWORD bytes)
if (flags & LMEM_ZEROINIT) memset( m, 0, bytes ); if (flags & LMEM_ZEROINIT) memset( m, 0, bytes );
} }
m->Size=bytes-sizeof(HeapData); m->Size=bytes-sizeof(HeapData);
return m+1; return (HANDLE)(m+1);
} }
HANDLE HEAP_Free (HANDLE hMem) HANDLE HEAP_Free (HANDLE hMem)
...@@ -253,7 +253,7 @@ HANDLE HEAP_ReAlloc(HANDLE hMem,DWORD bytes,UINT flags) ...@@ -253,7 +253,7 @@ HANDLE HEAP_ReAlloc(HANDLE hMem,DWORD bytes,UINT flags)
if(flags & LMEM_ZEROINIT && bytes > m->Size) if(flags & LMEM_ZEROINIT && bytes > m->Size)
memset( (char*)m+sizeof(HeapData)+m->Size, 0, bytes-m->Size ); memset( (char*)m+sizeof(HeapData)+m->Size, 0, bytes-m->Size );
m->Size=bytes; m->Size=bytes;
return m+1; return (HANDLE)(m+1);
} }
HANDLE LocalAlloc (WORD flags, WORD bytes) HANDLE LocalAlloc (WORD flags, WORD bytes)
...@@ -278,7 +278,7 @@ BOOL LocalInit (HANDLE segment, WORD start, WORD end) ...@@ -278,7 +278,7 @@ BOOL LocalInit (HANDLE segment, WORD start, WORD end)
LPVOID LocalLock (HANDLE hMem) LPVOID LocalLock (HANDLE hMem)
{ {
return hMem; return (LPVOID)hMem;
} }
HANDLE LocalReAlloc (HANDLE hMem, WORD new_size, WORD flags) HANDLE LocalReAlloc (HANDLE hMem, WORD new_size, WORD flags)
...@@ -311,7 +311,7 @@ HANDLE GlobalFree (HANDLE hMem) ...@@ -311,7 +311,7 @@ HANDLE GlobalFree (HANDLE hMem)
LPVOID GlobalLock (HGLOBAL hMem) LPVOID GlobalLock (HGLOBAL hMem)
{ {
return hMem; return (LPVOID)hMem;
} }
BOOL GlobalUnlock (HANDLE hMem) BOOL GlobalUnlock (HANDLE hMem)
......
...@@ -92,7 +92,7 @@ HGLOBAL LIBRES_LoadResource( HINSTANCE hModule, HRSRC hRsrc ) ...@@ -92,7 +92,7 @@ HGLOBAL LIBRES_LoadResource( HINSTANCE hModule, HRSRC hRsrc )
*/ */
LPVOID LIBRES_LockResource( HGLOBAL handle ) LPVOID LIBRES_LockResource( HGLOBAL handle )
{ {
return handle; return (LPVOID)handle;
} }
......
...@@ -64,7 +64,7 @@ BOOL LOCAL_Unlock( WORD ds, HLOCAL handle ) ...@@ -64,7 +64,7 @@ BOOL LOCAL_Unlock( WORD ds, HLOCAL handle )
WORD LOCAL_Size( WORD ds, HLOCAL handle ) WORD LOCAL_Size( WORD ds, HLOCAL handle )
{ return LocalSize(handle); } { return LocalSize(handle); }
void FarSetOwner(HANDLE a, WORD b) void FarSetOwner(HANDLE a, HANDLE b)
{ {
WINELIB_UNIMP("FarSetOwner()"); WINELIB_UNIMP("FarSetOwner()");
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <malloc.h> #include <malloc.h>
#include "windows.h" #include "windows.h"
#include "wine.h" #include "wine.h"
#include "xmalloc.h"
extern int MAIN_Init(void); extern int MAIN_Init(void);
extern BOOL WIDGETS_Init(void); extern BOOL WIDGETS_Init(void);
...@@ -15,6 +16,16 @@ extern int USER_InitApp(HINSTANCE); ...@@ -15,6 +16,16 @@ extern int USER_InitApp(HINSTANCE);
int _WinMain (int argc, char *argv []) int _WinMain (int argc, char *argv [])
{ {
HINSTANCE hInstance; HINSTANCE hInstance;
LPSTR lpszCmdParam;
int i, len = 0;
/* Alloc szCmdParam */
for (i = 1; i < argc; i++) len += strlen(argv[i]) + 1;
lpszCmdParam = (LPSTR) xmalloc(len + 1);
/* Concatenate arguments */
if (argc > 1) strcpy(lpszCmdParam, argv[1]);
else lpszCmdParam[0] = '\0';
for (i = 2; i < argc; i++) strcat(strcat(lpszCmdParam, " "), argv[i]);
if(!MAIN_Init()) return 0; /* JBP: Needed for DosDrives[] structure, etc. */ if(!MAIN_Init()) return 0; /* JBP: Needed for DosDrives[] structure, etc. */
hInstance = WinExec( *argv, SW_SHOWNORMAL ); hInstance = WinExec( *argv, SW_SHOWNORMAL );
...@@ -29,7 +40,7 @@ int _WinMain (int argc, char *argv []) ...@@ -29,7 +40,7 @@ int _WinMain (int argc, char *argv [])
#else #else
return WinMain (hInstance, /* hInstance */ return WinMain (hInstance, /* hInstance */
0, /* hPrevInstance */ 0, /* hPrevInstance */
"", /* lpszCmdParam */ lpszCmdParam, /* lpszCmdParam */
SW_NORMAL); /* nCmdShow */ SW_NORMAL); /* nCmdShow */
#endif #endif
} }
...@@ -134,7 +134,7 @@ void MODULE_PrintModule( HMODULE hmodule ) ...@@ -134,7 +134,7 @@ void MODULE_PrintModule( HMODULE hmodule )
/* Dump the module info */ /* Dump the module info */
printf( "Module "NPFMT":\n", hmodule ); printf( "Module %04x:\n", hmodule );
printf( "count=%d flags=%04x heap=%d stack=%d\n", printf( "count=%d flags=%04x heap=%d stack=%d\n",
pModule->count, pModule->flags, pModule->count, pModule->flags,
pModule->heap_size, pModule->stack_size ); pModule->heap_size, pModule->stack_size );
...@@ -154,7 +154,7 @@ void MODULE_PrintModule( HMODULE hmodule ) ...@@ -154,7 +154,7 @@ void MODULE_PrintModule( HMODULE hmodule )
printf( "\nSegment table:\n" ); printf( "\nSegment table:\n" );
pSeg = NE_SEG_TABLE( pModule ); pSeg = NE_SEG_TABLE( pModule );
for (i = 0; i < pModule->seg_count; i++, pSeg++) for (i = 0; i < pModule->seg_count; i++, pSeg++)
printf( "%02x: pos=%d size=%d flags=%04x minsize=%d sel="NPFMT"\n", printf( "%02x: pos=%d size=%d flags=%04x minsize=%d sel=%04x\n",
i + 1, pSeg->filepos, pSeg->size, pSeg->flags, i + 1, pSeg->filepos, pSeg->size, pSeg->flags,
pSeg->minsize, pSeg->selector ); pSeg->minsize, pSeg->selector );
...@@ -264,7 +264,7 @@ int MODULE_OpenFile( HMODULE hModule ) ...@@ -264,7 +264,7 @@ int MODULE_OpenFile( HMODULE hModule )
static int cachedfd = -1; static int cachedfd = -1;
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_module( stddeb, "MODULE_OpenFile("NPFMT") cache: mod="NPFMT" fd=%d\n", dprintf_module( stddeb, "MODULE_OpenFile(%04x) cache: mod=%04x fd=%d\n",
hModule, hCachedModule, cachedfd ); hModule, hCachedModule, cachedfd );
if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return -1; if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return -1;
if (hCachedModule == hModule) return cachedfd; if (hCachedModule == hModule) return cachedfd;
...@@ -273,7 +273,7 @@ int MODULE_OpenFile( HMODULE hModule ) ...@@ -273,7 +273,7 @@ int MODULE_OpenFile( HMODULE hModule )
name = NE_MODULE_NAME( pModule ); name = NE_MODULE_NAME( pModule );
if (!(unixName = DOSFS_GetUnixFileName( name, TRUE )) || if (!(unixName = DOSFS_GetUnixFileName( name, TRUE )) ||
(cachedfd = open( unixName, O_RDONLY )) == -1) (cachedfd = open( unixName, O_RDONLY )) == -1)
fprintf( stderr, "MODULE_OpenFile: can't open file '%s' for module "NPFMT"\n", fprintf( stderr, "MODULE_OpenFile: can't open file '%s' for module %04x\n",
name, hModule ); name, hModule );
dprintf_module( stddeb, "MODULE_OpenFile: opened '%s' -> %d\n", dprintf_module( stddeb, "MODULE_OpenFile: opened '%s' -> %d\n",
name, cachedfd ); name, cachedfd );
...@@ -461,7 +461,7 @@ HMODULE MODULE_LoadExeHeader( HFILE hFile, OFSTRUCT *ofs ) ...@@ -461,7 +461,7 @@ HMODULE MODULE_LoadExeHeader( HFILE hFile, OFSTRUCT *ofs )
hModule = GlobalAlloc( GMEM_MOVEABLE | GMEM_ZEROINIT, size ); hModule = GlobalAlloc( GMEM_MOVEABLE | GMEM_ZEROINIT, size );
if (!hModule) return (HMODULE)11; /* invalid exe */ if (!hModule) return (HMODULE)11; /* invalid exe */
FarSetOwner( hModule, (WORD)(DWORD)hModule ); FarSetOwner( hModule, hModule );
pModule = (NE_MODULE *)GlobalLock( hModule ); pModule = (NE_MODULE *)GlobalLock( hModule );
memcpy( pModule, &ne_header, sizeof(NE_MODULE) ); memcpy( pModule, &ne_header, sizeof(NE_MODULE) );
pModule->count = 0; pModule->count = 0;
...@@ -609,7 +609,7 @@ WORD MODULE_GetOrdinal( HMODULE hModule, char *name ) ...@@ -609,7 +609,7 @@ WORD MODULE_GetOrdinal( HMODULE hModule, char *name )
if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return 0; if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return 0;
dprintf_module( stddeb, "MODULE_GetOrdinal("NPFMT",'%s')\n", dprintf_module( stddeb, "MODULE_GetOrdinal(%04x,'%s')\n",
hModule, name ); hModule, name );
/* First handle names of the form '#xxxx' */ /* First handle names of the form '#xxxx' */
...@@ -1162,11 +1162,7 @@ BOOL FreeModule( HANDLE hModule ) ...@@ -1162,11 +1162,7 @@ BOOL FreeModule( HANDLE hModule )
*/ */
HMODULE WIN16_GetModuleHandle( SEGPTR name ) HMODULE WIN16_GetModuleHandle( SEGPTR name )
{ {
#ifdef WINELIB32 if (HIWORD(name) == 0) return GetExePtr( (HANDLE)name );
if (HIWORD(name) == 0) return GetExePtr( name );
#else
if (HIWORD(name) == 0) return GetExePtr( LOWORD(name) );
#endif
return MODULE_FindModule( PTR_SEG_TO_LIN(name) ); return MODULE_FindModule( PTR_SEG_TO_LIN(name) );
} }
...@@ -1185,7 +1181,7 @@ int GetModuleUsage( HANDLE hModule ) ...@@ -1185,7 +1181,7 @@ int GetModuleUsage( HANDLE hModule )
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return 0; if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return 0;
dprintf_module( stddeb, "GetModuleUsage("NPFMT"): returning %d\n", dprintf_module( stddeb, "GetModuleUsage(%04x): returning %d\n",
hModule, pModule->count ); hModule, pModule->count );
return pModule->count; return pModule->count;
} }
...@@ -1243,7 +1239,7 @@ HANDLE LoadLibrary( LPCSTR libname ) ...@@ -1243,7 +1239,7 @@ HANDLE LoadLibrary( LPCSTR libname )
*/ */
void FreeLibrary( HANDLE handle ) void FreeLibrary( HANDLE handle )
{ {
dprintf_module( stddeb,"FreeLibrary: "NPFMT"\n", handle ); dprintf_module( stddeb,"FreeLibrary: %04x\n", handle );
FreeModule( handle ); FreeModule( handle );
} }
...@@ -1258,6 +1254,7 @@ HANDLE WinExec( LPSTR lpCmdLine, WORD nCmdShow ) ...@@ -1258,6 +1254,7 @@ HANDLE WinExec( LPSTR lpCmdLine, WORD nCmdShow )
HANDLE handle; HANDLE handle;
WORD *cmdShowPtr; WORD *cmdShowPtr;
char *p, *cmdline, filename[256]; char *p, *cmdline, filename[256];
static int use_load_module = 1;
if (!(cmdShowHandle = GlobalAlloc( 0, 2 * sizeof(WORD) ))) return 0; if (!(cmdShowHandle = GlobalAlloc( 0, 2 * sizeof(WORD) ))) return 0;
if (!(cmdLineHandle = GlobalAlloc( 0, 256 ))) return 0; if (!(cmdLineHandle = GlobalAlloc( 0, 256 ))) return 0;
...@@ -1271,36 +1268,97 @@ HANDLE WinExec( LPSTR lpCmdLine, WORD nCmdShow ) ...@@ -1271,36 +1268,97 @@ HANDLE WinExec( LPSTR lpCmdLine, WORD nCmdShow )
/* Build the filename and command-line */ /* Build the filename and command-line */
cmdline = (char *)GlobalLock( cmdLineHandle ); cmdline = (char *)GlobalLock( cmdLineHandle );
strncpy( filename, lpCmdLine, 256 ); lstrcpyn( filename, lpCmdLine, sizeof(filename) - 4 /* for extension */ );
filename[255] = '\0';
for (p = filename; *p && (*p != ' ') && (*p != '\t'); p++); for (p = filename; *p && (*p != ' ') && (*p != '\t'); p++);
if (*p) if (*p) lstrcpyn( cmdline, p + 1, 128 );
{
strncpy( cmdline, p + 1, 128 );
cmdline[127] = '\0';
}
else cmdline[0] = '\0'; else cmdline[0] = '\0';
*p = '\0'; *p = '\0';
/* Now load the executable file */ /* Now load the executable file */
#ifdef WINELIB32 if (use_load_module)
params.hEnvironment = (HANDLE)GetDOSEnvironment(); {
#ifdef WINELIB
/* WINELIB: Use LoadModule() only for the program itself */
use_load_module = 0;
params.hEnvironment = (HANDLE)GetDOSEnvironment();
#else #else
params.hEnvironment = (HANDLE)SELECTOROF( GetDOSEnvironment() ); params.hEnvironment = (HANDLE)SELECTOROF( GetDOSEnvironment() );
#endif #endif /* WINELIB */
params.cmdLine = (SEGPTR)WIN16_GlobalLock( cmdLineHandle ); params.cmdLine = (SEGPTR)WIN16_GlobalLock( cmdLineHandle );
params.showCmd = (SEGPTR)WIN16_GlobalLock( cmdShowHandle ); params.showCmd = (SEGPTR)WIN16_GlobalLock( cmdShowHandle );
params.reserved = 0; params.reserved = 0;
handle = LoadModule( filename, &params ); handle = LoadModule( filename, &params );
if (handle == (HANDLE)2) /* file not found */ if (handle == 2) /* file not found */
{
/* Check that the original file name did not have a suffix */
p = strrchr(filename, '.');
if (!p || (strchr(p, '/') && strchr(p, '\\')))
{
p = filename + strlen(filename);
strcpy( p, ".exe" );
handle = LoadModule( filename, &params );
*p = '\0'; /* Remove extension */
}
}
}
else handle = 2;
if (handle < 32)
{ {
/* Check that the original file name did not have a suffix */ /* Try to start it as a unix program */
p = strrchr(filename, '.'); if (!fork())
if (p && !(strchr(p, '/') || strchr(p, '\\'))) {
return handle; /* filename already includes a suffix! */ /* Child process */
strcat( filename, ".exe" ); const char *unixfilename;
handle = LoadModule( filename, &params ); const char *argv[256], **argptr;
int iconic = (nCmdShow == SW_SHOWMINIMIZED ||
nCmdShow == SW_SHOWMINNOACTIVE);
/* get unixfilename */
if (strchr(filename, '/') ||
strchr(filename, ':') ||
strchr(filename, '\\'))
unixfilename = DOSFS_GetUnixFileName(filename, 1);
else unixfilename = filename;
if (unixfilename)
{
/* build argv */
argptr = argv;
if (iconic) *argptr++ = "-iconic";
*argptr++ = unixfilename;
p = cmdline;
while (1)
{
while (*p && (*p == ' ' || *p == '\t')) *p++ = '\0';
if (!*p) break;
*argptr++ = p;
while (*p && *p != ' ' && *p != '\t') p++;
}
*argptr++ = 0;
/* Execute */
execvp(argv[0], (char**)argv);
}
/* Failed ! */
#ifdef WINELIB
/* build argv */
argptr = argv;
*argptr++ = "wine";
if (iconic) *argptr++ = "-iconic";
*argptr++ = lpCmdLine;
*argptr++ = 0;
/* Execute */
execvp(argv[0] , (char**)argv);
/* Failed ! */
fprintf(stderr, "WinExec: can't exec 'wine %s'\n", lpCmdLine);
#endif
exit(1);
}
} }
GlobalFree( cmdShowHandle ); GlobalFree( cmdShowHandle );
...@@ -1335,20 +1393,20 @@ FARPROC GetProcAddress( HANDLE hModule, SEGPTR name ) ...@@ -1335,20 +1393,20 @@ FARPROC GetProcAddress( HANDLE hModule, SEGPTR name )
if (HIWORD(name) != 0) if (HIWORD(name) != 0)
{ {
ordinal = MODULE_GetOrdinal( hModule, (LPSTR)PTR_SEG_TO_LIN(name) ); ordinal = MODULE_GetOrdinal( hModule, (LPSTR)PTR_SEG_TO_LIN(name) );
dprintf_module( stddeb, "GetProcAddress: "NPFMT" '%s'\n", dprintf_module( stddeb, "GetProcAddress: %04x '%s'\n",
hModule, (LPSTR)PTR_SEG_TO_LIN(name) ); hModule, (LPSTR)PTR_SEG_TO_LIN(name) );
} }
else else
{ {
ordinal = LOWORD(name); ordinal = LOWORD(name);
dprintf_module( stddeb, "GetProcAddress: "NPFMT" %04x\n", dprintf_module( stddeb, "GetProcAddress: %04x %04x\n",
hModule, ordinal ); hModule, ordinal );
} }
if (!ordinal) return (FARPROC)0; if (!ordinal) return (FARPROC)0;
ret = MODULE_GetEntryPoint( hModule, ordinal ); ret = MODULE_GetEntryPoint( hModule, ordinal );
dprintf_module( stddeb, "GetProcAddress: returning "SPFMT"\n", ret ); dprintf_module( stddeb, "GetProcAddress: returning %08lx\n", (DWORD)ret );
return (FARPROC)ret; return (FARPROC)ret;
} }
......
...@@ -57,7 +57,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum ) ...@@ -57,7 +57,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
if (!pSeg->filepos) return TRUE; /* No file image, just return */ if (!pSeg->filepos) return TRUE; /* No file image, just return */
fd = MODULE_OpenFile( hModule ); fd = MODULE_OpenFile( hModule );
dprintf_module( stddeb, "Loading segment %d, selector="NPFMT"\n", dprintf_module( stddeb, "Loading segment %d, selector=%04x\n",
segnum, pSeg->selector ); segnum, pSeg->selector );
lseek( fd, pSeg->filepos << pModule->alignment, SEEK_SET ); lseek( fd, pSeg->filepos << pModule->alignment, SEEK_SET );
size = pSeg->size ? pSeg->size : 0x10000; size = pSeg->size ? pSeg->size : 0x10000;
...@@ -134,7 +134,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum ) ...@@ -134,7 +134,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
read( fd, &count, sizeof(count) ); read( fd, &count, sizeof(count) );
if (!count) return TRUE; if (!count) return TRUE;
dprintf_fixup( stddeb, "Fixups for %*.*s, segment %d, selector "NPFMT"\n", dprintf_fixup( stddeb, "Fixups for %*.*s, segment %d, selector %04x\n",
*((BYTE *)pModule + pModule->name_table), *((BYTE *)pModule + pModule->name_table),
*((BYTE *)pModule + pModule->name_table), *((BYTE *)pModule + pModule->name_table),
(char *)pModule + pModule->name_table + 1, (char *)pModule + pModule->name_table + 1,
...@@ -173,7 +173,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum ) ...@@ -173,7 +173,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
{ {
NE_MODULE *pTarget = (NE_MODULE *)GlobalLock( module ); NE_MODULE *pTarget = (NE_MODULE *)GlobalLock( module );
if (!pTarget) if (!pTarget)
fprintf( stderr, "Module not found: "NPFMT", reference %d of module %*.*s\n", fprintf( stderr, "Module not found: %04x, reference %d of module %*.*s\n",
module, rep->target1, module, rep->target1,
*((BYTE *)pModule + pModule->name_table), *((BYTE *)pModule + pModule->name_table),
*((BYTE *)pModule + pModule->name_table), *((BYTE *)pModule + pModule->name_table),
...@@ -274,7 +274,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum ) ...@@ -274,7 +274,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
case NE_RADDR_LOWBYTE: case NE_RADDR_LOWBYTE:
do { do {
sp = PTR_SEG_OFF_TO_LIN( pSeg->selector, offset ); sp = PTR_SEG_OFF_TO_LIN( pSeg->selector, offset );
dprintf_fixup(stddeb," "NPFMT":%04x:%04x BYTE%s\n", dprintf_fixup(stddeb," %04x:%04x:%04x BYTE%s\n",
pSeg->selector, offset, *sp, additive ? " additive":""); pSeg->selector, offset, *sp, additive ? " additive":"");
offset = *sp; offset = *sp;
if(additive) if(additive)
...@@ -288,7 +288,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum ) ...@@ -288,7 +288,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
case NE_RADDR_OFFSET16: case NE_RADDR_OFFSET16:
do { do {
sp = PTR_SEG_OFF_TO_LIN( pSeg->selector, offset ); sp = PTR_SEG_OFF_TO_LIN( pSeg->selector, offset );
dprintf_fixup(stddeb," "NPFMT":%04x:%04x OFFSET16%s\n", dprintf_fixup(stddeb," %04x:%04x:%04x OFFSET16%s\n",
pSeg->selector, offset, *sp, additive ? " additive" : "" ); pSeg->selector, offset, *sp, additive ? " additive" : "" );
offset = *sp; offset = *sp;
*sp = LOWORD(address); *sp = LOWORD(address);
...@@ -300,7 +300,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum ) ...@@ -300,7 +300,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
case NE_RADDR_POINTER32: case NE_RADDR_POINTER32:
do { do {
sp = PTR_SEG_OFF_TO_LIN( pSeg->selector, offset ); sp = PTR_SEG_OFF_TO_LIN( pSeg->selector, offset );
dprintf_fixup(stddeb," "NPFMT":%04x:%04x POINTER32%s\n", dprintf_fixup(stddeb," %04x:%04x:%04x POINTER32%s\n",
pSeg->selector, offset, *sp, additive ? " additive" : "" ); pSeg->selector, offset, *sp, additive ? " additive" : "" );
offset = *sp; offset = *sp;
*sp = LOWORD(address); *sp = LOWORD(address);
...@@ -313,7 +313,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum ) ...@@ -313,7 +313,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
case NE_RADDR_SELECTOR: case NE_RADDR_SELECTOR:
do { do {
sp = PTR_SEG_OFF_TO_LIN( pSeg->selector, offset ); sp = PTR_SEG_OFF_TO_LIN( pSeg->selector, offset );
dprintf_fixup(stddeb," "NPFMT":%04x:%04x SELECTOR%s\n", dprintf_fixup(stddeb," %04x:%04x:%04x SELECTOR%s\n",
pSeg->selector, offset, *sp, additive ? " additive" : "" ); pSeg->selector, offset, *sp, additive ? " additive" : "" );
offset = *sp; offset = *sp;
*sp = HIWORD(address); *sp = HIWORD(address);
......
...@@ -355,7 +355,7 @@ BOOL NE_FreeResource( HMODULE hModule, HGLOBAL handle ) ...@@ -355,7 +355,7 @@ BOOL NE_FreeResource( HMODULE hModule, HGLOBAL handle )
} }
pTypeInfo = (NE_TYPEINFO *)pNameInfo; pTypeInfo = (NE_TYPEINFO *)pNameInfo;
} }
fprintf( stderr, "FreeResource: "NPFMT" "NPFMT" not found!\n", hModule, handle ); fprintf( stderr, "FreeResource: %04x %04x not found!\n", hModule, handle );
return FALSE; return FALSE;
} }
#endif /* WINELIB */ #endif /* WINELIB */
...@@ -207,7 +207,7 @@ void fixup_imports(struct w_files* wpnt) ...@@ -207,7 +207,7 @@ void fixup_imports(struct w_files* wpnt)
while(*import_list) while(*import_list)
{ {
pe_name = (struct pe_import_name *) ((int) load_addr + *import_list); pe_name = (struct pe_import_name *) ((int) load_addr + ((unsigned)*import_list & ~0x80000000));
if((unsigned)*import_list & 0x80000000) if((unsigned)*import_list & 0x80000000)
{ {
int ordinal=*import_list & (0x80000000-1); int ordinal=*import_list & (0x80000000-1);
...@@ -652,7 +652,7 @@ HINSTANCE PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params ) ...@@ -652,7 +652,7 @@ HINSTANCE PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params )
/* FIXME: Is this really the correct place to initialise the DLL? */ /* FIXME: Is this really the correct place to initialise the DLL? */
if ((wpnt->pe->pe_header->coff.Characteristics & IMAGE_FILE_DLL)) { if ((wpnt->pe->pe_header->coff.Characteristics & IMAGE_FILE_DLL)) {
PE_InitDLL(wpnt); PE_InitDLL(hModule);
} else { } else {
TASK_CreateTask(hModule,hInstance,0, TASK_CreateTask(hModule,hInstance,0,
params->hEnvironment,(LPSTR)PTR_SEG_TO_LIN(params->cmdLine), params->hEnvironment,(LPSTR)PTR_SEG_TO_LIN(params->cmdLine),
......
...@@ -40,7 +40,7 @@ HRSRC FindResource( HMODULE hModule, SEGPTR name, SEGPTR type ) ...@@ -40,7 +40,7 @@ HRSRC FindResource( HMODULE hModule, SEGPTR name, SEGPTR type )
WORD *pModule; WORD *pModule;
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "FindResource: module="NPFMT" type=", hModule ); dprintf_resource(stddeb, "FindResource: module=%04x type=", hModule );
PrintId( type ); PrintId( type );
if (HIWORD(name)) /* Check for '#xxx' name */ if (HIWORD(name)) /* Check for '#xxx' name */
{ {
...@@ -77,7 +77,7 @@ HGLOBAL LoadResource( HMODULE hModule, HRSRC hRsrc ) ...@@ -77,7 +77,7 @@ HGLOBAL LoadResource( HMODULE hModule, HRSRC hRsrc )
WORD *pModule; WORD *pModule;
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "LoadResource: module="NPFMT" res="NPFMT"\n", dprintf_resource(stddeb, "LoadResource: module=%04x res=%04x\n",
hModule, hRsrc ); hModule, hRsrc );
if (!hRsrc) return 0; if (!hRsrc) return 0;
if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0; if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0;
...@@ -107,7 +107,7 @@ SEGPTR WIN16_LockResource( HGLOBAL handle ) ...@@ -107,7 +107,7 @@ SEGPTR WIN16_LockResource( HGLOBAL handle )
HMODULE hModule; HMODULE hModule;
WORD *pModule; WORD *pModule;
dprintf_resource(stddeb, "LockResource: handle="NPFMT"\n", handle ); dprintf_resource(stddeb, "LockResource: handle=%04x\n", handle );
if (!handle) return (SEGPTR)0; if (!handle) return (SEGPTR)0;
hModule = GetExePtr( handle ); hModule = GetExePtr( handle );
if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0; if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0;
...@@ -132,7 +132,7 @@ LPVOID LockResource( HGLOBAL handle ) ...@@ -132,7 +132,7 @@ LPVOID LockResource( HGLOBAL handle )
HMODULE hModule; HMODULE hModule;
WORD *pModule; WORD *pModule;
dprintf_resource(stddeb, "LockResource: handle="NPFMT"\n", handle ); dprintf_resource(stddeb, "LockResource: handle=%04x\n", handle );
if (!handle) return NULL; if (!handle) return NULL;
hModule = GetExePtr( handle ); hModule = GetExePtr( handle );
if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0; if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0;
...@@ -160,7 +160,7 @@ BOOL FreeResource( HGLOBAL handle ) ...@@ -160,7 +160,7 @@ BOOL FreeResource( HGLOBAL handle )
HMODULE hModule; HMODULE hModule;
WORD *pModule; WORD *pModule;
dprintf_resource(stddeb, "FreeResource: handle="NPFMT"\n", handle ); dprintf_resource(stddeb, "FreeResource: handle=%04x\n", handle );
if (!handle) return FALSE; if (!handle) return FALSE;
hModule = GetExePtr( handle ); hModule = GetExePtr( handle );
if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0; if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0;
...@@ -187,7 +187,7 @@ INT AccessResource( HINSTANCE hModule, HRSRC hRsrc ) ...@@ -187,7 +187,7 @@ INT AccessResource( HINSTANCE hModule, HRSRC hRsrc )
WORD *pModule; WORD *pModule;
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "AccessResource: module="NPFMT" res="NPFMT"\n", dprintf_resource(stddeb, "AccessResource: module=%04x res=%04x\n",
hModule, hRsrc ); hModule, hRsrc );
if (!hRsrc) return 0; if (!hRsrc) return 0;
if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0; if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0;
...@@ -215,7 +215,7 @@ DWORD SizeofResource( HMODULE hModule, HRSRC hRsrc ) ...@@ -215,7 +215,7 @@ DWORD SizeofResource( HMODULE hModule, HRSRC hRsrc )
WORD *pModule; WORD *pModule;
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "SizeofResource: module="NPFMT" res="NPFMT"\n", dprintf_resource(stddeb, "SizeofResource: module=%04x res=%04x\n",
hModule, hRsrc ); hModule, hRsrc );
if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0; if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0;
#ifndef WINELIB #ifndef WINELIB
...@@ -242,7 +242,7 @@ HGLOBAL AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size ) ...@@ -242,7 +242,7 @@ HGLOBAL AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size )
WORD *pModule; WORD *pModule;
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "AllocResource: module="NPFMT" res="NPFMT" size=%ld\n", dprintf_resource(stddeb, "AllocResource: module=%04x res=%04x size=%ld\n",
hModule, hRsrc, size ); hModule, hRsrc, size );
if (!hRsrc) return 0; if (!hRsrc) return 0;
if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0; if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0;
...@@ -268,7 +268,8 @@ HGLOBAL AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size ) ...@@ -268,7 +268,8 @@ HGLOBAL AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size )
*/ */
HANDLE DirectResAlloc(HANDLE hInstance, WORD wType, WORD wSize) HANDLE DirectResAlloc(HANDLE hInstance, WORD wType, WORD wSize)
{ {
dprintf_resource(stddeb,"DirectResAlloc("NPFMT",%x,%x)\n",hInstance,wType,wSize); dprintf_resource(stddeb,"DirectResAlloc(%04x,%04x,%04x)\n",
hInstance, wType, wSize );
hInstance = GetExePtr(hInstance); hInstance = GetExePtr(hInstance);
if(!hInstance)return 0; if(!hInstance)return 0;
if(wType != 0x10) /* 0x10 is the only observed value, passed from if(wType != 0x10) /* 0x10 is the only observed value, passed from
...@@ -291,10 +292,10 @@ HANDLE LoadAccelerators(HANDLE instance, SEGPTR lpTableName) ...@@ -291,10 +292,10 @@ HANDLE LoadAccelerators(HANDLE instance, SEGPTR lpTableName)
int i, n; int i, n;
if (HIWORD(lpTableName)) if (HIWORD(lpTableName))
dprintf_accel( stddeb, "LoadAccelerators: "NPFMT" '%s'\n", dprintf_accel( stddeb, "LoadAccelerators: %04x '%s'\n",
instance, (char *)PTR_SEG_TO_LIN( lpTableName ) ); instance, (char *)PTR_SEG_TO_LIN( lpTableName ) );
else else
dprintf_accel( stddeb, "LoadAccelerators: "NPFMT" %04x\n", dprintf_accel( stddeb, "LoadAccelerators: %04x %04x\n",
instance, LOWORD(lpTableName) ); instance, LOWORD(lpTableName) );
if (!(hRsrc = FindResource( instance, lpTableName, RT_ACCELERATOR ))) if (!(hRsrc = FindResource( instance, lpTableName, RT_ACCELERATOR )))
...@@ -340,7 +341,7 @@ int TranslateAccelerator(HWND hWnd, HANDLE hAccel, LPMSG msg) ...@@ -340,7 +341,7 @@ int TranslateAccelerator(HWND hWnd, HANDLE hAccel, LPMSG msg)
msg->message != WM_SYSKEYUP && msg->message != WM_SYSKEYUP &&
msg->message != WM_CHAR) return 0; msg->message != WM_CHAR) return 0;
dprintf_accel(stddeb, "TranslateAccelerators hAccel="NPFMT" !\n", hAccel); dprintf_accel(stddeb, "TranslateAccelerators hAccel=%04x !\n", hAccel);
lpAccelTbl = (LPACCELHEADER)GlobalLock(hAccel); lpAccelTbl = (LPACCELHEADER)GlobalLock(hAccel);
for (i = 0; i < lpAccelTbl->wCount; i++) { for (i = 0; i < lpAccelTbl->wCount; i++) {
...@@ -387,8 +388,8 @@ LoadString(HANDLE instance, WORD resource_id, LPSTR buffer, int buflen) ...@@ -387,8 +388,8 @@ LoadString(HANDLE instance, WORD resource_id, LPSTR buffer, int buflen)
int string_num; int string_num;
int i; int i;
dprintf_resource(stddeb, "LoadString: instance = "NPFMT", id = %04x, buffer = %08x, " dprintf_resource(stddeb,"LoadString: inst=%04x id=%04x buff=%08x len=%d\n",
"length = %d\n", instance, resource_id, (int) buffer, buflen); instance, resource_id, (int) buffer, buflen);
hrsrc = FindResource( instance, (SEGPTR)((resource_id>>4)+1), RT_STRING ); hrsrc = FindResource( instance, (SEGPTR)((resource_id>>4)+1), RT_STRING );
if (!hrsrc) return 0; if (!hrsrc) return 0;
......
...@@ -107,6 +107,8 @@ static void SIGNAL_SetHandler( int sig, void (*func)() ) ...@@ -107,6 +107,8 @@ static void SIGNAL_SetHandler( int sig, void (*func)() )
#endif /* linux */ #endif /* linux */
#if defined(__NetBSD__) || defined(__FreeBSD__) #if defined(__NetBSD__) || defined(__FreeBSD__)
sigset_t sig_mask;
sigemptyset(&sig_mask);
sig_act.sa_handler = func; sig_act.sa_handler = func;
sig_act.sa_flags = SA_ONSTACK; sig_act.sa_flags = SA_ONSTACK;
sig_act.sa_mask = sig_mask; sig_act.sa_mask = sig_mask;
...@@ -114,6 +116,8 @@ static void SIGNAL_SetHandler( int sig, void (*func)() ) ...@@ -114,6 +116,8 @@ static void SIGNAL_SetHandler( int sig, void (*func)() )
#endif /* __FreeBSD__ || __NetBSD__ */ #endif /* __FreeBSD__ || __NetBSD__ */
#if defined (__svr4__) #if defined (__svr4__)
sigset_t sig_mask;
sigemptyset(&sig_mask);
sig_act.sa_handler = func; sig_act.sa_handler = func;
sig_act.sa_flags = SA_ONSTACK | SA_SIGINFO; sig_act.sa_flags = SA_ONSTACK | SA_SIGINFO;
sig_act.sa_mask = sig_mask; sig_act.sa_mask = sig_mask;
...@@ -136,7 +140,6 @@ void init_wine_signals(void) ...@@ -136,7 +140,6 @@ void init_wine_signals(void)
extern void stop_wait(int a); extern void stop_wait(int a);
#if defined(__NetBSD__) || defined(__FreeBSD__) #if defined(__NetBSD__) || defined(__FreeBSD__)
sigset_t sig_mask;
struct sigaltstack ss; struct sigaltstack ss;
#if !defined (__FreeBSD__) #if !defined (__FreeBSD__)
...@@ -154,11 +157,9 @@ void init_wine_signals(void) ...@@ -154,11 +157,9 @@ void init_wine_signals(void)
perror("sigstack"); perror("sigstack");
exit(1); exit(1);
} }
sigemptyset(&sig_mask);
#endif /* __FreeBSD__ || __NetBSD__ */ #endif /* __FreeBSD__ || __NetBSD__ */
#if defined (__svr4__) #if defined (__svr4__)
sigset_t sig_mask;
struct sigaltstack ss; struct sigaltstack ss;
if ((ss.ss_sp = malloc(SIGSTKSZ) ) == NULL) { if ((ss.ss_sp = malloc(SIGSTKSZ) ) == NULL) {
...@@ -172,7 +173,6 @@ void init_wine_signals(void) ...@@ -172,7 +173,6 @@ void init_wine_signals(void)
perror("sigstack"); perror("sigstack");
exit(1); exit(1);
} }
sigemptyset(&sig_mask);
#endif /* __svr4__ */ #endif /* __svr4__ */
SIGNAL_SetHandler( SIGSEGV, (void (*)())win_fault ); SIGNAL_SetHandler( SIGSEGV, (void (*)())win_fault );
......
...@@ -555,7 +555,7 @@ HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance, ...@@ -555,7 +555,7 @@ HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
TASK_LinkTask( hTask ); TASK_LinkTask( hTask );
dprintf_task( stddeb, "CreateTask: module='%s' cmdline='%s' task="NPFMT"\n", dprintf_task( stddeb, "CreateTask: module='%s' cmdline='%s' task=%04x\n",
name, cmdLine, hTask ); name, cmdLine, hTask );
return hTask; return hTask;
...@@ -699,7 +699,7 @@ void TASK_Reschedule(void) ...@@ -699,7 +699,7 @@ void TASK_Reschedule(void)
if (!hTask) return; /* Do nothing */ if (!hTask) return; /* Do nothing */
pNewTask = (TDB *)GlobalLock( hTask ); pNewTask = (TDB *)GlobalLock( hTask );
dprintf_task( stddeb, "Switching to task "NPFMT" (%.8s)\n", dprintf_task( stddeb, "Switching to task %04x (%.8s)\n",
hTask, pNewTask->module_name ); hTask, pNewTask->module_name );
/* Save the stacks of the previous task (if any) */ /* Save the stacks of the previous task (if any) */
...@@ -939,8 +939,8 @@ FARPROC MakeProcInstance( FARPROC func, HANDLE hInstance ) ...@@ -939,8 +939,8 @@ FARPROC MakeProcInstance( FARPROC func, HANDLE hInstance )
if (!thunkaddr) return (FARPROC)0; if (!thunkaddr) return (FARPROC)0;
thunk = PTR_SEG_TO_LIN( thunkaddr ); thunk = PTR_SEG_TO_LIN( thunkaddr );
dprintf_task( stddeb, "MakeProcInstance("SPFMT","NPFMT"): got thunk "SPFMT"\n", dprintf_task( stddeb, "MakeProcInstance(%08lx,%04x): got thunk %08lx\n",
(SEGPTR)func, hInstance, (SEGPTR)thunkaddr ); (DWORD)func, hInstance, (DWORD)thunkaddr );
*thunk++ = 0xb8; /* movw instance, %ax */ *thunk++ = 0xb8; /* movw instance, %ax */
*thunk++ = (BYTE)(hInstance & 0xff); *thunk++ = (BYTE)(hInstance & 0xff);
...@@ -958,7 +958,7 @@ FARPROC MakeProcInstance( FARPROC func, HANDLE hInstance ) ...@@ -958,7 +958,7 @@ FARPROC MakeProcInstance( FARPROC func, HANDLE hInstance )
void FreeProcInstance( FARPROC func ) void FreeProcInstance( FARPROC func )
{ {
#ifndef WINELIB32 #ifndef WINELIB32
dprintf_task( stddeb, "FreeProcInstance("SPFMT")\n", (SEGPTR)func ); dprintf_task( stddeb, "FreeProcInstance(%08lx)\n", (DWORD)func );
TASK_FreeThunk( hCurrentTask, (SEGPTR)func ); TASK_FreeThunk( hCurrentTask, (SEGPTR)func );
#endif #endif
} }
...@@ -969,6 +969,7 @@ void FreeProcInstance( FARPROC func ) ...@@ -969,6 +969,7 @@ void FreeProcInstance( FARPROC func )
*/ */
HANDLE GetCodeHandle( FARPROC proc ) HANDLE GetCodeHandle( FARPROC proc )
{ {
#ifndef WINELIB32
HANDLE handle; HANDLE handle;
BYTE *thunk = (BYTE *)PTR_SEG_TO_LIN( proc ); BYTE *thunk = (BYTE *)PTR_SEG_TO_LIN( proc );
...@@ -982,6 +983,9 @@ HANDLE GetCodeHandle( FARPROC proc ) ...@@ -982,6 +983,9 @@ HANDLE GetCodeHandle( FARPROC proc )
handle = GlobalHandle( HIWORD(proc) ); handle = GlobalHandle( HIWORD(proc) );
return handle; return handle;
#else
return (HANDLE)proc;
#endif
} }
...@@ -1201,7 +1205,7 @@ BOOL TaskNext( TASKENTRY *lpte ) ...@@ -1201,7 +1205,7 @@ BOOL TaskNext( TASKENTRY *lpte )
TDB *pTask; TDB *pTask;
INSTANCEDATA *pInstData; INSTANCEDATA *pInstData;
dprintf_toolhelp( stddeb, "TaskNext(%p): task="NPFMT"\n", lpte, lpte->hNext ); dprintf_toolhelp( stddeb, "TaskNext(%p): task=%04x\n", lpte, lpte->hNext );
if (!lpte->hNext) return FALSE; if (!lpte->hNext) return FALSE;
pTask = (TDB *)GlobalLock( lpte->hNext ); pTask = (TDB *)GlobalLock( lpte->hNext );
if (!pTask || pTask->magic != TDB_MAGIC) return FALSE; if (!pTask || pTask->magic != TDB_MAGIC) return FALSE;
......
...@@ -649,7 +649,7 @@ void GlobalUnfix( HGLOBAL handle ) ...@@ -649,7 +649,7 @@ void GlobalUnfix( HGLOBAL handle )
/*********************************************************************** /***********************************************************************
* FarSetOwner (KERNEL.403) * FarSetOwner (KERNEL.403)
*/ */
void FarSetOwner( HANDLE handle, WORD hOwner ) void FarSetOwner( HANDLE handle, HANDLE hOwner )
{ {
GET_ARENA_PTR(handle)->hOwner = hOwner; GET_ARENA_PTR(handle)->hOwner = hOwner;
} }
......
...@@ -59,7 +59,7 @@ BOOL OpenClipboard(HWND hWnd) ...@@ -59,7 +59,7 @@ BOOL OpenClipboard(HWND hWnd)
{ {
if (hWndClipboardOwner != 0) return FALSE; if (hWndClipboardOwner != 0) return FALSE;
hWndClipboardOwner = hWnd; hWndClipboardOwner = hWnd;
dprintf_clipboard(stddeb,"OpenClipboard("NPFMT"); !\n", hWnd); dprintf_clipboard(stddeb,"OpenClipboard(%04x); !\n", hWnd);
return TRUE; return TRUE;
} }
...@@ -107,7 +107,7 @@ BOOL EmptyClipboard() ...@@ -107,7 +107,7 @@ BOOL EmptyClipboard()
HWND GetClipboardOwner() HWND GetClipboardOwner()
{ {
dprintf_clipboard(stddeb, dprintf_clipboard(stddeb,
"GetClipboardOwner() = "NPFMT" !\n", hWndClipboardOwner); "GetClipboardOwner() = %04x !\n", hWndClipboardOwner);
return hWndClipboardOwner; return hWndClipboardOwner;
} }
...@@ -119,7 +119,7 @@ HANDLE SetClipboardData(WORD wFormat, HANDLE hData) ...@@ -119,7 +119,7 @@ HANDLE SetClipboardData(WORD wFormat, HANDLE hData)
{ {
LPCLIPFORMAT lpFormat = ClipFormats; LPCLIPFORMAT lpFormat = ClipFormats;
dprintf_clipboard(stddeb, dprintf_clipboard(stddeb,
"SetClipboardDate(%04X, "NPFMT") !\n", wFormat, hData); "SetClipboardDate(%04X, %04x) !\n", wFormat, hData);
while(TRUE) { while(TRUE) {
if (lpFormat == NULL) return 0; if (lpFormat == NULL) return 0;
if (lpFormat->wFormatID == wFormat) break; if (lpFormat->wFormatID == wFormat) break;
...@@ -173,7 +173,7 @@ INT CountClipboardFormats() ...@@ -173,7 +173,7 @@ INT CountClipboardFormats()
if (lpFormat == NULL) break; if (lpFormat == NULL) break;
if (lpFormat->hData != 0) { if (lpFormat->hData != 0) {
dprintf_clipboard(stddeb, dprintf_clipboard(stddeb,
"CountClipboardFormats // Find Not Empty ("NPFMT") !\n", "CountClipboardFormats // Find Not Empty (%04x) !\n",
lpFormat->hData); lpFormat->hData);
FormatCount++; FormatCount++;
} }
...@@ -211,7 +211,7 @@ UINT EnumClipboardFormats(UINT wFormat) ...@@ -211,7 +211,7 @@ UINT EnumClipboardFormats(UINT wFormat)
lpFormat = lpFormat->NextFormat; lpFormat = lpFormat->NextFormat;
} }
dprintf_clipboard(stddeb, dprintf_clipboard(stddeb,
"EnumClipboardFormats // Find Not Empty Id=%04X hData="NPFMT" !\n", "EnumClipboardFormats // Find Not Empty Id=%04X hData=%04x !\n",
lpFormat->wFormatID, lpFormat->hData); lpFormat->wFormatID, lpFormat->hData);
return lpFormat->wFormatID; return lpFormat->wFormatID;
} }
...@@ -279,7 +279,7 @@ int GetClipboardFormatName(WORD wFormat, LPSTR retStr, short maxlen) ...@@ -279,7 +279,7 @@ int GetClipboardFormatName(WORD wFormat, LPSTR retStr, short maxlen)
HWND SetClipboardViewer(HWND hWnd) HWND SetClipboardViewer(HWND hWnd)
{ {
HWND hwndPrev = hWndViewer; HWND hwndPrev = hWndViewer;
dprintf_clipboard(stddeb,"SetClipboardViewer("NPFMT") !\n", hWnd); dprintf_clipboard(stddeb,"SetClipboardViewer(%04x) !\n", hWnd);
hWndViewer = hWnd; hWndViewer = hWnd;
return hwndPrev; return hwndPrev;
} }
...@@ -290,7 +290,7 @@ HWND SetClipboardViewer(HWND hWnd) ...@@ -290,7 +290,7 @@ HWND SetClipboardViewer(HWND hWnd)
*/ */
HWND GetClipboardViewer() HWND GetClipboardViewer()
{ {
dprintf_clipboard(stddeb,"GetClipboardFormat() = "NPFMT" !\n", hWndViewer); dprintf_clipboard(stddeb,"GetClipboardFormat() = %04x !\n", hWndViewer);
return hWndViewer; return hWndViewer;
} }
...@@ -301,7 +301,7 @@ HWND GetClipboardViewer() ...@@ -301,7 +301,7 @@ HWND GetClipboardViewer()
BOOL ChangeClipboardChain(HWND hWnd, HWND hWndNext) BOOL ChangeClipboardChain(HWND hWnd, HWND hWndNext)
{ {
dprintf_clipboard(stdnimp, dprintf_clipboard(stdnimp,
"ChangeClipboardChain("NPFMT", "NPFMT") !\n", hWnd, hWndNext); "ChangeClipboardChain(%04x, %04x) !\n", hWnd, hWndNext);
return 0; return 0;
} }
...@@ -331,7 +331,7 @@ BOOL IsClipboardFormatAvailable(WORD wFormat) ...@@ -331,7 +331,7 @@ BOOL IsClipboardFormatAvailable(WORD wFormat)
HWND GetOpenClipboardWindow() HWND GetOpenClipboardWindow()
{ {
dprintf_clipboard(stddeb, dprintf_clipboard(stddeb,
"GetOpenClipboardWindow() = "NPFMT" !\n", hWndClipboardOwner); "GetOpenClipboardWindow() = %04x !\n", hWndClipboardOwner);
return hWndClipboardOwner; return hWndClipboardOwner;
} }
...@@ -377,7 +377,7 @@ void CLIPBOARD_ReadSelection(Window w,Atom prop) ...@@ -377,7 +377,7 @@ void CLIPBOARD_ReadSelection(Window w,Atom prop)
hText=0; hText=0;
} else { } else {
dprintf_clipboard(stddeb,"Selection is %s\n",val); dprintf_clipboard(stddeb,"Selection is %s\n",val);
hText=GlobalAlloc(GMEM_MOVEABLE, nitems); hText=GlobalAlloc(GMEM_MOVEABLE, nitems+1);
memcpy(GlobalLock(hText),val,nitems+1); memcpy(GlobalLock(hText),val,nitems+1);
GlobalUnlock(hText); GlobalUnlock(hText);
} }
......
...@@ -295,6 +295,18 @@ static LONG FILEDLG_WMMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam) ...@@ -295,6 +295,18 @@ static LONG FILEDLG_WMMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
} }
/*********************************************************************** /***********************************************************************
* FILEDLG_HookCallChk [internal]
*/
static int FILEDLG_HookCallChk(LPOPENFILENAME lpofn)
{
if (lpofn)
if (lpofn->Flags & OFN_ENABLEHOOK)
if (lpofn->lpfnHook)
return 1;
return 0;
}
/***********************************************************************
* FILEDLG_WMInitDialog [internal] * FILEDLG_WMInitDialog [internal]
*/ */
...@@ -372,7 +384,11 @@ static LONG FILEDLG_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam) ...@@ -372,7 +384,11 @@ static LONG FILEDLG_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
ShowWindow(GetDlgItem(hWnd, pshHelp), SW_HIDE); ShowWindow(GetDlgItem(hWnd, pshHelp), SW_HIDE);
if (lpofn->Flags & OFN_HIDEREADONLY) if (lpofn->Flags & OFN_HIDEREADONLY)
ShowWindow(GetDlgItem(hWnd, chx1), SW_HIDE); ShowWindow(GetDlgItem(hWnd, chx1), SW_HIDE);
return TRUE; if (FILEDLG_HookCallChk(lpofn))
return (BOOL)CallWindowProc(lpofn->lpfnHook,
hWnd, WM_INITDIALOG, wParam,(LPARAM)MAKE_SEGPTR(lpofn));
else
return TRUE;
} }
/*********************************************************************** /***********************************************************************
...@@ -382,6 +398,7 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) ...@@ -382,6 +398,7 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
{ {
LONG lRet; LONG lRet;
LPOPENFILENAME lpofn; LPOPENFILENAME lpofn;
OPENFILENAME ofn2;
char tmpstr[512], tmpstr2[512]; char tmpstr[512], tmpstr2[512];
LPSTR pstr, pstr2; LPSTR pstr, pstr2;
UINT control,notification; UINT control,notification;
...@@ -407,6 +424,12 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) ...@@ -407,6 +424,12 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
SendDlgItemMessage(hWnd, lst1, LB_GETTEXT, lRet, SendDlgItemMessage(hWnd, lst1, LB_GETTEXT, lRet,
(LPARAM)MAKE_SEGPTR(tmpstr)); (LPARAM)MAKE_SEGPTR(tmpstr));
SendDlgItemMessage(hWnd, edt1, WM_SETTEXT, 0, (LPARAM)MAKE_SEGPTR(tmpstr)); SendDlgItemMessage(hWnd, edt1, WM_SETTEXT, 0, (LPARAM)MAKE_SEGPTR(tmpstr));
if (FILEDLG_HookCallChk(lpofn))
CallWindowProc (lpofn->lpfnHook, hWnd,
RegisterWindowMessage(MAKE_SEGPTR(LBSELCHSTRING)),
control, MAKELONG(lRet,CD_LBSELCHANGE));
/* FIXME: for OFN_ALLOWMULTISELECT we need CD_LBSELSUB, CD_SELADD, CD_LBSELNOITEMS */
return TRUE; return TRUE;
case lst2: /* directory list */ case lst2: /* directory list */
FILEDLG_StripEditControl(hWnd); FILEDLG_StripEditControl(hWnd);
...@@ -454,6 +477,7 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) ...@@ -454,6 +477,7 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
return TRUE; return TRUE;
case IDOK: case IDOK:
almost_ok: almost_ok:
ofn2=*lpofn; /* for later restoring */
SendDlgItemMessage(hWnd, edt1, WM_GETTEXT, 511, (LPARAM)MAKE_SEGPTR(tmpstr)); SendDlgItemMessage(hWnd, edt1, WM_GETTEXT, 511, (LPARAM)MAKE_SEGPTR(tmpstr));
pstr = strrchr(tmpstr, '\\'); pstr = strrchr(tmpstr, '\\');
if (pstr == NULL) if (pstr == NULL)
...@@ -507,7 +531,9 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) ...@@ -507,7 +531,9 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
} }
else else
SendDlgItemMessage(hWnd, edt1, WM_SETTEXT, 0, (LPARAM)MAKE_SEGPTR(tmpstr)); SendDlgItemMessage(hWnd, edt1, WM_SETTEXT, 0, (LPARAM)MAKE_SEGPTR(tmpstr));
ShowWindow(hWnd, SW_HIDE); #if 0
ShowWindow(hWnd, SW_HIDE); /* this should not be necessary ?! (%%%) */
#endif
{ {
int drive = DRIVE_GetCurrentDrive(); int drive = DRIVE_GetCurrentDrive();
tmpstr2[0] = 'A'+ drive; tmpstr2[0] = 'A'+ drive;
...@@ -535,6 +561,20 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) ...@@ -535,6 +561,20 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
dprintf_commdlg(stddeb,"strcpy'ing '%s'\n",tmpstr); fflush(stdout); dprintf_commdlg(stddeb,"strcpy'ing '%s'\n",tmpstr); fflush(stdout);
strcpy(PTR_SEG_TO_LIN(lpofn->lpstrFileTitle), tmpstr); strcpy(PTR_SEG_TO_LIN(lpofn->lpstrFileTitle), tmpstr);
} }
if (FILEDLG_HookCallChk(lpofn))
{
lRet= (BOOL)CallWindowProc (lpofn->lpfnHook,
hWnd, RegisterWindowMessage(MAKE_SEGPTR(FILEOKSTRING)),
0, (LPARAM)MAKE_SEGPTR(lpofn));
if (lRet)
{
*lpofn=ofn2; /* restore old state */
#if 0
ShowWindow(hWnd, SW_SHOW); /* only if above (%%%) SW_HIDE used */
#endif
break;
}
}
EndDialog(hWnd, TRUE); EndDialog(hWnd, TRUE);
return TRUE; return TRUE;
case IDCANCEL: case IDCANCEL:
...@@ -550,6 +590,15 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) ...@@ -550,6 +590,15 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
*/ */
LRESULT FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam) LRESULT FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
{ {
LPOPENFILENAME lpofn = (LPOPENFILENAME)GetWindowLong(hWnd, DWL_USER);
if (wMsg!=WM_INITDIALOG)
if (FILEDLG_HookCallChk(lpofn))
{
LRESULT lRet=(BOOL)CallWindowProc(lpofn->lpfnHook, hWnd, wMsg, wParam, lParam);
if (lRet)
return lRet; /* else continue message processing */
}
switch (wMsg) switch (wMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
...@@ -584,6 +633,15 @@ LRESULT FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam) ...@@ -584,6 +633,15 @@ LRESULT FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
*/ */
LRESULT FileSaveDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam) LRESULT FileSaveDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam)
{ {
LPOPENFILENAME lpofn = (LPOPENFILENAME)GetWindowLong(hWnd, DWL_USER);
if (wMsg!=WM_INITDIALOG)
if (FILEDLG_HookCallChk(lpofn))
{
LRESULT lRet=(BOOL)CallWindowProc(lpofn->lpfnHook, hWnd, wMsg, wParam, lParam);
if (lRet)
return lRet; /* else continue message processing */
}
switch (wMsg) { switch (wMsg) {
case WM_INITDIALOG: case WM_INITDIALOG:
return FILEDLG_WMInitDialog(hWnd, wParam, lParam); return FILEDLG_WMInitDialog(hWnd, wParam, lParam);
......
...@@ -33,7 +33,7 @@ void LoadStartupDrivers(void) ...@@ -33,7 +33,7 @@ void LoadStartupDrivers(void)
dprintf_driver(stddeb,"LoadStartupDrivers // str='%s'\n", ptr); dprintf_driver(stddeb,"LoadStartupDrivers // str='%s'\n", ptr);
hDrv = OpenDriver(ptr, "drivers", 0L); hDrv = OpenDriver(ptr, "drivers", 0L);
dprintf_driver(stddeb, dprintf_driver(stddeb,
"LoadStartupDrivers // hDrv="NPFMT"\n", hDrv); "LoadStartupDrivers // hDrv=%04x\n", hDrv);
ptr += strlen(ptr) + 1; ptr += strlen(ptr) + 1;
} }
dprintf_driver(stddeb,"LoadStartupDrivers // end of list !\n"); dprintf_driver(stddeb,"LoadStartupDrivers // end of list !\n");
...@@ -44,7 +44,7 @@ void LoadStartupDrivers(void) ...@@ -44,7 +44,7 @@ void LoadStartupDrivers(void)
*/ */
LRESULT WINAPI SendDriverMessage(HDRVR hDriver, WORD msg, LPARAM lParam1, LPARAM lParam2) LRESULT WINAPI SendDriverMessage(HDRVR hDriver, WORD msg, LPARAM lParam1, LPARAM lParam2)
{ {
dprintf_driver(stdnimp,"SendDriverMessage("NPFMT", %04X, %08lX, %08lX);\n", dprintf_driver(stdnimp,"SendDriverMessage(%04x, %04X, %08lX, %08lX);\n",
hDriver, msg, lParam1, lParam2); hDriver, msg, lParam1, lParam2);
return 0; return 0;
} }
...@@ -93,7 +93,7 @@ HDRVR OpenDriver(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam) ...@@ -93,7 +93,7 @@ HDRVR OpenDriver(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
lpnewdrv->lpPrevItem = lpdrv; lpnewdrv->lpPrevItem = lpdrv;
} }
lpnewdrv->lpDrvProc = NULL; lpnewdrv->lpDrvProc = NULL;
dprintf_driver(stddeb,"OpenDriver // hDrvr="NPFMT" loaded !\n", hDrvr); dprintf_driver(stddeb,"OpenDriver // hDrvr=%04x loaded !\n", hDrvr);
return hDrvr; return hDrvr;
} }
...@@ -104,7 +104,7 @@ LRESULT CloseDriver(HDRVR hDrvr, LPARAM lParam1, LPARAM lParam2) ...@@ -104,7 +104,7 @@ LRESULT CloseDriver(HDRVR hDrvr, LPARAM lParam1, LPARAM lParam2)
{ {
LPDRIVERITEM lpdrv; LPDRIVERITEM lpdrv;
dprintf_driver(stddeb, dprintf_driver(stddeb,
"CloseDriver("NPFMT", %08lX, %08lX);\n", hDrvr, lParam1, lParam2); "CloseDriver(%04x, %08lX, %08lX);\n", hDrvr, lParam1, lParam2);
lpdrv = (LPDRIVERITEM) GlobalLock(hDrvr); lpdrv = (LPDRIVERITEM) GlobalLock(hDrvr);
if (lpdrv != NULL && lpdrv->dis.hDriver == hDrvr) { if (lpdrv != NULL && lpdrv->dis.hDriver == hDrvr) {
if (lpdrv->lpPrevItem) if (lpdrv->lpPrevItem)
...@@ -113,7 +113,7 @@ LRESULT CloseDriver(HDRVR hDrvr, LPARAM lParam1, LPARAM lParam2) ...@@ -113,7 +113,7 @@ LRESULT CloseDriver(HDRVR hDrvr, LPARAM lParam1, LPARAM lParam2)
((LPDRIVERITEM)lpdrv->lpNextItem)->lpPrevItem = lpdrv->lpPrevItem; ((LPDRIVERITEM)lpdrv->lpNextItem)->lpPrevItem = lpdrv->lpPrevItem;
GlobalUnlock(hDrvr); GlobalUnlock(hDrvr);
GlobalFree(hDrvr); GlobalFree(hDrvr);
dprintf_driver(stddeb,"CloseDriver // hDrvr="NPFMT" closed !\n", hDrvr); dprintf_driver(stddeb,"CloseDriver // hDrvr=%04x closed !\n", hDrvr);
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
...@@ -126,7 +126,7 @@ HANDLE GetDriverModuleHandle(HDRVR hDrvr) ...@@ -126,7 +126,7 @@ HANDLE GetDriverModuleHandle(HDRVR hDrvr)
{ {
LPDRIVERITEM lpdrv; LPDRIVERITEM lpdrv;
HANDLE hModule = 0; HANDLE hModule = 0;
dprintf_driver(stddeb,"GetDriverModuleHandle("NPFMT");\n", hDrvr); dprintf_driver(stddeb,"GetDriverModuleHandle(%04x);\n", hDrvr);
lpdrv = (LPDRIVERITEM) GlobalLock(hDrvr); lpdrv = (LPDRIVERITEM) GlobalLock(hDrvr);
if (lpdrv != NULL) { if (lpdrv != NULL) {
hModule = lpdrv->dis.hModule; hModule = lpdrv->dis.hModule;
...@@ -175,7 +175,7 @@ LRESULT DefDriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg, ...@@ -175,7 +175,7 @@ LRESULT DefDriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
BOOL GetDriverInfo(HDRVR hDrvr, LPDRIVERINFOSTRUCT lpDrvInfo) BOOL GetDriverInfo(HDRVR hDrvr, LPDRIVERINFOSTRUCT lpDrvInfo)
{ {
LPDRIVERITEM lpdrv; LPDRIVERITEM lpdrv;
dprintf_driver(stddeb,"GetDriverInfo("NPFMT", %p);\n", hDrvr, lpDrvInfo); dprintf_driver(stddeb,"GetDriverInfo(%04x, %p);\n", hDrvr, lpDrvInfo);
if (lpDrvInfo == NULL) return FALSE; if (lpDrvInfo == NULL) return FALSE;
lpdrv = (LPDRIVERITEM) GlobalLock(hDrvr); lpdrv = (LPDRIVERITEM) GlobalLock(hDrvr);
if (lpdrv == NULL) return FALSE; if (lpdrv == NULL) return FALSE;
...@@ -191,7 +191,7 @@ HDRVR GetNextDriver(HDRVR hDrvr, DWORD dwFlags) ...@@ -191,7 +191,7 @@ HDRVR GetNextDriver(HDRVR hDrvr, DWORD dwFlags)
{ {
LPDRIVERITEM lpdrv; LPDRIVERITEM lpdrv;
HDRVR hRetDrv = 0; HDRVR hRetDrv = 0;
dprintf_driver(stddeb,"GetNextDriver("NPFMT", %08lX);\n", hDrvr, dwFlags); dprintf_driver(stddeb,"GetNextDriver(%04x, %08lX);\n", hDrvr, dwFlags);
if (hDrvr == 0) { if (hDrvr == 0) {
if (lpDrvItemList == NULL) { if (lpDrvItemList == NULL) {
dprintf_driver(stddeb, dprintf_driver(stddeb,
...@@ -199,7 +199,7 @@ HDRVR GetNextDriver(HDRVR hDrvr, DWORD dwFlags) ...@@ -199,7 +199,7 @@ HDRVR GetNextDriver(HDRVR hDrvr, DWORD dwFlags)
LoadStartupDrivers(); LoadStartupDrivers();
if (lpDrvItemList == NULL) return 0; if (lpDrvItemList == NULL) return 0;
} }
dprintf_driver(stddeb,"GetNextDriver // return first "NPFMT" !\n", dprintf_driver(stddeb,"GetNextDriver // return first %04x !\n",
lpDrvItemList->dis.hDriver); lpDrvItemList->dis.hDriver);
return lpDrvItemList->dis.hDriver; return lpDrvItemList->dis.hDriver;
} }
...@@ -215,7 +215,7 @@ HDRVR GetNextDriver(HDRVR hDrvr, DWORD dwFlags) ...@@ -215,7 +215,7 @@ HDRVR GetNextDriver(HDRVR hDrvr, DWORD dwFlags)
} }
GlobalUnlock(hDrvr); GlobalUnlock(hDrvr);
} }
dprintf_driver(stddeb,"GetNextDriver // return "NPFMT" !\n", hRetDrv); dprintf_driver(stddeb,"GetNextDriver // return %04x !\n", hRetDrv);
return hRetDrv; return hRetDrv;
} }
......
...@@ -55,7 +55,7 @@ void EXEC_ExitWindows( int retCode ) ...@@ -55,7 +55,7 @@ void EXEC_ExitWindows( int retCode )
*/ */
BOOL ExitWindows( DWORD dwReturnCode, WORD wReserved ) BOOL ExitWindows( DWORD dwReturnCode, WORD wReserved )
{ {
HWND hwnd, hwndDesktop; HWND hwndDesktop;
WND *wndPtr; WND *wndPtr;
HWND *list, *pWnd; HWND *list, *pWnd;
int count, i; int count, i;
...@@ -70,22 +70,16 @@ BOOL ExitWindows( DWORD dwReturnCode, WORD wReserved ) ...@@ -70,22 +70,16 @@ BOOL ExitWindows( DWORD dwReturnCode, WORD wReserved )
hwndDesktop = GetDesktopWindow(); hwndDesktop = GetDesktopWindow();
count = 0; count = 0;
for (hwnd = GetTopWindow(hwndDesktop); hwnd != 0; hwnd = wndPtr->hwndNext) for (wndPtr = WIN_GetDesktop()->child; wndPtr; wndPtr = wndPtr->next)
{
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE;
count++; count++;
}
if (!count) /* No windows, we can exit at once */ if (!count) /* No windows, we can exit at once */
EXEC_ExitWindows( LOWORD(dwReturnCode) ); EXEC_ExitWindows( LOWORD(dwReturnCode) );
/* Now build the list of all windows */ /* Now build the list of all windows */
if (!(list = (HWND *)malloc( sizeof(HWND) * count ))) return FALSE; if (!(pWnd = list = (HWND *)malloc( sizeof(HWND) * count ))) return FALSE;
for (hwnd = GetTopWindow(hwndDesktop), pWnd = list; hwnd != 0; hwnd = wndPtr->hwndNext) for (wndPtr = WIN_GetDesktop()->child; wndPtr; wndPtr = wndPtr->next)
{ *pWnd++ = wndPtr->hwndSelf;
wndPtr = WIN_FindWndPtr( hwnd );
*pWnd++ = hwnd;
}
/* Now send a WM_QUERYENDSESSION message to every window */ /* Now send a WM_QUERYENDSESSION message to every window */
......
...@@ -263,7 +263,7 @@ LZRead(HFILE fd,SEGPTR segbuf,WORD toread) { ...@@ -263,7 +263,7 @@ LZRead(HFILE fd,SEGPTR segbuf,WORD toread) {
BYTE *buf; BYTE *buf;
struct lzstate *lzs; struct lzstate *lzs;
dprintf_file(stddeb,"LZRead(%d,%08lx,%d)\n",fd,segbuf,toread); dprintf_file(stddeb,"LZRead(%d,%08lx,%d)\n",fd,(DWORD)segbuf,toread);
howmuch=toread; howmuch=toread;
for (i=0;i<nroflzstates;i++) for (i=0;i<nroflzstates;i++)
if (lzstates[i].lzfd==fd) if (lzstates[i].lzfd==fd)
......
...@@ -831,6 +831,66 @@ LPVOID GetEnvironmentStrings(void) ...@@ -831,6 +831,66 @@ LPVOID GetEnvironmentStrings(void)
return envtable; return envtable;
} }
LPVOID GetEnvironmentStringsW(void)
{
int count,len;
LPENVENTRY lpEnv;
char *envtable, *envptr;
WCHAR *wenvtable;
/* Count the total number of bytes we'll need for the string
* table. Include the trailing nuls and the final double nul.
*/
count = 1;
lpEnv = lpEnvList;
while(lpEnv != NULL)
{
if(lpEnv->Name != NULL)
{
count += strlen(lpEnv->Name) + 1;
count += strlen(lpEnv->Value) + 1;
}
lpEnv = lpEnv->Next;
}
len=count;
envtable = malloc(count);
if(envtable)
{
lpEnv = lpEnvList;
envptr = envtable;
while(lpEnv != NULL)
{
if(lpEnv->Name != NULL)
{
count = sprintf(envptr, "%s=%s", lpEnv->Name, lpEnv->Value);
envptr += count + 1;
}
lpEnv = lpEnv->Next;
}
*envptr = '\0';
}
wenvtable = malloc(2*len);
for(count=0;count<len;count++)
wenvtable[count]=(WCHAR)envtable[count];
free(envtable);
return envtable;
}
void FreeEnvironmentStringsA(void *e)
{
free(e);
}
void FreeEnvironmentStringsW(void* e)
{
free(e);
}
/*********************************************************************** /***********************************************************************
* GetTimerResolution (USER.14) * GetTimerResolution (USER.14)
*/ */
......
...@@ -117,7 +117,7 @@ int WNetSetJobCopies(LPSTR szQueue,WORD wJobId,WORD nCopies) ...@@ -117,7 +117,7 @@ int WNetSetJobCopies(LPSTR szQueue,WORD wJobId,WORD nCopies)
*/ */
int WNetWatchQueue(HWND hWnd,LPSTR szLocal,LPSTR szUser,WORD nQueue) int WNetWatchQueue(HWND hWnd,LPSTR szLocal,LPSTR szUser,WORD nQueue)
{ {
printf("EMPTY STUB !!! WNetWatchQueue("NPFMT",'%s','%s',%x)\n", printf("EMPTY STUB !!! WNetWatchQueue(%04x,'%s','%s',%x)\n",
hWnd,szLocal,szUser,nQueue); hWnd,szLocal,szUser,nQueue);
return WN_NET_ERROR; return WN_NET_ERROR;
} }
...@@ -193,7 +193,7 @@ int WNetGetCaps(WORD capability) ...@@ -193,7 +193,7 @@ int WNetGetCaps(WORD capability)
*/ */
int WNetDeviceMode(HWND hWndOwner) int WNetDeviceMode(HWND hWndOwner)
{ {
printf("EMPTY STUB !!! WNetDeviceMode("NPFMT")\n",hWndOwner); printf("EMPTY STUB !!! WNetDeviceMode(%04x)\n",hWndOwner);
return WN_NET_ERROR; return WN_NET_ERROR;
} }
...@@ -202,7 +202,7 @@ int WNetDeviceMode(HWND hWndOwner) ...@@ -202,7 +202,7 @@ int WNetDeviceMode(HWND hWndOwner)
*/ */
int WNetBrowseDialog(HWND hParent,WORD nType,LPSTR szPath) int WNetBrowseDialog(HWND hParent,WORD nType,LPSTR szPath)
{ {
printf("EMPTY STUB !!! WNetBrowseDialog("NPFMT",%x,'%s')\n", printf("EMPTY STUB !!! WNetBrowseDialog(%04x,%x,'%s')\n",
hParent,nType,szPath); hParent,nType,szPath);
return WN_NET_ERROR; return WN_NET_ERROR;
} }
...@@ -262,7 +262,7 @@ int WNetGetErrorText(WORD nError, LPSTR lpBuffer, LPWORD nBufferSize) ...@@ -262,7 +262,7 @@ int WNetGetErrorText(WORD nError, LPSTR lpBuffer, LPWORD nBufferSize)
*/ */
int WNetRestoreConnection(HWND hwndOwner,LPSTR lpszDevice) int WNetRestoreConnection(HWND hwndOwner,LPSTR lpszDevice)
{ {
printf("EMPTY STUB !!! WNetRestoreConnection("NPFMT",'%s')\n", printf("EMPTY STUB !!! WNetRestoreConnection(%04x,'%s')\n",
hwndOwner,lpszDevice); hwndOwner,lpszDevice);
return WN_NET_ERROR; return WN_NET_ERROR;
} }
...@@ -272,7 +272,7 @@ int WNetRestoreConnection(HWND hwndOwner,LPSTR lpszDevice) ...@@ -272,7 +272,7 @@ int WNetRestoreConnection(HWND hwndOwner,LPSTR lpszDevice)
*/ */
int WNetWriteJob(HANDLE hJob,void *lpData,LPWORD lpcbData) int WNetWriteJob(HANDLE hJob,void *lpData,LPWORD lpcbData)
{ {
printf("EMPTY STUB !!! WNetWriteJob("NPFMT",%p,%p)\n", printf("EMPTY STUB !!! WNetWriteJob(%04x,%p,%p)\n",
hJob,lpData,lpcbData); hJob,lpData,lpcbData);
return WN_NET_ERROR; return WN_NET_ERROR;
} }
...@@ -282,7 +282,7 @@ int WNetWriteJob(HANDLE hJob,void *lpData,LPWORD lpcbData) ...@@ -282,7 +282,7 @@ int WNetWriteJob(HANDLE hJob,void *lpData,LPWORD lpcbData)
*/ */
UINT WNetConnectDialog(HWND hWndParent, WORD iType) UINT WNetConnectDialog(HWND hWndParent, WORD iType)
{ {
printf("EMPTY STUB !!! WNetConnectDialog("NPFMT", %4X)\n", hWndParent, iType); printf("EMPTY STUB !!! WNetConnectDialog(%04x, %4X)\n", hWndParent, iType);
return WN_SUCCESS; return WN_SUCCESS;
} }
...@@ -291,7 +291,7 @@ UINT WNetConnectDialog(HWND hWndParent, WORD iType) ...@@ -291,7 +291,7 @@ UINT WNetConnectDialog(HWND hWndParent, WORD iType)
*/ */
int WNetDisconnectDialog(HWND hwndOwner, WORD iType) int WNetDisconnectDialog(HWND hwndOwner, WORD iType)
{ {
printf("EMPTY STUB !!! WNetDisconnectDialog("NPFMT",%x)\n", printf("EMPTY STUB !!! WNetDisconnectDialog(%04x,%x)\n",
hwndOwner,iType); hwndOwner,iType);
return WN_NET_ERROR; return WN_NET_ERROR;
} }
...@@ -301,7 +301,7 @@ int WNetDisconnectDialog(HWND hwndOwner, WORD iType) ...@@ -301,7 +301,7 @@ int WNetDisconnectDialog(HWND hwndOwner, WORD iType)
*/ */
UINT WNetConnectionDialog(HWND hWndParent, WORD iType) UINT WNetConnectionDialog(HWND hWndParent, WORD iType)
{ {
printf("EMPTY STUB !!! WNetConnectionDialog("NPFMT", %4X)\n", printf("EMPTY STUB !!! WNetConnectionDialog(%04x, %4X)\n",
hWndParent, iType); hWndParent, iType);
return WN_SUCCESS; return WN_SUCCESS;
} }
...@@ -311,7 +311,7 @@ UINT WNetConnectionDialog(HWND hWndParent, WORD iType) ...@@ -311,7 +311,7 @@ UINT WNetConnectionDialog(HWND hWndParent, WORD iType)
*/ */
int WNetViewQueueDialog(HWND hwndOwner,LPSTR lpszQueue) int WNetViewQueueDialog(HWND hwndOwner,LPSTR lpszQueue)
{ {
printf("EMPTY STUB !!! WNetViewQueueDialog("NPFMT",'%s')\n", printf("EMPTY STUB !!! WNetViewQueueDialog(%04x,'%s')\n",
hwndOwner,lpszQueue); hwndOwner,lpszQueue);
return WN_NET_ERROR; return WN_NET_ERROR;
} }
...@@ -322,7 +322,7 @@ int WNetViewQueueDialog(HWND hwndOwner,LPSTR lpszQueue) ...@@ -322,7 +322,7 @@ int WNetViewQueueDialog(HWND hwndOwner,LPSTR lpszQueue)
int WNetPropertyDialog(HWND hwndParent,WORD iButton, int WNetPropertyDialog(HWND hwndParent,WORD iButton,
WORD nPropSel,LPSTR lpszName,WORD nType) WORD nPropSel,LPSTR lpszName,WORD nType)
{ {
printf("EMPTY STUB !!! WNetPropertyDialog("NPFMT",%x,%x,'%s',%x)\n", printf("EMPTY STUB !!! WNetPropertyDialog(%04x,%x,%x,'%s',%x)\n",
hwndParent,iButton,nPropSel,lpszName,nType); hwndParent,iButton,nPropSel,lpszName,nType);
return WN_NET_ERROR; return WN_NET_ERROR;
} }
...@@ -342,7 +342,7 @@ int WNetGetDirectoryType(LPSTR lpName,void *lpType) ...@@ -342,7 +342,7 @@ int WNetGetDirectoryType(LPSTR lpName,void *lpType)
*/ */
int WNetDirectoryNotify(HWND hwndOwner,void *lpDir,WORD wOper) int WNetDirectoryNotify(HWND hwndOwner,void *lpDir,WORD wOper)
{ {
printf("EMPTY STUB !!! WNetDirectoryNotify("NPFMT",%p,%x)\n", printf("EMPTY STUB !!! WNetDirectoryNotify(%04x,%p,%x)\n",
hwndOwner,lpDir,wOper); hwndOwner,lpDir,wOper);
return WN_NET_ERROR; return WN_NET_ERROR;
} }
...@@ -353,7 +353,7 @@ int WNetDirectoryNotify(HWND hwndOwner,void *lpDir,WORD wOper) ...@@ -353,7 +353,7 @@ int WNetDirectoryNotify(HWND hwndOwner,void *lpDir,WORD wOper)
int WNetGetPropertyText(HWND hwndParent,WORD iButton,WORD nPropSel, int WNetGetPropertyText(HWND hwndParent,WORD iButton,WORD nPropSel,
LPSTR lpszName,WORD nType) LPSTR lpszName,WORD nType)
{ {
printf("EMPTY STUB !!! WNetGetPropertyText("NPFMT",%x,%x,'%s',%x)\n", printf("EMPTY STUB !!! WNetGetPropertyText(%04x,%x,%x,'%s',%x)\n",
hwndParent,iButton,nPropSel,lpszName,nType); hwndParent,iButton,nPropSel,lpszName,nType);
return WN_NET_ERROR; return WN_NET_ERROR;
} }
...@@ -374,7 +374,7 @@ UINT WNetAddConnection2(LPSTR lpNetPath, LPSTR lpPassWord, ...@@ -374,7 +374,7 @@ UINT WNetAddConnection2(LPSTR lpNetPath, LPSTR lpPassWord,
*/ */
UINT WNetCloseEnum(HANDLE hEnum) UINT WNetCloseEnum(HANDLE hEnum)
{ {
printf("EMPTY STUB !!! WNetCloseEnum("NPFMT");\n", hEnum); printf("EMPTY STUB !!! WNetCloseEnum(%04x);\n", hEnum);
return WN_NET_ERROR; return WN_NET_ERROR;
} }
...@@ -384,7 +384,7 @@ UINT WNetCloseEnum(HANDLE hEnum) ...@@ -384,7 +384,7 @@ UINT WNetCloseEnum(HANDLE hEnum)
UINT WNetEnumResource(HANDLE hEnum, DWORD cRequ, UINT WNetEnumResource(HANDLE hEnum, DWORD cRequ,
DWORD *lpCount, LPVOID lpBuf) DWORD *lpCount, LPVOID lpBuf)
{ {
printf("EMPTY STUB !!! WNetEnumResource("NPFMT", %08lX, %p, %p);\n", printf("EMPTY STUB !!! WNetEnumResource(%04x, %08lX, %p, %p);\n",
hEnum, cRequ, lpCount, lpBuf); hEnum, cRequ, lpCount, lpBuf);
return WN_NET_ERROR; return WN_NET_ERROR;
} }
...@@ -396,7 +396,7 @@ UINT WNetOpenEnum(DWORD dwScope, DWORD dwType, ...@@ -396,7 +396,7 @@ UINT WNetOpenEnum(DWORD dwScope, DWORD dwType,
LPNETRESOURCE lpNet, HANDLE FAR *lphEnum) LPNETRESOURCE lpNet, HANDLE FAR *lphEnum)
{ {
printf("EMPTY STUB !!! WNetOpenEnum(%08lX, %08lX, %p, %p);\n", printf("EMPTY STUB !!! WNetOpenEnum(%08lX, %08lX, %p, %p);\n",
dwScope, dwType, lpNet, lphEnum); dwScope, dwType, lpNet, lphEnum);
return WN_NET_ERROR; return WN_NET_ERROR;
} }
......
...@@ -52,6 +52,6 @@ OLESTATUS WINAPI OleRevokeClientDoc(LHCLIENTDOC hServerDoc) ...@@ -52,6 +52,6 @@ OLESTATUS WINAPI OleRevokeClientDoc(LHCLIENTDOC hServerDoc)
*/ */
BOOL WINAPI OleIsDcMeta(HDC hdc) BOOL WINAPI OleIsDcMeta(HDC hdc)
{ {
dprintf_ole(stddeb,"OleIsDCMeta("NPFMT")\n",hdc); dprintf_ole(stddeb,"OleIsDCMeta(%04x)\n",hdc);
return GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC ) != 0; return GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC ) != 0;
} }
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
* *
* Copyright 1993 Alexandre Julliard * Copyright 1993 Alexandre Julliard
* *
static char Copyright[] = "Copyright Alexandre Julliard, 1993"; */
*/
#include "windows.h" #include "windows.h"
......
...@@ -229,6 +229,7 @@ LONG RegOpenKey(HKEY hKey, LPCSTR lpSubKey, LPHKEY lphKey) ...@@ -229,6 +229,7 @@ LONG RegOpenKey(HKEY hKey, LPCSTR lpSubKey, LPHKEY lphKey)
lpKey = lphTopKey; break; lpKey = lphTopKey; break;
case HKEY_CLASSES_ROOT: /* == 1 */ case HKEY_CLASSES_ROOT: /* == 1 */
case 0x80000000: case 0x80000000:
case 0x80000001:
lpKey = lphRootKey; break; lpKey = lphRootKey; break;
default: default:
dprintf_reg(stddeb,"RegOpenKey // specific key = %08lX !\n", (DWORD)hKey); dprintf_reg(stddeb,"RegOpenKey // specific key = %08lX !\n", (DWORD)hKey);
...@@ -442,6 +443,7 @@ LONG RegEnumKey(HKEY hKey, DWORD dwSubKey, LPSTR lpBuf, DWORD dwSize) ...@@ -442,6 +443,7 @@ LONG RegEnumKey(HKEY hKey, DWORD dwSubKey, LPSTR lpBuf, DWORD dwSize)
lpKey = lphTopKey; break; lpKey = lphTopKey; break;
case HKEY_CLASSES_ROOT: /* == 1 */ case HKEY_CLASSES_ROOT: /* == 1 */
case 0x80000000: case 0x80000000:
case 0x80000001:
lpKey = lphRootKey; break; lpKey = lphRootKey; break;
default: default:
dprintf_reg(stddeb,"RegEnumKey // specific key = %08lX !\n", (DWORD)hKey); dprintf_reg(stddeb,"RegEnumKey // specific key = %08lX !\n", (DWORD)hKey);
...@@ -470,7 +472,7 @@ LONG RegEnumKey(HKEY hKey, DWORD dwSubKey, LPSTR lpBuf, DWORD dwSize) ...@@ -470,7 +472,7 @@ LONG RegEnumKey(HKEY hKey, DWORD dwSubKey, LPSTR lpBuf, DWORD dwSize)
void DragAcceptFiles(HWND hWnd, BOOL b) void DragAcceptFiles(HWND hWnd, BOOL b)
{ {
/* flips WS_EX_ACCEPTFILES bit according to the value of b */ /* flips WS_EX_ACCEPTFILES bit according to the value of b */
dprintf_reg(stddeb,"DragAcceptFiles("NPFMT", %u) old exStyle %08lx\n", dprintf_reg(stddeb,"DragAcceptFiles(%04x, %u) old exStyle %08lx\n",
hWnd,b,GetWindowLong(hWnd,GWL_EXSTYLE)); hWnd,b,GetWindowLong(hWnd,GWL_EXSTYLE));
SetWindowLong(hWnd,GWL_EXSTYLE, SetWindowLong(hWnd,GWL_EXSTYLE,
...@@ -491,7 +493,7 @@ UINT DragQueryFile(HDROP hDrop, WORD wFile, LPSTR lpszFile, WORD wLength) ...@@ -491,7 +493,7 @@ UINT DragQueryFile(HDROP hDrop, WORD wFile, LPSTR lpszFile, WORD wLength)
LPSTR lpCurrent; LPSTR lpCurrent;
WORD i; WORD i;
dprintf_reg(stddeb,"DragQueryFile("NPFMT", %i, %p, %u)\n", dprintf_reg(stddeb,"DragQueryFile(%04x, %i, %p, %u)\n",
hDrop,wFile,lpszFile,wLength); hDrop,wFile,lpszFile,wLength);
lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop); lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop);
...@@ -563,7 +565,7 @@ HINSTANCE ShellExecute(HWND hWnd, LPCSTR lpOperation, LPCSTR lpFile, LPSTR lpPar ...@@ -563,7 +565,7 @@ HINSTANCE ShellExecute(HWND hWnd, LPCSTR lpOperation, LPCSTR lpFile, LPSTR lpPar
* we have to pass the parameters. If an instance is already running, * we have to pass the parameters. If an instance is already running,
* we might have to send DDE commands. * we might have to send DDE commands.
*/ */
dprintf_exec(stddeb, "ShellExecute("NPFMT",'%s','%s','%s','%s',%x)\n", dprintf_exec(stddeb, "ShellExecute(%04x,'%s','%s','%s','%s',%x)\n",
hWnd, lpOperation ? lpOperation:"<null>", lpFile ? lpFile:"<null>", hWnd, lpOperation ? lpOperation:"<null>", lpFile ? lpFile:"<null>",
lpParameters ? lpParameters : "<null>", lpParameters ? lpParameters : "<null>",
lpDirectory ? lpDirectory : "<null>", iShowCmd); lpDirectory ? lpDirectory : "<null>", iShowCmd);
...@@ -719,7 +721,7 @@ HICON ExtractIcon(HINSTANCE hInst, LPCSTR lpszExeFileName, UINT nIconIndex) ...@@ -719,7 +721,7 @@ HICON ExtractIcon(HINSTANCE hInst, LPCSTR lpszExeFileName, UINT nIconIndex)
{ {
HICON hIcon = 0; HICON hIcon = 0;
HINSTANCE hInst2 = hInst; HINSTANCE hInst2 = hInst;
dprintf_reg(stddeb, "ExtractIcon("NPFMT", '%s', %d\n", dprintf_reg(stddeb, "ExtractIcon(%04x, '%s', %d\n",
hInst, lpszExeFileName, nIconIndex); hInst, lpszExeFileName, nIconIndex);
return 0; return 0;
if (lpszExeFileName != NULL) { if (lpszExeFileName != NULL) {
......
...@@ -432,7 +432,7 @@ void SPY_EnterMessage( int iFlag, HWND hWnd, UINT msg, ...@@ -432,7 +432,7 @@ void SPY_EnterMessage( int iFlag, HWND hWnd, UINT msg,
switch(iFlag) switch(iFlag)
{ {
case SPY_DISPATCHMESSAGE: case SPY_DISPATCHMESSAGE:
dprintf_message(stddeb,"("NPFMT") message [%04x] %s dispatched wp=%04x lp=%08lx\n", dprintf_message(stddeb,"(%04x) message [%04x] %s dispatched wp=%04x lp=%08lx\n",
hWnd, msg, SPY_GetMsgName( msg ), hWnd, msg, SPY_GetMsgName( msg ),
wParam, lParam); wParam, lParam);
break; break;
...@@ -443,10 +443,10 @@ void SPY_EnterMessage( int iFlag, HWND hWnd, UINT msg, ...@@ -443,10 +443,10 @@ void SPY_EnterMessage( int iFlag, HWND hWnd, UINT msg,
HTASK hTask = GetWindowTask(hWnd); HTASK hTask = GetWindowTask(hWnd);
if (hTask == GetCurrentTask()) strcpy( taskName, "self" ); if (hTask == GetCurrentTask()) strcpy( taskName, "self" );
else if (!hTask) strcpy( taskName, "Wine" ); else if (!hTask) strcpy( taskName, "Wine" );
else sprintf( taskName, "task "NPFMT" %s", else sprintf( taskName, "task %04x %s",
hTask, MODULE_GetModuleName( GetExePtr(hTask) ) ); hTask, MODULE_GetModuleName( GetExePtr(hTask) ) );
dprintf_message(stddeb,"%*s("NPFMT") message [%04x] %s sent from %s wp=%04x lp=%08lx\n", dprintf_message(stddeb,"%*s(%04x) message [%04x] %s sent from %s wp=%04x lp=%08lx\n",
SPY_IndentLevel, "", hWnd, msg, SPY_IndentLevel, "", hWnd, msg,
SPY_GetMsgName( msg ), taskName, wParam, lParam ); SPY_GetMsgName( msg ), taskName, wParam, lParam );
SPY_IndentLevel += SPY_INDENT_UNIT; SPY_IndentLevel += SPY_INDENT_UNIT;
...@@ -454,7 +454,7 @@ void SPY_EnterMessage( int iFlag, HWND hWnd, UINT msg, ...@@ -454,7 +454,7 @@ void SPY_EnterMessage( int iFlag, HWND hWnd, UINT msg,
break; break;
case SPY_DEFWNDPROC: case SPY_DEFWNDPROC:
dprintf_message(stddeb, "%*s("NPFMT") DefWindowProc: %s [%04x] wp=%04x lp=%08lx\n", dprintf_message(stddeb, "%*s(%04x) DefWindowProc: %s [%04x] wp=%04x lp=%08lx\n",
SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ), SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ),
msg, wParam, lParam ); msg, wParam, lParam );
break; break;
...@@ -473,12 +473,12 @@ void SPY_ExitMessage( int iFlag, HWND hWnd, UINT msg, LRESULT lReturn ) ...@@ -473,12 +473,12 @@ void SPY_ExitMessage( int iFlag, HWND hWnd, UINT msg, LRESULT lReturn )
switch(iFlag) switch(iFlag)
{ {
case SPY_RESULT_INVALIDHWND: case SPY_RESULT_INVALIDHWND:
dprintf_message(stddeb,"%*s("NPFMT") message [%04x] %s HAS INVALID HWND\n", dprintf_message(stddeb,"%*s(%04x) message [%04x] %s HAS INVALID HWND\n",
SPY_IndentLevel, "", hWnd, msg, SPY_IndentLevel, "", hWnd, msg,
SPY_GetMsgName( msg ) ); SPY_GetMsgName( msg ) );
break; break;
case SPY_RESULT_OK: case SPY_RESULT_OK:
dprintf_message(stddeb,"%*s("NPFMT") message [%04x] %s returned %08lx\n", dprintf_message(stddeb,"%*s(%04x) message [%04x] %s returned %08lx\n",
SPY_IndentLevel, "", hWnd, msg, SPY_IndentLevel, "", hWnd, msg,
SPY_GetMsgName( msg ), lReturn ); SPY_GetMsgName( msg ), lReturn );
break; break;
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
* Copyright 1995 Alexandre Julliard * Copyright 1995 Alexandre Julliard
*/ */
#include <sys/types.h>
#include "windows.h" #include "windows.h"
#include "drive.h" #include "drive.h"
#include "miscemu.h" #include "miscemu.h"
......
...@@ -24,6 +24,12 @@ ...@@ -24,6 +24,12 @@
#include "debug.h" #include "debug.h"
#include "xmalloc.h" #include "xmalloc.h"
#ifdef WINELIB32
#define UIFMT "%u"
#else
#define UIFMT "%hu"
#endif
extern MCI_OPEN_DRIVER_PARMS mciDrv[MAXMCIDRIVERS]; extern MCI_OPEN_DRIVER_PARMS mciDrv[MAXMCIDRIVERS];
/* FIXME: I need to remember the aliasname of a spec. driver. /* FIXME: I need to remember the aliasname of a spec. driver.
......
...@@ -1066,11 +1066,11 @@ BOOL BITBLT_InternalStretchBlt( DC *dcDst, short xDst, short yDst, ...@@ -1066,11 +1066,11 @@ BOOL BITBLT_InternalStretchBlt( DC *dcDst, short xDst, short yDst,
dcSrc, xSrc, ySrc, widthSrc, heightSrc, dcSrc, xSrc, ySrc, widthSrc, heightSrc,
&visRectSrc, &visRectDst )) &visRectSrc, &visRectDst ))
return TRUE; return TRUE;
dprintf_bitblt( stddeb, " vissrc=%ld,%ld-%ld,%ld visdst=%ld,%ld-%ld,%ld\n", dprintf_bitblt( stddeb, " vissrc=%d,%d-%d,%d visdst=%d,%d-%d,%d\n",
(LONG)visRectSrc.left, (LONG)visRectSrc.top, visRectSrc.left, visRectSrc.top,
(LONG)visRectSrc.right, (LONG)visRectSrc.bottom, visRectSrc.right, visRectSrc.bottom,
(LONG)visRectDst.left, (LONG)visRectDst.top, visRectDst.left, visRectDst.top,
(LONG)visRectDst.right, (LONG)visRectDst.bottom ); visRectDst.right, visRectDst.bottom );
} }
else else
{ {
...@@ -1078,9 +1078,9 @@ BOOL BITBLT_InternalStretchBlt( DC *dcDst, short xDst, short yDst, ...@@ -1078,9 +1078,9 @@ BOOL BITBLT_InternalStretchBlt( DC *dcDst, short xDst, short yDst,
if (!BITBLT_GetVisRectangles( dcDst, xDst, yDst, widthDst, heightDst, if (!BITBLT_GetVisRectangles( dcDst, xDst, yDst, widthDst, heightDst,
NULL, 0, 0, 0, 0, NULL, &visRectDst )) NULL, 0, 0, 0, 0, NULL, &visRectDst ))
return TRUE; return TRUE;
dprintf_bitblt( stddeb, " vissrc=none visdst=%ld,%ld-%ld,%ld\n", dprintf_bitblt( stddeb, " vissrc=none visdst=%d,%d-%d,%d\n",
(LONG)visRectDst.left, (LONG)visRectDst.top, visRectDst.left, visRectDst.top,
(LONG)visRectDst.right, (LONG)visRectDst.bottom ); visRectDst.right, visRectDst.bottom );
} }
width = visRectDst.right - visRectDst.left; width = visRectDst.right - visRectDst.left;
...@@ -1239,8 +1239,8 @@ BOOL PatBlt( HDC hdc, short left, short top, ...@@ -1239,8 +1239,8 @@ BOOL PatBlt( HDC hdc, short left, short top,
return TRUE; return TRUE;
} }
dprintf_bitblt(stddeb, "PatBlt: "NPFMT" %d,%d %dx%d %06lx\n", dprintf_bitblt(stddeb, "PatBlt: %04x %d,%d %dx%d %06lx\n",
hdc, left, top, width, height, rop ); hdc, left, top, width, height, rop );
return CallTo32_LargeStack( (int(*)())BITBLT_InternalStretchBlt, 11, return CallTo32_LargeStack( (int(*)())BITBLT_InternalStretchBlt, 11,
dc, left, top, width, height, dc, left, top, width, height,
...@@ -1266,7 +1266,7 @@ BOOL BitBlt( HDC hdcDst, INT xDst, INT yDst, INT width, INT height, ...@@ -1266,7 +1266,7 @@ BOOL BitBlt( HDC hdcDst, INT xDst, INT yDst, INT width, INT height,
dcSrc = (DC *) GDI_GetObjPtr( hdcSrc, DC_MAGIC ); dcSrc = (DC *) GDI_GetObjPtr( hdcSrc, DC_MAGIC );
dprintf_bitblt(stddeb, dprintf_bitblt(stddeb,
"BitBlt: "NPFMT" %d,%d %d bpp -> "NPFMT" %d,%d %dx%dx%d rop=%06lx\n", "BitBlt: %04x %d,%d %d bpp -> %04x %d,%d %dx%dx%d rop=%06lx\n",
hdcSrc, xSrc, ySrc, dcSrc ? dcSrc->w.bitsPerPixel : 0, hdcSrc, xSrc, ySrc, dcSrc ? dcSrc->w.bitsPerPixel : 0,
hdcDst, xDst, yDst, width, height, dcDst->w.bitsPerPixel, rop); hdcDst, xDst, yDst, width, height, dcDst->w.bitsPerPixel, rop);
...@@ -1296,7 +1296,7 @@ BOOL StretchBlt( HDC hdcDst, short xDst, short yDst, ...@@ -1296,7 +1296,7 @@ BOOL StretchBlt( HDC hdcDst, short xDst, short yDst,
dcSrc = (DC *) GDI_GetObjPtr( hdcSrc, DC_MAGIC ); dcSrc = (DC *) GDI_GetObjPtr( hdcSrc, DC_MAGIC );
dprintf_bitblt(stddeb, dprintf_bitblt(stddeb,
"StretchBlt: "NPFMT" %d,%d %dx%dx%d -> "NPFMT" %d,%d %dx%dx%d rop=%06lx\n", "StretchBlt: %04x %d,%d %dx%dx%d -> %04x %d,%d %dx%dx%d rop=%06lx\n",
hdcSrc, xSrc, ySrc, widthSrc, heightSrc, hdcSrc, xSrc, ySrc, widthSrc, heightSrc,
dcSrc ? dcSrc->w.bitsPerPixel : 0, hdcDst, xDst, yDst, dcSrc ? dcSrc->w.bitsPerPixel : 0, hdcDst, xDst, yDst,
widthDst, heightDst, dcDst->w.bitsPerPixel, rop ); widthDst, heightDst, dcDst->w.bitsPerPixel, rop );
......
...@@ -123,7 +123,7 @@ HBITMAP CreateBitmap( INT width, INT height, UINT planes, UINT bpp, LPVOID bits ...@@ -123,7 +123,7 @@ HBITMAP CreateBitmap( INT width, INT height, UINT planes, UINT bpp, LPVOID bits
HBITMAP CreateCompatibleBitmap( HDC hdc, INT width, INT height ) HBITMAP CreateCompatibleBitmap( HDC hdc, INT width, INT height )
{ {
DC * dc; DC * dc;
dprintf_gdi(stddeb, "CreateCompatibleBitmap: "NPFMT" %dx%d\n", dprintf_gdi(stddeb, "CreateCompatibleBitmap: %04x %dx%d\n",
hdc, width, height ); hdc, width, height );
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0; if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0;
return CreateBitmap( width, height, 1, dc->w.bitsPerPixel, NULL ); return CreateBitmap( width, height, 1, dc->w.bitsPerPixel, NULL );
...@@ -225,11 +225,11 @@ HBITMAP LoadBitmap( HANDLE instance, SEGPTR name ) ...@@ -225,11 +225,11 @@ HBITMAP LoadBitmap( HANDLE instance, SEGPTR name )
if (HIWORD(name)) if (HIWORD(name))
{ {
char *str = (char *)PTR_SEG_TO_LIN( name ); char *str = (char *)PTR_SEG_TO_LIN( name );
dprintf_bitmap( stddeb, "LoadBitmap("NPFMT",'%s')\n", instance, str ); dprintf_bitmap( stddeb, "LoadBitmap(%04x,'%s')\n", instance, str );
if (str[0] == '#') name = (SEGPTR)(DWORD)(WORD)atoi( str + 1 ); if (str[0] == '#') name = (SEGPTR)(DWORD)(WORD)atoi( str + 1 );
} }
else else
dprintf_bitmap( stddeb, "LoadBitmap("NPFMT",%04x)\n", dprintf_bitmap( stddeb, "LoadBitmap(%04x,%04x)\n",
instance, LOWORD(name) ); instance, LOWORD(name) );
if (!instance) /* OEM bitmap */ if (!instance) /* OEM bitmap */
...@@ -311,7 +311,7 @@ HBITMAP BITMAP_SelectObject( HDC hdc, DC * dc, HBITMAP hbitmap, ...@@ -311,7 +311,7 @@ HBITMAP BITMAP_SelectObject( HDC hdc, DC * dc, HBITMAP hbitmap,
*/ */
HBITMAP CreateDiscardableBitmap(HDC hdc, INT width, INT height) HBITMAP CreateDiscardableBitmap(HDC hdc, INT width, INT height)
{ {
dprintf_bitmap(stddeb,"CreateDiscardableBitmap("NPFMT", %d, %d); " dprintf_bitmap(stddeb,"CreateDiscardableBitmap(%04x, %d, %d); "
"// call CreateCompatibleBitmap() for now!\n", "// call CreateCompatibleBitmap() for now!\n",
hdc, width, height); hdc, width, height);
return CreateCompatibleBitmap(hdc, width, height); return CreateCompatibleBitmap(hdc, width, height);
......
...@@ -172,17 +172,13 @@ HBRUSH CreatePatternBrush( HBITMAP hbitmap ) ...@@ -172,17 +172,13 @@ HBRUSH CreatePatternBrush( HBITMAP hbitmap )
LOGBRUSH logbrush = { BS_PATTERN, 0, 0 }; LOGBRUSH logbrush = { BS_PATTERN, 0, 0 };
BITMAPOBJ *bmp, *newbmp; BITMAPOBJ *bmp, *newbmp;
dprintf_gdi(stddeb, "CreatePatternBrush: "NPFMT"\n", hbitmap ); dprintf_gdi(stddeb, "CreatePatternBrush: %04x\n", hbitmap );
/* Make a copy of the bitmap */ /* Make a copy of the bitmap */
if (!(bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC ))) if (!(bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC )))
return 0; return 0;
#ifdef WINELIB32
logbrush.lbHatch = (LONG)CreateBitmapIndirect( &bmp->bitmap );
#else
logbrush.lbHatch = (INT)CreateBitmapIndirect( &bmp->bitmap ); logbrush.lbHatch = (INT)CreateBitmapIndirect( &bmp->bitmap );
#endif
newbmp = (BITMAPOBJ *) GDI_GetObjPtr( (HANDLE)logbrush.lbHatch, BITMAP_MAGIC ); newbmp = (BITMAPOBJ *) GDI_GetObjPtr( (HANDLE)logbrush.lbHatch, BITMAP_MAGIC );
if (!newbmp) return 0; if (!newbmp) return 0;
XCopyArea( display, bmp->pixmap, newbmp->pixmap, BITMAP_GC(bmp), XCopyArea( display, bmp->pixmap, newbmp->pixmap, BITMAP_GC(bmp),
...@@ -200,7 +196,7 @@ HBRUSH CreateDIBPatternBrush( HGLOBAL hbitmap, UINT coloruse ) ...@@ -200,7 +196,7 @@ HBRUSH CreateDIBPatternBrush( HGLOBAL hbitmap, UINT coloruse )
BITMAPINFO *info, *newInfo; BITMAPINFO *info, *newInfo;
int size; int size;
dprintf_gdi(stddeb, "CreateDIBPatternBrush: "NPFMT"\n", hbitmap ); dprintf_gdi(stddeb, "CreateDIBPatternBrush: %04x\n", hbitmap );
/* Make a copy of the bitmap */ /* Make a copy of the bitmap */
...@@ -212,11 +208,7 @@ HBRUSH CreateDIBPatternBrush( HGLOBAL hbitmap, UINT coloruse ) ...@@ -212,11 +208,7 @@ HBRUSH CreateDIBPatternBrush( HGLOBAL hbitmap, UINT coloruse )
* 8 * info->bmiHeader.biHeight; * 8 * info->bmiHeader.biHeight;
size += DIB_BitmapInfoSize( info, coloruse ); size += DIB_BitmapInfoSize( info, coloruse );
#ifdef WINELIB32
if (!(logbrush.lbHatch = (LONG)GlobalAlloc( GMEM_MOVEABLE, size )))
#else
if (!(logbrush.lbHatch = (INT)GlobalAlloc( GMEM_MOVEABLE, size ))) if (!(logbrush.lbHatch = (INT)GlobalAlloc( GMEM_MOVEABLE, size )))
#endif
{ {
GlobalUnlock( hbitmap ); GlobalUnlock( hbitmap );
return 0; return 0;
...@@ -348,8 +340,8 @@ HBRUSH BRUSH_SelectObject( HDC hdc, DC * dc, HBRUSH hbrush, BRUSHOBJ * brush ) ...@@ -348,8 +340,8 @@ HBRUSH BRUSH_SelectObject( HDC hdc, DC * dc, HBRUSH hbrush, BRUSHOBJ * brush )
BITMAPINFO * bmpInfo; BITMAPINFO * bmpInfo;
HBRUSH prevHandle = dc->w.hBrush; HBRUSH prevHandle = dc->w.hBrush;
dprintf_gdi(stddeb, "Brush_SelectObject hdc="NPFMT" hbrush="NPFMT"\n", dprintf_gdi(stddeb, "Brush_SelectObject: hdc=%04x hbrush=%04x\n",
hdc,hbrush); hdc,hbrush);
if (dc->header.wMagic == METAFILE_DC_MAGIC) if (dc->header.wMagic == METAFILE_DC_MAGIC)
{ {
switch (brush->logbrush.lbStyle) switch (brush->logbrush.lbStyle)
......
...@@ -67,7 +67,7 @@ int SelectClipRgn( HDC hdc, HRGN hrgn ) ...@@ -67,7 +67,7 @@ int SelectClipRgn( HDC hdc, HRGN hrgn )
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR; if (!dc) return ERROR;
dprintf_clipping(stddeb, "SelectClipRgn: "NPFMT" "NPFMT"\n", hdc, hrgn ); dprintf_clipping(stddeb, "SelectClipRgn: %04x %04x\n", hdc, hrgn );
if (hrgn) if (hrgn)
{ {
...@@ -94,7 +94,7 @@ int SelectVisRgn( HDC hdc, HRGN hrgn ) ...@@ -94,7 +94,7 @@ int SelectVisRgn( HDC hdc, HRGN hrgn )
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc || !hrgn) return ERROR; if (!dc || !hrgn) return ERROR;
dprintf_clipping(stddeb, "SelectVisRgn: "NPFMT" "NPFMT"\n", hdc, hrgn ); dprintf_clipping(stddeb, "SelectVisRgn: %04x %04x\n", hdc, hrgn );
retval = CombineRgn( dc->w.hVisRgn, hrgn, 0, RGN_COPY ); retval = CombineRgn( dc->w.hVisRgn, hrgn, 0, RGN_COPY );
CLIPPING_UpdateGCRegion( dc ); CLIPPING_UpdateGCRegion( dc );
...@@ -116,7 +116,7 @@ int OffsetClipRgn( HDC hdc, short x, short y ) ...@@ -116,7 +116,7 @@ int OffsetClipRgn( HDC hdc, short x, short y )
return NULLREGION; /* ?? */ return NULLREGION; /* ?? */
} }
dprintf_clipping(stddeb, "OffsetClipRgn: "NPFMT" %d,%d\n", hdc, x, y ); dprintf_clipping(stddeb, "OffsetClipRgn: %04x %d,%d\n", hdc, x, y );
if (dc->w.hClipRgn) if (dc->w.hClipRgn)
{ {
...@@ -136,7 +136,7 @@ int OffsetVisRgn( HDC hdc, short x, short y ) ...@@ -136,7 +136,7 @@ int OffsetVisRgn( HDC hdc, short x, short y )
int retval; int retval;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR; if (!dc) return ERROR;
dprintf_clipping(stddeb, "OffsetVisRgn: "NPFMT" %d,%d\n", hdc, x, y ); dprintf_clipping(stddeb, "OffsetVisRgn: %04x %d,%d\n", hdc, x, y );
retval = OffsetRgn( dc->w.hVisRgn, x, y ); retval = OffsetRgn( dc->w.hVisRgn, x, y );
CLIPPING_UpdateGCRegion( dc ); CLIPPING_UpdateGCRegion( dc );
return retval; return retval;
...@@ -195,7 +195,7 @@ int ExcludeClipRect( HDC hdc, short left, short top, ...@@ -195,7 +195,7 @@ int ExcludeClipRect( HDC hdc, short left, short top,
return NULLREGION; /* ?? */ return NULLREGION; /* ?? */
} }
dprintf_clipping(stddeb, "ExcludeClipRect: "NPFMT" %dx%d,%dx%d\n", dprintf_clipping(stddeb, "ExcludeClipRect: %04x %dx%d,%dx%d\n",
hdc, left, top, right, bottom ); hdc, left, top, right, bottom );
return CLIPPING_IntersectClipRect( dc, left, top, right, bottom, TRUE ); return CLIPPING_IntersectClipRect( dc, left, top, right, bottom, TRUE );
} }
...@@ -216,7 +216,7 @@ int IntersectClipRect( HDC hdc, short left, short top, ...@@ -216,7 +216,7 @@ int IntersectClipRect( HDC hdc, short left, short top,
return NULLREGION; /* ?? */ return NULLREGION; /* ?? */
} }
dprintf_clipping(stddeb, "IntersectClipRect: "NPFMT" %dx%d,%dx%d\n", dprintf_clipping(stddeb, "IntersectClipRect: %04x %dx%d,%dx%d\n",
hdc, left, top, right, bottom ); hdc, left, top, right, bottom );
return CLIPPING_IntersectClipRect( dc, left, top, right, bottom, FALSE ); return CLIPPING_IntersectClipRect( dc, left, top, right, bottom, FALSE );
} }
...@@ -269,7 +269,7 @@ int ExcludeVisRect( HDC hdc, short left, short top, short right, short bottom ) ...@@ -269,7 +269,7 @@ int ExcludeVisRect( HDC hdc, short left, short top, short right, short bottom )
{ {
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR; if (!dc) return ERROR;
dprintf_clipping(stddeb, "ExcludeVisRect: "NPFMT" %dx%d,%dx%d\n", dprintf_clipping(stddeb, "ExcludeVisRect: %04x %dx%d,%dx%d\n",
hdc, left, top, right, bottom ); hdc, left, top, right, bottom );
return CLIPPING_IntersectVisRect( dc, left, top, right, bottom, TRUE ); return CLIPPING_IntersectVisRect( dc, left, top, right, bottom, TRUE );
} }
...@@ -283,7 +283,7 @@ int IntersectVisRect( HDC hdc, short left, short top, ...@@ -283,7 +283,7 @@ int IntersectVisRect( HDC hdc, short left, short top,
{ {
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR; if (!dc) return ERROR;
dprintf_clipping(stddeb, "IntersectVisRect: "NPFMT" %dx%d,%dx%d\n", dprintf_clipping(stddeb, "IntersectVisRect: %04x %dx%d,%dx%d\n",
hdc, left, top, right, bottom ); hdc, left, top, right, bottom );
return CLIPPING_IntersectVisRect( dc, left, top, right, bottom, FALSE ); return CLIPPING_IntersectVisRect( dc, left, top, right, bottom, FALSE );
} }
...@@ -297,7 +297,7 @@ BOOL PtVisible( HDC hdc, short x, short y ) ...@@ -297,7 +297,7 @@ BOOL PtVisible( HDC hdc, short x, short y )
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR; if (!dc) return ERROR;
dprintf_clipping(stddeb, "PtVisible: "NPFMT" %d,%d\n", hdc, x, y ); dprintf_clipping(stddeb, "PtVisible: %04x %d,%d\n", hdc, x, y );
if (!dc->w.hGCClipRgn) return FALSE; if (!dc->w.hGCClipRgn) return FALSE;
return PtInRegion( dc->w.hGCClipRgn, XLPTODP(dc,x), YLPTODP(dc,y) ); return PtInRegion( dc->w.hGCClipRgn, XLPTODP(dc,x), YLPTODP(dc,y) );
} }
...@@ -311,9 +311,8 @@ BOOL RectVisible( HDC hdc, LPRECT rect ) ...@@ -311,9 +311,8 @@ BOOL RectVisible( HDC hdc, LPRECT rect )
RECT tmpRect; RECT tmpRect;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return FALSE; if (!dc) return FALSE;
dprintf_clipping(stddeb,"RectVisible: "NPFMT" %ld,%ldx%ld,%ld\n", dprintf_clipping(stddeb,"RectVisible: %04x %d,%dx%d,%d\n",
hdc, (LONG)rect->left, (LONG)rect->top, (LONG)rect->right, hdc, rect->left, rect->top, rect->right, rect->bottom );
(LONG)rect->bottom );
if (!dc->w.hGCClipRgn) return FALSE; if (!dc->w.hGCClipRgn) return FALSE;
/* copy rectangle to avoid overwriting by LPtoDP */ /* copy rectangle to avoid overwriting by LPtoDP */
tmpRect = *rect; tmpRect = *rect;
...@@ -330,7 +329,7 @@ int GetClipBox( HDC hdc, LPRECT rect ) ...@@ -330,7 +329,7 @@ int GetClipBox( HDC hdc, LPRECT rect )
int ret; int ret;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR; if (!dc) return ERROR;
dprintf_clipping(stddeb, "GetClipBox: "NPFMT" %p\n", hdc, rect ); dprintf_clipping(stddeb, "GetClipBox: %04x %p\n", hdc, rect );
ret = GetRgnBox( dc->w.hGCClipRgn, rect ); ret = GetRgnBox( dc->w.hGCClipRgn, rect );
DPtoLP( hdc, (LPPOINT)rect, 2 ); DPtoLP( hdc, (LPPOINT)rect, 2 );
return ret; return ret;
...@@ -346,7 +345,7 @@ HRGN SaveVisRgn( HDC hdc ) ...@@ -346,7 +345,7 @@ HRGN SaveVisRgn( HDC hdc )
RGNOBJ *obj, *copyObj; RGNOBJ *obj, *copyObj;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return 0; if (!dc) return 0;
dprintf_clipping(stddeb, "SaveVisRgn: "NPFMT"\n", hdc ); dprintf_clipping(stddeb, "SaveVisRgn: %04x\n", hdc );
if (!dc->w.hVisRgn) if (!dc->w.hVisRgn)
{ {
fprintf( stderr, "SaveVisRgn: hVisRgn is zero. Please report this.\n" ); fprintf( stderr, "SaveVisRgn: hVisRgn is zero. Please report this.\n" );
...@@ -373,7 +372,7 @@ int RestoreVisRgn( HDC hdc ) ...@@ -373,7 +372,7 @@ int RestoreVisRgn( HDC hdc )
RGNOBJ *obj, *savedObj; RGNOBJ *obj, *savedObj;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc || !dc->w.hVisRgn) return ERROR; if (!dc || !dc->w.hVisRgn) return ERROR;
dprintf_clipping(stddeb, "RestoreVisRgn: "NPFMT"\n", hdc ); dprintf_clipping(stddeb, "RestoreVisRgn: %04x\n", hdc );
if (!(obj = (RGNOBJ *) GDI_GetObjPtr( dc->w.hVisRgn, REGION_MAGIC ))) if (!(obj = (RGNOBJ *) GDI_GetObjPtr( dc->w.hVisRgn, REGION_MAGIC )))
return ERROR; return ERROR;
if (!(saved = obj->header.hNext)) return ERROR; if (!(saved = obj->header.hNext)) return ERROR;
......
...@@ -340,7 +340,7 @@ static HANDLE CURSORICON_LoadHandler( HANDLE handle, HINSTANCE hInstance, ...@@ -340,7 +340,7 @@ static HANDLE CURSORICON_LoadHandler( HANDLE handle, HINSTANCE hInstance,
} }
/* Make it owned by the module */ /* Make it owned by the module */
if (hInstance) FarSetOwner( handle, (WORD)(DWORD)GetExePtr(hInstance) ); if (hInstance) FarSetOwner( handle, GetExePtr(hInstance) );
info = (CURSORICONINFO *)GlobalLock( handle ); info = (CURSORICONINFO *)GlobalLock( handle );
info->ptHotSpot.x = hotspot.x; info->ptHotSpot.x = hotspot.x;
...@@ -417,7 +417,7 @@ static HANDLE CURSORICON_Copy( HANDLE hInstance, HANDLE handle ) ...@@ -417,7 +417,7 @@ static HANDLE CURSORICON_Copy( HANDLE hInstance, HANDLE handle )
if (!(hInstance = GetExePtr( hInstance ))) return 0; if (!(hInstance = GetExePtr( hInstance ))) return 0;
size = GlobalSize( handle ); size = GlobalSize( handle );
hNew = GlobalAlloc( GMEM_MOVEABLE, size ); hNew = GlobalAlloc( GMEM_MOVEABLE, size );
FarSetOwner( hNew, (WORD)(DWORD)hInstance ); FarSetOwner( hNew, hInstance );
ptrNew = (char *)GlobalLock( hNew ); ptrNew = (char *)GlobalLock( hNew );
memcpy( ptrNew, ptrOld, size ); memcpy( ptrNew, ptrOld, size );
GlobalUnlock( handle ); GlobalUnlock( handle );
...@@ -466,10 +466,10 @@ HCURSOR CURSORICON_IconToCursor(HICON hIcon) ...@@ -466,10 +466,10 @@ HCURSOR CURSORICON_IconToCursor(HICON hIcon)
HCURSOR LoadCursor( HANDLE hInstance, SEGPTR name ) HCURSOR LoadCursor( HANDLE hInstance, SEGPTR name )
{ {
if (HIWORD(name)) if (HIWORD(name))
dprintf_cursor( stddeb, "LoadCursor: "NPFMT" '%s'\n", dprintf_cursor( stddeb, "LoadCursor: %04x '%s'\n",
hInstance, (char *)PTR_SEG_TO_LIN( name ) ); hInstance, (char *)PTR_SEG_TO_LIN( name ) );
else else
dprintf_cursor( stddeb, "LoadCursor: "NPFMT" %04x\n", dprintf_cursor( stddeb, "LoadCursor: %04x %04x\n",
hInstance, LOWORD(name) ); hInstance, LOWORD(name) );
return CURSORICON_Load( hInstance, name, return CURSORICON_Load( hInstance, name,
...@@ -483,10 +483,10 @@ HCURSOR LoadCursor( HANDLE hInstance, SEGPTR name ) ...@@ -483,10 +483,10 @@ HCURSOR LoadCursor( HANDLE hInstance, SEGPTR name )
HICON LoadIcon( HANDLE hInstance, SEGPTR name ) HICON LoadIcon( HANDLE hInstance, SEGPTR name )
{ {
if (HIWORD(name)) if (HIWORD(name))
dprintf_icon( stddeb, "LoadIcon: "NPFMT" '%s'\n", dprintf_icon( stddeb, "LoadIcon: %04x '%s'\n",
hInstance, (char *)PTR_SEG_TO_LIN( name ) ); hInstance, (char *)PTR_SEG_TO_LIN( name ) );
else else
dprintf_icon( stddeb, "LoadIcon: "NPFMT" %04x\n", dprintf_icon( stddeb, "LoadIcon: %04x %04x\n",
hInstance, LOWORD(name) ); hInstance, LOWORD(name) );
return CURSORICON_Load( hInstance, name, return CURSORICON_Load( hInstance, name,
...@@ -554,16 +554,16 @@ HANDLE CreateCursorIconIndirect( HANDLE hInstance, CURSORICONINFO *info, ...@@ -554,16 +554,16 @@ HANDLE CreateCursorIconIndirect( HANDLE hInstance, CURSORICONINFO *info,
/*********************************************************************** /***********************************************************************
* CopyIcon (USER.368) * CopyIcon (USER.368)
*/ */
#ifdef WINELIB32 #ifdef WINELIB
HICON CopyIcon( HICON hIcon ) HICON CopyIcon( HICON hIcon )
{ {
dprintf_icon( stddeb, "CopyIcon: "NPFMT"\n", hIcon ); dprintf_icon( stddeb, "CopyIcon: %04x\n", hIcon );
return CURSORICON_Copy( 0, hIcon ); return CURSORICON_Copy( 0, hIcon );
} }
#else #else
HICON CopyIcon( HANDLE hInstance, HICON hIcon ) HICON CopyIcon( HANDLE hInstance, HICON hIcon )
{ {
dprintf_icon( stddeb, "CopyIcon: "NPFMT" "NPFMT"\n", hInstance, hIcon ); dprintf_icon( stddeb, "CopyIcon: %04x %04x\n", hInstance, hIcon );
return CURSORICON_Copy( hInstance, hIcon ); return CURSORICON_Copy( hInstance, hIcon );
} }
#endif #endif
...@@ -572,16 +572,16 @@ HICON CopyIcon( HANDLE hInstance, HICON hIcon ) ...@@ -572,16 +572,16 @@ HICON CopyIcon( HANDLE hInstance, HICON hIcon )
/*********************************************************************** /***********************************************************************
* CopyCursor (USER.369) * CopyCursor (USER.369)
*/ */
#ifdef WINELIB32 #ifdef WINELIB
HCURSOR CopyCursor( HCURSOR hCursor ) HCURSOR CopyCursor( HCURSOR hCursor )
{ {
dprintf_cursor( stddeb, "CopyCursor: "NPFMT"\n", hCursor ); dprintf_cursor( stddeb, "CopyCursor: %04x\n", hCursor );
return CURSORICON_Copy( 0, hCursor ); return CURSORICON_Copy( 0, hCursor );
} }
#else #else
HCURSOR CopyCursor( HANDLE hInstance, HCURSOR hCursor ) HCURSOR CopyCursor( HANDLE hInstance, HCURSOR hCursor )
{ {
dprintf_cursor( stddeb, "CopyCursor: "NPFMT" "NPFMT"\n", hInstance, hCursor ); dprintf_cursor( stddeb, "CopyCursor: %04x %04x\n", hInstance, hCursor );
return CURSORICON_Copy( hInstance, hCursor ); return CURSORICON_Copy( hInstance, hCursor );
} }
#endif #endif
...@@ -592,7 +592,7 @@ HCURSOR CopyCursor( HANDLE hInstance, HCURSOR hCursor ) ...@@ -592,7 +592,7 @@ HCURSOR CopyCursor( HANDLE hInstance, HCURSOR hCursor )
*/ */
BOOL DestroyIcon( HICON hIcon ) BOOL DestroyIcon( HICON hIcon )
{ {
dprintf_icon( stddeb, "DestroyIcon: "NPFMT"\n", hIcon ); dprintf_icon( stddeb, "DestroyIcon: %04x\n", hIcon );
/* FIXME: should check for OEM icon here */ /* FIXME: should check for OEM icon here */
return (GlobalFree( hIcon ) != 0); return (GlobalFree( hIcon ) != 0);
} }
...@@ -603,7 +603,7 @@ BOOL DestroyIcon( HICON hIcon ) ...@@ -603,7 +603,7 @@ BOOL DestroyIcon( HICON hIcon )
*/ */
BOOL DestroyCursor( HCURSOR hCursor ) BOOL DestroyCursor( HCURSOR hCursor )
{ {
dprintf_cursor( stddeb, "DestroyCursor: "NPFMT"\n", hCursor ); dprintf_cursor( stddeb, "DestroyCursor: %04x\n", hCursor );
/* FIXME: should check for OEM cursor here */ /* FIXME: should check for OEM cursor here */
return (GlobalFree( hCursor ) != 0); return (GlobalFree( hCursor ) != 0);
} }
...@@ -697,7 +697,7 @@ static BOOL CURSORICON_SetCursor( HCURSOR hCursor ) ...@@ -697,7 +697,7 @@ static BOOL CURSORICON_SetCursor( HCURSOR hCursor )
if (!(ptr = (CURSORICONINFO*)GlobalLock( hCursor ))) return FALSE; if (!(ptr = (CURSORICONINFO*)GlobalLock( hCursor ))) return FALSE;
if (ptr->bPlanes * ptr->bBitsPerPixel != 1) if (ptr->bPlanes * ptr->bBitsPerPixel != 1)
{ {
fprintf( stderr, "Cursor "NPFMT" has more than 1 bpp!\n", hCursor ); fprintf( stderr, "Cursor %04x has more than 1 bpp!\n", hCursor );
return FALSE; return FALSE;
} }
...@@ -813,7 +813,7 @@ HCURSOR SetCursor( HCURSOR hCursor ) ...@@ -813,7 +813,7 @@ HCURSOR SetCursor( HCURSOR hCursor )
HCURSOR hOldCursor; HCURSOR hOldCursor;
if (hCursor == hActiveCursor) return hActiveCursor; /* No change */ if (hCursor == hActiveCursor) return hActiveCursor; /* No change */
dprintf_cursor( stddeb, "SetCursor: "NPFMT"\n", hCursor ); dprintf_cursor( stddeb, "SetCursor: %04x\n", hCursor );
hOldCursor = hActiveCursor; hOldCursor = hActiveCursor;
hActiveCursor = hCursor; hActiveCursor = hCursor;
/* Change the cursor shape only if it is visible */ /* Change the cursor shape only if it is visible */
...@@ -892,8 +892,7 @@ void GetCursorPos( POINT *pt ) ...@@ -892,8 +892,7 @@ void GetCursorPos( POINT *pt )
pt->x = rootX + desktopX; pt->x = rootX + desktopX;
pt->y = rootY + desktopY; pt->y = rootY + desktopY;
} }
dprintf_cursor(stddeb, "GetCursorPos: ret=%ld,%ld\n", (LONG)pt->x, dprintf_cursor(stddeb, "GetCursorPos: ret=%d,%d\n", pt->x, pt->y );
(LONG)pt->y );
} }
...@@ -920,7 +919,7 @@ WORD GetIconID( HANDLE hResource, DWORD resType ) ...@@ -920,7 +919,7 @@ WORD GetIconID( HANDLE hResource, DWORD resType )
return 0; return 0;
} }
dprintf_cursor( stddeb, "GetIconID: hRes="NPFMT", entries=%i\n", dprintf_cursor( stddeb, "GetIconID: hRes=%04x, entries=%i\n",
hResource, lpDir->idCount ); hResource, lpDir->idCount );
switch(resType) switch(resType)
...@@ -949,7 +948,7 @@ WORD GetIconID( HANDLE hResource, DWORD resType ) ...@@ -949,7 +948,7 @@ WORD GetIconID( HANDLE hResource, DWORD resType )
*/ */
HICON LoadIconHandler( HANDLE hResource, BOOL bNew ) HICON LoadIconHandler( HANDLE hResource, BOOL bNew )
{ {
dprintf_cursor(stddeb,"LoadIconHandler: hRes="NPFMT"\n",hResource); dprintf_cursor(stddeb,"LoadIconHandler: hRes=%04x\n",hResource);
if( !bNew ) if( !bNew )
{ {
......
...@@ -333,7 +333,7 @@ HDC GetDCState( HDC hdc ) ...@@ -333,7 +333,7 @@ HDC GetDCState( HDC hdc )
if (!(handle = GDI_AllocObject( sizeof(DC), DC_MAGIC ))) return 0; if (!(handle = GDI_AllocObject( sizeof(DC), DC_MAGIC ))) return 0;
newdc = (DC *) GDI_HEAP_LIN_ADDR( handle ); newdc = (DC *) GDI_HEAP_LIN_ADDR( handle );
dprintf_dc(stddeb, "GetDCState("NPFMT"): returning "NPFMT"\n", hdc, handle ); dprintf_dc(stddeb, "GetDCState(%04x): returning %04x\n", hdc, handle );
memset( &newdc->u.x, 0, sizeof(newdc->u.x) ); memset( &newdc->u.x, 0, sizeof(newdc->u.x) );
memcpy( &newdc->w, &dc->w, sizeof(dc->w) ); memcpy( &newdc->w, &dc->w, sizeof(dc->w) );
...@@ -366,7 +366,7 @@ void SetDCState( HDC hdc, HDC hdcs ) ...@@ -366,7 +366,7 @@ void SetDCState( HDC hdc, HDC hdcs )
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return; if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return;
if (!(dcs = (DC *) GDI_GetObjPtr( hdcs, DC_MAGIC ))) return; if (!(dcs = (DC *) GDI_GetObjPtr( hdcs, DC_MAGIC ))) return;
if (!dcs->w.flags & DC_SAVED) return; if (!dcs->w.flags & DC_SAVED) return;
dprintf_dc(stddeb, "SetDCState: "NPFMT" "NPFMT"\n", hdc, hdcs ); dprintf_dc(stddeb, "SetDCState: %04x %04x\n", hdc, hdcs );
/* Save the regions before overwriting everything */ /* Save the regions before overwriting everything */
hVisRgn = dc->w.hVisRgn; hVisRgn = dc->w.hVisRgn;
...@@ -410,7 +410,7 @@ int SaveDC( HDC hdc ) ...@@ -410,7 +410,7 @@ int SaveDC( HDC hdc )
dcs = (DC *) GDI_HEAP_LIN_ADDR( hdcs ); dcs = (DC *) GDI_HEAP_LIN_ADDR( hdcs );
dcs->header.hNext = dc->header.hNext; dcs->header.hNext = dc->header.hNext;
dc->header.hNext = hdcs; dc->header.hNext = hdcs;
dprintf_dc(stddeb, "SaveDC("NPFMT"): returning %d\n", hdc, dc->saveLevel+1 ); dprintf_dc(stddeb, "SaveDC(%04x): returning %d\n", hdc, dc->saveLevel+1 );
return ++dc->saveLevel; return ++dc->saveLevel;
} }
...@@ -422,7 +422,7 @@ BOOL RestoreDC( HDC hdc, short level ) ...@@ -422,7 +422,7 @@ BOOL RestoreDC( HDC hdc, short level )
{ {
DC * dc, * dcs; DC * dc, * dcs;
dprintf_dc(stddeb, "RestoreDC: "NPFMT" %d\n", hdc, level ); dprintf_dc(stddeb, "RestoreDC: %04x %d\n", hdc, level );
dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) if (!dc)
{ {
...@@ -459,7 +459,7 @@ HDC CreateDC( LPCTSTR driver, LPCTSTR device, LPCTSTR output, const DEVMODE* ini ...@@ -459,7 +459,7 @@ HDC CreateDC( LPCTSTR driver, LPCTSTR device, LPCTSTR output, const DEVMODE* ini
if (!handle) return 0; if (!handle) return 0;
dc = (DC *) GDI_HEAP_LIN_ADDR( handle ); dc = (DC *) GDI_HEAP_LIN_ADDR( handle );
dprintf_dc(stddeb, "CreateDC(%s %s %s): returning "NPFMT"\n", dprintf_dc(stddeb, "CreateDC(%s %s %s): returning %04x\n",
driver, device, output, handle ); driver, device, output, handle );
if (!displayDevCaps) if (!displayDevCaps)
...@@ -515,7 +515,7 @@ HDC CreateCompatibleDC( HDC hdc ) ...@@ -515,7 +515,7 @@ HDC CreateCompatibleDC( HDC hdc )
if (!handle) return 0; if (!handle) return 0;
dc = (DC *) GDI_HEAP_LIN_ADDR( handle ); dc = (DC *) GDI_HEAP_LIN_ADDR( handle );
dprintf_dc(stddeb, "CreateCompatibleDC("NPFMT"): returning "NPFMT"\n", hdc, handle ); dprintf_dc(stddeb, "CreateCompatibleDC(%04x): returning %04x\n", hdc, handle );
/* Create default bitmap */ /* Create default bitmap */
if (!(hbitmap = CreateBitmap( 1, 1, 1, 1, NULL ))) if (!(hbitmap = CreateBitmap( 1, 1, 1, 1, NULL )))
...@@ -559,7 +559,7 @@ BOOL DeleteDC( HDC hdc ) ...@@ -559,7 +559,7 @@ BOOL DeleteDC( HDC hdc )
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return FALSE; if (!dc) return FALSE;
dprintf_dc(stddeb, "DeleteDC: "NPFMT"\n", hdc ); dprintf_dc(stddeb, "DeleteDC: %04x\n", hdc );
while (dc->saveLevel) while (dc->saveLevel)
{ {
...@@ -608,7 +608,7 @@ int GetDeviceCaps( HDC hdc, WORD cap ) ...@@ -608,7 +608,7 @@ int GetDeviceCaps( HDC hdc, WORD cap )
if (cap > sizeof(DeviceCaps)-sizeof(WORD)) return 0; if (cap > sizeof(DeviceCaps)-sizeof(WORD)) return 0;
dprintf_dc(stddeb, "GetDeviceCaps("NPFMT",%d): returning %d\n", dprintf_dc(stddeb, "GetDeviceCaps(%04x,%d): returning %d\n",
hdc, cap, *(WORD *)(((char *)dc->w.devCaps) + cap) ); hdc, cap, *(WORD *)(((char *)dc->w.devCaps) + cap) );
return *(WORD *)(((char *)dc->w.devCaps) + cap); return *(WORD *)(((char *)dc->w.devCaps) + cap);
} }
......
...@@ -283,7 +283,7 @@ void FONT_GetMetrics( LOGFONT * logfont, XFontStruct * xfont, ...@@ -283,7 +283,7 @@ void FONT_GetMetrics( LOGFONT * logfont, XFontStruct * xfont,
DWORD GetGlyphOutLine(HDC hdc, UINT uChar, UINT fuFormat, LPGLYPHMETRICS lpgm, DWORD GetGlyphOutLine(HDC hdc, UINT uChar, UINT fuFormat, LPGLYPHMETRICS lpgm,
DWORD cbBuffer, LPSTR lpBuffer, LPMAT2 lpmat2) DWORD cbBuffer, LPSTR lpBuffer, LPMAT2 lpmat2)
{ {
fprintf( stdnimp,"GetGlyphOutLine("NPFMT", '%c', %04x, %p, %ld, %p, %p) // - empty stub!\n", fprintf( stdnimp,"GetGlyphOutLine(%04x, '%c', %04x, %p, %ld, %p, %p) // - empty stub!\n",
hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 ); hdc, uChar, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2 );
return (DWORD)-1; /* failure */ return (DWORD)-1; /* failure */
} }
...@@ -323,7 +323,7 @@ HFONT CreateFontIndirect( const LOGFONT * font ) ...@@ -323,7 +323,7 @@ HFONT CreateFontIndirect( const LOGFONT * font )
fontPtr = (FONTOBJ *) GDI_HEAP_LIN_ADDR( hfont ); fontPtr = (FONTOBJ *) GDI_HEAP_LIN_ADDR( hfont );
memcpy( &fontPtr->logfont, font, sizeof(LOGFONT) ); memcpy( &fontPtr->logfont, font, sizeof(LOGFONT) );
AnsiLower( fontPtr->logfont.lfFaceName ); AnsiLower( fontPtr->logfont.lfFaceName );
dprintf_font(stddeb,"CreateFontIndirect(%p (%d,%d)); return "NPFMT"\n", dprintf_font(stddeb,"CreateFontIndirect(%p (%d,%d)); return %04x\n",
font, font->lfHeight, font->lfWidth, hfont); font, font->lfHeight, font->lfWidth, hfont);
return hfont; return hfont;
} }
...@@ -370,8 +370,7 @@ HFONT FONT_SelectObject( DC * dc, HFONT hfont, FONTOBJ * font ) ...@@ -370,8 +370,7 @@ HFONT FONT_SelectObject( DC * dc, HFONT hfont, FONTOBJ * font )
X_PHYSFONT * stockPtr; X_PHYSFONT * stockPtr;
HFONT prevHandle = dc->w.hFont; HFONT prevHandle = dc->w.hFont;
XFontStruct * fontStruct; XFontStruct * fontStruct;
dprintf_font(stddeb,"FONT_SelectObject(%p, "NPFMT", %p)\n", dprintf_font(stddeb,"FONT_SelectObject(%p, %04x, %p)\n", dc, hfont, font);
dc, hfont, font);
#if 0 /* From the code in SelectObject, this can not happen */ #if 0 /* From the code in SelectObject, this can not happen */
/* Load font if necessary */ /* Load font if necessary */
...@@ -392,9 +391,8 @@ HFONT FONT_SelectObject( DC * dc, HFONT hfont, FONTOBJ * font ) ...@@ -392,9 +391,8 @@ HFONT FONT_SelectObject( DC * dc, HFONT hfont, FONTOBJ * font )
else else
return 0; return 0;
/* Must be DWORD for WINELIB32 support */
if ((hfont >= FIRST_STOCK_FONT) && (hfont <= LAST_STOCK_FONT)) if ((hfont >= FIRST_STOCK_FONT) && (hfont <= LAST_STOCK_FONT))
stockPtr = &stockFonts[(DWORD)hfont - (DWORD)FIRST_STOCK_FONT]; stockPtr = &stockFonts[hfont - FIRST_STOCK_FONT];
else else
stockPtr = NULL; stockPtr = NULL;
...@@ -405,7 +403,7 @@ HFONT FONT_SelectObject( DC * dc, HFONT hfont, FONTOBJ * font ) ...@@ -405,7 +403,7 @@ HFONT FONT_SelectObject( DC * dc, HFONT hfont, FONTOBJ * font )
/* If it is not a stock font, we can simply return 0 */ /* If it is not a stock font, we can simply return 0 */
if (!stockPtr) return 0; if (!stockPtr) return 0;
/* Otherwise we must try to find a substitute */ /* Otherwise we must try to find a substitute */
dprintf_font(stddeb,"Loading font 'fixed' for "NPFMT"\n", hfont ); dprintf_font(stddeb,"Loading font 'fixed' for %04x\n", hfont );
font->logfont.lfPitchAndFamily &= ~VARIABLE_PITCH; font->logfont.lfPitchAndFamily &= ~VARIABLE_PITCH;
font->logfont.lfPitchAndFamily |= FIXED_PITCH; font->logfont.lfPitchAndFamily |= FIXED_PITCH;
fontStruct = XLoadQueryFont( display, "fixed" ); fontStruct = XLoadQueryFont( display, "fixed" );
...@@ -420,7 +418,7 @@ HFONT FONT_SelectObject( DC * dc, HFONT hfont, FONTOBJ * font ) ...@@ -420,7 +418,7 @@ HFONT FONT_SelectObject( DC * dc, HFONT hfont, FONTOBJ * font )
{ {
fontStruct = stockPtr->fstruct; fontStruct = stockPtr->fstruct;
dprintf_font(stddeb, dprintf_font(stddeb,
"FONT_SelectObject: Loaded font from cache "NPFMT" %p\n", "FONT_SelectObject: Loaded font from cache %04x %p\n",
hfont, fontStruct ); hfont, fontStruct );
} }
...@@ -550,9 +548,8 @@ BOOL GetTextExtentPoint( HDC hdc, LPCSTR str, short count, LPSIZE size ) ...@@ -550,9 +548,8 @@ BOOL GetTextExtentPoint( HDC hdc, LPCSTR str, short count, LPSIZE size )
size->cy = abs((dc->u.x.font.fstruct->ascent+dc->u.x.font.fstruct->descent) size->cy = abs((dc->u.x.font.fstruct->ascent+dc->u.x.font.fstruct->descent)
* dc->w.WndExtY / dc->w.VportExtY); * dc->w.WndExtY / dc->w.VportExtY);
dprintf_font(stddeb,"GetTextExtentPoint("NPFMT" '%*.*s' %d %p): returning %ld,%ld\n", dprintf_font(stddeb,"GetTextExtentPoint(%04x '%*.*s' %d %p): returning %d,%d\n",
hdc, count, count, str, count, size, (LONG)size->cx, hdc, count, count, str, count, size, size->cx, size->cy );
(LONG)size->cy );
return TRUE; return TRUE;
} }
...@@ -588,7 +585,7 @@ BOOL GetTextMetrics( HDC hdc, LPTEXTMETRIC metrics ) ...@@ -588,7 +585,7 @@ BOOL GetTextMetrics( HDC hdc, LPTEXTMETRIC metrics )
*/ */
DWORD SetMapperFlags(HDC hDC, DWORD dwFlag) DWORD SetMapperFlags(HDC hDC, DWORD dwFlag)
{ {
dprintf_font(stdnimp,"SetmapperFlags("NPFMT", %08lX) // Empty Stub !\n", dprintf_font(stdnimp,"SetmapperFlags(%04x, %08lX) // Empty Stub !\n",
hDC, dwFlag); hDC, dwFlag);
return 0L; return 0L;
} }
...@@ -664,10 +661,6 @@ BOOL RemoveFontResource( LPSTR str ) ...@@ -664,10 +661,6 @@ BOOL RemoveFontResource( LPSTR str )
int ParseFontParms(LPSTR lpFont, WORD wParmsNo, LPSTR lpRetStr, WORD wMaxSiz) int ParseFontParms(LPSTR lpFont, WORD wParmsNo, LPSTR lpRetStr, WORD wMaxSiz)
{ {
int i; int i;
#if 0
dprintf_font(stddeb,"ParseFontParms('%s', %d, %p, %d);\n",
lpFont, wParmsNo, lpRetStr, wMaxSiz);
#endif
if (lpFont == NULL) return 0; if (lpFont == NULL) return 0;
if (lpRetStr == NULL) return 0; if (lpRetStr == NULL) return 0;
for (i = 0; (*lpFont != '\0' && i != wParmsNo); ) { for (i = 0; (*lpFont != '\0' && i != wParmsNo); ) {
...@@ -680,9 +673,6 @@ int ParseFontParms(LPSTR lpFont, WORD wParmsNo, LPSTR lpRetStr, WORD wMaxSiz) ...@@ -680,9 +673,6 @@ int ParseFontParms(LPSTR lpFont, WORD wParmsNo, LPSTR lpRetStr, WORD wMaxSiz)
for (i = 0; (*lpFont != '\0' && *lpFont != '-' && i < wMaxSiz); i++) for (i = 0; (*lpFont != '\0' && *lpFont != '-' && i < wMaxSiz); i++)
*(lpRetStr + i) = *lpFont++; *(lpRetStr + i) = *lpFont++;
*(lpRetStr + i) = '\0'; *(lpRetStr + i) = '\0';
#if 0
dprintf_font(stddeb,"ParseFontParms // '%s'\n", lpRetStr);
#endif
return i; return i;
} }
else else
...@@ -789,7 +779,7 @@ INT EnumFonts(HDC hDC, LPCTSTR lpFaceName, FONTENUMPROC lpEnumFunc, LPARAM lpDat ...@@ -789,7 +779,7 @@ INT EnumFonts(HDC hDC, LPCTSTR lpFaceName, FONTENUMPROC lpEnumFunc, LPARAM lpDat
int nRet = 0; int nRet = 0;
int i; int i;
dprintf_font(stddeb,"EnumFonts("NPFMT", %p='%s', %08lx, %08lx)\n", dprintf_font(stddeb,"EnumFonts(%04x, %p='%s', %08lx, %08lx)\n",
hDC, lpFaceName, lpFaceName, (LONG)lpEnumFunc, lpData); hDC, lpFaceName, lpFaceName, (LONG)lpEnumFunc, lpData);
if (lpEnumFunc == 0) return 0; if (lpEnumFunc == 0) return 0;
hLog = GDI_HEAP_ALLOC( sizeof(LOGFONT) + LF_FACESIZE ); hLog = GDI_HEAP_ALLOC( sizeof(LOGFONT) + LF_FACESIZE );
...@@ -859,7 +849,7 @@ INT EnumFontFamilies(HDC hDC, LPCTSTR lpszFamily, FONTENUMPROC lpEnumFunc, LPARA ...@@ -859,7 +849,7 @@ INT EnumFontFamilies(HDC hDC, LPCTSTR lpszFamily, FONTENUMPROC lpEnumFunc, LPARA
int nRet = 0; int nRet = 0;
int i; int i;
dprintf_font(stddeb,"EnumFontFamilies("NPFMT", %p, %08lx, %08lx)\n", dprintf_font(stddeb,"EnumFontFamilies(%04x, %p, %08lx, %08lx)\n",
hDC, lpszFamily, (DWORD)lpEnumFunc, lpData); hDC, lpszFamily, (DWORD)lpEnumFunc, lpData);
if (lpEnumFunc == 0) return 0; if (lpEnumFunc == 0) return 0;
hLog = GDI_HEAP_ALLOC( sizeof(ENUMLOGFONT) ); hLog = GDI_HEAP_ALLOC( sizeof(ENUMLOGFONT) );
......
...@@ -174,7 +174,7 @@ BOOL GDI_Init(void) ...@@ -174,7 +174,7 @@ BOOL GDI_Init(void)
/* Create default palette */ /* Create default palette */
if (!(hpalette = COLOR_Init())) return FALSE; if (!(hpalette = COLOR_Init())) return FALSE;
StockObjects[DEFAULT_PALETTE] = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( hpalette ); StockObjects[DEFAULT_PALETTE] = (GDIOBJHDR *)GDI_HEAP_LIN_ADDR( hpalette );
/* Create default bitmap */ /* Create default bitmap */
...@@ -217,8 +217,8 @@ BOOL GDI_FreeObject( HANDLE handle ) ...@@ -217,8 +217,8 @@ BOOL GDI_FreeObject( HANDLE handle )
GDIOBJHDR * object; GDIOBJHDR * object;
/* Can't free stock objects */ /* Can't free stock objects */
if ((DWORD)handle >= FIRST_STOCK_HANDLE && if ((handle >= FIRST_STOCK_HANDLE) && (handle <= LAST_STOCK_HANDLE))
(DWORD)handle <= LAST_STOCK_HANDLE ) return TRUE; return TRUE;
object = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle ); object = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle );
if (!object) return FALSE; if (!object) return FALSE;
...@@ -240,9 +240,8 @@ GDIOBJHDR * GDI_GetObjPtr( HANDLE handle, WORD magic ) ...@@ -240,9 +240,8 @@ GDIOBJHDR * GDI_GetObjPtr( HANDLE handle, WORD magic )
{ {
GDIOBJHDR * ptr = NULL; GDIOBJHDR * ptr = NULL;
if ((DWORD)handle >= FIRST_STOCK_HANDLE && if ((handle >= FIRST_STOCK_HANDLE) && (handle <= LAST_STOCK_HANDLE))
(DWORD)handle <= LAST_STOCK_HANDLE ) ptr = StockObjects[handle - FIRST_STOCK_HANDLE];
ptr = StockObjects[(DWORD)handle - FIRST_STOCK_HANDLE];
else else
ptr = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle ); ptr = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle );
if (!ptr) return NULL; if (!ptr) return NULL;
...@@ -261,7 +260,7 @@ BOOL DeleteObject( HGDIOBJ obj ) ...@@ -261,7 +260,7 @@ BOOL DeleteObject( HGDIOBJ obj )
GDIOBJHDR * header = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( obj ); GDIOBJHDR * header = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( obj );
if (!header) return FALSE; if (!header) return FALSE;
dprintf_gdi(stddeb, "DeleteObject: "NPFMT"\n", obj ); dprintf_gdi(stddeb, "DeleteObject: %04x\n", obj );
/* Delete object */ /* Delete object */
...@@ -285,9 +284,9 @@ HANDLE GetStockObject( int obj ) ...@@ -285,9 +284,9 @@ HANDLE GetStockObject( int obj )
{ {
if ((obj < 0) || (obj >= NB_STOCK_OBJECTS)) return 0; if ((obj < 0) || (obj >= NB_STOCK_OBJECTS)) return 0;
if (!StockObjects[obj]) return 0; if (!StockObjects[obj]) return 0;
dprintf_gdi(stddeb, "GetStockObject: returning %ld\n", dprintf_gdi(stddeb, "GetStockObject: returning %d\n",
(DWORD)FIRST_STOCK_HANDLE + obj ); FIRST_STOCK_HANDLE + obj );
return (HANDLE)((DWORD)FIRST_STOCK_HANDLE + obj); return (HANDLE)(FIRST_STOCK_HANDLE + obj);
} }
...@@ -297,12 +296,11 @@ HANDLE GetStockObject( int obj ) ...@@ -297,12 +296,11 @@ HANDLE GetStockObject( int obj )
int GetObject( HANDLE handle, int count, LPSTR buffer ) int GetObject( HANDLE handle, int count, LPSTR buffer )
{ {
GDIOBJHDR * ptr = NULL; GDIOBJHDR * ptr = NULL;
dprintf_gdi(stddeb, "GetObject: "NPFMT" %d %p\n", handle, count, buffer ); dprintf_gdi(stddeb, "GetObject: %04x %d %p\n", handle, count, buffer );
if (!count) return 0; if (!count) return 0;
if ((DWORD)handle >= FIRST_STOCK_HANDLE && if ((handle >= FIRST_STOCK_HANDLE) && (handle <= LAST_STOCK_HANDLE))
(DWORD)handle <= LAST_STOCK_HANDLE ) ptr = StockObjects[handle - FIRST_STOCK_HANDLE];
ptr = StockObjects[(DWORD)handle - FIRST_STOCK_HANDLE];
else else
ptr = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle ); ptr = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle );
if (!ptr) return 0; if (!ptr) return 0;
...@@ -332,10 +330,9 @@ HANDLE SelectObject( HDC hdc, HANDLE handle ) ...@@ -332,10 +330,9 @@ HANDLE SelectObject( HDC hdc, HANDLE handle )
GDIOBJHDR * ptr = NULL; GDIOBJHDR * ptr = NULL;
DC * dc; DC * dc;
dprintf_gdi(stddeb, "SelectObject: "NPFMT" "NPFMT"\n", hdc, handle ); dprintf_gdi(stddeb, "SelectObject: %04x %04x\n", hdc, handle );
if ((DWORD)handle >= FIRST_STOCK_HANDLE && if ((handle >= FIRST_STOCK_HANDLE) && (handle <= LAST_STOCK_HANDLE))
(DWORD)handle <= LAST_STOCK_HANDLE ) ptr = StockObjects[handle - FIRST_STOCK_HANDLE];
ptr = StockObjects[(DWORD)handle - FIRST_STOCK_HANDLE];
else else
ptr = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle ); ptr = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle );
if (!ptr) return 0; if (!ptr) return 0;
...@@ -369,7 +366,7 @@ HANDLE SelectObject( HDC hdc, HANDLE handle ) ...@@ -369,7 +366,7 @@ HANDLE SelectObject( HDC hdc, HANDLE handle )
*/ */
BOOL UnrealizeObject( HANDLE handle ) BOOL UnrealizeObject( HANDLE handle )
{ {
dprintf_gdi(stdnimp, "UnrealizeObject: "NPFMT"\n", handle ); dprintf_gdi(stdnimp, "UnrealizeObject: %04x\n", handle );
return TRUE; return TRUE;
} }
...@@ -393,7 +390,7 @@ INT EnumObjects( HDC hdc, INT nObjType, GOBJENUMPROC lpEnumFunc, LPARAM lParam ) ...@@ -393,7 +390,7 @@ INT EnumObjects( HDC hdc, INT nObjType, GOBJENUMPROC lpEnumFunc, LPARAM lParam )
int i, retval = 0; int i, retval = 0;
dprintf_gdi( stddeb, "EnumObjects: "NPFMT" %d %08lx %08lx\n", dprintf_gdi( stddeb, "EnumObjects: %04x %d %08lx %08lx\n",
hdc, nObjType, (DWORD)lpEnumFunc, lParam ); hdc, nObjType, (DWORD)lpEnumFunc, lParam );
switch(nObjType) switch(nObjType)
{ {
...@@ -440,122 +437,17 @@ INT EnumObjects( HDC hdc, INT nObjType, GOBJENUMPROC lpEnumFunc, LPARAM lParam ) ...@@ -440,122 +437,17 @@ INT EnumObjects( HDC hdc, INT nObjType, GOBJENUMPROC lpEnumFunc, LPARAM lParam )
break; break;
} }
return retval; return retval;
#if 0
/* HANDLE handle;
DC *dc;*/
HANDLE *lphObj;
GDIOBJHDR *header;
WORD wMagic;
LPSTR lpLog; /* Point to a LOGBRUSH or LOGPEN struct */
HANDLE hLog;
int nRet = 0;
if (lpEnumFunc == 0) {
fprintf(stderr,"EnumObjects // Bad EnumProc callback address !\n");
return 0;
}
switch (nObjType) {
case OBJ_PEN:
wMagic = PEN_MAGIC;
dprintf_gdi(stddeb,"EnumObjects("NPFMT", OBJ_PEN, %08lx, %p);\n",
hDC, (LONG)lpEnumFunc, lpData);
hLog = GDI_HEAP_ALLOC( sizeof(LOGPEN) );
lpLog = (LPSTR) GDI_HEAP_LIN_ADDR(hLog);
if (lpLog == NULL) {
fprintf(stderr,"EnumObjects // Unable to alloc LOGPEN struct !\n");
return 0;
}
break;
case OBJ_BRUSH:
wMagic = BRUSH_MAGIC;
dprintf_gdi(stddeb,"EnumObjects("NPFMT", OBJ_BRUSH, %08lx, %p);\n",
hDC, (LONG)lpEnumFunc, lpData);
hLog = GDI_HEAP_ALLOC( sizeof(LOGBRUSH) );
lpLog = (LPSTR) GDI_HEAP_LIN_ADDR(hLog);
if (lpLog == NULL) {
fprintf(stderr,"EnumObjects // Unable to alloc LOGBRUSH struct !\n");
return 0;
}
break;
default:
fprintf(stderr,"EnumObjects("NPFMT", %04X, %08lx, %p); // Unknown OBJ type !\n",
hDC, nObjType, (LONG)lpEnumFunc, lpData);
return 0;
}
#ifdef notdef /* FIXME: stock object ptr won't work in callback */
dprintf_gdi(stddeb,"EnumObjects // Stock Objects first !\n");
for (i = 0; i < NB_STOCK_OBJECTS; i++) {
header = StockObjects[i];
if (header->wMagic == wMagic) {
PEN_GetObject( (PENOBJ *)header, sizeof(LOGPEN), lpLog);
BRUSH_GetObject( (BRUSHOBJ *)header, sizeof(LOGBRUSH),lpLog);
dprintf_gdi(stddeb,"EnumObjects // StockObj lpLog=%p lpData=%p\n", lpLog, lpData);
if (header->wMagic == BRUSH_MAGIC) {
dprintf_gdi(stddeb,"EnumObjects // StockBrush lbStyle=%04X\n", ((LPLOGBRUSH)lpLog)->lbStyle);
dprintf_gdi(stddeb,"EnumObjects // StockBrush lbColor=%08lX\n", ((LPLOGBRUSH)lpLog)->lbColor);
dprintf_gdi(stddeb,"EnumObjects // StockBrush lbHatch=%04X\n", ((LPLOGBRUSH)lpLog)->lbHatch);
}
if (header->wMagic == PEN_MAGIC) {
dprintf_gdi(stddeb,"EnumObjects // StockPen lopnStyle=%04X\n", ((LPLOGPEN)lpLog)->lopnStyle);
dprintf_gdi(stddeb,"EnumObjects // StockPen lopnWidth=%d\n", ((LPLOGPEN)lpLog)->lopnWidth.x);
dprintf_gdi(stddeb,"EnumObjects // StockPen lopnColor=%08lX\n", ((LPLOGPEN)lpLog)->lopnColor);
}
nRet = CallEnumObjectsProc( lpEnumFunc,
GDI_HEAP_SEG_ADDR(hLog),
(int)lpData );
dprintf_gdi(stddeb,"EnumObjects // after Callback!\n");
if (nRet == 0) {
GDI_HEAP_FREE(hLog);
dprintf_gdi(stddeb,"EnumObjects // EnumEnd requested by application !\n");
return 0;
}
}
}
dprintf_gdi(stddeb,"EnumObjects // Now DC owned objects %p !\n", header);
#endif /* notdef */
if (lpPenBrushList == NULL) return 0;
for (lphObj = lpPenBrushList; *lphObj != 0; ) {
dprintf_gdi(stddeb,"EnumObjects // *lphObj="NPFMT"\n", *lphObj);
header = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR(*lphObj++);
if (header->wMagic == wMagic) {
dprintf_gdi(stddeb,"EnumObjects // DC_Obj lpLog=%p lpData=%p\n", lpLog, lpData);
if (header->wMagic == BRUSH_MAGIC) {
BRUSH_GetObject( (BRUSHOBJ *)header, sizeof(LOGBRUSH), lpLog);
dprintf_gdi(stddeb,"EnumObjects // DC_Brush lbStyle=%04X\n", ((LPLOGBRUSH)lpLog)->lbStyle);
dprintf_gdi(stddeb,"EnumObjects // DC_Brush lbColor=%08lX\n", ((LPLOGBRUSH)lpLog)->lbColor);
dprintf_gdi(stddeb,"EnumObjects // DC_Brush lbHatch=%04lX\n", (LONG)((LPLOGBRUSH)lpLog)->lbHatch);
}
if (header->wMagic == PEN_MAGIC) {
PEN_GetObject( (PENOBJ *)header, sizeof(LOGPEN), lpLog);
dprintf_gdi(stddeb,"EnumObjects // DC_Pen lopnStyle=%04X\n", ((LPLOGPEN)lpLog)->lopnStyle);
dprintf_gdi(stddeb,"EnumObjects // DC_Pen lopnWidth=%ld\n", (LONG)((LPLOGPEN)lpLog)->lopnWidth.x);
dprintf_gdi(stddeb,"EnumObjects // DC_Pen lopnColor=%08lX\n", ((LPLOGPEN)lpLog)->lopnColor);
}
nRet = CallEnumObjectsProc(lpEnumFunc, GDI_HEAP_SEG_ADDR(hLog),
(LONG)lpData);
if (nRet == 0)
break;
}
}
GDI_HEAP_FREE(hLog);
dprintf_gdi(stddeb,"EnumObjects // End of enumeration !\n");
return nRet;
#endif
} }
/*********************************************************************** /***********************************************************************
* IsGDIObject(GDI.462) * IsGDIObject (GDI.462)
*/ */
BOOL IsGDIObject(HANDLE handle) BOOL IsGDIObject(HANDLE handle)
{ {
GDIOBJHDR *object; GDIOBJHDR *object;
object = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle ); object = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle );
if (object) /* FIXME: should check magic here */
return TRUE; return (object != NULL);
else
return FALSE;
} }
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
* *
* Copyright 1993 Bob Amstadt * Copyright 1993 Bob Amstadt
* *
static char Copyright[] = "Copyright Bob Amstadt, 1993"; */
*/
#include <stdlib.h> #include <stdlib.h>
#include "windows.h" #include "windows.h"
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
* *
* Copyright David W. Metcalfe, 1994 * Copyright David W. Metcalfe, 1994
* *
static char Copyright[] = "Copyright David W. Metcalfe, 1994"; */
*/
#include <string.h> #include <string.h>
#include <fcntl.h> #include <fcntl.h>
...@@ -573,7 +572,7 @@ HANDLE GetMetaFileBits(HMETAFILE hmf) ...@@ -573,7 +572,7 @@ HANDLE GetMetaFileBits(HMETAFILE hmf)
HANDLE hMem = mf->hMetaHdr; HANDLE hMem = mf->hMetaHdr;
METAHEADER *mh = (METAHEADER *)GlobalLock(hMem); METAHEADER *mh = (METAHEADER *)GlobalLock(hMem);
dprintf_metafile(stddeb,"GetMetaFileBits: hmf in: "NPFMT"\n", hmf); dprintf_metafile(stddeb,"GetMetaFileBits: hmf in: %04x\n", hmf);
/* can't get bits of disk based metafile */ /* can't get bits of disk based metafile */
/* FIXME: should the disk file be loaded in this case? */ /* FIXME: should the disk file be loaded in this case? */
...@@ -589,7 +588,7 @@ HANDLE GetMetaFileBits(HMETAFILE hmf) ...@@ -589,7 +588,7 @@ HANDLE GetMetaFileBits(HMETAFILE hmf)
GlobalUnlock(hMem); GlobalUnlock(hMem);
GlobalFree(hmf); GlobalFree(hmf);
dprintf_metafile(stddeb,"GetMetaFileBits: hMem out: "NPFMT"\n", hMem); dprintf_metafile(stddeb,"GetMetaFileBits: hMem out: %04x\n", hMem);
return hMem; return hMem;
} }
...@@ -605,7 +604,7 @@ HMETAFILE SetMetaFileBits(HANDLE hMem) ...@@ -605,7 +604,7 @@ HMETAFILE SetMetaFileBits(HANDLE hMem)
METAFILE *mf; METAFILE *mf;
METAHEADER *mh = (METAHEADER *)GlobalLock(hMem); METAHEADER *mh = (METAHEADER *)GlobalLock(hMem);
dprintf_metafile(stddeb,"SetMetaFileBits: hMem in: "NPFMT"\n", hMem); dprintf_metafile(stddeb,"SetMetaFileBits: hMem in: %04x\n", hMem);
if (!mh) return FALSE; if (!mh) return FALSE;
...@@ -629,7 +628,7 @@ HMETAFILE SetMetaFileBits(HANDLE hMem) ...@@ -629,7 +628,7 @@ HMETAFILE SetMetaFileBits(HANDLE hMem)
GlobalUnlock(hMem); GlobalUnlock(hMem);
GlobalUnlock(hmf); GlobalUnlock(hmf);
dprintf_metafile(stddeb,"SetMetaFileBits: hmf out: "NPFMT"\n", hmf); dprintf_metafile(stddeb,"SetMetaFileBits: hmf out: %04x\n", hmf);
return hmf; return hmf;
} }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "cursoricon.h" #include "cursoricon.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
#include "xmalloc.h"
/* Include OEM pixmaps */ /* Include OEM pixmaps */
#include "bitmaps/obm_cdrom" #include "bitmaps/obm_cdrom"
...@@ -327,28 +327,34 @@ static BOOL OBM_CreateBitmaps( char **data, BOOL color, HBITMAP *hBitmap, ...@@ -327,28 +327,34 @@ static BOOL OBM_CreateBitmaps( char **data, BOOL color, HBITMAP *hBitmap,
HBITMAP *hBitmapMask, POINT *hotspot ) HBITMAP *hBitmapMask, POINT *hotspot )
{ {
Pixmap pixmap, pixmask; Pixmap pixmap, pixmask;
XpmAttributes attrs; XpmAttributes *attrs;
int err; int err;
attrs.valuemask = XpmColormap | XpmDepth | XpmColorSymbols | XpmHotspot; attrs = (XpmAttributes *)xmalloc( XpmAttributesSize() );
attrs.colormap = COLOR_WinColormap; attrs->valuemask = XpmColormap | XpmDepth | XpmColorSymbols |XpmHotspot;
attrs.depth = color ? screenDepth : 1; attrs->colormap = COLOR_WinColormap;
attrs.colorsymbols = (attrs.depth > 1) ? OBM_Colors : OBM_BlackAndWhite; attrs->depth = color ? screenDepth : 1;
attrs.numsymbols = (attrs.depth > 1) ? NB_COLOR_SYMBOLS : 2; attrs->colorsymbols = (attrs->depth > 1) ? OBM_Colors : OBM_BlackAndWhite;
attrs->numsymbols = (attrs->depth > 1) ? NB_COLOR_SYMBOLS : 2;
err = XpmCreatePixmapFromData( display, rootWindow, data, err = XpmCreatePixmapFromData( display, rootWindow, data,
&pixmap, &pixmask, &attrs ); &pixmap, &pixmask, attrs );
if (err != XpmSuccess) return FALSE; if (err != XpmSuccess)
{
free( attrs );
return FALSE;
}
if (hotspot) if (hotspot)
{ {
hotspot->x = attrs.x_hotspot; hotspot->x = attrs->x_hotspot;
hotspot->y = attrs.y_hotspot; hotspot->y = attrs->y_hotspot;
} }
*hBitmap = OBM_MakeBitmap( attrs.width, attrs.height, *hBitmap = OBM_MakeBitmap( attrs->width, attrs->height,
attrs.depth, pixmap ); attrs->depth, pixmap );
if (hBitmapMask) *hBitmapMask = OBM_MakeBitmap( attrs.width, attrs.height, if (hBitmapMask) *hBitmapMask = OBM_MakeBitmap(attrs->width, attrs->height,
1, pixmask ); 1, pixmask );
free( attrs );
if (!*hBitmap) if (!*hBitmap)
{ {
if (pixmap) XFreePixmap( display, pixmap ); if (pixmap) XFreePixmap( display, pixmap );
......
...@@ -3,18 +3,11 @@ ...@@ -3,18 +3,11 @@
* *
* Copyright 1993,1994 Alexandre Julliard * Copyright 1993,1994 Alexandre Julliard
* *
static char Copyright[] = "Copyright Alexandre Julliard, 1993,1994"; */
*/
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <limits.h>
#if !defined (MAXINT)
#include <limits.h>
#define MAXINT INT_MAX
#endif
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include "color.h" #include "color.h"
#include "palette.h" #include "palette.h"
#include "stddebug.h" #include "stddebug.h"
...@@ -51,7 +44,7 @@ static WORD PALETTE_GetNearestIndexAndColor(HPALETTE hpalette, COLORREF *color) ...@@ -51,7 +44,7 @@ static WORD PALETTE_GetNearestIndexAndColor(HPALETTE hpalette, COLORREF *color)
b = GetBValue(*color); b = GetBValue(*color);
entry = palPtr->logpalette.palPalEntry; entry = palPtr->logpalette.palPalEntry;
for (i = 0, minDist = MAXINT; minDist !=0 && for (i = 0, minDist = 0xffffff; minDist !=0 &&
i < palPtr->logpalette.palNumEntries ; i++) i < palPtr->logpalette.palNumEntries ; i++)
{ {
if (entry->peFlags != 0xff) if (entry->peFlags != 0xff)
...@@ -158,7 +151,7 @@ BOOL AnimatePalette(HPALETTE hPal, UINT StartIndex, UINT NumEntries, ...@@ -158,7 +151,7 @@ BOOL AnimatePalette(HPALETTE hPal, UINT StartIndex, UINT NumEntries,
WORD SetSystemPaletteUse( HDC hdc, WORD use) WORD SetSystemPaletteUse( HDC hdc, WORD use)
{ {
WORD old=SystemPaletteUse; WORD old=SystemPaletteUse;
printf("SetSystemPaletteUse("NPFMT",%04X) // empty stub !!!\n", hdc, use); printf("SetSystemPaletteUse(%04x,%04x) // empty stub !!!\n", hdc, use);
SystemPaletteUse=use; SystemPaletteUse=use;
return old; return old;
} }
...@@ -168,7 +161,7 @@ WORD SetSystemPaletteUse( HDC hdc, WORD use) ...@@ -168,7 +161,7 @@ WORD SetSystemPaletteUse( HDC hdc, WORD use)
*/ */
WORD GetSystemPaletteUse( HDC hdc ) WORD GetSystemPaletteUse( HDC hdc )
{ {
printf("GetSystemPaletteUse("NPFMT") // empty stub !!!\n", hdc); printf("GetSystemPaletteUse(%04x) // empty stub !!!\n", hdc);
return SystemPaletteUse; return SystemPaletteUse;
} }
...@@ -206,7 +199,7 @@ WORD GetSystemPaletteEntries( HDC hdc, WORD start, WORD count, ...@@ -206,7 +199,7 @@ WORD GetSystemPaletteEntries( HDC hdc, WORD start, WORD count,
WORD GetNearestPaletteIndex( HPALETTE hpalette, COLORREF color ) WORD GetNearestPaletteIndex( HPALETTE hpalette, COLORREF color )
{ {
WORD index = PALETTE_GetNearestIndexAndColor( hpalette, &color ); WORD index = PALETTE_GetNearestIndexAndColor( hpalette, &color );
dprintf_palette(stddeb,"GetNearestPaletteIndex("NPFMT",%06lx): returning %d\n", dprintf_palette(stddeb,"GetNearestPaletteIndex(%04x,%06lx): returning %d\n",
hpalette, color, index ); hpalette, color, index );
return index; return index;
} }
...@@ -247,7 +240,7 @@ HPALETTE GDISelectPalette( HDC hdc, HPALETTE hpal ) ...@@ -247,7 +240,7 @@ HPALETTE GDISelectPalette( HDC hdc, HPALETTE hpal )
HPALETTE prev; HPALETTE prev;
DC *dc; DC *dc;
dprintf_palette(stddeb, "GDISelectPalette: "NPFMT" "NPFMT"\n", hdc, hpal ); dprintf_palette(stddeb, "GDISelectPalette: %04x %04x\n", hdc, hpal );
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0; if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0;
prev = dc->w.hPalette; prev = dc->w.hPalette;
dc->w.hPalette = hpal; dc->w.hPalette = hpal;
...@@ -262,7 +255,7 @@ HPALETTE GDISelectPalette( HDC hdc, HPALETTE hpal ) ...@@ -262,7 +255,7 @@ HPALETTE GDISelectPalette( HDC hdc, HPALETTE hpal )
*/ */
UINT GDIRealizePalette( HDC hdc ) UINT GDIRealizePalette( HDC hdc )
{ {
dprintf_palette(stdnimp, "GDIRealizePalette: "NPFMT"\n", hdc ); dprintf_palette(stdnimp, "GDIRealizePalette: %04x\n", hdc );
return 0; return 0;
} }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
*/ */
BOOL REGION_DeleteObject( HRGN hrgn, RGNOBJ * obj ) BOOL REGION_DeleteObject( HRGN hrgn, RGNOBJ * obj )
{ {
dprintf_region(stddeb, "DeleteRegion: "NPFMT"\n", hrgn ); dprintf_region(stddeb, "DeleteRegion: %04x\n", hrgn );
if (obj->xrgn) XDestroyRegion( obj->xrgn ); if (obj->xrgn) XDestroyRegion( obj->xrgn );
return GDI_FreeObject( hrgn ); return GDI_FreeObject( hrgn );
} }
...@@ -32,7 +32,7 @@ int OffsetRgn( HRGN hrgn, short x, short y ) ...@@ -32,7 +32,7 @@ int OffsetRgn( HRGN hrgn, short x, short y )
{ {
RGNOBJ * obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC ); RGNOBJ * obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC );
if (!obj) return ERROR; if (!obj) return ERROR;
dprintf_region(stddeb, "OffsetRgn: "NPFMT" %d,%d\n", hrgn, x, y ); dprintf_region(stddeb, "OffsetRgn: %04x %d,%d\n", hrgn, x, y );
if (!obj->xrgn) return NULLREGION; if (!obj->xrgn) return NULLREGION;
XOffsetRegion( obj->xrgn, x, y ); XOffsetRegion( obj->xrgn, x, y );
return COMPLEXREGION; return COMPLEXREGION;
...@@ -46,7 +46,7 @@ int GetRgnBox( HRGN hrgn, LPRECT rect ) ...@@ -46,7 +46,7 @@ int GetRgnBox( HRGN hrgn, LPRECT rect )
{ {
RGNOBJ * obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC ); RGNOBJ * obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC );
if (!obj) return ERROR; if (!obj) return ERROR;
dprintf_region(stddeb, "GetRgnBox: "NPFMT"\n", hrgn ); dprintf_region(stddeb, "GetRgnBox: %04x\n", hrgn );
if (!obj->xrgn) if (!obj->xrgn)
{ {
SetRectEmpty( rect ); SetRectEmpty( rect );
...@@ -84,7 +84,7 @@ HRGN CreateRectRgn( INT left, INT top, INT right, INT bottom ) ...@@ -84,7 +84,7 @@ HRGN CreateRectRgn( INT left, INT top, INT right, INT bottom )
XUnionRectWithRegion( &rect, obj->xrgn, obj->xrgn ); XUnionRectWithRegion( &rect, obj->xrgn, obj->xrgn );
} }
else obj->xrgn = 0; else obj->xrgn = 0;
dprintf_region( stddeb, "CreateRectRgn(%d,%d-%d,%d): returning "NPFMT"\n", dprintf_region( stddeb, "CreateRectRgn(%d,%d-%d,%d): returning %04x\n",
left, top, right, bottom, hrgn ); left, top, right, bottom, hrgn );
return hrgn; return hrgn;
} }
...@@ -106,7 +106,7 @@ void SetRectRgn( HRGN hrgn, short left, short top, short right, short bottom ) ...@@ -106,7 +106,7 @@ void SetRectRgn( HRGN hrgn, short left, short top, short right, short bottom )
{ {
RGNOBJ * obj; RGNOBJ * obj;
dprintf_region(stddeb, "SetRectRgn: "NPFMT" %d,%d-%d,%d\n", dprintf_region(stddeb, "SetRectRgn: %04x %d,%d-%d,%d\n",
hrgn, left, top, right, bottom ); hrgn, left, top, right, bottom );
if (!(obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC ))) return; if (!(obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC ))) return;
...@@ -143,7 +143,7 @@ HRGN CreateRoundRectRgn( INT left, INT top, INT right, INT bottom, ...@@ -143,7 +143,7 @@ HRGN CreateRoundRectRgn( INT left, INT top, INT right, INT bottom,
if (!(hrgn = GDI_AllocObject( sizeof(RGNOBJ), REGION_MAGIC ))) return 0; if (!(hrgn = GDI_AllocObject( sizeof(RGNOBJ), REGION_MAGIC ))) return 0;
obj = (RGNOBJ *) GDI_HEAP_LIN_ADDR( hrgn ); obj = (RGNOBJ *) GDI_HEAP_LIN_ADDR( hrgn );
obj->xrgn = XCreateRegion(); obj->xrgn = XCreateRegion();
dprintf_region(stddeb,"CreateRoundRectRgn(%d,%d-%d,%d %dx%d): return="NPFMT"\n", dprintf_region(stddeb,"CreateRoundRectRgn(%d,%d-%d,%d %dx%d): return=%04x\n",
left, top, right, bottom, ellipse_width, ellipse_height, hrgn ); left, top, right, bottom, ellipse_width, ellipse_height, hrgn );
/* Check parameters */ /* Check parameters */
...@@ -276,7 +276,7 @@ HRGN CreatePolyPolygonRgn( const POINT * points, const INT * count, ...@@ -276,7 +276,7 @@ HRGN CreatePolyPolygonRgn( const POINT * points, const INT * count,
} }
obj = (RGNOBJ *) GDI_HEAP_LIN_ADDR( hrgn ); obj = (RGNOBJ *) GDI_HEAP_LIN_ADDR( hrgn );
obj->xrgn = 0; obj->xrgn = 0;
dprintf_region(stddeb, "CreatePolyPolygonRgn: %d polygons, returning "NPFMT"\n", dprintf_region(stddeb, "CreatePolyPolygonRgn: %d polygons, returning %04x\n",
nbpolygons, hrgn ); nbpolygons, hrgn );
/* Create X region */ /* Create X region */
...@@ -411,7 +411,7 @@ INT CombineRgn( HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode ) ...@@ -411,7 +411,7 @@ INT CombineRgn( HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode )
RGNOBJ *destObj, *src1Obj, *src2Obj; RGNOBJ *destObj, *src1Obj, *src2Obj;
Region destrgn; Region destrgn;
dprintf_region(stddeb, "CombineRgn: "NPFMT","NPFMT" -> "NPFMT" mode=%x\n", dprintf_region(stddeb, "CombineRgn: %04x,%04x -> %04x mode=%x\n",
hSrc1, hSrc2, hDest, mode ); hSrc1, hSrc2, hDest, mode );
if (!(destObj = (RGNOBJ *) GDI_GetObjPtr( hDest, REGION_MAGIC ))) if (!(destObj = (RGNOBJ *) GDI_GetObjPtr( hDest, REGION_MAGIC )))
......
...@@ -197,9 +197,8 @@ INT DrawText( HDC hdc, LPCTSTR str, INT i_count, LPRECT rect, UINT flags ) ...@@ -197,9 +197,8 @@ INT DrawText( HDC hdc, LPCTSTR str, INT i_count, LPRECT rect, UINT flags )
int width = rect->right - rect->left; int width = rect->right - rect->left;
int max_width = 0; int max_width = 0;
dprintf_text(stddeb,"DrawText: '%s', %d , [(%ld,%ld),(%ld,%ld)]\n", str, dprintf_text(stddeb,"DrawText: '%s', %d , [(%d,%d),(%d,%d)]\n", str,
count, (LONG)rect->left, (LONG)rect->top, (LONG)rect->right, count, rect->left, rect->top, rect->right, rect->bottom);
(LONG)rect->bottom);
if (count == -1) count = strlen(str); if (count == -1) count = strlen(str);
strPtr = str; strPtr = str;
...@@ -308,11 +307,9 @@ BOOL ExtTextOut( HDC hdc, short x, short y, WORD flags, LPRECT lprect, ...@@ -308,11 +307,9 @@ BOOL ExtTextOut( HDC hdc, short x, short y, WORD flags, LPRECT lprect,
dprintf_text(stddeb,"ExtTextOut: %d,%d '%*.*s', %d flags=%d\n", dprintf_text(stddeb,"ExtTextOut: %d,%d '%*.*s', %d flags=%d\n",
x, y, count, count, str, count, flags); x, y, count, count, str, count, flags);
if (lprect != NULL) { if (lprect != NULL) dprintf_text(stddeb, "rect %d %d %d %d\n",
dprintf_text(stddeb, "rect %ld %ld %ld %ld\n", (LONG)lprect->left, lprect->left, lprect->top,
(LONG)lprect->top, (LONG)lprect->right, lprect->right, lprect->bottom );
(LONG)lprect->bottom );
}
/* Setup coordinates */ /* Setup coordinates */
...@@ -574,7 +571,7 @@ LONG TEXT_TabbedTextOut( HDC hdc, int x, int y, LPSTR lpstr, int count, ...@@ -574,7 +571,7 @@ LONG TEXT_TabbedTextOut( HDC hdc, int x, int y, LPSTR lpstr, int count,
LONG TabbedTextOut( HDC hdc, short x, short y, LPSTR lpstr, short count, LONG TabbedTextOut( HDC hdc, short x, short y, LPSTR lpstr, short count,
short cTabStops, LPINT lpTabPos, short nTabOrg ) short cTabStops, LPINT lpTabPos, short nTabOrg )
{ {
dprintf_text( stddeb, "TabbedTextOut: "NPFMT" %d,%d '%*.*s' %d\n", dprintf_text( stddeb, "TabbedTextOut: %04x %d,%d '%*.*s' %d\n",
hdc, x, y, count, count, lpstr, count ); hdc, x, y, count, count, lpstr, count );
return TEXT_TabbedTextOut( hdc, x, y, lpstr, count, cTabStops, return TEXT_TabbedTextOut( hdc, x, y, lpstr, count, cTabStops,
lpTabPos, nTabOrg, TRUE ); lpTabPos, nTabOrg, TRUE );
...@@ -587,7 +584,7 @@ LONG TabbedTextOut( HDC hdc, short x, short y, LPSTR lpstr, short count, ...@@ -587,7 +584,7 @@ LONG TabbedTextOut( HDC hdc, short x, short y, LPSTR lpstr, short count,
DWORD GetTabbedTextExtent( HDC hdc, LPSTR lpstr, int count, DWORD GetTabbedTextExtent( HDC hdc, LPSTR lpstr, int count,
int cTabStops, LPINT lpTabPos ) int cTabStops, LPINT lpTabPos )
{ {
dprintf_text( stddeb, "GetTabbedTextExtent: "NPFMT" '%*.*s' %d\n", dprintf_text( stddeb, "GetTabbedTextExtent: %04x '%*.*s' %d\n",
hdc, count, count, lpstr, count ); hdc, count, count, lpstr, count );
return TEXT_TabbedTextOut( hdc, 0, 0, lpstr, count, cTabStops, return TEXT_TabbedTextOut( hdc, 0, 0, lpstr, count, cTabStops,
lpTabPos, 0, FALSE ); lpTabPos, 0, FALSE );
......
Fri Mar 15 20:56:31 1996 Ulrich Schmid <uschmid@mail.hh.provi.de>
* [main.c]
`Arrange icons' in group windows
* [program.c]
No sysmenu for program windows
* [string.c]
Update sysmenu after language change
Wed Feb 28 19:21:55 1996 Ulrich Schmid <uschmid@mail.hh.provi.de> Wed Feb 28 19:21:55 1996 Ulrich Schmid <uschmid@mail.hh.provi.de>
* [progman.h] [main.c] [group.c] [program.c] [dialog.c] * [progman.h] [main.c] [group.c] [program.c] [dialog.c]
......
...@@ -12,8 +12,7 @@ MOSTOBJS = \ ...@@ -12,8 +12,7 @@ MOSTOBJS = \
grpfile.o \ grpfile.o \
license.o \ license.o \
main.o \ main.o \
program.o \ program.o
winexec.o
STRINGOBJS = \ STRINGOBJS = \
accel.o \ accel.o \
...@@ -29,7 +28,7 @@ all: check_winerc $(PROGRAMS) ...@@ -29,7 +28,7 @@ all: check_winerc $(PROGRAMS)
@MAKE_RULES@ @MAKE_RULES@
# Some strings need addresses >= 0x10000 # Some strings need addresses >= 0x10000
progman: $(MOSTOBJS) $(STRINGOBJS) progman: $(MOSTOBJS) $(STRINGOBJS) $(WINELIB)
$(CC) -o progman $(MOSTOBJS) $(LDOPTIONS) $(ALL_LIBS) $(STRINGOBJS) $(CC) -o progman $(MOSTOBJS) $(LDOPTIONS) $(ALL_LIBS) $(STRINGOBJS)
clean:: clean::
......
...@@ -320,7 +320,10 @@ static VOID MAIN_MenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) ...@@ -320,7 +320,10 @@ static VOID MAIN_MenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
/* Menu Windows */ /* Menu Windows */
case PM_ARRANGE: case PM_ARRANGE:
SendMessage(Globals.hMDIWnd, WM_MDIICONARRANGE, 0, 0); if (hActiveGroupWnd && !IsIconic(hActiveGroupWnd))
ArrangeIconicWindows(hActiveGroupWnd);
else
SendMessage(Globals.hMDIWnd, WM_MDIICONARRANGE, 0, 0);
break; break;
/* Menu Language */ /* Menu Language */
......
...@@ -11,14 +11,6 @@ ...@@ -11,14 +11,6 @@
#include "windows.h" #include "windows.h"
/* FIXME should use WinExec from -lwine */
#ifdef WINELIB
#define WinExec ProgmanWinExec
#define WinHelp ProgmanWinHelp
HANDLE ProgmanWinExec(LPSTR,WORD);
BOOL ProgmanWinHelp(HWND,LPSTR,WORD,DWORD);
#endif
#define MAX_PATHNAME_LEN 1024 #define MAX_PATHNAME_LEN 1024
/* Fallback icon */ /* Fallback icon */
......
...@@ -198,7 +198,7 @@ HLOCAL PROGRAM_AddProgram(HLOCAL hGroup, HICON hIcon, LPCSTR lpszName, ...@@ -198,7 +198,7 @@ HLOCAL PROGRAM_AddProgram(HLOCAL hGroup, HICON hIcon, LPCSTR lpszName,
program->hWnd = program->hWnd =
CreateWindow (STRING_PROGRAM_WIN_CLASS_NAME, (LPSTR)lpszName, CreateWindow (STRING_PROGRAM_WIN_CLASS_NAME, (LPSTR)lpszName,
WS_CHILD | WS_OVERLAPPEDWINDOW, WS_CHILD | WS_CAPTION,
x, y, CW_USEDEFAULT, CW_USEDEFAULT, x, y, CW_USEDEFAULT, CW_USEDEFAULT,
group->hWnd, 0, Globals.hInstance, 0); group->hWnd, 0, Globals.hInstance, 0);
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
*/ */
#include <windows.h> #include <windows.h>
#ifdef WINELIB
#include <options.h>
#endif
#include "progman.h" #include "progman.h"
/* Class names */ /* Class names */
...@@ -33,6 +36,9 @@ static LPCSTR StringTableDe[]; ...@@ -33,6 +36,9 @@ static LPCSTR StringTableDe[];
VOID STRING_SelectLanguage(LPCSTR lang) VOID STRING_SelectLanguage(LPCSTR lang)
{ {
HMENU hMainMenu;
HLOCAL hGroup;
/* Change string table */ /* Change string table */
Globals.StringTable = StringTableEn; Globals.StringTable = StringTableEn;
if (!lstrcmp(lang, "De")) Globals.StringTable = StringTableDe; if (!lstrcmp(lang, "De")) Globals.StringTable = StringTableDe;
...@@ -51,28 +57,23 @@ VOID STRING_SelectLanguage(LPCSTR lang) ...@@ -51,28 +57,23 @@ VOID STRING_SelectLanguage(LPCSTR lang)
lstrcpyn(STRING_SYMBOL_Xx + sizeof(STRING_SYMBOL_Xx) - 3, lang, 3); lstrcpyn(STRING_SYMBOL_Xx + sizeof(STRING_SYMBOL_Xx) - 3, lang, 3);
lstrcpyn(STRING_EXECUTE_Xx + sizeof(STRING_EXECUTE_Xx) - 3, lang, 3); lstrcpyn(STRING_EXECUTE_Xx + sizeof(STRING_EXECUTE_Xx) - 3, lang, 3);
/* Destroy old menu */ /* Create menu */
if (Globals.hMainMenu) hMainMenu = LoadMenu(Globals.hInstance, STRING_MAIN_Xx);
{ if (hMainMenu)
SendMessage(Globals.hMDIWnd, WM_MDISETMENU, (WPARAM) NULL, (LPARAM) NULL);
#if 0 /* FIXME when MDISetMenu is complete */
DestroyMenu(Globals.hMainMenu);
#endif
}
/* Create new menu */
Globals.hMainMenu = LoadMenu(Globals.hInstance, STRING_MAIN_Xx);
if (Globals.hMainMenu)
{ {
Globals.hFileMenu = GetSubMenu(Globals.hMainMenu, 0); Globals.hFileMenu = GetSubMenu(hMainMenu, 0);
Globals.hOptionMenu = GetSubMenu(Globals.hMainMenu, 1); Globals.hOptionMenu = GetSubMenu(hMainMenu, 1);
Globals.hWindowsMenu = GetSubMenu(Globals.hMainMenu, 2); Globals.hWindowsMenu = GetSubMenu(hMainMenu, 2);
if (Globals.hMDIWnd) if (Globals.hMDIWnd)
SendMessage(Globals.hMDIWnd, WM_MDISETMENU, SendMessage(Globals.hMDIWnd, WM_MDISETMENU,
(WPARAM) Globals.hMainMenu, (WPARAM) hMainMenu,
(LPARAM) Globals.hWindowsMenu); (LPARAM) Globals.hWindowsMenu);
else SetMenu(Globals.hMainWnd, Globals.hMainMenu); else SetMenu(Globals.hMainWnd, hMainMenu);
/* Destroy old menu */
if (Globals.hMainMenu) DestroyMenu(Globals.hMainMenu);
Globals.hMainMenu = hMainMenu;
} }
/* Unsupported language */ /* Unsupported language */
else if(lstrcmp(lang, "En")) STRING_SelectLanguage("En"); else if(lstrcmp(lang, "En")) STRING_SelectLanguage("En");
...@@ -85,6 +86,17 @@ VOID STRING_SelectLanguage(LPCSTR lang) ...@@ -85,6 +86,17 @@ VOID STRING_SelectLanguage(LPCSTR lang)
/* have to be last because of /* have to be last because of
* the possible recursion */ * the possible recursion */
Globals.lpszLanguage = lang; Globals.lpszLanguage = lang;
#ifdef WINELIB
if (!lstrcmp(lang, "De")) Options.language = LANG_De;
if (!lstrcmp(lang, "En")) Options.language = LANG_En;
GetSystemMenu(Globals.hMainWnd, TRUE);
for (hGroup = GROUP_FirstGroup(); hGroup;
hGroup = GROUP_NextGroup(hGroup))
{
GROUP *group = LocalLock(hGroup);
GetSystemMenu(group->hWnd, TRUE);
}
#endif
} }
/* Local Variables: */ /* Local Variables: */
......
#ifdef WINELIB
#include <unistd.h>
#include <string.h>
#include "windows.h"
#include "winbase.h"
#include "options.h"
#include "dos_fs.h"
#include "debug.h"
#include "progman.h"
#define MAX_CMDLINE_SIZE 256
/* FIXME should use WinExec from -lwine */
HANDLE ProgmanWinExec( LPSTR lpCmdLine, WORD nCmdShow )
{
char wine[MAX_CMDLINE_SIZE];
char filename[MAX_CMDLINE_SIZE], *p;
char cmdline[MAX_CMDLINE_SIZE];
const char *argv[10], **argptr;
const char *unixfilename;
int simplename = 1;
if (fork()) return(INVALID_HANDLE_VALUE);
strncpy( filename, lpCmdLine, MAX_CMDLINE_SIZE );
filename[MAX_CMDLINE_SIZE-1] = '\0';
for (p = filename; *p && (*p != ' ') && (*p != '\t'); p++)
if ((*p == ':') || (*p == ':') || (*p == '/')) simplename = 0;
if (*p)
{
strncpy( cmdline, p + 1, 128 );
cmdline[127] = '\0';
}
else cmdline[0] = '\0';
*p = '\0';
if (simplename) unixfilename = filename;
else unixfilename = DOSFS_GetUnixFileName(filename, 0);
argptr = argv;
*argptr++ = unixfilename;
if (nCmdShow == SW_SHOWMINIMIZED) *argptr++ = "-iconic";
if (cmdline[0]) *argptr++ = cmdline;
*argptr++ = 0;
execvp(argv[0], (char**)argv);
PROFILE_GetWineIniString("progman", "wine", "wine",
wine, sizeof(wine));
argptr = argv;
*argptr++ = wine;
*argptr++ = "-language";
*argptr++ = Globals.lpszLanguage;
if (nCmdShow == SW_SHOWMINIMIZED) *argptr++ = "-iconic";
*argptr++ = lpCmdLine;
*argptr++ = 0;
execvp(argv[0] , (char**)argv);
printf("Cannot exec `%s %s %s%s %s'\n",
wine, "-language", Globals.lpszLanguage,
nCmdShow == SW_SHOWMINIMIZED ? " -iconic" : "",
lpCmdLine);
exit(1);
}
BOOL ProgmanWinHelp(HWND hWnd, LPSTR lpHelpFile, WORD wCommand, DWORD dwData)
{
char str[256];
dprintf_exec(stddeb,"WinHelp(%s, %u, %lu)\n",
lpHelpFile, wCommand, dwData);
switch(wCommand) {
case 0:
case HELP_HELPONHELP:
GetWindowsDirectory(str, sizeof(str));
strcat(str, "\\winhelp.exe winhelp.hlp");
dprintf_exec(stddeb,"'%s'\n", str);
break;
case HELP_INDEX:
GetWindowsDirectory(str, sizeof(str));
strcat(str, "\\winhelp.exe ");
strcat(str, lpHelpFile);
dprintf_exec(stddeb,"'%s'\n", str);
break;
default:
return FALSE;
}
WinExec(str, SW_SHOWNORMAL);
return(TRUE);
}
#endif
...@@ -5,6 +5,7 @@ C_SRCS = \ ...@@ -5,6 +5,7 @@ C_SRCS = \
advapi.c \ advapi.c \
code_page.c \ code_page.c \
console.c \ console.c \
cursoricon32.c \
environment.c \ environment.c \
error.c \ error.c \
except.c \ except.c \
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "windows.h" #include "windows.h"
#include "winerror.h" #include "winerror.h"
#include "kernel32.h" #include "kernel32.h"
#include "winnls.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
...@@ -47,3 +48,41 @@ int MultiByteToWideChar(UINT page, DWORD flags, char *src, int srclen, ...@@ -47,3 +48,41 @@ int MultiByteToWideChar(UINT page, DWORD flags, char *src, int srclen,
{ {
return (srclen==-1) ? strlen(src) * 2: srclen*2; return (srclen==-1) ? strlen(src) * 2: srclen*2;
} }
int WideCharToMultiByte(UINT page, DWORD flags, WCHAR *src, int srclen,
char *dst, int dstlen, char* defchar, BOOL *used)
{
int count = 0;
int dont_copy= (dstlen==0);
if(page!=GetACP() && page!=CP_OEMCP && page!=CP_ACP)
fprintf(stdnimp,"Conversion in CP %d not supported\n",page);
if(flags)
fprintf(stdnimp,"WideCharToMultiByte flags %lx not supported\n",flags);
if(used)
*used=0;
while(srclen && (dont_copy || dstlen))
{
if(!dont_copy){
if(*src<256)
*dst = *src;
else
{
/* FIXME: Is this correct ?*/
if(flags & WC_DEFAULTCHAR){
*dst = defchar ? *defchar : '?';
if(used)*used=1;
}
}
dstlen--;
dst++;
}
count++;
if(!*src)
break;
if(srclen!=-1)srclen--;
src++;
}
return count;
}
...@@ -474,3 +474,24 @@ static int TranslateCreationFlags(DWORD create_flags) ...@@ -474,3 +474,24 @@ static int TranslateCreationFlags(DWORD create_flags)
return rc; return rc;
} }
/**************************************************************************
* GetFileAttributes
*/
DWORD GetFileAttributesA(LPCSTR lpFileName)
{
struct stat buf;
DWORD res=0;
if(stat(lpFileName,&buf)==-1)
{
SetLastError(ErrnoToLastError(errno));
return 0;
}
if(buf.st_mode & S_IFREG)
res |= FILE_ATTRIBUTE_NORMAL;
if(buf.st_mode & S_IFDIR)
res |= FILE_ATTRIBUTE_DIRECTORY;
if((buf.st_mode & S_IWRITE) == 0)
res |= FILE_ATTRIBUTE_READONLY;
return res;
}
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "windows.h" #include "windows.h"
#include "winerror.h" #include "winerror.h"
#include "struct32.h" #include "struct32.h"
#include "stackframe.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
...@@ -38,3 +39,10 @@ BOOL WIN32_GetTextExtentPointA(HDC hdc, LPCTSTR str, int length, SIZE32* lpsize) ...@@ -38,3 +39,10 @@ BOOL WIN32_GetTextExtentPointA(HDC hdc, LPCTSTR str, int length, SIZE32* lpsize)
return retval; return retval;
} }
ATOM WIN32_GlobalAddAtomA(LPCTSTR str)
{
char buffer[256]; /* 16-bit atoms are limited to 255 anyway */
lstrcpyn( buffer, str, sizeof(buffer) );
return GlobalAddAtom(MAKE_SEGPTR(buffer));
}
...@@ -132,7 +132,7 @@ HANDLE32 LoadResource32( HINSTANCE hModule, HANDLE32 hRsrc ) ...@@ -132,7 +132,7 @@ HANDLE32 LoadResource32( HINSTANCE hModule, HANDLE32 hRsrc )
struct w_files *wptr = wine_files; struct w_files *wptr = wine_files;
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "LoadResource: module="NPFMT" res="NPFMT"\n", dprintf_resource(stddeb, "LoadResource: module=%04x res=%04x\n",
hModule, hRsrc ); hModule, hRsrc );
if (!hRsrc) return 0; if (!hRsrc) return 0;
while (wptr != NULL && (wptr->hModule != hModule)) while (wptr != NULL && (wptr->hModule != hModule))
...@@ -169,7 +169,7 @@ BOOL FreeResource32( HANDLE32 handle ) ...@@ -169,7 +169,7 @@ BOOL FreeResource32( HANDLE32 handle )
INT AccessResource32( HINSTANCE hModule, HRSRC hRsrc ) INT AccessResource32( HINSTANCE hModule, HRSRC hRsrc )
{ {
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "AccessResource: module="NPFMT" res="NPFMT"\n", dprintf_resource(stddeb, "AccessResource: module=%04x res=%04x\n",
hModule, hRsrc ); hModule, hRsrc );
if (!hRsrc) return 0; if (!hRsrc) return 0;
fprintf(stderr,"AccessResource32: not implemented\n"); fprintf(stderr,"AccessResource32: not implemented\n");
...@@ -183,7 +183,7 @@ INT AccessResource32( HINSTANCE hModule, HRSRC hRsrc ) ...@@ -183,7 +183,7 @@ INT AccessResource32( HINSTANCE hModule, HRSRC hRsrc )
DWORD SizeofResource32( HINSTANCE hModule, HRSRC hRsrc ) DWORD SizeofResource32( HINSTANCE hModule, HRSRC hRsrc )
{ {
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */ hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "SizeofResource: module="NPFMT" res="NPFMT"\n", dprintf_resource(stddeb, "SizeofResource: module=%04x res=%04x\n",
hModule, hRsrc ); hModule, hRsrc );
fprintf(stderr,"SizeofResource32: not implemented\n"); fprintf(stderr,"SizeofResource32: not implemented\n");
return 0; return 0;
...@@ -203,10 +203,10 @@ HANDLE32 WIN32_LoadAcceleratorsW(HINSTANCE instance, LPCWSTR lpTableName) ...@@ -203,10 +203,10 @@ HANDLE32 WIN32_LoadAcceleratorsW(HINSTANCE instance, LPCWSTR lpTableName)
int i, n; int i, n;
if (HIWORD(lpTableName)) if (HIWORD(lpTableName))
dprintf_accel( stddeb, "LoadAccelerators: "NPFMT" '%s'\n", dprintf_accel( stddeb, "LoadAccelerators: %04x '%s'\n",
instance, (char *)( lpTableName ) ); instance, (char *)( lpTableName ) );
else else
dprintf_accel( stddeb, "LoadAccelerators: "NPFMT" %04x\n", dprintf_accel( stddeb, "LoadAccelerators: %04x %04x\n",
instance, LOWORD(lpTableName) ); instance, LOWORD(lpTableName) );
if (!(hRsrc = FindResource32( instance, lpTableName, if (!(hRsrc = FindResource32( instance, lpTableName,
...@@ -261,7 +261,7 @@ WIN32_LoadStringW(HINSTANCE instance, DWORD resource_id, LPWSTR buffer, int bufl ...@@ -261,7 +261,7 @@ WIN32_LoadStringW(HINSTANCE instance, DWORD resource_id, LPWSTR buffer, int bufl
int string_num; int string_num;
int i; int i;
dprintf_resource(stddeb, "LoadString: instance = "NPFMT", id = %04x, buffer = %08x, " dprintf_resource(stddeb, "LoadString: instance = %04x, id = %04x, buffer = %08x, "
"length = %d\n", instance, (int)resource_id, (int) buffer, buflen); "length = %d\n", instance, (int)resource_id, (int) buffer, buflen);
hrsrc = FindResource32( instance, (LPCWSTR)((resource_id>>4)+1), hrsrc = FindResource32( instance, (LPCWSTR)((resource_id>>4)+1),
......
...@@ -6,11 +6,13 @@ ...@@ -6,11 +6,13 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <string.h>
#include "windows.h" #include "windows.h"
#include "winerror.h" #include "winerror.h"
#include "kernel32.h" #include "kernel32.h"
#include "stddebug.h" #include "stddebug.h"
#include "debug.h" #include "debug.h"
#include "xmalloc.h"
/*********************************************************************** /***********************************************************************
* GetCurrentThreadId (KERNEL32.200) * GetCurrentThreadId (KERNEL32.200)
...@@ -36,3 +38,68 @@ HANDLE WINAPI GetCurrentThread(void) ...@@ -36,3 +38,68 @@ HANDLE WINAPI GetCurrentThread(void)
return 0; return 0;
} }
/**********************************************************************
* Critical Sections are currently ignored
*/
void WINAPI InitializeCriticalSection(CRITICAL_SECTION *lpCrit)
{
memset(lpCrit,0,sizeof(CRITICAL_SECTION));
}
void WINAPI EnterCriticalSection(CRITICAL_SECTION* lpCrit)
{
return;
}
void WINAPI LeaveCriticalSection(CRITICAL_SECTION* lpCrit)
{
return;
}
void WINAPI DeleteCriticalSection(CRITICAL_SECTION* lpCrit)
{
return;
}
/***********************************************************************
* Tls is available only for the single thread
*/
static LPVOID* Tls=0;
static int TlsCount=0;
DWORD WINAPI TlsAlloc()
{
if(!Tls){
TlsCount++;
Tls=xmalloc(sizeof(LPVOID));
return 0;
}
Tls=xrealloc(Tls,sizeof(LPVOID)*(++TlsCount));
return TlsCount-1;
}
void TlsFree(DWORD index)
{
/*FIXME: should remember that it has been freed */
return;
}
LPVOID TlsGetValue(DWORD index)
{
if(index>=TlsCount)
{
/* FIXME: Set last error*/
return 0;
}
return Tls[index];
}
void TlsSetValue(DWORD index,LPVOID value)
{
if(index>=TlsCount)
{
/* FIXME: Set last error*/
return;
}
Tls[index]=value;
}
...@@ -322,8 +322,8 @@ HWND USER32_CreateDialogIndirectParamAorW(HINSTANCE hInst,LPVOID templ, ...@@ -322,8 +322,8 @@ HWND USER32_CreateDialogIndirectParamAorW(HINSTANCE hInst,LPVOID templ,
/* FIXME: proper modalframe handling ??*/ /* FIXME: proper modalframe handling ??*/
if (dlgTempl->style & DS_MODALFRAME) exStyle |= WS_EX_DLGMODALFRAME; if (dlgTempl->style & DS_MODALFRAME) exStyle |= WS_EX_DLGMODALFRAME;
/* FIXME: AdjustWindowRectEx */ AdjustWindowRectEx( &rect, dlgTempl->style,
hMenu ? TRUE : FALSE , exStyle );
rect.right -= rect.left; rect.right -= rect.left;
rect.bottom -= rect.top; rect.bottom -= rect.top;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* Caret functions * Caret functions
* *
* Copyright 1993 David Metcalfe * Copyright 1993 David Metcalfe
* Copyright 1996 Frans van Dorsselaer
*/ */
#include "windows.h" #include "windows.h"
...@@ -22,8 +23,7 @@ typedef struct ...@@ -22,8 +23,7 @@ typedef struct
short y; short y;
short width; short width;
short height; short height;
COLORREF color; HBRUSH hBrush;
HBITMAP bitmap;
WORD timeout; WORD timeout;
WORD timerid; WORD timerid;
} CARET; } CARET;
...@@ -35,7 +35,7 @@ typedef enum ...@@ -35,7 +35,7 @@ typedef enum
CARET_TOGGLE, CARET_TOGGLE,
} DISPLAY_CARET; } DISPLAY_CARET;
static CARET Caret = { (HWND)0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static CARET Caret = { 0, };
/***************************************************************** /*****************************************************************
...@@ -52,9 +52,7 @@ HWND CARET_GetHwnd() ...@@ -52,9 +52,7 @@ HWND CARET_GetHwnd()
void CARET_DisplayCaret(DISPLAY_CARET status) void CARET_DisplayCaret(DISPLAY_CARET status)
{ {
HDC hdc; HDC hdc;
HBRUSH hBrush;
HBRUSH hPrevBrush; HBRUSH hPrevBrush;
HRGN rgn;
if (Caret.on && (status == CARET_ON)) return; if (Caret.on && (status == CARET_ON)) return;
if (!Caret.on && (status == CARET_OFF)) return; if (!Caret.on && (status == CARET_OFF)) return;
...@@ -62,21 +60,11 @@ void CARET_DisplayCaret(DISPLAY_CARET status) ...@@ -62,21 +60,11 @@ void CARET_DisplayCaret(DISPLAY_CARET status)
/* So now it's always a toggle */ /* So now it's always a toggle */
Caret.on = !Caret.on; Caret.on = !Caret.on;
hdc = GetDC(Caret.hwnd); if (!(hdc = GetDCEx( Caret.hwnd, 0, DCX_USESTYLE | DCX_CACHE ))) return;
if (Caret.bitmap == (HBITMAP)0 || Caret.bitmap == (HBITMAP)1) hPrevBrush = SelectObject( hdc, Caret.hBrush );
hBrush = CreateSolidBrush(Caret.color); PatBlt( hdc, Caret.x, Caret.y, Caret.width, Caret.height, PATINVERT );
else
hBrush = CreatePatternBrush(Caret.bitmap);
hPrevBrush = SelectObject(hdc, (HANDLE)hBrush);
SetROP2(hdc, R2_XORPEN);
rgn = CreateRectRgn(Caret.x, Caret.y,
Caret.x + Caret.width,
Caret.y + Caret.height);
FillRgn(hdc, rgn, hBrush);
DeleteObject( rgn );
SelectObject( hdc, hPrevBrush ); SelectObject( hdc, hPrevBrush );
DeleteObject( hBrush ); ReleaseDC( Caret.hwnd, hdc );
ReleaseDC(Caret.hwnd, hdc);
} }
...@@ -85,8 +73,8 @@ void CARET_DisplayCaret(DISPLAY_CARET status) ...@@ -85,8 +73,8 @@ void CARET_DisplayCaret(DISPLAY_CARET status)
*/ */
WORD CARET_Callback(HWND hwnd, WORD msg, WORD timerid, LONG ctime) WORD CARET_Callback(HWND hwnd, WORD msg, WORD timerid, LONG ctime)
{ {
dprintf_caret(stddeb,"CARET_Callback: hwnd="NPFMT", timerid=%d, " dprintf_caret(stddeb,"CARET_Callback: hwnd=%04x, timerid=%d, caret=%d\n",
"caret=%d\n", hwnd, timerid, Caret.on); hwnd, timerid, Caret.on);
CARET_DisplayCaret(CARET_TOGGLE); CARET_DisplayCaret(CARET_TOGGLE);
return 0; return 0;
...@@ -157,34 +145,36 @@ static void CARET_Initialize() ...@@ -157,34 +145,36 @@ static void CARET_Initialize()
*/ */
BOOL CreateCaret(HWND hwnd, HBITMAP bitmap, INT width, INT height) BOOL CreateCaret(HWND hwnd, HBITMAP bitmap, INT width, INT height)
{ {
dprintf_caret(stddeb,"CreateCaret: hwnd="NPFMT"\n", hwnd); dprintf_caret(stddeb,"CreateCaret: hwnd=%04x\n", hwnd);
if (!hwnd) return FALSE; if (!hwnd) return FALSE;
/* if cursor already exists, destroy it */ /* if cursor already exists, destroy it */
if (Caret.hwnd) DestroyCaret(); if (Caret.hwnd) DestroyCaret();
if (bitmap && bitmap != (HBITMAP)1) Caret.bitmap = bitmap; if (bitmap && (bitmap != 1))
{
if (width) BITMAP bmp;
Caret.width = width; if (!GetObject( bitmap, sizeof(bmp), (LPSTR)&bmp )) return FALSE;
else Caret.width = bmp.bmWidth;
Caret.width = GetSystemMetrics(SM_CXBORDER); Caret.height = bmp.bmHeight;
/* FIXME: we should make a copy of the bitmap instead of a brush */
if (height) Caret.hBrush = CreatePatternBrush( bitmap );
Caret.height = height; }
else else
Caret.height = GetSystemMetrics(SM_CYBORDER); {
Caret.width = width ? width : GetSystemMetrics(SM_CXBORDER);
Caret.height = height ? height : GetSystemMetrics(SM_CYBORDER);
Caret.hBrush = CreateSolidBrush( bitmap ? GetSysColor(COLOR_GRAYTEXT) :
GetSysColor(COLOR_WINDOW) );
}
Caret.hwnd = hwnd; Caret.hwnd = hwnd;
Caret.hidden = 1; Caret.hidden = 1;
Caret.on = FALSE; Caret.on = FALSE;
Caret.x = 0; Caret.x = 0;
Caret.y = 0; Caret.y = 0;
if (bitmap == (HBITMAP)1)
Caret.color = GetSysColor(COLOR_GRAYTEXT);
else
Caret.color = GetSysColor(COLOR_WINDOW);
Caret.timeout = GetProfileInt( "windows", "CursorBlinkRate", 750 ); Caret.timeout = GetProfileInt( "windows", "CursorBlinkRate", 750 );
CARET_Initialize(); CARET_Initialize();
...@@ -201,9 +191,10 @@ BOOL DestroyCaret() ...@@ -201,9 +191,10 @@ BOOL DestroyCaret()
{ {
if (!Caret.hwnd) return FALSE; if (!Caret.hwnd) return FALSE;
dprintf_caret(stddeb,"DestroyCaret: hwnd="NPFMT", timerid=%d\n", dprintf_caret(stddeb,"DestroyCaret: hwnd=%04x, timerid=%d\n",
Caret.hwnd, Caret.timerid); Caret.hwnd, Caret.timerid);
DeleteObject( Caret.hBrush );
CARET_KillTimer(); CARET_KillTimer();
CARET_DisplayCaret(CARET_OFF); CARET_DisplayCaret(CARET_OFF);
...@@ -243,8 +234,8 @@ void HideCaret(HWND hwnd) ...@@ -243,8 +234,8 @@ void HideCaret(HWND hwnd)
if (!Caret.hwnd) return; if (!Caret.hwnd) return;
if (hwnd && (Caret.hwnd != hwnd)) return; if (hwnd && (Caret.hwnd != hwnd)) return;
dprintf_caret(stddeb,"HideCaret: hwnd="NPFMT", hidden=%d\n", dprintf_caret(stddeb,"HideCaret: hwnd=%04x, hidden=%d\n",
hwnd, Caret.hidden); hwnd, Caret.hidden);
CARET_KillTimer(); CARET_KillTimer();
CARET_DisplayCaret(CARET_OFF); CARET_DisplayCaret(CARET_OFF);
...@@ -261,7 +252,7 @@ void ShowCaret(HWND hwnd) ...@@ -261,7 +252,7 @@ void ShowCaret(HWND hwnd)
if (!Caret.hwnd) return; if (!Caret.hwnd) return;
if (hwnd && (Caret.hwnd != hwnd)) return; if (hwnd && (Caret.hwnd != hwnd)) return;
dprintf_caret(stddeb,"ShowCaret: hwnd="NPFMT", hidden=%d\n", dprintf_caret(stddeb,"ShowCaret: hwnd=%04x, hidden=%d\n",
hwnd, Caret.hidden); hwnd, Caret.hidden);
if (Caret.hidden) if (Caret.hidden)
...@@ -284,7 +275,7 @@ void SetCaretBlinkTime(WORD msecs) ...@@ -284,7 +275,7 @@ void SetCaretBlinkTime(WORD msecs)
{ {
if (!Caret.hwnd) return; if (!Caret.hwnd) return;
dprintf_caret(stddeb,"SetCaretBlinkTime: hwnd="NPFMT", msecs=%d\n", dprintf_caret(stddeb,"SetCaretBlinkTime: hwnd=%04x, msecs=%d\n",
Caret.hwnd, msecs); Caret.hwnd, msecs);
Caret.timeout = msecs; Caret.timeout = msecs;
...@@ -300,7 +291,7 @@ WORD GetCaretBlinkTime() ...@@ -300,7 +291,7 @@ WORD GetCaretBlinkTime()
{ {
if (!Caret.hwnd) return 0; if (!Caret.hwnd) return 0;
dprintf_caret(stddeb,"GetCaretBlinkTime: hwnd="NPFMT", msecs=%d\n", dprintf_caret(stddeb,"GetCaretBlinkTime: hwnd=%04x, msecs=%d\n",
Caret.hwnd, Caret.timeout); Caret.hwnd, Caret.timeout);
return Caret.timeout; return Caret.timeout;
...@@ -315,8 +306,8 @@ void GetCaretPos(LPPOINT pt) ...@@ -315,8 +306,8 @@ void GetCaretPos(LPPOINT pt)
{ {
if (!Caret.hwnd || !pt) return; if (!Caret.hwnd || !pt) return;
dprintf_caret(stddeb,"GetCaretPos: hwnd="NPFMT", pt=%p, x=%d, y=%d\n", dprintf_caret(stddeb,"GetCaretPos: hwnd=%04x, pt=%p, x=%d, y=%d\n",
Caret.hwnd, pt, Caret.x, Caret.y); Caret.hwnd, pt, Caret.x, Caret.y);
pt->x = Caret.x; pt->x = Caret.x;
pt->y = Caret.y; pt->y = Caret.y;
......
...@@ -159,7 +159,7 @@ ATOM RegisterClass( LPWNDCLASS class ) ...@@ -159,7 +159,7 @@ ATOM RegisterClass( LPWNDCLASS class )
HCLASS handle, prevClass; HCLASS handle, prevClass;
int classExtra; int classExtra;
dprintf_class( stddeb, "RegisterClass: wndproc=%08lx hinst="NPFMT" name='%s' background "NPFMT"\n", dprintf_class( stddeb, "RegisterClass: wndproc=%08lx hinst=%04x name='%s' background %04x\n",
(DWORD)class->lpfnWndProc, class->hInstance, (DWORD)class->lpfnWndProc, class->hInstance,
HIWORD(class->lpszClassName) ? HIWORD(class->lpszClassName) ?
(char *)PTR_SEG_TO_LIN(class->lpszClassName) : "(int)", (char *)PTR_SEG_TO_LIN(class->lpszClassName) : "(int)",
...@@ -258,11 +258,7 @@ BOOL UnregisterClass( SEGPTR className, HANDLE hinstance ) ...@@ -258,11 +258,7 @@ BOOL UnregisterClass( SEGPTR className, HANDLE hinstance )
if (classPtr->wc.hbrBackground) DeleteObject( classPtr->wc.hbrBackground ); if (classPtr->wc.hbrBackground) DeleteObject( classPtr->wc.hbrBackground );
GlobalDeleteAtom( classPtr->atomName ); GlobalDeleteAtom( classPtr->atomName );
if (HIWORD(classPtr->wc.lpszMenuName)) if (HIWORD(classPtr->wc.lpszMenuName))
#ifdef WINELIB32
USER_HEAP_FREE( (HANDLE)classPtr->wc.lpszMenuName ); USER_HEAP_FREE( (HANDLE)classPtr->wc.lpszMenuName );
#else
USER_HEAP_FREE( LOWORD(classPtr->wc.lpszMenuName) );
#endif
USER_HEAP_FREE( class ); USER_HEAP_FREE( class );
return TRUE; return TRUE;
} }
...@@ -336,7 +332,7 @@ int GetClassName(HWND hwnd, LPSTR lpClassName, short maxCount) ...@@ -336,7 +332,7 @@ int GetClassName(HWND hwnd, LPSTR lpClassName, short maxCount)
CLASS *classPtr; CLASS *classPtr;
/* FIXME: We have the find the correct hInstance */ /* FIXME: We have the find the correct hInstance */
dprintf_class(stddeb,"GetClassName("NPFMT",%p,%d)\n",hwnd,lpClassName,maxCount); dprintf_class(stddeb,"GetClassName(%04x,%p,%d)\n",hwnd,lpClassName,maxCount);
if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0; if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0;
if (!(classPtr = CLASS_FindClassPtr(wndPtr->hClass))) return 0; if (!(classPtr = CLASS_FindClassPtr(wndPtr->hClass))) return 0;
...@@ -351,7 +347,7 @@ BOOL GetClassInfo( HANDLE hInstance, SEGPTR name, LPWNDCLASS lpWndClass ) ...@@ -351,7 +347,7 @@ BOOL GetClassInfo( HANDLE hInstance, SEGPTR name, LPWNDCLASS lpWndClass )
{ {
CLASS *classPtr; CLASS *classPtr;
dprintf_class( stddeb, "GetClassInfo: hInstance="NPFMT" className=%s\n", dprintf_class( stddeb, "GetClassInfo: hInstance=%04x className=%s\n",
hInstance, hInstance,
HIWORD(name) ? (char *)PTR_SEG_TO_LIN(name) : "(int)" ); HIWORD(name) ? (char *)PTR_SEG_TO_LIN(name) : "(int)" );
......
...@@ -108,26 +108,25 @@ static BOOL DCE_GetVisRect( WND *wndPtr, BOOL clientArea, RECT *lprect ) ...@@ -108,26 +108,25 @@ static BOOL DCE_GetVisRect( WND *wndPtr, BOOL clientArea, RECT *lprect )
return FALSE; return FALSE;
} }
while (wndPtr->hwndParent) while (wndPtr->parent)
{ {
WND *parentPtr = WIN_FindWndPtr( wndPtr->hwndParent ); wndPtr = wndPtr->parent;
if (!(parentPtr->dwStyle & WS_VISIBLE) || if (!(wndPtr->dwStyle & WS_VISIBLE) ||
(parentPtr->flags & WIN_NO_REDRAW) || (wndPtr->flags & WIN_NO_REDRAW) ||
(parentPtr->dwStyle & WS_ICONIC)) (wndPtr->dwStyle & WS_ICONIC))
{ {
SetRectEmpty( lprect ); /* Clip everything */ SetRectEmpty( lprect ); /* Clip everything */
return FALSE; return FALSE;
} }
xoffset += parentPtr->rectClient.left; xoffset += wndPtr->rectClient.left;
yoffset += parentPtr->rectClient.top; yoffset += wndPtr->rectClient.top;
OffsetRect( lprect, parentPtr->rectClient.left, OffsetRect( lprect, wndPtr->rectClient.left,
parentPtr->rectClient.top ); wndPtr->rectClient.top );
/* Warning!! we assume that IntersectRect() handles the case */ /* Warning!! we assume that IntersectRect() handles the case */
/* where the destination is the same as one of the sources. */ /* where the destination is the same as one of the sources. */
if (!IntersectRect( lprect, lprect, &parentPtr->rectClient )) if (!IntersectRect( lprect, lprect, &wndPtr->rectClient ))
return FALSE; /* Visible rectangle is empty */ return FALSE; /* Visible rectangle is empty */
wndPtr = parentPtr;
} }
OffsetRect( lprect, -xoffset, -yoffset ); OffsetRect( lprect, -xoffset, -yoffset );
return TRUE; return TRUE;
...@@ -143,30 +142,28 @@ static BOOL DCE_GetVisRect( WND *wndPtr, BOOL clientArea, RECT *lprect ) ...@@ -143,30 +142,28 @@ static BOOL DCE_GetVisRect( WND *wndPtr, BOOL clientArea, RECT *lprect )
* is destroyed. Used to implement DCX_CLIPSIBLINGS and * is destroyed. Used to implement DCX_CLIPSIBLINGS and
* DCX_CLIPCHILDREN styles. * DCX_CLIPCHILDREN styles.
*/ */
static HRGN DCE_ClipWindows( HWND hwndStart, HWND hwndEnd, static HRGN DCE_ClipWindows( WND *pWndStart, WND *pWndEnd,
HRGN hrgn, int xoffset, int yoffset ) HRGN hrgn, int xoffset, int yoffset )
{ {
HRGN hrgnNew; HRGN hrgnNew;
WND *wndPtr;
if (!hwndStart) return hrgn; if (!pWndStart) return hrgn;
if (!(hrgnNew = CreateRectRgn( 0, 0, 0, 0 ))) if (!(hrgnNew = CreateRectRgn( 0, 0, 0, 0 )))
{ {
DeleteObject( hrgn ); DeleteObject( hrgn );
return 0; return 0;
} }
for (; hwndStart != hwndEnd; hwndStart = wndPtr->hwndNext) for (; pWndStart != pWndEnd; pWndStart = pWndStart->next)
{ {
wndPtr = WIN_FindWndPtr( hwndStart ); if (!(pWndStart->dwStyle & WS_VISIBLE)) continue;
if (!(wndPtr->dwStyle & WS_VISIBLE)) continue; SetRectRgn( hrgnNew, pWndStart->rectWindow.left + xoffset,
SetRectRgn( hrgnNew, wndPtr->rectWindow.left + xoffset, pWndStart->rectWindow.top + yoffset,
wndPtr->rectWindow.top + yoffset, pWndStart->rectWindow.right + xoffset,
wndPtr->rectWindow.right + xoffset, pWndStart->rectWindow.bottom + yoffset );
wndPtr->rectWindow.bottom + yoffset );
if (!CombineRgn( hrgn, hrgn, hrgnNew, RGN_DIFF )) break; if (!CombineRgn( hrgn, hrgn, hrgnNew, RGN_DIFF )) break;
} }
DeleteObject( hrgnNew ); DeleteObject( hrgnNew );
if (hwndStart != hwndEnd) /* something went wrong */ if (pWndStart != pWndEnd) /* something went wrong */
{ {
DeleteObject( hrgn ); DeleteObject( hrgn );
return 0; return 0;
...@@ -207,7 +204,7 @@ HRGN DCE_GetVisRgn( HWND hwnd, WORD flags ) ...@@ -207,7 +204,7 @@ HRGN DCE_GetVisRgn( HWND hwnd, WORD flags )
yoffset = wndPtr->rectClient.top - wndPtr->rectWindow.top; yoffset = wndPtr->rectClient.top - wndPtr->rectWindow.top;
} }
else xoffset = yoffset = 0; else xoffset = yoffset = 0;
hrgn = DCE_ClipWindows( wndPtr->hwndChild, 0, hrgn, xoffset, yoffset ); hrgn = DCE_ClipWindows( wndPtr->child, NULL, hrgn, xoffset, yoffset );
if (!hrgn) return 0; if (!hrgn) return 0;
} }
...@@ -225,8 +222,8 @@ HRGN DCE_GetVisRgn( HWND hwnd, WORD flags ) ...@@ -225,8 +222,8 @@ HRGN DCE_GetVisRgn( HWND hwnd, WORD flags )
} }
if (flags & DCX_CLIPSIBLINGS) if (flags & DCX_CLIPSIBLINGS)
{ {
hrgn = DCE_ClipWindows( GetWindow( wndPtr->hwndParent, GW_CHILD ), hrgn = DCE_ClipWindows( wndPtr->parent ? wndPtr->parent->child : NULL,
hwnd, hrgn, xoffset, yoffset ); wndPtr, hrgn, xoffset, yoffset );
if (!hrgn) return 0; if (!hrgn) return 0;
} }
...@@ -234,12 +231,11 @@ HRGN DCE_GetVisRgn( HWND hwnd, WORD flags ) ...@@ -234,12 +231,11 @@ HRGN DCE_GetVisRgn( HWND hwnd, WORD flags )
while (wndPtr->dwStyle & WS_CHILD) while (wndPtr->dwStyle & WS_CHILD)
{ {
hwnd = wndPtr->hwndParent; wndPtr = wndPtr->parent;
wndPtr = WIN_FindWndPtr( hwnd );
xoffset -= wndPtr->rectClient.left; xoffset -= wndPtr->rectClient.left;
yoffset -= wndPtr->rectClient.top; yoffset -= wndPtr->rectClient.top;
hrgn = DCE_ClipWindows( GetWindow( wndPtr->hwndParent, GW_CHILD ), hrgn = DCE_ClipWindows( wndPtr->parent->child, wndPtr,
hwnd, hrgn, xoffset, yoffset ); hrgn, xoffset, yoffset );
if (!hrgn) return 0; if (!hrgn) return 0;
} }
return hrgn; return hrgn;
...@@ -275,7 +271,7 @@ static void DCE_SetDrawable( WND *wndPtr, DC *dc, WORD flags ) ...@@ -275,7 +271,7 @@ static void DCE_SetDrawable( WND *wndPtr, DC *dc, WORD flags )
} }
while (!wndPtr->window) while (!wndPtr->window)
{ {
wndPtr = WIN_FindWndPtr( wndPtr->hwndParent ); wndPtr = wndPtr->parent;
dc->w.DCOrgX += wndPtr->rectClient.left; dc->w.DCOrgX += wndPtr->rectClient.left;
dc->w.DCOrgY += wndPtr->rectClient.top; dc->w.DCOrgY += wndPtr->rectClient.top;
} }
...@@ -354,12 +350,12 @@ HDC GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags ) ...@@ -354,12 +350,12 @@ HDC GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
{ {
if (flags & DCX_PARENTCLIP) /* Get a VisRgn for the parent */ if (flags & DCX_PARENTCLIP) /* Get a VisRgn for the parent */
{ {
WND *parentPtr = WIN_FindWndPtr( wndPtr->hwndParent ); WND *parentPtr = wndPtr->parent;
DWORD newflags = flags & ~(DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN | DWORD newflags = flags & ~(DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN |
DCX_WINDOW); DCX_WINDOW);
if (parentPtr->dwStyle & WS_CLIPSIBLINGS) if (parentPtr->dwStyle & WS_CLIPSIBLINGS)
newflags |= DCX_CLIPSIBLINGS; newflags |= DCX_CLIPSIBLINGS;
hrgnVisible = DCE_GetVisRgn( wndPtr->hwndParent, newflags ); hrgnVisible = DCE_GetVisRgn( parentPtr->hwndSelf, newflags );
if (flags & DCX_WINDOW) if (flags & DCX_WINDOW)
OffsetRgn( hrgnVisible, -wndPtr->rectWindow.left, OffsetRgn( hrgnVisible, -wndPtr->rectWindow.left,
-wndPtr->rectWindow.top ); -wndPtr->rectWindow.top );
...@@ -384,7 +380,7 @@ HDC GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags ) ...@@ -384,7 +380,7 @@ HDC GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
SelectVisRgn( hdc, hrgnVisible ); SelectVisRgn( hdc, hrgnVisible );
DeleteObject( hrgnVisible ); DeleteObject( hrgnVisible );
dprintf_dc(stddeb, "GetDCEx("NPFMT","NPFMT",0x%lx): returning "NPFMT"\n", dprintf_dc(stddeb, "GetDCEx(%04x,%04x,0x%lx): returning %04x\n",
hwnd, hrgnClip, flags, hdc); hwnd, hrgnClip, flags, hdc);
return hdc; return hdc;
} }
...@@ -424,7 +420,7 @@ int ReleaseDC( HWND hwnd, HDC hdc ) ...@@ -424,7 +420,7 @@ int ReleaseDC( HWND hwnd, HDC hdc )
HANDLE hdce; HANDLE hdce;
DCE * dce = NULL; DCE * dce = NULL;
dprintf_dc(stddeb, "ReleaseDC: "NPFMT" "NPFMT"\n", hwnd, hdc ); dprintf_dc(stddeb, "ReleaseDC: %04x %04x\n", hwnd, hdc );
for (hdce = firstDCE; (hdce); hdce = dce->hNext) for (hdce = firstDCE; (hdce); hdce = dce->hNext)
{ {
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
* *
* Copyright 1993 Alexandre Julliard * Copyright 1993 Alexandre Julliard
* *
static char Copyright[] = "Copyright Alexandre Julliard, 1993"; */
*/
#include "windows.h" #include "windows.h"
#include "dialog.h" #include "dialog.h"
......
...@@ -122,7 +122,7 @@ LRESULT DefWindowProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) ...@@ -122,7 +122,7 @@ LRESULT DefWindowProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
case WM_MOUSEACTIVATE: case WM_MOUSEACTIVATE:
if (wndPtr->dwStyle & WS_CHILD) if (wndPtr->dwStyle & WS_CHILD)
{ {
LONG ret = SendMessage( wndPtr->hwndParent, WM_MOUSEACTIVATE, LONG ret = SendMessage( wndPtr->parent->hwndSelf, WM_MOUSEACTIVATE,
wParam, lParam ); wParam, lParam );
if (ret) return ret; if (ret) return ret;
} }
...@@ -251,7 +251,8 @@ LRESULT DefWindowProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) ...@@ -251,7 +251,8 @@ LRESULT DefWindowProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
case WM_SETCURSOR: case WM_SETCURSOR:
if (wndPtr->dwStyle & WS_CHILD) if (wndPtr->dwStyle & WS_CHILD)
if (SendMessage(wndPtr->hwndParent, WM_SETCURSOR, wParam, lParam)) if (SendMessage(wndPtr->parent->hwndSelf, WM_SETCURSOR,
wParam, lParam))
return TRUE; return TRUE;
return NC_HandleSetCursor( hwnd, wParam, lParam ); return NC_HandleSetCursor( hwnd, wParam, lParam );
...@@ -300,7 +301,7 @@ LRESULT DefWindowProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) ...@@ -300,7 +301,7 @@ LRESULT DefWindowProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
case WM_SHOWWINDOW: case WM_SHOWWINDOW:
if( !lParam ) return 0; /* sent from ShowWindow */ if( !lParam ) return 0; /* sent from ShowWindow */
if( !(wndPtr->dwStyle & WS_POPUP) || !wndPtr->hwndOwner ) if( !(wndPtr->dwStyle & WS_POPUP) || !wndPtr->owner )
return 0; return 0;
if( wndPtr->dwStyle & WS_VISIBLE ) if( wndPtr->dwStyle & WS_VISIBLE )
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
* *
* Copyright 1993, 1994 Alexandre Julliard * Copyright 1993, 1994 Alexandre Julliard
* *
static char Copyright[] = "Copyright Alexandre Julliard, 1993, 1994"; */
*/
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
...@@ -59,16 +58,10 @@ BOOL DIALOG_Init() ...@@ -59,16 +58,10 @@ BOOL DIALOG_Init()
*/ */
HWND DIALOG_GetFirstTabItem( HWND hwndDlg ) HWND DIALOG_GetFirstTabItem( HWND hwndDlg )
{ {
HWND hwnd; WND *pWnd = WIN_FindWndPtr( hwndDlg );
WND *wndPtr = WIN_FindWndPtr( hwndDlg ); for (pWnd = pWnd->child; pWnd; pWnd = pWnd->next)
hwnd = wndPtr->hwndChild; if (pWnd->dwStyle & WS_TABSTOP) return pWnd->hwndSelf;
while(hwnd) return 0;
{
wndPtr = WIN_FindWndPtr( hwnd );
if (wndPtr->dwStyle & WS_TABSTOP) break;
hwnd = wndPtr->hwndNext;
}
return hwnd;
} }
...@@ -218,8 +211,8 @@ HWND CreateDialogParam( HINSTANCE hInst, SEGPTR dlgTemplate, ...@@ -218,8 +211,8 @@ HWND CreateDialogParam( HINSTANCE hInst, SEGPTR dlgTemplate,
HGLOBAL hmem; HGLOBAL hmem;
SEGPTR data; SEGPTR data;
dprintf_dialog(stddeb, "CreateDialogParam: "NPFMT","SPFMT","NPFMT",%08lx,%ld\n", dprintf_dialog(stddeb, "CreateDialogParam: %04x,%08lx,%04x,%08lx,%ld\n",
hInst, dlgTemplate, owner, (DWORD)dlgProc, param ); hInst, (DWORD)dlgTemplate, owner, (DWORD)dlgProc, param );
if (!(hRsrc = FindResource( hInst, dlgTemplate, RT_DIALOG ))) return 0; if (!(hRsrc = FindResource( hInst, dlgTemplate, RT_DIALOG ))) return 0;
if (!(hmem = LoadResource( hInst, hRsrc ))) return 0; if (!(hmem = LoadResource( hInst, hRsrc ))) return 0;
...@@ -411,7 +404,7 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate, ...@@ -411,7 +404,7 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate,
header->y * yUnit / 8, header->y * yUnit / 8,
header->cx * xUnit / 4, header->cx * xUnit / 4,
header->cy * yUnit / 8, header->cy * yUnit / 8,
hwnd, (HMENU)((DWORD)header->id), hwnd, (HMENU)header->id,
dlgInfo->hDialogHeap, (SEGPTR)0 ); dlgInfo->hDialogHeap, (SEGPTR)0 );
} }
else else
...@@ -422,7 +415,7 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate, ...@@ -422,7 +415,7 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate,
header->y * yUnit / 8, header->y * yUnit / 8,
header->cx * xUnit / 4, header->cx * xUnit / 4,
header->cy * yUnit / 8, header->cy * yUnit / 8,
hwnd, (HMENU)((DWORD)header->id), hwnd, (HMENU)header->id,
hInst, (SEGPTR)0 ); hInst, (SEGPTR)0 );
} }
...@@ -523,8 +516,8 @@ INT DialogBoxParam( HINSTANCE hInst, SEGPTR dlgTemplate, ...@@ -523,8 +516,8 @@ INT DialogBoxParam( HINSTANCE hInst, SEGPTR dlgTemplate,
{ {
HWND hwnd; HWND hwnd;
dprintf_dialog(stddeb, "DialogBoxParam: "NPFMT","SPFMT","NPFMT",%08lx,%ld\n", dprintf_dialog(stddeb, "DialogBoxParam: %04x,%08lx,%04x,%08lx,%ld\n",
hInst, dlgTemplate, owner, (DWORD)dlgProc, param ); hInst, (DWORD)dlgTemplate, owner, (DWORD)dlgProc, param );
hwnd = CreateDialogParam( hInst, dlgTemplate, owner, dlgProc, param ); hwnd = CreateDialogParam( hInst, dlgTemplate, owner, dlgProc, param );
if (hwnd) return DIALOG_DoDialogBox( hwnd, owner ); if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
return -1; return -1;
...@@ -567,7 +560,7 @@ BOOL EndDialog( HWND hwnd, INT retval ) ...@@ -567,7 +560,7 @@ BOOL EndDialog( HWND hwnd, INT retval )
DIALOGINFO * dlgInfo = (DIALOGINFO *)wndPtr->wExtra; DIALOGINFO * dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
dlgInfo->msgResult = retval; dlgInfo->msgResult = retval;
dlgInfo->fEnd = TRUE; dlgInfo->fEnd = TRUE;
dprintf_dialog(stddeb, "EndDialog: "NPFMT" %d\n", hwnd, retval ); dprintf_dialog(stddeb, "EndDialog: %04x %d\n", hwnd, retval );
return TRUE; return TRUE;
} }
...@@ -698,18 +691,11 @@ int GetDlgCtrlID( HWND hwnd ) ...@@ -698,18 +691,11 @@ int GetDlgCtrlID( HWND hwnd )
*/ */
HWND GetDlgItem( HWND hwndDlg, WORD id ) HWND GetDlgItem( HWND hwndDlg, WORD id )
{ {
HWND curChild; WND *pWnd;
WND * childPtr;
WND * wndPtr;
if (!(wndPtr = WIN_FindWndPtr( hwndDlg ))) return 0; if (!(pWnd = WIN_FindWndPtr( hwndDlg ))) return 0;
curChild = wndPtr->hwndChild; for (pWnd = pWnd->child; pWnd; pWnd = pWnd->next)
while(curChild) if (pWnd->wIDmenu == id) return pWnd->hwndSelf;
{
childPtr = WIN_FindWndPtr( curChild );
if (childPtr->wIDmenu == id) return curChild;
curChild = childPtr->hwndNext;
}
return 0; return 0;
} }
...@@ -811,25 +797,20 @@ WORD IsDlgButtonChecked( HWND hwnd, WORD id ) ...@@ -811,25 +797,20 @@ WORD IsDlgButtonChecked( HWND hwnd, WORD id )
*/ */
BOOL CheckRadioButton( HWND hwndDlg, UINT firstID, UINT lastID, UINT checkID ) BOOL CheckRadioButton( HWND hwndDlg, UINT firstID, UINT lastID, UINT checkID )
{ {
HWND button = GetWindow( hwndDlg, GW_CHILD ); WND *pWnd = WIN_FindWndPtr( hwndDlg );
WND *wndPtr; if (!pWnd) return FALSE;
while (button) for (pWnd = pWnd->child; pWnd; pWnd = pWnd->next)
{ if ((pWnd->wIDmenu == firstID) || (pWnd->wIDmenu == lastID)) break;
if (!(wndPtr = WIN_FindWndPtr( button ))) return FALSE; if (!pWnd) return FALSE;
if ((wndPtr->wIDmenu == firstID) || (wndPtr->wIDmenu == lastID)) break;
button = wndPtr->hwndNext;
}
if (!button) return FALSE;
if (wndPtr->wIDmenu == lastID) if (pWnd->wIDmenu == lastID)
lastID = firstID; /* Buttons are in reverse order */ lastID = firstID; /* Buttons are in reverse order */
while (button) while (pWnd)
{ {
if (!(wndPtr = WIN_FindWndPtr( button ))) return FALSE; SendMessage(pWnd->hwndSelf, BM_SETCHECK, (pWnd->wIDmenu == checkID),0);
SendMessage( button, BM_SETCHECK, (wndPtr->wIDmenu == checkID), 0 ); if (pWnd->wIDmenu == lastID) break;
if (wndPtr->wIDmenu == lastID) break; pWnd = pWnd->next;
button = wndPtr->hwndNext;
} }
return TRUE; return TRUE;
} }
...@@ -865,46 +846,39 @@ void MapDialogRect( HWND hwnd, LPRECT rect ) ...@@ -865,46 +846,39 @@ void MapDialogRect( HWND hwnd, LPRECT rect )
*/ */
HWND GetNextDlgGroupItem( HWND hwndDlg, HWND hwndCtrl, BOOL fPrevious ) HWND GetNextDlgGroupItem( HWND hwndDlg, HWND hwndCtrl, BOOL fPrevious )
{ {
HWND hwnd, hwndStart; WND *pWnd, *pWndStart, *pWndCtrl, *pWndDlg;
WND * dlgPtr, * ctrlPtr, * wndPtr;
if (!(dlgPtr = WIN_FindWndPtr( hwndDlg ))) return 0; if (!(pWndDlg = WIN_FindWndPtr( hwndDlg ))) return 0;
if (!(ctrlPtr = WIN_FindWndPtr( hwndCtrl ))) return 0; if (!(pWndCtrl = WIN_FindWndPtr( hwndCtrl ))) return 0;
if (ctrlPtr->hwndParent != hwndDlg) return 0; if (pWndCtrl->parent != pWndDlg) return 0;
if (!fPrevious && ctrlPtr->hwndNext) /*Check if next control is in group*/ if (!fPrevious && pWndCtrl->next) /* Check if next control is in group */
{ {
wndPtr = WIN_FindWndPtr( ctrlPtr->hwndNext ); if (!(pWndCtrl->next->dwStyle & WS_GROUP))
if (!(wndPtr->dwStyle & WS_GROUP)) return ctrlPtr->hwndNext; return pWndCtrl->next->hwndSelf;
} }
/* Now we will have to find the start of the group */ /* Now we will have to find the start of the group */
hwndStart = hwnd = dlgPtr->hwndChild; for (pWnd = pWndStart = pWndDlg->child; pWnd; pWnd = pWnd->next)
while (hwnd)
{ {
wndPtr = WIN_FindWndPtr( hwnd ); if (pWnd->dwStyle & WS_GROUP) pWndStart = pWnd; /* Start of a group */
if (wndPtr->dwStyle & WS_GROUP) hwndStart = hwnd; /*Start of a group*/ if (pWnd == pWndCtrl) break;
if (hwnd == hwndCtrl) break;
hwnd = wndPtr->hwndNext;
} }
if (!hwnd) fprintf(stderr, "GetNextDlgGroupItem: hwnd not in dialog!\n"); if (!pWnd) fprintf(stderr, "GetNextDlgGroupItem: hwnd not in dialog!\n");
/* only case left for forward search: wraparound */ /* only case left for forward search: wraparound */
if (!fPrevious) return hwndStart; if (!fPrevious) return pWndStart->hwndSelf;
hwnd = hwndStart; pWnd = pWndStart->next;
wndPtr = WIN_FindWndPtr( hwnd ); while (pWnd && (pWnd != pWndCtrl))
hwnd = wndPtr->hwndNext;
while (hwnd && (hwnd != hwndCtrl))
{ {
wndPtr = WIN_FindWndPtr( hwnd ); if (pWnd->dwStyle & WS_GROUP) break;
if (wndPtr->dwStyle & WS_GROUP) break; pWndStart = pWnd;
hwndStart = hwnd; pWnd = pWnd->next;
hwnd = wndPtr->hwndNext;
} }
return hwndStart; return pWndStart->hwndSelf;
} }
...@@ -913,26 +887,24 @@ HWND GetNextDlgGroupItem( HWND hwndDlg, HWND hwndCtrl, BOOL fPrevious ) ...@@ -913,26 +887,24 @@ HWND GetNextDlgGroupItem( HWND hwndDlg, HWND hwndCtrl, BOOL fPrevious )
*/ */
HWND GetNextDlgTabItem( HWND hwndDlg, HWND hwndCtrl, BOOL fPrevious ) HWND GetNextDlgTabItem( HWND hwndDlg, HWND hwndCtrl, BOOL fPrevious )
{ {
HWND hwnd, hwndLast; WND *pWnd, *pWndLast, *pWndCtrl, *pWndDlg;
WND * dlgPtr, * ctrlPtr, * wndPtr;
if (!(dlgPtr = WIN_FindWndPtr( hwndDlg ))) return 0; if (!(pWndDlg = WIN_FindWndPtr( hwndDlg ))) return 0;
if (!(ctrlPtr = WIN_FindWndPtr( hwndCtrl ))) return 0; if (!(pWndCtrl = WIN_FindWndPtr( hwndCtrl ))) return 0;
if (ctrlPtr->hwndParent != hwndDlg) return 0; if (pWndCtrl->parent != pWndDlg) return 0;
hwndLast = hwndCtrl; pWndLast = pWndCtrl;
hwnd = ctrlPtr->hwndNext; pWnd = pWndCtrl->next;
while (1) while (1)
{ {
if (!hwnd) hwnd = dlgPtr->hwndChild; if (!pWnd) pWnd = pWndDlg->child;
if (hwnd == hwndCtrl) break; if (pWnd == pWndCtrl) break;
wndPtr = WIN_FindWndPtr( hwnd ); if ((pWnd->dwStyle & WS_TABSTOP) && (pWnd->dwStyle & WS_VISIBLE))
if ((wndPtr->dwStyle & WS_TABSTOP) && (wndPtr->dwStyle & WS_VISIBLE))
{ {
hwndLast = hwnd; pWndLast = pWnd;
if (!fPrevious) break; if (!fPrevious) break;
} }
hwnd = wndPtr->hwndNext; pWnd = pWnd->next;
} }
return hwndLast; return pWndLast->hwndSelf;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment