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
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
1998-11-01 15:00:21 +01:00
|
|
|
*/
|
|
|
|
|
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>
|
|
|
|
#include <string.h>
|
|
|
|
#include <time.h>
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
1999-02-13 08:35:31 +01:00
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winreg.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"
|
1999-03-09 18:47:51 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
2005-02-23 21:29:17 +01:00
|
|
|
/* FIXME: fixed at 2005/2/22 */
|
|
|
|
static LONGLONG boottime = (LONGLONG)1275356510 * 100000000;
|
|
|
|
|
2002-12-10 21:04:40 +01:00
|
|
|
/* Structures used by NtConnectPort */
|
|
|
|
|
|
|
|
typedef struct LpcSectionInfo
|
|
|
|
{
|
|
|
|
DWORD Length;
|
|
|
|
HANDLE SectionHandle;
|
|
|
|
DWORD Param1;
|
|
|
|
DWORD SectionSize;
|
|
|
|
DWORD ClientBaseAddress;
|
|
|
|
DWORD ServerBaseAddress;
|
|
|
|
} LPCSECTIONINFO, *PLPCSECTIONINFO;
|
|
|
|
|
|
|
|
typedef struct LpcSectionMapInfo
|
|
|
|
{
|
|
|
|
DWORD Length;
|
|
|
|
DWORD SectionSize;
|
|
|
|
DWORD ServerBaseAddress;
|
|
|
|
} LPCSECTIONMAPINFO, *PLPCSECTIONMAPINFO;
|
|
|
|
|
|
|
|
/* Structure used by NtAcceptConnectPort, NtReplyWaitReceivePort */
|
|
|
|
|
|
|
|
#define MAX_MESSAGE_DATA 328
|
|
|
|
|
|
|
|
typedef struct LpcMessage
|
|
|
|
{
|
|
|
|
WORD ActualMessageLength;
|
|
|
|
WORD TotalMessageLength;
|
|
|
|
DWORD MessageType;
|
|
|
|
DWORD ClientProcessId;
|
|
|
|
DWORD ClientThreadId;
|
|
|
|
DWORD MessageId;
|
|
|
|
DWORD SharedSectionSize;
|
|
|
|
BYTE MessageData[MAX_MESSAGE_DATA];
|
|
|
|
} LPCMESSAGE, *PLPCMESSAGE;
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
TRACE("(%p,0x%08lx,%p,0x%08x,0x%08x,%p)\n",
|
|
|
|
ExistingToken, DesiredAccess, ObjectAttributes,
|
|
|
|
ImpersonationLevel, TokenType, NewToken);
|
|
|
|
dump_ObjectAttributes(ObjectAttributes);
|
|
|
|
|
|
|
|
SERVER_START_REQ( duplicate_token )
|
|
|
|
{
|
|
|
|
req->handle = ExistingToken;
|
|
|
|
req->access = DesiredAccess;
|
|
|
|
req->inherit = ObjectAttributes && (ObjectAttributes->Attributes & OBJ_INHERIT);
|
|
|
|
req->primary = (TokenType == TokenPrimary);
|
|
|
|
req->impersonation_level = ImpersonationLevel;
|
|
|
|
status = wine_server_call( req );
|
|
|
|
if (!status) *NewToken = reply->new_handle;
|
|
|
|
}
|
|
|
|
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)
|
1999-02-13 08:35:31 +01:00
|
|
|
{
|
2003-07-24 02:07:00 +02:00
|
|
|
NTSTATUS ret;
|
|
|
|
|
|
|
|
TRACE("(%p,0x%08lx,%p)\n", ProcessHandle,DesiredAccess, TokenHandle);
|
|
|
|
|
|
|
|
SERVER_START_REQ( open_token )
|
|
|
|
{
|
|
|
|
req->handle = ProcessHandle;
|
|
|
|
req->flags = 0;
|
|
|
|
ret = wine_server_call( req );
|
|
|
|
if (!ret) *TokenHandle = reply->token;
|
|
|
|
}
|
|
|
|
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)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2003-07-24 02:07:00 +02:00
|
|
|
NTSTATUS ret;
|
|
|
|
|
|
|
|
TRACE("(%p,0x%08lx,0x%08x,%p)\n",
|
|
|
|
ThreadHandle,DesiredAccess, OpenAsSelf, TokenHandle);
|
|
|
|
|
|
|
|
SERVER_START_REQ( open_token )
|
|
|
|
{
|
|
|
|
req->handle = ThreadHandle;
|
|
|
|
req->flags = OPEN_TOKEN_THREAD;
|
|
|
|
if (OpenAsSelf) req->flags |= OPEN_TOKEN_AS_SELF;
|
|
|
|
ret = wine_server_call( req );
|
|
|
|
if (!ret) *TokenHandle = reply->token;
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
|
|
|
|
TRACE("(%p,0x%08x,%p,0x%08lx,%p,%p)\n",
|
|
|
|
TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength);
|
|
|
|
|
|
|
|
SERVER_START_REQ( adjust_token_privileges )
|
|
|
|
{
|
|
|
|
req->handle = TokenHandle;
|
|
|
|
req->disable_all = DisableAllPrivileges;
|
|
|
|
req->get_modified_state = (PreviousState != NULL);
|
|
|
|
if (!DisableAllPrivileges)
|
|
|
|
{
|
|
|
|
wine_server_add_data( req, &NewState->Privileges,
|
|
|
|
NewState->PrivilegeCount * sizeof(NewState->Privileges[0]) );
|
|
|
|
}
|
|
|
|
if (PreviousState && BufferLength >= FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ))
|
|
|
|
wine_server_set_reply( req, &PreviousState->Privileges,
|
|
|
|
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,
|
2002-06-01 01:06:46 +02:00
|
|
|
DWORD tokeninfoclass,
|
1999-03-09 18:47:51 +01:00
|
|
|
LPVOID tokeninfo,
|
|
|
|
DWORD tokeninfolength,
|
2002-06-01 01:06:46 +02:00
|
|
|
LPDWORD retlen )
|
1999-02-13 08:35:31 +01:00
|
|
|
{
|
2000-11-01 22:38:09 +01:00
|
|
|
unsigned int len = 0;
|
2005-02-11 12:52:06 +01:00
|
|
|
NTSTATUS status = STATUS_SUCCESS;
|
2000-11-01 22:38:09 +01:00
|
|
|
|
2004-04-19 21:25:29 +02:00
|
|
|
TRACE("(%p,%ld,%p,%ld,%p)\n",
|
2000-11-01 22:38:09 +01:00
|
|
|
token,tokeninfoclass,tokeninfo,tokeninfolength,retlen);
|
|
|
|
|
|
|
|
switch (tokeninfoclass)
|
|
|
|
{
|
|
|
|
case TokenUser:
|
|
|
|
len = sizeof(TOKEN_USER) + sizeof(SID);
|
|
|
|
break;
|
|
|
|
case TokenGroups:
|
|
|
|
len = sizeof(TOKEN_GROUPS);
|
|
|
|
break;
|
|
|
|
case TokenOwner:
|
2003-12-30 20:17:05 +01:00
|
|
|
len = sizeof(TOKEN_OWNER) + sizeof(SID);
|
2000-11-01 22:38:09 +01:00
|
|
|
break;
|
|
|
|
case TokenPrimaryGroup:
|
|
|
|
len = sizeof(TOKEN_PRIMARY_GROUP);
|
|
|
|
break;
|
|
|
|
case TokenDefaultDacl:
|
|
|
|
len = sizeof(TOKEN_DEFAULT_DACL);
|
|
|
|
break;
|
|
|
|
case TokenSource:
|
|
|
|
len = sizeof(TOKEN_SOURCE);
|
|
|
|
break;
|
|
|
|
case TokenType:
|
|
|
|
len = sizeof (TOKEN_TYPE);
|
|
|
|
break;
|
1999-12-12 00:19:54 +01:00
|
|
|
#if 0
|
2000-11-01 22:38:09 +01:00
|
|
|
case TokenImpersonationLevel:
|
|
|
|
case TokenStatistics:
|
1999-04-25 21:01:52 +02:00
|
|
|
#endif /* 0 */
|
2000-11-01 22:38:09 +01:00
|
|
|
}
|
1998-11-01 15:00:21 +01:00
|
|
|
|
2000-11-01 22:38:09 +01:00
|
|
|
/* FIXME: what if retlen == NULL ? */
|
|
|
|
*retlen = len;
|
|
|
|
|
|
|
|
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:
|
|
|
|
if( tokeninfo )
|
|
|
|
{
|
|
|
|
TOKEN_USER * tuser = tokeninfo;
|
|
|
|
PSID sid = (PSID) (tuser + 1);
|
|
|
|
SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
|
|
|
|
RtlInitializeSid(sid, &localSidAuthority, 1);
|
|
|
|
*(RtlSubAuthoritySid(sid, 0)) = SECURITY_INTERACTIVE_RID;
|
|
|
|
tuser->User.Sid = sid;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TokenGroups:
|
|
|
|
if (tokeninfo)
|
|
|
|
{
|
|
|
|
TOKEN_GROUPS *tgroups = tokeninfo;
|
|
|
|
SID_IDENTIFIER_AUTHORITY sid = {SECURITY_NT_AUTHORITY};
|
|
|
|
|
|
|
|
/* we need to show admin privileges ! */
|
|
|
|
tgroups->GroupCount = 1;
|
2003-08-30 00:10:53 +02:00
|
|
|
tgroups->Groups->Attributes = SE_GROUP_ENABLED;
|
2000-11-01 22:38:09 +01:00
|
|
|
RtlAllocateAndInitializeSid( &sid,
|
|
|
|
2,
|
|
|
|
SECURITY_BUILTIN_DOMAIN_RID,
|
|
|
|
DOMAIN_ALIAS_RID_ADMINS,
|
|
|
|
0, 0, 0, 0, 0, 0,
|
|
|
|
&(tgroups->Groups->Sid));
|
|
|
|
}
|
|
|
|
break;
|
2004-08-18 00:28:13 +02:00
|
|
|
case TokenPrimaryGroup:
|
|
|
|
if (tokeninfo)
|
|
|
|
{
|
|
|
|
TOKEN_PRIMARY_GROUP *tgroup = tokeninfo;
|
|
|
|
SID_IDENTIFIER_AUTHORITY sid = {SECURITY_NT_AUTHORITY};
|
|
|
|
RtlAllocateAndInitializeSid( &sid,
|
|
|
|
2,
|
|
|
|
SECURITY_BUILTIN_DOMAIN_RID,
|
|
|
|
DOMAIN_ALIAS_RID_ADMINS,
|
|
|
|
0, 0, 0, 0, 0, 0,
|
|
|
|
&(tgroup->PrimaryGroup));
|
|
|
|
}
|
|
|
|
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;
|
2005-02-11 12:52:06 +01:00
|
|
|
req->handle = token;
|
|
|
|
if (tpriv && tokeninfolength > FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ))
|
|
|
|
wine_server_set_reply( req, &tpriv->Privileges, tokeninfolength - FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ) );
|
|
|
|
status = wine_server_call( req );
|
|
|
|
*retlen = FIELD_OFFSET( TOKEN_PRIVILEGES, Privileges ) + reply->len;
|
|
|
|
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:
|
|
|
|
if (tokeninfo)
|
|
|
|
{
|
|
|
|
TOKEN_OWNER *owner = tokeninfo;
|
|
|
|
PSID sid = (PSID) (owner + 1);
|
|
|
|
SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
|
|
|
|
RtlInitializeSid(sid, &localSidAuthority, 1);
|
|
|
|
*(RtlSubAuthoritySid(sid, 0)) = SECURITY_INTERACTIVE_RID;
|
|
|
|
owner->Owner = sid;
|
|
|
|
}
|
|
|
|
break;
|
2004-07-06 21:42:30 +02:00
|
|
|
default:
|
|
|
|
{
|
2004-08-18 00:09:55 +02:00
|
|
|
ERR("Unhandled Token Information class %ld!\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)
|
|
|
|
{
|
|
|
|
FIXME("%p %d %p %lu\n", TokenHandle, TokenInformationClass,
|
|
|
|
TokenInformation, TokenInformationLength);
|
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
FIXME("%p %d %p %lu %p %p\n", TokenHandle, ResetToDefault,
|
|
|
|
NewState, BufferLength, PreviousState, ReturnLength);
|
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
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,
|
|
|
|
IN PVOID SectionInformationClass,
|
|
|
|
OUT PVOID SectionInformation,
|
|
|
|
IN ULONG Length,
|
|
|
|
OUT PULONG ResultLength)
|
1999-02-13 08:35:31 +01:00
|
|
|
{
|
2002-12-05 20:56:15 +01:00
|
|
|
FIXME("(%p,%p,%p,0x%08lx,%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,
|
|
|
|
DWORD MaxConnectInfoLength,DWORD MaxDataLength,DWORD unknown)
|
1999-02-13 08:35:31 +01:00
|
|
|
{
|
2002-12-10 21:04:40 +01:00
|
|
|
FIXME("(%p,%p,0x%08lx,0x%08lx,0x%08lx),stub!\n",PortHandle,ObjectAttributes,
|
|
|
|
MaxConnectInfoLength,MaxDataLength,unknown);
|
|
|
|
return 0;
|
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
|
|
|
*/
|
2002-12-10 21:04:40 +01:00
|
|
|
NTSTATUS WINAPI NtConnectPort(PHANDLE PortHandle,PUNICODE_STRING PortName,PVOID Unknown1,
|
|
|
|
PLPCSECTIONINFO sectionInfo,PLPCSECTIONMAPINFO mapInfo,PVOID Unknown2,
|
|
|
|
PVOID ConnectInfo,PDWORD pConnectInfoLength)
|
1999-02-13 08:35:31 +01:00
|
|
|
{
|
2002-12-10 21:04:40 +01:00
|
|
|
FIXME("(%p,%s,%p,%p,%p,%p,%p,%p (%ld)),stub!\n",PortHandle,debugstr_w(PortName->Buffer),Unknown1,
|
|
|
|
sectionInfo,mapInfo,Unknown2,ConnectInfo,pConnectInfoLength,pConnectInfoLength?*pConnectInfoLength:-1);
|
|
|
|
if(ConnectInfo && pConnectInfoLength)
|
|
|
|
TRACE("\tMessage = %s\n",debugstr_an(ConnectInfo,*pConnectInfoLength));
|
|
|
|
return 0;
|
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
|
|
|
*/
|
2002-12-10 21:04:40 +01:00
|
|
|
NTSTATUS WINAPI NtListenPort(HANDLE PortHandle,PLPCMESSAGE pLpcMessage)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2002-12-10 21:04:40 +01:00
|
|
|
FIXME("(%p,%p),stub!\n",PortHandle,pLpcMessage);
|
|
|
|
return 0;
|
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
|
|
|
*/
|
2002-12-10 21:04:40 +01:00
|
|
|
NTSTATUS WINAPI NtAcceptConnectPort(PHANDLE PortHandle,DWORD Unknown,PLPCMESSAGE pLpcMessage,
|
|
|
|
DWORD acceptIt,DWORD Unknown2,PLPCSECTIONMAPINFO mapInfo)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2002-12-10 21:04:40 +01:00
|
|
|
FIXME("(%p,0x%08lx,%p,0x%08lx,0x%08lx,%p),stub!\n",PortHandle,Unknown,pLpcMessage,acceptIt,Unknown2,mapInfo);
|
|
|
|
return 0;
|
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);
|
|
|
|
return 0;
|
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);
|
|
|
|
return 0;
|
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
|
|
|
*/
|
2002-12-10 21:04:40 +01:00
|
|
|
NTSTATUS WINAPI NtRequestWaitReplyPort(HANDLE PortHandle,PLPCMESSAGE pLpcMessageIn,PLPCMESSAGE 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");
|
|
|
|
TRACE("\tActualMessageLength = %d\n",pLpcMessageIn->ActualMessageLength);
|
|
|
|
TRACE("\tTotalMessageLength = %d\n",pLpcMessageIn->TotalMessageLength);
|
|
|
|
TRACE("\tMessageType = %ld\n",pLpcMessageIn->MessageType);
|
|
|
|
TRACE("\tClientProcessId = %ld\n",pLpcMessageIn->ClientProcessId);
|
|
|
|
TRACE("\tClientThreadId = %ld\n",pLpcMessageIn->ClientThreadId);
|
|
|
|
TRACE("\tMessageId = %ld\n",pLpcMessageIn->MessageId);
|
|
|
|
TRACE("\tSharedSectionSize = %ld\n",pLpcMessageIn->SharedSectionSize);
|
|
|
|
TRACE("\tMessageData = %s\n",debugstr_an(pLpcMessageIn->MessageData,pLpcMessageIn->ActualMessageLength));
|
|
|
|
}
|
|
|
|
return 0;
|
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
|
|
|
*/
|
2002-12-10 21:04:40 +01:00
|
|
|
NTSTATUS WINAPI NtReplyWaitReceivePort(HANDLE PortHandle,PDWORD Unknown,PLPCMESSAGE pLpcMessageOut,PLPCMESSAGE pLpcMessageIn)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2002-12-10 21:04:40 +01:00
|
|
|
FIXME("(%p,%p,%p,%p),stub!\n",PortHandle,Unknown,pLpcMessageOut,pLpcMessageIn);
|
|
|
|
return 0;
|
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
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI NtSetIntervalProfile(DWORD x1,DWORD x2) {
|
1999-05-23 12:25:25 +02:00
|
|
|
FIXME("(0x%08lx,0x%08lx),stub!\n",x1,x2);
|
1998-11-01 15:00:21 +01:00
|
|
|
return 0;
|
|
|
|
}
|
1999-03-09 18:47:51 +01:00
|
|
|
|
1998-12-24 15:34:55 +01:00
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtQueryPerformanceCounter [NTDLL.@]
|
2005-01-26 21:41:36 +01:00
|
|
|
*
|
2005-02-23 21:29:17 +01:00
|
|
|
* Note: Windows uses a timer clocked at a multiple of 1193182 Hz. There is a
|
|
|
|
* good number of applications that crash when the returned frequency is either
|
|
|
|
* lower or higher then what Windows gives. Also too high counter values are
|
|
|
|
* reported to give problems.
|
1998-12-24 15:34:55 +01:00
|
|
|
*/
|
1999-02-19 17:29:05 +01:00
|
|
|
NTSTATUS WINAPI NtQueryPerformanceCounter(
|
2005-01-26 21:41:36 +01:00
|
|
|
OUT PLARGE_INTEGER Counter,
|
|
|
|
OUT PLARGE_INTEGER Frequency)
|
1999-02-13 08:35:31 +01:00
|
|
|
{
|
2005-01-26 21:41:36 +01:00
|
|
|
LARGE_INTEGER time;
|
2005-02-21 19:27:58 +01:00
|
|
|
|
|
|
|
if (!Counter) return STATUS_ACCESS_VIOLATION;
|
2005-01-26 21:41:36 +01:00
|
|
|
NtQuerySystemTime( &time );
|
2005-02-23 21:29:17 +01:00
|
|
|
time.QuadPart -= boottime;
|
|
|
|
/* convert a counter that increments at a rate of 10 MHz
|
|
|
|
* to one of 1193182 Hz, with some care for arithmetic
|
|
|
|
* overflow ( will not overflow until 3396 or so ) and
|
|
|
|
* good accuracy ( 21/176 = 0.119318182) */
|
|
|
|
Counter->QuadPart = (time.QuadPart * 21) / 176;
|
2005-02-21 19:27:58 +01:00
|
|
|
if (Frequency)
|
2005-02-23 21:29:17 +01:00
|
|
|
Frequency->QuadPart = 1193182;
|
2005-01-26 21:41:36 +01:00
|
|
|
return 0;
|
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;
|
|
|
|
|
|
|
|
TRACE("(0x%08x,%p,0x%08lx,%p)\n",
|
|
|
|
SystemInformationClass,SystemInformation,Length,ResultLength);
|
|
|
|
|
|
|
|
switch (SystemInformationClass)
|
2000-12-06 20:45:07 +01:00
|
|
|
{
|
2003-09-16 03:07:21 +02:00
|
|
|
case SystemBasicInformation:
|
|
|
|
{
|
|
|
|
SYSTEM_BASIC_INFORMATION* sbi = (SYSTEM_BASIC_INFORMATION*)SystemInformation;
|
|
|
|
if (Length >= sizeof(*sbi))
|
|
|
|
{
|
|
|
|
sbi->dwUnknown1 = 0;
|
|
|
|
sbi->uKeMaximumIncrement = 0;
|
|
|
|
sbi->uPageSize = 1024; /* FIXME */
|
|
|
|
sbi->uMmNumberOfPhysicalPages = 12345; /* FIXME */
|
|
|
|
sbi->uMmLowestPhysicalPage = 0; /* FIXME */
|
|
|
|
sbi->uMmHighestPhysicalPage = 12345; /* FIXME */
|
|
|
|
sbi->uAllocationGranularity = 65536; /* FIXME */
|
|
|
|
sbi->pLowestUserAddress = 0; /* FIXME */
|
|
|
|
sbi->pMmHighestUserAddress = (void*)~0; /* FIXME */
|
|
|
|
sbi->uKeActiveProcessors = 1; /* FIXME */
|
|
|
|
sbi->bKeNumberProcessors = 1; /* FIXME */
|
|
|
|
len = sizeof(*sbi);
|
|
|
|
}
|
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
}
|
|
|
|
break;
|
2005-01-28 13:34:20 +01:00
|
|
|
case SystemCpuInformation:
|
|
|
|
{
|
|
|
|
SYSTEM_CPU_INFORMATION* sci;
|
|
|
|
sci = (SYSTEM_CPU_INFORMATION *) SystemInformation;
|
|
|
|
if (Length >= sizeof(*sci))
|
|
|
|
{
|
|
|
|
/* FIXME: move some code from kernel/cpu.c to process this */
|
|
|
|
sci->Architecture = PROCESSOR_ARCHITECTURE_INTEL;
|
|
|
|
sci->Level = 6; /* 686, aka Pentium II+ */
|
|
|
|
sci->Revision = 0;
|
|
|
|
sci->Reserved = 0;
|
|
|
|
sci->FeatureSet = 0x1fff;
|
|
|
|
}
|
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
}
|
|
|
|
break;
|
2003-09-16 03:07:21 +02:00
|
|
|
case SystemPerformanceInformation:
|
|
|
|
{
|
|
|
|
SYSTEM_PERFORMANCE_INFORMATION* spi = (SYSTEM_PERFORMANCE_INFORMATION*)SystemInformation;
|
|
|
|
if (Length >= sizeof(*spi))
|
|
|
|
{
|
|
|
|
memset(spi, 0, sizeof(*spi)); /* FIXME */
|
|
|
|
len = sizeof(*spi);
|
|
|
|
}
|
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SystemTimeOfDayInformation:
|
|
|
|
{
|
|
|
|
SYSTEM_TIMEOFDAY_INFORMATION* sti = (SYSTEM_TIMEOFDAY_INFORMATION*)SystemInformation;
|
|
|
|
if (Length >= sizeof(*sti))
|
|
|
|
{
|
2005-02-23 21:29:17 +01:00
|
|
|
sti->liKeBootTime.QuadPart = boottime;
|
2003-09-16 03:07:21 +02:00
|
|
|
sti->liKeSystemTime.QuadPart = 0; /* FIXME */
|
|
|
|
sti->liExpTimeZoneBias.QuadPart = 0; /* FIXME */
|
|
|
|
sti->uCurrentTimeZoneId = 0; /* FIXME */
|
|
|
|
sti->dwReserved = 0;
|
|
|
|
len = sizeof(*sti);
|
|
|
|
}
|
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SystemProcessInformation:
|
|
|
|
{
|
|
|
|
SYSTEM_PROCESS_INFORMATION* spi = (SYSTEM_PROCESS_INFORMATION*)SystemInformation;
|
|
|
|
SYSTEM_PROCESS_INFORMATION* last = NULL;
|
|
|
|
HANDLE hSnap = 0;
|
2003-09-30 03:04:19 +02:00
|
|
|
WCHAR procname[1024];
|
|
|
|
DWORD wlen = 0;
|
2003-09-16 03:07:21 +02:00
|
|
|
|
|
|
|
SERVER_START_REQ( create_snapshot )
|
|
|
|
{
|
|
|
|
req->flags = SNAP_PROCESS | SNAP_THREAD;
|
|
|
|
req->inherit = FALSE;
|
|
|
|
req->pid = 0;
|
|
|
|
if (!(ret = wine_server_call( req ))) hSnap = reply->handle;
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
len = 0;
|
|
|
|
while (ret == STATUS_SUCCESS)
|
|
|
|
{
|
|
|
|
SERVER_START_REQ( next_process )
|
|
|
|
{
|
|
|
|
req->handle = hSnap;
|
|
|
|
req->reset = (len == 0);
|
2003-09-30 03:04:19 +02:00
|
|
|
wine_server_set_reply( req, procname, sizeof(procname) );
|
2003-09-16 03:07:21 +02:00
|
|
|
if (!(ret = wine_server_call( req )))
|
|
|
|
{
|
2003-09-30 03:04:19 +02:00
|
|
|
wlen = wine_server_reply_size(reply) + sizeof(WCHAR);
|
2003-09-16 03:07:21 +02:00
|
|
|
if (Length >= len + sizeof(*spi))
|
|
|
|
{
|
|
|
|
memset(spi, 0, sizeof(*spi));
|
|
|
|
spi->dwOffset = sizeof(*spi);
|
|
|
|
spi->dwThreadCount = reply->threads;
|
|
|
|
memset(&spi->ftCreationTime, 0, sizeof(spi->ftCreationTime));
|
|
|
|
/* spi->pszProcessName will be set later on */
|
|
|
|
spi->dwBasePriority = reply->priority;
|
|
|
|
spi->dwProcessID = (DWORD)reply->pid;
|
|
|
|
spi->dwParentProcessID = (DWORD)reply->ppid;
|
|
|
|
spi->dwHandleCount = reply->handles;
|
|
|
|
spi->dwVirtualBytesPeak = 0; /* FIXME */
|
|
|
|
spi->dwVirtualBytes = 0; /* FIXME */
|
|
|
|
spi->dwPageFaults = 0; /* FIXME */
|
|
|
|
spi->dwWorkingSetPeak = 0; /* FIXME */
|
|
|
|
spi->dwWorkingSet = 0; /* FIXME */
|
|
|
|
spi->dwUnknown5 = 0; /* FIXME */
|
|
|
|
spi->dwPagedPool = 0; /* FIXME */
|
|
|
|
spi->dwUnknown6 = 0; /* FIXME */
|
|
|
|
spi->dwNonPagedPool = 0; /* FIXME */
|
|
|
|
spi->dwPageFileBytesPeak = 0; /* FIXME */
|
|
|
|
spi->dwPrivateBytes = 0; /* FIXME */
|
|
|
|
spi->dwPageFileBytes = 0; /* FIXME */
|
|
|
|
/* spi->ti will be set later on */
|
|
|
|
len += sizeof(*spi) - sizeof(spi->ti);
|
|
|
|
}
|
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
if (ret != STATUS_SUCCESS)
|
|
|
|
{
|
|
|
|
if (ret == STATUS_NO_MORE_FILES) ret = STATUS_SUCCESS;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (Length >= len + wlen + spi->dwThreadCount * sizeof(THREAD_INFO))
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
/* set thread info */
|
|
|
|
spi->dwOffset += spi->dwThreadCount * sizeof(THREAD_INFO);
|
|
|
|
len += spi->dwThreadCount * sizeof(THREAD_INFO);
|
|
|
|
i = j = 0;
|
|
|
|
while (ret == STATUS_SUCCESS)
|
|
|
|
{
|
|
|
|
SERVER_START_REQ( next_thread )
|
|
|
|
{
|
|
|
|
req->handle = hSnap;
|
|
|
|
req->reset = (j == 0);
|
|
|
|
if (!(ret = wine_server_call( req )))
|
|
|
|
{
|
|
|
|
j++;
|
|
|
|
if (reply->pid == spi->dwProcessID)
|
|
|
|
{
|
|
|
|
/* ftKernelTime, ftUserTime, ftCreateTime;
|
|
|
|
* dwTickCount, dwStartAddress
|
|
|
|
*/
|
|
|
|
spi->ti[i].dwOwningPID = reply->pid;
|
|
|
|
spi->ti[i].dwThreadID = reply->tid;
|
|
|
|
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 */
|
|
|
|
spi->pszProcessName = (WCHAR*)((char*)spi + spi->dwOffset);
|
2003-09-30 03:04:19 +02:00
|
|
|
memcpy( spi->pszProcessName, procname, wlen - sizeof(WCHAR) );
|
|
|
|
spi->pszProcessName[wlen / sizeof(WCHAR)] = 0;
|
2003-09-16 03:07:21 +02:00
|
|
|
len += wlen;
|
|
|
|
spi->dwOffset += wlen;
|
|
|
|
|
|
|
|
last = spi;
|
|
|
|
spi = (SYSTEM_PROCESS_INFORMATION*)((char*)spi + spi->dwOffset);
|
|
|
|
}
|
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
}
|
|
|
|
if (ret == STATUS_SUCCESS && last) last->dwOffset = 0;
|
|
|
|
if (hSnap) NtClose(hSnap);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SystemProcessorPerformanceInformation:
|
|
|
|
{
|
|
|
|
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION* sppi = (SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION*)SystemInformation;
|
|
|
|
if (Length >= sizeof(*sppi))
|
|
|
|
{
|
|
|
|
memset(sppi, 0, sizeof(*sppi)); /* FIXME */
|
|
|
|
len = sizeof(*sppi);
|
|
|
|
}
|
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SystemCacheInformation:
|
|
|
|
{
|
|
|
|
SYSTEM_CACHE_INFORMATION* sci = (SYSTEM_CACHE_INFORMATION*)SystemInformation;
|
|
|
|
if (Length >= sizeof(*sci))
|
|
|
|
{
|
|
|
|
memset(sci, 0, sizeof(*sci)); /* FIXME */
|
|
|
|
len = sizeof(*sci);
|
|
|
|
}
|
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SystemRegistryQuotaInformation:
|
2000-12-06 20:45:07 +01: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. */
|
2003-09-16 03:07:21 +02:00
|
|
|
{
|
|
|
|
SYSTEM_REGISTRY_QUOTA_INFORMATION* srqi = (SYSTEM_REGISTRY_QUOTA_INFORMATION*)SystemInformation;
|
|
|
|
if (Length >= sizeof(*srqi))
|
|
|
|
{
|
|
|
|
FIXME("(0x%08x,%p,0x%08lx,%p) faking max registry size of 32 MB\n",
|
|
|
|
SystemInformationClass,SystemInformation,Length,ResultLength);
|
|
|
|
srqi->RegistryQuotaAllowed = 0x2000000;
|
|
|
|
srqi->RegistryQuotaUsed = 0x200000;
|
|
|
|
srqi->Reserved1 = (void*)0x200000;
|
2004-08-18 00:09:55 +02:00
|
|
|
len = sizeof(*srqi);
|
2003-09-16 03:07:21 +02:00
|
|
|
}
|
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
}
|
2000-12-06 20:45:07 +01:00
|
|
|
break;
|
|
|
|
|
2004-08-18 00:09:55 +02:00
|
|
|
case SystemKernelDebuggerInformation:
|
|
|
|
{
|
|
|
|
PSYSTEM_KERNEL_DEBUGGER_INFORMATION pkdi;
|
|
|
|
if( Length >= sizeof(*pkdi))
|
|
|
|
{
|
|
|
|
pkdi = SystemInformation;
|
|
|
|
pkdi->DebuggerEnabled = FALSE;
|
|
|
|
pkdi->DebuggerNotPresent = TRUE;
|
|
|
|
len = sizeof(*pkdi);
|
|
|
|
}
|
|
|
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2000-12-06 20:45:07 +01:00
|
|
|
default:
|
1999-05-23 12:25:25 +02:00
|
|
|
FIXME("(0x%08x,%p,0x%08lx,%p) stub\n",
|
2000-12-06 20:45:07 +01:00
|
|
|
SystemInformationClass,SystemInformation,Length,ResultLength);
|
2003-09-16 03:07:21 +02:00
|
|
|
ret = STATUS_NOT_IMPLEMENTED;
|
2000-12-06 20:45:07 +01: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
|
|
|
}
|
|
|
|
|
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(
|
|
|
|
IN PUNICODE_STRING PageFileName,
|
|
|
|
IN ULONG MiniumSize,
|
|
|
|
IN ULONG MaxiumSize,
|
|
|
|
OUT PULONG ActualSize)
|
1999-02-13 08:35:31 +01:00
|
|
|
{
|
1999-05-23 12:25:25 +02:00
|
|
|
FIXME("(%p(%s),0x%08lx,0x%08lx,%p),stub!\n",
|
1999-04-11 16:53:24 +02:00
|
|
|
PageFileName->Buffer, debugstr_w(PageFileName->Buffer),MiniumSize,MaxiumSize,ActualSize);
|
1999-02-13 08:35:31 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
/******************************************************************************
|
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
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI NtPowerInformation(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5)
|
|
|
|
{
|
|
|
|
FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub\n",x1,x2,x3,x4,x5);
|
|
|
|
return 0;
|
|
|
|
}
|
- 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.@]
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI NtShutdownSystem(DWORD x1)
|
|
|
|
{
|
|
|
|
FIXME("(0x%08lx),stub\n",x1);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
- 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
|
|
|
*
|
|
|
|
* FIXME: the server should do that
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI NtAllocateLocallyUniqueId(PLUID Luid)
|
|
|
|
{
|
2004-11-04 05:52:17 +01:00
|
|
|
static LUID luid = { SE_MAX_WELL_KNOWN_PRIVILEGE, 0 };
|
- 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-11-04 05:52:17 +01:00
|
|
|
FIXME("%p\n", Luid);
|
|
|
|
|
|
|
|
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
|
|
|
|
2001-11-20 19:52:20 +01:00
|
|
|
luid.LowPart++;
|
|
|
|
if (luid.LowPart==0)
|
|
|
|
luid.HighPart++;
|
|
|
|
Luid->HighPart = luid.HighPart;
|
|
|
|
Luid->LowPart = luid.LowPart;
|
|
|
|
|
|
|
|
return STATUS_SUCCESS;
|
- 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;
|
|
|
|
}
|
2004-08-30 20:36:24 +02:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* NtAlertThread (NTDLL.@)
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI NtAlertThread(HANDLE ThreadHandle)
|
|
|
|
{
|
|
|
|
FIXME("%p\n", ThreadHandle);
|
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
|
|
|
}
|