]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-35890: Use RegQueryInfoKeyW and CryptAcquireContextW explicitly (GH-19974)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 18 May 2020 17:09:59 +0000 (10:09 -0700)
committerGitHub <noreply@github.com>
Mon, 18 May 2020 17:09:59 +0000 (10:09 -0700)
(cherry picked from commit 98e42d1f882b9b59f587d538c562dbc7d11c64c3)

Co-authored-by: Minmin Gong <gongminmin@msn.com>
PC/getpathp.c
PC/winreg.c
Python/bootstrap_hash.c

index 3747ffb2d89f093fe72814107223ea36633cd50b..53653c81fb45fad4ad28a566cb8a3141e0ed43cf 100644 (file)
@@ -405,7 +405,7 @@ getpythonregpath(HKEY keyBase, int skipcore)
         goto done;
     }
     /* Find out how big our core buffer is, and how many subkeys we have */
-    rc = RegQueryInfoKey(newKey, NULL, NULL, NULL, &numKeys, NULL, NULL,
+    rc = RegQueryInfoKeyW(newKey, NULL, NULL, NULL, &numKeys, NULL, NULL,
                     NULL, NULL, &dataSize, NULL, NULL);
     if (rc!=ERROR_SUCCESS) {
         goto done;
index 5dff7deadf767ac4a27bb144216354ebe58b5c09..caad18e045bcb9a71653401138da736a2a224f02 100644 (file)
@@ -1451,9 +1451,9 @@ winreg_QueryInfoKey_impl(PyObject *module, HKEY key)
     if (PySys_Audit("winreg.QueryInfoKey", "n", (Py_ssize_t)key) < 0) {
         return NULL;
     }
-    if ((rc = RegQueryInfoKey(key, NULL, NULL, 0, &nSubKeys, NULL, NULL,
-                              &nValues,  NULL,  NULL, NULL, &ft))
-                              != ERROR_SUCCESS) {
+    if ((rc = RegQueryInfoKeyW(key, NULL, NULL, 0, &nSubKeys, NULL, NULL,
+                               &nValues,  NULL,  NULL, NULL, &ft))
+                               != ERROR_SUCCESS) {
         return PyErr_SetFromWindowsErrWithFunction(rc, "RegQueryInfoKey");
     }
     li.LowPart = ft.dwLowDateTime;
index 43f5264d86250ceabd6c3d8faa82a69f7ff0e7fc..eb2b6d08d8e1429a514500ffc6138c88e3ef7b1a 100644 (file)
@@ -38,8 +38,8 @@ static int
 win32_urandom_init(int raise)
 {
     /* Acquire context */
-    if (!CryptAcquireContext(&hCryptProv, NULL, NULL,
-                             PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
+    if (!CryptAcquireContextW(&hCryptProv, NULL, NULL,
+                              PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
         goto error;
 
     return 0;