- Minor header cleanup.
svn path=/trunk/; revision=2632
/* 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) \
#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
* 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
* 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);
-/* $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
#include <ddk/ntddk.h>
#include <roscfg.h>
-#include <internal/ob.h>
#include <limits.h>
#include <string.h>
#include <internal/pool.h>
CmiKeyType,
(PVOID*)&NewKey);
CmiRootKey = NewKey;
- ObAddEntryDirectory(NameSpaceRoot, CmiRootKey, L"Registry");
Status = ObReferenceObjectByHandle(RootKeyHandle,
STANDARD_RIGHTS_REQUIRED,
- ObDirectoryType,
+ CmiKeyType,
UserMode,
(PVOID*)&CmiRootKey,
NULL);
/* 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,
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,
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,
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,
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,
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,
#include <limits.h>
#include <ddk/ntddk.h>
#include <internal/ex.h>
-#include <internal/ob.h>
#include <wchar.h>
#define NDEBUG
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;
struct _EPROCESS;
-typedef struct
+typedef struct
{
CSHORT Type;
CSHORT Size;
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,
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 */
-/* $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
#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>
return(STATUS_UNSUCCESSFUL);
}
- if (Parent != NULL && RemainingPath != NULL)
- {
- ObAddEntryDirectory(Parent, ObjectBody, RemainingPath+1);
- }
return(STATUS_SUCCESS);
}
-/* $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
#include <limits.h>
#include <ddk/ntddk.h>
-#include <internal/ob.h>
+//#include <internal/ob.h>
#include <internal/pool.h>
#define NDEBUG
PWSTR RemainingPath,
POBJECT_ATTRIBUTES ObjectAttributes)
{
- if ((Parent != NULL)
- && (RemainingPath != NULL))
- {
- ObAddEntryDirectory(Parent,
- Object,
- RemainingPath + 1);
- }
- return(STATUS_SUCCESS);
+ return(STATUS_SUCCESS);
}
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes)
{
+#if 0
NTSTATUS Status;
PVOID Object;
-
- DPRINT("NtOpenSymbolicLinkObject (Name %wZ)\n",
- ObjectAttributes->ObjectName);
-
+#endif
+
+ DPRINT("NtOpenSymbolicLinkObject (Name %wZ)\n",
+ ObjectAttributes->ObjectName);
+
+ return(ObOpenObjectByName(ObjectAttributes,
+ IoSymbolicLinkType,
+ NULL,
+ UserMode,
+ DesiredAccess,
+ NULL,
+ LinkHandle));
+#if 0
Status = ObReferenceObjectByName(
ObjectAttributes->ObjectName,
ObjectAttributes->Attributes,
}
return STATUS_SUCCESS;
+#endif
}
-/* $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
#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>
{
return STATUS_UNSUCCESSFUL;
}
- if (Parent != NULL && RemainingPath != NULL)
- {
- ObAddEntryDirectory(Parent, ObjectBody, RemainingPath + 1);
- }
return STATUS_SUCCESS;
}
-/* $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
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
-#include <internal/ob.h>
#include <internal/port.h>
#include <internal/dbg.h>
PWSTR RemainingPath,
POBJECT_ATTRIBUTES ObjectAttributes)
{
- NTSTATUS Status;
-
if (RemainingPath == NULL)
{
return (STATUS_SUCCESS);
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);
}
* 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
#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>
PWSTR RemainingPath,
POBJECT_ATTRIBUTES ObjectAttributes)
{
- NTSTATUS Status;
-
DPRINT("MmpCreateDevice(ObjectBody %x, Parent %x, RemainingPath %S)\n",
ObjectBody, Parent, RemainingPath);
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);
}
-/* $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
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
-#include <internal/ob.h>
#include <ntos/synch.h>
#include <limits.h>
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)
#include <limits.h>
#include <ddk/ntddk.h>
#include <ntos/synch.h>
-#include <internal/ob.h>
#define NDEBUG
#include <internal/debug.h>
return(STATUS_UNSUCCESSFUL);
}
- if (Parent != NULL && RemainingPath != NULL)
- {
- ObAddEntryDirectory(Parent, ObjectBody, RemainingPath+1);
- }
return(STATUS_SUCCESS);
}
#include <limits.h>
#include <ddk/ntddk.h>
-#include <internal/ob.h>
#include <internal/id.h>
#include <ntos/synch.h>
#include <internal/pool.h>
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);
}
-/* $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
#include <limits.h>
#include <ddk/ntddk.h>
-#include <internal/ob.h>
#include <ntos/synch.h>
#include <internal/pool.h>
#include <internal/ps.h>
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)
-/* $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
#include <ddk/ntddk.h>
#include <ntos/synch.h>
-#include <internal/ob.h>
#include <internal/ke.h>
#include <limits.h>
#include <internal/pool.h>
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);
}
-; $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
;
ObReferenceObjectByPointer@16
;ObReleaseObjectSecurity@8
;ObSetSecurityDescriptorInfo@24
-ObAddEntryDirectory@12
;PfxFindPrefix
;PfxInitialize
;PfxInsertPrefix
-; $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
;
ObReferenceObjectByPointer=ObReferenceObjectByPointer@16
;ObReleaseObjectSecurity=ObReleaseObjectSecurity@8
;ObSetSecurityDescriptorInfo=ObSetSecurityDescriptorInfo@24
-ObAddEntryDirectory=ObAddEntryDirectory@12
;PfxFindPrefix
;PfxInitialize
;PfxInsertPrefix
* 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
/* 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
*/
HANDLE_REP handles[HANDLE_BLOCK_ENTRIES];
} HANDLE_BLOCK, *PHANDLE_BLOCK;
+
/* GLOBALS *******************************************************************/
#define TAG_HANDLE_TABLE TAG('H', 'T', 'B', 'L')
return(STATUS_SUCCESS);
}
-NTSTATUS STDCALL
+NTSTATUS STDCALL
ObInsertObject(PVOID Object,
PACCESS_STATE PassedAccessState,
ACCESS_MASK DesiredAccess,
FALSE,
Handle));
}
-
/* EOF */
-/* $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
}
-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
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)
(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 */
-/* $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
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);
- }
-
- RtlMapGenericMask(&DesiredAccess,
- Type->Mapping);
-
- 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);
+ PVOID Parent = NULL;
+ UNICODE_STRING RemainingPath;
+ POBJECT_HEADER Header;
+ POBJECT_HEADER ParentHeader = NULL;
+ NTSTATUS Status;
+
+ assert_irql(APC_LEVEL);
+
+ 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,
}
if (Header->Name.Buffer != NULL)
{
- ObRemoveEntry(Header);
+ ObpRemoveEntryDirectory(Header);
RtlFreeUnicodeString( &Header->Name );
}
DPRINT("ObPerformRetentionChecks() = Freeing object\n");