Skip to content

Commit

Permalink
GP-4384: Upgrade to pybag-2.2.10
Browse files Browse the repository at this point in the history
  • Loading branch information
nsadeveloper789 committed Mar 5, 2024
1 parent 4e89a2e commit 87aecb8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
::@env OPT_TARGET_IMG:str="" "Image" "The target binary executable image"
::@env OPT_TARGET_ARGS:str="" "Arguments" "Command-line arguments to pass to the target"
::@env OPT_USE_DBGMODEL:bool=true "Use dbgmodel" "Load and use dbgmodel.dll if it is available."
::@env OPT_DBGMODEL_PATH:str="" "Path to dbgeng" "Path to dbgeng and associated DLLS (if not Windows Kits)."
::@env WINDBG_DIR:str="" "Path to dbgeng" "Path to dbgeng and associated DLLS (if not Windows Kits)."

@echo off

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ classifiers = [
]
dependencies = [
"ghidratrace==10.4",
"pybag>=2.2.9"
"pybag>=2.2.10"
]

[project.urls]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,6 @@

ctypes.windll.kernel32.SetErrorMode(0x0001 | 0x0002 | 0x8000)

if platform.architecture()[0] == '64bit':
dbgdirs = [os.getenv('OPT_DBGMODEL_PATH'),
r'C:\Program Files\Windows Kits\10\Debuggers\x64',
r'C:\Program Files (x86)\Windows Kits\10\Debuggers\x64']
else:
dbgdirs = [os.getenv('OPT_DBGMODEL_PATH'),
r'C:\Program Files\Windows Kits\10\Debuggers\x86',
r'C:\Program Files (x86)\Windows Kits\10\Debuggers\x86']
dbgdir = None
for _dir in dbgdirs:
if _dir is not None and os.path.exists(_dir):
dbgdir = _dir
break

if not dbgdir:
raise RuntimeError("Windbg install directory not found!")

print(f"Loading dbgeng and friends from {dbgdir}")

# preload these to get correct DLLs loaded
try:
ctypes.windll.LoadLibrary(os.path.join(dbgdir, 'dbghelp.dll'))
except Exception as exc:
print(f"LoadLibrary failed: {dbgdir}\dbghelp.dll {exc}")
pass
try:
ctypes.windll.LoadLibrary(os.path.join(dbgdir, 'dbgeng.dll'))
except Exception as exc:
print(f"LoadLibrary failed: {dbgdir}\dbgeng.dll {exc}")
pass
try:
ctypes.windll.LoadLibrary(os.path.join(dbgdir, 'DbgModel.dll'))
except Exception as exc:
print(f"LoadLibrary failed: {dbgdir}\dbgmodel.dll {exc}")
pass

try:
from comtypes.gen import DbgMod
Expand Down

0 comments on commit 87aecb8

Please sign in to comment.