`WS_POPUP` for instance is `0x80000000`, which overflows a `LONG`. Coverity complained about this. The return type of `get_window_long()` already was `DWORD`.
-- v3: win32u: Store window styles in a UINT (Coverity).
From: Sven Baars sbaars@codeweavers.com
--- dlls/win32u/dce.c | 8 +++--- dlls/win32u/defwnd.c | 56 ++++++++++++++++++------------------ dlls/win32u/input.c | 6 ++-- dlls/win32u/menu.c | 8 +++--- dlls/win32u/message.c | 6 ++-- dlls/win32u/scroll.c | 4 +-- dlls/win32u/win32u_private.h | 4 +-- dlls/win32u/window.c | 36 +++++++++++------------ 8 files changed, 64 insertions(+), 64 deletions(-)
diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index ed6f0488c42..29a217052e0 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -1241,7 +1241,7 @@ HDC WINAPI NtUserGetDCEx( HWND hwnd, HRGN clip_rgn, DWORD flags ) BOOL update_vis_rgn = TRUE; struct dce *dce; HWND parent; - LONG window_style = get_window_long( hwnd, GWL_STYLE ); + UINT window_style = get_window_long( hwnd, GWL_STYLE );
if (!hwnd) hwnd = get_desktop_window(); else hwnd = get_full_window_handle( hwnd ); @@ -1280,7 +1280,7 @@ HDC WINAPI NtUserGetDCEx( HWND hwnd, HRGN clip_rgn, DWORD flags )
if( flags & DCX_PARENTCLIP ) { - LONG parent_style = get_window_long( parent, GWL_STYLE ); + UINT parent_style = get_window_long( parent, GWL_STYLE ); if( (window_style & WS_VISIBLE) && (parent_style & WS_VISIBLE) ) { flags &= ~DCX_CLIPCHILDREN; @@ -1521,7 +1521,7 @@ static HRGN send_ncpaint( HWND hwnd, HWND *child, UINT *flags ) { HRGN whole_rgn = get_update_region( hwnd, flags, child ); HRGN client_rgn = 0; - DWORD style; + UINT style;
if (child) hwnd = *child;
@@ -2095,7 +2095,7 @@ INT WINAPI NtUserScrollWindowEx( HWND hwnd, INT dx, INT dy, const RECT *rect,
if (!IsRectEmpty( &cliprc ) && (dx || dy)) { - DWORD style = get_window_long( hwnd, GWL_STYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE ); DWORD dcxflags = 0;
caret_hwnd = fix_caret( hwnd, &rc, dx, dy, flags, &move_caret, &new_caret_pos ); diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index 0cbb41d8604..5194d203860 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -251,7 +251,7 @@ BOOL draw_rect_edge( HDC hdc, RECT *rc, UINT type, UINT flags, UINT width ) }
/* see AdjustWindowRectExForDpi */ -BOOL adjust_window_rect( RECT *rect, DWORD style, BOOL menu, DWORD ex_style, UINT dpi ) +BOOL adjust_window_rect( RECT *rect, UINT style, BOOL menu, UINT ex_style, UINT dpi ) { NONCLIENTMETRICSW ncm = {.cbSize = sizeof(ncm)}; int adjust = 0; @@ -471,7 +471,7 @@ static LRESULT handle_set_cursor( HWND hwnd, WPARAM wparam, LPARAM lparam )
static LONG handle_window_pos_changing( HWND hwnd, WINDOWPOS *winpos ) { - LONG style = get_window_long( hwnd, GWL_STYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE );
if (winpos->flags & SWP_NOSIZE) return 0; if ((style & WS_THICKFRAME) || ((style & (WS_POPUP | WS_CHILD)) == 0)) @@ -1031,7 +1031,7 @@ static LRESULT handle_sys_command( HWND hwnd, WPARAM wparam, LPARAM lparam ) /* Get the 'inside' rectangle of a window, i.e. the whole window rectangle * but without the borders (if any). */ static void get_inside_rect( HWND hwnd, enum coords_relative relative, RECT *rect, - DWORD style, DWORD ex_style ) + UINT style, UINT ex_style ) { get_window_rect_rel( hwnd, relative, rect, get_thread_dpi() );
@@ -1065,8 +1065,8 @@ void get_sys_popup_pos( HWND hwnd, RECT *rect ) if (is_iconic(hwnd)) get_window_rect( hwnd, rect, get_thread_dpi() ); else { - DWORD style = get_window_long( hwnd, GWL_STYLE ); - DWORD ex_style = get_window_long( hwnd, GWL_EXSTYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE ); + UINT ex_style = get_window_long( hwnd, GWL_EXSTYLE );
get_inside_rect( hwnd, COORDS_CLIENT, rect, style, ex_style ); rect->right = rect->left + get_system_metrics( SM_CYCAPTION ) - 1; @@ -1076,7 +1076,7 @@ void get_sys_popup_pos( HWND hwnd, RECT *rect ) }
/* Draw a window frame inside the given rectangle, and update the rectangle. */ -static void draw_nc_frame( HDC hdc, RECT *rect, BOOL active, DWORD style, DWORD ex_style ) +static void draw_nc_frame( HDC hdc, RECT *rect, BOOL active, UINT style, UINT ex_style ) { INT width, height;
@@ -1147,7 +1147,7 @@ static HICON get_nc_icon_for_window( HWND hwnd ) }
/* Draws the bar part (ie the big rectangle) of the caption */ -static void draw_caption_bar( HDC hdc, const RECT *rect, DWORD style, BOOL active, BOOL gradient ) +static void draw_caption_bar( HDC hdc, const RECT *rect, UINT style, BOOL active, BOOL gradient ) { if (gradient) { @@ -1206,8 +1206,8 @@ BOOL draw_nc_sys_button( HWND hwnd, HDC hdc, BOOL down ) { RECT rect; POINT pt; - DWORD style = get_window_long( hwnd, GWL_STYLE ); - DWORD ex_style = get_window_long( hwnd, GWL_EXSTYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE ); + UINT ex_style = get_window_long( hwnd, GWL_EXSTYLE );
get_inside_rect( hwnd, COORDS_WINDOW, &rect, style, ex_style ); pt.x = rect.left + 2; @@ -1452,8 +1452,8 @@ BOOL draw_frame_menu( HDC dc, RECT *r, UINT flags ) static void draw_close_button( HWND hwnd, HDC hdc, BOOL down, BOOL grayed ) { RECT rect; - DWORD style = get_window_long( hwnd, GWL_STYLE ); - DWORD ex_style = get_window_long( hwnd, GWL_EXSTYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE ); + UINT ex_style = get_window_long( hwnd, GWL_EXSTYLE ); UINT flags = DFCS_CAPTIONCLOSE;
get_inside_rect( hwnd, COORDS_WINDOW, &rect, style, ex_style ); @@ -1489,8 +1489,8 @@ static void draw_max_button( HWND hwnd, HDC hdc, BOOL down, BOOL grayed ) { RECT rect; UINT flags; - DWORD style = get_window_long( hwnd, GWL_STYLE ); - DWORD ex_style = get_window_long( hwnd, GWL_EXSTYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE ); + UINT ex_style = get_window_long( hwnd, GWL_EXSTYLE );
/* never draw maximize box when window has WS_EX_TOOLWINDOW style */ if (ex_style & WS_EX_TOOLWINDOW) return; @@ -1512,8 +1512,8 @@ static void draw_min_button( HWND hwnd, HDC hdc, BOOL down, BOOL grayed ) { RECT rect; UINT flags; - DWORD style = get_window_long( hwnd, GWL_STYLE ); - DWORD ex_style = get_window_long( hwnd, GWL_EXSTYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE ); + UINT ex_style = get_window_long( hwnd, GWL_EXSTYLE );
/* never draw minimize box when window has WS_EX_TOOLWINDOW style */ if (ex_style & WS_EX_TOOLWINDOW) return; @@ -1534,8 +1534,8 @@ static void draw_min_button( HWND hwnd, HDC hdc, BOOL down, BOOL grayed ) draw_frame_caption( hdc, &rect, flags ); }
-static void draw_nc_caption( HDC hdc, RECT *rect, HWND hwnd, DWORD style, - DWORD ex_style, BOOL active ) +static void draw_nc_caption( HDC hdc, RECT *rect, HWND hwnd, UINT style, + UINT ex_style, BOOL active ) { RECT r = *rect; WCHAR buffer[256]; @@ -1633,7 +1633,7 @@ BOOL WINAPI NtUserDrawCaptionTemp( HWND hwnd, HDC hdc, const RECT *rect, HFONT f } else { - DWORD style = get_window_long( hwnd, GWL_STYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE ); draw_caption_bar( hdc, &rc, style, flags & DC_ACTIVE, flags & DC_GRADIENT ); }
@@ -1707,7 +1707,7 @@ static void nc_paint( HWND hwnd, HRGN clip ) RECT rfuzz, rect, clip_rect; BOOL active; WND *win; - DWORD style, ex_style; + UINT style, ex_style; WORD flags; HRGN hrgn; RECT rectClient; @@ -1811,7 +1811,7 @@ static void nc_paint( HWND hwnd, HRGN clip ) static LRESULT handle_nc_paint( HWND hwnd , HRGN clip ) { HWND parent = NtUserGetAncestor( hwnd, GA_PARENT ); - DWORD style = get_window_long( hwnd, GWL_STYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE );
if (style & WS_VISIBLE) { @@ -1850,8 +1850,8 @@ static LRESULT handle_nc_activate( HWND hwnd, WPARAM wparam, LPARAM lparam ) static void handle_nc_calc_size( HWND hwnd, WPARAM wparam, RECT *win_rect ) { RECT rect = { 0, 0, 0, 0 }; - LONG style = get_window_long( hwnd, GWL_STYLE ); - LONG ex_style = get_window_long( hwnd, GWL_EXSTYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE ); + UINT ex_style = get_window_long( hwnd, GWL_EXSTYLE );
if (!win_rect) return;
@@ -1910,7 +1910,7 @@ static void handle_nc_calc_size( HWND hwnd, WPARAM wparam, RECT *win_rect ) LRESULT handle_nc_hit_test( HWND hwnd, POINT pt ) { struct window_rects rects; - DWORD style, ex_style; + UINT style, ex_style;
TRACE( "hwnd %p pt %d,%d\n", hwnd, (int)pt.x, (int)pt.y );
@@ -2079,7 +2079,7 @@ LRESULT handle_nc_hit_test( HWND hwnd, POINT pt ) static void track_min_max_box( HWND hwnd, WORD wparam ) { HDC hdc = NtUserGetWindowDC( hwnd ); - DWORD style = get_window_long( hwnd, GWL_STYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE ); HMENU sys_menu = NtUserGetSystemMenu(hwnd, FALSE); void (*paint_button)( HWND, HDC, BOOL, BOOL ); BOOL pressed = TRUE; @@ -2178,7 +2178,7 @@ static void track_close_button( HWND hwnd, WPARAM wparam, LPARAM lparam )
static LRESULT handle_nc_lbutton_down( HWND hwnd, WPARAM wparam, LPARAM lparam ) { - LONG style = get_window_long( hwnd, GWL_STYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE );
switch (wparam) /* Hit test */ { @@ -2372,7 +2372,7 @@ static LRESULT handle_nc_mouse_move( HWND hwnd, WPARAM wparam, LPARAM lparam )
static LRESULT handle_nc_mouse_leave( HWND hwnd ) { - LONG style = get_window_long( hwnd, GWL_STYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE ); POINT pt = {0, 0};
TRACE( "hwnd=%p\n", hwnd ); @@ -2687,7 +2687,7 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
case WM_SHOWWINDOW: { - LONG style = get_window_long( hwnd, GWL_STYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE ); WND *win; if (!lparam) break; /* sent from ShowWindow */ if ((style & WS_VISIBLE) && wparam) break; @@ -3030,7 +3030,7 @@ LRESULT desktop_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, */ BOOL WINAPI NtUserGetTitleBarInfo( HWND hwnd, TITLEBARINFO *info ) { - DWORD style, ex_style; + UINT style, ex_style;
TRACE( "(%p %p)\n", hwnd, info );
diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index e1a0b11a584..c0e54d2ff05 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -2082,7 +2082,7 @@ HWND WINAPI NtUserSetActiveWindow( HWND hwnd )
if (hwnd) { - LONG style; + UINT style;
hwnd = get_full_window_handle( hwnd ); if (!is_window( hwnd )) @@ -2123,7 +2123,7 @@ HWND WINAPI NtUserSetFocus( HWND hwnd ) for (;;) { HWND parent; - LONG style = get_window_long( hwndTop, GWL_STYLE ); + UINT style = get_window_long( hwndTop, GWL_STYLE ); if (style & (WS_MINIMIZE | WS_DISABLED)) return 0; if (!(style & WS_CHILD)) break; parent = NtUserGetAncestor( hwndTop, GA_PARENT ); @@ -2613,7 +2613,7 @@ BOOL clip_fullscreen_window( HWND hwnd, BOOL reset ) struct user_thread_info *thread_info = get_user_thread_info(); MONITORINFO monitor_info = {.cbSize = sizeof(MONITORINFO)}; RECT rect, virtual_rect; - DWORD style; + UINT style; UINT dpi, ctx; BOOL ret;
diff --git a/dlls/win32u/menu.c b/dlls/win32u/menu.c index 0d1b3ec9667..005f4b1ac24 100644 --- a/dlls/win32u/menu.c +++ b/dlls/win32u/menu.c @@ -3301,7 +3301,7 @@ static void hide_sub_popups( HWND owner, HMENU hmenu, BOOL send_select, UINT fla } }
-static void init_sys_menu_popup( HMENU hmenu, DWORD style, DWORD class_style ) +static void init_sys_menu_popup( HMENU hmenu, UINT style, UINT class_style ) { BOOL gray;
@@ -3325,7 +3325,7 @@ static void init_sys_menu_popup( HMENU hmenu, DWORD style, DWORD class_style ) static BOOL init_popup( HWND owner, HMENU hmenu, UINT flags ) { UNICODE_STRING class_name = { .Buffer = MAKEINTRESOURCEW( POPUPMENU_CLASS_ATOM ) }; - DWORD ex_style = 0; + UINT ex_style = 0; struct menu *menu;
TRACE( "owner %p hmenu %p\n", owner, hmenu ); @@ -3711,7 +3711,7 @@ static LRESULT do_next_menu( MTRACKER *pmt, UINT vk, UINT flags )
if (!next_menu.hmenuNext || !next_menu.hwndNext) { - DWORD style = get_window_long( pmt->hOwnerWnd, GWL_STYLE ); + UINT style = get_window_long( pmt->hOwnerWnd, GWL_STYLE ); new_hwnd = pmt->hOwnerWnd; if (IS_SYSTEM_MENU( menu )) { @@ -3744,7 +3744,7 @@ static LRESULT do_next_menu( MTRACKER *pmt, UINT vk, UINT flags )
if (is_menu( new_menu ) && is_window( new_hwnd )) { - DWORD style = get_window_long( new_hwnd, GWL_STYLE ); + UINT style = get_window_long( new_hwnd, GWL_STYLE );
if (style & WS_SYSMENU && get_sub_menu(get_win_sys_menu( new_hwnd ), 0) == new_menu) { diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 5a5c26d9947..d3a29701dcb 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -483,14 +483,14 @@ static inline void *get_buffer_space( void **buffer, size_t size, size_t *buffer /* check whether a combobox expects strings or ids in CB_ADDSTRING/CB_INSERTSTRING */ static inline BOOL combobox_has_strings( HWND hwnd ) { - DWORD style = get_window_long( hwnd, GWL_STYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE ); return (!(style & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) || (style & CBS_HASSTRINGS)); }
/* check whether a listbox expects strings or ids in LB_ADDSTRING/LB_INSERTSTRING */ static inline BOOL listbox_has_strings( HWND hwnd ) { - DWORD style = get_window_long( hwnd, GWL_STYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE ); return (!(style & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE)) || (style & LBS_HASSTRINGS)); }
@@ -3915,7 +3915,7 @@ typedef LRESULT (*winproc_callback_t)( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp */ static inline BOOL test_lb_for_string( HWND hwnd, UINT msg ) { - DWORD style = get_window_long( hwnd, GWL_STYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE ); if (msg <= CB_MSGMAX) return (!(style & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) || (style & CBS_HASSTRINGS)); else diff --git a/dlls/win32u/scroll.c b/dlls/win32u/scroll.c index adbda241573..4c450728766 100644 --- a/dlls/win32u/scroll.c +++ b/dlls/win32u/scroll.c @@ -292,7 +292,7 @@ static void draw_scroll_bar( HWND hwnd, HDC hdc, int bar, enum SCROLL_HITTEST hi struct draw_scroll_bar_params params; struct scroll_info *info; RECT clip_box, intersect; - DWORD style; + UINT style; void *ret_ptr; ULONG ret_len;
@@ -1051,7 +1051,7 @@ static BOOL get_scroll_bar_info( HWND hwnd, LONG id, SCROLLBARINFO *info ) { struct scroll_info *scroll; int bar, dummy; - DWORD style = get_window_long( hwnd, GWL_STYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE ); BOOL pressed; RECT rect;
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index b4738ed6b16..20ae918fc5e 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -57,7 +57,7 @@ extern void register_window_surface( struct window_surface *old, extern void *window_surface_get_color( struct window_surface *surface, BITMAPINFO *info );
/* defwnd.c */ -extern BOOL adjust_window_rect( RECT *rect, DWORD style, BOOL menu, DWORD ex_style, UINT dpi ); +extern BOOL adjust_window_rect( RECT *rect, UINT style, BOOL menu, DWORD ex_style, UINT dpi ); extern LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL ansi ); extern LRESULT desktop_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL ansi ); @@ -250,7 +250,7 @@ extern BOOL is_window_enabled( HWND hwnd ); extern BOOL is_window_unicode( HWND hwnd ); extern BOOL is_window_visible( HWND hwnd ); extern BOOL is_zoomed( HWND hwnd ); -extern DWORD get_window_long( HWND hwnd, INT offset ); +extern UINT get_window_long( HWND hwnd, INT offset ); extern ULONG_PTR get_window_long_ptr( HWND hwnd, INT offset, BOOL ansi ); extern BOOL get_window_rect( HWND hwnd, RECT *rect, UINT dpi ); enum coords_relative; diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index c681333aa4a..20b8db0f1e8 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -360,7 +360,7 @@ HWND get_parent( HWND hwnd ) if (win == WND_DESKTOP) return 0; if (win == WND_OTHER_PROCESS) { - LONG style = get_window_long( hwnd, GWL_STYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE ); if (style & (WS_POPUP | WS_CHILD)) { SERVER_START_REQ( get_window_tree ) @@ -744,7 +744,7 @@ BOOL is_window_drawable( HWND hwnd, BOOL icon ) HWND *list; BOOL retval = TRUE; int i; - LONG style = get_window_long( hwnd, GWL_STYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE );
if (!(style & WS_VISIBLE)) return FALSE; if ((style & WS_MINIMIZE) && icon && get_class_long_ptr( hwnd, GCLP_HICON, FALSE )) return FALSE; @@ -849,7 +849,7 @@ static BOOL is_hung_app_window( HWND hwnd ) /* see IsWindowEnabled */ BOOL is_window_enabled( HWND hwnd ) { - LONG ret; + UINT ret;
RtlSetLastWin32Error( NO_ERROR ); ret = get_window_long( hwnd, GWL_STYLE ); @@ -1103,7 +1103,7 @@ static LONG_PTR get_window_long_size( HWND hwnd, INT offset, UINT size, BOOL ans }
/* see GetWindowLongW */ -DWORD get_window_long( HWND hwnd, INT offset ) +UINT get_window_long( HWND hwnd, INT offset ) { return get_window_long_size( hwnd, offset, sizeof(LONG), FALSE ); } @@ -1179,7 +1179,7 @@ ULONG set_window_style( HWND hwnd, ULONG set_bits, ULONG clear_bits ) return style.styleOld; }
-static DWORD fix_exstyle( DWORD style, DWORD exstyle ) +static UINT fix_exstyle( UINT style, UINT exstyle ) { if ((exstyle & WS_EX_DLGMODALFRAME) || (!(exstyle & WS_EX_STATICEDGE) && (style & (WS_DLGFRAME | WS_THICKFRAME)))) @@ -2592,7 +2592,7 @@ HWND window_from_point( HWND hwnd, POINT pt, INT *hittest )
for (i = 0; list[i]; i++) { - LONG style = get_window_long( list[i], GWL_STYLE ); + UINT style = get_window_long( list[i], GWL_STYLE );
/* If window is minimized or disabled, return at once */ if (style & WS_DISABLED) @@ -2652,7 +2652,7 @@ HWND WINAPI NtUserChildWindowFromPointEx( HWND parent, LONG x, LONG y, UINT flag if (!PtInRect( &rect, pt )) continue; if (flags & (CWP_SKIPINVISIBLE|CWP_SKIPDISABLED)) { - LONG style = get_window_long( list[i], GWL_STYLE ); + UINT style = get_window_long( list[i], GWL_STYLE ); if ((flags & CWP_SKIPINVISIBLE) && !(style & WS_VISIBLE)) continue; if ((flags & CWP_SKIPDISABLED) && (style & WS_DISABLED)) continue; } @@ -2684,7 +2684,7 @@ HWND WINAPI NtUserRealChildWindowFromPoint( HWND parent, LONG x, LONG y ) static BOOL get_work_rect( HWND hwnd, RECT *rect ) { MONITORINFO mon_info; - DWORD style; + UINT style;
mon_info = monitor_info_from_window( hwnd, MONITOR_DEFAULTTOPRIMARY ); *rect = mon_info.rcMonitor; @@ -2768,7 +2768,7 @@ BOOL WINAPI NtUserGetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *placement ) if (win == WND_OTHER_PROCESS) { RECT normal_position; - DWORD style; + UINT style;
if (!get_window_rect( hwnd, &normal_position, get_thread_dpi() )) return FALSE; @@ -2890,7 +2890,7 @@ static BOOL set_window_placement( HWND hwnd, const WINDOWPLACEMENT *wndpl, UINT RECT work_rect = get_maximized_work_rect( hwnd ); WND *win = get_win_ptr( hwnd ); WINDOWPLACEMENT wp = *wndpl; - DWORD style; + UINT style;
if (flags & PLACE_MIN) make_point_onscreen( &wp.ptMinPosition ); if (flags & PLACE_MAX) make_point_onscreen( &wp.ptMaxPosition ); @@ -4129,7 +4129,7 @@ UINT win_set_flags( HWND hwnd, UINT set_mask, UINT clear_mask ) */ static BOOL can_activate_window( HWND hwnd ) { - LONG style; + UINT style;
if (!hwnd) return FALSE; style = get_window_long( hwnd, GWL_STYLE ); @@ -4205,11 +4205,11 @@ static void send_parent_notify( HWND hwnd, UINT msg ) */ MINMAXINFO get_min_max_info( HWND hwnd ) { - LONG style = get_window_long( hwnd, GWL_STYLE ); - LONG exstyle = get_window_long( hwnd, GWL_EXSTYLE ); + UINT style = get_window_long( hwnd, GWL_STYLE ); + UINT exstyle = get_window_long( hwnd, GWL_EXSTYLE ); UINT context; RECT rc_work, rc_primary; - LONG adjusted_style; + UINT adjusted_style; MINMAXINFO minmax; INT xinc, yinc; RECT rc; @@ -4426,7 +4426,7 @@ static POINT get_minimized_pos( HWND hwnd, POINT pt ) static UINT window_min_maximize( HWND hwnd, UINT cmd, RECT *rect ) { UINT swp_flags = 0; - LONG old_style; + UINT old_style; MINMAXINFO minmax; WINDOWPLACEMENT wpl;
@@ -4615,7 +4615,7 @@ static BOOL show_window( HWND hwnd, INT cmd ) { WND *win; HWND parent; - LONG style = get_window_long( hwnd, GWL_STYLE ), new_style; + UINT style = get_window_long( hwnd, GWL_STYLE ), new_style; BOOL was_visible = (style & WS_VISIBLE) != 0; BOOL show_flag = TRUE; RECT newPos = {0, 0, 0, 0}; @@ -5304,7 +5304,7 @@ void destroy_thread_windows(void) */ static WND *create_window_handle( HWND parent, HWND owner, UNICODE_STRING *name, HINSTANCE instance, BOOL ansi, - DWORD style, DWORD ex_style ) + UINT style, UINT ex_style ) { UINT dpi_context = get_thread_dpi_awareness_context(); HWND handle = 0, full_parent = 0, full_owner = 0; @@ -5516,7 +5516,7 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name, } else { - DWORD parent_style = get_window_long( parent, GWL_EXSTYLE ); + UINT parent_style = get_window_long( parent, GWL_EXSTYLE ); if ((parent_style & WS_EX_LAYOUTRTL) && !(parent_style & WS_EX_NOINHERITLAYOUT)) cs.dwExStyle |= WS_EX_LAYOUTRTL; }
On Tue Mar 25 13:56:05 2025 +0000, Rémi Bernon wrote:
While changing it I'd suggest to use UINT on the unix side, to make eventual tracing easier.
You mean like this? I changed `DWORD` to `UINT` everywhere except for the `Nt*` functions.
On Tue Mar 25 13:56:05 2025 +0000, Sven Baars wrote:
You mean like this? I changed `DWORD` to `UINT` everywhere except for the `Nt*` functions.
Sure, we could even change the NtUser signatures as they are undocumented and behind syscall interface. I didn't meant to be fully exhaustive though, feel free to change them too but this seems good enough as well.
On Tue Mar 25 14:16:30 2025 +0000, Rémi Bernon wrote:
Sure, we could even change the NtUser signatures as they are undocumented and behind syscall interface. I didn't meant to be fully exhaustive though, feel free to change them too but this seems good enough as well.
Conceivably we could make DWORD ints on the Unix side instead.