-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-95461: Add some parameters in CreateKeyEx and OpenKeyEx in winreg #129903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
e3fac96
59dfa3d
bba8ba6
47ea0ba
d6251e0
f4f4fff
1fd89db
28bf171
94ed98b
b8261bb
2475c0b
913b21a
483849a
bd57ba7
6eae434
1b473ad
5badb7a
7b9ffec
b4e8d8b
580a348
76b947f
9e64cb2
5fab221
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
|
|
||
| #include <windows.h> | ||
|
|
||
| #define MS_WINDOWS_DESKTOP | ||
| #if defined(MS_WINDOWS_DESKTOP) || defined(MS_WINDOWS_SYSTEM) || defined(MS_WINDOWS_GAMES) | ||
|
|
||
| typedef struct { | ||
|
|
@@ -1417,8 +1418,37 @@ winreg.OpenKey -> HKEY | |
| access: REGSAM(c_default='KEY_READ') = winreg.KEY_READ | ||
| An integer that specifies an access mask that describes the desired | ||
| security access for the key. Default is KEY_READ. | ||
|
|
||
| Opens the specified key. | ||
|
|
||
| The result is a new handle to the specified key. | ||
| If the function fails, an OSError exception is raised. | ||
| [clinic start generated code]*/ | ||
|
|
||
| static HKEY | ||
| winreg_OpenKey_impl(PyObject *module, HKEY key, const wchar_t *sub_key, | ||
| int reserved, REGSAM access) | ||
| /*[clinic end generated code: output=5efbad23b3ffe2e7 input=7fb70c602dd114dd]*/ | ||
| { | ||
| return winreg_OpenKeyEx_impl(module, key, sub_key, reserved, access, 0); | ||
| } | ||
|
|
||
| /*[clinic input] | ||
| winreg.OpenKeyEx -> HKEY | ||
|
|
||
| key: HKEY | ||
| An already open key, or any one of the predefined HKEY_* constants. | ||
| sub_key: Py_UNICODE(accept={str, NoneType}) | ||
| A string that identifies the sub_key to open. | ||
| options: int = 0 | ||
| Can be one of the REG_OPTION_* constants. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably document the interaction with |
||
| access: REGSAM(c_default='KEY_READ') = winreg.KEY_READ | ||
| An integer that specifies an access mask that describes the desired | ||
| security access for the key. Default is KEY_READ. | ||
| reserved: int = 0 | ||
| A reserved integer that be should zero. If it is not zero, | ||
| it will be used as the options parameter for compatibility reasons. | ||
| Default is zero. | ||
|
|
||
| Opens the specified key. | ||
|
|
||
|
|
@@ -1427,9 +1457,9 @@ If the function fails, an OSError exception is raised. | |
| [clinic start generated code]*/ | ||
|
|
||
| static HKEY | ||
| winreg_OpenKey_impl(PyObject *module, HKEY key, const wchar_t *sub_key, | ||
| int reserved, REGSAM access, int options) | ||
| /*[clinic end generated code: output=1cb0239fad9672e0 input=2fff042272bfc4f6]*/ | ||
| winreg_OpenKeyEx_impl(PyObject *module, HKEY key, const wchar_t *sub_key, | ||
| int options, REGSAM access, int reserved) | ||
| /*[clinic end generated code: output=db8d3dc70876a046 input=d997970b48ac2e30]*/ | ||
| { | ||
| HKEY retKey; | ||
| long rc; | ||
|
|
@@ -1439,8 +1469,13 @@ winreg_OpenKey_impl(PyObject *module, HKEY key, const wchar_t *sub_key, | |
| (Py_ssize_t)access) < 0) { | ||
| return NULL; | ||
| } | ||
| if (options != 0) { | ||
| reserved = options; | ||
| if (reserved != 0) { | ||
| if (PyErr_WarnEx(PyExc_DeprecationWarning, | ||
| "reserved is deprecated, use options instead.", 1)) | ||
| { | ||
| return NULL; | ||
| } | ||
| options = reserved; | ||
| } | ||
| Py_BEGIN_ALLOW_THREADS | ||
| rc = RegOpenKeyExW(key, sub_key, reserved, access, &retKey); | ||
|
|
@@ -1456,23 +1491,6 @@ winreg_OpenKey_impl(PyObject *module, HKEY key, const wchar_t *sub_key, | |
| return retKey; | ||
| } | ||
|
|
||
| /*[clinic input] | ||
| winreg.OpenKeyEx = winreg.OpenKey | ||
|
|
||
| Opens the specified key. | ||
|
|
||
| The result is a new handle to the specified key. | ||
| If the function fails, an OSError exception is raised. | ||
| [clinic start generated code]*/ | ||
|
|
||
| static HKEY | ||
| winreg_OpenKeyEx_impl(PyObject *module, HKEY key, const wchar_t *sub_key, | ||
| int reserved, REGSAM access, int options) | ||
| /*[clinic end generated code: output=08a607e6a6385ed4 input=c6c4972af8622959]*/ | ||
| { | ||
| return winreg_OpenKey_impl(module, key, sub_key, reserved, access, options); | ||
| } | ||
|
|
||
| /*[clinic input] | ||
| winreg.QueryInfoKey | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.