Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize tools.tlbparser.get_tlib_filename. #619

Merged
merged 2 commits into from
Sep 18, 2024
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
7 changes: 1 addition & 6 deletions comtypes/tools/tlbparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,16 +732,11 @@ def __init__(self, tlib):
# path = r"c:\vc98\include\activscp.tlb"


def get_tlib_filename(tlib):
def get_tlib_filename(tlib: typeinfo.ITypeLib) -> Optional[str]:
# seems if the typelib is not registered, there's no way to
# determine the filename.
la = tlib.GetLibAttr()
name = BSTR()
try:
windll.oleaut32.QueryPathOfRegTypeLib
except AttributeError:
# Windows CE doesn't have this function
return None
if 0 == windll.oleaut32.QueryPathOfRegTypeLib(
byref(la.guid), la.wMajorVerNum, la.wMinorVerNum, 0, byref(name) # lcid
):
Expand Down