mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 00:23:37 +00:00
win32u: Introduce NtUserGetDialogInfo and NtUserSetDialogInfo.
And use it instead of accessing window object from user32.
This commit is contained in:
parent
fcf4d07161
commit
1cd5702d9f
|
@ -237,15 +237,11 @@ static LRESULT DEFDLG_Proc( HWND hwnd, UINT msg, WPARAM wParam,
|
|||
case WM_NCDESTROY:
|
||||
if (dlgInfo)
|
||||
{
|
||||
WND *wndPtr;
|
||||
|
||||
if (dlgInfo->hUserFont) DeleteObject( dlgInfo->hUserFont );
|
||||
if (dlgInfo->hMenu) NtUserDestroyMenu( dlgInfo->hMenu );
|
||||
HeapFree( GetProcessHeap(), 0, dlgInfo );
|
||||
|
||||
wndPtr = WIN_GetPtr( hwnd );
|
||||
wndPtr->dlgInfo = NULL;
|
||||
WIN_ReleasePtr( wndPtr );
|
||||
NtUserSetDialogInfo( hwnd, NULL );
|
||||
}
|
||||
/* Window clean-up */
|
||||
return DefWindowProcA( hwnd, msg, wParam, lParam );
|
||||
|
@ -323,22 +319,14 @@ static LRESULT DEFDLG_Proc( HWND hwnd, UINT msg, WPARAM wParam,
|
|||
*/
|
||||
DIALOGINFO *DIALOG_get_info( HWND hwnd, BOOL create )
|
||||
{
|
||||
WND* wndPtr;
|
||||
DIALOGINFO* dlgInfo;
|
||||
|
||||
wndPtr = WIN_GetPtr( hwnd );
|
||||
if (!wndPtr || wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP)
|
||||
{
|
||||
SetLastError( ERROR_INVALID_WINDOW_HANDLE );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dlgInfo = wndPtr->dlgInfo;
|
||||
dlgInfo = NtUserGetDialogInfo( hwnd );
|
||||
|
||||
if (!dlgInfo && create)
|
||||
{
|
||||
if (!(dlgInfo = HeapAlloc( GetProcessHeap(), 0, sizeof(*dlgInfo) )))
|
||||
goto out;
|
||||
return NULL;
|
||||
dlgInfo->hwndFocus = 0;
|
||||
dlgInfo->hUserFont = 0;
|
||||
dlgInfo->hMenu = 0;
|
||||
|
@ -346,11 +334,9 @@ DIALOGINFO *DIALOG_get_info( HWND hwnd, BOOL create )
|
|||
dlgInfo->yBaseUnit = 0;
|
||||
dlgInfo->idResult = IDOK;
|
||||
dlgInfo->flags = 0;
|
||||
wndPtr->dlgInfo = dlgInfo;
|
||||
NtUserSetDialogInfo( hwnd, dlgInfo );
|
||||
}
|
||||
|
||||
out:
|
||||
WIN_ReleasePtr( wndPtr );
|
||||
return dlgInfo;
|
||||
}
|
||||
|
||||
|
|
|
@ -5359,6 +5359,32 @@ failed:
|
|||
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.@)
|
||||
*/
|
||||
|
@ -5381,6 +5407,9 @@ ULONG_PTR WINAPI NtUserCallHwnd( HWND hwnd, DWORD code )
|
|||
case NtUserCallHwnd_GetParent:
|
||||
return HandleToUlong( get_parent( hwnd ));
|
||||
|
||||
case NtUserCallHwnd_GetDialogInfo:
|
||||
return (ULONG_PTR)get_dialog_info( hwnd );
|
||||
|
||||
case NtUserCallHwnd_GetWindowContextHelpId:
|
||||
return get_window_context_help_id( hwnd );
|
||||
|
||||
|
@ -5510,6 +5539,9 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code )
|
|||
case NtUserCallHwndParam_ScreenToClient:
|
||||
return screen_to_client( hwnd, (POINT *)param );
|
||||
|
||||
case NtUserCallHwndParam_SetDialogInfo:
|
||||
return set_dialog_info( hwnd, (void *)param );
|
||||
|
||||
case NtUserCallHwndParam_SetWindowContextHelpId:
|
||||
return set_window_context_help_id( hwnd, param );
|
||||
|
||||
|
|
|
@ -1101,6 +1101,7 @@ enum
|
|||
NtUserCallHwnd_ArrangeIconicWindows,
|
||||
NtUserCallHwnd_DrawMenuBar,
|
||||
NtUserCallHwnd_GetDefaultImeWindow,
|
||||
NtUserCallHwnd_GetDialogInfo,
|
||||
NtUserCallHwnd_GetDpiForWindow,
|
||||
NtUserCallHwnd_GetParent,
|
||||
NtUserCallHwnd_GetWindowContextHelpId,
|
||||
|
@ -1138,6 +1139,11 @@ static inline HWND NtUserGetDefaultImeWindow( HWND hwnd )
|
|||
return UlongToHandle( NtUserCallHwnd( hwnd, NtUserCallHwnd_GetDefaultImeWindow ));
|
||||
}
|
||||
|
||||
static inline void *NtUserGetDialogInfo( HWND hwnd )
|
||||
{
|
||||
return (void *)NtUserCallHwnd( hwnd, NtUserCallHwnd_GetDialogInfo );
|
||||
}
|
||||
|
||||
static inline UINT NtUserGetDpiForWindow( HWND hwnd )
|
||||
{
|
||||
return NtUserCallHwnd( hwnd, NtUserCallHwnd_GetDpiForWindow );
|
||||
|
@ -1216,6 +1222,7 @@ enum
|
|||
NtUserCallHwndParam_MirrorRgn,
|
||||
NtUserCallHwndParam_MonitorFromWindow,
|
||||
NtUserCallHwndParam_ScreenToClient,
|
||||
NtUserCallHwndParam_SetDialogInfo,
|
||||
NtUserCallHwndParam_SetWindowContextHelpId,
|
||||
NtUserCallHwndParam_SetWindowPixelFormat,
|
||||
NtUserCallHwndParam_ShowOwnedPopups,
|
||||
|
@ -1365,6 +1372,11 @@ static inline BOOL NtUserScreenToClient( HWND hwnd, POINT *pt )
|
|||
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 )
|
||||
{
|
||||
return NtUserCallHwndParam( hwnd, id, NtUserCallHwndParam_SetWindowContextHelpId );
|
||||
|
|
Loading…
Reference in a new issue