]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-35890: Use RegQueryInfoKeyW and CryptAcquireContextW explicitly (GH-19974)
authorMinmin Gong <gongminmin@msn.com>
Mon, 18 May 2020 16:50:03 +0000 (09:50 -0700)
committerGitHub <noreply@github.com>
Mon, 18 May 2020 16:50:03 +0000 (17:50 +0100)
PC/getpathp.c
PC/winreg.c
Python/bootstrap_hash.c

index d23d2bbde809f73db8842ef09bcdf2ff13731de8..fd5cfa7e1a8a3fc160319fa611579f3aca50c763 100644 (file)
@@ -358,7 +358,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 3e13e75826f1576cdf5539e4937f8b291e2c3026..1305b7030fadafba4cbdadf77e86487f6a918d89 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 aa3a3dfd964edb19d6c8db1748e743b8586c63d6..b2109275014b2381073ecb9d0c83add46c4f54dd 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;