wine/dlls/ntdll/process.c
Eric Pouech c3e6c095e1 Implemented kernel32.GetIoProcessCounters and stubbed
ntdll.NtQueryProcessInformation(ProcessIoCounters).
2003-09-19 00:06:45 +00:00

136 lines
3.9 KiB
C

/*
* NT basis DLL
*
* This file contains the Nt* API functions of NTDLL.DLL.
* In the original ntdll.dll they all seem to just call int 0x2e (down to the NTOSKRNL)
*
* Copyright 1996-1998 Marcus Meissner
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "wine/debug.h"
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winternl.h"
#include "ntdll_misc.h"
#include "wine/server.h"
WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
/*
* Process object
*/
/******************************************************************************
* NtTerminateProcess [NTDLL.@]
*
* Native applications must kill themselves when done
*/
NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code )
{
NTSTATUS ret;
BOOL self;
SERVER_START_REQ( terminate_process )
{
req->handle = handle;
req->exit_code = exit_code;
ret = wine_server_call( req );
self = !ret && reply->self;
}
SERVER_END_REQ;
if (self) exit( exit_code );
return ret;
}
/******************************************************************************
* NtQueryInformationProcess [NTDLL.@]
* ZwQueryInformationProcess [NTDLL.@]
*
*/
NTSTATUS WINAPI NtQueryInformationProcess(
IN HANDLE ProcessHandle,
IN PROCESSINFOCLASS ProcessInformationClass,
OUT PVOID ProcessInformation,
IN ULONG ProcessInformationLength,
OUT PULONG ReturnLength)
{
NTSTATUS ret = STATUS_SUCCESS;
ULONG len = 0;
switch (ProcessInformationClass)
{
case ProcessIoCounters:
if (ProcessInformationLength == sizeof(IO_COUNTERS))
{
memset(ProcessInformation, 0, ProcessInformationLength);
len = sizeof(IO_COUNTERS);
}
else ret = STATUS_INFO_LENGTH_MISMATCH;
break;
case ProcessDebugPort:
/* "These are not the debuggers you are looking for." *
* set it to 0 aka "no debugger" to satisfy copy protections */
if (ProcessInformationLength == 4)
{
memset(ProcessInformation, 0 ,ProcessInformationLength);
len = 4;
}
else ret = STATUS_INFO_LENGTH_MISMATCH;
break;
case ProcessWow64Information:
if (ProcessInformationLength == 4)
{
memset(ProcessInformation, 0, ProcessInformationLength);
len = 4;
}
else ret = STATUS_INFO_LENGTH_MISMATCH;
break;
default:
FIXME("(%p,0x%08x,%p,0x%08lx,%p),stub!\n",
ProcessHandle,ProcessInformationClass,
ProcessInformation,ProcessInformationLength,
ReturnLength);
ret = STATUS_NOT_IMPLEMENTED;
break;
}
if (ReturnLength) *ReturnLength = len;
return ret;
}
/******************************************************************************
* NtSetInformationProcess [NTDLL.@]
* ZwSetInformationProcess [NTDLL.@]
*/
NTSTATUS WINAPI NtSetInformationProcess(
IN HANDLE ProcessHandle,
IN PROCESSINFOCLASS ProcessInformationClass,
IN PVOID ProcessInformation,
IN ULONG ProcessInformationLength)
{
FIXME("(%p,0x%08x,%p,0x%08lx) stub\n",
ProcessHandle,ProcessInformationClass,ProcessInformation,ProcessInformationLength);
return 0;
}