Files
mandy/runtime/test/window_station.h
Lucas Laurent 55200be11e dxgi_device, dxgi_swapchain: skip what needs a desktop when the process has no interactive window station (#6301)
Squash-merged after review of PR #6301 - dxgi_device, dxgi_swapchain: skip what needs a desktop when the process has no interactive window station
2026-11-23 08:16:35 -06:00

16 lines
760 B
C

// Whether the test runs where windows and outputs exist. From an SSH session or a service the process has a window
// station that is not visible: the host DXGI then answers DXGI_ERROR_NOT_CURRENTLY_AVAILABLE for EnumOutputs and
// CreateSwapChainForHwnd, and a window cannot be shown, so tests that need a desktop skip there.
#pragma once
#include <windows.h>
inline bool has_interactive_window_station() {
HWINSTA station = GetProcessWindowStation();
if (!station) return true; // Unknown environment: let window creation report the real failure.
USEROBJECTFLAGS flags{};
DWORD bytes = 0;
if (!GetUserObjectInformationW(station, UOI_FLAGS, &flags, sizeof(flags), &bytes)) return true;
return (flags.dwFlags & WSF_VISIBLE) != 0;
}