[*] Mitigate Kernel32 and Rtl mixing

This commit is contained in:
Reece Wilson 2023-09-09 15:29:12 +01:00
parent 1fa063e19f
commit ca2f8fea71
3 changed files with 47 additions and 5 deletions

View File

@ -88,6 +88,8 @@ namespace Aurora
ADD_GET_PROC(Nt, NtOpenKeyedEvent)
ADD_GET_PROC(Nt, NtCreateKeyedEvent)
ADD_GET_PROC(Nt, RtlWaitOnAddress)
ADD_GET_PROC(Nt, RtlWakeByAddressAll)
ADD_GET_PROC(Nt, RtlWakeAddressSingle)
ADD_GET_PROC(Nt, ZwSetTimerResolution)
ADD_GET_PROC(Nt, NtQueryInformationProcess)
ADD_GET_PROC(Nt, NtNotifyChangeDirectoryFile)

View File

@ -146,7 +146,16 @@ namespace Aurora
const void * addr,
const void * cmp,
SIZE_T size,
const LARGE_INTEGER * timeout);
const LARGE_INTEGER * timeout
);
inline void(__stdcall *pRtlWakeByAddressAll)(
const void * addr
);
inline void(__stdcall *pRtlWakeAddressSingle)(
const void * addr
);
#if defined(AURORA_PLATFORM_WIN32)
inline NTSTATUS(__stdcall *pRtlGetVersion)(

View File

@ -462,7 +462,14 @@ namespace Aurora::Threading
AuUInt8 uWordSize)
{
#if defined(AURORA_IS_MODERNNT_DERIVED)
if (pRtlWaitOnAddress)
{
return pRtlWaitOnAddress((void *)pTargetAddress, (void *)pCompareAddress, uWordSize, nullptr);
}
else
{
return pWaitOnAddress((void *)pTargetAddress, (void *)pCompareAddress, uWordSize, INFINITE);
}
#endif
#if defined(AURORA_IS_LINUX_DERIVED)
@ -746,10 +753,27 @@ namespace Aurora::Threading
#endif
#if defined(AURORA_IS_MODERNNT_DERIVED)
if (pRtlWakeAddressSingle)
{
if (dwCount < 6)
{
for (AuUInt i = 0; i < dwCount; i++)
{
pRtlWakeAddressSingle((void *)pAddress);
}
}
else
{
pRtlWakeByAddressAll((void *)pAddress);
}
}
else
{
for (AuUInt i = 0; i < dwCount; i++)
{
pWakeByAddressSingle((void *)pAddress);
}
}
#endif
}
@ -760,7 +784,14 @@ namespace Aurora::Threading
#endif
#if defined(AURORA_IS_MODERNNT_DERIVED)
if (pRtlWakeByAddressAll)
{
pRtlWakeByAddressAll((void *)pAddress);
}
else
{
pWakeByAddressAll((void *)pAddress);
}
#endif
}