def get_dbg_eng_dir_from_registry():
import win32api, win32con
try:
hkey = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER, "Software\\Microsoft\\DebuggingTools")
except:
# Lets try a few common places before failing.
pgPaths = [
"c:\\",
os.environ["SystemDrive"]+"\\",
os.environ["ProgramFiles"],
]
if "ProgramW6432" in os.environ:
pgPaths.append(os.environ["ProgramW6432"])
if "ProgramFiles(x86)" in os.environ:
pgPaths.append(os.environ["ProgramFiles(x86)"])
dbgPaths = [
"Debuggers",
"Debugger",
"Debugging Tools for Windows",
"Debugging Tools for Windows (x64)",
"Debugging Tools for Windows (x86)",
]
for p in pgPaths:
for d in dbgPaths:
testPath = os.path.join(p,d)
if os.path.exists(testPath):
return testPath
raise DebuggerException("Failed to locate Microsoft Debugging Tools in the registry. Please make sure its installed")
val, type = win32api.RegQueryValueEx(hkey, "WinDbg")
return val
评论列表
文章目录