reactos/include/ddk
diff -u -r1.15 -r1.16
--- obfuncs.h 25 Sep 2003 20:00:01 -0000 1.15
+++ obfuncs.h 24 Sep 2004 16:18:28 -0000 1.16
@@ -139,4 +139,11 @@
IN PGENERIC_MAPPING GenericMapping);
*/
+NTSTATUS STDCALL
+ObFindHandleForObject(IN PEPROCESS Process,
+ IN PVOID Object,
+ IN POBJECT_TYPE ObjectType,
+ IN POBJECT_HANDLE_INFORMATION HandleInformation,
+ OUT PHANDLE HandleReturn);
+
#endif /* ndef _INCLUDE_DDK_OBFUNCS_H */
reactos/ntoskrnl
diff -u -r1.192 -r1.193
--- ntoskrnl.def 22 Sep 2004 22:31:46 -0000 1.192
+++ ntoskrnl.def 24 Sep 2004 16:18:28 -0000 1.193
@@ -1,4 +1,4 @@
-; $Id: ntoskrnl.def,v 1.192 2004/09/22 22:31:46 weiden Exp $
+; $Id: ntoskrnl.def,v 1.193 2004/09/24 16:18:28 weiden Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@@ -834,7 +834,7 @@
;ObCheckCreateObjectAccess@28
;ObCheckObjectAccess@20
ObCreateObject@36
-;ObFindHandleForObject@20
+ObFindHandleForObject@20
ObGetObjectPointerCount@4
ObGetObjectSecurity@12
ObInsertObject@24
reactos/ntoskrnl/ob
diff -u -r1.60 -r1.61
--- handle.c 13 Sep 2004 14:43:50 -0000 1.60
+++ handle.c 24 Sep 2004 16:18:28 -0000 1.61
@@ -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.60 2004/09/13 14:43:50 ekohl Exp $
+/* $Id: handle.c,v 1.61 2004/09/24 16:18:28 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -1026,4 +1026,53 @@
return Count;
}
+/*
+ * FUNCTION: Searches the handle table of a specified process whether it contains a
+ * valid handle to the Object we're looking for. If not, it'll create one.
+ *
+ * NOTES:
+ * The parameters of this function is basically a mixture of some of the parameters
+ * of ObReferenceObjectByHandle() and ObReferenceObjectByPointer(). A little thinking
+ * about what this function does (by it's name) makes clear what parameters it requires.
+ * For example the AccessMode parameter of ObReferenceObjectByHandle/Pointer() is not
+ * required at all as it only has influence on the object security. This function doesn't
+ * want to get access to an object, it just looks for a valid handle and if it can't find
+ * one, it'll just create one. It wouldn't make sense to check for security again as the
+ * caller already has a pointer to the object.
+ *
+ * A test on an XP machine shows that this prototype appears to be correct.
+ *
+ * ARGUMENTS:
+ * Process = This parameter simply describes in which handle table we're looking
+ * for a handle to the object.
+ * Object = The object pointer that we're looking for
+ * ObjectType = Just a sanity check as ObReferenceObjectByHandle() and
+ * ObReferenceObjectByPointer() provides.
+ * HandleInformation = This one has to be the opposite meaning of the usage in
+ * ObReferenceObjectByHandle(). If we actually found a valid
+ * handle in the table, we need to check against the information
+ * provided so we make sure this handle has all access rights
+ * (and attributes?!) we need. If they don't match, we can't
+ * use this handle and keep looking because the caller is likely
+ * to depend on these access rights.
+ * HandleReturn = The last parameter is the same as in ObCreateHandle(). If we could
+ * find a suitable handle in the handle table, return this handle, if
+ * not, we'll just create one using ObCreateHandle() with all access
+ * rights the caller needs.
+ *
+ * RETURNS: Status
+ *
+ * @unimplemented
+ */
+NTSTATUS STDCALL
+ObFindHandleForObject(IN PEPROCESS Process,
+ IN PVOID Object,
+ IN POBJECT_TYPE ObjectType,
+ IN POBJECT_HANDLE_INFORMATION HandleInformation,
+ OUT PHANDLE HandleReturn)
+{
+ UNIMPLEMENTED;
+ return STATUS_UNSUCCESSFUL;
+}
+
/* EOF */