Fixed a logic bug in object manager + import bug in syswow.py

This commit is contained in:
hakril
2019-08-05 22:31:00 +02:00
parent b0fa864271
commit 7827a43d9a
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -239,7 +239,7 @@ def ntquerysysteminformation_syswow64_error_check(result, func, args):
# Ignore STATUS_INFO_LENGTH_MISMATCH if SystemInformation is None
if result == STATUS_INFO_LENGTH_MISMATCH and not args[1]:
return args
raise WinproxyError("{0} failed with NTStatus {1}".format(func_name, hex(result)))
raise winproxy.WinproxyError("NtQuerySystemInformation failed with NTStatus {0}".format(hex(result)))
@Syswow64ApiProxy(winproxy.NtQuerySystemInformation, errcheck=ntquerysysteminformation_syswow64_error_check)
# @Syswow64ApiProxy(winproxy.NtQuerySystemInformation)
+3 -3
View File
@@ -26,7 +26,7 @@ def query_link(linkpath):
class KernelObject(object):
"""Represent an object in the Object Manager namespace"""
def __init__(self, path, name, type):
def __init__(self, path, name, type=None):
self.path = path
self.name = name
if path and not path.endswith("\\"):
@@ -177,8 +177,7 @@ class KernelObject(object):
elif name == "\\": # Ask for root ? return ourself
return self
else:
name = name[1:]
name = name[1:] # Strip the leading \ and go to normal case
obj = self
for part in name.split("\\"):
try:
@@ -187,6 +186,7 @@ class KernelObject(object):
if e.code == gdef.STATUS_OBJECT_TYPE_MISMATCH:
raise KeyError("Could not find object <{0}> under <{1}> because it is a <{2}>".format(
part, obj.name, obj.type))
raise # Something smart to do ?
return obj