Reactos
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[VCRUNTIME] Implement purecall handler support

Implements _get_purecall_handler, _set_purecall_handler and _purecall

+35
+1
sdk/lib/vcruntime/CMakeLists.txt
··· 93 93 ${vcrt_runtime_asm} 94 94 __std_terminate.c 95 95 __vcrt_init.c 96 + purecall.cpp 96 97 ) 97 98 98 99 # Runtime library (linked into ucrtbase)
+34
sdk/lib/vcruntime/purecall.cpp
··· 1 + /* 2 + * PROJECT: ReactOS vcruntime library 3 + * LICENSE: MIT (https://spdx.org/licenses/MIT) 4 + * PURPOSE: Implementation of _get_purecall_handler, _set_purecall_handler and _purecall function 5 + * COPYRIGHT: Copyright 2025 Timo Kreuzer <timo.kreuzer@reactos.org> 6 + */ 7 + 8 + #include <stdlib.h> 9 + #include <intrin.h> 10 + 11 + static volatile _purecall_handler purecall_handler; 12 + 13 + extern "C" 14 + _purecall_handler _cdecl _get_purecall_handler(void) 15 + { 16 + return purecall_handler; 17 + } 18 + 19 + extern "C" 20 + _purecall_handler _cdecl _set_purecall_handler(_In_opt_ _purecall_handler _Handler) 21 + { 22 + return reinterpret_cast<_purecall_handler>( 23 + _InterlockedExchangePointer(reinterpret_cast<void* volatile*>(&purecall_handler), 24 + reinterpret_cast<void*>(_Handler))); 25 + } 26 + 27 + extern "C" 28 + int __cdecl _purecall(void) 29 + { 30 + _purecall_handler handler = purecall_handler; 31 + if (handler) 32 + handler(); 33 + abort(); 34 + }