Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Don't fail attach to pid if 'ProgramFiles' env var is not available. Fixes #1144 #1515

Merged
merged 1 commit into from
Jun 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,29 +47,34 @@
def _load_latest_dbghelp_dll():

from os import getenv
from os.path import join

from os.path import join, exists

program_files_location = getenv("ProgramFiles")
if not program_files_location:
program_files_location = "C:\Program Files"

program_files_x86_location = getenv("ProgramFiles(x86)")

if arch == ARCH_AMD64:
if wow64:
pathname = join(
getenv("ProgramFiles(x86)",
getenv("ProgramFiles")),
program_files_x86_location or program_files_location,
"Debugging Tools for Windows (x86)",
"dbghelp.dll")
else:
pathname = join(
getenv("ProgramFiles"),
program_files_location,
"Debugging Tools for Windows (x64)",
"dbghelp.dll")
elif arch == ARCH_I386:
pathname = join(
getenv("ProgramFiles"),
program_files_location,
"Debugging Tools for Windows (x86)",
"dbghelp.dll")
else:
pathname = None

if pathname:
if pathname and exists(pathname):
try:
_dbghelp = ctypes.windll.LoadLibrary(pathname)
ctypes.windll.dbghelp = _dbghelp
Expand Down