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 HAL)
7 * Copyright 1996-1998 Marcus Meissner
15 #include "debugtools.h"
19 DEFAULT_DEBUG_CHANNEL(ntdll)
21 /* move to winbase.h */
22 typedef VOID (CALLBACK *PTIMERAPCROUTINE)(LPVOID lpArgToCompletionRoutine,DWORD dwTimerLowValue,DWORD dwTimerHighValue);
28 /**************************************************************************
29 * NtCreateTimer [NTDLL.87]
31 NTSTATUS WINAPI NtCreateTimer(
32 OUT PHANDLE TimerHandle,
33 IN ACCESS_MASK DesiredAccess,
34 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
35 IN TIMER_TYPE TimerType)
37 FIXME("(%p,0x%08lx,%p(%s),0x%08x) stub\n",
38 TimerHandle,DesiredAccess,ObjectAttributes,
39 ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL,
43 /**************************************************************************
44 * NtSetTimer [NTDLL.221]
46 NTSTATUS WINAPI NtSetTimer(
47 IN HANDLE TimerHandle,
48 IN PLARGE_INTEGER DueTime,
49 IN PTIMERAPCROUTINE TimerApcRoutine,
50 IN PVOID TimerContext,
52 IN ULONG Period OPTIONAL,
53 OUT PBOOLEAN PreviousState OPTIONAL)
55 FIXME("(0x%08x,%p,%p,%p,%08x,0x%08lx,%p) stub\n",
56 TimerHandle,DueTime,TimerApcRoutine,TimerContext,WakeTimer,Period,PreviousState);
60 /******************************************************************************
61 * NtQueryTimerResolution [NTDLL.129]
63 NTSTATUS WINAPI NtQueryTimerResolution(DWORD x1,DWORD x2,DWORD x3)
65 FIXME("(0x%08lx,0x%08lx,0x%08lx), stub!\n",x1,x2,x3);
73 /******************************************************************************
74 * NtTerminateProcess [NTDLL.]
76 * Native applications must kill themselves when done
77 * FIXME: return value 0-success
79 NTSTATUS WINAPI NtTerminateProcess(
83 TRACE("0x%08x 0x%08lx\n", ProcessHandle, ExitStatus );
85 /* win32 (0x7fffffff) to nt (-1) */
86 if ( NtCurrentProcess() == ProcessHandle )
87 ProcessHandle = GetCurrentProcess();
89 return (! TerminateProcess( ProcessHandle, ExitStatus ));
92 /******************************************************************************
93 * NtQueryInformationProcess [NTDLL.]
96 NTSTATUS WINAPI NtQueryInformationProcess(
97 IN HANDLE ProcessHandle,
98 IN PROCESSINFOCLASS ProcessInformationClass,
99 OUT PVOID ProcessInformation,
100 IN ULONG ProcessInformationLength,
101 OUT PULONG ReturnLength)
103 FIXME("(0x%08x,0x%08x,%p,0x%08lx,%p),stub!\n",
104 ProcessHandle,ProcessInformationClass,ProcessInformation,ProcessInformationLength,ReturnLength);
108 /******************************************************************************
109 * NtSetInformationProcess [NTDLL.207]
111 NTSTATUS WINAPI NtSetInformationProcess(
112 IN HANDLE ProcessHandle,
113 IN PROCESSINFOCLASS ProcessInformationClass,
114 IN PVOID ProcessInformation,
115 IN ULONG ProcessInformationLength)
117 FIXME("(0x%08x,0x%08x,%p,0x%08lx) stub\n",
118 ProcessHandle,ProcessInformationClass,ProcessInformation,ProcessInformationLength);
126 /******************************************************************************
127 * NtResumeThread [NTDLL]
129 NTSTATUS WINAPI NtResumeThread(
130 IN HANDLE ThreadHandle,
131 IN PULONG SuspendCount)
133 FIXME("(0x%08x,%p),stub!\n",
134 ThreadHandle,SuspendCount);
138 /******************************************************************************
139 * NtTerminateThread [NTDLL]
141 NTSTATUS WINAPI NtTerminateThread(
142 IN HANDLE ThreadHandle,
143 IN NTSTATUS ExitStatus)
145 if ( TerminateThread(ThreadHandle,ExitStatus) )
148 return 0xc0000000; /* FIXME: lasterror->ntstatus */
151 /******************************************************************************
152 * NtQueryInformationThread [NTDLL.]
155 NTSTATUS WINAPI NtQueryInformationThread(
156 IN HANDLE ThreadHandle,
157 IN THREADINFOCLASS ThreadInformationClass,
158 OUT PVOID ThreadInformation,
159 IN ULONG ThreadInformationLength,
160 OUT PULONG ReturnLength)
162 FIXME("(0x%08x,0x%08x,%p,0x%08lx,%p),stub!\n",
163 ThreadHandle, ThreadInformationClass, ThreadInformation,
164 ThreadInformationLength, ReturnLength);
168 /******************************************************************************
169 * NtSetInformationThread [NTDLL]
171 NTSTATUS WINAPI NtSetInformationThread(
173 THREADINFOCLASS ThreadInformationClass,
174 PVOID ThreadInformation,
175 ULONG ThreadInformationLength)
177 FIXME("(0x%08x,0x%08x,%p,0x%08lx),stub!\n",
178 ThreadHandle, ThreadInformationClass, ThreadInformation, ThreadInformationLength);
186 /******************************************************************************
187 * NtDuplicateToken [NTDLL]
189 NTSTATUS WINAPI NtDuplicateToken(
190 IN HANDLE ExistingToken,
191 IN ACCESS_MASK DesiredAccess,
192 IN POBJECT_ATTRIBUTES ObjectAttributes,
193 IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
194 IN TOKEN_TYPE TokenType,
195 OUT PHANDLE NewToken)
197 FIXME("(0x%08x,0x%08lx,%p,0x%08x,0x%08x,%p),stub!\n",
198 ExistingToken, DesiredAccess, ObjectAttributes, ImpersonationLevel,
199 TokenType, NewToken);
203 /******************************************************************************
204 * NtOpenProcessToken [NTDLL]
206 NTSTATUS WINAPI NtOpenProcessToken(
207 HANDLE ProcessHandle,
211 FIXME("(0x%08x,0x%08lx,%p): stub\n",
212 ProcessHandle,DesiredAccess, TokenHandle);
213 *TokenHandle = 0xcafe;
217 /******************************************************************************
218 * NtOpenThreadToken [NTDLL]
220 NTSTATUS WINAPI NtOpenThreadToken(
226 FIXME("(0x%08x,0x%08lx,0x%08x,%p): stub\n",
227 ThreadHandle,DesiredAccess, OpenAsSelf, TokenHandle);
228 *TokenHandle = 0xcafe;
232 /******************************************************************************
233 * NtAdjustPrivilegesToken [NTDLL]
235 * FIXME: parameters unsafe
237 NTSTATUS WINAPI NtAdjustPrivilegesToken(
238 IN HANDLE TokenHandle,
239 IN BOOLEAN DisableAllPrivileges,
240 IN PTOKEN_PRIVILEGES NewState,
241 IN DWORD BufferLength,
242 OUT PTOKEN_PRIVILEGES PreviousState,
243 OUT PDWORD ReturnLength)
245 FIXME("(0x%08x,0x%08x,%p,0x%08lx,%p,%p),stub!\n",
246 TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength);
250 /******************************************************************************
251 * NtQueryInformationToken [NTDLL.156]
254 NTSTATUS WINAPI NtQueryInformationToken(
256 DWORD tokeninfoclass,
258 DWORD tokeninfolength,
261 FIXME("(%08x,%ld,%p,%ld,%p): stub\n",
262 token,tokeninfoclass,tokeninfo,tokeninfolength,retlen);
264 switch (tokeninfoclass)
265 { case TokenGroups: /* 2 */
266 *retlen = sizeof (TOKEN_GROUPS);
268 case TokenUser: /* 1 */
269 case TokenPrivileges:
271 case TokenPrimaryGroup:
272 case TokenDefaultDacl:
275 case TokenImpersonationLevel:
276 case TokenStatistics:
287 /******************************************************************************
288 * NtCreateSection [NTDLL]
290 NTSTATUS WINAPI NtCreateSection(
291 OUT PHANDLE SectionHandle,
292 IN ACCESS_MASK DesiredAccess,
293 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
294 IN PLARGE_INTEGER MaximumSize OPTIONAL,
295 IN ULONG SectionPageProtection OPTIONAL,
296 IN ULONG AllocationAttributes,
297 IN HANDLE FileHandle OPTIONAL)
299 FIXME("(%p,0x%08lx,%p(%s),%p,0x%08lx,0x%08lx,0x%08x) stub\n",
300 SectionHandle,DesiredAccess,ObjectAttributes,
301 ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL,
302 MaximumSize,SectionPageProtection,AllocationAttributes,FileHandle);
306 /******************************************************************************
307 * NtOpenSection [NTDLL]
309 NTSTATUS WINAPI NtOpenSection(
310 PHANDLE SectionHandle,
311 ACCESS_MASK DesiredAccess,
312 POBJECT_ATTRIBUTES ObjectAttributes)
314 FIXME("(%p,0x%08lx,%p(%s)),stub!\n",
315 SectionHandle,DesiredAccess,ObjectAttributes,
316 ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL);
320 /******************************************************************************
321 * NtQuerySection [NTDLL]
323 NTSTATUS WINAPI NtQuerySection(
324 IN HANDLE SectionHandle,
325 IN PVOID SectionInformationClass,
326 OUT PVOID SectionInformation,
328 OUT PULONG ResultLength)
330 FIXME("(0x%08x,%p,%p,0x%08lx,%p) stub!\n",
331 SectionHandle,SectionInformationClass,SectionInformation,Length,ResultLength);
335 /******************************************************************************
336 * NtMapViewOfSection [NTDLL]
337 * FUNCTION: Maps a view of a section into the virtual address space of a process
340 * SectionHandle Handle of the section
341 * ProcessHandle Handle of the process
342 * BaseAddress Desired base address (or NULL) on entry
343 * Actual base address of the view on exit
344 * ZeroBits Number of high order address bits that must be zero
345 * CommitSize Size in bytes of the initially committed section of the view
346 * SectionOffset Offset in bytes from the beginning of the section to the beginning of the view
347 * ViewSize Desired length of map (or zero to map all) on entry
348 Actual length mapped on exit
349 * InheritDisposition Specified how the view is to be shared with
351 * AllocateType Type of allocation for the pages
352 * Protect Protection for the committed region of the view
354 NTSTATUS WINAPI NtMapViewOfSection(
355 HANDLE SectionHandle,
356 HANDLE ProcessHandle,
360 PLARGE_INTEGER SectionOffset,
362 SECTION_INHERIT InheritDisposition,
363 ULONG AllocationType,
366 FIXME("(0x%08x,0x%08x,%p,0x%08lx,0x%08lx,%p,%p,0x%08x,0x%08lx,0x%08lx) stub\n",
367 SectionHandle,ProcessHandle,BaseAddress,ZeroBits,CommitSize,SectionOffset,
368 ViewSize,InheritDisposition,AllocationType,Protect);
376 /******************************************************************************
377 * NtCreatePort [NTDLL]
379 NTSTATUS WINAPI NtCreatePort(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5)
381 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5);
385 /******************************************************************************
386 * NtConnectPort [NTDLL]
388 NTSTATUS WINAPI NtConnectPort(DWORD x1,PUNICODE_STRING uni,DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8)
390 FIXME("(0x%08lx,%s,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",
391 x1,debugstr_w(uni->Buffer),x3,x4,x5,x6,x7,x8);
395 /******************************************************************************
396 * NtListenPort [NTDLL]
398 NTSTATUS WINAPI NtListenPort(DWORD x1,DWORD x2)
400 FIXME("(0x%08lx,0x%08lx),stub!\n",x1,x2);
404 /******************************************************************************
405 * NtAcceptConnectPort [NTDLL]
407 NTSTATUS WINAPI NtAcceptConnectPort(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6)
409 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5,x6);
413 /******************************************************************************
414 * NtCompleteConnectPort [NTDLL]
416 NTSTATUS WINAPI NtCompleteConnectPort(DWORD x1)
418 FIXME("(0x%08lx),stub!\n",x1);
422 /******************************************************************************
423 * NtRegisterThreadTerminatePort [NTDLL]
425 NTSTATUS WINAPI NtRegisterThreadTerminatePort(DWORD x1)
427 FIXME("(0x%08lx),stub!\n",x1);
431 /******************************************************************************
432 * NtRequestWaitReplyPort [NTDLL]
434 NTSTATUS WINAPI NtRequestWaitReplyPort(DWORD x1,DWORD x2,DWORD x3)
436 FIXME("(0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3);
440 /******************************************************************************
441 * NtReplyWaitReceivePort [NTDLL]
443 NTSTATUS WINAPI NtReplyWaitReceivePort(DWORD x1,DWORD x2,DWORD x3,DWORD x4)
445 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4);
453 /******************************************************************************
454 * NtSetIntervalProfile [NTDLL]
456 NTSTATUS WINAPI NtSetIntervalProfile(DWORD x1,DWORD x2) {
457 FIXME("(0x%08lx,0x%08lx),stub!\n",x1,x2);
461 /******************************************************************************
462 * NtQueryPerformanceCounter [NTDLL]
464 NTSTATUS WINAPI NtQueryPerformanceCounter(
465 IN PLARGE_INTEGER Counter,
466 IN PLARGE_INTEGER Frequency)
468 FIXME("(%p, 0%p) stub\n",
473 /******************************************************************************
474 * NtCreateMailSlotFile [NTDLL]
476 NTSTATUS WINAPI NtCreateMailslotFile(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8)
478 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5,x6,x7,x8);
482 /******************************************************************************
483 * NtQuerySystemInformation [NTDLL.168]
486 * SystemInformationClass Index to a certain information structure
487 * SystemTimeAdjustmentInformation SYSTEM_TIME_ADJUSTMENT
488 * SystemCacheInformation SYSTEM_CACHE_INFORMATION
489 * SystemConfigurationInformation CONFIGURATION_INFORMATION
490 * observed (class/len):
495 * SystemInformation caller supplies storage for the information structure
496 * Length size of the structure
497 * ResultLength Data written
499 NTSTATUS WINAPI NtQuerySystemInformation(
500 IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
501 OUT PVOID SystemInformation,
503 OUT PULONG ResultLength)
505 FIXME("(0x%08x,%p,0x%08lx,%p) stub\n",
506 SystemInformationClass,SystemInformation,Length,ResultLength);
507 ZeroMemory (SystemInformation, Length);
512 /******************************************************************************
513 * NtCreatePagingFile [NTDLL]
515 NTSTATUS WINAPI NtCreatePagingFile(
516 IN PUNICODE_STRING PageFileName,
519 OUT PULONG ActualSize)
521 FIXME("(%p(%s),0x%08lx,0x%08lx,%p),stub!\n",
522 PageFileName->Buffer, debugstr_w(PageFileName->Buffer),MiniumSize,MaxiumSize,ActualSize);
526 /******************************************************************************
527 * NtDisplayString [NTDLL.95]
529 * writes a string to the nt-textmode screen eg. during startup
531 NTSTATUS WINAPI NtDisplayString (
532 PUNICODE_STRING string)
534 TRACE("%p(%s)\n",string->Buffer, debugstr_w(string->Buffer));
535 WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), string->Buffer, string->Length, 0, 0);