comctl32: Fix propsheet size calculation.
[wine/multimedia.git] / dlls / ntdll / nt.c
blob879a324288442b1f0ab4317260cc230c9affa317
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 = wine_server_obj_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 = wine_server_ptr_handle( 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 = wine_server_obj_handle( process );
122 req->access = access;
123 req->attributes = attributes;
124 req->flags = 0;
125 ret = wine_server_call( req );
126 if (!ret) *handle = wine_server_ptr_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 = wine_server_obj_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 = wine_server_ptr_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 = wine_server_obj_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 = wine_server_obj_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 = wine_server_obj_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 = wine_server_obj_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 = wine_server_obj_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 = wine_server_obj_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 = wine_server_obj_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 = wine_server_obj_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;
745 static BOOL fixme_written = FALSE;
747 memset(&spi, 0 , sizeof(spi));
748 len = sizeof(spi);
750 if (Length >= len)
752 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
753 else memcpy( SystemInformation, &spi, len);
755 else ret = STATUS_INFO_LENGTH_MISMATCH;
756 if(!fixme_written) {
757 FIXME("info_class SYSTEM_PERFORMANCE_INFORMATION\n");
758 fixme_written = TRUE;
761 break;
762 case SystemTimeOfDayInformation:
764 SYSTEM_TIMEOFDAY_INFORMATION sti;
766 memset(&sti, 0 , sizeof(sti));
768 /* liKeSystemTime, liExpTimeZoneBias, uCurrentTimeZoneId */
769 sti.liKeBootTime.QuadPart = server_start_time;
771 if (Length <= sizeof(sti))
773 len = Length;
774 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
775 else memcpy( SystemInformation, &sti, Length);
777 else ret = STATUS_INFO_LENGTH_MISMATCH;
779 break;
780 case SystemProcessInformation:
782 SYSTEM_PROCESS_INFORMATION* spi = (SYSTEM_PROCESS_INFORMATION*)SystemInformation;
783 SYSTEM_PROCESS_INFORMATION* last = NULL;
784 HANDLE hSnap = 0;
785 WCHAR procname[1024];
786 WCHAR* exename;
787 DWORD wlen = 0;
788 DWORD procstructlen = 0;
790 SERVER_START_REQ( create_snapshot )
792 req->flags = SNAP_PROCESS | SNAP_THREAD;
793 req->attributes = 0;
794 if (!(ret = wine_server_call( req )))
795 hSnap = wine_server_ptr_handle( reply->handle );
797 SERVER_END_REQ;
798 len = 0;
799 while (ret == STATUS_SUCCESS)
801 SERVER_START_REQ( next_process )
803 req->handle = wine_server_obj_handle( hSnap );
804 req->reset = (len == 0);
805 wine_server_set_reply( req, procname, sizeof(procname)-sizeof(WCHAR) );
806 if (!(ret = wine_server_call( req )))
808 /* Make sure procname is 0 terminated */
809 procname[wine_server_reply_size(reply) / sizeof(WCHAR)] = 0;
811 /* Get only the executable name, not the path */
812 if ((exename = strrchrW(procname, '\\')) != NULL) exename++;
813 else exename = procname;
815 wlen = (strlenW(exename) + 1) * sizeof(WCHAR);
817 procstructlen = sizeof(*spi) + wlen + ((reply->threads - 1) * sizeof(SYSTEM_THREAD_INFORMATION));
819 if (Length >= len + procstructlen)
821 /* ftCreationTime, ftUserTime, ftKernelTime;
822 * vmCounters, ioCounters
825 memset(spi, 0, sizeof(*spi));
827 spi->NextEntryOffset = procstructlen - wlen;
828 spi->dwThreadCount = reply->threads;
830 /* spi->pszProcessName will be set later on */
832 spi->dwBasePriority = reply->priority;
833 spi->UniqueProcessId = UlongToHandle(reply->pid);
834 spi->ParentProcessId = UlongToHandle(reply->ppid);
835 spi->HandleCount = reply->handles;
837 /* spi->ti will be set later on */
839 len += procstructlen;
841 else ret = STATUS_INFO_LENGTH_MISMATCH;
844 SERVER_END_REQ;
846 if (ret != STATUS_SUCCESS)
848 if (ret == STATUS_NO_MORE_FILES) ret = STATUS_SUCCESS;
849 break;
851 else /* Length is already checked for */
853 int i, j;
855 /* set thread info */
856 i = j = 0;
857 while (ret == STATUS_SUCCESS)
859 SERVER_START_REQ( next_thread )
861 req->handle = wine_server_obj_handle( hSnap );
862 req->reset = (j == 0);
863 if (!(ret = wine_server_call( req )))
865 j++;
866 if (UlongToHandle(reply->pid) == spi->UniqueProcessId)
868 /* ftKernelTime, ftUserTime, ftCreateTime;
869 * dwTickCount, dwStartAddress
872 memset(&spi->ti[i], 0, sizeof(spi->ti));
874 spi->ti[i].CreateTime.QuadPart = 0xdeadbeef;
875 spi->ti[i].ClientId.UniqueProcess = UlongToHandle(reply->pid);
876 spi->ti[i].ClientId.UniqueThread = UlongToHandle(reply->tid);
877 spi->ti[i].dwCurrentPriority = reply->base_pri + reply->delta_pri;
878 spi->ti[i].dwBasePriority = reply->base_pri;
879 i++;
883 SERVER_END_REQ;
885 if (ret == STATUS_NO_MORE_FILES) ret = STATUS_SUCCESS;
887 /* now append process name */
888 spi->ProcessName.Buffer = (WCHAR*)((char*)spi + spi->NextEntryOffset);
889 spi->ProcessName.Length = wlen - sizeof(WCHAR);
890 spi->ProcessName.MaximumLength = wlen;
891 memcpy( spi->ProcessName.Buffer, exename, wlen );
892 spi->NextEntryOffset += wlen;
894 last = spi;
895 spi = (SYSTEM_PROCESS_INFORMATION*)((char*)spi + spi->NextEntryOffset);
898 if (ret == STATUS_SUCCESS && last) last->NextEntryOffset = 0;
899 if (hSnap) NtClose(hSnap);
901 break;
902 case SystemProcessorPerformanceInformation:
904 SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION *sppi = NULL;
905 unsigned int cpus = 0;
906 int out_cpus = Length / sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION);
908 if (out_cpus == 0)
910 len = 0;
911 ret = STATUS_INFO_LENGTH_MISMATCH;
912 break;
914 else
915 #ifdef __APPLE__
917 processor_cpu_load_info_data_t *pinfo;
918 mach_msg_type_number_t info_count;
920 if (host_processor_info (mach_host_self (),
921 PROCESSOR_CPU_LOAD_INFO,
922 &cpus,
923 (processor_info_array_t*)&pinfo,
924 &info_count) == 0)
926 int i;
927 cpus = min(cpus,out_cpus);
928 len = sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * cpus;
929 sppi = RtlAllocateHeap(GetProcessHeap(), 0,len);
930 for (i = 0; i < cpus; i++)
932 sppi[i].liIdleTime.QuadPart = pinfo[i].cpu_ticks[CPU_STATE_IDLE];
933 sppi[i].liKernelTime.QuadPart = pinfo[i].cpu_ticks[CPU_STATE_SYSTEM];
934 sppi[i].liUserTime.QuadPart = pinfo[i].cpu_ticks[CPU_STATE_USER];
936 vm_deallocate (mach_task_self (), (vm_address_t) pinfo, info_count * sizeof(natural_t));
939 #else
941 FILE *cpuinfo = fopen("/proc/stat","r");
942 if (cpuinfo)
944 unsigned usr,nice,sys;
945 unsigned long idle;
946 int count;
947 char name[10];
948 char line[255];
950 /* first line is combined usage */
951 if (fgets(line,255,cpuinfo))
952 count = sscanf(line,"%s %u %u %u %lu",name, &usr, &nice,
953 &sys, &idle);
954 else
955 count = 0;
956 /* we set this up in the for older non-smp enabled kernels */
957 if (count == 5 && strcmp(name,"cpu")==0)
959 sppi = RtlAllocateHeap(GetProcessHeap(), 0,
960 sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION));
961 sppi->liIdleTime.QuadPart = idle;
962 sppi->liKernelTime.QuadPart = sys;
963 sppi->liUserTime.QuadPart = usr;
964 cpus = 1;
965 len = sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION);
970 if (fgets(line,255,cpuinfo))
971 count = sscanf(line,"%s %u %u %u %lu",name, &usr,
972 &nice, &sys, &idle);
973 else
974 count = 0;
975 if (count == 5 && strncmp(name,"cpu",3)==0)
977 out_cpus --;
978 if (name[3]=='0') /* first cpu */
980 sppi->liIdleTime.QuadPart = idle;
981 sppi->liKernelTime.QuadPart = sys;
982 sppi->liUserTime.QuadPart = usr;
984 else /* new cpu */
986 len = sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * (cpus+1);
987 sppi = RtlReAllocateHeap(GetProcessHeap(), 0, sppi, len);
988 sppi[cpus].liIdleTime.QuadPart = idle;
989 sppi[cpus].liKernelTime.QuadPart = sys;
990 sppi[cpus].liUserTime.QuadPart = usr;
991 cpus++;
994 else
995 break;
996 } while (out_cpus > 0);
997 fclose(cpuinfo);
1000 #endif
1002 if (cpus == 0)
1004 static int i = 1;
1006 sppi = RtlAllocateHeap(GetProcessHeap(),0,sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION));
1008 memset(sppi, 0 , sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION));
1009 FIXME("stub info_class SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION\n");
1011 /* many programs expect these values to change so fake change */
1012 len = sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION);
1013 sppi->liKernelTime.QuadPart = 1 * i;
1014 sppi->liUserTime.QuadPart = 2 * i;
1015 sppi->liIdleTime.QuadPart = 3 * i;
1016 i++;
1019 if (Length >= len)
1021 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
1022 else memcpy( SystemInformation, sppi, len);
1024 else ret = STATUS_INFO_LENGTH_MISMATCH;
1026 RtlFreeHeap(GetProcessHeap(),0,sppi);
1028 break;
1029 case SystemModuleInformation:
1030 /* FIXME: should be system-wide */
1031 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
1032 else ret = LdrQueryProcessModuleInformation( SystemInformation, Length, &len );
1033 break;
1034 case SystemHandleInformation:
1036 SYSTEM_HANDLE_INFORMATION shi;
1038 memset(&shi, 0, sizeof(shi));
1039 len = sizeof(shi);
1041 if ( Length >= len)
1043 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
1044 else memcpy( SystemInformation, &shi, len);
1046 else ret = STATUS_INFO_LENGTH_MISMATCH;
1047 FIXME("info_class SYSTEM_HANDLE_INFORMATION\n");
1049 break;
1050 case SystemCacheInformation:
1052 SYSTEM_CACHE_INFORMATION sci;
1054 memset(&sci, 0, sizeof(sci)); /* FIXME */
1055 len = sizeof(sci);
1057 if ( Length >= len)
1059 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
1060 else memcpy( SystemInformation, &sci, len);
1062 else ret = STATUS_INFO_LENGTH_MISMATCH;
1063 FIXME("info_class SYSTEM_CACHE_INFORMATION\n");
1065 break;
1066 case SystemInterruptInformation:
1068 SYSTEM_INTERRUPT_INFORMATION sii;
1070 memset(&sii, 0, sizeof(sii));
1071 len = sizeof(sii);
1073 if ( Length >= len)
1075 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
1076 else memcpy( SystemInformation, &sii, len);
1078 else ret = STATUS_INFO_LENGTH_MISMATCH;
1079 FIXME("info_class SYSTEM_INTERRUPT_INFORMATION\n");
1081 break;
1082 case SystemKernelDebuggerInformation:
1084 SYSTEM_KERNEL_DEBUGGER_INFORMATION skdi;
1086 skdi.DebuggerEnabled = FALSE;
1087 skdi.DebuggerNotPresent = TRUE;
1088 len = sizeof(skdi);
1090 if ( Length >= len)
1092 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
1093 else memcpy( SystemInformation, &skdi, len);
1095 else ret = STATUS_INFO_LENGTH_MISMATCH;
1097 break;
1098 case SystemRegistryQuotaInformation:
1100 /* Something to do with the size of the registry *
1101 * Since we don't have a size limitation, fake it *
1102 * This is almost certainly wrong. *
1103 * This sets each of the three words in the struct to 32 MB, *
1104 * which is enough to make the IE 5 installer happy. */
1105 SYSTEM_REGISTRY_QUOTA_INFORMATION srqi;
1107 srqi.RegistryQuotaAllowed = 0x2000000;
1108 srqi.RegistryQuotaUsed = 0x200000;
1109 srqi.Reserved1 = (void*)0x200000;
1110 len = sizeof(srqi);
1112 if ( Length >= len)
1114 if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
1115 else
1117 FIXME("SystemRegistryQuotaInformation: faking max registry size of 32 MB\n");
1118 memcpy( SystemInformation, &srqi, len);
1121 else ret = STATUS_INFO_LENGTH_MISMATCH;
1123 break;
1124 default:
1125 FIXME("(0x%08x,%p,0x%08x,%p) stub\n",
1126 SystemInformationClass,SystemInformation,Length,ResultLength);
1128 /* Several Information Classes are not implemented on Windows and return 2 different values
1129 * STATUS_NOT_IMPLEMENTED or STATUS_INVALID_INFO_CLASS
1130 * in 95% of the cases it's STATUS_INVALID_INFO_CLASS, so use this as the default
1132 ret = STATUS_INVALID_INFO_CLASS;
1135 if (ResultLength) *ResultLength = len;
1137 return ret;
1140 /******************************************************************************
1141 * NtSetSystemInformation [NTDLL.@]
1142 * ZwSetSystemInformation [NTDLL.@]
1144 NTSTATUS WINAPI NtSetSystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass, PVOID SystemInformation, ULONG Length)
1146 FIXME("(0x%08x,%p,0x%08x) stub\n",SystemInformationClass,SystemInformation,Length);
1147 return STATUS_SUCCESS;
1150 /******************************************************************************
1151 * NtCreatePagingFile [NTDLL.@]
1152 * ZwCreatePagingFile [NTDLL.@]
1154 NTSTATUS WINAPI NtCreatePagingFile(
1155 PUNICODE_STRING PageFileName,
1156 PLARGE_INTEGER MinimumSize,
1157 PLARGE_INTEGER MaximumSize,
1158 PLARGE_INTEGER ActualSize)
1160 FIXME("(%p %p %p %p) stub\n", PageFileName, MinimumSize, MaximumSize, ActualSize);
1161 return STATUS_SUCCESS;
1164 /******************************************************************************
1165 * NtDisplayString [NTDLL.@]
1167 * writes a string to the nt-textmode screen eg. during startup
1169 NTSTATUS WINAPI NtDisplayString ( PUNICODE_STRING string )
1171 STRING stringA;
1172 NTSTATUS ret;
1174 if (!(ret = RtlUnicodeStringToAnsiString( &stringA, string, TRUE )))
1176 MESSAGE( "%.*s", stringA.Length, stringA.Buffer );
1177 RtlFreeAnsiString( &stringA );
1179 return ret;
1182 /******************************************************************************
1183 * NtInitiatePowerAction [NTDLL.@]
1186 NTSTATUS WINAPI NtInitiatePowerAction(
1187 IN POWER_ACTION SystemAction,
1188 IN SYSTEM_POWER_STATE MinSystemState,
1189 IN ULONG Flags,
1190 IN BOOLEAN Asynchronous)
1192 FIXME("(%d,%d,0x%08x,%d),stub\n",
1193 SystemAction,MinSystemState,Flags,Asynchronous);
1194 return STATUS_NOT_IMPLEMENTED;
1198 /******************************************************************************
1199 * NtPowerInformation [NTDLL.@]
1202 NTSTATUS WINAPI NtPowerInformation(
1203 IN POWER_INFORMATION_LEVEL InformationLevel,
1204 IN PVOID lpInputBuffer,
1205 IN ULONG nInputBufferSize,
1206 IN PVOID lpOutputBuffer,
1207 IN ULONG nOutputBufferSize)
1209 TRACE("(%d,%p,%d,%p,%d)\n",
1210 InformationLevel,lpInputBuffer,nInputBufferSize,lpOutputBuffer,nOutputBufferSize);
1211 switch(InformationLevel) {
1212 case SystemPowerCapabilities: {
1213 PSYSTEM_POWER_CAPABILITIES PowerCaps = (PSYSTEM_POWER_CAPABILITIES)lpOutputBuffer;
1214 FIXME("semi-stub: SystemPowerCapabilities\n");
1215 if (nOutputBufferSize < sizeof(SYSTEM_POWER_CAPABILITIES))
1216 return STATUS_BUFFER_TOO_SMALL;
1217 /* FIXME: These values are based off a native XP desktop, should probably use APM/ACPI to get the 'real' values */
1218 PowerCaps->PowerButtonPresent = TRUE;
1219 PowerCaps->SleepButtonPresent = FALSE;
1220 PowerCaps->LidPresent = FALSE;
1221 PowerCaps->SystemS1 = TRUE;
1222 PowerCaps->SystemS2 = FALSE;
1223 PowerCaps->SystemS3 = FALSE;
1224 PowerCaps->SystemS4 = TRUE;
1225 PowerCaps->SystemS5 = TRUE;
1226 PowerCaps->HiberFilePresent = TRUE;
1227 PowerCaps->FullWake = TRUE;
1228 PowerCaps->VideoDimPresent = FALSE;
1229 PowerCaps->ApmPresent = FALSE;
1230 PowerCaps->UpsPresent = FALSE;
1231 PowerCaps->ThermalControl = FALSE;
1232 PowerCaps->ProcessorThrottle = FALSE;
1233 PowerCaps->ProcessorMinThrottle = 100;
1234 PowerCaps->ProcessorMaxThrottle = 100;
1235 PowerCaps->DiskSpinDown = TRUE;
1236 PowerCaps->SystemBatteriesPresent = FALSE;
1237 PowerCaps->BatteriesAreShortTerm = FALSE;
1238 PowerCaps->BatteryScale[0].Granularity = 0;
1239 PowerCaps->BatteryScale[0].Capacity = 0;
1240 PowerCaps->BatteryScale[1].Granularity = 0;
1241 PowerCaps->BatteryScale[1].Capacity = 0;
1242 PowerCaps->BatteryScale[2].Granularity = 0;
1243 PowerCaps->BatteryScale[2].Capacity = 0;
1244 PowerCaps->AcOnLineWake = PowerSystemUnspecified;
1245 PowerCaps->SoftLidWake = PowerSystemUnspecified;
1246 PowerCaps->RtcWake = PowerSystemSleeping1;
1247 PowerCaps->MinDeviceWakeState = PowerSystemUnspecified;
1248 PowerCaps->DefaultLowLatencyWake = PowerSystemUnspecified;
1249 return STATUS_SUCCESS;
1251 default:
1252 FIXME("Unimplemented NtPowerInformation action: %d\n", InformationLevel);
1253 return STATUS_NOT_IMPLEMENTED;
1257 /******************************************************************************
1258 * NtShutdownSystem [NTDLL.@]
1261 NTSTATUS WINAPI NtShutdownSystem(SHUTDOWN_ACTION Action)
1263 FIXME("%d\n",Action);
1264 return STATUS_SUCCESS;
1267 /******************************************************************************
1268 * NtAllocateLocallyUniqueId (NTDLL.@)
1270 NTSTATUS WINAPI NtAllocateLocallyUniqueId(PLUID Luid)
1272 NTSTATUS status;
1274 TRACE("%p\n", Luid);
1276 if (!Luid)
1277 return STATUS_ACCESS_VIOLATION;
1279 SERVER_START_REQ( allocate_locally_unique_id )
1281 status = wine_server_call( req );
1282 if (!status)
1284 Luid->LowPart = reply->luid.low_part;
1285 Luid->HighPart = reply->luid.high_part;
1288 SERVER_END_REQ;
1290 return status;
1293 /******************************************************************************
1294 * VerSetConditionMask (NTDLL.@)
1296 ULONGLONG WINAPI VerSetConditionMask( ULONGLONG dwlConditionMask, DWORD dwTypeBitMask,
1297 BYTE dwConditionMask)
1299 if(dwTypeBitMask == 0)
1300 return dwlConditionMask;
1301 dwConditionMask &= 0x07;
1302 if(dwConditionMask == 0)
1303 return dwlConditionMask;
1305 if(dwTypeBitMask & VER_PRODUCT_TYPE)
1306 dwlConditionMask |= dwConditionMask << 7*3;
1307 else if (dwTypeBitMask & VER_SUITENAME)
1308 dwlConditionMask |= dwConditionMask << 6*3;
1309 else if (dwTypeBitMask & VER_SERVICEPACKMAJOR)
1310 dwlConditionMask |= dwConditionMask << 5*3;
1311 else if (dwTypeBitMask & VER_SERVICEPACKMINOR)
1312 dwlConditionMask |= dwConditionMask << 4*3;
1313 else if (dwTypeBitMask & VER_PLATFORMID)
1314 dwlConditionMask |= dwConditionMask << 3*3;
1315 else if (dwTypeBitMask & VER_BUILDNUMBER)
1316 dwlConditionMask |= dwConditionMask << 2*3;
1317 else if (dwTypeBitMask & VER_MAJORVERSION)
1318 dwlConditionMask |= dwConditionMask << 1*3;
1319 else if (dwTypeBitMask & VER_MINORVERSION)
1320 dwlConditionMask |= dwConditionMask << 0*3;
1321 return dwlConditionMask;
1324 /******************************************************************************
1325 * NtAccessCheckAndAuditAlarm (NTDLL.@)
1326 * ZwAccessCheckAndAuditAlarm (NTDLL.@)
1328 NTSTATUS WINAPI NtAccessCheckAndAuditAlarm(PUNICODE_STRING SubsystemName, HANDLE HandleId, PUNICODE_STRING ObjectTypeName,
1329 PUNICODE_STRING ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor,
1330 ACCESS_MASK DesiredAccess, PGENERIC_MAPPING GenericMapping, BOOLEAN ObjectCreation,
1331 PACCESS_MASK GrantedAccess, PBOOLEAN AccessStatus, PBOOLEAN GenerateOnClose)
1333 FIXME("(%s, %p, %s, %p, 0x%08x, %p, %d, %p, %p, %p), stub\n", debugstr_us(SubsystemName), HandleId,
1334 debugstr_us(ObjectTypeName), SecurityDescriptor, DesiredAccess, GenericMapping, ObjectCreation,
1335 GrantedAccess, AccessStatus, GenerateOnClose);
1337 return STATUS_NOT_IMPLEMENTED;