commit 412b34700dacce91029c34378a813909b20adb46 Author: Qian Hong Date: Wed Oct 23 23:50:20 2013 +0800 Draft - user32: Implement partial stub OpenInputDesktop. diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c index e74ac19..15ce747 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -161,7 +161,7 @@ static void palette_init(void) * * Get the name of the desktop to use for this app if not specified explicitly. */ -static const WCHAR *get_default_desktop(void) +const WCHAR *get_default_desktop(void) { static const WCHAR defaultW[] = {'D','e','f','a','u','l','t',0}; static const WCHAR desktopW[] = {'D','e','s','k','t','o','p',0}; diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 9daa9f4..d88827c 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -309,6 +309,7 @@ typedef struct #include "poppack.h" extern BOOL get_icon_size( HICON handle, SIZE *size ) DECLSPEC_HIDDEN; +extern const WCHAR *get_default_desktop(void) DECLSPEC_HIDDEN; /* Mingw's assert() imports MessageBoxA and gets confused by user32 exporting it */ #ifdef __MINGW32__ diff --git a/dlls/user32/winstation.c b/dlls/user32/winstation.c index 96b51179..eebb8f9 100644 --- a/dlls/user32/winstation.c +++ b/dlls/user32/winstation.c @@ -462,9 +462,22 @@ BOOL WINAPI EnumDesktopsW( HWINSTA winsta, DESKTOPENUMPROCW func, LPARAM lparam */ HDESK WINAPI OpenInputDesktop( DWORD flags, BOOL inherit, ACCESS_MASK access ) { - FIXME( "(%x,%i,%x): stub\n", flags, inherit, access ); - SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); - return 0; + HWINSTA winsta; + USEROBJECTFLAGS info; + + FIXME( "(%x,%i,%x): partial stub\n", flags, inherit, access ); + + winsta = GetProcessWindowStation(); + memset(&info, 0, sizeof(info)); + GetUserObjectInformationA( winsta, UOI_FLAGS, &info, sizeof(info), NULL); + if (info.dwFlags != WSF_VISIBLE) + { + SetLastError( ERROR_INVALID_FUNCTION ); + return 0; + } + /* As long as SwitchDesktop is a stub, it is safe to assume OpenInputDesktop always + returns the default desktop. */ + return OpenDesktopW( get_default_desktop(), flags, inherit, access ); }