PyDbgEng.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:pydbg3 作者: walkerfuz 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号