Commit 7981d6c7 authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Alexandre Julliard

user32: Fix dialogs for 64-bits wine.

parent 7806e4d8
......@@ -150,7 +150,7 @@ typedef struct
extern BOOL COMBO_FlipListbox( LPHEADCOMBO, BOOL, BOOL ) DECLSPEC_HIDDEN;
/* Dialog info structure */
typedef struct
typedef struct tagDIALOGINFO
{
HWND hwndFocus; /* Current control with focus */
HFONT hUserFont; /* Dialog font */
......@@ -165,9 +165,6 @@ typedef struct
#define DF_END 0x0001
#define DF_OWNERENABLED 0x0002
/* offset of DIALOGINFO ptr in dialog extra bytes */
#define DWLP_WINE_DIALOGINFO (DWLP_USER+sizeof(ULONG_PTR))
extern DIALOGINFO *DIALOG_get_info( HWND hwnd, BOOL create ) DECLSPEC_HIDDEN;
extern void DIALOG_EnableOwner( HWND hOwner ) DECLSPEC_HIDDEN;
extern BOOL DIALOG_DisableOwner( HWND hOwner ) DECLSPEC_HIDDEN;
......
......@@ -230,8 +230,10 @@ static LRESULT DEFDLG_Proc( HWND hwnd, UINT msg, WPARAM wParam,
return 1;
}
case WM_NCDESTROY:
if ((dlgInfo = (DIALOGINFO *)SetWindowLongPtrW( hwnd, DWLP_WINE_DIALOGINFO, 0 )))
if (dlgInfo)
{
WND *wndPtr;
/* Free dialog heap (if created) */
if (dlgInfo->hDialogHeap)
{
......@@ -241,6 +243,10 @@ static LRESULT DEFDLG_Proc( HWND hwnd, UINT msg, WPARAM wParam,
if (dlgInfo->hUserFont) DeleteObject( dlgInfo->hUserFont );
if (dlgInfo->hMenu) DestroyMenu( dlgInfo->hMenu );
HeapFree( GetProcessHeap(), 0, dlgInfo );
wndPtr = WIN_GetPtr( hwnd );
wndPtr->dlgInfo = NULL;
WIN_ReleasePtr( wndPtr );
}
/* Window clean-up */
return DefWindowProcA( hwnd, msg, wParam, lParam );
......@@ -335,11 +341,18 @@ static LRESULT DEFDLG_Epilog(HWND hwnd, UINT msg, BOOL fResult)
DIALOGINFO *DIALOG_get_info( HWND hwnd, BOOL create )
{
WND* wndPtr;
DIALOGINFO* dlgInfo = (DIALOGINFO *)GetWindowLongPtrW( hwnd, DWLP_WINE_DIALOGINFO );
DIALOGINFO* dlgInfo;
if(!dlgInfo && create)
wndPtr = WIN_GetPtr( hwnd );
if (!wndPtr || wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP)
return NULL;
dlgInfo = wndPtr->dlgInfo;
if (!dlgInfo && create)
{
if (!(dlgInfo = HeapAlloc( GetProcessHeap(), 0, sizeof(*dlgInfo) ))) return NULL;
if (!(dlgInfo = HeapAlloc( GetProcessHeap(), 0, sizeof(*dlgInfo) )))
goto out;
dlgInfo->hwndFocus = 0;
dlgInfo->hUserFont = 0;
dlgInfo->hMenu = 0;
......@@ -348,19 +361,12 @@ DIALOGINFO *DIALOG_get_info( HWND hwnd, BOOL create )
dlgInfo->idResult = 0;
dlgInfo->flags = 0;
dlgInfo->hDialogHeap = 0;
wndPtr = WIN_GetPtr( hwnd );
if (wndPtr && wndPtr != WND_OTHER_PROCESS && wndPtr != WND_DESKTOP)
{
wndPtr->flags |= WIN_ISDIALOG;
WIN_ReleasePtr( wndPtr );
SetWindowLongPtrW( hwnd, DWLP_WINE_DIALOGINFO, (ULONG_PTR)dlgInfo );
}
else
{
HeapFree( GetProcessHeap(), 0, dlgInfo );
return NULL;
}
wndPtr->dlgInfo = dlgInfo;
wndPtr->flags |= WIN_ISDIALOG;
}
out:
WIN_ReleasePtr( wndPtr );
return dlgInfo;
}
......
......@@ -434,9 +434,9 @@ static HWND DIALOG_CreateIndirect16( HINSTANCE16 hInst, LPCVOID dlgTemplate,
}
wndPtr = WIN_GetPtr( hwnd );
wndPtr->flags |= WIN_ISDIALOG;
wndPtr->dlgInfo = dlgInfo;
WIN_ReleasePtr( wndPtr );
SetWindowLongPtrW( hwnd, DWLP_WINE_DIALOGINFO, (LONG_PTR)dlgInfo );
SetWindowLong16( HWND_16(hwnd), DWLP_DLGPROC, (LONG)dlgProc );
if (dlgInfo->hUserFont)
......
......@@ -31,6 +31,7 @@
#define WND_MAGIC 0x444e4957 /* 'WIND' */
struct tagCLASS;
struct tagDIALOGINFO;
typedef struct tagWND
{
......@@ -60,6 +61,7 @@ typedef struct tagWND
HMENU hSysMenu; /* window's copy of System Menu */
HICON hIcon; /* window's icon */
HICON hIconSmall; /* window's small icon */
struct tagDIALOGINFO *dlgInfo;/* Dialog additional info (dialogs only) */
int cbWndExtra; /* class cbWndExtra at window creation */
DWORD_PTR userdata; /* User private data */
DWORD wExtra[1]; /* Window extra bytes */
......
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