bpo-35890: Use RegQueryInfoKeyW and CryptAcquireContextW explicitly (GH-19974)

(cherry picked from commit 98e42d1f88)

Co-authored-by: Minmin Gong <gongminmin@msn.com>
This commit is contained in:
Miss Islington (bot) 2020-05-18 10:09:59 -07:00 committed by GitHub
parent ab9d9535aa
commit 460eac20a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View 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;

View 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;

View 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;