From: Steve Dower Date: Mon, 18 May 2020 22:24:41 +0000 (+0100) Subject: bpo-35890: Use RegQueryInfoKeyW and CryptAcquireContextW explicitly (GH-19974) X-Git-Tag: v3.7.8rc1~53 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=930badd414dd2376b1875e1775cb40855a87e180;p=thirdparty%2FPython%2Fcpython.git bpo-35890: Use RegQueryInfoKeyW and CryptAcquireContextW explicitly (GH-19974) Co-authored-by: Minmin Gong --- diff --git a/PC/getpathp.c b/PC/getpathp.c index e3cd3ae1e9a6..dc4e43fe7d3b 100644 --- a/PC/getpathp.c +++ b/PC/getpathp.c @@ -398,7 +398,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; diff --git a/PC/winreg.c b/PC/winreg.c index 16a10c7232a1..639052d20dd0 100644 --- a/PC/winreg.c +++ b/PC/winreg.c @@ -1382,8 +1382,8 @@ winreg_QueryInfoKey_impl(PyObject *module, HKEY key) PyObject *l; PyObject *ret; - if ((rc = RegQueryInfoKey(key, NULL, NULL, 0, &nSubKeys, NULL, NULL, - &nValues, NULL, NULL, NULL, &ft)) + 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; diff --git a/Python/bootstrap_hash.c b/Python/bootstrap_hash.c index 58b0802f4668..7b560e66e307 100644 --- a/Python/bootstrap_hash.c +++ b/Python/bootstrap_hash.c @@ -37,8 +37,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;