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"
18 #include "ntdll_misc.h"
20 DEFAULT_DEBUG_CHANNEL(ntdll)
26 /**************************************************************************
27 * NtCreateTimer [NTDLL.87]
29 NTSTATUS WINAPI NtCreateTimer(
30 OUT PHANDLE TimerHandle,
31 IN ACCESS_MASK DesiredAccess,
32 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
33 IN TIMER_TYPE TimerType)
35 FIXME("(%p,0x%08lx,%p,0x%08x) stub\n",
36 TimerHandle,DesiredAccess,ObjectAttributes, TimerType);
37 dump_ObjectAttributes(ObjectAttributes);
40 /**************************************************************************
41 * NtSetTimer [NTDLL.221]
43 NTSTATUS WINAPI NtSetTimer(
44 IN HANDLE TimerHandle,
45 IN PLARGE_INTEGER DueTime,
46 IN PTIMERAPCROUTINE TimerApcRoutine,
47 IN PVOID TimerContext,
49 IN ULONG Period OPTIONAL,
50 OUT PBOOLEAN PreviousState OPTIONAL)
52 FIXME("(0x%08x,%p,%p,%p,%08x,0x%08lx,%p) stub\n",
53 TimerHandle,DueTime,TimerApcRoutine,TimerContext,WakeTimer,Period,PreviousState);
57 /******************************************************************************
58 * NtQueryTimerResolution [NTDLL.129]
60 NTSTATUS WINAPI NtQueryTimerResolution(DWORD x1,DWORD x2,DWORD x3)
62 FIXME("(0x%08lx,0x%08lx,0x%08lx), stub!\n",x1,x2,x3);
70 /******************************************************************************
71 * NtTerminateProcess [NTDLL.]
73 * Native applications must kill themselves when done
74 * FIXME: return value 0-success
76 NTSTATUS WINAPI NtTerminateProcess(
80 TRACE("0x%08x 0x%08lx\n", ProcessHandle, ExitStatus );
82 /* win32 (0x7fffffff) to nt (-1) */
83 if ( NtCurrentProcess() == ProcessHandle )
84 ProcessHandle = GetCurrentProcess();
86 return (! TerminateProcess( ProcessHandle, ExitStatus ));
89 /******************************************************************************
90 * NtQueryInformationProcess [NTDLL.]
93 NTSTATUS WINAPI NtQueryInformationProcess(
94 IN HANDLE ProcessHandle,
95 IN PROCESSINFOCLASS ProcessInformationClass,
96 OUT PVOID ProcessInformation,
97 IN ULONG ProcessInformationLength,
98 OUT PULONG ReturnLength)
100 FIXME("(0x%08x,0x%08x,%p,0x%08lx,%p),stub!\n",
101 ProcessHandle,ProcessInformationClass,ProcessInformation,ProcessInformationLength,ReturnLength);
105 /******************************************************************************
106 * NtSetInformationProcess [NTDLL.207]
108 NTSTATUS WINAPI NtSetInformationProcess(
109 IN HANDLE ProcessHandle,
110 IN PROCESSINFOCLASS ProcessInformationClass,
111 IN PVOID ProcessInformation,
112 IN ULONG ProcessInformationLength)
114 FIXME("(0x%08x,0x%08x,%p,0x%08lx) stub\n",
115 ProcessHandle,ProcessInformationClass,ProcessInformation,ProcessInformationLength);
123 /******************************************************************************
124 * NtResumeThread [NTDLL]
126 NTSTATUS WINAPI NtResumeThread(
127 IN HANDLE ThreadHandle,
128 IN PULONG SuspendCount)
130 FIXME("(0x%08x,%p),stub!\n",
131 ThreadHandle,SuspendCount);
135 /******************************************************************************
136 * NtTerminateThread [NTDLL]
138 NTSTATUS WINAPI NtTerminateThread(
139 IN HANDLE ThreadHandle,
140 IN NTSTATUS ExitStatus)
142 if ( TerminateThread(ThreadHandle,ExitStatus) )
145 return 0xc0000000; /* FIXME: lasterror->ntstatus */
148 /******************************************************************************
149 * NtQueryInformationThread [NTDLL.]
152 NTSTATUS WINAPI NtQueryInformationThread(
153 IN HANDLE ThreadHandle,
154 IN THREADINFOCLASS ThreadInformationClass,
155 OUT PVOID ThreadInformation,
156 IN ULONG ThreadInformationLength,
157 OUT PULONG ReturnLength)
159 FIXME("(0x%08x,0x%08x,%p,0x%08lx,%p),stub!\n",
160 ThreadHandle, ThreadInformationClass, ThreadInformation,
161 ThreadInformationLength, ReturnLength);
165 /******************************************************************************
166 * NtSetInformationThread [NTDLL]
168 NTSTATUS WINAPI NtSetInformationThread(
170 THREADINFOCLASS ThreadInformationClass,
171 PVOID ThreadInformation,
172 ULONG ThreadInformationLength)
174 FIXME("(0x%08x,0x%08x,%p,0x%08lx),stub!\n",
175 ThreadHandle, ThreadInformationClass, ThreadInformation, ThreadInformationLength);
183 /******************************************************************************
184 * NtDuplicateToken [NTDLL]
186 NTSTATUS WINAPI NtDuplicateToken(
187 IN HANDLE ExistingToken,
188 IN ACCESS_MASK DesiredAccess,
189 IN POBJECT_ATTRIBUTES ObjectAttributes,
190 IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
191 IN TOKEN_TYPE TokenType,
192 OUT PHANDLE NewToken)
194 FIXME("(0x%08x,0x%08lx,%p,0x%08x,0x%08x,%p),stub!\n",
195 ExistingToken, DesiredAccess, ObjectAttributes,
196 ImpersonationLevel, TokenType, NewToken);
197 dump_ObjectAttributes(ObjectAttributes);
201 /******************************************************************************
202 * NtOpenProcessToken [NTDLL]
204 NTSTATUS WINAPI NtOpenProcessToken(
205 HANDLE ProcessHandle,
209 FIXME("(0x%08x,0x%08lx,%p): stub\n",
210 ProcessHandle,DesiredAccess, TokenHandle);
211 *TokenHandle = 0xcafe;
215 /******************************************************************************
216 * NtOpenThreadToken [NTDLL]
218 NTSTATUS WINAPI NtOpenThreadToken(
224 FIXME("(0x%08x,0x%08lx,0x%08x,%p): stub\n",
225 ThreadHandle,DesiredAccess, OpenAsSelf, TokenHandle);
226 *TokenHandle = 0xcafe;
230 /******************************************************************************
231 * NtAdjustPrivilegesToken [NTDLL]
233 * FIXME: parameters unsafe
235 NTSTATUS WINAPI NtAdjustPrivilegesToken(
236 IN HANDLE TokenHandle,
237 IN BOOLEAN DisableAllPrivileges,
238 IN PTOKEN_PRIVILEGES NewState,
239 IN DWORD BufferLength,
240 OUT PTOKEN_PRIVILEGES PreviousState,
241 OUT PDWORD ReturnLength)
243 FIXME("(0x%08x,0x%08x,%p,0x%08lx,%p,%p),stub!\n",
244 TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength);
248 /******************************************************************************
249 * NtQueryInformationToken [NTDLL.156]
252 * Buffer for TokenUser:
253 * 0x00 TOKEN_USER the PSID field points to the SID
257 NTSTATUS WINAPI NtQueryInformationToken(
259 DWORD tokeninfoclass,
261 DWORD tokeninfolength,
264 FIXME("(%08x,%ld,%p,%ld,%p): stub\n",
265 token,tokeninfoclass,tokeninfo,tokeninfolength,retlen);
267 switch (tokeninfoclass)
268 { case TokenGroups: /* 2 */
269 *retlen = sizeof (TOKEN_GROUPS);
271 case TokenUser: /* 1 */
273 int len = sizeof (TOKEN_USER)+ sizeof(SID);
275 if ( len <= tokeninfolength)
278 TOKEN_USER * tuser = tokeninfo;
279 PSID sid = (PSID) &((LPBYTE)tokeninfo)[sizeof(TOKEN_USER)];
280 SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
281 RtlInitializeSid(sid, &localSidAuthority, 1);
282 *(RtlSubAuthoritySid(sid, 0)) = SECURITY_INTERACTIVE_RID;
283 tuser->User.Sid = sid;
287 case TokenPrivileges:
288 *retlen = sizeof (TOKEN_PRIVILEGES);
291 *retlen = sizeof (TOKEN_OWNER);
293 case TokenPrimaryGroup:
294 *retlen = sizeof (TOKEN_PRIMARY_GROUP);
296 case TokenDefaultDacl:
297 *retlen = sizeof (TOKEN_DEFAULT_DACL);
300 *retlen = sizeof (TOKEN_SOURCE);
303 *retlen = sizeof (TOKEN_TYPE);
306 case TokenImpersonationLevel:
307 case TokenStatistics:
318 /******************************************************************************
319 * NtCreateSection [NTDLL]
321 NTSTATUS WINAPI NtCreateSection(
322 OUT PHANDLE SectionHandle,
323 IN ACCESS_MASK DesiredAccess,
324 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
325 IN PLARGE_INTEGER MaximumSize OPTIONAL,
326 IN ULONG SectionPageProtection OPTIONAL,
327 IN ULONG AllocationAttributes,
328 IN HANDLE FileHandle OPTIONAL)
330 FIXME("(%p,0x%08lx,%p,%p,0x%08lx,0x%08lx,0x%08x) stub\n",
331 SectionHandle,DesiredAccess, ObjectAttributes,
332 MaximumSize,SectionPageProtection,AllocationAttributes,FileHandle);
333 dump_ObjectAttributes(ObjectAttributes);
337 /******************************************************************************
338 * NtOpenSection [NTDLL]
340 NTSTATUS WINAPI NtOpenSection(
341 PHANDLE SectionHandle,
342 ACCESS_MASK DesiredAccess,
343 POBJECT_ATTRIBUTES ObjectAttributes)
345 FIXME("(%p,0x%08lx,%p),stub!\n",
346 SectionHandle,DesiredAccess,ObjectAttributes);
347 dump_ObjectAttributes(ObjectAttributes);
351 /******************************************************************************
352 * NtQuerySection [NTDLL]
354 NTSTATUS WINAPI NtQuerySection(
355 IN HANDLE SectionHandle,
356 IN PVOID SectionInformationClass,
357 OUT PVOID SectionInformation,
359 OUT PULONG ResultLength)
361 FIXME("(0x%08x,%p,%p,0x%08lx,%p) stub!\n",
362 SectionHandle,SectionInformationClass,SectionInformation,Length,ResultLength);
366 /******************************************************************************
367 * NtMapViewOfSection [NTDLL]
368 * FUNCTION: Maps a view of a section into the virtual address space of a process
371 * SectionHandle Handle of the section
372 * ProcessHandle Handle of the process
373 * BaseAddress Desired base address (or NULL) on entry
374 * Actual base address of the view on exit
375 * ZeroBits Number of high order address bits that must be zero
376 * CommitSize Size in bytes of the initially committed section of the view
377 * SectionOffset Offset in bytes from the beginning of the section to the beginning of the view
378 * ViewSize Desired length of map (or zero to map all) on entry
379 Actual length mapped on exit
380 * InheritDisposition Specified how the view is to be shared with
382 * AllocateType Type of allocation for the pages
383 * Protect Protection for the committed region of the view
385 NTSTATUS WINAPI NtMapViewOfSection(
386 HANDLE SectionHandle,
387 HANDLE ProcessHandle,
391 PLARGE_INTEGER SectionOffset,
393 SECTION_INHERIT InheritDisposition,
394 ULONG AllocationType,
397 FIXME("(0x%08x,0x%08x,%p,0x%08lx,0x%08lx,%p,%p,0x%08x,0x%08lx,0x%08lx) stub\n",
398 SectionHandle,ProcessHandle,BaseAddress,ZeroBits,CommitSize,SectionOffset,
399 ViewSize,InheritDisposition,AllocationType,Protect);
407 /******************************************************************************
408 * NtCreatePort [NTDLL]
410 NTSTATUS WINAPI NtCreatePort(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5)
412 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5);
416 /******************************************************************************
417 * NtConnectPort [NTDLL]
419 NTSTATUS WINAPI NtConnectPort(DWORD x1,PUNICODE_STRING uni,DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8)
421 FIXME("(0x%08lx,%s,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",
422 x1,debugstr_w(uni->Buffer),x3,x4,x5,x6,x7,x8);
426 /******************************************************************************
427 * NtListenPort [NTDLL]
429 NTSTATUS WINAPI NtListenPort(DWORD x1,DWORD x2)
431 FIXME("(0x%08lx,0x%08lx),stub!\n",x1,x2);
435 /******************************************************************************
436 * NtAcceptConnectPort [NTDLL]
438 NTSTATUS WINAPI NtAcceptConnectPort(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6)
440 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5,x6);
444 /******************************************************************************
445 * NtCompleteConnectPort [NTDLL]
447 NTSTATUS WINAPI NtCompleteConnectPort(DWORD x1)
449 FIXME("(0x%08lx),stub!\n",x1);
453 /******************************************************************************
454 * NtRegisterThreadTerminatePort [NTDLL]
456 NTSTATUS WINAPI NtRegisterThreadTerminatePort(DWORD x1)
458 FIXME("(0x%08lx),stub!\n",x1);
462 /******************************************************************************
463 * NtRequestWaitReplyPort [NTDLL]
465 NTSTATUS WINAPI NtRequestWaitReplyPort(DWORD x1,DWORD x2,DWORD x3)
467 FIXME("(0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3);
471 /******************************************************************************
472 * NtReplyWaitReceivePort [NTDLL]
474 NTSTATUS WINAPI NtReplyWaitReceivePort(DWORD x1,DWORD x2,DWORD x3,DWORD x4)
476 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4);
484 /******************************************************************************
485 * NtSetIntervalProfile [NTDLL]
487 NTSTATUS WINAPI NtSetIntervalProfile(DWORD x1,DWORD x2) {
488 FIXME("(0x%08lx,0x%08lx),stub!\n",x1,x2);
492 /******************************************************************************
493 * NtQueryPerformanceCounter [NTDLL]
495 NTSTATUS WINAPI NtQueryPerformanceCounter(
496 IN PLARGE_INTEGER Counter,
497 IN PLARGE_INTEGER Frequency)
499 FIXME("(%p, 0%p) stub\n",
504 /******************************************************************************
505 * NtCreateMailSlotFile [NTDLL]
507 NTSTATUS WINAPI NtCreateMailslotFile(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8)
509 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);
513 /******************************************************************************
514 * NtQuerySystemInformation [NTDLL.168]
517 * SystemInformationClass Index to a certain information structure
518 * SystemTimeAdjustmentInformation SYSTEM_TIME_ADJUSTMENT
519 * SystemCacheInformation SYSTEM_CACHE_INFORMATION
520 * SystemConfigurationInformation CONFIGURATION_INFORMATION
521 * observed (class/len):
526 * SystemInformation caller supplies storage for the information structure
527 * Length size of the structure
528 * ResultLength Data written
530 NTSTATUS WINAPI NtQuerySystemInformation(
531 IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
532 OUT PVOID SystemInformation,
534 OUT PULONG ResultLength)
536 FIXME("(0x%08x,%p,0x%08lx,%p) stub\n",
537 SystemInformationClass,SystemInformation,Length,ResultLength);
538 ZeroMemory (SystemInformation, Length);
543 /******************************************************************************
544 * NtCreatePagingFile [NTDLL]
546 NTSTATUS WINAPI NtCreatePagingFile(
547 IN PUNICODE_STRING PageFileName,
550 OUT PULONG ActualSize)
552 FIXME("(%p(%s),0x%08lx,0x%08lx,%p),stub!\n",
553 PageFileName->Buffer, debugstr_w(PageFileName->Buffer),MiniumSize,MaxiumSize,ActualSize);
557 /******************************************************************************
558 * NtDisplayString [NTDLL.95]
560 * writes a string to the nt-textmode screen eg. during startup
562 NTSTATUS WINAPI NtDisplayString (
563 PUNICODE_STRING string)
565 TRACE("%p(%s)\n",string->Buffer, debugstr_w(string->Buffer));
566 WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), string->Buffer, string->Length, 0, 0);
570 /******************************************************************************
571 * _alldiv [NTDLL.937]
575 long long WINAPI _alldiv(LARGE_INTEGER a, LARGE_INTEGER b)
577 #if SIZEOF_LONG_LONG==8
578 return (*(long long*)&a / *(long long*)&b);
580 FIXME(ntdll,"stub\n");
584 /******************************************************************************
585 * _allmul [NTDLL.938]
589 long long WINAPI _allmul(LARGE_INTEGER a, LARGE_INTEGER b)
591 #if SIZEOF_LONG_LONG==8
592 return (*(long long*)&a * *(long long*)&b);
594 FIXME(ntdll,"stub\n");
599 /******************************************************************************
600 * NtPowerInformation [NTDLL]
603 NTSTATUS WINAPI NtPowerInformation(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5)
605 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub\n",x1,x2,x3,x4,x5);
609 /******************************************************************************
610 * NtAllocateLocallyUniqueId
612 * FIXME: the server should do that
614 NTSTATUS WINAPI NtAllocateLocallyUniqueId(PLUID Luid)
618 FIXME("%p (0x%08lx%08lx)\n", Luid, luid.DUMMYSTRUCTNAME.HighPart, luid.DUMMYSTRUCTNAME.LowPart);
622 Luid->QuadPart = luid.QuadPart;
623 return STATUS_SUCCESS;