ReactOS 0.4.16-dev-2274-gc61d98f
purecall.cpp
Go to the documentation of this file.
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
12
13extern "C"
15{
16 return purecall_handler;
17}
18
19extern "C"
21{
22 return reinterpret_cast<_purecall_handler>(
23 _InterlockedExchangePointer(reinterpret_cast<void* volatile*>(&purecall_handler),
24 reinterpret_cast<void*>(_Handler)));
25}
26
27extern "C"
29{
31 if (handler)
32 handler();
33 abort();
34}
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7512
#define __cdecl
Definition: corecrt.h:121
void(__cdecl * _purecall_handler)(void)
Definition: stdlib.h:255
#define abort()
Definition: i386-dis.c:34
#define _In_opt_
Definition: no_sal2.h:212
#define volatile
Definition: prototyp.h:117
void * _InterlockedExchangePointer(_Interlocked_operand_ void *volatile *_Target, void *_Value)
int __cdecl _purecall(void)
Definition: purecall.cpp:28
_purecall_handler _cdecl _set_purecall_handler(_In_opt_ _purecall_handler _Handler)
Definition: purecall.cpp:20
_purecall_handler _cdecl _get_purecall_handler(void)
Definition: purecall.cpp:14
static volatile _purecall_handler purecall_handler
Definition: purecall.cpp:11