summaryrefslogtreecommitdiffstats
path: root/PC
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2022-09-08 21:02:04 (GMT)
committerGitHub <noreply@github.com>2022-09-08 21:02:04 (GMT)
commit95d6330a3edacacd081f55699bd6f0a787908924 (patch)
treeb415eefb3bb0c869061f7d418ae3945598d67851 /PC
parent9c8f3794337457b1d905a9fa0f38c2978fe32abd (diff)
downloadcpython-95d6330a3edacacd081f55699bd6f0a787908924.zip
cpython-95d6330a3edacacd081f55699bd6f0a787908924.tar.gz
cpython-95d6330a3edacacd081f55699bd6f0a787908924.tar.bz2
gh-96684: Silently suppress COM security errors in _wmi module (GH-96690)
Diffstat (limited to 'PC')
-rw-r--r--PC/_wmimodule.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/PC/_wmimodule.cpp b/PC/_wmimodule.cpp
index fbaadcc..de22049 100644
--- a/PC/_wmimodule.cpp
+++ b/PC/_wmimodule.cpp
@@ -63,6 +63,12 @@ _query_thread(LPVOID param)
RPC_C_IMP_LEVEL_IMPERSONATE,
NULL, EOAC_NONE, NULL
);
+ // gh-96684: CoInitializeSecurity will fail if another part of the app has
+ // already called it. Hopefully they passed lenient enough settings that we
+ // can complete the WMI query, so keep going.
+ if (hr == RPC_E_TOO_LATE) {
+ hr = 0;
+ }
if (SUCCEEDED(hr)) {
hr = CoCreateInstance(
CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER,