Moved some more definitions out of undocshell.h into the exported
[wine/multimedia.git] / dlls / ntdll / nt.c
blobf70fbdde151104edee5a96c544a26cb539e3e6f2
1 /*
2 * NT basis DLL
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)
7 * Copyright 1996-1998 Marcus Meissner
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.
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.
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
24 #include <stdarg.h>
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <time.h>
29 #include "wine/debug.h"
31 #include "windef.h"
32 #include "winbase.h"
33 #include "winreg.h"
34 #include "winternl.h"
35 #include "ntdll_misc.h"
36 #include "wine/server.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
40 /* Structures used by NtConnectPort */
42 typedef struct LpcSectionInfo
44 DWORD Length;
45 HANDLE SectionHandle;
46 DWORD Param1;
47 DWORD SectionSize;
48 DWORD ClientBaseAddress;
49 DWORD ServerBaseAddress;
50 } LPCSECTIONINFO, *PLPCSECTIONINFO;
52 typedef struct LpcSectionMapInfo
54 DWORD Length;
55 DWORD SectionSize;
56 DWORD ServerBaseAddress;
57 } LPCSECTIONMAPINFO, *PLPCSECTIONMAPINFO;
59 /* Structure used by NtAcceptConnectPort, NtReplyWaitReceivePort */
61 #define MAX_MESSAGE_DATA 328
63 typedef struct LpcMessage
65 WORD ActualMessageLength;
66 WORD TotalMessageLength;
67 DWORD MessageType;
68 DWORD ClientProcessId;
69 DWORD ClientThreadId;
70 DWORD MessageId;
71 DWORD SharedSectionSize;
72 BYTE MessageData[MAX_MESSAGE_DATA];
73 } LPCMESSAGE, *PLPCMESSAGE;
76 * Token
79 /******************************************************************************
80 * NtDuplicateToken [NTDLL.@]
81 * ZwDuplicateToken [NTDLL.@]
83 NTSTATUS WINAPI NtDuplicateToken(
84 IN HANDLE ExistingToken,
85 IN ACCESS_MASK DesiredAccess,
86 IN POBJECT_ATTRIBUTES ObjectAttributes,
87 IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
88 IN TOKEN_TYPE TokenType,
89 OUT PHANDLE NewToken)
91 FIXME("(%p,0x%08lx,%p,0x%08x,0x%08x,%p),stub!\n",
92 ExistingToken, DesiredAccess, ObjectAttributes,
93 ImpersonationLevel, TokenType, NewToken);
94 dump_ObjectAttributes(ObjectAttributes);
95 return 0;
98 /******************************************************************************
99 * NtOpenProcessToken [NTDLL.@]
100 * ZwOpenProcessToken [NTDLL.@]
102 NTSTATUS WINAPI NtOpenProcessToken(
103 HANDLE ProcessHandle,
104 DWORD DesiredAccess,
105 HANDLE *TokenHandle)
107 NTSTATUS ret;
109 TRACE("(%p,0x%08lx,%p)\n", ProcessHandle,DesiredAccess, TokenHandle);
111 SERVER_START_REQ( open_token )
113 req->handle = ProcessHandle;
114 req->flags = 0;
115 ret = wine_server_call( req );
116 if (!ret) *TokenHandle = reply->token;
118 SERVER_END_REQ;
120 return ret;
123 /******************************************************************************
124 * NtOpenThreadToken [NTDLL.@]
125 * ZwOpenThreadToken [NTDLL.@]
127 NTSTATUS WINAPI NtOpenThreadToken(
128 HANDLE ThreadHandle,
129 DWORD DesiredAccess,
130 BOOLEAN OpenAsSelf,
131 HANDLE *TokenHandle)
133 NTSTATUS ret;
135 TRACE("(%p,0x%08lx,0x%08x,%p)\n",
136 ThreadHandle,DesiredAccess, OpenAsSelf, TokenHandle);
138 SERVER_START_REQ( open_token )
140 req->handle = ThreadHandle;
141 req->flags = OPEN_TOKEN_THREAD;
142 if (OpenAsSelf) req->flags |= OPEN_TOKEN_AS_SELF;
143 ret = wine_server_call( req );
144 if (!ret) *TokenHandle = reply->token;
146 SERVER_END_REQ;
148 return ret;
151 /******************************************************************************
152 * NtAdjustPrivilegesToken [NTDLL.@]
153 * ZwAdjustGroupsToken [NTDLL.@]
155 * FIXME: parameters unsafe
157 NTSTATUS WINAPI NtAdjustPrivilegesToken(
158 IN HANDLE TokenHandle,
159 IN BOOLEAN DisableAllPrivileges,
160 IN PTOKEN_PRIVILEGES NewState,
161 IN DWORD BufferLength,
162 OUT PTOKEN_PRIVILEGES PreviousState,
163 OUT PDWORD ReturnLength)
165 FIXME("(%p,0x%08x,%p,0x%08lx,%p,%p),stub!\n",
166 TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength);
167 return 0;
170 /******************************************************************************
171 * NtQueryInformationToken [NTDLL.@]
172 * ZwQueryInformationToken [NTDLL.@]
174 * NOTES
175 * Buffer for TokenUser:
176 * 0x00 TOKEN_USER the PSID field points to the SID
177 * 0x08 SID
180 NTSTATUS WINAPI NtQueryInformationToken(
181 HANDLE token,
182 DWORD tokeninfoclass,
183 LPVOID tokeninfo,
184 DWORD tokeninfolength,
185 LPDWORD retlen )
187 unsigned int len = 0;
189 FIXME("(%p,%ld,%p,%ld,%p): stub\n",
190 token,tokeninfoclass,tokeninfo,tokeninfolength,retlen);
192 switch (tokeninfoclass)
194 case TokenUser:
195 len = sizeof(TOKEN_USER) + sizeof(SID);
196 break;
197 case TokenGroups:
198 len = sizeof(TOKEN_GROUPS);
199 break;
200 case TokenPrivileges:
201 len = sizeof(TOKEN_PRIVILEGES);
202 break;
203 case TokenOwner:
204 len = sizeof(TOKEN_OWNER) + sizeof(SID);
205 break;
206 case TokenPrimaryGroup:
207 len = sizeof(TOKEN_PRIMARY_GROUP);
208 break;
209 case TokenDefaultDacl:
210 len = sizeof(TOKEN_DEFAULT_DACL);
211 break;
212 case TokenSource:
213 len = sizeof(TOKEN_SOURCE);
214 break;
215 case TokenType:
216 len = sizeof (TOKEN_TYPE);
217 break;
218 #if 0
219 case TokenImpersonationLevel:
220 case TokenStatistics:
221 #endif /* 0 */
224 /* FIXME: what if retlen == NULL ? */
225 *retlen = len;
227 if (tokeninfolength < len)
228 return STATUS_BUFFER_TOO_SMALL;
230 switch (tokeninfoclass)
232 case TokenUser:
233 if( tokeninfo )
235 TOKEN_USER * tuser = tokeninfo;
236 PSID sid = (PSID) (tuser + 1);
237 SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
238 RtlInitializeSid(sid, &localSidAuthority, 1);
239 *(RtlSubAuthoritySid(sid, 0)) = SECURITY_INTERACTIVE_RID;
240 tuser->User.Sid = sid;
242 break;
243 case TokenGroups:
244 if (tokeninfo)
246 TOKEN_GROUPS *tgroups = tokeninfo;
247 SID_IDENTIFIER_AUTHORITY sid = {SECURITY_NT_AUTHORITY};
249 /* we need to show admin privileges ! */
250 tgroups->GroupCount = 1;
251 tgroups->Groups->Attributes = SE_GROUP_ENABLED;
252 RtlAllocateAndInitializeSid( &sid,
254 SECURITY_BUILTIN_DOMAIN_RID,
255 DOMAIN_ALIAS_RID_ADMINS,
256 0, 0, 0, 0, 0, 0,
257 &(tgroups->Groups->Sid));
259 break;
260 case TokenPrivileges:
261 if (tokeninfo)
263 TOKEN_PRIVILEGES *tpriv = tokeninfo;
264 tpriv->PrivilegeCount = 1;
266 break;
267 case TokenOwner:
268 if (tokeninfo)
270 TOKEN_OWNER *owner = tokeninfo;
271 PSID sid = (PSID) (owner + 1);
272 SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
273 RtlInitializeSid(sid, &localSidAuthority, 1);
274 *(RtlSubAuthoritySid(sid, 0)) = SECURITY_INTERACTIVE_RID;
275 owner->Owner = sid;
277 break;
279 return 0;
283 * Section
286 /******************************************************************************
287 * NtQuerySection [NTDLL.@]
289 NTSTATUS WINAPI NtQuerySection(
290 IN HANDLE SectionHandle,
291 IN PVOID SectionInformationClass,
292 OUT PVOID SectionInformation,
293 IN ULONG Length,
294 OUT PULONG ResultLength)
296 FIXME("(%p,%p,%p,0x%08lx,%p) stub!\n",
297 SectionHandle,SectionInformationClass,SectionInformation,Length,ResultLength);
298 return 0;
302 * ports
305 /******************************************************************************
306 * NtCreatePort [NTDLL.@]
307 * ZwCreatePort [NTDLL.@]
309 NTSTATUS WINAPI NtCreatePort(PHANDLE PortHandle,POBJECT_ATTRIBUTES ObjectAttributes,
310 DWORD MaxConnectInfoLength,DWORD MaxDataLength,DWORD unknown)
312 FIXME("(%p,%p,0x%08lx,0x%08lx,0x%08lx),stub!\n",PortHandle,ObjectAttributes,
313 MaxConnectInfoLength,MaxDataLength,unknown);
314 return 0;
317 /******************************************************************************
318 * NtConnectPort [NTDLL.@]
319 * ZwConnectPort [NTDLL.@]
321 NTSTATUS WINAPI NtConnectPort(PHANDLE PortHandle,PUNICODE_STRING PortName,PVOID Unknown1,
322 PLPCSECTIONINFO sectionInfo,PLPCSECTIONMAPINFO mapInfo,PVOID Unknown2,
323 PVOID ConnectInfo,PDWORD pConnectInfoLength)
325 FIXME("(%p,%s,%p,%p,%p,%p,%p,%p (%ld)),stub!\n",PortHandle,debugstr_w(PortName->Buffer),Unknown1,
326 sectionInfo,mapInfo,Unknown2,ConnectInfo,pConnectInfoLength,pConnectInfoLength?*pConnectInfoLength:-1);
327 if(ConnectInfo && pConnectInfoLength)
328 TRACE("\tMessage = %s\n",debugstr_an(ConnectInfo,*pConnectInfoLength));
329 return 0;
332 /******************************************************************************
333 * NtListenPort [NTDLL.@]
334 * ZwListenPort [NTDLL.@]
336 NTSTATUS WINAPI NtListenPort(HANDLE PortHandle,PLPCMESSAGE pLpcMessage)
338 FIXME("(%p,%p),stub!\n",PortHandle,pLpcMessage);
339 return 0;
342 /******************************************************************************
343 * NtAcceptConnectPort [NTDLL.@]
344 * ZwAcceptConnectPort [NTDLL.@]
346 NTSTATUS WINAPI NtAcceptConnectPort(PHANDLE PortHandle,DWORD Unknown,PLPCMESSAGE pLpcMessage,
347 DWORD acceptIt,DWORD Unknown2,PLPCSECTIONMAPINFO mapInfo)
349 FIXME("(%p,0x%08lx,%p,0x%08lx,0x%08lx,%p),stub!\n",PortHandle,Unknown,pLpcMessage,acceptIt,Unknown2,mapInfo);
350 return 0;
353 /******************************************************************************
354 * NtCompleteConnectPort [NTDLL.@]
355 * ZwCompleteConnectPort [NTDLL.@]
357 NTSTATUS WINAPI NtCompleteConnectPort(HANDLE PortHandle)
359 FIXME("(%p),stub!\n",PortHandle);
360 return 0;
363 /******************************************************************************
364 * NtRegisterThreadTerminatePort [NTDLL.@]
365 * ZwRegisterThreadTerminatePort [NTDLL.@]
367 NTSTATUS WINAPI NtRegisterThreadTerminatePort(HANDLE PortHandle)
369 FIXME("(%p),stub!\n",PortHandle);
370 return 0;
373 /******************************************************************************
374 * NtRequestWaitReplyPort [NTDLL.@]
375 * ZwRequestWaitReplyPort [NTDLL.@]
377 NTSTATUS WINAPI NtRequestWaitReplyPort(HANDLE PortHandle,PLPCMESSAGE pLpcMessageIn,PLPCMESSAGE pLpcMessageOut)
379 FIXME("(%p,%p,%p),stub!\n",PortHandle,pLpcMessageIn,pLpcMessageOut);
380 if(pLpcMessageIn)
382 TRACE("Message to send:\n");
383 TRACE("\tActualMessageLength = %d\n",pLpcMessageIn->ActualMessageLength);
384 TRACE("\tTotalMessageLength = %d\n",pLpcMessageIn->TotalMessageLength);
385 TRACE("\tMessageType = %ld\n",pLpcMessageIn->MessageType);
386 TRACE("\tClientProcessId = %ld\n",pLpcMessageIn->ClientProcessId);
387 TRACE("\tClientThreadId = %ld\n",pLpcMessageIn->ClientThreadId);
388 TRACE("\tMessageId = %ld\n",pLpcMessageIn->MessageId);
389 TRACE("\tSharedSectionSize = %ld\n",pLpcMessageIn->SharedSectionSize);
390 TRACE("\tMessageData = %s\n",debugstr_an(pLpcMessageIn->MessageData,pLpcMessageIn->ActualMessageLength));
392 return 0;
395 /******************************************************************************
396 * NtReplyWaitReceivePort [NTDLL.@]
397 * ZwReplyWaitReceivePort [NTDLL.@]
399 NTSTATUS WINAPI NtReplyWaitReceivePort(HANDLE PortHandle,PDWORD Unknown,PLPCMESSAGE pLpcMessageOut,PLPCMESSAGE pLpcMessageIn)
401 FIXME("(%p,%p,%p,%p),stub!\n",PortHandle,Unknown,pLpcMessageOut,pLpcMessageIn);
402 return 0;
406 * Misc
409 /******************************************************************************
410 * NtSetIntervalProfile [NTDLL.@]
411 * ZwSetIntervalProfile [NTDLL.@]
413 NTSTATUS WINAPI NtSetIntervalProfile(DWORD x1,DWORD x2) {
414 FIXME("(0x%08lx,0x%08lx),stub!\n",x1,x2);
415 return 0;
418 /******************************************************************************
419 * NtQueryPerformanceCounter [NTDLL.@]
421 NTSTATUS WINAPI NtQueryPerformanceCounter(
422 IN PLARGE_INTEGER Counter,
423 IN PLARGE_INTEGER Frequency)
425 FIXME("(%p, 0%p) stub\n",
426 Counter, Frequency);
427 return 0;
430 /******************************************************************************
431 * NtCreateMailslotFile [NTDLL.@]
432 * ZwCreateMailslotFile [NTDLL.@]
434 NTSTATUS WINAPI NtCreateMailslotFile(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8)
436 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);
437 return 0;
440 /******************************************************************************
441 * NtQuerySystemInformation [NTDLL.@]
442 * ZwQuerySystemInformation [NTDLL.@]
444 * ARGUMENTS:
445 * SystemInformationClass Index to a certain information structure
446 * SystemTimeAdjustmentInformation SYSTEM_TIME_ADJUSTMENT
447 * SystemCacheInformation SYSTEM_CACHE_INFORMATION
448 * SystemConfigurationInformation CONFIGURATION_INFORMATION
449 * observed (class/len):
450 * 0x0/0x2c
451 * 0x12/0x18
452 * 0x2/0x138
453 * 0x8/0x600
454 * 0x25/0xc
455 * SystemInformation caller supplies storage for the information structure
456 * Length size of the structure
457 * ResultLength Data written
459 NTSTATUS WINAPI NtQuerySystemInformation(
460 IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
461 OUT PVOID SystemInformation,
462 IN ULONG Length,
463 OUT PULONG ResultLength)
465 NTSTATUS ret = STATUS_SUCCESS;
466 ULONG len = 0;
468 TRACE("(0x%08x,%p,0x%08lx,%p)\n",
469 SystemInformationClass,SystemInformation,Length,ResultLength);
471 switch (SystemInformationClass)
473 case SystemBasicInformation:
475 SYSTEM_BASIC_INFORMATION* sbi = (SYSTEM_BASIC_INFORMATION*)SystemInformation;
476 if (Length >= sizeof(*sbi))
478 sbi->dwUnknown1 = 0;
479 sbi->uKeMaximumIncrement = 0;
480 sbi->uPageSize = 1024; /* FIXME */
481 sbi->uMmNumberOfPhysicalPages = 12345; /* FIXME */
482 sbi->uMmLowestPhysicalPage = 0; /* FIXME */
483 sbi->uMmHighestPhysicalPage = 12345; /* FIXME */
484 sbi->uAllocationGranularity = 65536; /* FIXME */
485 sbi->pLowestUserAddress = 0; /* FIXME */
486 sbi->pMmHighestUserAddress = (void*)~0; /* FIXME */
487 sbi->uKeActiveProcessors = 1; /* FIXME */
488 sbi->bKeNumberProcessors = 1; /* FIXME */
489 len = sizeof(*sbi);
491 else ret = STATUS_INFO_LENGTH_MISMATCH;
493 break;
494 case SystemPerformanceInformation:
496 SYSTEM_PERFORMANCE_INFORMATION* spi = (SYSTEM_PERFORMANCE_INFORMATION*)SystemInformation;
497 if (Length >= sizeof(*spi))
499 memset(spi, 0, sizeof(*spi)); /* FIXME */
500 len = sizeof(*spi);
502 else ret = STATUS_INFO_LENGTH_MISMATCH;
504 break;
505 case SystemTimeOfDayInformation:
507 SYSTEM_TIMEOFDAY_INFORMATION* sti = (SYSTEM_TIMEOFDAY_INFORMATION*)SystemInformation;
508 if (Length >= sizeof(*sti))
510 sti->liKeBootTime.QuadPart = 0; /* FIXME */
511 sti->liKeSystemTime.QuadPart = 0; /* FIXME */
512 sti->liExpTimeZoneBias.QuadPart = 0; /* FIXME */
513 sti->uCurrentTimeZoneId = 0; /* FIXME */
514 sti->dwReserved = 0;
515 len = sizeof(*sti);
517 else ret = STATUS_INFO_LENGTH_MISMATCH;
519 break;
520 case SystemProcessInformation:
522 SYSTEM_PROCESS_INFORMATION* spi = (SYSTEM_PROCESS_INFORMATION*)SystemInformation;
523 SYSTEM_PROCESS_INFORMATION* last = NULL;
524 HANDLE hSnap = 0;
525 WCHAR procname[1024];
526 DWORD wlen = 0;
528 SERVER_START_REQ( create_snapshot )
530 req->flags = SNAP_PROCESS | SNAP_THREAD;
531 req->inherit = FALSE;
532 req->pid = 0;
533 if (!(ret = wine_server_call( req ))) hSnap = reply->handle;
535 SERVER_END_REQ;
536 len = 0;
537 while (ret == STATUS_SUCCESS)
539 SERVER_START_REQ( next_process )
541 req->handle = hSnap;
542 req->reset = (len == 0);
543 wine_server_set_reply( req, procname, sizeof(procname) );
544 if (!(ret = wine_server_call( req )))
546 wlen = wine_server_reply_size(reply) + sizeof(WCHAR);
547 if (Length >= len + sizeof(*spi))
549 memset(spi, 0, sizeof(*spi));
550 spi->dwOffset = sizeof(*spi);
551 spi->dwThreadCount = reply->threads;
552 memset(&spi->ftCreationTime, 0, sizeof(spi->ftCreationTime));
553 /* spi->pszProcessName will be set later on */
554 spi->dwBasePriority = reply->priority;
555 spi->dwProcessID = (DWORD)reply->pid;
556 spi->dwParentProcessID = (DWORD)reply->ppid;
557 spi->dwHandleCount = reply->handles;
558 spi->dwVirtualBytesPeak = 0; /* FIXME */
559 spi->dwVirtualBytes = 0; /* FIXME */
560 spi->dwPageFaults = 0; /* FIXME */
561 spi->dwWorkingSetPeak = 0; /* FIXME */
562 spi->dwWorkingSet = 0; /* FIXME */
563 spi->dwUnknown5 = 0; /* FIXME */
564 spi->dwPagedPool = 0; /* FIXME */
565 spi->dwUnknown6 = 0; /* FIXME */
566 spi->dwNonPagedPool = 0; /* FIXME */
567 spi->dwPageFileBytesPeak = 0; /* FIXME */
568 spi->dwPrivateBytes = 0; /* FIXME */
569 spi->dwPageFileBytes = 0; /* FIXME */
570 /* spi->ti will be set later on */
571 len += sizeof(*spi) - sizeof(spi->ti);
573 else ret = STATUS_INFO_LENGTH_MISMATCH;
576 SERVER_END_REQ;
577 if (ret != STATUS_SUCCESS)
579 if (ret == STATUS_NO_MORE_FILES) ret = STATUS_SUCCESS;
580 break;
582 if (Length >= len + wlen + spi->dwThreadCount * sizeof(THREAD_INFO))
584 int i, j;
586 /* set thread info */
587 spi->dwOffset += spi->dwThreadCount * sizeof(THREAD_INFO);
588 len += spi->dwThreadCount * sizeof(THREAD_INFO);
589 i = j = 0;
590 while (ret == STATUS_SUCCESS)
592 SERVER_START_REQ( next_thread )
594 req->handle = hSnap;
595 req->reset = (j == 0);
596 if (!(ret = wine_server_call( req )))
598 j++;
599 if (reply->pid == spi->dwProcessID)
601 /* ftKernelTime, ftUserTime, ftCreateTime;
602 * dwTickCount, dwStartAddress
604 spi->ti[i].dwOwningPID = reply->pid;
605 spi->ti[i].dwThreadID = reply->tid;
606 spi->ti[i].dwCurrentPriority = reply->base_pri + reply->delta_pri;
607 spi->ti[i].dwBasePriority = reply->base_pri;
608 i++;
612 SERVER_END_REQ;
614 if (ret == STATUS_NO_MORE_FILES) ret = STATUS_SUCCESS;
616 /* now append process name */
617 spi->pszProcessName = (WCHAR*)((char*)spi + spi->dwOffset);
618 memcpy( spi->pszProcessName, procname, wlen - sizeof(WCHAR) );
619 spi->pszProcessName[wlen / sizeof(WCHAR)] = 0;
620 len += wlen;
621 spi->dwOffset += wlen;
623 last = spi;
624 spi = (SYSTEM_PROCESS_INFORMATION*)((char*)spi + spi->dwOffset);
626 else ret = STATUS_INFO_LENGTH_MISMATCH;
628 if (ret == STATUS_SUCCESS && last) last->dwOffset = 0;
629 if (hSnap) NtClose(hSnap);
631 break;
632 case SystemProcessorPerformanceInformation:
634 SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION* sppi = (SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION*)SystemInformation;
635 if (Length >= sizeof(*sppi))
637 memset(sppi, 0, sizeof(*sppi)); /* FIXME */
638 len = sizeof(*sppi);
640 else ret = STATUS_INFO_LENGTH_MISMATCH;
642 break;
644 case SystemCacheInformation:
646 SYSTEM_CACHE_INFORMATION* sci = (SYSTEM_CACHE_INFORMATION*)SystemInformation;
647 if (Length >= sizeof(*sci))
649 memset(sci, 0, sizeof(*sci)); /* FIXME */
650 len = sizeof(*sci);
652 else ret = STATUS_INFO_LENGTH_MISMATCH;
654 break;
655 case SystemRegistryQuotaInformation:
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. */
662 SYSTEM_REGISTRY_QUOTA_INFORMATION* srqi = (SYSTEM_REGISTRY_QUOTA_INFORMATION*)SystemInformation;
663 if (Length >= sizeof(*srqi))
665 FIXME("(0x%08x,%p,0x%08lx,%p) faking max registry size of 32 MB\n",
666 SystemInformationClass,SystemInformation,Length,ResultLength);
667 srqi->RegistryQuotaAllowed = 0x2000000;
668 srqi->RegistryQuotaUsed = 0x200000;
669 srqi->Reserved1 = (void*)0x200000;
670 if (ResultLength) *ResultLength = sizeof(*srqi);
672 else ret = STATUS_INFO_LENGTH_MISMATCH;
674 break;
676 default:
677 FIXME("(0x%08x,%p,0x%08lx,%p) stub\n",
678 SystemInformationClass,SystemInformation,Length,ResultLength);
679 memset(SystemInformation, 0, Length);
680 ret = STATUS_NOT_IMPLEMENTED;
682 if (ResultLength) *ResultLength = len;
684 return ret;
688 /******************************************************************************
689 * NtCreatePagingFile [NTDLL.@]
690 * ZwCreatePagingFile [NTDLL.@]
692 NTSTATUS WINAPI NtCreatePagingFile(
693 IN PUNICODE_STRING PageFileName,
694 IN ULONG MiniumSize,
695 IN ULONG MaxiumSize,
696 OUT PULONG ActualSize)
698 FIXME("(%p(%s),0x%08lx,0x%08lx,%p),stub!\n",
699 PageFileName->Buffer, debugstr_w(PageFileName->Buffer),MiniumSize,MaxiumSize,ActualSize);
700 return 0;
703 /******************************************************************************
704 * NtDisplayString [NTDLL.@]
706 * writes a string to the nt-textmode screen eg. during startup
708 NTSTATUS WINAPI NtDisplayString ( PUNICODE_STRING string )
710 STRING stringA;
711 NTSTATUS ret;
713 if (!(ret = RtlUnicodeStringToAnsiString( &stringA, string, TRUE )))
715 MESSAGE( "%.*s", stringA.Length, stringA.Buffer );
716 RtlFreeAnsiString( &stringA );
718 return ret;
721 /******************************************************************************
722 * NtPowerInformation [NTDLL.@]
725 NTSTATUS WINAPI NtPowerInformation(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5)
727 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub\n",x1,x2,x3,x4,x5);
728 return 0;
731 /******************************************************************************
732 * NtAllocateLocallyUniqueId (NTDLL.@)
734 * FIXME: the server should do that
736 NTSTATUS WINAPI NtAllocateLocallyUniqueId(PLUID Luid)
738 static LUID luid;
740 FIXME("%p (0x%08lx%08lx)\n", Luid, luid.HighPart, luid.LowPart);
742 luid.LowPart++;
743 if (luid.LowPart==0)
744 luid.HighPart++;
745 Luid->HighPart = luid.HighPart;
746 Luid->LowPart = luid.LowPart;
748 return STATUS_SUCCESS;
751 /******************************************************************************
752 * VerSetConditionMask (NTDLL.@)
754 ULONGLONG WINAPI VerSetConditionMask( ULONGLONG dwlConditionMask, DWORD dwTypeBitMask,
755 BYTE dwConditionMask)
757 if(dwTypeBitMask == 0)
758 return dwlConditionMask;
759 dwConditionMask &= 0x07;
760 if(dwConditionMask == 0)
761 return dwlConditionMask;
763 if(dwTypeBitMask & VER_PRODUCT_TYPE)
764 dwlConditionMask |= dwConditionMask << 7*3;
765 else if (dwTypeBitMask & VER_SUITENAME)
766 dwlConditionMask |= dwConditionMask << 6*3;
767 else if (dwTypeBitMask & VER_SERVICEPACKMAJOR)
768 dwlConditionMask |= dwConditionMask << 5*3;
769 else if (dwTypeBitMask & VER_SERVICEPACKMINOR)
770 dwlConditionMask |= dwConditionMask << 4*3;
771 else if (dwTypeBitMask & VER_PLATFORMID)
772 dwlConditionMask |= dwConditionMask << 3*3;
773 else if (dwTypeBitMask & VER_BUILDNUMBER)
774 dwlConditionMask |= dwConditionMask << 2*3;
775 else if (dwTypeBitMask & VER_MAJORVERSION)
776 dwlConditionMask |= dwConditionMask << 1*3;
777 else if (dwTypeBitMask & VER_MINORVERSION)
778 dwlConditionMask |= dwConditionMask << 0*3;
779 return dwlConditionMask;