diff --git a/Include/auROXTL/auAtomic.hpp b/Include/auROXTL/auAtomic.hpp index 2491d1d0..1aa30654 100644 --- a/Include/auROXTL/auAtomic.hpp +++ b/Include/auROXTL/auAtomic.hpp @@ -83,11 +83,13 @@ inline auline AuInt16 AuAtomicUtils::CompareExchange(AuInt16 *in, AuInt return _InterlockedCompareExchange16(reinterpret_cast(in), static_cast(replace), static_cast(compare)); } +#if !defined(AURORA_IS_32BIT) template<> inline auline AuUInt64 AuAtomicUtils::Add(AuUInt64 *in, AuUInt64 addend) { return static_cast(_InterlockedExchangeAdd64(reinterpret_cast(in), static_cast(addend)) + static_cast(addend)); } +#endif template<> inline auline AuUInt32 AuAtomicUtils::Add(AuUInt32 *in, AuUInt32 addend) @@ -95,11 +97,13 @@ inline auline AuUInt32 AuAtomicUtils::Add(AuUInt32 *in, AuUInt32 adden return static_cast(_InterlockedExchangeAdd(reinterpret_cast(in), static_cast(addend)) + static_cast(addend)); } +#if !defined(AURORA_IS_32BIT) template<> inline auline AuInt64 AuAtomicUtils::Add(AuInt64 *in, AuInt64 addend) { return _InterlockedExchangeAdd64(reinterpret_cast(in), static_cast(addend)) + static_cast(addend); } +#endif template<> inline auline AuInt32 AuAtomicUtils::Add(AuInt32 *in, AuInt32 addend) @@ -139,11 +143,13 @@ inline auline AuUInt16 AuAtomicUtils::Sub(AuUInt16 *in, AuUInt16 minue #endif +#if !defined(AURORA_IS_32BIT) template<> inline auline AuUInt64 AuAtomicUtils::Set(AuUInt64 *in, AuUInt8 offset) { return _InterlockedOr64(reinterpret_cast(in), AuUInt64(1) << offset); } +#endif template<> inline auline AuUInt32 AuAtomicUtils::Set(AuUInt32 *in, AuUInt8 offset) @@ -157,12 +163,13 @@ inline auline AuUInt16 AuAtomicUtils::Set(AuUInt16 *in, AuUInt8 offset return _InterlockedOr16(reinterpret_cast(in), 1 << offset); } - +#if !defined(AURORA_IS_32BIT) template<> inline auline AuInt64 AuAtomicUtils::Set(AuInt64 *in, AuUInt8 offset) { return _InterlockedOr64(reinterpret_cast(in), AuUInt64(1) << offset); } +#endif template<> inline auline AuInt32 AuAtomicUtils::Set(AuInt32 *in, AuUInt8 offset) @@ -248,6 +255,7 @@ inline auline bool AuAtomicUtils::TestAndSet(AuInt32 *in, const AuUInt8 return _interlockedbittestandset(reinterpret_cast(in), offset); } +#if !defined(AURORA_IS_32BIT) template<> inline auline bool AuAtomicUtils::TestAndSet(AuUInt64 *in, const AuUInt8 offset) { @@ -259,6 +267,7 @@ inline auline bool AuAtomicUtils::TestAndSet(AuInt64 *in, const AuUInt8 { return _interlockedbittestandset64(reinterpret_cast(in), offset); } +#endif #endif diff --git a/Source/Debug/ExceptionWatcher.NT.cpp b/Source/Debug/ExceptionWatcher.NT.cpp index 255ceb84..ec4f2916 100644 --- a/Source/Debug/ExceptionWatcher.NT.cpp +++ b/Source/Debug/ExceptionWatcher.NT.cpp @@ -44,21 +44,20 @@ namespace Aurora::Debug { AuString message; - if (handle && handle != INVALID_HANDLE_VALUE) + if (handle != INVALID_HANDLE_VALUE) { try { const ThrowInfo *pthrowInfo = reinterpret_cast(throwInfo); auto attribs = pthrowInfo->attributes; - const auto catchableTypeArray = reinterpret_cast(reinterpret_cast(handle) + static_cast(pthrowInfo->pCatchableTypeArray)); + const auto catchableTypeArray = reinterpret_cast(reinterpret_cast(handle) + (AuUInt)(pthrowInfo->pCatchableTypeArray)); AuString suffix; for (int i = 0; i < catchableTypeArray->nCatchableTypes; i++) { - const auto type = reinterpret_cast (reinterpret_cast(handle) + static_cast(catchableTypeArray->arrayOfCatchableTypes[i])); - const auto descriptor = reinterpret_cast (reinterpret_cast(handle) + static_cast(type->pType)); - + const auto type = reinterpret_cast (reinterpret_cast(handle) + (AuUInt *)(catchableTypeArray->arrayOfCatchableTypes[i])); + const auto descriptor = reinterpret_cast (reinterpret_cast(handle) + (AuUInt *)(type->pType)); message += (i == 0 ? "" : AuString(", ")) + descriptor->name(); // __std_type_info_name @@ -224,11 +223,6 @@ extern "C" AUKN_SYM void __stdcall _ReportMSVCSEH(void *exception, const void *t } } - if (!handle) - { - return; - } - if (handle == INVALID_HANDLE_VALUE) { return; diff --git a/Source/Debug/ExceptionWatcher.Win32.cpp b/Source/Debug/ExceptionWatcher.Win32.cpp index bad57476..ea3a7d86 100644 --- a/Source/Debug/ExceptionWatcher.Win32.cpp +++ b/Source/Debug/ExceptionWatcher.Win32.cpp @@ -105,7 +105,7 @@ namespace Aurora::Debug return (info.Protect & (PAGE_READONLY | PAGE_READWRITE)) != 0; } - static LONG HandleVectorException(_EXCEPTION_POINTERS *ExceptionInfo) + static LONG CALLBACK HandleVectorException(_EXCEPTION_POINTERS *ExceptionInfo) { if (ExceptionInfo->ExceptionRecord->ExceptionCode < STATUS_GUARD_PAGE_VIOLATION) { @@ -138,7 +138,7 @@ namespace Aurora::Debug ThrowInfo *pThrowInfo {}; if ((ExceptionInfo->ExceptionRecord->ExceptionCode == EH_EXCEPTION_NUMBER) && - (ExceptionInfo->ExceptionRecord->NumberParameters >= 4) && + (ExceptionInfo->ExceptionRecord->NumberParameters >= 3) && ((cxxThrow) || (cxxThrowPure)) ) @@ -183,15 +183,18 @@ namespace Aurora::Debug bool isInternal = false; #endif - ReportSEH(handle, exception, pThrowInfo, handleNoCppObject, backtrace, [&](const AuString &str) + if (pThrowInfo) { - // Pre-submit callback -> its showtime - if ((isCritical || isInternal) && (minimal == 0)) + ReportSEH(handle, exception, pThrowInfo, handleNoCppObject, backtrace, [&](const AuString &str) { - AuLogWarn("NT Exception: 0x{:x}, {}", ExceptionInfo->ExceptionRecord->ExceptionCode, str); - AuLogWarn("{}", StringifyStackTrace(backtrace)); - } - }); + // Pre-submit callback -> its showtime + if ((isCritical || isInternal) && (minimal == 0)) + { + AuLogWarn("NT Exception: 0x{:x}, {}", ExceptionInfo->ExceptionRecord->ExceptionCode, str); + AuLogWarn("{}", StringifyStackTrace(backtrace)); + } + }); + } try { diff --git a/Source/Processes/Process.Win32.cpp b/Source/Processes/Process.Win32.cpp index b91ae47d..59853dc5 100644 --- a/Source/Processes/Process.Win32.cpp +++ b/Source/Processes/Process.Win32.cpp @@ -67,7 +67,7 @@ namespace Aurora::Processes AuUInt32 count; }; - static BOOL TermWinHandleWin32Thread(HWND handle, LPARAM a) + static BOOL CALLBACK TermWinHandleWin32Thread(HWND handle, LPARAM a) { DWORD windowpid; auto context = reinterpret_cast(a);