Added mapping of access rights

svn path=/trunk/; revision=1579
This commit is contained in:
Eric Kohl 2001-01-28 17:42:56 +00:00
parent 6c726dfe40
commit c06ef435fb
10 changed files with 132 additions and 64 deletions

View file

@ -13,28 +13,41 @@
#ifndef __INCLUDE_PS_H
#define __INCLUDE_PS_H
#define THREAD_ALL_ACCESS (0x1f03ffL)
#define THREAD_DIRECT_IMPERSONATION (512)
#define THREAD_GET_CONTEXT (8)
#define THREAD_IMPERSONATE (256)
#define THREAD_QUERY_INFORMATION (64)
#define THREAD_SET_CONTEXT (16)
#define THREAD_SET_INFORMATION (32)
#define THREAD_SET_THREAD_TOKEN (128)
#define THREAD_SUSPEND_RESUME (2)
#define THREAD_TERMINATE (1)
/* Thread access rights */
#define THREAD_TERMINATE (0x0001L)
#define THREAD_SUSPEND_RESUME (0x0002L)
#define THREAD_GET_CONTEXT (0x0008L)
#define THREAD_SET_CONTEXT (0x0010L)
#define THREAD_SET_INFORMATION (0x0020L)
#define THREAD_QUERY_INFORMATION (0x0040L)
#define THREAD_SET_THREAD_TOKEN (0x0080L)
#define THREAD_IMPERSONATE (0x0100L)
#define THREAD_DIRECT_IMPERSONATION (0x0200L)
#define PROCESS_ALL_ACCESS (0x1f0fffL)
#define PROCESS_CREATE_PROCESS (128)
#define PROCESS_CREATE_THREAD (2)
#define PROCESS_DUP_HANDLE (64)
#define PROCESS_QUERY_INFORMATION (1024)
#define PROCESS_SET_INFORMATION (512)
#define PROCESS_TERMINATE (1)
#define PROCESS_VM_OPERATION (8)
#define PROCESS_VM_READ (16)
#define PROCESS_VM_WRITE (32)
#define THREAD_ALL_ACCESS (0x1f03ffL)
#define THREAD_READ (0x020048L)
#define THREAD_WRITE (0x020037L)
#define THREAD_EXECUTE (0x120000L)
/* Process access rights */
#define PROCESS_TERMINATE (0x0001L)
#define PROCESS_CREATE_THREAD (0x0002L)
#define PROCESS_SET_SESSIONID (0x0004L)
#define PROCESS_VM_OPERATION (0x0008L)
#define PROCESS_VM_READ (0x0010L)
#define PROCESS_VM_WRITE (0x0020L)
#define PROCESS_DUP_HANDLE (0x0040L)
#define PROCESS_CREATE_PROCESS (0x0080L)
#define PROCESS_SET_QUOTA (0x0100L)
#define PROCESS_SET_INFORMATION (0x0200L)
#define PROCESS_QUERY_INFORMATION (0x0400L)
#define PROCESS_ALL_ACCESS (0x1f0fffL)
#define PROCESS_READ (0x020410L)
#define PROCESS_WRITE (0x020bebL)
#define PROCESS_EXECUTE (0x120000L)
/* Thread priorities */
#define THREAD_PRIORITY_ABOVE_NORMAL (1)
#define THREAD_PRIORITY_BELOW_NORMAL (-1)
#define THREAD_PRIORITY_HIGHEST (2)

View file

@ -5,25 +5,39 @@
#include <ntos/types.h>
/* ACCESS_MASK */
#define MAXIMUM_ALLOWED (0x2000000L)
#define GENERIC_ALL (0x10000000L)
#define GENERIC_EXECUTE (0x20000000L)
#define MAXIMUM_ALLOWED (0x2000000L)
#define GENERIC_ALL (0x10000000L)
#define GENERIC_EXECUTE (0x20000000L)
#define SECURITY_STATIC_TRACKING (0)
#define SECURITY_DYNAMIC_TRACKING (1)
/* Standard rights */
#define STANDARD_RIGHTS_REQUIRED (0xf0000L)
#define STANDARD_RIGHTS_WRITE (0x20000L)
#define STANDARD_RIGHTS_READ (0x20000L)
#define STANDARD_RIGHTS_EXECUTE (0x20000L)
#define STANDARD_RIGHTS_ALL (0x1f0000L)
#define SPECIFIC_RIGHTS_ALL (0xffffL)
#define STANDARD_RIGHTS_WRITE (0x20000L)
#define STANDARD_RIGHTS_READ (0x20000L)
#define STANDARD_RIGHTS_EXECUTE (0x20000L)
#define STANDARD_RIGHTS_ALL (0x1f0000L)
#define SPECIFIC_RIGHTS_ALL (0xffffL)
/* Token rights */
#define TOKEN_ASSIGN_PRIMARY (0x0001L)
#define TOKEN_DUPLICATE (0x0002L)
#define TOKEN_IMPERSONATE (0x0004L)
#define TOKEN_QUERY (0x0008L)
#define TOKEN_QUERY_SOURCE (0x0010L)
#define TOKEN_ADJUST_PRIVILEGES (0x0020L)
#define TOKEN_ADJUST_GROUPS (0x0040L)
#define TOKEN_ADJUST_DEFAULT (0x0080L)
#define TOKEN_ALL_ACCESS (0xf00ffL)
#define TOKEN_READ (0x20008L)
#define TOKEN_WRITE (0x200e0L)
#define TOKEN_EXECUTE (0x20000L)
typedef BOOL SECURITY_CONTEXT_TRACKING_MODE;
typedef ULONG SECURITY_INFORMATION, *PSECURITY_INFORMATION;
typedef ULONG SECURITY_INFORMATION, *PSECURITY_INFORMATION;
typedef enum _TOKEN_INFORMATION_CLASS {
TokenUser = 1,

View file

@ -1,4 +1,4 @@
/* $Id: file.c,v 1.11 2000/09/03 14:49:17 ekohl Exp $
/* $Id: file.c,v 1.12 2001/01/28 17:37:48 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -204,14 +204,6 @@ NtSetInformationFile (
}
PGENERIC_MAPPING
STDCALL
IoGetFileObjectGenericMapping(VOID)
{
UNIMPLEMENTED;
}
NTSTATUS
STDCALL
NtQueryAttributesFile (

View file

@ -1,4 +1,4 @@
/* $Id: iomgr.c,v 1.16 2000/10/05 19:15:50 ekohl Exp $
/* $Id: iomgr.c,v 1.17 2001/01/28 17:37:48 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -32,6 +32,11 @@ ULONG EXPORTED IoWriteOperationCount = 0; /* FIXME: unknown type */
ULONG EXPORTED IoWriteTransferCount = 0; /* FIXME: unknown type */
ULONG EXPORTED IoStatisticsLock = 0; /* FIXME: unknown type */
static GENERIC_MAPPING IopFileMapping = {FILE_GENERIC_READ,
FILE_GENERIC_WRITE,
FILE_GENERIC_EXECUTE,
FILE_ALL_ACCESS};
/* FUNCTIONS ****************************************************************/
VOID IopCloseFile(PVOID ObjectBody, ULONG HandleCount)
@ -121,6 +126,7 @@ VOID IoInit (VOID)
IoDeviceObjectType->MaxHandles = ULONG_MAX;
IoDeviceObjectType->PagedPoolCharge = 0;
IoDeviceObjectType->NonpagedPoolCharge = sizeof (DEVICE_OBJECT);
IoDeviceObjectType->Mapping = &IopFileMapping;
IoDeviceObjectType->Dump = NULL;
IoDeviceObjectType->Open = NULL;
IoDeviceObjectType->Close = NULL;
@ -151,6 +157,7 @@ VOID IoInit (VOID)
IoFileObjectType->MaxHandles = ULONG_MAX;
IoFileObjectType->PagedPoolCharge = 0;
IoFileObjectType->NonpagedPoolCharge = sizeof(FILE_OBJECT);
IoFileObjectType->Mapping = &IopFileMapping;
IoFileObjectType->Dump = NULL;
IoFileObjectType->Open = NULL;
IoFileObjectType->Close = IopCloseFile;
@ -245,4 +252,11 @@ VOID IoInit (VOID)
&DeviceName);
}
PGENERIC_MAPPING STDCALL
IoGetFileObjectGenericMapping(VOID)
{
return &IopFileMapping;
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: symlink.c,v 1.17 2000/10/22 16:36:50 ekohl Exp $
/* $Id: symlink.c,v 1.18 2001/01/28 17:37:48 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -30,6 +30,12 @@ typedef struct
POBJECT_TYPE IoSymbolicLinkType = NULL;
static GENERIC_MAPPING IopSymbolicLinkMapping = {
STANDARD_RIGHTS_READ|SYMBOLIC_LINK_QUERY,
STANDARD_RIGHTS_WRITE,
STANDARD_RIGHTS_EXECUTE|SYMBOLIC_LINK_QUERY,
SYMBOLIC_LINK_ALL_ACCESS};
/* FUNCTIONS *****************************************************************/
@ -171,6 +177,7 @@ VOID IoInitSymbolicLinkImplementation (VOID)
IoSymbolicLinkType->MaxHandles = ULONG_MAX;
IoSymbolicLinkType->PagedPoolCharge = 0;
IoSymbolicLinkType->NonpagedPoolCharge = sizeof (SYMLNK_OBJECT);
IoSymbolicLinkType->Mapping = &IopSymbolicLinkMapping;
IoSymbolicLinkType->Dump = NULL;
IoSymbolicLinkType->Open = NULL;
IoSymbolicLinkType->Close = NULL;
@ -180,7 +187,7 @@ VOID IoInitSymbolicLinkImplementation (VOID)
IoSymbolicLinkType->QueryName = NULL;
IoSymbolicLinkType->OkayToClose = NULL;
IoSymbolicLinkType->Create = IopCreateSymbolicLink;
RtlInitUnicodeString(&IoSymbolicLinkType->TypeName,
L"SymbolicLink");
}

View file

@ -1,4 +1,4 @@
/* $Id: port.c,v 1.3 2000/10/22 16:36:51 ekohl Exp $
/* $Id: port.c,v 1.4 2001/01/28 17:38:12 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -30,6 +30,12 @@
POBJECT_TYPE ExPortType = NULL;
ULONG EiNextLpcMessageId = 0;
static GENERIC_MAPPING ExpPortMapping = {
STANDARD_RIGHTS_READ,
STANDARD_RIGHTS_WRITE,
0,
PORT_ALL_ACCESS};
/* FUNCTIONS *****************************************************************/
@ -45,6 +51,7 @@ NTSTATUS NiInitPort (VOID)
ExPortType->TotalHandles = 0;
ExPortType->PagedPoolCharge = 0;
ExPortType->NonpagedPoolCharge = sizeof(EPORT);
ExPortType->Mapping = &ExpPortMapping;
ExPortType->Dump = NULL;
ExPortType->Open = NULL;
ExPortType->Close = NiClosePort;

View file

@ -24,6 +24,12 @@ POBJECT_TYPE ObDirectoryType = NULL;
PDIRECTORY_OBJECT NameSpaceRoot = NULL;
static GENERIC_MAPPING ObpDirectoryMapping = {
STANDARD_RIGHTS_READ|DIRECTORY_QUERY|DIRECTORY_TRAVERSE,
STANDARD_RIGHTS_WRITE|DIRECTORY_CREATE_OBJECT|DIRECTORY_CREATE_SUBDIRECTORY,
STANDARD_RIGHTS_EXECUTE|DIRECTORY_QUERY|DIRECTORY_TRAVERSE,
DIRECTORY_ALL_ACCESS};
/* FUNCTIONS **************************************************************/
NTSTATUS STDCALL
@ -83,8 +89,8 @@ DPRINT("Object %p\n", Object);
* ...
* ObjectType
* ...
* Unknown3
* ???
* ParseContext
* ...
* AccessMode
* ...
* DesiredAccess
@ -100,7 +106,7 @@ DPRINT("Object %p\n", Object);
NTSTATUS STDCALL
ObOpenObjectByName(POBJECT_ATTRIBUTES ObjectAttributes,
POBJECT_TYPE ObjectType,
ULONG Unknown3, /* ?? */
PVOID ParseContext,
KPROCESSOR_MODE AccessMode,
ACCESS_MASK DesiredAccess,
PACCESS_STATE PassedAccessState,
@ -308,6 +314,7 @@ VOID ObInit(VOID)
ObDirectoryType->MaxHandles = ULONG_MAX;
ObDirectoryType->PagedPoolCharge = 0;
ObDirectoryType->NonpagedPoolCharge = sizeof(DIRECTORY_OBJECT);
ObDirectoryType->Mapping = &ObpDirectoryMapping;
ObDirectoryType->Dump = NULL;
ObDirectoryType->Open = NULL;
ObDirectoryType->Close = NULL;

View file

@ -1,4 +1,4 @@
/* $Id: process.c,v 1.55 2001/01/21 14:54:29 dwelch Exp $
/* $Id: process.c,v 1.56 2001/01/28 17:38:40 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -39,6 +39,11 @@ static LIST_ENTRY PsProcessListHead;
static KSPIN_LOCK PsProcessListLock;
static ULONG PiNextProcessUniqueId = 0;
static GENERIC_MAPPING PiProcessMapping = {PROCESS_READ,
PROCESS_WRITE,
PROCESS_EXECUTE,
PROCESS_ALL_ACCESS};
/* FUNCTIONS *****************************************************************/
@ -176,6 +181,7 @@ VOID PsInitProcessManagment(VOID)
PsProcessType->MaxHandles = ULONG_MAX;
PsProcessType->PagedPoolCharge = 0;
PsProcessType->NonpagedPoolCharge = sizeof(EPROCESS);
PsProcessType->Mapping = &PiProcessMapping;
PsProcessType->Dump = NULL;
PsProcessType->Open = NULL;
PsProcessType->Close = NULL;
@ -799,10 +805,9 @@ NTSTATUS STDCALL NtSetInformationProcess(IN HANDLE ProcessHandle,
}
#if 0
/**********************************************************************
* NAME INTERNAL
* PiSnapshotProcessTable
* PiQuerySystemProcessInformation
*
* DESCRIPTION
* Compute the size of a process+thread snapshot as
@ -816,13 +821,13 @@ NTSTATUS STDCALL NtSetInformationProcess(IN HANDLE ProcessHandle,
* We assume (sizeof (PVOID) == sizeof (ULONG)) holds.
*/
NTSTATUS
STDCALL
PiSnapshotProcessTable (
IN PVOID SnapshotBuffer,
IN ULONG Size,
IN PULONG pRequiredSize
)
PiQuerySystemProcessInformation(PVOID Buffer,
ULONG Size,
PULONG ReqSize)
{
return STATUS_NOT_IMPLEMENTED;
#if 0
KIRQL OldIrql;
PLIST_ENTRY CurrentEntryP;
PEPROCESS CurrentP;
@ -839,13 +844,10 @@ PiSnapshotProcessTable (
PSYSTEM_THREAD_INFO pInfoT = NULL;
/*
* Lock the process list.
*/
KeAcquireSpinLock (
& PsProcessListLock,
& OldIrql
);
/* Lock the process list. */
KeAcquireSpinLock(&PsProcessListLock,
&OldIrql);
/*
* Scan the process list. Since the
* list is circular, the guard is false
@ -1010,7 +1012,7 @@ PiSnapshotProcessTable (
pInfoP->RelativeOffset = 0L;
/* OK */
return STATUS_SUCCESS;
}
#endif
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: thread.c,v 1.67 2001/01/21 14:54:30 dwelch Exp $
/* $Id: thread.c,v 1.68 2001/01/28 17:38:40 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -49,6 +49,11 @@ ULONG PiNrRunnableThreads = 0;
static PETHREAD CurrentThread = NULL;
static GENERIC_MAPPING PiThreadMapping = {THREAD_READ,
THREAD_WRITE,
THREAD_EXECUTE,
THREAD_ALL_ACCESS};
/* FUNCTIONS ***************************************************************/
PKTHREAD STDCALL KeGetCurrentThread(VOID)
@ -273,6 +278,7 @@ PsInitThreadManagment(VOID)
PsThreadType->MaxHandles = 0;
PsThreadType->PagedPoolCharge = 0;
PsThreadType->NonpagedPoolCharge = sizeof(ETHREAD);
PsThreadType->Mapping = &PiThreadMapping;
PsThreadType->Dump = NULL;
PsThreadType->Open = NULL;
PsThreadType->Close = PiCloseThread;

View file

@ -1,4 +1,4 @@
/* $Id: token.c,v 1.8 2000/07/01 22:38:15 ekohl Exp $
/* $Id: token.c,v 1.9 2001/01/28 17:42:56 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -21,6 +21,11 @@
POBJECT_TYPE EXPORTED SeTokenType = NULL;
static GENERIC_MAPPING SepTokenMapping = {TOKEN_READ,
TOKEN_WRITE,
TOKEN_EXECUTE,
TOKEN_ALL_ACCESS};
/* FUNCTIONS *****************************************************************/
VOID SepFreeProxyData(PVOID ProxyData)
@ -227,6 +232,7 @@ VOID SeInitializeTokenManager(VOID)
SeTokenType->TotalHandles = 0;
SeTokenType->PagedPoolCharge = 0;
SeTokenType->NonpagedPoolCharge = 0;
SeTokenType->Mapping = &SepTokenMapping;
SeTokenType->Dump = NULL;
SeTokenType->Open = NULL;
SeTokenType->Close = NULL;