mirror of
https://github.com/reactos/reactos.git
synced 2024-07-29 15:49:03 +00:00
- Fixed object creation. Named objects are now automatically attached to a parent directory object.
- Minor header cleanup. svn path=/trunk/; revision=2632
This commit is contained in:
parent
46cef7fc9b
commit
40a007aba1
|
@ -1,17 +1,16 @@
|
|||
/* OBJECT MANAGER ************************************************************/
|
||||
|
||||
NTSTATUS STDCALL ObCreateObject(PHANDLE Handle,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
POBJECT_TYPE Type,
|
||||
PVOID *Object);
|
||||
NTSTATUS STDCALL
|
||||
ObCreateObject(PHANDLE Handle,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
POBJECT_TYPE Type,
|
||||
PVOID *Object);
|
||||
|
||||
VOID
|
||||
FASTCALL
|
||||
VOID FASTCALL
|
||||
ObfDereferenceObject(IN PVOID Object);
|
||||
|
||||
VOID
|
||||
FASTCALL
|
||||
VOID FASTCALL
|
||||
ObfReferenceObject(IN PVOID Object);
|
||||
|
||||
#define ObDereferenceObject(Object) \
|
||||
|
@ -20,25 +19,34 @@ ObfReferenceObject(IN PVOID Object);
|
|||
#define ObReferenceObject(Object) \
|
||||
ObfReferenceObject(Object)
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
ObMakeTemporaryObject(PVOID ObjectBody);
|
||||
NTSTATUS STDCALL
|
||||
ObInsertObject(PVOID Object,
|
||||
PACCESS_STATE PassedAccessState,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
ULONG AdditionalReferences,
|
||||
PVOID* ReferencedObject,
|
||||
PHANDLE Handle);
|
||||
|
||||
NTSTATUS STDCALL ObOpenObjectByName(IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
IN POBJECT_TYPE ObjectType,
|
||||
IN PVOID ParseContext,
|
||||
IN KPROCESSOR_MODE AccessMode,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN PACCESS_STATE PassedAccessState,
|
||||
OUT PHANDLE Handle);
|
||||
VOID STDCALL
|
||||
ObMakeTemporaryObject(IN PVOID ObjectBody);
|
||||
|
||||
NTSTATUS STDCALL ObOpenObjectByPointer(IN PVOID Object,
|
||||
IN ULONG HandleAttributes,
|
||||
IN PACCESS_STATE PassedAccessState,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN POBJECT_TYPE ObjectType,
|
||||
IN KPROCESSOR_MODE AccessMode,
|
||||
OUT PHANDLE Handle);
|
||||
NTSTATUS STDCALL
|
||||
ObOpenObjectByName(IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
IN POBJECT_TYPE ObjectType,
|
||||
IN PVOID ParseContext,
|
||||
IN KPROCESSOR_MODE AccessMode,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN PACCESS_STATE PassedAccessState,
|
||||
OUT PHANDLE Handle);
|
||||
|
||||
NTSTATUS STDCALL
|
||||
ObOpenObjectByPointer(IN PVOID Object,
|
||||
IN ULONG HandleAttributes,
|
||||
IN PACCESS_STATE PassedAccessState,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN POBJECT_TYPE ObjectType,
|
||||
IN KPROCESSOR_MODE AccessMode,
|
||||
OUT PHANDLE Handle);
|
||||
|
||||
/*
|
||||
* FUNCTION: Performs access validation on an object handle and if access
|
||||
|
@ -54,12 +62,13 @@ NTSTATUS STDCALL ObOpenObjectByPointer(IN PVOID Object,
|
|||
* information about the handle
|
||||
* RETURNS: Status
|
||||
*/
|
||||
NTSTATUS STDCALL ObReferenceObjectByHandle(HANDLE Handle,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_TYPE ObjectType,
|
||||
KPROCESSOR_MODE AccessMode,
|
||||
PVOID* Object,
|
||||
POBJECT_HANDLE_INFORMATION HandleInfo);
|
||||
NTSTATUS STDCALL
|
||||
ObReferenceObjectByHandle(HANDLE Handle,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_TYPE ObjectType,
|
||||
KPROCESSOR_MODE AccessMode,
|
||||
PVOID* Object,
|
||||
POBJECT_HANDLE_INFORMATION HandleInfo);
|
||||
|
||||
/*
|
||||
* FUNCTION: Increments the reference count for a given object
|
||||
|
@ -70,17 +79,19 @@ NTSTATUS STDCALL ObReferenceObjectByHandle(HANDLE Handle,
|
|||
* AccessMode = Access mode to use for the security check
|
||||
* RETURNS: Status
|
||||
*/
|
||||
NTSTATUS STDCALL ObReferenceObjectByPointer(PVOID Object,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_TYPE ObjectType,
|
||||
KPROCESSOR_MODE AccessMode);
|
||||
NTSTATUS STDCALL
|
||||
ObReferenceObjectByPointer(PVOID Object,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_TYPE ObjectType,
|
||||
KPROCESSOR_MODE AccessMode);
|
||||
|
||||
NTSTATUS STDCALL ObReferenceObjectByName(PUNICODE_STRING ObjectPath,
|
||||
ULONG Attributes,
|
||||
PACCESS_STATE PassedAccessState,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_TYPE ObjectType,
|
||||
KPROCESSOR_MODE AccessMode,
|
||||
PVOID ParseContext,
|
||||
PVOID* ObjectPtr);
|
||||
NTSTATUS STDCALL
|
||||
ObReferenceObjectByName(PUNICODE_STRING ObjectPath,
|
||||
ULONG Attributes,
|
||||
PACCESS_STATE PassedAccessState,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_TYPE ObjectType,
|
||||
KPROCESSOR_MODE AccessMode,
|
||||
PVOID ParseContext,
|
||||
PVOID* ObjectPtr);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: registry.c,v 1.67 2002/01/03 11:09:35 hbirr Exp $
|
||||
/* $Id: registry.c,v 1.68 2002/02/19 00:09:22 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -13,7 +13,6 @@
|
|||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <roscfg.h>
|
||||
#include <internal/ob.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <internal/pool.h>
|
||||
|
@ -83,10 +82,9 @@ DPRINT("Creating root\n");
|
|||
CmiKeyType,
|
||||
(PVOID*)&NewKey);
|
||||
CmiRootKey = NewKey;
|
||||
ObAddEntryDirectory(NameSpaceRoot, CmiRootKey, L"Registry");
|
||||
Status = ObReferenceObjectByHandle(RootKeyHandle,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
ObDirectoryType,
|
||||
CmiKeyType,
|
||||
UserMode,
|
||||
(PVOID*)&CmiRootKey,
|
||||
NULL);
|
||||
|
@ -106,12 +104,10 @@ DPRINT("Creating root\n");
|
|||
|
||||
/* Create initial predefined symbolic links */
|
||||
/* HKEY_LOCAL_MACHINE */
|
||||
RtlInitUnicodeString(&RootKeyName, REG_MACHINE_KEY_NAME);
|
||||
DPRINT("Creating HKLM\n");
|
||||
InitializeObjectAttributes(&ObjectAttributes, &RootKeyName, 0, NULL, NULL);
|
||||
Status=ObCreateObject(&KeyHandle,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
&ObjectAttributes,
|
||||
NULL,
|
||||
CmiKeyType,
|
||||
(PVOID*)&NewKey);
|
||||
Status = CmiAddSubKey(CmiVolatileFile,
|
||||
|
@ -134,12 +130,10 @@ DPRINT("Creating HKLM\n");
|
|||
CmiMachineKey=NewKey;
|
||||
|
||||
/* HKEY_USERS */
|
||||
RtlInitUnicodeString(&RootKeyName, REG_USERS_KEY_NAME);
|
||||
DPRINT("Creating HKU\n");
|
||||
InitializeObjectAttributes(&ObjectAttributes, &RootKeyName, 0, NULL, NULL);
|
||||
Status=ObCreateObject(&KeyHandle,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
&ObjectAttributes,
|
||||
NULL,
|
||||
CmiKeyType,
|
||||
(PVOID*)&NewKey);
|
||||
Status = CmiAddSubKey(CmiVolatileFile,
|
||||
|
@ -162,11 +156,9 @@ DPRINT("Creating HKU\n");
|
|||
CmiUserKey=NewKey;
|
||||
|
||||
/* Create '\\Registry\\Machine\\HARDWARE' key. */
|
||||
RtlInitUnicodeString(&RootKeyName, REG_HARDWARE_KEY_NAME);
|
||||
InitializeObjectAttributes(&ObjectAttributes, &RootKeyName, 0, NULL, NULL);
|
||||
Status=ObCreateObject(&KeyHandle,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
&ObjectAttributes,
|
||||
NULL,
|
||||
CmiKeyType,
|
||||
(PVOID*)&NewKey);
|
||||
Status = CmiAddSubKey(CmiVolatileFile,
|
||||
|
@ -189,11 +181,9 @@ DPRINT("Creating HKU\n");
|
|||
CmiHardwareKey=NewKey;
|
||||
|
||||
/* Create '\\Registry\\Machine\\HARDWARE\\DESCRIPTION' key. */
|
||||
RtlInitUnicodeString(&RootKeyName, REG_DESCRIPTION_KEY_NAME);
|
||||
InitializeObjectAttributes(&ObjectAttributes, &RootKeyName, 0, NULL, NULL);
|
||||
Status=ObCreateObject(&KeyHandle,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
&ObjectAttributes,
|
||||
NULL,
|
||||
CmiKeyType,
|
||||
(PVOID*)&NewKey);
|
||||
Status = CmiAddSubKey(CmiVolatileFile,
|
||||
|
@ -215,11 +205,9 @@ DPRINT("Creating HKU\n");
|
|||
CmiAddKeyToList(CmiHardwareKey,NewKey);
|
||||
|
||||
/* Create '\\Registry\\Machine\\HARDWARE\\DEVICEMAP' key. */
|
||||
RtlInitUnicodeString(&RootKeyName, REG_DEVICEMAP_KEY_NAME);
|
||||
InitializeObjectAttributes(&ObjectAttributes, &RootKeyName, 0, NULL, NULL);
|
||||
Status=ObCreateObject(&KeyHandle,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
&ObjectAttributes,
|
||||
NULL,
|
||||
CmiKeyType,
|
||||
(PVOID*)&NewKey);
|
||||
Status = CmiAddSubKey(CmiVolatileFile,
|
||||
|
@ -241,11 +229,9 @@ DPRINT("Creating HKU\n");
|
|||
CmiAddKeyToList(CmiHardwareKey,NewKey);
|
||||
|
||||
/* Create '\\Registry\\Machine\\HARDWARE\\RESOURCEMAP' key. */
|
||||
RtlInitUnicodeString(&RootKeyName, REG_RESOURCEMAP_KEY_NAME);
|
||||
InitializeObjectAttributes(&ObjectAttributes, &RootKeyName, 0, NULL, NULL);
|
||||
Status=ObCreateObject(&KeyHandle,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
&ObjectAttributes,
|
||||
NULL, //&ObjectAttributes,
|
||||
CmiKeyType,
|
||||
(PVOID*)&NewKey);
|
||||
Status = CmiAddSubKey(CmiVolatileFile,
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <limits.h>
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/ex.h>
|
||||
#include <internal/ob.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#define NDEBUG
|
||||
|
@ -98,24 +97,6 @@ ExpWinStaObjectCreate(PVOID ObjectBody,
|
|||
return Status;
|
||||
}
|
||||
|
||||
Status = ObReferenceObjectByPointer(
|
||||
Parent,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
ObDirectoryType,
|
||||
UserMode);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RtlDestroyAtomTable(WinSta->AtomTable);
|
||||
RtlFreeUnicodeString(&WinSta->Name);
|
||||
return Status;
|
||||
}
|
||||
|
||||
ObAddEntryDirectory(
|
||||
Parent,
|
||||
ObjectBody,
|
||||
(RemainingPath + 1));
|
||||
ObDereferenceObject(Parent);
|
||||
|
||||
DPRINT("Window station successfully created. Name (%wZ)\n", &WinSta->Name);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
struct _EPROCESS;
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
CSHORT Type;
|
||||
CSHORT Size;
|
||||
|
@ -51,43 +51,24 @@ enum
|
|||
OBJTYP_MAX,
|
||||
};
|
||||
|
||||
BOOL ObAddObjectToNameSpace(PUNICODE_STRING path, POBJECT_HEADER Object);
|
||||
|
||||
VOID ObRegisterType(CSHORT id, OBJECT_TYPE* type);
|
||||
NTSTATUS ObLookupObject(HANDLE rootdir, PWSTR string, PVOID* Object,
|
||||
PWSTR* UnparsedSection, ULONG Attributes);
|
||||
VOID ObRemoveEntry(POBJECT_HEADER Header);
|
||||
NTSTATUS ObPerformRetentionChecks(POBJECT_HEADER Header);
|
||||
#define OBJECT_ALLOC_SIZE(type) (type->NonpagedPoolCharge+sizeof(OBJECT_HEADER)-sizeof(COMMON_BODY_HEADER))
|
||||
|
||||
|
||||
extern PDIRECTORY_OBJECT NameSpaceRoot;
|
||||
|
||||
/*
|
||||
* FUNCTION: Creates an entry within a directory
|
||||
* ARGUMENTS:
|
||||
* parent = Parent directory
|
||||
* object = Header of the object to add
|
||||
*/
|
||||
VOID ObCreateEntry(PDIRECTORY_OBJECT parent, POBJECT_HEADER object);
|
||||
|
||||
POBJECT_HEADER BODY_TO_HEADER(PVOID body);
|
||||
PVOID HEADER_TO_BODY(POBJECT_HEADER obj);
|
||||
|
||||
#define OBJECT_ALLOC_SIZE(type) (type->NonpagedPoolCharge+sizeof(OBJECT_HEADER)-sizeof(COMMON_BODY_HEADER))
|
||||
VOID ObpAddEntryDirectory(PDIRECTORY_OBJECT Parent,
|
||||
POBJECT_HEADER Header,
|
||||
PWSTR Name);
|
||||
VOID ObpRemoveEntryDirectory(POBJECT_HEADER Header);
|
||||
|
||||
/*
|
||||
* PURPOSE: Defines a handle
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
PVOID ObjectBody;
|
||||
ACCESS_MASK GrantedAccess;
|
||||
BOOLEAN Inherit;
|
||||
} HANDLE_REP, *PHANDLE_REP;
|
||||
NTSTATUS ObPerformRetentionChecks(POBJECT_HEADER Header);
|
||||
|
||||
PHANDLE_REP ObTranslateHandle(struct _EPROCESS* Process, HANDLE h);
|
||||
extern PDIRECTORY_OBJECT NameSpaceRoot;
|
||||
|
||||
VOID STDCALL ObAddEntryDirectory(PDIRECTORY_OBJECT Parent,
|
||||
POBJECT Object,
|
||||
PWSTR Name);
|
||||
NTSTATUS ObCreateHandle(struct _EPROCESS* Process,
|
||||
PVOID ObjectBody,
|
||||
ACCESS_MASK GrantedAccess,
|
||||
|
@ -104,14 +85,7 @@ ULONG ObGetReferenceCount(PVOID Object);
|
|||
ULONG ObGetHandleCount(PVOID Object);
|
||||
VOID ObCloseAllHandles(struct _EPROCESS* Process);
|
||||
VOID ObDeleteHandleTable(struct _EPROCESS* Process);
|
||||
PVOID ObDeleteHandle(struct _EPROCESS* Process,
|
||||
PVOID ObDeleteHandle(struct _EPROCESS* Process,
|
||||
HANDLE Handle);
|
||||
NTSTATUS STDCALL
|
||||
ObInsertObject(PVOID Object,
|
||||
PACCESS_STATE PassedAccessState,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
ULONG AdditionalReferences,
|
||||
PVOID* ReferencedObject,
|
||||
PHANDLE Handle);
|
||||
|
||||
#endif /* __INCLUDE_INTERNAL_OBJMGR_H */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: device.c,v 1.34 2001/09/16 13:19:32 chorns Exp $
|
||||
/* $Id: device.c,v 1.35 2002/02/19 00:09:22 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -14,7 +14,6 @@
|
|||
#include <ddk/ntddk.h>
|
||||
#include <internal/io.h>
|
||||
#include <internal/po.h>
|
||||
#include <internal/ob.h>
|
||||
#include <internal/ldr.h>
|
||||
#include <internal/id.h>
|
||||
#include <internal/ps.h>
|
||||
|
@ -592,10 +591,6 @@ IopCreateDevice(PVOID ObjectBody,
|
|||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
if (Parent != NULL && RemainingPath != NULL)
|
||||
{
|
||||
ObAddEntryDirectory(Parent, ObjectBody, RemainingPath+1);
|
||||
}
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: symlink.c,v 1.23 2001/12/05 01:40:24 dwelch Exp $
|
||||
/* $Id: symlink.c,v 1.24 2002/02/19 00:09:22 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include <limits.h>
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/ob.h>
|
||||
//#include <internal/ob.h>
|
||||
#include <internal/pool.h>
|
||||
|
||||
#define NDEBUG
|
||||
|
@ -62,14 +62,7 @@ IopCreateSymbolicLink(PVOID Object,
|
|||
PWSTR RemainingPath,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes)
|
||||
{
|
||||
if ((Parent != NULL)
|
||||
&& (RemainingPath != NULL))
|
||||
{
|
||||
ObAddEntryDirectory(Parent,
|
||||
Object,
|
||||
RemainingPath + 1);
|
||||
}
|
||||
return(STATUS_SUCCESS);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
@ -214,12 +207,22 @@ NtOpenSymbolicLinkObject(OUT PHANDLE LinkHandle,
|
|||
IN ACCESS_MASK DesiredAccess,
|
||||
IN POBJECT_ATTRIBUTES ObjectAttributes)
|
||||
{
|
||||
#if 0
|
||||
NTSTATUS Status;
|
||||
PVOID Object;
|
||||
#endif
|
||||
|
||||
DPRINT("NtOpenSymbolicLinkObject (Name %wZ)\n",
|
||||
ObjectAttributes->ObjectName);
|
||||
DPRINT("NtOpenSymbolicLinkObject (Name %wZ)\n",
|
||||
ObjectAttributes->ObjectName);
|
||||
|
||||
return(ObOpenObjectByName(ObjectAttributes,
|
||||
IoSymbolicLinkType,
|
||||
NULL,
|
||||
UserMode,
|
||||
DesiredAccess,
|
||||
NULL,
|
||||
LinkHandle));
|
||||
#if 0
|
||||
Status = ObReferenceObjectByName(
|
||||
ObjectAttributes->ObjectName,
|
||||
ObjectAttributes->Attributes,
|
||||
|
@ -248,6 +251,7 @@ NtOpenSymbolicLinkObject(OUT PHANDLE LinkHandle,
|
|||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: loader.c,v 1.99 2002/02/12 12:30:46 jfilby Exp $
|
||||
/* $Id: loader.c,v 1.100 2002/02/19 00:09:23 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -31,7 +31,6 @@
|
|||
#include <internal/kd.h>
|
||||
#include <internal/io.h>
|
||||
#include <internal/mm.h>
|
||||
#include <internal/ob.h>
|
||||
#include <internal/ps.h>
|
||||
#include <internal/ldr.h>
|
||||
#include <internal/pool.h>
|
||||
|
@ -1017,10 +1016,6 @@ LdrCreateModule(PVOID ObjectBody,
|
|||
{
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
if (Parent != NULL && RemainingPath != NULL)
|
||||
{
|
||||
ObAddEntryDirectory(Parent, ObjectBody, RemainingPath + 1);
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: create.c,v 1.6 2001/12/02 23:34:42 dwelch Exp $
|
||||
/* $Id: create.c,v 1.7 2002/02/19 00:09:23 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -12,7 +12,6 @@
|
|||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/ob.h>
|
||||
#include <internal/port.h>
|
||||
#include <internal/dbg.h>
|
||||
|
||||
|
@ -61,8 +60,6 @@ NiCreatePort (PVOID ObjectBody,
|
|||
PWSTR RemainingPath,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
if (RemainingPath == NULL)
|
||||
{
|
||||
return (STATUS_SUCCESS);
|
||||
|
@ -73,20 +70,6 @@ NiCreatePort (PVOID ObjectBody,
|
|||
return (STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
Status = ObReferenceObjectByPointer (Parent,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
ObDirectoryType,
|
||||
UserMode);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
ObAddEntryDirectory (Parent,
|
||||
ObjectBody,
|
||||
(RemainingPath + 1));
|
||||
ObDereferenceObject (Parent);
|
||||
|
||||
return (STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
|
@ -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.76 2002/01/09 03:00:21 dwelch Exp $
|
||||
/* $Id: section.c,v 1.77 2002/02/19 00:09:23 ekohl Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/section.c
|
||||
|
@ -31,7 +31,6 @@
|
|||
#include <limits.h>
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/mm.h>
|
||||
#include <internal/ob.h>
|
||||
#include <internal/io.h>
|
||||
#include <internal/ps.h>
|
||||
#include <internal/pool.h>
|
||||
|
@ -1529,8 +1528,6 @@ MmpCreateSection(PVOID ObjectBody,
|
|||
PWSTR RemainingPath,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("MmpCreateDevice(ObjectBody %x, Parent %x, RemainingPath %S)\n",
|
||||
ObjectBody, Parent, RemainingPath);
|
||||
|
||||
|
@ -1544,18 +1541,6 @@ MmpCreateSection(PVOID ObjectBody,
|
|||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
Status = ObReferenceObjectByPointer(Parent,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
ObDirectoryType,
|
||||
UserMode);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
|
||||
ObAddEntryDirectory(Parent, ObjectBody, RemainingPath+1);
|
||||
ObDereferenceObject(Parent);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: evtpair.c,v 1.10 2001/12/05 01:40:25 dwelch Exp $
|
||||
/* $Id: evtpair.c,v 1.11 2002/02/19 00:09:24 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -12,7 +12,6 @@
|
|||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/ob.h>
|
||||
#include <ntos/synch.h>
|
||||
#include <limits.h>
|
||||
|
||||
|
@ -38,19 +37,15 @@ NtpCreateEventPair(PVOID ObjectBody,
|
|||
PWSTR RemainingPath,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes)
|
||||
{
|
||||
DPRINT("NtpCreateEventPair(ObjectBody %x, Parent %x, RemainingPath %S)\n",
|
||||
ObjectBody, Parent, RemainingPath);
|
||||
|
||||
if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL)
|
||||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
if (Parent != NULL && RemainingPath != NULL)
|
||||
{
|
||||
ObAddEntryDirectory(Parent, ObjectBody, RemainingPath+1);
|
||||
}
|
||||
return(STATUS_SUCCESS);
|
||||
DPRINT("NtpCreateEventPair(ObjectBody %x, Parent %x, RemainingPath %S)\n",
|
||||
ObjectBody, Parent, RemainingPath);
|
||||
|
||||
if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL)
|
||||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
VOID NtInitializeEventPairImplementation(VOID)
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include <limits.h>
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ntos/synch.h>
|
||||
#include <internal/ob.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
@ -61,10 +60,6 @@ NtpCreateMutant(PVOID ObjectBody,
|
|||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
if (Parent != NULL && RemainingPath != NULL)
|
||||
{
|
||||
ObAddEntryDirectory(Parent, ObjectBody, RemainingPath+1);
|
||||
}
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
#include <limits.h>
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/ob.h>
|
||||
#include <internal/id.h>
|
||||
#include <ntos/synch.h>
|
||||
#include <internal/pool.h>
|
||||
|
@ -57,19 +56,15 @@ NtpCreateEvent(PVOID ObjectBody,
|
|||
PWSTR RemainingPath,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes)
|
||||
{
|
||||
DPRINT("NtpCreateEvent(ObjectBody %x, Parent %x, RemainingPath %S)\n",
|
||||
ObjectBody, Parent, RemainingPath);
|
||||
|
||||
if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL)
|
||||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
if (Parent != NULL && RemainingPath != NULL)
|
||||
{
|
||||
ObAddEntryDirectory(Parent, ObjectBody, RemainingPath+1);
|
||||
}
|
||||
return(STATUS_SUCCESS);
|
||||
DPRINT("NtpCreateEvent(ObjectBody %x, Parent %x, RemainingPath %S)\n",
|
||||
ObjectBody, Parent, RemainingPath);
|
||||
|
||||
if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL)
|
||||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: ntsem.c,v 1.14 2001/12/05 01:40:25 dwelch Exp $
|
||||
/* $Id: ntsem.c,v 1.15 2002/02/19 00:09:24 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -13,7 +13,6 @@
|
|||
|
||||
#include <limits.h>
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/ob.h>
|
||||
#include <ntos/synch.h>
|
||||
#include <internal/pool.h>
|
||||
#include <internal/ps.h>
|
||||
|
@ -39,20 +38,15 @@ NtpCreateSemaphore(PVOID ObjectBody,
|
|||
PWSTR RemainingPath,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes)
|
||||
{
|
||||
|
||||
DPRINT("NtpCreateSemaphore(ObjectBody %x, Parent %x, RemainingPath %S)\n",
|
||||
ObjectBody, Parent, RemainingPath);
|
||||
|
||||
if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL)
|
||||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
if (Parent != NULL && RemainingPath != NULL)
|
||||
{
|
||||
ObAddEntryDirectory(Parent, ObjectBody, RemainingPath+1);
|
||||
}
|
||||
return(STATUS_SUCCESS);
|
||||
DPRINT("NtpCreateSemaphore(ObjectBody %x, Parent %x, RemainingPath %S)\n",
|
||||
ObjectBody, Parent, RemainingPath);
|
||||
|
||||
if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL)
|
||||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
VOID NtInitializeSemaphoreImplementation(VOID)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: nttimer.c,v 1.13 2001/12/05 01:40:25 dwelch Exp $
|
||||
/* $Id: nttimer.c,v 1.14 2002/02/19 00:09:24 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -13,7 +13,6 @@
|
|||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ntos/synch.h>
|
||||
#include <internal/ob.h>
|
||||
#include <internal/ke.h>
|
||||
#include <limits.h>
|
||||
#include <internal/pool.h>
|
||||
|
@ -52,19 +51,15 @@ NtpCreateTimer(PVOID ObjectBody,
|
|||
PWSTR RemainingPath,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes)
|
||||
{
|
||||
DPRINT("NtpCreateTimer(ObjectBody %x, Parent %x, RemainingPath %S)\n",
|
||||
ObjectBody, Parent, RemainingPath);
|
||||
|
||||
if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL)
|
||||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
if (Parent != NULL && RemainingPath != NULL)
|
||||
{
|
||||
ObAddEntryDirectory(Parent, ObjectBody, RemainingPath+1);
|
||||
}
|
||||
return(STATUS_SUCCESS);
|
||||
DPRINT("NtpCreateTimer(ObjectBody %x, Parent %x, RemainingPath %S)\n",
|
||||
ObjectBody, Parent, RemainingPath);
|
||||
|
||||
if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL)
|
||||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntoskrnl.def,v 1.126 2002/01/27 01:11:23 dwelch Exp $
|
||||
; $Id: ntoskrnl.def,v 1.127 2002/02/19 00:09:21 ekohl Exp $
|
||||
;
|
||||
; reactos/ntoskrnl/ntoskrnl.def
|
||||
;
|
||||
|
@ -575,7 +575,6 @@ ObReferenceObjectByName@32
|
|||
ObReferenceObjectByPointer@16
|
||||
;ObReleaseObjectSecurity@8
|
||||
;ObSetSecurityDescriptorInfo@24
|
||||
ObAddEntryDirectory@12
|
||||
;PfxFindPrefix
|
||||
;PfxInitialize
|
||||
;PfxInsertPrefix
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntoskrnl.edf,v 1.112 2002/01/27 01:11:23 dwelch Exp $
|
||||
; $Id: ntoskrnl.edf,v 1.113 2002/02/19 00:09:21 ekohl Exp $
|
||||
;
|
||||
; reactos/ntoskrnl/ntoskrnl.def
|
||||
;
|
||||
|
@ -575,7 +575,6 @@ ObReferenceObjectByName=ObReferenceObjectByName@32
|
|||
ObReferenceObjectByPointer=ObReferenceObjectByPointer@16
|
||||
;ObReleaseObjectSecurity=ObReleaseObjectSecurity@8
|
||||
;ObSetSecurityDescriptorInfo=ObSetSecurityDescriptorInfo@24
|
||||
ObAddEntryDirectory=ObAddEntryDirectory@12
|
||||
;PfxFindPrefix
|
||||
;PfxInitialize
|
||||
;PfxInsertPrefix
|
||||
|
|
|
@ -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.34 2001/12/31 19:06:48 dwelch Exp $
|
||||
/* $Id: handle.c,v 1.35 2002/02/19 00:09:24 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -40,8 +40,19 @@
|
|||
|
||||
/* TYPES *******************************************************************/
|
||||
|
||||
/*
|
||||
* PURPOSE: Defines a handle
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
PVOID ObjectBody;
|
||||
ACCESS_MASK GrantedAccess;
|
||||
BOOLEAN Inherit;
|
||||
} HANDLE_REP, *PHANDLE_REP;
|
||||
|
||||
#define HANDLE_BLOCK_ENTRIES ((PAGESIZE-sizeof(LIST_ENTRY))/sizeof(HANDLE_REP))
|
||||
|
||||
|
||||
/*
|
||||
* PURPOSE: Defines a page's worth of handles
|
||||
*/
|
||||
|
@ -51,6 +62,7 @@ typedef struct
|
|||
HANDLE_REP handles[HANDLE_BLOCK_ENTRIES];
|
||||
} HANDLE_BLOCK, *PHANDLE_BLOCK;
|
||||
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
#define TAG_HANDLE_TABLE TAG('H', 'T', 'B', 'L')
|
||||
|
@ -657,7 +669,7 @@ NTSTATUS STDCALL NtClose(HANDLE Handle)
|
|||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
NTSTATUS STDCALL
|
||||
ObInsertObject(PVOID Object,
|
||||
PACCESS_STATE PassedAccessState,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
|
@ -671,6 +683,5 @@ ObInsertObject(PVOID Object,
|
|||
FALSE,
|
||||
Handle));
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: namespc.c,v 1.27 2001/12/05 01:40:25 dwelch Exp $
|
||||
/* $Id: namespc.c,v 1.28 2002/02/19 00:09:24 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -149,27 +149,43 @@ ObOpenObjectByName(POBJECT_ATTRIBUTES ObjectAttributes,
|
|||
}
|
||||
|
||||
|
||||
VOID STDCALL
|
||||
ObAddEntryDirectory(PDIRECTORY_OBJECT Parent,
|
||||
POBJECT Object,
|
||||
PWSTR Name)
|
||||
VOID
|
||||
ObpAddEntryDirectory(PDIRECTORY_OBJECT Parent,
|
||||
POBJECT_HEADER Header,
|
||||
PWSTR Name)
|
||||
/*
|
||||
* FUNCTION: Add an entry to a namespace directory
|
||||
* ARGUMENTS:
|
||||
* parent = directory to add in
|
||||
* name = Name to give the entry
|
||||
* Object = Header of the object to add the entry for
|
||||
* Parent = directory to add in
|
||||
* Header = Header of the object to add the entry for
|
||||
* Name = Name to give the entry
|
||||
*/
|
||||
{
|
||||
KIRQL oldlvl;
|
||||
POBJECT_HEADER Header = BODY_TO_HEADER(Object);
|
||||
KIRQL oldlvl;
|
||||
|
||||
RtlCreateUnicodeString(&Header->Name, Name);
|
||||
Header->Parent = Parent;
|
||||
RtlCreateUnicodeString(&Header->Name, Name);
|
||||
Header->Parent = Parent;
|
||||
|
||||
KeAcquireSpinLock(&Parent->Lock, &oldlvl);
|
||||
InsertTailList(&Parent->head, &Header->Entry);
|
||||
KeReleaseSpinLock(&Parent->Lock, oldlvl);
|
||||
KeAcquireSpinLock(&Parent->Lock, &oldlvl);
|
||||
InsertTailList(&Parent->head, &Header->Entry);
|
||||
KeReleaseSpinLock(&Parent->Lock, oldlvl);
|
||||
}
|
||||
|
||||
VOID
|
||||
ObpRemoveEntryDirectory(POBJECT_HEADER Header)
|
||||
/*
|
||||
* FUNCTION: Remove an entry from a namespace directory
|
||||
* ARGUMENTS:
|
||||
* Header = Header of the object to remove
|
||||
*/
|
||||
{
|
||||
KIRQL oldlvl;
|
||||
|
||||
DPRINT("ObpRemoveEntryDirectory(Header %x)\n",Header);
|
||||
|
||||
KeAcquireSpinLock(&(Header->Parent->Lock),&oldlvl);
|
||||
RemoveEntryList(&(Header->Entry));
|
||||
KeReleaseSpinLock(&(Header->Parent->Lock),oldlvl);
|
||||
}
|
||||
|
||||
PVOID
|
||||
|
@ -284,23 +300,20 @@ ObpCreateDirectory(PVOID ObjectBody,
|
|||
PWSTR RemainingPath,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes)
|
||||
{
|
||||
PDIRECTORY_OBJECT DirectoryObject = (PDIRECTORY_OBJECT)ObjectBody;
|
||||
|
||||
DPRINT("ObpCreateDirectory(ObjectBody %x, Parent %x, RemainingPath %S)\n",
|
||||
ObjectBody, Parent, RemainingPath);
|
||||
|
||||
if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL)
|
||||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
if (Parent != NULL && RemainingPath != NULL)
|
||||
{
|
||||
ObAddEntryDirectory(Parent, ObjectBody, RemainingPath+1);
|
||||
}
|
||||
InitializeListHead(&DirectoryObject->head);
|
||||
KeInitializeSpinLock(&DirectoryObject->Lock);
|
||||
return(STATUS_SUCCESS);
|
||||
PDIRECTORY_OBJECT DirectoryObject = (PDIRECTORY_OBJECT)ObjectBody;
|
||||
|
||||
DPRINT("ObpCreateDirectory(ObjectBody %x, Parent %x, RemainingPath %S)\n",
|
||||
ObjectBody, Parent, RemainingPath);
|
||||
|
||||
if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL)
|
||||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
InitializeListHead(&DirectoryObject->head);
|
||||
KeInitializeSpinLock(&DirectoryObject->Lock);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
VOID ObInit(VOID)
|
||||
|
@ -339,14 +352,4 @@ VOID ObInit(VOID)
|
|||
(PVOID*)&NameSpaceRoot);
|
||||
}
|
||||
|
||||
VOID ObRemoveEntry(POBJECT_HEADER Header)
|
||||
{
|
||||
KIRQL oldlvl;
|
||||
|
||||
DPRINT("ObRemoveEntry(Header %x)\n",Header);
|
||||
|
||||
KeAcquireSpinLock(&(Header->Parent->Lock),&oldlvl);
|
||||
RemoveEntryList(&(Header->Entry));
|
||||
KeReleaseSpinLock(&(Header->Parent->Lock),oldlvl);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: object.c,v 1.41 2002/02/08 02:57:07 chorns Exp $
|
||||
/* $Id: object.c,v 1.42 2002/02/19 00:09:25 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -233,75 +233,95 @@ ObCreateObject(PHANDLE Handle,
|
|||
POBJECT_TYPE Type,
|
||||
PVOID *Object)
|
||||
{
|
||||
PVOID Parent = NULL;
|
||||
UNICODE_STRING RemainingPath;
|
||||
POBJECT_HEADER Header;
|
||||
NTSTATUS Status;
|
||||
|
||||
assert_irql(APC_LEVEL);
|
||||
|
||||
DPRINT("ObCreateObject(Handle %x, ObjectAttributes %x, Type %x)\n");
|
||||
if (ObjectAttributes != NULL &&
|
||||
ObjectAttributes->ObjectName != NULL)
|
||||
{
|
||||
DPRINT("ObjectAttributes->ObjectName->Buffer %S\n",
|
||||
ObjectAttributes->ObjectName->Buffer);
|
||||
}
|
||||
|
||||
if (ObjectAttributes != NULL &&
|
||||
ObjectAttributes->ObjectName != NULL)
|
||||
{
|
||||
Status = ObFindObject(ObjectAttributes,
|
||||
&Parent,
|
||||
&RemainingPath,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("ObFindObject() failed! (Status 0x%x)\n", Status);
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RtlInitUnicodeString (&RemainingPath, NULL);
|
||||
}
|
||||
PVOID Parent = NULL;
|
||||
UNICODE_STRING RemainingPath;
|
||||
POBJECT_HEADER Header;
|
||||
POBJECT_HEADER ParentHeader = NULL;
|
||||
NTSTATUS Status;
|
||||
|
||||
RtlMapGenericMask(&DesiredAccess,
|
||||
Type->Mapping);
|
||||
assert_irql(APC_LEVEL);
|
||||
|
||||
Header = (POBJECT_HEADER)ExAllocatePoolWithTag(NonPagedPool,
|
||||
OBJECT_ALLOC_SIZE(Type),
|
||||
Type->Tag);
|
||||
ObInitializeObject(Header,
|
||||
Handle,
|
||||
DesiredAccess,
|
||||
Type,
|
||||
ObjectAttributes);
|
||||
if ((Header->ObjectType != NULL) &&
|
||||
(Header->ObjectType->Create != NULL))
|
||||
{
|
||||
DPRINT("Calling %x\n", Header->ObjectType->Create);
|
||||
Status = Header->ObjectType->Create(HEADER_TO_BODY(Header),
|
||||
Parent,
|
||||
RemainingPath.Buffer,
|
||||
ObjectAttributes);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
if (Parent)
|
||||
{
|
||||
ObDereferenceObject( Parent );
|
||||
}
|
||||
RtlFreeUnicodeString( &Header->Name );
|
||||
RtlFreeUnicodeString( &RemainingPath );
|
||||
ExFreePool( Header );
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
RtlFreeUnicodeString( &RemainingPath );
|
||||
*Object = HEADER_TO_BODY(Header);
|
||||
return(STATUS_SUCCESS);
|
||||
DPRINT("ObCreateObject(Handle %x, ObjectAttributes %x, Type %x)\n",
|
||||
Handle, ObjectAttributes, Type);
|
||||
if (ObjectAttributes != NULL &&
|
||||
ObjectAttributes->ObjectName != NULL)
|
||||
{
|
||||
DPRINT("ObjectAttributes->ObjectName->Buffer %S\n",
|
||||
ObjectAttributes->ObjectName->Buffer);
|
||||
}
|
||||
|
||||
if (ObjectAttributes != NULL &&
|
||||
ObjectAttributes->ObjectName != NULL)
|
||||
{
|
||||
Status = ObFindObject(ObjectAttributes,
|
||||
&Parent,
|
||||
&RemainingPath,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("ObFindObject() failed! (Status 0x%x)\n", Status);
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RtlInitUnicodeString(&RemainingPath, NULL);
|
||||
}
|
||||
|
||||
RtlMapGenericMask(&DesiredAccess,
|
||||
Type->Mapping);
|
||||
|
||||
Header = (POBJECT_HEADER)ExAllocatePoolWithTag(NonPagedPool,
|
||||
OBJECT_ALLOC_SIZE(Type),
|
||||
Type->Tag);
|
||||
ObInitializeObject(Header,
|
||||
Handle,
|
||||
DesiredAccess,
|
||||
Type,
|
||||
ObjectAttributes);
|
||||
|
||||
if (Parent != NULL)
|
||||
{
|
||||
ParentHeader = BODY_TO_HEADER(Parent);
|
||||
}
|
||||
|
||||
if (ParentHeader != NULL &&
|
||||
ParentHeader->ObjectType == ObDirectoryType &&
|
||||
RemainingPath.Buffer != NULL)
|
||||
{
|
||||
ObpAddEntryDirectory(Parent,
|
||||
Header,
|
||||
RemainingPath.Buffer+1);
|
||||
}
|
||||
|
||||
if ((Header->ObjectType != NULL) &&
|
||||
(Header->ObjectType->Create != NULL))
|
||||
{
|
||||
DPRINT("Calling %x\n", Header->ObjectType->Create);
|
||||
Status = Header->ObjectType->Create(HEADER_TO_BODY(Header),
|
||||
Parent,
|
||||
RemainingPath.Buffer,
|
||||
ObjectAttributes);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
if (Parent)
|
||||
{
|
||||
ObDereferenceObject(Parent);
|
||||
}
|
||||
RtlFreeUnicodeString(&Header->Name);
|
||||
RtlFreeUnicodeString(&RemainingPath);
|
||||
ExFreePool(Header);
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
RtlFreeUnicodeString( &RemainingPath );
|
||||
|
||||
*Object = HEADER_TO_BODY(Header);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS STDCALL
|
||||
ObReferenceObjectByPointer(PVOID ObjectBody,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
|
@ -415,7 +435,7 @@ NTSTATUS ObPerformRetentionChecks(POBJECT_HEADER Header)
|
|||
}
|
||||
if (Header->Name.Buffer != NULL)
|
||||
{
|
||||
ObRemoveEntry(Header);
|
||||
ObpRemoveEntryDirectory(Header);
|
||||
RtlFreeUnicodeString( &Header->Name );
|
||||
}
|
||||
DPRINT("ObPerformRetentionChecks() = Freeing object\n");
|
||||
|
|
Loading…
Reference in a new issue