diff options
Diffstat (limited to 'PC/_msi.c')
-rw-r--r-- | PC/_msi.c | 295 |
1 files changed, 127 insertions, 168 deletions
@@ -1,5 +1,5 @@ /* Helper library for MSI creation with Python. - * Copyright (C) 2005 Martin v. Löwis + * Copyright (C) 2005 Martin v. Löwis * Licensed to PSF under a contributor agreement. */ @@ -18,7 +18,7 @@ static PyObject* uuidcreate(PyObject* obj, PyObject*args) { UUID result; - wchar_t *cresult; + char *cresult; PyObject *oresult; /* May return ok, local only, and no address. @@ -30,13 +30,13 @@ uuidcreate(PyObject* obj, PyObject*args) return NULL; } - if (UuidToStringW(&result, &cresult) == RPC_S_OUT_OF_MEMORY) { + if (UuidToString(&result, &cresult) == RPC_S_OUT_OF_MEMORY) { PyErr_SetString(PyExc_MemoryError, "out of memory in uuidgen"); return NULL; } - oresult = PyUnicode_FromWideChar(cresult, wcslen(cresult)); - RpcStringFreeW(&cresult); + oresult = PyString_FromString(cresult); + RpcStringFree(&cresult); return oresult; } @@ -55,7 +55,7 @@ static FNFCIFREE(cb_free) static FNFCIOPEN(cb_open) { - int result = _open(pszFile, oflag | O_NOINHERIT, pmode); + int result = _open(pszFile, oflag, pmode); if (result == -1) *err = errno; return result; @@ -63,7 +63,7 @@ static FNFCIOPEN(cb_open) static FNFCIREAD(cb_read) { - UINT result = (UINT)_read((int)hf, memory, cb); + UINT result = (UINT)_read(hf, memory, cb); if (result != cb) *err = errno; return result; @@ -71,7 +71,7 @@ static FNFCIREAD(cb_read) static FNFCIWRITE(cb_write) { - UINT result = (UINT)_write((int)hf, memory, cb); + UINT result = (UINT)_write(hf, memory, cb); if (result != cb) *err = errno; return result; @@ -79,7 +79,7 @@ static FNFCIWRITE(cb_write) static FNFCICLOSE(cb_close) { - int result = _close((int)hf); + int result = _close(hf); if (result != 0) *err = errno; return result; @@ -87,7 +87,7 @@ static FNFCICLOSE(cb_close) static FNFCISEEK(cb_seek) { - long result = (long)_lseek((int)hf, dist, seektype); + long result = (long)_lseek(hf, dist, seektype); if (result == -1) *err = errno; return result; @@ -122,9 +122,7 @@ static FNFCIGETTEMPFILE(cb_gettempfile) static FNFCISTATUS(cb_status) { if (pv) { - _Py_IDENTIFIER(status); - - PyObject *result = _PyObject_CallMethodId(pv, &PyId_status, "iii", typeStatus, cb1, cb2); + PyObject *result = PyObject_CallMethod(pv, "status", "iii", typeStatus, cb1, cb2); if (result == NULL) return -1; Py_DECREF(result); @@ -135,19 +133,17 @@ static FNFCISTATUS(cb_status) static FNFCIGETNEXTCABINET(cb_getnextcabinet) { if (pv) { - _Py_IDENTIFIER(getnextcabinet); - - PyObject *result = _PyObject_CallMethodId(pv, &PyId_getnextcabinet, "i", pccab->iCab); + PyObject *result = PyObject_CallMethod(pv, "getnextcabinet", "i", pccab->iCab); if (result == NULL) return -1; - if (!PyBytes_Check(result)) { + if (!PyString_Check(result)) { PyErr_Format(PyExc_TypeError, "Incorrect return type %s from getnextcabinet", result->ob_type->tp_name); Py_DECREF(result); return FALSE; } - strncpy(pccab->szCab, PyBytes_AsString(result), sizeof(pccab->szCab)); + strncpy(pccab->szCab, PyString_AsString(result), sizeof(pccab->szCab)); return TRUE; } return FALSE; @@ -179,7 +175,7 @@ static FNFCIGETOPENINFO(cb_getopeninfo) CloseHandle(handle); - return _open(pszName, _O_RDONLY | _O_BINARY | O_NOINHERIT); + return _open(pszName, _O_RDONLY | _O_BINARY); } static PyObject* fcicreate(PyObject* obj, PyObject* args) @@ -243,13 +239,8 @@ static PyObject* fcicreate(PyObject* obj, PyObject* args) for (i=0; i < PyList_GET_SIZE(files); i++) { PyObject *item = PyList_GET_ITEM(files, i); char *filename, *cabname; - - if (!PyArg_ParseTuple(item, "ss", &filename, &cabname)) { - PyErr_SetString(PyExc_TypeError, "FCICreate expects a list of tuples containing two strings"); - FCIDestroy(hfci); - return NULL; - } - + if (!PyArg_ParseTuple(item, "ss", &filename, &cabname)) + goto err; if (!FCIAddFile(hfci, filename, cabname, FALSE, cb_getnextcabinet, cb_status, cb_getopeninfo, tcompTYPE_MSZIP)) @@ -262,13 +253,10 @@ static PyObject* fcicreate(PyObject* obj, PyObject* args) if (!FCIDestroy(hfci)) goto err; - Py_RETURN_NONE; + Py_INCREF(Py_None); + return Py_None; err: - if(erf.fError) - PyErr_Format(PyExc_ValueError, "FCI error %d", erf.erfOper); /* XXX better error type */ - else - PyErr_SetString(PyExc_ValueError, "FCI general error"); - + PyErr_Format(PyExc_ValueError, "FCI error %d", erf.erfOper); /* XXX better error type */ FCIDestroy(hfci); return NULL; } @@ -287,6 +275,15 @@ msiobj_dealloc(msiobj* msidb) } static PyObject* +msiobj_close(msiobj* msidb, PyObject *args) +{ + MsiCloseHandle(msidb->h); + msidb->h = 0; + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject* msierror(int status) { int code; @@ -315,12 +312,6 @@ msierror(int status) case ERROR_INVALID_PARAMETER: PyErr_SetString(MSIError, "invalid parameter"); return NULL; - case ERROR_OPEN_FAILED: - PyErr_SetString(MSIError, "open failed"); - return NULL; - case ERROR_CREATE_FAILED: - PyErr_SetString(MSIError, "create failed"); - return NULL; default: PyErr_Format(MSIError, "unknown error %x", status); return NULL; @@ -344,23 +335,12 @@ msierror(int status) return NULL; } -static PyObject* -msidb_close(msiobj* msidb, PyObject *args) -{ - int status; - if ((status = MsiCloseHandle(msidb->h)) != ERROR_SUCCESS) { - return msierror(status); - } - msidb->h = 0; - Py_RETURN_NONE; -} - /*************************** Record objects **********************/ static PyObject* record_getfieldcount(msiobj* record, PyObject* args) { - return PyLong_FromLong(MsiRecordGetFieldCount(record->h)); + return PyInt_FromLong(MsiRecordGetFieldCount(record->h)); } static PyObject* @@ -376,7 +356,7 @@ record_getinteger(msiobj* record, PyObject* args) PyErr_SetString(MSIError, "could not convert record field to integer"); return NULL; } - return PyLong_FromLong((long) status); + return PyInt_FromLong((long) status); } static PyObject* @@ -384,23 +364,23 @@ record_getstring(msiobj* record, PyObject* args) { unsigned int field; unsigned int status; - WCHAR buf[2000]; - WCHAR *res = buf; + char buf[2000]; + char *res = buf; DWORD size = sizeof(buf); PyObject* string; if (!PyArg_ParseTuple(args, "I:GetString", &field)) return NULL; - status = MsiRecordGetStringW(record->h, field, res, &size); + status = MsiRecordGetString(record->h, field, res, &size); if (status == ERROR_MORE_DATA) { - res = (WCHAR*) malloc((size + 1)*sizeof(WCHAR)); + res = (char*) malloc(size + 1); if (res == NULL) return PyErr_NoMemory(); - status = MsiRecordGetStringW(record->h, field, res, &size); + status = MsiRecordGetString(record->h, field, res, &size); } if (status != ERROR_SUCCESS) return msierror((int) status); - string = PyUnicode_FromWideChar(res, size); + string = PyString_FromString(res); if (buf != res) free(res); return string; @@ -413,7 +393,8 @@ record_cleardata(msiobj* record, PyObject *args) if (status != ERROR_SUCCESS) return msierror(status); - Py_RETURN_NONE; + Py_INCREF(Py_None); + return Py_None; } static PyObject* @@ -421,15 +402,16 @@ record_setstring(msiobj* record, PyObject *args) { int status; int field; - wchar_t *data; + char *data; - if (!PyArg_ParseTuple(args, "iu:SetString", &field, &data)) + if (!PyArg_ParseTuple(args, "is:SetString", &field, &data)) return NULL; - if ((status = MsiRecordSetStringW(record->h, field, data)) != ERROR_SUCCESS) + if ((status = MsiRecordSetString(record->h, field, data)) != ERROR_SUCCESS) return msierror(status); - Py_RETURN_NONE; + Py_INCREF(Py_None); + return Py_None; } static PyObject* @@ -437,15 +419,16 @@ record_setstream(msiobj* record, PyObject *args) { int status; int field; - wchar_t *data; + char *data; - if (!PyArg_ParseTuple(args, "iu:SetStream", &field, &data)) + if (!PyArg_ParseTuple(args, "is:SetStream", &field, &data)) return NULL; - if ((status = MsiRecordSetStreamW(record->h, field, data)) != ERROR_SUCCESS) + if ((status = MsiRecordSetStream(record->h, field, data)) != ERROR_SUCCESS) return msierror(status); - Py_RETURN_NONE; + Py_INCREF(Py_None); + return Py_None; } static PyObject* @@ -461,7 +444,8 @@ record_setinteger(msiobj* record, PyObject *args) if ((status = MsiRecordSetInteger(record->h, field, data)) != ERROR_SUCCESS) return msierror(status); - Py_RETURN_NONE; + Py_INCREF(Py_None); + return Py_None; } @@ -491,10 +475,10 @@ static PyTypeObject record_Type = { 0, /*tp_itemsize*/ /* methods */ (destructor)msiobj_dealloc, /*tp_dealloc*/ - 0, /*tp_vectorcall_offset*/ + 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_as_async*/ + 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -571,9 +555,6 @@ summary_getproperty(msiobj* si, PyObject *args) status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival, &fval, sval, &ssize); } - if (status != ERROR_SUCCESS) { - return msierror(status); - } switch(type) { case VT_I2: @@ -611,7 +592,7 @@ summary_getpropertycount(msiobj* si, PyObject *args) if (status != ERROR_SUCCESS) return msierror(status); - return PyLong_FromLong(result); + return PyInt_FromLong(result); } static PyObject* @@ -624,20 +605,12 @@ summary_setproperty(msiobj* si, PyObject *args) if (!PyArg_ParseTuple(args, "iO:SetProperty", &field, &data)) return NULL; - if (PyUnicode_Check(data)) { - const WCHAR *value = _PyUnicode_AsUnicode(data); - if (value == NULL) { - return NULL; - } - status = MsiSummaryInfoSetPropertyW(si->h, field, VT_LPSTR, - 0, NULL, value); - } else if (PyLong_CheckExact(data)) { - long value = PyLong_AsLong(data); - if (value == -1 && PyErr_Occurred()) { - return NULL; - } + if (PyString_Check(data)) { + status = MsiSummaryInfoSetProperty(si->h, field, VT_LPSTR, + 0, NULL, PyString_AsString(data)); + } else if (PyInt_Check(data)) { status = MsiSummaryInfoSetProperty(si->h, field, VT_I4, - value, NULL, NULL); + PyInt_AsLong(data), NULL, NULL); } else { PyErr_SetString(PyExc_TypeError, "unsupported type"); return NULL; @@ -646,7 +619,8 @@ summary_setproperty(msiobj* si, PyObject *args) if (status != ERROR_SUCCESS) return msierror(status); - Py_RETURN_NONE; + Py_INCREF(Py_None); + return Py_None; } @@ -658,7 +632,8 @@ summary_persist(msiobj* si, PyObject *args) status = MsiSummaryInfoPersist(si->h); if (status != ERROR_SUCCESS) return msierror(status); - Py_RETURN_NONE; + Py_INCREF(Py_None); + return Py_None; } static PyMethodDef summary_methods[] = { @@ -680,10 +655,10 @@ static PyTypeObject summary_Type = { 0, /*tp_itemsize*/ /* methods */ (destructor)msiobj_dealloc, /*tp_dealloc*/ - 0, /*tp_vectorcall_offset*/ + 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_as_async*/ + 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -741,7 +716,8 @@ view_execute(msiobj *view, PyObject*args) if (status != ERROR_SUCCESS) return msierror(status); - Py_RETURN_NONE; + Py_INCREF(Py_None); + return Py_None; } static PyObject* @@ -750,12 +726,8 @@ view_fetch(msiobj *view, PyObject*args) int status; MSIHANDLE result; - status = MsiViewFetch(view->h, &result); - if (status == ERROR_NO_MORE_ITEMS) { - Py_RETURN_NONE; - } else if (status != ERROR_SUCCESS) { + if ((status = MsiViewFetch(view->h, &result)) != ERROR_SUCCESS) return msierror(status); - } return record_new(result); } @@ -794,7 +766,8 @@ view_modify(msiobj *view, PyObject *args) if ((status = MsiViewModify(view->h, kind, ((msiobj*)data)->h)) != ERROR_SUCCESS) return msierror(status); - Py_RETURN_NONE; + Py_INCREF(Py_None); + return Py_None; } static PyObject* @@ -805,7 +778,8 @@ view_close(msiobj *view, PyObject*args) if ((status = MsiViewClose(view->h)) != ERROR_SUCCESS) return msierror(status); - Py_RETURN_NONE; + Py_INCREF(Py_None); + return Py_None; } static PyMethodDef view_methods[] = { @@ -829,10 +803,10 @@ static PyTypeObject msiview_Type = { 0, /*tp_itemsize*/ /* methods */ (destructor)msiobj_dealloc, /*tp_dealloc*/ - 0, /*tp_vectorcall_offset*/ + 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_as_async*/ + 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -900,7 +874,8 @@ msidb_commit(msiobj *msidb, PyObject *args) if ((status = MsiDatabaseCommit(msidb->h)) != ERROR_SUCCESS) return msierror(status); - Py_RETURN_NONE; + Py_INCREF(Py_None); + return Py_None; } static PyObject* @@ -935,8 +910,6 @@ static PyMethodDef db_methods[] = { PyDoc_STR("Commit() -> None\nWraps MsiDatabaseCommit")}, { "GetSummaryInformation", (PyCFunction)msidb_getsummaryinformation, METH_VARARGS, PyDoc_STR("GetSummaryInformation(updateCount) -> viewobj\nWraps MsiGetSummaryInformation")}, - { "Close", (PyCFunction)msidb_close, METH_NOARGS, - PyDoc_STR("Close() -> None\nWraps MsiCloseHandle")}, { NULL, NULL } }; @@ -947,10 +920,10 @@ static PyTypeObject msidb_Type = { 0, /*tp_itemsize*/ /* methods */ (destructor)msiobj_dealloc, /*tp_dealloc*/ - 0, /*tp_vectorcall_offset*/ + 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_as_async*/ + 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ @@ -985,8 +958,8 @@ static PyTypeObject msidb_Type = { }; #define Py_NOT_PERSIST(x, flag) \ - (x != (SIZE_T)(flag) && \ - x != ((SIZE_T)(flag) | MSIDBOPEN_PATCHFILE)) + (x != (int)(flag) && \ + x != ((int)(flag) | MSIDBOPEN_PATCHFILE)) #define Py_INVALID_PERSIST(x) \ (Py_NOT_PERSIST(x, MSIDBOPEN_READONLY) && \ @@ -1009,7 +982,7 @@ static PyObject* msiopendb(PyObject *obj, PyObject *args) behavior. */ if (Py_INVALID_PERSIST(persist)) return msierror(ERROR_INVALID_PARAMETER); - status = MsiOpenDatabase(path, (LPCSTR)(SIZE_T)persist, &h); + status = MsiOpenDatabase(path, (LPCSTR)persist, &h); if (status != ERROR_SUCCESS) return msierror(status); @@ -1053,73 +1026,59 @@ static PyMethodDef msi_methods[] = { static char msi_doc[] = "Documentation"; - -static struct PyModuleDef _msimodule = { - PyModuleDef_HEAD_INIT, - "_msi", - msi_doc, - -1, - msi_methods, - NULL, - NULL, - NULL, - NULL -}; - PyMODINIT_FUNC -PyInit__msi(void) +init_msi(void) { PyObject *m; - m = PyModule_Create(&_msimodule); + m = Py_InitModule3("_msi", msi_methods, msi_doc); if (m == NULL) - return NULL; - - PyModule_AddIntConstant(m, "MSIDBOPEN_CREATEDIRECT", (long)(SIZE_T)MSIDBOPEN_CREATEDIRECT); - PyModule_AddIntConstant(m, "MSIDBOPEN_CREATE", (long)(SIZE_T)MSIDBOPEN_CREATE); - PyModule_AddIntConstant(m, "MSIDBOPEN_DIRECT", (long)(SIZE_T)MSIDBOPEN_DIRECT); - PyModule_AddIntConstant(m, "MSIDBOPEN_READONLY", (long)(SIZE_T)MSIDBOPEN_READONLY); - PyModule_AddIntConstant(m, "MSIDBOPEN_TRANSACT", (long)(SIZE_T)MSIDBOPEN_TRANSACT); - PyModule_AddIntConstant(m, "MSIDBOPEN_PATCHFILE", (long)(SIZE_T)MSIDBOPEN_PATCHFILE); - - PyModule_AddIntMacro(m, MSICOLINFO_NAMES); - PyModule_AddIntMacro(m, MSICOLINFO_TYPES); - - PyModule_AddIntMacro(m, MSIMODIFY_SEEK); - PyModule_AddIntMacro(m, MSIMODIFY_REFRESH); - PyModule_AddIntMacro(m, MSIMODIFY_INSERT); - PyModule_AddIntMacro(m, MSIMODIFY_UPDATE); - PyModule_AddIntMacro(m, MSIMODIFY_ASSIGN); - PyModule_AddIntMacro(m, MSIMODIFY_REPLACE); - PyModule_AddIntMacro(m, MSIMODIFY_MERGE); - PyModule_AddIntMacro(m, MSIMODIFY_DELETE); - PyModule_AddIntMacro(m, MSIMODIFY_INSERT_TEMPORARY); - PyModule_AddIntMacro(m, MSIMODIFY_VALIDATE); - PyModule_AddIntMacro(m, MSIMODIFY_VALIDATE_NEW); - PyModule_AddIntMacro(m, MSIMODIFY_VALIDATE_FIELD); - PyModule_AddIntMacro(m, MSIMODIFY_VALIDATE_DELETE); - - PyModule_AddIntMacro(m, PID_CODEPAGE); - PyModule_AddIntMacro(m, PID_TITLE); - PyModule_AddIntMacro(m, PID_SUBJECT); - PyModule_AddIntMacro(m, PID_AUTHOR); - PyModule_AddIntMacro(m, PID_KEYWORDS); - PyModule_AddIntMacro(m, PID_COMMENTS); - PyModule_AddIntMacro(m, PID_TEMPLATE); - PyModule_AddIntMacro(m, PID_LASTAUTHOR); - PyModule_AddIntMacro(m, PID_REVNUMBER); - PyModule_AddIntMacro(m, PID_LASTPRINTED); - PyModule_AddIntMacro(m, PID_CREATE_DTM); - PyModule_AddIntMacro(m, PID_LASTSAVE_DTM); - PyModule_AddIntMacro(m, PID_PAGECOUNT); - PyModule_AddIntMacro(m, PID_WORDCOUNT); - PyModule_AddIntMacro(m, PID_CHARCOUNT); - PyModule_AddIntMacro(m, PID_APPNAME); - PyModule_AddIntMacro(m, PID_SECURITY); + return; + + PyModule_AddIntConstant(m, "MSIDBOPEN_CREATEDIRECT", (int)MSIDBOPEN_CREATEDIRECT); + PyModule_AddIntConstant(m, "MSIDBOPEN_CREATE", (int)MSIDBOPEN_CREATE); + PyModule_AddIntConstant(m, "MSIDBOPEN_DIRECT", (int)MSIDBOPEN_DIRECT); + PyModule_AddIntConstant(m, "MSIDBOPEN_READONLY", (int)MSIDBOPEN_READONLY); + PyModule_AddIntConstant(m, "MSIDBOPEN_TRANSACT", (int)MSIDBOPEN_TRANSACT); + PyModule_AddIntConstant(m, "MSIDBOPEN_PATCHFILE", (int)MSIDBOPEN_PATCHFILE); + + PyModule_AddIntConstant(m, "MSICOLINFO_NAMES", MSICOLINFO_NAMES); + PyModule_AddIntConstant(m, "MSICOLINFO_TYPES", MSICOLINFO_TYPES); + + PyModule_AddIntConstant(m, "MSIMODIFY_SEEK", MSIMODIFY_SEEK); + PyModule_AddIntConstant(m, "MSIMODIFY_REFRESH", MSIMODIFY_REFRESH); + PyModule_AddIntConstant(m, "MSIMODIFY_INSERT", MSIMODIFY_INSERT); + PyModule_AddIntConstant(m, "MSIMODIFY_UPDATE", MSIMODIFY_UPDATE); + PyModule_AddIntConstant(m, "MSIMODIFY_ASSIGN", MSIMODIFY_ASSIGN); + PyModule_AddIntConstant(m, "MSIMODIFY_REPLACE", MSIMODIFY_REPLACE); + PyModule_AddIntConstant(m, "MSIMODIFY_MERGE", MSIMODIFY_MERGE); + PyModule_AddIntConstant(m, "MSIMODIFY_DELETE", MSIMODIFY_DELETE); + PyModule_AddIntConstant(m, "MSIMODIFY_INSERT_TEMPORARY", MSIMODIFY_INSERT_TEMPORARY); + PyModule_AddIntConstant(m, "MSIMODIFY_VALIDATE", MSIMODIFY_VALIDATE); + PyModule_AddIntConstant(m, "MSIMODIFY_VALIDATE_NEW", MSIMODIFY_VALIDATE_NEW); + PyModule_AddIntConstant(m, "MSIMODIFY_VALIDATE_FIELD", MSIMODIFY_VALIDATE_FIELD); + PyModule_AddIntConstant(m, "MSIMODIFY_VALIDATE_DELETE", MSIMODIFY_VALIDATE_DELETE); + + PyModule_AddIntConstant(m, "PID_CODEPAGE", PID_CODEPAGE); + PyModule_AddIntConstant(m, "PID_TITLE", PID_TITLE); + PyModule_AddIntConstant(m, "PID_SUBJECT", PID_SUBJECT); + PyModule_AddIntConstant(m, "PID_AUTHOR", PID_AUTHOR); + PyModule_AddIntConstant(m, "PID_KEYWORDS", PID_KEYWORDS); + PyModule_AddIntConstant(m, "PID_COMMENTS", PID_COMMENTS); + PyModule_AddIntConstant(m, "PID_TEMPLATE", PID_TEMPLATE); + PyModule_AddIntConstant(m, "PID_LASTAUTHOR", PID_LASTAUTHOR); + PyModule_AddIntConstant(m, "PID_REVNUMBER", PID_REVNUMBER); + PyModule_AddIntConstant(m, "PID_LASTPRINTED", PID_LASTPRINTED); + PyModule_AddIntConstant(m, "PID_CREATE_DTM", PID_CREATE_DTM); + PyModule_AddIntConstant(m, "PID_LASTSAVE_DTM", PID_LASTSAVE_DTM); + PyModule_AddIntConstant(m, "PID_PAGECOUNT", PID_PAGECOUNT); + PyModule_AddIntConstant(m, "PID_WORDCOUNT", PID_WORDCOUNT); + PyModule_AddIntConstant(m, "PID_CHARCOUNT", PID_CHARCOUNT); + PyModule_AddIntConstant(m, "PID_APPNAME", PID_APPNAME); + PyModule_AddIntConstant(m, "PID_SECURITY", PID_SECURITY); MSIError = PyErr_NewException ("_msi.MSIError", NULL, NULL); if (!MSIError) - return NULL; + return; PyModule_AddObject(m, "MSIError", MSIError); - return m; } |