aboutsummaryrefslogtreecommitdiff
path: root/PC
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-06-25 11:37:12 +0300
committerGitHub <noreply@github.com>2020-06-25 11:37:12 +0300
commit55939b1708d6fc0d36d2be11ccdc6bf207e1bd41 (patch)
treecdfce605a8dbd54923f85fb9078d882dcc89d3b3 /PC
parentbpo-41002: Optimize HTTPResponse.read with a given amount (GH-20943) (diff)
downloadcpython-55939b1708d6fc0d36d2be11ccdc6bf207e1bd41.tar.gz
cpython-55939b1708d6fc0d36d2be11ccdc6bf207e1bd41.tar.bz2
cpython-55939b1708d6fc0d36d2be11ccdc6bf207e1bd41.zip
bpo-41074: Fix support of non-ASCII names and SQL in msilib. (GH-21126)
* Fix support of non-ASCII names in functions OpenDatabase() and init_database(). * Fix support of non-ASCII SQL in method Database.OpenView().
Diffstat (limited to 'PC')
-rw-r--r--PC/_msi.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/PC/_msi.c b/PC/_msi.c
index 6ed8724f77f..58c1cfd997b 100644
--- a/PC/_msi.c
+++ b/PC/_msi.c
@@ -872,14 +872,14 @@ static PyObject*
msidb_openview(msiobj *msidb, PyObject *args)
{
int status;
- char *sql;
+ const wchar_t *sql;
MSIHANDLE hView;
msiobj *result;
- if (!PyArg_ParseTuple(args, "s:OpenView", &sql))
+ if (!PyArg_ParseTuple(args, "u:OpenView", &sql))
return NULL;
- if ((status = MsiDatabaseOpenView(msidb->h, sql, &hView)) != ERROR_SUCCESS)
+ if ((status = MsiDatabaseOpenViewW(msidb->h, sql, &hView)) != ERROR_SUCCESS)
return msierror(status);
result = PyObject_New(struct msiobj, &msiview_Type);
@@ -998,18 +998,18 @@ static PyTypeObject msidb_Type = {
static PyObject* msiopendb(PyObject *obj, PyObject *args)
{
int status;
- char *path;
+ const wchar_t *path;
int persist;
MSIHANDLE h;
msiobj *result;
- if (!PyArg_ParseTuple(args, "si:MSIOpenDatabase", &path, &persist))
+ if (!PyArg_ParseTuple(args, "ui:MSIOpenDatabase", &path, &persist))
return NULL;
/* We need to validate that persist is a valid MSIDBOPEN_* value. Otherwise,
MsiOpenDatabase may treat the value as a pointer, leading to unexpected
behavior. */
if (Py_INVALID_PERSIST(persist))
return msierror(ERROR_INVALID_PARAMETER);
- status = MsiOpenDatabase(path, (LPCSTR)(SIZE_T)persist, &h);
+ status = MsiOpenDatabaseW(path, (LPCWSTR)(SIZE_T)persist, &h);
if (status != ERROR_SUCCESS)
return msierror(status);