mirror of
https://github.com/python/cpython
synced 2024-09-05 16:38:56 +00:00
bpo-35890: Use RegQueryInfoKeyW and CryptAcquireContextW explicitly (GH-19974)
This commit is contained in:
parent
f660567937
commit
98e42d1f88
|
@ -358,7 +358,7 @@ getpythonregpath(HKEY keyBase, int skipcore)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
/* Find out how big our core buffer is, and how many subkeys we have */
|
/* 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);
|
NULL, NULL, &dataSize, NULL, NULL);
|
||||||
if (rc!=ERROR_SUCCESS) {
|
if (rc!=ERROR_SUCCESS) {
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
@ -1451,9 +1451,9 @@ winreg_QueryInfoKey_impl(PyObject *module, HKEY key)
|
||||||
if (PySys_Audit("winreg.QueryInfoKey", "n", (Py_ssize_t)key) < 0) {
|
if (PySys_Audit("winreg.QueryInfoKey", "n", (Py_ssize_t)key) < 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if ((rc = RegQueryInfoKey(key, NULL, NULL, 0, &nSubKeys, NULL, NULL,
|
if ((rc = RegQueryInfoKeyW(key, NULL, NULL, 0, &nSubKeys, NULL, NULL,
|
||||||
&nValues, NULL, NULL, NULL, &ft))
|
&nValues, NULL, NULL, NULL, &ft))
|
||||||
!= ERROR_SUCCESS) {
|
!= ERROR_SUCCESS) {
|
||||||
return PyErr_SetFromWindowsErrWithFunction(rc, "RegQueryInfoKey");
|
return PyErr_SetFromWindowsErrWithFunction(rc, "RegQueryInfoKey");
|
||||||
}
|
}
|
||||||
li.LowPart = ft.dwLowDateTime;
|
li.LowPart = ft.dwLowDateTime;
|
||||||
|
|
|
@ -38,8 +38,8 @@ static int
|
||||||
win32_urandom_init(int raise)
|
win32_urandom_init(int raise)
|
||||||
{
|
{
|
||||||
/* Acquire context */
|
/* Acquire context */
|
||||||
if (!CryptAcquireContext(&hCryptProv, NULL, NULL,
|
if (!CryptAcquireContextW(&hCryptProv, NULL, NULL,
|
||||||
PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
|
PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue