Skip to content

Commit

Permalink
Register COM objects with the abs path to pythoncomxx.dll
Browse files Browse the repository at this point in the history
  • Loading branch information
mhammond committed May 29, 2021
1 parent fda16a7 commit 3639a92
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGES.txt
Expand Up @@ -8,6 +8,9 @@ Note that build 228 was the last version supporting Python 2.

Since build 300:
----------------
* COM objects are now registered with the full path to pythoncomXX.dll, fixes
#1704.

* Fix some confusion on how dynamic COM object properties work. The old
code was confused, so there's a chance there will be some subtle
regression here - please open a bug if you find anything, but this
Expand Down
17 changes: 7 additions & 10 deletions com/win32com/server/register.py
Expand Up @@ -216,16 +216,13 @@ def RegisterServer(clsid,
# Although now we prefer a 'loader' DLL if it exists to avoid some
# manifest issues (the 'loader' DLL has a manifest, but pythoncom does not)
pythoncom_dir = os.path.dirname(pythoncom.__file__)
if pythoncom.__file__.find("_d") < 0:
suffix = ""
else:
suffix = "_d"
loadername = "pythoncomloader%d%d%s.dll" % (sys.version_info[0], sys.version_info[1], suffix)
if os.path.isfile(os.path.join(pythoncom_dir, loadername)):
dllName = loadername
else:
# just use pythoncom.
dllName = os.path.basename(pythoncom.__file__)
suffix = "_d" if "_d" in pythoncom.__file__ else ""
# Always register with the full path to the DLLs.
loadername = os.path.join(
pythoncom_dir,
"pythoncomloader%d%d%s.dll" % (sys.version_info[0], sys.version_info[1], suffix)
)
dllName = loadername if os.path.isfile(loadername) else pythoncom.__file__

_set_subkeys(keyNameRoot + "\\InprocServer32",
{ None : dllName,
Expand Down

0 comments on commit 3639a92

Please sign in to comment.