3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: kernel/rtl/mem.c
6 * PURPOSE: Memory functions
7 * PROGRAMMER: David Welch (welch@mcmail.com)
12 /* INCLUDES *****************************************************************/
14 #include <ddk/ntddk.h>
17 /* FUNCTIONS *****************************************************************/
21 RtlCompareMemory(PVOID Source1, PVOID Source2, ULONG Length)
23 * FUNCTION: Compares blocks of memory and returns the number of equal bytes
25 * Source1 = Block to compare
26 * Source2 = Block to compare
27 * Length = Number of bytes to compare
28 * RETURNS: Number of equal bytes
33 for (i=0,total=0;i<Length;i++)
35 if ( ((PUCHAR)Source1)[i] == ((PUCHAR)Source2)[i] )
45 RtlCompareMemoryUlong (
51 * FUNCTION: Compares a block of ULONGs with an ULONG and returns the number of equal bytes
53 * Source = Block to compare
54 * Length = Number of bytes to compare
55 * Value = Value to compare
56 * RETURNS: Number of equal bytes
59 PULONG ptr = (PULONG)Source;
60 ULONG len = Length / sizeof(ULONG);
63 for (i = 0; i < len; i++)
70 return (ULONG)((PCHAR)ptr - (PCHAR)Source);
74 VOID RtlCopyBytes(PVOID Destination,
78 RtlCopyMemory(Destination,Source,Length);
81 VOID RtlCopyMemory(VOID* Destination, CONST VOID* Source, ULONG Length)
83 DPRINT("RtlCopyMemory(Destination %x Source %x Length %d\n",
84 Destination,Source,Length);
85 memcpy(Destination,Source,Length);
86 DPRINT("*Destination %x\n",*(PULONG)Destination);
113 PULONG Dest = Destination;
114 ULONG Count = Length / sizeof(ULONG);