-/* $Id: object.c,v 1.78 2004/07/16 17:19:15 ekohl Exp $
+/* $Id: object.c,v 1.79 2004/07/18 13:03:43 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
NTSTATUS Status;
BOOLEAN ObjectAttached = FALSE;
PWCHAR NamePtr;
+ PSECURITY_DESCRIPTOR NewSecurityDescriptor = NULL;
assert_irql(APC_LEVEL);
DPRINT("ObCreateObject(Type %p ObjectAttributes %p, Object %p)\n",
Type, ObjectAttributes, Object);
+ if (Type == NULL)
+ {
+ DPRINT1("Invalid object type!\n");
+ return STATUS_INVALID_PARAMETER;
+ }
+
if (ObjectAttributes != NULL &&
ObjectAttributes->ObjectName != NULL &&
ObjectAttributes->ObjectName->Buffer != NULL)
ObjectAttached = TRUE;
}
- if ((Header->ObjectType != NULL) &&
- (Header->ObjectType->Create != NULL))
+ if (Header->ObjectType->Create != NULL)
{
DPRINT("Calling %x\n", Header->ObjectType->Create);
Status = Header->ObjectType->Create(HEADER_TO_BODY(Header),
return(Status);
}
}
- RtlFreeUnicodeString( &RemainingPath );
-
- if (Header->ObjectType != NULL)
+ RtlFreeUnicodeString(&RemainingPath);
+
+ /* Build the new security descriptor */
+ Status = SeAssignSecurity((ParentHeader != NULL) ? ParentHeader->SecurityDescriptor : NULL,
+ (ObjectAttributes != NULL) ? ObjectAttributes->SecurityDescriptor : NULL,
+ &NewSecurityDescriptor,
+ (Header->ObjectType == ObDirectoryType),
+ NULL, //SubjectContext,
+ Header->ObjectType->Mapping,
+ PagedPool);
+ if (NT_SUCCESS(Status))
{
- /* FIXME: Call SeAssignSecurity() to create a new security descriptor */
+ DPRINT("NewSecurityDescriptor %p\n", NewSecurityDescriptor);
if (Header->ObjectType->Security != NULL)
{
else
{
/* Assign the security descriptor to the object header */
- if (ObjectAttributes != NULL && ObjectAttributes->SecurityDescriptor != NULL)
- {
- Status = ObpAddSecurityDescriptor(ObjectAttributes->SecurityDescriptor,
- &Header->SecurityDescriptor);
- }
- else
- {
- Status = STATUS_SUCCESS;
- }
+ Status = ObpAddSecurityDescriptor(NewSecurityDescriptor,
+ &Header->SecurityDescriptor);
+ DPRINT("Object security descriptor %p\n", Header->SecurityDescriptor);
}
+
+ /* Release the new security descriptor */
+ SeDeassignSecurity(&NewSecurityDescriptor);
}
if (Object != NULL)
}
-/*
- * @implemented
- */
-NTSTATUS STDCALL
-ObReferenceObjectByPointer(IN PVOID Object,
- IN ACCESS_MASK DesiredAccess,
- IN POBJECT_TYPE ObjectType,
- IN KPROCESSOR_MODE AccessMode)
/*
* FUNCTION: Increments the pointer reference count for a given object
* ARGUMENTS:
* ObjectType = Points to the object type structure
* AccessMode = Type of access check to perform
* RETURNS: Status
+ *
+ * @implemented
*/
+NTSTATUS STDCALL
+ObReferenceObjectByPointer(IN PVOID Object,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_TYPE ObjectType,
+ IN KPROCESSOR_MODE AccessMode)
{
POBJECT_HEADER Header;