mirror of
https://github.com/hakril/PythonForWindows
synced 2026-06-08 14:31:45 +00:00
Fixed a logic bug in object manager + import bug in syswow.py
This commit is contained in:
+1
-1
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user