mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 17:16:04 +00:00
[NTDLL_APITEST]
- Do not use Zw functions from user mode svn path=/trunk/; revision=60405
This commit is contained in:
parent
13828ad762
commit
8d5a1b7ca7
5 changed files with 40 additions and 46 deletions
|
@ -2,6 +2,7 @@
|
||||||
list(APPEND SOURCE
|
list(APPEND SOURCE
|
||||||
LdrEnumResources.c
|
LdrEnumResources.c
|
||||||
NtAllocateVirtualMemory.c
|
NtAllocateVirtualMemory.c
|
||||||
|
NtContinue.c
|
||||||
NtCreateThread.c
|
NtCreateThread.c
|
||||||
NtFreeVirtualMemory.c
|
NtFreeVirtualMemory.c
|
||||||
NtMapViewOfSection.c
|
NtMapViewOfSection.c
|
||||||
|
@ -21,11 +22,10 @@ list(APPEND SOURCE
|
||||||
RtlInitializeBitMap.c
|
RtlInitializeBitMap.c
|
||||||
SystemInfo.c
|
SystemInfo.c
|
||||||
Timer.c
|
Timer.c
|
||||||
ZwContinue.c
|
|
||||||
testlist.c)
|
testlist.c)
|
||||||
|
|
||||||
if(ARCH STREQUAL "i386")
|
if(ARCH STREQUAL "i386")
|
||||||
add_asm_files(ntdll_apitest_asm i386/ZwContinue.S)
|
add_asm_files(ntdll_apitest_asm i386/NtContinue.S)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(ntdll_apitest ${SOURCE} ${ntdll_apitest_asm})
|
add_executable(ntdll_apitest ${SOURCE} ${ntdll_apitest_asm})
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
/*
|
/*
|
||||||
* PROJECT: ReactOS api tests
|
* PROJECT: ReactOS api tests
|
||||||
* LICENSE: GPL - See COPYING in the top level directory
|
* LICENSE: GPL - See COPYING in the top level directory
|
||||||
* PURPOSE: Test for ZwContinue
|
* PURPOSE: Test for NtContinue
|
||||||
* PROGRAMMER:
|
* PROGRAMMER:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <apitest.h>
|
#include <apitest.h>
|
||||||
|
#include <ndk/kefuncs.h>
|
||||||
|
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#ifdef _M_IX86
|
#ifdef _M_IX86
|
||||||
#define ZWC_SEGMENT_BITS (0xFFFF)
|
#define NTC_SEGMENT_BITS (0xFFFF)
|
||||||
#define ZWC_EFLAGS_BITS (0x3C0CD5)
|
#define NTC_EFLAGS_BITS (0x3C0CD5)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void continuePoint(void);
|
void continuePoint(void);
|
||||||
LONG NTAPI ZwContinue(IN CONTEXT *, IN BOOLEAN);
|
|
||||||
|
|
||||||
static jmp_buf jmpbuf;
|
static jmp_buf jmpbuf;
|
||||||
static CONTEXT continueContext;
|
static CONTEXT continueContext;
|
||||||
|
@ -66,24 +66,24 @@ void check(CONTEXT * pContext)
|
||||||
"ContextFlags=0x%lx\n", pContext->ContextFlags);
|
"ContextFlags=0x%lx\n", pContext->ContextFlags);
|
||||||
|
|
||||||
/* Random data segments */
|
/* Random data segments */
|
||||||
ok((pContext->SegGs & ZWC_SEGMENT_BITS) ==
|
ok((pContext->SegGs & NTC_SEGMENT_BITS) ==
|
||||||
(continueContext.SegGs & ZWC_SEGMENT_BITS),
|
(continueContext.SegGs & NTC_SEGMENT_BITS),
|
||||||
"SegGs=0x%lx / 0x%lx\n", pContext->SegGs, continueContext.SegGs);
|
"SegGs=0x%lx / 0x%lx\n", pContext->SegGs, continueContext.SegGs);
|
||||||
|
|
||||||
ok((pContext->SegFs & ZWC_SEGMENT_BITS) ==
|
ok((pContext->SegFs & NTC_SEGMENT_BITS) ==
|
||||||
(continueContext.SegFs & ZWC_SEGMENT_BITS),
|
(continueContext.SegFs & NTC_SEGMENT_BITS),
|
||||||
"SegFs=0x%lx / 0x%lx\n", pContext->SegFs, continueContext.SegFs);
|
"SegFs=0x%lx / 0x%lx\n", pContext->SegFs, continueContext.SegFs);
|
||||||
|
|
||||||
ok((pContext->SegEs & ZWC_SEGMENT_BITS) ==
|
ok((pContext->SegEs & NTC_SEGMENT_BITS) ==
|
||||||
(continueContext.SegEs & ZWC_SEGMENT_BITS),
|
(continueContext.SegEs & NTC_SEGMENT_BITS),
|
||||||
"SegEs=0x%lx / 0x%lx\n", pContext->SegEs, continueContext.SegEs);
|
"SegEs=0x%lx / 0x%lx\n", pContext->SegEs, continueContext.SegEs);
|
||||||
|
|
||||||
ok((pContext->SegDs & ZWC_SEGMENT_BITS) ==
|
ok((pContext->SegDs & NTC_SEGMENT_BITS) ==
|
||||||
(continueContext.SegDs & ZWC_SEGMENT_BITS),
|
(continueContext.SegDs & NTC_SEGMENT_BITS),
|
||||||
"SegDs=0x%lx / 0x%lx\n", pContext->SegDs, continueContext.SegDs);
|
"SegDs=0x%lx / 0x%lx\n", pContext->SegDs, continueContext.SegDs);
|
||||||
|
|
||||||
/* Integer registers */
|
/* Integer registers */
|
||||||
ok(pContext->Edi == continueContext.Edi,
|
ok(pContext->Edi == continueContext.Edi,
|
||||||
"Edi: 0x%lx != 0x%lx\n", pContext->Edi, continueContext.Edi);
|
"Edi: 0x%lx != 0x%lx\n", pContext->Edi, continueContext.Edi);
|
||||||
ok(pContext->Esi == continueContext.Esi,
|
ok(pContext->Esi == continueContext.Esi,
|
||||||
"Esi: 0x%lx != 0x%lx\n", pContext->Esi, continueContext.Esi);
|
"Esi: 0x%lx != 0x%lx\n", pContext->Esi, continueContext.Esi);
|
||||||
|
@ -104,16 +104,16 @@ void check(CONTEXT * pContext)
|
||||||
ok(pContext->Esp == continueContext.Esp,
|
ok(pContext->Esp == continueContext.Esp,
|
||||||
"Esp: 0x%lx != 0x%lx\n", pContext->Esp, continueContext.Esp);
|
"Esp: 0x%lx != 0x%lx\n", pContext->Esp, continueContext.Esp);
|
||||||
|
|
||||||
ok((pContext->SegCs & ZWC_SEGMENT_BITS) ==
|
ok((pContext->SegCs & NTC_SEGMENT_BITS) ==
|
||||||
(continueContext.SegCs & ZWC_SEGMENT_BITS),
|
(continueContext.SegCs & NTC_SEGMENT_BITS),
|
||||||
"SegCs: 0x%lx != 0x%lx\n", pContext->SegCs, continueContext.SegCs);
|
"SegCs: 0x%lx != 0x%lx\n", pContext->SegCs, continueContext.SegCs);
|
||||||
|
|
||||||
ok((pContext->EFlags & ZWC_EFLAGS_BITS) ==
|
ok((pContext->EFlags & NTC_EFLAGS_BITS) ==
|
||||||
(continueContext.EFlags & ZWC_EFLAGS_BITS),
|
(continueContext.EFlags & NTC_EFLAGS_BITS),
|
||||||
"EFlags: 0x%lx != 0x%lx\n", pContext->EFlags, continueContext.EFlags);
|
"EFlags: 0x%lx != 0x%lx\n", pContext->EFlags, continueContext.EFlags);
|
||||||
|
|
||||||
ok((pContext->SegSs & ZWC_SEGMENT_BITS) ==
|
ok((pContext->SegSs & NTC_SEGMENT_BITS) ==
|
||||||
(continueContext.SegSs & ZWC_SEGMENT_BITS),
|
(continueContext.SegSs & NTC_SEGMENT_BITS),
|
||||||
"SegSs: 0x%lx != 0x%lx\n", pContext->SegSs, continueContext.SegSs);
|
"SegSs: 0x%lx != 0x%lx\n", pContext->SegSs, continueContext.SegSs);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ void check(CONTEXT * pContext)
|
||||||
longjmp(jmpbuf, 1);
|
longjmp(jmpbuf, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test_ZwContinue()
|
START_TEST(NtContinue)
|
||||||
{
|
{
|
||||||
initrand();
|
initrand();
|
||||||
|
|
||||||
|
@ -158,16 +158,10 @@ void Test_ZwContinue()
|
||||||
/* Can't do a lot about segments */
|
/* Can't do a lot about segments */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ZwContinue(&continueContext, FALSE);
|
NtContinue(&continueContext, FALSE);
|
||||||
ok(0, "should never get here\n");
|
ok(0, "should never get here\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Second time */
|
/* Second time */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(ZwContinue)
|
|
||||||
{
|
|
||||||
Test_ZwContinue();
|
|
||||||
}
|
|
||||||
|
|
|
@ -104,19 +104,19 @@ START_TEST(RtlGetLengthWithoutTrailingPathSeperators)
|
||||||
&str, pentry->input);
|
&str, pentry->input);
|
||||||
|
|
||||||
len = 0xDEADBEEF;
|
len = 0xDEADBEEF;
|
||||||
|
|
||||||
StartSeh()
|
StartSeh()
|
||||||
res = RtlGetLengthWithoutTrailingPathSeperators(0, &str, &len);
|
res = RtlGetLengthWithoutTrailingPathSeperators(0, &str, &len);
|
||||||
EndSeh(STATUS_SUCCESS);
|
EndSeh(STATUS_SUCCESS);
|
||||||
|
|
||||||
ok(res == pentry->expected_result,
|
ok(res == pentry->expected_result,
|
||||||
"Unexpected result 0x%08x (expected 0x%08x) in [%d:%d]\n",
|
"Unexpected result 0x%08x (expected 0x%08x) in [%d:%d]\n",
|
||||||
res, pentry->expected_result,
|
res, pentry->expected_result,
|
||||||
i, pentry->line);
|
i, pentry->line);
|
||||||
ok(len == pentry->expected_output,
|
ok(len == pentry->expected_output,
|
||||||
"Unexpected length %d (expected %d) in [%d:%d]\n",
|
"Unexpected length %d (expected %d) in [%d:%d]\n",
|
||||||
len, pentry->expected_output,
|
len, pentry->expected_output,
|
||||||
i, pentry->line);
|
i, pentry->line);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invalid parameters
|
// Invalid parameters
|
||||||
|
@ -127,10 +127,10 @@ START_TEST(RtlGetLengthWithoutTrailingPathSeperators)
|
||||||
res = RtlGetLengthWithoutTrailingPathSeperators(0, NULL, &len);
|
res = RtlGetLengthWithoutTrailingPathSeperators(0, NULL, &len);
|
||||||
EndSeh(STATUS_SUCCESS);
|
EndSeh(STATUS_SUCCESS);
|
||||||
|
|
||||||
ok(res == STATUS_INVALID_PARAMETER,
|
ok(res == STATUS_INVALID_PARAMETER,
|
||||||
"Unexpected result 0x%08x (expected STATUS_INVALID_PARAMETER)\n",
|
"Unexpected result 0x%08x (expected STATUS_INVALID_PARAMETER)\n",
|
||||||
res);
|
res);
|
||||||
ok(len == 0,
|
ok(len == 0,
|
||||||
"Unexpected length %08x (expected 0)\n",
|
"Unexpected length %08x (expected 0)\n",
|
||||||
len);
|
len);
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ START_TEST(RtlGetLengthWithoutTrailingPathSeperators)
|
||||||
res = RtlGetLengthWithoutTrailingPathSeperators(0, &str, NULL);
|
res = RtlGetLengthWithoutTrailingPathSeperators(0, &str, NULL);
|
||||||
EndSeh(STATUS_SUCCESS);
|
EndSeh(STATUS_SUCCESS);
|
||||||
|
|
||||||
ok(res == STATUS_INVALID_PARAMETER,
|
ok(res == STATUS_INVALID_PARAMETER,
|
||||||
"Unexpected result 0x%08x (expected STATUS_INVALID_PARAMETER)\n",
|
"Unexpected result 0x%08x (expected STATUS_INVALID_PARAMETER)\n",
|
||||||
res);
|
res);
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ START_TEST(RtlGetLengthWithoutTrailingPathSeperators)
|
||||||
res = RtlGetLengthWithoutTrailingPathSeperators(0, NULL, NULL);
|
res = RtlGetLengthWithoutTrailingPathSeperators(0, NULL, NULL);
|
||||||
EndSeh(STATUS_SUCCESS);
|
EndSeh(STATUS_SUCCESS);
|
||||||
|
|
||||||
ok(res == STATUS_INVALID_PARAMETER,
|
ok(res == STATUS_INVALID_PARAMETER,
|
||||||
"Unexpected result 0x%08x (expected STATUS_INVALID_PARAMETER)\n",
|
"Unexpected result 0x%08x (expected STATUS_INVALID_PARAMETER)\n",
|
||||||
res);
|
res);
|
||||||
|
|
||||||
|
@ -158,11 +158,11 @@ START_TEST(RtlGetLengthWithoutTrailingPathSeperators)
|
||||||
res = RtlGetLengthWithoutTrailingPathSeperators(1<<i, &str, &len);
|
res = RtlGetLengthWithoutTrailingPathSeperators(1<<i, &str, &len);
|
||||||
EndSeh(STATUS_SUCCESS);
|
EndSeh(STATUS_SUCCESS);
|
||||||
|
|
||||||
ok(res == STATUS_INVALID_PARAMETER,
|
ok(res == STATUS_INVALID_PARAMETER,
|
||||||
"Unexpected result 0x%08x (expected STATUS_INVALID_PARAMETER)\n",
|
"Unexpected result 0x%08x (expected STATUS_INVALID_PARAMETER)\n",
|
||||||
res);
|
res);
|
||||||
|
|
||||||
ok(len == 0,
|
ok(len == 0,
|
||||||
"Unexpected length %08x (expected 0)\n",
|
"Unexpected length %08x (expected 0)\n",
|
||||||
len);
|
len);
|
||||||
}
|
}
|
||||||
|
@ -173,11 +173,11 @@ START_TEST(RtlGetLengthWithoutTrailingPathSeperators)
|
||||||
res = RtlGetLengthWithoutTrailingPathSeperators(0xFFFFFFFF, &str, &len);
|
res = RtlGetLengthWithoutTrailingPathSeperators(0xFFFFFFFF, &str, &len);
|
||||||
EndSeh(STATUS_SUCCESS);
|
EndSeh(STATUS_SUCCESS);
|
||||||
|
|
||||||
ok(res == STATUS_INVALID_PARAMETER,
|
ok(res == STATUS_INVALID_PARAMETER,
|
||||||
"Unexpected result 0x%08x (expected STATUS_INVALID_PARAMETER)\n",
|
"Unexpected result 0x%08x (expected STATUS_INVALID_PARAMETER)\n",
|
||||||
res);
|
res);
|
||||||
|
|
||||||
ok(len == 0,
|
ok(len == 0,
|
||||||
"Unexpected length %08x (expected 0)\n",
|
"Unexpected length %08x (expected 0)\n",
|
||||||
len);
|
len);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
extern void func_LdrEnumResources(void);
|
extern void func_LdrEnumResources(void);
|
||||||
extern void func_NtAllocateVirtualMemory(void);
|
extern void func_NtAllocateVirtualMemory(void);
|
||||||
|
extern void func_NtContinue(void);
|
||||||
extern void func_NtCreateThread(void);
|
extern void func_NtCreateThread(void);
|
||||||
extern void func_NtFreeVirtualMemory(void);
|
extern void func_NtFreeVirtualMemory(void);
|
||||||
extern void func_NtMapViewOfSection(void);
|
extern void func_NtMapViewOfSection(void);
|
||||||
|
@ -24,12 +25,12 @@ extern void func_RtlGetLengthWithoutTrailingPathSeperators(void);
|
||||||
extern void func_RtlGetLongestNtPathLength(void);
|
extern void func_RtlGetLongestNtPathLength(void);
|
||||||
extern void func_RtlInitializeBitMap(void);
|
extern void func_RtlInitializeBitMap(void);
|
||||||
extern void func_TimerResolution(void);
|
extern void func_TimerResolution(void);
|
||||||
extern void func_ZwContinue(void);
|
|
||||||
|
|
||||||
const struct test winetest_testlist[] =
|
const struct test winetest_testlist[] =
|
||||||
{
|
{
|
||||||
{ "LdrEnumResources", func_LdrEnumResources },
|
{ "LdrEnumResources", func_LdrEnumResources },
|
||||||
{ "NtAllocateVirtualMemory", func_NtAllocateVirtualMemory },
|
{ "NtAllocateVirtualMemory", func_NtAllocateVirtualMemory },
|
||||||
|
{ "NtContinue", func_NtContinue },
|
||||||
{ "NtCreateThread", func_NtCreateThread },
|
{ "NtCreateThread", func_NtCreateThread },
|
||||||
{ "NtFreeVirtualMemory", func_NtFreeVirtualMemory },
|
{ "NtFreeVirtualMemory", func_NtFreeVirtualMemory },
|
||||||
{ "NtMapViewOfSection", func_NtMapViewOfSection },
|
{ "NtMapViewOfSection", func_NtMapViewOfSection },
|
||||||
|
@ -49,7 +50,6 @@ const struct test winetest_testlist[] =
|
||||||
{ "RtlGetLongestNtPathLength", func_RtlGetLongestNtPathLength },
|
{ "RtlGetLongestNtPathLength", func_RtlGetLongestNtPathLength },
|
||||||
{ "RtlInitializeBitMap", func_RtlInitializeBitMap },
|
{ "RtlInitializeBitMap", func_RtlInitializeBitMap },
|
||||||
{ "TimerResolution", func_TimerResolution },
|
{ "TimerResolution", func_TimerResolution },
|
||||||
{ "ZwContinue", func_ZwContinue },
|
|
||||||
|
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue