pywin32-checkins Mailing List for Python for Windows Extensions (Page 2)
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(6) |
Jul
(50) |
Aug
(11) |
Sep
(24) |
Oct
(184) |
Nov
(118) |
Dec
(22) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(31) |
Feb
(25) |
Mar
(34) |
Apr
(105) |
May
(49) |
Jun
(38) |
Jul
(39) |
Aug
(7) |
Sep
(98) |
Oct
(79) |
Nov
(20) |
Dec
(17) |
2005 |
Jan
(66) |
Feb
(32) |
Mar
(43) |
Apr
(30) |
May
(58) |
Jun
(30) |
Jul
(16) |
Aug
(4) |
Sep
(21) |
Oct
(42) |
Nov
(11) |
Dec
(14) |
2006 |
Jan
(42) |
Feb
(30) |
Mar
(22) |
Apr
(1) |
May
(9) |
Jun
(15) |
Jul
(20) |
Aug
(9) |
Sep
(8) |
Oct
(1) |
Nov
(9) |
Dec
(43) |
2007 |
Jan
(52) |
Feb
(45) |
Mar
(20) |
Apr
(12) |
May
(59) |
Jun
(39) |
Jul
(35) |
Aug
(31) |
Sep
(17) |
Oct
(20) |
Nov
(4) |
Dec
(4) |
2008 |
Jan
(28) |
Feb
(111) |
Mar
(4) |
Apr
(27) |
May
(40) |
Jun
(27) |
Jul
(32) |
Aug
(94) |
Sep
(87) |
Oct
(153) |
Nov
(336) |
Dec
(331) |
2009 |
Jan
(298) |
Feb
(127) |
Mar
(20) |
Apr
(8) |
May
|
Jun
(10) |
Jul
(6) |
Aug
|
Sep
(2) |
Oct
(2) |
Nov
|
Dec
(1) |
2010 |
Jan
(7) |
Feb
(1) |
Mar
|
Apr
|
May
(15) |
Jun
(4) |
Jul
(3) |
Aug
(28) |
Sep
(1) |
Oct
(19) |
Nov
(16) |
Dec
(6) |
2011 |
Jan
(2) |
Feb
(18) |
Mar
(17) |
Apr
(12) |
May
(5) |
Jun
(11) |
Jul
(7) |
Aug
(2) |
Sep
(2) |
Oct
(4) |
Nov
(4) |
Dec
|
2012 |
Jan
(6) |
Feb
(2) |
Mar
|
Apr
(8) |
May
(4) |
Jun
(3) |
Jul
(13) |
Aug
(27) |
Sep
(8) |
Oct
(9) |
Nov
(3) |
Dec
(2) |
2013 |
Jan
|
Feb
(1) |
Mar
(5) |
Apr
(10) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(9) |
2014 |
Jan
(2) |
Feb
(4) |
Mar
(4) |
Apr
(1) |
May
(4) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(1) |
2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
(6) |
May
(2) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
(3) |
Feb
(2) |
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: <pyw...@li...> - 2014-05-26 00:29:55
|
changeset 2e9e6d6bf4a3 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=2e9e6d6bf4a3 summary: Treat MAPI property-tags as unsigned longs. diffstat: com/win32comext/mapi/src/PyIMAPIProp.i | 4 ++-- com/win32comext/mapi/src/mapiutil.cpp | 30 +++++++++++++++--------------- 2 files changed, 17 insertions(+), 17 deletions(-) diffs (130 lines): diff -r 54ff1deffcbf -r 2e9e6d6bf4a3 com/win32comext/mapi/src/PyIMAPIProp.i --- a/com/win32comext/mapi/src/PyIMAPIProp.i Sun May 04 15:29:59 2014 +1000 +++ b/com/win32comext/mapi/src/PyIMAPIProp.i Mon May 26 10:21:01 2014 +1000 @@ -261,11 +261,11 @@ HRESULT hr; IMAPIProp *pMAPIProp; if ((pMAPIProp=GetI(self))==NULL) return NULL; - // @pyparm int|propTag||The property tag to open + // @pyparm ULONG|propTag||The property tag to open // @pyparm <o PyIID>|iid||The IID of the resulting interface. // @pyparm int|interfaceOptions||Data that relates to the interface identified by the lpiid parameter. // @pyparm int|flags||flags - if(!PyArg_ParseTuple(args,"lOll:OpenProperty",&propTag, &obIID, &interfaceOptions, &flags)) + if(!PyArg_ParseTuple(args,"kOll:OpenProperty",&propTag, &obIID, &interfaceOptions, &flags)) return NULL; // IID. if (!PyWinObject_AsIID(obIID, &iid)) diff -r 54ff1deffcbf -r 2e9e6d6bf4a3 com/win32comext/mapi/src/mapiutil.cpp --- a/com/win32comext/mapi/src/mapiutil.cpp Sun May 04 15:29:59 2014 +1000 +++ b/com/win32comext/mapi/src/mapiutil.cpp Mon May 26 10:21:01 2014 +1000 @@ -125,9 +125,9 @@ BOOL PyMAPIObject_AsSPropValue(PyObject *Valob, SPropValue *pv, void *pAllocMoreLinkBlock) { PyObject *ob; - // @pyparm int|propType||The type of the MAPI property + // @pyparm ULONG|propType||The type of the MAPI property // @pyparm object|value||The property value - if (!PyArg_ParseTuple(Valob, "lO:SPropValue item", &pv->ulPropTag, &ob )) { + if (!PyArg_ParseTuple(Valob, "kO:SPropValue item", &pv->ulPropTag, &ob )) { PyErr_Clear(); PyErr_SetString(PyExc_TypeError, "An SPropValue item must be a tuple of (integer, object)"); return NULL; @@ -514,7 +514,7 @@ PyErr_SetString(PyExc_MemoryError, "Tuple(2) for PROP result"); return NULL; } - PyTuple_SET_ITEM(rc, 0, PyInt_FromLong(pv->ulPropTag)); + PyTuple_SET_ITEM(rc, 0, PyLong_FromUnsignedLong(pv->ulPropTag)); PyTuple_SET_ITEM(rc, 1, val); return rc; } @@ -723,7 +723,7 @@ MAPIFreeBuffer(pta); return FALSE; } - pta->aulPropTag[i] = PyInt_AsLong(obItem); + pta->aulPropTag[i] = PyLong_AsUnsignedLong(obItem); if (PyErr_Occurred()) { Py_DECREF(obItem); MAPIFreeBuffer(pta); @@ -733,7 +733,7 @@ } } else { // Simple int. - pta->aulPropTag[0] = PyInt_AsLong(obta); + pta->aulPropTag[0] = PyLong_AsUnsignedLong(obta); } *ppta = pta; return TRUE; @@ -749,7 +749,7 @@ { PyObject *ret = PyTuple_New(pta->cValues); for (ULONG i=0;i<pta->cValues;i++) { - PyTuple_SET_ITEM(ret, i, PyInt_FromLong(pta->aulPropTag[i])); + PyTuple_SET_ITEM(ret, i, PyLong_FromUnsignedLong(pta->aulPropTag[i])); } return ret; } @@ -859,7 +859,7 @@ goto loop_error; if (PyInt_Check(obPropId)) { pNew->ulKind = MNID_ID; - pNew->Kind.lID = PyInt_AsLong(obPropId); + pNew->Kind.lID = PyLong_AsUnsignedLong(obPropId); } else if (PyWinObject_AsBstr(obPropId, &bstrVal)) { // Make a copy of the string pNew->ulKind = MNID_STRING; @@ -922,11 +922,11 @@ // @object PySExistRestriction| BOOL PyMAPIObject_AsSExistRestriction(PyObject *ob, SExistRestriction *pRest, void *pAllocMoreLinkBlock) { - // @pyparm int|propTag||The property ID to check for existance. + // @pyparm ULONG|propTag||The property ID to check for existance. // @pyparm int|reserved1|0| // @pyparm int|reserved2|0| pRest->ulReserved1 = pRest->ulReserved2 = 0; - if (!PyArg_ParseTuple(ob, "l|ll:SExistRestriction tuple", &pRest->ulPropTag, &pRest->ulReserved1, &pRest->ulReserved2)) + if (!PyArg_ParseTuple(ob, "k|ll:SExistRestriction tuple", &pRest->ulPropTag, &pRest->ulReserved1, &pRest->ulReserved2)) return FALSE; return TRUE; } @@ -935,10 +935,10 @@ BOOL PyMAPIObject_AsSPropertyRestriction(PyObject *ob, SPropertyRestriction *pRest, void *pAllocMoreLinkBlock) { // @pyparm int|relOp|| - // @pyparm int|propTag||The property ID. + // @pyparm ULONG|propTag||The property ID. // @pyparm <o PySPropValue>|propertyValue|| PyObject *subOb; - if (!PyArg_ParseTuple(ob, "llO:SPropertyRestriction tuple", &pRest->relop, &pRest->ulPropTag, &subOb)) + if (!PyArg_ParseTuple(ob, "lkO:SPropertyRestriction tuple", &pRest->relop, &pRest->ulPropTag, &subOb)) return FALSE; HRESULT hr; if (FAILED((hr=MAPIAllocateMore(sizeof(SPropValue), pAllocMoreLinkBlock, (void **)&pRest->lpProp)))) { @@ -953,10 +953,10 @@ BOOL PyMAPIObject_AsSContentRestriction(PyObject *ob, SContentRestriction *pRest, void *pAllocMoreLinkBlock) { // @pyparm int|fuzzyLevel|| - // @pyparm int|propTag||The property ID. + // @pyparm ULONG|propTag||The property ID. // @pyparm <o PySPropValue>|propertyValue|| PyObject *subOb; - if (!PyArg_ParseTuple(ob, "llO:SContentRestriction tuple", &pRest->ulFuzzyLevel, &pRest->ulPropTag, &subOb)) + if (!PyArg_ParseTuple(ob, "lkO:SContentRestriction tuple", &pRest->ulFuzzyLevel, &pRest->ulPropTag, &subOb)) return FALSE; HRESULT hr; if (FAILED((hr=MAPIAllocateMore(sizeof(SPropValue), pAllocMoreLinkBlock, (void **)&pRest->lpProp)))) { @@ -1037,10 +1037,10 @@ BOOL PyMAPIObject_AsSBitMaskRestriction(PyObject *ob, SBitMaskRestriction *pRest, void *pAllocMoreLinkBlock) { // @pyparm int|relBMR|| - // @pyparm int|propTag||The property ID. + // @pyparm ULONG|propTag||The property ID. // @pyparm int|ulMask|0| pRest->ulMask=0; - if (!PyArg_ParseTuple(ob, "ll|l", &pRest->relBMR, &pRest->ulPropTag, &pRest->ulMask)) + if (!PyArg_ParseTuple(ob, "lk|l", &pRest->relBMR, &pRest->ulPropTag, &pRest->ulMask)) return FALSE; return TRUE; } |
From: <pyw...@li...> - 2014-05-04 05:30:23
|
changeset f19c8ec6fa35 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=f19c8ec6fa35 summary: Build 219 changeset 54ff1deffcbf in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=54ff1deffcbf summary: Bump version to 219.5 diffstat: .hgtags | 1 + setup.py | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-) diffs (17 lines): diff -r 713ac73c22e5 -r 54ff1deffcbf .hgtags --- a/.hgtags Sat May 03 17:32:59 2014 +1000 +++ b/.hgtags Sun May 04 15:29:59 2014 +1000 @@ -51,3 +51,4 @@ ed400a27739ff3ff7a850e69f574a1ad66de6c5e b218 e97376eb14b6d95e79e01e1bf68ef8427bcbafdc b218.3 2d79b6bd94bc145f7f5a6e1c63d626737fc98e6c 218.5 +713ac73c22e54a9d727f2fa4803b8c8939b14966 b219 diff -r 713ac73c22e5 -r 54ff1deffcbf setup.py --- a/setup.py Sat May 03 17:32:59 2014 +1000 +++ b/setup.py Sun May 04 15:29:59 2014 +1000 @@ -1,4 +1,4 @@ -build_id="219" # may optionally include a ".{patchno}" suffix. +build_id="219.5" # may optionally include a ".{patchno}" suffix. # Putting buildno at the top prevents automatic __doc__ assignment, and # I *want* the build number at the top :) __doc__="""This is a distutils setup-script for the pywin32 extensions |
From: <pyw...@li...> - 2014-05-03 07:32:55
|
changeset 609dd1df35c5 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=609dd1df35c5 summary: fix a couple of build issues on earlier python versions changeset 1bf9216a6469 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=1bf9216a6469 summary: Add helper batch files used to build the world changeset 713ac73c22e5 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=713ac73c22e5 summary: Fix build problem, bump build number to 219, and more changes diffstat: CHANGES.txt | 21 +++++++++++++++++- build_all.bat | 42 ++++++++++++++++++++++++++++++++++++++ make_all.bat | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 11 +++++++-- win32/src/win32evtlog.i | 2 + 5 files changed, 125 insertions(+), 5 deletions(-) diffs (204 lines): diff -r ebe979332110 -r 713ac73c22e5 CHANGES.txt --- a/CHANGES.txt Thu May 01 14:10:35 2014 -0600 +++ b/CHANGES.txt Sat May 03 17:32:59 2014 +1000 @@ -9,7 +9,8 @@ * win32com.mapi Addded outlook interface IConverterSession with methods MIMEToMAPI, MAPIToMIMEStm, and SetAdrBook Added method OpenStreamOnFile (Nick Czeczulin) - + Ignore PT_MV_TSTRING along with PT_TSTRING (Nick Czeczulin) + * Conversions from a Python object to a variant now does a better job at deciding what variant type to use, taking into account the size and sign of the value (Stefan Schukat via patch #127) @@ -32,8 +33,18 @@ * Fix issue implementing COM objects from within a virtualenv (Kevin Smyth via issue #3597965) +* Fix some issues using decimal objects with Python 3.3 and later (rupole) + +* Add a counterpart to VB's Nothing, from patch 3609027 by Stefan Schukat + +* win32api + Handle REG_QWORD (64-bit ints) (rupole) + Add GetEnvironmentVariableW and SetEnvironmentVariableW (rupole) + Fix function pointer check for win32api.GetNativeSystemInfo (bug#665) + * win32com.shell Add interfaces IFileOperation and IFileOperationProgressSink + Add SHParseDisplayName (feature req #3585998) (rupole) * win32com.propsys Add interfaces IPropertyChange, IPropertyChangeArray, and IObjectWithPropertyKey @@ -43,11 +54,17 @@ Add functions and objects for handling certificates and certificate stores * win32gui - Add RegisterHotKey + Add RegisterHotKey (rupole) * win32evtlog Add several more Evt* functions (Vista+ event log API) +* win32prociess + Add EnumProcessModulesEx (feature request 3608155) (rupole) + +* pythonwin + Fix a hang using the tools menu + Since build 217: ---------------- * mapiutil.py GetPropTagName has been modified to return the fully qualified diff -r ebe979332110 -r 713ac73c22e5 build_all.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build_all.bat Sat May 03 17:32:59 2014 +1000 @@ -0,0 +1,42 @@ +rem Sadly Python 2.5 requires an earlier MSSDK. +set mssdk=c:\mssdk\6.0 +py -2.5 setup.py -q build +@if errorlevel 1 goto failed + +rem And the rest work with 7.1 +set mssdk=c:\mssdk\7.1 +py -2.6-32 setup.py -q build +@if errorlevel 1 goto failed +py -2.6 setup.py -q build +@if errorlevel 1 goto failed +py -2.7-32 setup.py -q build +@if errorlevel 1 goto failed +py -2.7 setup.py -q build +@if errorlevel 1 goto failed +rem py3k +py -3.1-32 setup3.py -q build +@if errorlevel 1 goto failed +py -3.1 setup3.py -q build +@if errorlevel 1 goto failed +py -3.2-32 setup3.py -q build +@if errorlevel 1 goto failed +py -3.2 setup3.py -q build +@if errorlevel 1 goto failed +py -3.3-32 setup3.py -q build +@if errorlevel 1 goto failed +py -3.3 setup3.py -q build +@if errorlevel 1 goto failed +py -3.4-32 setup3.py -q build +@if errorlevel 1 goto failed +py -3.4 setup3.py -q build +@if errorlevel 1 goto failed +py -3.5-32 setup3.py -q build +@if errorlevel 1 goto failed +py -3.5 setup3.py -q build +@if errorlevel 1 goto failed + +goto xit +:failed +@echo Oops - failed! +goto xit +:xit \ No newline at end of file diff -r ebe979332110 -r 713ac73c22e5 make_all.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make_all.bat Sat May 03 17:32:59 2014 +1000 @@ -0,0 +1,54 @@ +@if "%1"=="quick" goto quick +@if "%1"=="already_built" goto already_built +if exist build\. rm -rf build +if exist build\. goto couldnt_rm +cd autoduck +call make.bat +@if errorlevel 1 goto failed +cd .. +:quick +call build_all.bat +:already_built +rem Now the binaries. + +rem Yuck - 2to3 hackery - must nuke bdist dirs as it may hold py3x syntax. +if exist build/bdist.win32/. rm -rf build/bdist.win32 +if exist build/bdist.win-amd64/. rm -rf build/bdist.win-amd64 +py -2.7-32 setup.py -q sdist +py -2.6-32 setup.py -q bdist_wininst --target-version=2.5 --skip-build +py -2.6-32 setup.py -q bdist_wininst --target-version=2.6 --skip-build +py -2.6-32 setup.py -q bdist_wininst --target-version=2.6 --skip-build --plat-name=win-amd64 +py -2.7-32 setup.py -q bdist_wininst --target-version=2.7 --skip-build +py -2.7-32 setup.py -q bdist_wininst --target-version=2.7 --skip-build --plat-name=win-amd64 + +rem Just incase - re-nuke bdist dirs so 2to3 always runs. +if exist build/bdist.win32/. rm -rf build/bdist.win32 +if exist build/bdist.win-amd64/. rm -rf build/bdist.win-amd64 + +py -3.1-32 setup3.py -q bdist_wininst --target-version=3.1 --skip-build +py -3.1-32 setup3.py -q bdist_wininst --target-version=3.1 --skip-build --plat-name=win-amd64 + +py -3.2-32 setup3.py -q bdist_wininst --target-version=3.2 --skip-build +py -3.2-32 setup3.py -q bdist_wininst --target-version=3.2 --skip-build --plat-name=win-amd64 + +py -3.3-32 setup3.py -q bdist_wininst --target-version=3.3 --skip-build +py -3.3-32 setup3.py -q bdist_wininst --target-version=3.3 --skip-build --plat-name=win-amd64 + +py -3.4-32 setup3.py -q bdist_wininst --target-version=3.4 --skip-build +py -3.4-32 setup3.py -q bdist_wininst --target-version=3.4 --skip-build --plat-name=win-amd64 + +py -3.5-32 setup3.py -q bdist_wininst --target-version=3.5 --skip-build +py -3.5-32 setup3.py -q bdist_wininst --target-version=3.5 --skip-build --plat-name=win-amd64 + +rem And nuke the dirs one more time :) +if exist build/bdist.win32/. rm -rf build/bdist.win32 +if exist build/bdist.win-amd64/. rm -rf build/bdist.win-amd64 + +@goto xit +:couldnt_rm +@echo Could not remove the build directory! +goto xit +:failed +@echo Oops - failed! +goto xit +:xit \ No newline at end of file diff -r ebe979332110 -r 713ac73c22e5 setup.py --- a/setup.py Thu May 01 14:10:35 2014 -0600 +++ b/setup.py Sat May 03 17:32:59 2014 +1000 @@ -1,4 +1,4 @@ -build_id="218.5" # may optionally include a ".{patchno}" suffix. +build_id="219" # may optionally include a ".{patchno}" suffix. # Putting buildno at the top prevents automatic __doc__ assignment, and # I *want* the build number at the top :) __doc__="""This is a distutils setup-script for the pywin32 extensions @@ -544,9 +544,14 @@ sdk_install_dir = None libs = kw.get("libraries", "") keyname = "SOFTWARE\Microsoft\Exchange\SDK" + flags = _winreg.KEY_READ + try: + flags |= _winreg.KEY_WOW64_32KEY + except AttributeError: + pass # this version doesn't support 64 bits, so must already be using 32bit key. for root in _winreg.HKEY_LOCAL_MACHINE, _winreg.HKEY_CURRENT_USER: try: - keyob = _winreg.OpenKey(root, keyname, 0, _winreg.KEY_READ | _winreg.KEY_WOW64_32KEY) + keyob = _winreg.OpenKey(root, keyname, 0, flags) value, type_id = _winreg.QueryValueEx(keyob, "INSTALLDIR") if type_id == _winreg.REG_SZ: sdk_install_dir = value @@ -2562,7 +2567,7 @@ 'isapi/test/*.py', 'isapi/test/*.txt', 'adodbapi/*.txt', - 'adodbapi/test/*.py' + 'adodbapi/test/*.py', 'adodbapi/examples/*.py' ]) + # The headers and .lib files diff -r ebe979332110 -r 713ac73c22e5 win32/src/win32evtlog.i --- a/win32/src/win32evtlog.i Thu May 01 14:10:35 2014 -0600 +++ b/win32/src/win32evtlog.i Sat May 03 17:32:59 2014 +1000 @@ -1742,7 +1742,9 @@ #define EvtChannelPublishingConfigClockType EvtChannelPublishingConfigClockType #define EvtChannelPublishingConfigSidType EvtChannelPublishingConfigSidType #define EvtChannelPublisherList EvtChannelPublisherList +#ifdef EvtChannelPublishingConfigFileMax // this is only in SDK versions 7 and up #define EvtChannelPublishingConfigFileMax EvtChannelPublishingConfigFileMax +#endif #define EvtChannelConfigPropertyIdEND EvtChannelConfigPropertyIdEND // Login type used with EvtOpenSession |
From: <pyw...@li...> - 2014-05-01 20:12:28
|
changeset ebe979332110 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=ebe979332110 summary: upgrade adodbapi to version 2.6 diffstat: CHANGES.txt | 7 +- adodbapi/__init__.py | 57 +- adodbapi/ado_consts.py | 15 +- adodbapi/adodbapi.py | 1358 +++++++++++-------------------- adodbapi/examples/db_print.py | 90 +- adodbapi/examples/db_table_names.py | 15 +- adodbapi/examples/test.mdb | 0 adodbapi/examples/xls_read.py | 9 +- adodbapi/examples/xls_write.py | 24 +- adodbapi/readme.txt | 226 +---- adodbapi/test/adodbapitest.py | 852 ++++++++++++++----- adodbapi/test/adodbapitestconfig.py | 159 ++- adodbapi/test/dbapi20.py | 173 ++- adodbapi/test/setuptestframework.py | 113 +- adodbapi/test/test_adodbapi_dbapi20.py | 98 +- adodbapi/test/tryconnection2.py | 50 +- adodbapi/test/tryconnection3.py | 50 +- setup.py | 5 +- 18 files changed, 1738 insertions(+), 1563 deletions(-) diffs (truncated from 4638 to 300 lines): diff -r d42964909493 -r ebe979332110 CHANGES.txt --- a/CHANGES.txt Tue Apr 01 15:17:20 2014 +1100 +++ b/CHANGES.txt Thu May 01 14:10:35 2014 -0600 @@ -22,11 +22,12 @@ Unfortunately, this means that only IExchangeManageStore::CreateStoreEntryID is currently available in a 64-bit build. (Nick Czeczulin) -* adodbapi updated to version 2.4.3 -- new examples folder includes short programs for - reading and writing .xls spreadsheets and reading ACCESS .mdb files using SQL. +* adodbapi updated to version 2.6 -- new examples folder includes short programs for + reading and writing .xls spreadsheets and reading ACCESS .mdb files using SQL. New functions .is64bit.Python() and .is64bit.os() to help pick the correct drivers. New function .schema_table.names() returns a list of all tables in a database. - see adodbapi/README.txt for more information. + Ability for a Windows computer to be a database proxy for a remote (Linux or Windows) unit. + see adodbapi/README.txt for more information. * Fix issue implementing COM objects from within a virtualenv (Kevin Smyth via issue #3597965) diff -r d42964909493 -r ebe979332110 adodbapi/__init__.py --- a/adodbapi/__init__.py Tue Apr 01 15:17:20 2014 +1100 +++ b/adodbapi/__init__.py Thu May 01 14:10:35 2014 -0600 @@ -1,3 +1,56 @@ -import ado_consts -from adodbapi import * +"""adodbapi - A python DB API 2.0 (PEP 249) interface to Microsoft ADO +Copyright (C) 2002 Henrik Ekelund, version 2.1 by Vernon Cole +* http://sourceforge.net/projects/adodbapi +""" +import sys +import time + +if sys.version_info < (3,0): # in Python 2, define all symbols, just like the bad old way + from apibase import * + VariantConversionMap = MultiMap # old name. Should use apibase.MultiMap + from ado_consts import * + _makeByteBuffer = buffer +else: + # but if the user is running Python 3, then keep the dictionary clean + from .apibase import apilevel, threadsafety, paramstyle + from .apibase import Warning, Error, InterfaceError, DatabaseError, DataError, OperationalError, IntegrityError + from .apibase import InternalError, ProgrammingError, NotSupportedError, FetchFailedError + from .apibase import NUMBER, STRING, BINARY, DATETIME, ROWID + _makeByteBuffer = bytes + +from adodbapi import connect, Connection, __version__, dateconverter, Cursor + +def Binary(aString): + """This function constructs an object capable of holding a binary (long) string value. """ + return _makeByteBuffer(aString) + +def Date(year,month,day): + "This function constructs an object holding a date value. " + return dateconverter.Date(year,month,day) + +def Time(hour,minute,second): + "This function constructs an object holding a time value. " + return dateconverter.Time(hour,minute,second) + +def Timestamp(year,month,day,hour,minute,second): + "This function constructs an object holding a time stamp value. " + return dateconverter.Timestamp(year,month,day,hour,minute,second) + +def DateFromTicks(ticks): + """This function constructs an object holding a date value from the given ticks value + (number of seconds since the epoch; see the documentation of the standard Python time module for details). """ + return Date(*time.gmtime(ticks)[:3]) + +def TimeFromTicks(ticks): + """This function constructs an object holding a time value from the given ticks value + (number of seconds since the epoch; see the documentation of the standard Python time module for details). """ + return Time(*time.gmtime(ticks)[3:6]) + +def TimestampFromTicks(ticks): + """This function constructs an object holding a time stamp value from the given + ticks value (number of seconds since the epoch; + see the documentation of the standard Python time module for details). """ + return Timestamp(*time.gmtime(ticks)[:6]) + +version = 'adodbapi v' + __version__ diff -r d42964909493 -r ebe979332110 adodbapi/ado_consts.py --- a/adodbapi/ado_consts.py Tue Apr 01 15:17:20 2014 +1100 +++ b/adodbapi/ado_consts.py Thu May 01 14:10:35 2014 -0600 @@ -170,8 +170,10 @@ #adInteger 3 Indicates a four-byte signed integer (DBTYPE_I4). #adSingle 4 Indicates a single-precision floating-point value (DBTYPE_R4). #adDouble 5 Indicates a double-precision floating-point value (DBTYPE_R8). -#adCurrency 6 Indicates a currency value (DBTYPE_CY). Currency is a fixed-point number with four digits to the right of the decimal point. It is stored in an eight-byte signed integer scaled by 10,000. -#adDate 7 Indicates a date value (DBTYPE_DATE). A date is stored as a double, the whole part of which is the number of days since December 30, 1899, and the fractional part of which is the fraction of a day. +#adCurrency 6 Indicates a currency value (DBTYPE_CY). Currency is a fixed-point number +# with four digits to the right of the decimal point. It is stored in an eight-byte signed integer scaled by 10,000. +#adDate 7 Indicates a date value (DBTYPE_DATE). A date is stored as a double, the whole part of which is +# the number of days since December 30, 1899, and the fractional part of which is the fraction of a day. #adBSTR 8 Indicates a null-terminated character string (Unicode) (DBTYPE_BSTR). #adIDispatch 9 Indicates a pointer to an IDispatch interface on a COM object (DBTYPE_IDISPATCH). #adError 10 Indicates a 32-bit error code (DBTYPE_ERROR). @@ -185,12 +187,14 @@ #adUnsignedInt 19 Indicates a four-byte unsigned integer (DBTYPE_UI4). #adBigInt 20 Indicates an eight-byte signed integer (DBTYPE_I8). #adUnsignedBigInt 21 Indicates an eight-byte unsigned integer (DBTYPE_UI8). -#adFileTime 64 Indicates a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (DBTYPE_FILETIME). +#adFileTime 64 Indicates a 64-bit value representing the number of 100-nanosecond intervals since +# January 1, 1601 (DBTYPE_FILETIME). #adGUID 72 Indicates a globally unique identifier (GUID) (DBTYPE_GUID). #adBinary 128 Indicates a binary value (DBTYPE_BYTES). #adChar 129 Indicates a string value (DBTYPE_STR). #adWChar 130 Indicates a null-terminated Unicode character string (DBTYPE_WSTR). -#adNumeric 131 Indicates an exact numeric value with a fixed precision and scale (DBTYPE_NUMERIC). adUserDefined 132 Indicates a user-defined variable (DBTYPE_UDT). +#adNumeric 131 Indicates an exact numeric value with a fixed precision and scale (DBTYPE_NUMERIC). +# adUserDefined 132 Indicates a user-defined variable (DBTYPE_UDT). #adUserDefined 132 Indicates a user-defined variable (DBTYPE_UDT). #adDBDate 133 Indicates a date value (yyyymmdd) (DBTYPE_DBDATE). #adDBTime 134 Indicates a time value (hhmmss) (DBTYPE_DBTIME). @@ -204,7 +208,8 @@ #adLongVarWChar 203 Indicates a long null-terminated Unicode string value (Parameter object only). #adVarBinary 204 Indicates a binary value (Parameter object only). #adLongVarBinary 205 Indicates a long binary value (Parameter object only). -#adArray (Does not apply to ADOX.) 0x2000 A flag value, always combined with another data type constant, that indicates an array of that other data type. +#adArray (Does not apply to ADOX.) 0x2000 A flag value, always combined with another data type constant, +# that indicates an array of that other data type. # Error codes to names adoErrors= { diff -r d42964909493 -r ebe979332110 adodbapi/adodbapi.py --- a/adodbapi/adodbapi.py Tue Apr 01 15:17:20 2014 +1100 +++ b/adodbapi/adodbapi.py Thu May 01 14:10:35 2014 -0600 @@ -1,6 +1,6 @@ """adodbapi - A python DB API 2.0 (PEP 249) interface to Microsoft ADO -Copyright (C) 2002 Henrik Ekelund, version 2.1 by Vernon Cole +Copyright (C) 2002 Henrik Ekelund, versions 2.1 and later by Vernon Cole * http://sourceforge.net/projects/pywin32 * http://sourceforge.net/projects/adodbapi @@ -22,31 +22,32 @@ DB-API 2.0 specification: http://www.python.org/dev/peps/pep-0249/ -This module source should run correctly in CPython versions 2.3 and later, +This module source should run correctly in CPython versions 2.5 and later, or IronPython version 2.6 and later, or, after running through 2to3.py, CPython 3.0 or later. """ -__version__ = '2.4.3' +__version__ = '2.6.0.6' version = 'adodbapi v' + __version__ -# N.O.T.E.:... -# if you have been using an older version of adodbapi and are getting errors because -# numeric and monitary data columns are now returned as Decimal data, -# try adding the following line to get that data as strings: ... -#adodbapi.variantConversions[adodbapi.adoCurrencyTypes]=adodbapi.cvtString # get currency as strings -#adodbapi.variantConversions[adodbapi.adoExactNumericTypes]=adodbapi.cvtString import sys -import time -#import traceback -import datetime +import copy +import decimal +import os -import decimal -# or # from django.utils import _decimal as decimal +import process_connect_string +import ado_consts as adc +import apibase as api +try: + verbose = int(os.environ['ADODBAPI_VERBOSE']) +except: + verbose = False +if verbose: + print(version) -onIronPython = sys.platform == 'cli' # --- define objects to smooth out IronPython <-> CPython differences -if onIronPython: +onWin32 = False # assume the worst +if api.onIronPython: from System import Activator, Type, DBNull, DateTime, Array, Byte from System import Decimal as SystemDecimal from clr import Reference @@ -55,277 +56,65 @@ return Activator.CreateInstance(type) def getIndexedValue(obj,index): return obj.Item[index] -else: #pywin32 +else: # try pywin32 try: import win32com.client import pythoncom import pywintypes - pythoncom.__future_currency__ = True + onWin32 = True def Dispatch(dispatch): return win32com.client.Dispatch(dispatch) except ImportError: import warnings - warnings.warn("pywin32 package required but not found.",ImportWarning) + warnings.warn("pywin32 package (or IronPython) required for adodbapi.",ImportWarning) def getIndexedValue(obj,index): return obj(index) - DBNull = type(None) - DateTime = type(NotImplemented) #impossible value -import ado_consts as adc #internal to this module, use the new sub_module +try: + from collections import Mapping +except ImportError: # Python 2.5 + Mapping = dict # this will handle the most common case # --- define objects to smooth out Python3000 <-> Python 2.x differences unicodeType = unicode #this line will be altered by 2to3.py to '= str' longType = long #this line will be altered by 2to3.py to '= int' -if sys.version[0] >= '3': #python 3.x +if sys.version_info >= (3,0): #python 3.x StringTypes = str - makeByteBuffer = bytes - memoryViewType = memoryview - _BaseException = Exception + maxint = sys.maxsize else: #python 2.x - from exceptions import StandardError as _BaseException - memoryViewType = type(buffer('')) - makeByteBuffer = buffer - try: #jdhardy -- handle bytes under IronPython - bytes - except NameError: - bytes = str StringTypes = (str,unicode) # will be messed up by 2to3 but never used - from ado_consts import * #define old way of getting constants (for callers) - -def standardErrorHandler(connection,cursor,errorclass,errorvalue): - err = (errorclass,errorvalue) - connection.messages.append(err) - if cursor is not None: - cursor.messages.append(err) - raise errorclass(errorvalue) - -# ----- Time converters ---------------------------------------------- - -# all purpose date to ISO format converter -def _dateObjectToIsoFormatString(obj): - if isinstance(obj, datetime.datetime): - s = obj.strftime('%Y-%m-%d %H:%M:%S') - elif isinstance(obj, datetime.date): #exact midnight - s = obj.strftime('%Y-%m-%d 00:00:00') - elif isinstance(obj, time.struct_time): - s = time.strftime('%Y-%m-%d %H:%M:%S',obj) - else: - try: #usually datetime.datetime - s = obj.isoformat() - except: #but may be mxdatetime - s = obj.Format('%Y-%m-%d %H:%M:%S') - return s - -class TimeConverter(object): # this is a generic time converter skeleton - def __init__(self): # the details will be filled in by instances - self._ordinal_1899_12_31=datetime.date(1899,12,31).toordinal()-1 - #Use self.types to compare if an input parameter is a datetime - self.types = (type(self.Date(2000,1,1)), - type(self.Time(12,1,1)), - type(self.Timestamp(2000,1,1,12,1,1))) - def COMDate(self,obj): - 'Returns a ComDate from a datetime in inputformat' - raise NotImplementedError #"Abstract class" - def DateObjectFromCOMDate(self,comDate): - 'Returns an object of the wanted type from a ComDate' - raise NotImplementedError #"Abstract class" - def Date(self,year,month,day): - "This function constructs an object holding a date value. " - raise NotImplementedError #"Abstract class" - def Time(self,hour,minute,second): - "This function constructs an object holding a time value. " - raise NotImplementedError #"Abstract class" - def Timestamp(self,year,month,day,hour,minute,second): - "This function constructs an object holding a time stamp value. " - raise NotImplementedError #"Abstract class" - def DateObjectToIsoFormatString(self,obj): - "This function should return a string in the format 'YYYY-MM-dd HH:MM:SS:ms' (ms optional) " - raise NotImplementedError #"Abstract class" - -# -- Optional: if mx extensions are installed you may use mxDateTime ---- -try: - import mx.DateTime - mxDateTime = True -# to change the default time converter, use something like: -# adodbapi.adodbapi.dateconverter = adodbapi.mxDateTimeConverter() -except: - mxDateTime = False -if mxDateTime: - class mxDateTimeConverter(TimeConverter): # used optionally if - def COMDate(self,obj): - return obj.COMDate() - def DateObjectFromCOMDate(self,comDate): - return mx.DateTime.DateTimeFromCOMDate(comDate) - def DateObjectFromCOMDate(self,comDate): - return mx.DateTime.DateTimeFromCOMDate(comDate) - def Date(self,year,month,day): |
From: <pyw...@li...> - 2014-04-01 04:17:26
|
changeset d42964909493 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=d42964909493 summary: Prevent pythonwin hanging when configuring the Tools menu in View->Options diffstat: Pythonwin/pywin/framework/toolmenu.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diffs (15 lines): diff -r 50ddf812a6d7 -r d42964909493 Pythonwin/pywin/framework/toolmenu.py --- a/Pythonwin/pywin/framework/toolmenu.py Mon Mar 03 09:22:38 2014 -0500 +++ b/Pythonwin/pywin/framework/toolmenu.py Tue Apr 01 15:17:20 2014 +1100 @@ -177,7 +177,10 @@ itemLook = 0 while 1: try: - items.append( ( self.listControl.GetItemText(itemLook, 0), self.listControl.GetItemText(itemLook, 1) ) ) + text = self.listControl.GetItemText(itemLook, 0); + if not text: + break + items.append( (text, self.listControl.GetItemText(itemLook, 1)) ) except win32ui.error: # no more items! break |
From: <pyw...@li...> - 2014-03-03 14:23:34
|
changeset 50ddf812a6d7 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=50ddf812a6d7 summary: More source and header files missing from source dist diffstat: MANIFEST.in | 4 ++++ com/win32comext/shell/src/shell.cpp | 2 +- setup.py | 1 + 3 files changed, 6 insertions(+), 1 deletions(-) diffs (44 lines): diff -r 7d1d77ba3759 -r 50ddf812a6d7 MANIFEST.in --- a/MANIFEST.in Sun Mar 02 18:37:14 2014 -0500 +++ b/MANIFEST.in Mon Mar 03 09:22:38 2014 -0500 @@ -28,6 +28,9 @@ include win32/src/*.manifest include win32/src/PerfMon/perfmondata.def include win32/src/PerfMon/*.h +include win32/src/win32crypt/*.h +include win32/src/win32net/*.h +include win32/src/win32wnet/*.h include win32/License.txt # COM include com/pythoncom.py @@ -74,6 +77,7 @@ include com/win32comext/mapi/src/*.h include com/win32comext/mapi/demos/*.py include com/win32comext/propsys/test/*.py +include com/win32comext/propsys/src/*.h include com/win32comext/shell/src/*.h include com/win32comext/shell/demos/servers/*.py include com/win32comext/shell/demos/servers/*.propdesc diff -r 7d1d77ba3759 -r 50ddf812a6d7 com/win32comext/shell/src/shell.cpp --- a/com/win32comext/shell/src/shell.cpp Sun Mar 02 18:37:14 2014 -0500 +++ b/com/win32comext/shell/src/shell.cpp Mon Mar 03 09:22:38 2014 -0500 @@ -3650,7 +3650,7 @@ PYCOM_INTERFACE_FULL(RelatedItem), PYCOM_INTERFACE_FULL(TransferMediumItem), // based on IRelatedItem with no extra methods PYCOM_INTERFACE_FULL(CurrentItem), // based on IRelatedItem with no extra methods - PYCOM_INTERFACE_FULL(CurrentItem), // based on IRelatedItem with no extra methods + PYCOM_INTERFACE_FULL(DisplayItem), // based on IRelatedItem with no extra methods PYCOM_INTERFACE_FULL(IdentityName), // based on IRelatedItem with no extra methods // These require Windows 7 SDK to build #if WINVER >= 0x0601 diff -r 7d1d77ba3759 -r 50ddf812a6d7 setup.py --- a/setup.py Sun Mar 02 18:37:14 2014 -0500 +++ b/setup.py Mon Mar 03 09:22:38 2014 -0500 @@ -1984,6 +1984,7 @@ %(shell)s/PyICustomDestinationList.cpp %(shell)s/PyIDefaultExtractIconInit.cpp %(shell)s/PyIDeskBand.cpp + %(shell)s/PyIDisplayItem.cpp %(shell)s/PyIDockingWindow.cpp %(shell)s/PyIDropTargetHelper.cpp %(shell)s/PyIEnumExplorerCommand.cpp |
From: <pyw...@li...> - 2014-03-02 23:41:29
|
changeset 7d1d77ba3759 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=7d1d77ba3759 summary: Include perfmon headers in source dist (??? not sure how they were getting included before ???) diffstat: MANIFEST.in | 4 ++-- setup.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diffs (31 lines): diff -r 35899562c52e -r 7d1d77ba3759 MANIFEST.in --- a/MANIFEST.in Sat Mar 01 12:36:39 2014 -0500 +++ b/MANIFEST.in Sun Mar 02 18:37:14 2014 -0500 @@ -27,11 +27,11 @@ include win32/src/*.h include win32/src/*.manifest include win32/src/PerfMon/perfmondata.def -include win32/*.dsp +include win32/src/PerfMon/*.h include win32/License.txt # COM include com/pythoncom.py -include com/win32com/src/*.h +include com/win32com/src/include/*.h include com/win32com/src/PythonCOM.def include com/win32com/src/PythonCOMLoader.def include com/win32com/src/PythonCOMLoader.cpp diff -r 35899562c52e -r 7d1d77ba3759 setup.py --- a/setup.py Sat Mar 01 12:36:39 2014 -0500 +++ b/setup.py Sun Mar 02 18:37:14 2014 -0500 @@ -1559,6 +1559,10 @@ unicode_mode=True, export_symbol_file = "win32/src/PerfMon/perfmondata.def", is_regular_dll = 1, + depends = [ + "win32/src/PerfMon/perfutil.h", + "win32/src/PerfMon/PyPerfMonControl.h", + ], ), ) |
From: <pyw...@li...> - 2014-03-01 17:37:28
|
changeset 35899562c52e in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=35899562c52e summary: More autoduck improvements for win32event diffstat: win32/src/win32event.i | 42 +++++++++++++++++++++--------------------- 1 files changed, 21 insertions(+), 21 deletions(-) diffs (131 lines): diff -r a3d246d1a182 -r 35899562c52e win32/src/win32event.i --- a/win32/src/win32event.i Fri Feb 28 22:48:22 2014 -0500 +++ b/win32/src/win32event.i Sat Mar 01 12:36:39 2014 -0500 @@ -98,18 +98,18 @@ // @pyswig <o PyHANDLE>|CreateEvent|Creates a waitable event // @rdesc The result is a handle to the created object PyHANDLE CreateEvent( - SECURITY_ATTRIBUTES *inNullSA, // @pyparm <o PySECURITY_ATTRIBUTES>|sa||The security attributes, or None - BOOL bManualReset, // @pyparm int|bManualReset||flag for manual-reset event - BOOL bInitialState, // @pyparm int|bInitialState||flag for initial state - TCHAR *INPUT_NULLOK // @pyparm <o PyIUnicode>|objectName||event-object name, or None + SECURITY_ATTRIBUTES *inNullSA, // @pyparm <o PySECURITY_ATTRIBUTES>|EventAttributes||The security attributes, or None + BOOL bManualReset, // @pyparm bool|bManualReset||flag for manual-reset event + BOOL bInitialState, // @pyparm bool|bInitialState||flag for initial state + TCHAR *INPUT_NULLOK // @pyparm <o PyUnicode>|Name||event-object name, or None ); // @pyswig <o PyHANDLE>|CreateMutex|Creates a mutex // @rdesc The result is a handle to the created object PyHANDLE CreateMutex( - SECURITY_ATTRIBUTES *inNullSA, // @pyparm object|securityAttributes||Placeholder for furture security object, or None - BOOL bInitialOwner, // @pyparm int|bInitialOwner||flag for initial ownership - TCHAR * INPUT_NULLOK // @pyparm <o PyIUnicode>|mutexName||mutex-object name, or None + SECURITY_ATTRIBUTES *inNullSA, // @pyparm <o PySECURITY_ATTRIBUTES>|MutexAttributes||Specifies inheritance and security descriptor for object, or None for defaults + BOOL bInitialOwner, // @pyparm bool|InitialOwner||flag for initial ownership + TCHAR * INPUT_NULLOK // @pyparm <o PyUnicode>|Name||Mutex-object name, or None ); #ifndef MS_WINCE @@ -119,7 +119,7 @@ PyHANDLE CreateSemaphore( SECURITY_ATTRIBUTES *SemaphoreAttributes, // @pyparm <o PySECURITY_ATTRIBUTES>|SemaphoreAttributes||Specifies inheritance and security descriptor for object, or None for defaults LONG lInitialCount, // @pyparm int|InitialCount||Initial count - LONG lMaximumCount, // @pyparm int|Maximum count||Maximum count + LONG lMaximumCount, // @pyparm int|MaximumCount||Maximum count TCHAR * INPUT_NULLOK // @pyparm str|SemaphoreName||Semaphore-object name, or None ); @@ -128,7 +128,7 @@ // @pyseeapi CreateWaitableTimer PyHANDLE CreateWaitableTimer( SECURITY_ATTRIBUTES *TimerAttributes, // @pyparm <o PySECURITY_ATTRIBUTES>|TimerAttributes||Specifies inheritance and security descriptor for object, or None for defaults - BOOL bManualReset, // @pyparm bool|ManualReset||True for manual reset timer, or False to create a synchronization time + BOOL bManualReset, // @pyparm bool|ManualReset||True for manual reset timer, or False to create a synchronization timer TCHAR * INPUT_NULLOK // @pyparm str|TimerName||Timer object name, or None ); #endif // MS_WINCE @@ -172,7 +172,7 @@ // @pyswig int|MsgWaitForMultipleObjects|Returns when a message arrives of an event is signalled %name(MsgWaitForMultipleObjects) PyObject *MyMsgWaitForMultipleObjects( PyObject *obHandleList, // @pyparm [<o PyHANDLE>, ...]|handleList||A sequence of handles to wait on. - BOOL bWaitAll, // @pyparm int|bWaitAll||If true, waits for all handles in the list. + BOOL bWaitAll, // @pyparm bool|bWaitAll||If true, waits for all handles in the list. DWORD dwMilliseconds, // @pyparm int|milliseconds||time-out interval in milliseconds DWORD dwWakeMask // @pyparm int|wakeMask||type of input events to wait for. One of the win32event.QS_ constants. // @comm Note that if bWaitAll is TRUE, the function will return when there is input in the queue, @@ -246,29 +246,29 @@ // @pyswig <o PyHANDLE>|OpenEvent|Returns a handle of an existing named event object. PyHANDLE OpenEvent( DWORD dwDesiredAccess, // @pyparm int|desiredAccess||access flag - one of <om win32event.EVENT_ALL_ACCESS>, <om win32event.EVENT_MODIFY_STATE>, or (NT only) <om win32event.SYNCHRONIZE> - BOOL bInheritHandle, // @pyparm int|bInheritHandle||inherit flag + BOOL bInheritHandle, // @pyparm bool|bInheritHandle||inherit flag TCHAR *lpName // @pyparm <o PyUnicode>|name||name of event to open. ); // @pyswig <o PyHANDLE>|OpenMutex|Returns a handle of an existing named mutex object. PyHANDLE OpenMutex( DWORD dwDesiredAccess, // @pyparm int|desiredAccess||access flag - BOOL bInheritHandle, // @pyparm int|bInheritHandle||inherit flag + BOOL bInheritHandle, // @pyparm bool|bInheritHandle||inherit flag TCHAR *lpName // @pyparm <o PyUnicode>|name||name of mutex to open. ); // @pyswig <o PyHANDLE>|OpenSemaphore|Returns a handle of an existing named semaphore object. PyHANDLE OpenSemaphore( DWORD dwDesiredAccess, // @pyparm int|desiredAccess||access flag - BOOL bInheritHandle, // @pyparm int|bInheritHandle||inherit flag + BOOL bInheritHandle, // @pyparm bool|bInheritHandle||inherit flag TCHAR *lpName // @pyparm <o PyUnicode>|name||name of semaphore to open. ); -//@pyswig handle|OpenWaitableTimer|Opens an existing named waitable timer object +//@pyswig <o PyHANDLE>|OpenWaitableTimer|Opens an existing named waitable timer object PyHANDLE OpenWaitableTimer( DWORD dwDesiredAccess, // @pyparm int|desiredAccess||access flag - BOOL bInheritHandle, // @pyparm int|bInheritHandle||inherit flag - TCHAR *lpTimerName // @pyparm string|timerName||pointer to timer object name + BOOL bInheritHandle, // @pyparm bool|bInheritHandle||inherit flag + TCHAR *lpTimerName // @pyparm str|timerName||pointer to timer object name ); #endif /* MS_WINCE */ @@ -306,7 +306,7 @@ #ifndef MS_WINCE // @pyswig |SetWaitableTimer|Sets a waitable timer. BOOLAPI SetWaitableTimer( - PyHANDLE hTimer, // @pyparm int|handle||handle to timer + PyHANDLE hTimer, // @pyparm <o PyHANDLE>|handle||handle to timer LARGE_INTEGER *INPUT, // @pyparm long|dueTime||timer due time long lPeriod, // @pyparm int|period||timer interval PTIMERAPCROUTINE pfnCompletionRoutine, // @pyparm object|func||completion routine - must be None @@ -349,7 +349,7 @@ // @pyswig int|WaitForMultipleObjects|Returns when an event is signalled %name(WaitForMultipleObjects) PyObject *MyWaitForMultipleObjects( PyObject *handleList, // @pyparm [<o PyHANDLE>, ...]|handleList||A sequence of handles to wait on. - BOOL bWaitAll, // @pyparm int|bWaitAll||wait flag + BOOL bWaitAll, // @pyparm bool|bWaitAll||wait flag DWORD dwMilliseconds // @pyparm int|milliseconds||time-out interval in milliseconds ); @@ -382,9 +382,9 @@ // @pyswig int|WaitForMultipleObjectsEx|Returns when an event is signalled %name(WaitForMultipleObjectsEx) PyObject *MyWaitForMultipleObjectsEx( PyObject *handleList, // @pyparm [<o PyHANDLE>, ...]|handleList||A sequence of handles to wait on. - BOOL bWaitAll, // @pyparm int|bWaitAll||wait flag + BOOL bWaitAll, // @pyparm bool|bWaitAll||wait flag DWORD dwMilliseconds, // @pyparm int|milliseconds||time-out interval in milliseconds - BOOL bAlertable // @pyparm int|bAlertable||alertable wait flag. + BOOL bAlertable // @pyparm bool|bAlertable||alertable wait flag. ); #endif %typedef DWORD DWORD_WAITAPI @@ -415,7 +415,7 @@ DWORD_WAITAPI WaitForSingleObjectEx( PyHANDLE hHandle, // @pyparm <o PyHANDLE>|hHandle||handle of object to wait for DWORD dwMilliseconds, // @pyparm int|milliseconds||time-out interval in milliseconds - BOOL bAlertable // @pyparm int|bAlertable||alertable wait flag. + BOOL bAlertable // @pyparm bool|bAlertable||alertable wait flag. ); // @rdesc See <om win32event.WaitForSingleObject> for return values. #endif /* MS_WINCE */ |
From: <pyw...@li...> - 2014-03-01 03:49:12
|
changeset a3d246d1a182 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=a3d246d1a182 summary: Fix autoduck for CreateSemaphore and CreateWaitableTimer, and link for MSDN search diffstat: AutoDuck/pyhtml.fmt | 2 +- win32/src/win32event.i | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diffs (52 lines): diff -r 33f1f89d5c5f -r a3d246d1a182 AutoDuck/pyhtml.fmt --- a/AutoDuck/pyhtml.fmt Fri Feb 21 14:23:40 2014 -0500 +++ b/AutoDuck/pyhtml.fmt Fri Feb 28 22:48:22 2014 -0500 @@ -471,7 +471,7 @@ .tag=pyseeapi, html, 1, 1 .pre=$(rmh)Win32 API References$(rmhe)$(par) -.format=$(term1)Search for <i>$1</i> at <a href="http://search.msdn.microsoft.com/search/results.aspx?view=msdn&qu=$1" target="_blank">msdn</a>, <a href="http://www.google.com/search?q=$1" target="_blank">google</a> or <a href="http://groups.google.com/groups?q=$1" target="_blank">google groups</a>.$(par) +.format=$(term1)Search for <i>$1</i> at <a href="http://search.msdn.microsoft.com/search/results.aspx?view=msdn&query=$1" target="_blank">msdn</a>, <a href="http://www.google.com/search?q=$1" target="_blank">google</a> or <a href="http://groups.google.com/groups?q=$1" target="_blank">google groups</a>.$(par) .tag=pyundocmfc, html, 2, 1 .pre=$(rmh)Undocumented MFC References$(par) diff -r 33f1f89d5c5f -r a3d246d1a182 win32/src/win32event.i --- a/win32/src/win32event.i Fri Feb 21 14:23:40 2014 -0500 +++ b/win32/src/win32event.i Fri Feb 28 22:48:22 2014 -0500 @@ -113,23 +113,26 @@ ); #ifndef MS_WINCE -// @pyswig <o PyHANDLE>|CreateSemaphore|Creates a Semaphore -// @rdesc The result is a handle to the created object +// @pyswig <o PyHANDLE>|CreateSemaphore|Creates a semaphore, or opens an existing one +// @rdesc The result is a handle to the object +// @pyseeapi CreateSemaphore PyHANDLE CreateSemaphore( - SECURITY_ATTRIBUTES *inNullSA, // lpSemaphoreAttributes, // @pyparm object|securityAttributes||Placeholder for furture security object, or None - LONG lInitialCount, // @pyparm int|initialCount||initial count - LONG lMaximumCount, // maximum count - TCHAR * INPUT_NULLOK // @pyparm <o PyIUnicode>|semaphoreName||semaphore-object name, or None + SECURITY_ATTRIBUTES *SemaphoreAttributes, // @pyparm <o PySECURITY_ATTRIBUTES>|SemaphoreAttributes||Specifies inheritance and security descriptor for object, or None for defaults + LONG lInitialCount, // @pyparm int|InitialCount||Initial count + LONG lMaximumCount, // @pyparm int|Maximum count||Maximum count + TCHAR * INPUT_NULLOK // @pyparm str|SemaphoreName||Semaphore-object name, or None ); +// @pyswig <o PyHANDLE>|CreateWaitableTimer|Creates a waitable timer, or opens an existing one +// @rdesc The result is a handle to the object +// @pyseeapi CreateWaitableTimer PyHANDLE CreateWaitableTimer( - SECURITY_ATTRIBUTES *inNullSA, // lpTimerAttributes, // pointer to security attributes - BOOL bManualReset, // @pyparm int|bManualReset||flag for manual reset state - TCHAR * INPUT_NULLOK // pointer to timer object name + SECURITY_ATTRIBUTES *TimerAttributes, // @pyparm <o PySECURITY_ATTRIBUTES>|TimerAttributes||Specifies inheritance and security descriptor for object, or None for defaults + BOOL bManualReset, // @pyparm bool|ManualReset||True for manual reset timer, or False to create a synchronization time + TCHAR * INPUT_NULLOK // @pyparm str|TimerName||Timer object name, or None ); #endif // MS_WINCE -// GetOverlappedResult %{ static BOOL MakeHandleList(PyObject *handleList, HANDLE **ppBuf, DWORD *pNumEntries) |
From: <pyw...@li...> - 2014-02-21 19:24:15
|
changeset 33f1f89d5c5f in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=33f1f89d5c5f summary: Add some newer flags for IContextMenu.QueryContextMenu diffstat: com/win32comext/shell/shellcon.py | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diffs (29 lines): diff -r 110353b433cd -r 33f1f89d5c5f com/win32comext/shell/shellcon.py --- a/com/win32comext/shell/shellcon.py Fri Feb 14 17:59:46 2014 -0500 +++ b/com/win32comext/shell/shellcon.py Fri Feb 21 14:23:40 2014 -0500 @@ -128,7 +128,7 @@ PRINTACTION_DOCUMENTDEFAULTS = 6 PRINTACTION_SERVERPROPERTIES = 7 - +# Flags used with IContextMenu.QueryContextMenu CMF_NORMAL = 0 CMF_DEFAULTONLY = 1 CMF_VERBSONLY = 2 @@ -137,7 +137,15 @@ CMF_CANRENAME = 16 CMF_NODEFAULT = 32 CMF_INCLUDESTATIC = 64 -CMF_RESERVED = -65536 +CMF_ITEMMENU = 128 +CMF_EXTENDEDVERBS = 256 +CMF_DISABLEDVERBS = 512 +CMF_ASYNCVERBSTATE = 1024 +CMF_OPTIMIZEFORINVOKE = 2048 +CMF_SYNCCASCADEMENU = 4096 +CMF_DONOTPICKDEFAULT = 8192 +CMF_RESERVED = 4294901760 # 0xffff0000 + GCS_VERBA = 0 GCS_HELPTEXTA = 1 GCS_VALIDATEA = 2 |
From: <pyw...@li...> - 2014-02-14 23:00:50
|
changeset 110353b433cd in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=110353b433cd summary: Fix function pointer check for win32api.GetNativeSystemInfo (bug#665) diffstat: win32/src/win32apimodule.cpp | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r c91327b31256 -r 110353b433cd win32/src/win32apimodule.cpp --- a/win32/src/win32apimodule.cpp Fri Feb 14 17:45:08 2014 -0500 +++ b/win32/src/win32apimodule.cpp Fri Feb 14 17:59:46 2014 -0500 @@ -2266,7 +2266,7 @@ static PyObject * PyGetNativeSystemInfo(PyObject * self, PyObject * args) { - CHECK_PFN(SetSystemPowerState); + CHECK_PFN(GetNativeSystemInfo); if (!PyArg_ParseTuple(args, ":GetNativeSystemInfo")) return NULL; // @pyseeapi GetNativeSystemInfo |
From: <pyw...@li...> - 2014-02-14 22:48:29
|
changeset c91327b31256 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=c91327b31256 summary: Add a comment about IPV6 client addresses from bug#664 diffstat: win32/src/win32tsmodule.cpp | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diffs (12 lines): diff -r 31014eee4df2 -r c91327b31256 win32/src/win32tsmodule.cpp --- a/win32/src/win32tsmodule.cpp Fri Feb 14 17:29:03 2014 -0500 +++ b/win32/src/win32tsmodule.cpp Fri Feb 14 17:45:08 2014 -0500 @@ -393,6 +393,8 @@ break; } case WTSClientAddress:{ // @flag WTSClientAddress|Dict containing type and value of client's IP address (None if console session) + // IPV6 addresses may not be returned correctly on Windows versions earlier than Windows Server 2012 + // (see http://sourceforge.net/p/pywin32/bugs/664/ for details) PyObject *obaddress; size_t address_cnt, address_ind; WTS_CLIENT_ADDRESS *wca=(WTS_CLIENT_ADDRESS *)buf; |
From: <pyw...@li...> - 2014-02-14 22:31:18
|
changeset 31014eee4df2 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=31014eee4df2 summary: Add GetEnvironmentVariableW and SetEnvironmentVariableW diffstat: win32/src/win32apimodule.cpp | 101 ++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 95 insertions(+), 6 deletions(-) diffs (164 lines): diff -r e2cdf93c66b5 -r 31014eee4df2 win32/src/win32apimodule.cpp --- a/win32/src/win32apimodule.cpp Sat Jan 25 14:43:34 2014 +1100 +++ b/win32/src/win32apimodule.cpp Fri Feb 14 17:29:03 2014 -0500 @@ -388,21 +388,22 @@ return Py_None; } -// @pymethod string|win32api|GetEnvironmentVariable|Retrieves the value of an environment variable. -// @comm Returns None if environment variable is not found +// @pymethod str|win32api|GetEnvironmentVariable|Retrieves the value of an environment variable. +// @rdesc Returns None if environment variable is not found static PyObject * PyGetEnvironmentVariable( PyObject *self, PyObject *args ) { TCHAR *szVar; PyObject *obVar, *ret=NULL; if (!PyArg_ParseTuple(args, "O:GetEnvironmentVariable", - &obVar)) // @pyparm string|variable||The variable to get + &obVar)) // @pyparm str|variable||The variable to get return NULL; if (!PyWinObject_AsTCHAR(obVar, &szVar, FALSE)) return NULL; // @pyseeapi GetEnvironmentVariable PyW32_BEGIN_ALLOW_THREADS DWORD size = GetEnvironmentVariable(szVar, NULL, 0); + PyW32_END_ALLOW_THREADS TCHAR *pResult = NULL; if (!size){ Py_INCREF(Py_None); @@ -411,13 +412,14 @@ else{ pResult = (TCHAR *)malloc(sizeof(TCHAR) * size); if (pResult==NULL) - PyErr_NoMemory(); // ??? does this need to hold thread lock ??? + PyErr_NoMemory(); else{ + PyW32_BEGIN_ALLOW_THREADS GetEnvironmentVariable(szVar, pResult, size); + PyW32_END_ALLOW_THREADS ret = PyWinObject_FromTCHAR(pResult); } } - PyW32_END_ALLOW_THREADS PyWinObject_FreeTCHAR(szVar); if (pResult) @@ -425,6 +427,60 @@ return ret; } +// @pymethod <o PyUnicode>|win32api|GetEnvironmentVariableW|Retrieves the unicode value of an environment variable. +// @rdesc Returns None if environment variable is not found +// @pyseeapi GetEnvironmentVariableW +static PyObject * +PyGetEnvironmentVariableW( PyObject *self, PyObject *args ) +{ + TmpWCHAR Name; + PyObject *obName; + if (!PyArg_ParseTuple(args, "O:GetEnvironmentVariableW", + &obName)) // @pyparm str|Name||The variable to retrieve + return NULL; + if (!PyWinObject_AsWCHAR(obName, &Name)) + return NULL; + + DWORD returned_size, allocated_size = 0; + WCHAR *pResult = NULL; + PyObject *ret = NULL; + // Call in loop to account for race condition where env var is changed between calls + while(TRUE){ + if (pResult) + free(pResult); + if (allocated_size){ + // returned_size includes NULL terminator + pResult = (WCHAR *)malloc(allocated_size * sizeof(WCHAR)); + if (pResult == NULL){ + PyErr_NoMemory(); + break; + } + } + Py_BEGIN_ALLOW_THREADS + returned_size = GetEnvironmentVariableW(Name, pResult, allocated_size); + Py_END_ALLOW_THREADS + if (!returned_size){ + DWORD err = GetLastError(); + if (err == ERROR_ENVVAR_NOT_FOUND){ + Py_INCREF(Py_None); + ret = Py_None; + } + else + PyWin_SetAPIError("GetEnvironmentVariableW", err); + break; + } + // Var may have been changed between calls, check that value still fits in buffer + if (returned_size < allocated_size){ + ret = PyWinObject_FromWCHAR(pResult, returned_size); + break; + } + allocated_size = returned_size; + } + if (pResult) + free(pResult); + return ret; +} + // @pymethod |win32api|SetEnvironmentVariable|Creates, deletes, or changes the value of an environment variable. static PyObject * PySetEnvironmentVariable(PyObject *self, PyObject *args) @@ -450,6 +506,27 @@ return ret; } +// @pymethod |win32api|SetEnvironmentVariableW|Creates, deletes, or changes the value of an environment variable. +static PyObject * +PySetEnvironmentVariableW(PyObject *self, PyObject *args) +{ + TmpWCHAR Name, Value; + PyObject *obName, *obValue; + if (!PyArg_ParseTuple(args, "OO:SetEnvironmentVariableW", + &obName, // @pyparm str|Name||Name of the environment variable + &obValue)) // @pyparm str|Value||Value to be set, or None to remove variable + return NULL; + // @pyseeapi SetEnvironmentVariable + if (!PyWinObject_AsWCHAR(obName, &Name)) + return NULL; + if (!PyWinObject_AsWCHAR(obValue, &Value, TRUE)) + return NULL; + if (!SetEnvironmentVariableW(Name, Value)) + return PyWin_SetAPIError("SetEnvironmentVariableW"); + Py_INCREF(Py_None); + return Py_None; +} + // @pymethod string|win32api|ExpandEnvironmentStrings|Expands environment-variable strings and replaces them with their defined values. static PyObject * PyExpandEnvironmentStrings( PyObject *self, PyObject *args ) @@ -6333,7 +6410,13 @@ {"GetDiskFreeSpaceEx", PyGetDiskFreeSpaceEx, 1}, // @pymeth GetDiskFreeSpaceEx|Retrieves information about a disk. {"GetDllDirectory", PyGetDllDirectory, METH_NOARGS}, // @pymeth GetDllDirectory|Retrieves the DLL search path {"GetDomainName", PyGetDomainName, 1}, // @pymeth GetDomainName|Returns the current domain name - {"GetEnvironmentVariable", PyGetEnvironmentVariable, 1}, // @pymeth GetEnvironmentVariable|Retrieves the value of an environment variable. + // @pymeth GetEnvironmentVariable|Retrieves the value of an environment variable. +#ifdef UNICODE + {"GetEnvironmentVariable", PyGetEnvironmentVariableW, 1}, +#else + {"GetEnvironmentVariable", PyGetEnvironmentVariable, 1}, +#endif + {"GetEnvironmentVariableW", PyGetEnvironmentVariableW, 1}, // @pymeth GetEnvironmentVariableW|Retrieves the value of an environment variable. {"GetFileAttributes", PyGetFileAttributes,1}, // @pymeth GetFileAttributes|Retrieves the attributes for the named file. {"GetFileVersionInfo", PyGetFileVersionInfo, 1}, //@pymeth GetFileVersionInfo|Retrieves string version info {"GetFocus", PyGetFocus, 1}, // @pymeth GetFocus|Retrieves the handle of the keyboard focus window associated with the thread that called the method. @@ -6472,7 +6555,13 @@ {"SetClassWord", PySetClassWord,1}, // @pymeth SetClassWord|Replaces the specified 32-bit (long) value at the specified offset into the extra class memory for the window. {"SetClassWord", PySetWindowWord,1}, // @pymeth SetWindowWord| {"SetCursor", PySetCursor,1}, // @pymeth SetCursor|Set the cursor to the HCURSOR object. + // @pymeth SetEnvironmentVariable|Creates, deletes, or changes the value of an environment variable. +#ifdef UNICODE + {"SetEnvironmentVariable", PySetEnvironmentVariableW,1}, +#else {"SetEnvironmentVariable", PySetEnvironmentVariable,1}, // @pymeth SetEnvironmentVariable|Creates, deletes, or changes the value of an environment variable. +#endif + {"SetEnvironmentVariableW", PySetEnvironmentVariableW,1}, // @pymeth SetEnvironmentVariableW|Creates, deletes, or changes the value of an environment variable. {"SetHandleInformation", PySetHandleInformation,1}, // @pymeth SetHandleInformation|Sets a handles's flags {"SetStdHandle", PySetStdHandle, 1}, // @pymeth SetStdHandle|Sets a handle for the standard input, standard output, or standard error device {"SetSystemPowerState", PySetSystemPowerState, 1}, // @pymeth SetSystemPowerState|Powers machine down to a suspended state |
From: <pyw...@li...> - 2014-01-25 03:43:38
|
changeset e2cdf93c66b5 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=e2cdf93c66b5 summary: Fix PyOpenStreamOnFile build error on py3.x versions diffstat: com/win32comext/mapi/src/mapi.i | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diffs (19 lines): diff -r e83b6c43e736 -r e2cdf93c66b5 com/win32comext/mapi/src/mapi.i --- a/com/win32comext/mapi/src/mapi.i Sat Jan 25 14:23:00 2014 +1100 +++ b/com/win32comext/mapi/src/mapi.i Sat Jan 25 14:43:34 2014 +1100 @@ -802,9 +802,13 @@ HRESULT hRes; unsigned long flags = 0; IStream *pStream; - char *filepath; + PyObject *obFilepath; - if (!PyArg_ParseTuple(args, "s|l:OpenStreamOnFile", &filepath, &flags)) + if (!PyArg_ParseTuple(args, "O|l:OpenStreamOnFile", &obFilepath, &flags)) + return NULL; + + TCHAR *filepath; + if (!PyWinObject_AsTCHAR(obFilepath, &filepath, FALSE)) return NULL; PY_INTERFACE_PRECALL; |
From: <pyw...@li...> - 2014-01-25 03:23:05
|
changeset e83b6c43e736 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=e83b6c43e736 summary: Add missing IConverterSession.h file diffstat: com/win32comext/mapi/src/IConverterSession.h | 50 ++++++++++++++++++++++++++++ 1 files changed, 50 insertions(+), 0 deletions(-) diffs (54 lines): diff -r 90d1d37b2444 -r e83b6c43e736 com/win32comext/mapi/src/IConverterSession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com/win32comext/mapi/src/IConverterSession.h Sat Jan 25 14:23:00 2014 +1100 @@ -0,0 +1,50 @@ +#pragma once + +//Class Identifiers +// {4e3a7680-b77a-11d0-9da5-00c04fd65685} +DEFINE_GUID(CLSID_IConverterSession, 0x4e3a7680, 0xb77a, + 0x11d0, 0x9d, 0xa5, 0x0, 0xc0, 0x4f, 0xd6, 0x56, 0x85); + +//Interface Identifiers +// {4b401570-b77b-11d0-9da5-00c04fd65685} +DEFINE_GUID(IID_IConverterSession, 0x4b401570, 0xb77b, + 0x11d0, 0x9d, 0xa5, 0x0, 0xc0, 0x4f, 0xd6, 0x56, 0x85); + +// Constants +#define CCSF_SMTP 0x0002 // the converter is being passed an SMTP message +#define CCSF_NOHEADERS 0x0004 // the converter should ignore the headers on the outside message +#define CCSF_USE_TNEF 0x0010 // the converter should embed TNEF in the MIME message +#define CCSF_INCLUDE_BCC 0x0020 // the converter should include Bcc recipients +#define CCSF_8BITHEADERS 0x0040 // the converter should allow 8 bit headers +#define CCSF_USE_RTF 0x0080 // the converter should do HTML->RTF conversion +#define CCSF_PLAIN_TEXT_ONLY 0x1000 // the converter should just send plain text +#define CCSF_NO_MSGID 0x4000 // don't include Message-Id field in outgoing messages +#define CCSF_EMBEDDED_MESSAGE 0x8000 // sent/unsent information is persisted in X-Unsent +#define CCSF_PRESERVE_SOURCE 0x40000 // don't modify the source message + +// http://msdn2.microsoft.com/en-us/library/bb905202.aspx +interface IConverterSession : public IUnknown +{ +public: + virtual HRESULT STDMETHODCALLTYPE SetAdrBook(LPADRBOOK pab); + + virtual HRESULT PlaceHolder1(); + virtual HRESULT PlaceHolder2(); + + virtual HRESULT STDMETHODCALLTYPE MIMEToMAPI(LPSTREAM pstm, + LPMESSAGE pmsg, + LPCSTR pszSrcSrv, + ULONG ulFlags); + + virtual HRESULT STDMETHODCALLTYPE MAPIToMIMEStm(LPMESSAGE pmsg, + LPSTREAM pstm, + ULONG ulFlags); + + virtual HRESULT PlaceHolder3(); + virtual HRESULT PlaceHolder4(); + virtual HRESULT PlaceHolder5(); + virtual HRESULT PlaceHolder6(); + virtual HRESULT PlaceHolder7(); + virtual HRESULT PlaceHolder8(); + virtual HRESULT PlaceHolder9(); +}; |
From: <pyw...@li...> - 2013-12-27 04:07:52
|
changeset 90d1d37b2444 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=90d1d37b2444 summary: Add EvtGetObjectArraySize and EvtGetObjectArrayProperty diffstat: win32/src/win32evtlog.i | 71 +++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 69 insertions(+), 2 deletions(-) diffs (109 lines): diff -r 7a6e7f8c56cf -r 90d1d37b2444 win32/src/win32evtlog.i --- a/win32/src/win32evtlog.i Tue Dec 24 22:25:45 2013 -0500 +++ b/win32/src/win32evtlog.i Thu Dec 26 23:06:31 2013 -0500 @@ -1320,7 +1320,9 @@ // @pyswig (object, int)|EvtGetPublisherMetadataProperty|Retrieves a property from an event publisher // @comm Accepts keyword args -// @comm Returns the value and type of value (EvtVarType*) +// @rdesc Returns the value and type of value (EvtVarType*) +// Some properties return a handle (type EvtVarTypeEvtHandle) which can be iterated using +// <om win32evtlog.EvtGetObjectArraySize> and <om win32evtlog.EvtGetObjectArrayProperty>. static PyObject *PyEvtGetPublisherMetadataProperty(PyObject *self, PyObject *args, PyObject *kwargs) { static char *keywords[]={"PublisherMetadata", "PropertyId", "Flags", NULL}; @@ -1407,7 +1409,7 @@ // @pyswig (object, int)|EvtGetEventMetadataProperty|Retrieves a property from an event publisher // @comm Accepts keyword args -// @comm Returns the value and type of value (EvtVarType*) +// @rdesc Returns the value and type of value (EvtVarType*). static PyObject *PyEvtGetEventMetadataProperty(PyObject *self, PyObject *args, PyObject *kwargs) { static char *keywords[]={"EventMetadata", "PropertyId", "Flags", NULL}; @@ -1523,6 +1525,67 @@ return ret; } PyCFunction pfnPyEvtGetEventInfo = (PyCFunction) PyEvtGetEventInfo; + +// @pyswig int|EvtGetObjectArraySize|Returns the size of an array of event objects +// @comm Accepts keyword args +static PyObject *PyEvtGetObjectArraySize(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *keywords[]={"ObjectArray", NULL}; + EVT_HANDLE harray; + DWORD size; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:EvtGetObjectArraySize", keywords, + PyWinObject_AsHANDLE, &harray)) // @pyparm <o PyEVT_HANDLE>|ObjectArray||Handle to an array of objects as returned by <om win32evtlog.EvtGetPublisherMetadataProperty> for some ProperyId's + return NULL; + BOOL bsuccess; + Py_BEGIN_ALLOW_THREADS + bsuccess = EvtGetObjectArraySize(harray, &size); + Py_END_ALLOW_THREADS + if (!bsuccess) + return PyWin_SetAPIError("EvtGetObjectArraySize"); + return PyLong_FromUnsignedLong(size); +} +PyCFunction pfnPyEvtGetObjectArraySize = (PyCFunction) PyEvtGetObjectArraySize; + +// @pyswig (object, int)|EvtGetObjectArrayProperty|Retrieves an item from an object array +// @comm Accepts keyword args +// @rdesc Returns the value and type of value (EvtVarType*) +static PyObject *PyEvtGetObjectArrayProperty(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *keywords[]={"ObjectArray", "PropertyId", "ArrayIndex", "Flags", NULL}; + EVT_HANDLE harray; + DWORD prop_id, index, flags = 0; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&kk|k:EvtGetObjectArrayProperty", keywords, + PyWinObject_AsHANDLE, &harray, // @pyparm <o PyEVT_HANDLE>|ObjectArray||Handle to an array of objects as returned by <om win32evtlog.EvtGetPublisherMetadataProperty> for some ProperyId's + &prop_id, // @pyparm int|PropertyId||Type of property contained in the array + &index, // @pyparm int|ArrayIndex||Zero-based index of item to retrieve + &flags)) // @pyparm int|Flags|0|Reserved, use only 0 + return NULL; + + PEVT_VARIANT val = NULL; + DWORD buf_size=0, buf_needed, err; + Py_BEGIN_ALLOW_THREADS + EvtGetObjectArrayProperty(harray, prop_id, index, flags, buf_size, val, &buf_needed); + Py_END_ALLOW_THREADS + err = GetLastError(); + if (err != ERROR_INSUFFICIENT_BUFFER) + return PyWin_SetAPIError("EvtGetObjectArrayProperty", err); + val = (PEVT_VARIANT)malloc(buf_needed); + if (val == NULL) + return PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", buf_needed); + buf_size = buf_needed; + BOOL bsuccess; + Py_BEGIN_ALLOW_THREADS + bsuccess = EvtGetObjectArrayProperty(harray, prop_id, index, flags, buf_size, val, &buf_needed); + Py_END_ALLOW_THREADS + PyObject *ret = NULL; + if (!bsuccess) + PyWin_SetAPIError("EvtGetObjectArrayProperty"); + else + ret = PyWinObject_FromEVT_VARIANT(val); + free(val); + return ret; +} +PyCFunction pfnPyEvtGetObjectArrayProperty = (PyCFunction) PyEvtGetObjectArrayProperty; %} @@ -1552,6 +1615,8 @@ %native (EvtGetEventMetadataProperty) pfnPyEvtGetEventMetadataProperty; %native (EvtGetLogInfo) pfnPyEvtGetLogInfo; %native (EvtGetEventInfo) pfnPyEvtGetEventInfo; +%native (EvtGetObjectArraySize) pfnPyEvtGetObjectArraySize; +%native (EvtGetObjectArrayProperty) pfnPyEvtGetObjectArrayProperty; %init %{ @@ -1582,6 +1647,8 @@ ||(strcmp(pmd->ml_name, "EvtGetEventMetadataProperty")==0) ||(strcmp(pmd->ml_name, "EvtGetLogInfo")==0) ||(strcmp(pmd->ml_name, "EvtGetEventInfo")==0) + ||(strcmp(pmd->ml_name, "EvtGetObjectArraySize")==0) + ||(strcmp(pmd->ml_name, "EvtGetObjectArrayProperty")==0) ){ pmd->ml_flags = METH_VARARGS | METH_KEYWORDS; } |
From: <pyw...@li...> - 2013-12-25 03:27:03
|
changeset baff3aedce78 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=baff3aedce78 summary: Added tag 218.5 for changeset 2d79b6bd94bc changeset 7a6e7f8c56cf in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=7a6e7f8c56cf summary: Add win32gui.RegisterHotKey diffstat: .hgtags | 1 + CHANGES.txt | 11 ++++++++++- win32/src/win32gui.i | 8 ++++++++ 3 files changed, 19 insertions(+), 1 deletions(-) diffs (48 lines): diff -r 2d79b6bd94bc -r 7a6e7f8c56cf .hgtags --- a/.hgtags Mon Dec 16 09:50:55 2013 -0500 +++ b/.hgtags Tue Dec 24 22:25:45 2013 -0500 @@ -50,3 +50,4 @@ b7968cc5d12a148df3005979adb804ab79dd1d17 b218 ed400a27739ff3ff7a850e69f574a1ad66de6c5e b218 e97376eb14b6d95e79e01e1bf68ef8427bcbafdc b218.3 +2d79b6bd94bc145f7f5a6e1c63d626737fc98e6c 218.5 diff -r 2d79b6bd94bc -r 7a6e7f8c56cf CHANGES.txt --- a/CHANGES.txt Mon Dec 16 09:50:55 2013 -0500 +++ b/CHANGES.txt Tue Dec 24 22:25:45 2013 -0500 @@ -1,4 +1,4 @@ -A changelog for recent builds as pasted into the sourceforge page. +A changelog for recent builds as pasted into the sourceforge page. Generally created by hand after running: hg log -rb2xx: > log.out @@ -38,6 +38,15 @@ Add interfaces IPropertyChange, IPropertyChangeArray, and IObjectWithPropertyKey Add functions PSCreateSimplePropertyChange, PSCreatePropertyChangeArray, and SHSetDefaultProperties +* win32crypt + Add functions and objects for handling certificates and certificate stores + +* win32gui + Add RegisterHotKey + +* win32evtlog + Add several more Evt* functions (Vista+ event log API) + Since build 217: ---------------- * mapiutil.py GetPropTagName has been modified to return the fully qualified diff -r 2d79b6bd94bc -r 7a6e7f8c56cf win32/src/win32gui.i --- a/win32/src/win32gui.i Mon Dec 16 09:50:55 2013 -0500 +++ b/win32/src/win32gui.i Tue Dec 24 22:25:45 2013 -0500 @@ -7521,3 +7521,11 @@ // It is generally not necessary to call this function manually, but in some cases, // handle values may be extracted via the struct module and need to be closed explicitly. BOOLAPI UnregisterDeviceNotification(HANDLE); + +// @pyswig |RegisterHotKey|Registers a hotkey for a window +// @pyseeapi RegisterHotKey +// @pyparm <o PyHANDLE>|hWnd||Handle to window that will receive WM_HOTKEY messages +// @pyparm int|id||Unique id to be used for the hot key +// @pyparm int|Modifiers||Control keys, combination of win32con.MOD_* +// @pyparm int|vk||Virtual key code +BOOLAPI RegisterHotKey(HWND, int, UINT, UINT); |
From: <pyw...@li...> - 2013-12-16 14:52:00
|
changeset 2d79b6bd94bc in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=2d79b6bd94bc summary: Add EvtGetLogInfo and EvtGetEventInfo diffstat: win32/src/win32evtlog.i | 101 +++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 99 insertions(+), 2 deletions(-) diffs (136 lines): diff -r fa2687fcdebb -r 2d79b6bd94bc win32/src/win32evtlog.i --- a/win32/src/win32evtlog.i Sun Dec 15 10:24:36 2013 -0500 +++ b/win32/src/win32evtlog.i Mon Dec 16 09:50:55 2013 -0500 @@ -1416,7 +1416,7 @@ DWORD flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i|k:EvtGetEventMetadataProperty", keywords, PyWinObject_AsHANDLE, &hevent, // @pyparm <o PyEVT_HANDLE>|EventMetadata||Event metadata handle as returned by <om win32evtlog.EvtNextEventMetadata> - &prop_id, // @pyparm int|PropertyId||Property to retreive, EvtPublisherMetadata* + &prop_id, // @pyparm int|PropertyId||Property to retreive, EventMetadata* &flags)) // @pyparm int|Flags|0|Reserved, use only 0 return NULL; @@ -1445,6 +1445,84 @@ return ret; } PyCFunction pfnPyEvtGetEventMetadataProperty = (PyCFunction) PyEvtGetEventMetadataProperty; + +// @pyswig (object, int)|EvtGetLogInfo|Retrieves log file or channel information +// @comm Accepts keyword args +// @comm Returns the value and type of value (EvtVarType*) +static PyObject *PyEvtGetLogInfo(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *keywords[]={"Log", "PropertyId", NULL}; + EVT_HANDLE hlog; + EVT_LOG_PROPERTY_ID prop_id; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i:EvtGetLogInfo", keywords, + PyWinObject_AsHANDLE, &hlog, // @pyparm <o PyEVT_HANDLE>|Log||Event log handle as returned by <om win32evtlog.EvtOpenLog> + &prop_id)) // @pyparm int|PropertyId||Property to retreive, EvtLog* + return NULL; + + PEVT_VARIANT val = NULL; + DWORD buf_size=0, buf_needed, err; + Py_BEGIN_ALLOW_THREADS + EvtGetLogInfo(hlog, prop_id, buf_size, val, &buf_needed); + Py_END_ALLOW_THREADS + err = GetLastError(); + if (err != ERROR_INSUFFICIENT_BUFFER) + return PyWin_SetAPIError("EvtGetLogInfo", err); + val = (PEVT_VARIANT)malloc(buf_needed); + if (val == NULL) + return PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", buf_needed); + buf_size = buf_needed; + BOOL bsuccess; + Py_BEGIN_ALLOW_THREADS + bsuccess = EvtGetLogInfo(hlog, prop_id, buf_size, val, &buf_needed); + Py_END_ALLOW_THREADS + PyObject *ret = NULL; + if (!bsuccess) + PyWin_SetAPIError("EvtGetLogInfo"); + else + ret = PyWinObject_FromEVT_VARIANT(val); + free(val); + return ret; +} +PyCFunction pfnPyEvtGetLogInfo = (PyCFunction) PyEvtGetLogInfo; + +// @pyswig (object, int)|EvtGetEventInfo|Retrieves information about the source of an event +// @comm Accepts keyword args +// @comm Returns the value and type of value (EvtVarType*) +static PyObject *PyEvtGetEventInfo(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *keywords[]={"Event", "PropertyId", NULL}; + EVT_HANDLE hevent; + EVT_EVENT_PROPERTY_ID prop_id; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i:EvtGetEventInfo", keywords, + PyWinObject_AsHANDLE, &hevent, // @pyparm <o PyEVT_HANDLE>|Event||Handle to an event + &prop_id)) // @pyparm int|PropertyId||Property to retreive, EvtEvent* + return NULL; + + PEVT_VARIANT val = NULL; + DWORD buf_size=0, buf_needed, err; + Py_BEGIN_ALLOW_THREADS + EvtGetEventInfo(hevent, prop_id, buf_size, val, &buf_needed); + Py_END_ALLOW_THREADS + err = GetLastError(); + if (err != ERROR_INSUFFICIENT_BUFFER) + return PyWin_SetAPIError("EvtGetEventInfo", err); + val = (PEVT_VARIANT)malloc(buf_needed); + if (val == NULL) + return PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", buf_needed); + buf_size = buf_needed; + BOOL bsuccess; + Py_BEGIN_ALLOW_THREADS + bsuccess = EvtGetEventInfo(hevent, prop_id, buf_size, val, &buf_needed); + Py_END_ALLOW_THREADS + PyObject *ret = NULL; + if (!bsuccess) + PyWin_SetAPIError("EvtGetEventInfo"); + else + ret = PyWinObject_FromEVT_VARIANT(val); + free(val); + return ret; +} +PyCFunction pfnPyEvtGetEventInfo = (PyCFunction) PyEvtGetEventInfo; %} @@ -1472,6 +1550,8 @@ %native (EvtOpenEventMetadataEnum) pfnPyEvtOpenEventMetadataEnum; %native (EvtNextEventMetadata) pfnPyEvtNextEventMetadata; %native (EvtGetEventMetadataProperty) pfnPyEvtGetEventMetadataProperty; +%native (EvtGetLogInfo) pfnPyEvtGetLogInfo; +%native (EvtGetEventInfo) pfnPyEvtGetEventInfo; %init %{ @@ -1499,7 +1579,9 @@ ||(strcmp(pmd->ml_name, "EvtGetPublisherMetadataProperty")==0) ||(strcmp(pmd->ml_name, "EvtOpenEventMetadataEnum")==0) ||(strcmp(pmd->ml_name, "EvtNextEventMetadata")==0) - ||(strcmp(pmd->ml_name, "EvtGetEventMetadataProperty")==0) + ||(strcmp(pmd->ml_name, "EvtGetEventMetadataProperty")==0) + ||(strcmp(pmd->ml_name, "EvtGetLogInfo")==0) + ||(strcmp(pmd->ml_name, "EvtGetEventInfo")==0) ){ pmd->ml_flags = METH_VARARGS | METH_KEYWORDS; } @@ -1648,3 +1730,18 @@ #define EventMetadataEventMessageID EventMetadataEventMessageID #define EventMetadataEventTemplate EventMetadataEventTemplate #define EvtEventMetadataPropertyIdEND EvtEventMetadataPropertyIdEND + +// EVT_LOG_PROPERTY_ID, used with EvtGetLogInfo +#define EvtLogCreationTime EvtLogCreationTime +#define EvtLogLastAccessTime EvtLogLastAccessTime +#define EvtLogLastWriteTime EvtLogLastWriteTime +#define EvtLogFileSize EvtLogFileSize +#define EvtLogAttributes EvtLogAttributes +#define EvtLogNumberOfLogRecords EvtLogNumberOfLogRecords +#define EvtLogOldestRecordNumber EvtLogOldestRecordNumber +#define EvtLogFull EvtLogFull + +// EVT_EVENT_PROPERTY_ID used with EvtGetEventInfo +#define EvtEventQueryIDs EvtEventQueryIDs +#define EvtEventPath EvtEventPath +#define EvtEventPropertyIdEND EvtEventPropertyIdEND |
From: <pyw...@li...> - 2013-12-15 15:25:16
|
changeset fa2687fcdebb in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=fa2687fcdebb summary: Add EvtOpenEventMetadataEnum, EvtNextEventMetadata, and EvtGetEventMetadataProperty diffstat: win32/src/win32evtlog.i | 105 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 105 insertions(+), 0 deletions(-) diffs (133 lines): diff -r 18f908e84861 -r fa2687fcdebb win32/src/win32evtlog.i --- a/win32/src/win32evtlog.i Sun Dec 15 01:00:31 2013 -0500 +++ b/win32/src/win32evtlog.i Sun Dec 15 10:24:36 2013 -0500 @@ -1358,6 +1358,93 @@ return ret; } PyCFunction pfnPyEvtGetPublisherMetadataProperty = (PyCFunction) PyEvtGetPublisherMetadataProperty; + +// @pyswig <o PyEVT_HANDLE>|EvtOpenEventMetadataEnum|Enumerates the events that a publisher provides +// @comm Accepts keyword args +static PyObject *PyEvtOpenEventMetadataEnum(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *keywords[]={"PublisherMetadata", "Flags", NULL}; + EVT_HANDLE hpublisher, enum_handle; + DWORD flags=0; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|k:EvtOpenEventMetadataEnum", keywords, + PyWinObject_AsHANDLE, &hpublisher, // @pyparm <o PyEVT_HANDLE>|PublisherMetadata||Publisher handle as returned by <om win32evtlog.EvtOpenPublisherMetadata> + &flags)) // @pyparm int|Flags|0|Reserved, use only 0 + return NULL; + Py_BEGIN_ALLOW_THREADS + enum_handle=EvtOpenEventMetadataEnum(hpublisher, flags); + Py_END_ALLOW_THREADS + if (enum_handle==NULL) + return PyWin_SetAPIError("EvtOpenEventMetadataEnum"); + return PyWinObject_FromEVT_HANDLE(enum_handle); +} +PyCFunction pfnPyEvtOpenEventMetadataEnum = (PyCFunction) PyEvtOpenEventMetadataEnum; + +// @pyswig <o PyEVT_HANDLE>|EvtNextEventMetadata|Retrieves the next item from an event metadata enumeration +// @comm Accepts keyword args +static PyObject *PyEvtNextEventMetadata(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *keywords[]={"EventMetadataEnum", "Flags", NULL}; + EVT_HANDLE henum, ret; + DWORD flags = 0; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|k:EvtNextEventMetadata", keywords, + PyWinObject_AsHANDLE, &henum, // @pyparm <o PyEVT_HANDLE>|EventMetadataEnum||Enumeration handle as returned by <om win32evtlog.EvtOpenEventMetadataEnum> + &flags)) // @pyparm int|Flags|0|Reserved, use only 0 + return NULL; + + Py_BEGIN_ALLOW_THREADS + ret = EvtNextEventMetadata(henum, flags); + Py_END_ALLOW_THREADS + if (ret != NULL) + return PyWinObject_FromEVT_HANDLE(ret); + DWORD err=GetLastError(); + if (err==ERROR_NO_MORE_ITEMS){ + Py_INCREF(Py_None); + return Py_None; + } + return PyWin_SetAPIError("EvtNextEventMetadata"); +} +PyCFunction pfnPyEvtNextEventMetadata = (PyCFunction) PyEvtNextEventMetadata; + +// @pyswig (object, int)|EvtGetEventMetadataProperty|Retrieves a property from an event publisher +// @comm Accepts keyword args +// @comm Returns the value and type of value (EvtVarType*) +static PyObject *PyEvtGetEventMetadataProperty(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *keywords[]={"EventMetadata", "PropertyId", "Flags", NULL}; + EVT_HANDLE hevent; + EVT_EVENT_METADATA_PROPERTY_ID prop_id; + DWORD flags = 0; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i|k:EvtGetEventMetadataProperty", keywords, + PyWinObject_AsHANDLE, &hevent, // @pyparm <o PyEVT_HANDLE>|EventMetadata||Event metadata handle as returned by <om win32evtlog.EvtNextEventMetadata> + &prop_id, // @pyparm int|PropertyId||Property to retreive, EvtPublisherMetadata* + &flags)) // @pyparm int|Flags|0|Reserved, use only 0 + return NULL; + + PEVT_VARIANT val = NULL; + DWORD buf_size=0, buf_needed, err; + Py_BEGIN_ALLOW_THREADS + EvtGetEventMetadataProperty(hevent, prop_id, flags, buf_size, val, &buf_needed); + Py_END_ALLOW_THREADS + err = GetLastError(); + if (err != ERROR_INSUFFICIENT_BUFFER) + return PyWin_SetAPIError("EvtGetEventMetadataProperty", err); + val = (PEVT_VARIANT)malloc(buf_needed); + if (val == NULL) + return PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", buf_needed); + buf_size = buf_needed; + BOOL bsuccess; + Py_BEGIN_ALLOW_THREADS + bsuccess = EvtGetEventMetadataProperty(hevent, prop_id, flags, buf_size, val, &buf_needed); + Py_END_ALLOW_THREADS + PyObject *ret = NULL; + if (!bsuccess) + PyWin_SetAPIError("EvtGetEventMetadataProperty"); + else + ret = PyWinObject_FromEVT_VARIANT(val); + free(val); + return ret; +} +PyCFunction pfnPyEvtGetEventMetadataProperty = (PyCFunction) PyEvtGetEventMetadataProperty; %} @@ -1382,6 +1469,9 @@ %native (EvtNextPublisherId) pfnPyEvtNextPublisherId; %native (EvtOpenPublisherMetadata) pfnPyEvtOpenPublisherMetadata; %native (EvtGetPublisherMetadataProperty) pfnPyEvtGetPublisherMetadataProperty; +%native (EvtOpenEventMetadataEnum) pfnPyEvtOpenEventMetadataEnum; +%native (EvtNextEventMetadata) pfnPyEvtNextEventMetadata; +%native (EvtGetEventMetadataProperty) pfnPyEvtGetEventMetadataProperty; %init %{ @@ -1407,6 +1497,9 @@ ||(strcmp(pmd->ml_name, "EvtNextPublisherId")==0) ||(strcmp(pmd->ml_name, "EvtOpenPublisherMetadata")==0) ||(strcmp(pmd->ml_name, "EvtGetPublisherMetadataProperty")==0) + ||(strcmp(pmd->ml_name, "EvtOpenEventMetadataEnum")==0) + ||(strcmp(pmd->ml_name, "EvtNextEventMetadata")==0) + ||(strcmp(pmd->ml_name, "EvtGetEventMetadataProperty")==0) ){ pmd->ml_flags = METH_VARARGS | METH_KEYWORDS; } @@ -1543,3 +1636,15 @@ #define EvtPublisherMetadataKeywordValue EvtPublisherMetadataKeywordValue #define EvtPublisherMetadataKeywordMessageID EvtPublisherMetadataKeywordMessageID #define EvtPublisherMetadataPropertyIdEND EvtPublisherMetadataPropertyIdEND + +// EVT_EVENT_METADATA_PROPERTY_ID used with EvtGetEventMetadataProperty +#define EventMetadataEventID EventMetadataEventID +#define EventMetadataEventVersion EventMetadataEventVersion +#define EventMetadataEventChannel EventMetadataEventChannel +#define EventMetadataEventLevel EventMetadataEventLevel +#define EventMetadataEventOpcode EventMetadataEventOpcode +#define EventMetadataEventTask EventMetadataEventTask +#define EventMetadataEventKeyword EventMetadataEventKeyword +#define EventMetadataEventMessageID EventMetadataEventMessageID +#define EventMetadataEventTemplate EventMetadataEventTemplate +#define EvtEventMetadataPropertyIdEND EvtEventMetadataPropertyIdEND |
From: <pyw...@li...> - 2013-12-15 06:01:04
|
changeset 18f908e84861 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=18f908e84861 summary: Add EvtOpenPublisherEnum, EvtNextPublisherId, EvtOpenPublisherMetadata, and EvtGetPublisherMetadataProperty diffstat: win32/src/win32evtlog.i | 196 ++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 189 insertions(+), 7 deletions(-) diffs (242 lines): diff -r 594108a1bc03 -r 18f908e84861 win32/src/win32evtlog.i --- a/win32/src/win32evtlog.i Sat Dec 14 10:23:02 2013 -0500 +++ b/win32/src/win32evtlog.i Sun Dec 15 01:00:31 2013 -0500 @@ -1127,7 +1127,7 @@ free(val); return ret; } -PyCFunction pfnEvtGetChannelConfigProperty = (PyCFunction) PyEvtGetChannelConfigProperty; +PyCFunction pfnPyEvtGetChannelConfigProperty = (PyCFunction) PyEvtGetChannelConfigProperty; // @pyswig <o PyEVT_HANDLE>|EvtOpenChannelConfig|Opens channel configuration // @comm Accepts keyword args @@ -1152,7 +1152,7 @@ return PyWin_SetAPIError("EvtOpenChannelConfig"); return PyWinObject_FromEVT_HANDLE(ret); } -PyCFunction pfnEvtOpenChannelConfig = (PyCFunction) PyEvtOpenChannelConfig; +PyCFunction pfnPyEvtOpenChannelConfig = (PyCFunction) PyEvtOpenChannelConfig; void PyWinObject_FreeEVT_RPC_LOGIN(EVT_RPC_LOGIN *erl) { @@ -1213,12 +1213,154 @@ Py_END_ALLOW_THREADS PyWinObject_FreeEVT_RPC_LOGIN(&login); if (ret == NULL) - return PyWin_SetAPIError("EvtOpenChannelConfig"); + return PyWin_SetAPIError("EvtOpenSession"); return PyWinObject_FromEVT_HANDLE(ret); } -PyCFunction pfnEvtOpenSession = (PyCFunction) PyEvtOpenSession; +PyCFunction pfnPyEvtOpenSession = (PyCFunction) PyEvtOpenSession; + +// @pyswig <o PyEVT_HANDLE>|EvtOpenPublisherEnum|Begins an enumeration of event publishers +// @comm Accepts keyword args +static PyObject *PyEvtOpenPublisherEnum(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *keywords[]={"Session", "Flags", NULL}; + EVT_HANDLE session=NULL, enum_handle; + DWORD flags=0; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O&k:EvtOpenPublisherEnum", keywords, + PyWinObject_AsHANDLE, &session, // @pyparm <o PyEVT_HANDLE>|Session|None|Handle to a remote session (see <om win32evtlog.EvtOpenSession>), or None for local machine. + &flags)) // @pyparm int|Flags|0|Reserved, use only 0 + return NULL; + Py_BEGIN_ALLOW_THREADS + enum_handle=EvtOpenPublisherEnum(session, flags); + Py_END_ALLOW_THREADS + if (enum_handle==NULL) + return PyWin_SetAPIError("EvtOpenPublisherEnum"); + return PyWinObject_FromEVT_HANDLE(enum_handle); +} +PyCFunction pfnPyEvtOpenPublisherEnum = (PyCFunction) PyEvtOpenPublisherEnum; + +// @pyswig str|EvtNextPublisherId|Returns the next publisher from an enumeration +// @rdesc Returns None at end of enumeration +// @comm Accepts keyword args +static PyObject *PyEvtNextPublisherId(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *keywords[]={"PublisherEnum", NULL}; + EVT_HANDLE enum_handle; + DWORD allocated_size=256, returned_size, err; + WCHAR *buf=NULL; + PyObject *ret=NULL; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:EvtNextPublisherId", keywords, + PyWinObject_AsHANDLE, &enum_handle)) // @pyparm <o PyEVT_HANDLE>|PublisherEnum||Handle to an enumeration as returned by <om win32evtlog.EvtOpenPublisherEnum> + return NULL; + BOOL bsuccess; + while (true){ + if (buf) + free(buf); + WCHAR *buf=(WCHAR *)malloc(allocated_size * sizeof(WCHAR)); + if (!buf) + return NULL; + + Py_BEGIN_ALLOW_THREADS + bsuccess = EvtNextPublisherId(enum_handle, allocated_size, buf, &returned_size); + Py_END_ALLOW_THREADS + if (bsuccess){ + ret=PyWinObject_FromWCHAR(buf); + break; + } + err=GetLastError(); + if (err==ERROR_INSUFFICIENT_BUFFER){ + allocated_size=returned_size; + continue; + } + if (err==ERROR_NO_MORE_ITEMS){ + Py_INCREF(Py_None); + ret=Py_None; + break; + } + PyWin_SetAPIError("EvtNextPublisherId", err); + break; + } + if (buf) + free(buf); + return ret; +} +PyCFunction pfnPyEvtNextPublisherId = (PyCFunction) PyEvtNextPublisherId; + +// @pyswig <o PyEVT_HANDLE>|EvtOpenPublisherMetadata|Opens a publisher to retrieve properties using <om win32evtlog.EvtGetPublisherMetadataProperty> +// @comm Accepts keyword args +static PyObject *PyEvtOpenPublisherMetadata(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *keywords[]={"PublisherIdentity", "Session", "LogFilePath", "Locale", "Flags", NULL}; + PyObject *obpublisher, *oblogfile=Py_None; + TmpWCHAR publisher, logfile; + EVT_HANDLE session = NULL; + LCID locale = 0; + DWORD flags = 0; + EVT_HANDLE ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O&Okk:EvtOpenPublisherMetadata", keywords, + &obpublisher, // @pyparm str|PublisherIdentity||Publisher id as returned by <om win32evtlog.EvtNextPublisherId> + PyWinObject_AsHANDLE, &session, // @pyparm <o PyEVT_HANDLE>|Session|None|Handle to remote session, or None for local machine + &oblogfile, // @pyparm str|LogFilePath|None|Log file from which to retrieve publisher, or None for locally registered publisher + &locale, // @pyparm int|Locale|0|Locale to use for retrieved properties, use 0 for current locale + &flags)) // @pyparm int|Flags|0|Reserved, use only 0 + return NULL; + if (!PyWinObject_AsWCHAR(obpublisher, &publisher, FALSE)) + return NULL; + if (!PyWinObject_AsWCHAR(oblogfile, &logfile, TRUE)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + ret = EvtOpenPublisherMetadata(session, publisher, logfile, locale, flags); + Py_END_ALLOW_THREADS + if (ret == NULL) + return PyWin_SetAPIError("EvtOpenPublisherMetadata"); + return PyWinObject_FromEVT_HANDLE(ret); +} +PyCFunction pfnPyEvtOpenPublisherMetadata = (PyCFunction) PyEvtOpenPublisherMetadata; + +// @pyswig (object, int)|EvtGetPublisherMetadataProperty|Retrieves a property from an event publisher +// @comm Accepts keyword args +// @comm Returns the value and type of value (EvtVarType*) +static PyObject *PyEvtGetPublisherMetadataProperty(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *keywords[]={"PublisherMetadata", "PropertyId", "Flags", NULL}; + EVT_HANDLE hpublisher; + EVT_PUBLISHER_METADATA_PROPERTY_ID prop_id; + DWORD flags = 0; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i|k:EvtGetPublisherMetadataProperty", keywords, + PyWinObject_AsHANDLE, &hpublisher, // @pyparm <o PyEVT_HANDLE>|PublisherMetadata||Publisher handle as returned by <om win32evtlog.EvtOpenPublisherMetadata> + &prop_id, // @pyparm int|PropertyId||Property to retreive, EvtPublisherMetadata* + &flags)) // @pyparm int|Flags|0|Reserved, use only 0 + return NULL; + + PEVT_VARIANT val = NULL; + DWORD buf_size=0, buf_needed, err; + Py_BEGIN_ALLOW_THREADS + EvtGetPublisherMetadataProperty(hpublisher, prop_id, flags, buf_size, val, &buf_needed); + Py_END_ALLOW_THREADS + err = GetLastError(); + if (err != ERROR_INSUFFICIENT_BUFFER) + return PyWin_SetAPIError("EvtGetPublisherMetadataProperty", err); + val = (PEVT_VARIANT)malloc(buf_needed); + if (val == NULL) + return PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", buf_needed); + buf_size = buf_needed; + BOOL bsuccess; + Py_BEGIN_ALLOW_THREADS + bsuccess = EvtGetPublisherMetadataProperty(hpublisher, prop_id, flags, buf_size, val, &buf_needed); + Py_END_ALLOW_THREADS + PyObject *ret = NULL; + if (!bsuccess) + PyWin_SetAPIError("EvtGetPublisherMetadataProperty"); + else + ret = PyWinObject_FromEVT_VARIANT(val); + free(val); + return ret; +} +PyCFunction pfnPyEvtGetPublisherMetadataProperty = (PyCFunction) PyEvtGetPublisherMetadataProperty; %} + %native (EvtOpenChannelEnum) pfnPyEvtOpenChannelEnum; %native (EvtNextChannelPath) pfnPyEvtNextChannelPath; %native (EvtOpenLog) pfnPyEvtOpenLog; @@ -1233,9 +1375,13 @@ %native (EvtSubscribe) pfnPyEvtSubscribe; %native (EvtCreateBookmark) pfnPyEvtCreateBookmark; %native (EvtUpdateBookmark) pfnPyEvtUpdateBookmark; -%native (EvtGetChannelConfigProperty) pfnEvtGetChannelConfigProperty; -%native (EvtOpenChannelConfig) pfnEvtOpenChannelConfig; -%native (EvtOpenSession) pfnEvtOpenSession; +%native (EvtGetChannelConfigProperty) pfnPyEvtGetChannelConfigProperty; +%native (EvtOpenChannelConfig) pfnPyEvtOpenChannelConfig; +%native (EvtOpenSession) pfnPyEvtOpenSession; +%native (EvtOpenPublisherEnum) pfnPyEvtOpenPublisherEnum; +%native (EvtNextPublisherId) pfnPyEvtNextPublisherId; +%native (EvtOpenPublisherMetadata) pfnPyEvtOpenPublisherMetadata; +%native (EvtGetPublisherMetadataProperty) pfnPyEvtGetPublisherMetadataProperty; %init %{ @@ -1257,6 +1403,10 @@ ||(strcmp(pmd->ml_name, "EvtGetChannelConfigProperty")==0) ||(strcmp(pmd->ml_name, "EvtOpenChannelConfig")==0) ||(strcmp(pmd->ml_name, "EvtOpenSession")==0) + ||(strcmp(pmd->ml_name, "EvtOpenPublisherEnum")==0) + ||(strcmp(pmd->ml_name, "EvtNextPublisherId")==0) + ||(strcmp(pmd->ml_name, "EvtOpenPublisherMetadata")==0) + ||(strcmp(pmd->ml_name, "EvtGetPublisherMetadataProperty")==0) ){ pmd->ml_flags = METH_VARARGS | METH_KEYWORDS; } @@ -1361,3 +1511,35 @@ #define EvtRpcLoginAuthNegotiate EvtRpcLoginAuthNegotiate #define EvtRpcLoginAuthKerberos EvtRpcLoginAuthKerberos #define EvtRpcLoginAuthNTLM EvtRpcLoginAuthNTLM + +// EVT_PUBLISHER_METADATA_PROPERTY_ID +#define EvtPublisherMetadataPublisherGuid EvtPublisherMetadataPublisherGuid +#define EvtPublisherMetadataResourceFilePath EvtPublisherMetadataResourceFilePath +#define EvtPublisherMetadataParameterFilePath EvtPublisherMetadataParameterFilePath +#define EvtPublisherMetadataMessageFilePath EvtPublisherMetadataMessageFilePath +#define EvtPublisherMetadataHelpLink EvtPublisherMetadataHelpLink +#define EvtPublisherMetadataPublisherMessageID EvtPublisherMetadataPublisherMessageID +#define EvtPublisherMetadataChannelReferences EvtPublisherMetadataChannelReferences +#define EvtPublisherMetadataChannelReferencePath EvtPublisherMetadataChannelReferencePath +#define EvtPublisherMetadataChannelReferenceIndex EvtPublisherMetadataChannelReferenceIndex +#define EvtPublisherMetadataChannelReferenceID EvtPublisherMetadataChannelReferenceID +#define EvtPublisherMetadataChannelReferenceFlags EvtPublisherMetadataChannelReferenceFlags +#define EvtPublisherMetadataChannelReferenceMessageID EvtPublisherMetadataChannelReferenceMessageID +#define EvtPublisherMetadataLevels EvtPublisherMetadataLevels +#define EvtPublisherMetadataLevelName EvtPublisherMetadataLevelName +#define EvtPublisherMetadataLevelValue EvtPublisherMetadataLevelValue +#define EvtPublisherMetadataLevelMessageID EvtPublisherMetadataLevelMessageID +#define EvtPublisherMetadataTasks EvtPublisherMetadataTasks +#define EvtPublisherMetadataTaskName EvtPublisherMetadataTaskName +#define EvtPublisherMetadataTaskEventGuid EvtPublisherMetadataTaskEventGuid +#define EvtPublisherMetadataTaskValue EvtPublisherMetadataTaskValue +#define EvtPublisherMetadataTaskMessageID EvtPublisherMetadataTaskMessageID +#define EvtPublisherMetadataOpcodes EvtPublisherMetadataOpcodes +#define EvtPublisherMetadataOpcodeName EvtPublisherMetadataOpcodeName +#define EvtPublisherMetadataOpcodeValue EvtPublisherMetadataOpcodeValue +#define EvtPublisherMetadataOpcodeMessageID EvtPublisherMetadataOpcodeMessageID +#define EvtPublisherMetadataKeywords EvtPublisherMetadataKeywords +#define EvtPublisherMetadataKeywordName EvtPublisherMetadataKeywordName +#define EvtPublisherMetadataKeywordValue EvtPublisherMetadataKeywordValue +#define EvtPublisherMetadataKeywordMessageID EvtPublisherMetadataKeywordMessageID +#define EvtPublisherMetadataPropertyIdEND EvtPublisherMetadataPropertyIdEND |
From: <pyw...@li...> - 2013-12-14 15:26:12
|
changeset 594108a1bc03 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=594108a1bc03 summary: Add EvtOpenSession, EvtOpenChannelConfig, and EvtGetChannelConfigProperty; Release thread lock while calling other Evt* functions diffstat: win32/src/win32evtlog.i | 356 ++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 345 insertions(+), 11 deletions(-) diffs (truncated from 508 to 300 lines): diff -r c36870fc25f0 -r 594108a1bc03 win32/src/win32evtlog.i --- a/win32/src/win32evtlog.i Sun Dec 08 13:47:19 2013 -0500 +++ b/win32/src/win32evtlog.i Sat Dec 14 10:23:02 2013 -0500 @@ -489,7 +489,9 @@ PyWinObject_AsHANDLE, &session, // @pyparm <o PyEVT_HANDLE>|Session|None|Handle to a remote session (see <om win32evtlog.EvtOpenSession>), or None for local machine. &flags)) // @pyparm int|Flags|0|Reserved, use only 0 return NULL; + Py_BEGIN_ALLOW_THREADS enum_handle=EvtOpenChannelEnum(session, flags); + Py_END_ALLOW_THREADS if (enum_handle==NULL) return PyWin_SetAPIError("EvtOpenChannelEnum"); return PyWinObject_FromEVT_HANDLE(enum_handle); @@ -509,6 +511,7 @@ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:EvtNextChannelPath", keywords, PyWinObject_AsHANDLE, &enum_handle)) // @pyparm <o PyEVT_HANDLE>|ChannelEnum||Handle to an enumeration as returned by <om win32evtlog.EvtOpenChannelEnum> return NULL; + BOOL bsuccess; while (true){ if (buf) free(buf); @@ -516,7 +519,11 @@ WCHAR *buf=(WCHAR *)malloc(allocated_size * sizeof(WCHAR)); if (!buf) return NULL; - if (EvtNextChannelPath(enum_handle, allocated_size, buf, &returned_size)){ + + Py_BEGIN_ALLOW_THREADS + bsuccess = EvtNextChannelPath(enum_handle, allocated_size, buf, &returned_size); + Py_END_ALLOW_THREADS + if (bsuccess){ ret=PyWinObject_FromWCHAR(buf); break; } @@ -555,7 +562,9 @@ return NULL; if (!PyWinObject_AsWCHAR(obpath, &path, FALSE)) return NULL; + Py_BEGIN_ALLOW_THREADS log_handle=EvtOpenLog(session, path, flags); + Py_END_ALLOW_THREADS PyWinObject_FreeWCHAR(path); if (log_handle==NULL) return PyWin_SetAPIError("EvtOpenLog"); @@ -582,7 +591,11 @@ return NULL; if (!PyWinObject_AsWCHAR(obexport_path, &export_path, TRUE)) return NULL; - if (EvtClearLog(session, path, export_path, flags)){ + BOOL bsuccess; + Py_BEGIN_ALLOW_THREADS + bsuccess = EvtClearLog(session, path, export_path, flags); + Py_END_ALLOW_THREADS + if (bsuccess){ Py_INCREF(Py_None); return Py_None; } @@ -612,7 +625,11 @@ return NULL; if (!PyWinObject_AsWCHAR(obquery, &query, TRUE)) return NULL; - if (EvtExportLog(session, path, query, export_path, flags)){ + BOOL bsuccess; + Py_BEGIN_ALLOW_THREADS + bsuccess = EvtExportLog(session, path, query, export_path, flags); + Py_END_ALLOW_THREADS + if (bsuccess){ Py_INCREF(Py_None); return Py_None; } @@ -638,7 +655,12 @@ return NULL; if (!PyWinObject_AsWCHAR(obpath, &path, FALSE)) return NULL; - if (EvtArchiveExportedLog(session, path, lcid, flags)){ + + BOOL bsuccess; + Py_BEGIN_ALLOW_THREADS + bsuccess = EvtArchiveExportedLog(session, path, lcid, flags); + Py_END_ALLOW_THREADS + if (bsuccess){ Py_INCREF(Py_None); return Py_None; } @@ -654,6 +676,8 @@ PyObject *ret=NULL; if (!PyArg_ParseTuple(args, ":EvtGetExtendedStatus")) return NULL; + + BOOL bsuccess; while (1){ if (msg) free(msg); @@ -663,7 +687,10 @@ PyErr_NoMemory(); return NULL; } - if (EvtGetExtendedStatus(buflen, msg, &bufneeded)){ + Py_BEGIN_ALLOW_THREADS + bsuccess = EvtGetExtendedStatus(buflen, msg, &bufneeded); + Py_END_ALLOW_THREADS + if (bsuccess){ ret=PyWinObject_FromWCHAR(msg, bufneeded); break; } @@ -696,8 +723,9 @@ return NULL; if (!PyWinObject_AsWCHAR(obquery, &query, TRUE)) return NULL; - + Py_BEGIN_ALLOW_THREADS ret = EvtQuery(session, path, query, flags); + Py_END_ALLOW_THREADS if (ret == NULL) return PyWin_SetAPIError("EvtQuery"); return PyWinObject_FromEVT_HANDLE(ret); @@ -726,8 +754,11 @@ PyErr_NoMemory(); return NULL; } - - if (!EvtNext(query, nbr_requested, events, timeout, flags, &nbr_returned)){ + BOOL bsuccess; + Py_BEGIN_ALLOW_THREADS + bsuccess = EvtNext(query, nbr_requested, events, timeout, flags, &nbr_returned); + Py_END_ALLOW_THREADS + if (!bsuccess){ free(events); DWORD err=GetLastError(); if (err == ERROR_NO_MORE_ITEMS) @@ -769,7 +800,11 @@ PyWinObject_AsHANDLE, &bookmark, // @pyparm <o PyEVT_HANDLE>|Bookmark|None|Used as seek origin only if Flags contains EvtSeekRelativeToBookmark &timeout)) // @pyparm int|Timeout|0|Reserved, use only 0 return NULL; - if (!EvtSeek(query, position, bookmark, timeout, flags)) + BOOL bsuccess; + Py_BEGIN_ALLOW_THREADS + bsuccess = EvtSeek(query, position, bookmark, timeout, flags); + Py_END_ALLOW_THREADS + if (!bsuccess) return PyWin_SetAPIError("EvtSeek"); Py_INCREF(Py_None); return Py_None;; @@ -796,6 +831,7 @@ PyErr_Format(PyExc_NotImplementedError,"Rendering values is not yet supported"); return NULL; } + BOOL bsuccess; while(1){ if (buf) free(buf); @@ -804,7 +840,11 @@ PyErr_NoMemory(); return NULL; } - if (EvtRender(NULL, event, flags, bufsize, buf, &bufneeded, &propcount)){ + + Py_BEGIN_ALLOW_THREADS + bsuccess = EvtRender(NULL, event, flags, bufsize, buf, &bufneeded, &propcount); + Py_END_ALLOW_THREADS + if (bsuccess){ ret=PyWinObject_FromWCHAR((WCHAR *)buf); break; } @@ -902,8 +942,10 @@ if (obuserdata==NULL) return NULL; } + Py_BEGIN_ALLOW_THREADS ret = EvtSubscribe(session, signalevent, path, query, bookmark, (void *)obuserdata, pfncallback, flags); + Py_END_ALLOW_THREADS if (ret==NULL) return PyWin_SetAPIError("EvtSubscribe"); return PyWinObject_FromEVT_HANDLE(ret, obuserdata); @@ -924,7 +966,9 @@ return NULL; if (!PyWinObject_AsWCHAR(obxml, &xml, TRUE)) return NULL; + Py_BEGIN_ALLOW_THREADS ret = EvtCreateBookmark(xml); + Py_END_ALLOW_THREADS if (ret == NULL) return PyWin_SetAPIError("EvtCreateBookmark"); return PyWinObject_FromEVT_HANDLE(ret); @@ -942,13 +986,237 @@ PyWinObject_AsHANDLE, &evt)) // @pyparm <o PyEVT_HANDLE>|Event||Handle to an event return NULL; - if (!EvtUpdateBookmark(bookmark, evt)) + BOOL bsuccess; + Py_BEGIN_ALLOW_THREADS + bsuccess = EvtUpdateBookmark(bookmark, evt); + Py_END_ALLOW_THREADS + if (!bsuccess) return PyWin_SetAPIError("EvtUpdateBookmark"); Py_INCREF(Py_None); return Py_None; } PyCFunction pfnPyEvtUpdateBookmark = (PyCFunction) PyEvtUpdateBookmark; +PyObject *PyWinObject_FromEVT_VARIANT(PEVT_VARIANT val) +{ + if (val->Type & EVT_VARIANT_TYPE_ARRAY){ + PyErr_SetString(PyExc_NotImplementedError, "EVT_VARIANT arrays not supported yet"); + return NULL; + } + DWORD val_type = val->Type & EVT_VARIANT_TYPE_MASK; + PyObject *obval = NULL; + switch (val_type){ + case EvtVarTypeNull: + Py_INCREF(Py_None); + obval = Py_None; + break; + case EvtVarTypeString: + obval = PyWinObject_FromWCHAR(val->StringVal); + break; + case EvtVarTypeAnsiString: + obval = PyWinCoreString_FromString(val->AnsiStringVal); + break; + case EvtVarTypeSByte: + obval = PyLong_FromLong(val->SByteVal); + break; + case EvtVarTypeByte: + obval = PyLong_FromUnsignedLong(val->ByteVal); + break; + case EvtVarTypeInt16: + obval = PyLong_FromLong(val->Int16Val); + break; + case EvtVarTypeUInt16: + obval = PyLong_FromUnsignedLong(val->UInt16Val); + break; + case EvtVarTypeInt32: + obval = PyLong_FromLong(val->Int32Val); + break; + case EvtVarTypeUInt32: + obval = PyLong_FromUnsignedLong(val->UInt32Val); + break; + case EvtVarTypeInt64: + obval = PyLong_FromLongLong(val->Int64Val); + break; + case EvtVarTypeUInt64: + obval = PyLong_FromUnsignedLongLong(val->UInt64Val); + break; + case EvtVarTypeSingle: + obval = PyFloat_FromDouble(val->SingleVal); + break; + case EvtVarTypeDouble: + obval = PyFloat_FromDouble(val->DoubleVal); + break; + case EvtVarTypeBoolean: + obval = PyBool_FromLong(val->BooleanVal); + break; + case EvtVarTypeBinary: + obval = PyString_FromStringAndSize((char *)val->BinaryVal, val->Count); + break; + case EvtVarTypeGuid: + obval = PyWinObject_FromIID(*val->GuidVal); + break; + case EvtVarTypeSizeT: + obval = PyInt_FromSsize_t(val->SizeTVal); + break; + case EvtVarTypeFileTime: + { + // FileTimeVal is defined as ULONGLONG for unknown reasons + LARGE_INTEGER timestamp; + timestamp.QuadPart = val->FileTimeVal; + obval = PyWinObject_FromTimeStamp(timestamp); + break; + } + case EvtVarTypeSysTime: + obval = PyWinObject_FromSYSTEMTIME(*val->SysTimeVal); + break; + case EvtVarTypeSid: + obval = PyWinObject_FromSID(val->SidVal); + break; + // case EvtVarTypeHexInt32: + // case EvtVarTypeHexInt64: + case EvtVarTypeEvtHandle: + obval = PyWinObject_FromEVT_HANDLE(val->EvtHandleVal); + break; + case EvtVarTypeEvtXml: + obval = PyWinObject_FromWCHAR(val->XmlVal); + break; + default: + PyErr_Format(PyExc_NotImplementedError, "EVT_VARIANT_TYPE %d not supported yet", val_type); + } + if (obval == NULL) + return NULL; + return Py_BuildValue("Nk", obval, val->Type); +} + +// @pyswig (object, int)|EvtGetChannelConfigProperty|Retreives channel configuration information +// @comm Accepts keyword args +// @comm Returns the value and type of value (EvtVarType*) +static PyObject *PyEvtGetChannelConfigProperty(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *keywords[]={"ChannelConfig", "PropertyId", "Flags", NULL}; + EVT_HANDLE config_handle; + EVT_CHANNEL_CONFIG_PROPERTY_ID prop_id; |
From: <pyw...@li...> - 2013-12-08 18:49:12
|
changeset c36870fc25f0 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=c36870fc25f0 summary: Release thread lock when calling PyCERT_CONTEXT methods, update some constants diffstat: win32/Lib/win32cryptcon.py | 28 ++++++++++- win32/src/win32crypt/PyCERT_CONTEXT.cpp | 89 +++++++++++++++++++++++++------- 2 files changed, 96 insertions(+), 21 deletions(-) diffs (235 lines): diff -r 902851ec4db0 -r c36870fc25f0 win32/Lib/win32cryptcon.py --- a/win32/Lib/win32cryptcon.py Sat Dec 07 18:08:31 2013 -0500 +++ b/win32/Lib/win32cryptcon.py Sun Dec 08 13:47:19 2013 -0500 @@ -1149,6 +1149,8 @@ CMSG_OID_IMPORT_KEY_TRANS_FUNC = "CryptMsgDllImportKeyTrans" CMSG_OID_IMPORT_KEY_AGREE_FUNC = "CryptMsgDllImportKeyAgree" CMSG_OID_IMPORT_MAIL_LIST_FUNC = "CryptMsgDllImportMailList" + +# Certificate property id's used with CertGetCertificateContextProperty CERT_KEY_PROV_HANDLE_PROP_ID = 1 CERT_KEY_PROV_INFO_PROP_ID = 2 CERT_SHA1_HASH_PROP_ID = 3 @@ -1185,10 +1187,34 @@ CERT_ARCHIVED_KEY_HASH_PROP_ID = 65 CERT_AUTO_ENROLL_RETRY_PROP_ID = 66 CERT_AIA_URL_RETRIEVED_PROP_ID = 67 -CERT_FIRST_RESERVED_PROP_ID = 68 +CERT_AUTHORITY_INFO_ACCESS_PROP_ID = 68 +CERT_BACKED_UP_PROP_ID = 69 +CERT_OCSP_RESPONSE_PROP_ID = 70 +CERT_REQUEST_ORIGINATOR_PROP_ID = 71 +CERT_SOURCE_LOCATION_PROP_ID = 72 +CERT_SOURCE_URL_PROP_ID = 73 +CERT_NEW_KEY_PROP_ID = 74 +CERT_OCSP_CACHE_PREFIX_PROP_ID = 75 +CERT_SMART_CARD_ROOT_INFO_PROP_ID = 76 +CERT_NO_AUTO_EXPIRE_CHECK_PROP_ID = 77 +CERT_NCRYPT_KEY_HANDLE_PROP_ID = 78 +CERT_HCRYPTPROV_OR_NCRYPT_KEY_HANDLE_PROP_ID = 79 +CERT_SUBJECT_INFO_ACCESS_PROP_ID = 80 +CERT_CA_OCSP_AUTHORITY_INFO_ACCESS_PROP_ID = 81 +CERT_CA_DISABLE_CRL_PROP_ID = 82 +CERT_ROOT_PROGRAM_CERT_POLICIES_PROP_ID = 83 +CERT_ROOT_PROGRAM_NAME_CONSTRAINTS_PROP_ID = 84 +CERT_SUBJECT_OCSP_AUTHORITY_INFO_ACCESS_PROP_ID = 85 +CERT_SUBJECT_DISABLE_CRL_PROP_ID = 86 +CERT_CEP_PROP_ID = 87 +CERT_SIGN_HASH_CNG_ALG_PROP_ID = 89 +CERT_SCARD_PIN_ID_PROP_ID = 90 +CERT_SCARD_PIN_INFO_PROP_ID = 91 +CERT_FIRST_RESERVED_PROP_ID = 92 CERT_LAST_RESERVED_PROP_ID = 0x00007FFF CERT_FIRST_USER_PROP_ID = 0x00008000 CERT_LAST_USER_PROP_ID = 0x0000FFFF + szOID_CERT_PROP_ID_PREFIX = "1.3.6.1.4.1.311.10.11." szOID_CERT_KEY_IDENTIFIER_PROP_ID = "1.3.6.1.4.1.311.10.11.20" szOID_CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID = \ diff -r 902851ec4db0 -r c36870fc25f0 win32/src/win32crypt/PyCERT_CONTEXT.cpp --- a/win32/src/win32crypt/PyCERT_CONTEXT.cpp Sat Dec 07 18:08:31 2013 -0500 +++ b/win32/src/win32crypt/PyCERT_CONTEXT.cpp Sun Dec 08 13:47:19 2013 -0500 @@ -224,12 +224,14 @@ PyObject *PyCERT_CONTEXT::PyCertFreeCertificateContext (PyObject *self, PyObject *args) { PCCERT_CONTEXT pccert_context=((PyCERT_CONTEXT *)self)->GetPCCERT_CONTEXT(); - if (CertFreeCertificateContext (pccert_context)){ - Py_INCREF(Py_None); - return Py_None; - } - PyWin_SetAPIError("CertFreeCertificateContext"); - return NULL; + BOOL bsuccess; + Py_BEGIN_ALLOW_THREADS + bsuccess = CertFreeCertificateContext (pccert_context); + Py_END_ALLOW_THREADS + if (!bsuccess) + return PyWin_SetAPIError("CertFreeCertificateContext"); + Py_INCREF(Py_None); + return Py_None; } // @pymethod [int,...]|PyCERT_CONTEXT|CertEnumCertificateContextProperties|Lists property ids for the certificate @@ -242,7 +244,9 @@ if (ret==NULL) return NULL; while (TRUE){ + Py_BEGIN_ALLOW_THREADS dwPropId=CertEnumCertificateContextProperties(pccert_context, dwPropId); + Py_END_ALLOW_THREADS if (dwPropId==0) break; ret_item=PyLong_FromUnsignedLong(dwPropId); @@ -272,8 +276,12 @@ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|k:CryptAcquireCertificatePrivateKey", keywords, &flags)) // @pyparm int|Flags|0|Combination of CRYPT_ACQUIRE_*_FLAG constants return NULL; - if (!CryptAcquireCertificatePrivateKey(pccert_context, flags, reserved, - &hcryptprov, &keyspec, &callerfree)) + BOOL bsuccess; + Py_BEGIN_ALLOW_THREADS + bsuccess = CryptAcquireCertificatePrivateKey(pccert_context, flags, reserved, + &hcryptprov, &keyspec, &callerfree); + Py_END_ALLOW_THREADS + if (!bsuccess) return PyWin_SetAPIError("CryptAcquireCertificatePrivateKey"); /* If callerfree returns false, CSP handle shouldn't be freed, so increase its refcount since @@ -297,13 +305,19 @@ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|k:CertGetEnhancedKeyUsage", keywords, &flags)) // @pyparm int|Flags|0|CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG, CERT_FIND_PROP_ONLY_ENHKEY_USAGE_FLAG, or 0 return NULL; - if (!CertGetEnhancedKeyUsage(pccert_context, flags, pceu, &bufsize)) + BOOL bsuccess; + Py_BEGIN_ALLOW_THREADS + bsuccess = CertGetEnhancedKeyUsage(pccert_context, flags, pceu, &bufsize); + Py_END_ALLOW_THREADS + if (!bsuccess) return PyWin_SetAPIError("CertGetEnhancedKeyUsage"); pceu=(PCERT_ENHKEY_USAGE)malloc(bufsize); if (pceu==NULL) return PyErr_Format(PyExc_MemoryError, "Failed to allocate %d bytes", bufsize); - - if (!CertGetEnhancedKeyUsage(pccert_context, flags, pceu, &bufsize)) + Py_BEGIN_ALLOW_THREADS + bsuccess = CertGetEnhancedKeyUsage(pccert_context, flags, pceu, &bufsize); + Py_END_ALLOW_THREADS + if (!bsuccess) PyWin_SetAPIError("CertGetEnhancedKeyUsage"); else ret=PyWinObject_FromCTL_USAGE(pceu); @@ -318,7 +332,11 @@ PCCERT_CONTEXT pccert_context=((PyCERT_CONTEXT *)self)->GetPCCERT_CONTEXT(); DWORD buf; DWORD bufsize=sizeof(DWORD); - if (!CertGetIntendedKeyUsage(pccert_context->dwCertEncodingType, pccert_context->pCertInfo, (BYTE *)&buf, bufsize)) + BOOL bsuccess; + Py_BEGIN_ALLOW_THREADS + bsuccess = CertGetIntendedKeyUsage(pccert_context->dwCertEncodingType, pccert_context->pCertInfo, (BYTE *)&buf, bufsize); + Py_END_ALLOW_THREADS + if (!bsuccess) return PyWin_SetAPIError("CertGetIntendedKeyUsage"); return PyLong_FromUnsignedLong(buf); } @@ -334,12 +352,21 @@ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|k:CertSerializeCertificateStoreElement", keywords, &flags)) // @pyparm int|Flags|0|Reserved, use only 0 if passed in return NULL; - if (!CertSerializeCertificateStoreElement(pccert_context, flags, buf, &bufsize)) + + BOOL bsuccess; + Py_BEGIN_ALLOW_THREADS + bsuccess = CertSerializeCertificateStoreElement(pccert_context, flags, buf, &bufsize); + Py_END_ALLOW_THREADS + if (!bsuccess) return PyWin_SetAPIError("CertSerializeCertificateStoreElement"); buf=(BYTE *)malloc(bufsize); if (buf==NULL) return PyErr_Format(PyExc_MemoryError, "Unable to allocate %d bytes", bufsize); - if (!CertSerializeCertificateStoreElement(pccert_context, flags, buf, &bufsize)) + + Py_BEGIN_ALLOW_THREADS + bsuccess = CertSerializeCertificateStoreElement(pccert_context, flags, buf, &bufsize); + Py_END_ALLOW_THREADS + if (!bsuccess) PyWin_SetAPIError("CertSerializeCertificateStoreElement"); else ret=PyString_FromStringAndSize((char *)buf, bufsize); @@ -362,7 +389,11 @@ return NULL; if (!PyWinObject_AsCERT_CONTEXT(obissuer, &issuer, TRUE)) return NULL; - if (!CertVerifySubjectCertificateContext(pccert_context, issuer, &flags)) + BOOL bsuccess; + Py_BEGIN_ALLOW_THREADS + bsuccess = CertVerifySubjectCertificateContext(pccert_context, issuer, &flags); + Py_END_ALLOW_THREADS + if (!bsuccess) return PyWin_SetAPIError("CertVerifySubjectCertificateContext"); return PyLong_FromUnsignedLong(flags); } @@ -371,7 +402,11 @@ PyObject *PyCERT_CONTEXT::PyCertDeleteCertificateFromStore(PyObject *self, PyObject *args) { PCCERT_CONTEXT pcert_context=((PyCERT_CONTEXT *)self)->GetPCCERT_CONTEXT(); - if (!CertDeleteCertificateFromStore(pcert_context)) + BOOL bsuccess; + Py_BEGIN_ALLOW_THREADS + bsuccess = CertDeleteCertificateFromStore(pcert_context); + Py_END_ALLOW_THREADS + if (!bsuccess) return PyWin_SetAPIError("CertDeleteCertificateFromStore"); Py_INCREF(Py_None); return Py_None; @@ -391,7 +426,11 @@ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "k:CertGetCertificateContextProperty", keywords, &dwPropId)) // @pyparm int|PropId||One of the CERT_*_PROP_ID constants return NULL; - if (!CertGetCertificateContextProperty(pccert_context, dwPropId, pvData, &pcbData)){ + BOOL bsuccess; + Py_BEGIN_ALLOW_THREADS + bsuccess = CertGetCertificateContextProperty(pccert_context, dwPropId, pvData, &pcbData); + Py_END_ALLOW_THREADS + if (!bsuccess){ PyWin_SetAPIError("CertGetCertificateContextProperty"); return NULL; } @@ -401,7 +440,10 @@ if (pvData==NULL) return PyErr_Format(PyExc_MemoryError,"CertGetCertificateContextProperty: unable to allocate %d bytes", pcbData); ZeroMemory(pvData, pcbData); - if (!CertGetCertificateContextProperty(pccert_context, dwPropId, pvData, &pcbData)){ + Py_BEGIN_ALLOW_THREADS + bsuccess = CertGetCertificateContextProperty(pccert_context, dwPropId, pvData, &pcbData); + Py_END_ALLOW_THREADS + if (!bsuccess){ PyWin_SetAPIError("CertGetCertificateContextProperty"); free(pvData); return NULL; @@ -494,9 +536,13 @@ &flags)) // @pyparm int|Flags|0|Combination of CERT_SET_* flags return NULL; + BOOL bsuccess; // When Data is None, property is to be deleted so no conversion necessary if (obData==Py_None){ - if (!CertSetCertificateContextProperty(pccert_context, prop, flags, NULL)) + Py_BEGIN_ALLOW_THREADS + bsuccess = CertSetCertificateContextProperty(pccert_context, prop, flags, NULL); + Py_END_ALLOW_THREADS + if (!bsuccess) return PyWin_SetAPIError("CertSetCertificateContextProperty"); else{ Py_INCREF(Py_None); @@ -577,7 +623,10 @@ goto cleanup; } - if (!CertSetCertificateContextProperty(pccert_context, prop, flags, pvData)) + Py_BEGIN_ALLOW_THREADS + bsuccess = CertSetCertificateContextProperty(pccert_context, prop, flags, pvData); + Py_END_ALLOW_THREADS + if (!bsuccess) PyWin_SetAPIError("CertSetCertificateContextProperty"); else{ Py_INCREF(Py_None); |
From: <pyw...@li...> - 2013-12-07 23:09:38
|
changeset 902851ec4db0 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=902851ec4db0 summary: Add certificate functions to win32crypt, unswig existing functions diffstat: AutoDuck/pywin32.mak | 3 +- setup.py | 16 +- win32/Lib/win32cryptcon.py | 207 ++- win32/src/win32crypt.i | 177 -- win32/src/win32crypt/PyCERTSTORE.cpp | 590 +++++++ win32/src/win32crypt/PyCERT_CONTEXT.cpp | 602 +++++++ win32/src/win32crypt/PyCRYPTHASH.cpp | 281 +++ win32/src/win32crypt/PyCRYPTKEY.cpp | 314 +++ win32/src/win32crypt/PyCRYPTMSG.cpp | 125 + win32/src/win32crypt/PyCRYPTPROV.cpp | 459 +++++ win32/src/win32crypt/PyCTL_CONTEXT.cpp | 210 ++ win32/src/win32crypt/win32crypt.h | 354 ++++ win32/src/win32crypt/win32crypt_structs.cpp | 1036 ++++++++++++ win32/src/win32crypt/win32cryptmodule.cpp | 2218 +++++++++++++++++++++++++++ 14 files changed, 6409 insertions(+), 183 deletions(-) diffs (truncated from 6804 to 300 lines): diff -r 337015e6d473 -r 902851ec4db0 AutoDuck/pywin32.mak --- a/AutoDuck/pywin32.mak Mon Dec 02 09:09:14 2013 +1100 +++ b/AutoDuck/pywin32.mak Sat Dec 07 18:08:31 2013 -0500 @@ -40,10 +40,11 @@ $(WIN32_SOURCE_DIR)/win32net/*.cpp \ $(WIN32_SOURCE_DIR)/win32wnet/*.cpp \ $(WIN32_SOURCE_DIR)/win32print/*.cpp \ + $(WIN32_SOURCE_DIR)/win32crypt/*.cpp \ $(GENDIR)/win32evtlog.d $(GENDIR)/win32event.d $(GENDIR)/win32file.d \ $(GENDIR)/win32service.d $(GENDIR)/win32pipe.d $(GENDIR)/win32security.d \ $(GENDIR)/win32process.d $(GENDIR)/wincerapi.d $(GENDIR)/win32gui.d \ - $(GENDIR)/win32inet.d $(GENDIR)/_winxptheme.d $(GENDIR)/win32crypt.d \ + $(GENDIR)/win32inet.d $(GENDIR)/_winxptheme.d \ $(GENDIR)/win32job.d \ winxpgui.d diff -r 337015e6d473 -r 902851ec4db0 setup.py --- a/setup.py Mon Dec 02 09:09:14 2013 +1100 +++ b/setup.py Sat Dec 07 18:08:31 2013 -0500 @@ -1,4 +1,4 @@ -build_id="218.4" # may optionally include a ".{patchno}" suffix. +build_id="218.5" # may optionally include a ".{patchno}" suffix. # Putting buildno at the top prevents automatic __doc__ assignment, and # I *want* the build number at the top :) __doc__="""This is a distutils setup-script for the pywin32 extensions @@ -1575,7 +1575,17 @@ ("timer", "user32", None, None, "win32/src/timermodule.cpp"), ("win2kras", "rasapi32", None, 0x0500, "win32/src/win2krasmodule.cpp"), ("win32cred", "AdvAPI32 credui", True, 0x0501, 'win32/src/win32credmodule.cpp'), - ("win32crypt", "Crypt32", None, 0x0500, 'win32/src/win32crypt.i'), + ("win32crypt", "Crypt32 Advapi32", True, 0x0500, """ + win32/src/win32crypt/win32cryptmodule.cpp + win32/src/win32crypt/win32crypt_structs.cpp + win32/src/win32crypt/PyCERTSTORE.cpp + win32/src/win32crypt/PyCERT_CONTEXT.cpp + win32/src/win32crypt/PyCRYPTHASH.cpp + win32/src/win32crypt/PyCRYPTKEY.cpp + win32/src/win32crypt/PyCRYPTMSG.cpp + win32/src/win32crypt/PyCRYPTPROV.cpp + win32/src/win32crypt/PyCTL_CONTEXT.cpp + """), ("win32file", "", None, 0x0500, """ win32/src/win32file.i win32/src/win32file_comm.cpp @@ -1937,7 +1947,7 @@ %(mapi)s/PyIMsgStore.i %(mapi)s/PyIMsgStore.cpp %(mapi)s/PyIProfAdmin.i %(mapi)s/PyIProfAdmin.cpp %(mapi)s/PyIProfSect.i %(mapi)s/PyIProfSect.cpp - %(mapi)s/PyIConverterSession.i %(mapi)s/PyIConverterSession.cpp + %(mapi)s/PyIConverterSession.i %(mapi)s/PyIConverterSession.cpp %(mapi)s/PyIMAPIAdviseSink.cpp %(mapi)s/mapiutil.cpp %(mapi)s/mapiguids.cpp diff -r 337015e6d473 -r 902851ec4db0 win32/Lib/win32cryptcon.py --- a/win32/Lib/win32cryptcon.py Mon Dec 02 09:09:14 2013 +1100 +++ b/win32/Lib/win32cryptcon.py Sat Dec 07 18:08:31 2013 -0500 @@ -238,8 +238,10 @@ HP_HMAC_INFO = 0x0005 HP_TLS1PRF_LABEL = 0x0006 HP_TLS1PRF_SEED = 0x0007 + +CRYPT_FAILED = 0 +CRYPT_SUCCEED = 1 def RCRYPT_SUCCEEDED(rt): return ((rt) == CRYPT_SUCCEED) - def RCRYPT_FAILED(rt): return ((rt) == CRYPT_FAILED) PP_ENUMALGS = 1 @@ -607,7 +609,100 @@ CRYPT_DECODE_ALLOC_FLAG = 0x8000 CRYPT_UNICODE_NAME_DECODE_DISABLE_IE4_UTF8_FLAG = \ CERT_RDN_DISABLE_IE4_UTF8_FLAG + CRYPT_ENCODE_DECODE_NONE = 0 +X509_CERT = 1 +X509_CERT_TO_BE_SIGNED = 2 +X509_CERT_CRL_TO_BE_SIGNED = 3 +X509_CERT_REQUEST_TO_BE_SIGNED = 4 +X509_EXTENSIONS = 5 +X509_NAME_VALUE = 6 +X509_NAME = 7 +X509_PUBLIC_KEY_INFO = 8 +X509_AUTHORITY_KEY_ID = 9 +X509_KEY_ATTRIBUTES = 10 +X509_KEY_USAGE_RESTRICTION = 11 +X509_ALTERNATE_NAME = 12 +X509_BASIC_CONSTRAINTS = 13 +X509_KEY_USAGE = 14 +X509_BASIC_CONSTRAINTS2 = 15 +X509_CERT_POLICIES = 16 +PKCS_UTC_TIME = 17 +PKCS_TIME_REQUEST = 18 +RSA_CSP_PUBLICKEYBLOB = 19 +X509_UNICODE_NAME = 20 +X509_KEYGEN_REQUEST_TO_BE_SIGNED = 21 +PKCS_ATTRIBUTE = 22 +PKCS_CONTENT_INFO_SEQUENCE_OF_ANY = 23 +X509_UNICODE_NAME_VALUE = 24 +X509_ANY_STRING = X509_NAME_VALUE +X509_UNICODE_ANY_STRING = X509_UNICODE_NAME_VALUE +X509_OCTET_STRING = 25 +X509_BITS = 26 +X509_INTEGER = 27 +X509_MULTI_BYTE_INTEGER = 28 +X509_ENUMERATED = 29 +X509_CHOICE_OF_TIME = 30 +X509_AUTHORITY_KEY_ID2 = 31 +X509_AUTHORITY_INFO_ACCESS = 32 +X509_SUBJECT_INFO_ACCESS = X509_AUTHORITY_INFO_ACCESS +X509_CRL_REASON_CODE = X509_ENUMERATED +PKCS_CONTENT_INFO = 33 +X509_SEQUENCE_OF_ANY = 34 +X509_CRL_DIST_POINTS = 35 +X509_ENHANCED_KEY_USAGE = 36 +PKCS_CTL = 37 +X509_MULTI_BYTE_UINT = 38 +X509_DSS_PUBLICKEY = X509_MULTI_BYTE_UINT +X509_DSS_PARAMETERS = 39 +X509_DSS_SIGNATURE = 40 +PKCS_RC2_CBC_PARAMETERS = 41 +PKCS_SMIME_CAPABILITIES = 42 +X509_QC_STATEMENTS_EXT = 42 +PKCS_RSA_PRIVATE_KEY = 43 +PKCS_PRIVATE_KEY_INFO = 44 +PKCS_ENCRYPTED_PRIVATE_KEY_INFO = 45 +X509_PKIX_POLICY_QUALIFIER_USERNOTICE = 46 +X509_DH_PUBLICKEY = X509_MULTI_BYTE_UINT +X509_DH_PARAMETERS = 47 +PKCS_ATTRIBUTES = 48 +PKCS_SORTED_CTL = 49 +X509_ECC_SIGNATURE = 47 +X942_DH_PARAMETERS = 50 +X509_BITS_WITHOUT_TRAILING_ZEROES = 51 +X942_OTHER_INFO = 52 +X509_CERT_PAIR = 53 +X509_ISSUING_DIST_POINT = 54 +X509_NAME_CONSTRAINTS = 55 +X509_POLICY_MAPPINGS = 56 +X509_POLICY_CONSTRAINTS = 57 +X509_CROSS_CERT_DIST_POINTS = 58 +CMC_DATA = 59 +CMC_RESPONSE = 60 +CMC_STATUS = 61 +CMC_ADD_EXTENSIONS = 62 +CMC_ADD_ATTRIBUTES = 63 +X509_CERTIFICATE_TEMPLATE = 64 +OCSP_SIGNED_REQUEST = 65 +OCSP_REQUEST = 66 +OCSP_RESPONSE = 67 +OCSP_BASIC_SIGNED_RESPONSE = 68 +OCSP_BASIC_RESPONSE = 69 +X509_LOGOTYPE_EXT = 70 +X509_BIOMETRIC_EXT = 71 +CNG_RSA_PUBLIC_KEY_BLOB = 72 +X509_OBJECT_IDENTIFIER = 73 +X509_ALGORITHM_IDENTIFIER = 74 +PKCS_RSA_SSA_PSS_PARAMETERS = 75 +PKCS_RSAES_OAEP_PARAMETERS = 76 +ECC_CMS_SHARED_INFO = 77 +TIMESTAMP_REQUEST = 78 +TIMESTAMP_RESPONSE = 79 +TIMESTAMP_INFO = 80 +X509_CERT_BUNDLE = 81 +PKCS7_SIGNER_INFO = 500 +CMS_SIGNER_INFO = 501 + szOID_AUTHORITY_KEY_IDENTIFIER = "2.5.29.1" szOID_KEY_ATTRIBUTES = "2.5.29.2" szOID_CERT_POLICIES_95 = "2.5.29.3" @@ -873,9 +968,13 @@ CRYPT_OID_FORMAT_OBJECT_FUNC = "CryptDllFormatObject" CRYPT_OID_FIND_OID_INFO_FUNC = "CryptDllFindOIDInfo" CRYPT_OID_FIND_LOCALIZED_NAME_FUNC = "CryptDllFindLocalizedName" + CRYPT_OID_REGPATH = "Software\\Microsoft\\Cryptography\\OID" CRYPT_OID_REG_ENCODING_TYPE_PREFIX = "EncodingType " +CRYPT_OID_REG_DLL_VALUE_NAME = u"Dll" +CRYPT_OID_REG_FUNC_NAME_VALUE_NAME = u"FuncName" CRYPT_OID_REG_FUNC_NAME_VALUE_NAME_A = "FuncName" +CRYPT_OID_REG_FLAGS_VALUE_NAME = u"CryptFlags" CRYPT_DEFAULT_OID = "DEFAULT" CRYPT_INSTALL_OID_FUNC_BEFORE_FLAG = 1 CRYPT_GET_INSTALLED_OID_FUNC_FLAG = 0x1 @@ -918,6 +1017,8 @@ CMSG_SIGNED_AND_ENVELOPED = 4 CMSG_HASHED = 5 CMSG_ENCRYPTED = 6 + +CMSG_ALL_FLAGS = -1 CMSG_DATA_FLAG = (1 << CMSG_DATA) CMSG_SIGNED_FLAG = (1 << CMSG_SIGNED) CMSG_ENVELOPED_FLAG = (1 << CMSG_ENVELOPED) @@ -1031,6 +1132,7 @@ CMSG_OID_EXPORT_ENCRYPT_KEY_FUNC = "CryptMsgDllExportEncryptKey" CMSG_OID_IMPORT_ENCRYPT_KEY_FUNC = "CryptMsgDllImportEncryptKey" CMSG_CONTENT_ENCRYPT_PAD_ENCODED_LEN_FLAG = 0x00000001 +CMSG_DEFAULT_INSTALLABLE_FUNC_OID = 1 CMSG_CONTENT_ENCRYPT_FREE_PARA_FLAG = 0x00000001 CMSG_CONTENT_ENCRYPT_RELEASE_CONTEXT_FLAG = 0x00008000 CMSG_OID_GEN_CONTENT_ENCRYPT_KEY_FUNC = "CryptMsgDllGenContentEncryptKey" @@ -1181,21 +1283,49 @@ CERT_TRUST_PUB_ALLOW_ENTERPRISE_ADMIN_TRUST = 0x00000002 CERT_TRUST_PUB_CHECK_PUBLISHER_REV_FLAG = 0x00000100 CERT_TRUST_PUB_CHECK_TIMESTAMP_REV_FLAG = 0x00000200 + +CERT_AUTH_ROOT_AUTO_UPDATE_LOCAL_MACHINE_REGPATH = ur"Software\Microsoft\SystemCertificates\AuthRoot\AutoUpdate" CERT_AUTH_ROOT_AUTO_UPDATE_DISABLE_UNTRUSTED_ROOT_LOGGING_FLAG = 0x1 CERT_AUTH_ROOT_AUTO_UPDATE_DISABLE_PARTIAL_CHAIN_LOGGING_FLAG = 0x2 +CERT_AUTH_ROOT_AUTO_UPDATE_ROOT_DIR_URL_VALUE_NAME = u"RootDirUrl" +CERT_AUTH_ROOT_AUTO_UPDATE_SYNC_DELTA_TIME_VALUE_NAME = u"SyncDeltaTime" +CERT_AUTH_ROOT_AUTO_UPDATE_FLAGS_VALUE_NAME = u"Flags" +CERT_AUTH_ROOT_CTL_FILENAME = u"authroot.stl" CERT_AUTH_ROOT_CTL_FILENAME_A = "authroot.stl" +CERT_AUTH_ROOT_CAB_FILENAME = u"authrootstl.cab" +CERT_AUTH_ROOT_SEQ_FILENAME = "authrootseq.txt" +CERT_AUTH_ROOT_CERT_EXT = ".crt" + +CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH = ur"Software\Policies\Microsoft\SystemCertificates" +CERT_EFSBLOB_REGPATH = CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH + ur"\EFS" +CERT_EFSBLOB_VALUE_NAME = u"EFSBlob" +CERT_PROT_ROOT_FLAGS_REGPATH = CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH +ur"\Root\ProtectedRoots" +CERT_PROT_ROOT_FLAGS_VALUE_NAME = u"Flags" +CERT_TRUST_PUB_SAFER_GROUP_POLICY_REGPATH = CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH + ur"\TrustedPublisher\Safer" +CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH = ur"Software\Microsoft\SystemCertificates" +CERT_TRUST_PUB_SAFER_LOCAL_MACHINE_REGPATH = CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH + ur"\TrustedPublisher\Safer" +CERT_TRUST_PUB_AUTHENTICODE_FLAGS_VALUE_NAME = u"AuthenticodeFlags" +CERT_OCM_SUBCOMPONENTS_LOCAL_MACHINE_REGPATH = ur"SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\OC Manager\Subcomponents" +CERT_OCM_SUBCOMPONENTS_ROOT_AUTO_UPDATE_VALUE_NAME = ur"RootAutoUpdate" +CERT_DISABLE_ROOT_AUTO_UPDATE_REGPATH = CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH + ur"\AuthRoot" +CERT_DISABLE_ROOT_AUTO_UPDATE_VALUE_NAME = u"DisableRootAutoUpdate" +CERT_AUTH_ROOT_AUTO_UPDATE_LOCAL_MACHINE_REGPATH = CERT_LOCAL_MACHINE_SYSTEM_STORE_REGPATH + ur"\AuthRoot\AutoUpdate" + CERT_REGISTRY_STORE_REMOTE_FLAG = 0x10000 CERT_REGISTRY_STORE_SERIALIZED_FLAG = 0x20000 CERT_REGISTRY_STORE_CLIENT_GPT_FLAG = (-2147483648) CERT_REGISTRY_STORE_LM_GPT_FLAG = 0x01000000 CERT_REGISTRY_STORE_ROAMING_FLAG = 0x40000 CERT_REGISTRY_STORE_MY_IE_DIRTY_FLAG = 0x80000 +CERT_IE_DIRTY_FLAGS_REGPATH = ur"Software\Microsoft\Cryptography\IEDirtyFlags" + CERT_FILE_STORE_COMMIT_ENABLE_FLAG = 0x10000 CERT_LDAP_STORE_SIGN_FLAG = 0x10000 CERT_LDAP_STORE_AREC_EXCLUSIVE_FLAG = 0x20000 CERT_LDAP_STORE_OPENED_FLAG = 0x40000 CERT_LDAP_STORE_UNBIND_FLAG = 0x80000 CRYPT_OID_OPEN_STORE_PROV_FUNC = "CertDllOpenStoreProv" + CERT_STORE_PROV_EXTERNAL_FLAG = 0x1 CERT_STORE_PROV_DELETED_FLAG = 0x2 CERT_STORE_PROV_NO_PERSIST_FLAG = 0x4 @@ -1329,6 +1459,8 @@ CERT_STORE_CERTIFICATE_CONTEXT = 1 CERT_STORE_CRL_CONTEXT = 2 CERT_STORE_CTL_CONTEXT = 3 + +CERT_STORE_ALL_CONTEXT_FLAG = -1 CERT_STORE_CERTIFICATE_CONTEXT_FLAG = \ (1 << CERT_STORE_CERTIFICATE_CONTEXT) CERT_STORE_CRL_CONTEXT_FLAG = \ @@ -1358,11 +1490,23 @@ CERT_CREATE_CONTEXT_SORTED_FLAG = 0x2 CERT_CREATE_CONTEXT_NO_HCRYPTMSG_FLAG = 0x4 CERT_CREATE_CONTEXT_NO_ENTRY_FLAG = 0x8 + CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG = 0x1 CERT_PHYSICAL_STORE_OPEN_DISABLE_FLAG = 0x2 CERT_PHYSICAL_STORE_REMOTE_OPEN_DISABLE_FLAG = 0x4 CERT_PHYSICAL_STORE_INSERT_COMPUTER_NAME_ENABLE_FLAG = 0x8 CERT_PHYSICAL_STORE_PREDEFINED_ENUM_FLAG = 0x1 + +# Names of physical cert stores +CERT_PHYSICAL_STORE_DEFAULT_NAME = u".Default" +CERT_PHYSICAL_STORE_GROUP_POLICY_NAME = u".GroupPolicy" +CERT_PHYSICAL_STORE_LOCAL_MACHINE_NAME = u".LocalMachine" +CERT_PHYSICAL_STORE_DS_USER_CERTIFICATE_NAME = u".UserCertificate" +CERT_PHYSICAL_STORE_LOCAL_MACHINE_GROUP_POLICY_NAME = u".LocalMachineGroupPolicy" +CERT_PHYSICAL_STORE_ENTERPRISE_NAME = u".Enterprise" +CERT_PHYSICAL_STORE_AUTH_ROOT_NAME = u".AuthRoot" +CERT_PHYSICAL_STORE_SMART_CARD_NAME = u".SmartCard" + CRYPT_OID_OPEN_SYSTEM_STORE_PROV_FUNC = "CertDllOpenSystemStoreProv" CRYPT_OID_REGISTER_SYSTEM_STORE_FUNC = "CertDllRegisterSystemStore" CRYPT_OID_UNREGISTER_SYSTEM_STORE_FUNC = "CertDllUnregisterSystemStore" @@ -1370,6 +1514,8 @@ CRYPT_OID_REGISTER_PHYSICAL_STORE_FUNC = "CertDllRegisterPhysicalStore" CRYPT_OID_UNREGISTER_PHYSICAL_STORE_FUNC = "CertDllUnregisterPhysicalStore" CRYPT_OID_ENUM_PHYSICAL_STORE_FUNC = "CertDllEnumPhysicalStore" +CRYPT_OID_SYSTEM_STORE_LOCATION_VALUE_NAME = u"SystemStoreLocation" + CMSG_TRUSTED_SIGNER_FLAG = 0x1 CMSG_SIGNER_ONLY_FLAG = 0x2 CMSG_USE_SIGNER_INDEX_FLAG = 0x4 @@ -1409,7 +1555,7 @@ CRYPT_FIND_SILENT_KEYSET_FLAG = 0x00000040 CRYPT_OID_IMPORT_PRIVATE_KEY_INFO_FUNC = "CryptDllImportPrivateKeyInfoEx" CRYPT_OID_EXPORT_PRIVATE_KEY_INFO_FUNC = "CryptDllExportPrivateKeyInfoEx" -CRYPT_DELETE_KEYSET = 0x0001 +CRYPT_DELETE_KEYSET = CRYPT_DELETEKEYSET CERT_SIMPLE_NAME_STR = 1 CERT_OID_NAME_STR = 2 |
From: <pyw...@li...> - 2013-12-01 22:09:30
|
changeset 337015e6d473 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=337015e6d473 summary: Add missing PyIConverterSession.i file diffstat: com/win32comext/mapi/src/PyIConverterSession.i | 181 +++++++++++++++++++++++++ 1 files changed, 181 insertions(+), 0 deletions(-) diffs (185 lines): diff -r c031fedef936 -r 337015e6d473 com/win32comext/mapi/src/PyIConverterSession.i --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com/win32comext/mapi/src/PyIConverterSession.i Mon Dec 02 09:09:14 2013 +1100 @@ -0,0 +1,181 @@ +/* File : PyIConverterSession.i */ + +%module IConverterSession + +%include "typemaps.i" +%include "pywin32.i" +%include "pythoncom.i" +%include "mapilib.i" + +%typemap(python,ignore) IConverterSession **OUTPUT(IConverterSession *temp) +{ + $target = &temp; +} +%typemap(python,argout) IConverterSession **OUTPUT { + MAKE_OUTPUT_INTERFACE($source, $target, IID_IConverterSession) +} +%typemap(python,freearg) IConverterSession *INPUT, + IConverterSession *INPUT_NULLOK +{ + if ($source) $source->Release(); +} + +%typemap(python,in) IConverterSession *INPUT { + if (!PyCom_InterfaceFromPyInstanceOrObject($source, IID_IConverterSession, (void **)&$target, 0)) + return NULL; +} +%typemap(python,in) IConverterSession *INPUT_NULLOK { + if (!PyCom_InterfaceFromPyInstanceOrObject($source, IID_IConverterSession, (void **)&$target, 1)) + return NULL; +} + +%{ +#include <MapiUtil.h> +#include <initguid.h> +#include "IConverterSession.h" +#include "PyIConverterSession.h" + +#include "PYIStream.h" +#include "PYIMapiProp.h" +#include "PYIMessage.h" + +PyIConverterSession::PyIConverterSession(IUnknown *pDisp) : + PyIUnknown(pDisp) +{ + ob_type = &type; +} + +/*static*/ IConverterSession *PyIConverterSession::GetI(PyObject *self) +{ + return (IConverterSession *)PyIUnknown::GetI(self); +} + +PyIConverterSession::~PyIConverterSession() +{ +} + +PyObject *PyIConverterSession::MIMEToMAPI(PyObject *self, PyObject *args) +{ + HRESULT hRes; + PyObject *result = NULL; + PyObject *obStream; + PyObject *obMsg; + unsigned long flags; + + IConverterSession *_swig_self; + if ((_swig_self=GetI(self))==NULL) return NULL; + + if (!PyArg_ParseTuple(args, "OO|l:MIMEToMAPI", &obStream, &obMsg, &flags)) + return NULL; + + IStream *pStream = NULL; + IMessage *pMsg = NULL; + + if (!PyCom_InterfaceFromPyObject(obStream, IID_IStream, (void **)&pStream, FALSE)) + goto done; + if (!PyCom_InterfaceFromPyObject(obMsg, IID_IMessage, (void **)&pMsg, FALSE)) + goto done; + + PY_INTERFACE_PRECALL; + hRes = _swig_self->MIMEToMAPI(pStream, pMsg, NULL, flags); + PY_INTERFACE_POSTCALL; + + if (FAILED(hRes)) + result = OleSetOleError(hRes); + else + { + Py_INCREF(Py_None); + result = Py_None; + } + +done: + if (pStream) + pStream->Release(); + if (pMsg) + pMsg->Release(); + + return result; +} + +PyObject *PyIConverterSession::MAPIToMIMEStm(PyObject *self, PyObject *args) +{ + HRESULT hRes; + PyObject *result = NULL; + PyObject *obStream; + PyObject *obMsg; + unsigned long flags; + + IConverterSession *_swig_self; + if ((_swig_self=GetI(self))==NULL) return NULL; + + if (!PyArg_ParseTuple(args, "OO|l:MAPIToMIMEStm", &obMsg, &obStream, &flags)) + return NULL; + + IStream *pStream = NULL; + IMessage *pMsg = NULL; + + if (!PyCom_InterfaceFromPyObject(obMsg, IID_IMessage, (void **)&pMsg, FALSE)) + goto done; + if (!PyCom_InterfaceFromPyObject(obStream, IID_IStream, (void **)&pStream, FALSE)) + goto done; + + PY_INTERFACE_PRECALL; + hRes = _swig_self->MAPIToMIMEStm(pMsg, pStream, flags); + PY_INTERFACE_POSTCALL; + + if (FAILED(hRes)) + result = OleSetOleError(hRes); + else + { + Py_INCREF(Py_None); + result = Py_None; + } + +done: + if (pStream) + pStream->Release(); + if (pMsg) + pMsg->Release(); + + return result; +} + +PyObject *PyIConverterSession::SetAdrBook(PyObject *self, PyObject *args) +{ + HRESULT hRes; + PyObject *result = NULL; + PyObject *obIAddrBook; + + IConverterSession *_swig_self; + if ((_swig_self=GetI(self))==NULL) return NULL; + + if (!PyArg_ParseTuple(args, "O:SetAdrBook", &obIAddrBook)) + return NULL; + + IAddrBook *pAddrBook = NULL; + + if (obIAddrBook != Py_None && !PyCom_InterfaceFromPyObject(obIAddrBook, IID_IAddrBook, (void **)&pAddrBook, FALSE)) + return NULL; + + PY_INTERFACE_PRECALL; + hRes = _swig_self->SetAdrBook(pAddrBook); + PY_INTERFACE_POSTCALL; + + if (FAILED(hRes)) + result = OleSetOleError(hRes); + else + { + Py_INCREF(Py_None); + result = Py_None; + } + + if (pAddrBook) + pAddrBook->Release(); + + return result; +} +%} + +%native(MIMEToMAPI) MIMEToMAPI; +%native(MAPIToMIMEStm) MAPIToMIMEStm; +%native(SetAdrBook) SetAdrBook; |
From: <pyw...@li...> - 2013-11-24 23:23:40
|
changeset c031fedef936 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=c031fedef936 summary: Add IConverterSession and supporting methods, via patch #132 diffstat: CHANGES.txt | 4 + com/win32comext/mapi/src/PyIExchangeManageStore.i | 10 +--- com/win32comext/mapi/src/mapi.i | 49 ++++++++++++++++++++++- setup.py | 2 + 4 files changed, 56 insertions(+), 9 deletions(-) diffs (145 lines): diff -r cbcbd126551c -r c031fedef936 CHANGES.txt --- a/CHANGES.txt Thu Jun 13 19:16:16 2013 +1000 +++ b/CHANGES.txt Mon Nov 25 10:23:29 2013 +1100 @@ -6,6 +6,10 @@ Since build 218: ---------------- + * win32com.mapi + Addded outlook interface IConverterSession with methods MIMEToMAPI, MAPIToMIMEStm, and SetAdrBook + Added method OpenStreamOnFile (Nick Czeczulin) + * Conversions from a Python object to a variant now does a better job at deciding what variant type to use, taking into account the size and sign of the value (Stefan Schukat via patch #127) diff -r cbcbd126551c -r c031fedef936 com/win32comext/mapi/src/PyIExchangeManageStore.i --- a/com/win32comext/mapi/src/PyIExchangeManageStore.i Thu Jun 13 19:16:16 2013 +1000 +++ b/com/win32comext/mapi/src/PyIExchangeManageStore.i Mon Nov 25 10:23:29 2013 +1100 @@ -76,14 +76,10 @@ Py_END_ALLOW_THREADS if (FAILED(hRes)) - { - OleSetOleError(hRes); - goto error; - } + result = OleSetOleError(hRes); + else + result = Py_BuildValue("s#", sbEID.lpb, sbEID.cb); - result = Py_BuildValue("s#", sbEID.lpb, sbEID.cb); - -error: MAPIFreeBuffer((LPENTRYID)sbEID.lpb); return result; diff -r cbcbd126551c -r c031fedef936 com/win32comext/mapi/src/mapi.i --- a/com/win32comext/mapi/src/mapi.i Thu Jun 13 19:16:16 2013 +1000 +++ b/com/win32comext/mapi/src/mapi.i Mon Nov 25 10:23:29 2013 +1100 @@ -44,6 +44,8 @@ #include "PyIProfSect.h" #include "PyIMsgServiceAdmin.h" #include "PyIMAPIAdviseSink.h" +#include "IConverterSession.h" +#include "PyIConverterSession.h" #include "MAPISPI.H" #include "MAPISPI.H" @@ -176,6 +178,12 @@ if ( PyCom_RegisterGatewayObject(IID_IMAPIAdviseSink, GET_PYGATEWAY_CTOR(PyGMAPIAdviseSink), "IMAPIAdviseSink") != 0) return MODINIT_ERROR_RETURN; ADD_IID(IID_IMAPIAdviseSink); + if ( PyCom_RegisterClientType(&PyIConverterSession::type, &IID_IConverterSession) != 0 ) return MODINIT_ERROR_RETURN; + { + ADD_IID(IID_IConverterSession); + ADD_IID(CLSID_IConverterSession); + } + ADD_IID(PS_PUBLIC_STRINGS); ADD_IID(PS_MAPI); ADD_IID(PS_ROUTING_EMAIL_ADDRESSES); @@ -183,7 +191,6 @@ ADD_IID(PS_ROUTING_DISPLAY_NAME); ADD_IID(PS_ROUTING_ENTRYID); ADD_IID(PS_ROUTING_SEARCH_KEY); - %} #define NO_ATTACHMENT NO_ATTACHMENT // The attachment has just been created. @@ -235,7 +242,7 @@ #define RTF_SYNC_RTF_CHANGED RTF_SYNC_RTF_CHANGED // The RTF version of the message has changed. #define MAPI_CREATE MAPI_CREATE // The object will be created if necessary. -#define MAPI_E_CALL_FAILED +#define MAPI_E_CALL_FAILED MAPI_E_CALL_FAILED #define MAPI_E_NOT_ENOUGH_MEMORY MAPI_E_NOT_ENOUGH_MEMORY #define MAPI_E_INVALID_PARAMETER MAPI_E_INVALID_PARAMETER #define MAPI_E_INTERFACE_NOT_SUPPORTED MAPI_E_INTERFACE_NOT_SUPPORTED @@ -449,6 +456,18 @@ #define FLUSH_NO_UI FLUSH_NO_UI #define FLUSH_ASYNC_OK FLUSH_ASYNC_OK +// IConverterSession Constants - http://msdn2.microsoft.com/en-us/library/bb905201.aspx +#define CCSF_SMTP CCSF_SMTP // the converter is being passed an SMTP message +#define CCSF_NOHEADERS CCSF_NOHEADERS // the converter should ignore the headers on the outside message +#define CCSF_USE_TNEF CCSF_USE_TNEF // the converter should embed TNEF in the MIME message +#define CCSF_INCLUDE_BCC CCSF_INCLUDE_BCC // the converter should include Bcc recipients +#define CCSF_8BITHEADERS CCSF_8BITHEADERS // the converter should allow 8 bit headers +#define CCSF_USE_RTF CCSF_USE_RTF // the converter should do HTML->RTF conversion +#define CCSF_PLAIN_TEXT_ONLY CCSF_PLAIN_TEXT_ONLY // the converter should just send plain text +#define CCSF_NO_MSGID CCSF_NO_MSGID // don't include Message-Id field in outgoing messages +#define CCSF_EMBEDDED_MESSAGE CCSF_EMBEDDED_MESSAGE // sent/unsent information is persisted in X-Unsent +#define CCSF_PRESERVE_SOURCE CCSF_PRESERVE_SOURCE // don't modify the source message + // @object MAPIINIT_0|A MAPIINIT_0 is represented as a tuple of: // @tupleitem 0|int|version|This must be MAPI_INIT_VERSION. // @tupleitem 1|int|flags|MAPI initlization flags. @@ -775,3 +794,29 @@ } %} %native(RTFStreamToHTML) MyRTFStreamToHTML; + + +%{ +PyObject *PyOpenStreamOnFile(PyObject *self, PyObject *args) +{ + HRESULT hRes; + unsigned long flags = 0; + IStream *pStream; + char *filepath; + + if (!PyArg_ParseTuple(args, "s|l:OpenStreamOnFile", &filepath, &flags)) + return NULL; + + PY_INTERFACE_PRECALL; + hRes = OpenStreamOnFile(MAPIAllocateBuffer, MAPIFreeBuffer, flags, filepath, NULL, &pStream); + PY_INTERFACE_POSTCALL; + + if (FAILED(hRes)) + return OleSetOleError(hRes); + + return PyCom_PyObjectFromIUnknown(pStream, IID_IStream, FALSE); +} +%} +%native(OpenStreamOnFile) PyOpenStreamOnFile; + + diff -r cbcbd126551c -r c031fedef936 setup.py --- a/setup.py Thu Jun 13 19:16:16 2013 +1000 +++ b/setup.py Mon Nov 25 10:23:29 2013 +1100 @@ -1937,6 +1937,7 @@ %(mapi)s/PyIMsgStore.i %(mapi)s/PyIMsgStore.cpp %(mapi)s/PyIProfAdmin.i %(mapi)s/PyIProfAdmin.cpp %(mapi)s/PyIProfSect.i %(mapi)s/PyIProfSect.cpp + %(mapi)s/PyIConverterSession.i %(mapi)s/PyIConverterSession.cpp %(mapi)s/PyIMAPIAdviseSink.cpp %(mapi)s/mapiutil.cpp %(mapi)s/mapiguids.cpp @@ -2308,6 +2309,7 @@ 'PyIMsgStore': 'IMAPIProp', 'PyIProfAdmin': '', 'PyIProfSect': 'IMAPIProp', + 'PyIConverterSession': '', # exchange and exchdapi 'exchange': None, 'exchdapi': None, |