From bd4f0603058bc95dd7f41cb4a2a5db65c220b528 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 20 May 2023 12:02:03 +0300 Subject: [PATCH] [RTL_APITEST] Move RtlIntSafe test from kmtest to rtl_apitest --- modules/rostests/apitests/ntdll/testlist.c | 2 ++ modules/rostests/apitests/rtl/CMakeLists.txt | 2 +- .../rostests/{kmtests => apitests}/rtl/RtlIntSafe.c | 13 ++++++------- modules/rostests/apitests/rtl/testlist.c | 3 +++ modules/rostests/kmtests/CMakeLists.txt | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-) rename modules/rostests/{kmtests => apitests}/rtl/RtlIntSafe.c (97%) diff --git a/modules/rostests/apitests/ntdll/testlist.c b/modules/rostests/apitests/ntdll/testlist.c index cc19972f5aa03..641a756f261a8 100644 --- a/modules/rostests/apitests/ntdll/testlist.c +++ b/modules/rostests/apitests/ntdll/testlist.c @@ -79,6 +79,7 @@ extern void func_RtlGetUnloadEventTrace(void); extern void func_RtlHandle(void); extern void func_RtlImageDirectoryEntryToData(void); extern void func_RtlImageRvaToVa(void); +extern void func_RtlIntSafe(void); extern void func_RtlIsNameLegalDOS8Dot3(void); extern void func_RtlMemoryStream(void); extern void func_RtlMultipleAllocateHeap(void); @@ -176,6 +177,7 @@ const struct test winetest_testlist[] = { "RtlHandle", func_RtlHandle }, { "RtlImageDirectoryEntryToData", func_RtlImageDirectoryEntryToData }, { "RtlImageRvaToVa", func_RtlImageRvaToVa }, + { "RtlIntSafe", func_RtlIntSafe }, { "RtlIsNameLegalDOS8Dot3", func_RtlIsNameLegalDOS8Dot3 }, { "RtlMemoryStream", func_RtlMemoryStream }, { "RtlMultipleAllocateHeap", func_RtlMultipleAllocateHeap }, diff --git a/modules/rostests/apitests/rtl/CMakeLists.txt b/modules/rostests/apitests/rtl/CMakeLists.txt index 7c74792dfd57a..13bd9b7a718a8 100644 --- a/modules/rostests/apitests/rtl/CMakeLists.txt +++ b/modules/rostests/apitests/rtl/CMakeLists.txt @@ -1,7 +1,7 @@ list(APPEND SOURCE - # To be filled + RtlIntSafe.c ) if(ARCH STREQUAL "i386") diff --git a/modules/rostests/kmtests/rtl/RtlIntSafe.c b/modules/rostests/apitests/rtl/RtlIntSafe.c similarity index 97% rename from modules/rostests/kmtests/rtl/RtlIntSafe.c rename to modules/rostests/apitests/rtl/RtlIntSafe.c index bc8bd2854ecfa..bb00bc354c60f 100644 --- a/modules/rostests/kmtests/rtl/RtlIntSafe.c +++ b/modules/rostests/apitests/rtl/RtlIntSafe.c @@ -5,8 +5,7 @@ * PROGRAMMER: Thomas Faber */ -#define KMT_EMULATE_KERNEL -#include +#include #define ENABLE_INTSAFE_SIGNED_FUNCTIONS #include @@ -76,7 +75,7 @@ START_TEST(RtlIntSafe) TEST_CONVERSION(Long, LONG, UInt, UINT, uint, 0, 0, STATUS_SUCCESS); TEST_CONVERSION(Long, LONG, UInt, UINT, uint, 5, 5, STATUS_SUCCESS); - TEST_CONVERSION(Long, LONG, UInt, UINT, uint, LONG_MAX, LONG_MAX, STATUS_SUCCESS); + TEST_CONVERSION(Long, LONG, UInt, UINT, uint, INT_MAX, INT_MAX, STATUS_SUCCESS); TEST_CONVERSION(Long, LONG, UInt, UINT, uint, -1, (UINT)-1, STATUS_INTEGER_OVERFLOW); TEST_CONVERSION(Long, LONG, UInt, UINT, uint, LONG_MIN, (UINT)-1, STATUS_INTEGER_OVERFLOW); @@ -129,15 +128,15 @@ START_TEST(RtlIntSafe) TEST_ADD(Int8, INT8, int, INT8_MIN, -1, (INT8)-1, STATUS_INTEGER_OVERFLOW); TEST_ADD(Int8, INT8, int, INT8_MIN, INT8_MIN, (INT8)-1, STATUS_INTEGER_OVERFLOW); - TEST_ADD(LongLong, LONGLONG, longlong, 0, 0, 0, STATUS_SUCCESS); - TEST_ADD(LongLong, LONGLONG, longlong, 5, 5, 10, STATUS_SUCCESS); + TEST_ADD(LongLong, LONGLONG, longlong, 0, 0, (LONGLONG)0, STATUS_SUCCESS); + TEST_ADD(LongLong, LONGLONG, longlong, 5, 5, (LONGLONG)10, STATUS_SUCCESS); TEST_ADD(LongLong, LONGLONG, longlong, 0, LONGLONG_MAX, LONGLONG_MAX, STATUS_SUCCESS); TEST_ADD(LongLong, LONGLONG, longlong, LONGLONG_MAX, 0, LONGLONG_MAX, STATUS_SUCCESS); TEST_ADD(LongLong, LONGLONG, longlong, LONGLONG_MAX - 1, 1, LONGLONG_MAX, STATUS_SUCCESS); TEST_ADD(LongLong, LONGLONG, longlong, LONGLONG_MAX, 1, (LONGLONG)-1, STATUS_INTEGER_OVERFLOW); TEST_ADD(LongLong, LONGLONG, longlong, LONGLONG_MAX, INT8_MAX, (LONGLONG)-1, STATUS_INTEGER_OVERFLOW); - TEST_ADD(LongLong, LONGLONG, longlong, 0, -1, -1, STATUS_SUCCESS); - TEST_ADD(LongLong, LONGLONG, longlong, -1, 0, -1, STATUS_SUCCESS); + TEST_ADD(LongLong, LONGLONG, longlong, 0, -1, (LONGLONG)-1, STATUS_SUCCESS); + TEST_ADD(LongLong, LONGLONG, longlong, -1, 0, (LONGLONG)-1, STATUS_SUCCESS); TEST_ADD(LongLong, LONGLONG, longlong, 0, LONGLONG_MIN, LONGLONG_MIN, STATUS_SUCCESS); TEST_ADD(LongLong, LONGLONG, longlong, LONGLONG_MIN, 0, LONGLONG_MIN, STATUS_SUCCESS); TEST_ADD(LongLong, LONGLONG, longlong, LONGLONG_MAX, LONGLONG_MIN, (LONGLONG)-1, STATUS_SUCCESS); diff --git a/modules/rostests/apitests/rtl/testlist.c b/modules/rostests/apitests/rtl/testlist.c index ca7ad4c2a5095..1eeed3b056b10 100644 --- a/modules/rostests/apitests/rtl/testlist.c +++ b/modules/rostests/apitests/rtl/testlist.c @@ -4,9 +4,12 @@ #include extern void func_RtlCaptureContext(void); +extern void func_RtlIntSafe(void); const struct test winetest_testlist[] = { + { "RtlIntSafe", func_RtlIntSafe }, + #ifdef _M_AMD64 { "RtlCaptureContext", func_RtlCaptureContext }, #endif diff --git a/modules/rostests/kmtests/CMakeLists.txt b/modules/rostests/kmtests/CMakeLists.txt index 4dd5572b13aad..40c710f0a468c 100644 --- a/modules/rostests/kmtests/CMakeLists.txt +++ b/modules/rostests/kmtests/CMakeLists.txt @@ -18,7 +18,7 @@ list(APPEND COMMON_SOURCE example/GuardedMemory.c rtl/RtlAvlTree.c rtl/RtlException.c - rtl/RtlIntSafe.c + ../apitests/rtl/RtlIntSafe.c rtl/RtlMemory.c rtl/RtlRegistry.c rtl/RtlSplayTree.c