mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
- Delete named objects from the namespace when the last handle is closed, unless the object is a permanent object
- IoCreateDevice should create a permanent object for named devices svn path=/trunk/; revision=14703
This commit is contained in:
parent
995ac8a5b2
commit
932dc7e607
4 changed files with 30 additions and 21 deletions
|
@ -272,7 +272,6 @@ NTSTATUS ObFindObject(POBJECT_ATTRIBUTES ObjectAttributes,
|
|||
PVOID* ReturnedObject,
|
||||
PUNICODE_STRING RemainingPath,
|
||||
POBJECT_TYPE ObjectType);
|
||||
VOID ObDeleteHandleTable(struct _EPROCESS* Process);
|
||||
|
||||
NTSTATUS
|
||||
ObpQueryHandleAttributes(HANDLE Handle,
|
||||
|
|
|
@ -385,9 +385,15 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
|
|||
/* Initialize the Object Attributes */
|
||||
InitializeObjectAttributes(&ObjectAttributes, DeviceName, 0, NULL, NULL);
|
||||
|
||||
/* Honour exclusive flag */
|
||||
/* Honor exclusive flag */
|
||||
ObjectAttributes.Attributes |= OBJ_EXCLUSIVE;
|
||||
|
||||
/* Create a permanent object for named devices */
|
||||
if (DeviceName != NULL)
|
||||
{
|
||||
ObjectAttributes.Attributes |= OBJ_PERMANENT;
|
||||
}
|
||||
|
||||
/* Align the Extension Size to 8-bytes */
|
||||
AlignedDeviceExtensionSize = (DeviceExtensionSize + 7) &~ 7;
|
||||
DPRINT("AlignedDeviceExtensionSize %x\n", AlignedDeviceExtensionSize);
|
||||
|
|
|
@ -48,13 +48,6 @@ PHANDLE_TABLE ObpKernelHandleTable = NULL;
|
|||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
ObKillProcess(PEPROCESS Process)
|
||||
{
|
||||
ObDeleteHandleTable(Process);
|
||||
}
|
||||
|
||||
static VOID
|
||||
ObpDecrementHandleCount(PVOID ObjectBody)
|
||||
{
|
||||
|
@ -71,6 +64,15 @@ ObpDecrementHandleCount(PVOID ObjectBody)
|
|||
|
||||
if(NewHandleCount == 0)
|
||||
{
|
||||
if(ObjectHeader->Parent != NULL && !ObjectHeader->Permanent)
|
||||
{
|
||||
/* delete the object from the namespace when the last handle got closed.
|
||||
Only do this if it's actually been inserted into the namespace and
|
||||
if it's not a permanent object. */
|
||||
ObpRemoveEntryDirectory(ObjectHeader);
|
||||
}
|
||||
|
||||
/* remove the keep-alive reference */
|
||||
ObDereferenceObject(ObjectBody);
|
||||
}
|
||||
}
|
||||
|
@ -519,18 +521,6 @@ DeleteHandleCallback(PHANDLE_TABLE HandleTable,
|
|||
ObpDecrementHandleCount(ObjectBody);
|
||||
}
|
||||
|
||||
VOID ObDeleteHandleTable(PEPROCESS Process)
|
||||
/*
|
||||
* FUNCTION: Deletes the handle table associated with a process
|
||||
*/
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
||||
ExDestroyHandleTable(Process->ObjectTable,
|
||||
DeleteHandleCallback,
|
||||
Process);
|
||||
}
|
||||
|
||||
static BOOLEAN STDCALL
|
||||
DuplicateHandleCallback(PHANDLE_TABLE HandleTable,
|
||||
PHANDLE_TABLE_ENTRY HandleTableEntry,
|
||||
|
@ -583,6 +573,18 @@ VOID ObCreateHandleTable(PEPROCESS Parent,
|
|||
}
|
||||
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
ObKillProcess(PEPROCESS Process)
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
||||
ExDestroyHandleTable(Process->ObjectTable,
|
||||
DeleteHandleCallback,
|
||||
Process);
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
ObCreateHandle(PEPROCESS Process,
|
||||
PVOID ObjectBody,
|
||||
|
|
|
@ -1021,6 +1021,7 @@ STATIC NTSTATUS
|
|||
ObpDeleteObjectDpcLevel(IN POBJECT_HEADER ObjectHeader,
|
||||
IN LONG OldRefCount)
|
||||
{
|
||||
#if 0
|
||||
if (ObjectHeader->RefCount < 0)
|
||||
{
|
||||
CPRINT("Object %p/%p has invalid reference count (%d)\n",
|
||||
|
@ -1036,6 +1037,7 @@ ObpDeleteObjectDpcLevel(IN POBJECT_HEADER ObjectHeader,
|
|||
ObjectHeader->HandleCount);
|
||||
KEBUGCHECK(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
switch (KeGetCurrentIrql ())
|
||||
|
|
Loading…
Reference in a new issue