3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/ob/ntobj.c
6 * PURPOSE: User mode interface to object manager
7 * PROGRAMMER: David Welch (welch@cwcom.net)
12 /* INCLUDES *****************************************************************/
14 #include <ddk/ntddk.h>
15 #include <internal/ob.h>
16 #include <internal/id.h>
19 #include <internal/debug.h>
22 /* FUNCTIONS ************************************************************/
24 /**********************************************************************
26 * NtSetInformationObject
37 NtSetInformationObject (IN HANDLE ObjectHandle,
38 IN CINT ObjectInformationClass,
39 IN PVOID ObjectInformation,
46 /*Very, very, very new implementation. Test it!
48 Probably we should add meaning to QueryName in POBJECT_TYPE, no matter if we know
49 the correct parameters or not. For FILE_OBJECTs, it would probably look like the code
50 for ObjectNameInformation below. You give it a POBJECT and a PUNICODE_STRING, and it
51 returns the full path in the PUNICODE_STRING
53 If we don't do it this way, we should anyway add switches and separate functions to handle
54 the different object types*/
56 /**********************************************************************
69 NtQueryObject (IN HANDLE ObjectHandle,
70 IN CINT ObjectInformationClass,
71 OUT PVOID ObjectInformation,
73 OUT PULONG ReturnLength)
75 POBJECT_TYPE_INFORMATION typeinfo;
76 POBJECT_HEADER ObjectHeader;
80 Status = ObReferenceObjectByHandle (ObjectHandle,
86 if (!NT_SUCCESS (Status))
91 ObjectHeader = BODY_TO_HEADER(Object);
93 switch (ObjectInformationClass)
95 case ObjectNameInformation:
96 Status = ObQueryNameString (Object,
97 (POBJECT_NAME_INFORMATION)ObjectInformation,
102 case ObjectTypeInformation:
103 typeinfo = (POBJECT_TYPE_INFORMATION)ObjectInformation;
104 if (Length!=sizeof(OBJECT_TYPE_INFORMATION))
105 return STATUS_INVALID_BUFFER_SIZE;
107 // FIXME: Is this supposed to only be the header's Name field?
108 // Can somebody check/verify this?
109 RtlCopyUnicodeString(&typeinfo->Name,&ObjectHeader->Name);
111 if (Status != STATUS_SUCCESS)
116 RtlCopyUnicodeString(&typeinfo->Type,&ObjectHeader->ObjectType->TypeName);
117 //This should be info from the object header, not the object type, right?
118 typeinfo->TotalHandles = ObjectHeader-> HandleCount;
119 typeinfo->ReferenceCount = ObjectHeader -> RefCount;
123 Status = STATUS_NOT_IMPLEMENTED;
127 ObDereferenceObject(Object);
133 /**********************************************************************
135 * ObMakeTemporaryObject
148 ObMakeTemporaryObject (IN PVOID ObjectBody)
150 POBJECT_HEADER ObjectHeader;
152 ObjectHeader = BODY_TO_HEADER(ObjectBody);
153 ObjectHeader->Permanent = FALSE;
157 /**********************************************************************
159 * NtMakeTemporaryObject
171 NtMakeTemporaryObject (IN HANDLE Handle)
173 POBJECT_HEADER ObjectHeader;
177 Status = ObReferenceObjectByHandle(Handle,
183 if (Status != STATUS_SUCCESS)
188 ObjectHeader = BODY_TO_HEADER(Object);
189 ObjectHeader->Permanent = FALSE;
191 ObDereferenceObject(Object);
193 return STATUS_SUCCESS;