Release 960712
Fri Jul 12 17:43:05 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [controls/scroll.c]
Use Win32 heap functions to allocate scroll-bar info structure.
* [debugger/dbg.y] [debugger/registers.c]
Added support for FS and GS segment registers.
Check that segment registers value are OK before returning from
the signal handler.
* [tools/build.c] [if1632/relay.c] [loader/builtin.c]
Changed relay debugging for Win32 function: the relay code now
passes the entry point address instead of the function name.
* [tools/build.c] [miscemu/*.c]
Added support for data entry points in Win32 DLLs.
Added 'cdecl' function type for Win32.
For 'register' function, the relay code now passes a pointer to
the SIGCONTEXT structure.
* [include/registers.h] [include/wine.h]
Moved SIGCONTEXT structure definition in registers.h.
* [loader/pe_image.c]
Don't die at once if some Win32 entry points cannot be found, but
set them to NULL, just like we do for Win16. This allows some
programs to go further before crashing.
* [loader/task.c] [loader/main.c]
Moved global initializations from InitTask() to MAIN_Init(), as
they no longer need a task context with the new SEGPTR heap functions.
* [memory/string.c]
Added lstrcpynAtoW and lstrcpynWtoA; not real API functions, but
very convenient.
* [windows/graphics.c]
Partially implemented DrawEdge().
* [windows/timer.c] [windows/caret.c]
Implemented Win32 timer handling. Updated caret management to use
Win32 timers (avoids having to use a Win16 callback).
* [windows/win.c]
Prevent programs from setting some style bits with
SetWindowLong(). This should fix some BadMatch crashes.
Link new windows at the end of the linked list.
* [windows/winpos.c]
Don't try to activate a child window in ShowWindow().
* [windows/winproc.c]
Added a 32->32 thunk to support Ansi-Unicode translation.
Wed Jul 10 22:11:12 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [files/directory.c]
Additional (undocumented) return value for GetTempDrive() added.
* [files/dos_fs.c] [files/file.c] [include/windows.h]
GetTempFileName32* added.
GetShortPathName* added.
* [memory/string.c]
Win16 lstrcpy() can get NULL ptrs as argument and survive.
* [misc/lzexpand.c]
LZOpenFile(): also try opening with compressed filename if normal
open fails.
* [misc/ole2nls.c] [misc/lstr.c] [include/windows.h]
Char* added.
CompareString* added.
Sun Jul 7 01:22:14 1996 Jukka Iivonen <iivonen@cc.helsinki.fi>
* [objects/font.c] [if1632/gdi32.spec]
CreateFontIndirect32A and CreateFontIndirect32W added.
* [misc/ole2nls.c]
GetUserDefaultLCID return values updated for new languages.
Finnish support added for GetLocaleInfoA.
* [object/palette] [gdi32.spec]
RealizePalette32 and SelectPalette32 added.
Sat Jul 6 17:27:30 1996 Ronan Waide <root@waider.ie>
* [misc/shell.c]
Fixup for SHELL_FindExecutable so that File->Run from progman
works once more. Still needs some more fixups - grep for FIXME in
this file.
diff --git a/windows/caret.c b/windows/caret.c
index 902d309..e7f4b65 100644
--- a/windows/caret.c
+++ b/windows/caret.c
@@ -14,16 +14,16 @@
typedef struct
{
- HWND hwnd;
- short hidden;
- BOOL on;
- short x;
- short y;
- short width;
- short height;
- HBRUSH hBrush;
- WORD timeout;
- WORD timerid;
+ HWND32 hwnd;
+ UINT32 hidden;
+ BOOL32 on;
+ INT32 x;
+ INT32 y;
+ INT32 width;
+ INT32 height;
+ HBRUSH16 hBrush;
+ UINT32 timeout;
+ UINT32 timerid;
} CARET;
typedef enum
@@ -33,13 +33,13 @@
CARET_TOGGLE,
} DISPLAY_CARET;
-static CARET Caret = { 0, };
+static CARET Caret;
/*****************************************************************
* CARET_GetHwnd
*/
-HWND CARET_GetHwnd()
+HWND32 CARET_GetHwnd()
{
return Caret.hwnd;
}
@@ -47,10 +47,10 @@
/*****************************************************************
* CARET_DisplayCaret
*/
-void CARET_DisplayCaret(DISPLAY_CARET status)
+static void CARET_DisplayCaret( DISPLAY_CARET status )
{
- HDC hdc;
- HBRUSH hPrevBrush;
+ HDC16 hdc;
+ HBRUSH16 hPrevBrush;
if (Caret.on && (status == CARET_ON)) return;
if (!Caret.on && (status == CARET_OFF)) return;
@@ -69,37 +69,35 @@
/*****************************************************************
* CARET_Callback
*/
-WORD CARET_Callback(HWND hwnd, WORD msg, WORD timerid, LONG ctime)
+static VOID CARET_Callback( HWND32 hwnd, UINT32 msg, UINT32 id, DWORD ctime)
{
dprintf_caret(stddeb,"CARET_Callback: hwnd=%04x, timerid=%d, caret=%d\n",
- hwnd, timerid, Caret.on);
-
+ hwnd, id, Caret.on);
CARET_DisplayCaret(CARET_TOGGLE);
- return 0;
}
/*****************************************************************
* CARET_SetTimer
*/
-void CARET_SetTimer(void)
+static void CARET_SetTimer(void)
{
- if (Caret.timerid) KillSystemTimer((HWND)0, Caret.timerid);
- Caret.timerid = SetSystemTimer((HWND)0, 0, Caret.timeout,
- MODULE_GetWndProcEntry16("CARET_Callback"));
+ if (Caret.timerid) KillSystemTimer32( (HWND32)0, Caret.timerid );
+ Caret.timerid = SetSystemTimer32( (HWND32)0, 0, Caret.timeout,
+ CARET_Callback );
}
/*****************************************************************
* CARET_ResetTimer
*/
-void CARET_ResetTimer(void)
+static void CARET_ResetTimer(void)
{
if (Caret.timerid)
{
- KillSystemTimer((HWND)0, Caret.timerid);
- Caret.timerid = SetSystemTimer((HWND)0, 0, Caret.timeout,
- MODULE_GetWndProcEntry16("CARET_Callback"));
+ KillSystemTimer32( (HWND32)0, Caret.timerid );
+ Caret.timerid = SetSystemTimer32( (HWND32)0, 0, Caret.timeout,
+ CARET_Callback );
}
}
@@ -107,20 +105,20 @@
/*****************************************************************
* CARET_KillTimer
*/
-void CARET_KillTimer(void)
+static void CARET_KillTimer(void)
{
if (Caret.timerid)
{
- KillSystemTimer((HWND)0, Caret.timerid);
+ KillSystemTimer32( (HWND32)0, Caret.timerid );
Caret.timerid = 0;
}
}
/*****************************************************************
- * CreateCaret (USER.163)
+ * CreateCaret (USER.163) (USER32.65)
*/
-BOOL CreateCaret(HWND hwnd, HBITMAP bitmap, INT width, INT height)
+BOOL16 CreateCaret( HWND32 hwnd, HBITMAP32 bitmap, INT32 width, INT32 height )
{
dprintf_caret(stddeb,"CreateCaret: hwnd=%04x\n", hwnd);
@@ -158,10 +156,9 @@
/*****************************************************************
- * DestroyCaret (USER.164)
+ * DestroyCaret (USER.164) (USER32.130)
*/
-
-BOOL DestroyCaret()
+BOOL16 DestroyCaret(void)
{
if (!Caret.hwnd) return FALSE;
@@ -171,20 +168,18 @@
DeleteObject( Caret.hBrush );
CARET_KillTimer();
CARET_DisplayCaret(CARET_OFF);
-
Caret.hwnd = 0;
return TRUE;
}
/*****************************************************************
- * SetCaretPos (USER.165)
+ * SetCaretPos (USER.165) (USER32.465)
*/
-
-void SetCaretPos(short x, short y)
+BOOL16 SetCaretPos( INT32 x, INT32 y)
{
- if (!Caret.hwnd) return;
- if ((x == Caret.x) && (y == Caret.y)) return;
+ if (!Caret.hwnd) return FALSE;
+ if ((x == Caret.x) && (y == Caret.y)) return TRUE;
dprintf_caret(stddeb,"SetCaretPos: x=%d, y=%d\n", x, y);
@@ -197,16 +192,17 @@
CARET_DisplayCaret(CARET_ON);
CARET_SetTimer();
}
+ return TRUE;
}
-/*****************************************************************
- * HideCaret (USER.166)
- */
-void HideCaret(HWND hwnd)
+/*****************************************************************
+ * HideCaret (USER.166) (USER32.316)
+ */
+BOOL16 HideCaret( HWND32 hwnd )
{
- if (!Caret.hwnd) return;
- if (hwnd && (Caret.hwnd != hwnd)) return;
+ if (!Caret.hwnd) return FALSE;
+ if (hwnd && (Caret.hwnd != hwnd)) return FALSE;
dprintf_caret(stddeb,"HideCaret: hwnd=%04x, hidden=%d\n",
hwnd, Caret.hidden);
@@ -214,17 +210,17 @@
CARET_KillTimer();
CARET_DisplayCaret(CARET_OFF);
Caret.hidden++;
+ return TRUE;
}
/*****************************************************************
- * ShowCaret (USER.167)
+ * ShowCaret (USER.167) (USER32.528)
*/
-
-void ShowCaret(HWND hwnd)
+BOOL16 ShowCaret( HWND32 hwnd )
{
- if (!Caret.hwnd) return;
- if (hwnd && (Caret.hwnd != hwnd)) return;
+ if (!Caret.hwnd) return FALSE;
+ if (hwnd && (Caret.hwnd != hwnd)) return FALSE;
dprintf_caret(stddeb,"ShowCaret: hwnd=%04x, hidden=%d\n",
hwnd, Caret.hidden);
@@ -238,61 +234,66 @@
CARET_SetTimer();
}
}
+ return TRUE;
}
/*****************************************************************
- * SetCaretBlinkTime (USER.168)
+ * SetCaretBlinkTime (USER.168) (USER32.464)
*/
-
-void SetCaretBlinkTime(WORD msecs)
+BOOL16 SetCaretBlinkTime( UINT32 msecs )
{
- if (!Caret.hwnd) return;
+ if (!Caret.hwnd) return FALSE;
dprintf_caret(stddeb,"SetCaretBlinkTime: hwnd=%04x, msecs=%d\n",
Caret.hwnd, msecs);
Caret.timeout = msecs;
CARET_ResetTimer();
+ return TRUE;
}
/*****************************************************************
- * GetCaretBlinkTime (USER.169)
+ * GetCaretBlinkTime16 (USER.169)
*/
+UINT16 GetCaretBlinkTime16(void)
+{
+ return (UINT16)GetCaretBlinkTime32();
+}
-WORD GetCaretBlinkTime()
+
+/*****************************************************************
+ * GetCaretBlinkTime32 (USER32.208)
+ */
+UINT32 GetCaretBlinkTime32(void)
{
if (!Caret.hwnd) return 0;
-
- dprintf_caret(stddeb,"GetCaretBlinkTime: hwnd=%04x, msecs=%d\n",
- Caret.hwnd, Caret.timeout);
-
return Caret.timeout;
}
/*****************************************************************
- * GetCaretPos16 (USER.183)
+ * GetCaretPos16 (USER.183)
*/
-void GetCaretPos16( LPPOINT16 pt )
+VOID GetCaretPos16( LPPOINT16 pt )
{
if (!Caret.hwnd || !pt) return;
dprintf_caret(stddeb,"GetCaretPos: hwnd=%04x, pt=%p, x=%d, y=%d\n",
Caret.hwnd, pt, Caret.x, Caret.y);
-
- pt->x = Caret.x;
- pt->y = Caret.y;
+ pt->x = (INT16)Caret.x;
+ pt->y = (INT16)Caret.y;
}
/*****************************************************************
- * GetCaretPos32 (USER32.209)
+ * GetCaretPos32 (USER32.209)
*/
-void GetCaretPos32( LPPOINT32 pt )
+BOOL32 GetCaretPos32( LPPOINT32 pt )
{
- if (!Caret.hwnd || !pt) return;
+ if (!Caret.hwnd || !pt) return FALSE;
pt->x = Caret.x;
pt->y = Caret.y;
+ return TRUE;
}
diff --git a/windows/defwnd.c b/windows/defwnd.c
index caca49e..7d63ce1 100644
--- a/windows/defwnd.c
+++ b/windows/defwnd.c
@@ -121,9 +121,9 @@
case WM_NCDESTROY:
if (wndPtr->text) HeapFree( SystemHeap, 0, wndPtr->text );
wndPtr->text = NULL;
- if (wndPtr->hVScroll) USER_HEAP_FREE(wndPtr->hVScroll);
- if (wndPtr->hHScroll) USER_HEAP_FREE(wndPtr->hHScroll);
- wndPtr->hVScroll = wndPtr->hHScroll = 0;
+ if (wndPtr->pVScroll) HeapFree( SystemHeap, 0, wndPtr->pVScroll );
+ if (wndPtr->pHScroll) HeapFree( SystemHeap, 0, wndPtr->pHScroll );
+ wndPtr->pVScroll = wndPtr->pHScroll = NULL;
return 0;
case WM_PAINT:
diff --git a/windows/dialog.c b/windows/dialog.c
index ce5a675..7e86721 100644
--- a/windows/dialog.c
+++ b/windows/dialog.c
@@ -295,11 +295,6 @@
}
if (!hwndCtrl) return FALSE;
- /* Make the control last one in Z-order, so that controls remain
- in the order in which they were created */
- SetWindowPos( hwndCtrl, HWND_BOTTOM, 0, 0, 0, 0,
- SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE );
-
/* Send initialisation messages to the control */
if (dlgInfo->hUserFont) SendMessage32A( hwndCtrl, WM_SETFONT,
(WPARAM)dlgInfo->hUserFont, 0 );
@@ -548,7 +543,10 @@
rect.bottom -= rect.top;
if ((INT16)template.x == CW_USEDEFAULT16)
- rect.left = rect.top = CW_USEDEFAULT16;
+ {
+ rect.left = rect.top = (procType == WIN_PROC_16) ? CW_USEDEFAULT16
+ : CW_USEDEFAULT32;
+ }
else
{
rect.left += template.x * xUnit / 4;
@@ -929,36 +927,20 @@
break;
case VK_ESCAPE:
-#ifdef WINELIB32
- SendMessage32A( hwndDlg, WM_COMMAND,
- MAKEWPARAM( IDCANCEL, 0 ),
- (LPARAM)GetDlgItem(hwndDlg,IDCANCEL) );
-#else
- SendMessage16( hwndDlg, WM_COMMAND, IDCANCEL,
- MAKELPARAM( GetDlgItem(hwndDlg,IDCANCEL), 0 ));
-#endif
+ SendMessage32A( hwndDlg, WM_COMMAND, IDCANCEL,
+ (LPARAM)GetDlgItem( hwndDlg, IDCANCEL ) );
break;
case VK_RETURN:
{
DWORD dw = SendMessage16( hwndDlg, DM_GETDEFID, 0, 0 );
if (HIWORD(dw) == DC_HASDEFID)
-#ifdef WINELIB32
SendMessage32A( hwndDlg, WM_COMMAND,
MAKEWPARAM( LOWORD(dw), BN_CLICKED ),
- (LPARAM)GetDlgItem( hwndDlg, LOWORD(dw) ) );
+ (LPARAM)GetDlgItem( hwndDlg, LOWORD(dw) ));
else
- SendMessage32A( hwndDlg, WM_COMMAND,
- MAKEWPARAM( IDOK, 0 ),
- (LPARAM)GetDlgItem(hwndDlg,IDOK) );
-#else
- SendMessage16( hwndDlg, WM_COMMAND, LOWORD(dw),
- MAKELPARAM( GetDlgItem( hwndDlg, LOWORD(dw) ),
- BN_CLICKED ));
- else
- SendMessage16( hwndDlg, WM_COMMAND, IDOK,
- MAKELPARAM( GetDlgItem(hwndDlg,IDOK), 0 ));
-#endif
+ SendMessage32A( hwndDlg, WM_COMMAND, IDOK,
+ (LPARAM)GetDlgItem( hwndDlg, IDOK ) );
}
break;
@@ -985,9 +967,9 @@
/****************************************************************
- * GetDlgCtrlID (USER.277)
+ * GetDlgCtrlID (USER.277) (USER32.233)
*/
-int GetDlgCtrlID( HWND hwnd )
+INT16 GetDlgCtrlID( HWND32 hwnd )
{
WND *wndPtr = WIN_FindWndPtr(hwnd);
if (wndPtr) return wndPtr->wIDmenu;
@@ -1164,9 +1146,9 @@
/***********************************************************************
- * CheckDlgButton (USER.97)
+ * CheckDlgButton (USER.97) (USER32.44)
*/
-BOOL CheckDlgButton( HWND hwnd, INT id, UINT check )
+BOOL16 CheckDlgButton( HWND32 hwnd, INT32 id, UINT32 check )
{
SendDlgItemMessage32A( hwnd, id, BM_SETCHECK32, check, 0 );
return TRUE;
@@ -1183,9 +1165,10 @@
/***********************************************************************
- * CheckRadioButton (USER.96)
+ * CheckRadioButton (USER.96) (USER32.47)
*/
-BOOL CheckRadioButton( HWND hwndDlg, UINT firstID, UINT lastID, UINT checkID )
+BOOL16 CheckRadioButton( HWND32 hwndDlg, UINT32 firstID, UINT32 lastID,
+ UINT32 checkID )
{
WND *pWnd = WIN_FindWndPtr( hwndDlg );
if (!pWnd) return FALSE;
diff --git a/windows/event.c b/windows/event.c
index 4a87d91..cf14d07 100644
--- a/windows/event.c
+++ b/windows/event.c
@@ -884,7 +884,7 @@
* Mouse_Event (USER.299)
*/
#ifndef WINELIB
-void Mouse_Event( SIGCONTEXT context )
+void Mouse_Event( SIGCONTEXT *context )
{
/* Register values:
* AX = mouse event
@@ -897,25 +897,25 @@
int rootX, rootY, childX, childY;
unsigned int state;
- if (AX_reg(&context) & ME_MOVE)
+ if (AX_reg(context) & ME_MOVE)
{
/* We have to actually move the cursor */
XWarpPointer( display, rootWindow, None, 0, 0, 0, 0,
- (short)BX_reg(&context), (short)CX_reg(&context) );
+ (short)BX_reg(context), (short)CX_reg(context) );
return;
}
if (!XQueryPointer( display, rootWindow, &root, &child,
&rootX, &rootY, &childX, &childY, &state )) return;
- if (AX_reg(&context) & ME_LDOWN)
+ if (AX_reg(context) & ME_LDOWN)
hardware_event( WM_LBUTTONDOWN, EVENT_XStateToKeyState( state ), 0L,
rootX - desktopX, rootY - desktopY, GetTickCount(), 0);
- if (AX_reg(&context) & ME_LUP)
+ if (AX_reg(context) & ME_LUP)
hardware_event( WM_LBUTTONUP, EVENT_XStateToKeyState( state ), 0L,
rootX - desktopX, rootY - desktopY, GetTickCount(), 0);
- if (AX_reg(&context) & ME_RDOWN)
+ if (AX_reg(context) & ME_RDOWN)
hardware_event( WM_RBUTTONDOWN, EVENT_XStateToKeyState( state ), 0L,
rootX - desktopX, rootY - desktopY, GetTickCount(), 0);
- if (AX_reg(&context) & ME_RUP)
+ if (AX_reg(context) & ME_RUP)
hardware_event( WM_RBUTTONUP, EVENT_XStateToKeyState( state ), 0L,
rootX - desktopX, rootY - desktopY, GetTickCount(), 0);
}
diff --git a/windows/graphics.c b/windows/graphics.c
index 00770c7..f1cb9e7 100644
--- a/windows/graphics.c
+++ b/windows/graphics.c
@@ -991,8 +991,8 @@
*
* Main flood-fill routine.
*/
-static BOOL GRAPH_DoFloodFill( DC *dc, RECT16 *rect, INT16 x, INT16 y,
- COLORREF color, WORD fillType )
+static BOOL16 GRAPH_DoFloodFill( DC *dc, RECT16 *rect, INT32 x, INT32 y,
+ COLORREF color, UINT32 fillType )
{
XImage *image;
@@ -1021,9 +1021,10 @@
/**********************************************************************
- * ExtFloodFill (GDI.372)
+ * ExtFloodFill (GDI.372) (GDI32.96)
*/
-BOOL ExtFloodFill( HDC hdc, INT x, INT y, COLORREF color, WORD fillType )
+BOOL16 ExtFloodFill( HDC32 hdc, INT32 x, INT32 y, COLORREF color,
+ UINT32 fillType )
{
RECT16 rect;
DC *dc;
@@ -1049,32 +1050,129 @@
/**********************************************************************
- * FloodFill (GDI.25)
+ * FloodFill (GDI.25) (GDI32.104)
*/
-BOOL FloodFill( HDC hdc, INT x, INT y, COLORREF color )
+BOOL16 FloodFill( HDC32 hdc, INT32 x, INT32 y, COLORREF color )
{
return ExtFloodFill( hdc, x, y, color, FLOODFILLBORDER );
}
/**********************************************************************
- * DrawEdge (USER.659)
+ * DrawEdge16 (USER.659)
*/
-BOOL DrawEdge(HDC hdc, LPRECT16 qrc, UINT edge, UINT flags)
+BOOL16 DrawEdge16( HDC16 hdc, LPRECT16 rc, UINT16 edge, UINT16 flags )
{
- fprintf(stdnimp,"DrawEdge(%x,%p,%d,%x), empty stub!\n",
- hdc,qrc,edge,flags
- );
- return TRUE;
+ RECT32 rect32;
+ BOOL32 ret;
+
+ CONV_RECT16TO32( rc, &rect32 );
+ ret = DrawEdge32( hdc, &rect32, edge, flags );
+ CONV_RECT32TO16( &rect32, rc );
+ return ret;
}
+
/**********************************************************************
- * DrawFrameControl (USER.656)
+ * DrawEdge32 (USER32.154)
*/
-BOOL DrawFrameControl(HDC hdc, LPRECT16 qrc, UINT edge, UINT flags)
+BOOL32 DrawEdge32( HDC32 hdc, LPRECT32 rc, UINT32 edge, UINT32 flags )
{
- fprintf(stdnimp,"DrawFrameControl(%x,%p,%d,%x), empty stub!\n",
- hdc,qrc,edge,flags
- );
- return TRUE;
+ HBRUSH hbrushOld;
+
+ if (flags >= BF_DIAGONAL)
+ fprintf( stderr, "DrawEdge: unsupported flags %04x\n", flags );
+
+ dprintf_graphics( stddeb, "DrawEdge: %04x %d,%d-%d,%d %04x %04x\n",
+ hdc, rc->left, rc->top, rc->right, rc->bottom,
+ edge, flags );
+
+ /* First do all the raised edges */
+
+ SelectObject( hdc, sysColorObjects.hbrushBtnHighlight );
+ if (edge & BDR_RAISEDOUTER)
+ {
+ if (flags & BF_LEFT) PatBlt( hdc, rc->left, rc->top,
+ 1, rc->bottom - rc->top - 1, PATCOPY );
+ if (flags & BF_TOP) PatBlt( hdc, rc->left, rc->top,
+ rc->right - rc->left - 1, 1, PATCOPY );
+ }
+ if (edge & BDR_SUNKENOUTER)
+ {
+ if (flags & BF_RIGHT) PatBlt( hdc, rc->right - 1, rc->top,
+ 1, rc->bottom - rc->top, PATCOPY );
+ if (flags & BF_BOTTOM) PatBlt( hdc, rc->left, rc->bottom - 1,
+ rc->right - rc->left, 1, PATCOPY );
+ }
+ if (edge & BDR_RAISEDINNER)
+ {
+ if (flags & BF_LEFT) PatBlt( hdc, rc->left + 1, rc->top + 1,
+ 1, rc->bottom - rc->top - 2, PATCOPY );
+ if (flags & BF_TOP) PatBlt( hdc, rc->left + 1, rc->top + 1,
+ rc->right - rc->left - 2, 1, PATCOPY );
+ }
+ if (edge & BDR_SUNKENINNER)
+ {
+ if (flags & BF_RIGHT) PatBlt( hdc, rc->right - 2, rc->top + 1,
+ 1, rc->bottom - rc->top - 2, PATCOPY );
+ if (flags & BF_BOTTOM) PatBlt( hdc, rc->left + 1, rc->bottom - 2,
+ rc->right - rc->left - 2, 1, PATCOPY );
+ }
+
+ /* Then do all the sunken edges */
+
+ hbrushOld = SelectObject( hdc, sysColorObjects.hbrushBtnShadow );
+ if (edge & BDR_SUNKENOUTER)
+ {
+ if (flags & BF_LEFT) PatBlt( hdc, rc->left, rc->top,
+ 1, rc->bottom - rc->top - 1, PATCOPY );
+ if (flags & BF_TOP) PatBlt( hdc, rc->left, rc->top,
+ rc->right - rc->left - 1, 1, PATCOPY );
+ }
+ if (edge & BDR_RAISEDOUTER)
+ {
+ if (flags & BF_RIGHT) PatBlt( hdc, rc->right - 1, rc->top,
+ 1, rc->bottom - rc->top, PATCOPY );
+ if (flags & BF_BOTTOM) PatBlt( hdc, rc->left, rc->bottom - 1,
+ rc->right - rc->left, 1, PATCOPY );
+ }
+ if (edge & BDR_SUNKENINNER)
+ {
+ if (flags & BF_LEFT) PatBlt( hdc, rc->left + 1, rc->top + 1,
+ 1, rc->bottom - rc->top - 2, PATCOPY );
+ if (flags & BF_TOP) PatBlt( hdc, rc->left + 1, rc->top + 1,
+ rc->right - rc->left - 2, 1, PATCOPY );
+ }
+ if (edge & BDR_RAISEDINNER)
+ {
+ if (flags & BF_RIGHT) PatBlt( hdc, rc->right - 2, rc->top + 1,
+ 1, rc->bottom - rc->top - 2, PATCOPY );
+ if (flags & BF_BOTTOM) PatBlt( hdc, rc->left + 1, rc->bottom - 2,
+ rc->right - rc->left - 2, 1, PATCOPY );
+ }
+
+ SelectObject( hdc, hbrushOld );
+ return TRUE;
+}
+
+
+/**********************************************************************
+ * DrawFrameControl16 (USER.656)
+ */
+BOOL16 DrawFrameControl16( HDC16 hdc, LPRECT16 rc, UINT16 edge, UINT16 flags )
+{
+ fprintf( stdnimp,"DrawFrameControl16(%x,%p,%d,%x), empty stub!\n",
+ hdc,rc,edge,flags );
+ return TRUE;
+}
+
+
+/**********************************************************************
+ * DrawFrameControl32 (USER32.157)
+ */
+BOOL32 DrawFrameControl32( HDC32 hdc, LPRECT32 rc, UINT32 edge, UINT32 flags )
+{
+ fprintf( stdnimp,"DrawFrameControl32(%x,%p,%d,%x), empty stub!\n",
+ hdc,rc,edge,flags );
+ return TRUE;
}
diff --git a/windows/message.c b/windows/message.c
index 4713f6e..62c4c93 100644
--- a/windows/message.c
+++ b/windows/message.c
@@ -253,7 +253,7 @@
if ((first || last) &&
((msg->message < first) || (msg->message > last))) continue;
if ((msg->hwnd != GetDesktopWindow()) &&
- (GetWindowTask(msg->hwnd) != GetCurrentTask()))
+ (GetWindowTask16(msg->hwnd) != GetCurrentTask()))
continue; /* Not for this task */
if (remove)
{
@@ -662,7 +662,6 @@
return TRUE;
}
-
HOOK_CallHooks( WH_CALLWNDPROC, HC_ACTION, 1,
(LPARAM)MAKE_SEGPTR(&msgstruct) );
hwnd = msgstruct.hWnd;
@@ -676,13 +675,7 @@
return 0;
}
if (wndPtr->hmemTaskQ != GetTaskQueue(0))
- {
-#if 0
- fprintf( stderr, "SendMessage16: intertask message not supported\n" );
- return 0;
-#endif
return MSG_SendMessage( wndPtr->hmemTaskQ, hwnd, msg, wParam, lParam );
- }
SPY_EnterMessage( SPY_SENDMESSAGE16, hwnd, msg, wParam, lParam );
ret = CallWindowProc16( (WNDPROC16)wndPtr->winproc,
@@ -718,6 +711,19 @@
fprintf( stderr, "SendMessage32A: invalid hwnd %08x\n", hwnd );
return 0;
}
+
+ if (WINPROC_GetProcType( wndPtr->winproc ) == WIN_PROC_16)
+ {
+ /* Use SendMessage16 for now to get hooks right */
+ UINT16 msg16;
+ WPARAM16 wParam16;
+ if (WINPROC_MapMsg32ATo16( msg, wParam, &msg16, &wParam16, &lParam ) == -1)
+ return 0;
+ ret = SendMessage16( hwnd, msg16, wParam16, lParam );
+ WINPROC_UnmapMsg32ATo16( msg16, wParam16, lParam );
+ return ret;
+ }
+
if (wndPtr->hmemTaskQ != GetTaskQueue(0))
{
fprintf( stderr, "SendMessage32A: intertask message not supported\n" );
@@ -895,7 +901,7 @@
/***********************************************************************
- * GetTickCount (USER.13) (KERNEL32.299)
+ * GetTickCount (USER.13) (KERNEL32.299)
*/
DWORD GetTickCount(void)
{
diff --git a/windows/painting.c b/windows/painting.c
index e9c8283..29a58cb 100644
--- a/windows/painting.c
+++ b/windows/painting.c
@@ -196,17 +196,12 @@
{
/* Send WM_CTLCOLOR message if needed */
- if ((DWORD)hbrush <= CTLCOLOR_MAX)
+ if ((UINT32)hbrush <= CTLCOLOR_MAX)
{
if (!hwndParent) return;
-#ifdef WINELIB32
hbrush = (HBRUSH)SendMessage32A( hwndParent,
- WM_CTLCOLORMSGBOX+(DWORD)hbrush,
+ WM_CTLCOLORMSGBOX + (UINT32)hbrush,
(WPARAM)hdc, (LPARAM)hwnd );
-#else
- hbrush = (HBRUSH)SendMessage16( hwndParent, WM_CTLCOLOR,
- hdc, MAKELONG( hwnd, hbrush ) );
-#endif
}
if (hbrush) FillRect16( hdc, rect, hbrush );
}
@@ -217,13 +212,8 @@
*/
HBRUSH GetControlBrush( HWND hwnd, HDC hdc, WORD control )
{
-#ifdef WINELIB32
return (HBRUSH)SendMessage32A( GetParent(hwnd), WM_CTLCOLOR+control,
(WPARAM)hdc, (LPARAM)hwnd );
-#else
- return (HBRUSH)SendMessage16( GetParent(hwnd), WM_CTLCOLOR,
- hdc, MAKELONG( hwnd, control ) );
-#endif
}
diff --git a/windows/property.c b/windows/property.c
index 9d3a0dc..dc5303c 100644
--- a/windows/property.c
+++ b/windows/property.c
@@ -133,7 +133,7 @@
/* Already get the next in case the callback */
/* function removes the current property. */
hProp = prop->next;
- ret = CallEnumPropProc( func, hwnd,
+ ret = CallEnumPropProc( (FARPROC16)func, hwnd,
prop->atom ?
(LONG)MAKELONG( prop->atom, 0 )
:
diff --git a/windows/queue.c b/windows/queue.c
index c1406c1..85ebc17 100644
--- a/windows/queue.c
+++ b/windows/queue.c
@@ -36,7 +36,7 @@
/***********************************************************************
* QUEUE_DumpQueue
*/
-void QUEUE_DumpQueue( HQUEUE hQueue )
+void QUEUE_DumpQueue( HQUEUE16 hQueue )
{
MESSAGEQUEUE *pq;
@@ -127,7 +127,7 @@
*
* Unlinks and deletes a message queue.
*/
-BOOL QUEUE_DeleteMsgQueue( HQUEUE hQueue )
+BOOL32 QUEUE_DeleteMsgQueue( HQUEUE16 hQueue )
{
MESSAGEQUEUE * msgQueue = (MESSAGEQUEUE*)GlobalLock16(hQueue);
HQUEUE *pPrev;
@@ -159,7 +159,7 @@
* Create the system message queue, and set the double-click speed.
* Must be called only once.
*/
-BOOL QUEUE_CreateSysMsgQueue( int size )
+BOOL32 QUEUE_CreateSysMsgQueue( int size )
{
if (size > MAX_QUEUE_SIZE) size = MAX_QUEUE_SIZE;
else if (size <= 0) size = 1;
@@ -302,7 +302,7 @@
*
* Add a message to the queue. Return FALSE if queue is full.
*/
-BOOL QUEUE_AddMsg( HQUEUE hQueue, MSG16 * msg, DWORD extraInfo )
+BOOL32 QUEUE_AddMsg( HQUEUE16 hQueue, MSG16 * msg, DWORD extraInfo )
{
int pos;
MESSAGEQUEUE *msgQueue;
@@ -334,7 +334,7 @@
*
* Find a message matching the given parameters. Return -1 if none available.
*/
-int QUEUE_FindMsg( MESSAGEQUEUE * msgQueue, HWND hwnd, int first, int last )
+int QUEUE_FindMsg( MESSAGEQUEUE * msgQueue, HWND32 hwnd, int first, int last )
{
int i, pos = msgQueue->nextMessage;
@@ -488,7 +488,7 @@
/***********************************************************************
* QUEUE_GetQueueTask
*/
-HTASK QUEUE_GetQueueTask( HQUEUE hQueue )
+HTASK16 QUEUE_GetQueueTask( HQUEUE16 hQueue )
{
MESSAGEQUEUE *queue = GlobalLock16( hQueue );
return (queue) ? queue->hTask : 0 ;
@@ -498,7 +498,7 @@
/***********************************************************************
* QUEUE_IncPaintCount
*/
-void QUEUE_IncPaintCount( HQUEUE hQueue )
+void QUEUE_IncPaintCount( HQUEUE16 hQueue )
{
MESSAGEQUEUE *queue;
@@ -511,7 +511,7 @@
/***********************************************************************
* QUEUE_DecPaintCount
*/
-void QUEUE_DecPaintCount( HQUEUE hQueue )
+void QUEUE_DecPaintCount( HQUEUE16 hQueue )
{
MESSAGEQUEUE *queue;
@@ -524,7 +524,7 @@
/***********************************************************************
* QUEUE_IncTimerCount
*/
-void QUEUE_IncTimerCount( HQUEUE hQueue )
+void QUEUE_IncTimerCount( HQUEUE16 hQueue )
{
MESSAGEQUEUE *queue;
@@ -537,7 +537,7 @@
/***********************************************************************
* QUEUE_DecTimerCount
*/
-void QUEUE_DecTimerCount( HQUEUE hQueue )
+void QUEUE_DecTimerCount( HQUEUE16 hQueue )
{
MESSAGEQUEUE *queue;
@@ -561,9 +561,9 @@
/***********************************************************************
- * GetWindowTask (USER.224)
+ * GetWindowTask16 (USER.224)
*/
-HTASK GetWindowTask( HWND hwnd )
+HTASK16 GetWindowTask16( HWND16 hwnd )
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
diff --git a/windows/timer.c b/windows/timer.c
index 31e3940..4f4ef67 100644
--- a/windows/timer.c
+++ b/windows/timer.c
@@ -4,8 +4,10 @@
* Copyright 1993 Alexandre Julliard
*/
+#define NO_TRANSITION_TYPES /* This file is Win32-clean */
#include "windows.h"
#include "queue.h"
+#include "winproc.h"
#include "stddebug.h"
/* #define DEBUG_TIMER */
#include "debug.h"
@@ -13,14 +15,14 @@
typedef struct tagTIMER
{
- HWND hwnd;
- HQUEUE hq;
- WORD msg; /* WM_TIMER or WM_SYSTIMER */
- WORD id;
- WORD timeout;
+ HWND32 hwnd;
+ HQUEUE16 hq;
+ UINT16 msg; /* WM_TIMER or WM_SYSTIMER */
+ UINT32 id;
+ UINT32 timeout;
struct tagTIMER *next;
DWORD expires; /* Next expiration, or 0 if already expired */
- FARPROC proc;
+ HWINDOWPROC proc;
} TIMER;
#define NB_TIMERS 34
@@ -86,14 +88,14 @@
pTimer->msg = 0;
pTimer->id = 0;
pTimer->timeout = 0;
- pTimer->proc = 0;
+ WINPROC_FreeProc( pTimer->proc );
}
/***********************************************************************
* TIMER_SwitchQueue
*/
-void TIMER_SwitchQueue(HQUEUE old, HQUEUE new)
+void TIMER_SwitchQueue( HQUEUE16 old, HQUEUE16 new )
{
TIMER * pT = pNextTimer;
@@ -110,7 +112,7 @@
*
* Remove all timers for a given window.
*/
-void TIMER_RemoveWindowTimers( HWND hwnd )
+void TIMER_RemoveWindowTimers( HWND32 hwnd )
{
int i;
TIMER *pTimer;
@@ -126,7 +128,7 @@
*
* Remove all timers for a given queue.
*/
-void TIMER_RemoveQueueTimers( HQUEUE hqueue )
+void TIMER_RemoveQueueTimers( HQUEUE16 hqueue )
{
int i;
TIMER *pTimer;
@@ -187,7 +189,8 @@
*
* Build a message for an expired timer.
*/
-BOOL TIMER_GetTimerMsg( MSG16 *msg, HWND hwnd, HQUEUE hQueue, BOOL remove )
+BOOL32 TIMER_GetTimerMsg( MSG16 *msg, HWND32 hwnd,
+ HQUEUE16 hQueue, BOOL32 remove )
{
TIMER *pTimer = pNextTimer;
DWORD curTime = GetTickCount();
@@ -204,9 +207,9 @@
pTimer->hwnd, pTimer->msg, pTimer->id, (DWORD)pTimer->proc);
/* Build the message */
- msg->hwnd = pTimer->hwnd;
+ msg->hwnd = (HWND16)pTimer->hwnd;
msg->message = pTimer->msg;
- msg->wParam = pTimer->id;
+ msg->wParam = (UINT16)pTimer->id;
msg->lParam = (LONG)pTimer->proc;
msg->time = curTime;
return TRUE;
@@ -216,14 +219,13 @@
/***********************************************************************
* TIMER_SetTimer
*/
-static WORD TIMER_SetTimer( HWND hwnd, WORD id, WORD timeout,
- FARPROC proc, BOOL sys )
+static UINT32 TIMER_SetTimer( HWND32 hwnd, UINT32 id, UINT32 timeout,
+ WNDPROC16 proc, WINDOWPROCTYPE type, BOOL32 sys )
{
int i;
TIMER * pTimer;
if (!timeout) return 0;
-/* if (!hwnd && !proc) return 0; */
/* Check if there's already a timer with the same hwnd and id */
@@ -234,7 +236,9 @@
/* Got one: set new values and return */
TIMER_RemoveTimer( pTimer );
pTimer->timeout = timeout;
- pTimer->proc = proc;
+ WINPROC_FreeProc( pTimer->proc );
+ pTimer->proc = (HWINDOWPROC)0;
+ if (proc) WINPROC_SetProc( &pTimer->proc, proc, type );
pTimer->expires = GetTickCount() + timeout;
TIMER_InsertTimer( pTimer );
return id;
@@ -252,27 +256,27 @@
/* Add the timer */
pTimer->hwnd = hwnd;
- pTimer->hq = (hwnd) ? GetTaskQueue( GetWindowTask( hwnd ) )
+ pTimer->hq = (hwnd) ? GetTaskQueue( GetWindowTask16( hwnd ) )
: GetTaskQueue( 0 );
pTimer->msg = sys ? WM_SYSTIMER : WM_TIMER;
pTimer->id = id;
pTimer->timeout = timeout;
pTimer->expires = GetTickCount() + timeout;
- pTimer->proc = proc;
- dprintf_timer(stddeb, "Timer added: %p, %04x, %04x, %04x, %08lx\n",
- pTimer, pTimer->hwnd, pTimer->msg, pTimer->id, (DWORD)pTimer->proc);
+ pTimer->proc = (HWINDOWPROC)0;
+ if (proc) WINPROC_SetProc( &pTimer->proc, proc, type );
+ dprintf_timer( stddeb, "Timer added: %p, %04x, %04x, %04x, %08lx\n",
+ pTimer, pTimer->hwnd, pTimer->msg, pTimer->id,
+ (DWORD)pTimer->proc );
TIMER_InsertTimer( pTimer );
- if (!id)
- return TRUE;
- else
- return id;
+ if (!id) return TRUE;
+ else return id;
}
/***********************************************************************
* TIMER_KillTimer
*/
-static BOOL TIMER_KillTimer( HWND hwnd, WORD id, BOOL sys )
+static BOOL32 TIMER_KillTimer( HWND32 hwnd, UINT32 id, BOOL32 sys )
{
int i;
TIMER * pTimer;
@@ -295,41 +299,90 @@
/***********************************************************************
- * SetTimer (USER.10)
+ * SetTimer16 (USER.10)
*/
-WORD SetTimer( HWND hwnd, WORD id, WORD timeout, FARPROC proc )
+UINT16 SetTimer16( HWND16 hwnd, UINT16 id, UINT16 timeout, TIMERPROC16 proc )
{
- dprintf_timer(stddeb, "SetTimer: %04x %d %d %08lx\n", hwnd, id, timeout, (LONG)proc );
- return TIMER_SetTimer( hwnd, id, timeout, proc, FALSE );
+ dprintf_timer( stddeb, "SetTimer16: %04x %d %d %08lx\n",
+ hwnd, id, timeout, (LONG)proc );
+ return TIMER_SetTimer( hwnd, id, timeout, (WNDPROC16)proc,
+ WIN_PROC_16, FALSE );
}
/***********************************************************************
- * SetSystemTimer (USER.11)
+ * SetTimer32 (USER32.510)
*/
-WORD SetSystemTimer( HWND hwnd, WORD id, WORD timeout, FARPROC proc )
+UINT32 SetTimer32( HWND32 hwnd, UINT32 id, UINT32 timeout, TIMERPROC32 proc )
{
- dprintf_timer(stddeb, "SetSystemTimer: %04x %d %d %08lx\n",
- hwnd, id, timeout, (LONG)proc );
- return TIMER_SetTimer( hwnd, id, timeout, proc, TRUE );
+ dprintf_timer( stddeb, "SetTimer32: %04x %d %d %08lx\n",
+ hwnd, id, timeout, (LONG)proc );
+ return TIMER_SetTimer( hwnd, id, timeout, (WNDPROC16)proc,
+ WIN_PROC_32A, FALSE );
}
/***********************************************************************
- * KillTimer (USER.12)
+ * SetSystemTimer16 (USER.11)
*/
-BOOL KillTimer( HWND hwnd, WORD id )
+UINT16 SetSystemTimer16( HWND16 hwnd, UINT16 id, UINT16 timeout,
+ TIMERPROC16 proc )
{
- dprintf_timer(stddeb, "KillTimer: %04x %d\n", hwnd, id );
+ dprintf_timer( stddeb, "SetSystemTimer16: %04x %d %d %08lx\n",
+ hwnd, id, timeout, (LONG)proc );
+ return TIMER_SetTimer( hwnd, id, timeout, (WNDPROC16)proc,
+ WIN_PROC_16, TRUE );
+}
+
+
+/***********************************************************************
+ * SetSystemTimer32 (USER32.508)
+ */
+UINT32 SetSystemTimer32( HWND32 hwnd, UINT32 id, UINT32 timeout,
+ TIMERPROC32 proc )
+{
+ dprintf_timer( stddeb, "SetSystemTimer32: %04x %d %d %08lx\n",
+ hwnd, id, timeout, (LONG)proc );
+ return TIMER_SetTimer( hwnd, id, timeout, (WNDPROC16)proc,
+ WIN_PROC_32A, TRUE );
+}
+
+
+/***********************************************************************
+ * KillTimer16 (USER.12)
+ */
+BOOL16 KillTimer16( HWND16 hwnd, UINT16 id )
+{
+ dprintf_timer(stddeb, "KillTimer16: %04x %d\n", hwnd, id );
return TIMER_KillTimer( hwnd, id, FALSE );
}
/***********************************************************************
- * KillSystemTimer (USER.182)
+ * KillTimer32 (USER32.353)
*/
-BOOL KillSystemTimer( HWND hwnd, WORD id )
+BOOL32 KillTimer32( HWND32 hwnd, UINT32 id )
{
- dprintf_timer(stddeb, "KillSystemTimer: %04x %d\n", hwnd, id );
+ dprintf_timer(stddeb, "KillTimer32: %04x %d\n", hwnd, id );
+ return TIMER_KillTimer( hwnd, id, FALSE );
+}
+
+
+/***********************************************************************
+ * KillSystemTimer16 (USER.182)
+ */
+BOOL16 KillSystemTimer16( HWND16 hwnd, UINT16 id )
+{
+ dprintf_timer( stddeb, "KillSystemTimer16: %04x %d\n", hwnd, id );
+ return TIMER_KillTimer( hwnd, id, TRUE );
+}
+
+
+/***********************************************************************
+ * KillSystemTimer32 (USER32.352)
+ */
+BOOL32 KillSystemTimer32( HWND32 hwnd, UINT32 id )
+{
+ dprintf_timer( stddeb, "KillSystemTimer32: %04x %d\n", hwnd, id );
return TIMER_KillTimer( hwnd, id, TRUE );
}
diff --git a/windows/win.c b/windows/win.c
index 7fc2b25..83a8c36 100644
--- a/windows/win.c
+++ b/windows/win.c
@@ -94,7 +94,7 @@
"inst=%04x taskQ=%04x updRgn=%04x active=%04x hdce=%04x idmenu=%04x\n"
"style=%08lx exstyle=%08lx wndproc=%08x text='%s'\n"
"client=%d,%d-%d,%d window=%d,%d-%d,%d iconpos=%d,%d maxpos=%d,%d\n"
- "sysmenu=%04x flags=%04x props=%04x vscroll=%04x hscroll=%04x\n",
+ "sysmenu=%04x flags=%04x props=%04x vscroll=%p hscroll=%p\n",
ptr->next, ptr->child, ptr->parent, ptr->owner,
ptr->class, className, ptr->hInstance, ptr->hmemTaskQ,
ptr->hrgnUpdate, ptr->hwndLastActive, ptr->hdce, ptr->wIDmenu,
@@ -104,7 +104,7 @@
ptr->rectClient.bottom, ptr->rectWindow.left, ptr->rectWindow.top,
ptr->rectWindow.right, ptr->rectWindow.bottom, ptr->ptIconPos.x,
ptr->ptIconPos.y, ptr->ptMaxPos.x, ptr->ptMaxPos.y, ptr->hSysMenu,
- ptr->flags, ptr->hProp, ptr->hVScroll, ptr->hHScroll );
+ ptr->flags, ptr->hProp, ptr->pVScroll, ptr->pHScroll );
if (ptr->class->cbWndExtra)
{
@@ -403,8 +403,8 @@
WS_CLIPSIBLINGS;
pWndDesktop->dwExStyle = 0;
pWndDesktop->hdce = 0;
- pWndDesktop->hVScroll = 0;
- pWndDesktop->hHScroll = 0;
+ pWndDesktop->pVScroll = NULL;
+ pWndDesktop->pHScroll = NULL;
pWndDesktop->wIDmenu = 0;
pWndDesktop->flags = 0;
pWndDesktop->window = rootWindow;
@@ -525,8 +525,8 @@
wndPtr->dwExStyle = cs->dwExStyle;
wndPtr->wIDmenu = 0;
wndPtr->flags = 0;
- wndPtr->hVScroll = 0;
- wndPtr->hHScroll = 0;
+ wndPtr->pVScroll = NULL;
+ wndPtr->pHScroll = NULL;
wndPtr->hSysMenu = MENU_GetDefSysMenu();
wndPtr->hProp = 0;
wndPtr->userdata = 0;
@@ -555,7 +555,7 @@
/* Insert the window in the linked list */
- WIN_LinkWindow( hwnd, HWND_TOP );
+ WIN_LinkWindow( hwnd, HWND_BOTTOM );
/* Send the WM_GETMINMAXINFO message and fix the size if needed */
@@ -1139,7 +1139,7 @@
/***********************************************************************
* IsWindowUnicode (USER32.349)
*/
-BOOL IsWindowUnicode( HWND hwnd )
+BOOL32 IsWindowUnicode( HWND32 hwnd )
{
WND * wndPtr;
@@ -1295,8 +1295,13 @@
retval = (LONG)WINPROC_GetProc( wndPtr->winproc, type );
WINPROC_SetProc( &wndPtr->winproc, (WNDPROC16)newval, type );
return retval;
+ case GWL_STYLE:
+ ptr = &wndPtr->dwStyle;
+ /* Some bits can't be changed this way */
+ newval &= ~(WS_VISIBLE | WS_CHILD);
+ newval |= (*ptr & (WS_VISIBLE | WS_CHILD));
+ break;
case GWL_USERDATA: ptr = &wndPtr->userdata; break;
- case GWL_STYLE: ptr = &wndPtr->dwStyle; break;
case GWL_EXSTYLE: ptr = &wndPtr->dwExStyle; break;
default:
fprintf( stderr, "SetWindowLong: invalid offset %d\n", offset );
@@ -1428,9 +1433,9 @@
/*******************************************************************
- * IsWindow (USER.47)
+ * IsWindow (USER.47) (USER32.347)
*/
-BOOL IsWindow( HWND hwnd )
+BOOL16 IsWindow( HWND32 hwnd )
{
WND * wndPtr = WIN_FindWndPtr( hwnd );
return ((wndPtr != NULL) && (wndPtr->dwMagic == WND_MAGIC));
@@ -1656,7 +1661,8 @@
{
/* Make sure that the window still exists */
if (!IsWindow((*ppWnd)->hwndSelf)) continue;
- if (!CallEnumWindowsProc16( lpEnumFunc, (*ppWnd)->hwndSelf, lParam ))
+ if (!CallEnumWindowsProc16( (FARPROC16)lpEnumFunc,
+ (*ppWnd)->hwndSelf, lParam ))
break;
}
HeapFree( SystemHeap, 0, list );
@@ -1711,7 +1717,8 @@
/* Make sure that the window still exists */
if (!IsWindow((*ppWnd)->hwndSelf)) continue;
if ((*ppWnd)->hmemTaskQ != hQueue) continue; /* Check the queue */
- if (!CallEnumWindowsProc16( func, (*ppWnd)->hwndSelf, lParam ))
+ if (!CallEnumWindowsProc16( (FARPROC16)func,
+ (*ppWnd)->hwndSelf, lParam ))
break;
}
HeapFree( SystemHeap, 0, list );
@@ -1761,7 +1768,7 @@
if (!IsWindow((*ppWnd)->hwndSelf)) continue;
/* Build children list first */
if (!(childList = WIN_BuildWinArray( *ppWnd ))) return FALSE;
- if (!CallEnumWindowsProc16( func, (*ppWnd)->hwndSelf, lParam ))
+ if (!CallEnumWindowsProc16((FARPROC16)func,(*ppWnd)->hwndSelf,lParam))
return FALSE;
ret = WIN_EnumChildWindows16( childList, func, lParam );
HeapFree( SystemHeap, 0, childList );
diff --git a/windows/winpos.c b/windows/winpos.c
index 1acf4b5..fcf56ba 100644
--- a/windows/winpos.c
+++ b/windows/winpos.c
@@ -656,6 +656,8 @@
break;
}
+ /* We can't activate a child window */
+ if (wndPtr->dwStyle & WS_CHILD) swpflags |= SWP_NOACTIVATE | SWP_NOZORDER;
SendMessage16( hwnd, WM_SHOWWINDOW, (cmd != SW_HIDE), 0 );
SetWindowPos( hwnd, HWND_TOP, x, y, cx, cy, swpflags );
@@ -961,14 +963,9 @@
wIconized = HIWORD(wndTemp->dwStyle & WS_MINIMIZE);
SendMessage16( hWnd, WM_NCACTIVATE, TRUE, 0 );
-#ifdef WINELIB32
SendMessage32A( hWnd, WM_ACTIVATE,
- MAKEWPARAM( (fMouse)?WA_CLICKACTIVE:WA_ACTIVE, wIconized),
+ MAKEWPARAM( (fMouse) ? WA_CLICKACTIVE : WA_ACTIVE, wIconized),
(LPARAM)hwndPrevActive );
-#else
- SendMessage16( hWnd, WM_ACTIVATE, (fMouse)? WA_CLICKACTIVE : WA_ACTIVE,
- MAKELONG(hwndPrevActive,wIconized));
-#endif
if( !IsWindow(hWnd) ) return 0;
diff --git a/windows/winproc.c b/windows/winproc.c
index ff10000..501acfe 100644
--- a/windows/winproc.c
+++ b/windows/winproc.c
@@ -10,12 +10,14 @@
#include "callback.h"
#include "heap.h"
#include "ldt.h"
+#include "registers.h"
#include "stackframe.h"
#include "string32.h"
#include "struct32.h"
#include "win.h"
-#include "wine.h"
#include "winproc.h"
+#include "stddebug.h"
+#include "debug.h"
/* Window procedure 16-bit thunk; see BuildSpec16Files() in tools/build.c */
typedef struct
@@ -36,7 +38,7 @@
typedef struct
{
BYTE popl_eax; /* popl %eax (return address) */
- BYTE pushl; /* pushl $proc */
+ BYTE pushl_func; /* pushl $proc */
WNDPROC16 proc WINE_PACKED;
BYTE pushl_eax; /* pushl %eax */
BYTE pushl_ebp; /* pushl %ebp */
@@ -44,10 +46,17 @@
LPCSTR name WINE_PACKED;
BYTE pushl_thunk; /* pushl $thunkfrom32 */
void (*thunk32)() WINE_PACKED;
- BYTE jmp; /* jmp relay */
+ BYTE jmp; /* jmp relay (relative jump)*/
void (*relay)() WINE_PACKED;
} WINPROC_THUNK_FROM32;
+/* Simple jmp to call 32-bit procedure directly */
+typedef struct
+{
+ BYTE jmp; /* jmp proc (relative jump) */
+ WNDPROC32 proc WINE_PACKED;
+} WINPROC_JUMP;
+
typedef union
{
WINPROC_THUNK_FROM16 t_from16;
@@ -57,6 +66,7 @@
typedef struct tagWINDOWPROC
{
WINPROC_THUNK thunk; /* Thunk */
+ WINPROC_JUMP jmp; /* Jump */
struct tagWINDOWPROC *next; /* Next window proc */
UINT32 magic; /* Magic number */
WINDOWPROCTYPE type; /* Function type */
@@ -84,10 +94,10 @@
#ifndef WINELIB
extern void CallFrom16_long_wwwll(void);
-extern void CallFrom32_5(void);
+extern void CallFrom32_stdcall_5(void);
#else
static void CallFrom16_long_wwwll(void) {}
-static void CallFrom32_5(void) {}
+static void CallFrom32_stdcall_5(void) {}
#endif /* WINELIB */
/* Reference 16->32A thunk */
@@ -114,8 +124,8 @@
WINE_CODE_SELECTOR
};
-/* Reference 32A->16 thunk */
-static const WINPROC_THUNK_FROM32 WINPROC_ThunkRef32ATo16 =
+/* Reference 32->16 thunk */
+static const WINPROC_THUNK_FROM32 WINPROC_ThunkRef32To16 =
{
0x58, /* popl %eax */
0x68, 0x00000000, /* pushl $proc16 */
@@ -123,9 +133,14 @@
0x55, /* pushl %ebp */
0x68, "WINPROC_CallProc32ATo16", /* pushl $name */
0x68, (void (*)())WINPROC_CallProc32ATo16, /* pushl $thunk32 */
- 0xe9, CallFrom32_5 /* jmp relay */
+ 0xe9, CallFrom32_stdcall_5 /* jmp relay */
};
+/* Reference 32->32 jump */
+static const WINPROC_JUMP WINPROC_JumpRef =
+{
+ 0xe9, 0x00000000 /* jmp proc (relative) */
+};
static HANDLE32 WinProcHeap;
@@ -151,22 +166,37 @@
*/
static WINDOWPROC *WINPROC_GetPtr( WNDPROC16 handle )
{
+ BYTE *ptr;
WINDOWPROC *proc;
/* Check for a linear pointer */
if (HEAP_IsInsideHeap( WinProcHeap, 0, (LPVOID)handle ))
{
- proc = (WINDOWPROC *)handle;
- if (proc->magic == WINPROC_MAGIC) return proc;
+ ptr = (BYTE *)handle;
+ /* First check if it is the jmp address */
+ if (*ptr == WINPROC_JumpRef.jmp)
+ ptr -= (int)&((WINDOWPROC *)0)->jmp -
+ (int)&((WINDOWPROC *)0)->thunk;
+ /* Now it must be the thunk address */
+ if (*ptr == WINPROC_ThunkRef16To32A.popl_eax)
+ ptr -= (int)&((WINDOWPROC *)0)->thunk;
+ /* Now we have a pointer to the WINDOWPROC struct */
+ if (((WINDOWPROC *)ptr)->magic == WINPROC_MAGIC)
+ return (WINDOWPROC *)ptr;
}
/* Check for a segmented pointer */
- if (!IsBadReadPtr( (SEGPTR)handle, sizeof(WINDOWPROC) ))
+ if (!IsBadReadPtr( (SEGPTR)handle, sizeof(WINDOWPROC)-sizeof(proc->thunk)))
{
- proc = (WINDOWPROC *)PTR_SEG_TO_LIN(handle);
- if (proc->magic == WINPROC_MAGIC) return proc;
+ ptr = (BYTE *)PTR_SEG_TO_LIN(handle);
+ /* It must be the thunk address */
+ if (*ptr == WINPROC_ThunkRef32To16.popl_eax)
+ ptr -= (int)&((WINDOWPROC *)0)->thunk;
+ /* Now we have a pointer to the WINDOWPROC struct */
+ if (((WINDOWPROC *)ptr)->magic == WINPROC_MAGIC)
+ return (WINDOWPROC *)ptr;
}
return NULL;
@@ -197,7 +227,7 @@
switch(type)
{
case WIN_PROC_16:
- proc->thunk.t_from32 = WINPROC_ThunkRef32ATo16;
+ proc->thunk.t_from32 = WINPROC_ThunkRef32To16;
proc->thunk.t_from32.proc = func;
/* We need to fix the relative jump target */
proc->thunk.t_from32.relay = (void (*)())((DWORD)proc->thunk.t_from32.relay -
@@ -206,10 +236,18 @@
case WIN_PROC_32A:
proc->thunk.t_from16 = WINPROC_ThunkRef16To32A;
proc->thunk.t_from16.proc = (FARPROC32)func;
+ proc->jmp = WINPROC_JumpRef;
+ /* Fixup relative jump */
+ proc->jmp.proc = (WNDPROC32)((DWORD)func -
+ (DWORD)(&proc->jmp.proc + 1));
break;
case WIN_PROC_32W:
proc->thunk.t_from16 = WINPROC_ThunkRef16To32W;
- proc->thunk.t_from16.proc = (FARPROC32)func;
+ proc->thunk.t_from16.proc = (WNDPROC32)func;
+ proc->jmp = WINPROC_JumpRef;
+ /* Fixup relative jump */
+ proc->jmp.proc = (WNDPROC32)((DWORD)func -
+ (DWORD)(&proc->jmp.proc + 1));
break;
default:
/* Should not happen */
@@ -219,6 +257,8 @@
proc->type = type;
}
proc->next = NULL;
+ dprintf_win( stddeb, "WINPROC_AllocWinProc(%08x,%d): returning %08x\n",
+ (UINT32)func, type, (UINT32)proc );
return proc;
}
@@ -235,14 +275,15 @@
if (((WINDOWPROC *)proc)->type == WIN_PROC_16)
return ((WINDOWPROC *)proc)->thunk.t_from32.proc;
else
- return (WNDPROC16)HEAP_GetSegptr( WinProcHeap, 0, proc );
+ return (WNDPROC16)HEAP_GetSegptr( WinProcHeap, 0,
+ &((WINDOWPROC *)proc)->thunk );
}
else /* We want a 32-bit address */
{
if (((WINDOWPROC *)proc)->type == WIN_PROC_16)
- return (WNDPROC16)proc;
+ return (WNDPROC16)&((WINDOWPROC *)proc)->thunk;
else
- return (WNDPROC16)((WINDOWPROC *)proc)->thunk.t_from16.proc;
+ return (WNDPROC16)&((WINDOWPROC *)proc)->jmp;
}
}
@@ -293,6 +334,8 @@
/* Add the win proc at the head of the list */
+ dprintf_win( stddeb, "WINPROC_SetProc(%08x,%08x,%d): res=%08x\n",
+ (UINT32)*pFirst, (UINT32)func, type, (UINT32)proc );
proc->next = *(WINDOWPROC **)pFirst;
*(WINDOWPROC **)pFirst = proc;
return TRUE;
@@ -309,6 +352,7 @@
while (proc)
{
WINDOWPROC *next = ((WINDOWPROC *)proc)->next;
+ dprintf_win( stddeb, "WINPROC_FreeProc: freeing %08x\n", (UINT32)proc);
HeapFree( WinProcHeap, 0, proc );
proc = next;
}
@@ -383,7 +427,7 @@
case WM_GETTEXT:
{
LPARAM *ptr = (LPARAM *)lParam - 1;
- STRING32_UniToAnsi( (LPSTR)*ptr, (LPWSTR)(ptr + 1) );
+ lstrcpynWtoA( (LPSTR)*ptr, (LPWSTR)(ptr + 1), wParam );
HeapFree( SystemHeap, 0, ptr );
}
break;
@@ -457,7 +501,7 @@
case WM_GETTEXT:
{
LPARAM *ptr = (LPARAM *)lParam - 1;
- STRING32_AnsiToUni( (LPWSTR)*ptr, (LPSTR)(ptr + 1) );
+ lstrcpynAtoW( (LPWSTR)*ptr, (LPSTR)(ptr + 1), wParam );
HeapFree( SystemHeap, 0, ptr );
}
break;
@@ -780,11 +824,13 @@
case WM_ACTIVATE:
case WM_CHARTOITEM:
case WM_COMMAND:
- case WM_HSCROLL:
case WM_VKEYTOITEM:
- case WM_VSCROLL:
*plparam = MAKELPARAM( (HWND16)*plparam, HIWORD(wParam32) );
return 0;
+ case WM_HSCROLL:
+ case WM_VSCROLL:
+ *plparam = MAKELPARAM( HIWORD(wParam32), (HWND16)*plparam );
+ return 0;
case WM_CTLCOLORMSGBOX:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORLISTBOX:
@@ -1169,23 +1215,7 @@
if (WINPROC_MapMsg32ATo16( msg, wParam, &msg16, &wParam16, &lParam ) == -1)
return 0;
-#ifndef WINELIB
- if ((msg16 == WM_CREATE) || (msg16 == WM_NCCREATE))
- {
- CREATESTRUCT16 *cs = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam);
- /* Build the CREATESTRUCT on the 16-bit stack. */
- /* This is really ugly, but some programs (notably the */
- /* "Undocumented Windows" examples) want it that way. */
- result = CallWndProcNCCREATE16( func, ds, cs->dwExStyle,
- cs->lpszClass, cs->lpszName, cs->style, cs->x, cs->y,
- cs->cx, cs->cy, cs->hwndParent, cs->hMenu, cs->hInstance,
- (LONG)cs->lpCreateParams, hwnd, msg16, wParam16,
- MAKELONG( IF1632_Saved16_sp-sizeof(CREATESTRUCT16),
- IF1632_Saved16_ss ) );
- }
- else
-#endif /* WINELIB */
- result = CallWndProc16( func, ds, hwnd, msg16, wParam16, lParam );
+ result = CallWndProc16( func, ds, hwnd, msg16, wParam16, lParam );
WINPROC_UnmapMsg32ATo16( msg16, wParam16, lParam );
return result;
}
@@ -1242,6 +1272,22 @@
case WIN_PROC_16:
if (!proc->thunk.t_from32.proc) return 0;
wndPtr = WIN_FindWndPtr( hwnd );
+#ifndef WINELIB
+ if ((msg == WM_CREATE) || (msg == WM_NCCREATE))
+ {
+ CREATESTRUCT16 *cs = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam);
+ /* Build the CREATESTRUCT on the 16-bit stack. */
+ /* This is really ugly, but some programs (notably the */
+ /* "Undocumented Windows" examples) want it that way. */
+ return CallWndProcNCCREATE16( proc->thunk.t_from32.proc,
+ wndPtr ? wndPtr->hInstance : CURRENT_DS, cs->dwExStyle,
+ cs->lpszClass, cs->lpszName, cs->style, cs->x, cs->y,
+ cs->cx, cs->cy, cs->hwndParent, cs->hMenu, cs->hInstance,
+ (LONG)cs->lpCreateParams, hwnd, msg, wParam,
+ MAKELONG( IF1632_Saved16_sp-sizeof(CREATESTRUCT16),
+ IF1632_Saved16_ss ) );
+ }
+#endif
return CallWndProc16( proc->thunk.t_from32.proc,
wndPtr ? wndPtr->hInstance : CURRENT_DS,
hwnd, msg, wParam, lParam );