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
29 #include "wine/debug.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
48 DWORD ClientBaseAddress;
49 DWORD ServerBaseAddress;
50 } LPCSECTIONINFO, *PLPCSECTIONINFO;
52 typedef struct LpcSectionMapInfo
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;
68 DWORD ClientProcessId;
71 DWORD SharedSectionSize;
72 BYTE MessageData[MAX_MESSAGE_DATA];
73 } LPCMESSAGE, *PLPCMESSAGE;
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,
93 TRACE("(%p,0x%08lx,%p,0x%08x,0x%08x,%p)\n",
94 ExistingToken, DesiredAccess, ObjectAttributes,
95 ImpersonationLevel, TokenType, NewToken);
96 dump_ObjectAttributes(ObjectAttributes);
98 SERVER_START_REQ( duplicate_token )
100 req->handle = ExistingToken;
101 req->access = DesiredAccess;
102 req->inherit = ObjectAttributes && (ObjectAttributes->Attributes & OBJ_INHERIT);
103 req->primary = (TokenType == TokenPrimary);
104 req->impersonation_level = ImpersonationLevel;
105 status = wine_server_call( req );
106 if (!status) *NewToken = reply->new_handle;
113 /******************************************************************************
114 * NtOpenProcessToken [NTDLL.@]
115 * ZwOpenProcessToken [NTDLL.@]
117 NTSTATUS WINAPI NtOpenProcessToken(
118 HANDLE ProcessHandle,
124 TRACE("(%p,0x%08lx,%p)\n", ProcessHandle,DesiredAccess, TokenHandle);
126 SERVER_START_REQ( open_token )
128 req->handle = ProcessHandle;
130 ret = wine_server_call( req );
131 if (!ret) *TokenHandle = reply->token;
138 /******************************************************************************
139 * NtOpenThreadToken [NTDLL.@]
140 * ZwOpenThreadToken [NTDLL.@]
142 NTSTATUS WINAPI NtOpenThreadToken(
150 TRACE("(%p,0x%08lx,0x%08x,%p)\n",
151 ThreadHandle,DesiredAccess, OpenAsSelf, TokenHandle);
153 SERVER_START_REQ( open_token )
155 req->handle = ThreadHandle;
156 req->flags = OPEN_TOKEN_THREAD;
157 if (OpenAsSelf) req->flags |= OPEN_TOKEN_AS_SELF;
158 ret = wine_server_call( req );
159 if (!ret) *TokenHandle = reply->token;
166 /******************************************************************************
167 * NtAdjustPrivilegesToken [NTDLL.@]
168 * ZwAdjustPrivilegesToken [NTDLL.@]
170 * FIXME: parameters unsafe
172 NTSTATUS WINAPI NtAdjustPrivilegesToken(
173 IN HANDLE TokenHandle,
174 IN BOOLEAN DisableAllPrivileges,
175 IN PTOKEN_PRIVILEGES NewState,
176 IN DWORD BufferLength,
177 OUT PTOKEN_PRIVILEGES PreviousState,
178 OUT PDWORD ReturnLength)
182 TRACE("(%p,0x%08x,%p,0x%08lx,%p,%p)\n",
183 TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength);
185 SERVER_START_REQ( adjust_token_privileges )
187 req->handle = TokenHandle;
188 req->disable_all = DisableAllPrivileges;
189 req->get_modified_state = (PreviousState != NULL);
190 if (!DisableAllPrivileges)
192 wine_server_add_data( req, &NewState->Privileges,
193 NewState->PrivilegeCount * sizeof(NewState->Privileges[0]) );
195 if (PreviousState && BufferLength >= FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ))
196 wine_server_set_reply( req, &PreviousState->Privileges,
197 BufferLength - FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ) );
198 ret = wine_server_call( req );
201 *ReturnLength = reply->len + FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges );
202 PreviousState->PrivilegeCount = reply->len / sizeof(LUID_AND_ATTRIBUTES);
210 /******************************************************************************
211 * NtQueryInformationToken [NTDLL.@]
212 * ZwQueryInformationToken [NTDLL.@]
215 * Buffer for TokenUser:
216 * 0x00 TOKEN_USER the PSID field points to the SID
220 NTSTATUS WINAPI NtQueryInformationToken(
222 DWORD tokeninfoclass,
224 DWORD tokeninfolength,
227 unsigned int len = 0;
228 NTSTATUS status = STATUS_SUCCESS;
230 TRACE("(%p,%ld,%p,%ld,%p)\n",
231 token,tokeninfoclass,tokeninfo,tokeninfolength,retlen);
233 switch (tokeninfoclass)
236 len = sizeof(TOKEN_USER) + sizeof(SID);
239 len = sizeof(TOKEN_GROUPS);
242 len = sizeof(TOKEN_OWNER) + sizeof(SID);
244 case TokenPrimaryGroup:
245 len = sizeof(TOKEN_PRIMARY_GROUP);
247 case TokenDefaultDacl:
248 len = sizeof(TOKEN_DEFAULT_DACL);
251 len = sizeof(TOKEN_SOURCE);
254 len = sizeof (TOKEN_TYPE);
257 case TokenImpersonationLevel:
258 case TokenStatistics:
262 /* FIXME: what if retlen == NULL ? */
265 if (tokeninfolength < len)
266 return STATUS_BUFFER_TOO_SMALL;
268 switch (tokeninfoclass)
273 TOKEN_USER * tuser = tokeninfo;
274 PSID sid = (PSID) (tuser + 1);
275 SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
276 RtlInitializeSid(sid, &localSidAuthority, 1);
277 *(RtlSubAuthoritySid(sid, 0)) = SECURITY_INTERACTIVE_RID;
278 tuser->User.Sid = sid;
284 TOKEN_GROUPS *tgroups = tokeninfo;
285 SID_IDENTIFIER_AUTHORITY sid = {SECURITY_NT_AUTHORITY};
287 /* we need to show admin privileges ! */
288 tgroups->GroupCount = 1;
289 tgroups->Groups->Attributes = SE_GROUP_ENABLED;
290 RtlAllocateAndInitializeSid( &sid,
292 SECURITY_BUILTIN_DOMAIN_RID,
293 DOMAIN_ALIAS_RID_ADMINS,
295 &(tgroups->Groups->Sid));
298 case TokenPrimaryGroup:
301 TOKEN_PRIMARY_GROUP *tgroup = tokeninfo;
302 SID_IDENTIFIER_AUTHORITY sid = {SECURITY_NT_AUTHORITY};
303 RtlAllocateAndInitializeSid( &sid,
305 SECURITY_BUILTIN_DOMAIN_RID,
306 DOMAIN_ALIAS_RID_ADMINS,
308 &(tgroup->PrimaryGroup));
311 case TokenPrivileges:
312 SERVER_START_REQ( get_token_privileges )
314 TOKEN_PRIVILEGES *tpriv = tokeninfo;
316 if (tpriv && tokeninfolength > FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ))
317 wine_server_set_reply( req, &tpriv->Privileges, tokeninfolength - FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ) );
318 status = wine_server_call( req );
319 *retlen = FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ) + reply->len;
320 if (tpriv) tpriv->PrivilegeCount = reply->len / sizeof(LUID_AND_ATTRIBUTES);
327 TOKEN_OWNER *owner = tokeninfo;
328 PSID sid = (PSID) (owner + 1);
329 SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
330 RtlInitializeSid(sid, &localSidAuthority, 1);
331 *(RtlSubAuthoritySid(sid, 0)) = SECURITY_INTERACTIVE_RID;
337 ERR("Unhandled Token Information class %ld!\n", tokeninfoclass);
338 return STATUS_NOT_IMPLEMENTED;
344 /******************************************************************************
345 * NtSetInformationToken [NTDLL.@]
346 * ZwSetInformationToken [NTDLL.@]
348 NTSTATUS WINAPI NtSetInformationToken(
350 TOKEN_INFORMATION_CLASS TokenInformationClass,
351 PVOID TokenInformation,
352 ULONG TokenInformationLength)
354 FIXME("%p %d %p %lu\n", TokenHandle, TokenInformationClass,
355 TokenInformation, TokenInformationLength);
356 return STATUS_NOT_IMPLEMENTED;
359 /******************************************************************************
360 * NtAdjustGroupsToken [NTDLL.@]
361 * ZwAdjustGroupsToken [NTDLL.@]
363 NTSTATUS WINAPI NtAdjustGroupsToken(
365 BOOLEAN ResetToDefault,
366 PTOKEN_GROUPS NewState,
368 PTOKEN_GROUPS PreviousState,
371 FIXME("%p %d %p %lu %p %p\n", TokenHandle, ResetToDefault,
372 NewState, BufferLength, PreviousState, ReturnLength);
373 return STATUS_NOT_IMPLEMENTED;
380 /******************************************************************************
381 * NtQuerySection [NTDLL.@]
383 NTSTATUS WINAPI NtQuerySection(
384 IN HANDLE SectionHandle,
385 IN PVOID SectionInformationClass,
386 OUT PVOID SectionInformation,
388 OUT PULONG ResultLength)
390 FIXME("(%p,%p,%p,0x%08lx,%p) stub!\n",
391 SectionHandle,SectionInformationClass,SectionInformation,Length,ResultLength);
399 /******************************************************************************
400 * NtCreatePort [NTDLL.@]
401 * ZwCreatePort [NTDLL.@]
403 NTSTATUS WINAPI NtCreatePort(PHANDLE PortHandle,POBJECT_ATTRIBUTES ObjectAttributes,
404 DWORD MaxConnectInfoLength,DWORD MaxDataLength,DWORD unknown)
406 FIXME("(%p,%p,0x%08lx,0x%08lx,0x%08lx),stub!\n",PortHandle,ObjectAttributes,
407 MaxConnectInfoLength,MaxDataLength,unknown);
411 /******************************************************************************
412 * NtConnectPort [NTDLL.@]
413 * ZwConnectPort [NTDLL.@]
415 NTSTATUS WINAPI NtConnectPort(PHANDLE PortHandle,PUNICODE_STRING PortName,PVOID Unknown1,
416 PLPCSECTIONINFO sectionInfo,PLPCSECTIONMAPINFO mapInfo,PVOID Unknown2,
417 PVOID ConnectInfo,PDWORD pConnectInfoLength)
419 FIXME("(%p,%s,%p,%p,%p,%p,%p,%p (%ld)),stub!\n",PortHandle,debugstr_w(PortName->Buffer),Unknown1,
420 sectionInfo,mapInfo,Unknown2,ConnectInfo,pConnectInfoLength,pConnectInfoLength?*pConnectInfoLength:-1);
421 if(ConnectInfo && pConnectInfoLength)
422 TRACE("\tMessage = %s\n",debugstr_an(ConnectInfo,*pConnectInfoLength));
426 /******************************************************************************
427 * NtListenPort [NTDLL.@]
428 * ZwListenPort [NTDLL.@]
430 NTSTATUS WINAPI NtListenPort(HANDLE PortHandle,PLPCMESSAGE pLpcMessage)
432 FIXME("(%p,%p),stub!\n",PortHandle,pLpcMessage);
436 /******************************************************************************
437 * NtAcceptConnectPort [NTDLL.@]
438 * ZwAcceptConnectPort [NTDLL.@]
440 NTSTATUS WINAPI NtAcceptConnectPort(PHANDLE PortHandle,DWORD Unknown,PLPCMESSAGE pLpcMessage,
441 DWORD acceptIt,DWORD Unknown2,PLPCSECTIONMAPINFO mapInfo)
443 FIXME("(%p,0x%08lx,%p,0x%08lx,0x%08lx,%p),stub!\n",PortHandle,Unknown,pLpcMessage,acceptIt,Unknown2,mapInfo);
447 /******************************************************************************
448 * NtCompleteConnectPort [NTDLL.@]
449 * ZwCompleteConnectPort [NTDLL.@]
451 NTSTATUS WINAPI NtCompleteConnectPort(HANDLE PortHandle)
453 FIXME("(%p),stub!\n",PortHandle);
457 /******************************************************************************
458 * NtRegisterThreadTerminatePort [NTDLL.@]
459 * ZwRegisterThreadTerminatePort [NTDLL.@]
461 NTSTATUS WINAPI NtRegisterThreadTerminatePort(HANDLE PortHandle)
463 FIXME("(%p),stub!\n",PortHandle);
467 /******************************************************************************
468 * NtRequestWaitReplyPort [NTDLL.@]
469 * ZwRequestWaitReplyPort [NTDLL.@]
471 NTSTATUS WINAPI NtRequestWaitReplyPort(HANDLE PortHandle,PLPCMESSAGE pLpcMessageIn,PLPCMESSAGE pLpcMessageOut)
473 FIXME("(%p,%p,%p),stub!\n",PortHandle,pLpcMessageIn,pLpcMessageOut);
476 TRACE("Message to send:\n");
477 TRACE("\tActualMessageLength = %d\n",pLpcMessageIn->ActualMessageLength);
478 TRACE("\tTotalMessageLength = %d\n",pLpcMessageIn->TotalMessageLength);
479 TRACE("\tMessageType = %ld\n",pLpcMessageIn->MessageType);
480 TRACE("\tClientProcessId = %ld\n",pLpcMessageIn->ClientProcessId);
481 TRACE("\tClientThreadId = %ld\n",pLpcMessageIn->ClientThreadId);
482 TRACE("\tMessageId = %ld\n",pLpcMessageIn->MessageId);
483 TRACE("\tSharedSectionSize = %ld\n",pLpcMessageIn->SharedSectionSize);
484 TRACE("\tMessageData = %s\n",debugstr_an(pLpcMessageIn->MessageData,pLpcMessageIn->ActualMessageLength));
489 /******************************************************************************
490 * NtReplyWaitReceivePort [NTDLL.@]
491 * ZwReplyWaitReceivePort [NTDLL.@]
493 NTSTATUS WINAPI NtReplyWaitReceivePort(HANDLE PortHandle,PDWORD Unknown,PLPCMESSAGE pLpcMessageOut,PLPCMESSAGE pLpcMessageIn)
495 FIXME("(%p,%p,%p,%p),stub!\n",PortHandle,Unknown,pLpcMessageOut,pLpcMessageIn);
503 /******************************************************************************
504 * NtSetIntervalProfile [NTDLL.@]
505 * ZwSetIntervalProfile [NTDLL.@]
507 NTSTATUS WINAPI NtSetIntervalProfile(DWORD x1,DWORD x2) {
508 FIXME("(0x%08lx,0x%08lx),stub!\n",x1,x2);
512 /******************************************************************************
513 * NtQueryPerformanceCounter [NTDLL.@]
515 * Note: Windows uses a timer clocked at a multiple of 1193182 Hz.
518 NTSTATUS WINAPI NtQueryPerformanceCounter(
519 OUT PLARGE_INTEGER Counter,
520 OUT PLARGE_INTEGER Frequency)
524 if (!Counter) return STATUS_ACCESS_VIOLATION;
525 NtQuerySystemTime( &time );
526 Counter->QuadPart = time.QuadPart;
528 Frequency->QuadPart = 10000000;
532 /******************************************************************************
533 * NtCreateMailslotFile [NTDLL.@]
534 * ZwCreateMailslotFile [NTDLL.@]
536 NTSTATUS WINAPI NtCreateMailslotFile(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8)
538 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);
542 /******************************************************************************
543 * NtQuerySystemInformation [NTDLL.@]
544 * ZwQuerySystemInformation [NTDLL.@]
547 * SystemInformationClass Index to a certain information structure
548 * SystemTimeAdjustmentInformation SYSTEM_TIME_ADJUSTMENT
549 * SystemCacheInformation SYSTEM_CACHE_INFORMATION
550 * SystemConfigurationInformation CONFIGURATION_INFORMATION
551 * observed (class/len):
557 * SystemInformation caller supplies storage for the information structure
558 * Length size of the structure
559 * ResultLength Data written
561 NTSTATUS WINAPI NtQuerySystemInformation(
562 IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
563 OUT PVOID SystemInformation,
565 OUT PULONG ResultLength)
567 NTSTATUS ret = STATUS_SUCCESS;
570 TRACE("(0x%08x,%p,0x%08lx,%p)\n",
571 SystemInformationClass,SystemInformation,Length,ResultLength);
573 switch (SystemInformationClass)
575 case SystemBasicInformation:
577 SYSTEM_BASIC_INFORMATION* sbi = (SYSTEM_BASIC_INFORMATION*)SystemInformation;
578 if (Length >= sizeof(*sbi))
581 sbi->uKeMaximumIncrement = 0;
582 sbi->uPageSize = 1024; /* FIXME */
583 sbi->uMmNumberOfPhysicalPages = 12345; /* FIXME */
584 sbi->uMmLowestPhysicalPage = 0; /* FIXME */
585 sbi->uMmHighestPhysicalPage = 12345; /* FIXME */
586 sbi->uAllocationGranularity = 65536; /* FIXME */
587 sbi->pLowestUserAddress = 0; /* FIXME */
588 sbi->pMmHighestUserAddress = (void*)~0; /* FIXME */
589 sbi->uKeActiveProcessors = 1; /* FIXME */
590 sbi->bKeNumberProcessors = 1; /* FIXME */
593 else ret = STATUS_INFO_LENGTH_MISMATCH;
596 case SystemCpuInformation:
598 SYSTEM_CPU_INFORMATION* sci;
599 sci = (SYSTEM_CPU_INFORMATION *) SystemInformation;
600 if (Length >= sizeof(*sci))
602 /* FIXME: move some code from kernel/cpu.c to process this */
603 sci->Architecture = PROCESSOR_ARCHITECTURE_INTEL;
604 sci->Level = 6; /* 686, aka Pentium II+ */
607 sci->FeatureSet = 0x1fff;
609 else ret = STATUS_INFO_LENGTH_MISMATCH;
612 case SystemPerformanceInformation:
614 SYSTEM_PERFORMANCE_INFORMATION* spi = (SYSTEM_PERFORMANCE_INFORMATION*)SystemInformation;
615 if (Length >= sizeof(*spi))
617 memset(spi, 0, sizeof(*spi)); /* FIXME */
620 else ret = STATUS_INFO_LENGTH_MISMATCH;
623 case SystemTimeOfDayInformation:
625 SYSTEM_TIMEOFDAY_INFORMATION* sti = (SYSTEM_TIMEOFDAY_INFORMATION*)SystemInformation;
626 if (Length >= sizeof(*sti))
628 sti->liKeBootTime.QuadPart = 0; /* FIXME */
629 sti->liKeSystemTime.QuadPart = 0; /* FIXME */
630 sti->liExpTimeZoneBias.QuadPart = 0; /* FIXME */
631 sti->uCurrentTimeZoneId = 0; /* FIXME */
635 else ret = STATUS_INFO_LENGTH_MISMATCH;
638 case SystemProcessInformation:
640 SYSTEM_PROCESS_INFORMATION* spi = (SYSTEM_PROCESS_INFORMATION*)SystemInformation;
641 SYSTEM_PROCESS_INFORMATION* last = NULL;
643 WCHAR procname[1024];
646 SERVER_START_REQ( create_snapshot )
648 req->flags = SNAP_PROCESS | SNAP_THREAD;
649 req->inherit = FALSE;
651 if (!(ret = wine_server_call( req ))) hSnap = reply->handle;
655 while (ret == STATUS_SUCCESS)
657 SERVER_START_REQ( next_process )
660 req->reset = (len == 0);
661 wine_server_set_reply( req, procname, sizeof(procname) );
662 if (!(ret = wine_server_call( req )))
664 wlen = wine_server_reply_size(reply) + sizeof(WCHAR);
665 if (Length >= len + sizeof(*spi))
667 memset(spi, 0, sizeof(*spi));
668 spi->dwOffset = sizeof(*spi);
669 spi->dwThreadCount = reply->threads;
670 memset(&spi->ftCreationTime, 0, sizeof(spi->ftCreationTime));
671 /* spi->pszProcessName will be set later on */
672 spi->dwBasePriority = reply->priority;
673 spi->dwProcessID = (DWORD)reply->pid;
674 spi->dwParentProcessID = (DWORD)reply->ppid;
675 spi->dwHandleCount = reply->handles;
676 spi->dwVirtualBytesPeak = 0; /* FIXME */
677 spi->dwVirtualBytes = 0; /* FIXME */
678 spi->dwPageFaults = 0; /* FIXME */
679 spi->dwWorkingSetPeak = 0; /* FIXME */
680 spi->dwWorkingSet = 0; /* FIXME */
681 spi->dwUnknown5 = 0; /* FIXME */
682 spi->dwPagedPool = 0; /* FIXME */
683 spi->dwUnknown6 = 0; /* FIXME */
684 spi->dwNonPagedPool = 0; /* FIXME */
685 spi->dwPageFileBytesPeak = 0; /* FIXME */
686 spi->dwPrivateBytes = 0; /* FIXME */
687 spi->dwPageFileBytes = 0; /* FIXME */
688 /* spi->ti will be set later on */
689 len += sizeof(*spi) - sizeof(spi->ti);
691 else ret = STATUS_INFO_LENGTH_MISMATCH;
695 if (ret != STATUS_SUCCESS)
697 if (ret == STATUS_NO_MORE_FILES) ret = STATUS_SUCCESS;
700 if (Length >= len + wlen + spi->dwThreadCount * sizeof(THREAD_INFO))
704 /* set thread info */
705 spi->dwOffset += spi->dwThreadCount * sizeof(THREAD_INFO);
706 len += spi->dwThreadCount * sizeof(THREAD_INFO);
708 while (ret == STATUS_SUCCESS)
710 SERVER_START_REQ( next_thread )
713 req->reset = (j == 0);
714 if (!(ret = wine_server_call( req )))
717 if (reply->pid == spi->dwProcessID)
719 /* ftKernelTime, ftUserTime, ftCreateTime;
720 * dwTickCount, dwStartAddress
722 spi->ti[i].dwOwningPID = reply->pid;
723 spi->ti[i].dwThreadID = reply->tid;
724 spi->ti[i].dwCurrentPriority = reply->base_pri + reply->delta_pri;
725 spi->ti[i].dwBasePriority = reply->base_pri;
732 if (ret == STATUS_NO_MORE_FILES) ret = STATUS_SUCCESS;
734 /* now append process name */
735 spi->pszProcessName = (WCHAR*)((char*)spi + spi->dwOffset);
736 memcpy( spi->pszProcessName, procname, wlen - sizeof(WCHAR) );
737 spi->pszProcessName[wlen / sizeof(WCHAR)] = 0;
739 spi->dwOffset += wlen;
742 spi = (SYSTEM_PROCESS_INFORMATION*)((char*)spi + spi->dwOffset);
744 else ret = STATUS_INFO_LENGTH_MISMATCH;
746 if (ret == STATUS_SUCCESS && last) last->dwOffset = 0;
747 if (hSnap) NtClose(hSnap);
750 case SystemProcessorPerformanceInformation:
752 SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION* sppi = (SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION*)SystemInformation;
753 if (Length >= sizeof(*sppi))
755 memset(sppi, 0, sizeof(*sppi)); /* FIXME */
758 else ret = STATUS_INFO_LENGTH_MISMATCH;
762 case SystemCacheInformation:
764 SYSTEM_CACHE_INFORMATION* sci = (SYSTEM_CACHE_INFORMATION*)SystemInformation;
765 if (Length >= sizeof(*sci))
767 memset(sci, 0, sizeof(*sci)); /* FIXME */
770 else ret = STATUS_INFO_LENGTH_MISMATCH;
773 case SystemRegistryQuotaInformation:
774 /* Something to do with the size of the registry *
775 * Since we don't have a size limitation, fake it *
776 * This is almost certainly wrong. *
777 * This sets each of the three words in the struct to 32 MB, *
778 * which is enough to make the IE 5 installer happy. */
780 SYSTEM_REGISTRY_QUOTA_INFORMATION* srqi = (SYSTEM_REGISTRY_QUOTA_INFORMATION*)SystemInformation;
781 if (Length >= sizeof(*srqi))
783 FIXME("(0x%08x,%p,0x%08lx,%p) faking max registry size of 32 MB\n",
784 SystemInformationClass,SystemInformation,Length,ResultLength);
785 srqi->RegistryQuotaAllowed = 0x2000000;
786 srqi->RegistryQuotaUsed = 0x200000;
787 srqi->Reserved1 = (void*)0x200000;
790 else ret = STATUS_INFO_LENGTH_MISMATCH;
794 case SystemKernelDebuggerInformation:
796 PSYSTEM_KERNEL_DEBUGGER_INFORMATION pkdi;
797 if( Length >= sizeof(*pkdi))
799 pkdi = SystemInformation;
800 pkdi->DebuggerEnabled = FALSE;
801 pkdi->DebuggerNotPresent = TRUE;
804 else ret = STATUS_INFO_LENGTH_MISMATCH;
809 FIXME("(0x%08x,%p,0x%08lx,%p) stub\n",
810 SystemInformationClass,SystemInformation,Length,ResultLength);
811 ret = STATUS_NOT_IMPLEMENTED;
813 if (ResultLength) *ResultLength = len;
819 /******************************************************************************
820 * NtCreatePagingFile [NTDLL.@]
821 * ZwCreatePagingFile [NTDLL.@]
823 NTSTATUS WINAPI NtCreatePagingFile(
824 IN PUNICODE_STRING PageFileName,
827 OUT PULONG ActualSize)
829 FIXME("(%p(%s),0x%08lx,0x%08lx,%p),stub!\n",
830 PageFileName->Buffer, debugstr_w(PageFileName->Buffer),MiniumSize,MaxiumSize,ActualSize);
834 /******************************************************************************
835 * NtDisplayString [NTDLL.@]
837 * writes a string to the nt-textmode screen eg. during startup
839 NTSTATUS WINAPI NtDisplayString ( PUNICODE_STRING string )
844 if (!(ret = RtlUnicodeStringToAnsiString( &stringA, string, TRUE )))
846 MESSAGE( "%.*s", stringA.Length, stringA.Buffer );
847 RtlFreeAnsiString( &stringA );
852 /******************************************************************************
853 * NtPowerInformation [NTDLL.@]
856 NTSTATUS WINAPI NtPowerInformation(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5)
858 FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub\n",x1,x2,x3,x4,x5);
862 /******************************************************************************
863 * NtShutdownSystem [NTDLL.@]
866 NTSTATUS WINAPI NtShutdownSystem(DWORD x1)
868 FIXME("(0x%08lx),stub\n",x1);
872 /******************************************************************************
873 * NtAllocateLocallyUniqueId (NTDLL.@)
875 * FIXME: the server should do that
877 NTSTATUS WINAPI NtAllocateLocallyUniqueId(PLUID Luid)
879 static LUID luid = { SE_MAX_WELL_KNOWN_PRIVILEGE, 0 };
884 return STATUS_ACCESS_VIOLATION;
889 Luid->HighPart = luid.HighPart;
890 Luid->LowPart = luid.LowPart;
892 return STATUS_SUCCESS;
895 /******************************************************************************
896 * VerSetConditionMask (NTDLL.@)
898 ULONGLONG WINAPI VerSetConditionMask( ULONGLONG dwlConditionMask, DWORD dwTypeBitMask,
899 BYTE dwConditionMask)
901 if(dwTypeBitMask == 0)
902 return dwlConditionMask;
903 dwConditionMask &= 0x07;
904 if(dwConditionMask == 0)
905 return dwlConditionMask;
907 if(dwTypeBitMask & VER_PRODUCT_TYPE)
908 dwlConditionMask |= dwConditionMask << 7*3;
909 else if (dwTypeBitMask & VER_SUITENAME)
910 dwlConditionMask |= dwConditionMask << 6*3;
911 else if (dwTypeBitMask & VER_SERVICEPACKMAJOR)
912 dwlConditionMask |= dwConditionMask << 5*3;
913 else if (dwTypeBitMask & VER_SERVICEPACKMINOR)
914 dwlConditionMask |= dwConditionMask << 4*3;
915 else if (dwTypeBitMask & VER_PLATFORMID)
916 dwlConditionMask |= dwConditionMask << 3*3;
917 else if (dwTypeBitMask & VER_BUILDNUMBER)
918 dwlConditionMask |= dwConditionMask << 2*3;
919 else if (dwTypeBitMask & VER_MAJORVERSION)
920 dwlConditionMask |= dwConditionMask << 1*3;
921 else if (dwTypeBitMask & VER_MINORVERSION)
922 dwlConditionMask |= dwConditionMask << 0*3;
923 return dwlConditionMask;
926 /******************************************************************************
927 * NtAlertThread (NTDLL.@)
929 NTSTATUS WINAPI NtAlertThread(HANDLE ThreadHandle)
931 FIXME("%p\n", ThreadHandle);
932 return STATUS_NOT_IMPLEMENTED;