Fixed a bug in ObOpenObjectByName

This commit is contained in:
ergo720 2021-12-27 13:51:44 +01:00
parent 922bd4e9d2
commit 6078193fec
2 changed files with 6 additions and 5 deletions

View File

@ -917,9 +917,7 @@ XBSYSAPI EXPORTNUM(201) xbox::ntstatus_xt NTAPI xbox::NtOpenDirectoryObject
{
LOG_FORWARD("ObOpenObjectByName");
xbox::ntstatus_xt status = ObOpenObjectByName(ObjectAttributes, &ObDirectoryObjectType, NULL, DirectoryHandle);
RegisterXboxHandle(*DirectoryHandle, NULL); // we don't need to create a native handle for a directory object
return status;
return ObOpenObjectByName(ObjectAttributes, &ObDirectoryObjectType, NULL, DirectoryHandle);
}
// ******************************************************************

View File

@ -929,12 +929,15 @@ XBSYSAPI EXPORTNUM(243) xbox::ntstatus_xt NTAPI xbox::ObOpenObjectByName
ntstatus_xt result = X_STATUS_OBJECT_PATH_NOT_FOUND;
if (const auto &nativeHandle = GetNativeHandle(Handle)) {
// This was a handle created by Ob
if (ObjectType == &ObDirectoryObjectType) {
// Directory objects are currently handled by Ob
PVOID Object;
result = ObpReferenceObjectByName(ObjectAttributes->RootDirectory, ObjectAttributes->ObjectName,
ObjectAttributes->Attributes, ObjectType, ParseContext, &Object);
*Handle = ObpGetHandleByObjectThenDereferenceInline(Object, result);
if (X_NT_SUCCESS(result)) {
RegisterXboxHandle(*Handle, NULL); // we don't need to create a native handle for a directory object
}
}
else if (ObjectType == &ObSymbolicLinkObjectType) {
// Use this place for any interface implementation since