diff --git a/docs/runtime_imports.md b/docs/runtime_imports.md index 7b9f62d5a1..e9bbc34e3c 100644 --- a/docs/runtime_imports.md +++ b/docs/runtime_imports.md @@ -449,14 +449,23 @@ on the executable, the rest is not: card and text entry, which fail before starting. - **Accessibility and speech** (`IXAccessibilityImpl2`, slots 3-21): `XHighContrastGetMode` (5) answers Off and - `XClosedCaptionSetEnabled` (4) is accepted. No voice is installed: `XSpeechSynthesizerEnumerateInstalledVoices` - (8) calls back zero times and returns `S_OK`, `XSpeechSynthesizerCreate` (9) fails (`E_FAIL`) with a null handle, - and the handle calls (10-16, 21: close, default and custom voice, streams from text and SSML, stream size and - data) refuse the handle they were never given (`E_INVALIDARG`, outputs zeroed). The closed-caption properties (3) - and the speech-to-text display calls (6, 7, 17-20) fail with `E_FAIL`, writing nothing: their parameter lists - are not in the docs' layout. -- **`XLauncherImpl`** (`IXLauncherImpl`, slots 3-5): `XLaunchUri`, `XDisplayAcquireTimeoutDeferral` (null handle) - and `XDisplayCloseTimeoutDeferralHandle` fail with `E_FAIL`; nothing is launched. + `XClosedCaptionSetEnabled` (4) is accepted. One silent voice is installed: + `XSpeechSynthesizerEnumerateInstalledVoices(context, callback)` (8) calls back once, with voice id `leonida-silent` + and language `en-US` (the GDK reference's `XSpeechSynthesizerVoiceInformation` layout), and returns `S_OK` + (`E_INVALIDARG` without a callback). `XSpeechSynthesizerCreate` (9) hands + out a synthesizer handle that speaks with it (`E_POINTER` for a null out pointer). Close (10), set default voice (11) + and set custom voice (12, only for that voice id) accept that handle and refuse any other with `E_INVALIDARG`. + Streams from text (13) and SSML (21) are created from it and return a + stream handle; its close (14) accepts it. Stream size (15) reports 44 bytes and stream data (16) copies them: a valid + RIFF/WAVE header for 16 kHz, 16-bit mono PCM with zero data bytes, so a title that plays narration reads a silent + stream (a buffer under 44 bytes gets `ERROR_INSUFFICIENT_BUFFER`). A foreign handle on 15 or 16 gets `E_INVALIDARG`, + outputs zeroed. The closed-caption properties (3) and the speech-to-text display calls (6, 7, 17-20) fail with + `E_FAIL`, writing nothing: their parameter lists are not in the docs' layout. +- **`XLauncherImpl`** (`IXLauncherImpl`, slots 3-5): `XLaunchUri` fails with `E_FAIL`; nothing is launched. + `XDisplayAcquireTimeoutDeferral` (4) creates a Win32 `PowerRequestDisplayRequired` request and returns its handle (a + failing `PowerCreateRequest` or `PowerSetRequest` returns the Win32 error as an HRESULT). + `XDisplayCloseTimeoutDeferralHandle` (5) clears that request and closes the handle, so the display may sleep again. + Side effect on the host: while the title holds a deferral, Windows keeps the PC's display on. - **ASSUMPTION:** the parameter lists of the speech calls and `XHighContrastGetMode` (Off is 0), from the GDK reference; only the argument counts were measured, from `tools/gdk_runtime_calls.py` on the executable. - **HDR:** `XDisplayTryEnableHdrMode` answers Disabled, because the host output is SDR. With `LEONIDA_HDR=1` it diff --git a/runtime/shims/xgameruntime_offline.cpp b/runtime/shims/xgameruntime_offline.cpp index cc7a91d211..23a5e9d81c 100644 --- a/runtime/shims/xgameruntime_offline.cpp +++ b/runtime/shims/xgameruntime_offline.cpp @@ -1,5 +1,5 @@ -// xgameruntime: XGameEventImpl, XGameUiImpl, XGameStreamingImpl, XDisplayImpl, XUserDeviceImpl, XAccessibilityImpl and -// XLauncherImpl, offline: small classes a title calls early. +// xgameruntime: XGameEventImpl, XGameUiImpl, XGameStreamingImpl, XDisplayImpl, XUserDeviceImpl, XAccessibilityImpl +// and XLauncherImpl, offline: small classes a title calls early. // // Each XGameEvent*, XGameUi* and XGameStreaming* function in xgameruntime.lib asks QueryApiImpl for its class and // calls one slot with its own arguments after `this`. The class and interface ids and the method order are @@ -18,17 +18,19 @@ // XUserDeviceImpl every device belongs to the offline user; associations and audio endpoints never change, so // their change registrations are kept until unregistered and never called back; the user has // no audio endpoint of its own; finding a controller shows no UI (as on desktop). -// XAccessibilityImpl high contrast is Off, closed captions can't be configured, no voice is installed (enumerating -// calls back zero times), XSpeechSynthesizerCreate fails (E_FAIL) with a null handle, the other -// speech calls refuse the handle they were never given (E_INVALIDARG), speech-to-text display -// calls fail (E_FAIL). -// XLauncherImpl XLaunchUri and the display timeout deferral calls fail (E_FAIL); nothing is launched. +// XAccessibilityImpl high contrast is Off, closed captions can't be configured, one silent voice is installed +// (enumerating calls back once), XSpeechSynthesizerCreate hands out a synthesizer whose +// text/SSML streams return a valid 44-byte empty 16 kHz mono 16-bit PCM WAVE header so titles +// that play narration continue cleanly; speech-to-text display calls fail (E_FAIL). +// XLauncherImpl XLaunchUri fails offline (E_FAIL); XDisplayAcquireTimeoutDeferral / Close acquire and clear a +// real Win32 PowerRequestDisplayRequired handle so the host display stays awake. // // Slots whose signature the public pages don't give answer with a value that is safe whichever way the caller reads // it: see `client_not_connected` (XGameStreaming) and `offline_failure`. #include #include +#include #include #include #include @@ -604,38 +606,94 @@ HRESULT STDMETHODCALLTYPE accessibility_high_contrast(void*, uint32_t* mode) { // 4: HRESULT XClosedCaptionSetEnabled(bool enabled): there are no captions to show; accepted and dropped. HRESULT STDMETHODCALLTYPE accessibility_captions_set_enabled(void*, bool) { return S_OK; } -// 8: HRESULT XSpeechSynthesizerEnumerateInstalledVoices(callback, void* context): no voice is installed, so the -// callback runs zero times. ASSUMPTION: the argument order (GDK reference), only the count (2) was measured. -HRESULT STDMETHODCALLTYPE speech_enumerate_voices(void*, void* callback, void*) { - return callback ? S_OK : E_INVALIDARG; +// XSpeechSynthesizerVoiceInformation and its callback, in the GDK reference's member order (the gender is +// XSpeechSynthesizerVoiceGender, a uint32_t enum: Female 0, Male 1). +struct SpeechVoiceInformation { + const char* description; + const char* display_name; + uint32_t gender; + const char* voice_id; + const char* language; +}; +static_assert(offsetof(SpeechVoiceInformation, voice_id) == 24 && sizeof(SpeechVoiceInformation) == 40, "x64 layout"); +using InstalledVoicesCallback = bool(CALLBACK*)(const SpeechVoiceInformation* information, void* context); +constexpr SpeechVoiceInformation kSilentVoice = {"Leonida silent voice - English (United States)", + "Leonida silent voice", 0, "leonida-silent", "en-US"}; + +// 8: HRESULT XSpeechSynthesizerEnumerateInstalledVoices(void* context, callback): one voice, the silent one every +// synthesizer below speaks with. ASSUMPTION: the argument order (GDK reference), only the count (2) was measured. +HRESULT STDMETHODCALLTYPE speech_enumerate_voices(void*, void* context, InstalledVoicesCallback callback) { + if (!callback) return E_INVALIDARG; + callback(&kSilentVoice, context); + return S_OK; +} + +// Valid 44-byte RIFF/WAVE header for 16 kHz, 16-bit mono PCM with 0 data bytes (silent speech stream). +constexpr uint8_t kSilentWave[44] = { + 'R', 'I', 'F', 'F', 0x24, 0x00, 0x00, 0x00, 'W', 'A', 'V', 'E', 'f', 'm', 't', ' ', + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x80, 0x3e, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, + 0x02, 0x00, 0x10, 0x00, 'd', 'a', 't', 'a', 0x00, 0x00, 0x00, 0x00, +}; + +uint8_t g_speech_synth_handle = 0; +uint8_t g_speech_stream_handle = 0; + +// 9: HRESULT XSpeechSynthesizerCreate(XSpeechSynthesizerHandle* handle): silent synthesizer handle. +HRESULT STDMETHODCALLTYPE speech_create(void*, void** handle) { + if (!handle) return E_POINTER; + *handle = &g_speech_synth_handle; + return S_OK; +} + +// 10: HRESULT XSpeechSynthesizerCloseHandle(XSpeechSynthesizerHandle handle) +HRESULT STDMETHODCALLTYPE speech_close_synth(void*, void* handle) { + return handle == &g_speech_synth_handle ? S_OK : E_INVALIDARG; } -// 9: HRESULT XSpeechSynthesizerCreate(XSpeechSynthesizerHandle* handle): no synthesizer offline. -HRESULT STDMETHODCALLTYPE speech_create(void* self, void** handle) { - if (handle) *handle = nullptr; - return offline_failure(self); +// 11: HRESULT XSpeechSynthesizerSetDefaultVoice(XSpeechSynthesizerHandle handle) +HRESULT STDMETHODCALLTYPE speech_set_default_voice(void*, void* handle) { + return handle == &g_speech_synth_handle ? S_OK : E_INVALIDARG; } -// 10-12, 14: a synthesizer or stream handle is the first argument, and none was ever handed out: E_INVALIDARG. -HRESULT STDMETHODCALLTYPE speech_bad_handle(void*) { return E_INVALIDARG; } +// 12: HRESULT XSpeechSynthesizerSetCustomVoice(XSpeechSynthesizerHandle handle, const char* voiceId): only the +// enumerated voice is installed. +HRESULT STDMETHODCALLTYPE speech_set_custom_voice(void*, void* handle, const char* voice_id) { + if (handle != &g_speech_synth_handle || !voice_id) return E_INVALIDARG; + return std::strcmp(voice_id, kSilentVoice.voice_id) == 0 ? S_OK : E_INVALIDARG; +} // 13, 21: HRESULT XSpeechSynthesizerCreateStreamFromText/Ssml(synthesizer, const char* text, // XSpeechSynthesizerStreamHandle* stream) -HRESULT STDMETHODCALLTYPE speech_create_stream(void*, void*, const char*, void** stream) { +HRESULT STDMETHODCALLTYPE speech_create_stream(void*, void* synth, const char*, void** stream) { if (stream) *stream = nullptr; - return E_INVALIDARG; + if (synth != &g_speech_synth_handle) return E_INVALIDARG; + if (!stream) return E_POINTER; + *stream = &g_speech_stream_handle; + return S_OK; +} + +// 14: HRESULT XSpeechSynthesizerCloseStreamHandle(XSpeechSynthesizerStreamHandle stream) +HRESULT STDMETHODCALLTYPE speech_close_stream(void*, void* stream) { + return stream == &g_speech_stream_handle ? S_OK : E_INVALIDARG; } // 15: HRESULT XSpeechSynthesizerGetStreamDataSize(stream, size_t* size) -HRESULT STDMETHODCALLTYPE speech_stream_size(void*, void*, size_t* size) { +HRESULT STDMETHODCALLTYPE speech_stream_size(void*, void* stream, size_t* size) { if (size) *size = 0; - return E_INVALIDARG; + if (stream != &g_speech_stream_handle) return E_INVALIDARG; + if (!size) return E_POINTER; + *size = sizeof(kSilentWave); + return S_OK; } // 16: HRESULT XSpeechSynthesizerGetStreamData(stream, size_t size, void* buffer, size_t* used) -HRESULT STDMETHODCALLTYPE speech_stream_data(void*, void*, size_t, void*, size_t* used) { +HRESULT STDMETHODCALLTYPE speech_stream_data(void*, void* stream, size_t size, void* buffer, size_t* used) { if (used) *used = 0; - return E_INVALIDARG; + if (stream != &g_speech_stream_handle) return E_INVALIDARG; + if (!buffer || size < sizeof(kSilentWave)) return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); + std::memcpy(buffer, kSilentWave, sizeof(kSilentWave)); + if (used) *used = sizeof(kSilentWave); + return S_OK; } // The slots with no offline counterpart whose arguments the layout doesn't give: the caption properties (3) and @@ -654,11 +712,11 @@ const void* const kAccessibilityVtable[] = { FN(accessibility_offline<7>), // 7 XSpeechToTextSendString FN(speech_enumerate_voices), // 8 XSpeechSynthesizerEnumerateInstalledVoices FN(speech_create), // 9 XSpeechSynthesizerCreate - FN(speech_bad_handle), // 10 XSpeechSynthesizerCloseHandle - FN(speech_bad_handle), // 11 XSpeechSynthesizerSetDefaultVoice - FN(speech_bad_handle), // 12 XSpeechSynthesizerSetCustomVoice + FN(speech_close_synth), // 10 XSpeechSynthesizerCloseHandle + FN(speech_set_default_voice), // 11 XSpeechSynthesizerSetDefaultVoice + FN(speech_set_custom_voice), // 12 XSpeechSynthesizerSetCustomVoice FN(speech_create_stream), // 13 XSpeechSynthesizerCreateStreamFromText - FN(speech_bad_handle), // 14 XSpeechSynthesizerCloseStreamHandle + FN(speech_close_stream), // 14 XSpeechSynthesizerCloseStreamHandle FN(speech_stream_size), // 15 XSpeechSynthesizerGetStreamDataSize FN(speech_stream_data), // 16 XSpeechSynthesizerGetStreamData FN(accessibility_offline<17>), // 17 XSpeechToTextBeginHypothesisString @@ -680,11 +738,31 @@ constexpr char kLauncherName[] = "XLauncherImpl"; constexpr GUID kLauncherClass = {0x1b339674, 0x328d, 0x4283, {0xa2, 0x00, 0x31, 0x71, 0xf1, 0x8d, 0x36, 0x39}}; // 3: HRESULT XLaunchUri(XUserHandle user, const char* uri): nothing is launched; E_FAIL. -// 4: HRESULT XDisplayAcquireTimeoutDeferral(XDisplayTimeoutDeferralHandle* handle): none is handed out. -// 5: XDisplayCloseTimeoutDeferralHandle(handle): no handle exists; E_FAIL, which a void caller ignores. -HRESULT STDMETHODCALLTYPE launcher_acquire_deferral(void* self, void** handle) { - if (handle) *handle = nullptr; - return offline_failure(self); +// 4: HRESULT XDisplayAcquireTimeoutDeferral(XDisplayTimeoutDeferralHandle* handle): Win32 display power request. +// 5: void XDisplayCloseTimeoutDeferralHandle(XDisplayTimeoutDeferralHandle handle): clears and closes the request. +HRESULT STDMETHODCALLTYPE launcher_acquire_deferral(void*, void** handle) { + if (!handle) return E_POINTER; + *handle = nullptr; + wchar_t reason[] = L"Title display timeout deferral"; + REASON_CONTEXT ctx{}; + ctx.Version = POWER_REQUEST_CONTEXT_VERSION; + ctx.Flags = POWER_REQUEST_CONTEXT_SIMPLE_STRING; + ctx.Reason.SimpleReasonString = reason; + const HANDLE req = PowerCreateRequest(&ctx); + if (req == INVALID_HANDLE_VALUE) return HRESULT_FROM_WIN32(GetLastError()); + if (!PowerSetRequest(req, PowerRequestDisplayRequired)) { + const DWORD err = GetLastError(); + CloseHandle(req); + return HRESULT_FROM_WIN32(err); + } + *handle = req; + return S_OK; +} + +void STDMETHODCALLTYPE launcher_close_deferral(void*, void* handle) { + if (!handle) return; + PowerClearRequest(handle, PowerRequestDisplayRequired); + CloseHandle(handle); } HRESULT STDMETHODCALLTYPE launcher_query_interface(void*, REFIID iid, void** out); @@ -692,7 +770,7 @@ const void* const kLauncherVtable[] = { FN(launcher_query_interface), FN(object_add_ref), FN(object_release), // 0-2 IUnknown FN((offline_failure)), // 3 XLaunchUri FN(launcher_acquire_deferral), // 4 XDisplayAcquireTimeoutDeferral - FN((offline_failure)), // 5 XDisplayCloseTimeoutDeferralHandle + FN(launcher_close_deferral), // 5 XDisplayCloseTimeoutDeferralHandle }; static_assert(std::size(kLauncherVtable) == 6, "IUnknown + IXLauncherImpl's 3 methods"); ClassObject g_launcher_object{kLauncherVtable}; diff --git a/runtime/test/xgameruntime_offline_test.cpp b/runtime/test/xgameruntime_offline_test.cpp index 7668b6164b..66b1100544 100644 --- a/runtime/test/xgameruntime_offline_test.cpp +++ b/runtime/test/xgameruntime_offline_test.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -74,7 +75,16 @@ constexpr GUID kAccessibilityClass = {0x3e241977, 0x6237, 0x41e9, {0x85, 0x59, 0 constexpr GUID kAccessibility2 = {0xd722b373, 0x8c4d, 0x4692, {0x9e, 0x51, 0xd6, 0xad, 0x9b, 0x37, 0xaa, 0x7d}}; constexpr GUID kLauncherClass = {0x1b339674, 0x328d, 0x4283, {0xa2, 0x00, 0x31, 0x71, 0xf1, 0x8d, 0x36, 0x39}}; -using EnumVoices = HRESULT(STDMETHODCALLTYPE*)(void*, void*, void*); +struct VoiceInformation { // XSpeechSynthesizerVoiceInformation, the GDK reference's member order + const char* description; + const char* display_name; + uint32_t gender; + const char* voice_id; + const char* language; +}; +using VoiceCallback = bool(CALLBACK*)(const VoiceInformation*, void*); +using EnumVoices = HRESULT(STDMETHODCALLTYPE*)(void*, void* context, VoiceCallback callback); +using SetCustomVoice = HRESULT(STDMETHODCALLTYPE*)(void*, void*, const char*); using SpeechCreate = HRESULT(STDMETHODCALLTYPE*)(void*, void**); using SpeechClose = HRESULT(STDMETHODCALLTYPE*)(void*, void*); using SpeechStream = HRESULT(STDMETHODCALLTYPE*)(void*, void*, const char*, void**); @@ -93,6 +103,19 @@ void* user_object(HRESULT(WINAPI* query)(const GUID*, REFIID, void**)) { void CALLBACK on_state(void*, uint64_t, uint32_t) {} +struct VoicesSeen { + int count = 0; + std::string voice_id; + std::string language; +}; +bool CALLBACK on_voice(const VoiceInformation* info, void* context) { + auto* seen = static_cast(context); + ++seen->count; + seen->voice_id = info && info->voice_id ? info->voice_id : ""; + seen->language = info && info->language ? info->language : ""; + return true; +} + // XUserDeviceImpl slots 4/5 (device association) and 7/8 (default audio endpoint): kept until unregistered, never // called back offline. long g_device_callbacks = 0; @@ -290,22 +313,45 @@ int main() { "XHighContrastGetMode reports Off"); check(at(acc, 4)(acc, true) == S_OK, "XClosedCaptionSetEnabled is accepted"); check(FAILED(at(acc, 3)(acc)), "the closed-caption properties are not available offline"); - check(at(acc, 8)(acc, reinterpret_cast(&on_state), nullptr) == S_OK && - at(acc, 8)(acc, nullptr, nullptr) == E_INVALIDARG, - "XSpeechSynthesizerEnumerateInstalledVoices: no voices, S_OK (a callback is required)"); - void* synth = reinterpret_cast(1); - check(at(acc, 9)(acc, &synth) == E_FAIL && synth == nullptr, - "XSpeechSynthesizerCreate fails offline and nulls the handle"); - void* stream = reinterpret_cast(1); - size_t size = 5, got = 5; + VoicesSeen seen; + check(at(acc, 8)(acc, &seen, &on_voice) == S_OK && seen.count == 1 && + seen.voice_id == "leonida-silent" && seen.language == "en-US", + "XSpeechSynthesizerEnumerateInstalledVoices(context, callback): one silent voice, its context passed back"); + check(at(acc, 8)(acc, nullptr, nullptr) == E_INVALIDARG, + "XSpeechSynthesizerEnumerateInstalledVoices: a callback is required"); + void* synth = nullptr; + check(at(acc, 9)(acc, &synth) == S_OK && synth != nullptr && + at(acc, 9)(acc, nullptr) == E_POINTER, + "XSpeechSynthesizerCreate returns a silent synthesizer handle"); + void* stream = nullptr; + size_t size = 0, got = 0; check(at(acc, 10)(acc, nullptr) == E_INVALIDARG && at(acc, 11)(acc, nullptr) == E_INVALIDARG && at(acc, 12)(acc, nullptr) == E_INVALIDARG && at(acc, 14)(acc, nullptr) == E_INVALIDARG, "close and set-voice calls on a null handle: E_INVALIDARG"); + check(at(acc, 11)(acc, synth) == S_OK, "XSpeechSynthesizerSetDefaultVoice succeeds on valid handle"); + check(at(acc, 12)(acc, synth, seen.voice_id.c_str()) == S_OK && + at(acc, 12)(acc, synth, "not-installed") == E_INVALIDARG && + at(acc, 12)(acc, synth, nullptr) == E_INVALIDARG, + "XSpeechSynthesizerSetCustomVoice accepts the enumerated voice only"); check(at(acc, 13)(acc, nullptr, "hi", &stream) == E_INVALIDARG && stream == nullptr, "CreateStreamFromText on a null synthesizer: E_INVALIDARG, no stream"); - stream = reinterpret_cast(1); - check(at(acc, 21)(acc, nullptr, "", &stream) == E_INVALIDARG && stream == nullptr, - "CreateStreamFromSsml on a null synthesizer: E_INVALIDARG, no stream"); + check(at(acc, 13)(acc, synth, "Hello", &stream) == S_OK && stream != nullptr, + "CreateStreamFromText returns a silent WAVE stream"); + check(at(acc, 15)(acc, stream, &size) == S_OK && size == 44, + "GetStreamDataSize reports the 44-byte empty WAVE header"); + uint8_t wav[64] = {}; + check(at(acc, 16)(acc, stream, 8, wav, &got) == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) && got == 0, + "GetStreamData rejects an undersized buffer with ERROR_INSUFFICIENT_BUFFER"); + check(at(acc, 16)(acc, stream, sizeof(wav), wav, &got) == S_OK && got == 44 && + std::memcmp(wav, "RIFF", 4) == 0 && std::memcmp(wav + 8, "WAVEfmt ", 8) == 0 && + std::memcmp(wav + 36, "data", 4) == 0, + "GetStreamData writes a valid silent 16 kHz mono 16-bit PCM WAVE header"); + check(at(acc, 14)(acc, stream) == S_OK, "XSpeechSynthesizerCloseStreamHandle succeeds"); + stream = nullptr; + check(at(acc, 21)(acc, synth, "", &stream) == S_OK && stream != nullptr && + at(acc, 14)(acc, stream) == S_OK, + "CreateStreamFromSsml returns a silent WAVE stream"); + check(at(acc, 10)(acc, synth) == S_OK, "XSpeechSynthesizerCloseHandle succeeds"); check(at(acc, 15)(acc, nullptr, &size) == E_INVALIDARG && size == 0 && at(acc, 16)(acc, nullptr, 8, nullptr, &got) == E_INVALIDARG && got == 0, "stream size and data on a null stream: E_INVALIDARG, zero written"); @@ -317,12 +363,17 @@ int main() { void* launcher = nullptr; check(query(&kLauncherClass, kLauncherClass, &launcher) == S_OK && launcher, "XLauncherImpl for its class id"); if (!launcher) return 1; - void* deferral = reinterpret_cast(1); + void* deferral = nullptr; + using CloseDeferral = void(STDMETHODCALLTYPE*)(void*, void*); check(at(launcher, 3)(launcher, nullptr, "https://example.com") == E_FAIL, "XLaunchUri is not available offline"); - check(at(launcher, 4)(launcher, &deferral) == E_FAIL && deferral == nullptr && - at(launcher, 5)(launcher) == E_FAIL, - "the display timeout deferral is not available offline"); + check(at(launcher, 4)(launcher, nullptr) == E_POINTER, + "XDisplayAcquireTimeoutDeferral rejects null out pointer"); + check(at(launcher, 4)(launcher, &deferral) == S_OK && deferral != nullptr, + "XDisplayAcquireTimeoutDeferral acquires a display power request handle"); + at(launcher, 5)(launcher, deferral); + at(launcher, 5)(launcher, nullptr); + check(true, "XDisplayCloseTimeoutDeferralHandle closes handle and ignores null"); GUID other = kLauncherClass; other.Data1 ^= 1; void* none = reinterpret_cast(1);