[CRT]
authorThomas Faber <thomas.faber@reactos.org>
Tue, 29 Sep 2015 17:24:48 +0000 (17:24 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Tue, 29 Sep 2015 17:24:48 +0000 (17:24 +0000)
- Add "memcmp" library that is used by kernel drivers to get memcmp/RtlEqualMemory
CORE-10285 #resolve

svn path=/trunk/; revision=69413

reactos/lib/sdk/crt/CMakeLists.txt
rostests/kmtests/CMakeLists.txt
rostests/kmtests/rtl/RtlMemory.c

index 53b4963..3c002b4 100644 (file)
@@ -49,6 +49,9 @@ add_library(user32_wsprintf
 add_dependencies(user32_wsprintf psdk)
 add_target_compile_definitions(user32_wsprintf _USER32_WSPRINTF)
 
 add_dependencies(user32_wsprintf psdk)
 add_target_compile_definitions(user32_wsprintf _USER32_WSPRINTF)
 
+add_library(memcmp mem/memcmp.c)
+add_dependencies(memcmp psdk)
+
 add_library(getopt misc/getopt.c)
 add_target_compile_definitions(getopt _DLL __USE_CRTIMP)
 add_dependencies(getopt psdk)
 add_library(getopt misc/getopt.c)
 add_target_compile_definitions(getopt _DLL __USE_CRTIMP)
 add_dependencies(getopt psdk)
index b17c970..30dcade 100644 (file)
@@ -85,7 +85,7 @@ list(APPEND KMTEST_DRV_SOURCE
 
 add_library(kmtest_drv SHARED ${KMTEST_DRV_SOURCE})
 set_module_type(kmtest_drv kernelmodedriver)
 
 add_library(kmtest_drv SHARED ${KMTEST_DRV_SOURCE})
 set_module_type(kmtest_drv kernelmodedriver)
-target_link_libraries(kmtest_drv kmtest_printf chkstk ${PSEH_LIB})
+target_link_libraries(kmtest_drv kmtest_printf chkstk memcmp ${PSEH_LIB})
 add_importlibs(kmtest_drv ntoskrnl hal)
 add_dependencies(kmtest_drv bugcodes xdk)
 add_target_compile_definitions(kmtest_drv KMT_KERNEL_MODE NTDDI_VERSION=NTDDI_WS03SP1)
 add_importlibs(kmtest_drv ntoskrnl hal)
 add_dependencies(kmtest_drv bugcodes xdk)
 add_target_compile_definitions(kmtest_drv KMT_KERNEL_MODE NTDDI_VERSION=NTDDI_WS03SP1)
index c058b20..b16e5b7 100644 (file)
@@ -287,7 +287,19 @@ START_TEST(RtlMemory)
     KeRaiseIrql(HIGH_LEVEL, &Irql);
 
     /* RtlEqualMemory */
     KeRaiseIrql(HIGH_LEVEL, &Irql);
 
     /* RtlEqualMemory */
-    /* TODO: where is memcmp? */
+    MakePattern(Buffer, 8, HalfSize / 8 - 1, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
+                        1, 1,                0x12,
+                        8, HalfSize / 8,     0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
+                        1, 7,                0x12, 0);
+                        
+    ok_bool_true(RtlEqualMemory((PVOID)1, (PVOID)2, 0),
+                 "RtlEqualMemory returned");
+    ok_bool_true(RtlEqualMemory(Buffer, Buffer + HalfSize - 7, HalfSize - 8),
+                 "RtlEqualMemory returned");
+    ok_bool_true(RtlEqualMemory(Buffer, Buffer + HalfSize - 7, HalfSize - 8 + 1),
+                 "RtlEqualMemory returned");
+    ok_bool_false(RtlEqualMemory(Buffer, Buffer + HalfSize - 7, HalfSize - 8 + 2),
+                  "RtlEqualMemory returned");
 
     /* RtlCompareMemory */
     MakePattern(Buffer, 8, HalfSize / 8 - 1, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
 
     /* RtlCompareMemory */
     MakePattern(Buffer, 8, HalfSize / 8 - 1, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,