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 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
ObfDereferenceObject(IN PVOID Object);

View file

@ -1,6 +1,6 @@
#ifndef _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 _OBJECT_ATTRIBUTES;
@ -160,6 +160,7 @@ typedef struct _OBJECT_HEADER
LONG HandleCount;
BOOLEAN CloseInProcess;
BOOLEAN Permanent;
BOOLEAN Inherit;
struct _DIRECTORY_OBJECT* Parent;
POBJECT_TYPE ObjectType;

View file

@ -1689,13 +1689,6 @@ typedef struct _KINTERRUPT *PKINTERRUPT;
#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 */
typedef enum _TRAVERSE_METHOD {

View file

@ -103,16 +103,32 @@ NtCreateKey(OUT PHANDLE KeyHandle,
DPRINT("RemainingPath %S ParentObject %x\n", RemainingPath.Buffer, Object);
Status = ObRosCreateObject(KeyHandle,
DesiredAccess,
NULL,
Status = ObCreateObject(ExGetPreviousMode(),
CmiKeyType,
NULL,
ExGetPreviousMode(),
NULL,
sizeof(KEY_OBJECT),
0,
0,
(PVOID*)&KeyObject);
if (!NT_SUCCESS(Status))
{
return(Status);
}
Status = ObInsertObject((PVOID)KeyObject,
NULL,
DesiredAccess,
0,
NULL,
KeyHandle);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject(KeyObject);
return(Status);
}
KeyObject->ParentKey = Object;
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
* PROJECT: ReactOS kernel
@ -290,18 +290,22 @@ CmInitializeRegistry(VOID)
/* Create '\Registry' key. */
RtlInitUnicodeString(&KeyName, REG_ROOT_KEY_NAME);
InitializeObjectAttributes(&ObjectAttributes, &KeyName, 0, NULL, NULL);
Status = ObRosCreateObject(&RootKeyHandle,
STANDARD_RIGHTS_REQUIRED,
&ObjectAttributes,
CmiKeyType,
(PVOID *) &RootKey);
Status = ObCreateObject(KernelMode,
CmiKeyType,
&ObjectAttributes,
KernelMode,
NULL,
sizeof(KEY_OBJECT),
0,
0,
(PVOID *) &RootKey);
assert(NT_SUCCESS(Status));
Status = ObReferenceObjectByHandle(RootKeyHandle,
STANDARD_RIGHTS_REQUIRED,
CmiKeyType,
KernelMode,
(PVOID *)&RootKey,
NULL);
Status = ObInsertObject(RootKey,
NULL,
STANDARD_RIGHTS_REQUIRED,
0,
NULL,
&RootKeyHandle);
assert(NT_SUCCESS(Status));
RootKey->RegistryHive = CmiVolatileHive;
RootKey->BlockOffset = CmiVolatileHive->HiveHeader->RootKeyCell;
@ -544,19 +548,18 @@ CmiConnectHive(IN POBJECT_ATTRIBUTES KeyObjectAttributes,
DPRINT("RemainingPath %wZ ParentKey %p\n",
&RemainingPath, ParentKey);
Status = ObRosCreateObject(NULL,
STANDARD_RIGHTS_REQUIRED,
NULL,
Status = ObCreateObject(KernelMode,
CmiKeyType,
NULL,
KernelMode,
NULL,
sizeof(KEY_OBJECT),
0,
0,
(PVOID*)&NewKey);
if (!NT_SUCCESS(Status))
{
return Status;
}
if (!NT_SUCCESS(Status))
{
DPRINT1 ("ObRosCreateObject() failed (Status %lx)\n", Status);
DPRINT1 ("ObCreateObject() failed (Status %lx)\n", Status);
ObDereferenceObject (ParentKey);
return Status;
}

View file

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

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
* PROJECT: ReactOS kernel
@ -211,7 +211,6 @@ PFILE_OBJECT STDCALL
IoCreateStreamFileObject(PFILE_OBJECT FileObject,
PDEVICE_OBJECT DeviceObject)
{
HANDLE FileHandle;
PFILE_OBJECT CreatedFileObject;
NTSTATUS Status;
@ -220,10 +219,14 @@ IoCreateStreamFileObject(PFILE_OBJECT FileObject,
assert_irql(PASSIVE_LEVEL);
Status = ObRosCreateObject(&FileHandle,
STANDARD_RIGHTS_REQUIRED,
NULL,
Status = ObCreateObject(KernelMode,
IoFileObjectType,
NULL,
KernelMode,
NULL,
sizeof(FILE_OBJECT),
0,
0,
(PVOID*)&CreatedFileObject);
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?
KeInitializeEvent(&CreatedFileObject->Event, NotificationEvent, FALSE);
ZwClose(FileHandle);
return(CreatedFileObject);
return CreatedFileObject;
}
@ -354,16 +355,34 @@ IoCreateFile(OUT PHANDLE FileHandle,
*FileHandle = 0;
Status = ObRosCreateObject(FileHandle,
DesiredAccess,
ObjectAttributes,
Status = ObCreateObject(ExGetPreviousMode(),
IoFileObjectType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(FILE_OBJECT),
0,
0,
(PVOID*)&FileObject);
if (!NT_SUCCESS(Status))
{
DPRINT("ObRosCreateObject() failed! (Status %lx)\n", Status);
DPRINT("ObCreateObject() failed! (Status %lx)\n", 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)
{
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
* PROJECT: ReactOS kernel
@ -281,7 +281,6 @@ IopCreateDriverObject(PDRIVER_OBJECT *DriverObject,
ULONG DriverImageSize)
{
PDRIVER_OBJECT Object;
HANDLE DriverHandle = 0;
ULONG i;
WCHAR NameBuffer[MAX_PATH];
UNICODE_STRING DriverName;
@ -314,19 +313,21 @@ IopCreateDriverObject(PDRIVER_OBJECT *DriverObject,
NULL,
NULL);
/* Create module object */
Status = ObRosCreateObject(&DriverHandle,
STANDARD_RIGHTS_REQUIRED,
&ObjectAttributes,
/* Create driver object */
Status = ObCreateObject(KernelMode,
IoDriverObjectType,
&ObjectAttributes,
KernelMode,
NULL,
sizeof(DRIVER_OBJECT),
0,
0,
(PVOID*)&Object);
if (!NT_SUCCESS(Status))
{
return(Status);
}
NtClose(DriverHandle);
/* Create driver extension */
Object->DriverExtension = (PDRIVER_EXTENSION)
ExAllocatePoolWithTag(NonPagedPool,
@ -763,18 +764,26 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
if (DeviceName != NULL)
{
InitializeObjectAttributes(&ObjectAttributes,DeviceName,0,NULL,NULL);
Status = ObRosCreateObject(NULL,
0,
&ObjectAttributes,
Status = ObCreateObject(KernelMode,
IoDeviceObjectType,
&ObjectAttributes,
KernelMode,
NULL,
sizeof(DEVICE_OBJECT),
0,
0,
(PVOID*)&CreatedDeviceObject);
}
else
{
Status = ObRosCreateObject(NULL,
0,
NULL,
Status = ObCreateObject(KernelMode,
IoDeviceObjectType,
NULL,
KernelMode,
NULL,
sizeof(DEVICE_OBJECT),
0,
0,
(PVOID*)&CreatedDeviceObject);
}
@ -782,7 +791,7 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
if (!NT_SUCCESS(Status))
{
DPRINT("IoCreateDevice() ObRosCreateObject failed, status: 0x%08X\n", Status);
DPRINT("IoCreateDevice() ObCreateObject failed, status: 0x%08X\n", Status);
return(Status);
}

View file

@ -114,20 +114,37 @@ NtCreateIoCompletion(
{
PKQUEUE Queue;
NTSTATUS Status;
Status = ObRosCreateObject(IoCompletionHandle,
DesiredAccess,
ObjectAttributes,
ExIoCompletionType,
(PVOID*)&Queue);
if (NT_SUCCESS(Status))
Status = ObCreateObject(ExGetPreviousMode(),
ExIoCompletionType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(KQUEUE),
0,
0,
(PVOID*)&Queue);
if (!NT_SUCCESS(Status))
{
(void) KeInitializeQueue(Queue, NumberOfConcurrentThreads);
ObDereferenceObject(Queue);
return Status;
}
return Status;
Status = ObInsertObject ((PVOID)Queue,
NULL,
DesiredAccess,
0,
NULL,
IoCompletionHandle);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject(Queue);
return Status;
}
KeInitializeQueue(Queue, NumberOfConcurrentThreads);
ObDereferenceObject(Queue);
return STATUS_SUCCESS;
/*
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
* PROJECT: ReactOS kernel
@ -63,10 +63,14 @@ EiConnectPort(IN PEPORT* ConnectedPort,
/*
* Create a port to represent our side of the connection
*/
Status = ObRosCreateObject (NULL,
PORT_ALL_ACCESS,
NULL,
Status = ObCreateObject (KernelMode,
ExPortType,
NULL,
KernelMode,
NULL,
sizeof(EPORT),
0,
0,
(PVOID*)&OurPort);
if (!NT_SUCCESS(Status))
{
@ -548,10 +552,14 @@ NtAcceptConnectPort (PHANDLE ServerPortHandle,
*/
if (AcceptIt)
{
Status = ObRosCreateObject(ServerPortHandle,
PORT_ALL_ACCESS,
NULL,
Status = ObCreateObject(ExGetPreviousMode(),
ExPortType,
NULL,
ExGetPreviousMode(),
NULL,
sizeof(EPORT),
0,
0,
(PVOID*)&OurPort);
if (!NT_SUCCESS(Status))
{
@ -559,9 +567,24 @@ NtAcceptConnectPort (PHANDLE ServerPortHandle,
ObDereferenceObject(NamedPort);
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);
}
/*
* Dequeue the connection request
*/

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
* PROJECT: ReactOS kernel
@ -112,17 +112,34 @@ NtCreatePort (PHANDLE PortHandle,
{
return (Status);
}
/* Ask Ob to create the object */
Status = ObRosCreateObject (PortHandle,
PORT_ALL_ACCESS,
ObjectAttributes,
Status = ObCreateObject (ExGetPreviousMode(),
ExPortType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(EPORT),
0,
0,
(PVOID*)&Port);
if (!NT_SUCCESS(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);
Port->MaxConnectInfoLength = 260; /* 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
* 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
* FILE: ntoskrnl/mm/section.c
@ -2201,16 +2201,32 @@ MmCreatePageFileSection(PHANDLE SectionHandle,
/*
* Create the section
*/
Status = ObRosCreateObject(SectionHandle,
DesiredAccess,
ObjectAttributes,
Status = ObCreateObject(ExGetPreviousMode(),
MmSectionObjectType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(SECTION_OBJECT),
0,
0,
(PVOID*)&Section);
if (!NT_SUCCESS(Status))
{
return(Status);
}
Status = ObInsertObject ((PVOID)Section,
NULL,
DesiredAccess,
0,
NULL,
SectionHandle);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject(Section);
return(Status);
}
/*
* Initialize it
*/
@ -2296,16 +2312,32 @@ MmCreateDataFileSection(PHANDLE SectionHandle,
/*
* Create the section
*/
Status = ObRosCreateObject(SectionHandle,
DesiredAccess,
ObjectAttributes,
Status = ObCreateObject(ExGetPreviousMode(),
MmSectionObjectType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(SECTION_OBJECT),
0,
0,
(PVOID*)&Section);
if (!NT_SUCCESS(Status))
{
return(Status);
}
Status = ObInsertObject ((PVOID)Section,
NULL,
DesiredAccess,
0,
NULL,
SectionHandle);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject(Section);
return(Status);
}
/*
* Initialize it
*/
@ -2654,11 +2686,15 @@ MmCreateImageSection(PHANDLE SectionHandle,
/*
* Create the section
*/
Status = ObRosCreateObject(SectionHandle,
DesiredAccess,
ObjectAttributes,
MmSectionObjectType,
(PVOID*)&Section);
Status = ObCreateObject (ExGetPreviousMode(),
MmSectionObjectType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(SECTION_OBJECT),
0,
0,
(PVOID*)&Section);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject(FileObject);
@ -2666,6 +2702,20 @@ MmCreateImageSection(PHANDLE SectionHandle,
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
*/
@ -2840,17 +2890,34 @@ MmCreateImageSection(PHANDLE SectionHandle,
/*
* Create the section
*/
Status = ObRosCreateObject(SectionHandle,
DesiredAccess,
ObjectAttributes,
MmSectionObjectType,
(PVOID*)&Section);
Status = ObCreateObject (ExGetPreviousMode(),
MmSectionObjectType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(SECTION_OBJECT),
0,
0,
(PVOID*)&Section);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject(FileObject);
return(Status);
}
Status = ObInsertObject ((PVOID)Section,
NULL,
DesiredAccess,
0,
NULL,
SectionHandle);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject(Section);
ObDereferenceObject(FileObject);
return(Status);
}
/*
* 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
* PROJECT: ReactOS kernel
@ -101,23 +101,37 @@ NtCreateEventPair(OUT PHANDLE EventPairHandle,
NTSTATUS Status;
DPRINT("NtCreateEventPair()\n");
Status = ObRosCreateObject(EventPairHandle,
DesiredAccess,
ObjectAttributes,
Status = ObCreateObject(ExGetPreviousMode(),
ExEventPairObjectType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(KEVENT_PAIR),
0,
0,
(PVOID*)&EventPair);
if (!NT_SUCCESS(Status))
{
return(Status);
}
KeInitializeEvent(&EventPair->LowEvent,
SynchronizationEvent,
FALSE);
KeInitializeEvent(&EventPair->HighEvent,
SynchronizationEvent,
FALSE);
Status = ObInsertObject ((PVOID)EventPair,
NULL,
DesiredAccess,
0,
NULL,
EventPairHandle);
ObDereferenceObject(EventPair);
return(STATUS_SUCCESS);
return Status;
}

View file

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

View file

@ -150,10 +150,14 @@ NtCreateEvent(OUT PHANDLE UnsafeEventHandle,
ObjectAttributes = NULL;
}
Status = ObRosCreateObject(&EventHandle,
DesiredAccess,
ObjectAttributes,
Status = ObCreateObject(ExGetPreviousMode(),
ExEventObjectType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(KEVENT),
0,
0,
(PVOID*)&Event);
if (!NT_SUCCESS(Status))
{
@ -162,7 +166,18 @@ NtCreateEvent(OUT PHANDLE UnsafeEventHandle,
KeInitializeEvent(Event,
ManualReset ? NotificationEvent : SynchronizationEvent,
InitialState);
Status = ObInsertObject ((PVOID)Event,
NULL,
DesiredAccess,
0,
NULL,
&EventHandle);
ObDereferenceObject(Event);
if (!NT_SUCCESS(Status))
{
return Status;
}
Status = MmCopyToCaller(UnsafeEventHandle, &EventHandle, sizeof(HANDLE));
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
* PROJECT: ReactOS kernel
@ -85,21 +85,35 @@ NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
{
PKSEMAPHORE Semaphore;
NTSTATUS Status;
Status = ObRosCreateObject(SemaphoreHandle,
DesiredAccess,
ObjectAttributes,
Status = ObCreateObject(ExGetPreviousMode(),
ExSemaphoreType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(KSEMAPHORE),
0,
0,
(PVOID*)&Semaphore);
if (!NT_SUCCESS(Status))
{
return(Status);
}
KeInitializeSemaphore(Semaphore,
InitialCount,
MaximumCount);
Status = ObInsertObject ((PVOID)Semaphore,
NULL,
DesiredAccess,
0,
NULL,
SemaphoreHandle);
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
* PROJECT: ReactOS kernel
@ -192,10 +192,14 @@ NtCreateTimer(OUT PHANDLE TimerHandle,
NTSTATUS Status;
DPRINT("NtCreateTimer()\n");
Status = ObRosCreateObject(TimerHandle,
DesiredAccess,
ObjectAttributes,
Status = ObCreateObject(ExGetPreviousMode(),
ExTimerType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(NTTIMER),
0,
0,
(PVOID*)&Timer);
if (!NT_SUCCESS(Status))
return Status;
@ -209,9 +213,16 @@ NtCreateTimer(OUT PHANDLE TimerHandle,
Timer->Running = FALSE;
Status = ObInsertObject ((PVOID)Timer,
NULL,
DesiredAccess,
0,
NULL,
TimerHandle);
ObDereferenceObject(Timer);
return(STATUS_SUCCESS);
return Status;
}

View file

@ -458,10 +458,14 @@ NtCreateProfile(OUT PHANDLE UnsafeProfileHandle,
/*
* Create the object
*/
Status = ObRosCreateObject(&ProfileHandle,
STANDARD_RIGHTS_ALL,
NULL,
Status = ObCreateObject(ExGetPreviousMode(),
ExProfileObjectType,
NULL,
ExGetPreviousMode(),
NULL,
sizeof(KPROFILE),
0,
0,
(PVOID*)&Profile);
if (!NT_SUCCESS(Status))
{
@ -487,6 +491,18 @@ NtCreateProfile(OUT PHANDLE UnsafeProfileHandle,
*/
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
*/

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
;
@ -611,11 +611,10 @@ ObAssignSecurity@16
;ObCheckCreateObjectAccess@28
;ObCheckObjectAccess@20
ObCreateObject@36
ObRosCreateObject@20
;ObFindHandleForObject@20
ObGetObjectPointerCount@4
ObGetObjectSecurity@12
;ObInsertObject@24
ObInsertObject@24
ObMakeTemporaryObject@4
ObOpenObjectByName@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
;
@ -612,11 +612,10 @@ ObAssignSecurity=ObAssignSecurity@16
;ObCheckCreateObjectAccess=ObCheckCreateObjectAccess@28
;ObCheckObjectAccess=ObCheckObjectAccess@20
ObCreateObject=ObCreateObject@36
ObRosCreateObject=ObRosCreateObject@20
;ObFindHandleForObject=ObFindHandleForObject@20
ObGetObjectPointerCount=ObGetObjectPointerCount@4
ObGetObjectSecurity=ObGetObjectSecurity@12
;ObInsertObject=ObInsertObject@24
ObInsertObject=ObInsertObject@24
ObMakeTemporaryObject=ObMakeTemporaryObject@4
ObOpenObjectByName=ObOpenObjectByName@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
* PROJECT: ReactOS kernel
@ -332,19 +332,39 @@ NtCreateDirectoryObject (OUT PHANDLE DirectoryHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes)
{
PDIRECTORY_OBJECT dir;
PDIRECTORY_OBJECT DirectoryObject;
NTSTATUS Status;
DPRINT("NtCreateDirectoryObject(DirectoryHandle %x, "
"DesiredAccess %x, ObjectAttributes %x, "
"ObjectAttributes->ObjectName %S)\n",
DirectoryHandle, DesiredAccess, ObjectAttributes,
ObjectAttributes->ObjectName);
return(ObRosCreateObject(DirectoryHandle,
DesiredAccess,
ObjectAttributes,
ObDirectoryType,
(PVOID*)&dir));
DPRINT("NtCreateDirectoryObject(DirectoryHandle %x, "
"DesiredAccess %x, ObjectAttributes %x, "
"ObjectAttributes->ObjectName %wZ)\n",
DirectoryHandle, DesiredAccess, ObjectAttributes,
ObjectAttributes->ObjectName);
Status = ObCreateObject (ExGetPreviousMode(),
ObDirectoryType,
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 */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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
* PROJECT: ReactOS kernel
@ -774,17 +774,26 @@ NTSTATUS STDCALL NtClose(HANDLE Handle)
* @implemented
*/
NTSTATUS STDCALL
ObInsertObject(PVOID Object,
PACCESS_STATE PassedAccessState,
ACCESS_MASK DesiredAccess,
ULONG AdditionalReferences,
PVOID* ReferencedObject,
PHANDLE Handle)
ObInsertObject(IN PVOID Object,
IN PACCESS_STATE PassedAccessState OPTIONAL,
IN ACCESS_MASK DesiredAccess,
IN ULONG AdditionalReferences,
OUT PVOID* ReferencedObject OPTIONAL,
OUT PHANDLE Handle)
{
POBJECT_HEADER ObjectHeader;
ACCESS_MASK Access;
Access = DesiredAccess;
ObjectHeader = BODY_TO_HEADER(Object);
RtlMapGenericMask(&Access,
ObjectHeader->ObjectType->Mapping);
return(ObCreateHandle(PsGetCurrentProcess(),
Object,
DesiredAccess,
FALSE,
Access,
ObjectHeader->Inherit,
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
* PROJECT: ReactOS kernel
@ -399,10 +399,14 @@ ObInit(VOID)
L"ObjectType");
/* create root directory */
ObRosCreateObject(NULL,
STANDARD_RIGHTS_REQUIRED,
NULL,
ObCreateObject(KernelMode,
ObDirectoryType,
NULL,
KernelMode,
NULL,
sizeof(DIRECTORY_OBJECT),
0,
0,
(PVOID*)&NameSpaceRoot);
/* create '\ObjectTypes' directory */
@ -413,10 +417,14 @@ ObInit(VOID)
OBJ_PERMANENT,
NULL,
NULL);
ObRosCreateObject(NULL,
STANDARD_RIGHTS_REQUIRED,
&ObjectAttributes,
ObCreateObject(KernelMode,
ObDirectoryType,
&ObjectAttributes,
KernelMode,
NULL,
sizeof(DIRECTORY_OBJECT),
0,
0,
NULL);
ObpCreateTypeObject(ObDirectoryType);
@ -447,10 +455,14 @@ ObpCreateTypeObject(POBJECT_TYPE ObjectType)
OBJ_PERMANENT,
NULL,
NULL);
Status = ObRosCreateObject(NULL,
STANDARD_RIGHTS_REQUIRED,
&ObjectAttributes,
Status = ObCreateObject(KernelMode,
ObTypeObjectType,
&ObjectAttributes,
KernelMode,
NULL,
sizeof(TYPE_OBJECT),
0,
0,
(PVOID*)&TypeObject);
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
* 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
* ObFindObject@16
@ -351,21 +311,26 @@ ObQueryNameString (IN PVOID Object,
/**********************************************************************
* NAME EXPORTED
* ObRosCreateObject@20
* ObCreateObject@36
*
* DESCRIPTION
*
* ARGUMENTS
*
* NOTE
* Internal ReactOS function
* RETURN VALUE
* Status
*
* @implemented
*/
NTSTATUS STDCALL
ObRosCreateObject (OUT PHANDLE Handle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes,
ObCreateObject (IN KPROCESSOR_MODE ObjectAttributesAccessMode OPTIONAL,
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)
{
PVOID Parent = NULL;
@ -378,7 +343,7 @@ ObRosCreateObject (OUT PHANDLE Handle,
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);
if (ObjectAttributes != NULL &&
@ -400,17 +365,37 @@ ObRosCreateObject (OUT PHANDLE Handle,
RtlInitUnicodeString(&RemainingPath, NULL);
}
RtlMapGenericMask(&DesiredAccess,
Type->Mapping);
Header = (POBJECT_HEADER)ExAllocatePoolWithTag(NonPagedPool,
OBJECT_ALLOC_SIZE(Type),
OBJECT_ALLOC_SIZE(ObjectSize),
Type->Tag);
ObInitializeObject(Header,
NULL,
DesiredAccess,
Type,
ObjectAttributes);
if (Header == NULL)
return STATUS_INSUFFICIENT_RESOURCES;
/* Initialize the object header */
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)
{
@ -463,44 +448,9 @@ ObRosCreateObject (OUT PHANDLE Handle,
*Object = HEADER_TO_BODY(Header);
}
if (Handle != NULL)
{
ObCreateHandle(PsGetCurrentProcess(),
*Object,
DesiredAccess,
ObjectAttributes && (ObjectAttributes->Attributes & OBJ_INHERIT) ? TRUE : FALSE,
Handle);
}
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

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
* PROJECT: ReactOS kernel
@ -228,16 +228,32 @@ NtCreateSymbolicLinkObject(OUT PHANDLE SymbolicLinkHandle,
ObjectAttributes,
DeviceName);
Status = ObRosCreateObject(SymbolicLinkHandle,
DesiredAccess,
ObjectAttributes,
Status = ObCreateObject(ExGetPreviousMode(),
ObSymbolicLinkType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(SYMLNK_OBJECT),
0,
0,
(PVOID*)&SymbolicLink);
if (!NT_SUCCESS(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.MaximumLength =
((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
* PROJECT: ReactOS kernel
@ -370,16 +370,32 @@ PsInitializeThread(HANDLE ProcessHandle,
/*
* Create and initialize thread
*/
Status = ObRosCreateObject(ThreadHandle,
DesiredAccess,
ThreadAttributes,
Status = ObCreateObject(UserMode,
PsThreadType,
ThreadAttributes,
UserMode,
NULL,
sizeof(ETHREAD),
0,
0,
(PVOID*)&Thread);
if (!NT_SUCCESS(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);
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
* PROJECT: ReactOS kernel
@ -269,10 +269,14 @@ PsInitProcessManagment(VOID)
/*
* Initialize the system process
*/
Status = ObRosCreateObject(NULL,
PROCESS_ALL_ACCESS,
NULL,
Status = ObCreateObject(KernelMode,
PsProcessType,
NULL,
KernelMode,
NULL,
sizeof(EPROCESS),
0,
0,
(PVOID*)&PsInitialSystemProcess);
if (!NT_SUCCESS(Status))
{
@ -593,18 +597,36 @@ NtCreateProcess(OUT PHANDLE ProcessHandle,
return(Status);
}
Status = ObRosCreateObject(ProcessHandle,
DesiredAccess,
ObjectAttributes,
Status = ObCreateObject(ExGetPreviousMode(),
PsProcessType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(EPROCESS),
0,
0,
(PVOID*)&Process);
if (!NT_SUCCESS(Status))
{
ObDereferenceObject(ParentProcess);
DPRINT("ObRosCreateObject() = %x\n",Status);
DPRINT("ObCreateObject() = %x\n",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,
InternalProcessType,
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
* PROJECT: ReactOS kernel
@ -145,14 +145,18 @@ SepDuplicateToken(PACCESS_TOKEN Token,
PACCESS_TOKEN AccessToken;
Status = ObRosCreateObject(0,
TOKEN_ALL_ACCESS,
ObjectAttributes,
Status = ObCreateObject(PreviousMode,
SepTokenObjectType,
ObjectAttributes,
PreviousMode,
NULL,
sizeof(ACCESS_TOKEN),
0,
0,
(PVOID*)&AccessToken);
if (!NT_SUCCESS(Status))
{
DPRINT1("ObRosCreateObject() failed (Status %lx)\n");
DPRINT1("ObCreateObject() failed (Status %lx)\n");
return(Status);
}
@ -1061,11 +1065,19 @@ SepCreateSystemProcessToken(struct _EPROCESS* Process)
/*
* Initialize the token
*/
Status = ObRosCreateObject(NULL,
TOKEN_ALL_ACCESS,
NULL,
SepTokenObjectType,
(PVOID*)&AccessToken);
Status = ObCreateObject(KernelMode,
SepTokenObjectType,
NULL,
KernelMode,
NULL,
sizeof(ACCESS_TOKEN),
0,
0,
(PVOID*)&AccessToken);
if (!NT_SUCCESS(Status))
{
return(Status);
}
Status = NtAllocateLocallyUniqueId(&AccessToken->TokenId);
if (!NT_SUCCESS(Status))
@ -1277,17 +1289,34 @@ NtCreateToken(OUT PHANDLE UnsafeTokenHandle,
if (!NT_SUCCESS(Status))
return(Status);
Status = ObRosCreateObject(&TokenHandle,
DesiredAccess,
ObjectAttributes,
Status = ObCreateObject(ExGetPreviousMode(),
SepTokenObjectType,
ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(ACCESS_TOKEN),
0,
0,
(PVOID*)&AccessToken);
if (!NT_SUCCESS(Status))
{
DPRINT1("ObRosCreateObject() failed (Status %lx)\n");
DPRINT1("ObCreateObject() failed (Status %lx)\n");
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,
&TokenSource->SourceIdentifier);
memcpy(AccessToken->TokenSource.SourceName,
@ -1309,7 +1338,7 @@ NtCreateToken(OUT PHANDLE UnsafeTokenHandle,
/*
* 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.
*/

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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
* PROJECT: ReactOS kernel
@ -332,10 +332,14 @@ NtUserCreateWindowStation(PUNICODE_STRING lpszWindowStationName,
DPRINT("Creating window station (%wZ)\n", &WindowStationName);
Status = ObRosCreateObject(&WinSta,
STANDARD_RIGHTS_REQUIRED,
&ObjectAttributes,
Status = ObCreateObject(ExGetPreviousMode(),
ExWindowStationObjectType,
&ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(WINSTATION_OBJECT),
0,
0,
(PVOID*)&WinStaObject);
if (!NT_SUCCESS(Status))
{
@ -344,6 +348,20 @@ NtUserCreateWindowStation(PUNICODE_STRING lpszWindowStationName,
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();
if (!WinStaObject->HandleTable)
{
@ -674,10 +692,14 @@ NtUserCreateDesktop(PUNICODE_STRING lpszDesktopName,
DPRINT("Status for open operation (0x%X)\n", Status);
Status = ObRosCreateObject(&Desktop,
STANDARD_RIGHTS_REQUIRED,
&ObjectAttributes,
Status = ObCreateObject(ExGetPreviousMode(),
ExDesktopObjectType,
&ObjectAttributes,
ExGetPreviousMode(),
NULL,
sizeof(DESKTOP_OBJECT),
0,
0,
(PVOID*)&DesktopObject);
if (!NT_SUCCESS(Status))
{
@ -685,7 +707,7 @@ NtUserCreateDesktop(PUNICODE_STRING lpszDesktopName,
SetLastNtError(STATUS_UNSUCCESSFUL);
return((HDESK)0);
}
/* Initialize some local (to win32k) desktop state. */
DesktopObject->ActiveMessageQueue = NULL;
DesktopObject->DesktopWindow =
@ -693,6 +715,20 @@ NtUserCreateDesktop(PUNICODE_STRING lpszDesktopName,
DesktopWindowClass,
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);
}