Implemented NtQueueApcThread, and changed the server APC interface to
[wine] / dlls / ntdll / nt.c
1 /*
2  * NT basis DLL
3  *
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)
6  *
7  * Copyright 1996-1998 Marcus Meissner
8  *
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.
13  *
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.
18  *
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
22  */
23
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <string.h>
27 #include <time.h>
28 #include "wine/debug.h"
29
30 #include "winternl.h"
31 #include "ntdll_misc.h"
32 #include "wine/server.h"
33
34 WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
35
36 /* Structures used by NtConnectPort */
37
38 typedef struct LpcSectionInfo
39 {
40   DWORD Length;
41   HANDLE SectionHandle;
42   DWORD Param1;
43   DWORD SectionSize;
44   DWORD ClientBaseAddress;
45   DWORD ServerBaseAddress;
46 } LPCSECTIONINFO, *PLPCSECTIONINFO;
47
48 typedef struct LpcSectionMapInfo
49 {
50   DWORD Length;
51   DWORD SectionSize;
52   DWORD ServerBaseAddress;
53 } LPCSECTIONMAPINFO, *PLPCSECTIONMAPINFO;
54
55 /* Structure used by NtAcceptConnectPort, NtReplyWaitReceivePort */
56
57 #define MAX_MESSAGE_DATA 328
58
59 typedef struct LpcMessage
60 {
61   WORD ActualMessageLength;
62   WORD TotalMessageLength;
63   DWORD MessageType;
64   DWORD ClientProcessId;
65   DWORD ClientThreadId;
66   DWORD MessageId;
67   DWORD SharedSectionSize;
68   BYTE MessageData[MAX_MESSAGE_DATA];
69 } LPCMESSAGE, *PLPCMESSAGE;
70
71 /*
72  *      Timer object
73  */
74
75 /**************************************************************************
76  *              NtCreateTimer                           [NTDLL.@]
77  *              ZwCreateTimer                           [NTDLL.@]
78  */
79 NTSTATUS WINAPI NtCreateTimer(
80         OUT PHANDLE TimerHandle,
81         IN ACCESS_MASK DesiredAccess,
82         IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
83         IN TIMER_TYPE TimerType)
84 {
85         FIXME("(%p,0x%08lx,%p,0x%08x) stub\n",
86         TimerHandle,DesiredAccess,ObjectAttributes, TimerType);
87         dump_ObjectAttributes(ObjectAttributes);
88         return 0;
89 }
90 /**************************************************************************
91  *              NtSetTimer                              [NTDLL.@]
92  *              ZwSetTimer                              [NTDLL.@]
93  */
94 NTSTATUS WINAPI NtSetTimer(
95         IN HANDLE TimerHandle,
96         IN PLARGE_INTEGER DueTime,
97         IN PTIMERAPCROUTINE TimerApcRoutine,
98         IN PVOID TimerContext,
99         IN BOOLEAN WakeTimer,
100         IN ULONG Period OPTIONAL,
101         OUT PBOOLEAN PreviousState OPTIONAL)
102 {
103         FIXME("(%p,%p,%p,%p,%08x,0x%08lx,%p) stub\n",
104         TimerHandle,DueTime,TimerApcRoutine,TimerContext,WakeTimer,Period,PreviousState);
105         return 0;
106 }
107
108 /******************************************************************************
109  * NtQueryTimerResolution [NTDLL.@]
110  */
111 NTSTATUS WINAPI NtQueryTimerResolution(DWORD x1,DWORD x2,DWORD x3)
112 {
113         FIXME("(0x%08lx,0x%08lx,0x%08lx), stub!\n",x1,x2,x3);
114         return 1;
115 }
116
117 /*
118  *      Process object
119  */
120
121 /******************************************************************************
122  *  NtTerminateProcess                  [NTDLL.@]
123  *
124  *  Native applications must kill themselves when done
125  */
126 NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code )
127 {
128     NTSTATUS ret;
129     BOOL self;
130     SERVER_START_REQ( terminate_process )
131     {
132         req->handle    = handle;
133         req->exit_code = exit_code;
134         ret = wine_server_call( req );
135         self = !ret && reply->self;
136     }
137     SERVER_END_REQ;
138     if (self) exit( exit_code );
139     return ret;
140 }
141
142 /******************************************************************************
143 *  NtQueryInformationProcess            [NTDLL.@]
144 *  ZwQueryInformationProcess            [NTDLL.@]
145 *
146 */
147 NTSTATUS WINAPI NtQueryInformationProcess(
148         IN HANDLE ProcessHandle,
149         IN PROCESSINFOCLASS ProcessInformationClass,
150         OUT PVOID ProcessInformation,
151         IN ULONG ProcessInformationLength,
152         OUT PULONG ReturnLength)
153 {
154         NTSTATUS ret = STATUS_SUCCESS;
155         ULONG len = 0;
156
157         switch (ProcessInformationClass) {
158         case ProcessDebugPort:
159                 /* "These are not the debuggers you are looking for." */
160                 /* set it to 0 aka "no debugger" to satisfy copy protections */
161                 if (ProcessInformationLength == 4)
162                 {
163                         memset(ProcessInformation,0,ProcessInformationLength);
164                         len = 4;
165                 }
166                 else
167                         ret = STATUS_INFO_LENGTH_MISMATCH;
168                 break;
169         default:
170                 FIXME("(%p,0x%08x,%p,0x%08lx,%p),stub!\n",
171                         ProcessHandle,ProcessInformationClass,
172                         ProcessInformation,ProcessInformationLength,
173                         ReturnLength
174                 );
175                 break;
176         }
177
178         if (ReturnLength)
179                 *ReturnLength = len;
180
181         return ret;
182 }
183
184 /******************************************************************************
185  * NtSetInformationProcess [NTDLL.@]
186  * ZwSetInformationProcess [NTDLL.@]
187  */
188 NTSTATUS WINAPI NtSetInformationProcess(
189         IN HANDLE ProcessHandle,
190         IN PROCESSINFOCLASS ProcessInformationClass,
191         IN PVOID ProcessInformation,
192         IN ULONG ProcessInformationLength)
193 {
194         FIXME("(%p,0x%08x,%p,0x%08lx) stub\n",
195         ProcessHandle,ProcessInformationClass,ProcessInformation,ProcessInformationLength);
196         return 0;
197 }
198
199 /*
200  *      Thread
201  */
202
203 /******************************************************************************
204 *  NtQueryInformationThread             [NTDLL.@]
205 *  ZwQueryInformationThread             [NTDLL.@]
206 *
207 */
208 NTSTATUS WINAPI NtQueryInformationThread(
209         IN HANDLE ThreadHandle,
210         IN THREADINFOCLASS ThreadInformationClass,
211         OUT PVOID ThreadInformation,
212         IN ULONG ThreadInformationLength,
213         OUT PULONG ReturnLength)
214 {
215         FIXME("(%p,0x%08x,%p,0x%08lx,%p),stub!\n",
216                 ThreadHandle, ThreadInformationClass, ThreadInformation,
217                 ThreadInformationLength, ReturnLength);
218         return 0;
219 }
220
221 /******************************************************************************
222  *  NtSetInformationThread              [NTDLL.@]
223  *  ZwSetInformationThread              [NTDLL.@]
224  */
225 NTSTATUS WINAPI NtSetInformationThread(
226         HANDLE ThreadHandle,
227         THREADINFOCLASS ThreadInformationClass,
228         PVOID ThreadInformation,
229         ULONG ThreadInformationLength)
230 {
231         FIXME("(%p,0x%08x,%p,0x%08lx),stub!\n",
232         ThreadHandle, ThreadInformationClass, ThreadInformation, ThreadInformationLength);
233         return 0;
234 }
235
236 /*
237  *      Token
238  */
239
240 /******************************************************************************
241  *  NtDuplicateToken            [NTDLL.@]
242  *  ZwDuplicateToken            [NTDLL.@]
243  */
244 NTSTATUS WINAPI NtDuplicateToken(
245         IN HANDLE ExistingToken,
246         IN ACCESS_MASK DesiredAccess,
247         IN POBJECT_ATTRIBUTES ObjectAttributes,
248         IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
249         IN TOKEN_TYPE TokenType,
250         OUT PHANDLE NewToken)
251 {
252         FIXME("(%p,0x%08lx,%p,0x%08x,0x%08x,%p),stub!\n",
253         ExistingToken, DesiredAccess, ObjectAttributes,
254         ImpersonationLevel, TokenType, NewToken);
255         dump_ObjectAttributes(ObjectAttributes);
256         return 0;
257 }
258
259 /******************************************************************************
260  *  NtOpenProcessToken          [NTDLL.@]
261  *  ZwOpenProcessToken          [NTDLL.@]
262  */
263 NTSTATUS WINAPI NtOpenProcessToken(
264         HANDLE ProcessHandle,
265         DWORD DesiredAccess,
266         HANDLE *TokenHandle)
267 {
268         FIXME("(%p,0x%08lx,%p): stub\n",
269         ProcessHandle,DesiredAccess, TokenHandle);
270         *TokenHandle = (HANDLE)0xcafe;
271         return 0;
272 }
273
274 /******************************************************************************
275  *  NtOpenThreadToken           [NTDLL.@]
276  *  ZwOpenThreadToken           [NTDLL.@]
277  */
278 NTSTATUS WINAPI NtOpenThreadToken(
279         HANDLE ThreadHandle,
280         DWORD DesiredAccess,
281         BOOLEAN OpenAsSelf,
282         HANDLE *TokenHandle)
283 {
284         FIXME("(%p,0x%08lx,0x%08x,%p): stub\n",
285         ThreadHandle,DesiredAccess, OpenAsSelf, TokenHandle);
286         *TokenHandle = (HANDLE)0xcafe;
287         return 0;
288 }
289
290 /******************************************************************************
291  *  NtAdjustPrivilegesToken             [NTDLL.@]
292  *  ZwAdjustGroupsToken         [NTDLL.@]
293  *
294  * FIXME: parameters unsafe
295  */
296 NTSTATUS WINAPI NtAdjustPrivilegesToken(
297         IN HANDLE TokenHandle,
298         IN BOOLEAN DisableAllPrivileges,
299         IN PTOKEN_PRIVILEGES NewState,
300         IN DWORD BufferLength,
301         OUT PTOKEN_PRIVILEGES PreviousState,
302         OUT PDWORD ReturnLength)
303 {
304         FIXME("(%p,0x%08x,%p,0x%08lx,%p,%p),stub!\n",
305         TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength);
306         return 0;
307 }
308
309 /******************************************************************************
310 *  NtQueryInformationToken              [NTDLL.@]
311 *  ZwQueryInformationToken              [NTDLL.@]
312 *
313 * NOTES
314 *  Buffer for TokenUser:
315 *   0x00 TOKEN_USER the PSID field points to the SID
316 *   0x08 SID
317 *
318 */
319 NTSTATUS WINAPI NtQueryInformationToken(
320         HANDLE token,
321         DWORD tokeninfoclass,
322         LPVOID tokeninfo,
323         DWORD tokeninfolength,
324         LPDWORD retlen )
325 {
326     unsigned int len = 0;
327
328     FIXME("(%p,%ld,%p,%ld,%p): stub\n",
329           token,tokeninfoclass,tokeninfo,tokeninfolength,retlen);
330
331     switch (tokeninfoclass)
332     {
333     case TokenUser:
334         len = sizeof(TOKEN_USER) + sizeof(SID);
335         break;
336     case TokenGroups:
337         len = sizeof(TOKEN_GROUPS);
338         break;
339     case TokenPrivileges:
340         len = sizeof(TOKEN_PRIVILEGES);
341         break;
342     case TokenOwner:
343         len = sizeof(TOKEN_OWNER);
344         break;
345     case TokenPrimaryGroup:
346         len = sizeof(TOKEN_PRIMARY_GROUP);
347         break;
348     case TokenDefaultDacl:
349         len = sizeof(TOKEN_DEFAULT_DACL);
350         break;
351     case TokenSource:
352         len = sizeof(TOKEN_SOURCE);
353         break;
354     case TokenType:
355         len = sizeof (TOKEN_TYPE);
356         break;
357 #if 0
358     case TokenImpersonationLevel:
359     case TokenStatistics:
360 #endif /* 0 */
361     }
362
363     /* FIXME: what if retlen == NULL ? */
364     *retlen = len;
365
366     if (tokeninfolength < len)
367         return STATUS_BUFFER_TOO_SMALL;
368
369     switch (tokeninfoclass)
370     {
371     case TokenUser:
372         if( tokeninfo )
373         {
374             TOKEN_USER * tuser = tokeninfo;
375             PSID sid = (PSID) (tuser + 1);
376             SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
377             RtlInitializeSid(sid, &localSidAuthority, 1);
378             *(RtlSubAuthoritySid(sid, 0)) = SECURITY_INTERACTIVE_RID;
379             tuser->User.Sid = sid;
380         }
381         break;
382     case TokenGroups:
383         if (tokeninfo)
384         {
385             TOKEN_GROUPS *tgroups = tokeninfo;
386             SID_IDENTIFIER_AUTHORITY sid = {SECURITY_NT_AUTHORITY};
387
388             /* we need to show admin privileges ! */
389             tgroups->GroupCount = 1;
390             RtlAllocateAndInitializeSid( &sid,
391                                          2,
392                                          SECURITY_BUILTIN_DOMAIN_RID,
393                                          DOMAIN_ALIAS_RID_ADMINS,
394                                          0, 0, 0, 0, 0, 0,
395                                          &(tgroups->Groups->Sid));
396         }
397         break;
398     case TokenPrivileges:
399         if (tokeninfo)
400         {
401             TOKEN_PRIVILEGES *tpriv = tokeninfo;
402             tpriv->PrivilegeCount = 1;
403         }
404         break;
405     }
406     return 0;
407 }
408
409 /*
410  *      Section
411  */
412
413 /******************************************************************************
414  *  NtQuerySection      [NTDLL.@]
415  */
416 NTSTATUS WINAPI NtQuerySection(
417         IN HANDLE SectionHandle,
418         IN PVOID SectionInformationClass,
419         OUT PVOID SectionInformation,
420         IN ULONG Length,
421         OUT PULONG ResultLength)
422 {
423         FIXME("(%p,%p,%p,0x%08lx,%p) stub!\n",
424         SectionHandle,SectionInformationClass,SectionInformation,Length,ResultLength);
425         return 0;
426 }
427
428 /*
429  *      ports
430  */
431
432 /******************************************************************************
433  *  NtCreatePort                [NTDLL.@]
434  *  ZwCreatePort                [NTDLL.@]
435  */
436 NTSTATUS WINAPI NtCreatePort(PHANDLE PortHandle,POBJECT_ATTRIBUTES ObjectAttributes,
437                              DWORD MaxConnectInfoLength,DWORD MaxDataLength,DWORD unknown)
438 {
439   FIXME("(%p,%p,0x%08lx,0x%08lx,0x%08lx),stub!\n",PortHandle,ObjectAttributes,
440         MaxConnectInfoLength,MaxDataLength,unknown);
441   return 0;
442 }
443
444 /******************************************************************************
445  *  NtConnectPort               [NTDLL.@]
446  *  ZwConnectPort               [NTDLL.@]
447  */
448 NTSTATUS WINAPI NtConnectPort(PHANDLE PortHandle,PUNICODE_STRING PortName,PVOID Unknown1,
449                               PLPCSECTIONINFO sectionInfo,PLPCSECTIONMAPINFO mapInfo,PVOID Unknown2,
450                               PVOID ConnectInfo,PDWORD pConnectInfoLength)
451 {
452   FIXME("(%p,%s,%p,%p,%p,%p,%p,%p (%ld)),stub!\n",PortHandle,debugstr_w(PortName->Buffer),Unknown1,
453         sectionInfo,mapInfo,Unknown2,ConnectInfo,pConnectInfoLength,pConnectInfoLength?*pConnectInfoLength:-1);
454   if(ConnectInfo && pConnectInfoLength)
455     TRACE("\tMessage = %s\n",debugstr_an(ConnectInfo,*pConnectInfoLength));
456   return 0;
457 }
458
459 /******************************************************************************
460  *  NtListenPort                [NTDLL.@]
461  *  ZwListenPort                [NTDLL.@]
462  */
463 NTSTATUS WINAPI NtListenPort(HANDLE PortHandle,PLPCMESSAGE pLpcMessage)
464 {
465   FIXME("(%p,%p),stub!\n",PortHandle,pLpcMessage);
466   return 0;
467 }
468
469 /******************************************************************************
470  *  NtAcceptConnectPort [NTDLL.@]
471  *  ZwAcceptConnectPort [NTDLL.@]
472  */
473 NTSTATUS WINAPI NtAcceptConnectPort(PHANDLE PortHandle,DWORD Unknown,PLPCMESSAGE pLpcMessage,
474                                     DWORD acceptIt,DWORD Unknown2,PLPCSECTIONMAPINFO mapInfo)
475 {
476   FIXME("(%p,0x%08lx,%p,0x%08lx,0x%08lx,%p),stub!\n",PortHandle,Unknown,pLpcMessage,acceptIt,Unknown2,mapInfo);
477   return 0;
478 }
479
480 /******************************************************************************
481  *  NtCompleteConnectPort       [NTDLL.@]
482  *  ZwCompleteConnectPort       [NTDLL.@]
483  */
484 NTSTATUS WINAPI NtCompleteConnectPort(HANDLE PortHandle)
485 {
486   FIXME("(%p),stub!\n",PortHandle);
487   return 0;
488 }
489
490 /******************************************************************************
491  *  NtRegisterThreadTerminatePort       [NTDLL.@]
492  *  ZwRegisterThreadTerminatePort       [NTDLL.@]
493  */
494 NTSTATUS WINAPI NtRegisterThreadTerminatePort(HANDLE PortHandle)
495 {
496   FIXME("(%p),stub!\n",PortHandle);
497   return 0;
498 }
499
500 /******************************************************************************
501  *  NtRequestWaitReplyPort              [NTDLL.@]
502  *  ZwRequestWaitReplyPort              [NTDLL.@]
503  */
504 NTSTATUS WINAPI NtRequestWaitReplyPort(HANDLE PortHandle,PLPCMESSAGE pLpcMessageIn,PLPCMESSAGE pLpcMessageOut)
505 {
506   FIXME("(%p,%p,%p),stub!\n",PortHandle,pLpcMessageIn,pLpcMessageOut);
507   if(pLpcMessageIn)
508   {
509     TRACE("Message to send:\n");
510     TRACE("\tActualMessageLength = %d\n",pLpcMessageIn->ActualMessageLength);
511     TRACE("\tTotalMessageLength  = %d\n",pLpcMessageIn->TotalMessageLength);
512     TRACE("\tMessageType         = %ld\n",pLpcMessageIn->MessageType);
513     TRACE("\tClientProcessId     = %ld\n",pLpcMessageIn->ClientProcessId);
514     TRACE("\tClientThreadId      = %ld\n",pLpcMessageIn->ClientThreadId);
515     TRACE("\tMessageId           = %ld\n",pLpcMessageIn->MessageId);
516     TRACE("\tSharedSectionSize   = %ld\n",pLpcMessageIn->SharedSectionSize);
517     TRACE("\tMessageData         = %s\n",debugstr_an(pLpcMessageIn->MessageData,pLpcMessageIn->ActualMessageLength));
518   }
519   return 0;
520 }
521
522 /******************************************************************************
523  *  NtReplyWaitReceivePort      [NTDLL.@]
524  *  ZwReplyWaitReceivePort      [NTDLL.@]
525  */
526 NTSTATUS WINAPI NtReplyWaitReceivePort(HANDLE PortHandle,PDWORD Unknown,PLPCMESSAGE pLpcMessageOut,PLPCMESSAGE pLpcMessageIn)
527 {
528   FIXME("(%p,%p,%p,%p),stub!\n",PortHandle,Unknown,pLpcMessageOut,pLpcMessageIn);
529   return 0;
530 }
531
532 /*
533  *      Misc
534  */
535
536  /******************************************************************************
537  *  NtSetIntervalProfile        [NTDLL.@]
538  *  ZwSetIntervalProfile        [NTDLL.@]
539  */
540 NTSTATUS WINAPI NtSetIntervalProfile(DWORD x1,DWORD x2) {
541         FIXME("(0x%08lx,0x%08lx),stub!\n",x1,x2);
542         return 0;
543 }
544
545 /******************************************************************************
546  *  NtQueryPerformanceCounter   [NTDLL.@]
547  */
548 NTSTATUS WINAPI NtQueryPerformanceCounter(
549         IN PLARGE_INTEGER Counter,
550         IN PLARGE_INTEGER Frequency)
551 {
552         FIXME("(%p, 0%p) stub\n",
553         Counter, Frequency);
554         return 0;
555 }
556
557 /******************************************************************************
558  *  NtCreateMailslotFile        [NTDLL.@]
559  *  ZwCreateMailslotFile        [NTDLL.@]
560  */
561 NTSTATUS WINAPI NtCreateMailslotFile(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8)
562 {
563         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);
564         return 0;
565 }
566
567 /******************************************************************************
568  * NtQuerySystemInformation [NTDLL.@]
569  * ZwQuerySystemInformation [NTDLL.@]
570  *
571  * ARGUMENTS:
572  *  SystemInformationClass      Index to a certain information structure
573  *      SystemTimeAdjustmentInformation SYSTEM_TIME_ADJUSTMENT
574  *      SystemCacheInformation          SYSTEM_CACHE_INFORMATION
575  *      SystemConfigurationInformation  CONFIGURATION_INFORMATION
576  *      observed (class/len):
577  *              0x0/0x2c
578  *              0x12/0x18
579  *              0x2/0x138
580  *              0x8/0x600
581  *              0x25/0xc
582  *  SystemInformation   caller supplies storage for the information structure
583  *  Length              size of the structure
584  *  ResultLength        Data written
585  */
586 NTSTATUS WINAPI NtQuerySystemInformation(
587         IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
588         OUT PVOID SystemInformation,
589         IN ULONG Length,
590         OUT PULONG ResultLength)
591 {
592     switch(SystemInformationClass)
593     {
594     case 0x25:
595         /* Something to do with the size of the registry             *
596          * Since we don't have a size limitation, fake it            *
597          * This is almost certainly wrong.                           *
598          * This sets each of the three words in the struct to 32 MB, *
599          * which is enough to make the IE 5 installer happy.         */
600         FIXME("(0x%08x,%p,0x%08lx,%p) faking max registry size of 32 MB\n",
601               SystemInformationClass,SystemInformation,Length,ResultLength);
602         *(DWORD *)SystemInformation = 0x2000000;
603         *(((DWORD *)SystemInformation)+1) = 0x200000;
604         *(((DWORD *)SystemInformation)+2) = 0x200000;
605         break;
606
607     default:
608         FIXME("(0x%08x,%p,0x%08lx,%p) stub\n",
609               SystemInformationClass,SystemInformation,Length,ResultLength);
610         ZeroMemory (SystemInformation, Length);
611     }
612
613     return STATUS_SUCCESS;
614 }
615
616
617 /******************************************************************************
618  *  NtCreatePagingFile          [NTDLL.@]
619  *  ZwCreatePagingFile          [NTDLL.@]
620  */
621 NTSTATUS WINAPI NtCreatePagingFile(
622         IN PUNICODE_STRING PageFileName,
623         IN ULONG MiniumSize,
624         IN ULONG MaxiumSize,
625         OUT PULONG ActualSize)
626 {
627         FIXME("(%p(%s),0x%08lx,0x%08lx,%p),stub!\n",
628         PageFileName->Buffer, debugstr_w(PageFileName->Buffer),MiniumSize,MaxiumSize,ActualSize);
629         return 0;
630 }
631
632 /******************************************************************************
633  *  NtDisplayString                             [NTDLL.@]
634  *
635  * writes a string to the nt-textmode screen eg. during startup
636  */
637 NTSTATUS WINAPI NtDisplayString ( PUNICODE_STRING string )
638 {
639     STRING stringA;
640     NTSTATUS ret;
641
642     if (!(ret = RtlUnicodeStringToAnsiString( &stringA, string, TRUE )))
643     {
644         MESSAGE( "%.*s", stringA.Length, stringA.Buffer );
645         RtlFreeAnsiString( &stringA );
646     }
647     return ret;
648 }
649
650 /******************************************************************************
651  *  NtPowerInformation                          [NTDLL.@]
652  *
653  */
654 NTSTATUS WINAPI NtPowerInformation(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5)
655 {
656         FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub\n",x1,x2,x3,x4,x5);
657         return 0;
658 }
659
660 /******************************************************************************
661  *  NtAllocateLocallyUniqueId (NTDLL.@)
662  *
663  * FIXME: the server should do that
664  */
665 NTSTATUS WINAPI NtAllocateLocallyUniqueId(PLUID Luid)
666 {
667     static LUID luid;
668
669     FIXME("%p (0x%08lx%08lx)\n", Luid, luid.HighPart, luid.LowPart);
670
671     luid.LowPart++;
672     if (luid.LowPart==0)
673         luid.HighPart++;
674     Luid->HighPart = luid.HighPart;
675     Luid->LowPart = luid.LowPart;
676
677     return STATUS_SUCCESS;
678 }
679
680 /******************************************************************************
681  *        VerSetConditionMask   (NTDLL.@)
682  */
683 ULONGLONG WINAPI VerSetConditionMask( ULONGLONG dwlConditionMask, DWORD dwTypeBitMask,
684                                       BYTE dwConditionMask)
685 {
686     if(dwTypeBitMask == 0)
687         return dwlConditionMask;
688     dwConditionMask &= 0x07;
689     if(dwConditionMask == 0)
690         return dwlConditionMask;
691
692     if(dwTypeBitMask & VER_PRODUCT_TYPE)
693         dwlConditionMask |= dwConditionMask << 7*3;
694     else if (dwTypeBitMask & VER_SUITENAME)
695         dwlConditionMask |= dwConditionMask << 6*3;
696     else if (dwTypeBitMask & VER_SERVICEPACKMAJOR)
697         dwlConditionMask |= dwConditionMask << 5*3;
698     else if (dwTypeBitMask & VER_SERVICEPACKMINOR)
699         dwlConditionMask |= dwConditionMask << 4*3;
700     else if (dwTypeBitMask & VER_PLATFORMID)
701         dwlConditionMask |= dwConditionMask << 3*3;
702     else if (dwTypeBitMask & VER_BUILDNUMBER)
703         dwlConditionMask |= dwConditionMask << 2*3;
704     else if (dwTypeBitMask & VER_MAJORVERSION)
705         dwlConditionMask |= dwConditionMask << 1*3;
706     else if (dwTypeBitMask & VER_MINORVERSION)
707         dwlConditionMask |= dwConditionMask << 0*3;
708     return dwlConditionMask;
709 }