[NDK][XDK][RTL] Fix definition of RtlFillMemoryUlong on x64

This commit is contained in:
Timo Kreuzer 2019-09-23 13:57:32 +02:00
parent e084a7ae83
commit fb0ebac349
3 changed files with 39 additions and 7 deletions

View file

@ -2119,13 +2119,42 @@ RtlFindCharInUnicodeString(
// //
// Memory Functions // Memory Functions
// //
#if defined(_M_AMD64)
FORCEINLINE
VOID
RtlFillMemoryUlong(
_Out_writes_bytes_all_(Length) PVOID Destination,
_In_ SIZE_T Length,
_In_ ULONG Pattern)
{
PULONG Address = (PULONG)Destination;
if ((Length /= 4) != 0) {
if (((ULONG64)Address & 4) != 0) {
*Address = Pattern;
if ((Length -= 1) == 0) {
return;
}
Address += 1;
}
__stosq((PULONG64)(Address), Pattern | ((ULONG64)Pattern << 32), Length / 2);
if ((Length & 1) != 0) Address[Length - 1] = Pattern;
}
return;
}
#define RtlFillMemoryUlonglong(Destination, Length, Pattern) \
__stosq((PULONG64)(Destination), Pattern, (Length) / 8)
#else
NTSYSAPI NTSYSAPI
VOID VOID
NTAPI NTAPI
RtlFillMemoryUlong( RtlFillMemoryUlong(
_In_ PVOID Destination, _Out_writes_bytes_all_(Length) PVOID Destination,
_In_ SIZE_T Length, _In_ SIZE_T Length,
_In_ ULONG Fill _In_ ULONG Pattern
); );
NTSYSAPI NTSYSAPI
@ -2137,6 +2166,8 @@ RtlFillMemoryUlonglong(
_In_ ULONGLONG Pattern _In_ ULONGLONG Pattern
); );
#endif
NTSYSAPI NTSYSAPI
NTSTATUS NTSTATUS
NTAPI NTAPI

View file

@ -2376,9 +2376,9 @@ NTSYSAPI
VOID VOID
NTAPI NTAPI
RtlFillMemoryUlong( RtlFillMemoryUlong(
OUT PVOID Destination, _Out_writes_bytes_all_(Length) PVOID Destination,
IN SIZE_T Length, _In_ SIZE_T Length,
IN ULONG Pattern); _In_ ULONG Pattern);
NTSYSAPI NTSYSAPI
VOID VOID

View file

@ -92,7 +92,7 @@ RtlFillMemory(PVOID Destination,
} }
#ifndef _M_AMD64
/* /*
* @implemented * @implemented
*/ */
@ -131,7 +131,8 @@ RtlFillMemoryUlonglong(
Count--; Count--;
} }
} }
#endif #endif // _WIN64
#endif // _M_AMD64
#undef RtlMoveMemory #undef RtlMoveMemory
/* /*