mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[NTDLL_APITEST] Add a test for RtlGetUnloadEventTrace
This commit is contained in:
parent
362f4b5915
commit
7cce7b9c08
3 changed files with 86 additions and 0 deletions
|
@ -58,6 +58,7 @@ list(APPEND SOURCE
|
||||||
RtlGetLengthWithoutTrailingPathSeperators.c
|
RtlGetLengthWithoutTrailingPathSeperators.c
|
||||||
RtlGetLongestNtPathLength.c
|
RtlGetLongestNtPathLength.c
|
||||||
RtlGetNtProductType.c
|
RtlGetNtProductType.c
|
||||||
|
RtlGetUnloadEventTrace.c
|
||||||
RtlHandle.c
|
RtlHandle.c
|
||||||
RtlImageRvaToVa.c
|
RtlImageRvaToVa.c
|
||||||
RtlIsNameLegalDOS8Dot3.c
|
RtlIsNameLegalDOS8Dot3.c
|
||||||
|
|
83
modules/rostests/apitests/ntdll/RtlGetUnloadEventTrace.c
Normal file
83
modules/rostests/apitests/ntdll/RtlGetUnloadEventTrace.c
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
/*
|
||||||
|
* PROJECT: ReactOS API tests
|
||||||
|
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
||||||
|
* PURPOSE: Test for RtlGetUnloadEventTrace
|
||||||
|
* COPYRIGHT: Copyright 2020 Mark Jansen (mark.jansen@reactos.org)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "precomp.h"
|
||||||
|
|
||||||
|
PRTL_UNLOAD_EVENT_TRACE
|
||||||
|
NTAPI
|
||||||
|
RtlGetUnloadEventTrace(VOID);
|
||||||
|
|
||||||
|
#ifndef _WIN64
|
||||||
|
C_ASSERT(sizeof(RTL_UNLOAD_EVENT_TRACE) == 84);
|
||||||
|
C_ASSERT(sizeof(RTL_UNLOAD_EVENT_TRACE) * RTL_UNLOAD_EVENT_TRACE_NUMBER == 0x540);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void Test_Dump()
|
||||||
|
{
|
||||||
|
PRTL_UNLOAD_EVENT_TRACE TraceHead, Trace;
|
||||||
|
UINT n;
|
||||||
|
|
||||||
|
TraceHead = RtlGetUnloadEventTrace();
|
||||||
|
for (n = 0; n < RTL_UNLOAD_EVENT_TRACE_NUMBER; ++n)
|
||||||
|
{
|
||||||
|
ULONG ExpectSequence = n ? n : RTL_UNLOAD_EVENT_TRACE_NUMBER;
|
||||||
|
|
||||||
|
Trace = TraceHead + n;
|
||||||
|
|
||||||
|
ok(Trace->BaseAddress != NULL, "Got no BaseAddress for %u\n", n);
|
||||||
|
ok(Trace->SizeOfImage != 0, "Got no SizeOfImage for %u\n", n);
|
||||||
|
ok(Trace->Sequence == ExpectSequence,
|
||||||
|
"Wrong Sequence: %lu instead of %lu for %u\n", Trace->Sequence, ExpectSequence, n);
|
||||||
|
ok(Trace->TimeDateStamp != 0, "Got no TimeDateStamp for %u\n", n);
|
||||||
|
ok(Trace->CheckSum != 0, "Got no CheckSum for %u\n", n);
|
||||||
|
ok(!wcscmp(Trace->ImageName, L"GetUName.dLl"), "Wrong ImageName for %u: %S\n", n, Trace->ImageName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define TESTDLL "GetUName.dLl"
|
||||||
|
static void Test_LoadUnload()
|
||||||
|
{
|
||||||
|
HMODULE mod;
|
||||||
|
static char Buffer[MAX_PATH] = {0};
|
||||||
|
|
||||||
|
mod = GetModuleHandleA(TESTDLL);
|
||||||
|
ok(mod == NULL, "ERROR, %s already loaded\n", TESTDLL);
|
||||||
|
|
||||||
|
mod = LoadLibraryA(Buffer[0] ? Buffer :TESTDLL);
|
||||||
|
ok(mod != NULL, "ERROR, %s not loaded\n", TESTDLL);
|
||||||
|
|
||||||
|
if (!Buffer[0])
|
||||||
|
{
|
||||||
|
GetModuleFileNameA(mod, Buffer, _countof(Buffer));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Buffer[0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
FreeLibrary(mod);
|
||||||
|
|
||||||
|
mod = GetModuleHandleA(TESTDLL);
|
||||||
|
ok(mod == NULL, "ERROR, %s still loaded\n", TESTDLL);
|
||||||
|
}
|
||||||
|
|
||||||
|
START_TEST(RtlGetUnloadEventTrace)
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
HMODULE Ignore;
|
||||||
|
|
||||||
|
Ignore = LoadLibrary("user32.dll");
|
||||||
|
|
||||||
|
for (n = 0; n <= RTL_UNLOAD_EVENT_TRACE_NUMBER; ++n)
|
||||||
|
{
|
||||||
|
trace("Num: %u\n", n);
|
||||||
|
Test_LoadUnload();
|
||||||
|
}
|
||||||
|
Test_Dump();
|
||||||
|
|
||||||
|
FreeLibrary(Ignore);
|
||||||
|
}
|
|
@ -57,6 +57,7 @@ extern void func_RtlGetFullPathName_UstrEx(void);
|
||||||
extern void func_RtlGetLengthWithoutTrailingPathSeperators(void);
|
extern void func_RtlGetLengthWithoutTrailingPathSeperators(void);
|
||||||
extern void func_RtlGetLongestNtPathLength(void);
|
extern void func_RtlGetLongestNtPathLength(void);
|
||||||
extern void func_RtlGetNtProductType(void);
|
extern void func_RtlGetNtProductType(void);
|
||||||
|
extern void func_RtlGetUnloadEventTrace(void);
|
||||||
extern void func_RtlHandle(void);
|
extern void func_RtlHandle(void);
|
||||||
extern void func_RtlImageRvaToVa(void);
|
extern void func_RtlImageRvaToVa(void);
|
||||||
extern void func_RtlIsNameLegalDOS8Dot3(void);
|
extern void func_RtlIsNameLegalDOS8Dot3(void);
|
||||||
|
@ -128,6 +129,7 @@ const struct test winetest_testlist[] =
|
||||||
{ "RtlGetLengthWithoutTrailingPathSeperators", func_RtlGetLengthWithoutTrailingPathSeperators },
|
{ "RtlGetLengthWithoutTrailingPathSeperators", func_RtlGetLengthWithoutTrailingPathSeperators },
|
||||||
{ "RtlGetLongestNtPathLength", func_RtlGetLongestNtPathLength },
|
{ "RtlGetLongestNtPathLength", func_RtlGetLongestNtPathLength },
|
||||||
{ "RtlGetNtProductType", func_RtlGetNtProductType },
|
{ "RtlGetNtProductType", func_RtlGetNtProductType },
|
||||||
|
{ "RtlGetUnloadEventTrace", func_RtlGetUnloadEventTrace },
|
||||||
{ "RtlHandle", func_RtlHandle },
|
{ "RtlHandle", func_RtlHandle },
|
||||||
{ "RtlImageRvaToVa", func_RtlImageRvaToVa },
|
{ "RtlImageRvaToVa", func_RtlImageRvaToVa },
|
||||||
{ "RtlIsNameLegalDOS8Dot3", func_RtlIsNameLegalDOS8Dot3 },
|
{ "RtlIsNameLegalDOS8Dot3", func_RtlIsNameLegalDOS8Dot3 },
|
||||||
|
|
Loading…
Reference in a new issue