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
25 #include "wine/port.h"
27 #ifdef HAVE_SYS_PARAM_H
28 # include <sys/param.h>
30 #ifdef HAVE_SYS_SYSCTL_H
31 # include <sys/sysctl.h>
33 #ifdef HAVE_MACHINE_CPU_H
34 # include <machine/cpu.h>
36 #ifdef HAVE_MACH_MACHINE_H
37 # include <mach/machine.h>
45 #ifdef HAVE_SYS_TIME_H
46 # include <sys/time.h>
50 #define NONAMELESSUNION
52 #define WIN32_NO_STATUS
53 #include "wine/debug.h"
54 #include "wine/unicode.h"
57 #include "ntdll_misc.h"
58 #include "wine/server.h"
62 #include <mach/mach_init.h>
63 #include <mach/mach_host.h>
64 #include <mach/vm_map.h>
67 WINE_DEFAULT_DEBUG_CHANNEL(ntdll
);
73 /******************************************************************************
74 * NtDuplicateToken [NTDLL.@]
75 * ZwDuplicateToken [NTDLL.@]
77 NTSTATUS WINAPI
NtDuplicateToken(
78 IN HANDLE ExistingToken
,
79 IN ACCESS_MASK DesiredAccess
,
80 IN POBJECT_ATTRIBUTES ObjectAttributes
,
81 IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
,
82 IN TOKEN_TYPE TokenType
,
87 TRACE("(%p,0x%08x,%s,0x%08x,0x%08x,%p)\n",
88 ExistingToken
, DesiredAccess
, debugstr_ObjectAttributes(ObjectAttributes
),
89 ImpersonationLevel
, TokenType
, NewToken
);
91 if (ObjectAttributes
&& ObjectAttributes
->SecurityQualityOfService
)
93 SECURITY_QUALITY_OF_SERVICE
*SecurityQOS
= ObjectAttributes
->SecurityQualityOfService
;
94 TRACE("ObjectAttributes->SecurityQualityOfService = {%d, %d, %d, %s}\n",
95 SecurityQOS
->Length
, SecurityQOS
->ImpersonationLevel
,
96 SecurityQOS
->ContextTrackingMode
,
97 SecurityQOS
->EffectiveOnly
? "TRUE" : "FALSE");
98 ImpersonationLevel
= SecurityQOS
->ImpersonationLevel
;
101 SERVER_START_REQ( duplicate_token
)
103 req
->handle
= wine_server_obj_handle( ExistingToken
);
104 req
->access
= DesiredAccess
;
105 req
->attributes
= ObjectAttributes
? ObjectAttributes
->Attributes
: 0;
106 req
->primary
= (TokenType
== TokenPrimary
);
107 req
->impersonation_level
= ImpersonationLevel
;
108 status
= wine_server_call( req
);
109 if (!status
) *NewToken
= wine_server_ptr_handle( reply
->new_handle
);
116 /******************************************************************************
117 * NtOpenProcessToken [NTDLL.@]
118 * ZwOpenProcessToken [NTDLL.@]
120 NTSTATUS WINAPI
NtOpenProcessToken(
121 HANDLE ProcessHandle
,
125 return NtOpenProcessTokenEx( ProcessHandle
, DesiredAccess
, 0, TokenHandle
);
128 /******************************************************************************
129 * NtOpenProcessTokenEx [NTDLL.@]
130 * ZwOpenProcessTokenEx [NTDLL.@]
132 NTSTATUS WINAPI
NtOpenProcessTokenEx( HANDLE process
, DWORD access
, DWORD attributes
,
137 TRACE("(%p,0x%08x,0x%08x,%p)\n", process
, access
, attributes
, handle
);
139 SERVER_START_REQ( open_token
)
141 req
->handle
= wine_server_obj_handle( process
);
142 req
->access
= access
;
143 req
->attributes
= attributes
;
145 ret
= wine_server_call( req
);
146 if (!ret
) *handle
= wine_server_ptr_handle( reply
->token
);
152 /******************************************************************************
153 * NtOpenThreadToken [NTDLL.@]
154 * ZwOpenThreadToken [NTDLL.@]
156 NTSTATUS WINAPI
NtOpenThreadToken(
162 return NtOpenThreadTokenEx( ThreadHandle
, DesiredAccess
, OpenAsSelf
, 0, TokenHandle
);
165 /******************************************************************************
166 * NtOpenThreadTokenEx [NTDLL.@]
167 * ZwOpenThreadTokenEx [NTDLL.@]
169 NTSTATUS WINAPI
NtOpenThreadTokenEx( HANDLE thread
, DWORD access
, BOOLEAN as_self
, DWORD attributes
,
174 TRACE("(%p,0x%08x,%u,0x%08x,%p)\n", thread
, access
, as_self
, attributes
, handle
);
176 SERVER_START_REQ( open_token
)
178 req
->handle
= wine_server_obj_handle( thread
);
179 req
->access
= access
;
180 req
->attributes
= attributes
;
181 req
->flags
= OPEN_TOKEN_THREAD
;
182 if (as_self
) req
->flags
|= OPEN_TOKEN_AS_SELF
;
183 ret
= wine_server_call( req
);
184 if (!ret
) *handle
= wine_server_ptr_handle( reply
->token
);
191 /******************************************************************************
192 * NtAdjustPrivilegesToken [NTDLL.@]
193 * ZwAdjustPrivilegesToken [NTDLL.@]
195 * FIXME: parameters unsafe
197 NTSTATUS WINAPI
NtAdjustPrivilegesToken(
198 IN HANDLE TokenHandle
,
199 IN BOOLEAN DisableAllPrivileges
,
200 IN PTOKEN_PRIVILEGES NewState
,
201 IN DWORD BufferLength
,
202 OUT PTOKEN_PRIVILEGES PreviousState
,
203 OUT PDWORD ReturnLength
)
207 TRACE("(%p,0x%08x,%p,0x%08x,%p,%p)\n",
208 TokenHandle
, DisableAllPrivileges
, NewState
, BufferLength
, PreviousState
, ReturnLength
);
210 SERVER_START_REQ( adjust_token_privileges
)
212 req
->handle
= wine_server_obj_handle( TokenHandle
);
213 req
->disable_all
= DisableAllPrivileges
;
214 req
->get_modified_state
= (PreviousState
!= NULL
);
215 if (!DisableAllPrivileges
)
217 wine_server_add_data( req
, NewState
->Privileges
,
218 NewState
->PrivilegeCount
* sizeof(NewState
->Privileges
[0]) );
220 if (PreviousState
&& BufferLength
>= FIELD_OFFSET( TOKEN_PRIVILEGES
, Privileges
))
221 wine_server_set_reply( req
, PreviousState
->Privileges
,
222 BufferLength
- FIELD_OFFSET( TOKEN_PRIVILEGES
, Privileges
) );
223 ret
= wine_server_call( req
);
226 *ReturnLength
= reply
->len
+ FIELD_OFFSET( TOKEN_PRIVILEGES
, Privileges
);
227 PreviousState
->PrivilegeCount
= reply
->len
/ sizeof(LUID_AND_ATTRIBUTES
);
235 /******************************************************************************
236 * NtQueryInformationToken [NTDLL.@]
237 * ZwQueryInformationToken [NTDLL.@]
240 * Buffer for TokenUser:
241 * 0x00 TOKEN_USER the PSID field points to the SID
245 NTSTATUS WINAPI
NtQueryInformationToken(
247 TOKEN_INFORMATION_CLASS tokeninfoclass
,
249 ULONG tokeninfolength
,
252 static const ULONG info_len
[] =
257 0, /* TokenPrivileges */
259 0, /* TokenPrimaryGroup */
260 0, /* TokenDefaultDacl */
261 sizeof(TOKEN_SOURCE
), /* TokenSource */
262 sizeof(TOKEN_TYPE
), /* TokenType */
263 sizeof(SECURITY_IMPERSONATION_LEVEL
), /* TokenImpersonationLevel */
264 sizeof(TOKEN_STATISTICS
), /* TokenStatistics */
265 0, /* TokenRestrictedSids */
266 sizeof(DWORD
), /* TokenSessionId */
267 0, /* TokenGroupsAndPrivileges */
268 0, /* TokenSessionReference */
269 0, /* TokenSandBoxInert */
270 0, /* TokenAuditPolicy */
272 sizeof(TOKEN_ELEVATION_TYPE
), /* TokenElevationType */
273 0, /* TokenLinkedToken */
274 sizeof(TOKEN_ELEVATION
), /* TokenElevation */
275 0, /* TokenHasRestrictions */
276 0, /* TokenAccessInformation */
277 0, /* TokenVirtualizationAllowed */
278 0, /* TokenVirtualizationEnabled */
279 0, /* TokenIntegrityLevel */
280 0, /* TokenUIAccess */
281 0, /* TokenMandatoryPolicy */
282 0 /* TokenLogonSid */
286 NTSTATUS status
= STATUS_SUCCESS
;
288 TRACE("(%p,%d,%p,%d,%p)\n",
289 token
,tokeninfoclass
,tokeninfo
,tokeninfolength
,retlen
);
291 if (tokeninfoclass
< MaxTokenInfoClass
)
292 len
= info_len
[tokeninfoclass
];
294 if (retlen
) *retlen
= len
;
296 if (tokeninfolength
< len
)
297 return STATUS_BUFFER_TOO_SMALL
;
299 switch (tokeninfoclass
)
302 SERVER_START_REQ( get_token_sid
)
304 TOKEN_USER
* tuser
= tokeninfo
;
305 PSID sid
= tuser
+ 1;
306 DWORD sid_len
= tokeninfolength
< sizeof(TOKEN_USER
) ? 0 : tokeninfolength
- sizeof(TOKEN_USER
);
308 req
->handle
= wine_server_obj_handle( token
);
309 req
->which_sid
= tokeninfoclass
;
310 wine_server_set_reply( req
, sid
, sid_len
);
311 status
= wine_server_call( req
);
312 if (retlen
) *retlen
= reply
->sid_len
+ sizeof(TOKEN_USER
);
313 if (status
== STATUS_SUCCESS
)
315 tuser
->User
.Sid
= sid
;
316 tuser
->User
.Attributes
= 0;
325 /* reply buffer is always shorter than output one */
326 buffer
= tokeninfolength
? RtlAllocateHeap(GetProcessHeap(), 0, tokeninfolength
) : NULL
;
328 SERVER_START_REQ( get_token_groups
)
330 TOKEN_GROUPS
*groups
= tokeninfo
;
332 req
->handle
= wine_server_obj_handle( token
);
333 wine_server_set_reply( req
, buffer
, tokeninfolength
);
334 status
= wine_server_call( req
);
335 if (status
== STATUS_BUFFER_TOO_SMALL
)
337 if (retlen
) *retlen
= reply
->user_len
;
339 else if (status
== STATUS_SUCCESS
)
341 struct token_groups
*tg
= buffer
;
342 unsigned int *attr
= (unsigned int *)(tg
+ 1);
344 const int non_sid_portion
= (sizeof(struct token_groups
) + tg
->count
* sizeof(unsigned int));
345 SID
*sids
= (SID
*)((char *)tokeninfo
+ FIELD_OFFSET( TOKEN_GROUPS
, Groups
[tg
->count
] ));
347 if (retlen
) *retlen
= reply
->user_len
;
349 groups
->GroupCount
= tg
->count
;
350 memcpy( sids
, (char *)buffer
+ non_sid_portion
,
351 reply
->user_len
- FIELD_OFFSET( TOKEN_GROUPS
, Groups
[tg
->count
] ));
353 for (i
= 0; i
< tg
->count
; i
++)
355 groups
->Groups
[i
].Attributes
= attr
[i
];
356 groups
->Groups
[i
].Sid
= sids
;
357 sids
= (SID
*)((char *)sids
+ RtlLengthSid(sids
));
360 else if (retlen
) *retlen
= 0;
364 RtlFreeHeap(GetProcessHeap(), 0, buffer
);
367 case TokenPrimaryGroup
:
368 SERVER_START_REQ( get_token_sid
)
370 TOKEN_PRIMARY_GROUP
*tgroup
= tokeninfo
;
371 PSID sid
= tgroup
+ 1;
372 DWORD sid_len
= tokeninfolength
< sizeof(TOKEN_PRIMARY_GROUP
) ? 0 : tokeninfolength
- sizeof(TOKEN_PRIMARY_GROUP
);
374 req
->handle
= wine_server_obj_handle( token
);
375 req
->which_sid
= tokeninfoclass
;
376 wine_server_set_reply( req
, sid
, sid_len
);
377 status
= wine_server_call( req
);
378 if (retlen
) *retlen
= reply
->sid_len
+ sizeof(TOKEN_PRIMARY_GROUP
);
379 if (status
== STATUS_SUCCESS
)
380 tgroup
->PrimaryGroup
= sid
;
384 case TokenPrivileges
:
385 SERVER_START_REQ( get_token_privileges
)
387 TOKEN_PRIVILEGES
*tpriv
= tokeninfo
;
388 req
->handle
= wine_server_obj_handle( token
);
389 if (tpriv
&& tokeninfolength
> FIELD_OFFSET( TOKEN_PRIVILEGES
, Privileges
))
390 wine_server_set_reply( req
, tpriv
->Privileges
, tokeninfolength
- FIELD_OFFSET( TOKEN_PRIVILEGES
, Privileges
) );
391 status
= wine_server_call( req
);
392 if (retlen
) *retlen
= FIELD_OFFSET( TOKEN_PRIVILEGES
, Privileges
) + reply
->len
;
393 if (tpriv
) tpriv
->PrivilegeCount
= reply
->len
/ sizeof(LUID_AND_ATTRIBUTES
);
398 SERVER_START_REQ( get_token_sid
)
400 TOKEN_OWNER
*towner
= tokeninfo
;
401 PSID sid
= towner
+ 1;
402 DWORD sid_len
= tokeninfolength
< sizeof(TOKEN_OWNER
) ? 0 : tokeninfolength
- sizeof(TOKEN_OWNER
);
404 req
->handle
= wine_server_obj_handle( token
);
405 req
->which_sid
= tokeninfoclass
;
406 wine_server_set_reply( req
, sid
, sid_len
);
407 status
= wine_server_call( req
);
408 if (retlen
) *retlen
= reply
->sid_len
+ sizeof(TOKEN_OWNER
);
409 if (status
== STATUS_SUCCESS
)
414 case TokenImpersonationLevel
:
415 SERVER_START_REQ( get_token_impersonation_level
)
417 SECURITY_IMPERSONATION_LEVEL
*impersonation_level
= tokeninfo
;
418 req
->handle
= wine_server_obj_handle( token
);
419 status
= wine_server_call( req
);
420 if (status
== STATUS_SUCCESS
)
421 *impersonation_level
= reply
->impersonation_level
;
425 case TokenStatistics
:
426 SERVER_START_REQ( get_token_statistics
)
428 TOKEN_STATISTICS
*statistics
= tokeninfo
;
429 req
->handle
= wine_server_obj_handle( token
);
430 status
= wine_server_call( req
);
431 if (status
== STATUS_SUCCESS
)
433 statistics
->TokenId
.LowPart
= reply
->token_id
.low_part
;
434 statistics
->TokenId
.HighPart
= reply
->token_id
.high_part
;
435 statistics
->AuthenticationId
.LowPart
= 0; /* FIXME */
436 statistics
->AuthenticationId
.HighPart
= 0; /* FIXME */
437 statistics
->ExpirationTime
.u
.HighPart
= 0x7fffffff;
438 statistics
->ExpirationTime
.u
.LowPart
= 0xffffffff;
439 statistics
->TokenType
= reply
->primary
? TokenPrimary
: TokenImpersonation
;
440 statistics
->ImpersonationLevel
= reply
->impersonation_level
;
442 /* kernel information not relevant to us */
443 statistics
->DynamicCharged
= 0;
444 statistics
->DynamicAvailable
= 0;
446 statistics
->GroupCount
= reply
->group_count
;
447 statistics
->PrivilegeCount
= reply
->privilege_count
;
448 statistics
->ModifiedId
.LowPart
= reply
->modified_id
.low_part
;
449 statistics
->ModifiedId
.HighPart
= reply
->modified_id
.high_part
;
455 SERVER_START_REQ( get_token_statistics
)
457 TOKEN_TYPE
*token_type
= tokeninfo
;
458 req
->handle
= wine_server_obj_handle( token
);
459 status
= wine_server_call( req
);
460 if (status
== STATUS_SUCCESS
)
461 *token_type
= reply
->primary
? TokenPrimary
: TokenImpersonation
;
465 case TokenDefaultDacl
:
466 SERVER_START_REQ( get_token_default_dacl
)
468 TOKEN_DEFAULT_DACL
*default_dacl
= tokeninfo
;
469 ACL
*acl
= (ACL
*)(default_dacl
+ 1);
472 if (tokeninfolength
< sizeof(TOKEN_DEFAULT_DACL
)) acl_len
= 0;
473 else acl_len
= tokeninfolength
- sizeof(TOKEN_DEFAULT_DACL
);
475 req
->handle
= wine_server_obj_handle( token
);
476 wine_server_set_reply( req
, acl
, acl_len
);
477 status
= wine_server_call( req
);
479 if (retlen
) *retlen
= reply
->acl_len
+ sizeof(TOKEN_DEFAULT_DACL
);
480 if (status
== STATUS_SUCCESS
)
483 default_dacl
->DefaultDacl
= acl
;
485 default_dacl
->DefaultDacl
= NULL
;
490 case TokenElevationType
:
492 TOKEN_ELEVATION_TYPE
*elevation_type
= tokeninfo
;
493 FIXME("QueryInformationToken( ..., TokenElevationType, ...) semi-stub\n");
494 *elevation_type
= TokenElevationTypeFull
;
499 TOKEN_ELEVATION
*elevation
= tokeninfo
;
500 FIXME("QueryInformationToken( ..., TokenElevation, ...) semi-stub\n");
501 elevation
->TokenIsElevated
= TRUE
;
506 *((DWORD
*)tokeninfo
) = 0;
507 FIXME("QueryInformationToken( ..., TokenSessionId, ...) semi-stub\n");
512 ERR("Unhandled Token Information class %d!\n", tokeninfoclass
);
513 return STATUS_NOT_IMPLEMENTED
;
519 /******************************************************************************
520 * NtSetInformationToken [NTDLL.@]
521 * ZwSetInformationToken [NTDLL.@]
523 NTSTATUS WINAPI
NtSetInformationToken(
525 TOKEN_INFORMATION_CLASS TokenInformationClass
,
526 PVOID TokenInformation
,
527 ULONG TokenInformationLength
)
529 NTSTATUS ret
= STATUS_NOT_IMPLEMENTED
;
531 TRACE("%p %d %p %u\n", TokenHandle
, TokenInformationClass
,
532 TokenInformation
, TokenInformationLength
);
534 switch (TokenInformationClass
)
536 case TokenDefaultDacl
:
537 if (TokenInformationLength
< sizeof(TOKEN_DEFAULT_DACL
))
539 ret
= STATUS_INFO_LENGTH_MISMATCH
;
542 if (!TokenInformation
)
544 ret
= STATUS_ACCESS_VIOLATION
;
547 SERVER_START_REQ( set_token_default_dacl
)
549 ACL
*acl
= ((TOKEN_DEFAULT_DACL
*)TokenInformation
)->DefaultDacl
;
552 if (acl
) size
= acl
->AclSize
;
555 req
->handle
= wine_server_obj_handle( TokenHandle
);
556 wine_server_add_data( req
, acl
, size
);
557 ret
= wine_server_call( req
);
562 FIXME("unimplemented class %u\n", TokenInformationClass
);
569 /******************************************************************************
570 * NtAdjustGroupsToken [NTDLL.@]
571 * ZwAdjustGroupsToken [NTDLL.@]
573 NTSTATUS WINAPI
NtAdjustGroupsToken(
575 BOOLEAN ResetToDefault
,
576 PTOKEN_GROUPS NewState
,
578 PTOKEN_GROUPS PreviousState
,
581 FIXME("%p %d %p %u %p %p\n", TokenHandle
, ResetToDefault
,
582 NewState
, BufferLength
, PreviousState
, ReturnLength
);
583 return STATUS_NOT_IMPLEMENTED
;
586 /******************************************************************************
587 * NtPrivilegeCheck [NTDLL.@]
588 * ZwPrivilegeCheck [NTDLL.@]
590 NTSTATUS WINAPI
NtPrivilegeCheck(
592 PPRIVILEGE_SET RequiredPrivileges
,
596 SERVER_START_REQ( check_token_privileges
)
598 req
->handle
= wine_server_obj_handle( ClientToken
);
599 req
->all_required
= ((RequiredPrivileges
->Control
& PRIVILEGE_SET_ALL_NECESSARY
) ? TRUE
: FALSE
);
600 wine_server_add_data( req
, RequiredPrivileges
->Privilege
,
601 RequiredPrivileges
->PrivilegeCount
* sizeof(RequiredPrivileges
->Privilege
[0]) );
602 wine_server_set_reply( req
, RequiredPrivileges
->Privilege
,
603 RequiredPrivileges
->PrivilegeCount
* sizeof(RequiredPrivileges
->Privilege
[0]) );
605 status
= wine_server_call( req
);
607 if (status
== STATUS_SUCCESS
)
608 *Result
= (reply
->has_privileges
? TRUE
: FALSE
);
618 /******************************************************************************
619 * NtQuerySection [NTDLL.@]
621 NTSTATUS WINAPI
NtQuerySection(
622 IN HANDLE SectionHandle
,
623 IN SECTION_INFORMATION_CLASS SectionInformationClass
,
624 OUT PVOID SectionInformation
,
626 OUT PULONG ResultLength
)
628 FIXME("(%p,%d,%p,0x%08x,%p) stub!\n",
629 SectionHandle
,SectionInformationClass
,SectionInformation
,Length
,ResultLength
);
637 /******************************************************************************
638 * NtCreatePort [NTDLL.@]
639 * ZwCreatePort [NTDLL.@]
641 NTSTATUS WINAPI
NtCreatePort(PHANDLE PortHandle
,POBJECT_ATTRIBUTES ObjectAttributes
,
642 ULONG MaxConnectInfoLength
,ULONG MaxDataLength
,PULONG reserved
)
644 FIXME("(%p,%p,%u,%u,%p),stub!\n",PortHandle
,ObjectAttributes
,
645 MaxConnectInfoLength
,MaxDataLength
,reserved
);
646 return STATUS_NOT_IMPLEMENTED
;
649 /******************************************************************************
650 * NtConnectPort [NTDLL.@]
651 * ZwConnectPort [NTDLL.@]
653 NTSTATUS WINAPI
NtConnectPort(
655 PUNICODE_STRING PortName
,
656 PSECURITY_QUALITY_OF_SERVICE SecurityQos
,
657 PLPC_SECTION_WRITE WriteSection
,
658 PLPC_SECTION_READ ReadSection
,
659 PULONG MaximumMessageLength
,
661 PULONG pConnectInfoLength
)
663 FIXME("(%p,%s,%p,%p,%p,%p,%p,%p),stub!\n",
664 PortHandle
,debugstr_w(PortName
->Buffer
),SecurityQos
,
665 WriteSection
,ReadSection
,MaximumMessageLength
,ConnectInfo
,
667 if (ConnectInfo
&& pConnectInfoLength
)
668 TRACE("\tMessage = %s\n",debugstr_an(ConnectInfo
,*pConnectInfoLength
));
669 return STATUS_NOT_IMPLEMENTED
;
672 /******************************************************************************
673 * NtSecureConnectPort (NTDLL.@)
674 * ZwSecureConnectPort (NTDLL.@)
676 NTSTATUS WINAPI
NtSecureConnectPort(
678 PUNICODE_STRING PortName
,
679 PSECURITY_QUALITY_OF_SERVICE SecurityQos
,
680 PLPC_SECTION_WRITE WriteSection
,
682 PLPC_SECTION_READ ReadSection
,
683 PULONG MaximumMessageLength
,
685 PULONG pConnectInfoLength
)
687 FIXME("(%p,%s,%p,%p,%p,%p,%p,%p,%p),stub!\n",
688 PortHandle
,debugstr_w(PortName
->Buffer
),SecurityQos
,
689 WriteSection
,pSid
,ReadSection
,MaximumMessageLength
,ConnectInfo
,
691 return STATUS_NOT_IMPLEMENTED
;
694 /******************************************************************************
695 * NtListenPort [NTDLL.@]
696 * ZwListenPort [NTDLL.@]
698 NTSTATUS WINAPI
NtListenPort(HANDLE PortHandle
,PLPC_MESSAGE pLpcMessage
)
700 FIXME("(%p,%p),stub!\n",PortHandle
,pLpcMessage
);
701 return STATUS_NOT_IMPLEMENTED
;
704 /******************************************************************************
705 * NtAcceptConnectPort [NTDLL.@]
706 * ZwAcceptConnectPort [NTDLL.@]
708 NTSTATUS WINAPI
NtAcceptConnectPort(
710 ULONG PortIdentifier
,
711 PLPC_MESSAGE pLpcMessage
,
713 PLPC_SECTION_WRITE WriteSection
,
714 PLPC_SECTION_READ ReadSection
)
716 FIXME("(%p,%u,%p,%d,%p,%p),stub!\n",
717 PortHandle
,PortIdentifier
,pLpcMessage
,Accept
,WriteSection
,ReadSection
);
718 return STATUS_NOT_IMPLEMENTED
;
721 /******************************************************************************
722 * NtCompleteConnectPort [NTDLL.@]
723 * ZwCompleteConnectPort [NTDLL.@]
725 NTSTATUS WINAPI
NtCompleteConnectPort(HANDLE PortHandle
)
727 FIXME("(%p),stub!\n",PortHandle
);
728 return STATUS_NOT_IMPLEMENTED
;
731 /******************************************************************************
732 * NtRegisterThreadTerminatePort [NTDLL.@]
733 * ZwRegisterThreadTerminatePort [NTDLL.@]
735 NTSTATUS WINAPI
NtRegisterThreadTerminatePort(HANDLE PortHandle
)
737 FIXME("(%p),stub!\n",PortHandle
);
738 return STATUS_NOT_IMPLEMENTED
;
741 /******************************************************************************
742 * NtRequestWaitReplyPort [NTDLL.@]
743 * ZwRequestWaitReplyPort [NTDLL.@]
745 NTSTATUS WINAPI
NtRequestWaitReplyPort(
747 PLPC_MESSAGE pLpcMessageIn
,
748 PLPC_MESSAGE pLpcMessageOut
)
750 FIXME("(%p,%p,%p),stub!\n",PortHandle
,pLpcMessageIn
,pLpcMessageOut
);
753 TRACE("Message to send:\n");
754 TRACE("\tDataSize = %u\n",pLpcMessageIn
->DataSize
);
755 TRACE("\tMessageSize = %u\n",pLpcMessageIn
->MessageSize
);
756 TRACE("\tMessageType = %u\n",pLpcMessageIn
->MessageType
);
757 TRACE("\tVirtualRangesOffset = %u\n",pLpcMessageIn
->VirtualRangesOffset
);
758 TRACE("\tClientId.UniqueProcess = %p\n",pLpcMessageIn
->ClientId
.UniqueProcess
);
759 TRACE("\tClientId.UniqueThread = %p\n",pLpcMessageIn
->ClientId
.UniqueThread
);
760 TRACE("\tMessageId = %lu\n",pLpcMessageIn
->MessageId
);
761 TRACE("\tSectionSize = %lu\n",pLpcMessageIn
->SectionSize
);
762 TRACE("\tData = %s\n",
763 debugstr_an((const char*)pLpcMessageIn
->Data
,pLpcMessageIn
->DataSize
));
765 return STATUS_NOT_IMPLEMENTED
;
768 /******************************************************************************
769 * NtReplyWaitReceivePort [NTDLL.@]
770 * ZwReplyWaitReceivePort [NTDLL.@]
772 NTSTATUS WINAPI
NtReplyWaitReceivePort(
774 PULONG PortIdentifier
,
775 PLPC_MESSAGE ReplyMessage
,
776 PLPC_MESSAGE Message
)
778 FIXME("(%p,%p,%p,%p),stub!\n",PortHandle
,PortIdentifier
,ReplyMessage
,Message
);
779 return STATUS_NOT_IMPLEMENTED
;
786 /******************************************************************************
787 * NtSetIntervalProfile [NTDLL.@]
788 * ZwSetIntervalProfile [NTDLL.@]
790 NTSTATUS WINAPI
NtSetIntervalProfile(
792 KPROFILE_SOURCE Source
)
794 FIXME("%u,%d\n", Interval
, Source
);
795 return STATUS_SUCCESS
;
798 static SYSTEM_CPU_INFORMATION cached_sci
;
799 static ULONGLONG cpuHz
= 1000000000; /* default to a 1GHz */
801 #define AUTH 0x68747541 /* "Auth" */
802 #define ENTI 0x69746e65 /* "enti" */
803 #define CAMD 0x444d4163 /* "cAMD" */
805 /* Calls cpuid with an eax of 'ax' and returns the 16 bytes in *p
806 * We are compiled with -fPIC, so we can't clobber ebx.
808 static inline void do_cpuid(unsigned int ax
, unsigned int *p
)
811 __asm__("pushl %%ebx\n\t"
813 "movl %%ebx, %%esi\n\t"
815 : "=a" (p
[0]), "=S" (p
[1]), "=c" (p
[2]), "=d" (p
[3])
820 /* From xf86info havecpuid.c 1.11 */
821 static inline int have_cpuid(void)
835 : "=&r" (f1
), "=&r" (f2
)
836 : "ir" (0x00200000));
837 return ((f1
^f2
) & 0x00200000) != 0;
843 static inline void get_cpuinfo(SYSTEM_CPU_INFORMATION
* info
)
845 unsigned int regs
[4], regs2
[4];
847 if (!have_cpuid()) return;
849 do_cpuid(0x00000000, regs
); /* get standard cpuid level and vendor name */
850 if (regs
[0]>=0x00000001) /* Check for supported cpuid version */
852 do_cpuid(0x00000001, regs2
); /* get cpu features */
853 switch ((regs2
[0] >> 8) & 0xf) /* cpu family */
855 case 3: info
->Level
= 3; break;
856 case 4: info
->Level
= 4; break;
857 case 5: info
->Level
= 5; break;
858 case 15: /* PPro/2/3/4 has same info as P1 */
859 case 6: info
->Level
= 6; break;
861 FIXME("unknown cpu family %d, please report! (-> setting to 386)\n",
862 (regs2
[0] >> 8)&0xf);
866 user_shared_data
->ProcessorFeatures
[PF_FLOATING_POINT_EMULATED
] = !(regs2
[3] & 1);
867 user_shared_data
->ProcessorFeatures
[PF_RDTSC_INSTRUCTION_AVAILABLE
] = (regs2
[3] & (1 << 4 )) >> 4;
868 user_shared_data
->ProcessorFeatures
[PF_PAE_ENABLED
] = (regs2
[3] & (1 << 6 )) >> 6;
869 user_shared_data
->ProcessorFeatures
[PF_COMPARE_EXCHANGE_DOUBLE
] = (regs2
[3] & (1 << 8 )) >> 8;
870 user_shared_data
->ProcessorFeatures
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = (regs2
[3] & (1 << 23)) >> 23;
871 user_shared_data
->ProcessorFeatures
[PF_XMMI_INSTRUCTIONS_AVAILABLE
] = (regs2
[3] & (1 << 25)) >> 25;
872 user_shared_data
->ProcessorFeatures
[PF_XMMI64_INSTRUCTIONS_AVAILABLE
] = (regs2
[3] & (1 << 26)) >> 26;
874 if (regs
[1] == AUTH
&& regs
[3] == ENTI
&& regs
[2] == CAMD
)
876 do_cpuid(0x80000000, regs
); /* get vendor cpuid level */
877 if (regs
[0] >= 0x80000001)
879 do_cpuid(0x80000001, regs2
); /* get vendor features */
880 user_shared_data
->ProcessorFeatures
[PF_3DNOW_INSTRUCTIONS_AVAILABLE
] = (regs2
[3] & (1 << 31 )) >> 31;
886 /******************************************************************
889 * inits a couple of places with CPU related information:
890 * - cached_sci & cpuHZ in this file
891 * - Peb->NumberOfProcessors
892 * - SharedUserData->ProcessFeatures[] array
894 * It creates a registry subhierarchy, looking like:
895 * "\HARDWARE\DESCRIPTION\System\CentralProcessor\<processornumber>\Identifier (CPU x86)".
896 * Note that there is a hierarchy for every processor installed, so this
897 * supports multiprocessor systems. This is done like Win95 does it, I think.
899 * It creates some registry entries in the environment part:
900 * "\HKLM\System\CurrentControlSet\Control\Session Manager\Environment". These are
901 * always present. When deleted, Windows will add them again.
903 void fill_cpu_info(void)
905 memset(&cached_sci
, 0, sizeof(cached_sci
));
906 /* choose sensible defaults ...
907 * FIXME: perhaps overridable with precompiler flags?
910 cached_sci
.Architecture
= PROCESSOR_ARCHITECTURE_INTEL
;
911 cached_sci
.Level
= 5; /* 586 */
912 #elif defined(__x86_64__)
913 cached_sci
.Architecture
= PROCESSOR_ARCHITECTURE_AMD64
;
914 #elif defined(__powerpc__)
915 cached_sci
.Architecture
= PROCESSOR_ARCHITECTURE_PPC
;
916 #elif defined(__arm__)
917 cached_sci
.Architecture
= PROCESSOR_ARCHITECTURE_ARM
;
918 #elif defined(__sparc__)
919 cached_sci
.Architecture
= PROCESSOR_ARCHITECTURE_SPARC
;
923 cached_sci
.Revision
= 0;
924 cached_sci
.Reserved
= 0;
925 cached_sci
.FeatureSet
= 0x1fff; /* FIXME: set some sensible defaults out of ProcessFeatures[] */
927 NtCurrentTeb()->Peb
->NumberOfProcessors
= 1;
929 /* Hmm, reasonable processor feature defaults? */
934 FILE *f
= fopen ("/proc/cpuinfo", "r");
938 while (fgets(line
,200,f
) != NULL
)
942 /* NOTE: the ':' is the only character we can rely on */
943 if (!(value
= strchr(line
,':')))
946 /* terminate the valuename */
948 while ((s
>= line
) && ((*s
== ' ') || (*s
== '\t'))) s
--;
951 /* and strip leading spaces from value */
953 while (*value
==' ') value
++;
954 if ((s
= strchr(value
,'\n')))
957 if (!strcasecmp(line
, "processor"))
959 /* processor number counts up... */
962 if (sscanf(value
, "%d",&x
))
963 if (x
+ 1 > NtCurrentTeb()->Peb
->NumberOfProcessors
)
964 NtCurrentTeb()->Peb
->NumberOfProcessors
= x
+ 1;
968 if (!strcasecmp(line
, "model"))
970 /* First part of Revision */
973 if (sscanf(value
, "%d",&x
))
974 cached_sci
.Revision
= cached_sci
.Revision
| (x
<< 8);
979 /* 2.1 and ARM method */
980 if (!strcasecmp(line
, "cpu family") || !strcasecmp(line
, "CPU architecture"))
982 if (isdigit(value
[0]))
984 cached_sci
.Level
= atoi(value
);
989 if (!strcasecmp(line
, "cpu"))
991 if (isdigit(value
[0]) && value
[1] == '8' && value
[2] == '6' && value
[3] == 0)
993 switch (cached_sci
.Level
= value
[0] - '0')
1001 FIXME("unknown Linux 2.0 cpu family '%s', please report ! (-> setting to 386)\n", value
);
1002 cached_sci
.Level
= 3;
1008 if (!strcasecmp(line
, "stepping"))
1010 /* Second part of Revision */
1013 if (sscanf(value
, "%d",&x
))
1014 cached_sci
.Revision
= cached_sci
.Revision
| x
;
1017 if (!strcasecmp(line
, "cpu MHz"))
1020 if (sscanf( value
, "%lf", &cmz
) == 1)
1022 /* SYSTEMINFO doesn't have a slot for cpu speed, so store in a global */
1023 cpuHz
= cmz
* 1000 * 1000;
1027 if (!strcasecmp(line
, "fdiv_bug"))
1029 if (!strncasecmp(value
, "yes",3))
1030 user_shared_data
->ProcessorFeatures
[PF_FLOATING_POINT_PRECISION_ERRATA
] = TRUE
;
1033 if (!strcasecmp(line
, "fpu"))
1035 if (!strncasecmp(value
, "no",2))
1036 user_shared_data
->ProcessorFeatures
[PF_FLOATING_POINT_EMULATED
] = TRUE
;
1039 if (!strcasecmp(line
, "flags") || !strcasecmp(line
, "features"))
1041 if (strstr(value
, "cx8"))
1042 user_shared_data
->ProcessorFeatures
[PF_COMPARE_EXCHANGE_DOUBLE
] = TRUE
;
1043 if (strstr(value
, "cx16"))
1044 user_shared_data
->ProcessorFeatures
[PF_COMPARE_EXCHANGE128
] = TRUE
;
1045 if (strstr(value
, "mmx"))
1046 user_shared_data
->ProcessorFeatures
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1047 if (strstr(value
, "nx"))
1048 user_shared_data
->ProcessorFeatures
[PF_NX_ENABLED
] = TRUE
;
1049 if (strstr(value
, "tsc"))
1050 user_shared_data
->ProcessorFeatures
[PF_RDTSC_INSTRUCTION_AVAILABLE
] = TRUE
;
1051 if (strstr(value
, "3dnow"))
1052 user_shared_data
->ProcessorFeatures
[PF_3DNOW_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1053 /* This will also catch sse2, but we have sse itself
1054 * if we have sse2, so no problem */
1055 if (strstr(value
, "sse"))
1056 user_shared_data
->ProcessorFeatures
[PF_XMMI_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1057 if (strstr(value
, "sse2"))
1058 user_shared_data
->ProcessorFeatures
[PF_XMMI64_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1059 if (strstr(value
, "pni"))
1060 user_shared_data
->ProcessorFeatures
[PF_SSE3_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1061 if (strstr(value
, "pae"))
1062 user_shared_data
->ProcessorFeatures
[PF_PAE_ENABLED
] = TRUE
;
1063 if (strstr(value
, "ht"))
1064 cached_sci
.FeatureSet
|= CPU_FEATURE_HTT
;
1070 #elif defined (__NetBSD__)
1077 FILE *f
= fopen("/var/run/dmesg.boot", "r");
1079 /* first deduce as much as possible from the sysctls */
1080 mib
[0] = CTL_MACHDEP
;
1081 #ifdef CPU_FPU_PRESENT
1082 mib
[1] = CPU_FPU_PRESENT
;
1083 val_len
= sizeof(value
);
1084 if (sysctl(mib
, 2, &value
, &val_len
, NULL
, 0) >= 0)
1085 user_shared_data
->ProcessorFeatures
[PF_FLOATING_POINT_EMULATED
] = !value
;
1088 mib
[1] = CPU_SSE
; /* this should imply MMX */
1089 val_len
= sizeof(value
);
1090 if (sysctl(mib
, 2, &value
, &val_len
, NULL
, 0) >= 0)
1091 if (value
) user_shared_data
->ProcessorFeatures
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1094 mib
[1] = CPU_SSE2
; /* this should imply MMX */
1095 val_len
= sizeof(value
);
1096 if (sysctl(mib
, 2, &value
, &val_len
, NULL
, 0) >= 0)
1097 if (value
) user_shared_data
->ProcessorFeatures
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1101 val_len
= sizeof(value
);
1102 if (sysctl(mib
, 2, &value
, &val_len
, NULL
, 0) >= 0)
1103 if (value
> NtCurrentTeb()->Peb
->NumberOfProcessors
)
1104 NtCurrentTeb()->Peb
->NumberOfProcessors
= value
;
1106 val_len
= sizeof(model
)-1;
1107 if (sysctl(mib
, 2, model
, &val_len
, NULL
, 0) >= 0)
1109 model
[val_len
] = '\0'; /* just in case */
1110 cpuclass
= strstr(model
, "-class");
1111 if (cpuclass
!= NULL
) {
1112 while(cpuclass
> model
&& cpuclass
[0] != '(') cpuclass
--;
1113 if (!strncmp(cpuclass
+1, "386", 3))
1115 cached_sci
.Level
= 3;
1117 if (!strncmp(cpuclass
+1, "486", 3))
1119 cached_sci
.Level
= 4;
1121 if (!strncmp(cpuclass
+1, "586", 3))
1123 cached_sci
.Level
= 5;
1125 if (!strncmp(cpuclass
+1, "686", 3))
1127 cached_sci
.Level
= 6;
1128 /* this should imply MMX */
1129 user_shared_data
->ProcessorFeatures
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1134 /* it may be worth reading from /var/run/dmesg.boot for
1135 additional information such as CX8, MMX and TSC
1136 (however this information should be considered less
1137 reliable than that from the sysctl calls) */
1140 while (fgets(model
, 255, f
) != NULL
)
1143 if (sscanf(model
, "cpu%d: features %x<", &cpu
, &features
) == 2)
1145 /* we could scan the string but it is easier
1146 to test the bits directly */
1148 user_shared_data
->ProcessorFeatures
[PF_FLOATING_POINT_EMULATED
] = TRUE
;
1149 if (features
& 0x10)
1150 user_shared_data
->ProcessorFeatures
[PF_RDTSC_INSTRUCTION_AVAILABLE
] = TRUE
;
1151 if (features
& 0x100)
1152 user_shared_data
->ProcessorFeatures
[PF_COMPARE_EXCHANGE_DOUBLE
] = TRUE
;
1153 if (features
& 0x800000)
1154 user_shared_data
->ProcessorFeatures
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1162 #elif defined(__FreeBSD__) || defined (__FreeBSD_kernel__)
1167 get_cpuinfo( &cached_sci
);
1169 /* Check for OS support of SSE -- Is this used, and should it be sse1 or sse2? */
1170 /*len = sizeof(num);
1171 ret = sysctlbyname("hw.instruction_sse", &num, &len, NULL, 0);
1173 user_shared_data->ProcessorFeatures[PF_XMMI_INSTRUCTIONS_AVAILABLE] = num;*/
1176 ret
= sysctlbyname("hw.ncpu", &num
, &len
, NULL
, 0);
1178 NtCurrentTeb()->Peb
->NumberOfProcessors
= num
;
1181 if (!sysctlbyname("dev.cpu.0.freq", &num
, &len
, NULL
, 0))
1182 cpuHz
= num
* 1000 * 1000;
1184 #elif defined(__sun)
1186 int num
= sysconf( _SC_NPROCESSORS_ONLN
);
1188 if (num
== -1) num
= 1;
1189 get_cpuinfo( &cached_sci
);
1190 NtCurrentTeb()->Peb
->NumberOfProcessors
= num
;
1192 #elif defined (__OpenBSD__)
1194 int mib
[2], num
, ret
;
1201 ret
= sysctl(mib
, 2, &num
, &len
, NULL
, 0);
1203 NtCurrentTeb()->Peb
->NumberOfProcessors
= num
;
1205 #elif defined (__APPLE__)
1208 unsigned long long longVal
;
1213 valSize
= sizeof(int);
1214 if (sysctlbyname ("hw.optional.floatingpoint", &value
, &valSize
, NULL
, 0) == 0)
1217 user_shared_data
->ProcessorFeatures
[PF_FLOATING_POINT_EMULATED
] = FALSE
;
1219 user_shared_data
->ProcessorFeatures
[PF_FLOATING_POINT_EMULATED
] = TRUE
;
1221 valSize
= sizeof(int);
1222 if (sysctlbyname ("hw.ncpu", &value
, &valSize
, NULL
, 0) == 0)
1223 NtCurrentTeb()->Peb
->NumberOfProcessors
= value
;
1225 /* FIXME: we don't use the "hw.activecpu" value... but the cached one */
1227 valSize
= sizeof(int);
1228 if (sysctlbyname ("hw.cputype", &cputype
, &valSize
, NULL
, 0) == 0)
1232 case CPU_TYPE_POWERPC
:
1233 cached_sci
.Architecture
= PROCESSOR_ARCHITECTURE_PPC
;
1234 valSize
= sizeof(int);
1235 if (sysctlbyname ("hw.cpusubtype", &value
, &valSize
, NULL
, 0) == 0)
1239 case CPU_SUBTYPE_POWERPC_601
:
1240 case CPU_SUBTYPE_POWERPC_602
: cached_sci
.Level
= 1; break;
1241 case CPU_SUBTYPE_POWERPC_603
: cached_sci
.Level
= 3; break;
1242 case CPU_SUBTYPE_POWERPC_603e
:
1243 case CPU_SUBTYPE_POWERPC_603ev
: cached_sci
.Level
= 6; break;
1244 case CPU_SUBTYPE_POWERPC_604
: cached_sci
.Level
= 4; break;
1245 case CPU_SUBTYPE_POWERPC_604e
: cached_sci
.Level
= 9; break;
1246 case CPU_SUBTYPE_POWERPC_620
: cached_sci
.Level
= 20; break;
1247 case CPU_SUBTYPE_POWERPC_750
: /* G3/G4 derive from 603 so ... */
1248 case CPU_SUBTYPE_POWERPC_7400
:
1249 case CPU_SUBTYPE_POWERPC_7450
: cached_sci
.Level
= 6; break;
1250 case CPU_SUBTYPE_POWERPC_970
: cached_sci
.Level
= 9;
1251 /* :o) user_shared_data->ProcessorFeatures[PF_ALTIVEC_INSTRUCTIONS_AVAILABLE] ;-) */
1256 break; /* CPU_TYPE_POWERPC */
1258 cached_sci
.Architecture
= PROCESSOR_ARCHITECTURE_INTEL
;
1259 valSize
= sizeof(int);
1260 if (sysctlbyname ("machdep.cpu.family", &value
, &valSize
, NULL
, 0) == 0)
1262 cached_sci
.Level
= value
;
1264 valSize
= sizeof(int);
1265 if (sysctlbyname ("machdep.cpu.model", &value
, &valSize
, NULL
, 0) == 0)
1266 cached_sci
.Revision
= (value
<< 8);
1267 valSize
= sizeof(int);
1268 if (sysctlbyname ("machdep.cpu.stepping", &value
, &valSize
, NULL
, 0) == 0)
1269 cached_sci
.Revision
|= value
;
1270 valSize
= sizeof(buffer
);
1271 if (sysctlbyname ("machdep.cpu.features", buffer
, &valSize
, NULL
, 0) == 0)
1273 cached_sci
.Revision
|= value
;
1274 if (strstr(buffer
, "CX8")) user_shared_data
->ProcessorFeatures
[PF_COMPARE_EXCHANGE_DOUBLE
] = TRUE
;
1275 if (strstr(buffer
, "CX16")) user_shared_data
->ProcessorFeatures
[PF_COMPARE_EXCHANGE128
] = TRUE
;
1276 if (strstr(buffer
, "MMX")) user_shared_data
->ProcessorFeatures
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1277 if (strstr(buffer
, "TSC")) user_shared_data
->ProcessorFeatures
[PF_RDTSC_INSTRUCTION_AVAILABLE
] = TRUE
;
1278 if (strstr(buffer
, "3DNOW")) user_shared_data
->ProcessorFeatures
[PF_3DNOW_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1279 if (strstr(buffer
, "SSE")) user_shared_data
->ProcessorFeatures
[PF_XMMI_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1280 if (strstr(buffer
, "SSE2")) user_shared_data
->ProcessorFeatures
[PF_XMMI64_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1281 if (strstr(buffer
, "SSE3")) user_shared_data
->ProcessorFeatures
[PF_SSE3_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1282 if (strstr(buffer
, "PAE")) user_shared_data
->ProcessorFeatures
[PF_PAE_ENABLED
] = TRUE
;
1283 if (strstr(buffer
, "HTT")) cached_sci
.FeatureSet
|= CPU_FEATURE_HTT
;
1285 break; /* CPU_TYPE_I386 */
1287 } /* switch (cputype) */
1289 valSize
= sizeof(longVal
);
1290 if (!sysctlbyname("hw.cpufrequency", &longVal
, &valSize
, NULL
, 0))
1294 FIXME("not yet supported on this system\n");
1296 TRACE("<- CPU arch %d, level %d, rev %d, features 0x%x\n",
1297 cached_sci
.Architecture
, cached_sci
.Level
, cached_sci
.Revision
, cached_sci
.FeatureSet
);
1300 /******************************************************************************
1301 * NtQuerySystemInformation [NTDLL.@]
1302 * ZwQuerySystemInformation [NTDLL.@]
1305 * SystemInformationClass Index to a certain information structure
1306 * SystemTimeAdjustmentInformation SYSTEM_TIME_ADJUSTMENT
1307 * SystemCacheInformation SYSTEM_CACHE_INFORMATION
1308 * SystemConfigurationInformation CONFIGURATION_INFORMATION
1309 * observed (class/len):
1315 * SystemInformation caller supplies storage for the information structure
1316 * Length size of the structure
1317 * ResultLength Data written
1319 NTSTATUS WINAPI
NtQuerySystemInformation(
1320 IN SYSTEM_INFORMATION_CLASS SystemInformationClass
,
1321 OUT PVOID SystemInformation
,
1323 OUT PULONG ResultLength
)
1325 NTSTATUS ret
= STATUS_SUCCESS
;
1328 TRACE("(0x%08x,%p,0x%08x,%p)\n",
1329 SystemInformationClass
,SystemInformation
,Length
,ResultLength
);
1331 switch (SystemInformationClass
)
1333 case SystemBasicInformation
:
1335 SYSTEM_BASIC_INFORMATION sbi
;
1337 virtual_get_system_info( &sbi
);
1342 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1343 else memcpy( SystemInformation
, &sbi
, len
);
1345 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1348 case SystemCpuInformation
:
1349 if (Length
>= (len
= sizeof(cached_sci
)))
1351 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1352 else memcpy(SystemInformation
, &cached_sci
, len
);
1354 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1356 case SystemPerformanceInformation
:
1358 SYSTEM_PERFORMANCE_INFORMATION spi
;
1359 static BOOL fixme_written
= FALSE
;
1362 memset(&spi
, 0 , sizeof(spi
));
1365 spi
.Reserved3
= 0x7fffffff; /* Available paged pool memory? */
1367 if ((fp
= fopen("/proc/uptime", "r")))
1369 double uptime
, idle_time
;
1371 fscanf(fp
, "%lf %lf", &uptime
, &idle_time
);
1373 spi
.IdleTime
.QuadPart
= 10000000 * idle_time
;
1377 static ULONGLONG idle
;
1378 /* many programs expect IdleTime to change so fake change */
1379 spi
.IdleTime
.QuadPart
= ++idle
;
1384 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1385 else memcpy( SystemInformation
, &spi
, len
);
1387 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1388 if(!fixme_written
) {
1389 FIXME("info_class SYSTEM_PERFORMANCE_INFORMATION\n");
1390 fixme_written
= TRUE
;
1394 case SystemTimeOfDayInformation
:
1396 SYSTEM_TIMEOFDAY_INFORMATION sti
;
1398 memset(&sti
, 0 , sizeof(sti
));
1400 /* liKeSystemTime, liExpTimeZoneBias, uCurrentTimeZoneId */
1401 sti
.liKeBootTime
.QuadPart
= server_start_time
;
1403 if (Length
<= sizeof(sti
))
1406 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1407 else memcpy( SystemInformation
, &sti
, Length
);
1409 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1412 case SystemProcessInformation
:
1414 SYSTEM_PROCESS_INFORMATION
* spi
= SystemInformation
;
1415 SYSTEM_PROCESS_INFORMATION
* last
= NULL
;
1417 WCHAR procname
[1024];
1420 DWORD procstructlen
= 0;
1422 SERVER_START_REQ( create_snapshot
)
1424 req
->flags
= SNAP_PROCESS
| SNAP_THREAD
;
1425 req
->attributes
= 0;
1426 if (!(ret
= wine_server_call( req
)))
1427 hSnap
= wine_server_ptr_handle( reply
->handle
);
1431 while (ret
== STATUS_SUCCESS
)
1433 SERVER_START_REQ( next_process
)
1435 req
->handle
= wine_server_obj_handle( hSnap
);
1436 req
->reset
= (len
== 0);
1437 wine_server_set_reply( req
, procname
, sizeof(procname
)-sizeof(WCHAR
) );
1438 if (!(ret
= wine_server_call( req
)))
1440 /* Make sure procname is 0 terminated */
1441 procname
[wine_server_reply_size(reply
) / sizeof(WCHAR
)] = 0;
1443 /* Get only the executable name, not the path */
1444 if ((exename
= strrchrW(procname
, '\\')) != NULL
) exename
++;
1445 else exename
= procname
;
1447 wlen
= (strlenW(exename
) + 1) * sizeof(WCHAR
);
1449 procstructlen
= sizeof(*spi
) + wlen
+ ((reply
->threads
- 1) * sizeof(SYSTEM_THREAD_INFORMATION
));
1451 if (Length
>= len
+ procstructlen
)
1453 /* ftCreationTime, ftUserTime, ftKernelTime;
1454 * vmCounters, ioCounters
1457 memset(spi
, 0, sizeof(*spi
));
1459 spi
->NextEntryOffset
= procstructlen
- wlen
;
1460 spi
->dwThreadCount
= reply
->threads
;
1462 /* spi->pszProcessName will be set later on */
1464 spi
->dwBasePriority
= reply
->priority
;
1465 spi
->UniqueProcessId
= UlongToHandle(reply
->pid
);
1466 spi
->ParentProcessId
= UlongToHandle(reply
->ppid
);
1467 spi
->HandleCount
= reply
->handles
;
1469 /* spi->ti will be set later on */
1471 len
+= procstructlen
;
1473 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1478 if (ret
!= STATUS_SUCCESS
)
1480 if (ret
== STATUS_NO_MORE_FILES
) ret
= STATUS_SUCCESS
;
1483 else /* Length is already checked for */
1487 /* set thread info */
1489 while (ret
== STATUS_SUCCESS
)
1491 SERVER_START_REQ( next_thread
)
1493 req
->handle
= wine_server_obj_handle( hSnap
);
1494 req
->reset
= (j
== 0);
1495 if (!(ret
= wine_server_call( req
)))
1498 if (UlongToHandle(reply
->pid
) == spi
->UniqueProcessId
)
1500 /* ftKernelTime, ftUserTime, ftCreateTime;
1501 * dwTickCount, dwStartAddress
1504 memset(&spi
->ti
[i
], 0, sizeof(spi
->ti
));
1506 spi
->ti
[i
].CreateTime
.QuadPart
= 0xdeadbeef;
1507 spi
->ti
[i
].ClientId
.UniqueProcess
= UlongToHandle(reply
->pid
);
1508 spi
->ti
[i
].ClientId
.UniqueThread
= UlongToHandle(reply
->tid
);
1509 spi
->ti
[i
].dwCurrentPriority
= reply
->base_pri
+ reply
->delta_pri
;
1510 spi
->ti
[i
].dwBasePriority
= reply
->base_pri
;
1517 if (ret
== STATUS_NO_MORE_FILES
) ret
= STATUS_SUCCESS
;
1519 /* now append process name */
1520 spi
->ProcessName
.Buffer
= (WCHAR
*)((char*)spi
+ spi
->NextEntryOffset
);
1521 spi
->ProcessName
.Length
= wlen
- sizeof(WCHAR
);
1522 spi
->ProcessName
.MaximumLength
= wlen
;
1523 memcpy( spi
->ProcessName
.Buffer
, exename
, wlen
);
1524 spi
->NextEntryOffset
+= wlen
;
1527 spi
= (SYSTEM_PROCESS_INFORMATION
*)((char*)spi
+ spi
->NextEntryOffset
);
1530 if (ret
== STATUS_SUCCESS
&& last
) last
->NextEntryOffset
= 0;
1531 if (hSnap
) NtClose(hSnap
);
1534 case SystemProcessorPerformanceInformation
:
1536 SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
*sppi
= NULL
;
1537 unsigned int cpus
= 0;
1538 int out_cpus
= Length
/ sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
);
1543 ret
= STATUS_INFO_LENGTH_MISMATCH
;
1549 processor_cpu_load_info_data_t
*pinfo
;
1550 mach_msg_type_number_t info_count
;
1552 if (host_processor_info (mach_host_self (),
1553 PROCESSOR_CPU_LOAD_INFO
,
1555 (processor_info_array_t
*)&pinfo
,
1559 cpus
= min(cpus
,out_cpus
);
1560 len
= sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
) * cpus
;
1561 sppi
= RtlAllocateHeap(GetProcessHeap(), 0,len
);
1562 for (i
= 0; i
< cpus
; i
++)
1564 sppi
[i
].IdleTime
.QuadPart
= pinfo
[i
].cpu_ticks
[CPU_STATE_IDLE
];
1565 sppi
[i
].KernelTime
.QuadPart
= pinfo
[i
].cpu_ticks
[CPU_STATE_SYSTEM
];
1566 sppi
[i
].UserTime
.QuadPart
= pinfo
[i
].cpu_ticks
[CPU_STATE_USER
];
1568 vm_deallocate (mach_task_self (), (vm_address_t
) pinfo
, info_count
* sizeof(natural_t
));
1573 FILE *cpuinfo
= fopen("/proc/stat", "r");
1576 unsigned long clk_tck
= sysconf(_SC_CLK_TCK
);
1577 unsigned long usr
,nice
,sys
,idle
,remainder
[8];
1582 /* first line is combined usage */
1583 while (fgets(line
,255,cpuinfo
))
1585 count
= sscanf(line
, "%s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu",
1586 name
, &usr
, &nice
, &sys
, &idle
,
1587 &remainder
[0], &remainder
[1], &remainder
[2], &remainder
[3],
1588 &remainder
[4], &remainder
[5], &remainder
[6], &remainder
[7]);
1590 if (count
< 5 || strncmp( name
, "cpu", 3 )) break;
1591 for (i
= 0; i
+ 5 < count
; ++i
) sys
+= remainder
[i
];
1594 cpus
= atoi( name
+ 3 ) + 1;
1595 if (cpus
> out_cpus
) break;
1596 len
= sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
) * cpus
;
1598 sppi
= RtlReAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY
, sppi
, len
);
1600 sppi
= RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
1602 sppi
[cpus
-1].IdleTime
.QuadPart
= (ULONGLONG
)idle
* 10000000 / clk_tck
;
1603 sppi
[cpus
-1].KernelTime
.QuadPart
= (ULONGLONG
)sys
* 10000000 / clk_tck
;
1604 sppi
[cpus
-1].UserTime
.QuadPart
= (ULONGLONG
)usr
* 10000000 / clk_tck
;
1615 cpus
= min(NtCurrentTeb()->Peb
->NumberOfProcessors
, out_cpus
);
1616 len
= sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
) * cpus
;
1617 sppi
= RtlAllocateHeap(GetProcessHeap(), 0, len
);
1618 FIXME("stub info_class SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION\n");
1619 /* many programs expect these values to change so fake change */
1620 for (n
= 0; n
< cpus
; n
++)
1622 sppi
[n
].KernelTime
.QuadPart
= 1 * i
;
1623 sppi
[n
].UserTime
.QuadPart
= 2 * i
;
1624 sppi
[n
].IdleTime
.QuadPart
= 3 * i
;
1631 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1632 else memcpy( SystemInformation
, sppi
, len
);
1634 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1636 RtlFreeHeap(GetProcessHeap(),0,sppi
);
1639 case SystemModuleInformation
:
1640 /* FIXME: should be system-wide */
1641 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1642 else ret
= LdrQueryProcessModuleInformation( SystemInformation
, Length
, &len
);
1644 case SystemHandleInformation
:
1646 SYSTEM_HANDLE_INFORMATION shi
;
1648 memset(&shi
, 0, sizeof(shi
));
1653 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1654 else memcpy( SystemInformation
, &shi
, len
);
1656 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1657 FIXME("info_class SYSTEM_HANDLE_INFORMATION\n");
1660 case SystemCacheInformation
:
1662 SYSTEM_CACHE_INFORMATION sci
;
1664 memset(&sci
, 0, sizeof(sci
)); /* FIXME */
1669 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1670 else memcpy( SystemInformation
, &sci
, len
);
1672 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1673 FIXME("info_class SYSTEM_CACHE_INFORMATION\n");
1676 case SystemInterruptInformation
:
1678 SYSTEM_INTERRUPT_INFORMATION sii
;
1680 memset(&sii
, 0, sizeof(sii
));
1685 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1686 else memcpy( SystemInformation
, &sii
, len
);
1688 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1689 FIXME("info_class SYSTEM_INTERRUPT_INFORMATION\n");
1692 case SystemKernelDebuggerInformation
:
1694 SYSTEM_KERNEL_DEBUGGER_INFORMATION skdi
;
1696 skdi
.DebuggerEnabled
= FALSE
;
1697 skdi
.DebuggerNotPresent
= TRUE
;
1702 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1703 else memcpy( SystemInformation
, &skdi
, len
);
1705 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1708 case SystemRegistryQuotaInformation
:
1710 /* Something to do with the size of the registry *
1711 * Since we don't have a size limitation, fake it *
1712 * This is almost certainly wrong. *
1713 * This sets each of the three words in the struct to 32 MB, *
1714 * which is enough to make the IE 5 installer happy. */
1715 SYSTEM_REGISTRY_QUOTA_INFORMATION srqi
;
1717 srqi
.RegistryQuotaAllowed
= 0x2000000;
1718 srqi
.RegistryQuotaUsed
= 0x200000;
1719 srqi
.Reserved1
= (void*)0x200000;
1724 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1727 FIXME("SystemRegistryQuotaInformation: faking max registry size of 32 MB\n");
1728 memcpy( SystemInformation
, &srqi
, len
);
1731 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1735 FIXME("(0x%08x,%p,0x%08x,%p) stub\n",
1736 SystemInformationClass
,SystemInformation
,Length
,ResultLength
);
1738 /* Several Information Classes are not implemented on Windows and return 2 different values
1739 * STATUS_NOT_IMPLEMENTED or STATUS_INVALID_INFO_CLASS
1740 * in 95% of the cases it's STATUS_INVALID_INFO_CLASS, so use this as the default
1742 ret
= STATUS_INVALID_INFO_CLASS
;
1745 if (ResultLength
) *ResultLength
= len
;
1750 /******************************************************************************
1751 * NtSetSystemInformation [NTDLL.@]
1752 * ZwSetSystemInformation [NTDLL.@]
1754 NTSTATUS WINAPI
NtSetSystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass
, PVOID SystemInformation
, ULONG Length
)
1756 FIXME("(0x%08x,%p,0x%08x) stub\n",SystemInformationClass
,SystemInformation
,Length
);
1757 return STATUS_SUCCESS
;
1760 /******************************************************************************
1761 * NtCreatePagingFile [NTDLL.@]
1762 * ZwCreatePagingFile [NTDLL.@]
1764 NTSTATUS WINAPI
NtCreatePagingFile(
1765 PUNICODE_STRING PageFileName
,
1766 PLARGE_INTEGER MinimumSize
,
1767 PLARGE_INTEGER MaximumSize
,
1768 PLARGE_INTEGER ActualSize
)
1770 FIXME("(%p %p %p %p) stub\n", PageFileName
, MinimumSize
, MaximumSize
, ActualSize
);
1771 return STATUS_SUCCESS
;
1774 /******************************************************************************
1775 * NtDisplayString [NTDLL.@]
1777 * writes a string to the nt-textmode screen eg. during startup
1779 NTSTATUS WINAPI
NtDisplayString ( PUNICODE_STRING string
)
1784 if (!(ret
= RtlUnicodeStringToAnsiString( &stringA
, string
, TRUE
)))
1786 MESSAGE( "%.*s", stringA
.Length
, stringA
.Buffer
);
1787 RtlFreeAnsiString( &stringA
);
1792 /******************************************************************************
1793 * NtInitiatePowerAction [NTDLL.@]
1796 NTSTATUS WINAPI
NtInitiatePowerAction(
1797 IN POWER_ACTION SystemAction
,
1798 IN SYSTEM_POWER_STATE MinSystemState
,
1800 IN BOOLEAN Asynchronous
)
1802 FIXME("(%d,%d,0x%08x,%d),stub\n",
1803 SystemAction
,MinSystemState
,Flags
,Asynchronous
);
1804 return STATUS_NOT_IMPLEMENTED
;
1808 /******************************************************************************
1809 * NtPowerInformation [NTDLL.@]
1812 NTSTATUS WINAPI
NtPowerInformation(
1813 IN POWER_INFORMATION_LEVEL InformationLevel
,
1814 IN PVOID lpInputBuffer
,
1815 IN ULONG nInputBufferSize
,
1816 IN PVOID lpOutputBuffer
,
1817 IN ULONG nOutputBufferSize
)
1819 TRACE("(%d,%p,%d,%p,%d)\n",
1820 InformationLevel
,lpInputBuffer
,nInputBufferSize
,lpOutputBuffer
,nOutputBufferSize
);
1821 switch(InformationLevel
) {
1822 case SystemPowerCapabilities
: {
1823 PSYSTEM_POWER_CAPABILITIES PowerCaps
= lpOutputBuffer
;
1824 FIXME("semi-stub: SystemPowerCapabilities\n");
1825 if (nOutputBufferSize
< sizeof(SYSTEM_POWER_CAPABILITIES
))
1826 return STATUS_BUFFER_TOO_SMALL
;
1827 /* FIXME: These values are based off a native XP desktop, should probably use APM/ACPI to get the 'real' values */
1828 PowerCaps
->PowerButtonPresent
= TRUE
;
1829 PowerCaps
->SleepButtonPresent
= FALSE
;
1830 PowerCaps
->LidPresent
= FALSE
;
1831 PowerCaps
->SystemS1
= TRUE
;
1832 PowerCaps
->SystemS2
= FALSE
;
1833 PowerCaps
->SystemS3
= FALSE
;
1834 PowerCaps
->SystemS4
= TRUE
;
1835 PowerCaps
->SystemS5
= TRUE
;
1836 PowerCaps
->HiberFilePresent
= TRUE
;
1837 PowerCaps
->FullWake
= TRUE
;
1838 PowerCaps
->VideoDimPresent
= FALSE
;
1839 PowerCaps
->ApmPresent
= FALSE
;
1840 PowerCaps
->UpsPresent
= FALSE
;
1841 PowerCaps
->ThermalControl
= FALSE
;
1842 PowerCaps
->ProcessorThrottle
= FALSE
;
1843 PowerCaps
->ProcessorMinThrottle
= 100;
1844 PowerCaps
->ProcessorMaxThrottle
= 100;
1845 PowerCaps
->DiskSpinDown
= TRUE
;
1846 PowerCaps
->SystemBatteriesPresent
= FALSE
;
1847 PowerCaps
->BatteriesAreShortTerm
= FALSE
;
1848 PowerCaps
->BatteryScale
[0].Granularity
= 0;
1849 PowerCaps
->BatteryScale
[0].Capacity
= 0;
1850 PowerCaps
->BatteryScale
[1].Granularity
= 0;
1851 PowerCaps
->BatteryScale
[1].Capacity
= 0;
1852 PowerCaps
->BatteryScale
[2].Granularity
= 0;
1853 PowerCaps
->BatteryScale
[2].Capacity
= 0;
1854 PowerCaps
->AcOnLineWake
= PowerSystemUnspecified
;
1855 PowerCaps
->SoftLidWake
= PowerSystemUnspecified
;
1856 PowerCaps
->RtcWake
= PowerSystemSleeping1
;
1857 PowerCaps
->MinDeviceWakeState
= PowerSystemUnspecified
;
1858 PowerCaps
->DefaultLowLatencyWake
= PowerSystemUnspecified
;
1859 return STATUS_SUCCESS
;
1861 case SystemExecutionState
: {
1862 PULONG ExecutionState
= lpOutputBuffer
;
1863 WARN("semi-stub: SystemExecutionState\n"); /* Needed for .NET Framework, but using a FIXME is really noisy. */
1864 if (lpInputBuffer
!= NULL
)
1865 return STATUS_INVALID_PARAMETER
;
1866 /* FIXME: The actual state should be the value set by SetThreadExecutionState which is not currently implemented. */
1867 *ExecutionState
= ES_USER_PRESENT
;
1868 return STATUS_SUCCESS
;
1870 case ProcessorInformation
: {
1871 PPROCESSOR_POWER_INFORMATION cpu_power
= lpOutputBuffer
;
1873 WARN("semi-stub: ProcessorInformation\n");
1874 if (nOutputBufferSize
< sizeof(PROCESSOR_POWER_INFORMATION
))
1875 return STATUS_BUFFER_TOO_SMALL
;
1876 cpu_power
->Number
= NtCurrentTeb()->Peb
->NumberOfProcessors
;
1877 cpu_power
->MaxMhz
= cpuHz
/ 1000000;
1878 cpu_power
->CurrentMhz
= cpuHz
/ 1000000;
1879 cpu_power
->MhzLimit
= cpuHz
/ 1000000;
1880 cpu_power
->MaxIdleState
= 0; /* FIXME */
1881 cpu_power
->CurrentIdleState
= 0; /* FIXME */
1882 return STATUS_SUCCESS
;
1885 /* FIXME: Needed by .NET Framework */
1886 WARN("Unimplemented NtPowerInformation action: %d\n", InformationLevel
);
1887 return STATUS_NOT_IMPLEMENTED
;
1891 /******************************************************************************
1892 * NtShutdownSystem [NTDLL.@]
1895 NTSTATUS WINAPI
NtShutdownSystem(SHUTDOWN_ACTION Action
)
1897 FIXME("%d\n",Action
);
1898 return STATUS_SUCCESS
;
1901 /******************************************************************************
1902 * NtAllocateLocallyUniqueId (NTDLL.@)
1904 NTSTATUS WINAPI
NtAllocateLocallyUniqueId(PLUID Luid
)
1908 TRACE("%p\n", Luid
);
1911 return STATUS_ACCESS_VIOLATION
;
1913 SERVER_START_REQ( allocate_locally_unique_id
)
1915 status
= wine_server_call( req
);
1918 Luid
->LowPart
= reply
->luid
.low_part
;
1919 Luid
->HighPart
= reply
->luid
.high_part
;
1927 /******************************************************************************
1928 * VerSetConditionMask (NTDLL.@)
1930 ULONGLONG WINAPI
VerSetConditionMask( ULONGLONG dwlConditionMask
, DWORD dwTypeBitMask
,
1931 BYTE dwConditionMask
)
1933 if(dwTypeBitMask
== 0)
1934 return dwlConditionMask
;
1935 dwConditionMask
&= 0x07;
1936 if(dwConditionMask
== 0)
1937 return dwlConditionMask
;
1939 if(dwTypeBitMask
& VER_PRODUCT_TYPE
)
1940 dwlConditionMask
|= dwConditionMask
<< 7*3;
1941 else if (dwTypeBitMask
& VER_SUITENAME
)
1942 dwlConditionMask
|= dwConditionMask
<< 6*3;
1943 else if (dwTypeBitMask
& VER_SERVICEPACKMAJOR
)
1944 dwlConditionMask
|= dwConditionMask
<< 5*3;
1945 else if (dwTypeBitMask
& VER_SERVICEPACKMINOR
)
1946 dwlConditionMask
|= dwConditionMask
<< 4*3;
1947 else if (dwTypeBitMask
& VER_PLATFORMID
)
1948 dwlConditionMask
|= dwConditionMask
<< 3*3;
1949 else if (dwTypeBitMask
& VER_BUILDNUMBER
)
1950 dwlConditionMask
|= dwConditionMask
<< 2*3;
1951 else if (dwTypeBitMask
& VER_MAJORVERSION
)
1952 dwlConditionMask
|= dwConditionMask
<< 1*3;
1953 else if (dwTypeBitMask
& VER_MINORVERSION
)
1954 dwlConditionMask
|= dwConditionMask
<< 0*3;
1955 return dwlConditionMask
;
1958 /******************************************************************************
1959 * NtAccessCheckAndAuditAlarm (NTDLL.@)
1960 * ZwAccessCheckAndAuditAlarm (NTDLL.@)
1962 NTSTATUS WINAPI
NtAccessCheckAndAuditAlarm(PUNICODE_STRING SubsystemName
, HANDLE HandleId
, PUNICODE_STRING ObjectTypeName
,
1963 PUNICODE_STRING ObjectName
, PSECURITY_DESCRIPTOR SecurityDescriptor
,
1964 ACCESS_MASK DesiredAccess
, PGENERIC_MAPPING GenericMapping
, BOOLEAN ObjectCreation
,
1965 PACCESS_MASK GrantedAccess
, PBOOLEAN AccessStatus
, PBOOLEAN GenerateOnClose
)
1967 FIXME("(%s, %p, %s, %p, 0x%08x, %p, %d, %p, %p, %p), stub\n", debugstr_us(SubsystemName
), HandleId
,
1968 debugstr_us(ObjectTypeName
), SecurityDescriptor
, DesiredAccess
, GenericMapping
, ObjectCreation
,
1969 GrantedAccess
, AccessStatus
, GenerateOnClose
);
1971 return STATUS_NOT_IMPLEMENTED
;
1974 /******************************************************************************
1975 * NtSystemDebugControl (NTDLL.@)
1976 * ZwSystemDebugControl (NTDLL.@)
1978 NTSTATUS WINAPI
NtSystemDebugControl(SYSDBG_COMMAND command
, PVOID inbuffer
, ULONG inbuflength
, PVOID outbuffer
,
1979 ULONG outbuflength
, PULONG retlength
)
1981 FIXME("(%d, %p, %d, %p, %d, %p), stub\n", command
, inbuffer
, inbuflength
, outbuffer
, outbuflength
, retlength
);
1983 return STATUS_NOT_IMPLEMENTED
;