mirror of
https://github.com/reactos/reactos.git
synced 2025-07-23 03:53:41 +00:00
2004-10-24 Casper S. Hornstrup <chorns@users.sourceforge.net>
* ntoskrnl/Makefile (TARGET_REGTESTS): Define to yes. * regtests/regtests/regtests.c (_ExitProcess): Declare. * regtests/regtests/regtests.def (_ExitProcess@4): Ditto. * regtests/shared/regtests.h (_ExitProcess): Ditto. * tools/regtests.c: Exit process using _ExitProcess(); Properly support fastcall symbols. * ntoskrnl/tests: New directory. * ntoskrnl/tests/tests: Ditto. * ntoskrnl/tests/.cvsignore: New file. * ntoskrnl/tests/Makefile: Ditto. * ntoskrnl/tests/setup.c: Ditto. * ntoskrnl/tests/stubs.tst: Ditto. * ntoskrnl/tests/tests/.cvsignore: Ditto. svn path=/trunk/; revision=11420
This commit is contained in:
parent
1dbfd30e1e
commit
b69a77aa97
11 changed files with 146 additions and 14 deletions
|
@ -1,3 +1,19 @@
|
|||
2004-10-24 Casper S. Hornstrup <chorns@users.sourceforge.net>
|
||||
|
||||
* ntoskrnl/Makefile (TARGET_REGTESTS): Define to yes.
|
||||
* regtests/regtests/regtests.c (_ExitProcess): Declare.
|
||||
* regtests/regtests/regtests.def (_ExitProcess@4): Ditto.
|
||||
* regtests/shared/regtests.h (_ExitProcess): Ditto.
|
||||
* tools/regtests.c: Exit process using _ExitProcess();
|
||||
Properly support fastcall symbols.
|
||||
* ntoskrnl/tests: New directory.
|
||||
* ntoskrnl/tests/tests: Ditto.
|
||||
* ntoskrnl/tests/.cvsignore: New file.
|
||||
* ntoskrnl/tests/Makefile: Ditto.
|
||||
* ntoskrnl/tests/setup.c: Ditto.
|
||||
* ntoskrnl/tests/stubs.tst: Ditto.
|
||||
* ntoskrnl/tests/tests/.cvsignore: Ditto.
|
||||
|
||||
2004-10-24 Casper S. Hornstrup <chorns@users.sourceforge.net>
|
||||
|
||||
* config (REGRESSIONTESTS): Remove.
|
||||
|
|
|
@ -4,6 +4,8 @@ PATH_TO_TOP := ..
|
|||
|
||||
include $(PATH_TO_TOP)/config
|
||||
|
||||
TARGET_REGTESTS = yes
|
||||
|
||||
TARGET_TYPE = kernel
|
||||
|
||||
TARGET_NAME = ntoskrnl
|
||||
|
|
9
reactos/ntoskrnl/tests/.cvsignore
Normal file
9
reactos/ntoskrnl/tests/.cvsignore
Normal file
|
@ -0,0 +1,9 @@
|
|||
_regtests.c
|
||||
_rtstub.c
|
||||
_hooks.c
|
||||
_stubs.S
|
||||
Makefile.tests
|
||||
*.d
|
||||
*.o
|
||||
*.a
|
||||
*.pch
|
25
reactos/ntoskrnl/tests/Makefile
Normal file
25
reactos/ntoskrnl/tests/Makefile
Normal file
|
@ -0,0 +1,25 @@
|
|||
PATH_TO_TOP = ../..
|
||||
|
||||
TARGET_TYPE = test
|
||||
|
||||
TARGET_NAME = regtests
|
||||
|
||||
TARGET_LIBPATH = .
|
||||
|
||||
TARGET_CFLAGS = -I$(REGTESTS_PATH_INC)
|
||||
|
||||
TARGET_LIBS = \
|
||||
../ntoskrnl.a \
|
||||
$(SDK_PATH_LIB)/rtl.a \
|
||||
$(SDK_PATH_LIB)/rosrtl.a \
|
||||
$(SDK_PATH_LIB)/pseh.a
|
||||
|
||||
-include Makefile.tests
|
||||
|
||||
TARGET_OBJECTS = \
|
||||
setup.o \
|
||||
$(addprefix tests/, $(TESTS))
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
5
reactos/ntoskrnl/tests/setup.c
Normal file
5
reactos/ntoskrnl/tests/setup.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include "regtests.h"
|
||||
|
||||
_SetupOnce()
|
||||
{
|
||||
}
|
59
reactos/ntoskrnl/tests/stubs.tst
Normal file
59
reactos/ntoskrnl/tests/stubs.tst
Normal file
|
@ -0,0 +1,59 @@
|
|||
hal.dll __divdi3
|
||||
hal.dll __udivdi3
|
||||
hal.dll __moddi3
|
||||
hal.dll __umoddi3
|
||||
hal.dll _init_end__
|
||||
hal.dll _init_start__
|
||||
hal.dll _text_end__
|
||||
hal.dll @ExAcquireFastMutex@4
|
||||
hal.dll @ExReleaseFastMutex@4
|
||||
hal.dll @ExTryToAcquireFastMutex@4
|
||||
hal.dll HalAcquireDisplayOwnership@4
|
||||
hal.dll HalAllocateAdapterChannel@16
|
||||
hal.dll HalAllocateCommonBuffer@16
|
||||
hal.dll HalAllProcessorsStarted@0
|
||||
hal.dll HalBeginSystemInterrupt@12
|
||||
hal.dll HalDisableSystemInterrupt@8
|
||||
hal.dll HalDisplayString@
|
||||
hal.dll HalDisplayString@4
|
||||
hal.dll HalEnableSystemInterrupt@12
|
||||
hal.dll HalEndSystemInterrupt@8
|
||||
hal.dll HalFreeCommonBuffer@24
|
||||
hal.dll HalGetAdapter@8
|
||||
hal.dll HalGetEnvironmentVariable@12
|
||||
hal.dll HalInitializeProcessor@8
|
||||
hal.dll HalInitSystem@8
|
||||
hal.dll HalQueryRealTimeClock@4
|
||||
hal.dll HalReadDmaCounter@4
|
||||
hal.dll HalReleaseDisplayOwnership@0
|
||||
hal.dll HalReportResourceUsage@0
|
||||
hal.dll @HalRequestSoftwareInterrupt@4
|
||||
hal.dll HalReturnToFirmware@4
|
||||
hal.dll HalSetEnvironmentVariable@8
|
||||
hal.dll HalSetRealTimeClock@4
|
||||
hal.dll IoAssignDriveLetters@16
|
||||
hal.dll IoFlushAdapterBuffers@24
|
||||
hal.dll IoFreeAdapterChannel@4
|
||||
hal.dll IoFreeMapRegisters@12
|
||||
hal.dll IoMapTransfer@24
|
||||
hal.dll KdPortGetByteEx@8
|
||||
hal.dll KdPortInitializeEx@12
|
||||
hal.dll KdPortPutByteEx@8
|
||||
hal.dll KeAcquireSpinLock@8
|
||||
hal.dll KeFlushWriteBuffer@0
|
||||
hal.dll KeGetCurrentIrql@0
|
||||
hal.dll KeLowerIrql@4
|
||||
hal.dll KeQueryPerformanceCounter@4
|
||||
hal.dll KeRaiseIrql@8
|
||||
hal.dll KeRaiseIrqlToDpcLevel@0
|
||||
hal.dll KeRaiseIrqlToSynchLevel@0
|
||||
hal.dll KeReleaseSpinLock@8
|
||||
hal.dll @KfAcquireSpinLock@4
|
||||
hal.dll @KfLowerIrql@4
|
||||
hal.dll @KfReleaseSpinLock@8
|
||||
hal.dll READ_PORT_UCHAR@4
|
||||
hal.dll READ_PORT_ULONG@4
|
||||
hal.dll READ_PORT_USHORT@4
|
||||
hal.dll WRITE_PORT_UCHAR@8
|
||||
hal.dll WRITE_PORT_ULONG@8
|
||||
hal.dll WRITE_PORT_USHORT@8
|
2
reactos/ntoskrnl/tests/tests/.cvsignore
Normal file
2
reactos/ntoskrnl/tests/tests/.cvsignore
Normal file
|
@ -0,0 +1,2 @@
|
|||
*.d
|
||||
*.o
|
|
@ -26,3 +26,9 @@ _LoadLibraryA(LPCSTR lpLibFileName)
|
|||
{
|
||||
return LoadLibraryA(lpLibFileName);
|
||||
}
|
||||
|
||||
VOID STDCALL
|
||||
_ExitProcess(UINT uExitCode)
|
||||
{
|
||||
ExitProcess(uExitCode);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
LIBRARY REGTESTS.DLL
|
||||
EXPORTS
|
||||
_ExitProcess@4
|
||||
_GetModuleHandleA@4
|
||||
_GetProcAddress@8
|
||||
_LoadLibraryA@4
|
||||
|
|
|
@ -171,6 +171,9 @@ _GetProcAddress(HMODULE hModule,
|
|||
HINSTANCE STDCALL
|
||||
_LoadLibraryA(LPCSTR lpLibFileName);
|
||||
|
||||
VOID STDCALL
|
||||
_ExitProcess(UINT uExitCode);
|
||||
|
||||
static inline PCHAR
|
||||
FrameworkGetExportedFunctionNameInternal(PAPI_DESCRIPTION ApiDescription)
|
||||
{
|
||||
|
|
|
@ -433,17 +433,6 @@ static char EXESTUB[] =
|
|||
"\n"
|
||||
"#include \"regtests.h\"\n"
|
||||
"\n"
|
||||
"#if defined(__USE_W32API)\n"
|
||||
" #define HANDLE PVOID\n"
|
||||
" #define NTSTATUS ULONG\n"
|
||||
"\n"
|
||||
" NTSTATUS STDCALL\n"
|
||||
" NtTerminateProcess(HANDLE ProcessHandle,\n"
|
||||
" NTSTATUS ExitStatus);\n"
|
||||
"\n"
|
||||
" #define NtCurrentProcess() ((HANDLE) 0xFFFFFFFF)\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
"void\n"
|
||||
"ConsoleWrite(char *Buffer)\n"
|
||||
"{\n"
|
||||
|
@ -460,7 +449,7 @@ static char EXESTUB[] =
|
|||
" RegisterTests();\n"
|
||||
" SetupOnce();\n"
|
||||
" PerformTests(ConsoleWrite, NULL);\n"
|
||||
" NtTerminateProcess (NtCurrentProcess(), 0);\n"
|
||||
" _ExitProcess(0);\n"
|
||||
" return 0;\n"
|
||||
"}\n";
|
||||
|
||||
|
@ -522,6 +511,18 @@ write_hooks_footer(FILE *hooks_out, unsigned long nr_stubs)
|
|||
fprintf(hooks_out, HOOKS_FOOTER, nr_stubs);
|
||||
}
|
||||
|
||||
char *
|
||||
get_symbolname(char *decoratedname)
|
||||
{
|
||||
char buf[300];
|
||||
|
||||
if (decoratedname[0] == '@')
|
||||
return strdup(decoratedname);
|
||||
strcpy(buf, "_");
|
||||
strcat(buf, decoratedname);
|
||||
return strdup(buf);
|
||||
}
|
||||
|
||||
char *
|
||||
get_undecorated_name(char *buf,
|
||||
char *decoratedname)
|
||||
|
@ -570,6 +571,7 @@ write_stub(FILE *stubs_out, FILE *hooks_out, char *dllname,
|
|||
char *p;
|
||||
char *decoratedname = NULL;
|
||||
char *forwardedexport = NULL;
|
||||
char *symbolname = NULL;
|
||||
|
||||
p = strtok(decoratedname_and_forward, "=");
|
||||
if (p != NULL)
|
||||
|
@ -585,8 +587,10 @@ write_stub(FILE *stubs_out, FILE *hooks_out, char *dllname,
|
|||
forwardedexport = decoratedname_and_forward;
|
||||
}
|
||||
|
||||
fprintf(stubs_out, ".globl _%s\n", decoratedname);
|
||||
fprintf(stubs_out, "_%s:\n", decoratedname);
|
||||
symbolname = get_symbolname(decoratedname);
|
||||
fprintf(stubs_out, ".globl %s\n", symbolname);
|
||||
fprintf(stubs_out, "%s:\n", symbolname);
|
||||
free(symbolname);
|
||||
fprintf(stubs_out, " pushl $%d\n", stub_index);
|
||||
fprintf(stubs_out, " jmp passthrough\n");
|
||||
fprintf(stubs_out, "\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue