diff options
author | Steve Dower <steve.dower@python.org> | 2024-01-26 17:53:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-26 17:53:46 (GMT) |
commit | 74bd566f70f14959a7752388eb2f24cfeb6cf4e4 (patch) | |
tree | 6bea71233c36a2524280f933b4d74736889b3e2d /Modules/_winapi.c | |
parent | c95cdd0a824a0219492a2dadd772b2391a18b9da (diff) | |
download | cpython-74bd566f70f14959a7752388eb2f24cfeb6cf4e4.zip cpython-74bd566f70f14959a7752388eb2f24cfeb6cf4e4.tar.gz cpython-74bd566f70f14959a7752388eb2f24cfeb6cf4e4.tar.bz2 |
Use Unicode unconditionally for _winapi.CreateFile (GH-114611)
Currently it switches based on build settings, but argument clinic does not handle it correctly.
Diffstat (limited to 'Modules/_winapi.c')
-rw-r--r-- | Modules/_winapi.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Modules/_winapi.c b/Modules/_winapi.c index bcb003f..2784a81 100644 --- a/Modules/_winapi.c +++ b/Modules/_winapi.c @@ -439,7 +439,7 @@ _winapi_ConnectNamedPipe_impl(PyObject *module, HANDLE handle, /*[clinic input] _winapi.CreateFile -> HANDLE - file_name: LPCTSTR + file_name: LPCWSTR desired_access: DWORD share_mode: DWORD security_attributes: LPSECURITY_ATTRIBUTES @@ -450,12 +450,12 @@ _winapi.CreateFile -> HANDLE [clinic start generated code]*/ static HANDLE -_winapi_CreateFile_impl(PyObject *module, LPCTSTR file_name, +_winapi_CreateFile_impl(PyObject *module, LPCWSTR file_name, DWORD desired_access, DWORD share_mode, LPSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD flags_and_attributes, HANDLE template_file) -/*[clinic end generated code: output=417ddcebfc5a3d53 input=6423c3e40372dbd5]*/ +/*[clinic end generated code: output=818c811e5e04d550 input=1fa870ed1c2e3d69]*/ { HANDLE handle; @@ -466,14 +466,15 @@ _winapi_CreateFile_impl(PyObject *module, LPCTSTR file_name, } Py_BEGIN_ALLOW_THREADS - handle = CreateFile(file_name, desired_access, - share_mode, security_attributes, - creation_disposition, - flags_and_attributes, template_file); + handle = CreateFileW(file_name, desired_access, + share_mode, security_attributes, + creation_disposition, + flags_and_attributes, template_file); Py_END_ALLOW_THREADS - if (handle == INVALID_HANDLE_VALUE) + if (handle == INVALID_HANDLE_VALUE) { PyErr_SetFromWindowsErr(0); + } return handle; } |