Alexandre Julliard : user32: Don't start explorer. exe on non-visible window stations.
Alexandre Julliard
julliard at winehq.org
Tue Apr 1 06:51:18 CDT 2008
Module: wine
Branch: master
Commit: bd09340cf2d4dae6e9abd2dd11c532fee7711c41
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bd09340cf2d4dae6e9abd2dd11c532fee7711c41
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Mar 31 17:26:42 2008 +0200
user32: Don't start explorer.exe on non-visible window stations.
---
dlls/user32/win.c | 49 +++++++++++++++++++++++++++----------------------
1 files changed, 27 insertions(+), 22 deletions(-)
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index d5d0267..aa5bd87 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -1620,30 +1620,35 @@ HWND WINAPI GetDesktopWindow(void)
if (!thread_info->desktop)
{
- static const WCHAR command_line[] = {'\\','e','x','p','l','o','r','e','r','.','e','x','e',' ','/','d','e','s','k','t','o','p',0};
- STARTUPINFOW si;
- PROCESS_INFORMATION pi;
- WCHAR cmdline[MAX_PATH + sizeof(command_line)/sizeof(WCHAR)];
-
- memset( &si, 0, sizeof(si) );
- si.cb = sizeof(si);
- si.dwFlags = STARTF_USESTDHANDLES;
- si.hStdInput = 0;
- si.hStdOutput = 0;
- si.hStdError = GetStdHandle( STD_ERROR_HANDLE );
-
- GetSystemDirectoryW( cmdline, MAX_PATH );
- lstrcatW( cmdline, command_line );
- if (CreateProcessW( NULL, cmdline, NULL, NULL, FALSE, DETACHED_PROCESS,
- NULL, NULL, &si, &pi ))
- {
- TRACE( "started explorer pid %04x tid %04x\n", pi.dwProcessId, pi.dwThreadId );
- WaitForInputIdle( pi.hProcess, 10000 );
- CloseHandle( pi.hThread );
- CloseHandle( pi.hProcess );
-
- }
- else WARN( "failed to start explorer, err %d\n", GetLastError() );
+ USEROBJECTFLAGS flags;
+ if (!GetUserObjectInformationW( GetProcessWindowStation(), UOI_FLAGS, &flags,
+ sizeof(flags), NULL ) || (flags.dwFlags & WSF_VISIBLE))
+ {
+ static const WCHAR command_line[] = {'\\','e','x','p','l','o','r','e','r','.','e','x','e',' ','/','d','e','s','k','t','o','p',0};
+ STARTUPINFOW si;
+ PROCESS_INFORMATION pi;
+ WCHAR cmdline[MAX_PATH + sizeof(command_line)/sizeof(WCHAR)];
+
+ memset( &si, 0, sizeof(si) );
+ si.cb = sizeof(si);
+ si.dwFlags = STARTF_USESTDHANDLES;
+ si.hStdInput = 0;
+ si.hStdOutput = 0;
+ si.hStdError = GetStdHandle( STD_ERROR_HANDLE );
+
+ GetSystemDirectoryW( cmdline, MAX_PATH );
+ lstrcatW( cmdline, command_line );
+ if (CreateProcessW( NULL, cmdline, NULL, NULL, FALSE, DETACHED_PROCESS,
+ NULL, NULL, &si, &pi ))
+ {
+ TRACE( "started explorer pid %04x tid %04x\n", pi.dwProcessId, pi.dwThreadId );
+ WaitForInputIdle( pi.hProcess, 10000 );
+ CloseHandle( pi.hThread );
+ CloseHandle( pi.hProcess );
+ }
+ else WARN( "failed to start explorer, err %d\n", GetLastError() );
+ }
+ else TRACE( "not starting explorer since winstation is not visible\n" );
SERVER_START_REQ( get_desktop_window )
{
More information about the wine-cvs
mailing list