Release 20040408.
[wine.git] / dlls / ntdll / process.c
blobb85e4735e6323fe3007834f6512380fc2ac948ab
1 /*
2 * NT basis DLL
4 * This file contains the Nt* API functions of NTDLL.DLL.
5 * In the original ntdll.dll they all seem to just call int 0x2e (down to the NTOSKRNL)
7 * Copyright 1996-1998 Marcus Meissner
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include <stdarg.h>
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <time.h>
29 #include "wine/debug.h"
31 #include "windef.h"
32 #include "winbase.h"
33 #include "winreg.h"
34 #include "winternl.h"
35 #include "ntdll_misc.h"
36 #include "wine/server.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
41 * Process object
44 /******************************************************************************
45 * NtTerminateProcess [NTDLL.@]
47 * Native applications must kill themselves when done
49 NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code )
51 NTSTATUS ret;
52 BOOL self;
53 SERVER_START_REQ( terminate_process )
55 req->handle = handle;
56 req->exit_code = exit_code;
57 ret = wine_server_call( req );
58 self = !ret && reply->self;
60 SERVER_END_REQ;
61 if (self) exit( exit_code );
62 return ret;
65 /******************************************************************************
66 * NtQueryInformationProcess [NTDLL.@]
67 * ZwQueryInformationProcess [NTDLL.@]
70 NTSTATUS WINAPI NtQueryInformationProcess(
71 IN HANDLE ProcessHandle,
72 IN PROCESSINFOCLASS ProcessInformationClass,
73 OUT PVOID ProcessInformation,
74 IN ULONG ProcessInformationLength,
75 OUT PULONG ReturnLength)
77 NTSTATUS ret = STATUS_SUCCESS;
78 ULONG len = 0;
80 switch (ProcessInformationClass)
82 case ProcessIoCounters:
83 if (ProcessInformationLength == sizeof(IO_COUNTERS))
85 memset(ProcessInformation, 0, ProcessInformationLength);
86 len = sizeof(IO_COUNTERS);
88 else ret = STATUS_INFO_LENGTH_MISMATCH;
89 break;
90 case ProcessDebugPort:
91 /* "These are not the debuggers you are looking for." *
92 * set it to 0 aka "no debugger" to satisfy copy protections */
93 if (ProcessInformationLength == 4)
95 memset(ProcessInformation, 0 ,ProcessInformationLength);
96 len = 4;
98 else ret = STATUS_INFO_LENGTH_MISMATCH;
99 break;
100 case ProcessWow64Information:
101 if (ProcessInformationLength == 4)
103 memset(ProcessInformation, 0, ProcessInformationLength);
104 len = 4;
106 else ret = STATUS_INFO_LENGTH_MISMATCH;
107 break;
108 default:
109 FIXME("(%p,0x%08x,%p,0x%08lx,%p),stub!\n",
110 ProcessHandle,ProcessInformationClass,
111 ProcessInformation,ProcessInformationLength,
112 ReturnLength);
113 ret = STATUS_NOT_IMPLEMENTED;
114 break;
117 if (ReturnLength) *ReturnLength = len;
119 return ret;
122 /******************************************************************************
123 * NtSetInformationProcess [NTDLL.@]
124 * ZwSetInformationProcess [NTDLL.@]
126 NTSTATUS WINAPI NtSetInformationProcess(
127 IN HANDLE ProcessHandle,
128 IN PROCESSINFOCLASS ProcessInformationClass,
129 IN PVOID ProcessInformation,
130 IN ULONG ProcessInformationLength)
132 FIXME("(%p,0x%08x,%p,0x%08lx) stub\n",
133 ProcessHandle,ProcessInformationClass,ProcessInformation,ProcessInformationLength);
134 return 0;