/****************************************************************************** * OpenWindowStationA (USER32.@) */ HWINSTA WINAPI OpenWindowStationA( LPCSTR name, BOOL inherit, ACCESS_MASK access ) { WCHAR buffer[MAX_PATH]; if (!name) return OpenWindowStationW( NULL, inherit, access ); if (!MultiByteToWideChar( CP_ACP, 0, name, -1, buffer, MAX_PATH )) { SetLastError( ERROR_FILENAME_EXCED_RANGE ); return 0; } return OpenWindowStationW( buffer, inherit, access ); }
/* * @implemented */ HWINSTA WINAPI OpenWindowStationA(LPCSTR lpszWinSta, BOOL fInherit, ACCESS_MASK dwDesiredAccess) { UNICODE_STRING WindowStationNameU; HWINSTA hWinSta; if (lpszWinSta) { /* After conversion, the buffer is zero-terminated */ RtlCreateUnicodeStringFromAsciiz(&WindowStationNameU, lpszWinSta); } else { RtlInitUnicodeString(&WindowStationNameU, NULL); } hWinSta = OpenWindowStationW(WindowStationNameU.Buffer, fInherit, dwDesiredAccess); /* Free the string, if it was allocated */ if (lpszWinSta) RtlFreeUnicodeString(&WindowStationNameU); return hWinSta; }
BOOL CALLBACK EnumWindowStationProc(LPWSTR lpszWindowStation, LPARAM lParam) { HWINSTA hWinSta; printf("%S\n", lpszWindowStation); hWinSta = OpenWindowStationW(lpszWindowStation, FALSE, WINSTA_ENUMDESKTOPS); if (hWinSta == NULL) { printf("\tCan't open window station.\n"); return TRUE; } EnumDesktopsW(hWinSta, EnumDesktopProc, 0xdede); return TRUE; }
HWINSTA ZOpenWindowStationW(LPWSTR lpszWinSta,BOOL fInherit, DWORD dwDesiredAccess) { return OpenWindowStationW(lpszWinSta,fInherit, dwDesiredAccess) ; }