Skip to content

Commit ab4d315

Browse files
gh-85470: Delay load ole32.dll in the _ctypes module
ole32.dll pulls in user32.dll, which makes the system treat the process as a GUI process and stop sending logoff and shutdown console control events to it. It is only needed for ProgIDFromCLSID() when formatting a COM error.
1 parent 998b890 commit ab4d315

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Importing :mod:`ctypes` on Windows no longer loads ``user32.dll``, which
2+
made the system treat the process as a GUI process and stop sending logoff
3+
and shutdown console control events to it. ``ole32.dll``, which pulled
4+
``user32.dll`` in, is now delay loaded.

PCbuild/_ctypes.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
</ClCompile>
9999
<Link>
100100
<AdditionalOptions>/EXPORT:DllGetClassObject,PRIVATE /EXPORT:DllCanUnloadNow,PRIVATE %(AdditionalOptions)</AdditionalOptions>
101+
<DelayLoadDLLs>ole32.dll</DelayLoadDLLs>
101102
</Link>
102103
</ItemDefinitionGroup>
103104
<ItemGroup>

0 commit comments

Comments
 (0)