From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/button.c | 4 ++-- dlls/user32/clipboard.c | 6 +++--- dlls/user32/combo.c | 4 ++-- dlls/user32/dialog.c | 2 +- dlls/user32/edit.c | 10 +++++----- dlls/user32/icontitle.c | 2 +- dlls/user32/mdi.c | 2 +- dlls/user32/msgbox.c | 2 +- dlls/user32/painting.c | 16 ---------------- dlls/user32/static.c | 2 +- dlls/user32/user32.spec | 2 +- dlls/win32u/dce.c | 9 +++++++++ dlls/win32u/menu.c | 6 +++--- dlls/win32u/syscall.c | 1 + dlls/win32u/sysparams.c | 2 +- dlls/win32u/win32u.spec | 2 +- dlls/wow64win/syscall.h | 1 + dlls/wow64win/user.c | 7 +++++++ include/ntuser.h | 1 + 19 files changed, 42 insertions(+), 39 deletions(-)
diff --git a/dlls/user32/button.c b/dlls/user32/button.c index 2c661ffcce0..10a111562a7 100644 --- a/dlls/user32/button.c +++ b/dlls/user32/button.c @@ -141,7 +141,7 @@ static inline void paint_button( HWND hwnd, LONG style, UINT action ) { if (btnPaintFunc[style] && IsWindowVisible(hwnd)) { - HDC hdc = GetDC( hwnd ); + HDC hdc = NtUserGetDC( hwnd ); btnPaintFunc[style]( hwnd, hdc, action ); NtUserReleaseDC( hwnd, hdc ); } @@ -328,7 +328,7 @@ LRESULT ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, /* Clear an old text here as Windows does */ if (IsWindowVisible(hWnd)) { - HDC hdc = GetDC(hWnd); + HDC hdc = NtUserGetDC(hWnd); HBRUSH hbrush; RECT client, rc; HWND parent = GetParent(hWnd); diff --git a/dlls/user32/clipboard.c b/dlls/user32/clipboard.c index db86b447148..dd33bd7df82 100644 --- a/dlls/user32/clipboard.c +++ b/dlls/user32/clipboard.c @@ -349,7 +349,7 @@ static HANDLE render_synthesized_bitmap( HANDLE data, UINT from ) { BITMAPINFO *bmi; HANDLE ret = 0; - HDC hdc = GetDC( 0 ); + HDC hdc = NtUserGetDC( 0 );
if ((bmi = GlobalLock( data ))) { @@ -369,7 +369,7 @@ static HANDLE render_synthesized_dib( HANDLE data, UINT format, UINT from ) BITMAPINFO *bmi, *src; DWORD src_size, header_size, bits_size; HANDLE ret = 0; - HDC hdc = GetDC( 0 ); + HDC hdc = NtUserGetDC( 0 );
if (from == CF_BITMAP) { @@ -428,7 +428,7 @@ static HANDLE render_synthesized_metafile( HANDLE data ) void *bits; METAFILEPICT *pict; ENHMETAHEADER header; - HDC hdc = GetDC( 0 ); + HDC hdc = NtUserGetDC( 0 );
size = GetWinMetaFileBits( data, 0, NULL, MM_ISOTROPIC, hdc ); if ((bits = HeapAlloc( GetProcessHeap(), 0, size ))) diff --git a/dlls/user32/combo.c b/dlls/user32/combo.c index e03a168b237..6afd841f82a 100644 --- a/dlls/user32/combo.c +++ b/dlls/user32/combo.c @@ -162,7 +162,7 @@ static LRESULT COMBO_NCDestroy( LPHEADCOMBO lphc )
static INT combo_get_text_height(const HEADCOMBO *combo) { - HDC hdc = GetDC(combo->self); + HDC hdc = NtUserGetDC(combo->self); HFONT prev_font = 0; TEXTMETRICW tm;
@@ -659,7 +659,7 @@ static void CBPaintText( else if(!(lphc->wState & CBF_NOREDRAW) && IsWindowVisible( lphc->self )) { /* paint text field ourselves */ - HDC hdc = hdc_paint ? hdc_paint : GetDC(lphc->self); + HDC hdc = hdc_paint ? hdc_paint : NtUserGetDC(lphc->self); UINT itemState = ODS_COMBOBOXEDIT; HFONT hPrevFont = (lphc->hFont) ? SelectObject(hdc, lphc->hFont) : 0; HBRUSH hPrevBrush, hBkgBrush; diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c index 68c0d804ca7..d13594324e0 100644 --- a/dlls/user32/dialog.c +++ b/dlls/user32/dialog.c @@ -469,7 +469,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
if (template.style & DS_SETFONT) { - HDC dc = GetDC(0); + HDC dc = NtUserGetDC(0);
if (template.pointSize == 0x7fff) { diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c index d950cb89889..74411d385e2 100644 --- a/dlls/user32/edit.c +++ b/dlls/user32/edit.c @@ -380,7 +380,7 @@ static SCRIPT_STRING_ANALYSIS EDIT_UpdateUniscribeData_linedef(EDITSTATE *es, HD HRESULT hr;
if (!udc) - udc = GetDC(es->hwndSelf); + udc = NtUserGetDC(es->hwndSelf); if (es->font) old_font = SelectObject(udc, es->font);
@@ -421,7 +421,7 @@ static SCRIPT_STRING_ANALYSIS EDIT_UpdateUniscribeData(EDITSTATE *es, HDC dc, IN HDC udc = dc;
if (!udc) - udc = GetDC(es->hwndSelf); + udc = NtUserGetDC(es->hwndSelf); if (es->font) old_font = SelectObject(udc, es->font);
@@ -2885,7 +2885,7 @@ static void EDIT_EM_SetMargins(EDITSTATE *es, INT action,
/* Set the default margins depending on the font */ if (es->font && (left == EC_USEFONTINFO || right == EC_USEFONTINFO)) { - HDC dc = GetDC(es->hwndSelf); + HDC dc = NtUserGetDC(es->hwndSelf); HFONT old_font = SelectObject(dc, es->font); LONG width = GdiGetCharDimensions(dc, &tm, NULL), rc_width; RECT rc; @@ -3798,7 +3798,7 @@ static void EDIT_WM_SetFocus(EDITSTATE *es) /* single line edit updates itself */ if (IsWindowVisible(es->hwndSelf) && !(es->style & ES_MULTILINE)) { - HDC hdc = GetDC(es->hwndSelf); + HDC hdc = NtUserGetDC(es->hwndSelf); EDIT_WM_Paint(es, hdc); NtUserReleaseDC( es->hwndSelf, hdc ); } @@ -3859,7 +3859,7 @@ static void EDIT_WM_SetFont(EDITSTATE *es, HFONT font, BOOL redraw)
es->font = font; EDIT_InvalidateUniscribeData(es); - dc = GetDC(es->hwndSelf); + dc = NtUserGetDC(es->hwndSelf); if (font) old_font = SelectObject(dc, font); GetTextMetricsW(dc, &tm); diff --git a/dlls/user32/icontitle.c b/dlls/user32/icontitle.c index cce3f45250f..047ac5ef1c8 100644 --- a/dlls/user32/icontitle.c +++ b/dlls/user32/icontitle.c @@ -47,7 +47,7 @@ static BOOL ICONTITLE_SetTitlePos( HWND hwnd, HWND owner ) length = lstrlenW( str ); }
- if (!(hDC = GetDC( hwnd ))) return FALSE; + if (!(hDC = NtUserGetDC( hwnd ))) return FALSE;
hPrevFont = SelectObject( hDC, hIconTitleFont );
diff --git a/dlls/user32/mdi.c b/dlls/user32/mdi.c index ce608b3ba9f..f579298544a 100644 --- a/dlls/user32/mdi.c +++ b/dlls/user32/mdi.c @@ -823,7 +823,7 @@ static BOOL MDI_AugmentFrameMenu( HWND frame, HWND hChild ) { HDC hMemDC; HBITMAP hBitmap, hOldBitmap; - HDC hdc = GetDC(hChild); + HDC hdc = NtUserGetDC(hChild);
if (hdc) { diff --git a/dlls/user32/msgbox.c b/dlls/user32/msgbox.c index 22ddc30efed..4a14a868c73 100644 --- a/dlls/user32/msgbox.c +++ b/dlls/user32/msgbox.c @@ -231,7 +231,7 @@ static void MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMSW lpmb) ileft = rect.left; iwidth = rect.right - ileft;
- hdc = GetDC(hwnd); + hdc = NtUserGetDC(hwnd); hPrevFont = SelectObject( hdc, (HFONT)SendMessageW( hwnd, WM_GETFONT, 0, 0 ));
/* Get the number of visible buttons and their size */ diff --git a/dlls/user32/painting.c b/dlls/user32/painting.c index 89451e4e46b..a231dd68a3d 100644 --- a/dlls/user32/painting.c +++ b/dlls/user32/painting.c @@ -22,22 +22,6 @@ #include "user_private.h"
-/*********************************************************************** - * GetDC (USER32.@) - * - * Get a device context. - * - * RETURNS - * Success: Handle to the device context - * Failure: NULL. - */ -HDC WINAPI GetDC( HWND hwnd ) -{ - if (!hwnd) return NtUserGetDCEx( 0, 0, DCX_CACHE | DCX_WINDOW ); - return NtUserGetDCEx( hwnd, 0, DCX_USESTYLE ); -} - - /*********************************************************************** * GetWindowDC (USER32.@) */ diff --git a/dlls/user32/static.c b/dlls/user32/static.c index f5cef12b12a..f3953f7610a 100644 --- a/dlls/user32/static.c +++ b/dlls/user32/static.c @@ -275,7 +275,7 @@ static VOID STATIC_TryPaintFcn(HWND hwnd, LONG full_style) LONG style = full_style & SS_TYPEMASK;
GetClientRect( hwnd, &rc ); - hdc = GetDC( hwnd ); + hdc = NtUserGetDC( hwnd ); hrgn = set_control_clipping( hdc, &rc ); hbrush = STATIC_SendWmCtlColorStatic( hwnd, hdc ); if (staticPaintFunc[style]) diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index 88684c29506..464348201cb 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -287,7 +287,7 @@ @ stdcall GetCursorFrameInfo(long long long ptr ptr) @ stdcall GetCursorInfo(ptr) NtUserGetCursorInfo @ stdcall GetCursorPos(ptr) -@ stdcall GetDC(long) +@ stdcall GetDC(long) NtUserGetDC @ stdcall GetDCEx(long long long) NtUserGetDCEx @ stdcall GetDesktopWindow() @ stdcall GetDialogBaseUnits() diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index da5d5078b09..360b985c339 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -1029,6 +1029,15 @@ INT WINAPI NtUserReleaseDC( HWND hwnd, HDC hdc ) return release_dc( hwnd, hdc, FALSE ); }
+/*********************************************************************** + * NtUserGetDC (win32u.@) + */ +HDC WINAPI NtUserGetDC( HWND hwnd ) +{ + if (!hwnd) return NtUserGetDCEx( 0, 0, DCX_CACHE | DCX_WINDOW ); + return NtUserGetDCEx( hwnd, 0, DCX_USESTYLE ); +} + /********************************************************************** * NtUserWindowFromDC (win32u.@) */ diff --git a/dlls/win32u/menu.c b/dlls/win32u/menu.c index 98456446e11..a6b7ec38003 100644 --- a/dlls/win32u/menu.c +++ b/dlls/win32u/menu.c @@ -2960,7 +2960,7 @@ static void calc_popup_menu_size( struct menu *menu, UINT max_height ) SetRectEmpty( &menu->items_rect );
if (menu->nItems == 0) return; - hdc = NtUserGetDCEx( 0, 0, DCX_CACHE | DCX_WINDOW ); + hdc = NtUserGetDC( 0 );
NtGdiSelectFont( hdc, get_menu_font( FALSE ));
@@ -3163,7 +3163,7 @@ static void select_item( HWND owner, HMENU hmenu, UINT index, BOOL send_select, if (!menu || !menu->nItems || !menu->hWnd) return;
if (menu->FocusedItem == index) return; - if (menu->wFlags & MF_POPUP) hdc = NtUserGetDCEx( menu->hWnd, 0, DCX_USESTYLE ); + if (menu->wFlags & MF_POPUP) hdc = NtUserGetDC( menu->hWnd ); else hdc = NtUserGetDCEx( menu->hWnd, 0, DCX_CACHE | DCX_WINDOW); if (!top_popup) { @@ -3369,7 +3369,7 @@ static HMENU show_sub_popup( HWND owner, HMENU hmenu, BOOL select_first, UINT fl /* correct item if modified as a reaction to WM_INITMENUPOPUP message */ if (!(item->fState & MF_HILITE)) { - if (menu->wFlags & MF_POPUP) hdc = NtUserGetDCEx( menu->hWnd, 0, DCX_USESTYLE ); + if (menu->wFlags & MF_POPUP) hdc = NtUserGetDC( menu->hWnd ); else hdc = NtUserGetDCEx( menu->hWnd, 0, DCX_CACHE | DCX_WINDOW );
NtGdiSelectFont( hdc, get_menu_font( FALSE )); diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index ec6cd859ff6..8c603dbf81e 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -169,6 +169,7 @@ static void * const syscalls[] = NtUserGetCursor, NtUserGetCursorFrameInfo, NtUserGetCursorInfo, + NtUserGetDC, NtUserGetDCEx, NtUserGetDisplayConfigBufferSizes, NtUserGetDoubleClickTime, diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index d02ff16a2c0..5854e000fea 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -3496,7 +3496,7 @@ DWORD get_dialog_base_units(void) { HDC hdc;
- if ((hdc = NtUserGetDCEx( 0, 0, DCX_CACHE | DCX_WINDOW ))) + if ((hdc = NtUserGetDC( 0 ))) { cx = get_char_dimensions( hdc, NULL, &cy ); NtUserReleaseDC( 0, hdc ); diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index c9c126ec2f3..43d9b3904d0 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -915,7 +915,7 @@ @ stdcall -syscall NtUserGetCursor() @ stdcall -syscall NtUserGetCursorFrameInfo(long long ptr ptr) @ stdcall -syscall NtUserGetCursorInfo(ptr) -@ stub NtUserGetDC +@ stdcall -syscall NtUserGetDC(long) @ stdcall -syscall NtUserGetDCEx(long long long) @ stub NtUserGetDManipHookInitFunction @ stub NtUserGetDesktopID diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index e9b63f365dd..288dd593c2f 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -155,6 +155,7 @@ SYSCALL_ENTRY( NtUserGetCursor ) \ SYSCALL_ENTRY( NtUserGetCursorFrameInfo ) \ SYSCALL_ENTRY( NtUserGetCursorInfo ) \ + SYSCALL_ENTRY( NtUserGetDC ) \ SYSCALL_ENTRY( NtUserGetDCEx ) \ SYSCALL_ENTRY( NtUserGetDisplayConfigBufferSizes ) \ SYSCALL_ENTRY( NtUserGetDoubleClickTime ) \ diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 256add62aab..934612dce8a 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -1918,6 +1918,13 @@ NTSTATUS WINAPI wow64_NtUserGetCursorInfo( UINT *args ) return TRUE; }
+NTSTATUS WINAPI wow64_NtUserGetDC( UINT *args ) +{ + HWND hwnd = get_handle( &args ); + + return HandleToUlong( NtUserGetDC( hwnd )); +} + NTSTATUS WINAPI wow64_NtUserGetDCEx( UINT *args ) { HWND hwnd = get_handle( &args ); diff --git a/include/ntuser.h b/include/ntuser.h index 5331b3d7400..c27af731f29 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -733,6 +733,7 @@ HCURSOR WINAPI NtUserGetCursor(void); HCURSOR WINAPI NtUserGetCursorFrameInfo( HCURSOR hCursor, DWORD istep, DWORD *rate_jiffies, DWORD *num_steps ); BOOL WINAPI NtUserGetCursorInfo( CURSORINFO *info ); +HDC WINAPI NtUserGetDC( HWND hwnd ); HDC WINAPI NtUserGetDCEx( HWND hwnd, HRGN clip_rgn, DWORD flags ); LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_info, UINT32 *num_mode_info );
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/painting.c | 9 --------- dlls/user32/user32.spec | 2 +- dlls/win32u/dce.c | 8 ++++++++ dlls/win32u/defwnd.c | 6 +++--- dlls/win32u/syscall.c | 1 + dlls/win32u/win32u.spec | 2 +- dlls/wow64win/syscall.h | 1 + dlls/wow64win/user.c | 7 +++++++ include/ntuser.h | 1 + 9 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/dlls/user32/painting.c b/dlls/user32/painting.c index a231dd68a3d..c962f0dccf2 100644 --- a/dlls/user32/painting.c +++ b/dlls/user32/painting.c @@ -22,15 +22,6 @@ #include "user_private.h"
-/*********************************************************************** - * GetWindowDC (USER32.@) - */ -HDC WINAPI GetWindowDC( HWND hwnd ) -{ - return NtUserGetDCEx( hwnd, 0, DCX_USESTYLE | DCX_WINDOW ); -} - - /*********************************************************************** * UpdateWindow (USER32.@) */ diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index 464348201cb..e71370e9761 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -405,7 +405,7 @@ # @ stub GetWinStationInfo @ stdcall GetWindow(long long) @ stdcall GetWindowContextHelpId(long) -@ stdcall GetWindowDC(long) +@ stdcall GetWindowDC(long) NtUserGetWindowDC @ stdcall GetWindowDisplayAffinity(long ptr) @ stdcall GetWindowDpiAwarenessContext(long) @ stdcall GetWindowInfo(long ptr) diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index 360b985c339..9b5f87589c6 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -1038,6 +1038,14 @@ HDC WINAPI NtUserGetDC( HWND hwnd ) return NtUserGetDCEx( hwnd, 0, DCX_USESTYLE ); }
+/*********************************************************************** + * NtUserGetWindowDC (win32u.@) + */ +HDC WINAPI NtUserGetWindowDC( HWND hwnd ) +{ + return NtUserGetDCEx( hwnd, 0, DCX_USESTYLE | DCX_WINDOW ); +} + /********************************************************************** * NtUserWindowFromDC (win32u.@) */ diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index 04953508cf2..e58d4e5a793 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -2067,7 +2067,7 @@ LRESULT handle_nc_hit_test( HWND hwnd, POINT pt )
static void track_min_max_box( HWND hwnd, WORD wparam ) { - HDC hdc = NtUserGetDCEx( hwnd, 0, DCX_USESTYLE | DCX_WINDOW ); + HDC hdc = NtUserGetWindowDC( hwnd ); DWORD style = get_window_long( hwnd, GWL_STYLE ); HMENU sys_menu = NtUserGetSystemMenu(hwnd, FALSE); void (*paint_button)( HWND, HDC, BOOL, BOOL ); @@ -2141,7 +2141,7 @@ static void track_close_button( HWND hwnd, WPARAM wparam, LPARAM lparam )
/* If the close item of the sysmenu is disabled or not present do nothing */ if((state & MF_DISABLED) || (state & MF_GRAYED) || state == 0xFFFFFFFF) return; - hdc = NtUserGetDCEx( hwnd, 0, DCX_USESTYLE | DCX_WINDOW ); + hdc = NtUserGetWindowDC( hwnd ); NtUserSetCapture( hwnd ); draw_close_button( hwnd, hdc, TRUE, FALSE );
@@ -2191,7 +2191,7 @@ static LRESULT handle_nc_lbutton_down( HWND hwnd, WPARAM wparam, LPARAM lparam ) case HTSYSMENU: if (style & WS_SYSMENU) { - HDC hdc = NtUserGetDCEx( hwnd, 0, DCX_USESTYLE | DCX_WINDOW ); + HDC hdc = NtUserGetWindowDC( hwnd ); draw_nc_sys_button( hwnd, hdc, TRUE ); NtUserReleaseDC( hwnd, hdc ); send_message( hwnd, WM_SYSCOMMAND, SC_MOUSEMENU + HTSYSMENU, lparam ); diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index 8c603dbf81e..3e029f413e5 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -209,6 +209,7 @@ static void * const syscalls[] = NtUserGetUpdateRect, NtUserGetUpdateRgn, NtUserGetUpdatedClipboardFormats, + NtUserGetWindowDC, NtUserGetWindowPlacement, NtUserGetWindowRgnEx, NtUserHideCaret, diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index 43d9b3904d0..9a987045868 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1009,7 +1009,7 @@ @ stub NtUserGetWindowBand @ stub NtUserGetWindowCompositionAttribute @ stub NtUserGetWindowCompositionInfo -@ stub NtUserGetWindowDC +@ stdcall -syscall NtUserGetWindowDC(long) @ stub NtUserGetWindowDisplayAffinity @ stub NtUserGetWindowFeedbackSetting @ stub NtUserGetWindowGroupId diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index 288dd593c2f..25d8d42e575 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -195,6 +195,7 @@ SYSCALL_ENTRY( NtUserGetUpdateRect ) \ SYSCALL_ENTRY( NtUserGetUpdateRgn ) \ SYSCALL_ENTRY( NtUserGetUpdatedClipboardFormats ) \ + SYSCALL_ENTRY( NtUserGetWindowDC ) \ SYSCALL_ENTRY( NtUserGetWindowPlacement ) \ SYSCALL_ENTRY( NtUserGetWindowRgnEx ) \ SYSCALL_ENTRY( NtUserHideCaret ) \ diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 934612dce8a..78ffc34e68e 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -2570,6 +2570,13 @@ NTSTATUS WINAPI wow64_NtUserGetUpdatedClipboardFormats( UINT *args ) return NtUserGetUpdatedClipboardFormats( formats, size, out_size ); }
+NTSTATUS WINAPI wow64_NtUserGetWindowDC( UINT *args ) +{ + HWND hwnd = get_handle( &args ); + + return HandleToUlong( NtUserGetWindowDC( hwnd )); +} + NTSTATUS WINAPI wow64_NtUserGetWindowPlacement( UINT *args ) { HWND hwnd = get_handle( &args ); diff --git a/include/ntuser.h b/include/ntuser.h index c27af731f29..cff2b6633a5 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -777,6 +777,7 @@ BOOL WINAPI NtUserGetTitleBarInfo( HWND hwnd, TITLEBARINFO *info ); INT WINAPI NtUserGetUpdateRgn( HWND hwnd, HRGN hrgn, BOOL erase ); BOOL WINAPI NtUserGetUpdatedClipboardFormats( UINT *formats, UINT size, UINT *out_size ); BOOL WINAPI NtUserGetUpdateRect( HWND hwnd, RECT *rect, BOOL erase ); +HDC WINAPI NtUserGetWindowDC( HWND hwnd ); BOOL WINAPI NtUserGetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *placement ); int WINAPI NtUserGetWindowRgnEx( HWND hwnd, HRGN hrgn, UINT unk ); BOOL WINAPI NtUserHideCaret( HWND hwnd );
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/icontitle.c | 2 +- dlls/user32/painting.c | 20 -------------------- dlls/user32/user32.spec | 2 +- dlls/win32u/dce.c | 16 ++++++++++++++++ dlls/win32u/syscall.c | 1 + dlls/win32u/win32u.spec | 2 +- dlls/wow64win/syscall.h | 1 + dlls/wow64win/user.c | 8 ++++++++ include/ntuser.h | 1 + 9 files changed, 30 insertions(+), 23 deletions(-)
diff --git a/dlls/user32/icontitle.c b/dlls/user32/icontitle.c index 047ac5ef1c8..687f2b69d72 100644 --- a/dlls/user32/icontitle.c +++ b/dlls/user32/icontitle.c @@ -176,7 +176,7 @@ LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg, else lParam = (owner == GetActiveWindow()); if( ICONTITLE_Paint( hWnd, owner, (HDC)wParam, (BOOL)lParam ) ) - ValidateRect( hWnd, NULL ); + NtUserValidateRect( hWnd, NULL ); return 1; } return DefWindowProcW( hWnd, msg, wParam, lParam ); diff --git a/dlls/user32/painting.c b/dlls/user32/painting.c index c962f0dccf2..be6f91e1bde 100644 --- a/dlls/user32/painting.c +++ b/dlls/user32/painting.c @@ -52,26 +52,6 @@ BOOL WINAPI ValidateRgn( HWND hwnd, HRGN hrgn ) }
-/*********************************************************************** - * ValidateRect (USER32.@) - * - * MSDN: if hwnd parameter is NULL, ValidateRect invalidates and redraws - * all windows and sends WM_ERASEBKGND and WM_NCPAINT. - */ -BOOL WINAPI ValidateRect( HWND hwnd, const RECT *rect ) -{ - UINT flags = RDW_VALIDATE; - - if (!hwnd) - { - flags = RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_FRAME | RDW_ERASE | RDW_ERASENOW; - rect = NULL; - } - - return NtUserRedrawWindow( hwnd, rect, 0, flags ); -} - - /************************************************************************* * ScrollWindow (USER32.@) * diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index e71370e9761..b843d2068cd 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -807,7 +807,7 @@ @ stdcall UserSignalProc(long long long long) # @ stub VRipOutput # @ stub VTagOutput -@ stdcall ValidateRect(long ptr) +@ stdcall ValidateRect(long ptr) NtUserValidateRect @ stdcall ValidateRgn(long long) @ stdcall VkKeyScanA(long) @ stdcall VkKeyScanExA(long long) diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index 9b5f87589c6..364fbe6455b 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -1507,6 +1507,22 @@ BOOL WINAPI NtUserRedrawWindow( HWND hwnd, const RECT *rect, HRGN hrgn, UINT fla return ret; }
+/*********************************************************************** + * NtUserValidateRect (win32u.@) + */ +BOOL WINAPI NtUserValidateRect( HWND hwnd, const RECT *rect ) +{ + UINT flags = RDW_VALIDATE; + + if (!hwnd) + { + flags = RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_FRAME | RDW_ERASE | RDW_ERASENOW; + rect = NULL; + } + + return NtUserRedrawWindow( hwnd, rect, 0, flags ); +} + /*********************************************************************** * NtUserGetUpdateRgn (win32u.@) */ diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index 3e029f413e5..97052d4dc46 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -302,6 +302,7 @@ static void * const syscalls[] = NtUserUnregisterClass, NtUserUnregisterHotKey, NtUserUpdateInputContext, + NtUserValidateRect, NtUserVkKeyScanEx, NtUserWaitForInputIdle, NtUserWindowFromDC, diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index 9a987045868..d4e4365ce23 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1300,7 +1300,7 @@ @ stub NtUserUpdateWindowInputSinkHints @ stub NtUserUpdateWindowTrackingInfo @ stub NtUserUserHandleGrantAccess -@ stub NtUserValidateRect +@ stdcall -syscall NtUserValidateRect(long ptr) @ stub NtUserValidateTimerCallback @ stdcall -syscall NtUserVkKeyScanEx(long long) @ stub NtUserWOWCleanup diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index 25d8d42e575..c2cd0b7bbf5 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -288,6 +288,7 @@ SYSCALL_ENTRY( NtUserUnregisterClass ) \ SYSCALL_ENTRY( NtUserUnregisterHotKey ) \ SYSCALL_ENTRY( NtUserUpdateInputContext ) \ + SYSCALL_ENTRY( NtUserValidateRect ) \ SYSCALL_ENTRY( NtUserVkKeyScanEx ) \ SYSCALL_ENTRY( NtUserWaitForInputIdle ) \ SYSCALL_ENTRY( NtUserWindowFromDC ) \ diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 78ffc34e68e..af77475e740 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -4102,6 +4102,14 @@ NTSTATUS WINAPI wow64_NtUserUpdateInputContext( UINT *args ) return NtUserUpdateInputContext( handle, attr, value ); }
+NTSTATUS WINAPI wow64_NtUserValidateRect( UINT *args ) +{ + HWND hwnd = get_handle( &args ); + const RECT *rect = get_ptr( &args ); + + return NtUserValidateRect( hwnd, rect ); +} + NTSTATUS WINAPI wow64_NtUserVkKeyScanEx( UINT *args ) { WCHAR chr = get_ulong( &args ); diff --git a/include/ntuser.h b/include/ntuser.h index cff2b6633a5..18718ea8a2c 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -892,6 +892,7 @@ BOOL WINAPI NtUserUpdateInputContext( HIMC handle, UINT attr, UINT_PTR value BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *pts_dst, const SIZE *size, HDC hdc_src, const POINT *pts_src, COLORREF key, const BLENDFUNCTION *blend, DWORD flags, const RECT *dirty ); +BOOL WINAPI NtUserValidateRect( HWND hwnd, const RECT *rect ); WORD WINAPI NtUserVkKeyScanEx( WCHAR chr, HKL layout ); DWORD WINAPI NtUserWaitForInputIdle( HANDLE process, DWORD timeout, BOOL wow ); HWND WINAPI NtUserWindowFromDC( HDC hdc );
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/painting.c | 15 --------------- dlls/user32/user32.spec | 2 +- dlls/win32u/dce.c | 11 +++++++++++ dlls/win32u/syscall.c | 1 + dlls/win32u/win32u.spec | 2 +- dlls/wow64win/syscall.h | 1 + dlls/wow64win/user.c | 9 +++++++++ include/ntuser.h | 1 + 8 files changed, 25 insertions(+), 17 deletions(-)
diff --git a/dlls/user32/painting.c b/dlls/user32/painting.c index be6f91e1bde..de67cd97e5f 100644 --- a/dlls/user32/painting.c +++ b/dlls/user32/painting.c @@ -62,18 +62,3 @@ BOOL WINAPI ScrollWindow( HWND hwnd, INT dx, INT dy, UINT flags = SW_INVALIDATE | SW_ERASE | (rect ? 0 : SW_SCROLLCHILDREN) | SW_NODCCACHE; return NtUserScrollWindowEx( hwnd, dx, dy, rect, clipRect, 0, NULL, flags ); } - -/************************************************************************ - * PrintWindow (USER32.@) - * - */ -BOOL WINAPI PrintWindow(HWND hwnd, HDC hdcBlt, UINT nFlags) -{ - UINT flags = PRF_CHILDREN | PRF_ERASEBKGND | PRF_OWNED | PRF_CLIENT; - if(!(nFlags & PW_CLIENTONLY)) - { - flags |= PRF_NONCLIENT; - } - SendMessageW(hwnd, WM_PRINT, (WPARAM)hdcBlt, flags); - return TRUE; -} diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index b843d2068cd..1130ab457cd 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -576,7 +576,7 @@ @ stdcall PostQuitMessage(long) @ stdcall PostThreadMessageA(long long long long) @ stdcall PostThreadMessageW(long long long long) NtUserPostThreadMessage -@ stdcall PrintWindow(long long long) +@ stdcall PrintWindow(long long long) NtUserPrintWindow @ stdcall PrivateExtractIconExA(str long ptr ptr long) @ stdcall PrivateExtractIconExW(wstr long ptr ptr long) @ stdcall PrivateExtractIconsA (str long long long ptr ptr long long) diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index 364fbe6455b..1cc6a0d605e 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -1858,3 +1858,14 @@ INT WINAPI NtUserScrollWindowEx( HWND hwnd, INT dx, INT dy, const RECT *rect,
return retval; } + +/************************************************************************ + * NtUserPrintWindow (win32u.@) + */ +BOOL WINAPI NtUserPrintWindow( HWND hwnd, HDC hdc, UINT flags ) +{ + UINT prf_flags = PRF_CHILDREN | PRF_ERASEBKGND | PRF_OWNED | PRF_CLIENT; + if (!(flags & PW_CLIENTONLY)) prf_flags |= PRF_NONCLIENT; + send_message( hwnd, WM_PRINT, (WPARAM)hdc, prf_flags ); + return TRUE; +} diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index 97052d4dc46..558edc0257e 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -237,6 +237,7 @@ static void * const syscalls[] = NtUserPerMonitorDPIPhysicalToLogicalPoint, NtUserPostMessage, NtUserPostThreadMessage, + NtUserPrintWindow, NtUserQueryInputContext, NtUserRedrawWindow, NtUserRegisterClassExWOW, diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index d4e4365ce23..1d85a450748 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1105,7 +1105,7 @@ @ stub NtUserPostKeyboardInputMessage @ stdcall -syscall NtUserPostMessage(long long long long) @ stdcall -syscall NtUserPostThreadMessage(long long long long) -@ stub NtUserPrintWindow +@ stdcall -syscall NtUserPrintWindow(long long long) @ stub NtUserProcessConnect @ stub NtUserProcessInkFeedbackCommand @ stub NtUserPromoteMouseInPointer diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index c2cd0b7bbf5..8573fa743a5 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -223,6 +223,7 @@ SYSCALL_ENTRY( NtUserPerMonitorDPIPhysicalToLogicalPoint ) \ SYSCALL_ENTRY( NtUserPostMessage ) \ SYSCALL_ENTRY( NtUserPostThreadMessage ) \ + SYSCALL_ENTRY( NtUserPrintWindow ) \ SYSCALL_ENTRY( NtUserQueryInputContext ) \ SYSCALL_ENTRY( NtUserRedrawWindow ) \ SYSCALL_ENTRY( NtUserRegisterClassExWOW ) \ diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index af77475e740..447e8f84495 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -3184,6 +3184,15 @@ NTSTATUS WINAPI wow64_NtUserPostThreadMessage( UINT *args ) return NtUserPostThreadMessage( thread, msg, wparam, lparam ); }
+NTSTATUS WINAPI wow64_NtUserPrintWindow( UINT *args ) +{ + HWND hwnd = get_handle( &args ); + HDC hdc = get_handle( &args ); + UINT flags = get_ulong( &args ); + + return NtUserPrintWindow( hwnd, hdc, flags ); +} + NTSTATUS WINAPI wow64_NtUserQueryInputContext( UINT *args ) { HIMC handle = get_handle( &args ); diff --git a/include/ntuser.h b/include/ntuser.h index 18718ea8a2c..b83ae2418d3 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -810,6 +810,7 @@ BOOL WINAPI NtUserPeekMessage( MSG *msg_out, HWND hwnd, UINT first, UINT last BOOL WINAPI NtUserPerMonitorDPIPhysicalToLogicalPoint( HWND hwnd, POINT *pt ); BOOL WINAPI NtUserPostMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ); BOOL WINAPI NtUserPostThreadMessage( DWORD thread, UINT msg, WPARAM wparam, LPARAM lparam ); +BOOL WINAPI NtUserPrintWindow( HWND hwnd, HDC hdc, UINT flags ); UINT_PTR WINAPI NtUserQueryInputContext( HIMC handle, UINT attr ); BOOL WINAPI NtUserRedrawWindow( HWND hwnd, const RECT *rect, HRGN hrgn, UINT flags ); ATOM WINAPI NtUserRegisterClassExWOW( const WNDCLASSEXW *wc, UNICODE_STRING *name, UNICODE_STRING *version,
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/Makefile.in | 1 - dlls/user32/painting.c | 64 ----------------------------------------- dlls/user32/win.c | 40 ++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 65 deletions(-) delete mode 100644 dlls/user32/painting.c
diff --git a/dlls/user32/Makefile.in b/dlls/user32/Makefile.in index 3a01810991d..1a29970e112 100644 --- a/dlls/user32/Makefile.in +++ b/dlls/user32/Makefile.in @@ -32,7 +32,6 @@ C_SRCS = \ misc.c \ msgbox.c \ nonclient.c \ - painting.c \ property.c \ resource.c \ scroll.c \ diff --git a/dlls/user32/painting.c b/dlls/user32/painting.c deleted file mode 100644 index de67cd97e5f..00000000000 --- a/dlls/user32/painting.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Window painting functions - * - * Copyright 1993, 1994, 1995, 2001, 2004, 2005, 2008 Alexandre Julliard - * Copyright 1996, 1997, 1999 Alex Korobka - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "user_private.h" - - -/*********************************************************************** - * UpdateWindow (USER32.@) - */ -BOOL WINAPI UpdateWindow( HWND hwnd ) -{ - if (!hwnd) - { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); - return FALSE; - } - - return NtUserRedrawWindow( hwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN ); -} - - -/*********************************************************************** - * ValidateRgn (USER32.@) - */ -BOOL WINAPI ValidateRgn( HWND hwnd, HRGN hrgn ) -{ - if (!hwnd) - { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); - return FALSE; - } - - return NtUserRedrawWindow( hwnd, NULL, hrgn, RDW_VALIDATE ); -} - - -/************************************************************************* - * ScrollWindow (USER32.@) - * - */ -BOOL WINAPI ScrollWindow( HWND hwnd, INT dx, INT dy, - const RECT *rect, const RECT *clipRect ) -{ - UINT flags = SW_INVALIDATE | SW_ERASE | (rect ? 0 : SW_SCROLLCHILDREN) | SW_NODCCACHE; - return NtUserScrollWindowEx( hwnd, dx, dy, rect, clipRect, 0, NULL, flags ); -} diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 383de818172..a6f43c188c4 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -1428,6 +1428,46 @@ BOOL WINAPI SetProcessDefaultLayout( DWORD layout ) return NtUserSetProcessDefaultLayout( layout ); }
+ +/*********************************************************************** + * UpdateWindow (USER32.@) + */ +BOOL WINAPI UpdateWindow( HWND hwnd ) +{ + if (!hwnd) + { + SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + return FALSE; + } + + return NtUserRedrawWindow( hwnd, NULL, 0, RDW_UPDATENOW | RDW_ALLCHILDREN ); +} + + +/*********************************************************************** + * ValidateRgn (USER32.@) + */ +BOOL WINAPI ValidateRgn( HWND hwnd, HRGN hrgn ) +{ + if (!hwnd) + { + SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + return FALSE; + } + + return NtUserRedrawWindow( hwnd, NULL, hrgn, RDW_VALIDATE ); +} + + +/************************************************************************* + * ScrollWindow (USER32.@) + */ +BOOL WINAPI ScrollWindow( HWND hwnd, INT dx, INT dy, const RECT *rect, const RECT *clip_rect ) +{ + UINT flags = SW_INVALIDATE | SW_ERASE | (rect ? 0 : SW_SCROLLCHILDREN) | SW_NODCCACHE; + return NtUserScrollWindowEx( hwnd, dx, dy, rect, clip_rect, 0, NULL, flags ); +} + #ifdef _WIN64
/* 64bit versions */
From: Jacek Caban jacek@codeweavers.com
--- dlls/winex11.drv/clipboard.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index 6ebc36cbead..e91368d69e7 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -564,7 +564,7 @@ static void *create_dib_from_bitmap( HBITMAP hBmp, size_t *size )
/* Retrieve the DIB bits from the bitmap and fill in the * DIB color table if present */ - hdc = NtUserGetDCEx( 0, 0, DCX_CACHE | DCX_WINDOW ); + hdc = NtUserGetDC( 0 ); nLinesCopied = NtGdiGetDIBitsInternal( hdc, hBmp, 0, bmp.bmHeight, ret + OffsetBits, (LPBITMAPINFO) pbmiHeader, 0, 0, 0 ); NtUserReleaseDC( 0, hdc ); @@ -986,7 +986,7 @@ static void *import_image_bmp( Atom type, const void *data, size_t size, size_t else return NULL; if (!width || !height) return NULL;
- hdc = NtUserGetDCEx( 0, 0, DCX_CACHE | DCX_WINDOW ); + hdc = NtUserGetDC( 0 );
if ((hbmp = NtGdiCreateDIBitmapInternal( hdc, width, height, CBM_INIT, (const BYTE *)data + bfh->bfOffBits, bmi,
This merge request was approved by Huw Davies.