From 86ced291044b177b3d0b2fde565e41fee81a609e Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 14 May 2026 16:39:24 +0300 Subject: [PATCH] [DELAYIMP_APITEST] Fix crash on Vista x64 For some reason on Vista x64 0xdeadbeef isn't detected as an invalid handle and the whole thing crashes. INVALID_HANDLE_VALUE on the other hand is detected as an invalid handle, so use that. --- modules/rostests/apitests/sdk/delayimp.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/rostests/apitests/sdk/delayimp.cpp b/modules/rostests/apitests/sdk/delayimp.cpp index 5872d1e2a34..ab4d0e93810 100644 --- a/modules/rostests/apitests/sdk/delayimp.cpp +++ b/modules/rostests/apitests/sdk/delayimp.cpp @@ -489,7 +489,16 @@ START_TEST(delayimp_runtimehook) SetExpectedDli(g_winmm_midi_out_close); g_ExpectedDll = WINMM_DLLNAME; g_ExpectedName = "midiOutClose"; - DWORD err = midiOutClose((HMIDIOUT)(ULONG_PTR)0xdeadbeef); + DWORD err; + _SEH2_TRY + { + err = midiOutClose((HMIDIOUT)INVALID_HANDLE_VALUE); + } + _SEH2_EXCEPT(ExceptionFilter(_SEH2_GetExceptionInformation(), _SEH2_GetExceptionCode())) + { + err = _SEH2_GetExceptionCode(); + } + _SEH2_END; ok(err == MMSYSERR_INVALHANDLE, "Expected err to be MMSYSERR_INVALHANDLE, was 0x%lx\n", err); CheckDliDone(); @@ -500,7 +509,7 @@ START_TEST(delayimp_runtimehook) g_BreakFunctionName = true; _SEH2_TRY { - err = mixerClose((HMIXER)(ULONG_PTR)0xdeadbeef); + err = mixerClose((HMIXER)INVALID_HANDLE_VALUE); } _SEH2_EXCEPT(ExceptionFilter(_SEH2_GetExceptionInformation(), _SEH2_GetExceptionCode())) {