Replaced ObRosCreateObject() by ObCreateObject() and ObInsertObject().

Fixed ObCreateObject() and ObInsertObject().

svn path=/trunk/; revision=6140
This commit is contained in:
Eric Kohl 2003-09-25 20:09:56 +00:00
parent 72d8964737
commit 895c98c856
30 changed files with 671 additions and 300 deletions

View file

@ -8,6 +8,17 @@ ObAssignSecurity(IN PACCESS_STATE AccessState,
IN PVOID Object, IN PVOID Object,
IN POBJECT_TYPE Type); IN POBJECT_TYPE Type);
NTSTATUS STDCALL
ObCreateObject (IN KPROCESSOR_MODE ObjectAttributesAccessMode OPTIONAL,
IN POBJECT_TYPE ObjectType,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN KPROCESSOR_MODE AccessMode,
IN OUT PVOID ParseContext OPTIONAL,
IN ULONG ObjectSize,
IN ULONG PagedPoolCharge OPTIONAL,
IN ULONG NonPagedPoolCharge OPTIONAL,
OUT PVOID *Object);
VOID FASTCALL VOID FASTCALL
ObfDereferenceObject(IN PVOID Object); ObfDereferenceObject(IN PVOID Object);

View file

@ -1,6 +1,6 @@
#ifndef _INCLUDE_DDK_OBTYPES_H #ifndef _INCLUDE_DDK_OBTYPES_H
#define _INCLUDE_DDK_OBTYPES_H #define _INCLUDE_DDK_OBTYPES_H
/* $Id: obtypes.h,v 1.3 2003/06/02 10:02:16 ekohl Exp $ */ /* $Id: obtypes.h,v 1.4 2003/09/25 20:00:25 ekohl Exp $ */
struct _DIRECTORY_OBJECT; struct _DIRECTORY_OBJECT;
struct _OBJECT_ATTRIBUTES; struct _OBJECT_ATTRIBUTES;
@ -160,6 +160,7 @@ typedef struct _OBJECT_HEADER
LONG HandleCount; LONG HandleCount;
BOOLEAN CloseInProcess; BOOLEAN CloseInProcess;
BOOLEAN Permanent; BOOLEAN Permanent;
BOOLEAN Inherit;
struct _DIRECTORY_OBJECT* Parent; struct _DIRECTORY_OBJECT* Parent;
POBJECT_TYPE ObjectType; POBJECT_TYPE ObjectType;

View file

@ -1689,13 +1689,6 @@ typedef struct _KINTERRUPT *PKINTERRUPT;
#endif /* __USE_W32API */ #endif /* __USE_W32API */
NTSTATUS STDCALL
ObRosCreateObject(OUT PHANDLE Handle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes,
IN POBJECT_TYPE Type,
OUT PVOID *Object);
/* BEGIN REACTOS ONLY */ /* BEGIN REACTOS ONLY */
typedef enum _TRAVERSE_METHOD { typedef enum _TRAVERSE_METHOD {

View file

@ -103,16 +103,32 @@ NtCreateKey(OUT PHANDLE KeyHandle,
DPRINT("RemainingPath %S ParentObject %x\n", RemainingPath.Buffer, Object); DPRINT("RemainingPath %S ParentObject %x\n", RemainingPath.Buffer, Object);
Status = ObRosCreateObject(KeyHandle, Status = ObCreateObject(ExGetPreviousMode(),
DesiredAccess,
NULL,
CmiKeyType, CmiKeyType,
NULL,
ExGetPreviousMode(),
NULL,
sizeof(KEY_OBJECT),
0,
0,
(PVOID*)&KeyObject); (PVOID*)&KeyObject);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
return(Status); return(Status);
} }
Status = ObInsertObject((PVOID)KeyObject,
NULL,
DesiredAccess,
0,
NULL,
KeyHandle);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject(KeyObject);
return(Status);
}
KeyObject->ParentKey = Object; KeyObject->ParentKey = Object;
if (CreateOptions & REG_OPTION_VOLATILE) if (CreateOptions & REG_OPTION_VOLATILE)

View file

@ -1,4 +1,4 @@
/* $Id: registry.c,v 1.107 2003/07/21 21:53:51 royce Exp $ /* $Id: registry.c,v 1.108 2003/09/25 20:03:11 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -290,18 +290,22 @@ CmInitializeRegistry(VOID)
/* Create '\Registry' key. */ /* Create '\Registry' key. */
RtlInitUnicodeString(&KeyName, REG_ROOT_KEY_NAME); RtlInitUnicodeString(&KeyName, REG_ROOT_KEY_NAME);
InitializeObjectAttributes(&ObjectAttributes, &KeyName, 0, NULL, NULL); InitializeObjectAttributes(&ObjectAttributes, &KeyName, 0, NULL, NULL);
Status = ObRosCreateObject(&RootKeyHandle, Status = ObCreateObject(KernelMode,
STANDARD_RIGHTS_REQUIRED,
&ObjectAttributes,
CmiKeyType, CmiKeyType,
&ObjectAttributes,
KernelMode,
NULL,
sizeof(KEY_OBJECT),
0,
0,
(PVOID *) &RootKey); (PVOID *) &RootKey);
assert(NT_SUCCESS(Status)); assert(NT_SUCCESS(Status));
Status = ObReferenceObjectByHandle(RootKeyHandle, Status = ObInsertObject(RootKey,
NULL,
STANDARD_RIGHTS_REQUIRED, STANDARD_RIGHTS_REQUIRED,
CmiKeyType, 0,
KernelMode, NULL,
(PVOID *)&RootKey, &RootKeyHandle);
NULL);
assert(NT_SUCCESS(Status)); assert(NT_SUCCESS(Status));
RootKey->RegistryHive = CmiVolatileHive; RootKey->RegistryHive = CmiVolatileHive;
RootKey->BlockOffset = CmiVolatileHive->HiveHeader->RootKeyCell; RootKey->BlockOffset = CmiVolatileHive->HiveHeader->RootKeyCell;
@ -544,19 +548,18 @@ CmiConnectHive(IN POBJECT_ATTRIBUTES KeyObjectAttributes,
DPRINT("RemainingPath %wZ ParentKey %p\n", DPRINT("RemainingPath %wZ ParentKey %p\n",
&RemainingPath, ParentKey); &RemainingPath, ParentKey);
Status = ObRosCreateObject(NULL, Status = ObCreateObject(KernelMode,
STANDARD_RIGHTS_REQUIRED,
NULL,
CmiKeyType, CmiKeyType,
NULL,
KernelMode,
NULL,
sizeof(KEY_OBJECT),
0,
0,
(PVOID*)&NewKey); (PVOID*)&NewKey);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
return Status; DPRINT1 ("ObCreateObject() failed (Status %lx)\n", Status);
}
if (!NT_SUCCESS(Status))
{
DPRINT1 ("ObRosCreateObject() failed (Status %lx)\n", Status);
ObDereferenceObject (ParentKey); ObDereferenceObject (ParentKey);
return Status; return Status;
} }

View file

@ -147,10 +147,14 @@ CmiObjectParse(PVOID ParsedObject,
/* Create new key object and put into linked list */ /* Create new key object and put into linked list */
DPRINT("CmiObjectParse: %s\n", Path); DPRINT("CmiObjectParse: %s\n", Path);
Status = ObRosCreateObject(NULL, Status = ObCreateObject(KernelMode,
STANDARD_RIGHTS_REQUIRED,
NULL,
CmiKeyType, CmiKeyType,
NULL,
KernelMode,
NULL,
sizeof(KEY_OBJECT),
0,
0,
(PVOID*)&FoundObject); (PVOID*)&FoundObject);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {

View file

@ -63,7 +63,7 @@ enum
}; };
#define OBJECT_ALLOC_SIZE(type) (type->NonpagedPoolCharge+sizeof(OBJECT_HEADER)-sizeof(COMMON_BODY_HEADER)) #define OBJECT_ALLOC_SIZE(ObjectSize) ((ObjectSize)+sizeof(OBJECT_HEADER)-sizeof(COMMON_BODY_HEADER))
extern PDIRECTORY_OBJECT NameSpaceRoot; extern PDIRECTORY_OBJECT NameSpaceRoot;

View file

@ -1,4 +1,4 @@
/* $Id: create.c,v 1.67 2003/07/11 01:23:14 royce Exp $ /* $Id: create.c,v 1.68 2003/09/25 20:04:27 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -211,7 +211,6 @@ PFILE_OBJECT STDCALL
IoCreateStreamFileObject(PFILE_OBJECT FileObject, IoCreateStreamFileObject(PFILE_OBJECT FileObject,
PDEVICE_OBJECT DeviceObject) PDEVICE_OBJECT DeviceObject)
{ {
HANDLE FileHandle;
PFILE_OBJECT CreatedFileObject; PFILE_OBJECT CreatedFileObject;
NTSTATUS Status; NTSTATUS Status;
@ -220,10 +219,14 @@ IoCreateStreamFileObject(PFILE_OBJECT FileObject,
assert_irql(PASSIVE_LEVEL); assert_irql(PASSIVE_LEVEL);
Status = ObRosCreateObject(&FileHandle, Status = ObCreateObject(KernelMode,
STANDARD_RIGHTS_REQUIRED,
NULL,
IoFileObjectType, IoFileObjectType,
NULL,
KernelMode,
NULL,
sizeof(FILE_OBJECT),
0,
0,
(PVOID*)&CreatedFileObject); (PVOID*)&CreatedFileObject);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -247,9 +250,7 @@ IoCreateStreamFileObject(PFILE_OBJECT FileObject,
// shouldn't we initialize the lock event, and several other things here too? // shouldn't we initialize the lock event, and several other things here too?
KeInitializeEvent(&CreatedFileObject->Event, NotificationEvent, FALSE); KeInitializeEvent(&CreatedFileObject->Event, NotificationEvent, FALSE);
ZwClose(FileHandle); return CreatedFileObject;
return(CreatedFileObject);
} }
@ -354,16 +355,34 @@ IoCreateFile(OUT PHANDLE FileHandle,
*FileHandle = 0; *FileHandle = 0;
Status = ObRosCreateObject(FileHandle, Status = ObCreateObject(ExGetPreviousMode(),
DesiredAccess,
ObjectAttributes,
IoFileObjectType, IoFileObjectType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(FILE_OBJECT),
0,
0,
(PVOID*)&FileObject); (PVOID*)&FileObject);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT("ObRosCreateObject() failed! (Status %lx)\n", Status); DPRINT("ObCreateObject() failed! (Status %lx)\n", Status);
return(Status); return(Status);
} }
Status = ObInsertObject ((PVOID)FileObject,
NULL,
DesiredAccess,
0,
NULL,
FileHandle);
if (!NT_SUCCESS(Status))
{
DPRINT("ObInsertObject() failed! (Status %lx)\n", Status);
ObDereferenceObject (FileObject);
return(Status);
}
if (CreateOptions & FILE_SYNCHRONOUS_IO_ALERT) if (CreateOptions & FILE_SYNCHRONOUS_IO_ALERT)
{ {
FileObject->Flags |= (FO_ALERTABLE_IO | FO_SYNCHRONOUS_IO); FileObject->Flags |= (FO_ALERTABLE_IO | FO_SYNCHRONOUS_IO);

View file

@ -1,4 +1,4 @@
/* $Id: device.c,v 1.59 2003/09/25 15:54:42 navaraf Exp $ /* $Id: device.c,v 1.60 2003/09/25 20:04:27 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -281,7 +281,6 @@ IopCreateDriverObject(PDRIVER_OBJECT *DriverObject,
ULONG DriverImageSize) ULONG DriverImageSize)
{ {
PDRIVER_OBJECT Object; PDRIVER_OBJECT Object;
HANDLE DriverHandle = 0;
ULONG i; ULONG i;
WCHAR NameBuffer[MAX_PATH]; WCHAR NameBuffer[MAX_PATH];
UNICODE_STRING DriverName; UNICODE_STRING DriverName;
@ -314,19 +313,21 @@ IopCreateDriverObject(PDRIVER_OBJECT *DriverObject,
NULL, NULL,
NULL); NULL);
/* Create module object */ /* Create driver object */
Status = ObRosCreateObject(&DriverHandle, Status = ObCreateObject(KernelMode,
STANDARD_RIGHTS_REQUIRED,
&ObjectAttributes,
IoDriverObjectType, IoDriverObjectType,
&ObjectAttributes,
KernelMode,
NULL,
sizeof(DRIVER_OBJECT),
0,
0,
(PVOID*)&Object); (PVOID*)&Object);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
return(Status); return(Status);
} }
NtClose(DriverHandle);
/* Create driver extension */ /* Create driver extension */
Object->DriverExtension = (PDRIVER_EXTENSION) Object->DriverExtension = (PDRIVER_EXTENSION)
ExAllocatePoolWithTag(NonPagedPool, ExAllocatePoolWithTag(NonPagedPool,
@ -763,18 +764,26 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
if (DeviceName != NULL) if (DeviceName != NULL)
{ {
InitializeObjectAttributes(&ObjectAttributes,DeviceName,0,NULL,NULL); InitializeObjectAttributes(&ObjectAttributes,DeviceName,0,NULL,NULL);
Status = ObRosCreateObject(NULL, Status = ObCreateObject(KernelMode,
0,
&ObjectAttributes,
IoDeviceObjectType, IoDeviceObjectType,
&ObjectAttributes,
KernelMode,
NULL,
sizeof(DEVICE_OBJECT),
0,
0,
(PVOID*)&CreatedDeviceObject); (PVOID*)&CreatedDeviceObject);
} }
else else
{ {
Status = ObRosCreateObject(NULL, Status = ObCreateObject(KernelMode,
0,
NULL,
IoDeviceObjectType, IoDeviceObjectType,
NULL,
KernelMode,
NULL,
sizeof(DEVICE_OBJECT),
0,
0,
(PVOID*)&CreatedDeviceObject); (PVOID*)&CreatedDeviceObject);
} }
@ -782,7 +791,7 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT("IoCreateDevice() ObRosCreateObject failed, status: 0x%08X\n", Status); DPRINT("IoCreateDevice() ObCreateObject failed, status: 0x%08X\n", Status);
return(Status); return(Status);
} }

View file

@ -115,19 +115,36 @@ NtCreateIoCompletion(
PKQUEUE Queue; PKQUEUE Queue;
NTSTATUS Status; NTSTATUS Status;
Status = ObRosCreateObject(IoCompletionHandle, Status = ObCreateObject(ExGetPreviousMode(),
DesiredAccess,
ObjectAttributes,
ExIoCompletionType, ExIoCompletionType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(KQUEUE),
0,
0,
(PVOID*)&Queue); (PVOID*)&Queue);
if (!NT_SUCCESS(Status))
if (NT_SUCCESS(Status))
{ {
(void) KeInitializeQueue(Queue, NumberOfConcurrentThreads); return Status;
ObDereferenceObject(Queue);
} }
Status = ObInsertObject ((PVOID)Queue,
NULL,
DesiredAccess,
0,
NULL,
IoCompletionHandle);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject(Queue);
return Status; return Status;
}
KeInitializeQueue(Queue, NumberOfConcurrentThreads);
ObDereferenceObject(Queue);
return STATUS_SUCCESS;
/* /*
CompletionPort = NULL OR ExistingCompletionPort CompletionPort = NULL OR ExistingCompletionPort

View file

@ -1,4 +1,4 @@
/* $Id: connect.c,v 1.19 2003/08/07 11:47:33 silverblade Exp $ /* $Id: connect.c,v 1.20 2003/09/25 20:04:59 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -63,10 +63,14 @@ EiConnectPort(IN PEPORT* ConnectedPort,
/* /*
* Create a port to represent our side of the connection * Create a port to represent our side of the connection
*/ */
Status = ObRosCreateObject (NULL, Status = ObCreateObject (KernelMode,
PORT_ALL_ACCESS,
NULL,
ExPortType, ExPortType,
NULL,
KernelMode,
NULL,
sizeof(EPORT),
0,
0,
(PVOID*)&OurPort); (PVOID*)&OurPort);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -548,10 +552,14 @@ NtAcceptConnectPort (PHANDLE ServerPortHandle,
*/ */
if (AcceptIt) if (AcceptIt)
{ {
Status = ObRosCreateObject(ServerPortHandle, Status = ObCreateObject(ExGetPreviousMode(),
PORT_ALL_ACCESS,
NULL,
ExPortType, ExPortType,
NULL,
ExGetPreviousMode(),
NULL,
sizeof(EPORT),
0,
0,
(PVOID*)&OurPort); (PVOID*)&OurPort);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -559,6 +567,21 @@ NtAcceptConnectPort (PHANDLE ServerPortHandle,
ObDereferenceObject(NamedPort); ObDereferenceObject(NamedPort);
return(Status); return(Status);
} }
Status = ObInsertObject ((PVOID)OurPort,
NULL,
PORT_ALL_ACCESS,
0,
NULL,
ServerPortHandle);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject(OurPort);
ExFreePool(CReply);
ObDereferenceObject(NamedPort);
return(Status);
}
NiInitializePort(OurPort); NiInitializePort(OurPort);
} }

View file

@ -1,4 +1,4 @@
/* $Id: create.c,v 1.12 2003/07/11 01:23:15 royce Exp $ /* $Id: create.c,v 1.13 2003/09/25 20:04:59 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -112,17 +112,34 @@ NtCreatePort (PHANDLE PortHandle,
{ {
return (Status); return (Status);
} }
/* Ask Ob to create the object */ /* Ask Ob to create the object */
Status = ObRosCreateObject (PortHandle, Status = ObCreateObject (ExGetPreviousMode(),
PORT_ALL_ACCESS,
ObjectAttributes,
ExPortType, ExPortType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(EPORT),
0,
0,
(PVOID*)&Port); (PVOID*)&Port);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
return (Status); return (Status);
} }
Status = ObInsertObject ((PVOID)Port,
NULL,
PORT_ALL_ACCESS,
0,
NULL,
PortHandle);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject (Port);
return (Status);
}
Status = NiInitializePort (Port); Status = NiInitializePort (Port);
Port->MaxConnectInfoLength = 260; /* FIXME: use a macro! */ Port->MaxConnectInfoLength = 260; /* FIXME: use a macro! */
Port->MaxDataLength = 328; /* FIXME: use a macro! */ Port->MaxDataLength = 328; /* FIXME: use a macro! */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: section.c,v 1.127 2003/08/20 00:02:31 dwelch Exp $ /* $Id: section.c,v 1.128 2003/09/25 20:05:44 ekohl Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/section.c * FILE: ntoskrnl/mm/section.c
@ -2201,16 +2201,32 @@ MmCreatePageFileSection(PHANDLE SectionHandle,
/* /*
* Create the section * Create the section
*/ */
Status = ObRosCreateObject(SectionHandle, Status = ObCreateObject(ExGetPreviousMode(),
DesiredAccess,
ObjectAttributes,
MmSectionObjectType, MmSectionObjectType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(SECTION_OBJECT),
0,
0,
(PVOID*)&Section); (PVOID*)&Section);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
return(Status); return(Status);
} }
Status = ObInsertObject ((PVOID)Section,
NULL,
DesiredAccess,
0,
NULL,
SectionHandle);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject(Section);
return(Status);
}
/* /*
* Initialize it * Initialize it
*/ */
@ -2296,16 +2312,32 @@ MmCreateDataFileSection(PHANDLE SectionHandle,
/* /*
* Create the section * Create the section
*/ */
Status = ObRosCreateObject(SectionHandle, Status = ObCreateObject(ExGetPreviousMode(),
DesiredAccess,
ObjectAttributes,
MmSectionObjectType, MmSectionObjectType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(SECTION_OBJECT),
0,
0,
(PVOID*)&Section); (PVOID*)&Section);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
return(Status); return(Status);
} }
Status = ObInsertObject ((PVOID)Section,
NULL,
DesiredAccess,
0,
NULL,
SectionHandle);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject(Section);
return(Status);
}
/* /*
* Initialize it * Initialize it
*/ */
@ -2654,10 +2686,14 @@ MmCreateImageSection(PHANDLE SectionHandle,
/* /*
* Create the section * Create the section
*/ */
Status = ObRosCreateObject(SectionHandle, Status = ObCreateObject (ExGetPreviousMode(),
DesiredAccess,
ObjectAttributes,
MmSectionObjectType, MmSectionObjectType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(SECTION_OBJECT),
0,
0,
(PVOID*)&Section); (PVOID*)&Section);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -2666,6 +2702,20 @@ MmCreateImageSection(PHANDLE SectionHandle,
return(Status); return(Status);
} }
Status = ObInsertObject ((PVOID)Section,
NULL,
DesiredAccess,
0,
NULL,
SectionHandle);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject(Section);
ObDereferenceObject(FileObject);
ExFreePool(ImageSections);
return(Status);
}
/* /*
* Initialize it * Initialize it
*/ */
@ -2840,10 +2890,14 @@ MmCreateImageSection(PHANDLE SectionHandle,
/* /*
* Create the section * Create the section
*/ */
Status = ObRosCreateObject(SectionHandle, Status = ObCreateObject (ExGetPreviousMode(),
DesiredAccess,
ObjectAttributes,
MmSectionObjectType, MmSectionObjectType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(SECTION_OBJECT),
0,
0,
(PVOID*)&Section); (PVOID*)&Section);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -2851,6 +2905,19 @@ MmCreateImageSection(PHANDLE SectionHandle,
return(Status); return(Status);
} }
Status = ObInsertObject ((PVOID)Section,
NULL,
DesiredAccess,
0,
NULL,
SectionHandle);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject(Section);
ObDereferenceObject(FileObject);
return(Status);
}
/* /*
* Initialize it * Initialize it
*/ */

View file

@ -1,4 +1,4 @@
/* $Id: evtpair.c,v 1.16 2003/09/14 09:18:04 hbirr Exp $ /* $Id: evtpair.c,v 1.17 2003/09/25 20:06:32 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -101,23 +101,37 @@ NtCreateEventPair(OUT PHANDLE EventPairHandle,
NTSTATUS Status; NTSTATUS Status;
DPRINT("NtCreateEventPair()\n"); DPRINT("NtCreateEventPair()\n");
Status = ObRosCreateObject(EventPairHandle, Status = ObCreateObject(ExGetPreviousMode(),
DesiredAccess,
ObjectAttributes,
ExEventPairObjectType, ExEventPairObjectType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(KEVENT_PAIR),
0,
0,
(PVOID*)&EventPair); (PVOID*)&EventPair);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
return(Status); return(Status);
} }
KeInitializeEvent(&EventPair->LowEvent, KeInitializeEvent(&EventPair->LowEvent,
SynchronizationEvent, SynchronizationEvent,
FALSE); FALSE);
KeInitializeEvent(&EventPair->HighEvent, KeInitializeEvent(&EventPair->HighEvent,
SynchronizationEvent, SynchronizationEvent,
FALSE); FALSE);
Status = ObInsertObject ((PVOID)EventPair,
NULL,
DesiredAccess,
0,
NULL,
EventPairHandle);
ObDereferenceObject(EventPair); ObDereferenceObject(EventPair);
return(STATUS_SUCCESS);
return Status;
} }

View file

@ -114,20 +114,33 @@ NtCreateMutant(OUT PHANDLE MutantHandle,
PKMUTEX Mutant; PKMUTEX Mutant;
NTSTATUS Status; NTSTATUS Status;
Status = ObRosCreateObject(MutantHandle, Status = ObCreateObject(ExGetPreviousMode(),
DesiredAccess,
ObjectAttributes,
ExMutantObjectType, ExMutantObjectType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(KMUTANT),
0,
0,
(PVOID*)&Mutant); (PVOID*)&Mutant);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
return(Status); return(Status);
} }
KeInitializeMutant(Mutant, KeInitializeMutant(Mutant,
InitialOwner); InitialOwner);
Status = ObInsertObject ((PVOID)Mutant,
NULL,
DesiredAccess,
0,
NULL,
MutantHandle);
ObDereferenceObject(Mutant); ObDereferenceObject(Mutant);
return(STATUS_SUCCESS); return Status;
} }

View file

@ -150,10 +150,14 @@ NtCreateEvent(OUT PHANDLE UnsafeEventHandle,
ObjectAttributes = NULL; ObjectAttributes = NULL;
} }
Status = ObRosCreateObject(&EventHandle, Status = ObCreateObject(ExGetPreviousMode(),
DesiredAccess,
ObjectAttributes,
ExEventObjectType, ExEventObjectType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(KEVENT),
0,
0,
(PVOID*)&Event); (PVOID*)&Event);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -162,7 +166,18 @@ NtCreateEvent(OUT PHANDLE UnsafeEventHandle,
KeInitializeEvent(Event, KeInitializeEvent(Event,
ManualReset ? NotificationEvent : SynchronizationEvent, ManualReset ? NotificationEvent : SynchronizationEvent,
InitialState); InitialState);
Status = ObInsertObject ((PVOID)Event,
NULL,
DesiredAccess,
0,
NULL,
&EventHandle);
ObDereferenceObject(Event); ObDereferenceObject(Event);
if (!NT_SUCCESS(Status))
{
return Status;
}
Status = MmCopyToCaller(UnsafeEventHandle, &EventHandle, sizeof(HANDLE)); Status = MmCopyToCaller(UnsafeEventHandle, &EventHandle, sizeof(HANDLE));
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))

View file

@ -1,4 +1,4 @@
/* $Id: ntsem.c,v 1.18 2003/06/07 12:23:14 chorns Exp $ /* $Id: ntsem.c,v 1.19 2003/09/25 20:06:32 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -86,20 +86,34 @@ NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
PKSEMAPHORE Semaphore; PKSEMAPHORE Semaphore;
NTSTATUS Status; NTSTATUS Status;
Status = ObRosCreateObject(SemaphoreHandle, Status = ObCreateObject(ExGetPreviousMode(),
DesiredAccess,
ObjectAttributes,
ExSemaphoreType, ExSemaphoreType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(KSEMAPHORE),
0,
0,
(PVOID*)&Semaphore); (PVOID*)&Semaphore);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
return(Status); return(Status);
} }
KeInitializeSemaphore(Semaphore, KeInitializeSemaphore(Semaphore,
InitialCount, InitialCount,
MaximumCount); MaximumCount);
Status = ObInsertObject ((PVOID)Semaphore,
NULL,
DesiredAccess,
0,
NULL,
SemaphoreHandle);
ObDereferenceObject(Semaphore); ObDereferenceObject(Semaphore);
return(STATUS_SUCCESS);
return Status;
} }

View file

@ -1,4 +1,4 @@
/* $Id: nttimer.c,v 1.19 2003/06/07 12:23:14 chorns Exp $ /* $Id: nttimer.c,v 1.20 2003/09/25 20:06:32 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -192,10 +192,14 @@ NtCreateTimer(OUT PHANDLE TimerHandle,
NTSTATUS Status; NTSTATUS Status;
DPRINT("NtCreateTimer()\n"); DPRINT("NtCreateTimer()\n");
Status = ObRosCreateObject(TimerHandle, Status = ObCreateObject(ExGetPreviousMode(),
DesiredAccess,
ObjectAttributes,
ExTimerType, ExTimerType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(NTTIMER),
0,
0,
(PVOID*)&Timer); (PVOID*)&Timer);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return Status; return Status;
@ -209,9 +213,16 @@ NtCreateTimer(OUT PHANDLE TimerHandle,
Timer->Running = FALSE; Timer->Running = FALSE;
Status = ObInsertObject ((PVOID)Timer,
NULL,
DesiredAccess,
0,
NULL,
TimerHandle);
ObDereferenceObject(Timer); ObDereferenceObject(Timer);
return(STATUS_SUCCESS); return Status;
} }

View file

@ -458,10 +458,14 @@ NtCreateProfile(OUT PHANDLE UnsafeProfileHandle,
/* /*
* Create the object * Create the object
*/ */
Status = ObRosCreateObject(&ProfileHandle, Status = ObCreateObject(ExGetPreviousMode(),
STANDARD_RIGHTS_ALL,
NULL,
ExProfileObjectType, ExProfileObjectType,
NULL,
ExGetPreviousMode(),
NULL,
sizeof(KPROFILE),
0,
0,
(PVOID*)&Profile); (PVOID*)&Profile);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -487,6 +491,18 @@ NtCreateProfile(OUT PHANDLE UnsafeProfileHandle,
*/ */
KiInsertProfile(Profile); KiInsertProfile(Profile);
Status = ObInsertObject ((PVOID)Profile,
NULL,
STANDARD_RIGHTS_ALL,
0,
NULL,
&ProfileHandle);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject (Profile);
return Status;
}
/* /*
* Copy the created handle back to the caller * Copy the created handle back to the caller
*/ */

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.def,v 1.166 2003/09/25 18:29:45 navaraf Exp $ ; $Id: ntoskrnl.def,v 1.167 2003/09/25 20:02:09 ekohl Exp $
; ;
; reactos/ntoskrnl/ntoskrnl.def ; reactos/ntoskrnl/ntoskrnl.def
; ;
@ -611,11 +611,10 @@ ObAssignSecurity@16
;ObCheckCreateObjectAccess@28 ;ObCheckCreateObjectAccess@28
;ObCheckObjectAccess@20 ;ObCheckObjectAccess@20
ObCreateObject@36 ObCreateObject@36
ObRosCreateObject@20
;ObFindHandleForObject@20 ;ObFindHandleForObject@20
ObGetObjectPointerCount@4 ObGetObjectPointerCount@4
ObGetObjectSecurity@12 ObGetObjectSecurity@12
;ObInsertObject@24 ObInsertObject@24
ObMakeTemporaryObject@4 ObMakeTemporaryObject@4
ObOpenObjectByName@28 ObOpenObjectByName@28
ObOpenObjectByPointer@28 ObOpenObjectByPointer@28

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.edf,v 1.153 2003/09/25 15:54:42 navaraf Exp $ ; $Id: ntoskrnl.edf,v 1.154 2003/09/25 20:02:09 ekohl Exp $
; ;
; reactos/ntoskrnl/ntoskrnl.def ; reactos/ntoskrnl/ntoskrnl.def
; ;
@ -612,11 +612,10 @@ ObAssignSecurity=ObAssignSecurity@16
;ObCheckCreateObjectAccess=ObCheckCreateObjectAccess@28 ;ObCheckCreateObjectAccess=ObCheckCreateObjectAccess@28
;ObCheckObjectAccess=ObCheckObjectAccess@20 ;ObCheckObjectAccess=ObCheckObjectAccess@20
ObCreateObject=ObCreateObject@36 ObCreateObject=ObCreateObject@36
ObRosCreateObject=ObRosCreateObject@20
;ObFindHandleForObject=ObFindHandleForObject@20 ;ObFindHandleForObject=ObFindHandleForObject@20
ObGetObjectPointerCount=ObGetObjectPointerCount@4 ObGetObjectPointerCount=ObGetObjectPointerCount@4
ObGetObjectSecurity=ObGetObjectSecurity@12 ObGetObjectSecurity=ObGetObjectSecurity@12
;ObInsertObject=ObInsertObject@24 ObInsertObject=ObInsertObject@24
ObMakeTemporaryObject=ObMakeTemporaryObject@4 ObMakeTemporaryObject=ObMakeTemporaryObject@4
ObOpenObjectByName=ObOpenObjectByName@28 ObOpenObjectByName=ObOpenObjectByName@28
ObOpenObjectByPointer=ObOpenObjectByPointer@28 ObOpenObjectByPointer=ObOpenObjectByPointer@28

View file

@ -1,4 +1,4 @@
/* $Id: dirobj.c,v 1.19 2003/09/03 20:15:02 ekohl Exp $ /* $Id: dirobj.c,v 1.20 2003/09/25 20:07:46 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -332,19 +332,39 @@ NtCreateDirectoryObject (OUT PHANDLE DirectoryHandle,
IN ACCESS_MASK DesiredAccess, IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes) IN POBJECT_ATTRIBUTES ObjectAttributes)
{ {
PDIRECTORY_OBJECT dir; PDIRECTORY_OBJECT DirectoryObject;
NTSTATUS Status;
DPRINT("NtCreateDirectoryObject(DirectoryHandle %x, " DPRINT("NtCreateDirectoryObject(DirectoryHandle %x, "
"DesiredAccess %x, ObjectAttributes %x, " "DesiredAccess %x, ObjectAttributes %x, "
"ObjectAttributes->ObjectName %S)\n", "ObjectAttributes->ObjectName %wZ)\n",
DirectoryHandle, DesiredAccess, ObjectAttributes, DirectoryHandle, DesiredAccess, ObjectAttributes,
ObjectAttributes->ObjectName); ObjectAttributes->ObjectName);
return(ObRosCreateObject(DirectoryHandle, Status = ObCreateObject (ExGetPreviousMode(),
DesiredAccess,
ObjectAttributes,
ObDirectoryType, ObDirectoryType,
(PVOID*)&dir)); ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(DIRECTORY_OBJECT),
0,
0,
(PVOID*)&DirectoryObject);
if (!NT_SUCCESS(Status))
{
return Status;
}
Status = ObInsertObject ((PVOID)DirectoryObject,
NULL,
DesiredAccess,
0,
NULL,
DirectoryHandle);
ObDereferenceObject(DirectoryObject);
return Status;
} }
/* EOF */ /* EOF */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: handle.c,v 1.50 2003/09/14 09:19:07 hbirr Exp $ /* $Id: handle.c,v 1.51 2003/09/25 20:07:46 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -774,17 +774,26 @@ NTSTATUS STDCALL NtClose(HANDLE Handle)
* @implemented * @implemented
*/ */
NTSTATUS STDCALL NTSTATUS STDCALL
ObInsertObject(PVOID Object, ObInsertObject(IN PVOID Object,
PACCESS_STATE PassedAccessState, IN PACCESS_STATE PassedAccessState OPTIONAL,
ACCESS_MASK DesiredAccess, IN ACCESS_MASK DesiredAccess,
ULONG AdditionalReferences, IN ULONG AdditionalReferences,
PVOID* ReferencedObject, OUT PVOID* ReferencedObject OPTIONAL,
PHANDLE Handle) OUT PHANDLE Handle)
{ {
POBJECT_HEADER ObjectHeader;
ACCESS_MASK Access;
Access = DesiredAccess;
ObjectHeader = BODY_TO_HEADER(Object);
RtlMapGenericMask(&Access,
ObjectHeader->ObjectType->Mapping);
return(ObCreateHandle(PsGetCurrentProcess(), return(ObCreateHandle(PsGetCurrentProcess(),
Object, Object,
DesiredAccess, Access,
FALSE, ObjectHeader->Inherit,
Handle)); Handle));
} }

View file

@ -1,4 +1,4 @@
/* $Id: namespc.c,v 1.39 2003/07/10 21:34:29 royce Exp $ /* $Id: namespc.c,v 1.40 2003/09/25 20:07:46 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -399,10 +399,14 @@ ObInit(VOID)
L"ObjectType"); L"ObjectType");
/* create root directory */ /* create root directory */
ObRosCreateObject(NULL, ObCreateObject(KernelMode,
STANDARD_RIGHTS_REQUIRED,
NULL,
ObDirectoryType, ObDirectoryType,
NULL,
KernelMode,
NULL,
sizeof(DIRECTORY_OBJECT),
0,
0,
(PVOID*)&NameSpaceRoot); (PVOID*)&NameSpaceRoot);
/* create '\ObjectTypes' directory */ /* create '\ObjectTypes' directory */
@ -413,10 +417,14 @@ ObInit(VOID)
OBJ_PERMANENT, OBJ_PERMANENT,
NULL, NULL,
NULL); NULL);
ObRosCreateObject(NULL, ObCreateObject(KernelMode,
STANDARD_RIGHTS_REQUIRED,
&ObjectAttributes,
ObDirectoryType, ObDirectoryType,
&ObjectAttributes,
KernelMode,
NULL,
sizeof(DIRECTORY_OBJECT),
0,
0,
NULL); NULL);
ObpCreateTypeObject(ObDirectoryType); ObpCreateTypeObject(ObDirectoryType);
@ -447,10 +455,14 @@ ObpCreateTypeObject(POBJECT_TYPE ObjectType)
OBJ_PERMANENT, OBJ_PERMANENT,
NULL, NULL,
NULL); NULL);
Status = ObRosCreateObject(NULL, Status = ObCreateObject(KernelMode,
STANDARD_RIGHTS_REQUIRED,
&ObjectAttributes,
ObTypeObjectType, ObTypeObjectType,
&ObjectAttributes,
KernelMode,
NULL,
sizeof(TYPE_OBJECT),
0,
0,
(PVOID*)&TypeObject); (PVOID*)&TypeObject);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {

View file

@ -1,4 +1,4 @@
/* $Id: object.c,v 1.68 2003/09/25 05:12:24 vizzini Exp $ /* $Id: object.c,v 1.69 2003/09/25 20:07:46 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -40,46 +40,6 @@ POBJECT_HEADER BODY_TO_HEADER(PVOID body)
} }
/**********************************************************************
* NAME PRIVATE
* ObInitializeObject
*
* DESCRIPTION
*
* ARGUMENTS
*
* RETURN VALUE
*/
VOID ObInitializeObject(POBJECT_HEADER ObjectHeader,
PHANDLE Handle,
ACCESS_MASK DesiredAccess,
POBJECT_TYPE Type,
POBJECT_ATTRIBUTES ObjectAttributes)
{
ObjectHeader->HandleCount = 0;
ObjectHeader->RefCount = 1;
ObjectHeader->ObjectType = Type;
if (ObjectAttributes != NULL &&
ObjectAttributes->Attributes & OBJ_PERMANENT)
{
ObjectHeader->Permanent = TRUE;
}
else
{
ObjectHeader->Permanent = FALSE;
}
RtlInitUnicodeString(&(ObjectHeader->Name),NULL);
if (Handle != NULL)
{
ObCreateHandle(PsGetCurrentProcess(),
HEADER_TO_BODY(ObjectHeader),
DesiredAccess,
ObjectAttributes && (ObjectAttributes->Attributes & OBJ_INHERIT) ? TRUE : FALSE,
Handle);
}
}
/********************************************************************** /**********************************************************************
* NAME PRIVATE * NAME PRIVATE
* ObFindObject@16 * ObFindObject@16
@ -351,21 +311,26 @@ ObQueryNameString (IN PVOID Object,
/********************************************************************** /**********************************************************************
* NAME EXPORTED * NAME EXPORTED
* ObRosCreateObject@20 * ObCreateObject@36
* *
* DESCRIPTION * DESCRIPTION
* *
* ARGUMENTS * ARGUMENTS
* *
* NOTE
* Internal ReactOS function
* RETURN VALUE * RETURN VALUE
* Status
*
* @implemented
*/ */
NTSTATUS STDCALL NTSTATUS STDCALL
ObRosCreateObject (OUT PHANDLE Handle, ObCreateObject (IN KPROCESSOR_MODE ObjectAttributesAccessMode OPTIONAL,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes,
IN POBJECT_TYPE Type, IN POBJECT_TYPE Type,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN KPROCESSOR_MODE AccessMode,
IN OUT PVOID ParseContext OPTIONAL,
IN ULONG ObjectSize,
IN ULONG PagedPoolCharge OPTIONAL,
IN ULONG NonPagedPoolCharge OPTIONAL,
OUT PVOID *Object) OUT PVOID *Object)
{ {
PVOID Parent = NULL; PVOID Parent = NULL;
@ -378,7 +343,7 @@ ObRosCreateObject (OUT PHANDLE Handle,
assert_irql(APC_LEVEL); assert_irql(APC_LEVEL);
DPRINT("ObRosCreateObject(Handle %x, ObjectAttributes %x, Type %x)\n", DPRINT("ObCreateObject(Handle %x, ObjectAttributes %x, Type %x)\n",
Handle, ObjectAttributes, Type); Handle, ObjectAttributes, Type);
if (ObjectAttributes != NULL && if (ObjectAttributes != NULL &&
@ -400,17 +365,37 @@ ObRosCreateObject (OUT PHANDLE Handle,
RtlInitUnicodeString(&RemainingPath, NULL); RtlInitUnicodeString(&RemainingPath, NULL);
} }
RtlMapGenericMask(&DesiredAccess,
Type->Mapping);
Header = (POBJECT_HEADER)ExAllocatePoolWithTag(NonPagedPool, Header = (POBJECT_HEADER)ExAllocatePoolWithTag(NonPagedPool,
OBJECT_ALLOC_SIZE(Type), OBJECT_ALLOC_SIZE(ObjectSize),
Type->Tag); Type->Tag);
ObInitializeObject(Header, if (Header == NULL)
NULL, return STATUS_INSUFFICIENT_RESOURCES;
DesiredAccess,
Type, /* Initialize the object header */
ObjectAttributes); Header->HandleCount = 0;
Header->RefCount = 1;
Header->ObjectType = Type;
if (ObjectAttributes != NULL &&
ObjectAttributes->Attributes & OBJ_PERMANENT)
{
Header->Permanent = TRUE;
}
else
{
Header->Permanent = FALSE;
}
if (ObjectAttributes != NULL &&
ObjectAttributes->Attributes & OBJ_INHERIT)
{
Header->Inherit = TRUE;
}
else
{
Header->Inherit = FALSE;
}
RtlInitUnicodeString(&(Header->Name),NULL);
if (Parent != NULL) if (Parent != NULL)
{ {
@ -463,44 +448,9 @@ ObRosCreateObject (OUT PHANDLE Handle,
*Object = HEADER_TO_BODY(Header); *Object = HEADER_TO_BODY(Header);
} }
if (Handle != NULL)
{
ObCreateHandle(PsGetCurrentProcess(),
*Object,
DesiredAccess,
ObjectAttributes && (ObjectAttributes->Attributes & OBJ_INHERIT) ? TRUE : FALSE,
Handle);
}
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
/**********************************************************************
* NAME EXPORTED
* ObCreateObject@36
*
* DESCRIPTION
*
* ARGUMENTS
*
* RETURN VALUE
*
* @unimplemented
*/
NTSTATUS STDCALL
ObCreateObject (IN KPROCESSOR_MODE ObjectAttributesAccessMode OPTIONAL,
IN POBJECT_TYPE ObjectType,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN KPROCESSOR_MODE AccessMode,
IN OUT PVOID ParseContext OPTIONAL,
IN ULONG ObjectSize,
IN ULONG PagedPoolCharge OPTIONAL,
IN ULONG NonPagedPoolCharge OPTIONAL,
OUT PVOID *Object)
{
UNIMPLEMENTED
return STATUS_NOT_IMPLEMENTED;
}
/* /*
* @implemented * @implemented

View file

@ -1,4 +1,4 @@
/* $Id: symlink.c,v 1.3 2003/09/03 15:12:16 ekohl Exp $ /* $Id: symlink.c,v 1.4 2003/09/25 20:07:46 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -228,16 +228,32 @@ NtCreateSymbolicLinkObject(OUT PHANDLE SymbolicLinkHandle,
ObjectAttributes, ObjectAttributes,
DeviceName); DeviceName);
Status = ObRosCreateObject(SymbolicLinkHandle, Status = ObCreateObject(ExGetPreviousMode(),
DesiredAccess,
ObjectAttributes,
ObSymbolicLinkType, ObSymbolicLinkType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(SYMLNK_OBJECT),
0,
0,
(PVOID*)&SymbolicLink); (PVOID*)&SymbolicLink);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
return(Status); return(Status);
} }
Status = ObInsertObject ((PVOID)SymbolicLink,
NULL,
DesiredAccess,
0,
NULL,
SymbolicLinkHandle);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject (SymbolicLink);
return Status;
}
SymbolicLink->TargetName.Length = 0; SymbolicLink->TargetName.Length = 0;
SymbolicLink->TargetName.MaximumLength = SymbolicLink->TargetName.MaximumLength =
((wcslen(DeviceName->Buffer) + 1) * sizeof(WCHAR)); ((wcslen(DeviceName->Buffer) + 1) * sizeof(WCHAR));

View file

@ -1,4 +1,4 @@
/* $Id: create.c,v 1.66 2003/09/14 10:50:29 hbirr Exp $ /* $Id: create.c,v 1.67 2003/09/25 20:08:36 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -370,16 +370,32 @@ PsInitializeThread(HANDLE ProcessHandle,
/* /*
* Create and initialize thread * Create and initialize thread
*/ */
Status = ObRosCreateObject(ThreadHandle, Status = ObCreateObject(UserMode,
DesiredAccess,
ThreadAttributes,
PsThreadType, PsThreadType,
ThreadAttributes,
UserMode,
NULL,
sizeof(ETHREAD),
0,
0,
(PVOID*)&Thread); (PVOID*)&Thread);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
return(Status); return(Status);
} }
Status = ObInsertObject ((PVOID)Thread,
NULL,
DesiredAccess,
0,
NULL,
ThreadHandle);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject (Thread);
return Status;
}
DPRINT("Thread = %x\n",Thread); DPRINT("Thread = %x\n",Thread);
PiNrThreads++; PiNrThreads++;

View file

@ -1,4 +1,4 @@
/* $Id: process.c,v 1.115 2003/09/14 10:52:33 hbirr Exp $ /* $Id: process.c,v 1.116 2003/09/25 20:08:36 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -269,10 +269,14 @@ PsInitProcessManagment(VOID)
/* /*
* Initialize the system process * Initialize the system process
*/ */
Status = ObRosCreateObject(NULL, Status = ObCreateObject(KernelMode,
PROCESS_ALL_ACCESS,
NULL,
PsProcessType, PsProcessType,
NULL,
KernelMode,
NULL,
sizeof(EPROCESS),
0,
0,
(PVOID*)&PsInitialSystemProcess); (PVOID*)&PsInitialSystemProcess);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -593,18 +597,36 @@ NtCreateProcess(OUT PHANDLE ProcessHandle,
return(Status); return(Status);
} }
Status = ObRosCreateObject(ProcessHandle, Status = ObCreateObject(ExGetPreviousMode(),
DesiredAccess,
ObjectAttributes,
PsProcessType, PsProcessType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(EPROCESS),
0,
0,
(PVOID*)&Process); (PVOID*)&Process);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
ObDereferenceObject(ParentProcess); ObDereferenceObject(ParentProcess);
DPRINT("ObRosCreateObject() = %x\n",Status); DPRINT("ObCreateObject() = %x\n",Status);
return(Status); return(Status);
} }
Status = ObInsertObject ((PVOID)Process,
NULL,
DesiredAccess,
0,
NULL,
ProcessHandle);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject (Process);
ObDereferenceObject (ParentProcess);
DPRINT("ObInsertObject() = %x\n",Status);
return Status;
}
KeInitializeDispatcherHeader(&Process->Pcb.DispatcherHeader, KeInitializeDispatcherHeader(&Process->Pcb.DispatcherHeader,
InternalProcessType, InternalProcessType,
sizeof(EPROCESS), sizeof(EPROCESS),

View file

@ -1,4 +1,4 @@
/* $Id: token.c,v 1.26 2003/07/11 01:23:16 royce Exp $ /* $Id: token.c,v 1.27 2003/09/25 20:09:11 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -145,14 +145,18 @@ SepDuplicateToken(PACCESS_TOKEN Token,
PACCESS_TOKEN AccessToken; PACCESS_TOKEN AccessToken;
Status = ObRosCreateObject(0, Status = ObCreateObject(PreviousMode,
TOKEN_ALL_ACCESS,
ObjectAttributes,
SepTokenObjectType, SepTokenObjectType,
ObjectAttributes,
PreviousMode,
NULL,
sizeof(ACCESS_TOKEN),
0,
0,
(PVOID*)&AccessToken); (PVOID*)&AccessToken);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("ObRosCreateObject() failed (Status %lx)\n"); DPRINT1("ObCreateObject() failed (Status %lx)\n");
return(Status); return(Status);
} }
@ -1061,11 +1065,19 @@ SepCreateSystemProcessToken(struct _EPROCESS* Process)
/* /*
* Initialize the token * Initialize the token
*/ */
Status = ObRosCreateObject(NULL, Status = ObCreateObject(KernelMode,
TOKEN_ALL_ACCESS,
NULL,
SepTokenObjectType, SepTokenObjectType,
NULL,
KernelMode,
NULL,
sizeof(ACCESS_TOKEN),
0,
0,
(PVOID*)&AccessToken); (PVOID*)&AccessToken);
if (!NT_SUCCESS(Status))
{
return(Status);
}
Status = NtAllocateLocallyUniqueId(&AccessToken->TokenId); Status = NtAllocateLocallyUniqueId(&AccessToken->TokenId);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -1277,17 +1289,34 @@ NtCreateToken(OUT PHANDLE UnsafeTokenHandle,
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return(Status); return(Status);
Status = ObRosCreateObject(&TokenHandle, Status = ObCreateObject(ExGetPreviousMode(),
DesiredAccess,
ObjectAttributes,
SepTokenObjectType, SepTokenObjectType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(ACCESS_TOKEN),
0,
0,
(PVOID*)&AccessToken); (PVOID*)&AccessToken);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("ObRosCreateObject() failed (Status %lx)\n"); DPRINT1("ObCreateObject() failed (Status %lx)\n");
return(Status); return(Status);
} }
Status = ObInsertObject ((PVOID)AccessToken,
NULL,
DesiredAccess,
0,
NULL,
&TokenHandle);
if (!NT_SUCCESS(Status))
{
DPRINT1("ObInsertObject() failed (Status %lx)\n");
ObDereferenceObject (AccessToken);
return Status;
}
RtlCopyLuid(&AccessToken->TokenSource.SourceIdentifier, RtlCopyLuid(&AccessToken->TokenSource.SourceIdentifier,
&TokenSource->SourceIdentifier); &TokenSource->SourceIdentifier);
memcpy(AccessToken->TokenSource.SourceName, memcpy(AccessToken->TokenSource.SourceName,
@ -1309,7 +1338,7 @@ NtCreateToken(OUT PHANDLE UnsafeTokenHandle,
/* /*
* Normally we would just point these members into the variable information * Normally we would just point these members into the variable information
* area; however, our ObRosCreateObject() call can't allocate a variable information * area; however, our ObCreateObject() call can't allocate a variable information
* area, so we allocate them seperately and provide a destroy function. * area, so we allocate them seperately and provide a destroy function.
*/ */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: winsta.c,v 1.35 2003/09/24 18:39:34 weiden Exp $ /* $Id: winsta.c,v 1.36 2003/09/25 20:09:56 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -332,10 +332,14 @@ NtUserCreateWindowStation(PUNICODE_STRING lpszWindowStationName,
DPRINT("Creating window station (%wZ)\n", &WindowStationName); DPRINT("Creating window station (%wZ)\n", &WindowStationName);
Status = ObRosCreateObject(&WinSta, Status = ObCreateObject(ExGetPreviousMode(),
STANDARD_RIGHTS_REQUIRED,
&ObjectAttributes,
ExWindowStationObjectType, ExWindowStationObjectType,
&ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(WINSTATION_OBJECT),
0,
0,
(PVOID*)&WinStaObject); (PVOID*)&WinStaObject);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -344,6 +348,20 @@ NtUserCreateWindowStation(PUNICODE_STRING lpszWindowStationName,
return (HWINSTA)0; return (HWINSTA)0;
} }
Status = ObInsertObject ((PVOID)WinStaObject,
NULL,
STANDARD_RIGHTS_REQUIRED,
0,
NULL,
&WinSta);
if (!NT_SUCCESS(Status))
{
DPRINT("Failed creating window station (%wZ)\n", &WindowStationName);
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
ObDereferenceObject(WinStaObject);
return (HWINSTA)0;
}
WinStaObject->HandleTable = ObmCreateHandleTable(); WinStaObject->HandleTable = ObmCreateHandleTable();
if (!WinStaObject->HandleTable) if (!WinStaObject->HandleTable)
{ {
@ -674,10 +692,14 @@ NtUserCreateDesktop(PUNICODE_STRING lpszDesktopName,
DPRINT("Status for open operation (0x%X)\n", Status); DPRINT("Status for open operation (0x%X)\n", Status);
Status = ObRosCreateObject(&Desktop, Status = ObCreateObject(ExGetPreviousMode(),
STANDARD_RIGHTS_REQUIRED,
&ObjectAttributes,
ExDesktopObjectType, ExDesktopObjectType,
&ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(DESKTOP_OBJECT),
0,
0,
(PVOID*)&DesktopObject); (PVOID*)&DesktopObject);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -693,6 +715,20 @@ NtUserCreateDesktop(PUNICODE_STRING lpszDesktopName,
DesktopWindowClass, DesktopWindowClass,
640, 480); 640, 480);
Status = ObInsertObject ((PVOID)DesktopObject,
NULL,
STANDARD_RIGHTS_REQUIRED,
0,
NULL,
&Desktop);
ObDereferenceObject(DesktopObject);
if (!NT_SUCCESS(Status))
{
DPRINT("Failed to create desktop handle\n");
SetLastNtError(STATUS_UNSUCCESSFUL);
return((HDESK)0);
}
return((HDESK)Desktop); return((HDESK)Desktop);
} }