mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[WIN32K][USER32] Change mechanism for storing dialog info pointer
DLGWINDOWEXTRA is 30 (both on win32 and win64). This has storage for the following entries: DWLP_MSGRESULT (0), DWLP_DLGPROC (8), DWLP_USER (16) We used to store the dialog info pointer using SetWindowLongPtr (DWLP_ROS_DIALOGINFO == DWLP_USER+sizeof(ULONG_PTR) == 24), which was fine on win32, but failed on win64, since there wasn't enough space left (24 + 8 = 32 > 30). Rewrite the way the DLGINFO pointer is stored, by adding an additional field to the WND structure and set it using NtUserxSetDialogPointer (which is what it is for). Also fix too small cbWndExtra for the button class.
This commit is contained in:
parent
50c9dab6c9
commit
d07203ecb7
4 changed files with 9 additions and 14 deletions
|
@ -726,6 +726,8 @@ typedef struct _WND
|
|||
PSBINFOEX pSBInfoex; // convert to PSBINFO
|
||||
/* Entry in the list of thread windows. */
|
||||
LIST_ENTRY ThreadListEntry;
|
||||
|
||||
PVOID DialogPointer;
|
||||
} WND, *PWND;
|
||||
|
||||
#define PWND_BOTTOM ((PWND)1)
|
||||
|
|
|
@ -798,9 +798,10 @@ NtUserCallHwndParam(
|
|||
UserRefObjectCo(pWnd, &Ref);
|
||||
|
||||
if (pWnd->head.pti->ppi == PsGetCurrentProcessWin32Process() &&
|
||||
pWnd->cbwndExtra == DLGWINDOWEXTRA &&
|
||||
pWnd->cbwndExtra >= DLGWINDOWEXTRA &&
|
||||
!(pWnd->state & WNDS_SERVERSIDEWINDOWPROC))
|
||||
{
|
||||
pWnd->DialogPointer = (PVOID)Param;
|
||||
if (Param)
|
||||
{
|
||||
if (!pWnd->fnid) pWnd->fnid = FNID_DIALOG;
|
||||
|
|
|
@ -72,7 +72,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(button);
|
|||
#define BUTTON_HFONT_GWL_OFFSET (sizeof(LONG))
|
||||
#define HIMAGE_GWL_OFFSET (BUTTON_HFONT_GWL_OFFSET+sizeof(HFONT))
|
||||
#define BUTTON_UISTATE_GWL_OFFSET (HIMAGE_GWL_OFFSET+sizeof(HFONT))
|
||||
#define NB_EXTRA_BYTES (BUTTON_UISTATE_GWL_OFFSET+sizeof(LONG))
|
||||
#define NB_EXTRA_BYTES (BUTTON_UISTATE_GWL_OFFSET+sizeof(LONG_PTR))
|
||||
|
||||
/* undocumented flags */
|
||||
#define BUTTON_NSTATES 0x0F
|
||||
|
|
|
@ -36,9 +36,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(user32);
|
|||
|
||||
#define DF_END 0x0001
|
||||
#define DF_DIALOGACTIVE 0x4000 // ReactOS
|
||||
#define DWLP_ROS_DIALOGINFO (DWLP_USER+sizeof(ULONG_PTR))
|
||||
#define GETDLGINFO(hwnd) DIALOG_get_info(hwnd, FALSE)
|
||||
#define SETDLGINFO(hwnd, info) SetWindowLongPtrW((hwnd), DWLP_ROS_DIALOGINFO, (LONG_PTR)(info))
|
||||
#define GET_WORD(ptr) (*(WORD *)(ptr))
|
||||
#define GET_DWORD(ptr) (*(DWORD *)(ptr))
|
||||
#define GET_LONG(ptr) (*(const LONG *)(ptr))
|
||||
|
@ -141,7 +139,7 @@ DIALOGINFO *DIALOG_get_info( HWND hWnd, BOOL create )
|
|||
return NULL;
|
||||
}
|
||||
|
||||
dlgInfo = (DIALOGINFO *)GetWindowLongPtrW( hWnd, DWLP_ROS_DIALOGINFO );
|
||||
dlgInfo = pWindow->DialogPointer;
|
||||
|
||||
if (!dlgInfo && create)
|
||||
{
|
||||
|
@ -151,7 +149,7 @@ DIALOGINFO *DIALOG_get_info( HWND hWnd, BOOL create )
|
|||
return NULL;
|
||||
|
||||
dlgInfo->idResult = IDOK;
|
||||
SETDLGINFO( hWnd, dlgInfo );
|
||||
NtUserxSetDialogPointer( hWnd, dlgInfo );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -159,13 +157,6 @@ DIALOGINFO *DIALOG_get_info( HWND hWnd, BOOL create )
|
|||
}
|
||||
}
|
||||
|
||||
if (dlgInfo)
|
||||
{
|
||||
if (!(pWindow->state & WNDS_DIALOGWINDOW))
|
||||
{
|
||||
NtUserxSetDialogPointer( hWnd, dlgInfo );
|
||||
}
|
||||
}
|
||||
return dlgInfo;
|
||||
}
|
||||
|
||||
|
@ -1258,7 +1249,8 @@ static LRESULT DEFDLG_Proc( HWND hwnd, UINT msg, WPARAM wParam,
|
|||
}
|
||||
case WM_NCDESTROY:
|
||||
//// ReactOS
|
||||
if ((dlgInfo = (DIALOGINFO *)SetWindowLongPtrW( hwnd, DWLP_ROS_DIALOGINFO, 0 )))
|
||||
dlgInfo = DIALOG_get_info(hwnd, FALSE);
|
||||
if (dlgInfo != NULL)
|
||||
{
|
||||
if (dlgInfo->hUserFont) DeleteObject( dlgInfo->hUserFont );
|
||||
if (dlgInfo->hMenu) DestroyMenu( dlgInfo->hMenu );
|
||||
|
|
Loading…
Reference in a new issue