mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
Added mapping of access rights
Improved 'open' function svn path=/trunk/; revision=1578
This commit is contained in:
parent
9331d6391e
commit
6c726dfe40
6 changed files with 162 additions and 139 deletions
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: include/synch.h
|
* FILE: include/ntos/synch.h
|
||||||
* PURPOSE: Synchronization declarations used by all the parts of the
|
* PURPOSE: Synchronization declarations used by all the parts of the
|
||||||
* system
|
* system
|
||||||
* PROGRAMMER: David Welch <welch@cwcom.net>
|
* PROGRAMMER: David Welch <welch@cwcom.net>
|
||||||
|
@ -18,7 +18,9 @@
|
||||||
#define EVENT_MODIFY_STATE (2)
|
#define EVENT_MODIFY_STATE (2)
|
||||||
#define EVENT_PAIR_ALL_ACCESS (0x1f0000L)
|
#define EVENT_PAIR_ALL_ACCESS (0x1f0000L)
|
||||||
#define MUTEX_ALL_ACCESS (0x1f0001L)
|
#define MUTEX_ALL_ACCESS (0x1f0001L)
|
||||||
#define MUTEX_MODIFY_STATE (1)
|
#define MUTEX_QUERY_STATE (1)
|
||||||
|
#define MUTANT_ALL_ACCESS (0x1f0001L)
|
||||||
|
#define MUTANT_QUERY_STATE (1)
|
||||||
#define SEMAPHORE_ALL_ACCESS (0x1f0003L)
|
#define SEMAPHORE_ALL_ACCESS (0x1f0003L)
|
||||||
#define SEMAPHORE_QUERY_STATE (1)
|
#define SEMAPHORE_QUERY_STATE (1)
|
||||||
#define SEMAPHORE_MODIFY_STATE (2)
|
#define SEMAPHORE_MODIFY_STATE (2)
|
||||||
|
@ -27,4 +29,4 @@
|
||||||
#define TIMER_MODIFY_STATE (2)
|
#define TIMER_MODIFY_STATE (2)
|
||||||
|
|
||||||
|
|
||||||
#endif /* __INCLUDE_PS_H */
|
#endif /* __INCLUDE_SYNCH_H */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: section.c,v 1.42 2001/01/13 18:38:09 dwelch Exp $
|
/* $Id: section.c,v 1.43 2001/01/28 15:17:52 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -25,6 +25,12 @@
|
||||||
|
|
||||||
POBJECT_TYPE EXPORTED MmSectionObjectType = NULL;
|
POBJECT_TYPE EXPORTED MmSectionObjectType = NULL;
|
||||||
|
|
||||||
|
static GENERIC_MAPPING MmpSectionMapping = {
|
||||||
|
STANDARD_RIGHTS_READ | SECTION_MAP_READ | SECTION_QUERY,
|
||||||
|
STANDARD_RIGHTS_WRITE | SECTION_MAP_WRITE,
|
||||||
|
STANDARD_RIGHTS_EXECUTE | SECTION_MAP_EXECUTE,
|
||||||
|
SECTION_ALL_ACCESS};
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -231,7 +237,7 @@ MmWaitForPendingOperationSection(PMADDRESS_SPACE AddressSpace,
|
||||||
* page-in again so we have to wait again.
|
* page-in again so we have to wait again.
|
||||||
*/
|
*/
|
||||||
Entry = MmGetPageEntrySection(Section,
|
Entry = MmGetPageEntrySection(Section,
|
||||||
Offset.u.LowPart);
|
Offset.u.LowPart);
|
||||||
} while (Entry & SPE_PAGEIN_PENDING);
|
} while (Entry & SPE_PAGEIN_PENDING);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -370,7 +376,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
||||||
MmWaitForFreePages();
|
MmWaitForFreePages();
|
||||||
MmLockAddressSpace(AddressSpace);
|
MmLockAddressSpace(AddressSpace);
|
||||||
MmLockSection(Section);
|
MmLockSection(Section);
|
||||||
Entry1 = MmGetPageEntrySection(Section, Offset.u.LowPart);
|
Entry1 = MmGetPageEntrySection(Section, Offset.u.LowPart);
|
||||||
if (Entry1 & SPE_PAGEIN_PENDING)
|
if (Entry1 & SPE_PAGEIN_PENDING)
|
||||||
{
|
{
|
||||||
return(MmWaitForPendingOperationSection(AddressSpace,
|
return(MmWaitForPendingOperationSection(AddressSpace,
|
||||||
|
@ -411,7 +417,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
||||||
* Clear the wait state (Since we are holding the only reference to
|
* Clear the wait state (Since we are holding the only reference to
|
||||||
* page this is safe)
|
* page this is safe)
|
||||||
*/
|
*/
|
||||||
MmClearWaitPage(Page);
|
MmClearWaitPage(Page);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Notify any other threads that fault on the same section offset
|
* Notify any other threads that fault on the same section offset
|
||||||
|
@ -597,14 +603,14 @@ MmCreatePhysicalMemorySection(VOID)
|
||||||
*/
|
*/
|
||||||
SectionSize.QuadPart = 0xFFFFFFFF;
|
SectionSize.QuadPart = 0xFFFFFFFF;
|
||||||
RtlInitUnicodeString(&Name, L"\\Device\\PhysicalMemory");
|
RtlInitUnicodeString(&Name, L"\\Device\\PhysicalMemory");
|
||||||
InitializeObjectAttributes(&Obj,
|
InitializeObjectAttributes(&Obj,
|
||||||
&Name,
|
&Name,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
Status = NtCreateSection(&PhysSectionH,
|
Status = NtCreateSection(&PhysSectionH,
|
||||||
SECTION_ALL_ACCESS,
|
SECTION_ALL_ACCESS,
|
||||||
&Obj,
|
&Obj,
|
||||||
&SectionSize,
|
&SectionSize,
|
||||||
PAGE_EXECUTE_READWRITE,
|
PAGE_EXECUTE_READWRITE,
|
||||||
0,
|
0,
|
||||||
|
@ -634,36 +640,37 @@ MmCreatePhysicalMemorySection(VOID)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
MmInitSectionImplementation(VOID)
|
MmInitSectionImplementation(VOID)
|
||||||
{
|
{
|
||||||
MmSectionObjectType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
|
MmSectionObjectType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
|
||||||
|
|
||||||
RtlInitUnicodeString(&MmSectionObjectType->TypeName, L"Section");
|
|
||||||
|
|
||||||
MmSectionObjectType->TotalObjects = 0;
|
|
||||||
MmSectionObjectType->TotalHandles = 0;
|
|
||||||
MmSectionObjectType->MaxObjects = ULONG_MAX;
|
|
||||||
MmSectionObjectType->MaxHandles = ULONG_MAX;
|
|
||||||
MmSectionObjectType->PagedPoolCharge = 0;
|
|
||||||
MmSectionObjectType->NonpagedPoolCharge = sizeof(SECTION_OBJECT);
|
|
||||||
MmSectionObjectType->Dump = NULL;
|
|
||||||
MmSectionObjectType->Open = NULL;
|
|
||||||
MmSectionObjectType->Close = MmpCloseSection;
|
|
||||||
MmSectionObjectType->Delete = MmpDeleteSection;
|
|
||||||
MmSectionObjectType->Parse = NULL;
|
|
||||||
MmSectionObjectType->Security = NULL;
|
|
||||||
MmSectionObjectType->QueryName = NULL;
|
|
||||||
MmSectionObjectType->OkayToClose = NULL;
|
|
||||||
MmSectionObjectType->Create = MmpCreateSection;
|
|
||||||
|
|
||||||
return(STATUS_SUCCESS);
|
RtlInitUnicodeString(&MmSectionObjectType->TypeName, L"Section");
|
||||||
|
|
||||||
|
MmSectionObjectType->TotalObjects = 0;
|
||||||
|
MmSectionObjectType->TotalHandles = 0;
|
||||||
|
MmSectionObjectType->MaxObjects = ULONG_MAX;
|
||||||
|
MmSectionObjectType->MaxHandles = ULONG_MAX;
|
||||||
|
MmSectionObjectType->PagedPoolCharge = 0;
|
||||||
|
MmSectionObjectType->NonpagedPoolCharge = sizeof(SECTION_OBJECT);
|
||||||
|
MmSectionObjectType->Mapping = &MmpSectionMapping;
|
||||||
|
MmSectionObjectType->Dump = NULL;
|
||||||
|
MmSectionObjectType->Open = NULL;
|
||||||
|
MmSectionObjectType->Close = MmpCloseSection;
|
||||||
|
MmSectionObjectType->Delete = MmpDeleteSection;
|
||||||
|
MmSectionObjectType->Parse = NULL;
|
||||||
|
MmSectionObjectType->Security = NULL;
|
||||||
|
MmSectionObjectType->QueryName = NULL;
|
||||||
|
MmSectionObjectType->OkayToClose = NULL;
|
||||||
|
MmSectionObjectType->Create = MmpCreateSection;
|
||||||
|
|
||||||
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* FIXME: NtCS should call MmCS */
|
/* FIXME: NtCS should call MmCS */
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
NtCreateSection (OUT PHANDLE SectionHandle,
|
NtCreateSection (OUT PHANDLE SectionHandle,
|
||||||
IN ACCESS_MASK DesiredAccess,
|
IN ACCESS_MASK DesiredAccess,
|
||||||
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
|
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
|
||||||
IN PLARGE_INTEGER MaximumSize OPTIONAL,
|
IN PLARGE_INTEGER MaximumSize OPTIONAL,
|
||||||
IN ULONG SectionPageProtection OPTIONAL,
|
IN ULONG SectionPageProtection OPTIONAL,
|
||||||
IN ULONG AllocationAttributes,
|
IN ULONG AllocationAttributes,
|
||||||
IN HANDLE FileHandle OPTIONAL)
|
IN HANDLE FileHandle OPTIONAL)
|
||||||
|
@ -768,35 +775,23 @@ NtCreateSection (OUT PHANDLE SectionHandle,
|
||||||
* REVISIONS
|
* REVISIONS
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
NtOpenSection(PHANDLE SectionHandle,
|
NtOpenSection(PHANDLE SectionHandle,
|
||||||
ACCESS_MASK DesiredAccess,
|
ACCESS_MASK DesiredAccess,
|
||||||
POBJECT_ATTRIBUTES ObjectAttributes)
|
POBJECT_ATTRIBUTES ObjectAttributes)
|
||||||
{
|
{
|
||||||
PVOID Object;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
*SectionHandle = 0;
|
*SectionHandle = 0;
|
||||||
|
|
||||||
Status = ObReferenceObjectByName(ObjectAttributes->ObjectName,
|
Status = ObOpenObjectByName(ObjectAttributes,
|
||||||
ObjectAttributes->Attributes,
|
MmSectionObjectType,
|
||||||
NULL,
|
NULL,
|
||||||
DesiredAccess,
|
UserMode,
|
||||||
MmSectionObjectType,
|
DesiredAccess,
|
||||||
UserMode,
|
NULL,
|
||||||
NULL,
|
SectionHandle);
|
||||||
&Object);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = ObCreateHandle(PsGetCurrentProcess(),
|
|
||||||
Object,
|
|
||||||
DesiredAccess,
|
|
||||||
FALSE,
|
|
||||||
SectionHandle);
|
|
||||||
ObDereferenceObject(Object);
|
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -886,7 +881,7 @@ NtMapViewOfSection(HANDLE SectionHandle,
|
||||||
NULL);
|
NULL);
|
||||||
if (!(NT_SUCCESS(Status)))
|
if (!(NT_SUCCESS(Status)))
|
||||||
{
|
{
|
||||||
DPRINT("ObReference failed rc=%x\n",Status);
|
DPRINT("ObReference failed rc=%x\n",Status);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: evtpair.c,v 1.5 2000/10/22 11:30:00 ekohl Exp $
|
/* $Id: evtpair.c,v 1.6 2001/01/28 15:14:19 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -24,6 +24,11 @@
|
||||||
|
|
||||||
POBJECT_TYPE EXPORTED ExEventPairObjectType = NULL;
|
POBJECT_TYPE EXPORTED ExEventPairObjectType = NULL;
|
||||||
|
|
||||||
|
static GENERIC_MAPPING ExEventPairMapping = {
|
||||||
|
STANDARD_RIGHTS_READ,
|
||||||
|
STANDARD_RIGHTS_WRITE,
|
||||||
|
STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE,
|
||||||
|
EVENT_PAIR_ALL_ACCESS};
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
@ -59,6 +64,7 @@ VOID NtInitializeEventPairImplementation(VOID)
|
||||||
ExEventPairObjectType->TotalHandles = 0;
|
ExEventPairObjectType->TotalHandles = 0;
|
||||||
ExEventPairObjectType->PagedPoolCharge = 0;
|
ExEventPairObjectType->PagedPoolCharge = 0;
|
||||||
ExEventPairObjectType->NonpagedPoolCharge = sizeof(KEVENT_PAIR);
|
ExEventPairObjectType->NonpagedPoolCharge = sizeof(KEVENT_PAIR);
|
||||||
|
ExEventPairObjectType->Mapping = &ExEventPairMapping;
|
||||||
ExEventPairObjectType->Dump = NULL;
|
ExEventPairObjectType->Dump = NULL;
|
||||||
ExEventPairObjectType->Open = NULL;
|
ExEventPairObjectType->Open = NULL;
|
||||||
ExEventPairObjectType->Close = NULL;
|
ExEventPairObjectType->Close = NULL;
|
||||||
|
@ -99,31 +105,19 @@ NtOpenEventPair(OUT PHANDLE EventPairHandle,
|
||||||
IN ACCESS_MASK DesiredAccess,
|
IN ACCESS_MASK DesiredAccess,
|
||||||
IN POBJECT_ATTRIBUTES ObjectAttributes)
|
IN POBJECT_ATTRIBUTES ObjectAttributes)
|
||||||
{
|
{
|
||||||
PKEVENT_PAIR EventPair;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT("NtOpenEventPair()\n");
|
DPRINT("NtOpenEventPair()\n");
|
||||||
Status = ObReferenceObjectByName(ObjectAttributes->ObjectName,
|
|
||||||
ObjectAttributes->Attributes,
|
|
||||||
NULL,
|
|
||||||
DesiredAccess,
|
|
||||||
ExEventPairObjectType,
|
|
||||||
UserMode,
|
|
||||||
NULL,
|
|
||||||
(PVOID*)&EventPair);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
return(Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = ObCreateHandle(PsGetCurrentProcess(),
|
Status = ObOpenObjectByName(ObjectAttributes,
|
||||||
EventPair,
|
ExEventPairObjectType,
|
||||||
DesiredAccess,
|
NULL,
|
||||||
FALSE,
|
UserMode,
|
||||||
EventPairHandle);
|
DesiredAccess,
|
||||||
ObDereferenceObject(EventPair);
|
NULL,
|
||||||
|
EventPairHandle);
|
||||||
|
|
||||||
return(STATUS_SUCCESS);
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <internal/ob.h>
|
#include <internal/ob.h>
|
||||||
#include <ntos/synch.h>
|
|
||||||
#include <internal/id.h>
|
#include <internal/id.h>
|
||||||
|
#include <ntos/synch.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <internal/debug.h>
|
#include <internal/debug.h>
|
||||||
|
@ -23,14 +23,21 @@
|
||||||
|
|
||||||
POBJECT_TYPE EXPORTED ExEventObjectType = NULL;
|
POBJECT_TYPE EXPORTED ExEventObjectType = NULL;
|
||||||
|
|
||||||
|
static GENERIC_MAPPING ExpEventMapping = {
|
||||||
|
STANDARD_RIGHTS_READ | SYNCHRONIZE | EVENT_QUERY_STATE,
|
||||||
|
STANDARD_RIGHTS_WRITE | SYNCHRONIZE | EVENT_MODIFY_STATE,
|
||||||
|
STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE | EVENT_QUERY_STATE,
|
||||||
|
EVENT_ALL_ACCESS};
|
||||||
|
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
NTSTATUS NtpCreateEvent(PVOID ObjectBody,
|
NTSTATUS
|
||||||
PVOID Parent,
|
NtpCreateEvent(PVOID ObjectBody,
|
||||||
PWSTR RemainingPath,
|
PVOID Parent,
|
||||||
POBJECT_ATTRIBUTES ObjectAttributes)
|
PWSTR RemainingPath,
|
||||||
|
POBJECT_ATTRIBUTES ObjectAttributes)
|
||||||
{
|
{
|
||||||
|
|
||||||
DPRINT("NtpCreateEvent(ObjectBody %x, Parent %x, RemainingPath %S)\n",
|
DPRINT("NtpCreateEvent(ObjectBody %x, Parent %x, RemainingPath %S)\n",
|
||||||
ObjectBody, Parent, RemainingPath);
|
ObjectBody, Parent, RemainingPath);
|
||||||
|
|
||||||
|
@ -46,7 +53,9 @@ NTSTATUS NtpCreateEvent(PVOID ObjectBody,
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID NtInitializeEventImplementation(VOID)
|
|
||||||
|
VOID
|
||||||
|
NtInitializeEventImplementation(VOID)
|
||||||
{
|
{
|
||||||
ExEventObjectType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
|
ExEventObjectType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
|
||||||
|
|
||||||
|
@ -58,6 +67,7 @@ VOID NtInitializeEventImplementation(VOID)
|
||||||
ExEventObjectType->TotalHandles = 0;
|
ExEventObjectType->TotalHandles = 0;
|
||||||
ExEventObjectType->PagedPoolCharge = 0;
|
ExEventObjectType->PagedPoolCharge = 0;
|
||||||
ExEventObjectType->NonpagedPoolCharge = sizeof(KEVENT);
|
ExEventObjectType->NonpagedPoolCharge = sizeof(KEVENT);
|
||||||
|
ExEventObjectType->Mapping = &ExpEventMapping;
|
||||||
ExEventObjectType->Dump = NULL;
|
ExEventObjectType->Dump = NULL;
|
||||||
ExEventObjectType->Open = NULL;
|
ExEventObjectType->Open = NULL;
|
||||||
ExEventObjectType->Close = NULL;
|
ExEventObjectType->Close = NULL;
|
||||||
|
@ -69,7 +79,9 @@ VOID NtInitializeEventImplementation(VOID)
|
||||||
ExEventObjectType->Create = NtpCreateEvent;
|
ExEventObjectType->Create = NtpCreateEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS STDCALL NtClearEvent (IN HANDLE EventHandle)
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
NtClearEvent(IN HANDLE EventHandle)
|
||||||
{
|
{
|
||||||
PKEVENT Event;
|
PKEVENT Event;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -90,11 +102,12 @@ NTSTATUS STDCALL NtClearEvent (IN HANDLE EventHandle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS STDCALL NtCreateEvent (OUT PHANDLE EventHandle,
|
NTSTATUS STDCALL
|
||||||
IN ACCESS_MASK DesiredAccess,
|
NtCreateEvent(OUT PHANDLE EventHandle,
|
||||||
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
IN ACCESS_MASK DesiredAccess,
|
||||||
IN BOOLEAN ManualReset,
|
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||||||
IN BOOLEAN InitialState)
|
IN BOOLEAN ManualReset,
|
||||||
|
IN BOOLEAN InitialState)
|
||||||
{
|
{
|
||||||
PKEVENT Event;
|
PKEVENT Event;
|
||||||
|
|
||||||
|
@ -103,8 +116,8 @@ NTSTATUS STDCALL NtCreateEvent (OUT PHANDLE EventHandle,
|
||||||
DesiredAccess,
|
DesiredAccess,
|
||||||
ObjectAttributes,
|
ObjectAttributes,
|
||||||
ExEventObjectType);
|
ExEventObjectType);
|
||||||
KeInitializeEvent(Event,
|
KeInitializeEvent(Event,
|
||||||
ManualReset ? NotificationEvent : SynchronizationEvent,
|
ManualReset ? NotificationEvent : SynchronizationEvent,
|
||||||
InitialState );
|
InitialState );
|
||||||
ObDereferenceObject(Event);
|
ObDereferenceObject(Event);
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
|
@ -132,8 +145,9 @@ NtOpenEvent(OUT PHANDLE EventHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS STDCALL NtPulseEvent(IN HANDLE EventHandle,
|
NTSTATUS STDCALL
|
||||||
IN PULONG PulseCount OPTIONAL)
|
NtPulseEvent(IN HANDLE EventHandle,
|
||||||
|
IN PULONG PulseCount OPTIONAL)
|
||||||
{
|
{
|
||||||
PKEVENT Event;
|
PKEVENT Event;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -157,11 +171,12 @@ NTSTATUS STDCALL NtPulseEvent(IN HANDLE EventHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS STDCALL NtQueryEvent (IN HANDLE EventHandle,
|
NTSTATUS STDCALL
|
||||||
IN EVENT_INFORMATION_CLASS EventInformationClass,
|
NtQueryEvent(IN HANDLE EventHandle,
|
||||||
OUT PVOID EventInformation,
|
IN EVENT_INFORMATION_CLASS EventInformationClass,
|
||||||
IN ULONG EventInformationLength,
|
OUT PVOID EventInformation,
|
||||||
OUT PULONG ReturnLength)
|
IN ULONG EventInformationLength,
|
||||||
|
OUT PULONG ReturnLength)
|
||||||
{
|
{
|
||||||
PEVENT_BASIC_INFORMATION Info;
|
PEVENT_BASIC_INFORMATION Info;
|
||||||
PKEVENT Event;
|
PKEVENT Event;
|
||||||
|
@ -198,8 +213,9 @@ NTSTATUS STDCALL NtQueryEvent (IN HANDLE EventHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS STDCALL NtResetEvent(HANDLE EventHandle,
|
NTSTATUS STDCALL
|
||||||
PULONG NumberOfWaitingThreads OPTIONAL)
|
NtResetEvent(IN HANDLE EventHandle,
|
||||||
|
OUT PULONG NumberOfWaitingThreads OPTIONAL)
|
||||||
{
|
{
|
||||||
PKEVENT Event;
|
PKEVENT Event;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -222,8 +238,9 @@ NTSTATUS STDCALL NtResetEvent(HANDLE EventHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS STDCALL NtSetEvent(IN HANDLE EventHandle,
|
NTSTATUS STDCALL
|
||||||
OUT PULONG NumberOfThreadsReleased)
|
NtSetEvent(IN HANDLE EventHandle,
|
||||||
|
OUT PULONG NumberOfThreadsReleased)
|
||||||
{
|
{
|
||||||
PKEVENT Event;
|
PKEVENT Event;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -244,3 +261,5 @@ NTSTATUS STDCALL NtSetEvent(IN HANDLE EventHandle,
|
||||||
ObDereferenceObject(Event);
|
ObDereferenceObject(Event);
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/*
|
/* $Id: ntsem.c,v 1.9 2001/01/28 15:15:07 ekohl Exp $
|
||||||
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/nt/ntsem.c
|
* FILE: ntoskrnl/nt/ntsem.c
|
||||||
|
@ -22,6 +23,12 @@
|
||||||
|
|
||||||
POBJECT_TYPE ExSemaphoreType;
|
POBJECT_TYPE ExSemaphoreType;
|
||||||
|
|
||||||
|
static GENERIC_MAPPING ExSemaphoreMapping = {
|
||||||
|
STANDARD_RIGHTS_READ | SEMAPHORE_QUERY_STATE,
|
||||||
|
STANDARD_RIGHTS_WRITE | SEMAPHORE_MODIFY_STATE,
|
||||||
|
STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE | SEMAPHORE_QUERY_STATE,
|
||||||
|
SEMAPHORE_ALL_ACCESS};
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
NTSTATUS NtpCreateSemaphore(PVOID ObjectBody,
|
NTSTATUS NtpCreateSemaphore(PVOID ObjectBody,
|
||||||
|
@ -57,6 +64,7 @@ VOID NtInitializeSemaphoreImplementation(VOID)
|
||||||
ExSemaphoreType->TotalHandles = 0;
|
ExSemaphoreType->TotalHandles = 0;
|
||||||
ExSemaphoreType->PagedPoolCharge = 0;
|
ExSemaphoreType->PagedPoolCharge = 0;
|
||||||
ExSemaphoreType->NonpagedPoolCharge = sizeof(KSEMAPHORE);
|
ExSemaphoreType->NonpagedPoolCharge = sizeof(KSEMAPHORE);
|
||||||
|
ExSemaphoreType->Mapping = &ExSemaphoreMapping;
|
||||||
ExSemaphoreType->Dump = NULL;
|
ExSemaphoreType->Dump = NULL;
|
||||||
ExSemaphoreType->Open = NULL;
|
ExSemaphoreType->Open = NULL;
|
||||||
ExSemaphoreType->Close = NULL;
|
ExSemaphoreType->Close = NULL;
|
||||||
|
@ -68,11 +76,12 @@ VOID NtInitializeSemaphoreImplementation(VOID)
|
||||||
ExSemaphoreType->Create = NtpCreateSemaphore;
|
ExSemaphoreType->Create = NtpCreateSemaphore;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS STDCALL NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
|
NTSTATUS STDCALL
|
||||||
IN ACCESS_MASK DesiredAccess,
|
NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
|
||||||
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
IN ACCESS_MASK DesiredAccess,
|
||||||
IN LONG InitialCount,
|
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||||||
IN LONG MaximumCount)
|
IN LONG InitialCount,
|
||||||
|
IN LONG MaximumCount)
|
||||||
{
|
{
|
||||||
PKSEMAPHORE Semaphore;
|
PKSEMAPHORE Semaphore;
|
||||||
|
|
||||||
|
@ -89,42 +98,31 @@ NTSTATUS STDCALL NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS STDCALL NtOpenSemaphore(IN HANDLE SemaphoreHandle,
|
NTSTATUS STDCALL
|
||||||
IN ACCESS_MASK DesiredAccess,
|
NtOpenSemaphore(IN HANDLE SemaphoreHandle,
|
||||||
IN POBJECT_ATTRIBUTES ObjectAttributes)
|
IN ACCESS_MASK DesiredAccess,
|
||||||
|
IN POBJECT_ATTRIBUTES ObjectAttributes)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PKSEMAPHORE Semaphore;
|
|
||||||
|
|
||||||
Status = ObReferenceObjectByName(ObjectAttributes->ObjectName,
|
Status = ObOpenObjectByName(ObjectAttributes,
|
||||||
ObjectAttributes->Attributes,
|
ExSemaphoreType,
|
||||||
NULL,
|
NULL,
|
||||||
DesiredAccess,
|
UserMode,
|
||||||
ExSemaphoreType,
|
DesiredAccess,
|
||||||
UserMode,
|
NULL,
|
||||||
NULL,
|
SemaphoreHandle);
|
||||||
(PVOID*)&Semaphore);
|
|
||||||
if (Status != STATUS_SUCCESS)
|
|
||||||
{
|
|
||||||
return(Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = ObCreateHandle(PsGetCurrentProcess(),
|
return Status;
|
||||||
Semaphore,
|
|
||||||
DesiredAccess,
|
|
||||||
FALSE,
|
|
||||||
SemaphoreHandle);
|
|
||||||
ObDereferenceObject(Semaphore);
|
|
||||||
|
|
||||||
return(STATUS_SUCCESS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS STDCALL NtQuerySemaphore(IN HANDLE SemaphoreHandle,
|
NTSTATUS STDCALL
|
||||||
IN SEMAPHORE_INFORMATION_CLASS SemaphoreInformationClass,
|
NtQuerySemaphore(IN HANDLE SemaphoreHandle,
|
||||||
OUT PVOID SemaphoreInformation,
|
IN SEMAPHORE_INFORMATION_CLASS SemaphoreInformationClass,
|
||||||
IN ULONG SemaphoreInformationLength,
|
OUT PVOID SemaphoreInformation,
|
||||||
OUT PULONG ReturnLength)
|
IN ULONG SemaphoreInformationLength,
|
||||||
|
OUT PULONG ReturnLength)
|
||||||
{
|
{
|
||||||
PSEMAPHORE_BASIC_INFORMATION Info;
|
PSEMAPHORE_BASIC_INFORMATION Info;
|
||||||
PKSEMAPHORE Semaphore;
|
PKSEMAPHORE Semaphore;
|
||||||
|
@ -157,9 +155,10 @@ NTSTATUS STDCALL NtQuerySemaphore(IN HANDLE SemaphoreHandle,
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS STDCALL NtReleaseSemaphore(IN HANDLE SemaphoreHandle,
|
NTSTATUS STDCALL
|
||||||
IN LONG ReleaseCount,
|
NtReleaseSemaphore(IN HANDLE SemaphoreHandle,
|
||||||
OUT PLONG PreviousCount)
|
IN LONG ReleaseCount,
|
||||||
|
OUT PLONG PreviousCount)
|
||||||
{
|
{
|
||||||
PKSEMAPHORE Semaphore;
|
PKSEMAPHORE Semaphore;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -181,3 +180,5 @@ NTSTATUS STDCALL NtReleaseSemaphore(IN HANDLE SemaphoreHandle,
|
||||||
ObDereferenceObject(Semaphore);
|
ObDereferenceObject(Semaphore);
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
||||||
|
|
|
@ -14,6 +14,18 @@
|
||||||
|
|
||||||
#include <internal/debug.h>
|
#include <internal/debug.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* GLOBALS ******************************************************************/
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
static GENERIC_MAPPING ExpTimerMapping = {
|
||||||
|
STANDARD_RIGHTS_READ | TIMER_QUERY_STATE,
|
||||||
|
STANDARD_RIGHTS_WRITE | TIMER_MODIFY_STATE,
|
||||||
|
STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE,
|
||||||
|
TIMER_ALL_ACCESS};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
|
Loading…
Reference in a new issue