Release 960805
Sun Aug 4 18:18:48 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [controls/scroll.c]
Attempted to implement undocumented scroll-bar messages.
* [tools/build.c] [include/callback.h] [windows/winproc.c]
CallTo16_* functions now get DS from the previous 16-bit stackframe.
* [if1632/thunk.c] [include/callback.h]
Added thunks to implement callbacks for the emulator. Now all the
Enum* functions always take a real function pointer even in the
emulator.
* [loader/builtin.c]
Removed binary search in BUILTIN_GetEntryPoint32(), as it didn't
work with NULL entry points. Using linear search now.
* [loader/module.c]
Implemented IsSharedSelector().
* [loader/task.c]
Changed SwitchStackTo/Back to use the instance data to store the
previous stack instead of the TDB. Also copy the local variables
onto the new stack.
Added GetExeVersion() and SetTackSignalProc().
Implemented SetSigHandler().
Sat Aug 3 22:19:00 1996 Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk>
* [controls/menu.c]
"Fixed" problem in deleting menus where win32 could get into an
endless loop when it crashed. I think I've fixed the symptoms, not
the original problem so it might be worth further investigation.
* [debugger/registers.c]
Added missing #ifdefs on FS_REG and GS_REG, needed for FreeBSD to
compile wine properly.
* [files/dos_fs.c]
Made DOSFS_Hash and DOSFS_Match non-static so they can be called
from win32/findfile.c (q.v.).
* [if1632/gdi32.spec]
Added SetMapMode (call existing function)
* [if1632/kernel32.spec]
Added FindFirstFileA and SetFileAttributesA.
* [if1632/user32.spec]
Added BringWindowToTop, CreatePopupMenu, GetKeyState, GetParent,
IsDlgButtonChecked (call existing functions) and IsDialogMessageA,
UnhookWindowsHookEx.
* [win32/file.c]
Added stub function SetFileAttributes32A. It's a stub because I
can't really work out what this function should do with most
attributes in a Unix environment. Anyone care to expand it?
* [win32/findfile.c]
New file. Initial stab at FindFirstFile. This doesn't work as
specified yet, though a lot of the groundwork is there. I haven't
time to work on this for the next month, so if anyone wants to pick
it up and run with it please do.
* [win32/memory.c]
Removed malloc.h from includes (covered by stdlib.h include, and
gets rid of a warning in FreeBSD).
* [win32/newfns.c]
UnhookWindowsHookEx32A stub added.
* [win32/user32.c]
Added implementation of IsDialogMessage32A.
* [windows/dialog.c]
IsDlgButtonChecked now calls SendDlgItemMessage32A instead of
SendDlgItemMessage16.
Sat Aug 3 18:00:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu>
* [windows/graphics.c]
Removed rectangle checking (conflicted with nonstandard
mapping modes).
* [windows/dialog.c]
Added check for child-style dialogs to DS_ABSALIGN
coordinate conversion.
* [objects/color.c]
Cleaned up misc. bits
Thu Aug 1 10:51:45 1996 Andrew Lewycky <plewycky@oise.utoronto.ca>
* [windows/focus.c] [windows/event.c] [windows/win.c]
[windows/defdlg.c]
Fixes to focusing and activation.
* [windows/defdlg.c]
Properly(?) handle DM_GETDEFID.
* [controls/combo.c]
Handle CB_FINDSTRINGEXACT, CB_SETEDITSEL, CB_GETEDITSEL.
CBCheckSize: Adjust edit position.
Tue Jul 30 09:46:36 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [files/file.c] [include/file.h] [loader/module.c] [loader/ne_image.c]
Pass HFILEs instead of unix-fds to self-loader code.
Mon Jul 29 21:48:25 1996 Albrecht Kleine <kleine@ak.sax.de>
* [include/metafile.h] [objects/metafile.c] [objects/text.c]
Implemented handling of some new metafile records (META_...)
in PlayMetaFileRecord(), rewrite of 'case META_EXTTEXTOUT'.
Added functions like MF_StretchBlt() for usage in metafiles.
Minor bugfix in CopyMetafile().
* [objects/bitmap.c][objects/dib.c]
Added check for metafile-DC in Bitmap and DIB functions:
CreateCompatibleBitmap() etc.
diff --git a/windows/dce.c b/windows/dce.c
index 97fc7f5..58ada2a 100644
--- a/windows/dce.c
+++ b/windows/dce.c
@@ -118,11 +118,11 @@
}
/**********************************************************************
- * DCE_hDC2hWnd
+ * WindowFromDC (USER.117) (USER32.580)
*/
-HWND DCE_hDC2hWnd(HDC hDC)
+HWND16 WindowFromDC( HDC32 hDC )
{
- HANDLE hdce = DCE_FindDCE(hDC);
+ HANDLE16 hdce = DCE_FindDCE(hDC);
if( hdce )
{
diff --git a/windows/defdlg.c b/windows/defdlg.c
index 0ddbea8..c91c607 100644
--- a/windows/defdlg.c
+++ b/windows/defdlg.c
@@ -40,7 +40,6 @@
HWND hwndFocus = GetFocus();
if (!hwndFocus || !IsChild( hwnd, hwndFocus )) return FALSE;
- if (!infoPtr->hwndFocus) return FALSE; /* Already saved */
infoPtr->hwndFocus = hwndFocus;
/* Remove default button */
return TRUE;
@@ -60,7 +59,6 @@
}
-#ifdef SUPERFLUOUS_FUNCTIONS
/***********************************************************************
* DEFDLG_FindDefButton
*
@@ -77,7 +75,6 @@
}
return hwndChild;
}
-#endif
/***********************************************************************
@@ -117,6 +114,8 @@
static LRESULT DEFDLG_Proc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
LPARAM lParam, DIALOGINFO *dlgInfo )
{
+ HWND hwndDefId;
+
switch(msg)
{
case WM_INITDIALOG:
@@ -177,8 +176,13 @@
return 1;
case DM_GETDEFID:
- if (dlgInfo->fEnd || !dlgInfo->msgResult) return 0;
- return MAKELONG( dlgInfo->msgResult, DC_HASDEFID );
+ if (dlgInfo->fEnd) return 0;
+ if (dlgInfo->msgResult)
+ return MAKELONG( dlgInfo->msgResult, DC_HASDEFID );
+ hwndDefId = DEFDLG_FindDefButton( hwnd );
+ if (hwndDefId)
+ return MAKELONG( GetDlgCtrlID( hwndDefId ), DC_HASDEFID);
+ return 0;
case WM_NEXTDLGCTL:
{
diff --git a/windows/dialog.c b/windows/dialog.c
index 9faec22..3fbcb14 100644
--- a/windows/dialog.c
+++ b/windows/dialog.c
@@ -550,7 +550,7 @@
{
rect.left += template.x * xUnit / 4;
rect.top += template.y * yUnit / 8;
- if (!(template.style & DS_ABSALIGN))
+ if ( !(template.style & DS_ABSALIGN) && !(template.style & WS_CHILD) )
ClientToScreen16( owner, (POINT16 *)&rect );
}
@@ -1160,7 +1160,7 @@
*/
WORD IsDlgButtonChecked( HWND hwnd, WORD id )
{
- return (WORD)SendDlgItemMessage16( hwnd, id, BM_GETCHECK16, 0, 0 );
+ return (WORD)SendDlgItemMessage32A( hwnd, id, BM_GETCHECK32, 0, 0 );
}
diff --git a/windows/event.c b/windows/event.c
index f00cfe9..9ea4349 100644
--- a/windows/event.c
+++ b/windows/event.c
@@ -148,6 +148,7 @@
static void EVENT_SelectionNotify( XSelectionEvent *event);
static void EVENT_SelectionClear( WND *pWnd, XSelectionClearEvent *event);
static void EVENT_ClientMessage( WND *pWnd, XClientMessageEvent *event );
+static void EVENT_MapNotify( HWND hwnd, XMapEvent *event );
/* Usable only with OLVWM - compile option perhaps?
static void EVENT_EnterNotify( WND *pWnd, XCrossingEvent *event );
@@ -238,7 +239,20 @@
* break;
*/
case NoExpose:
- break;
+ break;
+
+ /* We get all these because of StructureNotifyMask. */
+ case UnmapNotify:
+ case CirculateNotify:
+ case CreateNotify:
+ case DestroyNotify:
+ case GravityNotify:
+ case ReparentNotify:
+ break;
+
+ case MapNotify:
+ EVENT_MapNotify( pWnd->hwndSelf, (XMapEvent *)event );
+ break;
default:
dprintf_event(stddeb, "Unprocessed event %s for hwnd %04x\n",
@@ -844,6 +858,19 @@
*/
/**********************************************************************
+ * EVENT_MapNotify
+ */
+void EVENT_MapNotify( HWND hWnd, XMapEvent *event )
+{
+ HWND hwndFocus = GetFocus();
+
+ if (hwndFocus && IsChild( hWnd, hwndFocus ))
+ FOCUS_SetXFocus(hwndFocus);
+
+ return;
+}
+
+/**********************************************************************
* SetCapture (USER.18)
*/
HWND SetCapture( HWND hwnd )
diff --git a/windows/focus.c b/windows/focus.c
index 1c28025..f2c7f20 100644
--- a/windows/focus.c
+++ b/windows/focus.c
@@ -11,6 +11,7 @@
#include "winpos.h"
#include "hook.h"
#include "color.h"
+#include "message.h"
#include "options.h"
static HWND hwndFocus = 0;
@@ -21,7 +22,7 @@
* Set the X focus.
* Explicit colormap management seems to work only with OLVWM.
*/
-static void FOCUS_SetXFocus( HWND hwnd )
+void FOCUS_SetXFocus( HWND hwnd )
{
XWindowAttributes win_attr;
Window win;
@@ -47,6 +48,8 @@
XSetInputFocus( display, win, RevertToParent, CurrentTime );
if (COLOR_GetSystemPaletteFlags() & COLOR_PRIVATE)
XInstallColormap( display, COLOR_GetColormap() );
+
+ EVENT_Synchronize();
}
/*****************************************************************
diff --git a/windows/graphics.c b/windows/graphics.c
index ef7806d..221bc02 100644
--- a/windows/graphics.c
+++ b/windows/graphics.c
@@ -453,7 +453,10 @@
{
HBRUSH prevBrush;
- if ((rect->right <= rect->left) || (rect->bottom <= rect->top)) return 0;
+ /* coordinates are logical so we cannot fast-check rectangle
+ * - do it in PatBlt() after LPtoDP().
+ */
+
if (!(prevBrush = SelectObject( hdc, hbrush ))) return 0;
PatBlt( hdc, rect->left, rect->top,
rect->right - rect->left, rect->bottom - rect->top, PATCOPY );
@@ -469,7 +472,6 @@
{
HBRUSH prevBrush;
- if ((rect->right <= rect->left) || (rect->bottom <= rect->top)) return 0;
if (!(prevBrush = SelectObject( hdc, (HBRUSH16)hbrush ))) return 0;
PatBlt( hdc, rect->left, rect->top,
rect->right - rect->left, rect->bottom - rect->top, PATCOPY );
@@ -483,7 +485,6 @@
*/
void InvertRect16( HDC16 hdc, const RECT16 *rect )
{
- if ((rect->right <= rect->left) || (rect->bottom <= rect->top)) return;
PatBlt( hdc, rect->left, rect->top,
rect->right - rect->left, rect->bottom - rect->top, DSTINVERT );
}
@@ -494,7 +495,6 @@
*/
void InvertRect32( HDC32 hdc, const RECT32 *rect )
{
- if ((rect->right <= rect->left) || (rect->bottom <= rect->top)) return;
PatBlt( hdc, rect->left, rect->top,
rect->right - rect->left, rect->bottom - rect->top, DSTINVERT );
}
@@ -511,13 +511,13 @@
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return FALSE;
- if ((rect->right <= rect->left) || (rect->bottom <= rect->top)) return 0;
- if (!(prevBrush = SelectObject( hdc, hbrush ))) return 0;
-
left = XLPTODP( dc, rect->left );
top = YLPTODP( dc, rect->top );
right = XLPTODP( dc, rect->right );
bottom = YLPTODP( dc, rect->bottom );
+
+ if ( (right <= left) || (bottom <= top) ) return 0;
+ if (!(prevBrush = SelectObject( hdc, hbrush ))) return 0;
if (DC_SetupGCForBrush( dc ))
{
diff --git a/windows/hook.c b/windows/hook.c
index e9cb158..a8bc38b 100644
--- a/windows/hook.c
+++ b/windows/hook.c
@@ -15,6 +15,7 @@
#define NO_TRANSITION_TYPES /* This file is Win32-clean */
#include "hook.h"
+#include "callback.h"
#include "queue.h"
#include "user.h"
#include "stddebug.h"
diff --git a/windows/message.c b/windows/message.c
index ff5e646..82d04dd 100644
--- a/windows/message.c
+++ b/windows/message.c
@@ -15,6 +15,7 @@
#include "sysmetrics.h"
#include "hook.h"
#include "spy.h"
+#include "stackframe.h"
#include "winpos.h"
#include "atom.h"
#include "dde.h"
diff --git a/windows/property.c b/windows/property.c
index e60a61c..22bcf98 100644
--- a/windows/property.c
+++ b/windows/property.c
@@ -8,7 +8,6 @@
#include <string.h>
#include "win.h"
#include "heap.h"
-#include "callback.h"
#include "string32.h"
#include "stddebug.h"
#include "debug.h"
@@ -235,8 +234,7 @@
dprintf_prop( stddeb, " Callback: handle=%08x str='%s'\n",
prop->handle, prop->string );
- ret = CallEnumPropProc16( (FARPROC16)func, hwnd,
- SEGPTR_GET(prop->string), prop->handle );
+ ret = func( hwnd, SEGPTR_GET(prop->string), prop->handle );
if (!ret) break;
}
return ret;
@@ -248,24 +246,7 @@
*/
INT32 EnumProps32A( HWND32 hwnd, PROPENUMPROC32A func )
{
- PROPERTY *prop, *next;
- WND *pWnd;
- INT32 ret = -1;
-
- dprintf_prop( stddeb, "EnumProps32A: %04x %08x\n", hwnd, (UINT32)func );
- if (!(pWnd = WIN_FindWndPtr( hwnd ))) return -1;
- for (prop = pWnd->pProp; (prop); prop = next)
- {
- /* Already get the next in case the callback */
- /* function removes the current property. */
- next = prop->next;
-
- dprintf_prop( stddeb, " Callback: handle=%08x str='%s'\n",
- prop->handle, prop->string );
- ret = CallEnumPropProc32( func, hwnd, prop->string, prop->handle );
- if (!ret) break;
- }
- return ret;
+ return EnumPropsEx32A( hwnd, (PROPENUMPROCEX32A)func, 0 );
}
@@ -274,33 +255,7 @@
*/
INT32 EnumProps32W( HWND32 hwnd, PROPENUMPROC32W func )
{
- PROPERTY *prop, *next;
- WND *pWnd;
- INT32 ret = -1;
-
- dprintf_prop( stddeb, "EnumProps32W: %04x %08x\n", hwnd, (UINT32)func );
- if (!(pWnd = WIN_FindWndPtr( hwnd ))) return -1;
- for (prop = pWnd->pProp; (prop); prop = next)
- {
- /* Already get the next in case the callback */
- /* function removes the current property. */
- next = prop->next;
-
- dprintf_prop( stddeb, " Callback: handle=%08x str='%s'\n",
- prop->handle, prop->string );
- if (HIWORD(prop->string))
- {
- LPWSTR str = STRING32_DupAnsiToUni( prop->string );
- ret = CallEnumPropProc32( func, hwnd, str, prop->handle );
- free( str );
- }
- else
- ret = CallEnumPropProc32( func, hwnd,
- (LPCWSTR)(UINT32)LOWORD(prop->string),
- prop->handle );
- if (!ret) break;
- }
- return ret;
+ return EnumPropsEx32W( hwnd, (PROPENUMPROCEX32W)func, 0 );
}
@@ -324,8 +279,7 @@
dprintf_prop( stddeb, " Callback: handle=%08x str='%s'\n",
prop->handle, prop->string );
- ret = CallEnumPropProcEx32( func, hwnd, prop->string,
- prop->handle, lParam );
+ ret = func( hwnd, prop->string, prop->handle, lParam );
if (!ret) break;
}
return ret;
@@ -355,13 +309,12 @@
if (HIWORD(prop->string))
{
LPWSTR str = STRING32_DupAnsiToUni( prop->string );
- ret = CallEnumPropProcEx32( func, hwnd, str, prop->handle, lParam);
+ ret = func( hwnd, str, prop->handle, lParam );
free( str );
}
else
- ret = CallEnumPropProcEx32( func, hwnd,
- (LPCWSTR)(UINT32)LOWORD(prop->string),
- prop->handle, lParam );
+ ret = func( hwnd, (LPCWSTR)(UINT32)LOWORD( prop->string ),
+ prop->handle, lParam );
if (!ret) break;
}
return ret;
diff --git a/windows/win.c b/windows/win.c
index 29b902f..845d9ac 100644
--- a/windows/win.c
+++ b/windows/win.c
@@ -28,7 +28,6 @@
#include "color.h"
#include "shm_main_blk.h"
#include "dde_proc.h"
-#include "callback.h"
#include "clipboard.h"
#include "winproc.h"
#include "stddebug.h"
@@ -602,7 +601,7 @@
win_attr.event_mask = ExposureMask | KeyPressMask |
KeyReleaseMask | PointerMotionMask |
ButtonPressMask | ButtonReleaseMask |
- FocusChangeMask;
+ FocusChangeMask | StructureNotifyMask;
win_attr.override_redirect = TRUE;
}
win_attr.colormap = COLOR_GetColormap();
@@ -1687,9 +1686,7 @@
{
/* Make sure that the window still exists */
if (!IsWindow((*ppWnd)->hwndSelf)) continue;
- if (!CallEnumWindowsProc16( (FARPROC16)lpEnumFunc,
- (*ppWnd)->hwndSelf, lParam ))
- break;
+ if (!lpEnumFunc( (*ppWnd)->hwndSelf, lParam )) break;
}
HeapFree( SystemHeap, 0, list );
return TRUE;
@@ -1701,25 +1698,7 @@
*/
BOOL32 EnumWindows32( WNDENUMPROC32 lpEnumFunc, LPARAM lParam )
{
- WND **list, **ppWnd;
-
- /* We have to build a list of all windows first, to avoid */
- /* unpleasant side-effects, for instance if the callback */
- /* function changes the Z-order of the windows. */
-
- if (!(list = WIN_BuildWinArray( pWndDesktop ))) return FALSE;
-
- /* Now call the callback function for every window */
-
- for (ppWnd = list; *ppWnd; ppWnd++)
- {
- /* Make sure that the window still exists */
- if (!IsWindow((*ppWnd)->hwndSelf)) continue;
- if (!CallEnumWindowsProc32( lpEnumFunc, (*ppWnd)->hwndSelf, lParam ))
- break;
- }
- HeapFree( SystemHeap, 0, list );
- return TRUE;
+ return (BOOL32)EnumWindows16( (WNDENUMPROC16)lpEnumFunc, lParam );
}
@@ -1743,9 +1722,7 @@
/* Make sure that the window still exists */
if (!IsWindow((*ppWnd)->hwndSelf)) continue;
if ((*ppWnd)->hmemTaskQ != hQueue) continue; /* Check the queue */
- if (!CallEnumWindowsProc16( (FARPROC16)func,
- (*ppWnd)->hwndSelf, lParam ))
- break;
+ if (!func( (*ppWnd)->hwndSelf, lParam )) break;
}
HeapFree( SystemHeap, 0, list );
return TRUE;
@@ -1757,33 +1734,17 @@
*/
BOOL32 EnumThreadWindows( DWORD id, WNDENUMPROC32 func, LPARAM lParam )
{
- WND **list, **ppWnd;
- HANDLE hQueue = GetTaskQueue( (DWORD)id );
-
- if (!(list = WIN_BuildWinArray( pWndDesktop ))) return FALSE;
-
- /* Now call the callback function for every window */
-
- for (ppWnd = list; *ppWnd; ppWnd++)
- {
- /* Make sure that the window still exists */
- if (!IsWindow((*ppWnd)->hwndSelf)) continue;
- if ((*ppWnd)->hmemTaskQ != hQueue) continue; /* Check the queue */
- if (!CallEnumWindowsProc32( func, (*ppWnd)->hwndSelf, lParam ))
- break;
- }
- HeapFree( SystemHeap, 0, list );
- return TRUE;
+ return (BOOL16)EnumTaskWindows16((HTASK16)id, (WNDENUMPROC16)func, lParam);
}
/**********************************************************************
- * WIN_EnumChildWindows16
+ * WIN_EnumChildWindows
*
- * Helper function for EnumChildWindows16().
+ * Helper function for EnumChildWindows().
*/
-static BOOL16 WIN_EnumChildWindows16( WND **ppWnd, WNDENUMPROC16 func,
- LPARAM lParam )
+static BOOL16 WIN_EnumChildWindows( WND **ppWnd, WNDENUMPROC16 func,
+ LPARAM lParam )
{
WND **childList;
BOOL16 ret = FALSE;
@@ -1794,37 +1755,8 @@
if (!IsWindow((*ppWnd)->hwndSelf)) continue;
/* Build children list first */
if (!(childList = WIN_BuildWinArray( *ppWnd ))) return FALSE;
- if (!CallEnumWindowsProc16((FARPROC16)func,(*ppWnd)->hwndSelf,lParam))
- return FALSE;
- ret = WIN_EnumChildWindows16( childList, func, lParam );
- HeapFree( SystemHeap, 0, childList );
- if (!ret) return FALSE;
- ppWnd++;
- }
- return TRUE;
-}
-
-
-/**********************************************************************
- * WIN_EnumChildWindows32
- *
- * Helper function for EnumChildWindows32().
- */
-static BOOL32 WIN_EnumChildWindows32( WND **ppWnd, WNDENUMPROC32 func,
- LPARAM lParam )
-{
- WND **childList;
- BOOL32 ret = FALSE;
-
- while (*ppWnd)
- {
- /* Make sure that the window still exists */
- if (!IsWindow((*ppWnd)->hwndSelf)) continue;
- /* Build children list first */
- if (!(childList = WIN_BuildWinArray( *ppWnd ))) return FALSE;
- if (!CallEnumWindowsProc32( func, (*ppWnd)->hwndSelf, lParam ))
- return FALSE;
- ret = WIN_EnumChildWindows32( childList, func, lParam );
+ if (!func( (*ppWnd)->hwndSelf, lParam )) return FALSE;
+ ret = WIN_EnumChildWindows( childList, func, lParam );
HeapFree( SystemHeap, 0, childList );
if (!ret) return FALSE;
ppWnd++;
@@ -1842,7 +1774,7 @@
if (!(pParent = WIN_FindWndPtr( parent ))) return FALSE;
if (!(list = WIN_BuildWinArray( pParent ))) return FALSE;
- WIN_EnumChildWindows16( list, func, lParam );
+ WIN_EnumChildWindows( list, func, lParam );
HeapFree( SystemHeap, 0, list );
return TRUE;
}
@@ -1853,13 +1785,8 @@
*/
BOOL32 EnumChildWindows32( HWND32 parent, WNDENUMPROC32 func, LPARAM lParam )
{
- WND **list, *pParent;
-
- if (!(pParent = WIN_FindWndPtr( parent ))) return FALSE;
- if (!(list = WIN_BuildWinArray( pParent ))) return FALSE;
- WIN_EnumChildWindows32( list, func, lParam );
- HeapFree( SystemHeap, 0, list );
- return TRUE;
+ return (BOOL32)EnumChildWindows16( (HWND16)parent, (WNDENUMPROC16)func,
+ lParam );
}
diff --git a/windows/winpos.c b/windows/winpos.c
index 23ab087..9e1a9cc 100644
--- a/windows/winpos.c
+++ b/windows/winpos.c
@@ -683,7 +683,8 @@
else
{
/* We can't activate a child window */
- if (wndPtr->dwStyle & WS_CHILD) swpflags |= SWP_NOACTIVATE;
+ if (wndPtr->dwStyle & WS_CHILD)
+ swpflags |= SWP_NOACTIVATE | SWP_NOZORDER;
SetWindowPos( hwnd, HWND_TOP, x, y, cx, cy, swpflags );
if (!IsWindow( hwnd )) return wasVisible;
}
diff --git a/windows/winproc.c b/windows/winproc.c
index f52a6d2..06057c0 100644
--- a/windows/winproc.c
+++ b/windows/winproc.c
@@ -1344,11 +1344,13 @@
UINT16 msg16;
WPARAM16 wParam16;
WND *wndPtr = WIN_FindWndPtr( hwnd );
- WORD ds = wndPtr ? wndPtr->hInstance : CURRENT_DS;
+ WORD ds = CURRENT_DS;
if (WINPROC_MapMsg32ATo16( msg, wParam, &msg16, &wParam16, &lParam ) == -1)
return 0;
- result = CallWndProc16( func, ds, hwnd, msg16, wParam16, lParam );
+ if (wndPtr) CURRENT_DS = wndPtr->hInstance;
+ result = CallWndProc16( func, hwnd, msg16, wParam16, lParam );
+ CURRENT_DS = ds;
WINPROC_UnmapMsg32ATo16( msg16, wParam16, lParam );
return result;
}
@@ -1367,11 +1369,13 @@
UINT16 msg16;
WPARAM16 wParam16;
WND *wndPtr = WIN_FindWndPtr( hwnd );
+ WORD ds = CURRENT_DS;
if (WINPROC_MapMsg32WTo16( msg, wParam, &msg16, &wParam16, &lParam ) == -1)
return 0;
- result = CallWndProc16( func, wndPtr ? wndPtr->hInstance : CURRENT_DS,
- hwnd, msg16, wParam16, lParam );
+ if (wndPtr) CURRENT_DS = wndPtr->hInstance;
+ result = CallWndProc16( func, hwnd, msg16, wParam16, lParam );
+ CURRENT_DS = ds;
WINPROC_UnmapMsg32WTo16( msg16, wParam16, lParam );
return result;
}
@@ -1383,21 +1387,26 @@
LRESULT CallWindowProc16( WNDPROC16 func, HWND16 hwnd, UINT16 msg,
WPARAM16 wParam, LPARAM lParam )
{
+ LRESULT result;
WND *wndPtr;
WINDOWPROC *proc = WINPROC_GetPtr( func );
+ WORD ds = CURRENT_DS;
if (!proc)
{
wndPtr = WIN_FindWndPtr( hwnd );
- return CallWndProc16( (FARPROC16)func,
- wndPtr ? wndPtr->hInstance : CURRENT_DS,
- hwnd, msg, wParam, lParam );
+ if (wndPtr) CURRENT_DS = wndPtr->hInstance;
+ result = CallWndProc16( (FARPROC16)func, hwnd, msg, wParam, lParam );
+ CURRENT_DS = ds;
+ return result;
}
#if testing
wndPtr = WIN_FindWndPtr( hwnd );
- return CallWndProc16( WINPROC_GetProc( (HWINDOWPROC)proc, WIN_PROC_16),
- wndPtr ? wndPtr->hInstance : CURRENT_DS,
- hwnd, msg, wParam, lParam );
+ if (wndPtr) CURRENT_DS = wndPtr->hInstance;
+ result = CallWndProc16( WINPROC_GetProc( (HWINDOWPROC)proc, WIN_PROC_16),
+ hwnd, msg, wParam, lParam );
+ CURRENT_DS = ds;
+ return result;
#endif
switch(proc->type)
@@ -1405,6 +1414,7 @@
case WIN_PROC_16:
if (!proc->thunk.t_from32.proc) return 0;
wndPtr = WIN_FindWndPtr( hwnd );
+ if (wndPtr) CURRENT_DS = wndPtr->hInstance;
#ifndef WINELIB
if ((msg == WM_CREATE) || (msg == WM_NCCREATE))
{
@@ -1412,18 +1422,21 @@
/* 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 ) );
+ result = CallWndProcNCCREATE16( proc->thunk.t_from32.proc,
+ 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 ) );
+ CURRENT_DS = ds;
+ return result;
}
#endif
- return CallWndProc16( proc->thunk.t_from32.proc,
- wndPtr ? wndPtr->hInstance : CURRENT_DS,
- hwnd, msg, wParam, lParam );
+ result = CallWndProc16( proc->thunk.t_from32.proc,
+ hwnd, msg, wParam, lParam );
+ CURRENT_DS = ds;
+ return result;
+
case WIN_PROC_32A:
if (!proc->thunk.t_from16.proc) return 0;
return WINPROC_CallProc16To32A( hwnd, msg, wParam, lParam,