From: Louis Lenders xerox.xerox2000x@gmail.com
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=58254 --- dlls/user32/tests/win.c | 19 +++++++++++++++++++ dlls/user32/user32.spec | 2 +- dlls/user32/win.c | 10 ++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 166653f0d2c..6f006bc0d32 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -61,6 +61,7 @@ static BOOL (WINAPI *pSetWindowDisplayAffinity)(HWND hwnd, DWORD affinity); static BOOL (WINAPI *pAdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT); 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 test_lbuttondown_flag; static DWORD num_gettext_msgs; @@ -13563,6 +13564,22 @@ static void test_ReleaseCapture(void) UnregisterClassA(cls.lpszClassName, GetModuleHandleA(0)); }
+static void test_SetProcessLaunchForegroundPolicy(void) +{ + BOOL ret; + DWORD pid = GetCurrentProcessId(); + + if (!pSetProcessLaunchForegroundPolicy) + { + win_skip("SetProcessLaunchForegroundPolicy is not available\n"); + return; + } + + SetLastError(0xcafecafe); + ret = pSetProcessLaunchForegroundPolicy(pid, 4); + ok(!ret && (GetLastError() == ERROR_ACCESS_DENIED), "SetProcessLaunchForegroundPolicy failed: %d error %lu\n", ret, GetLastError()); +} + START_TEST(win) { char **argv; @@ -13587,6 +13604,7 @@ START_TEST(win) pAdjustWindowRectExForDpi = (void *)GetProcAddress( user32, "AdjustWindowRectExForDpi" ); pSystemParametersInfoForDpi = (void *)GetProcAddress( user32, "SystemParametersInfoForDpi" ); pInternalGetWindowIcon = (void *)GetProcAddress( user32, "InternalGetWindowIcon" ); + pSetProcessLaunchForegroundPolicy = (void*)GetProcAddress( user32, "SetProcessLaunchForegroundPolicy" );
if (argc == 4) { @@ -13747,6 +13765,7 @@ START_TEST(win) test_DragDetect(); test_WM_NCCALCSIZE(); test_ReleaseCapture(); + test_SetProcessLaunchForegroundPolicy();
/* add the tests above this line */ if (hhook) UnhookWindowsHookEx(hhook); diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index 081e4c38373..494c8b7a983 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -1074,7 +1074,7 @@ @ stdcall SetProcessDefaultLayout(long) NtUserSetProcessDefaultLayout @ stdcall SetProcessDpiAwarenessContext(long) @ stdcall SetProcessDpiAwarenessInternal(long) -# @ stub SetProcessLaunchForegroundPolicy +@ stdcall SetProcessLaunchForegroundPolicy(long long) # @ stub SetProcessRestrictionExemption @ stdcall SetProcessWindowStation(long) NtUserSetProcessWindowStation @ stdcall SetProgmanWindow(long) NtUserSetProgmanWindow diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 8741c07a671..08371dd3e16 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -1645,3 +1645,13 @@ BOOL WINAPI SetWindowCompositionAttribute(HWND hwnd, void *data) SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; } + +/********************************************************************** + * SetProcessLaunchForegroundPolicy (USER32.@) + */ +BOOL WINAPI SetProcessLaunchForegroundPolicy(DWORD pid, DWORD flags) +{ + FIXME("(%lu %lu): stub\n", pid, flags); + SetLastError(ERROR_ACCESS_DENIED); + return FALSE; +}