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 0, /* 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;
323 char stack_buffer
[256];
324 unsigned int server_buf_len
= sizeof(stack_buffer
);
325 void *buffer
= stack_buffer
;
326 BOOLEAN need_more_memory
;
328 /* we cannot work out the size of the server buffer required for the
329 * input size, since there are two factors affecting how much can be
330 * stored in the buffer - number of groups and lengths of sids */
333 need_more_memory
= FALSE
;
335 SERVER_START_REQ( get_token_groups
)
337 TOKEN_GROUPS
*groups
= tokeninfo
;
339 req
->handle
= wine_server_obj_handle( token
);
340 wine_server_set_reply( req
, buffer
, server_buf_len
);
341 status
= wine_server_call( req
);
342 if (status
== STATUS_BUFFER_TOO_SMALL
)
344 if (buffer
== stack_buffer
)
345 buffer
= RtlAllocateHeap(GetProcessHeap(), 0, reply
->user_len
);
347 buffer
= RtlReAllocateHeap(GetProcessHeap(), 0, buffer
, reply
->user_len
);
348 if (!buffer
) return STATUS_NO_MEMORY
;
350 server_buf_len
= reply
->user_len
;
351 need_more_memory
= TRUE
;
353 else if (status
== STATUS_SUCCESS
)
355 struct token_groups
*tg
= buffer
;
356 unsigned int *attr
= (unsigned int *)(tg
+ 1);
358 const int non_sid_portion
= (sizeof(struct token_groups
) + tg
->count
* sizeof(unsigned int));
359 SID
*sids
= (SID
*)((char *)tokeninfo
+ FIELD_OFFSET( TOKEN_GROUPS
, Groups
[tg
->count
] ));
360 ULONG needed_bytes
= FIELD_OFFSET( TOKEN_GROUPS
, Groups
[tg
->count
] ) +
361 reply
->user_len
- non_sid_portion
;
363 if (retlen
) *retlen
= needed_bytes
;
365 if (needed_bytes
<= tokeninfolength
)
367 groups
->GroupCount
= tg
->count
;
368 memcpy( sids
, (char *)buffer
+ non_sid_portion
,
369 reply
->user_len
- non_sid_portion
);
371 for (i
= 0; i
< tg
->count
; i
++)
373 groups
->Groups
[i
].Attributes
= attr
[i
];
374 groups
->Groups
[i
].Sid
= sids
;
375 sids
= (SID
*)((char *)sids
+ RtlLengthSid(sids
));
378 else status
= STATUS_BUFFER_TOO_SMALL
;
380 else if (retlen
) *retlen
= 0;
383 } while (need_more_memory
);
384 if (buffer
!= stack_buffer
) RtlFreeHeap(GetProcessHeap(), 0, buffer
);
387 case TokenPrimaryGroup
:
388 SERVER_START_REQ( get_token_sid
)
390 TOKEN_PRIMARY_GROUP
*tgroup
= tokeninfo
;
391 PSID sid
= tgroup
+ 1;
392 DWORD sid_len
= tokeninfolength
< sizeof(TOKEN_PRIMARY_GROUP
) ? 0 : tokeninfolength
- sizeof(TOKEN_PRIMARY_GROUP
);
394 req
->handle
= wine_server_obj_handle( token
);
395 req
->which_sid
= tokeninfoclass
;
396 wine_server_set_reply( req
, sid
, sid_len
);
397 status
= wine_server_call( req
);
398 if (retlen
) *retlen
= reply
->sid_len
+ sizeof(TOKEN_PRIMARY_GROUP
);
399 if (status
== STATUS_SUCCESS
)
400 tgroup
->PrimaryGroup
= sid
;
404 case TokenPrivileges
:
405 SERVER_START_REQ( get_token_privileges
)
407 TOKEN_PRIVILEGES
*tpriv
= tokeninfo
;
408 req
->handle
= wine_server_obj_handle( token
);
409 if (tpriv
&& tokeninfolength
> FIELD_OFFSET( TOKEN_PRIVILEGES
, Privileges
))
410 wine_server_set_reply( req
, tpriv
->Privileges
, tokeninfolength
- FIELD_OFFSET( TOKEN_PRIVILEGES
, Privileges
) );
411 status
= wine_server_call( req
);
412 if (retlen
) *retlen
= FIELD_OFFSET( TOKEN_PRIVILEGES
, Privileges
) + reply
->len
;
413 if (tpriv
) tpriv
->PrivilegeCount
= reply
->len
/ sizeof(LUID_AND_ATTRIBUTES
);
418 SERVER_START_REQ( get_token_sid
)
420 TOKEN_OWNER
*towner
= tokeninfo
;
421 PSID sid
= towner
+ 1;
422 DWORD sid_len
= tokeninfolength
< sizeof(TOKEN_OWNER
) ? 0 : tokeninfolength
- sizeof(TOKEN_OWNER
);
424 req
->handle
= wine_server_obj_handle( token
);
425 req
->which_sid
= tokeninfoclass
;
426 wine_server_set_reply( req
, sid
, sid_len
);
427 status
= wine_server_call( req
);
428 if (retlen
) *retlen
= reply
->sid_len
+ sizeof(TOKEN_OWNER
);
429 if (status
== STATUS_SUCCESS
)
434 case TokenImpersonationLevel
:
435 SERVER_START_REQ( get_token_impersonation_level
)
437 SECURITY_IMPERSONATION_LEVEL
*impersonation_level
= tokeninfo
;
438 req
->handle
= wine_server_obj_handle( token
);
439 status
= wine_server_call( req
);
440 if (status
== STATUS_SUCCESS
)
441 *impersonation_level
= reply
->impersonation_level
;
445 case TokenStatistics
:
446 SERVER_START_REQ( get_token_statistics
)
448 TOKEN_STATISTICS
*statistics
= tokeninfo
;
449 req
->handle
= wine_server_obj_handle( token
);
450 status
= wine_server_call( req
);
451 if (status
== STATUS_SUCCESS
)
453 statistics
->TokenId
.LowPart
= reply
->token_id
.low_part
;
454 statistics
->TokenId
.HighPart
= reply
->token_id
.high_part
;
455 statistics
->AuthenticationId
.LowPart
= 0; /* FIXME */
456 statistics
->AuthenticationId
.HighPart
= 0; /* FIXME */
457 statistics
->ExpirationTime
.u
.HighPart
= 0x7fffffff;
458 statistics
->ExpirationTime
.u
.LowPart
= 0xffffffff;
459 statistics
->TokenType
= reply
->primary
? TokenPrimary
: TokenImpersonation
;
460 statistics
->ImpersonationLevel
= reply
->impersonation_level
;
462 /* kernel information not relevant to us */
463 statistics
->DynamicCharged
= 0;
464 statistics
->DynamicAvailable
= 0;
466 statistics
->GroupCount
= reply
->group_count
;
467 statistics
->PrivilegeCount
= reply
->privilege_count
;
468 statistics
->ModifiedId
.LowPart
= reply
->modified_id
.low_part
;
469 statistics
->ModifiedId
.HighPart
= reply
->modified_id
.high_part
;
475 SERVER_START_REQ( get_token_statistics
)
477 TOKEN_TYPE
*token_type
= tokeninfo
;
478 req
->handle
= wine_server_obj_handle( token
);
479 status
= wine_server_call( req
);
480 if (status
== STATUS_SUCCESS
)
481 *token_type
= reply
->primary
? TokenPrimary
: TokenImpersonation
;
485 case TokenDefaultDacl
:
486 SERVER_START_REQ( get_token_default_dacl
)
488 TOKEN_DEFAULT_DACL
*default_dacl
= tokeninfo
;
489 ACL
*acl
= (ACL
*)(default_dacl
+ 1);
492 if (tokeninfolength
< sizeof(TOKEN_DEFAULT_DACL
)) acl_len
= 0;
493 else acl_len
= tokeninfolength
- sizeof(TOKEN_DEFAULT_DACL
);
495 req
->handle
= wine_server_obj_handle( token
);
496 wine_server_set_reply( req
, acl
, acl_len
);
497 status
= wine_server_call( req
);
499 if (retlen
) *retlen
= reply
->acl_len
+ sizeof(TOKEN_DEFAULT_DACL
);
500 if (status
== STATUS_SUCCESS
)
503 default_dacl
->DefaultDacl
= acl
;
505 default_dacl
->DefaultDacl
= NULL
;
510 case TokenElevationType
:
512 TOKEN_ELEVATION_TYPE
*elevation_type
= tokeninfo
;
513 FIXME("QueryInformationToken( ..., TokenElevationType, ...) semi-stub\n");
514 *elevation_type
= TokenElevationTypeFull
;
519 TOKEN_ELEVATION
*elevation
= tokeninfo
;
520 FIXME("QueryInformationToken( ..., TokenElevation, ...) semi-stub\n");
521 elevation
->TokenIsElevated
= TRUE
;
526 ERR("Unhandled Token Information class %d!\n", tokeninfoclass
);
527 return STATUS_NOT_IMPLEMENTED
;
533 /******************************************************************************
534 * NtSetInformationToken [NTDLL.@]
535 * ZwSetInformationToken [NTDLL.@]
537 NTSTATUS WINAPI
NtSetInformationToken(
539 TOKEN_INFORMATION_CLASS TokenInformationClass
,
540 PVOID TokenInformation
,
541 ULONG TokenInformationLength
)
543 NTSTATUS ret
= STATUS_NOT_IMPLEMENTED
;
545 TRACE("%p %d %p %u\n", TokenHandle
, TokenInformationClass
,
546 TokenInformation
, TokenInformationLength
);
548 switch (TokenInformationClass
)
550 case TokenDefaultDacl
:
551 if (TokenInformationLength
< sizeof(TOKEN_DEFAULT_DACL
))
553 ret
= STATUS_INFO_LENGTH_MISMATCH
;
556 if (!TokenInformation
)
558 ret
= STATUS_ACCESS_VIOLATION
;
561 SERVER_START_REQ( set_token_default_dacl
)
563 ACL
*acl
= ((TOKEN_DEFAULT_DACL
*)TokenInformation
)->DefaultDacl
;
566 if (acl
) size
= acl
->AclSize
;
569 req
->handle
= wine_server_obj_handle( TokenHandle
);
570 wine_server_add_data( req
, acl
, size
);
571 ret
= wine_server_call( req
);
576 FIXME("unimplemented class %u\n", TokenInformationClass
);
583 /******************************************************************************
584 * NtAdjustGroupsToken [NTDLL.@]
585 * ZwAdjustGroupsToken [NTDLL.@]
587 NTSTATUS WINAPI
NtAdjustGroupsToken(
589 BOOLEAN ResetToDefault
,
590 PTOKEN_GROUPS NewState
,
592 PTOKEN_GROUPS PreviousState
,
595 FIXME("%p %d %p %u %p %p\n", TokenHandle
, ResetToDefault
,
596 NewState
, BufferLength
, PreviousState
, ReturnLength
);
597 return STATUS_NOT_IMPLEMENTED
;
600 /******************************************************************************
601 * NtPrivilegeCheck [NTDLL.@]
602 * ZwPrivilegeCheck [NTDLL.@]
604 NTSTATUS WINAPI
NtPrivilegeCheck(
606 PPRIVILEGE_SET RequiredPrivileges
,
610 SERVER_START_REQ( check_token_privileges
)
612 req
->handle
= wine_server_obj_handle( ClientToken
);
613 req
->all_required
= ((RequiredPrivileges
->Control
& PRIVILEGE_SET_ALL_NECESSARY
) ? TRUE
: FALSE
);
614 wine_server_add_data( req
, RequiredPrivileges
->Privilege
,
615 RequiredPrivileges
->PrivilegeCount
* sizeof(RequiredPrivileges
->Privilege
[0]) );
616 wine_server_set_reply( req
, RequiredPrivileges
->Privilege
,
617 RequiredPrivileges
->PrivilegeCount
* sizeof(RequiredPrivileges
->Privilege
[0]) );
619 status
= wine_server_call( req
);
621 if (status
== STATUS_SUCCESS
)
622 *Result
= (reply
->has_privileges
? TRUE
: FALSE
);
632 /******************************************************************************
633 * NtQuerySection [NTDLL.@]
635 NTSTATUS WINAPI
NtQuerySection(
636 IN HANDLE SectionHandle
,
637 IN SECTION_INFORMATION_CLASS SectionInformationClass
,
638 OUT PVOID SectionInformation
,
640 OUT PULONG ResultLength
)
642 FIXME("(%p,%d,%p,0x%08x,%p) stub!\n",
643 SectionHandle
,SectionInformationClass
,SectionInformation
,Length
,ResultLength
);
651 /******************************************************************************
652 * NtCreatePort [NTDLL.@]
653 * ZwCreatePort [NTDLL.@]
655 NTSTATUS WINAPI
NtCreatePort(PHANDLE PortHandle
,POBJECT_ATTRIBUTES ObjectAttributes
,
656 ULONG MaxConnectInfoLength
,ULONG MaxDataLength
,PULONG reserved
)
658 FIXME("(%p,%p,%u,%u,%p),stub!\n",PortHandle
,ObjectAttributes
,
659 MaxConnectInfoLength
,MaxDataLength
,reserved
);
660 return STATUS_NOT_IMPLEMENTED
;
663 /******************************************************************************
664 * NtConnectPort [NTDLL.@]
665 * ZwConnectPort [NTDLL.@]
667 NTSTATUS WINAPI
NtConnectPort(
669 PUNICODE_STRING PortName
,
670 PSECURITY_QUALITY_OF_SERVICE SecurityQos
,
671 PLPC_SECTION_WRITE WriteSection
,
672 PLPC_SECTION_READ ReadSection
,
673 PULONG MaximumMessageLength
,
675 PULONG pConnectInfoLength
)
677 FIXME("(%p,%s,%p,%p,%p,%p,%p,%p),stub!\n",
678 PortHandle
,debugstr_w(PortName
->Buffer
),SecurityQos
,
679 WriteSection
,ReadSection
,MaximumMessageLength
,ConnectInfo
,
681 if (ConnectInfo
&& pConnectInfoLength
)
682 TRACE("\tMessage = %s\n",debugstr_an(ConnectInfo
,*pConnectInfoLength
));
683 return STATUS_NOT_IMPLEMENTED
;
686 /******************************************************************************
687 * NtSecureConnectPort (NTDLL.@)
688 * ZwSecureConnectPort (NTDLL.@)
690 NTSTATUS WINAPI
NtSecureConnectPort(
692 PUNICODE_STRING PortName
,
693 PSECURITY_QUALITY_OF_SERVICE SecurityQos
,
694 PLPC_SECTION_WRITE WriteSection
,
696 PLPC_SECTION_READ ReadSection
,
697 PULONG MaximumMessageLength
,
699 PULONG pConnectInfoLength
)
701 FIXME("(%p,%s,%p,%p,%p,%p,%p,%p,%p),stub!\n",
702 PortHandle
,debugstr_w(PortName
->Buffer
),SecurityQos
,
703 WriteSection
,pSid
,ReadSection
,MaximumMessageLength
,ConnectInfo
,
705 return STATUS_NOT_IMPLEMENTED
;
708 /******************************************************************************
709 * NtListenPort [NTDLL.@]
710 * ZwListenPort [NTDLL.@]
712 NTSTATUS WINAPI
NtListenPort(HANDLE PortHandle
,PLPC_MESSAGE pLpcMessage
)
714 FIXME("(%p,%p),stub!\n",PortHandle
,pLpcMessage
);
715 return STATUS_NOT_IMPLEMENTED
;
718 /******************************************************************************
719 * NtAcceptConnectPort [NTDLL.@]
720 * ZwAcceptConnectPort [NTDLL.@]
722 NTSTATUS WINAPI
NtAcceptConnectPort(
724 ULONG PortIdentifier
,
725 PLPC_MESSAGE pLpcMessage
,
727 PLPC_SECTION_WRITE WriteSection
,
728 PLPC_SECTION_READ ReadSection
)
730 FIXME("(%p,%u,%p,%d,%p,%p),stub!\n",
731 PortHandle
,PortIdentifier
,pLpcMessage
,Accept
,WriteSection
,ReadSection
);
732 return STATUS_NOT_IMPLEMENTED
;
735 /******************************************************************************
736 * NtCompleteConnectPort [NTDLL.@]
737 * ZwCompleteConnectPort [NTDLL.@]
739 NTSTATUS WINAPI
NtCompleteConnectPort(HANDLE PortHandle
)
741 FIXME("(%p),stub!\n",PortHandle
);
742 return STATUS_NOT_IMPLEMENTED
;
745 /******************************************************************************
746 * NtRegisterThreadTerminatePort [NTDLL.@]
747 * ZwRegisterThreadTerminatePort [NTDLL.@]
749 NTSTATUS WINAPI
NtRegisterThreadTerminatePort(HANDLE PortHandle
)
751 FIXME("(%p),stub!\n",PortHandle
);
752 return STATUS_NOT_IMPLEMENTED
;
755 /******************************************************************************
756 * NtRequestWaitReplyPort [NTDLL.@]
757 * ZwRequestWaitReplyPort [NTDLL.@]
759 NTSTATUS WINAPI
NtRequestWaitReplyPort(
761 PLPC_MESSAGE pLpcMessageIn
,
762 PLPC_MESSAGE pLpcMessageOut
)
764 FIXME("(%p,%p,%p),stub!\n",PortHandle
,pLpcMessageIn
,pLpcMessageOut
);
767 TRACE("Message to send:\n");
768 TRACE("\tDataSize = %u\n",pLpcMessageIn
->DataSize
);
769 TRACE("\tMessageSize = %u\n",pLpcMessageIn
->MessageSize
);
770 TRACE("\tMessageType = %u\n",pLpcMessageIn
->MessageType
);
771 TRACE("\tVirtualRangesOffset = %u\n",pLpcMessageIn
->VirtualRangesOffset
);
772 TRACE("\tClientId.UniqueProcess = %p\n",pLpcMessageIn
->ClientId
.UniqueProcess
);
773 TRACE("\tClientId.UniqueThread = %p\n",pLpcMessageIn
->ClientId
.UniqueThread
);
774 TRACE("\tMessageId = %lu\n",pLpcMessageIn
->MessageId
);
775 TRACE("\tSectionSize = %lu\n",pLpcMessageIn
->SectionSize
);
776 TRACE("\tData = %s\n",
777 debugstr_an((const char*)pLpcMessageIn
->Data
,pLpcMessageIn
->DataSize
));
779 return STATUS_NOT_IMPLEMENTED
;
782 /******************************************************************************
783 * NtReplyWaitReceivePort [NTDLL.@]
784 * ZwReplyWaitReceivePort [NTDLL.@]
786 NTSTATUS WINAPI
NtReplyWaitReceivePort(
788 PULONG PortIdentifier
,
789 PLPC_MESSAGE ReplyMessage
,
790 PLPC_MESSAGE Message
)
792 FIXME("(%p,%p,%p,%p),stub!\n",PortHandle
,PortIdentifier
,ReplyMessage
,Message
);
793 return STATUS_NOT_IMPLEMENTED
;
800 /******************************************************************************
801 * NtSetIntervalProfile [NTDLL.@]
802 * ZwSetIntervalProfile [NTDLL.@]
804 NTSTATUS WINAPI
NtSetIntervalProfile(
806 KPROFILE_SOURCE Source
)
808 FIXME("%u,%d\n", Interval
, Source
);
809 return STATUS_SUCCESS
;
812 static SYSTEM_CPU_INFORMATION cached_sci
;
813 static ULONGLONG cpuHz
= 1000000000; /* default to a 1GHz */
815 #define AUTH 0x68747541 /* "Auth" */
816 #define ENTI 0x69746e65 /* "enti" */
817 #define CAMD 0x444d4163 /* "cAMD" */
819 /* Calls cpuid with an eax of 'ax' and returns the 16 bytes in *p
820 * We are compiled with -fPIC, so we can't clobber ebx.
822 static inline void do_cpuid(unsigned int ax
, unsigned int *p
)
825 __asm__("pushl %%ebx\n\t"
827 "movl %%ebx, %%esi\n\t"
829 : "=a" (p
[0]), "=S" (p
[1]), "=c" (p
[2]), "=d" (p
[3])
834 /* From xf86info havecpuid.c 1.11 */
835 static inline int have_cpuid(void)
849 : "=&r" (f1
), "=&r" (f2
)
850 : "ir" (0x00200000));
851 return ((f1
^f2
) & 0x00200000) != 0;
857 static inline void get_cpuinfo(SYSTEM_CPU_INFORMATION
* info
)
859 unsigned int regs
[4], regs2
[4];
861 if (!have_cpuid()) return;
863 do_cpuid(0x00000000, regs
); /* get standard cpuid level and vendor name */
864 if (regs
[0]>=0x00000001) /* Check for supported cpuid version */
866 do_cpuid(0x00000001, regs2
); /* get cpu features */
867 switch ((regs2
[0] >> 8) & 0xf) /* cpu family */
869 case 3: info
->Level
= 3; break;
870 case 4: info
->Level
= 4; break;
871 case 5: info
->Level
= 5; break;
872 case 15: /* PPro/2/3/4 has same info as P1 */
873 case 6: info
->Level
= 6; break;
875 FIXME("unknown cpu family %d, please report! (-> setting to 386)\n",
876 (regs2
[0] >> 8)&0xf);
880 user_shared_data
->ProcessorFeatures
[PF_FLOATING_POINT_EMULATED
] = !(regs2
[3] & 1);
881 user_shared_data
->ProcessorFeatures
[PF_RDTSC_INSTRUCTION_AVAILABLE
] = (regs2
[3] & (1 << 4 )) >> 4;
882 user_shared_data
->ProcessorFeatures
[PF_PAE_ENABLED
] = (regs2
[3] & (1 << 6 )) >> 6;
883 user_shared_data
->ProcessorFeatures
[PF_COMPARE_EXCHANGE_DOUBLE
] = (regs2
[3] & (1 << 8 )) >> 8;
884 user_shared_data
->ProcessorFeatures
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = (regs2
[3] & (1 << 23)) >> 23;
885 user_shared_data
->ProcessorFeatures
[PF_XMMI_INSTRUCTIONS_AVAILABLE
] = (regs2
[3] & (1 << 25)) >> 25;
886 user_shared_data
->ProcessorFeatures
[PF_XMMI64_INSTRUCTIONS_AVAILABLE
] = (regs2
[3] & (1 << 26)) >> 26;
888 if (regs
[1] == AUTH
&& regs
[3] == ENTI
&& regs
[2] == CAMD
)
890 do_cpuid(0x80000000, regs
); /* get vendor cpuid level */
891 if (regs
[0] >= 0x80000001)
893 do_cpuid(0x80000001, regs2
); /* get vendor features */
894 user_shared_data
->ProcessorFeatures
[PF_3DNOW_INSTRUCTIONS_AVAILABLE
] = (regs2
[3] & (1 << 31 )) >> 31;
900 /******************************************************************
903 * inits a couple of places with CPU related information:
904 * - cached_sci & cpuHZ in this file
905 * - Peb->NumberOfProcessors
906 * - SharedUserData->ProcessFeatures[] array
908 * It creates a registry subhierarchy, looking like:
909 * "\HARDWARE\DESCRIPTION\System\CentralProcessor\<processornumber>\Identifier (CPU x86)".
910 * Note that there is a hierarchy for every processor installed, so this
911 * supports multiprocessor systems. This is done like Win95 does it, I think.
913 * It creates some registry entries in the environment part:
914 * "\HKLM\System\CurrentControlSet\Control\Session Manager\Environment". These are
915 * always present. When deleted, Windows will add them again.
917 void fill_cpu_info(void)
919 memset(&cached_sci
, 0, sizeof(cached_sci
));
920 /* choose sensible defaults ...
921 * FIXME: perhaps overridable with precompiler flags?
924 cached_sci
.Architecture
= PROCESSOR_ARCHITECTURE_INTEL
;
925 cached_sci
.Level
= 5; /* 586 */
926 #elif defined(__x86_64__)
927 cached_sci
.Architecture
= PROCESSOR_ARCHITECTURE_AMD64
;
928 #elif defined(__powerpc__)
929 cached_sci
.Architecture
= PROCESSOR_ARCHITECTURE_PPC
;
930 #elif defined(__arm__)
931 cached_sci
.Architecture
= PROCESSOR_ARCHITECTURE_ARM
;
932 #elif defined(__ALPHA__)
933 cached_sci
.Architecture
= PROCESSOR_ARCHITECTURE_ALPHA
;
934 #elif defined(__sparc__)
935 cached_sci
.Architecture
= PROCESSOR_ARCHITECTURE_SPARC
;
939 cached_sci
.Revision
= 0;
940 cached_sci
.Reserved
= 0;
941 cached_sci
.FeatureSet
= 0x1fff; /* FIXME: set some sensible defaults out of ProcessFeatures[] */
943 NtCurrentTeb()->Peb
->NumberOfProcessors
= 1;
945 /* Hmm, reasonable processor feature defaults? */
950 FILE *f
= fopen ("/proc/cpuinfo", "r");
954 while (fgets(line
,200,f
) != NULL
)
958 /* NOTE: the ':' is the only character we can rely on */
959 if (!(value
= strchr(line
,':')))
962 /* terminate the valuename */
964 while ((s
>= line
) && ((*s
== ' ') || (*s
== '\t'))) s
--;
967 /* and strip leading spaces from value */
969 while (*value
==' ') value
++;
970 if ((s
= strchr(value
,'\n')))
973 if (!strcasecmp(line
, "processor"))
975 /* processor number counts up... */
978 if (sscanf(value
, "%d",&x
))
979 if (x
+ 1 > NtCurrentTeb()->Peb
->NumberOfProcessors
)
980 NtCurrentTeb()->Peb
->NumberOfProcessors
= x
+ 1;
984 if (!strcasecmp(line
, "model"))
986 /* First part of Revision */
989 if (sscanf(value
, "%d",&x
))
990 cached_sci
.Revision
= cached_sci
.Revision
| (x
<< 8);
996 if (!strcasecmp(line
, "cpu family"))
998 if (isdigit(value
[0]))
1000 cached_sci
.Level
= atoi(value
);
1004 /* old 2.0 method */
1005 if (!strcasecmp(line
, "cpu"))
1007 if (isdigit(value
[0]) && value
[1] == '8' && value
[2] == '6' && value
[3] == 0)
1009 switch (cached_sci
.Level
= value
[0] - '0')
1017 FIXME("unknown Linux 2.0 cpu family '%s', please report ! (-> setting to 386)\n", value
);
1018 cached_sci
.Level
= 3;
1024 if (!strcasecmp(line
, "stepping"))
1026 /* Second part of Revision */
1029 if (sscanf(value
, "%d",&x
))
1030 cached_sci
.Revision
= cached_sci
.Revision
| x
;
1033 if (!strcasecmp(line
, "cpu MHz"))
1036 if (sscanf( value
, "%lf", &cmz
) == 1)
1038 /* SYSTEMINFO doesn't have a slot for cpu speed, so store in a global */
1039 cpuHz
= cmz
* 1000 * 1000;
1043 if (!strcasecmp(line
, "fdiv_bug"))
1045 if (!strncasecmp(value
, "yes",3))
1046 user_shared_data
->ProcessorFeatures
[PF_FLOATING_POINT_PRECISION_ERRATA
] = TRUE
;
1049 if (!strcasecmp(line
, "fpu"))
1051 if (!strncasecmp(value
, "no",2))
1052 user_shared_data
->ProcessorFeatures
[PF_FLOATING_POINT_EMULATED
] = TRUE
;
1055 if (!strcasecmp(line
, "flags") || !strcasecmp(line
, "features"))
1057 if (strstr(value
, "cx8"))
1058 user_shared_data
->ProcessorFeatures
[PF_COMPARE_EXCHANGE_DOUBLE
] = TRUE
;
1059 if (strstr(value
, "cx16"))
1060 user_shared_data
->ProcessorFeatures
[PF_COMPARE_EXCHANGE128
] = TRUE
;
1061 if (strstr(value
, "mmx"))
1062 user_shared_data
->ProcessorFeatures
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1063 if (strstr(value
, "tsc"))
1064 user_shared_data
->ProcessorFeatures
[PF_RDTSC_INSTRUCTION_AVAILABLE
] = TRUE
;
1065 if (strstr(value
, "3dnow"))
1066 user_shared_data
->ProcessorFeatures
[PF_3DNOW_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1067 /* This will also catch sse2, but we have sse itself
1068 * if we have sse2, so no problem */
1069 if (strstr(value
, "sse"))
1070 user_shared_data
->ProcessorFeatures
[PF_XMMI_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1071 if (strstr(value
, "sse2"))
1072 user_shared_data
->ProcessorFeatures
[PF_XMMI64_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1073 if (strstr(value
, "pni"))
1074 user_shared_data
->ProcessorFeatures
[PF_SSE3_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1075 if (strstr(value
, "pae"))
1076 user_shared_data
->ProcessorFeatures
[PF_PAE_ENABLED
] = TRUE
;
1077 if (strstr(value
, "ht"))
1078 cached_sci
.FeatureSet
|= CPU_FEATURE_HTT
;
1084 #elif defined (__NetBSD__)
1091 FILE *f
= fopen("/var/run/dmesg.boot", "r");
1093 /* first deduce as much as possible from the sysctls */
1094 mib
[0] = CTL_MACHDEP
;
1095 #ifdef CPU_FPU_PRESENT
1096 mib
[1] = CPU_FPU_PRESENT
;
1097 val_len
= sizeof(value
);
1098 if (sysctl(mib
, 2, &value
, &val_len
, NULL
, 0) >= 0)
1099 user_shared_data
->ProcessorFeatures
[PF_FLOATING_POINT_EMULATED
] = !value
;
1102 mib
[1] = CPU_SSE
; /* this should imply MMX */
1103 val_len
= sizeof(value
);
1104 if (sysctl(mib
, 2, &value
, &val_len
, NULL
, 0) >= 0)
1105 if (value
) user_shared_data
->ProcessorFeatures
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1108 mib
[1] = CPU_SSE2
; /* this should imply MMX */
1109 val_len
= sizeof(value
);
1110 if (sysctl(mib
, 2, &value
, &val_len
, NULL
, 0) >= 0)
1111 if (value
) user_shared_data
->ProcessorFeatures
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1115 val_len
= sizeof(value
);
1116 if (sysctl(mib
, 2, &value
, &val_len
, NULL
, 0) >= 0)
1117 if (value
> NtCurrentTeb()->Peb
->NumberOfProcessors
)
1118 NtCurrentTeb()->Peb
->NumberOfProcessors
= value
;
1120 val_len
= sizeof(model
)-1;
1121 if (sysctl(mib
, 2, model
, &val_len
, NULL
, 0) >= 0)
1123 model
[val_len
] = '\0'; /* just in case */
1124 cpuclass
= strstr(model
, "-class");
1125 if (cpuclass
!= NULL
) {
1126 while(cpuclass
> model
&& cpuclass
[0] != '(') cpuclass
--;
1127 if (!strncmp(cpuclass
+1, "386", 3))
1129 cached_sci
.Level
= 3;
1131 if (!strncmp(cpuclass
+1, "486", 3))
1133 cached_sci
.Level
= 4;
1135 if (!strncmp(cpuclass
+1, "586", 3))
1137 cached_sci
.Level
= 5;
1139 if (!strncmp(cpuclass
+1, "686", 3))
1141 cached_sci
.Level
= 6;
1142 /* this should imply MMX */
1143 user_shared_data
->ProcessorFeatures
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1148 /* it may be worth reading from /var/run/dmesg.boot for
1149 additional information such as CX8, MMX and TSC
1150 (however this information should be considered less
1151 reliable than that from the sysctl calls) */
1154 while (fgets(model
, 255, f
) != NULL
)
1157 if (sscanf(model
, "cpu%d: features %x<", &cpu
, &features
) == 2)
1159 /* we could scan the string but it is easier
1160 to test the bits directly */
1162 user_shared_data
->ProcessorFeatures
[PF_FLOATING_POINT_EMULATED
] = TRUE
;
1163 if (features
& 0x10)
1164 user_shared_data
->ProcessorFeatures
[PF_RDTSC_INSTRUCTION_AVAILABLE
] = TRUE
;
1165 if (features
& 0x100)
1166 user_shared_data
->ProcessorFeatures
[PF_COMPARE_EXCHANGE_DOUBLE
] = TRUE
;
1167 if (features
& 0x800000)
1168 user_shared_data
->ProcessorFeatures
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1176 #elif defined(__FreeBSD__) || defined (__FreeBSD_kernel__)
1181 get_cpuinfo( &cached_sci
);
1183 /* Check for OS support of SSE -- Is this used, and should it be sse1 or sse2? */
1184 /*len = sizeof(num);
1185 ret = sysctlbyname("hw.instruction_sse", &num, &len, NULL, 0);
1187 user_shared_data->ProcessorFeatures[PF_XMMI_INSTRUCTIONS_AVAILABLE] = num;*/
1190 ret
= sysctlbyname("hw.ncpu", &num
, &len
, NULL
, 0);
1192 NtCurrentTeb()->Peb
->NumberOfProcessors
= num
;
1195 if (!sysctlbyname("dev.cpu.0.freq", &num
, &len
, NULL
, 0))
1196 cpuHz
= num
* 1000 * 1000;
1198 #elif defined(__sun)
1200 int num
= sysconf( _SC_NPROCESSORS_ONLN
);
1202 if (num
== -1) num
= 1;
1203 get_cpuinfo( &cached_sci
);
1204 NtCurrentTeb()->Peb
->NumberOfProcessors
= num
;
1206 #elif defined (__OpenBSD__)
1208 int mib
[2], num
, ret
;
1215 ret
= sysctl(mib
, 2, &num
, &len
, NULL
, 0);
1217 NtCurrentTeb()->Peb
->NumberOfProcessors
= num
;
1219 #elif defined (__APPLE__)
1222 unsigned long long longVal
;
1227 valSize
= sizeof(int);
1228 if (sysctlbyname ("hw.optional.floatingpoint", &value
, &valSize
, NULL
, 0) == 0)
1231 user_shared_data
->ProcessorFeatures
[PF_FLOATING_POINT_EMULATED
] = FALSE
;
1233 user_shared_data
->ProcessorFeatures
[PF_FLOATING_POINT_EMULATED
] = TRUE
;
1235 valSize
= sizeof(int);
1236 if (sysctlbyname ("hw.ncpu", &value
, &valSize
, NULL
, 0) == 0)
1237 NtCurrentTeb()->Peb
->NumberOfProcessors
= value
;
1239 /* FIXME: we don't use the "hw.activecpu" value... but the cached one */
1241 valSize
= sizeof(int);
1242 if (sysctlbyname ("hw.cputype", &cputype
, &valSize
, NULL
, 0) == 0)
1246 case CPU_TYPE_POWERPC
:
1247 cached_sci
.Architecture
= PROCESSOR_ARCHITECTURE_PPC
;
1248 valSize
= sizeof(int);
1249 if (sysctlbyname ("hw.cpusubtype", &value
, &valSize
, NULL
, 0) == 0)
1253 case CPU_SUBTYPE_POWERPC_601
:
1254 case CPU_SUBTYPE_POWERPC_602
: cached_sci
.Level
= 1; break;
1255 case CPU_SUBTYPE_POWERPC_603
: cached_sci
.Level
= 3; break;
1256 case CPU_SUBTYPE_POWERPC_603e
:
1257 case CPU_SUBTYPE_POWERPC_603ev
: cached_sci
.Level
= 6; break;
1258 case CPU_SUBTYPE_POWERPC_604
: cached_sci
.Level
= 4; break;
1259 case CPU_SUBTYPE_POWERPC_604e
: cached_sci
.Level
= 9; break;
1260 case CPU_SUBTYPE_POWERPC_620
: cached_sci
.Level
= 20; break;
1261 case CPU_SUBTYPE_POWERPC_750
: /* G3/G4 derive from 603 so ... */
1262 case CPU_SUBTYPE_POWERPC_7400
:
1263 case CPU_SUBTYPE_POWERPC_7450
: cached_sci
.Level
= 6; break;
1264 case CPU_SUBTYPE_POWERPC_970
: cached_sci
.Level
= 9;
1265 /* :o) user_shared_data->ProcessorFeatures[PF_ALTIVEC_INSTRUCTIONS_AVAILABLE] ;-) */
1270 break; /* CPU_TYPE_POWERPC */
1272 cached_sci
.Architecture
= PROCESSOR_ARCHITECTURE_INTEL
;
1273 valSize
= sizeof(int);
1274 if (sysctlbyname ("machdep.cpu.family", &value
, &valSize
, NULL
, 0) == 0)
1276 cached_sci
.Level
= value
;
1278 valSize
= sizeof(int);
1279 if (sysctlbyname ("machdep.cpu.model", &value
, &valSize
, NULL
, 0) == 0)
1280 cached_sci
.Revision
= (value
<< 8);
1281 valSize
= sizeof(int);
1282 if (sysctlbyname ("machdep.cpu.stepping", &value
, &valSize
, NULL
, 0) == 0)
1283 cached_sci
.Revision
|= value
;
1284 valSize
= sizeof(buffer
);
1285 if (sysctlbyname ("machdep.cpu.features", buffer
, &valSize
, NULL
, 0) == 0)
1287 cached_sci
.Revision
|= value
;
1288 if (strstr(buffer
, "CX8")) user_shared_data
->ProcessorFeatures
[PF_COMPARE_EXCHANGE_DOUBLE
] = TRUE
;
1289 if (strstr(buffer
, "CX16")) user_shared_data
->ProcessorFeatures
[PF_COMPARE_EXCHANGE128
] = TRUE
;
1290 if (strstr(buffer
, "MMX")) user_shared_data
->ProcessorFeatures
[PF_MMX_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1291 if (strstr(buffer
, "TSC")) user_shared_data
->ProcessorFeatures
[PF_RDTSC_INSTRUCTION_AVAILABLE
] = TRUE
;
1292 if (strstr(buffer
, "3DNOW")) user_shared_data
->ProcessorFeatures
[PF_3DNOW_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1293 if (strstr(buffer
, "SSE")) user_shared_data
->ProcessorFeatures
[PF_XMMI_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1294 if (strstr(buffer
, "SSE2")) user_shared_data
->ProcessorFeatures
[PF_XMMI64_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1295 if (strstr(buffer
, "SSE3")) user_shared_data
->ProcessorFeatures
[PF_SSE3_INSTRUCTIONS_AVAILABLE
] = TRUE
;
1296 if (strstr(buffer
, "PAE")) user_shared_data
->ProcessorFeatures
[PF_PAE_ENABLED
] = TRUE
;
1298 break; /* CPU_TYPE_I386 */
1300 } /* switch (cputype) */
1302 valSize
= sizeof(longVal
);
1303 if (!sysctlbyname("hw.cpufrequency", &longVal
, &valSize
, NULL
, 0))
1307 FIXME("not yet supported on this system\n");
1309 TRACE("<- CPU arch %d, level %d, rev %d, features 0x%x\n",
1310 cached_sci
.Architecture
, cached_sci
.Level
, cached_sci
.Revision
, cached_sci
.FeatureSet
);
1313 /******************************************************************************
1314 * NtQuerySystemInformation [NTDLL.@]
1315 * ZwQuerySystemInformation [NTDLL.@]
1318 * SystemInformationClass Index to a certain information structure
1319 * SystemTimeAdjustmentInformation SYSTEM_TIME_ADJUSTMENT
1320 * SystemCacheInformation SYSTEM_CACHE_INFORMATION
1321 * SystemConfigurationInformation CONFIGURATION_INFORMATION
1322 * observed (class/len):
1328 * SystemInformation caller supplies storage for the information structure
1329 * Length size of the structure
1330 * ResultLength Data written
1332 NTSTATUS WINAPI
NtQuerySystemInformation(
1333 IN SYSTEM_INFORMATION_CLASS SystemInformationClass
,
1334 OUT PVOID SystemInformation
,
1336 OUT PULONG ResultLength
)
1338 NTSTATUS ret
= STATUS_SUCCESS
;
1341 TRACE("(0x%08x,%p,0x%08x,%p)\n",
1342 SystemInformationClass
,SystemInformation
,Length
,ResultLength
);
1344 switch (SystemInformationClass
)
1346 case SystemBasicInformation
:
1348 SYSTEM_BASIC_INFORMATION sbi
;
1350 virtual_get_system_info( &sbi
);
1355 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1356 else memcpy( SystemInformation
, &sbi
, len
);
1358 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1361 case SystemCpuInformation
:
1362 if (Length
>= (len
= sizeof(cached_sci
)))
1364 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1365 else memcpy(SystemInformation
, &cached_sci
, len
);
1367 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1369 case SystemPerformanceInformation
:
1371 SYSTEM_PERFORMANCE_INFORMATION spi
;
1372 static BOOL fixme_written
= FALSE
;
1375 memset(&spi
, 0 , sizeof(spi
));
1378 spi
.Reserved3
= 0x7fffffff; /* Available paged pool memory? */
1380 if ((fp
= fopen("/proc/uptime", "r")))
1382 double uptime
, idle_time
;
1384 fscanf(fp
, "%lf %lf", &uptime
, &idle_time
);
1386 spi
.IdleTime
.QuadPart
= 10000000 * idle_time
;
1390 static ULONGLONG idle
;
1391 /* many programs expect IdleTime to change so fake change */
1392 spi
.IdleTime
.QuadPart
= ++idle
;
1397 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1398 else memcpy( SystemInformation
, &spi
, len
);
1400 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1401 if(!fixme_written
) {
1402 FIXME("info_class SYSTEM_PERFORMANCE_INFORMATION\n");
1403 fixme_written
= TRUE
;
1407 case SystemTimeOfDayInformation
:
1409 SYSTEM_TIMEOFDAY_INFORMATION sti
;
1411 memset(&sti
, 0 , sizeof(sti
));
1413 /* liKeSystemTime, liExpTimeZoneBias, uCurrentTimeZoneId */
1414 sti
.liKeBootTime
.QuadPart
= server_start_time
;
1416 if (Length
<= sizeof(sti
))
1419 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1420 else memcpy( SystemInformation
, &sti
, Length
);
1422 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1425 case SystemProcessInformation
:
1427 SYSTEM_PROCESS_INFORMATION
* spi
= SystemInformation
;
1428 SYSTEM_PROCESS_INFORMATION
* last
= NULL
;
1430 WCHAR procname
[1024];
1433 DWORD procstructlen
= 0;
1435 SERVER_START_REQ( create_snapshot
)
1437 req
->flags
= SNAP_PROCESS
| SNAP_THREAD
;
1438 req
->attributes
= 0;
1439 if (!(ret
= wine_server_call( req
)))
1440 hSnap
= wine_server_ptr_handle( reply
->handle
);
1444 while (ret
== STATUS_SUCCESS
)
1446 SERVER_START_REQ( next_process
)
1448 req
->handle
= wine_server_obj_handle( hSnap
);
1449 req
->reset
= (len
== 0);
1450 wine_server_set_reply( req
, procname
, sizeof(procname
)-sizeof(WCHAR
) );
1451 if (!(ret
= wine_server_call( req
)))
1453 /* Make sure procname is 0 terminated */
1454 procname
[wine_server_reply_size(reply
) / sizeof(WCHAR
)] = 0;
1456 /* Get only the executable name, not the path */
1457 if ((exename
= strrchrW(procname
, '\\')) != NULL
) exename
++;
1458 else exename
= procname
;
1460 wlen
= (strlenW(exename
) + 1) * sizeof(WCHAR
);
1462 procstructlen
= sizeof(*spi
) + wlen
+ ((reply
->threads
- 1) * sizeof(SYSTEM_THREAD_INFORMATION
));
1464 if (Length
>= len
+ procstructlen
)
1466 /* ftCreationTime, ftUserTime, ftKernelTime;
1467 * vmCounters, ioCounters
1470 memset(spi
, 0, sizeof(*spi
));
1472 spi
->NextEntryOffset
= procstructlen
- wlen
;
1473 spi
->dwThreadCount
= reply
->threads
;
1475 /* spi->pszProcessName will be set later on */
1477 spi
->dwBasePriority
= reply
->priority
;
1478 spi
->UniqueProcessId
= UlongToHandle(reply
->pid
);
1479 spi
->ParentProcessId
= UlongToHandle(reply
->ppid
);
1480 spi
->HandleCount
= reply
->handles
;
1482 /* spi->ti will be set later on */
1484 len
+= procstructlen
;
1486 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1491 if (ret
!= STATUS_SUCCESS
)
1493 if (ret
== STATUS_NO_MORE_FILES
) ret
= STATUS_SUCCESS
;
1496 else /* Length is already checked for */
1500 /* set thread info */
1502 while (ret
== STATUS_SUCCESS
)
1504 SERVER_START_REQ( next_thread
)
1506 req
->handle
= wine_server_obj_handle( hSnap
);
1507 req
->reset
= (j
== 0);
1508 if (!(ret
= wine_server_call( req
)))
1511 if (UlongToHandle(reply
->pid
) == spi
->UniqueProcessId
)
1513 /* ftKernelTime, ftUserTime, ftCreateTime;
1514 * dwTickCount, dwStartAddress
1517 memset(&spi
->ti
[i
], 0, sizeof(spi
->ti
));
1519 spi
->ti
[i
].CreateTime
.QuadPart
= 0xdeadbeef;
1520 spi
->ti
[i
].ClientId
.UniqueProcess
= UlongToHandle(reply
->pid
);
1521 spi
->ti
[i
].ClientId
.UniqueThread
= UlongToHandle(reply
->tid
);
1522 spi
->ti
[i
].dwCurrentPriority
= reply
->base_pri
+ reply
->delta_pri
;
1523 spi
->ti
[i
].dwBasePriority
= reply
->base_pri
;
1530 if (ret
== STATUS_NO_MORE_FILES
) ret
= STATUS_SUCCESS
;
1532 /* now append process name */
1533 spi
->ProcessName
.Buffer
= (WCHAR
*)((char*)spi
+ spi
->NextEntryOffset
);
1534 spi
->ProcessName
.Length
= wlen
- sizeof(WCHAR
);
1535 spi
->ProcessName
.MaximumLength
= wlen
;
1536 memcpy( spi
->ProcessName
.Buffer
, exename
, wlen
);
1537 spi
->NextEntryOffset
+= wlen
;
1540 spi
= (SYSTEM_PROCESS_INFORMATION
*)((char*)spi
+ spi
->NextEntryOffset
);
1543 if (ret
== STATUS_SUCCESS
&& last
) last
->NextEntryOffset
= 0;
1544 if (hSnap
) NtClose(hSnap
);
1547 case SystemProcessorPerformanceInformation
:
1549 SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
*sppi
= NULL
;
1550 unsigned int cpus
= 0;
1551 int out_cpus
= Length
/ sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
);
1556 ret
= STATUS_INFO_LENGTH_MISMATCH
;
1562 processor_cpu_load_info_data_t
*pinfo
;
1563 mach_msg_type_number_t info_count
;
1565 if (host_processor_info (mach_host_self (),
1566 PROCESSOR_CPU_LOAD_INFO
,
1568 (processor_info_array_t
*)&pinfo
,
1572 cpus
= min(cpus
,out_cpus
);
1573 len
= sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
) * cpus
;
1574 sppi
= RtlAllocateHeap(GetProcessHeap(), 0,len
);
1575 for (i
= 0; i
< cpus
; i
++)
1577 sppi
[i
].IdleTime
.QuadPart
= pinfo
[i
].cpu_ticks
[CPU_STATE_IDLE
];
1578 sppi
[i
].KernelTime
.QuadPart
= pinfo
[i
].cpu_ticks
[CPU_STATE_SYSTEM
];
1579 sppi
[i
].UserTime
.QuadPart
= pinfo
[i
].cpu_ticks
[CPU_STATE_USER
];
1581 vm_deallocate (mach_task_self (), (vm_address_t
) pinfo
, info_count
* sizeof(natural_t
));
1586 FILE *cpuinfo
= fopen("/proc/stat", "r");
1589 unsigned usr
,nice
,sys
;
1595 /* first line is combined usage */
1596 if (fgets(line
,255,cpuinfo
))
1597 count
= sscanf(line
, "%s %u %u %u %lu", name
, &usr
, &nice
,
1601 /* we set this up in the for older non-smp enabled kernels */
1602 if (count
== 5 && strcmp(name
, "cpu") == 0)
1604 sppi
= RtlAllocateHeap(GetProcessHeap(), 0,
1605 sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
));
1606 sppi
->IdleTime
.QuadPart
= idle
;
1607 sppi
->KernelTime
.QuadPart
= sys
;
1608 sppi
->UserTime
.QuadPart
= usr
;
1610 len
= sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
);
1615 if (fgets(line
, 255, cpuinfo
))
1616 count
= sscanf(line
, "%s %u %u %u %lu", name
, &usr
,
1617 &nice
, &sys
, &idle
);
1620 if (count
== 5 && strncmp(name
, "cpu", 3)==0)
1623 if (name
[3]=='0') /* first cpu */
1625 sppi
->IdleTime
.QuadPart
= idle
;
1626 sppi
->KernelTime
.QuadPart
= sys
;
1627 sppi
->UserTime
.QuadPart
= usr
;
1631 len
= sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
) * (cpus
+1);
1632 sppi
= RtlReAllocateHeap(GetProcessHeap(), 0, sppi
, len
);
1633 sppi
[cpus
].IdleTime
.QuadPart
= idle
;
1634 sppi
[cpus
].KernelTime
.QuadPart
= sys
;
1635 sppi
[cpus
].UserTime
.QuadPart
= usr
;
1641 } while (out_cpus
> 0);
1651 cpus
= min(NtCurrentTeb()->Peb
->NumberOfProcessors
, out_cpus
);
1652 len
= sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
) * cpus
;
1653 sppi
= RtlAllocateHeap(GetProcessHeap(), 0, len
);
1654 FIXME("stub info_class SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION\n");
1655 /* many programs expect these values to change so fake change */
1656 for (n
= 0; n
< cpus
; n
++)
1658 sppi
[n
].KernelTime
.QuadPart
= 1 * i
;
1659 sppi
[n
].UserTime
.QuadPart
= 2 * i
;
1660 sppi
[n
].IdleTime
.QuadPart
= 3 * i
;
1667 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1668 else memcpy( SystemInformation
, sppi
, len
);
1670 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1672 RtlFreeHeap(GetProcessHeap(),0,sppi
);
1675 case SystemModuleInformation
:
1676 /* FIXME: should be system-wide */
1677 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1678 else ret
= LdrQueryProcessModuleInformation( SystemInformation
, Length
, &len
);
1680 case SystemHandleInformation
:
1682 SYSTEM_HANDLE_INFORMATION shi
;
1684 memset(&shi
, 0, sizeof(shi
));
1689 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1690 else memcpy( SystemInformation
, &shi
, len
);
1692 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1693 FIXME("info_class SYSTEM_HANDLE_INFORMATION\n");
1696 case SystemCacheInformation
:
1698 SYSTEM_CACHE_INFORMATION sci
;
1700 memset(&sci
, 0, sizeof(sci
)); /* FIXME */
1705 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1706 else memcpy( SystemInformation
, &sci
, len
);
1708 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1709 FIXME("info_class SYSTEM_CACHE_INFORMATION\n");
1712 case SystemInterruptInformation
:
1714 SYSTEM_INTERRUPT_INFORMATION sii
;
1716 memset(&sii
, 0, sizeof(sii
));
1721 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1722 else memcpy( SystemInformation
, &sii
, len
);
1724 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1725 FIXME("info_class SYSTEM_INTERRUPT_INFORMATION\n");
1728 case SystemKernelDebuggerInformation
:
1730 SYSTEM_KERNEL_DEBUGGER_INFORMATION skdi
;
1732 skdi
.DebuggerEnabled
= FALSE
;
1733 skdi
.DebuggerNotPresent
= TRUE
;
1738 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1739 else memcpy( SystemInformation
, &skdi
, len
);
1741 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1744 case SystemRegistryQuotaInformation
:
1746 /* Something to do with the size of the registry *
1747 * Since we don't have a size limitation, fake it *
1748 * This is almost certainly wrong. *
1749 * This sets each of the three words in the struct to 32 MB, *
1750 * which is enough to make the IE 5 installer happy. */
1751 SYSTEM_REGISTRY_QUOTA_INFORMATION srqi
;
1753 srqi
.RegistryQuotaAllowed
= 0x2000000;
1754 srqi
.RegistryQuotaUsed
= 0x200000;
1755 srqi
.Reserved1
= (void*)0x200000;
1760 if (!SystemInformation
) ret
= STATUS_ACCESS_VIOLATION
;
1763 FIXME("SystemRegistryQuotaInformation: faking max registry size of 32 MB\n");
1764 memcpy( SystemInformation
, &srqi
, len
);
1767 else ret
= STATUS_INFO_LENGTH_MISMATCH
;
1771 FIXME("(0x%08x,%p,0x%08x,%p) stub\n",
1772 SystemInformationClass
,SystemInformation
,Length
,ResultLength
);
1774 /* Several Information Classes are not implemented on Windows and return 2 different values
1775 * STATUS_NOT_IMPLEMENTED or STATUS_INVALID_INFO_CLASS
1776 * in 95% of the cases it's STATUS_INVALID_INFO_CLASS, so use this as the default
1778 ret
= STATUS_INVALID_INFO_CLASS
;
1781 if (ResultLength
) *ResultLength
= len
;
1786 /******************************************************************************
1787 * NtSetSystemInformation [NTDLL.@]
1788 * ZwSetSystemInformation [NTDLL.@]
1790 NTSTATUS WINAPI
NtSetSystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass
, PVOID SystemInformation
, ULONG Length
)
1792 FIXME("(0x%08x,%p,0x%08x) stub\n",SystemInformationClass
,SystemInformation
,Length
);
1793 return STATUS_SUCCESS
;
1796 /******************************************************************************
1797 * NtCreatePagingFile [NTDLL.@]
1798 * ZwCreatePagingFile [NTDLL.@]
1800 NTSTATUS WINAPI
NtCreatePagingFile(
1801 PUNICODE_STRING PageFileName
,
1802 PLARGE_INTEGER MinimumSize
,
1803 PLARGE_INTEGER MaximumSize
,
1804 PLARGE_INTEGER ActualSize
)
1806 FIXME("(%p %p %p %p) stub\n", PageFileName
, MinimumSize
, MaximumSize
, ActualSize
);
1807 return STATUS_SUCCESS
;
1810 /******************************************************************************
1811 * NtDisplayString [NTDLL.@]
1813 * writes a string to the nt-textmode screen eg. during startup
1815 NTSTATUS WINAPI
NtDisplayString ( PUNICODE_STRING string
)
1820 if (!(ret
= RtlUnicodeStringToAnsiString( &stringA
, string
, TRUE
)))
1822 MESSAGE( "%.*s", stringA
.Length
, stringA
.Buffer
);
1823 RtlFreeAnsiString( &stringA
);
1828 /******************************************************************************
1829 * NtInitiatePowerAction [NTDLL.@]
1832 NTSTATUS WINAPI
NtInitiatePowerAction(
1833 IN POWER_ACTION SystemAction
,
1834 IN SYSTEM_POWER_STATE MinSystemState
,
1836 IN BOOLEAN Asynchronous
)
1838 FIXME("(%d,%d,0x%08x,%d),stub\n",
1839 SystemAction
,MinSystemState
,Flags
,Asynchronous
);
1840 return STATUS_NOT_IMPLEMENTED
;
1844 /******************************************************************************
1845 * NtPowerInformation [NTDLL.@]
1848 NTSTATUS WINAPI
NtPowerInformation(
1849 IN POWER_INFORMATION_LEVEL InformationLevel
,
1850 IN PVOID lpInputBuffer
,
1851 IN ULONG nInputBufferSize
,
1852 IN PVOID lpOutputBuffer
,
1853 IN ULONG nOutputBufferSize
)
1855 TRACE("(%d,%p,%d,%p,%d)\n",
1856 InformationLevel
,lpInputBuffer
,nInputBufferSize
,lpOutputBuffer
,nOutputBufferSize
);
1857 switch(InformationLevel
) {
1858 case SystemPowerCapabilities
: {
1859 PSYSTEM_POWER_CAPABILITIES PowerCaps
= lpOutputBuffer
;
1860 FIXME("semi-stub: SystemPowerCapabilities\n");
1861 if (nOutputBufferSize
< sizeof(SYSTEM_POWER_CAPABILITIES
))
1862 return STATUS_BUFFER_TOO_SMALL
;
1863 /* FIXME: These values are based off a native XP desktop, should probably use APM/ACPI to get the 'real' values */
1864 PowerCaps
->PowerButtonPresent
= TRUE
;
1865 PowerCaps
->SleepButtonPresent
= FALSE
;
1866 PowerCaps
->LidPresent
= FALSE
;
1867 PowerCaps
->SystemS1
= TRUE
;
1868 PowerCaps
->SystemS2
= FALSE
;
1869 PowerCaps
->SystemS3
= FALSE
;
1870 PowerCaps
->SystemS4
= TRUE
;
1871 PowerCaps
->SystemS5
= TRUE
;
1872 PowerCaps
->HiberFilePresent
= TRUE
;
1873 PowerCaps
->FullWake
= TRUE
;
1874 PowerCaps
->VideoDimPresent
= FALSE
;
1875 PowerCaps
->ApmPresent
= FALSE
;
1876 PowerCaps
->UpsPresent
= FALSE
;
1877 PowerCaps
->ThermalControl
= FALSE
;
1878 PowerCaps
->ProcessorThrottle
= FALSE
;
1879 PowerCaps
->ProcessorMinThrottle
= 100;
1880 PowerCaps
->ProcessorMaxThrottle
= 100;
1881 PowerCaps
->DiskSpinDown
= TRUE
;
1882 PowerCaps
->SystemBatteriesPresent
= FALSE
;
1883 PowerCaps
->BatteriesAreShortTerm
= FALSE
;
1884 PowerCaps
->BatteryScale
[0].Granularity
= 0;
1885 PowerCaps
->BatteryScale
[0].Capacity
= 0;
1886 PowerCaps
->BatteryScale
[1].Granularity
= 0;
1887 PowerCaps
->BatteryScale
[1].Capacity
= 0;
1888 PowerCaps
->BatteryScale
[2].Granularity
= 0;
1889 PowerCaps
->BatteryScale
[2].Capacity
= 0;
1890 PowerCaps
->AcOnLineWake
= PowerSystemUnspecified
;
1891 PowerCaps
->SoftLidWake
= PowerSystemUnspecified
;
1892 PowerCaps
->RtcWake
= PowerSystemSleeping1
;
1893 PowerCaps
->MinDeviceWakeState
= PowerSystemUnspecified
;
1894 PowerCaps
->DefaultLowLatencyWake
= PowerSystemUnspecified
;
1895 return STATUS_SUCCESS
;
1897 case SystemExecutionState
: {
1898 PULONG ExecutionState
= lpOutputBuffer
;
1899 WARN("semi-stub: SystemExecutionState\n"); /* Needed for .NET Framework, but using a FIXME is really noisy. */
1900 if (lpInputBuffer
!= NULL
)
1901 return STATUS_INVALID_PARAMETER
;
1902 /* FIXME: The actual state should be the value set by SetThreadExecutionState which is not currently implemented. */
1903 *ExecutionState
= ES_USER_PRESENT
;
1904 return STATUS_SUCCESS
;
1906 case ProcessorInformation
: {
1907 PPROCESSOR_POWER_INFORMATION cpu_power
= lpOutputBuffer
;
1909 WARN("semi-stub: ProcessorInformation\n");
1910 if (nOutputBufferSize
< sizeof(PROCESSOR_POWER_INFORMATION
))
1911 return STATUS_BUFFER_TOO_SMALL
;
1912 cpu_power
->Number
= NtCurrentTeb()->Peb
->NumberOfProcessors
;
1913 cpu_power
->MaxMhz
= cpuHz
/ 1000000;
1914 cpu_power
->CurrentMhz
= cpuHz
/ 1000000;
1915 cpu_power
->MhzLimit
= cpuHz
/ 1000000;
1916 cpu_power
->MaxIdleState
= 0; /* FIXME */
1917 cpu_power
->CurrentIdleState
= 0; /* FIXME */
1918 return STATUS_SUCCESS
;
1921 /* FIXME: Needed by .NET Framework */
1922 WARN("Unimplemented NtPowerInformation action: %d\n", InformationLevel
);
1923 return STATUS_NOT_IMPLEMENTED
;
1927 /******************************************************************************
1928 * NtShutdownSystem [NTDLL.@]
1931 NTSTATUS WINAPI
NtShutdownSystem(SHUTDOWN_ACTION Action
)
1933 FIXME("%d\n",Action
);
1934 return STATUS_SUCCESS
;
1937 /******************************************************************************
1938 * NtAllocateLocallyUniqueId (NTDLL.@)
1940 NTSTATUS WINAPI
NtAllocateLocallyUniqueId(PLUID Luid
)
1944 TRACE("%p\n", Luid
);
1947 return STATUS_ACCESS_VIOLATION
;
1949 SERVER_START_REQ( allocate_locally_unique_id
)
1951 status
= wine_server_call( req
);
1954 Luid
->LowPart
= reply
->luid
.low_part
;
1955 Luid
->HighPart
= reply
->luid
.high_part
;
1963 /******************************************************************************
1964 * VerSetConditionMask (NTDLL.@)
1966 ULONGLONG WINAPI
VerSetConditionMask( ULONGLONG dwlConditionMask
, DWORD dwTypeBitMask
,
1967 BYTE dwConditionMask
)
1969 if(dwTypeBitMask
== 0)
1970 return dwlConditionMask
;
1971 dwConditionMask
&= 0x07;
1972 if(dwConditionMask
== 0)
1973 return dwlConditionMask
;
1975 if(dwTypeBitMask
& VER_PRODUCT_TYPE
)
1976 dwlConditionMask
|= dwConditionMask
<< 7*3;
1977 else if (dwTypeBitMask
& VER_SUITENAME
)
1978 dwlConditionMask
|= dwConditionMask
<< 6*3;
1979 else if (dwTypeBitMask
& VER_SERVICEPACKMAJOR
)
1980 dwlConditionMask
|= dwConditionMask
<< 5*3;
1981 else if (dwTypeBitMask
& VER_SERVICEPACKMINOR
)
1982 dwlConditionMask
|= dwConditionMask
<< 4*3;
1983 else if (dwTypeBitMask
& VER_PLATFORMID
)
1984 dwlConditionMask
|= dwConditionMask
<< 3*3;
1985 else if (dwTypeBitMask
& VER_BUILDNUMBER
)
1986 dwlConditionMask
|= dwConditionMask
<< 2*3;
1987 else if (dwTypeBitMask
& VER_MAJORVERSION
)
1988 dwlConditionMask
|= dwConditionMask
<< 1*3;
1989 else if (dwTypeBitMask
& VER_MINORVERSION
)
1990 dwlConditionMask
|= dwConditionMask
<< 0*3;
1991 return dwlConditionMask
;
1994 /******************************************************************************
1995 * NtAccessCheckAndAuditAlarm (NTDLL.@)
1996 * ZwAccessCheckAndAuditAlarm (NTDLL.@)
1998 NTSTATUS WINAPI
NtAccessCheckAndAuditAlarm(PUNICODE_STRING SubsystemName
, HANDLE HandleId
, PUNICODE_STRING ObjectTypeName
,
1999 PUNICODE_STRING ObjectName
, PSECURITY_DESCRIPTOR SecurityDescriptor
,
2000 ACCESS_MASK DesiredAccess
, PGENERIC_MAPPING GenericMapping
, BOOLEAN ObjectCreation
,
2001 PACCESS_MASK GrantedAccess
, PBOOLEAN AccessStatus
, PBOOLEAN GenerateOnClose
)
2003 FIXME("(%s, %p, %s, %p, 0x%08x, %p, %d, %p, %p, %p), stub\n", debugstr_us(SubsystemName
), HandleId
,
2004 debugstr_us(ObjectTypeName
), SecurityDescriptor
, DesiredAccess
, GenericMapping
, ObjectCreation
,
2005 GrantedAccess
, AccessStatus
, GenerateOnClose
);
2007 return STATUS_NOT_IMPLEMENTED
;
2010 /******************************************************************************
2011 * NtSystemDebugControl (NTDLL.@)
2012 * ZwSystemDebugControl (NTDLL.@)
2014 NTSTATUS WINAPI
NtSystemDebugControl(SYSDBG_COMMAND command
, PVOID inbuffer
, ULONG inbuflength
, PVOID outbuffer
,
2015 ULONG outbuflength
, PULONG retlength
)
2017 FIXME("(%d, %p, %d, %p, %d, %p), stub\n", command
, inbuffer
, inbuflength
, outbuffer
, outbuflength
, retlength
);
2019 return STATUS_NOT_IMPLEMENTED
;