Portability fix. Better debug messages (display IID of 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         case ProcessWow64Information:
170                 if (ProcessInformationLength == 4)
171                 {
172                         memset(ProcessInformation,0,ProcessInformationLength);
173                         len = 4;
174                 }
175                 else
176                         ret = STATUS_INFO_LENGTH_MISMATCH;
177                 break;
178         default:
179                 FIXME("(%p,0x%08x,%p,0x%08lx,%p),stub!\n",
180                         ProcessHandle,ProcessInformationClass,
181                         ProcessInformation,ProcessInformationLength,
182                         ReturnLength
183                 );
184                 break;
185         }
186
187         if (ReturnLength)
188                 *ReturnLength = len;
189
190         return ret;
191 }
192
193 /******************************************************************************
194  * NtSetInformationProcess [NTDLL.@]
195  * ZwSetInformationProcess [NTDLL.@]
196  */
197 NTSTATUS WINAPI NtSetInformationProcess(
198         IN HANDLE ProcessHandle,
199         IN PROCESSINFOCLASS ProcessInformationClass,
200         IN PVOID ProcessInformation,
201         IN ULONG ProcessInformationLength)
202 {
203         FIXME("(%p,0x%08x,%p,0x%08lx) stub\n",
204         ProcessHandle,ProcessInformationClass,ProcessInformation,ProcessInformationLength);
205         return 0;
206 }
207
208 /*
209  *      Thread
210  */
211
212 /******************************************************************************
213 *  NtQueryInformationThread             [NTDLL.@]
214 *  ZwQueryInformationThread             [NTDLL.@]
215 *
216 */
217 NTSTATUS WINAPI NtQueryInformationThread(
218         IN HANDLE ThreadHandle,
219         IN THREADINFOCLASS ThreadInformationClass,
220         OUT PVOID ThreadInformation,
221         IN ULONG ThreadInformationLength,
222         OUT PULONG ReturnLength)
223 {
224         FIXME("(%p,0x%08x,%p,0x%08lx,%p),stub!\n",
225                 ThreadHandle, ThreadInformationClass, ThreadInformation,
226                 ThreadInformationLength, ReturnLength);
227         return 0;
228 }
229
230 /******************************************************************************
231  *  NtSetInformationThread              [NTDLL.@]
232  *  ZwSetInformationThread              [NTDLL.@]
233  */
234 NTSTATUS WINAPI NtSetInformationThread(
235         HANDLE ThreadHandle,
236         THREADINFOCLASS ThreadInformationClass,
237         PVOID ThreadInformation,
238         ULONG ThreadInformationLength)
239 {
240         FIXME("(%p,0x%08x,%p,0x%08lx),stub!\n",
241         ThreadHandle, ThreadInformationClass, ThreadInformation, ThreadInformationLength);
242         return 0;
243 }
244
245 /*
246  *      Token
247  */
248
249 /******************************************************************************
250  *  NtDuplicateToken            [NTDLL.@]
251  *  ZwDuplicateToken            [NTDLL.@]
252  */
253 NTSTATUS WINAPI NtDuplicateToken(
254         IN HANDLE ExistingToken,
255         IN ACCESS_MASK DesiredAccess,
256         IN POBJECT_ATTRIBUTES ObjectAttributes,
257         IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
258         IN TOKEN_TYPE TokenType,
259         OUT PHANDLE NewToken)
260 {
261         FIXME("(%p,0x%08lx,%p,0x%08x,0x%08x,%p),stub!\n",
262         ExistingToken, DesiredAccess, ObjectAttributes,
263         ImpersonationLevel, TokenType, NewToken);
264         dump_ObjectAttributes(ObjectAttributes);
265         return 0;
266 }
267
268 /******************************************************************************
269  *  NtOpenProcessToken          [NTDLL.@]
270  *  ZwOpenProcessToken          [NTDLL.@]
271  */
272 NTSTATUS WINAPI NtOpenProcessToken(
273         HANDLE ProcessHandle,
274         DWORD DesiredAccess,
275         HANDLE *TokenHandle)
276 {
277         FIXME("(%p,0x%08lx,%p): stub\n",
278         ProcessHandle,DesiredAccess, TokenHandle);
279         *TokenHandle = (HANDLE)0xcafe;
280         return 0;
281 }
282
283 /******************************************************************************
284  *  NtOpenThreadToken           [NTDLL.@]
285  *  ZwOpenThreadToken           [NTDLL.@]
286  */
287 NTSTATUS WINAPI NtOpenThreadToken(
288         HANDLE ThreadHandle,
289         DWORD DesiredAccess,
290         BOOLEAN OpenAsSelf,
291         HANDLE *TokenHandle)
292 {
293         FIXME("(%p,0x%08lx,0x%08x,%p): stub\n",
294         ThreadHandle,DesiredAccess, OpenAsSelf, TokenHandle);
295         *TokenHandle = (HANDLE)0xcafe;
296         return 0;
297 }
298
299 /******************************************************************************
300  *  NtAdjustPrivilegesToken             [NTDLL.@]
301  *  ZwAdjustGroupsToken         [NTDLL.@]
302  *
303  * FIXME: parameters unsafe
304  */
305 NTSTATUS WINAPI NtAdjustPrivilegesToken(
306         IN HANDLE TokenHandle,
307         IN BOOLEAN DisableAllPrivileges,
308         IN PTOKEN_PRIVILEGES NewState,
309         IN DWORD BufferLength,
310         OUT PTOKEN_PRIVILEGES PreviousState,
311         OUT PDWORD ReturnLength)
312 {
313         FIXME("(%p,0x%08x,%p,0x%08lx,%p,%p),stub!\n",
314         TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength);
315         return 0;
316 }
317
318 /******************************************************************************
319 *  NtQueryInformationToken              [NTDLL.@]
320 *  ZwQueryInformationToken              [NTDLL.@]
321 *
322 * NOTES
323 *  Buffer for TokenUser:
324 *   0x00 TOKEN_USER the PSID field points to the SID
325 *   0x08 SID
326 *
327 */
328 NTSTATUS WINAPI NtQueryInformationToken(
329         HANDLE token,
330         DWORD tokeninfoclass,
331         LPVOID tokeninfo,
332         DWORD tokeninfolength,
333         LPDWORD retlen )
334 {
335     unsigned int len = 0;
336
337     FIXME("(%p,%ld,%p,%ld,%p): stub\n",
338           token,tokeninfoclass,tokeninfo,tokeninfolength,retlen);
339
340     switch (tokeninfoclass)
341     {
342     case TokenUser:
343         len = sizeof(TOKEN_USER) + sizeof(SID);
344         break;
345     case TokenGroups:
346         len = sizeof(TOKEN_GROUPS);
347         break;
348     case TokenPrivileges:
349         len = sizeof(TOKEN_PRIVILEGES);
350         break;
351     case TokenOwner:
352         len = sizeof(TOKEN_OWNER);
353         break;
354     case TokenPrimaryGroup:
355         len = sizeof(TOKEN_PRIMARY_GROUP);
356         break;
357     case TokenDefaultDacl:
358         len = sizeof(TOKEN_DEFAULT_DACL);
359         break;
360     case TokenSource:
361         len = sizeof(TOKEN_SOURCE);
362         break;
363     case TokenType:
364         len = sizeof (TOKEN_TYPE);
365         break;
366 #if 0
367     case TokenImpersonationLevel:
368     case TokenStatistics:
369 #endif /* 0 */
370     }
371
372     /* FIXME: what if retlen == NULL ? */
373     *retlen = len;
374
375     if (tokeninfolength < len)
376         return STATUS_BUFFER_TOO_SMALL;
377
378     switch (tokeninfoclass)
379     {
380     case TokenUser:
381         if( tokeninfo )
382         {
383             TOKEN_USER * tuser = tokeninfo;
384             PSID sid = (PSID) (tuser + 1);
385             SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
386             RtlInitializeSid(sid, &localSidAuthority, 1);
387             *(RtlSubAuthoritySid(sid, 0)) = SECURITY_INTERACTIVE_RID;
388             tuser->User.Sid = sid;
389         }
390         break;
391     case TokenGroups:
392         if (tokeninfo)
393         {
394             TOKEN_GROUPS *tgroups = tokeninfo;
395             SID_IDENTIFIER_AUTHORITY sid = {SECURITY_NT_AUTHORITY};
396
397             /* we need to show admin privileges ! */
398             tgroups->GroupCount = 1;
399             RtlAllocateAndInitializeSid( &sid,
400                                          2,
401                                          SECURITY_BUILTIN_DOMAIN_RID,
402                                          DOMAIN_ALIAS_RID_ADMINS,
403                                          0, 0, 0, 0, 0, 0,
404                                          &(tgroups->Groups->Sid));
405         }
406         break;
407     case TokenPrivileges:
408         if (tokeninfo)
409         {
410             TOKEN_PRIVILEGES *tpriv = tokeninfo;
411             tpriv->PrivilegeCount = 1;
412         }
413         break;
414     }
415     return 0;
416 }
417
418 /*
419  *      Section
420  */
421
422 /******************************************************************************
423  *  NtQuerySection      [NTDLL.@]
424  */
425 NTSTATUS WINAPI NtQuerySection(
426         IN HANDLE SectionHandle,
427         IN PVOID SectionInformationClass,
428         OUT PVOID SectionInformation,
429         IN ULONG Length,
430         OUT PULONG ResultLength)
431 {
432         FIXME("(%p,%p,%p,0x%08lx,%p) stub!\n",
433         SectionHandle,SectionInformationClass,SectionInformation,Length,ResultLength);
434         return 0;
435 }
436
437 /*
438  *      ports
439  */
440
441 /******************************************************************************
442  *  NtCreatePort                [NTDLL.@]
443  *  ZwCreatePort                [NTDLL.@]
444  */
445 NTSTATUS WINAPI NtCreatePort(PHANDLE PortHandle,POBJECT_ATTRIBUTES ObjectAttributes,
446                              DWORD MaxConnectInfoLength,DWORD MaxDataLength,DWORD unknown)
447 {
448   FIXME("(%p,%p,0x%08lx,0x%08lx,0x%08lx),stub!\n",PortHandle,ObjectAttributes,
449         MaxConnectInfoLength,MaxDataLength,unknown);
450   return 0;
451 }
452
453 /******************************************************************************
454  *  NtConnectPort               [NTDLL.@]
455  *  ZwConnectPort               [NTDLL.@]
456  */
457 NTSTATUS WINAPI NtConnectPort(PHANDLE PortHandle,PUNICODE_STRING PortName,PVOID Unknown1,
458                               PLPCSECTIONINFO sectionInfo,PLPCSECTIONMAPINFO mapInfo,PVOID Unknown2,
459                               PVOID ConnectInfo,PDWORD pConnectInfoLength)
460 {
461   FIXME("(%p,%s,%p,%p,%p,%p,%p,%p (%ld)),stub!\n",PortHandle,debugstr_w(PortName->Buffer),Unknown1,
462         sectionInfo,mapInfo,Unknown2,ConnectInfo,pConnectInfoLength,pConnectInfoLength?*pConnectInfoLength:-1);
463   if(ConnectInfo && pConnectInfoLength)
464     TRACE("\tMessage = %s\n",debugstr_an(ConnectInfo,*pConnectInfoLength));
465   return 0;
466 }
467
468 /******************************************************************************
469  *  NtListenPort                [NTDLL.@]
470  *  ZwListenPort                [NTDLL.@]
471  */
472 NTSTATUS WINAPI NtListenPort(HANDLE PortHandle,PLPCMESSAGE pLpcMessage)
473 {
474   FIXME("(%p,%p),stub!\n",PortHandle,pLpcMessage);
475   return 0;
476 }
477
478 /******************************************************************************
479  *  NtAcceptConnectPort [NTDLL.@]
480  *  ZwAcceptConnectPort [NTDLL.@]
481  */
482 NTSTATUS WINAPI NtAcceptConnectPort(PHANDLE PortHandle,DWORD Unknown,PLPCMESSAGE pLpcMessage,
483                                     DWORD acceptIt,DWORD Unknown2,PLPCSECTIONMAPINFO mapInfo)
484 {
485   FIXME("(%p,0x%08lx,%p,0x%08lx,0x%08lx,%p),stub!\n",PortHandle,Unknown,pLpcMessage,acceptIt,Unknown2,mapInfo);
486   return 0;
487 }
488
489 /******************************************************************************
490  *  NtCompleteConnectPort       [NTDLL.@]
491  *  ZwCompleteConnectPort       [NTDLL.@]
492  */
493 NTSTATUS WINAPI NtCompleteConnectPort(HANDLE PortHandle)
494 {
495   FIXME("(%p),stub!\n",PortHandle);
496   return 0;
497 }
498
499 /******************************************************************************
500  *  NtRegisterThreadTerminatePort       [NTDLL.@]
501  *  ZwRegisterThreadTerminatePort       [NTDLL.@]
502  */
503 NTSTATUS WINAPI NtRegisterThreadTerminatePort(HANDLE PortHandle)
504 {
505   FIXME("(%p),stub!\n",PortHandle);
506   return 0;
507 }
508
509 /******************************************************************************
510  *  NtRequestWaitReplyPort              [NTDLL.@]
511  *  ZwRequestWaitReplyPort              [NTDLL.@]
512  */
513 NTSTATUS WINAPI NtRequestWaitReplyPort(HANDLE PortHandle,PLPCMESSAGE pLpcMessageIn,PLPCMESSAGE pLpcMessageOut)
514 {
515   FIXME("(%p,%p,%p),stub!\n",PortHandle,pLpcMessageIn,pLpcMessageOut);
516   if(pLpcMessageIn)
517   {
518     TRACE("Message to send:\n");
519     TRACE("\tActualMessageLength = %d\n",pLpcMessageIn->ActualMessageLength);
520     TRACE("\tTotalMessageLength  = %d\n",pLpcMessageIn->TotalMessageLength);
521     TRACE("\tMessageType         = %ld\n",pLpcMessageIn->MessageType);
522     TRACE("\tClientProcessId     = %ld\n",pLpcMessageIn->ClientProcessId);
523     TRACE("\tClientThreadId      = %ld\n",pLpcMessageIn->ClientThreadId);
524     TRACE("\tMessageId           = %ld\n",pLpcMessageIn->MessageId);
525     TRACE("\tSharedSectionSize   = %ld\n",pLpcMessageIn->SharedSectionSize);
526     TRACE("\tMessageData         = %s\n",debugstr_an(pLpcMessageIn->MessageData,pLpcMessageIn->ActualMessageLength));
527   }
528   return 0;
529 }
530
531 /******************************************************************************
532  *  NtReplyWaitReceivePort      [NTDLL.@]
533  *  ZwReplyWaitReceivePort      [NTDLL.@]
534  */
535 NTSTATUS WINAPI NtReplyWaitReceivePort(HANDLE PortHandle,PDWORD Unknown,PLPCMESSAGE pLpcMessageOut,PLPCMESSAGE pLpcMessageIn)
536 {
537   FIXME("(%p,%p,%p,%p),stub!\n",PortHandle,Unknown,pLpcMessageOut,pLpcMessageIn);
538   return 0;
539 }
540
541 /*
542  *      Misc
543  */
544
545  /******************************************************************************
546  *  NtSetIntervalProfile        [NTDLL.@]
547  *  ZwSetIntervalProfile        [NTDLL.@]
548  */
549 NTSTATUS WINAPI NtSetIntervalProfile(DWORD x1,DWORD x2) {
550         FIXME("(0x%08lx,0x%08lx),stub!\n",x1,x2);
551         return 0;
552 }
553
554 /******************************************************************************
555  *  NtQueryPerformanceCounter   [NTDLL.@]
556  */
557 NTSTATUS WINAPI NtQueryPerformanceCounter(
558         IN PLARGE_INTEGER Counter,
559         IN PLARGE_INTEGER Frequency)
560 {
561         FIXME("(%p, 0%p) stub\n",
562         Counter, Frequency);
563         return 0;
564 }
565
566 /******************************************************************************
567  *  NtCreateMailslotFile        [NTDLL.@]
568  *  ZwCreateMailslotFile        [NTDLL.@]
569  */
570 NTSTATUS WINAPI NtCreateMailslotFile(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8)
571 {
572         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);
573         return 0;
574 }
575
576 /******************************************************************************
577  * NtQuerySystemInformation [NTDLL.@]
578  * ZwQuerySystemInformation [NTDLL.@]
579  *
580  * ARGUMENTS:
581  *  SystemInformationClass      Index to a certain information structure
582  *      SystemTimeAdjustmentInformation SYSTEM_TIME_ADJUSTMENT
583  *      SystemCacheInformation          SYSTEM_CACHE_INFORMATION
584  *      SystemConfigurationInformation  CONFIGURATION_INFORMATION
585  *      observed (class/len):
586  *              0x0/0x2c
587  *              0x12/0x18
588  *              0x2/0x138
589  *              0x8/0x600
590  *              0x25/0xc
591  *  SystemInformation   caller supplies storage for the information structure
592  *  Length              size of the structure
593  *  ResultLength        Data written
594  */
595 NTSTATUS WINAPI NtQuerySystemInformation(
596         IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
597         OUT PVOID SystemInformation,
598         IN ULONG Length,
599         OUT PULONG ResultLength)
600 {
601     switch(SystemInformationClass)
602     {
603     case 0x25:
604         /* Something to do with the size of the registry             *
605          * Since we don't have a size limitation, fake it            *
606          * This is almost certainly wrong.                           *
607          * This sets each of the three words in the struct to 32 MB, *
608          * which is enough to make the IE 5 installer happy.         */
609         FIXME("(0x%08x,%p,0x%08lx,%p) faking max registry size of 32 MB\n",
610               SystemInformationClass,SystemInformation,Length,ResultLength);
611         *(DWORD *)SystemInformation = 0x2000000;
612         *(((DWORD *)SystemInformation)+1) = 0x200000;
613         *(((DWORD *)SystemInformation)+2) = 0x200000;
614         break;
615
616     default:
617         FIXME("(0x%08x,%p,0x%08lx,%p) stub\n",
618               SystemInformationClass,SystemInformation,Length,ResultLength);
619         ZeroMemory (SystemInformation, Length);
620     }
621
622     return STATUS_SUCCESS;
623 }
624
625
626 /******************************************************************************
627  *  NtCreatePagingFile          [NTDLL.@]
628  *  ZwCreatePagingFile          [NTDLL.@]
629  */
630 NTSTATUS WINAPI NtCreatePagingFile(
631         IN PUNICODE_STRING PageFileName,
632         IN ULONG MiniumSize,
633         IN ULONG MaxiumSize,
634         OUT PULONG ActualSize)
635 {
636         FIXME("(%p(%s),0x%08lx,0x%08lx,%p),stub!\n",
637         PageFileName->Buffer, debugstr_w(PageFileName->Buffer),MiniumSize,MaxiumSize,ActualSize);
638         return 0;
639 }
640
641 /******************************************************************************
642  *  NtDisplayString                             [NTDLL.@]
643  *
644  * writes a string to the nt-textmode screen eg. during startup
645  */
646 NTSTATUS WINAPI NtDisplayString ( PUNICODE_STRING string )
647 {
648     STRING stringA;
649     NTSTATUS ret;
650
651     if (!(ret = RtlUnicodeStringToAnsiString( &stringA, string, TRUE )))
652     {
653         MESSAGE( "%.*s", stringA.Length, stringA.Buffer );
654         RtlFreeAnsiString( &stringA );
655     }
656     return ret;
657 }
658
659 /******************************************************************************
660  *  NtPowerInformation                          [NTDLL.@]
661  *
662  */
663 NTSTATUS WINAPI NtPowerInformation(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5)
664 {
665         FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub\n",x1,x2,x3,x4,x5);
666         return 0;
667 }
668
669 /******************************************************************************
670  *  NtAllocateLocallyUniqueId (NTDLL.@)
671  *
672  * FIXME: the server should do that
673  */
674 NTSTATUS WINAPI NtAllocateLocallyUniqueId(PLUID Luid)
675 {
676     static LUID luid;
677
678     FIXME("%p (0x%08lx%08lx)\n", Luid, luid.HighPart, luid.LowPart);
679
680     luid.LowPart++;
681     if (luid.LowPart==0)
682         luid.HighPart++;
683     Luid->HighPart = luid.HighPart;
684     Luid->LowPart = luid.LowPart;
685
686     return STATUS_SUCCESS;
687 }
688
689 /******************************************************************************
690  *        VerSetConditionMask   (NTDLL.@)
691  */
692 ULONGLONG WINAPI VerSetConditionMask( ULONGLONG dwlConditionMask, DWORD dwTypeBitMask,
693                                       BYTE dwConditionMask)
694 {
695     if(dwTypeBitMask == 0)
696         return dwlConditionMask;
697     dwConditionMask &= 0x07;
698     if(dwConditionMask == 0)
699         return dwlConditionMask;
700
701     if(dwTypeBitMask & VER_PRODUCT_TYPE)
702         dwlConditionMask |= dwConditionMask << 7*3;
703     else if (dwTypeBitMask & VER_SUITENAME)
704         dwlConditionMask |= dwConditionMask << 6*3;
705     else if (dwTypeBitMask & VER_SERVICEPACKMAJOR)
706         dwlConditionMask |= dwConditionMask << 5*3;
707     else if (dwTypeBitMask & VER_SERVICEPACKMINOR)
708         dwlConditionMask |= dwConditionMask << 4*3;
709     else if (dwTypeBitMask & VER_PLATFORMID)
710         dwlConditionMask |= dwConditionMask << 3*3;
711     else if (dwTypeBitMask & VER_BUILDNUMBER)
712         dwlConditionMask |= dwConditionMask << 2*3;
713     else if (dwTypeBitMask & VER_MAJORVERSION)
714         dwlConditionMask |= dwConditionMask << 1*3;
715     else if (dwTypeBitMask & VER_MINORVERSION)
716         dwlConditionMask |= dwConditionMask << 0*3;
717     return dwlConditionMask;
718 }