AuROXTL/Include/auROXTL/auWin32Utils.hpp
Reece Wilson 0c3f6c4158 [+] Improved AuSwap
[*] AuWin32CloseHandle should work without including windows.h
[*] AU_CFG_ID_SHIP disables null pointer checks (shared ptr abi)
2022-11-17 05:06:40 +00:00

34 lines
633 B
C++

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: auWin32Utils.hpp
Date: 2022-2-1
File: AuroraUtils.hpp
File: auROXTLUtils.hpp
Date: 2021-6-9
Author: Reece
***/
#pragma once
#if defined(AURORA_IS_MODERNNT_DERIVED)
extern "C"
{
__declspec(dllimport) int __stdcall CloseHandle(
void *hObject
);
}
static auline void AuWin32CloseHandle(void *&handle)
{
void *local;
static void *const kInvalidHandle = (void *)((AuUInt)-1);
if ((local = AuExchange(handle, kInvalidHandle)) != kInvalidHandle)
{
CloseHandle(local);
}
}
#endif