This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients eryksun, paul.moore, steve.dower, tim.golden, zach.ware
Date 2021-11-05.22:30:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1636151455.54.0.904525327505.issue45720@roundup.psfhosted.org>
In-reply-to
Content
> I also don't actually see gdi32 being transitively loaded as
> claimed in the Twitter thread, even back to 3.8. So presumably
> there's something else going on to cause that issue.

Since Windows XP, shlwapi.dll has increasingly made use of delay loading, but up to Windows 8.1 it was still immediately loading user32.dll and gdi32.dll. In Windows 10, shlwapi.dll finally made them delay loaded dependencies. Also, in Windows 10, PathIsRelativeW is forwarded to the implementation in kernelbase.dll, not that it matters from the end user's perspective since it's not in an API set.

Regarding user32.dll, there's still an issue with ssl, hashlib, winsound, and ctypes not delay loading it, or DLLs that directly depend on it such as ole32.dll and oleaut32.dll. In most use cases these DLLs would never be loaded. 

When user32.dll loads, the process and the loading thread are converted to GUI versions, i.e. they're extended in the kernel with the window manager's Win32Process and Win32Thread structures, and the process connects to a window station and desktop (e.g. r"WinSta0\Default"). One concern with converting to a GUI process is that the system doesn't send CTRL_LOGOFF_EVENT and CTRL_SHUTDOWN_EVENT console events to GUI processes. Thus a console script can't handle those events with a simple ctypes-based handler as long as importing ctypes always loads user32.dll.
History
Date User Action Args
2021-11-05 22:30:55eryksunsetrecipients: + eryksun, paul.moore, tim.golden, zach.ware, steve.dower
2021-11-05 22:30:55eryksunsetmessageid: <1636151455.54.0.904525327505.issue45720@roundup.psfhosted.org>
2021-11-05 22:30:55eryksunlinkissue45720 messages
2021-11-05 22:30:55eryksuncreate