Initial revision
[reactos.git] / reactos / ntoskrnl / rtl / mem.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: kernel/rtl/mem.c
5 * PURPOSE: Graceful system shutdown if a bug is detected
6 * PROGRAMMER: David Welch (welch@mcmail.com)
7 * UPDATE HISTORY:
8 * Created 22/05/98
9 */
10
11 /* INCLUDES *****************************************************************/
12
13 #include <internal/kernel.h>
14 #include <internal/linkage.h>
15 #include <internal/string.h>
16
17 #include <ddk/ntddk.h>
18
19 #include <internal/debug.h>
20
21 /* FUNCTIONS *****************************************************************/
22
23 ULONG RtlCompareMemory(PVOID Source1, PVOID Source2, ULONG Length)
24 /*
25 * FUNCTION: Compares blocks of memory and returns the number of equal bytes
26 * ARGUMENTS:
27 * Source1 = Block to compare
28 * Source2 = Block to compare
29 * Length = Number of bytes to compare
30 * RETURNS: Number of equal bytes
31 */
32 {
33 int i,total;
34
35 for (i=0,total=0;i<Length;i++)
36 {
37 if ( ((PUCHAR)Source1)[i] == ((PUCHAR)Source2)[i] )
38 {
39 total++;
40 }
41 }
42 return(total);
43 }
44
45 VOID RtlCopyBytes(PVOID Destination,
46 CONST VOID* Source,
47 ULONG Length)
48 {
49 RtlCopyMemory(Destination,Source,Length);
50 }
51
52 VOID RtlCopyMemory(VOID* Destination, VOID* Source, ULONG Length)
53 {
54 memcpy(Destination,Source,Length);
55 }
56
57 VOID RtlFillMemory(PVOID Destination, ULONG Length, UCHAR Fill)
58 {
59 memset(Destination,Fill,Length);
60 }
61
62 VOID RtlZeroMemory(PVOID Destination, ULONG Length)
63 {
64 RtlFillMemory(Destination,Length,0);
65 }
66
67 VOID RtlMoveMemory(PVOID Destination,
68 CONST VOID* Source,
69 ULONG Length)
70 {
71 memmove(Destination,Source,Length);
72 }