From: Paul Gofman pgofman@codeweavers.com
--- dlls/user32/tests/win.c | 75 +++++++++++++++++++++++++++++++++++++ dlls/win32u/main.c | 5 +++ dlls/win32u/win32syscalls.h | 5 +-- dlls/win32u/win32u.spec | 2 +- dlls/win32u/window.c | 11 ++++++ dlls/wow64win/user.c | 8 ++++ include/ntuser.h | 1 + 7 files changed, 103 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 693a95f3d72..13dff9d672d 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -64,6 +64,8 @@ static BOOL (WINAPI *pSystemParametersInfoForDpi)(UINT,UINT,void*,UINT,UINT); static HICON (WINAPI *pInternalGetWindowIcon)(HWND window, UINT type); static BOOL (WINAPI *pSetProcessLaunchForegroundPolicy)(DWORD,DWORD);
+static BOOL (WINAPI *pNtUserModifyUserStartupInfoFlags)(DWORD,DWORD); + static BOOL test_lbuttondown_flag; static DWORD num_gettext_msgs; static DWORD num_settext_msgs; @@ -13777,6 +13779,65 @@ static void test_startupinfo_showwindow_proc( int test_id ) winetest_pop_context(); }
+static void test_showwindow_proc_modify_flags(void) +{ + RTL_USER_PROCESS_PARAMETERS *up = NtCurrentTeb()->Peb->ProcessParameters; + HWND hwnd; + BOOL ret; + + if (!pNtUserModifyUserStartupInfoFlags) + { + win_skip( "NtUserModifyUserStartupInfoFlags is not available.\n" ); + return; + } + + ok( up->dwFlags & STARTF_USESHOWWINDOW, "got %#lx.\n", up->dwFlags ); + ok( up->wShowWindow == SW_HIDE, "got %lu.\n.", up->wShowWindow ); + + /* Startup window parameters are fetched early and current values don't affect behaviour. */ + up->dwFlags = 0; + up->wShowWindow = SW_SHOW; + + pNtUserModifyUserStartupInfoFlags( STARTF_USESHOWWINDOW, 0 ); + hwnd = CreateWindowA( "static", "overlapped2", WS_OVERLAPPED, 0, 0, 0, 0, NULL, NULL, GetModuleHandleW(NULL), NULL ); + ok( !!hwnd, "got NULL.\n" ); + pump_messages(); + ShowWindow( hwnd, SW_SHOWDEFAULT ); + ret = IsWindowVisible( hwnd ); + ok( ret, "got %d.\n", ret ); + DestroyWindow( hwnd ); + pump_messages(); + + pNtUserModifyUserStartupInfoFlags( STARTF_USESHOWWINDOW, STARTF_USESHOWWINDOW ); + hwnd = CreateWindowA( "static", "overlapped2", WS_OVERLAPPED, 0, 0, 0, 0, NULL, NULL, GetModuleHandleW(NULL), NULL ); + ok( !!hwnd, "got NULL.\n" ); + pump_messages(); + ShowWindow( hwnd, SW_SHOWDEFAULT ); + ret = IsWindowVisible( hwnd ); + ok( !ret, "got %d.\n", ret ); + DestroyWindow( hwnd ); + pump_messages(); + + hwnd = CreateWindowA( "static", "overlapped2", WS_OVERLAPPED, 0, 0, 0, 0, NULL, NULL, GetModuleHandleW(NULL), NULL ); + ok( !!hwnd, "got NULL.\n" ); + pump_messages(); + ShowWindow( hwnd, SW_SHOWDEFAULT ); + ret = IsWindowVisible( hwnd ); + ok( ret, "got %d.\n", ret ); + DestroyWindow( hwnd ); + pump_messages(); + + pNtUserModifyUserStartupInfoFlags( STARTF_USESHOWWINDOW, STARTF_USESHOWWINDOW ); + hwnd = CreateWindowA( "static", "overlapped2", WS_OVERLAPPED, 0, 0, 0, 0, NULL, NULL, GetModuleHandleW(NULL), NULL ); + ok( !!hwnd, "got NULL.\n" ); + pump_messages(); + ShowWindow( hwnd, SW_SHOWDEFAULT ); + ret = IsWindowVisible( hwnd ); + ok( !ret, "got %d.\n", ret ); + DestroyWindow( hwnd ); + pump_messages(); +} + static void test_startupinfo_showwindow( char **argv ) { STARTUPINFOA sa = {.cb = sizeof(STARTUPINFOA)}; @@ -13795,6 +13856,11 @@ static void test_startupinfo_showwindow( char **argv ) ok( ret, "got error %lu\n", GetLastError() ); wait_child_process( &info ); } + + sprintf( cmdline, "%s %s showwindow_proc_modify_flags", argv[0], argv[1] ); + ret = CreateProcessA( NULL, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &sa, &info ); + ok( ret, "got error %lu\n", GetLastError() ); + wait_child_process( &info ); }
static void test_cascade_windows(void) @@ -14273,6 +14339,7 @@ START_TEST(win) int argc = winetest_get_mainargs( &argv ); HMODULE user32 = GetModuleHandleA( "user32.dll" ); HMODULE gdi32 = GetModuleHandleA("gdi32.dll"); + HMODULE win32u = GetModuleHandleA("win32u.dll"); pGetWindowInfo = (void *)GetProcAddress( user32, "GetWindowInfo" ); pGetWindowModuleFileNameA = (void *)GetProcAddress( user32, "GetWindowModuleFileNameA" ); pGetLayeredWindowAttributes = (void *)GetProcAddress( user32, "GetLayeredWindowAttributes" ); @@ -14293,6 +14360,8 @@ START_TEST(win) pInternalGetWindowIcon = (void *)GetProcAddress( user32, "InternalGetWindowIcon" ); pSetProcessLaunchForegroundPolicy = (void*)GetProcAddress( user32, "SetProcessLaunchForegroundPolicy" );
+ pNtUserModifyUserStartupInfoFlags = (void*)GetProcAddress( win32u, "NtUserModifyUserStartupInfoFlags" ); + if (argc == 4) { HWND hwnd; @@ -14328,6 +14397,12 @@ START_TEST(win) return; }
+ if (argc == 3 && !strcmp(argv[2], "showwindow_proc_modify_flags")) + { + test_showwindow_proc_modify_flags(); + return; + } + if (!RegisterWindowClasses()) assert(0);
hwndMain = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window", diff --git a/dlls/win32u/main.c b/dlls/win32u/main.c index 193c2c048bf..c0482ba059f 100644 --- a/dlls/win32u/main.c +++ b/dlls/win32u/main.c @@ -1962,6 +1962,11 @@ LRESULT SYSCALL_API NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARA SYSCALL_FUNC( NtUserMessageCall ); }
+BOOL SYSCALL_API NtUserModifyUserStartupInfoFlags( DWORD mask, DWORD flags ) +{ + SYSCALL_FUNC( NtUserModifyUserStartupInfoFlags ); +} + BOOL SYSCALL_API NtUserMoveWindow( HWND hwnd, INT x, INT y, INT cx, INT cy, BOOL repaint ) { SYSCALL_FUNC( NtUserMoveWindow ); diff --git a/dlls/win32u/win32syscalls.h b/dlls/win32u/win32syscalls.h index 69982b52833..7826afd3fc3 100644 --- a/dlls/win32u/win32syscalls.h +++ b/dlls/win32u/win32syscalls.h @@ -1209,7 +1209,7 @@ SYSCALL_ENTRY( 0x14b5, NtUserMessageCall, 28 ) \ SYSCALL_ENTRY( 0x14b6, NtUserMinInitialize, 0 ) \ SYSCALL_ENTRY( 0x14b7, NtUserMinMaximize, 0 ) \ - SYSCALL_ENTRY( 0x14b8, NtUserModifyUserStartupInfoFlags, 0 ) \ + SYSCALL_ENTRY( 0x14b8, NtUserModifyUserStartupInfoFlags, 8 ) \ SYSCALL_ENTRY( 0x14b9, NtUserModifyWindowTouchCapability, 0 ) \ SYSCALL_ENTRY( 0x14ba, NtUserMoveWindow, 24 ) \ SYSCALL_ENTRY( 0x14bb, NtUserMsgWaitForMultipleObjectsEx, 20 ) \ @@ -2751,7 +2751,7 @@ SYSCALL_ENTRY( 0x14b5, NtUserMessageCall, 56 ) \ SYSCALL_ENTRY( 0x14b6, NtUserMinInitialize, 0 ) \ SYSCALL_ENTRY( 0x14b7, NtUserMinMaximize, 0 ) \ - SYSCALL_ENTRY( 0x14b8, NtUserModifyUserStartupInfoFlags, 0 ) \ + SYSCALL_ENTRY( 0x14b8, NtUserModifyUserStartupInfoFlags, 16 ) \ SYSCALL_ENTRY( 0x14b9, NtUserModifyWindowTouchCapability, 0 ) \ SYSCALL_ENTRY( 0x14ba, NtUserMoveWindow, 48 ) \ SYSCALL_ENTRY( 0x14bb, NtUserMsgWaitForMultipleObjectsEx, 40 ) \ @@ -3929,7 +3929,6 @@ SYSCALL_STUB( NtUserMarkWindowForRawMouse ) \ SYSCALL_STUB( NtUserMinInitialize ) \ SYSCALL_STUB( NtUserMinMaximize ) \ - SYSCALL_STUB( NtUserModifyUserStartupInfoFlags ) \ SYSCALL_STUB( NtUserModifyWindowTouchCapability ) \ SYSCALL_STUB( NtUserNavigateFocus ) \ SYSCALL_STUB( NtUserNlsKbdSendIMENotification ) \ diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index f0ccfba35cb..e3e80a05d0c 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1207,7 +1207,7 @@ @ stdcall -syscall NtUserMessageCall(long long long long long long long) @ stub -syscall NtUserMinInitialize @ stub -syscall NtUserMinMaximize -@ stub -syscall NtUserModifyUserStartupInfoFlags +@ stdcall -syscall NtUserModifyUserStartupInfoFlags(long long) @ stub -syscall NtUserModifyWindowTouchCapability @ stdcall -syscall NtUserMoveWindow(long long long long long long) @ stdcall -syscall NtUserMsgWaitForMultipleObjectsEx(long ptr long long long) diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index f5c022b227f..d149410dd81 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -6452,3 +6452,14 @@ BOOL WINAPI NtUserGetWindowDisplayAffinity( HWND hwnd, DWORD *affinity ) *affinity = WDA_NONE; return TRUE; } + +/***************************************************************** + * NtUserModifyUserStartupInfoFlags (win32u.@) + */ +BOOL WINAPI NtUserModifyUserStartupInfoFlags( DWORD mask, DWORD flags ) +{ + TRACE( "%#x, %#x.\n", (int)mask, (int)flags ); + + set_startup_info_flags( mask, flags ); + return TRUE; +} diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 398f0fa2f6f..b728e7c01d7 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -3807,6 +3807,14 @@ NTSTATUS WINAPI wow64_NtUserMessageCall( UINT *args ) return message_call_32to64( hwnd, msg, wparam, lparam, result_info, type, ansi ); }
+NTSTATUS WINAPI wow64_NtUserModifyUserStartupInfoFlags( UINT *args ) +{ + DWORD mask = get_ulong( &args ); + DWORD flags = get_ulong( &args ); + + return NtUserModifyUserStartupInfoFlags( mask, flags ); +} + NTSTATUS WINAPI wow64_NtUserMoveWindow( UINT *args ) { HWND hwnd = get_handle( &args ); diff --git a/include/ntuser.h b/include/ntuser.h index 664bcfe459d..8b9d177419b 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -933,6 +933,7 @@ W32KAPI INT WINAPI NtUserMenuItemFromPoint( HWND hwnd, HMENU handle, int x, W32KAPI BOOL WINAPI NtUserMessageBeep( UINT type ); W32KAPI LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, void *result_info, DWORD type, BOOL ansi ); +W32KAPI BOOL WINAPI NtUserModifyUserStartupInfoFlags( DWORD mask, DWORD flags ); W32KAPI BOOL WINAPI NtUserMoveWindow( HWND hwnd, INT x, INT y, INT cx, INT cy, BOOL repaint ); W32KAPI DWORD WINAPI NtUserMsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout, DWORD mask, DWORD flags );