Commit 1cd5702d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard
Browse files

win32u: Introduce NtUserGetDialogInfo and NtUserSetDialogInfo.

And use it instead of accessing window object from user32.
parent fcf4d071
...@@ -237,15 +237,11 @@ static LRESULT DEFDLG_Proc( HWND hwnd, UINT msg, WPARAM wParam, ...@@ -237,15 +237,11 @@ static LRESULT DEFDLG_Proc( HWND hwnd, UINT msg, WPARAM wParam,
case WM_NCDESTROY: case WM_NCDESTROY:
if (dlgInfo) if (dlgInfo)
{ {
WND *wndPtr;
if (dlgInfo->hUserFont) DeleteObject( dlgInfo->hUserFont ); if (dlgInfo->hUserFont) DeleteObject( dlgInfo->hUserFont );
if (dlgInfo->hMenu) NtUserDestroyMenu( dlgInfo->hMenu ); if (dlgInfo->hMenu) NtUserDestroyMenu( dlgInfo->hMenu );
HeapFree( GetProcessHeap(), 0, dlgInfo ); HeapFree( GetProcessHeap(), 0, dlgInfo );
wndPtr = WIN_GetPtr( hwnd ); NtUserSetDialogInfo( hwnd, NULL );
wndPtr->dlgInfo = NULL;
WIN_ReleasePtr( wndPtr );
} }
/* Window clean-up */ /* Window clean-up */
return DefWindowProcA( hwnd, msg, wParam, lParam ); return DefWindowProcA( hwnd, msg, wParam, lParam );
...@@ -323,22 +319,14 @@ static LRESULT DEFDLG_Proc( HWND hwnd, UINT msg, WPARAM wParam, ...@@ -323,22 +319,14 @@ static LRESULT DEFDLG_Proc( HWND hwnd, UINT msg, WPARAM wParam,
*/ */
DIALOGINFO *DIALOG_get_info( HWND hwnd, BOOL create ) DIALOGINFO *DIALOG_get_info( HWND hwnd, BOOL create )
{ {
WND* wndPtr;
DIALOGINFO* dlgInfo; DIALOGINFO* dlgInfo;
wndPtr = WIN_GetPtr( hwnd ); dlgInfo = NtUserGetDialogInfo( hwnd );
if (!wndPtr || wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP)
{
SetLastError( ERROR_INVALID_WINDOW_HANDLE );
return NULL;
}
dlgInfo = wndPtr->dlgInfo;
if (!dlgInfo && create) if (!dlgInfo && create)
{ {
if (!(dlgInfo = HeapAlloc( GetProcessHeap(), 0, sizeof(*dlgInfo) ))) if (!(dlgInfo = HeapAlloc( GetProcessHeap(), 0, sizeof(*dlgInfo) )))
goto out; return NULL;
dlgInfo->hwndFocus = 0; dlgInfo->hwndFocus = 0;
dlgInfo->hUserFont = 0; dlgInfo->hUserFont = 0;
dlgInfo->hMenu = 0; dlgInfo->hMenu = 0;
...@@ -346,11 +334,9 @@ DIALOGINFO *DIALOG_get_info( HWND hwnd, BOOL create ) ...@@ -346,11 +334,9 @@ DIALOGINFO *DIALOG_get_info( HWND hwnd, BOOL create )
dlgInfo->yBaseUnit = 0; dlgInfo->yBaseUnit = 0;
dlgInfo->idResult = IDOK; dlgInfo->idResult = IDOK;
dlgInfo->flags = 0; dlgInfo->flags = 0;
wndPtr->dlgInfo = dlgInfo; NtUserSetDialogInfo( hwnd, dlgInfo );
} }
out:
WIN_ReleasePtr( wndPtr );
return dlgInfo; return dlgInfo;
} }
......
...@@ -5359,6 +5359,32 @@ failed: ...@@ -5359,6 +5359,32 @@ failed:
return 0; return 0;
} }
static void *get_dialog_info( HWND hwnd )
{
WND *win;
void *ret;
if (!(win = get_win_ptr( hwnd )) || win == WND_OTHER_PROCESS || win == WND_DESKTOP)
{
SetLastError( ERROR_INVALID_WINDOW_HANDLE );
return NULL;
}
ret = win->dlgInfo;
release_win_ptr( win );
return ret;
}
static BOOL set_dialog_info( HWND hwnd, void *info )
{
WND *win;
if (!(win = get_win_ptr( hwnd )) || win == WND_OTHER_PROCESS || win == WND_DESKTOP) return FALSE;
win->dlgInfo = info;
release_win_ptr( win );
return TRUE;
}
/***************************************************************************** /*****************************************************************************
* NtUserCallHwnd (win32u.@) * NtUserCallHwnd (win32u.@)
*/ */
...@@ -5381,6 +5407,9 @@ ULONG_PTR WINAPI NtUserCallHwnd( HWND hwnd, DWORD code ) ...@@ -5381,6 +5407,9 @@ ULONG_PTR WINAPI NtUserCallHwnd( HWND hwnd, DWORD code )
case NtUserCallHwnd_GetParent: case NtUserCallHwnd_GetParent:
return HandleToUlong( get_parent( hwnd )); return HandleToUlong( get_parent( hwnd ));
case NtUserCallHwnd_GetDialogInfo:
return (ULONG_PTR)get_dialog_info( hwnd );
case NtUserCallHwnd_GetWindowContextHelpId: case NtUserCallHwnd_GetWindowContextHelpId:
return get_window_context_help_id( hwnd ); return get_window_context_help_id( hwnd );
...@@ -5510,6 +5539,9 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code ) ...@@ -5510,6 +5539,9 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code )
case NtUserCallHwndParam_ScreenToClient: case NtUserCallHwndParam_ScreenToClient:
return screen_to_client( hwnd, (POINT *)param ); return screen_to_client( hwnd, (POINT *)param );
case NtUserCallHwndParam_SetDialogInfo:
return set_dialog_info( hwnd, (void *)param );
case NtUserCallHwndParam_SetWindowContextHelpId: case NtUserCallHwndParam_SetWindowContextHelpId:
return set_window_context_help_id( hwnd, param ); return set_window_context_help_id( hwnd, param );
......
...@@ -1101,6 +1101,7 @@ enum ...@@ -1101,6 +1101,7 @@ enum
NtUserCallHwnd_ArrangeIconicWindows, NtUserCallHwnd_ArrangeIconicWindows,
NtUserCallHwnd_DrawMenuBar, NtUserCallHwnd_DrawMenuBar,
NtUserCallHwnd_GetDefaultImeWindow, NtUserCallHwnd_GetDefaultImeWindow,
NtUserCallHwnd_GetDialogInfo,
NtUserCallHwnd_GetDpiForWindow, NtUserCallHwnd_GetDpiForWindow,
NtUserCallHwnd_GetParent, NtUserCallHwnd_GetParent,
NtUserCallHwnd_GetWindowContextHelpId, NtUserCallHwnd_GetWindowContextHelpId,
...@@ -1138,6 +1139,11 @@ static inline HWND NtUserGetDefaultImeWindow( HWND hwnd ) ...@@ -1138,6 +1139,11 @@ static inline HWND NtUserGetDefaultImeWindow( HWND hwnd )
return UlongToHandle( NtUserCallHwnd( hwnd, NtUserCallHwnd_GetDefaultImeWindow )); return UlongToHandle( NtUserCallHwnd( hwnd, NtUserCallHwnd_GetDefaultImeWindow ));
} }
static inline void *NtUserGetDialogInfo( HWND hwnd )
{
return (void *)NtUserCallHwnd( hwnd, NtUserCallHwnd_GetDialogInfo );
}
static inline UINT NtUserGetDpiForWindow( HWND hwnd ) static inline UINT NtUserGetDpiForWindow( HWND hwnd )
{ {
return NtUserCallHwnd( hwnd, NtUserCallHwnd_GetDpiForWindow ); return NtUserCallHwnd( hwnd, NtUserCallHwnd_GetDpiForWindow );
...@@ -1216,6 +1222,7 @@ enum ...@@ -1216,6 +1222,7 @@ enum
NtUserCallHwndParam_MirrorRgn, NtUserCallHwndParam_MirrorRgn,
NtUserCallHwndParam_MonitorFromWindow, NtUserCallHwndParam_MonitorFromWindow,
NtUserCallHwndParam_ScreenToClient, NtUserCallHwndParam_ScreenToClient,
NtUserCallHwndParam_SetDialogInfo,
NtUserCallHwndParam_SetWindowContextHelpId, NtUserCallHwndParam_SetWindowContextHelpId,
NtUserCallHwndParam_SetWindowPixelFormat, NtUserCallHwndParam_SetWindowPixelFormat,
NtUserCallHwndParam_ShowOwnedPopups, NtUserCallHwndParam_ShowOwnedPopups,
...@@ -1365,6 +1372,11 @@ static inline BOOL NtUserScreenToClient( HWND hwnd, POINT *pt ) ...@@ -1365,6 +1372,11 @@ static inline BOOL NtUserScreenToClient( HWND hwnd, POINT *pt )
return NtUserCallHwndParam( hwnd, (UINT_PTR)pt, NtUserCallHwndParam_ScreenToClient ); return NtUserCallHwndParam( hwnd, (UINT_PTR)pt, NtUserCallHwndParam_ScreenToClient );
} }
static inline void NtUserSetDialogInfo( HWND hwnd, void *info )
{
NtUserCallHwndParam( hwnd, (UINT_PTR)info, NtUserCallHwndParam_SetDialogInfo );
}
static inline BOOL NtUserSetWindowContextHelpId( HWND hwnd, DWORD id ) static inline BOOL NtUserSetWindowContextHelpId( HWND hwnd, DWORD id )
{ {
return NtUserCallHwndParam( hwnd, id, NtUserCallHwndParam_SetWindowContextHelpId ); return NtUserCallHwndParam( hwnd, id, NtUserCallHwndParam_SetWindowContextHelpId );
......
Supports Markdown
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