/****************************************************************************** * OpenDesktopA (USER32.@) */ HDESK WINAPI OpenDesktopA( LPCSTR name, DWORD flags, BOOL inherit, ACCESS_MASK access ) { WCHAR buffer[MAX_PATH]; if (!name) return OpenDesktopW( NULL, flags, inherit, access ); if (!MultiByteToWideChar( CP_ACP, 0, name, -1, buffer, MAX_PATH )) { SetLastError( ERROR_FILENAME_EXCED_RANGE ); return 0; } return OpenDesktopW( buffer, flags, inherit, access ); }
/* * @implemented */ HDESK WINAPI OpenDesktopA( LPCSTR lpszDesktop, DWORD dwFlags, BOOL fInherit, ACCESS_MASK dwDesiredAccess) { UNICODE_STRING DesktopNameU; HDESK hDesktop; if (lpszDesktop) { /* After conversion, the buffer is zero-terminated */ RtlCreateUnicodeStringFromAsciiz(&DesktopNameU, lpszDesktop); } else { RtlInitUnicodeString(&DesktopNameU, NULL); } hDesktop = OpenDesktopW(DesktopNameU.Buffer, dwFlags, fInherit, dwDesiredAccess); /* Free the string, if it was allocated */ if (lpszDesktop) RtlFreeUnicodeString(&DesktopNameU); return hDesktop; }
static BOOL CALLBACK shutdown_one_desktop( LPWSTR name, LPARAM force ) { HDESK hdesk; WINE_TRACE("Shutting down desktop %s\n", wine_dbgstr_w(name)); hdesk = OpenDesktopW( name, 0, FALSE, GENERIC_ALL ); if (hdesk == NULL) { WINE_ERR("Cannot open desktop %s, err=%i\n", wine_dbgstr_w(name), GetLastError()); return FALSE; } if (!SetThreadDesktop( hdesk )) { CloseDesktop( hdesk ); WINE_ERR("Cannot set thread desktop %s, err=%i\n", wine_dbgstr_w(name), GetLastError()); return FALSE; } CloseDesktop( hdesk ); return shutdown_close_windows( force ); }
HDESK ZOpenDesktopW(LPWSTR lpszDesktop, BOOL fInherit, DWORD dwDesiredAccess) { return OpenDesktopW( lpszDesktop, fInherit, dwDesiredAccess) ; }