RtlFillMemoryUlong - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTRTL_H
#if defined(_M_AMD64)

FORCEINLINE
VOID
NTAPI_INLINE
RtlFillMemoryUlong(
    _Out_writes_bytes_all_(Length) PVOID Destination,
    _In_ SIZE_T Length,
    _In_ ULONG Pattern
    )
{
    PULONG Address = (PULONG)Destination;

    //
    // If the number of DWORDs is not zero, then fill the specified buffer
    // with the specified pattern.
    //

    if ((Length /= 4) != 0) {

        //
        // If the destination is not quadword aligned (ignoring low bits),
        // then align the destination by storing one DWORD.
        //

        if (((ULONG64)Address & 4) != 0) {
            *Address = Pattern;
            if ((Length -= 1) == 0) {
                return;
            }

            Address += 1;
        }

        //
        // If the number of QWORDs is not zero, then fill the destination
        // buffer a QWORD at a time.
        //

         __stosq((PULONG64)(Address),
                 Pattern | ((ULONG64)Pattern << 32),
                 Length / 2);

        if ((Length & 1) != 0) {
            Address[Length - 1] = Pattern;
        }
    }

    return;
}

#endif
#endif

View code on GitHub
#ifndef _NTRTL_H
#if defined(_M_AMD64)
// ...
#else

NTSYSAPI
VOID
NTAPI
RtlFillMemoryUlong(
    _Out_writes_bytes_all_(Length) PVOID Destination,
    _In_ SIZE_T Length,
    _In_ ULONG Pattern
    );

#endif
#endif

View code on GitHub
// ntifs.h

VOID RtlFillMemoryUlong(
  [out] PVOID  Destination,
  [in]  SIZE_T Length,
  [in]  ULONG  Pattern
);
View the official Windows Driver Kit DDI reference

NtDoc

This function is documented in Windows Driver Kit.

Windows Driver Kit DDI reference (nf-ntifs-rtlfillmemoryulong)

RtlFillMemoryUlong function

Description

The RtlFillMemoryUlong routine fills the specified range of memory with one or more repetitions of a ULONG value.

Parameters

Destination [out]

Pointer to a block of memory to be filled. Must be ULONG-aligned.

Length [in]

Length in bytes of the memory to fill. Must be a multiple of sizeof(ULONG). (Note: SIZE_T is defined in basetsd.h.)

Pattern [in]

ULONG value with which to fill the memory block.

Remarks

If the block of memory at Destination is nonpaged, the caller can be running at any IRQL. Otherwise, callers of RtlFillMemoryUlong must be running at IRQL < DISPATCH_LEVEL.

For more information about managing buffered data and initializing driver-allocated buffers, see Buffered Data and Buffer Initialization.

See also

RtlFillMemory

RtlFillMemoryUlonglong

RtlZeroMemory