diff --git a/windows/syswow64.py b/windows/syswow64.py index cf0b8bc..d777163 100644 --- a/windows/syswow64.py +++ b/windows/syswow64.py @@ -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) diff --git a/windows/winobject/object_manager.py b/windows/winobject/object_manager.py index e8bd1ab..a9161c9 100644 --- a/windows/winobject/object_manager.py +++ b/windows/winobject/object_manager.py @@ -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