diff --git a/reactos/include/ddk/obfuncs.h b/reactos/include/ddk/obfuncs.h index cfca99a462c..cfd9c88b63a 100644 --- a/reactos/include/ddk/obfuncs.h +++ b/reactos/include/ddk/obfuncs.h @@ -139,4 +139,11 @@ ObSetSecurityDescriptorInfo(IN PVOID Object, 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 */ diff --git a/reactos/ntoskrnl/ntoskrnl.def b/reactos/ntoskrnl/ntoskrnl.def index 97d1762b749..b3be1217a04 100644 --- a/reactos/ntoskrnl/ntoskrnl.def +++ b/reactos/ntoskrnl/ntoskrnl.def @@ -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 @@ ObAssignSecurity@16 ;ObCheckCreateObjectAccess@28 ;ObCheckObjectAccess@20 ObCreateObject@36 -;ObFindHandleForObject@20 +ObFindHandleForObject@20 ObGetObjectPointerCount@4 ObGetObjectSecurity@12 ObInsertObject@24 diff --git a/reactos/ntoskrnl/ob/handle.c b/reactos/ntoskrnl/ob/handle.c index c4c8a062b3c..846fc25ae79 100644 --- a/reactos/ntoskrnl/ob/handle.c +++ b/reactos/ntoskrnl/ob/handle.c @@ -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 @@ ObpGetHandleCountByHandleTable(PHANDLE_TABLE HandleTable) 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 */