2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
5 * PURPOSE: Memory functions
6 * PROGRAMMER: David Welch (welch@mcmail.com)
9 /* INCLUDES *****************************************************************/
17 /* FUNCTIONS *****************************************************************/
19 /******************************************************************************
20 * RtlCompareMemory [NTDLL.@]
22 * Compare one block of memory with another
25 * Source1 [I] Source block
26 * Source2 [I] Block to compare to Source1
27 * Length [I] Number of bytes to fill
30 * The length of the first byte at which Source1 and Source2 differ, or Length
31 * if they are the same.
37 RtlCompareMemory(IN
const VOID
*Source1
,
38 IN
const VOID
*Source2
,
42 for (i
= 0; (i
< Length
) && (((PUCHAR
)Source1
)[i
] == ((PUCHAR
)Source2
)[i
]); i
++)
50 * FUNCTION: Compares a block of ULONGs with an ULONG and returns the number of equal bytes
52 * Source = Block to compare
53 * Length = Number of bytes to compare
54 * Value = Value to compare
55 * RETURNS: Number of equal bytes
61 RtlCompareMemoryUlong(IN PVOID Source
,
65 PULONG ptr
= (PULONG
)Source
;
66 ULONG_PTR len
= Length
/ sizeof(ULONG
);
69 for (i
= 0; i
< len
; i
++)
77 return (SIZE_T
)((PCHAR
)ptr
- (PCHAR
)Source
);
87 RtlFillMemory(PVOID Destination
,
91 memset(Destination
, Fill
, Length
);
101 RtlFillMemoryUlong(PVOID Destination
,
105 PULONG Dest
= Destination
;
106 SIZE_T Count
= Length
/ sizeof(ULONG
);
119 RtlFillMemoryUlonglong(
124 PULONGLONG Dest
= Destination
;
125 SIZE_T Count
= Length
/ sizeof(ULONGLONG
);
142 RtlMoveMemory(PVOID Destination
,
146 memmove(Destination
, Source
, Length
);
155 RtlZeroMemory(PVOID Destination
,
158 RtlFillMemory(Destination
, Length
, 0);