1998-11-01 15:00:21 +01:00
|
|
|
/*
|
|
|
|
* NT basis DLL
|
2002-06-01 01:06:46 +02:00
|
|
|
*
|
1998-11-01 15:00:21 +01:00
|
|
|
* This file contains the Nt* API functions of NTDLL.DLL.
|
2000-12-13 22:28:15 +01:00
|
|
|
* In the original ntdll.dll they all seem to just call int 0x2e (down to the NTOSKRNL)
|
1998-11-01 15:00:21 +01:00
|
|
|
*
|
|
|
|
* Copyright 1996-1998 Marcus Meissner
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
1998-11-01 15:00:21 +01:00
|
|
|
*/
|
|
|
|
|
2009-09-15 21:38:07 +02:00
|
|
|
#include "config.h"
|
|
|
|
#include "wine/port.h"
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_PARAM_H
|
|
|
|
# include <sys/param.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_SYSCTL_H
|
|
|
|
# include <sys/sysctl.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_MACHINE_CPU_H
|
|
|
|
# include <machine/cpu.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_MACH_MACHINE_H
|
|
|
|
# include <mach/machine.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <string.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
1999-06-12 16:55:11 +02:00
|
|
|
#include <stdio.h>
|
1998-11-01 15:00:21 +01:00
|
|
|
#include <stdlib.h>
|
2009-09-15 21:38:07 +02:00
|
|
|
#ifdef HAVE_SYS_TIME_H
|
|
|
|
# include <sys/time.h>
|
|
|
|
#endif
|
1998-11-01 15:00:21 +01:00
|
|
|
#include <time.h>
|
2005-11-28 17:32:54 +01:00
|
|
|
|
2007-09-18 00:39:43 +02:00
|
|
|
#define NONAMELESSUNION
|
2005-11-28 17:32:54 +01:00
|
|
|
#include "ntstatus.h"
|
|
|
|
#define WIN32_NO_STATUS
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2005-06-16 11:44:39 +02:00
|
|
|
#include "wine/unicode.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
2002-09-13 00:07:02 +02:00
|
|
|
#include "winternl.h"
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
#include "ntdll_misc.h"
|
2001-07-19 02:39:09 +02:00
|
|
|
#include "wine/server.h"
|
2009-09-15 21:38:07 +02:00
|
|
|
#include "ddk/wdm.h"
|
1999-03-09 18:47:51 +01:00
|
|
|
|
2008-10-17 22:25:30 +02:00
|
|
|
#ifdef __APPLE__
|
|
|
|
#include <mach/mach_init.h>
|
|
|
|
#include <mach/mach_host.h>
|
|
|
|
#include <mach/vm_map.h>
|
|
|
|
#endif
|
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
/*
|
|
|
|
* Token
|
|
|
|
*/
|
|
|
|
|
1998-11-01 15:00:21 +01:00
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtDuplicateToken [NTDLL.@]
|
2001-07-11 20:56:41 +02:00
|
|
|
* ZwDuplicateToken [NTDLL.@]
|
1998-11-01 15:00:21 +01:00
|
|
|
*/
|
1999-03-09 18:47:51 +01:00
|
|
|
NTSTATUS WINAPI NtDuplicateToken(
|
|
|
|
IN HANDLE ExistingToken,
|
|
|
|
IN ACCESS_MASK DesiredAccess,
|
|
|
|
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
|
|
|
IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
|
|
|
|
IN TOKEN_TYPE TokenType,
|
|
|
|
OUT PHANDLE NewToken)
|
1999-02-13 08:35:31 +01:00
|
|
|
{
|
2005-02-11 12:52:06 +01:00
|
|
|
NTSTATUS status;
|
|
|
|
|
2009-02-16 11:46:44 +01:00
|
|
|
TRACE("(%p,0x%08x,%s,0x%08x,0x%08x,%p)\n",
|
|
|
|
ExistingToken, DesiredAccess, debugstr_ObjectAttributes(ObjectAttributes),
|
|
|
|
ImpersonationLevel, TokenType, NewToken);
|
2005-02-11 12:52:06 +01:00
|
|
|
|
2007-07-12 16:32:00 +02:00
|
|
|
if (ObjectAttributes && ObjectAttributes->SecurityQualityOfService)
|
|
|
|
{
|
|
|
|
SECURITY_QUALITY_OF_SERVICE *SecurityQOS = ObjectAttributes->SecurityQualityOfService;
|
|
|
|
TRACE("ObjectAttributes->SecurityQualityOfService = {%d, %d, %d, %s}\n",
|
|
|
|
SecurityQOS->Length, SecurityQOS->ImpersonationLevel,
|
|
|
|
SecurityQOS->ContextTrackingMode,
|
|
|
|
SecurityQOS->EffectiveOnly ? "TRUE" : "FALSE");
|
|
|
|
ImpersonationLevel = SecurityQOS->ImpersonationLevel;
|
|
|
|
}
|
|
|
|
|
2005-02-11 12:52:06 +01:00
|
|
|
SERVER_START_REQ( duplicate_token )
|
|
|
|
{
|
2008-12-08 16:05:17 +01:00
|
|
|
req->handle = wine_server_obj_handle( ExistingToken );
|
2005-12-09 12:17:19 +01:00
|
|
|
req->access = DesiredAccess;
|
|
|
|
req->attributes = ObjectAttributes ? ObjectAttributes->Attributes : 0;
|
|
|
|
req->primary = (TokenType == TokenPrimary);
|
2005-02-11 12:52:06 +01:00
|
|
|
req->impersonation_level = ImpersonationLevel;
|
|
|
|
status = wine_server_call( req );
|
2008-12-08 16:05:17 +01:00
|
|
|
if (!status) *NewToken = wine_server_ptr_handle( reply->new_handle );
|
2005-02-11 12:52:06 +01:00
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
|
|
|
|
return status;
|
1998-11-01 15:00:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtOpenProcessToken [NTDLL.@]
|
2001-07-11 20:56:41 +02:00
|
|
|
* ZwOpenProcessToken [NTDLL.@]
|
1998-11-01 15:00:21 +01:00
|
|
|
*/
|
1999-03-09 18:47:51 +01:00
|
|
|
NTSTATUS WINAPI NtOpenProcessToken(
|
|
|
|
HANDLE ProcessHandle,
|
2002-06-01 01:06:46 +02:00
|
|
|
DWORD DesiredAccess,
|
|
|
|
HANDLE *TokenHandle)
|
2008-09-04 21:57:13 +02:00
|
|
|
{
|
|
|
|
return NtOpenProcessTokenEx( ProcessHandle, DesiredAccess, 0, TokenHandle );
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* NtOpenProcessTokenEx [NTDLL.@]
|
|
|
|
* ZwOpenProcessTokenEx [NTDLL.@]
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI NtOpenProcessTokenEx( HANDLE process, DWORD access, DWORD attributes,
|
|
|
|
HANDLE *handle )
|
1999-02-13 08:35:31 +01:00
|
|
|
{
|
2003-07-24 02:07:00 +02:00
|
|
|
NTSTATUS ret;
|
|
|
|
|
2008-09-04 21:57:13 +02:00
|
|
|
TRACE("(%p,0x%08x,0x%08x,%p)\n", process, access, attributes, handle);
|
2003-07-24 02:07:00 +02:00
|
|
|
|
|
|
|
SERVER_START_REQ( open_token )
|
|
|
|
{
|
2008-12-08 16:05:17 +01:00
|
|
|
req->handle = wine_server_obj_handle( process );
|
2008-09-04 21:57:13 +02:00
|
|
|
req->access = access;
|
|
|
|
req->attributes = attributes;
|
2005-12-09 12:17:19 +01:00
|
|
|
req->flags = 0;
|
2003-07-24 02:07:00 +02:00
|
|
|
ret = wine_server_call( req );
|
2008-12-08 16:05:17 +01:00
|
|
|
if (!ret) *handle = wine_server_ptr_handle( reply->token );
|
2003-07-24 02:07:00 +02:00
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return ret;
|
1998-11-01 15:00:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtOpenThreadToken [NTDLL.@]
|
2001-07-11 20:56:41 +02:00
|
|
|
* ZwOpenThreadToken [NTDLL.@]
|
1998-11-01 15:00:21 +01:00
|
|
|
*/
|
1999-03-09 18:47:51 +01:00
|
|
|
NTSTATUS WINAPI NtOpenThreadToken(
|
|
|
|
HANDLE ThreadHandle,
|
2002-06-01 01:06:46 +02:00
|
|
|
DWORD DesiredAccess,
|
1999-03-09 18:47:51 +01:00
|
|
|
BOOLEAN OpenAsSelf,
|
2002-06-01 01:06:46 +02:00
|
|
|
HANDLE *TokenHandle)
|
2008-09-04 21:57:13 +02:00
|
|
|
{
|
|
|
|
return NtOpenThreadTokenEx( ThreadHandle, DesiredAccess, OpenAsSelf, 0, TokenHandle );
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* NtOpenThreadTokenEx [NTDLL.@]
|
|
|
|
* ZwOpenThreadTokenEx [NTDLL.@]
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI NtOpenThreadTokenEx( HANDLE thread, DWORD access, BOOLEAN as_self, DWORD attributes,
|
|
|
|
HANDLE *handle )
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2003-07-24 02:07:00 +02:00
|
|
|
NTSTATUS ret;
|
|
|
|
|
2008-09-04 21:57:13 +02:00
|
|
|
TRACE("(%p,0x%08x,%u,0x%08x,%p)\n", thread, access, as_self, attributes, handle );
|
2003-07-24 02:07:00 +02:00
|
|
|
|
|
|
|
SERVER_START_REQ( open_token )
|
|
|
|
{
|
2008-12-08 16:05:17 +01:00
|
|
|
req->handle = wine_server_obj_handle( thread );
|
2008-09-04 21:57:13 +02:00
|
|
|
req->access = access;
|
|
|
|
req->attributes = attributes;
|
2005-12-09 12:17:19 +01:00
|
|
|
req->flags = OPEN_TOKEN_THREAD;
|
2008-09-04 21:57:13 +02:00
|
|
|
if (as_self) req->flags |= OPEN_TOKEN_AS_SELF;
|
2003-07-24 02:07:00 +02:00
|
|
|
ret = wine_server_call( req );
|
2008-12-08 16:05:17 +01:00
|
|
|
if (!ret) *handle = wine_server_ptr_handle( reply->token );
|
2003-07-24 02:07:00 +02:00
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
|
|
|
|
return ret;
|
1998-11-01 15:00:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtAdjustPrivilegesToken [NTDLL.@]
|
2004-08-30 20:36:24 +02:00
|
|
|
* ZwAdjustPrivilegesToken [NTDLL.@]
|
1999-02-13 08:35:31 +01:00
|
|
|
*
|
|
|
|
* FIXME: parameters unsafe
|
1998-11-01 15:00:21 +01:00
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI NtAdjustPrivilegesToken(
|
1999-02-26 12:11:13 +01:00
|
|
|
IN HANDLE TokenHandle,
|
1999-02-19 17:29:05 +01:00
|
|
|
IN BOOLEAN DisableAllPrivileges,
|
1999-02-13 08:35:31 +01:00
|
|
|
IN PTOKEN_PRIVILEGES NewState,
|
|
|
|
IN DWORD BufferLength,
|
|
|
|
OUT PTOKEN_PRIVILEGES PreviousState,
|
|
|
|
OUT PDWORD ReturnLength)
|
|
|
|
{
|
2005-02-11 12:52:06 +01:00
|
|
|
NTSTATUS ret;
|
|
|
|
|
2006-10-16 13:49:06 +02:00
|
|
|
TRACE("(%p,0x%08x,%p,0x%08x,%p,%p)\n",
|
2005-02-11 12:52:06 +01:00
|
|
|
TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength);
|
|
|
|
|
|
|
|
SERVER_START_REQ( adjust_token_privileges )
|
|
|
|
{
|
2008-12-08 16:05:17 +01:00
|
|
|
req->handle = wine_server_obj_handle( TokenHandle );
|
2005-02-11 12:52:06 +01:00
|
|
|
req->disable_all = DisableAllPrivileges;
|
|
|
|
req->get_modified_state = (PreviousState != NULL);
|
|
|
|
if (!DisableAllPrivileges)
|
|
|
|
{
|
2008-07-11 11:41:42 +02:00
|
|
|
wine_server_add_data( req, NewState->Privileges,
|
2005-02-11 12:52:06 +01:00
|
|
|
NewState->PrivilegeCount * sizeof(NewState->Privileges[0]) );
|
|
|
|
}
|
|
|
|
if (PreviousState && BufferLength >= FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ))
|
2008-07-11 11:41:42 +02:00
|
|
|
wine_server_set_reply( req, PreviousState->Privileges,
|
2005-02-11 12:52:06 +01:00
|
|
|
BufferLength - FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ) );
|
|
|
|
ret = wine_server_call( req );
|
|
|
|
if (PreviousState)
|
|
|
|
{
|
|
|
|
*ReturnLength = reply->len + FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges );
|
|
|
|
PreviousState->PrivilegeCount = reply->len / sizeof(LUID_AND_ATTRIBUTES);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
|
|
|
|
return ret;
|
1998-11-01 15:00:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* NtQueryInformationToken [NTDLL.@]
|
2001-07-11 20:56:41 +02:00
|
|
|
* ZwQueryInformationToken [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
* NOTES
|
|
|
|
* Buffer for TokenUser:
|
|
|
|
* 0x00 TOKEN_USER the PSID field points to the SID
|
|
|
|
* 0x08 SID
|
|
|
|
*
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI NtQueryInformationToken(
|
|
|
|
HANDLE token,
|
2006-01-12 13:32:09 +01:00
|
|
|
TOKEN_INFORMATION_CLASS tokeninfoclass,
|
|
|
|
PVOID tokeninfo,
|
|
|
|
ULONG tokeninfolength,
|
|
|
|
PULONG retlen )
|
1999-02-13 08:35:31 +01:00
|
|
|
{
|
2006-01-12 13:32:09 +01:00
|
|
|
ULONG len;
|
2005-02-11 12:52:06 +01:00
|
|
|
NTSTATUS status = STATUS_SUCCESS;
|
2000-11-01 22:38:09 +01:00
|
|
|
|
2006-10-16 13:49:06 +02:00
|
|
|
TRACE("(%p,%d,%p,%d,%p)\n",
|
2000-11-01 22:38:09 +01:00
|
|
|
token,tokeninfoclass,tokeninfo,tokeninfolength,retlen);
|
|
|
|
|
|
|
|
switch (tokeninfoclass)
|
|
|
|
{
|
|
|
|
case TokenSource:
|
|
|
|
len = sizeof(TOKEN_SOURCE);
|
|
|
|
break;
|
|
|
|
case TokenType:
|
|
|
|
len = sizeof (TOKEN_TYPE);
|
|
|
|
break;
|
|
|
|
case TokenImpersonationLevel:
|
2007-02-21 18:10:45 +01:00
|
|
|
len = sizeof(SECURITY_IMPERSONATION_LEVEL);
|
|
|
|
break;
|
2000-11-01 22:38:09 +01:00
|
|
|
case TokenStatistics:
|
2007-09-13 17:47:56 +02:00
|
|
|
len = sizeof(TOKEN_STATISTICS);
|
|
|
|
break;
|
2006-01-12 13:32:09 +01:00
|
|
|
default:
|
|
|
|
len = 0;
|
2000-11-01 22:38:09 +01:00
|
|
|
}
|
1998-11-01 15:00:21 +01:00
|
|
|
|
2006-01-12 13:32:09 +01:00
|
|
|
if (retlen) *retlen = len;
|
2000-11-01 22:38:09 +01:00
|
|
|
|
|
|
|
if (tokeninfolength < len)
|
2003-10-06 23:04:06 +02:00
|
|
|
return STATUS_BUFFER_TOO_SMALL;
|
2000-11-01 22:38:09 +01:00
|
|
|
|
|
|
|
switch (tokeninfoclass)
|
|
|
|
{
|
|
|
|
case TokenUser:
|
2009-11-16 21:11:06 +01:00
|
|
|
SERVER_START_REQ( get_token_sid )
|
2000-11-01 22:38:09 +01:00
|
|
|
{
|
|
|
|
TOKEN_USER * tuser = tokeninfo;
|
2009-03-17 00:12:11 +01:00
|
|
|
PSID sid = tuser + 1;
|
2005-07-18 15:22:55 +02:00
|
|
|
DWORD sid_len = tokeninfolength < sizeof(TOKEN_USER) ? 0 : tokeninfolength - sizeof(TOKEN_USER);
|
|
|
|
|
2008-12-08 16:05:17 +01:00
|
|
|
req->handle = wine_server_obj_handle( token );
|
2009-11-16 21:11:06 +01:00
|
|
|
req->which_sid = tokeninfoclass;
|
2005-07-18 15:22:55 +02:00
|
|
|
wine_server_set_reply( req, sid, sid_len );
|
|
|
|
status = wine_server_call( req );
|
2009-11-16 21:11:06 +01:00
|
|
|
if (retlen) *retlen = reply->sid_len + sizeof(TOKEN_USER);
|
2005-07-18 15:22:55 +02:00
|
|
|
if (status == STATUS_SUCCESS)
|
|
|
|
{
|
|
|
|
tuser->User.Sid = sid;
|
|
|
|
tuser->User.Attributes = 0;
|
|
|
|
}
|
2000-11-01 22:38:09 +01:00
|
|
|
}
|
2005-07-18 15:22:55 +02:00
|
|
|
SERVER_END_REQ;
|
2000-11-01 22:38:09 +01:00
|
|
|
break;
|
|
|
|
case TokenGroups:
|
2006-05-13 17:58:19 +02:00
|
|
|
{
|
|
|
|
char stack_buffer[256];
|
|
|
|
unsigned int server_buf_len = sizeof(stack_buffer);
|
|
|
|
void *buffer = stack_buffer;
|
2009-02-12 09:09:17 +01:00
|
|
|
BOOLEAN need_more_memory;
|
2006-05-13 17:58:19 +02:00
|
|
|
|
|
|
|
/* we cannot work out the size of the server buffer required for the
|
|
|
|
* input size, since there are two factors affecting how much can be
|
|
|
|
* stored in the buffer - number of groups and lengths of sids */
|
|
|
|
do
|
2000-11-01 22:38:09 +01:00
|
|
|
{
|
2009-02-12 09:09:17 +01:00
|
|
|
need_more_memory = FALSE;
|
|
|
|
|
2006-05-13 17:58:19 +02:00
|
|
|
SERVER_START_REQ( get_token_groups )
|
|
|
|
{
|
|
|
|
TOKEN_GROUPS *groups = tokeninfo;
|
2000-11-01 22:38:09 +01:00
|
|
|
|
2008-12-08 16:05:17 +01:00
|
|
|
req->handle = wine_server_obj_handle( token );
|
2006-05-13 17:58:19 +02:00
|
|
|
wine_server_set_reply( req, buffer, server_buf_len );
|
|
|
|
status = wine_server_call( req );
|
|
|
|
if (status == STATUS_BUFFER_TOO_SMALL)
|
|
|
|
{
|
|
|
|
if (buffer == stack_buffer)
|
|
|
|
buffer = RtlAllocateHeap(GetProcessHeap(), 0, reply->user_len);
|
|
|
|
else
|
|
|
|
buffer = RtlReAllocateHeap(GetProcessHeap(), 0, buffer, reply->user_len);
|
|
|
|
if (!buffer) return STATUS_NO_MEMORY;
|
|
|
|
|
|
|
|
server_buf_len = reply->user_len;
|
|
|
|
need_more_memory = TRUE;
|
|
|
|
}
|
|
|
|
else if (status == STATUS_SUCCESS)
|
|
|
|
{
|
|
|
|
struct token_groups *tg = buffer;
|
|
|
|
unsigned int *attr = (unsigned int *)(tg + 1);
|
|
|
|
ULONG i;
|
2009-07-03 13:58:09 +02:00
|
|
|
const int non_sid_portion = (sizeof(struct token_groups) + tg->count * sizeof(unsigned int));
|
2006-05-13 17:58:19 +02:00
|
|
|
SID *sids = (SID *)((char *)tokeninfo + FIELD_OFFSET( TOKEN_GROUPS, Groups[tg->count] ));
|
|
|
|
ULONG needed_bytes = FIELD_OFFSET( TOKEN_GROUPS, Groups[tg->count] ) +
|
|
|
|
reply->user_len - non_sid_portion;
|
|
|
|
|
|
|
|
if (retlen) *retlen = needed_bytes;
|
|
|
|
|
|
|
|
if (needed_bytes <= tokeninfolength)
|
|
|
|
{
|
|
|
|
groups->GroupCount = tg->count;
|
|
|
|
memcpy( sids, (char *)buffer + non_sid_portion,
|
|
|
|
reply->user_len - non_sid_portion );
|
|
|
|
|
|
|
|
for (i = 0; i < tg->count; i++)
|
|
|
|
{
|
|
|
|
groups->Groups[i].Attributes = attr[i];
|
|
|
|
groups->Groups[i].Sid = sids;
|
|
|
|
sids = (SID *)((char *)sids + RtlLengthSid(sids));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else status = STATUS_BUFFER_TOO_SMALL;
|
|
|
|
}
|
|
|
|
else if (retlen) *retlen = 0;
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
} while (need_more_memory);
|
|
|
|
if (buffer != stack_buffer) RtlFreeHeap(GetProcessHeap(), 0, buffer);
|
2000-11-01 22:38:09 +01:00
|
|
|
break;
|
2006-05-13 17:58:19 +02:00
|
|
|
}
|
2004-08-18 00:28:13 +02:00
|
|
|
case TokenPrimaryGroup:
|
2009-11-16 21:11:06 +01:00
|
|
|
SERVER_START_REQ( get_token_sid )
|
2004-08-18 00:28:13 +02:00
|
|
|
{
|
|
|
|
TOKEN_PRIMARY_GROUP *tgroup = tokeninfo;
|
2009-11-16 21:11:06 +01:00
|
|
|
PSID sid = tgroup + 1;
|
|
|
|
DWORD sid_len = tokeninfolength < sizeof(TOKEN_PRIMARY_GROUP) ? 0 : tokeninfolength - sizeof(TOKEN_PRIMARY_GROUP);
|
|
|
|
|
|
|
|
req->handle = wine_server_obj_handle( token );
|
|
|
|
req->which_sid = tokeninfoclass;
|
|
|
|
wine_server_set_reply( req, sid, sid_len );
|
|
|
|
status = wine_server_call( req );
|
|
|
|
if (retlen) *retlen = reply->sid_len + sizeof(TOKEN_PRIMARY_GROUP);
|
|
|
|
if (status == STATUS_SUCCESS)
|
|
|
|
tgroup->PrimaryGroup = sid;
|
2004-08-18 00:28:13 +02:00
|
|
|
}
|
2009-11-16 21:11:06 +01:00
|
|
|
SERVER_END_REQ;
|
2004-08-18 00:28:13 +02:00
|
|
|
break;
|
2000-11-01 22:38:09 +01:00
|
|
|
case TokenPrivileges:
|
2005-02-11 12:52:06 +01:00
|
|
|
SERVER_START_REQ( get_token_privileges )
|
2000-11-01 22:38:09 +01:00
|
|
|
{
|
|
|
|
TOKEN_PRIVILEGES *tpriv = tokeninfo;
|
2008-12-08 16:05:17 +01:00
|
|
|
req->handle = wine_server_obj_handle( token );
|
2005-02-11 12:52:06 +01:00
|
|
|
if (tpriv && tokeninfolength > FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ))
|
2008-07-11 11:41:42 +02:00
|
|
|
wine_server_set_reply( req, tpriv->Privileges, tokeninfolength - FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ) );
|
2005-02-11 12:52:06 +01:00
|
|
|
status = wine_server_call( req );
|
2006-01-12 13:32:09 +01:00
|
|
|
if (retlen) *retlen = FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ) + reply->len;
|
2005-02-11 12:52:06 +01:00
|
|
|
if (tpriv) tpriv->PrivilegeCount = reply->len / sizeof(LUID_AND_ATTRIBUTES);
|
2000-11-01 22:38:09 +01:00
|
|
|
}
|
2005-02-11 12:52:06 +01:00
|
|
|
SERVER_END_REQ;
|
2000-11-01 22:38:09 +01:00
|
|
|
break;
|
2003-12-30 20:17:05 +01:00
|
|
|
case TokenOwner:
|
2009-11-16 21:11:06 +01:00
|
|
|
SERVER_START_REQ( get_token_sid )
|
2003-12-30 20:17:05 +01:00
|
|
|
{
|
2009-11-16 21:11:06 +01:00
|
|
|
TOKEN_OWNER *towner = tokeninfo;
|
|
|
|
PSID sid = towner + 1;
|
|
|
|
DWORD sid_len = tokeninfolength < sizeof(TOKEN_OWNER) ? 0 : tokeninfolength - sizeof(TOKEN_OWNER);
|
|
|
|
|
|
|
|
req->handle = wine_server_obj_handle( token );
|
|
|
|
req->which_sid = tokeninfoclass;
|
|
|
|
wine_server_set_reply( req, sid, sid_len );
|
|
|
|
status = wine_server_call( req );
|
|
|
|
if (retlen) *retlen = reply->sid_len + sizeof(TOKEN_OWNER);
|
|
|
|
if (status == STATUS_SUCCESS)
|
|
|
|
towner->Owner = sid;
|
2003-12-30 20:17:05 +01:00
|
|
|
}
|
2009-11-16 21:11:06 +01:00
|
|
|
SERVER_END_REQ;
|
2003-12-30 20:17:05 +01:00
|
|
|
break;
|
2007-02-21 18:10:45 +01:00
|
|
|
case TokenImpersonationLevel:
|
|
|
|
SERVER_START_REQ( get_token_impersonation_level )
|
|
|
|
{
|
|
|
|
SECURITY_IMPERSONATION_LEVEL *impersonation_level = tokeninfo;
|
2008-12-08 16:05:17 +01:00
|
|
|
req->handle = wine_server_obj_handle( token );
|
2007-02-21 18:10:45 +01:00
|
|
|
status = wine_server_call( req );
|
|
|
|
if (status == STATUS_SUCCESS)
|
|
|
|
*impersonation_level = reply->impersonation_level;
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
break;
|
2007-09-13 17:47:56 +02:00
|
|
|
case TokenStatistics:
|
|
|
|
SERVER_START_REQ( get_token_statistics )
|
|
|
|
{
|
|
|
|
TOKEN_STATISTICS *statistics = tokeninfo;
|
2008-12-08 16:05:17 +01:00
|
|
|
req->handle = wine_server_obj_handle( token );
|
2007-09-13 17:47:56 +02:00
|
|
|
status = wine_server_call( req );
|
|
|
|
if (status == STATUS_SUCCESS)
|
|
|
|
{
|
|
|
|
statistics->TokenId.LowPart = reply->token_id.low_part;
|
|
|
|
statistics->TokenId.HighPart = reply->token_id.high_part;
|
|
|
|
statistics->AuthenticationId.LowPart = 0; /* FIXME */
|
|
|
|
statistics->AuthenticationId.HighPart = 0; /* FIXME */
|
2007-09-18 00:39:43 +02:00
|
|
|
statistics->ExpirationTime.u.HighPart = 0x7fffffff;
|
|
|
|
statistics->ExpirationTime.u.LowPart = 0xffffffff;
|
2007-09-13 17:47:56 +02:00
|
|
|
statistics->TokenType = reply->primary ? TokenPrimary : TokenImpersonation;
|
|
|
|
statistics->ImpersonationLevel = reply->impersonation_level;
|
|
|
|
|
|
|
|
/* kernel information not relevant to us */
|
|
|
|
statistics->DynamicCharged = 0;
|
|
|
|
statistics->DynamicAvailable = 0;
|
|
|
|
|
|
|
|
statistics->GroupCount = reply->group_count;
|
|
|
|
statistics->PrivilegeCount = reply->privilege_count;
|
|
|
|
statistics->ModifiedId.LowPart = reply->modified_id.low_part;
|
|
|
|
statistics->ModifiedId.HighPart = reply->modified_id.high_part;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
break;
|
|
|
|
case TokenType:
|
|
|
|
SERVER_START_REQ( get_token_statistics )
|
|
|
|
{
|
|
|
|
TOKEN_TYPE *token_type = tokeninfo;
|
2008-12-08 16:05:17 +01:00
|
|
|
req->handle = wine_server_obj_handle( token );
|
2007-09-13 17:47:56 +02:00
|
|
|
status = wine_server_call( req );
|
|
|
|
if (status == STATUS_SUCCESS)
|
|
|
|
*token_type = reply->primary ? TokenPrimary : TokenImpersonation;
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
break;
|
2009-04-21 09:53:49 +02:00
|
|
|
case TokenDefaultDacl:
|
|
|
|
SERVER_START_REQ( get_token_default_dacl )
|
|
|
|
{
|
|
|
|
TOKEN_DEFAULT_DACL *default_dacl = tokeninfo;
|
|
|
|
ACL *acl = (ACL *)(default_dacl + 1);
|
|
|
|
DWORD acl_len;
|
|
|
|
|
|
|
|
if (tokeninfolength < sizeof(TOKEN_DEFAULT_DACL)) acl_len = 0;
|
|
|
|
else acl_len = tokeninfolength - sizeof(TOKEN_DEFAULT_DACL);
|
|
|
|
|
|
|
|
req->handle = wine_server_obj_handle( token );
|
|
|
|
wine_server_set_reply( req, acl, acl_len );
|
|
|
|
status = wine_server_call( req );
|
|
|
|
|
|
|
|
if (retlen) *retlen = reply->acl_len + sizeof(TOKEN_DEFAULT_DACL);
|
|
|
|
if (status == STATUS_SUCCESS)
|
|
|
|
{
|
|
|
|
if (reply->acl_len)
|
|
|
|
default_dacl->DefaultDacl = acl;
|
|
|
|
else
|
|
|
|
default_dacl->DefaultDacl = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
break;
|
2004-07-06 21:42:30 +02:00
|
|
|
default:
|
|
|
|
{
|
2006-01-12 13:32:09 +01:00
|
|
|
ERR("Unhandled Token Information class %d!\n", tokeninfoclass);
|
2004-07-06 21:42:30 +02:00
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
|
|
|
}
|
2000-11-01 22:38:09 +01:00
|
|
|
}
|
2005-02-11 12:52:06 +01:00
|
|
|
return status;
|
1998-11-01 15:00:21 +01:00
|
|
|
}
|
|
|
|
|
2004-08-18 00:09:55 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* NtSetInformationToken [NTDLL.@]
|
|
|
|
* ZwSetInformationToken [NTDLL.@]
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI NtSetInformationToken(
|
|
|
|
HANDLE TokenHandle,
|
|
|
|
TOKEN_INFORMATION_CLASS TokenInformationClass,
|
|
|
|
PVOID TokenInformation,
|
|
|
|
ULONG TokenInformationLength)
|
|
|
|
{
|
2009-04-21 09:53:49 +02:00
|
|
|
NTSTATUS ret = STATUS_NOT_IMPLEMENTED;
|
|
|
|
|
|
|
|
TRACE("%p %d %p %u\n", TokenHandle, TokenInformationClass,
|
|
|
|
TokenInformation, TokenInformationLength);
|
|
|
|
|
|
|
|
switch (TokenInformationClass)
|
|
|
|
{
|
|
|
|
case TokenDefaultDacl:
|
|
|
|
if (TokenInformationLength < sizeof(TOKEN_DEFAULT_DACL))
|
|
|
|
{
|
|
|
|
ret = STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!TokenInformation)
|
|
|
|
{
|
|
|
|
ret = STATUS_ACCESS_VIOLATION;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
SERVER_START_REQ( set_token_default_dacl )
|
|
|
|
{
|
|
|
|
ACL *acl = ((TOKEN_DEFAULT_DACL *)TokenInformation)->DefaultDacl;
|
|
|
|
WORD size;
|
|
|
|
|
|
|
|
if (acl) size = acl->AclSize;
|
|
|
|
else size = 0;
|
|
|
|
|
|
|
|
req->handle = wine_server_obj_handle( TokenHandle );
|
|
|
|
wine_server_add_data( req, acl, size );
|
|
|
|
ret = wine_server_call( req );
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
FIXME("unimplemented class %u\n", TokenInformationClass);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
2004-08-18 00:09:55 +02:00
|
|
|
}
|
|
|
|
|
2004-08-30 20:36:24 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* NtAdjustGroupsToken [NTDLL.@]
|
|
|
|
* ZwAdjustGroupsToken [NTDLL.@]
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI NtAdjustGroupsToken(
|
|
|
|
HANDLE TokenHandle,
|
|
|
|
BOOLEAN ResetToDefault,
|
|
|
|
PTOKEN_GROUPS NewState,
|
|
|
|
ULONG BufferLength,
|
|
|
|
PTOKEN_GROUPS PreviousState,
|
|
|
|
PULONG ReturnLength)
|
|
|
|
{
|
2006-10-16 13:49:06 +02:00
|
|
|
FIXME("%p %d %p %u %p %p\n", TokenHandle, ResetToDefault,
|
2004-08-30 20:36:24 +02:00
|
|
|
NewState, BufferLength, PreviousState, ReturnLength);
|
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2005-04-22 23:17:15 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* NtPrivilegeCheck [NTDLL.@]
|
|
|
|
* ZwPrivilegeCheck [NTDLL.@]
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI NtPrivilegeCheck(
|
|
|
|
HANDLE ClientToken,
|
|
|
|
PPRIVILEGE_SET RequiredPrivileges,
|
|
|
|
PBOOLEAN Result)
|
|
|
|
{
|
|
|
|
NTSTATUS status;
|
|
|
|
SERVER_START_REQ( check_token_privileges )
|
|
|
|
{
|
2008-12-08 16:05:17 +01:00
|
|
|
req->handle = wine_server_obj_handle( ClientToken );
|
2005-04-22 23:17:15 +02:00
|
|
|
req->all_required = ((RequiredPrivileges->Control & PRIVILEGE_SET_ALL_NECESSARY) ? TRUE : FALSE);
|
2008-07-11 11:41:42 +02:00
|
|
|
wine_server_add_data( req, RequiredPrivileges->Privilege,
|
2005-04-22 23:17:15 +02:00
|
|
|
RequiredPrivileges->PrivilegeCount * sizeof(RequiredPrivileges->Privilege[0]) );
|
2008-07-11 11:41:42 +02:00
|
|
|
wine_server_set_reply( req, RequiredPrivileges->Privilege,
|
2005-04-22 23:17:15 +02:00
|
|
|
RequiredPrivileges->PrivilegeCount * sizeof(RequiredPrivileges->Privilege[0]) );
|
|
|
|
|
|
|
|
status = wine_server_call( req );
|
|
|
|
|
|
|
|
if (status == STATUS_SUCCESS)
|
|
|
|
*Result = (reply->has_privileges ? TRUE : FALSE);
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
/*
|
|
|
|
* Section
|
1998-11-01 15:00:21 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1998-11-01 15:00:21 +01:00
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtQuerySection [NTDLL.@]
|
1998-11-01 15:00:21 +01:00
|
|
|
*/
|
1999-03-09 18:47:51 +01:00
|
|
|
NTSTATUS WINAPI NtQuerySection(
|
|
|
|
IN HANDLE SectionHandle,
|
2005-06-13 12:03:18 +02:00
|
|
|
IN SECTION_INFORMATION_CLASS SectionInformationClass,
|
1999-03-09 18:47:51 +01:00
|
|
|
OUT PVOID SectionInformation,
|
|
|
|
IN ULONG Length,
|
|
|
|
OUT PULONG ResultLength)
|
1999-02-13 08:35:31 +01:00
|
|
|
{
|
2006-10-16 13:49:06 +02:00
|
|
|
FIXME("(%p,%d,%p,0x%08x,%p) stub!\n",
|
1999-03-09 18:47:51 +01:00
|
|
|
SectionHandle,SectionInformationClass,SectionInformation,Length,ResultLength);
|
1998-11-01 15:00:21 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
/*
|
|
|
|
* ports
|
1998-11-01 15:00:21 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtCreatePort [NTDLL.@]
|
2001-07-11 20:56:41 +02:00
|
|
|
* ZwCreatePort [NTDLL.@]
|
1998-11-01 15:00:21 +01:00
|
|
|
*/
|
2002-12-10 21:04:40 +01:00
|
|
|
NTSTATUS WINAPI NtCreatePort(PHANDLE PortHandle,POBJECT_ATTRIBUTES ObjectAttributes,
|
2005-06-13 12:03:18 +02:00
|
|
|
ULONG MaxConnectInfoLength,ULONG MaxDataLength,PULONG reserved)
|
1999-02-13 08:35:31 +01:00
|
|
|
{
|
2006-10-16 13:49:06 +02:00
|
|
|
FIXME("(%p,%p,%u,%u,%p),stub!\n",PortHandle,ObjectAttributes,
|
2005-06-13 12:03:18 +02:00
|
|
|
MaxConnectInfoLength,MaxDataLength,reserved);
|
2006-05-10 04:18:07 +02:00
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
1998-11-01 15:00:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtConnectPort [NTDLL.@]
|
2001-07-11 20:56:41 +02:00
|
|
|
* ZwConnectPort [NTDLL.@]
|
1998-11-01 15:00:21 +01:00
|
|
|
*/
|
2005-06-14 13:43:20 +02:00
|
|
|
NTSTATUS WINAPI NtConnectPort(
|
|
|
|
PHANDLE PortHandle,
|
|
|
|
PUNICODE_STRING PortName,
|
|
|
|
PSECURITY_QUALITY_OF_SERVICE SecurityQos,
|
|
|
|
PLPC_SECTION_WRITE WriteSection,
|
|
|
|
PLPC_SECTION_READ ReadSection,
|
|
|
|
PULONG MaximumMessageLength,
|
|
|
|
PVOID ConnectInfo,
|
|
|
|
PULONG pConnectInfoLength)
|
1999-02-13 08:35:31 +01:00
|
|
|
{
|
2005-06-14 13:43:20 +02:00
|
|
|
FIXME("(%p,%s,%p,%p,%p,%p,%p,%p),stub!\n",
|
|
|
|
PortHandle,debugstr_w(PortName->Buffer),SecurityQos,
|
|
|
|
WriteSection,ReadSection,MaximumMessageLength,ConnectInfo,
|
|
|
|
pConnectInfoLength);
|
|
|
|
if (ConnectInfo && pConnectInfoLength)
|
|
|
|
TRACE("\tMessage = %s\n",debugstr_an(ConnectInfo,*pConnectInfoLength));
|
2006-05-10 04:18:07 +02:00
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
1998-11-01 15:00:21 +01:00
|
|
|
}
|
|
|
|
|
2009-06-01 09:40:37 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* NtSecureConnectPort (NTDLL.@)
|
|
|
|
* ZwSecureConnectPort (NTDLL.@)
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI NtSecureConnectPort(
|
|
|
|
PHANDLE PortHandle,
|
|
|
|
PUNICODE_STRING PortName,
|
|
|
|
PSECURITY_QUALITY_OF_SERVICE SecurityQos,
|
|
|
|
PLPC_SECTION_WRITE WriteSection,
|
|
|
|
PSID pSid,
|
|
|
|
PLPC_SECTION_READ ReadSection,
|
|
|
|
PULONG MaximumMessageLength,
|
|
|
|
PVOID ConnectInfo,
|
|
|
|
PULONG pConnectInfoLength)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%s,%p,%p,%p,%p,%p,%p,%p),stub!\n",
|
|
|
|
PortHandle,debugstr_w(PortName->Buffer),SecurityQos,
|
|
|
|
WriteSection,pSid,ReadSection,MaximumMessageLength,ConnectInfo,
|
|
|
|
pConnectInfoLength);
|
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
1998-11-01 15:00:21 +01:00
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtListenPort [NTDLL.@]
|
2001-07-11 20:56:41 +02:00
|
|
|
* ZwListenPort [NTDLL.@]
|
1998-11-01 15:00:21 +01:00
|
|
|
*/
|
2005-06-14 13:43:20 +02:00
|
|
|
NTSTATUS WINAPI NtListenPort(HANDLE PortHandle,PLPC_MESSAGE pLpcMessage)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2002-12-10 21:04:40 +01:00
|
|
|
FIXME("(%p,%p),stub!\n",PortHandle,pLpcMessage);
|
2006-05-10 04:18:07 +02:00
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
1998-11-01 15:00:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtAcceptConnectPort [NTDLL.@]
|
2001-07-11 20:56:41 +02:00
|
|
|
* ZwAcceptConnectPort [NTDLL.@]
|
1998-11-01 15:00:21 +01:00
|
|
|
*/
|
2005-06-14 13:43:20 +02:00
|
|
|
NTSTATUS WINAPI NtAcceptConnectPort(
|
|
|
|
PHANDLE PortHandle,
|
|
|
|
ULONG PortIdentifier,
|
|
|
|
PLPC_MESSAGE pLpcMessage,
|
|
|
|
BOOLEAN Accept,
|
|
|
|
PLPC_SECTION_WRITE WriteSection,
|
|
|
|
PLPC_SECTION_READ ReadSection)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2006-10-16 13:49:06 +02:00
|
|
|
FIXME("(%p,%u,%p,%d,%p,%p),stub!\n",
|
2005-06-14 13:43:20 +02:00
|
|
|
PortHandle,PortIdentifier,pLpcMessage,Accept,WriteSection,ReadSection);
|
2006-05-10 04:18:07 +02:00
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
1998-11-01 15:00:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtCompleteConnectPort [NTDLL.@]
|
2001-07-11 20:56:41 +02:00
|
|
|
* ZwCompleteConnectPort [NTDLL.@]
|
1998-11-01 15:00:21 +01:00
|
|
|
*/
|
2002-12-10 21:04:40 +01:00
|
|
|
NTSTATUS WINAPI NtCompleteConnectPort(HANDLE PortHandle)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2002-12-10 21:04:40 +01:00
|
|
|
FIXME("(%p),stub!\n",PortHandle);
|
2006-05-10 04:18:07 +02:00
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
1998-11-01 15:00:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtRegisterThreadTerminatePort [NTDLL.@]
|
2001-07-11 20:56:41 +02:00
|
|
|
* ZwRegisterThreadTerminatePort [NTDLL.@]
|
1998-11-01 15:00:21 +01:00
|
|
|
*/
|
2002-12-10 21:04:40 +01:00
|
|
|
NTSTATUS WINAPI NtRegisterThreadTerminatePort(HANDLE PortHandle)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2002-12-10 21:04:40 +01:00
|
|
|
FIXME("(%p),stub!\n",PortHandle);
|
2006-05-10 04:18:07 +02:00
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
1998-11-01 15:00:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtRequestWaitReplyPort [NTDLL.@]
|
2001-07-11 20:56:41 +02:00
|
|
|
* ZwRequestWaitReplyPort [NTDLL.@]
|
1998-11-01 15:00:21 +01:00
|
|
|
*/
|
2005-06-14 13:43:20 +02:00
|
|
|
NTSTATUS WINAPI NtRequestWaitReplyPort(
|
|
|
|
HANDLE PortHandle,
|
|
|
|
PLPC_MESSAGE pLpcMessageIn,
|
|
|
|
PLPC_MESSAGE pLpcMessageOut)
|
1999-02-13 08:35:31 +01:00
|
|
|
{
|
2002-12-10 21:04:40 +01:00
|
|
|
FIXME("(%p,%p,%p),stub!\n",PortHandle,pLpcMessageIn,pLpcMessageOut);
|
|
|
|
if(pLpcMessageIn)
|
|
|
|
{
|
|
|
|
TRACE("Message to send:\n");
|
2005-06-14 13:43:20 +02:00
|
|
|
TRACE("\tDataSize = %u\n",pLpcMessageIn->DataSize);
|
|
|
|
TRACE("\tMessageSize = %u\n",pLpcMessageIn->MessageSize);
|
|
|
|
TRACE("\tMessageType = %u\n",pLpcMessageIn->MessageType);
|
|
|
|
TRACE("\tVirtualRangesOffset = %u\n",pLpcMessageIn->VirtualRangesOffset);
|
|
|
|
TRACE("\tClientId.UniqueProcess = %p\n",pLpcMessageIn->ClientId.UniqueProcess);
|
|
|
|
TRACE("\tClientId.UniqueThread = %p\n",pLpcMessageIn->ClientId.UniqueThread);
|
2009-05-07 13:42:39 +02:00
|
|
|
TRACE("\tMessageId = %lu\n",pLpcMessageIn->MessageId);
|
|
|
|
TRACE("\tSectionSize = %lu\n",pLpcMessageIn->SectionSize);
|
2005-06-14 13:43:20 +02:00
|
|
|
TRACE("\tData = %s\n",
|
2005-09-02 16:47:36 +02:00
|
|
|
debugstr_an((const char*)pLpcMessageIn->Data,pLpcMessageIn->DataSize));
|
2002-12-10 21:04:40 +01:00
|
|
|
}
|
2006-05-10 04:18:07 +02:00
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
1998-11-01 15:00:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtReplyWaitReceivePort [NTDLL.@]
|
2001-07-11 20:56:41 +02:00
|
|
|
* ZwReplyWaitReceivePort [NTDLL.@]
|
1998-11-01 15:00:21 +01:00
|
|
|
*/
|
2005-06-14 13:43:20 +02:00
|
|
|
NTSTATUS WINAPI NtReplyWaitReceivePort(
|
|
|
|
HANDLE PortHandle,
|
|
|
|
PULONG PortIdentifier,
|
|
|
|
PLPC_MESSAGE ReplyMessage,
|
|
|
|
PLPC_MESSAGE Message)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2005-06-14 13:43:20 +02:00
|
|
|
FIXME("(%p,%p,%p,%p),stub!\n",PortHandle,PortIdentifier,ReplyMessage,Message);
|
2006-05-10 04:18:07 +02:00
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
1998-11-01 15:00:21 +01:00
|
|
|
}
|
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
/*
|
|
|
|
* Misc
|
1998-11-01 15:00:21 +01:00
|
|
|
*/
|
1999-03-09 18:47:51 +01:00
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtSetIntervalProfile [NTDLL.@]
|
2001-07-11 20:56:41 +02:00
|
|
|
* ZwSetIntervalProfile [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
2005-06-16 12:46:11 +02:00
|
|
|
NTSTATUS WINAPI NtSetIntervalProfile(
|
|
|
|
ULONG Interval,
|
|
|
|
KPROFILE_SOURCE Source)
|
|
|
|
{
|
2006-10-16 13:49:06 +02:00
|
|
|
FIXME("%u,%d\n", Interval, Source);
|
2005-06-16 12:46:11 +02:00
|
|
|
return STATUS_SUCCESS;
|
1998-11-01 15:00:21 +01:00
|
|
|
}
|
1999-03-09 18:47:51 +01:00
|
|
|
|
2009-09-15 21:38:07 +02:00
|
|
|
static SYSTEM_CPU_INFORMATION cached_sci;
|
2009-09-15 21:38:15 +02:00
|
|
|
static ULONGLONG cpuHz = 1000000000; /* default to a 1GHz */
|
2009-09-15 21:38:07 +02:00
|
|
|
|
|
|
|
#define AUTH 0x68747541 /* "Auth" */
|
|
|
|
#define ENTI 0x69746e65 /* "enti" */
|
|
|
|
#define CAMD 0x444d4163 /* "cAMD" */
|
|
|
|
|
|
|
|
/* Calls cpuid with an eax of 'ax' and returns the 16 bytes in *p
|
|
|
|
* We are compiled with -fPIC, so we can't clobber ebx.
|
|
|
|
*/
|
|
|
|
static inline void do_cpuid(unsigned int ax, unsigned int *p)
|
|
|
|
{
|
|
|
|
#ifdef __i386__
|
|
|
|
__asm__("pushl %%ebx\n\t"
|
|
|
|
"cpuid\n\t"
|
|
|
|
"movl %%ebx, %%esi\n\t"
|
|
|
|
"popl %%ebx"
|
|
|
|
: "=a" (p[0]), "=S" (p[1]), "=c" (p[2]), "=d" (p[3])
|
|
|
|
: "0" (ax));
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* From xf86info havecpuid.c 1.11 */
|
|
|
|
static inline int have_cpuid(void)
|
|
|
|
{
|
|
|
|
#ifdef __i386__
|
|
|
|
unsigned int f1, f2;
|
|
|
|
__asm__("pushfl\n\t"
|
|
|
|
"pushfl\n\t"
|
|
|
|
"popl %0\n\t"
|
|
|
|
"movl %0,%1\n\t"
|
|
|
|
"xorl %2,%0\n\t"
|
|
|
|
"pushl %0\n\t"
|
|
|
|
"popfl\n\t"
|
|
|
|
"pushfl\n\t"
|
|
|
|
"popl %0\n\t"
|
|
|
|
"popfl"
|
|
|
|
: "=&r" (f1), "=&r" (f2)
|
|
|
|
: "ir" (0x00200000));
|
|
|
|
return ((f1^f2) & 0x00200000) != 0;
|
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void get_cpuinfo(SYSTEM_CPU_INFORMATION* info)
|
|
|
|
{
|
|
|
|
unsigned int regs[4], regs2[4];
|
|
|
|
|
|
|
|
if (!have_cpuid()) return;
|
|
|
|
|
|
|
|
do_cpuid(0x00000000, regs); /* get standard cpuid level and vendor name */
|
|
|
|
if (regs[0]>=0x00000001) /* Check for supported cpuid version */
|
|
|
|
{
|
|
|
|
do_cpuid(0x00000001, regs2); /* get cpu features */
|
|
|
|
switch ((regs2[0] >> 8) & 0xf) /* cpu family */
|
|
|
|
{
|
|
|
|
case 3: info->Level = 3; break;
|
|
|
|
case 4: info->Level = 4; break;
|
|
|
|
case 5: info->Level = 5; break;
|
|
|
|
case 15: /* PPro/2/3/4 has same info as P1 */
|
|
|
|
case 6: info->Level = 6; break;
|
|
|
|
default:
|
|
|
|
FIXME("unknown cpu family %d, please report! (-> setting to 386)\n",
|
|
|
|
(regs2[0] >> 8)&0xf);
|
|
|
|
info->Level = 3;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
user_shared_data->ProcessorFeatures[PF_FLOATING_POINT_EMULATED] = !(regs2[3] & 1);
|
|
|
|
user_shared_data->ProcessorFeatures[PF_RDTSC_INSTRUCTION_AVAILABLE] = (regs2[3] & (1 << 4 )) >> 4;
|
|
|
|
user_shared_data->ProcessorFeatures[PF_COMPARE_EXCHANGE_DOUBLE] = (regs2[3] & (1 << 8 )) >> 8;
|
|
|
|
user_shared_data->ProcessorFeatures[PF_MMX_INSTRUCTIONS_AVAILABLE] = (regs2[3] & (1 << 23)) >> 23;
|
|
|
|
|
|
|
|
if (regs[1] == AUTH && regs[3] == ENTI && regs[2] == CAMD)
|
|
|
|
{
|
|
|
|
do_cpuid(0x80000000, regs); /* get vendor cpuid level */
|
|
|
|
if (regs[0] >= 0x80000001)
|
|
|
|
{
|
|
|
|
do_cpuid(0x80000001, regs2); /* get vendor features */
|
|
|
|
user_shared_data->ProcessorFeatures[PF_3DNOW_INSTRUCTIONS_AVAILABLE] = (regs2[3] & (1 << 31 )) >> 31;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* fill_cpu_info
|
|
|
|
*
|
|
|
|
* inits a couple of places with CPU related information:
|
|
|
|
* - cached_sci & cpuHZ in this file
|
|
|
|
* - Peb->NumberOfProcessors
|
|
|
|
* - SharedUserData->ProcessFeatures[] array
|
2009-09-15 21:38:23 +02:00
|
|
|
*
|
|
|
|
* It creates a registry subhierarchy, looking like:
|
|
|
|
* "\HARDWARE\DESCRIPTION\System\CentralProcessor\<processornumber>\Identifier (CPU x86)".
|
|
|
|
* Note that there is a hierarchy for every processor installed, so this
|
|
|
|
* supports multiprocessor systems. This is done like Win95 does it, I think.
|
|
|
|
*
|
|
|
|
* It creates some registry entries in the environment part:
|
|
|
|
* "\HKLM\System\CurrentControlSet\Control\Session Manager\Environment". These are
|
|
|
|
* always present. When deleted, Windows will add them again.
|
2009-09-15 21:38:07 +02:00
|
|
|
*/
|
|
|
|
void fill_cpu_info(void)
|
|
|
|
{
|
|
|
|
memset(&cached_sci, 0, sizeof(cached_sci));
|
|
|
|
/* choose sensible defaults ...
|
|
|
|
* FIXME: perhaps overridable with precompiler flags?
|
|
|
|
*/
|
|
|
|
cached_sci.Architecture = PROCESSOR_ARCHITECTURE_INTEL;
|
|
|
|
cached_sci.Level = 5; /* 586 */
|
|
|
|
cached_sci.Revision = 0;
|
|
|
|
cached_sci.Reserved = 0;
|
|
|
|
cached_sci.FeatureSet = 0x1fff; /* FIXME: set some sensible defaults out of ProcessFeatures[] */
|
|
|
|
|
|
|
|
NtCurrentTeb()->Peb->NumberOfProcessors = 1;
|
|
|
|
|
|
|
|
/* Hmm, reasonable processor feature defaults? */
|
|
|
|
|
|
|
|
#ifdef linux
|
|
|
|
{
|
|
|
|
char line[200];
|
|
|
|
FILE *f = fopen ("/proc/cpuinfo", "r");
|
|
|
|
|
|
|
|
if (!f)
|
|
|
|
return;
|
|
|
|
while (fgets(line,200,f) != NULL)
|
|
|
|
{
|
|
|
|
char *s,*value;
|
|
|
|
|
|
|
|
/* NOTE: the ':' is the only character we can rely on */
|
|
|
|
if (!(value = strchr(line,':')))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* terminate the valuename */
|
|
|
|
s = value - 1;
|
|
|
|
while ((s >= line) && ((*s == ' ') || (*s == '\t'))) s--;
|
|
|
|
*(s + 1) = '\0';
|
|
|
|
|
|
|
|
/* and strip leading spaces from value */
|
|
|
|
value += 1;
|
|
|
|
while (*value==' ') value++;
|
|
|
|
if ((s = strchr(value,'\n')))
|
|
|
|
*s='\0';
|
|
|
|
|
|
|
|
if (!strcasecmp(line, "processor"))
|
|
|
|
{
|
|
|
|
/* processor number counts up... */
|
|
|
|
unsigned int x;
|
|
|
|
|
|
|
|
if (sscanf(value, "%d",&x))
|
|
|
|
if (x + 1 > NtCurrentTeb()->Peb->NumberOfProcessors)
|
|
|
|
NtCurrentTeb()->Peb->NumberOfProcessors = x + 1;
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (!strcasecmp(line, "model"))
|
|
|
|
{
|
|
|
|
/* First part of Revision */
|
|
|
|
int x;
|
|
|
|
|
|
|
|
if (sscanf(value, "%d",&x))
|
|
|
|
cached_sci.Revision = cached_sci.Revision | (x << 8);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 2.1 method */
|
|
|
|
if (!strcasecmp(line, "cpu family"))
|
|
|
|
{
|
|
|
|
if (isdigit(value[0]))
|
|
|
|
{
|
|
|
|
cached_sci.Level = atoi(value);
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
/* old 2.0 method */
|
|
|
|
if (!strcasecmp(line, "cpu"))
|
|
|
|
{
|
|
|
|
if (isdigit(value[0]) && value[1] == '8' && value[2] == '6' && value[3] == 0)
|
|
|
|
{
|
|
|
|
switch (cached_sci.Level = value[0] - '0')
|
|
|
|
{
|
|
|
|
case 3:
|
|
|
|
case 4:
|
|
|
|
case 5:
|
|
|
|
case 6:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
FIXME("unknown Linux 2.0 cpu family '%s', please report ! (-> setting to 386)\n", value);
|
|
|
|
cached_sci.Level = 3;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (!strcasecmp(line, "stepping"))
|
|
|
|
{
|
|
|
|
/* Second part of Revision */
|
|
|
|
int x;
|
|
|
|
|
|
|
|
if (sscanf(value, "%d",&x))
|
|
|
|
cached_sci.Revision = cached_sci.Revision | x;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (!strcasecmp(line, "cpu MHz"))
|
|
|
|
{
|
|
|
|
double cmz;
|
|
|
|
if (sscanf( value, "%lf", &cmz ) == 1)
|
|
|
|
{
|
|
|
|
/* SYSTEMINFO doesn't have a slot for cpu speed, so store in a global */
|
|
|
|
cpuHz = cmz * 1000 * 1000;
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (!strcasecmp(line, "fdiv_bug"))
|
|
|
|
{
|
|
|
|
if (!strncasecmp(value, "yes",3))
|
|
|
|
user_shared_data->ProcessorFeatures[PF_FLOATING_POINT_PRECISION_ERRATA] = TRUE;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (!strcasecmp(line, "fpu"))
|
|
|
|
{
|
|
|
|
if (!strncasecmp(value, "no",2))
|
|
|
|
user_shared_data->ProcessorFeatures[PF_FLOATING_POINT_EMULATED] = TRUE;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (!strcasecmp(line, "flags") || !strcasecmp(line, "features"))
|
|
|
|
{
|
|
|
|
if (strstr(value, "cx8"))
|
|
|
|
user_shared_data->ProcessorFeatures[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE;
|
|
|
|
if (strstr(value, "mmx"))
|
|
|
|
user_shared_data->ProcessorFeatures[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE;
|
|
|
|
if (strstr(value, "tsc"))
|
|
|
|
user_shared_data->ProcessorFeatures[PF_RDTSC_INSTRUCTION_AVAILABLE] = TRUE;
|
|
|
|
if (strstr(value, "3dnow"))
|
|
|
|
user_shared_data->ProcessorFeatures[PF_3DNOW_INSTRUCTIONS_AVAILABLE] = TRUE;
|
|
|
|
/* This will also catch sse2, but we have sse itself
|
|
|
|
* if we have sse2, so no problem */
|
|
|
|
if (strstr(value, "sse"))
|
|
|
|
user_shared_data->ProcessorFeatures[PF_XMMI_INSTRUCTIONS_AVAILABLE] = TRUE;
|
|
|
|
if (strstr(value, "sse2"))
|
|
|
|
user_shared_data->ProcessorFeatures[PF_XMMI64_INSTRUCTIONS_AVAILABLE] = TRUE;
|
|
|
|
if (strstr(value, "pae"))
|
|
|
|
user_shared_data->ProcessorFeatures[PF_PAE_ENABLED] = TRUE;
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose(f);
|
|
|
|
}
|
|
|
|
#elif defined (__NetBSD__)
|
|
|
|
{
|
|
|
|
int mib[2];
|
|
|
|
int value;
|
|
|
|
size_t val_len;
|
|
|
|
char model[256];
|
|
|
|
char *cpuclass;
|
|
|
|
FILE *f = fopen("/var/run/dmesg.boot", "r");
|
|
|
|
|
|
|
|
/* first deduce as much as possible from the sysctls */
|
|
|
|
mib[0] = CTL_MACHDEP;
|
|
|
|
#ifdef CPU_FPU_PRESENT
|
|
|
|
mib[1] = CPU_FPU_PRESENT;
|
|
|
|
val_len = sizeof(value);
|
|
|
|
if (sysctl(mib, 2, &value, &val_len, NULL, 0) >= 0)
|
|
|
|
user_shared_data->ProcessorFeatures[PF_FLOATING_POINT_EMULATED] = !value;
|
|
|
|
#endif
|
|
|
|
#ifdef CPU_SSE
|
|
|
|
mib[1] = CPU_SSE; /* this should imply MMX */
|
|
|
|
val_len = sizeof(value);
|
|
|
|
if (sysctl(mib, 2, &value, &val_len, NULL, 0) >= 0)
|
|
|
|
if (value) user_shared_data->ProcessorFeatures[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE;
|
|
|
|
#endif
|
|
|
|
#ifdef CPU_SSE2
|
|
|
|
mib[1] = CPU_SSE2; /* this should imply MMX */
|
|
|
|
val_len = sizeof(value);
|
|
|
|
if (sysctl(mib, 2, &value, &val_len, NULL, 0) >= 0)
|
|
|
|
if (value) user_shared_data->ProcessorFeatures[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE;
|
|
|
|
#endif
|
|
|
|
mib[0] = CTL_HW;
|
|
|
|
mib[1] = HW_NCPU;
|
|
|
|
val_len = sizeof(value);
|
|
|
|
if (sysctl(mib, 2, &value, &val_len, NULL, 0) >= 0)
|
|
|
|
if (value > NtCurrentTeb()->Peb->NumberOfProcessors)
|
|
|
|
NtCurrentTeb()->Peb->NumberOfProcessors = value;
|
|
|
|
mib[1] = HW_MODEL;
|
|
|
|
val_len = sizeof(model)-1;
|
|
|
|
if (sysctl(mib, 2, model, &val_len, NULL, 0) >= 0)
|
|
|
|
{
|
|
|
|
model[val_len] = '\0'; /* just in case */
|
|
|
|
cpuclass = strstr(model, "-class");
|
|
|
|
if (cpuclass != NULL) {
|
|
|
|
while(cpuclass > model && cpuclass[0] != '(') cpuclass--;
|
|
|
|
if (!strncmp(cpuclass+1, "386", 3))
|
|
|
|
{
|
|
|
|
cached_sci.Level= 3;
|
|
|
|
}
|
|
|
|
if (!strncmp(cpuclass+1, "486", 3))
|
|
|
|
{
|
|
|
|
cached_sci.Level= 4;
|
|
|
|
}
|
|
|
|
if (!strncmp(cpuclass+1, "586", 3))
|
|
|
|
{
|
|
|
|
cached_sci.Level= 5;
|
|
|
|
}
|
|
|
|
if (!strncmp(cpuclass+1, "686", 3))
|
|
|
|
{
|
|
|
|
cached_sci.Level= 6;
|
|
|
|
/* this should imply MMX */
|
|
|
|
user_shared_data->ProcessorFeatures[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* it may be worth reading from /var/run/dmesg.boot for
|
|
|
|
additional information such as CX8, MMX and TSC
|
|
|
|
(however this information should be considered less
|
|
|
|
reliable than that from the sysctl calls) */
|
|
|
|
if (f != NULL)
|
|
|
|
{
|
|
|
|
while (fgets(model, 255, f) != NULL)
|
|
|
|
{
|
|
|
|
int cpu, features;
|
|
|
|
if (sscanf(model, "cpu%d: features %x<", &cpu, &features) == 2)
|
|
|
|
{
|
|
|
|
/* we could scan the string but it is easier
|
|
|
|
to test the bits directly */
|
|
|
|
if (features & 0x1)
|
|
|
|
user_shared_data->ProcessorFeatures[PF_FLOATING_POINT_EMULATED] = TRUE;
|
|
|
|
if (features & 0x10)
|
|
|
|
user_shared_data->ProcessorFeatures[PF_RDTSC_INSTRUCTION_AVAILABLE] = TRUE;
|
|
|
|
if (features & 0x100)
|
|
|
|
user_shared_data->ProcessorFeatures[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE;
|
|
|
|
if (features & 0x800000)
|
|
|
|
user_shared_data->ProcessorFeatures[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose(f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#elif defined(__FreeBSD__)
|
|
|
|
{
|
|
|
|
int ret, num;
|
|
|
|
size_t len;
|
|
|
|
|
|
|
|
get_cpuinfo( &cached_sci );
|
|
|
|
|
|
|
|
/* Check for OS support of SSE -- Is this used, and should it be sse1 or sse2? */
|
|
|
|
/*len = sizeof(num);
|
|
|
|
ret = sysctlbyname("hw.instruction_sse", &num, &len, NULL, 0);
|
|
|
|
if (!ret)
|
|
|
|
user_shared_data->ProcessorFeatures[PF_XMMI_INSTRUCTIONS_AVAILABLE] = num;*/
|
|
|
|
|
|
|
|
len = sizeof(num);
|
|
|
|
ret = sysctlbyname("hw.ncpu", &num, &len, NULL, 0);
|
|
|
|
if (!ret)
|
|
|
|
NtCurrentTeb()->Peb->NumberOfProcessors = num;
|
|
|
|
}
|
|
|
|
#elif defined(__sun)
|
|
|
|
{
|
|
|
|
int num = sysconf( _SC_NPROCESSORS_ONLN );
|
|
|
|
|
|
|
|
if (num == -1) num = 1;
|
|
|
|
get_cpuinfo( &cached_sci );
|
|
|
|
NtCurrentTeb()->Peb->NumberOfProcessors = num;
|
|
|
|
}
|
|
|
|
#elif defined (__APPLE__)
|
|
|
|
{
|
|
|
|
size_t valSize;
|
|
|
|
unsigned long long longVal;
|
|
|
|
int value;
|
|
|
|
int cputype;
|
|
|
|
char buffer[256];
|
|
|
|
|
|
|
|
valSize = sizeof(int);
|
|
|
|
if (sysctlbyname ("hw.optional.floatingpoint", &value, &valSize, NULL, 0) == 0)
|
|
|
|
{
|
|
|
|
if (value)
|
|
|
|
user_shared_data->ProcessorFeatures[PF_FLOATING_POINT_EMULATED] = FALSE;
|
|
|
|
else
|
|
|
|
user_shared_data->ProcessorFeatures[PF_FLOATING_POINT_EMULATED] = TRUE;
|
|
|
|
}
|
|
|
|
valSize = sizeof(int);
|
|
|
|
if (sysctlbyname ("hw.ncpu", &value, &valSize, NULL, 0) == 0)
|
|
|
|
NtCurrentTeb()->Peb->NumberOfProcessors = value;
|
|
|
|
|
|
|
|
/* FIXME: we don't use the "hw.activecpu" value... but the cached one */
|
|
|
|
|
|
|
|
valSize = sizeof(int);
|
|
|
|
if (sysctlbyname ("hw.cputype", &cputype, &valSize, NULL, 0) == 0)
|
|
|
|
{
|
|
|
|
switch (cputype)
|
|
|
|
{
|
|
|
|
case CPU_TYPE_POWERPC:
|
2009-09-22 21:36:28 +02:00
|
|
|
cached_sci.Architecture = PROCESSOR_ARCHITECTURE_PPC;
|
2009-09-15 21:38:07 +02:00
|
|
|
valSize = sizeof(int);
|
|
|
|
if (sysctlbyname ("hw.cpusubtype", &value, &valSize, NULL, 0) == 0)
|
|
|
|
{
|
|
|
|
switch (value)
|
|
|
|
{
|
|
|
|
case CPU_SUBTYPE_POWERPC_601:
|
|
|
|
case CPU_SUBTYPE_POWERPC_602: cached_sci.Level = 1; break;
|
|
|
|
case CPU_SUBTYPE_POWERPC_603: cached_sci.Level = 3; break;
|
|
|
|
case CPU_SUBTYPE_POWERPC_603e:
|
|
|
|
case CPU_SUBTYPE_POWERPC_603ev: cached_sci.Level = 6; break;
|
|
|
|
case CPU_SUBTYPE_POWERPC_604: cached_sci.Level = 4; break;
|
|
|
|
case CPU_SUBTYPE_POWERPC_604e: cached_sci.Level = 9; break;
|
|
|
|
case CPU_SUBTYPE_POWERPC_620: cached_sci.Level = 20; break;
|
|
|
|
case CPU_SUBTYPE_POWERPC_750: /* G3/G4 derive from 603 so ... */
|
|
|
|
case CPU_SUBTYPE_POWERPC_7400:
|
|
|
|
case CPU_SUBTYPE_POWERPC_7450: cached_sci.Level = 6; break;
|
|
|
|
case CPU_SUBTYPE_POWERPC_970: cached_sci.Level = 9;
|
|
|
|
/* :o) user_shared_data->ProcessorFeatures[PF_ALTIVEC_INSTRUCTIONS_AVAILABLE] ;-) */
|
|
|
|
break;
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break; /* CPU_TYPE_POWERPC */
|
|
|
|
case CPU_TYPE_I386:
|
|
|
|
cached_sci.Architecture = PROCESSOR_ARCHITECTURE_INTEL;
|
|
|
|
valSize = sizeof(int);
|
|
|
|
if (sysctlbyname ("machdep.cpu.family", &value, &valSize, NULL, 0) == 0)
|
|
|
|
{
|
|
|
|
cached_sci.Level = value;
|
|
|
|
}
|
|
|
|
valSize = sizeof(int);
|
|
|
|
if (sysctlbyname ("machdep.cpu.model", &value, &valSize, NULL, 0) == 0)
|
|
|
|
cached_sci.Revision = (value << 8);
|
|
|
|
valSize = sizeof(int);
|
|
|
|
if (sysctlbyname ("machdep.cpu.stepping", &value, &valSize, NULL, 0) == 0)
|
|
|
|
cached_sci.Revision |= value;
|
|
|
|
valSize = sizeof(buffer);
|
|
|
|
if (sysctlbyname ("machdep.cpu.features", buffer, &valSize, NULL, 0) == 0)
|
|
|
|
{
|
|
|
|
cached_sci.Revision |= value;
|
|
|
|
if (strstr(buffer, "CX8")) user_shared_data->ProcessorFeatures[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE;
|
|
|
|
if (strstr(buffer, "MMX")) user_shared_data->ProcessorFeatures[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE;
|
|
|
|
if (strstr(buffer, "TSC")) user_shared_data->ProcessorFeatures[PF_RDTSC_INSTRUCTION_AVAILABLE] = TRUE;
|
|
|
|
if (strstr(buffer, "3DNOW")) user_shared_data->ProcessorFeatures[PF_3DNOW_INSTRUCTIONS_AVAILABLE] = TRUE;
|
|
|
|
if (strstr(buffer, "SSE")) user_shared_data->ProcessorFeatures[PF_XMMI_INSTRUCTIONS_AVAILABLE] = TRUE;
|
|
|
|
if (strstr(buffer, "SSE2")) user_shared_data->ProcessorFeatures[PF_XMMI64_INSTRUCTIONS_AVAILABLE] = TRUE;
|
|
|
|
if (strstr(buffer, "PAE")) user_shared_data->ProcessorFeatures[PF_PAE_ENABLED] = TRUE;
|
|
|
|
}
|
|
|
|
break; /* CPU_TYPE_I386 */
|
|
|
|
default: break;
|
|
|
|
} /* switch (cputype) */
|
|
|
|
}
|
|
|
|
valSize = sizeof(longVal);
|
|
|
|
if (!sysctlbyname("hw.cpufrequency", &longVal, &valSize, NULL, 0))
|
|
|
|
cpuHz = longVal;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
FIXME("not yet supported on this system\n");
|
|
|
|
#endif
|
|
|
|
TRACE("<- CPU arch %d, level %d, rev %d, features 0x%x\n",
|
|
|
|
cached_sci.Architecture, cached_sci.Level, cached_sci.Revision, cached_sci.FeatureSet);
|
|
|
|
}
|
|
|
|
|
1998-12-24 15:34:55 +01:00
|
|
|
/******************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* NtQuerySystemInformation [NTDLL.@]
|
2001-07-11 20:56:41 +02:00
|
|
|
* ZwQuerySystemInformation [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*
|
|
|
|
* ARGUMENTS:
|
|
|
|
* SystemInformationClass Index to a certain information structure
|
|
|
|
* SystemTimeAdjustmentInformation SYSTEM_TIME_ADJUSTMENT
|
|
|
|
* SystemCacheInformation SYSTEM_CACHE_INFORMATION
|
|
|
|
* SystemConfigurationInformation CONFIGURATION_INFORMATION
|
2002-06-01 01:06:46 +02:00
|
|
|
* observed (class/len):
|
1999-03-09 18:47:51 +01:00
|
|
|
* 0x0/0x2c
|
|
|
|
* 0x12/0x18
|
|
|
|
* 0x2/0x138
|
|
|
|
* 0x8/0x600
|
2000-12-06 20:45:07 +01:00
|
|
|
* 0x25/0xc
|
1999-03-09 18:47:51 +01:00
|
|
|
* SystemInformation caller supplies storage for the information structure
|
|
|
|
* Length size of the structure
|
|
|
|
* ResultLength Data written
|
1999-02-13 08:35:31 +01:00
|
|
|
*/
|
1999-03-09 18:47:51 +01:00
|
|
|
NTSTATUS WINAPI NtQuerySystemInformation(
|
|
|
|
IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
|
|
|
|
OUT PVOID SystemInformation,
|
|
|
|
IN ULONG Length,
|
|
|
|
OUT PULONG ResultLength)
|
1999-02-13 08:35:31 +01:00
|
|
|
{
|
2003-09-16 03:07:21 +02:00
|
|
|
NTSTATUS ret = STATUS_SUCCESS;
|
|
|
|
ULONG len = 0;
|
|
|
|
|
2006-10-16 13:49:06 +02:00
|
|
|
TRACE("(0x%08x,%p,0x%08x,%p)\n",
|
2003-09-16 03:07:21 +02:00
|
|
|
SystemInformationClass,SystemInformation,Length,ResultLength);
|
|
|
|
|
|
|
|
switch (SystemInformationClass)
|
2000-12-06 20:45:07 +01:00
|
|
|
{
|
2003-09-16 03:07:21 +02:00
|
|
|
case SystemBasicInformation:
|
|
|
|
{
|
2005-04-15 16:12:54 +02:00
|
|
|
SYSTEM_BASIC_INFORMATION sbi;
|
|
|
|
|
2008-11-03 13:23:48 +01:00
|
|
|
virtual_get_system_info( &sbi );
|
2005-04-15 16:12:54 +02:00
|
|
|
len = sizeof(sbi);
|
|
|
|
|
2005-06-15 12:19:34 +02:00
|
|
|
if ( Length == len)
|
2003-09-16 03:07:21 +02:00
|
|
|
{
|
2005-04-15 16:12:54 +02:00
|
|
|
if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
|
|
|
|
else memcpy( SystemInformation, &sbi, len);
|
2003-09-16 03:07:21 +02:00
|
|
|
}
|
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
}
|
|
|
|
break;
|
2005-01-28 13:34:20 +01:00
|
|
|
case SystemCpuInformation:
|
2009-09-15 21:38:07 +02:00
|
|
|
if (Length >= (len = sizeof(cached_sci)))
|
2005-01-28 13:34:20 +01:00
|
|
|
{
|
2009-09-15 21:38:07 +02:00
|
|
|
if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
|
|
|
|
else memcpy(SystemInformation, &cached_sci, len);
|
2005-01-28 13:34:20 +01:00
|
|
|
}
|
2009-09-15 21:38:07 +02:00
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
2005-01-28 13:34:20 +01:00
|
|
|
break;
|
2003-09-16 03:07:21 +02:00
|
|
|
case SystemPerformanceInformation:
|
|
|
|
{
|
2005-07-05 13:46:37 +02:00
|
|
|
SYSTEM_PERFORMANCE_INFORMATION spi;
|
2008-11-28 15:33:34 +01:00
|
|
|
static BOOL fixme_written = FALSE;
|
2005-07-05 13:46:37 +02:00
|
|
|
|
|
|
|
memset(&spi, 0 , sizeof(spi));
|
|
|
|
len = sizeof(spi);
|
|
|
|
|
|
|
|
if (Length >= len)
|
2003-09-16 03:07:21 +02:00
|
|
|
{
|
2005-07-05 13:46:37 +02:00
|
|
|
if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
|
|
|
|
else memcpy( SystemInformation, &spi, len);
|
2003-09-16 03:07:21 +02:00
|
|
|
}
|
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
2008-11-28 15:33:34 +01:00
|
|
|
if(!fixme_written) {
|
|
|
|
FIXME("info_class SYSTEM_PERFORMANCE_INFORMATION\n");
|
|
|
|
fixme_written = TRUE;
|
|
|
|
}
|
2003-09-16 03:07:21 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SystemTimeOfDayInformation:
|
|
|
|
{
|
2005-06-13 13:34:56 +02:00
|
|
|
SYSTEM_TIMEOFDAY_INFORMATION sti;
|
|
|
|
|
|
|
|
memset(&sti, 0 , sizeof(sti));
|
|
|
|
|
|
|
|
/* liKeSystemTime, liExpTimeZoneBias, uCurrentTimeZoneId */
|
2007-04-17 20:08:59 +02:00
|
|
|
sti.liKeBootTime.QuadPart = server_start_time;
|
2005-06-13 13:34:56 +02:00
|
|
|
|
|
|
|
if (Length <= sizeof(sti))
|
2003-09-16 03:07:21 +02:00
|
|
|
{
|
2005-06-13 13:34:56 +02:00
|
|
|
len = Length;
|
|
|
|
if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
|
|
|
|
else memcpy( SystemInformation, &sti, Length);
|
2003-09-16 03:07:21 +02:00
|
|
|
}
|
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SystemProcessInformation:
|
|
|
|
{
|
2009-03-17 00:12:11 +01:00
|
|
|
SYSTEM_PROCESS_INFORMATION* spi = SystemInformation;
|
2003-09-16 03:07:21 +02:00
|
|
|
SYSTEM_PROCESS_INFORMATION* last = NULL;
|
|
|
|
HANDLE hSnap = 0;
|
2003-09-30 03:04:19 +02:00
|
|
|
WCHAR procname[1024];
|
2005-06-16 11:44:39 +02:00
|
|
|
WCHAR* exename;
|
2003-09-30 03:04:19 +02:00
|
|
|
DWORD wlen = 0;
|
2005-06-09 22:33:45 +02:00
|
|
|
DWORD procstructlen = 0;
|
2003-09-16 03:07:21 +02:00
|
|
|
|
|
|
|
SERVER_START_REQ( create_snapshot )
|
|
|
|
{
|
2005-12-09 12:09:44 +01:00
|
|
|
req->flags = SNAP_PROCESS | SNAP_THREAD;
|
|
|
|
req->attributes = 0;
|
2008-12-08 16:05:17 +01:00
|
|
|
if (!(ret = wine_server_call( req )))
|
|
|
|
hSnap = wine_server_ptr_handle( reply->handle );
|
2003-09-16 03:07:21 +02:00
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
len = 0;
|
|
|
|
while (ret == STATUS_SUCCESS)
|
|
|
|
{
|
|
|
|
SERVER_START_REQ( next_process )
|
|
|
|
{
|
2008-12-08 16:05:17 +01:00
|
|
|
req->handle = wine_server_obj_handle( hSnap );
|
2003-09-16 03:07:21 +02:00
|
|
|
req->reset = (len == 0);
|
2005-06-16 11:44:39 +02:00
|
|
|
wine_server_set_reply( req, procname, sizeof(procname)-sizeof(WCHAR) );
|
2003-09-16 03:07:21 +02:00
|
|
|
if (!(ret = wine_server_call( req )))
|
|
|
|
{
|
2005-06-16 11:44:39 +02:00
|
|
|
/* Make sure procname is 0 terminated */
|
|
|
|
procname[wine_server_reply_size(reply) / sizeof(WCHAR)] = 0;
|
|
|
|
|
|
|
|
/* Get only the executable name, not the path */
|
|
|
|
if ((exename = strrchrW(procname, '\\')) != NULL) exename++;
|
|
|
|
else exename = procname;
|
|
|
|
|
|
|
|
wlen = (strlenW(exename) + 1) * sizeof(WCHAR);
|
|
|
|
|
2005-06-09 22:33:45 +02:00
|
|
|
procstructlen = sizeof(*spi) + wlen + ((reply->threads - 1) * sizeof(SYSTEM_THREAD_INFORMATION));
|
2005-06-16 11:44:39 +02:00
|
|
|
|
2005-06-09 22:33:45 +02:00
|
|
|
if (Length >= len + procstructlen)
|
2003-09-16 03:07:21 +02:00
|
|
|
{
|
2005-06-07 22:01:48 +02:00
|
|
|
/* ftCreationTime, ftUserTime, ftKernelTime;
|
2005-06-03 13:24:43 +02:00
|
|
|
* vmCounters, ioCounters
|
|
|
|
*/
|
|
|
|
|
2003-09-16 03:07:21 +02:00
|
|
|
memset(spi, 0, sizeof(*spi));
|
2005-06-03 13:24:43 +02:00
|
|
|
|
2009-01-03 14:54:11 +01:00
|
|
|
spi->NextEntryOffset = procstructlen - wlen;
|
2003-09-16 03:07:21 +02:00
|
|
|
spi->dwThreadCount = reply->threads;
|
2005-06-03 13:24:43 +02:00
|
|
|
|
2003-09-16 03:07:21 +02:00
|
|
|
/* spi->pszProcessName will be set later on */
|
2005-06-03 13:24:43 +02:00
|
|
|
|
2003-09-16 03:07:21 +02:00
|
|
|
spi->dwBasePriority = reply->priority;
|
2009-01-03 14:54:11 +01:00
|
|
|
spi->UniqueProcessId = UlongToHandle(reply->pid);
|
|
|
|
spi->ParentProcessId = UlongToHandle(reply->ppid);
|
|
|
|
spi->HandleCount = reply->handles;
|
2005-06-03 13:24:43 +02:00
|
|
|
|
2003-09-16 03:07:21 +02:00
|
|
|
/* spi->ti will be set later on */
|
2005-06-03 13:24:43 +02:00
|
|
|
|
2005-06-09 22:33:45 +02:00
|
|
|
len += procstructlen;
|
2003-09-16 03:07:21 +02:00
|
|
|
}
|
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
2005-06-09 22:33:45 +02:00
|
|
|
|
2003-09-16 03:07:21 +02:00
|
|
|
if (ret != STATUS_SUCCESS)
|
|
|
|
{
|
|
|
|
if (ret == STATUS_NO_MORE_FILES) ret = STATUS_SUCCESS;
|
|
|
|
break;
|
|
|
|
}
|
2005-06-09 22:33:45 +02:00
|
|
|
else /* Length is already checked for */
|
2003-09-16 03:07:21 +02:00
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
/* set thread info */
|
|
|
|
i = j = 0;
|
|
|
|
while (ret == STATUS_SUCCESS)
|
|
|
|
{
|
|
|
|
SERVER_START_REQ( next_thread )
|
|
|
|
{
|
2008-12-08 16:05:17 +01:00
|
|
|
req->handle = wine_server_obj_handle( hSnap );
|
2003-09-16 03:07:21 +02:00
|
|
|
req->reset = (j == 0);
|
|
|
|
if (!(ret = wine_server_call( req )))
|
|
|
|
{
|
|
|
|
j++;
|
2009-01-03 14:54:11 +01:00
|
|
|
if (UlongToHandle(reply->pid) == spi->UniqueProcessId)
|
2003-09-16 03:07:21 +02:00
|
|
|
{
|
|
|
|
/* ftKernelTime, ftUserTime, ftCreateTime;
|
|
|
|
* dwTickCount, dwStartAddress
|
|
|
|
*/
|
2005-06-07 22:01:48 +02:00
|
|
|
|
|
|
|
memset(&spi->ti[i], 0, sizeof(spi->ti));
|
|
|
|
|
2009-01-03 14:54:11 +01:00
|
|
|
spi->ti[i].CreateTime.QuadPart = 0xdeadbeef;
|
|
|
|
spi->ti[i].ClientId.UniqueProcess = UlongToHandle(reply->pid);
|
|
|
|
spi->ti[i].ClientId.UniqueThread = UlongToHandle(reply->tid);
|
2003-09-16 03:07:21 +02:00
|
|
|
spi->ti[i].dwCurrentPriority = reply->base_pri + reply->delta_pri;
|
|
|
|
spi->ti[i].dwBasePriority = reply->base_pri;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
}
|
|
|
|
if (ret == STATUS_NO_MORE_FILES) ret = STATUS_SUCCESS;
|
|
|
|
|
|
|
|
/* now append process name */
|
2009-01-03 14:54:11 +01:00
|
|
|
spi->ProcessName.Buffer = (WCHAR*)((char*)spi + spi->NextEntryOffset);
|
2005-06-06 17:42:08 +02:00
|
|
|
spi->ProcessName.Length = wlen - sizeof(WCHAR);
|
|
|
|
spi->ProcessName.MaximumLength = wlen;
|
2005-06-16 11:44:39 +02:00
|
|
|
memcpy( spi->ProcessName.Buffer, exename, wlen );
|
2009-01-03 14:54:11 +01:00
|
|
|
spi->NextEntryOffset += wlen;
|
2003-09-16 03:07:21 +02:00
|
|
|
|
|
|
|
last = spi;
|
2009-01-03 14:54:11 +01:00
|
|
|
spi = (SYSTEM_PROCESS_INFORMATION*)((char*)spi + spi->NextEntryOffset);
|
2003-09-16 03:07:21 +02:00
|
|
|
}
|
|
|
|
}
|
2009-01-03 14:54:11 +01:00
|
|
|
if (ret == STATUS_SUCCESS && last) last->NextEntryOffset = 0;
|
2003-09-16 03:07:21 +02:00
|
|
|
if (hSnap) NtClose(hSnap);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SystemProcessorPerformanceInformation:
|
|
|
|
{
|
2008-10-17 22:25:30 +02:00
|
|
|
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION *sppi = NULL;
|
|
|
|
unsigned int cpus = 0;
|
|
|
|
int out_cpus = Length / sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION);
|
|
|
|
|
|
|
|
if (out_cpus == 0)
|
|
|
|
{
|
|
|
|
len = 0;
|
|
|
|
ret = STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#ifdef __APPLE__
|
|
|
|
{
|
|
|
|
processor_cpu_load_info_data_t *pinfo;
|
|
|
|
mach_msg_type_number_t info_count;
|
|
|
|
|
|
|
|
if (host_processor_info (mach_host_self (),
|
|
|
|
PROCESSOR_CPU_LOAD_INFO,
|
|
|
|
&cpus,
|
|
|
|
(processor_info_array_t*)&pinfo,
|
|
|
|
&info_count) == 0)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
cpus = min(cpus,out_cpus);
|
|
|
|
len = sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * cpus;
|
|
|
|
sppi = RtlAllocateHeap(GetProcessHeap(), 0,len);
|
|
|
|
for (i = 0; i < cpus; i++)
|
|
|
|
{
|
2009-08-28 21:15:22 +02:00
|
|
|
sppi[i].IdleTime.QuadPart = pinfo[i].cpu_ticks[CPU_STATE_IDLE];
|
|
|
|
sppi[i].KernelTime.QuadPart = pinfo[i].cpu_ticks[CPU_STATE_SYSTEM];
|
|
|
|
sppi[i].UserTime.QuadPart = pinfo[i].cpu_ticks[CPU_STATE_USER];
|
2008-10-17 22:25:30 +02:00
|
|
|
}
|
2008-10-31 21:17:17 +01:00
|
|
|
vm_deallocate (mach_task_self (), (vm_address_t) pinfo, info_count * sizeof(natural_t));
|
2008-10-17 22:25:30 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
{
|
2009-09-15 21:38:07 +02:00
|
|
|
FILE *cpuinfo = fopen("/proc/stat", "r");
|
2008-10-17 22:25:30 +02:00
|
|
|
if (cpuinfo)
|
|
|
|
{
|
|
|
|
unsigned usr,nice,sys;
|
|
|
|
unsigned long idle;
|
|
|
|
int count;
|
|
|
|
char name[10];
|
2008-10-31 21:17:17 +01:00
|
|
|
char line[255];
|
2008-10-17 22:25:30 +02:00
|
|
|
|
|
|
|
/* first line is combined usage */
|
2008-10-31 21:17:17 +01:00
|
|
|
if (fgets(line,255,cpuinfo))
|
2009-09-15 21:38:07 +02:00
|
|
|
count = sscanf(line, "%s %u %u %u %lu", name, &usr, &nice,
|
|
|
|
&sys, &idle);
|
2008-10-31 21:17:17 +01:00
|
|
|
else
|
|
|
|
count = 0;
|
2008-10-17 22:25:30 +02:00
|
|
|
/* we set this up in the for older non-smp enabled kernels */
|
2009-09-15 21:38:07 +02:00
|
|
|
if (count == 5 && strcmp(name, "cpu") == 0)
|
2008-10-17 22:25:30 +02:00
|
|
|
{
|
|
|
|
sppi = RtlAllocateHeap(GetProcessHeap(), 0,
|
|
|
|
sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION));
|
2009-08-27 19:30:50 +02:00
|
|
|
sppi->IdleTime.QuadPart = idle;
|
|
|
|
sppi->KernelTime.QuadPart = sys;
|
|
|
|
sppi->UserTime.QuadPart = usr;
|
2008-10-17 22:25:30 +02:00
|
|
|
cpus = 1;
|
|
|
|
len = sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION);
|
|
|
|
}
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2009-09-15 21:38:07 +02:00
|
|
|
if (fgets(line, 255, cpuinfo))
|
|
|
|
count = sscanf(line, "%s %u %u %u %lu", name, &usr,
|
|
|
|
&nice, &sys, &idle);
|
2008-10-31 21:17:17 +01:00
|
|
|
else
|
|
|
|
count = 0;
|
2009-09-15 21:38:07 +02:00
|
|
|
if (count == 5 && strncmp(name, "cpu", 3)==0)
|
2008-10-17 22:25:30 +02:00
|
|
|
{
|
|
|
|
out_cpus --;
|
|
|
|
if (name[3]=='0') /* first cpu */
|
|
|
|
{
|
2009-08-27 19:30:50 +02:00
|
|
|
sppi->IdleTime.QuadPart = idle;
|
|
|
|
sppi->KernelTime.QuadPart = sys;
|
|
|
|
sppi->UserTime.QuadPart = usr;
|
2008-10-17 22:25:30 +02:00
|
|
|
}
|
|
|
|
else /* new cpu */
|
|
|
|
{
|
|
|
|
len = sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * (cpus+1);
|
|
|
|
sppi = RtlReAllocateHeap(GetProcessHeap(), 0, sppi, len);
|
2009-08-27 19:30:50 +02:00
|
|
|
sppi[cpus].IdleTime.QuadPart = idle;
|
|
|
|
sppi[cpus].KernelTime.QuadPart = sys;
|
|
|
|
sppi[cpus].UserTime.QuadPart = usr;
|
2008-10-17 22:25:30 +02:00
|
|
|
cpus++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
} while (out_cpus > 0);
|
|
|
|
fclose(cpuinfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (cpus == 0)
|
|
|
|
{
|
|
|
|
static int i = 1;
|
|
|
|
|
|
|
|
sppi = RtlAllocateHeap(GetProcessHeap(),0,sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION));
|
2005-07-05 13:46:37 +02:00
|
|
|
|
2008-10-17 22:25:30 +02:00
|
|
|
memset(sppi, 0 , sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION));
|
|
|
|
FIXME("stub info_class SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION\n");
|
|
|
|
|
|
|
|
/* many programs expect these values to change so fake change */
|
|
|
|
len = sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION);
|
2009-08-27 19:30:50 +02:00
|
|
|
sppi->KernelTime.QuadPart = 1 * i;
|
|
|
|
sppi->UserTime.QuadPart = 2 * i;
|
|
|
|
sppi->IdleTime.QuadPart = 3 * i;
|
2008-10-17 22:25:30 +02:00
|
|
|
i++;
|
|
|
|
}
|
2005-07-05 13:46:37 +02:00
|
|
|
|
|
|
|
if (Length >= len)
|
2003-09-16 03:07:21 +02:00
|
|
|
{
|
2005-07-05 13:46:37 +02:00
|
|
|
if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
|
2008-10-17 22:25:30 +02:00
|
|
|
else memcpy( SystemInformation, sppi, len);
|
2003-09-16 03:07:21 +02:00
|
|
|
}
|
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
2008-10-17 22:25:30 +02:00
|
|
|
|
|
|
|
RtlFreeHeap(GetProcessHeap(),0,sppi);
|
2003-09-16 03:07:21 +02:00
|
|
|
}
|
|
|
|
break;
|
2005-05-20 11:40:59 +02:00
|
|
|
case SystemModuleInformation:
|
2007-06-19 16:58:42 +02:00
|
|
|
/* FIXME: should be system-wide */
|
2007-07-04 12:07:22 +02:00
|
|
|
if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
|
|
|
|
else ret = LdrQueryProcessModuleInformation( SystemInformation, Length, &len );
|
2005-05-13 15:55:51 +02:00
|
|
|
break;
|
2005-05-10 15:15:58 +02:00
|
|
|
case SystemHandleInformation:
|
|
|
|
{
|
|
|
|
SYSTEM_HANDLE_INFORMATION shi;
|
|
|
|
|
|
|
|
memset(&shi, 0, sizeof(shi));
|
|
|
|
len = sizeof(shi);
|
2003-09-16 03:07:21 +02:00
|
|
|
|
2005-05-10 15:15:58 +02:00
|
|
|
if ( Length >= len)
|
|
|
|
{
|
|
|
|
if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
|
|
|
|
else memcpy( SystemInformation, &shi, len);
|
|
|
|
}
|
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
2007-10-28 00:02:41 +02:00
|
|
|
FIXME("info_class SYSTEM_HANDLE_INFORMATION\n");
|
2005-05-10 15:15:58 +02:00
|
|
|
}
|
|
|
|
break;
|
2003-09-16 03:07:21 +02:00
|
|
|
case SystemCacheInformation:
|
|
|
|
{
|
2005-07-05 13:46:37 +02:00
|
|
|
SYSTEM_CACHE_INFORMATION sci;
|
|
|
|
|
|
|
|
memset(&sci, 0, sizeof(sci)); /* FIXME */
|
|
|
|
len = sizeof(sci);
|
|
|
|
|
|
|
|
if ( Length >= len)
|
2003-09-16 03:07:21 +02:00
|
|
|
{
|
2005-07-05 13:46:37 +02:00
|
|
|
if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
|
|
|
|
else memcpy( SystemInformation, &sci, len);
|
2003-09-16 03:07:21 +02:00
|
|
|
}
|
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
2007-10-28 00:02:41 +02:00
|
|
|
FIXME("info_class SYSTEM_CACHE_INFORMATION\n");
|
2003-09-16 03:07:21 +02:00
|
|
|
}
|
|
|
|
break;
|
2005-05-13 15:55:51 +02:00
|
|
|
case SystemInterruptInformation:
|
|
|
|
{
|
|
|
|
SYSTEM_INTERRUPT_INFORMATION sii;
|
|
|
|
|
|
|
|
memset(&sii, 0, sizeof(sii));
|
|
|
|
len = sizeof(sii);
|
|
|
|
|
|
|
|
if ( Length >= len)
|
|
|
|
{
|
|
|
|
if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
|
|
|
|
else memcpy( SystemInformation, &sii, len);
|
|
|
|
}
|
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
2007-10-28 00:02:41 +02:00
|
|
|
FIXME("info_class SYSTEM_INTERRUPT_INFORMATION\n");
|
2005-05-13 15:55:51 +02:00
|
|
|
}
|
|
|
|
break;
|
2005-05-10 15:15:58 +02:00
|
|
|
case SystemKernelDebuggerInformation:
|
|
|
|
{
|
2005-07-05 13:46:37 +02:00
|
|
|
SYSTEM_KERNEL_DEBUGGER_INFORMATION skdi;
|
|
|
|
|
|
|
|
skdi.DebuggerEnabled = FALSE;
|
|
|
|
skdi.DebuggerNotPresent = TRUE;
|
|
|
|
len = sizeof(skdi);
|
|
|
|
|
|
|
|
if ( Length >= len)
|
2005-05-10 15:15:58 +02:00
|
|
|
{
|
2005-07-05 13:46:37 +02:00
|
|
|
if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
|
|
|
|
else memcpy( SystemInformation, &skdi, len);
|
2005-05-10 15:15:58 +02:00
|
|
|
}
|
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
}
|
|
|
|
break;
|
2003-09-16 03:07:21 +02:00
|
|
|
case SystemRegistryQuotaInformation:
|
|
|
|
{
|
2005-07-05 13:46:37 +02:00
|
|
|
/* Something to do with the size of the registry *
|
|
|
|
* Since we don't have a size limitation, fake it *
|
|
|
|
* This is almost certainly wrong. *
|
|
|
|
* This sets each of the three words in the struct to 32 MB, *
|
|
|
|
* which is enough to make the IE 5 installer happy. */
|
|
|
|
SYSTEM_REGISTRY_QUOTA_INFORMATION srqi;
|
|
|
|
|
|
|
|
srqi.RegistryQuotaAllowed = 0x2000000;
|
|
|
|
srqi.RegistryQuotaUsed = 0x200000;
|
|
|
|
srqi.Reserved1 = (void*)0x200000;
|
|
|
|
len = sizeof(srqi);
|
|
|
|
|
|
|
|
if ( Length >= len)
|
2003-09-16 03:07:21 +02:00
|
|
|
{
|
2005-07-05 13:46:37 +02:00
|
|
|
if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FIXME("SystemRegistryQuotaInformation: faking max registry size of 32 MB\n");
|
|
|
|
memcpy( SystemInformation, &srqi, len);
|
|
|
|
}
|
2003-09-16 03:07:21 +02:00
|
|
|
}
|
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
}
|
2000-12-06 20:45:07 +01:00
|
|
|
break;
|
|
|
|
default:
|
2006-10-16 13:49:06 +02:00
|
|
|
FIXME("(0x%08x,%p,0x%08x,%p) stub\n",
|
2000-12-06 20:45:07 +01:00
|
|
|
SystemInformationClass,SystemInformation,Length,ResultLength);
|
2005-04-15 16:12:54 +02:00
|
|
|
|
|
|
|
/* Several Information Classes are not implemented on Windows and return 2 different values
|
|
|
|
* STATUS_NOT_IMPLEMENTED or STATUS_INVALID_INFO_CLASS
|
|
|
|
* in 95% of the cases it's STATUS_INVALID_INFO_CLASS, so use this as the default
|
|
|
|
*/
|
|
|
|
ret = STATUS_INVALID_INFO_CLASS;
|
2000-12-06 20:45:07 +01:00
|
|
|
}
|
2005-04-15 16:12:54 +02:00
|
|
|
|
2003-09-16 03:07:21 +02:00
|
|
|
if (ResultLength) *ResultLength = len;
|
2000-12-06 20:45:07 +01:00
|
|
|
|
2003-09-16 03:07:21 +02:00
|
|
|
return ret;
|
1998-12-24 15:34:55 +01:00
|
|
|
}
|
|
|
|
|
2006-01-20 19:41:04 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* NtSetSystemInformation [NTDLL.@]
|
|
|
|
* ZwSetSystemInformation [NTDLL.@]
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI NtSetSystemInformation(SYSTEM_INFORMATION_CLASS SystemInformationClass, PVOID SystemInformation, ULONG Length)
|
|
|
|
{
|
2006-10-16 13:49:06 +02:00
|
|
|
FIXME("(0x%08x,%p,0x%08x) stub\n",SystemInformationClass,SystemInformation,Length);
|
2006-01-20 19:41:04 +01:00
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
1998-11-01 15:00:21 +01:00
|
|
|
|
1999-02-13 08:35:31 +01:00
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtCreatePagingFile [NTDLL.@]
|
2001-07-11 20:56:41 +02:00
|
|
|
* ZwCreatePagingFile [NTDLL.@]
|
1999-02-13 08:35:31 +01:00
|
|
|
*/
|
1999-03-09 18:47:51 +01:00
|
|
|
NTSTATUS WINAPI NtCreatePagingFile(
|
2005-06-16 12:46:11 +02:00
|
|
|
PUNICODE_STRING PageFileName,
|
2005-10-03 20:44:52 +02:00
|
|
|
PLARGE_INTEGER MinimumSize,
|
|
|
|
PLARGE_INTEGER MaximumSize,
|
2005-06-16 12:46:11 +02:00
|
|
|
PLARGE_INTEGER ActualSize)
|
1999-02-13 08:35:31 +01:00
|
|
|
{
|
2005-10-03 20:44:52 +02:00
|
|
|
FIXME("(%p %p %p %p) stub\n", PageFileName, MinimumSize, MaximumSize, ActualSize);
|
2005-06-16 12:46:11 +02:00
|
|
|
return STATUS_SUCCESS;
|
1999-02-13 08:35:31 +01:00
|
|
|
}
|
|
|
|
|
1999-04-11 16:53:24 +02:00
|
|
|
/******************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* NtDisplayString [NTDLL.@]
|
2002-06-01 01:06:46 +02:00
|
|
|
*
|
1999-04-11 16:53:24 +02:00
|
|
|
* writes a string to the nt-textmode screen eg. during startup
|
|
|
|
*/
|
2000-09-29 02:31:57 +02:00
|
|
|
NTSTATUS WINAPI NtDisplayString ( PUNICODE_STRING string )
|
1999-04-11 16:53:24 +02:00
|
|
|
{
|
2000-09-29 02:31:57 +02:00
|
|
|
STRING stringA;
|
|
|
|
NTSTATUS ret;
|
|
|
|
|
|
|
|
if (!(ret = RtlUnicodeStringToAnsiString( &stringA, string, TRUE )))
|
|
|
|
{
|
|
|
|
MESSAGE( "%.*s", stringA.Length, stringA.Buffer );
|
|
|
|
RtlFreeAnsiString( &stringA );
|
|
|
|
}
|
|
|
|
return ret;
|
1999-04-11 16:53:24 +02:00
|
|
|
}
|
1999-12-10 04:27:15 +01:00
|
|
|
|
2005-04-16 12:45:51 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* NtInitiatePowerAction [NTDLL.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI NtInitiatePowerAction(
|
|
|
|
IN POWER_ACTION SystemAction,
|
|
|
|
IN SYSTEM_POWER_STATE MinSystemState,
|
|
|
|
IN ULONG Flags,
|
|
|
|
IN BOOLEAN Asynchronous)
|
|
|
|
{
|
2006-10-16 13:49:06 +02:00
|
|
|
FIXME("(%d,%d,0x%08x,%d),stub\n",
|
2005-04-16 12:45:51 +02:00
|
|
|
SystemAction,MinSystemState,Flags,Asynchronous);
|
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-12-10 04:27:15 +01:00
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtPowerInformation [NTDLL.@]
|
2002-06-01 01:06:46 +02:00
|
|
|
*
|
1999-12-10 04:27:15 +01:00
|
|
|
*/
|
2005-04-16 12:45:51 +02:00
|
|
|
NTSTATUS WINAPI NtPowerInformation(
|
|
|
|
IN POWER_INFORMATION_LEVEL InformationLevel,
|
|
|
|
IN PVOID lpInputBuffer,
|
|
|
|
IN ULONG nInputBufferSize,
|
|
|
|
IN PVOID lpOutputBuffer,
|
|
|
|
IN ULONG nOutputBufferSize)
|
1999-12-10 04:27:15 +01:00
|
|
|
{
|
2006-10-16 13:49:06 +02:00
|
|
|
TRACE("(%d,%p,%d,%p,%d)\n",
|
2005-04-16 12:45:51 +02:00
|
|
|
InformationLevel,lpInputBuffer,nInputBufferSize,lpOutputBuffer,nOutputBufferSize);
|
2005-04-18 11:52:32 +02:00
|
|
|
switch(InformationLevel) {
|
|
|
|
case SystemPowerCapabilities: {
|
2009-03-17 00:12:11 +01:00
|
|
|
PSYSTEM_POWER_CAPABILITIES PowerCaps = lpOutputBuffer;
|
2005-04-18 11:52:32 +02:00
|
|
|
FIXME("semi-stub: SystemPowerCapabilities\n");
|
|
|
|
if (nOutputBufferSize < sizeof(SYSTEM_POWER_CAPABILITIES))
|
|
|
|
return STATUS_BUFFER_TOO_SMALL;
|
|
|
|
/* FIXME: These values are based off a native XP desktop, should probably use APM/ACPI to get the 'real' values */
|
|
|
|
PowerCaps->PowerButtonPresent = TRUE;
|
|
|
|
PowerCaps->SleepButtonPresent = FALSE;
|
|
|
|
PowerCaps->LidPresent = FALSE;
|
|
|
|
PowerCaps->SystemS1 = TRUE;
|
|
|
|
PowerCaps->SystemS2 = FALSE;
|
|
|
|
PowerCaps->SystemS3 = FALSE;
|
|
|
|
PowerCaps->SystemS4 = TRUE;
|
|
|
|
PowerCaps->SystemS5 = TRUE;
|
|
|
|
PowerCaps->HiberFilePresent = TRUE;
|
|
|
|
PowerCaps->FullWake = TRUE;
|
|
|
|
PowerCaps->VideoDimPresent = FALSE;
|
|
|
|
PowerCaps->ApmPresent = FALSE;
|
|
|
|
PowerCaps->UpsPresent = FALSE;
|
|
|
|
PowerCaps->ThermalControl = FALSE;
|
|
|
|
PowerCaps->ProcessorThrottle = FALSE;
|
|
|
|
PowerCaps->ProcessorMinThrottle = 100;
|
|
|
|
PowerCaps->ProcessorMaxThrottle = 100;
|
|
|
|
PowerCaps->DiskSpinDown = TRUE;
|
|
|
|
PowerCaps->SystemBatteriesPresent = FALSE;
|
|
|
|
PowerCaps->BatteriesAreShortTerm = FALSE;
|
|
|
|
PowerCaps->BatteryScale[0].Granularity = 0;
|
|
|
|
PowerCaps->BatteryScale[0].Capacity = 0;
|
|
|
|
PowerCaps->BatteryScale[1].Granularity = 0;
|
|
|
|
PowerCaps->BatteryScale[1].Capacity = 0;
|
|
|
|
PowerCaps->BatteryScale[2].Granularity = 0;
|
|
|
|
PowerCaps->BatteryScale[2].Capacity = 0;
|
|
|
|
PowerCaps->AcOnLineWake = PowerSystemUnspecified;
|
|
|
|
PowerCaps->SoftLidWake = PowerSystemUnspecified;
|
|
|
|
PowerCaps->RtcWake = PowerSystemSleeping1;
|
|
|
|
PowerCaps->MinDeviceWakeState = PowerSystemUnspecified;
|
|
|
|
PowerCaps->DefaultLowLatencyWake = PowerSystemUnspecified;
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
2009-07-14 18:02:59 +02:00
|
|
|
case SystemExecutionState: {
|
|
|
|
PULONG ExecutionState = lpOutputBuffer;
|
2009-08-09 00:17:15 +02:00
|
|
|
WARN("semi-stub: SystemExecutionState\n"); /* Needed for .NET Framework, but using a FIXME is really noisy. */
|
2009-07-14 18:02:59 +02:00
|
|
|
if (lpInputBuffer != NULL)
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
/* FIXME: The actual state should be the value set by SetThreadExecutionState which is not currently implemented. */
|
|
|
|
*ExecutionState = ES_USER_PRESENT;
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
2009-09-15 21:38:15 +02:00
|
|
|
case ProcessorInformation: {
|
|
|
|
PPROCESSOR_POWER_INFORMATION cpu_power = lpOutputBuffer;
|
|
|
|
|
|
|
|
WARN("semi-stub: ProcessorInformation\n");
|
|
|
|
if (nOutputBufferSize < sizeof(PROCESSOR_POWER_INFORMATION))
|
|
|
|
return STATUS_BUFFER_TOO_SMALL;
|
|
|
|
cpu_power->Number = NtCurrentTeb()->Peb->NumberOfProcessors;
|
|
|
|
cpu_power->MaxMhz = cpuHz / 1000000;
|
|
|
|
cpu_power->CurrentMhz = cpuHz / 1000000;
|
|
|
|
cpu_power->MhzLimit = cpuHz / 1000000;
|
|
|
|
cpu_power->MaxIdleState = 0; /* FIXME */
|
|
|
|
cpu_power->CurrentIdleState = 0; /* FIXME */
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
2005-04-18 11:52:32 +02:00
|
|
|
default:
|
2009-05-21 22:07:02 +02:00
|
|
|
/* FIXME: Needed by .NET Framework */
|
|
|
|
WARN("Unimplemented NtPowerInformation action: %d\n", InformationLevel);
|
2005-04-18 11:52:32 +02:00
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
|
|
|
}
|
1999-12-10 04:27:15 +01:00
|
|
|
}
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
|
2004-09-14 21:30:36 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* NtShutdownSystem [NTDLL.@]
|
|
|
|
*
|
|
|
|
*/
|
2005-06-16 12:46:11 +02:00
|
|
|
NTSTATUS WINAPI NtShutdownSystem(SHUTDOWN_ACTION Action)
|
2004-09-14 21:30:36 +02:00
|
|
|
{
|
2005-06-16 12:46:11 +02:00
|
|
|
FIXME("%d\n",Action);
|
|
|
|
return STATUS_SUCCESS;
|
2004-09-14 21:30:36 +02:00
|
|
|
}
|
|
|
|
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
/******************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* NtAllocateLocallyUniqueId (NTDLL.@)
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI NtAllocateLocallyUniqueId(PLUID Luid)
|
|
|
|
{
|
2007-03-07 01:33:26 +01:00
|
|
|
NTSTATUS status;
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
|
2007-03-07 01:33:26 +01:00
|
|
|
TRACE("%p\n", Luid);
|
2004-11-04 05:52:17 +01:00
|
|
|
|
|
|
|
if (!Luid)
|
|
|
|
return STATUS_ACCESS_VIOLATION;
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
|
2007-03-07 01:33:26 +01:00
|
|
|
SERVER_START_REQ( allocate_locally_unique_id )
|
|
|
|
{
|
|
|
|
status = wine_server_call( req );
|
|
|
|
if (!status)
|
|
|
|
{
|
|
|
|
Luid->LowPart = reply->luid.low_part;
|
|
|
|
Luid->HighPart = reply->luid.high_part;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
2001-11-20 19:52:20 +01:00
|
|
|
|
2007-03-07 01:33:26 +01:00
|
|
|
return status;
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
}
|
2002-05-09 22:30:52 +02:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* VerSetConditionMask (NTDLL.@)
|
|
|
|
*/
|
|
|
|
ULONGLONG WINAPI VerSetConditionMask( ULONGLONG dwlConditionMask, DWORD dwTypeBitMask,
|
|
|
|
BYTE dwConditionMask)
|
|
|
|
{
|
2002-05-20 00:20:09 +02:00
|
|
|
if(dwTypeBitMask == 0)
|
|
|
|
return dwlConditionMask;
|
|
|
|
dwConditionMask &= 0x07;
|
|
|
|
if(dwConditionMask == 0)
|
|
|
|
return dwlConditionMask;
|
|
|
|
|
|
|
|
if(dwTypeBitMask & VER_PRODUCT_TYPE)
|
|
|
|
dwlConditionMask |= dwConditionMask << 7*3;
|
|
|
|
else if (dwTypeBitMask & VER_SUITENAME)
|
|
|
|
dwlConditionMask |= dwConditionMask << 6*3;
|
|
|
|
else if (dwTypeBitMask & VER_SERVICEPACKMAJOR)
|
|
|
|
dwlConditionMask |= dwConditionMask << 5*3;
|
|
|
|
else if (dwTypeBitMask & VER_SERVICEPACKMINOR)
|
|
|
|
dwlConditionMask |= dwConditionMask << 4*3;
|
|
|
|
else if (dwTypeBitMask & VER_PLATFORMID)
|
|
|
|
dwlConditionMask |= dwConditionMask << 3*3;
|
|
|
|
else if (dwTypeBitMask & VER_BUILDNUMBER)
|
|
|
|
dwlConditionMask |= dwConditionMask << 2*3;
|
|
|
|
else if (dwTypeBitMask & VER_MAJORVERSION)
|
|
|
|
dwlConditionMask |= dwConditionMask << 1*3;
|
|
|
|
else if (dwTypeBitMask & VER_MINORVERSION)
|
|
|
|
dwlConditionMask |= dwConditionMask << 0*3;
|
2002-05-09 22:30:52 +02:00
|
|
|
return dwlConditionMask;
|
|
|
|
}
|
2005-10-27 12:25:41 +02:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* NtAccessCheckAndAuditAlarm (NTDLL.@)
|
|
|
|
* ZwAccessCheckAndAuditAlarm (NTDLL.@)
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI NtAccessCheckAndAuditAlarm(PUNICODE_STRING SubsystemName, HANDLE HandleId, PUNICODE_STRING ObjectTypeName,
|
|
|
|
PUNICODE_STRING ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor,
|
|
|
|
ACCESS_MASK DesiredAccess, PGENERIC_MAPPING GenericMapping, BOOLEAN ObjectCreation,
|
|
|
|
PACCESS_MASK GrantedAccess, PBOOLEAN AccessStatus, PBOOLEAN GenerateOnClose)
|
|
|
|
{
|
2006-10-16 13:49:06 +02:00
|
|
|
FIXME("(%s, %p, %s, %p, 0x%08x, %p, %d, %p, %p, %p), stub\n", debugstr_us(SubsystemName), HandleId,
|
2005-10-27 12:25:41 +02:00
|
|
|
debugstr_us(ObjectTypeName), SecurityDescriptor, DesiredAccess, GenericMapping, ObjectCreation,
|
|
|
|
GrantedAccess, AccessStatus, GenerateOnClose);
|
|
|
|
|
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
|
|
|
}
|