From d1f10c50efc139fab092d2dc0e8cd4fd859e90a4 Mon Sep 17 00:00:00 2001 From: Juergen Schmied Date: Sun, 11 Apr 1999 14:53:24 +0000 Subject: [PATCH] Implemented NtTerminateProcess and NtDisplayString. --- dlls/ntdll/nt.c | 35 +++++++++++++++++++++++++++++++++-- dlls/ntdll/rtlstr.c | 2 ++ include/ntddk.h | 1 + relay32/ntdll.spec | 4 ++-- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c index 9d2bc22bbb0..d085ca17d41 100644 --- a/dlls/ntdll/nt.c +++ b/dlls/ntdll/nt.c @@ -67,6 +67,25 @@ NTSTATUS WINAPI NtQueryTimerResolution(DWORD x1,DWORD x2,DWORD x3) * Process object */ +/****************************************************************************** + * NtTerminateProcess [NTDLL.] + * + * Native applications must kill themselves when done + * FIXME: return value 0-success + */ +NTSTATUS WINAPI NtTerminateProcess( + HANDLE ProcessHandle, + LONG ExitStatus) +{ + TRACE(ntdll, "0x%08x 0x%08lx\n", ProcessHandle, ExitStatus ); + + /* win32 (0x7fffffff) to nt (-1) */ + if ( NtCurrentProcess() == ProcessHandle ) + ProcessHandle = GetCurrentProcess(); + + return (! TerminateProcess( ProcessHandle, ExitStatus )); +} + /****************************************************************************** * NtQueryInformationProcess [NTDLL.] * @@ -495,8 +514,20 @@ NTSTATUS WINAPI NtCreatePagingFile( IN ULONG MaxiumSize, OUT PULONG ActualSize) { - FIXME(ntdll,"(%p,0x%08lx,0x%08lx,%p),stub!\n", - debugstr_w(PageFileName->Buffer),MiniumSize,MaxiumSize,ActualSize); + FIXME(ntdll,"(%p(%s),0x%08lx,0x%08lx,%p),stub!\n", + PageFileName->Buffer, debugstr_w(PageFileName->Buffer),MiniumSize,MaxiumSize,ActualSize); return 0; } +/****************************************************************************** + * NtDisplayString [NTDLL.95] + * + * writes a string to the nt-textmode screen eg. during startup + */ +NTSTATUS WINAPI NtDisplayString ( + PUNICODE_STRING string) +{ + TRACE(ntdll,"%p(%s)\n",string->Buffer, debugstr_w(string->Buffer)); + WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), string->Buffer, string->Length, 0, 0); + return 0; +} diff --git a/dlls/ntdll/rtlstr.c b/dlls/ntdll/rtlstr.c index 0b4e1652950..8a177ebebf5 100644 --- a/dlls/ntdll/rtlstr.c +++ b/dlls/ntdll/rtlstr.c @@ -136,6 +136,8 @@ VOID WINAPI RtlInitString(PSTRING target,LPCSTR source) */ VOID WINAPI RtlInitUnicodeString(PUNICODE_STRING target,LPCWSTR source) { + TRACE(ntdll,"%p %p(%s)\n", target, source, debugstr_w(source)); + target->Length = target->MaximumLength = 0; target->Buffer = (LPWSTR)source; if (!source) diff --git a/include/ntddk.h b/include/ntddk.h index e8997f5f179..898b1f40df0 100644 --- a/include/ntddk.h +++ b/include/ntddk.h @@ -291,6 +291,7 @@ NTSTATUS WINAPI NtQueryInformationProcess( IN ULONG ProcessInformationLength, OUT PULONG ReturnLength); +#define NtCurrentProcess() ( (HANDLE) -1 ) /* * timer diff --git a/relay32/ntdll.spec b/relay32/ntdll.spec index 5e561ddad4f..8dabefb4e8b 100644 --- a/relay32/ntdll.spec +++ b/relay32/ntdll.spec @@ -100,7 +100,7 @@ type win32 092 stub NtDeleteKey 093 stub NtDeleteValueKey 094 stdcall NtDeviceIoControlFile(long long long long long long long long long long) NtDeviceIoControlFile -095 stub NtDisplayString +095 stdcall NtDisplayString(ptr)NtDisplayString 096 stdcall NtDuplicateObject(long long long long long long long) NtDuplicateObject 097 stdcall NtDuplicateToken(long long long long long long) NtDuplicateToken 098 stub NtEnumerateBus @@ -235,7 +235,7 @@ type win32 227 stub NtStopProfile 228 stub NtSuspendThread 229 stub NtSystemDebugControl -230 stub NtTerminateProcess +230 stdcall NtTerminateProcess(long long)NtTerminateProcess 231 stdcall NtTerminateThread(long long) NtTerminateThread 232 stub NtTestAlert 233 stub NtUnloadDriver