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