Index: _msi.c =================================================================== --- _msi.c (revision 66982) +++ _msi.c (working copy) @@ -481,8 +481,8 @@ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ - PyObject_GenericGetAttr,/*tp_getattro*/ - PyObject_GenericSetAttr,/*tp_setattro*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT, /*tp_flags*/ 0, /*tp_doc*/ @@ -492,7 +492,7 @@ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - record_methods, /*tp_methods*/ + record_methods, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -534,7 +534,7 @@ FILETIME fval; char sbuf[1000]; char *sval = sbuf; - DWORD ssize = sizeof(sval); + DWORD ssize = sizeof(sbuf); if (!PyArg_ParseTuple(args, "i:GetProperty", &field)) return NULL; @@ -542,7 +542,8 @@ status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival, &fval, sval, &ssize); if (status == ERROR_MORE_DATA) { - sval = malloc(ssize); + ssize++; + sval = malloc(ssize); status = MsiSummaryInfoGetProperty(si->h, field, &type, &ival, &fval, sval, &ssize); } @@ -647,8 +648,8 @@ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ - PyObject_GenericGetAttr,/*tp_getattro*/ - PyObject_GenericSetAttr,/*tp_setattro*/ + 0,/*tp_getattro*/ + 0,/*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT, /*tp_flags*/ 0, /*tp_doc*/ @@ -707,8 +708,13 @@ int status; MSIHANDLE result; - if ((status = MsiViewFetch(view->h, &result)) != ERROR_SUCCESS) - return msierror(status); + status = MsiViewFetch(view->h, &result); + if (status == ERROR_NO_MORE_ITEMS) { + Py_INCREF(Py_None); + return Py_None; + } + if (status != ERROR_SUCCESS) + return msierror(status); return record_new(result); } @@ -795,8 +801,8 @@ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ - PyObject_GenericGetAttr,/*tp_getattro*/ - PyObject_GenericSetAttr,/*tp_setattro*/ + 0,/*tp_getattro*/ + 0,/*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT, /*tp_flags*/ 0, /*tp_doc*/ @@ -912,8 +918,8 @@ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ - PyObject_GenericGetAttr,/*tp_getattro*/ - PyObject_GenericSetAttr,/*tp_setattro*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT, /*tp_flags*/ 0, /*tp_doc*/ @@ -1002,6 +1008,15 @@ if (m == NULL) return; + if (PyType_Ready(&record_Type) < 0) + return; + if (PyType_Ready(&summary_Type) < 0) + return; + if (PyType_Ready(&msidb_Type) < 0) + return; + if (PyType_Ready(&msiview_Type) < 0) + 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);