source: trunk/src/NTDLL/nt.cpp@ 1036

Last change on this file since 1036 was 97, checked in by phaller, 26 years ago

Add: added cvs variable $Id$ to source files.

File size: 22.1 KB
Line 
1/* $Id: nt.cpp,v 1.2 1999-06-10 17:06:45 phaller Exp $ */
2
3
4/*
5 * NT basis DLL
6 *
7 * This file contains the Nt* API functions of NTDLL.DLL.
8 * In the original ntdll.dll they all seem to just call int 0x2e (down to the HAL)
9 *
10 * Copyright 1996-1998 Marcus Meissner
11 * Copyright 1999 Patrick Haller
12 */
13
14#include <stdlib.h>
15#include <string.h>
16#include <time.h>
17
18#include "ntdll.h"
19
20
21/* move to winbase.h */
22
23// @@@PH can't compile this WINE code
24//typedef VOID (CALLBACK *PTIMERAPCROUTINE)(LPVOID lpArgToCompletionRoutine,DWORD dwTimerLowValue,DWORD dwTimerHighValue);
25typedef PVOID PTIMERAPCROUTINE;
26
27
28/*
29 * Timer object
30 */
31
32/**************************************************************************
33 * NtCreateTimer [NTDLL.87]
34 */
35NTSTATUS WINAPI NtCreateTimer(PHANDLE TimerHandle,
36 ACCESS_MASK DesiredAccess,
37 POBJECT_ATTRIBUTES ObjectAttributes,
38 TIMER_TYPE TimerType)
39{
40 dprintf(("NTDLL: NtCreateTimer(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
41 TimerHandle,
42 DesiredAccess,
43 ObjectAttributes,
44 TimerType));
45
46 return 0;
47}
48
49
50/**************************************************************************
51 * NtSetTimer [NTDLL.221]
52 */
53NTSTATUS WINAPI NtSetTimer(HANDLE TimerHandle,
54 PLARGE_INTEGER DueTime,
55 PTIMERAPCROUTINE TimerApcRoutine,
56 PVOID TimerContext,
57 BOOLEAN WakeTimer,
58 ULONG Period,
59 PBOOLEAN PreviousState)
60{
61 dprintf(("NTDLL: NtSetTimer(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
62 TimerHandle,
63 DueTime,
64 TimerApcRoutine,
65 TimerContext,
66 WakeTimer,
67 Period,
68 PreviousState));
69
70 return 0;
71}
72
73
74/******************************************************************************
75 * NtQueryTimerResolution [NTDLL.129]
76 */
77NTSTATUS WINAPI NtQueryTimerResolution(DWORD x1,
78 DWORD x2,
79 DWORD x3)
80{
81 dprintf(("NTDLL: NtQueryTimerResolution(%08xh,%08xh,%08xh) not implemented.\n",
82 x1,
83 x2,
84 x3));
85
86 return 1;
87}
88
89
90/*
91 * Process object
92 */
93
94/******************************************************************************
95 * NtTerminateProcess [NTDLL.]
96 *
97 * Native applications must kill themselves when done
98 * FIXME: return value 0-success
99 */
100NTSTATUS WINAPI NtTerminateProcess(HANDLE ProcessHandle,
101 LONG ExitStatus)
102{
103 dprintf(("NTDLL: NtTerminateProcess(%08xh,%08xh)",
104 ProcessHandle,
105 ExitStatus));
106
107 /* win32 (0x7fffffff) to nt (-1) */
108 if ( NtCurrentProcess() == ProcessHandle )
109 ProcessHandle = GetCurrentProcess();
110
111 /* @@@PH return code looks suspicious ! */
112 return (! TerminateProcess( ProcessHandle, ExitStatus ));
113}
114
115
116/******************************************************************************
117* NtQueryInformationProcess [NTDLL.]
118*
119*/
120NTSTATUS WINAPI NtQueryInformationProcess(HANDLE ProcessHandle,
121 PROCESSINFOCLASS ProcessInformationClass,
122 PVOID ProcessInformation,
123 ULONG ProcessInformationLength,
124 PULONG ReturnLength)
125{
126 dprintf(("NTDLL: NtQueryInformationProcess(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
127 ProcessHandle,
128 ProcessInformationClass,
129 ProcessInformation,
130 ProcessInformationLength,
131 ReturnLength));
132
133 return 0;
134}
135
136/******************************************************************************
137 * NtSetInformationProcess [NTDLL.207]
138 */
139NTSTATUS WINAPI NtSetInformationProcess(HANDLE ProcessHandle,
140 PROCESSINFOCLASS ProcessInformationClass,
141 PVOID ProcessInformation,
142 ULONG ProcessInformationLength)
143{
144 dprintf(("NTDLL: NtSetInformationProcess(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
145 ProcessHandle,
146 ProcessInformationClass,
147 ProcessInformation,
148 ProcessInformationLength));
149
150 return 0;
151}
152
153
154/*
155 * Thread
156 */
157
158/******************************************************************************
159 * NtResumeThread [NTDLL]
160 */
161NTSTATUS WINAPI NtResumeThread(HANDLE ThreadHandle,
162 PULONG SuspendCount)
163{
164 dprintf(("NTDLL: NtResumeThread(%08xh,%08x) not implemented.\n",
165 ThreadHandle,
166 SuspendCount));
167
168 return 0;
169}
170
171
172/******************************************************************************
173 * NtTerminateThread [NTDLL]
174 */
175NTSTATUS WINAPI NtTerminateThread(HANDLE ThreadHandle,
176 NTSTATUS ExitStatus)
177{
178 dprintf(("NTDLL: NtTerminateThread(%08xh,%08xh) not correctly implemented.\n",
179 ThreadHandle,
180 ExitStatus));
181
182 if ( TerminateThread(ThreadHandle,ExitStatus) )
183 return 0;
184
185 return 0xc0000000; /* FIXME: lasterror->ntstatus */
186}
187
188
189/******************************************************************************
190* NtQueryInformationThread [NTDLL.]
191*
192*/
193NTSTATUS WINAPI NtQueryInformationThread(HANDLE ThreadHandle,
194 THREADINFOCLASS ThreadInformationClass,
195 PVOID ThreadInformation,
196 ULONG ThreadInformationLength,
197 PULONG ReturnLength)
198{
199 dprintf(("NTDLL: NtQueryInformationThread(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
200 ThreadHandle,
201 ThreadInformationClass,
202 ThreadInformation,
203 ThreadInformationLength,
204 ReturnLength));
205
206 return 0;
207}
208
209
210/******************************************************************************
211 * NtSetInformationThread [NTDLL]
212 */
213NTSTATUS WINAPI NtSetInformationThread(HANDLE ThreadHandle,
214 THREADINFOCLASS ThreadInformationClass,
215 PVOID ThreadInformation,
216 ULONG ThreadInformationLength)
217{
218 dprintf(("NTDLL: NtSetInformationThread(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
219 ThreadHandle,
220 ThreadInformationClass,
221 ThreadInformation,
222 ThreadInformationLength));
223
224 return 0;
225}
226
227
228/*
229 * Token
230 */
231
232/******************************************************************************
233 * NtDuplicateToken [NTDLL]
234 */
235NTSTATUS WINAPI NtDuplicateToken(HANDLE ExistingToken,
236 ACCESS_MASK DesiredAccess,
237 POBJECT_ATTRIBUTES ObjectAttributes,
238 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
239 TOKEN_TYPE TokenType,
240 PHANDLE NewToken)
241{
242 dprintf(("NTDLL: NtDuplicateToken(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
243 ExistingToken,
244 DesiredAccess,
245 ObjectAttributes,
246 ImpersonationLevel,
247 TokenType,
248 NewToken));
249
250 return 0;
251}
252
253/******************************************************************************
254 * NtOpenProcessToken [NTDLL]
255 */
256NTSTATUS WINAPI NtOpenProcessToken(HANDLE ProcessHandle,
257 DWORD DesiredAccess,
258 PHANDLE TokenHandle)
259{
260 dprintf(("NTDLL: NtOpenProcessToken(%08xh,%08xh,%08xh) not implemented.\n",
261 ProcessHandle,
262 DesiredAccess,
263 TokenHandle));
264
265 *TokenHandle = 0xcafe;
266 return 0;
267}
268
269
270/******************************************************************************
271 * NtOpenThreadToken [NTDLL]
272 */
273NTSTATUS WINAPI NtOpenThreadToken(HANDLE ThreadHandle,
274 DWORD DesiredAccess,
275 BOOLEAN OpenAsSelf,
276 PHANDLE TokenHandle)
277{
278 dprintf(("NTDLL: NtOpenThreadToken(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
279 ThreadHandle,
280 DesiredAccess,
281 OpenAsSelf,
282 TokenHandle));
283
284 *TokenHandle = 0xcafe;
285 return 0;
286}
287
288
289/******************************************************************************
290 * NtAdjustPrivilegesToken [NTDLL]
291 *
292 * FIXME: parameters unsafe
293 */
294NTSTATUS WINAPI NtAdjustPrivilegesToken(HANDLE TokenHandle,
295 BOOLEAN DisableAllPrivileges,
296 PTOKEN_PRIVILEGES NewState,
297 DWORD BufferLength,
298 PTOKEN_PRIVILEGES PreviousState,
299 PDWORD ReturnLength)
300{
301 dprintf(("NTDLL: NtAdjustPrivilegesToken(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
302 TokenHandle,
303 DisableAllPrivileges,
304 NewState,
305 BufferLength,
306 PreviousState,
307 ReturnLength));
308
309 return 0;
310}
311
312
313/******************************************************************************
314* NtQueryInformationToken [NTDLL.156]
315*
316*/
317NTSTATUS WINAPI NtQueryInformationToken(HANDLE Token,
318 DWORD TokenInformationClass,
319 LPVOID TokenInformation,
320 DWORD TokenInformationLength,
321 LPDWORD ReturnLength)
322{
323 dprintf(("NTDLL: NtQueryInformationToken(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
324 Token,
325 TokenInformationClass,
326 TokenInformation,
327 TokenInformationLength,
328 ReturnLength));
329
330 switch (TokenInformationClass)
331 {
332 case TokenGroups: /* 2 */
333 *ReturnLength = sizeof (TOKEN_GROUPS);
334#if 0
335 case TokenUser: /* 1 */
336 case TokenPrivileges:
337 case TokenOwner:
338 case TokenPrimaryGroup:
339 case TokenDefaultDacl:
340 case TokenSource:
341 case TokenType:
342 case TokenImpersonationLevel:
343 case TokenStatistics:
344#endif /* 0 */
345 }
346
347 return 0;
348}
349
350
351/*
352 * Section
353 */
354
355/******************************************************************************
356 * NtCreateSection [NTDLL]
357 */
358NTSTATUS WINAPI NtCreateSection(PHANDLE SectionHandle,
359 ACCESS_MASK DesiredAccess,
360 POBJECT_ATTRIBUTES ObjectAttributes,
361 PLARGE_INTEGER MaximumSize,
362 ULONG SectionPageProtection,
363 ULONG AllocationAttributes,
364 HANDLE FileHandle)
365{
366 dprintf(("NTDLL: NtCreateSection(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
367 SectionHandle,
368 DesiredAccess,
369 ObjectAttributes,
370 MaximumSize,
371 SectionPageProtection,
372 AllocationAttributes,
373 FileHandle));
374
375 return 0;
376}
377
378
379/******************************************************************************
380 * NtOpenSection [NTDLL]
381 */
382NTSTATUS WINAPI NtOpenSection(PHANDLE SectionHandle,
383 ACCESS_MASK DesiredAccess,
384 POBJECT_ATTRIBUTES ObjectAttributes)
385{
386 dprintf(("NTDLL: NtOpenSection(%08xh,%08xh,%08xh) not implemented.\n",
387 SectionHandle,
388 DesiredAccess,
389 ObjectAttributes));
390
391 return 0;
392}
393
394
395/******************************************************************************
396 * NtQuerySection [NTDLL]
397 */
398NTSTATUS WINAPI NtQuerySection(HANDLE SectionHandle,
399 PVOID SectionInformationClass,
400 PVOID SectionInformation,
401 ULONG Length,
402 PULONG ResultLength)
403{
404 dprintf(("NTDLL: NtQuerySection(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
405 SectionHandle,
406 SectionInformationClass,
407 SectionInformation,
408 Length,
409 ResultLength));
410
411 return 0;
412}
413
414
415/******************************************************************************
416 * NtMapViewOfSection [NTDLL]
417 * FUNCTION: Maps a view of a section into the virtual address space of a process
418 *
419 * ARGUMENTS:
420 * SectionHandle Handle of the section
421 * ProcessHandle Handle of the process
422 * BaseAddress Desired base address (or NULL) on entry
423 * Actual base address of the view on exit
424 * ZeroBits Number of high order address bits that must be zero
425 * CommitSize Size bytes of the initially committed section of the view
426 * SectionOffset Offset bytes from the beginning of the section to the beginning of the view
427 * ViewSize Desired length of map (or zero to map all) on entry
428 Actual length mapped on exit
429 * InheritDisposition Specified how the view is to be shared with
430 * child processes
431 * AllocateType Type of allocation for the pages
432 * Protect Protection for the committed region of the view
433 */
434NTSTATUS WINAPI NtMapViewOfSection(HANDLE SectionHandle,
435 HANDLE ProcessHandle,
436 PVOID* BaseAddress,
437 ULONG ZeroBits,
438 ULONG CommitSize,
439 PLARGE_INTEGER SectionOffset,
440 PULONG ViewSize,
441 SECTION_INHERIT InheritDisposition,
442 ULONG AllocationType,
443 ULONG Protect)
444{
445 dprintf(("NTDLL: NtMapViewOfSection(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
446 SectionHandle,
447 ProcessHandle,
448 BaseAddress,
449 ZeroBits,
450 CommitSize,
451 SectionOffset,
452 ViewSize,
453 InheritDisposition,
454 AllocationType,
455 Protect));
456
457 return 0;
458}
459
460
461/*
462 * ports
463 */
464
465/******************************************************************************
466 * NtCreatePort [NTDLL]
467 */
468NTSTATUS WINAPI NtCreatePort(DWORD x1,
469 DWORD x2,
470 DWORD x3,
471 DWORD x4,
472 DWORD x5)
473{
474 dprintf(("NTDLL: NtCreatePort(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
475 x1,
476 x2,
477 x3,
478 x4,
479 x5));
480
481 return 0;
482}
483
484
485/******************************************************************************
486 * NtConnectPort [NTDLL]
487 */
488NTSTATUS WINAPI NtConnectPort(DWORD x1,
489 PUNICODE_STRING uni,
490 DWORD x3,
491 DWORD x4,
492 DWORD x5,
493 DWORD x6,
494 DWORD x7,
495 DWORD x8)
496{
497 dprintf(("NTDLL: NtConnectPort(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
498 x1,
499 uni,
500 x3,
501 x4,
502 x5,
503 x6,
504 x7,
505 x8));
506
507 return 0;
508}
509
510
511/******************************************************************************
512 * NtListenPort [NTDLL]
513 */
514NTSTATUS WINAPI NtListenPort(DWORD x1,
515 DWORD x2)
516{
517 dprintf(("NTDLL: NtListenPort(%08xh,%08xh) not implemented.\n",
518 x1,
519 x2));
520
521 return 0;
522}
523
524
525/******************************************************************************
526 * NtAcceptConnectPort [NTDLL]
527 */
528NTSTATUS WINAPI NtAcceptConnectPort(DWORD x1,
529 DWORD x2,
530 DWORD x3,
531 DWORD x4,
532 DWORD x5,
533 DWORD x6)
534{
535 dprintf(("NTDLL: NtAcceptConnectPort(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
536 x1,
537 x2,
538 x3,
539 x4,
540 x5,
541 x6));
542
543 return 0;
544}
545
546
547/******************************************************************************
548 * NtCompleteConnectPort [NTDLL]
549 */
550NTSTATUS WINAPI NtCompleteConnectPort(DWORD x1)
551{
552 dprintf(("NTDLL: NtCompleteConnectPort(%08xh) not implemented.\n",
553 x1));
554
555 return 0;
556}
557
558
559/******************************************************************************
560 * NtRegisterThreadTerminatePort [NTDLL]
561 */
562NTSTATUS WINAPI NtRegisterThreadTerminatePort(DWORD x1)
563{
564 dprintf(("NTDLL: NtRegisterThreadTerminatePort(%08xh) not implemented.\n",
565 x1));
566
567 return 0;
568}
569
570
571/******************************************************************************
572 * NtRequestWaitReplyPort [NTDLL]
573 */
574NTSTATUS WINAPI NtRequestWaitReplyPort(DWORD x1,
575 DWORD x2,
576 DWORD x3)
577{
578 dprintf(("NTDLL: NtRequestWaitReplyPort(%08xh,%08xh,%08xh) not implemented.\n",
579 x1,
580 x2,
581 x3));
582
583 return 0;
584}
585
586
587/******************************************************************************
588 * NtReplyWaitReceivePort [NTDLL]
589 */
590NTSTATUS WINAPI NtReplyWaitReceivePort(DWORD x1,
591 DWORD x2,
592 DWORD x3,
593 DWORD x4)
594{
595 dprintf(("NTDLL: NtReplyWaitReceivePort(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
596 x1,
597 x2,
598 x3,
599 x4));
600
601 return 0;
602}
603
604
605/*
606 * Misc
607 */
608
609 /******************************************************************************
610 * NtSetIntervalProfile [NTDLL]
611 */
612NTSTATUS WINAPI NtSetIntervalProfile(DWORD x1,
613 DWORD x2)
614{
615 dprintf(("NTDLL: NtSetIntervalProfile(%08xh,%08xh) not implemented.\n",
616 x1,
617 x2));
618
619 return 0;
620}
621
622
623/******************************************************************************
624 * NtQueryPerformanceCounter [NTDLL]
625 */
626NTSTATUS WINAPI NtQueryPerformanceCounter(PLARGE_INTEGER Counter,
627 PLARGE_INTEGER Frequency)
628{
629 dprintf(("NTDLL: NtQueryPerformanceCounter(%08xh,%08xh) not implemented.\n",
630 Counter,
631 Frequency));
632
633 return 0;
634}
635
636
637/******************************************************************************
638 * NtCreateMailSlotFile [NTDLL]
639 */
640NTSTATUS WINAPI NtCreateMailslotFile(DWORD x1,
641 DWORD x2,
642 DWORD x3,
643 DWORD x4,
644 DWORD x5,
645 DWORD x6,
646 DWORD x7,
647 DWORD x8)
648{
649 dprintf(("NTDLL: NtCreateMailslotFile(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
650 x1,
651 x2,
652 x3,
653 x4,
654 x5,
655 x6,
656 x7,
657 x8));
658
659 return 0;
660}
661
662
663/******************************************************************************
664 * NtQuerySystemInformation [NTDLL.168]
665 *
666 * ARGUMENTS:
667 * SystemInformationClass Index to a certain information structure
668 * SystemTimeAdjustmentInformation SYSTEM_TIME_ADJUSTMENT
669 * SystemCacheInformation SYSTEM_CACHE_INFORMATION
670 * SystemConfigurationInformation CONFIGURATION_INFORMATION
671 * observed (class/len):
672 * 0x0/0x2c
673 * 0x12/0x18
674 * 0x2/0x138
675 * 0x8/0x600
676 * SystemInformation caller supplies storage for the information structure
677 * Length size of the structure
678 * ResultLength Data written
679 */
680NTSTATUS WINAPI NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass,
681 PVOID SystemInformation,
682 ULONG Length,
683 PULONG ResultLength)
684{
685 dprintf(("NTDLL: NtQuerySystemInformation(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
686 SystemInformationClass,
687 SystemInformation,
688 Length,
689 ResultLength));
690
691 ZeroMemory (SystemInformation, Length);
692 return 0;
693}
694
695
696/******************************************************************************
697 * NtCreatePagingFile [NTDLL]
698 */
699NTSTATUS WINAPI NtCreatePagingFile(PUNICODE_STRING PageFileName,
700 ULONG MinimumSize,
701 ULONG MaximumSize,
702 PULONG ActualSize)
703{
704 dprintf(("NTDLL: NtCreatePagingFile(%08xh, %08xh, %08xh, %08xh) not implemented.\n",
705 PageFileName,
706 MinimumSize,
707 MaximumSize,
708 ActualSize));
709
710 return 0;
711}
712
713
714/******************************************************************************
715 * NtDisplayString [NTDLL.95]
716 *
717 * writes a string to the nt-textmode screen eg. during startup
718 */
719NTSTATUS WINAPI NtDisplayString (PUNICODE_STRING string)
720{
721 dprintf(("NTDLL: NtDisplayString(%08xh\n",
722 string));
723
724 WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE),
725 string->Buffer,
726 string->Length,
727 0,
728 0);
729
730 return 0;
731}
Note: See TracBrowser for help on using the repository browser.