riched20: Sign-compare warnings fix.
[wine/multimedia.git] / dlls / ntdll / nt.c
blob37e3ee96dc38f80d62e514df33e011d7660a4404
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include <stdarg.h>
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <time.h>
30 #define NONAMELESSUNION
31 #include "ntstatus.h"
32 #define WIN32_NO_STATUS
33 #include "wine/debug.h"
34 #include "wine/unicode.h"
35 #include "windef.h"
36 #include "winternl.h"
37 #include "ntdll_misc.h"
38 #include "wine/server.h"
40 #ifdef __APPLE__
41 #include <mach/mach_init.h>
42 #include <mach/mach_host.h>
43 #include <mach/vm_map.h>
44 #endif
46 WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
49 * Token
52 /******************************************************************************
53 * NtDuplicateToken [NTDLL.@]
54 * ZwDuplicateToken [NTDLL.@]
56 NTSTATUS WINAPI NtDuplicateToken(
57 IN HANDLE ExistingToken,
58 IN ACCESS_MASK DesiredAccess,
59 IN POBJECT_ATTRIBUTES ObjectAttributes,
60 IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
61 IN TOKEN_TYPE TokenType,
62 OUT PHANDLE NewToken)
64 NTSTATUS status;
66 TRACE("(%p,0x%08x,%p,0x%08x,0x%08x,%p)\n",
67 ExistingToken, DesiredAccess, ObjectAttributes,
68 ImpersonationLevel, TokenType, NewToken);
69 dump_ObjectAttributes(ObjectAttributes);
71 if (ObjectAttributes && ObjectAttributes->SecurityQualityOfService)
73 SECURITY_QUALITY_OF_SERVICE *SecurityQOS = ObjectAttributes->SecurityQualityOfService;
74 TRACE("ObjectAttributes->SecurityQualityOfService = {%d, %d, %d, %s}\n",
75 SecurityQOS->Length, SecurityQOS->ImpersonationLevel,
76 SecurityQOS->ContextTrackingMode,
77 SecurityQOS->EffectiveOnly ? "TRUE" : "FALSE");
78 ImpersonationLevel = SecurityQOS->ImpersonationLevel;
81 SERVER_START_REQ( duplicate_token )
83 req->handle = ExistingToken;
84 req->access = DesiredAccess;
85 req->attributes = ObjectAttributes ? ObjectAttributes->Attributes : 0;
86 req->primary = (TokenType == TokenPrimary);
87 req->impersonation_level = ImpersonationLevel;
88 status = wine_server_call( req );
89 if (!status) *NewToken = reply->new_handle;
91 SERVER_END_REQ;
93 return status;
96 /******************************************************************************
97 * NtOpenProcessToken [NTDLL.@]
98 * ZwOpenProcessToken [NTDLL.@]
100 NTSTATUS WINAPI NtOpenProcessToken(
101 HANDLE ProcessHandle,
102 DWORD DesiredAccess,
103 HANDLE *TokenHandle)
105 return NtOpenProcessTokenEx( ProcessHandle, DesiredAccess, 0, TokenHandle );
108 /******************************************************************************
109 * NtOpenProcessTokenEx [NTDLL.@]
110 * ZwOpenProcessTokenEx [NTDLL.@]
112 NTSTATUS WINAPI NtOpenProcessTokenEx( HANDLE process, DWORD access, DWORD attributes,
113 HANDLE *handle )
115 NTSTATUS ret;
117 TRACE("(%p,0x%08x,0x%08x,%p)\n", process, access, attributes, handle);
119 SERVER_START_REQ( open_token )
121 req->handle = process;
122 req->access = access;
123 req->attributes = attributes;
124 req->flags = 0;
125 ret = wine_server_call( req );
126 if (!ret) *handle = reply->token;
128 SERVER_END_REQ;
129 return ret;
132 /******************************************************************************
133 * NtOpenThreadToken [NTDLL.@]
134 * ZwOpenThreadToken [NTDLL.@]
136 NTSTATUS WINAPI NtOpenThreadToken(
137 HANDLE ThreadHandle,
138 DWORD DesiredAccess,
139 BOOLEAN OpenAsSelf,
140 HANDLE *TokenHandle)
142 return NtOpenThreadTokenEx( ThreadHandle, DesiredAccess, OpenAsSelf, 0, TokenHandle );
145 /******************************************************************************
146 * NtOpenThreadTokenEx [NTDLL.@]
147 * ZwOpenThreadTokenEx [NTDLL.@]
149 NTSTATUS WINAPI NtOpenThreadTokenEx( HANDLE thread, DWORD access, BOOLEAN as_self, DWORD attributes,
150 HANDLE *handle )
152 NTSTATUS ret;
154 TRACE("(%p,0x%08x,%u,0x%08x,%p)\n", thread, access, as_self, attributes, handle );
156 SERVER_START_REQ( open_token )
158 req->handle = thread;
159 req->access = access;
160 req->attributes = attributes;
161 req->flags = OPEN_TOKEN_THREAD;
162 if (as_self) req->flags |= OPEN_TOKEN_AS_SELF;
163 ret = wine_server_call( req );
164 if (!ret) *handle = reply->token;
166 SERVER_END_REQ;
168 return ret;
171 /******************************************************************************
172 * NtAdjustPrivilegesToken [NTDLL.@]
173 * ZwAdjustPrivilegesToken [NTDLL.@]
175 * FIXME: parameters unsafe
177 NTSTATUS WINAPI NtAdjustPrivilegesToken(
178 IN HANDLE TokenHandle,
179 IN BOOLEAN DisableAllPrivileges,
180 IN PTOKEN_PRIVILEGES NewState,
181 IN DWORD BufferLength,
182 OUT PTOKEN_PRIVILEGES PreviousState,
183 OUT PDWORD ReturnLength)
185 NTSTATUS ret;
187 TRACE("(%p,0x%08x,%p,0x%08x,%p,%p)\n",
188 TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength);
190 SERVER_START_REQ( adjust_token_privileges )
192 req->handle = TokenHandle;
193 req->disable_all = DisableAllPrivileges;
194 req->get_modified_state = (PreviousState != NULL);
195 if (!DisableAllPrivileges)
197 wine_server_add_data( req, NewState->Privileges,
198 NewState->PrivilegeCount * sizeof(NewState->Privileges[0]) );
200 if (PreviousState && BufferLength >= FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ))
201 wine_server_set_reply( req, PreviousState->Privileges,
202 BufferLength - FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ) );
203 ret = wine_server_call( req );
204 if (PreviousState)
206 *ReturnLength = reply->len + FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges );
207 PreviousState->PrivilegeCount = reply->len / sizeof(LUID_AND_ATTRIBUTES);
210 SERVER_END_REQ;
212 return ret;
215 /******************************************************************************
216 * NtQueryInformationToken [NTDLL.@]
217 * ZwQueryInformationToken [NTDLL.@]
219 * NOTES
220 * Buffer for TokenUser:
221 * 0x00 TOKEN_USER the PSID field points to the SID
222 * 0x08 SID
225 NTSTATUS WINAPI NtQueryInformationToken(
226 HANDLE token,
227 TOKEN_INFORMATION_CLASS tokeninfoclass,
228 PVOID tokeninfo,
229 ULONG tokeninfolength,
230 PULONG retlen )
232 ULONG len;
233 NTSTATUS status = STATUS_SUCCESS;
235 TRACE("(%p,%d,%p,%d,%p)\n",
236 token,tokeninfoclass,tokeninfo,tokeninfolength,retlen);
238 switch (tokeninfoclass)
240 case TokenOwner:
241 len = sizeof(TOKEN_OWNER) + sizeof(SID);
242 break;
243 case TokenPrimaryGroup:
244 len = sizeof(TOKEN_PRIMARY_GROUP);
245 break;
246 case TokenDefaultDacl:
247 len = sizeof(TOKEN_DEFAULT_DACL);
248 break;
249 case TokenSource:
250 len = sizeof(TOKEN_SOURCE);
251 break;
252 case TokenType:
253 len = sizeof (TOKEN_TYPE);
254 break;
255 case TokenImpersonationLevel:
256 len = sizeof(SECURITY_IMPERSONATION_LEVEL);
257 break;
258 case TokenStatistics:
259 len = sizeof(TOKEN_STATISTICS);
260 break;
261 default:
262 len = 0;
265 if (retlen) *retlen = len;
267 if (tokeninfolength < len)
268 return STATUS_BUFFER_TOO_SMALL;
270 switch (tokeninfoclass)
272 case TokenUser:
273 SERVER_START_REQ( get_token_user )
275 TOKEN_USER * tuser = tokeninfo;
276 PSID sid = (PSID) (tuser + 1);
277 DWORD sid_len = tokeninfolength < sizeof(TOKEN_USER) ? 0 : tokeninfolength - sizeof(TOKEN_USER);
279 req->handle = token;
280 wine_server_set_reply( req, sid, sid_len );
281 status = wine_server_call( req );
282 if (retlen) *retlen = reply->user_len + sizeof(TOKEN_USER);
283 if (status == STATUS_SUCCESS)
285 tuser->User.Sid = sid;
286 tuser->User.Attributes = 0;
289 SERVER_END_REQ;
290 break;
291 case TokenGroups:
293 char stack_buffer[256];
294 unsigned int server_buf_len = sizeof(stack_buffer);
295 void *buffer = stack_buffer;
296 BOOLEAN need_more_memory = FALSE;
298 /* we cannot work out the size of the server buffer required for the
299 * input size, since there are two factors affecting how much can be
300 * stored in the buffer - number of groups and lengths of sids */
303 SERVER_START_REQ( get_token_groups )
305 TOKEN_GROUPS *groups = tokeninfo;
307 req->handle = token;
308 wine_server_set_reply( req, buffer, server_buf_len );
309 status = wine_server_call( req );
310 if (status == STATUS_BUFFER_TOO_SMALL)
312 if (buffer == stack_buffer)
313 buffer = RtlAllocateHeap(GetProcessHeap(), 0, reply->user_len);
314 else
315 buffer = RtlReAllocateHeap(GetProcessHeap(), 0, buffer, reply->user_len);
316 if (!buffer) return STATUS_NO_MEMORY;
318 server_buf_len = reply->user_len;
319 need_more_memory = TRUE;
321 else if (status == STATUS_SUCCESS)
323 struct token_groups *tg = buffer;
324 unsigned int *attr = (unsigned int *)(tg + 1);
325 ULONG i;
326 const int non_sid_portion = (sizeof(struct token_groups) + tg->count * sizeof(unsigned long));
327 SID *sids = (SID *)((char *)tokeninfo + FIELD_OFFSET( TOKEN_GROUPS, Groups[tg->count] ));
328 ULONG needed_bytes = FIELD_OFFSET( TOKEN_GROUPS, Groups[tg->count] ) +
329 reply->user_len - non_sid_portion;
331 if (retlen) *retlen = needed_bytes;
333 if (needed_bytes <= tokeninfolength)
335 groups->GroupCount = tg->count;
336 memcpy( sids, (char *)buffer + non_sid_portion,
337 reply->user_len - non_sid_portion );
339 for (i = 0; i < tg->count; i++)
341 groups->Groups[i].Attributes = attr[i];
342 groups->Groups[i].Sid = sids;
343 sids = (SID *)((char *)sids + RtlLengthSid(sids));
346 else status = STATUS_BUFFER_TOO_SMALL;
348 else if (retlen) *retlen = 0;
350 SERVER_END_REQ;
351 } while (need_more_memory);
352 if (buffer != stack_buffer) RtlFreeHeap(GetProcessHeap(), 0, buffer);
353 break;
355 case TokenPrimaryGroup:
356 if (tokeninfo)
358 TOKEN_PRIMARY_GROUP *tgroup = tokeninfo;
359 SID_IDENTIFIER_AUTHORITY sid = {SECURITY_NT_AUTHORITY};
360 RtlAllocateAndInitializeSid( &sid,
362 SECURITY_BUILTIN_DOMAIN_RID,
363 DOMAIN_ALIAS_RID_ADMINS,
364 0, 0, 0, 0, 0, 0,
365 &(tgroup->PrimaryGroup));
367 break;
368 case TokenPrivileges:
369 SERVER_START_REQ( get_token_privileges )
371 TOKEN_PRIVILEGES *tpriv = tokeninfo;
372 req->handle = token;
373 if (tpriv && tokeninfolength > FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ))
374 wine_server_set_reply( req, tpriv->Privileges, tokeninfolength - FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ) );
375 status = wine_server_call( req );
376 if (retlen) *retlen = FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ) + reply->len;
377 if (tpriv) tpriv->PrivilegeCount = reply->len / sizeof(LUID_AND_ATTRIBUTES);
379 SERVER_END_REQ;
380 break;
381 case TokenOwner:
382 if (tokeninfo)
384 TOKEN_OWNER *owner = tokeninfo;
385 PSID sid = (PSID) (owner + 1);
386 SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
387 RtlInitializeSid(sid, &localSidAuthority, 1);
388 *(RtlSubAuthoritySid(sid, 0)) = SECURITY_INTERACTIVE_RID;
389 owner->Owner = sid;
391 break;
392 case TokenImpersonationLevel:
393 SERVER_START_REQ( get_token_impersonation_level )
395 SECURITY_IMPERSONATION_LEVEL *impersonation_level = tokeninfo;
396 req->handle = token;
397 status = wine_server_call( req );
398 if (status == STATUS_SUCCESS)
399 *impersonation_level = reply->impersonation_level;
401 SERVER_END_REQ;
402 break;
403 case TokenStatistics:
404 SERVER_START_REQ( get_token_statistics )
406 TOKEN_STATISTICS *statistics = tokeninfo;
407 req->handle = token;
408 status = wine_server_call( req );
409 if (status == STATUS_SUCCESS)
411 statistics->TokenId.LowPart = reply->token_id.low_part;
412 statistics->TokenId.HighPart = reply->token_id.high_part;
413 statistics->AuthenticationId.LowPart = 0; /* FIXME */
414 statistics->AuthenticationId.HighPart = 0; /* FIXME */
415 statistics->ExpirationTime.u.HighPart = 0x7fffffff;
416 statistics->ExpirationTime.u.LowPart = 0xffffffff;
417 statistics->TokenType = reply->primary ? TokenPrimary : TokenImpersonation;
418 statistics->ImpersonationLevel = reply->impersonation_level;
420 /* kernel information not relevant to us */
421 statistics->DynamicCharged = 0;
422 statistics->DynamicAvailable = 0;
424 statistics->GroupCount = reply->group_count;
425 statistics->PrivilegeCount = reply->privilege_count;
426 statistics->ModifiedId.LowPart = reply->modified_id.low_part;
427 statistics->ModifiedId.HighPart = reply->modified_id.high_part;
430 SERVER_END_REQ;
431 break;
432 case TokenType:
433 SERVER_START_REQ( get_token_statistics )
435 TOKEN_TYPE *token_type = tokeninfo;
436 req->handle = token;
437 status = wine_server_call( req );
438 if (status == STATUS_SUCCESS)
439 *token_type = reply->primary ? TokenPrimary : TokenImpersonation;
441 SERVER_END_REQ;
442 break;
443 default:
445 ERR("Unhandled Token Information class %d!\n", tokeninfoclass);
446 return STATUS_NOT_IMPLEMENTED;
449 return status;
452 /******************************************************************************
453 * NtSetInformationToken [NTDLL.@]
454 * ZwSetInformationToken [NTDLL.@]
456 NTSTATUS WINAPI NtSetInformationToken(
457 HANDLE TokenHandle,
458 TOKEN_INFORMATION_CLASS TokenInformationClass,
459 PVOID TokenInformation,
460 ULONG TokenInformationLength)
462 FIXME("%p %d %p %u\n", TokenHandle, TokenInformationClass,
463 TokenInformation, TokenInformationLength);
464 return STATUS_NOT_IMPLEMENTED;
467 /******************************************************************************
468 * NtAdjustGroupsToken [NTDLL.@]
469 * ZwAdjustGroupsToken [NTDLL.@]
471 NTSTATUS WINAPI NtAdjustGroupsToken(
472 HANDLE TokenHandle,
473 BOOLEAN ResetToDefault,
474 PTOKEN_GROUPS NewState,
475 ULONG BufferLength,
476 PTOKEN_GROUPS PreviousState,
477 PULONG ReturnLength)
479 FIXME("%p %d %p %u %p %p\n", TokenHandle, ResetToDefault,
480 NewState, BufferLength, PreviousState, ReturnLength);
481 return STATUS_NOT_IMPLEMENTED;
484 /******************************************************************************
485 * NtPrivilegeCheck [NTDLL.@]
486 * ZwPrivilegeCheck [NTDLL.@]
488 NTSTATUS WINAPI NtPrivilegeCheck(
489 HANDLE ClientToken,
490 PPRIVILEGE_SET RequiredPrivileges,
491 PBOOLEAN Result)
493 NTSTATUS status;
494 SERVER_START_REQ( check_token_privileges )
496 req->handle = ClientToken;
497 req->all_required = ((RequiredPrivileges->Control & PRIVILEGE_SET_ALL_NECESSARY) ? TRUE : FALSE);
498 wine_server_add_data( req, RequiredPrivileges->Privilege,
499 RequiredPrivileges->PrivilegeCount * sizeof(RequiredPrivileges->Privilege[0]) );
500 wine_server_set_reply( req, RequiredPrivileges->Privilege,
501 RequiredPrivileges->PrivilegeCount * sizeof(RequiredPrivileges->Privilege[0]) );
503 status = wine_server_call( req );
505 if (status == STATUS_SUCCESS)
506 *Result = (reply->has_privileges ? TRUE : FALSE);
508 SERVER_END_REQ;
509 return status;
513 * Section
516 /******************************************************************************
517 * NtQuerySection [NTDLL.@]
519 NTSTATUS WINAPI NtQuerySection(
520 IN HANDLE SectionHandle,
521 IN SECTION_INFORMATION_CLASS SectionInformationClass,
522 OUT PVOID SectionInformation,
523 IN ULONG Length,
524 OUT PULONG ResultLength)
526 FIXME("(%p,%d,%p,0x%08x,%p) stub!\n",
527 SectionHandle,SectionInformationClass,SectionInformation,Length,ResultLength);
528 return 0;
532 * ports
535 /******************************************************************************
536 * NtCreatePort [NTDLL.@]
537 * ZwCreatePort [NTDLL.@]
539 NTSTATUS WINAPI NtCreatePort(PHANDLE PortHandle,POBJECT_ATTRIBUTES ObjectAttributes,
540 ULONG MaxConnectInfoLength,ULONG MaxDataLength,PULONG reserved)
542 FIXME("(%p,%p,%u,%u,%p),stub!\n",PortHandle,ObjectAttributes,
543 MaxConnectInfoLength,MaxDataLength,reserved);
544 return STATUS_NOT_IMPLEMENTED;
547 /******************************************************************************
548 * NtConnectPort [NTDLL.@]
549 * ZwConnectPort [NTDLL.@]
551 NTSTATUS WINAPI NtConnectPort(
552 PHANDLE PortHandle,
553 PUNICODE_STRING PortName,
554 PSECURITY_QUALITY_OF_SERVICE SecurityQos,
555 PLPC_SECTION_WRITE WriteSection,
556 PLPC_SECTION_READ ReadSection,
557 PULONG MaximumMessageLength,
558 PVOID ConnectInfo,
559 PULONG pConnectInfoLength)
561 FIXME("(%p,%s,%p,%p,%p,%p,%p,%p),stub!\n",
562 PortHandle,debugstr_w(PortName->Buffer),SecurityQos,
563 WriteSection,ReadSection,MaximumMessageLength,ConnectInfo,
564 pConnectInfoLength);
565 if (ConnectInfo && pConnectInfoLength)
566 TRACE("\tMessage = %s\n",debugstr_an(ConnectInfo,*pConnectInfoLength));
567 return STATUS_NOT_IMPLEMENTED;
570 /******************************************************************************
571 * NtListenPort [NTDLL.@]
572 * ZwListenPort [NTDLL.@]
574 NTSTATUS WINAPI NtListenPort(HANDLE PortHandle,PLPC_MESSAGE pLpcMessage)
576 FIXME("(%p,%p),stub!\n",PortHandle,pLpcMessage);
577 return STATUS_NOT_IMPLEMENTED;
580 /******************************************************************************
581 * NtAcceptConnectPort [NTDLL.@]
582 * ZwAcceptConnectPort [NTDLL.@]
584 NTSTATUS WINAPI NtAcceptConnectPort(
585 PHANDLE PortHandle,
586 ULONG PortIdentifier,
587 PLPC_MESSAGE pLpcMessage,
588 BOOLEAN Accept,
589 PLPC_SECTION_WRITE WriteSection,
590 PLPC_SECTION_READ ReadSection)
592 FIXME("(%p,%u,%p,%d,%p,%p),stub!\n",
593 PortHandle,PortIdentifier,pLpcMessage,Accept,WriteSection,ReadSection);
594 return STATUS_NOT_IMPLEMENTED;
597 /******************************************************************************
598 * NtCompleteConnectPort [NTDLL.@]
599 * ZwCompleteConnectPort [NTDLL.@]
601 NTSTATUS WINAPI NtCompleteConnectPort(HANDLE PortHandle)
603 FIXME("(%p),stub!\n",PortHandle);
604 return STATUS_NOT_IMPLEMENTED;
607 /******************************************************************************
608 * NtRegisterThreadTerminatePort [NTDLL.@]
609 * ZwRegisterThreadTerminatePort [NTDLL.@]
611 NTSTATUS WINAPI NtRegisterThreadTerminatePort(HANDLE PortHandle)
613 FIXME("(%p),stub!\n",PortHandle);
614 return STATUS_NOT_IMPLEMENTED;
617 /******************************************************************************
618 * NtRequestWaitReplyPort [NTDLL.@]
619 * ZwRequestWaitReplyPort [NTDLL.@]
621 NTSTATUS WINAPI NtRequestWaitReplyPort(
622 HANDLE PortHandle,
623 PLPC_MESSAGE pLpcMessageIn,
624 PLPC_MESSAGE pLpcMessageOut)
626 FIXME("(%p,%p,%p),stub!\n",PortHandle,pLpcMessageIn,pLpcMessageOut);
627 if(pLpcMessageIn)
629 TRACE("Message to send:\n");
630 TRACE("\tDataSize = %u\n",pLpcMessageIn->DataSize);
631 TRACE("\tMessageSize = %u\n",pLpcMessageIn->MessageSize);
632 TRACE("\tMessageType = %u\n",pLpcMessageIn->MessageType);
633 TRACE("\tVirtualRangesOffset = %u\n",pLpcMessageIn->VirtualRangesOffset);
634 TRACE("\tClientId.UniqueProcess = %p\n",pLpcMessageIn->ClientId.UniqueProcess);
635 TRACE("\tClientId.UniqueThread = %p\n",pLpcMessageIn->ClientId.UniqueThread);
636 TRACE("\tMessageId = %u\n",pLpcMessageIn->MessageId);
637 TRACE("\tSectionSize = %u\n",pLpcMessageIn->SectionSize);
638 TRACE("\tData = %s\n",
639 debugstr_an((const char*)pLpcMessageIn->Data,pLpcMessageIn->DataSize));
641 return STATUS_NOT_IMPLEMENTED;
644 /******************************************************************************
645 * NtReplyWaitReceivePort [NTDLL.@]
646 * ZwReplyWaitReceivePort [NTDLL.@]
648 NTSTATUS WINAPI NtReplyWaitReceivePort(
649 HANDLE PortHandle,
650 PULONG PortIdentifier,
651 PLPC_MESSAGE ReplyMessage,
652 PLPC_MESSAGE Message)
654 FIXME("(%p,%p,%p,%p),stub!\n",PortHandle,PortIdentifier,ReplyMessage,Message);
655 return STATUS_NOT_IMPLEMENTED;
659 * Misc
662 /******************************************************************************
663 * NtSetIntervalProfile [NTDLL.@]
664 * ZwSetIntervalProfile [NTDLL.@]
666 NTSTATUS WINAPI NtSetIntervalProfile(
667 ULONG Interval,
668 KPROFILE_SOURCE Source)
670 FIXME("%u,%d\n", Interval, Source);
671 return STATUS_SUCCESS;
674 /******************************************************************************
675 * NtQuerySystemInformation [NTDLL.@]
676 * ZwQuerySystemInformation [NTDLL.@]
678 * ARGUMENTS:
679 * SystemInformationClass Index to a certain information structure
680 * SystemTimeAdjustmentInformation SYSTEM_TIME_ADJUSTMENT
681 * SystemCacheInformation SYSTEM_CACHE_INFORMATION
682 * SystemConfigurationInformation CONFIGURATION_INFORMATION
683 * observed (class/len):
684 * 0x0/0x2c
685 * 0x12/0x18
686 * 0x2/0x138
687 * 0x8/0x600
688 * 0x25/0xc
689 * SystemInformation caller supplies storage for the information structure
690 * Length size of the structure
691 * ResultLength Data written
693 NTSTATUS WINAPI NtQuerySystemInformation(
694 IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
695 OUT PVOID SystemInformation,
696 IN ULONG Length,
697 OUT PULONG ResultLength)
699 NTSTATUS ret = STATUS_SUCCESS;
700 ULONG len = 0;
702 TRACE("(0x%08x,%p,0x%08x,%p)\n",
703 SystemInformationClass,SystemInformation,Length,ResultLength);
705 switch (SystemInformationClass)
707 case SystemBasicInformation:
709 SYSTEM_BASIC_INFORMATION sbi;
711 virtual_get_system_info( &sbi );
712 len = sizeof(sbi);
714 if ( Length == len)
716 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
717 else memcpy( SystemInformation, &sbi, len);
719 else ret = STATUS_INFO_LENGTH_MISMATCH;
721 break;
722 case SystemCpuInformation:
724 SYSTEM_CPU_INFORMATION sci;
726 /* FIXME: move some code from kernel/cpu.c to process this */
727 sci.Architecture = PROCESSOR_ARCHITECTURE_INTEL;
728 sci.Level = 6; /* 686, aka Pentium II+ */
729 sci.Revision = 0;
730 sci.Reserved = 0;
731 sci.FeatureSet = 0x1fff;
732 len = sizeof(sci);
734 if ( Length >= len)
736 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
737 else memcpy( SystemInformation, &sci, len);
739 else ret = STATUS_INFO_LENGTH_MISMATCH;
741 break;
742 case SystemPerformanceInformation:
744 SYSTEM_PERFORMANCE_INFORMATION spi;
746 memset(&spi, 0 , sizeof(spi));
747 len = sizeof(spi);
749 if (Length >= len)
751 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
752 else memcpy( SystemInformation, &spi, len);
754 else ret = STATUS_INFO_LENGTH_MISMATCH;
755 FIXME("info_class SYSTEM_PERFORMANCE_INFORMATION\n");
757 break;
758 case SystemTimeOfDayInformation:
760 SYSTEM_TIMEOFDAY_INFORMATION sti;
762 memset(&sti, 0 , sizeof(sti));
764 /* liKeSystemTime, liExpTimeZoneBias, uCurrentTimeZoneId */
765 sti.liKeBootTime.QuadPart = server_start_time;
767 if (Length <= sizeof(sti))
769 len = Length;
770 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
771 else memcpy( SystemInformation, &sti, Length);
773 else ret = STATUS_INFO_LENGTH_MISMATCH;
775 break;
776 case SystemProcessInformation:
778 SYSTEM_PROCESS_INFORMATION* spi = (SYSTEM_PROCESS_INFORMATION*)SystemInformation;
779 SYSTEM_PROCESS_INFORMATION* last = NULL;
780 HANDLE hSnap = 0;
781 WCHAR procname[1024];
782 WCHAR* exename;
783 DWORD wlen = 0;
784 DWORD procstructlen = 0;
786 SERVER_START_REQ( create_snapshot )
788 req->flags = SNAP_PROCESS | SNAP_THREAD;
789 req->attributes = 0;
790 req->pid = 0;
791 if (!(ret = wine_server_call( req ))) hSnap = reply->handle;
793 SERVER_END_REQ;
794 len = 0;
795 while (ret == STATUS_SUCCESS)
797 SERVER_START_REQ( next_process )
799 req->handle = hSnap;
800 req->reset = (len == 0);
801 wine_server_set_reply( req, procname, sizeof(procname)-sizeof(WCHAR) );
802 if (!(ret = wine_server_call( req )))
804 /* Make sure procname is 0 terminated */
805 procname[wine_server_reply_size(reply) / sizeof(WCHAR)] = 0;
807 /* Get only the executable name, not the path */
808 if ((exename = strrchrW(procname, '\\')) != NULL) exename++;
809 else exename = procname;
811 wlen = (strlenW(exename) + 1) * sizeof(WCHAR);
813 procstructlen = sizeof(*spi) + wlen + ((reply->threads - 1) * sizeof(SYSTEM_THREAD_INFORMATION));
815 if (Length >= len + procstructlen)
817 /* ftCreationTime, ftUserTime, ftKernelTime;
818 * vmCounters, ioCounters
821 memset(spi, 0, sizeof(*spi));
823 spi->dwOffset = procstructlen - wlen;
824 spi->dwThreadCount = reply->threads;
826 /* spi->pszProcessName will be set later on */
828 spi->dwBasePriority = reply->priority;
829 spi->dwProcessID = (DWORD)reply->pid;
830 spi->dwParentProcessID = (DWORD)reply->ppid;
831 spi->dwHandleCount = reply->handles;
833 /* spi->ti will be set later on */
835 len += procstructlen;
837 else ret = STATUS_INFO_LENGTH_MISMATCH;
840 SERVER_END_REQ;
842 if (ret != STATUS_SUCCESS)
844 if (ret == STATUS_NO_MORE_FILES) ret = STATUS_SUCCESS;
845 break;
847 else /* Length is already checked for */
849 int i, j;
851 /* set thread info */
852 i = j = 0;
853 while (ret == STATUS_SUCCESS)
855 SERVER_START_REQ( next_thread )
857 req->handle = hSnap;
858 req->reset = (j == 0);
859 if (!(ret = wine_server_call( req )))
861 j++;
862 if (reply->pid == spi->dwProcessID)
864 /* ftKernelTime, ftUserTime, ftCreateTime;
865 * dwTickCount, dwStartAddress
868 memset(&spi->ti[i], 0, sizeof(spi->ti));
870 spi->ti[i].dwOwningPID = reply->pid;
871 spi->ti[i].dwThreadID = reply->tid;
872 spi->ti[i].dwCurrentPriority = reply->base_pri + reply->delta_pri;
873 spi->ti[i].dwBasePriority = reply->base_pri;
874 i++;
878 SERVER_END_REQ;
880 if (ret == STATUS_NO_MORE_FILES) ret = STATUS_SUCCESS;
882 /* now append process name */
883 spi->ProcessName.Buffer = (WCHAR*)((char*)spi + spi->dwOffset);
884 spi->ProcessName.Length = wlen - sizeof(WCHAR);
885 spi->ProcessName.MaximumLength = wlen;
886 memcpy( spi->ProcessName.Buffer, exename, wlen );
887 spi->dwOffset += wlen;
889 last = spi;
890 spi = (SYSTEM_PROCESS_INFORMATION*)((char*)spi + spi->dwOffset);
893 if (ret == STATUS_SUCCESS && last) last->dwOffset = 0;
894 if (hSnap) NtClose(hSnap);
896 break;
897 case SystemProcessorPerformanceInformation:
899 SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION *sppi = NULL;
900 unsigned int cpus = 0;
901 int out_cpus = Length / sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION);
903 if (out_cpus == 0)
905 len = 0;
906 ret = STATUS_INFO_LENGTH_MISMATCH;
907 break;
909 else
910 #ifdef __APPLE__
912 processor_cpu_load_info_data_t *pinfo;
913 mach_msg_type_number_t info_count;
915 if (host_processor_info (mach_host_self (),
916 PROCESSOR_CPU_LOAD_INFO,
917 &cpus,
918 (processor_info_array_t*)&pinfo,
919 &info_count) == 0)
921 int i;
922 cpus = min(cpus,out_cpus);
923 len = sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * cpus;
924 sppi = RtlAllocateHeap(GetProcessHeap(), 0,len);
925 for (i = 0; i < cpus; i++)
927 sppi[i].liIdleTime.QuadPart = pinfo[i].cpu_ticks[CPU_STATE_IDLE];
928 sppi[i].liKernelTime.QuadPart = pinfo[i].cpu_ticks[CPU_STATE_SYSTEM];
929 sppi[i].liUserTime.QuadPart = pinfo[i].cpu_ticks[CPU_STATE_USER];
931 vm_deallocate (mach_task_self (), (vm_address_t) pinfo, info_count * sizeof(natural_t));
934 #else
936 FILE *cpuinfo = fopen("/proc/stat","r");
937 if (cpuinfo)
939 unsigned usr,nice,sys;
940 unsigned long idle;
941 int count;
942 char name[10];
943 char line[255];
945 /* first line is combined usage */
946 if (fgets(line,255,cpuinfo))
947 count = sscanf(line,"%s %u %u %u %lu",name, &usr, &nice,
948 &sys, &idle);
949 else
950 count = 0;
951 /* we set this up in the for older non-smp enabled kernels */
952 if (count == 5 && strcmp(name,"cpu")==0)
954 sppi = RtlAllocateHeap(GetProcessHeap(), 0,
955 sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION));
956 sppi->liIdleTime.QuadPart = idle;
957 sppi->liKernelTime.QuadPart = sys;
958 sppi->liUserTime.QuadPart = usr;
959 cpus = 1;
960 len = sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION);
965 if (fgets(line,255,cpuinfo))
966 count = sscanf(line,"%s %u %u %u %lu",name, &usr,
967 &nice, &sys, &idle);
968 else
969 count = 0;
970 if (count == 5 && strncmp(name,"cpu",3)==0)
972 out_cpus --;
973 if (name[3]=='0') /* first cpu */
975 sppi->liIdleTime.QuadPart = idle;
976 sppi->liKernelTime.QuadPart = sys;
977 sppi->liUserTime.QuadPart = usr;
979 else /* new cpu */
981 len = sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * (cpus+1);
982 sppi = RtlReAllocateHeap(GetProcessHeap(), 0, sppi, len);
983 sppi[cpus].liIdleTime.QuadPart = idle;
984 sppi[cpus].liKernelTime.QuadPart = sys;
985 sppi[cpus].liUserTime.QuadPart = usr;
986 cpus++;
989 else
990 break;
991 } while (out_cpus > 0);
992 fclose(cpuinfo);
995 #endif
997 if (cpus == 0)
999 static int i = 1;
1001 sppi = RtlAllocateHeap(GetProcessHeap(),0,sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION));
1003 memset(sppi, 0 , sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION));
1004 FIXME("stub info_class SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION\n");
1006 /* many programs expect these values to change so fake change */
1007 len = sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION);
1008 sppi->liKernelTime.QuadPart = 1 * i;
1009 sppi->liUserTime.QuadPart = 2 * i;
1010 sppi->liIdleTime.QuadPart = 3 * i;
1011 i++;
1014 if (Length >= len)
1016 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
1017 else memcpy( SystemInformation, sppi, len);
1019 else ret = STATUS_INFO_LENGTH_MISMATCH;
1021 RtlFreeHeap(GetProcessHeap(),0,sppi);
1023 break;
1024 case SystemModuleInformation:
1025 /* FIXME: should be system-wide */
1026 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
1027 else ret = LdrQueryProcessModuleInformation( SystemInformation, Length, &len );
1028 break;
1029 case SystemHandleInformation:
1031 SYSTEM_HANDLE_INFORMATION shi;
1033 memset(&shi, 0, sizeof(shi));
1034 len = sizeof(shi);
1036 if ( Length >= len)
1038 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
1039 else memcpy( SystemInformation, &shi, len);
1041 else ret = STATUS_INFO_LENGTH_MISMATCH;
1042 FIXME("info_class SYSTEM_HANDLE_INFORMATION\n");
1044 break;
1045 case SystemCacheInformation:
1047 SYSTEM_CACHE_INFORMATION sci;
1049 memset(&sci, 0, sizeof(sci)); /* FIXME */
1050 len = sizeof(sci);
1052 if ( Length >= len)
1054 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
1055 else memcpy( SystemInformation, &sci, len);
1057 else ret = STATUS_INFO_LENGTH_MISMATCH;
1058 FIXME("info_class SYSTEM_CACHE_INFORMATION\n");
1060 break;
1061 case SystemInterruptInformation:
1063 SYSTEM_INTERRUPT_INFORMATION sii;
1065 memset(&sii, 0, sizeof(sii));
1066 len = sizeof(sii);
1068 if ( Length >= len)
1070 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
1071 else memcpy( SystemInformation, &sii, len);
1073 else ret = STATUS_INFO_LENGTH_MISMATCH;
1074 FIXME("info_class SYSTEM_INTERRUPT_INFORMATION\n");
1076 break;
1077 case SystemKernelDebuggerInformation:
1079 SYSTEM_KERNEL_DEBUGGER_INFORMATION skdi;
1081 skdi.DebuggerEnabled = FALSE;
1082 skdi.DebuggerNotPresent = TRUE;
1083 len = sizeof(skdi);
1085 if ( Length >= len)
1087 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
1088 else memcpy( SystemInformation, &skdi, len);
1090 else ret = STATUS_INFO_LENGTH_MISMATCH;
1092 break;
1093 case SystemRegistryQuotaInformation:
1095 /* Something to do with the size of the registry *
1096 * Since we don't have a size limitation, fake it *
1097 * This is almost certainly wrong. *
1098 * This sets each of the three words in the struct to 32 MB, *
1099 * which is enough to make the IE 5 installer happy. */
1100 SYSTEM_REGISTRY_QUOTA_INFORMATION srqi;
1102 srqi.RegistryQuotaAllowed = 0x2000000;
1103 srqi.RegistryQuotaUsed = 0x200000;
1104 srqi.Reserved1 = (void*)0x200000;
1105 len = sizeof(srqi);
1107 if ( Length >= len)
1109 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
1110 else
1112 FIXME("SystemRegistryQuotaInformation: faking max registry size of 32 MB\n");
1113 memcpy( SystemInformation, &srqi, len);
1116 else ret = STATUS_INFO_LENGTH_MISMATCH;
1118 break;
1119 default:
1120 FIXME("(0x%08x,%p,0x%08x,%p) stub\n",
1121 SystemInformationClass,SystemInformation,Length,ResultLength);
1123 /* Several Information Classes are not implemented on Windows and return 2 different values
1124 * STATUS_NOT_IMPLEMENTED or STATUS_INVALID_INFO_CLASS
1125 * in 95% of the cases it's STATUS_INVALID_INFO_CLASS, so use this as the default
1127 ret = STATUS_INVALID_INFO_CLASS;
1130 if (ResultLength) *ResultLength = len;
1132 return ret;
1135 /******************************************************************************
1136 * NtSetSystemInformation [NTDLL.@]
1137 * ZwSetSystemInformation [NTDLL.@]
1139 NTSTATUS WINAPI NtSetSystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass, PVOID SystemInformation, ULONG Length)
1141 FIXME("(0x%08x,%p,0x%08x) stub\n",SystemInformationClass,SystemInformation,Length);
1142 return STATUS_SUCCESS;
1145 /******************************************************************************
1146 * NtCreatePagingFile [NTDLL.@]
1147 * ZwCreatePagingFile [NTDLL.@]
1149 NTSTATUS WINAPI NtCreatePagingFile(
1150 PUNICODE_STRING PageFileName,
1151 PLARGE_INTEGER MinimumSize,
1152 PLARGE_INTEGER MaximumSize,
1153 PLARGE_INTEGER ActualSize)
1155 FIXME("(%p %p %p %p) stub\n", PageFileName, MinimumSize, MaximumSize, ActualSize);
1156 return STATUS_SUCCESS;
1159 /******************************************************************************
1160 * NtDisplayString [NTDLL.@]
1162 * writes a string to the nt-textmode screen eg. during startup
1164 NTSTATUS WINAPI NtDisplayString ( PUNICODE_STRING string )
1166 STRING stringA;
1167 NTSTATUS ret;
1169 if (!(ret = RtlUnicodeStringToAnsiString( &stringA, string, TRUE )))
1171 MESSAGE( "%.*s", stringA.Length, stringA.Buffer );
1172 RtlFreeAnsiString( &stringA );
1174 return ret;
1177 /******************************************************************************
1178 * NtInitiatePowerAction [NTDLL.@]
1181 NTSTATUS WINAPI NtInitiatePowerAction(
1182 IN POWER_ACTION SystemAction,
1183 IN SYSTEM_POWER_STATE MinSystemState,
1184 IN ULONG Flags,
1185 IN BOOLEAN Asynchronous)
1187 FIXME("(%d,%d,0x%08x,%d),stub\n",
1188 SystemAction,MinSystemState,Flags,Asynchronous);
1189 return STATUS_NOT_IMPLEMENTED;
1193 /******************************************************************************
1194 * NtPowerInformation [NTDLL.@]
1197 NTSTATUS WINAPI NtPowerInformation(
1198 IN POWER_INFORMATION_LEVEL InformationLevel,
1199 IN PVOID lpInputBuffer,
1200 IN ULONG nInputBufferSize,
1201 IN PVOID lpOutputBuffer,
1202 IN ULONG nOutputBufferSize)
1204 TRACE("(%d,%p,%d,%p,%d)\n",
1205 InformationLevel,lpInputBuffer,nInputBufferSize,lpOutputBuffer,nOutputBufferSize);
1206 switch(InformationLevel) {
1207 case SystemPowerCapabilities: {
1208 PSYSTEM_POWER_CAPABILITIES PowerCaps = (PSYSTEM_POWER_CAPABILITIES)lpOutputBuffer;
1209 FIXME("semi-stub: SystemPowerCapabilities\n");
1210 if (nOutputBufferSize < sizeof(SYSTEM_POWER_CAPABILITIES))
1211 return STATUS_BUFFER_TOO_SMALL;
1212 /* FIXME: These values are based off a native XP desktop, should probably use APM/ACPI to get the 'real' values */
1213 PowerCaps->PowerButtonPresent = TRUE;
1214 PowerCaps->SleepButtonPresent = FALSE;
1215 PowerCaps->LidPresent = FALSE;
1216 PowerCaps->SystemS1 = TRUE;
1217 PowerCaps->SystemS2 = FALSE;
1218 PowerCaps->SystemS3 = FALSE;
1219 PowerCaps->SystemS4 = TRUE;
1220 PowerCaps->SystemS5 = TRUE;
1221 PowerCaps->HiberFilePresent = TRUE;
1222 PowerCaps->FullWake = TRUE;
1223 PowerCaps->VideoDimPresent = FALSE;
1224 PowerCaps->ApmPresent = FALSE;
1225 PowerCaps->UpsPresent = FALSE;
1226 PowerCaps->ThermalControl = FALSE;
1227 PowerCaps->ProcessorThrottle = FALSE;
1228 PowerCaps->ProcessorMinThrottle = 100;
1229 PowerCaps->ProcessorMaxThrottle = 100;
1230 PowerCaps->DiskSpinDown = TRUE;
1231 PowerCaps->SystemBatteriesPresent = FALSE;
1232 PowerCaps->BatteriesAreShortTerm = FALSE;
1233 PowerCaps->BatteryScale[0].Granularity = 0;
1234 PowerCaps->BatteryScale[0].Capacity = 0;
1235 PowerCaps->BatteryScale[1].Granularity = 0;
1236 PowerCaps->BatteryScale[1].Capacity = 0;
1237 PowerCaps->BatteryScale[2].Granularity = 0;
1238 PowerCaps->BatteryScale[2].Capacity = 0;
1239 PowerCaps->AcOnLineWake = PowerSystemUnspecified;
1240 PowerCaps->SoftLidWake = PowerSystemUnspecified;
1241 PowerCaps->RtcWake = PowerSystemSleeping1;
1242 PowerCaps->MinDeviceWakeState = PowerSystemUnspecified;
1243 PowerCaps->DefaultLowLatencyWake = PowerSystemUnspecified;
1244 return STATUS_SUCCESS;
1246 default:
1247 FIXME("Unimplemented NtPowerInformation action: %d\n", InformationLevel);
1248 return STATUS_NOT_IMPLEMENTED;
1252 /******************************************************************************
1253 * NtShutdownSystem [NTDLL.@]
1256 NTSTATUS WINAPI NtShutdownSystem(SHUTDOWN_ACTION Action)
1258 FIXME("%d\n",Action);
1259 return STATUS_SUCCESS;
1262 /******************************************************************************
1263 * NtAllocateLocallyUniqueId (NTDLL.@)
1265 NTSTATUS WINAPI NtAllocateLocallyUniqueId(PLUID Luid)
1267 NTSTATUS status;
1269 TRACE("%p\n", Luid);
1271 if (!Luid)
1272 return STATUS_ACCESS_VIOLATION;
1274 SERVER_START_REQ( allocate_locally_unique_id )
1276 status = wine_server_call( req );
1277 if (!status)
1279 Luid->LowPart = reply->luid.low_part;
1280 Luid->HighPart = reply->luid.high_part;
1283 SERVER_END_REQ;
1285 return status;
1288 /******************************************************************************
1289 * VerSetConditionMask (NTDLL.@)
1291 ULONGLONG WINAPI VerSetConditionMask( ULONGLONG dwlConditionMask, DWORD dwTypeBitMask,
1292 BYTE dwConditionMask)
1294 if(dwTypeBitMask == 0)
1295 return dwlConditionMask;
1296 dwConditionMask &= 0x07;
1297 if(dwConditionMask == 0)
1298 return dwlConditionMask;
1300 if(dwTypeBitMask & VER_PRODUCT_TYPE)
1301 dwlConditionMask |= dwConditionMask << 7*3;
1302 else if (dwTypeBitMask & VER_SUITENAME)
1303 dwlConditionMask |= dwConditionMask << 6*3;
1304 else if (dwTypeBitMask & VER_SERVICEPACKMAJOR)
1305 dwlConditionMask |= dwConditionMask << 5*3;
1306 else if (dwTypeBitMask & VER_SERVICEPACKMINOR)
1307 dwlConditionMask |= dwConditionMask << 4*3;
1308 else if (dwTypeBitMask & VER_PLATFORMID)
1309 dwlConditionMask |= dwConditionMask << 3*3;
1310 else if (dwTypeBitMask & VER_BUILDNUMBER)
1311 dwlConditionMask |= dwConditionMask << 2*3;
1312 else if (dwTypeBitMask & VER_MAJORVERSION)
1313 dwlConditionMask |= dwConditionMask << 1*3;
1314 else if (dwTypeBitMask & VER_MINORVERSION)
1315 dwlConditionMask |= dwConditionMask << 0*3;
1316 return dwlConditionMask;
1319 /******************************************************************************
1320 * NtAccessCheckAndAuditAlarm (NTDLL.@)
1321 * ZwAccessCheckAndAuditAlarm (NTDLL.@)
1323 NTSTATUS WINAPI NtAccessCheckAndAuditAlarm(PUNICODE_STRING SubsystemName, HANDLE HandleId, PUNICODE_STRING ObjectTypeName,
1324 PUNICODE_STRING ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor,
1325 ACCESS_MASK DesiredAccess, PGENERIC_MAPPING GenericMapping, BOOLEAN ObjectCreation,
1326 PACCESS_MASK GrantedAccess, PBOOLEAN AccessStatus, PBOOLEAN GenerateOnClose)
1328 FIXME("(%s, %p, %s, %p, 0x%08x, %p, %d, %p, %p, %p), stub\n", debugstr_us(SubsystemName), HandleId,
1329 debugstr_us(ObjectTypeName), SecurityDescriptor, DesiredAccess, GenericMapping, ObjectCreation,
1330 GrantedAccess, AccessStatus, GenerateOnClose);
1332 return STATUS_NOT_IMPLEMENTED;