pywin32-checkins Mailing List for Python for Windows Extensions (Page 149)
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: <mha...@us...> - 2003-10-31 03:05:11
|
Update of /cvsroot/pywin32/pywin32/com/win32com In directory sc8-pr-cvs1:/tmp/cvs-serv20010 Modified Files: __init__.py Log Message: Don't insist sys.winver exists (it doesn't on the Mainwin Linux port) Index: __init__.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/__init__.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** __init__.py 26 Oct 2003 01:18:55 -0000 1.8 --- __init__.py 31 Oct 2003 03:05:07 -0000 1.9 *************** *** 27,34 **** KEY_QUERY_VALUE = 0x1 # Open the root key once, as this is quite slow on NT. - keyName = "SOFTWARE\\Python\\PythonCore\\%s\\PythonPath\\win32com" % sys.winver try: key = win32api.RegOpenKey(HKEY_LOCAL_MACHINE , keyName, 0, KEY_QUERY_VALUE) ! except win32api.error: key = None --- 27,34 ---- KEY_QUERY_VALUE = 0x1 # Open the root key once, as this is quite slow on NT. try: + keyName = "SOFTWARE\\Python\\PythonCore\\%s\\PythonPath\\win32com" % sys.winver key = win32api.RegOpenKey(HKEY_LOCAL_MACHINE , keyName, 0, KEY_QUERY_VALUE) ! except (win32api.error, AttributeError): key = None |
|
From: <mha...@us...> - 2003-10-31 03:04:06
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client
In directory sc8-pr-cvs1:/tmp/cvs-serv19480
Modified Files:
gencache.py
Log Message:
We would fail is the __gen_path__ directory didn't exist (as we decided we
were readonly). Now use the same semantics as we use for the rest of the
.zip support.
Index: gencache.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/gencache.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** gencache.py 6 Oct 2003 13:12:46 -0000 1.22
--- gencache.py 31 Oct 2003 03:04:02 -0000 1.23
***************
*** 39,43 ****
# There is no reason we *must* be readonly in a .zip, but we are now,
# and we really do need a "read-only" concept anyway.
! is_readonly = not os.path.isdir(os.path.dirname(win32com.__gen_path__))
# A dictionary of ITypeLibrary objects for demand generation explicitly handed to us
--- 39,45 ----
# There is no reason we *must* be readonly in a .zip, but we are now,
# and we really do need a "read-only" concept anyway.
! # We don't want to use isdir() though, as we have always gracefully
! # created this directory when we could.
! is_readonly = win32com.__gen_path__.find(".zip\\") >= 0
# A dictionary of ITypeLibrary objects for demand generation explicitly handed to us
***************
*** 105,108 ****
--- 107,111 ----
Checks the directory is OK.
"""
+ assert not is_readonly, "Why do you want the genpath for a readonly store?"
try:
os.makedirs(win32com.__gen_path__)
|
|
From: <mha...@us...> - 2003-10-31 02:54:15
|
Update of /cvsroot/pywin32/pywin32/win32/src
In directory sc8-pr-cvs1:/tmp/cvs-serv17507
Modified Files:
PyWinTypesmodule.cpp
Log Message:
It would help it I spelt DllMain correctly.
Index: PyWinTypesmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypesmodule.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** PyWinTypesmodule.cpp 31 Oct 2003 02:47:39 -0000 1.10
--- PyWinTypesmodule.cpp 31 Oct 2003 02:54:12 -0000 1.11
***************
*** 494,498 ****
extern "C" __declspec(dllexport)
#endif
! BOOL WINAPI DLLMAIN(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
{
switch (dwReason) {
--- 494,498 ----
extern "C" __declspec(dllexport)
#endif
! BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
{
switch (dwReason) {
|
|
From: <mha...@us...> - 2003-10-31 02:47:43
|
Update of /cvsroot/pywin32/pywin32/win32/src
In directory sc8-pr-cvs1:/tmp/cvs-serv16324
Modified Files:
PyWinTypesmodule.cpp
Log Message:
Remove DLLMAIN macro hell that was used for freeze (but should no longer
be necessary, as a) freeze is dead, and (b) a /D option should be able
to do the same magic.
Index: PyWinTypesmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypesmodule.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** PyWinTypesmodule.cpp 27 Feb 2003 21:54:45 -0000 1.9
--- PyWinTypesmodule.cpp 31 Oct 2003 02:47:39 -0000 1.10
***************
*** 491,506 ****
}
- #ifndef BUILD_FREEZE
- #define DLLMAIN DllMain
- #define DLLMAIN_DECL
- #else
- #define DLLMAIN DllMainpywintypes
- #define DLLMAIN_DECL __declspec(dllexport)
- #endif
-
#ifndef MS_WINCE
! extern "C"
#endif
- DLLMAIN_DECL
BOOL WINAPI DLLMAIN(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
{
--- 491,497 ----
}
#ifndef MS_WINCE
! extern "C" __declspec(dllexport)
#endif
BOOL WINAPI DLLMAIN(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
{
|
|
From: <mha...@us...> - 2003-10-31 02:46:32
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src
In directory sc8-pr-cvs1:/tmp/cvs-serv16059
Modified Files:
dllmain.cpp
Log Message:
Fix case of a few #includes, and remove DLLMAIN macro hell that was used
for freeze (but should no longer be necessary, as a) freeze is dead, and
(b) a /D option should be able to do the same magic.
Index: dllmain.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/dllmain.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** dllmain.cpp 7 Jul 2003 14:10:53 -0000 1.9
--- dllmain.cpp 31 Oct 2003 02:46:29 -0000 1.10
***************
*** 6,11 ****
#include <Python.h>
! #include <PythonRun.h> /* for Py_Initialize() */
! #include <Import.h> /* for PyImport_GetModuleDict() */
#include "PythonCOM.h"
--- 6,11 ----
#include <Python.h>
! #include <pythonrun.h> /* for Py_Initialize() */
! #include <import.h> /* for PyImport_GetModuleDict() */
#include "PythonCOM.h"
***************
*** 107,124 ****
static BOOL g_bCoInitThreadHasInit = FALSE;
- #ifndef BUILD_FREEZE
- #define DLLMAIN DllMain
- #define DLLMAIN_DECL
- #else
- #define DLLMAIN DllMainpythoncom
- #define DLLMAIN_DECL __declspec(dllexport)
- #endif
-
#ifndef MS_WINCE
! extern "C" DLLMAIN_DECL
! BOOL WINAPI DLLMAIN(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
#else
! DLLMAIN_DECL
! BOOL WINAPI DLLMAIN(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
#endif
{
--- 107,115 ----
static BOOL g_bCoInitThreadHasInit = FALSE;
#ifndef MS_WINCE
! extern "C" __declspec(dllexport)
! BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
#else
! BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)
#endif
{
|
|
From: <mha...@us...> - 2003-10-31 02:45:16
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src
In directory sc8-pr-cvs1:/tmp/cvs-serv15890
Modified Files:
univgw.cpp
Log Message:
Only spew a warning when on an unsupported platform.
Index: univgw.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/univgw.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** univgw.cpp 8 Aug 2003 03:57:51 -0000 1.7
--- univgw.cpp 31 Oct 2003 02:45:13 -0000 1.8
***************
*** 227,231 ****
#else // _M_IX86
! # error make_method not defined for this platform
#endif
--- 227,232 ----
#else // _M_IX86
! /* The MAINWIN toolkit allows us to build this on Linux!!! */
! # pragma message("XXXXXXXXX - win32com.universal wont work on this platform - need make_method")
#endif
|
|
From: <mha...@us...> - 2003-10-31 02:44:14
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/extensions
In directory sc8-pr-cvs1:/tmp/cvs-serv15726/extensions
Modified Files:
PyIPropertyStorage.cpp
Log Message:
Remove inline declarations of loop indexes from the loop.
Index: PyIPropertyStorage.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyIPropertyStorage.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** PyIPropertyStorage.cpp 30 Oct 2003 06:32:26 -0000 1.5
--- PyIPropertyStorage.cpp 31 Oct 2003 02:44:08 -0000 1.6
***************
*** 20,24 ****
LONG cChars = 0;
int len = PySequence_Length(ob);
! for (int i=0;i<len;i++) {
PyObject *sub = PySequence_GetItem(ob, i);
if (PyUnicode_Check(sub))
--- 20,25 ----
LONG cChars = 0;
int len = PySequence_Length(ob);
! int i;
! for (i=0;i<len;i++) {
PyObject *sub = PySequence_GetItem(ob, i);
if (PyUnicode_Check(sub))
***************
*** 183,187 ****
PROPVARIANT *pRet = new PROPVARIANT[len];
! for (int i=0;i<len;i++)
PropVariantInit(pRet+i);
--- 184,189 ----
PROPVARIANT *pRet = new PROPVARIANT[len];
! int i;
! for (i=0;i<len;i++)
PropVariantInit(pRet+i);
***************
*** 279,283 ****
return NULL;
}
! for (ULONG i=0;i<cProps;i++)
PropVariantInit(pPropVars+i);
--- 281,286 ----
return NULL;
}
! ULONG i;
! for (i=0;i<cProps;i++)
PropVariantInit(pPropVars+i);
|
|
From: <mha...@us...> - 2003-10-31 02:43:06
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory sc8-pr-cvs1:/tmp/cvs-serv15449 Modified Files: PyFactory.cpp Log Message: Fix case of #include files (fails when building on Linux ;) Index: PyFactory.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyFactory.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PyFactory.cpp 1 Sep 2003 08:08:09 -0000 1.5 --- PyFactory.cpp 31 Oct 2003 02:43:03 -0000 1.6 *************** *** 5,9 **** #include "stdafx.h" ! #include <Import.h> /* for PyImport_ImportModule() */ #include "PythonCOM.h" --- 5,9 ---- #include "stdafx.h" ! #include <import.h> /* for PyImport_ImportModule() */ #include "PythonCOM.h" |
|
From: <ru...@us...> - 2003-10-30 06:32:49
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/extensions
In directory sc8-pr-cvs1:/tmp/cvs-serv20395/com/win32com/src/extensions
Modified Files:
PyIPropertyStorage.cpp
Added Files:
PyIEnumSTATPROPSETSTG.cpp
Log Message:
Add StgOpenStorageEx and IEnumSTATPROPSETSTG
--- NEW FILE: PyIEnumSTATPROPSETSTG.cpp ---
// This file implements the IEnumSTATPROPSETSTG Interface and Gateway for Python.
// Cloned from PyIEnumSTATPROPSTG.cpp
#include "stdafx.h"
#include "PythonCOM.h"
#ifndef NO_PYCOM_ENUMSTATPROPSETSTG
#include "PyIEnumSTATPROPSETSTG.h"
// @doc - This file contains autoduck documentation
// ---------------------------------------------------
//
// Interface Implementation
PyIEnumSTATPROPSETSTG::PyIEnumSTATPROPSETSTG(IUnknown *pdisp):
PyIUnknown(pdisp)
{
ob_type = &type;
}
PyIEnumSTATPROPSETSTG::~PyIEnumSTATPROPSETSTG()
{
}
/* static */ IEnumSTATPROPSETSTG *PyIEnumSTATPROPSETSTG::GetI(PyObject *self)
{
return (IEnumSTATPROPSETSTG *)PyIUnknown::GetI(self);
}
// @pymethod object|PyIEnumSTATPROPSETSTG|Next|Retrieves a specified number of items in the enumeration sequence.
PyObject *PyIEnumSTATPROPSETSTG::Next(PyObject *self, PyObject *args)
{
long celt = 1;
// @pyparm int|num|1|Number of items to retrieve.
if ( !PyArg_ParseTuple(args, "|l:Next", &celt) )
return NULL;
IEnumSTATPROPSETSTG *pIESTATPROPSETSTG = GetI(self);
if ( pIESTATPROPSETSTG == NULL )
return NULL;
STATPROPSETSTG *rgVar = new STATPROPSETSTG[celt];
if ( rgVar == NULL ) {
PyErr_SetString(PyExc_MemoryError, "allocating result STATPROPSETSTGs");
return NULL;
}
int i;
/* for ( i = celt; i--; )
// *** possibly init each structure element???
*/
ULONG celtFetched = 0;
PY_INTERFACE_PRECALL;
HRESULT hr = pIESTATPROPSETSTG->Next(celt, rgVar, &celtFetched);
PY_INTERFACE_POSTCALL;
if ( HRESULT_CODE(hr) != ERROR_NO_MORE_ITEMS && FAILED(hr) )
{
delete [] rgVar;
return PyCom_BuildPyException(hr);
}
PyObject *result = PyTuple_New(celtFetched);
if ( result != NULL )
{
for ( i = celtFetched; i--; )
{
PyObject *ob=PyCom_PyObjectFromSTATPROPSETSTG(&(rgVar[i]));
PyTuple_SET_ITEM(result, i, ob);
}
}
delete [] rgVar;
return result;
}
// @pymethod |PyIEnumSTATPROPSETSTG|Skip|Skips over the next specified elementes.
PyObject *PyIEnumSTATPROPSETSTG::Skip(PyObject *self, PyObject *args)
{
long celt;
if ( !PyArg_ParseTuple(args, "l:Skip", &celt) )
return NULL;
IEnumSTATPROPSETSTG *pIESTATPROPSETSTG = GetI(self);
if ( pIESTATPROPSETSTG == NULL )
return NULL;
PY_INTERFACE_PRECALL;
HRESULT hr = pIESTATPROPSETSTG->Skip(celt);
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr);
Py_INCREF(Py_None);
return Py_None;
}
// @pymethod |PyIEnumSTATPROPSETSTG|Reset|Resets the enumeration sequence to the beginning.
PyObject *PyIEnumSTATPROPSETSTG::Reset(PyObject *self, PyObject *args)
{
if ( !PyArg_ParseTuple(args, ":Reset") )
return NULL;
IEnumSTATPROPSETSTG *pIESTATPROPSETSTG = GetI(self);
if ( pIESTATPROPSETSTG == NULL )
return NULL;
PY_INTERFACE_PRECALL;
HRESULT hr = pIESTATPROPSETSTG->Reset();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr);
Py_INCREF(Py_None);
return Py_None;
}
// @pymethod <o PyIEnumSTATPROPSETSTG>|PyIEnumSTATPROPSETSTG|Clone|Creates another enumerator that contains the same enumeration state as the current one
PyObject *PyIEnumSTATPROPSETSTG::Clone(PyObject *self, PyObject *args)
{
if ( !PyArg_ParseTuple(args, ":Clone") )
return NULL;
IEnumSTATPROPSETSTG *pIESTATPROPSETSTG = GetI(self);
if ( pIESTATPROPSETSTG == NULL )
return NULL;
IEnumSTATPROPSETSTG *pClone;
PY_INTERFACE_PRECALL;
HRESULT hr = pIESTATPROPSETSTG->Clone(&pClone);
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr);
return PyCom_PyObjectFromIUnknown(pClone, IID_IEnumSTATPROPSETSTG, FALSE);
}
// @object PyIEnumSTATPROPSETSTG|A Python interface to IEnumSTATPROPSETSTG
static struct PyMethodDef PyIEnumSTATPROPSETSTG_methods[] =
{
{ "Next", PyIEnumSTATPROPSETSTG::Next, 1 }, // @pymeth Next|Retrieves a specified number of items in the enumeration sequence.
{ "Skip", PyIEnumSTATPROPSETSTG::Skip, 1 }, // @pymeth Skip|Skips over the next specified elementes.
{ "Reset", PyIEnumSTATPROPSETSTG::Reset, 1 }, // @pymeth Reset|Resets the enumeration sequence to the beginning.
{ "Clone", PyIEnumSTATPROPSETSTG::Clone, 1 }, // @pymeth Clone|Creates another enumerator that contains the same enumeration state as the current one.
{ NULL }
};
PyComTypeObject PyIEnumSTATPROPSETSTG::type("PyIEnumSTATPROPSETSTG",
&PyIUnknown::type,
sizeof(PyIEnumSTATPROPSETSTG),
PyIEnumSTATPROPSETSTG_methods,
GET_PYCOM_CTOR(PyIEnumSTATPROPSETSTG));
#endif // NO_PYCOM_ENUMSTATPROPSETSTG
Index: PyIPropertyStorage.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyIPropertyStorage.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** PyIPropertyStorage.cpp 18 Oct 2003 06:01:36 -0000 1.4
--- PyIPropertyStorage.cpp 30 Oct 2003 06:32:26 -0000 1.5
***************
*** 241,263 ****
}
- PyObject *PyObject_FromSTATPROPSETSTG(STATPROPSETSTG *pStg)
- {
- if (pStg==NULL) {
- Py_INCREF(Py_None);
- return Py_None;
- }
- PyObject *obfmtid = PyWinObject_FromIID(pStg->fmtid);
- PyObject *obclsid = PyWinObject_FromIID(pStg->clsid);
- PyObject *obmtime = PyWinObject_FromFILETIME(pStg->mtime);
- PyObject *obctime = PyWinObject_FromFILETIME(pStg->ctime);
- PyObject *obatime = PyWinObject_FromFILETIME(pStg->atime);
- PyObject *ret = Py_BuildValue("OOiOOO", obfmtid, obclsid, pStg->grfFlags, obmtime, obctime, obatime);
- Py_XDECREF(obclsid);
- Py_XDECREF(obfmtid);
- Py_XDECREF(obmtime);
- Py_XDECREF(obctime);
- Py_XDECREF(obatime);
- return ret;
- }
//
// Interface Implementation
--- 241,244 ----
***************
*** 668,672 ****
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIPS, IID_IPropertyStorage);
! return PyObject_FromSTATPROPSETSTG(&p);
}
--- 649,653 ----
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIPS, IID_IPropertyStorage);
! return PyCom_PyObjectFromSTATPROPSETSTG(&p);
}
|
|
From: <ru...@us...> - 2003-10-30 06:30:59
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/include
In directory sc8-pr-cvs1:/tmp/cvs-serv20123/com/win32com/src/include
Modified Files:
PythonCOM.h
Added Files:
PyIEnumSTATPROPSETSTG.h
Log Message:
Add StgOpenStorageEx and IEnumSTATPROPSETSTG
--- NEW FILE: PyIEnumSTATPROPSETSTG.h ---
// Cloned from PyIEnumSTATPROPSTG.h
class PyIEnumSTATPROPSETSTG : public PyIUnknown
{
public:
MAKE_PYCOM_CTOR(PyIEnumSTATPROPSETSTG);
static IEnumSTATPROPSETSTG *GetI(PyObject *self);
static PyComTypeObject type;
// The Python methods
static PyObject *Next(PyObject *self, PyObject *args);
static PyObject *Skip(PyObject *self, PyObject *args);
static PyObject *Reset(PyObject *self, PyObject *args);
static PyObject *Clone(PyObject *self, PyObject *args);
protected:
PyIEnumSTATPROPSETSTG(IUnknown *pdisp);
~PyIEnumSTATPROPSETSTG();
};
Index: PythonCOM.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PythonCOM.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** PythonCOM.h 23 Oct 2003 23:42:02 -0000 1.12
--- PythonCOM.h 30 Oct 2003 06:30:38 -0000 1.13
***************
*** 238,242 ****
PYCOM_EXPORT BOOL PyCom_SAFEARRAYFromPyObject(PyObject *obj, SAFEARRAY **ppSA, VARENUM vt = VT_VARIANT);
PYCOM_EXPORT PyObject *PyCom_PyObjectFromSAFEARRAY(SAFEARRAY *psa, VARENUM vt = VT_VARIANT );
!
--- 238,243 ----
PYCOM_EXPORT BOOL PyCom_SAFEARRAYFromPyObject(PyObject *obj, SAFEARRAY **ppSA, VARENUM vt = VT_VARIANT);
PYCOM_EXPORT PyObject *PyCom_PyObjectFromSAFEARRAY(SAFEARRAY *psa, VARENUM vt = VT_VARIANT );
! PYCOM_EXPORT BOOL PyCom_PyObjectAsSTGOPTIONS(PyObject *obstgoptions, STGOPTIONS **ppstgoptions);
! PYCOM_EXPORT PyObject *PyCom_PyObjectFromSTATPROPSETSTG(STATPROPSETSTG *pStat);
|
|
From: <ru...@us...> - 2003-10-30 06:28:51
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src
In directory sc8-pr-cvs1:/tmp/cvs-serv19738/com/win32com/src
Modified Files:
PyComHelpers.cpp PyStorage.cpp PythonCOM.cpp Register.cpp
Log Message:
Add StgOpenStorageEx and IEnumSTATPROPSETSTG
Index: PyComHelpers.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyComHelpers.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** PyComHelpers.cpp 14 Feb 2001 02:27:28 -0000 1.3
--- PyComHelpers.cpp 30 Oct 2003 06:28:28 -0000 1.4
***************
*** 291,292 ****
--- 291,354 ----
return TRUE;
}
+
+ BOOL PyCom_PyObjectAsSTGOPTIONS(PyObject *obstgoptions, STGOPTIONS **ppstgoptions)
+ {
+ static char *stgmembers[]={"Version","reserved","SectorSize","TemplateFile",0};
+ char *explain_format="STGOPTIONS must be a dictionary containing "\
+ "{Version:int,reserved:0,SectorSize:int,TemplateFile:unicode}";
+ PyObject *dummy_tuple=NULL;
+ BOOL ret;
+
+ if ((obstgoptions==Py_None)||(obstgoptions==NULL)){
+ *ppstgoptions=NULL;
+ return TRUE;
+ }
+ if (!PyDict_Check(obstgoptions)){
+ PyErr_SetString(PyExc_TypeError,explain_format);
+ return FALSE;
+ }
+
+ *ppstgoptions=new(STGOPTIONS);
+ if (*ppstgoptions==NULL){
+ PyErr_SetString(PyExc_MemoryError,"PyObjectAsSTGOPTIONS: Out of memory");
+ return FALSE;
+ }
+ (*ppstgoptions)->usVersion=2;
+ (*ppstgoptions)->reserved=0;
+ (*ppstgoptions)->ulSectorSize=512;
+ (*ppstgoptions)->pwcsTemplateFile=NULL;
+ dummy_tuple=PyTuple_New(0);
+ ret=PyArg_ParseTupleAndKeywords(dummy_tuple, obstgoptions, "|lllu", stgmembers,
+ &(*ppstgoptions)->usVersion,
+ &(*ppstgoptions)->reserved,
+ &(*ppstgoptions)->ulSectorSize,
+ &(*ppstgoptions)->pwcsTemplateFile);
+ Py_DECREF(dummy_tuple);
+ if (!ret){
+ PyErr_Clear();
+ PyErr_SetString(PyExc_TypeError,explain_format);
+ delete(*ppstgoptions);
+ *ppstgoptions=NULL;
+ }
+ return ret;
+ }
+
+ PyObject *PyCom_PyObjectFromSTATPROPSETSTG(STATPROPSETSTG *pStg)
+ {
+ if (pStg==NULL) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ PyObject *obfmtid = PyWinObject_FromIID(pStg->fmtid);
+ PyObject *obclsid = PyWinObject_FromIID(pStg->clsid);
+ PyObject *obmtime = PyWinObject_FromFILETIME(pStg->mtime);
+ PyObject *obctime = PyWinObject_FromFILETIME(pStg->ctime);
+ PyObject *obatime = PyWinObject_FromFILETIME(pStg->atime);
+ PyObject *ret = Py_BuildValue("OOiOOO", obfmtid, obclsid, pStg->grfFlags, obmtime, obctime, obatime);
+ Py_XDECREF(obfmtid);
+ Py_XDECREF(obclsid);
+ Py_XDECREF(obmtime);
+ Py_XDECREF(obctime);
+ Py_XDECREF(obatime);
+ return ret;
+ }
\ No newline at end of file
Index: PyStorage.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyStorage.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** PyStorage.cpp 19 Nov 1999 04:01:45 -0000 1.2
--- PyStorage.cpp 30 Oct 2003 06:28:28 -0000 1.3
***************
*** 4,10 ****
#include "stdafx.h"
-
#include "PythonCOM.h"
#include "PythonCOMServer.h"
// @doc
--- 4,14 ----
#include "stdafx.h"
#include "PythonCOM.h"
#include "PythonCOMServer.h"
+
+
+ HRESULT (WINAPI *myStgOpenStorageEx)(WCHAR *, DWORD, DWORD, DWORD,
+ STGOPTIONS *, void *, REFIID, void **);
+
// @doc
***************
*** 153,155 ****
--- 157,202 ----
return PyCom_PyObjectFromIUnknown(pResult, IID_IStorage, FALSE);
}
+
+ // @pymethod <o PyIStorage>|pythoncom|StgOpenStorageEx|Advanced version of StgOpenStorage, win2k or better
+ PyObject *pythoncom_StgOpenStorageEx(PyObject *self, PyObject *args)
+ {
+ if (myStgOpenStorageEx==NULL){
+ PyErr_SetString(PyExc_NotImplementedError,"StgOpenStorageEx not supported by this version of Windows");
+ return NULL;
+ }
+ PyObject *obfname=NULL, *obriid=NULL, *obstgoptions=NULL;
+ WCHAR *fname;
+ DWORD mode=0, attrs=0;
+ VOID *reserved=NULL;
+ DWORD stgfmt;
+ IID riid;
+ STGOPTIONS *pstgoptions=NULL;
+ HRESULT err;
+ void *intptr;
+ if (!PyArg_ParseTuple(args, "OiiiO|O:StgOpenStorageEx",
+ &obfname, //@pyparm string|name||Name of the stream or file to open
+ &mode, // @pyparm int|grfmode||open flags
+ &stgfmt, // @pyparm int|stgfmt||Storage format (STGFMT_STORAGE,STGFMT_FILE,STGFMT_ANY, or STGFMT_DOCFILE)
+ &attrs, // @pyparm int|grfAttrs||Reserved, must be 0
+ &obriid, // @pyparm IID|riid||Interface id to return, IStorage or IPropertySetStorage
+ &obstgoptions)) //@pyparm <o dict>|pStgOptions||Dictionary representing STGOPTIONS struct (only used with STGFMT_DOCFILE)
+ return NULL;
+ if (!PyWinObject_AsIID(obriid, &riid))
+ return NULL;
+ if(!PyCom_PyObjectAsSTGOPTIONS(obstgoptions, &pstgoptions))
+ return NULL;
+ if (!PyWinObject_AsWCHAR(obfname,&fname))
+ return NULL;
+
+ PY_INTERFACE_PRECALL;
+ err = (*myStgOpenStorageEx)(fname, mode, stgfmt, attrs, NULL, reserved, riid, &intptr);
+ PY_INTERFACE_POSTCALL;
+ if (pstgoptions)
+ delete(pstgoptions);
+ PyWinObject_FreeWCHAR(fname);
+ if (FAILED(err))
+ return PyCom_BuildPyException(err);
+ return PyCom_PyObjectFromIUnknown((IUnknown *)intptr, riid, FALSE);
+ }
+
Index: PythonCOM.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PythonCOM.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** PythonCOM.cpp 9 Oct 2003 13:26:33 -0000 1.23
--- PythonCOM.cpp 30 Oct 2003 06:28:28 -0000 1.24
***************
*** 16,20 ****
--- 16,24 ----
#include "PyFactory.h"
+ extern HRESULT (WINAPI *myStgOpenStorageEx)(WCHAR *, DWORD, DWORD, DWORD,
+ STGOPTIONS *, void *, REFIID, void **);
+
extern int PyCom_RegisterCoreIIDs(PyObject *dict);
+
extern int PyCom_RegisterCoreSupport(void);
***************
*** 32,35 ****
--- 36,40 ----
// Storage related functions.
extern PyObject *pythoncom_StgOpenStorage(PyObject *self, PyObject *args);
+ extern PyObject *pythoncom_StgOpenStorageEx(PyObject *self, PyObject *args);
#ifndef MS_WINCE
extern PyObject *pythoncom_StgIsStorageFile(PyObject *self, PyObject *args);
***************
*** 1467,1470 ****
--- 1472,1476 ----
{ "STGMEDIUM", Py_NewSTGMEDIUM, 1}, // @pymeth STGMEDIUM|Creates a new <o PySTGMEDIUM> object suitable for the <o PyIDataObject> interface.
{ "StgOpenStorage", pythoncom_StgOpenStorage, 1 }, // @pymeth StgOpenStorage|Opens an existing root storage object in the file system.
+ { "StgOpenStorageEx", pythoncom_StgOpenStorageEx, 1 }, // @pymeth StgOpenStorageEx|Access IStorage and IPropertySetStorage interfaces for normal files
{ "TYPEATTR", Py_NewTYPEATTR, 1}, // @pymeth TYPEATTR|Returns a new <o TYPEATTR> object.
{ "VARDESC", Py_NewVARDESC, 1}, // @pymeth VARDESC|Returns a new <o VARDESC> object.
***************
*** 1868,1871 ****
--- 1874,1901 ----
AddConstant(dict, "dcom", 0 );
}
+
+ PyObject *obfmtid=NULL;
+ obfmtid=PyWinObject_FromIID(FMTID_DocSummaryInformation);
+ PyDict_SetItemString(dict,"FMTID_DocSummaryInformation",obfmtid);
+ Py_DECREF(obfmtid);
+ obfmtid=PyWinObject_FromIID(FMTID_SummaryInformation);
+ PyDict_SetItemString(dict,"FMTID_SummaryInformation",obfmtid);
+ Py_DECREF(obfmtid);
+ obfmtid=PyWinObject_FromIID(FMTID_UserDefinedProperties);
+ PyDict_SetItemString(dict,"FMTID_UserDefinedProperties",obfmtid);
+ Py_DECREF(obfmtid);
+ // obfmtid=PyWinObject_FromIID(FMTID_MediaFileSummaryInfo);
+ // PyDict_SetItemString(dict,"FMTID_MediaFileSummaryInfo",obfmtid);
+ // Py_DECREF(obfmtid);
+
+ myStgOpenStorageEx=NULL;
+ HMODULE hmodule=GetModuleHandle("Ole32.dll");
+ if (hmodule!=NULL){
+ FARPROC fp = GetProcAddress(hmodule,"StgOpenStorageEx");
+ if (fp!=NULL)
+ myStgOpenStorageEx=(HRESULT (WINAPI *)(WCHAR *, DWORD, DWORD, DWORD,
+ STGOPTIONS *, void *, REFIID, void **))(fp);
+ }
+
// @prop int|dcom|1 if the system is DCOM aware, else 0. Only Win95 without DCOM extensions should return 0
***************
*** 1874,1875 ****
--- 1904,1906 ----
// @property int|pythoncom|dcom|1 if the system is DCOM aware, else 0. Only Win95 without DCOM extensions should return 0
}
+
Index: Register.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/Register.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Register.cpp 9 Oct 2003 00:26:23 -0000 1.10
--- Register.cpp 30 Oct 2003 06:28:28 -0000 1.11
***************
*** 46,49 ****
--- 46,50 ----
#include "PyIPropertySetStorage.h"
#include "PyIEnumSTATPROPSTG.h"
+ #include "PyIEnumSTATPROPSETSTG.h"
#include "PyIEnumFORMATETC.h"
#include "PyIDataObject.h"
***************
*** 238,241 ****
--- 239,243 ----
#ifndef NO_PYCOM_ENUMSTATPROPSTG
PYCOM_INTERFACE_CLIENT_ONLY( EnumSTATPROPSTG),
+ PYCOM_INTERFACE_CLIENT_ONLY( EnumSTATPROPSETSTG),
#endif // NO_PYCOM_ENUMSTATPROPSTG
PYCOM_INTERFACE_FULL ( EnumSTATSTG),
|
|
From: <ru...@us...> - 2003-10-30 06:24:38
|
Update of /cvsroot/pywin32/pywin32/com/win32com In directory sc8-pr-cvs1:/tmp/cvs-serv19247/com/win32com Modified Files: storagecon.py Log Message: Add constants needed by StgOpenStorageEx Index: storagecon.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/storagecon.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** storagecon.py 10 Dec 2000 00:55:05 -0000 1.2 --- storagecon.py 30 Oct 2003 06:24:15 -0000 1.3 *************** *** 50,51 **** --- 50,131 ---- STG_LAYOUT_INTERLEAVED = 0x00000001L COM_RIGHTS_EXECUTE = 1 + + STGFMT_DOCUMENT = 0 + STGFMT_STORAGE = 0 + STGFMT_NATIVE = 1 + STGFMT_FILE = 3 + STGFMT_ANY = 4 + STGFMT_DOCFILE = 5 + + PID_DICTIONARY = 0 + PID_CODEPAGE = 0x1 + PID_FIRST_USABLE = 0x2 + PID_FIRST_NAME_DEFAULT = 0xfff + + PID_LOCALE = 0x80000000 + PID_MODIFY_TIME = 0x80000001 + PID_SECURITY = 0x80000002 + PID_BEHAVIOR = 0x80000003 + PID_ILLEGAL = 0xffffffff + PID_MIN_READONLY = 0x80000000 + PID_MAX_READONLY = 0xbfffffff + + ## DiscardableInformation + PIDDI_THUMBNAIL = 0x00000002L + + ## SummaryInformation + PIDSI_TITLE = 0x00000002 + PIDSI_SUBJECT = 0x00000003 + PIDSI_AUTHOR = 0x00000004 + PIDSI_KEYWORDS = 0x00000005 + PIDSI_COMMENTS = 0x00000006 + PIDSI_TEMPLATE = 0x00000007 + PIDSI_LASTAUTHOR = 0x00000008 + PIDSI_REVNUMBER = 0x00000009 + PIDSI_EDITTIME = 0x0000000a + PIDSI_LASTPRINTED = 0x0000000b + PIDSI_CREATE_DTM = 0x0000000c + PIDSI_LASTSAVE_DTM = 0x0000000d + PIDSI_PAGECOUNT = 0x0000000e + PIDSI_WORDCOUNT = 0x0000000f + PIDSI_CHARCOUNT = 0x00000010 + PIDSI_THUMBNAIL = 0x00000011 + PIDSI_APPNAME = 0x00000012 + PIDSI_DOC_SECURITY = 0x00000013 + + ## DocSummaryInformation + PIDDSI_CATEGORY = 0x00000002 + PIDDSI_PRESFORMAT = 0x00000003 + PIDDSI_BYTECOUNT = 0x00000004 + PIDDSI_LINECOUNT = 0x00000005 + PIDDSI_PARCOUNT = 0x00000006 + PIDDSI_SLIDECOUNT = 0x00000007 + PIDDSI_NOTECOUNT = 0x00000008 + PIDDSI_HIDDENCOUNT = 0x00000009 + PIDDSI_MMCLIPCOUNT = 0x0000000A + PIDDSI_SCALE = 0x0000000B + PIDDSI_HEADINGPAIR = 0x0000000C + PIDDSI_DOCPARTS = 0x0000000D + PIDDSI_MANAGER = 0x0000000E + PIDDSI_COMPANY = 0x0000000F + PIDDSI_LINKSDIRTY = 0x00000010 + + + ## MediaFileSummaryInfo + PIDMSI_EDITOR = 0x00000002 + PIDMSI_SUPPLIER = 0x00000003 + PIDMSI_SOURCE = 0x00000004 + PIDMSI_SEQUENCE_NO = 0x00000005 + PIDMSI_PROJECT = 0x00000006 + PIDMSI_STATUS = 0x00000007 + PIDMSI_OWNER = 0x00000008 + PIDMSI_RATING = 0x00000009 + PIDMSI_PRODUCTION = 0x0000000A + PIDMSI_COPYRIGHT = 0x0000000B + + ## PROPSETFLAG enum + PROPSETFLAG_DEFAULT = 0 + PROPSETFLAG_NONSIMPLE = 1 + PROPSETFLAG_ANSI = 2 + PROPSETFLAG_UNBUFFERED = 4 + PROPSETFLAG_CASE_SENSITIVE = 8 |
|
From: <mha...@us...> - 2003-10-29 02:08:12
|
Update of /cvsroot/pywin32/pywin32/win32/src
In directory sc8-pr-cvs1:/tmp/cvs-serv31738
Modified Files:
win32file.i
Log Message:
New security functions from Roger, and a reorg of the code that
fetches the function pointers.
Index: win32file.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32file.i,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** win32file.i 1 Sep 2003 08:11:08 -0000 1.32
--- win32file.i 29 Oct 2003 02:06:14 -0000 1.33
***************
*** 2338,2375 ****
static BOOL (WINAPI *pfnDeleteVolumeMountPointW)(LPCWSTR) = NULL;
static BOOL (WINAPI *pfnCreateHardLinkW)(LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES ) = NULL;
- #define VOLUME_POINTERS_NON_NULL \
- (pfnGetVolumeNameForVolumeMountPointW != NULL && \
- pfnSetVolumeMountPointW != NULL && \
- pfnDeleteVolumeMountPointW != NULL && \
- pfnCreateHardLinkW != NULL)
-
- static BOOL _CheckVolumePfns()
- {
- // Do a LoadLibrary for the function pointers, as these are
- // win2k specific.
- if (!VOLUME_POINTERS_NON_NULL) {
-
- HMODULE hMod = GetModuleHandle("kernel32.dll");
- if (hMod==0) {
- PyWin_SetAPIError("GetModuleHandle", E_HANDLE);
- return FALSE;
- }
-
- FARPROC fp = GetProcAddress(hMod, "GetVolumeNameForVolumeMountPointW");
- if (fp) pfnGetVolumeNameForVolumeMountPointW = (BOOL (WINAPI *)(LPCWSTR, LPCWSTR, DWORD))(fp);
-
- fp = GetProcAddress(hMod, "SetVolumeMountPointW");
- if (fp) pfnSetVolumeMountPointW = (BOOL (WINAPI *)(LPCWSTR, LPCWSTR))(fp);
-
- fp = GetProcAddress(hMod, "DeleteVolumeMountPointW");
- if (fp) pfnDeleteVolumeMountPointW = (BOOL (WINAPI *)(LPCWSTR))(fp);
-
- fp = GetProcAddress(hMod, "CreateHardLinkW");
- if (fp) pfnCreateHardLinkW = (BOOL (WINAPI *)(LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES))(fp);
-
- }
- return VOLUME_POINTERS_NON_NULL;
- }
// @pyswig <o PyUnicode>|SetVolumeMountPoint|Mounts the specified volume at the specified volume mount point.
--- 2338,2345 ----
static BOOL (WINAPI *pfnDeleteVolumeMountPointW)(LPCWSTR) = NULL;
static BOOL (WINAPI *pfnCreateHardLinkW)(LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES ) = NULL;
+ static BOOL (WINAPI *pfnEncryptFile)(WCHAR *)=NULL;
+ static BOOL (WINAPI *pfnDecryptFile)(WCHAR *)=NULL;
+ static BOOL (WINAPI *pfnEncryptionDisable)(WCHAR *, BOOL)=NULL;
// @pyswig <o PyUnicode>|SetVolumeMountPoint|Mounts the specified volume at the specified volume mount point.
***************
*** 2391,2397 ****
WCHAR *mount_point = NULL;
WCHAR volume_name[50];
- if (!_CheckVolumePfns())
- return NULL;
if (!PyArg_ParseTuple(args,"OO", &mount_point_obj, &volume_obj))
return NULL;
--- 2361,2367 ----
WCHAR *mount_point = NULL;
WCHAR volume_name[50];
+ if ((pfnSetVolumeMountPointW==NULL)||(pfnGetVolumeNameForVolumeMountPointW==NULL))
+ return PyErr_Format(PyExc_NotImplementedError,"SetVolumeMountPoint not supported by this version of Windows");
if (!PyArg_ParseTuple(args,"OO", &mount_point_obj, &volume_obj))
return NULL;
***************
*** 2425,2429 ****
}
-
// @pyswig |DeleteVolumeMountPoint|Unmounts the volume from the specified volume mount point.
static PyObject*
--- 2395,2398 ----
***************
*** 2441,2446 ****
WCHAR *mount_point = NULL;
! if (!_CheckVolumePfns())
! return NULL;
if (!PyArg_ParseTuple(args,"O", &mount_point_obj))
--- 2410,2415 ----
WCHAR *mount_point = NULL;
! if (pfnDeleteVolumeMountPointW==NULL)
! return PyErr_Format(PyExc_NotImplementedError,"DeleteVolumeMountPoint not supported by this version of Windows");
if (!PyArg_ParseTuple(args,"O", &mount_point_obj))
***************
*** 2452,2456 ****
}
- assert(pfnDeleteVolumeMountPointW);
if (!(*pfnDeleteVolumeMountPointW)(mount_point)){
PyWin_SetAPIError("DeleteVolumeMountPoint");
--- 2421,2424 ----
***************
*** 2470,2474 ****
{
// @comm An NTFS hard link is similar to a POSIX hard link.
! // <nl>This function reates a second directory entry for an existing file, can be different name in
// same directory or any name in a different directory.
// Both file paths must be on the same NTFS volume.<nl>To remove the link, simply delete
--- 2438,2442 ----
{
// @comm An NTFS hard link is similar to a POSIX hard link.
! // <nl>This function creates a second directory entry for an existing file, can be different name in
// same directory or any name in a different directory.
// Both file paths must be on the same NTFS volume.<nl>To remove the link, simply delete
***************
*** 2491,2497 ****
SECURITY_ATTRIBUTES *sa;
! if (!_CheckVolumePfns())
! return NULL;
!
if (!PyArg_ParseTuple(args,"OO|O", &new_file_obj, &existing_file_obj, &sa_obj))
return NULL;
--- 2459,2464 ----
SECURITY_ATTRIBUTES *sa;
! if (pfnCreateHardLinkW==NULL)
! return PyErr_Format(PyExc_NotImplementedError,"CreateHardLink not supported by this version of Windows");
if (!PyArg_ParseTuple(args,"OO|O", &new_file_obj, &existing_file_obj, &sa_obj))
return NULL;
***************
*** 2512,2516 ****
}
- assert(pfnCreateHardLinkW);
if (!((*pfnCreateHardLinkW)(new_file, existing_file, sa))){
PyWin_SetAPIError("CreateHardLink");
--- 2479,2482 ----
***************
*** 2525,2533 ****
--- 2491,2638 ----
}
+ // @pyswig <o PyUnicode>|GetVolumeNameForVolumeMountPoint|Returns unique volume name (Win2k or later)
+ static PyObject*
+ py_GetVolumeNameForVolumeMountPoint(PyObject *self, PyObject *args)
+ {
+ // @pyparm string|mountPoint||Volume mount point or root drive - trailing backslash required
+ PyObject *ret=NULL;
+ PyObject *obvolume_name = NULL, *obmount_point = NULL;
+
+ WCHAR *mount_point = NULL;
+ WCHAR volume_name[50];
+ if (pfnGetVolumeNameForVolumeMountPointW==NULL)
+ return PyErr_Format(PyExc_NotImplementedError,"GetVolumeNameForVolumeMountPoint not supported by this version of Windows");
+
+ if (!PyArg_ParseTuple(args,"O", &obmount_point))
+ return NULL;
+
+ if (!PyWinObject_AsWCHAR(obmount_point, &mount_point, false)){
+ PyErr_SetString(PyExc_TypeError,"Mount point must be string or unicode");
+ goto cleanup;
+ }
+
+ assert(pfnGetVolumeNameForVolumeMountPointW);
+ if (!(*pfnGetVolumeNameForVolumeMountPointW)(mount_point, volume_name, sizeof(volume_name)/sizeof(volume_name[0])))
+ PyWin_SetAPIError("GetVolumeNameForVolumeMountPoint");
+ else
+ ret=PyWinObject_FromWCHAR(volume_name);
+ cleanup:
+ PyWinObject_FreeWCHAR(mount_point);
+ return ret;
+ }
+
+ // @pyswig |EncryptFile|Encrypts specified file (requires Win2k or higher and NTFS)
+ static PyObject*
+ py_EncryptFile(PyObject *self, PyObject *args)
+ {
+ // @pyparm string/unicode|filename||File to encrypt
+
+ PyObject *ret=NULL, *obfname=NULL;
+ WCHAR *fname = NULL;
+ if (pfnEncryptFile==NULL)
+ return PyErr_Format(PyExc_NotImplementedError,"EncryptFile not supported by this version of Windows");
+ if (!PyArg_ParseTuple(args,"O", &obfname))
+ return NULL;
+ if (!PyWinObject_AsWCHAR(obfname, &fname, FALSE))
+ return NULL;
+ if (!(*pfnEncryptFile)(fname))
+ PyWin_SetAPIError("EncryptFile");
+ else
+ ret=Py_None;
+ PyWinObject_FreeWCHAR(fname);
+ Py_XINCREF(ret);
+ return ret;
+ }
+
+ // @pyswig |DecryptFile|Decrypts specified file (requires Win2k or higher and NTFS)
+ static PyObject*
+ py_DecryptFile(PyObject *self, PyObject *args)
+ {
+ // @pyparm string/unicode|filename||File to decrypt
+ PyObject *ret=NULL, *obfname=NULL;
+ WCHAR *fname = NULL;
+ if (pfnDecryptFile==NULL)
+ return PyErr_Format(PyExc_NotImplementedError,"DecryptFile not supported by this version of Windows");
+ if (!PyArg_ParseTuple(args,"O", &obfname))
+ return NULL;
+ if (!PyWinObject_AsWCHAR(obfname, &fname, FALSE))
+ return NULL;
+ if (!(*pfnDecryptFile)(fname))
+ PyWin_SetAPIError("DecryptFile");
+ else
+ ret=Py_None;
+ PyWinObject_FreeWCHAR(fname);
+ Py_XINCREF(ret);
+ return ret;
+ }
+
+ // @pyswig |EncryptionDisable|Enables/disables encryption for a directory (requires Win2k or higher and NTFS)
+ static PyObject*
+ py_EncryptionDisable(PyObject *self, PyObject *args)
+ {
+ // @pyparm string/unicode|DirName||Directory to enable or disable
+ // @pyparm boolean|Disable||Set to False to enable encryption
+ PyObject *ret=NULL, *obfname=NULL;
+ WCHAR *fname = NULL;
+ BOOL Disable;
+ if (pfnEncryptionDisable==NULL)
+ return PyErr_Format(PyExc_NotImplementedError,"EncryptionDisable not supported by this version of Windows");
+ if (!PyArg_ParseTuple(args,"Oi", &obfname, &Disable))
+ return NULL;
+ if (!PyWinObject_AsWCHAR(obfname, &fname, FALSE))
+ return NULL;
+ if (!(*pfnEncryptionDisable)(fname,Disable))
+ PyWin_SetAPIError("EncryptionDisable");
+ else
+ ret=Py_None;
+ PyWinObject_FreeWCHAR(fname);
+ Py_XINCREF(ret);
+ return ret;
+ }
+
%}
+
%native (SetVolumeMountPoint) py_SetVolumeMountPoint;
%native (DeleteVolumeMountPoint) py_DeleteVolumeMountPoint;
%native (CreateHardLink) py_CreateHardLink;
+ %native (GetVolumeNameForVolumeMountPoint) py_GetVolumeNameForVolumeMountPoint;
+
// end of win2k volume mount functions.
+ %native (EncryptFile) py_EncryptFile;
+ %native (DecryptFile) py_DecryptFile;
+ %native (EncryptionDisable) py_EncryptionDisable;
+
+
+ %init %{
+ HMODULE hmodule;
+ FARPROC fp;
+
+ hmodule=LoadLibrary("AdvAPI32.dll");
+ if (hmodule){
+ fp=GetProcAddress(hmodule,"EncryptFileW");
+ if (fp) pfnEncryptFile=(BOOL (WINAPI *)(WCHAR *))(fp);
+
+ fp=GetProcAddress(hmodule,"DecryptFileW");
+ if (fp) pfnDecryptFile=(BOOL (WINAPI *)(WCHAR *))(fp);
+
+ fp=GetProcAddress(hmodule,"EncryptionDisable");
+ if (fp) pfnEncryptionDisable=(BOOL (WINAPI *)(WCHAR *, BOOL))(fp);
+ }
+
+ hmodule = GetModuleHandle("kernel32.dll");
+ if (hmodule){
+ fp = GetProcAddress(hmodule, "GetVolumeNameForVolumeMountPointW");
+ if (fp) pfnGetVolumeNameForVolumeMountPointW = (BOOL (WINAPI *)(LPCWSTR, LPCWSTR, DWORD))(fp);
+
+ fp = GetProcAddress(hmodule, "SetVolumeMountPointW");
+ if (fp) pfnSetVolumeMountPointW = (BOOL (WINAPI *)(LPCWSTR, LPCWSTR))(fp);
+
+ fp = GetProcAddress(hmodule, "DeleteVolumeMountPointW");
+ if (fp) pfnDeleteVolumeMountPointW = (BOOL (WINAPI *)(LPCWSTR))(fp);
+
+ fp = GetProcAddress(hmodule, "CreateHardLinkW");
+ if (fp) pfnCreateHardLinkW = (BOOL (WINAPI *)(LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES))(fp);
+ }
+ %}
#define EV_BREAK EV_BREAK // A break was detected on input.
|
|
From: <mha...@us...> - 2003-10-28 21:28:11
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client
In directory sc8-pr-cvs1:/tmp/cvs-serv14261
Modified Files:
genpy.py
Log Message:
Always import win32com.client.util
Index: genpy.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/genpy.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** genpy.py 23 Oct 2003 22:51:08 -0000 1.35
--- genpy.py 28 Oct 2003 21:26:45 -0000 1.36
***************
*** 24,28 ****
error = "makepy.error"
! makepy_version = "0.4.7" # Written to generated file.
GEN_FULL="full"
--- 24,28 ----
error = "makepy.error"
! makepy_version = "0.4.8" # Written to generated file.
GEN_FULL="full"
***************
*** 497,501 ****
print '\t\t"Allow this class to be accessed as a collection"'
print "\t\tif not self.__dict__.has_key('_enum_'):"
- print "\t\t\timport win32com.client.util"
print "\t\t\tself.__dict__['_enum_'] = self._NewEnum()"
print "\t\treturn self._enum_.__getitem__(index)"
--- 497,500 ----
***************
*** 778,781 ****
--- 777,781 ----
print>> self.file
print >> self.file, 'import win32com.client.CLSIDToClass, pythoncom'
+ print >> self.file, 'import win32com.client.util'
print >> self.file, 'from pywintypes import IID'
print >> self.file, 'from win32com.client import Dispatch'
|
|
From: <mha...@us...> - 2003-10-26 04:06:17
|
Update of /cvsroot/pywin32/pywin32/Wise
In directory sc8-pr-cvs1:/tmp/cvs-serv19506
Modified Files:
desc.txt win32all.wse
Log Message:
Few changes for next win32all
Index: desc.txt
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Wise/desc.txt,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** desc.txt 1 Sep 2003 08:22:02 -0000 1.7
--- desc.txt 26 Oct 2003 04:02:15 -0000 1.8
***************
*** 20,23 ****
--- 20,24 ----
odbc.pyd Python ODBC Extensions.
pythonservice.exe Python Service Dispatcher Exe
+ servicemanager.pyd Python Win32 Service hosting support
timer.pyd Python Win32 Timers support
win32api.pyd Python Win32 API extensions
Index: win32all.wse
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Wise/win32all.wse,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** win32all.wse 8 Oct 2003 05:41:19 -0000 1.35
--- win32all.wse 26 Oct 2003 04:02:15 -0000 1.36
***************
*** 18,22 ****
Patch Threshold=85
Patch Memory=4000
! EXE Filename=win32all-159.exe
Code Sign Name=Python Win32 combined extensions
Code Sign Info=skippinet.com.au
--- 18,22 ----
Patch Threshold=85
Patch Memory=4000
! EXE Filename=win32all-161.exe
Code Sign Name=Python Win32 combined extensions
Code Sign Info=skippinet.com.au
***************
*** 1098,1101 ****
--- 1098,1107 ----
end
item: Install File
+ Source=e:\src\pythonex\win32\Build\servicemanager.pyd
+ Destination=%INSTDIR%\servicemanager.pyd
+ Description=win32 extension files
+ Flags=0000000000000011
+ end
+ item: Install File
Source=e:\src\pythonex\win32\Build\timer.pyd
Destination=%INSTDIR%\timer.pyd
***************
*** 1467,1470 ****
--- 1473,1482 ----
end
item: Remark
+ Text=If this exists, it becomes the gen_py dir - so create it
+ end
+ item: Create Directory
+ Pathname=%INSTDIR%\gen_py
+ end
+ item: Remark
Text=AXScript and AXDebug files
end
***************
*** 1599,1602 ****
--- 1611,1620 ----
end
item: Install File
+ Source=e:\src\pythonex\com\win32comext\shell\demos\*.py
+ Destination=%EXTDIR%\shell\demos
+ Description=ActiveX Shell Extension files
+ Flags=0000000100000010
+ end
+ item: Install File
Source=e:\src\pythonex\com\Build\shell.pyd
Destination=%EXTDIR%\shell\shell.pyd
***************
*** 1662,1666 ****
end
item: Remark
! Text=Add the registry key that support auto-register
end
item: Edit Registry
--- 1680,1684 ----
end
item: Remark
! Text=Add the registry key that support auto-register (not that this has been used by anyone, nor has MS ever published it)
end
item: Edit Registry
|
|
From: <mha...@us...> - 2003-10-26 04:03:14
|
Update of /cvsroot/pywin32/pywin32/win32/src
In directory sc8-pr-cvs1:/tmp/cvs-serv19016
Modified Files:
win32apimodule.cpp
Log Message:
GetUserNameEx() was failing on XP.
Index: win32apimodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32apimodule.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** win32apimodule.cpp 23 Oct 2003 01:20:20 -0000 1.28
--- win32apimodule.cpp 26 Oct 2003 03:59:51 -0000 1.29
***************
*** 782,797 ****
return NULL;
// @pyseeapi GetUserNameEx
if (!myGetUserNameEx(fmt,formattedname,&nSize)){
! // returned string includes trailing null, so should always fail with 0 len
! if (GetLastError()!=ERROR_MORE_DATA){
! PyWin_SetAPIError("GetUserNameEx");
! goto done;
! }
! formattedname=(WCHAR *)malloc(nSize*sizeof(WCHAR));
! if (!myGetUserNameEx(fmt,formattedname,&nSize)){
! PyWin_SetAPIError("GetUserNameEx");
! goto done;
! }
! }
ret=PyWinObject_FromWCHAR(formattedname);
done:
--- 782,797 ----
return NULL;
// @pyseeapi GetUserNameEx
+ // We always get into trouble with WinXP vs 2k error codes.
+ // Simply assume that if we have a size, the function gave us the correct one.
+ myGetUserNameEx(fmt,formattedname,&nSize);
+ if (!nSize)
+ return PyWin_SetAPIError("GetUserNameEx (for buffer size)");
+ formattedname=(WCHAR *)malloc(nSize*sizeof(WCHAR));
+ if (!formattedname)
+ return PyErr_NoMemory();
if (!myGetUserNameEx(fmt,formattedname,&nSize)){
! PyWin_SetAPIError("GetUserNameEx");
! goto done;
! }
ret=PyWinObject_FromWCHAR(formattedname);
done:
|
|
From: <mha...@us...> - 2003-10-26 03:53:56
|
Update of /cvsroot/pywin32/pywin32/win32/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv18255
Modified Files:
pywintypes.py
Log Message:
Look for pywintypes.dll in the sys.prefix directory - that is where it
goes for non-admin users, and LoadLibrary will fail to locate it (as
that is not on our path)
Index: pywintypes.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/Lib/pywintypes.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** pywintypes.py 6 Oct 2003 13:05:10 -0000 1.3
--- pywintypes.py 26 Oct 2003 03:52:56 -0000 1.4
***************
*** 2,9 ****
def __import(modname):
! import win32api, imp, sys, os
! suffix = ""
! if win32api.__file__.endswith("_d.pyd")>0:
! suffix = "_d"
filename = "%s%d%d%s.dll" % (modname, sys.version_info[0], sys.version_info[1], suffix)
if hasattr(sys, "frozen"):
--- 2,18 ----
def __import(modname):
! # *sigh* - non-admin installs will not have pywintypesxx.dll in the
! # system directory, so 'import win32api' will fail looking
! # for pywintypes - the exact DLL we are trying to load!
! # So if it exists in sys.prefix, then we try and load it from
! # there, as that way we can avoid the win32api import
! import imp, sys, os
! # See if this is a debug build.
! for suffix_item in imp.get_suffixes():
! if suffix_item[0]=='_d.pyd':
! suffix = '_d'
! break
! else:
! suffix = ""
filename = "%s%d%d%s.dll" % (modname, sys.version_info[0], sys.version_info[1], suffix)
if hasattr(sys, "frozen"):
***************
*** 18,31 ****
h = None
else:
! # Normal Python needs these files in a directory somewhere on
! # %PATH%, so let Windows search it out for us
! h = win32api.LoadLibrary(filename)
! found = win32api.GetModuleFileName(h)
# Python can load the module
mod = imp.load_module(modname, None, found, ('.dll', 'rb', imp.C_EXTENSION))
# and fill our namespace with it.
globals().update(mod.__dict__)
- if h is not None:
- win32api.FreeLibrary(h)
__import("pywintypes")
--- 27,43 ----
h = None
else:
! if os.path.isfile(os.path.join(sys.prefix, filename)):
! found = os.path.join(sys.prefix, filename)
! else:
! # We could still avoid win32api here, but...
! import win32api
! # Normal Python needs these files in a directory somewhere on
! # %PATH%, so let Windows search it out for us
! h = win32api.LoadLibrary(filename)
! found = win32api.GetModuleFileName(h)
# Python can load the module
mod = imp.load_module(modname, None, found, ('.dll', 'rb', imp.C_EXTENSION))
# and fill our namespace with it.
globals().update(mod.__dict__)
__import("pywintypes")
|
|
From: <mha...@us...> - 2003-10-26 01:28:35
|
Update of /cvsroot/pywin32/pywin32/com/win32com In directory sc8-pr-cvs1:/tmp/cvs-serv30220 Modified Files: __init__.py Log Message: Correct error in my recent checkin checking win32com\gen_py exists. Index: __init__.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/__init__.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** __init__.py 25 Oct 2003 06:25:25 -0000 1.7 --- __init__.py 26 Oct 2003 01:18:55 -0000 1.8 *************** *** 92,97 **** # (gencache doesn't insist it have an __init__, but our __import__ # above does! ! __gen_path__ = os.path.abspath( ! os.path.join(win32com.__path__[0], "gen_py")) if not os.path.isdir(__gen_path__): # We used to dynamically create a directory under win32com - --- 92,96 ---- # (gencache doesn't insist it have an __init__, but our __import__ # above does! ! __gen_path__ = os.path.abspath(os.path.join(__path__[0], "gen_py")) if not os.path.isdir(__gen_path__): # We used to dynamically create a directory under win32com - |
|
From: <mha...@us...> - 2003-10-25 23:01:00
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src
In directory sc8-pr-cvs1:/tmp/cvs-serv32579
Modified Files:
MiscTypes.cpp PyIBase.cpp
Log Message:
Move to the tp_getattro() slot, so we can use PyObject_GenericGetAttr(),
so we can get some of the new type benefits, such as the automatic 'next'
method on iterators. Start moving towards Python's new tp_base slot
in favour of the hand-rolled one we built before Python saw the light :)
Index: MiscTypes.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/MiscTypes.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MiscTypes.cpp 6 Oct 2003 13:09:44 -0000 1.2
--- MiscTypes.cpp 23 Oct 2003 07:34:37 -0000 1.3
***************
*** 17,24 ****
0, /*tp_dealloc*/
0, /*tp_print*/
! PyType_Type.tp_getattr, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
! PyType_Type.tp_repr, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
--- 17,24 ----
0, /*tp_dealloc*/
0, /*tp_print*/
! 0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
! 0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
***************
*** 27,34 ****
0, /*tp_call*/
0, /*tp_str*/
! 0, /*tp_getattro */
0, /*tp_setattro */
0, /* tp_as_buffer */
! 0, /* tp_flags */
"Define the behavior of a PythonCOM Interface type.", /* tp_doc */
};
--- 27,34 ----
0, /*tp_call*/
0, /*tp_str*/
! PyObject_GenericGetAttr, /*tp_getattro */
0, /*tp_setattro */
0, /* tp_as_buffer */
! Py_TPFLAGS_DEFAULT, /* tp_flags */
"Define the behavior of a PythonCOM Interface type.", /* tp_doc */
};
***************
*** 40,44 ****
--- 40,48 ----
// probably better, as is forces _all_ python objects have the same type sig.
static const PyTypeObject type_template = {
+ #ifdef OLD_PYTHON_TYPES
PyObject_HEAD_INIT(&PyInterfaceType_Type)
+ #else
+ PyObject_HEAD_INIT(&PyType_Type)
+ #endif
0, /*ob_size*/
"PythonComTypeTemplate", /*tp_name*/
***************
*** 48,52 ****
(destructor) PyIBase::dealloc, /*tp_dealloc*/
0, /*tp_print*/
! (getattrfunc) PyIBase::getattr, /*tp_getattr*/
(setattrfunc) PyIBase::setattr, /*tp_setattr*/
PyIBase::cmp, /*tp_compare*/
--- 52,56 ----
(destructor) PyIBase::dealloc, /*tp_dealloc*/
0, /*tp_print*/
! 0, /*tp_getattr*/
(setattrfunc) PyIBase::setattr, /*tp_setattr*/
PyIBase::cmp, /*tp_compare*/
***************
*** 58,62 ****
0, /*tp_call*/
0, /*tp_str*/
! 0, /*tp_getattro */
0, /*tp_setattro */
0, /* tp_as_buffer */
--- 62,66 ----
0, /*tp_call*/
0, /*tp_str*/
! PyIBase::getattro, /* tp_getattro */
0, /*tp_setattro */
0, /* tp_as_buffer */
***************
*** 68,72 ****
0, /* tp_weaklistoffset */
PyIBase::iter, /* tp_iter */
! PyIBase::iternext /* tp_iternext */
};
--- 72,84 ----
0, /* tp_weaklistoffset */
PyIBase::iter, /* tp_iter */
! PyIBase::iternext, /* tp_iternext */
! 0, /* tp_methods */
! 0, /* tp_members */
! 0, /* tp_getset */
! #ifdef OLD_PYTHON_TYPES
! 0, /* tp_base */
! #else
! &PyInterfaceType_Type,
! #endif
};
***************
*** 89,93 ****
--- 101,110 ----
/* static */ BOOL PyComTypeObject::is_interface_type(const PyObject *ob)
{
+ #ifdef OLD_PYTHON_TYPES
return ob->ob_type == &PyInterfaceType_Type;
+ #else
+ return ob->ob_type == &PyType_Type &&
+ ((PyTypeObject *)ob)->tp_base == &PyInterfaceType_Type;
+ #endif
}
Index: PyIBase.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyIBase.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** PyIBase.cpp 6 Oct 2003 13:09:44 -0000 1.2
--- PyIBase.cpp 23 Oct 2003 07:34:37 -0000 1.3
***************
*** 31,38 ****
/*static*/PyObject *
! PyIBase::getattr(PyObject *self, char *name)
{
! return ((PyIBase *)self)->getattr(name);
}
PyObject *
PyIBase::getattr(char *name)
--- 31,52 ----
/*static*/PyObject *
! PyIBase::getattro(PyObject *self, PyObject *name)
{
! if (PyString_Check(name)) {
! PyObject *rc = ((PyIBase *)self)->getattr(PyString_AsString(name));
! if (rc)
! return rc;
! PyErr_Clear();
! }
! // Using PyObject_GenericGetAttr allows some special type magic
! // (ie,
! #ifdef OLD_PYTHON_TYPES
! PyErr_SetObject(PyExc_AttributeError, name);
! return NULL;
! #else
! return PyObject_GenericGetAttr(self, name);
! #endif
}
+
PyObject *
PyIBase::getattr(char *name)
***************
*** 41,57 ****
}
PyObject *
! PyIBase::iter()
{
! return PyErr_Format(PyExc_TypeError,
! "COM objects of type '%s' can not be iterated.", ob_type->tp_name);
! return NULL;
}
PyObject *
! PyIBase::iternext()
{
! PyErr_SetString(PyExc_RuntimeError, "not iterable");
! return NULL;
}
/*static*/int PyIBase::setattr(PyObject *op, char *name, PyObject *v)
{
--- 55,71 ----
}
PyObject *
! PyIBase::iternext()
{
! return PyErr_Format(PyExc_RuntimeError,
! "iternext must be overridden by objects supporting enumeration (type '%s').", ob_type->tp_name);
}
PyObject *
! PyIBase::iter()
{
! return PyErr_Format(PyExc_TypeError,
! "COM objects of type '%s' can not be iterated.", ob_type->tp_name);
}
+
/*static*/int PyIBase::setattr(PyObject *op, char *name, PyObject *v)
{
***************
*** 87,95 ****
{
return ((PyIBase *)ob1)->compare(ob2);
- }
-
- /*static*/ PyObject *PyIBase::iter(PyObject *self)
- {
- return ((PyIBase *)self)->iter();
}
--- 101,104 ----
|
|
From: <mha...@us...> - 2003-10-25 18:39:12
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/include
In directory sc8-pr-cvs1:/tmp/cvs-serv10436/include
Modified Files:
PyIEnumFORMATETC.h PyIEnumVARIANT.h PythonCOM.h
Log Message:
Tighten up iterator semantics. Only interfaces that explicitly declare
they are an enumerator get the iterator slots and flags. Our 2 interfaces
that support iteration make this declaration.
Index: PyIEnumFORMATETC.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PyIEnumFORMATETC.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** PyIEnumFORMATETC.h 23 Oct 2003 02:44:12 -0000 1.2
--- PyIEnumFORMATETC.h 23 Oct 2003 23:42:02 -0000 1.3
***************
*** 10,14 ****
MAKE_PYCOM_CTOR(PyIEnumFORMATETC);
static IEnumFORMATETC *GetI(PyObject *self);
! static PyComTypeObject type;
virtual PyObject *iternext();
--- 10,14 ----
MAKE_PYCOM_CTOR(PyIEnumFORMATETC);
static IEnumFORMATETC *GetI(PyObject *self);
! static PyComEnumTypeObject type;
virtual PyObject *iternext();
Index: PyIEnumVARIANT.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PyIEnumVARIANT.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** PyIEnumVARIANT.h 23 Oct 2003 02:43:04 -0000 1.3
--- PyIEnumVARIANT.h 23 Oct 2003 23:42:02 -0000 1.4
***************
*** 10,14 ****
MAKE_PYCOM_CTOR(PyIEnumVARIANT);
static IEnumVARIANT *GetI(PyObject *self);
! static PyComTypeObject type;
virtual PyObject *iternext();
--- 10,14 ----
MAKE_PYCOM_CTOR(PyIEnumVARIANT);
static IEnumVARIANT *GetI(PyObject *self);
! static PyComEnumTypeObject type;
virtual PyObject *iternext();
Index: PythonCOM.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/include/PythonCOM.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** PythonCOM.h 23 Oct 2003 07:34:37 -0000 1.11
--- PythonCOM.h 23 Oct 2003 23:42:02 -0000 1.12
***************
*** 154,157 ****
--- 154,163 ----
};
+ // A type used for PyIEnum interfaces
+ class PYCOM_EXPORT PyComEnumTypeObject : public PyComTypeObject {
+ public:
+ PyComEnumTypeObject( const char *name, PyComTypeObject *pBaseType, int typeSize, struct PyMethodDef* methodList, PyIUnknown* (* thector)(IUnknown *) );
+ };
+
// Very very base class - not COM specific - Should exist in the
// Python core somewhere, IMO.
***************
*** 165,169 ****
virtual PyObject *repr();
virtual int compare(PyObject *other) {return (int)this-int(other);}
! virtual PyObject *iter();
virtual PyObject *iternext();
--- 171,175 ----
virtual PyObject *repr();
virtual int compare(PyObject *other) {return (int)this-int(other);}
! virtual PyObject *iter() {Py_INCREF(this);return this;}
virtual PyObject *iternext();
***************
*** 181,185 ****
static int setattr(PyObject *op, char *name, PyObject *v);
static int cmp(PyObject *ob1, PyObject *ob2);
! static PyObject *iter(PyObject *self) {return PyObject_SelfIter(self);}
static PyObject *iternext(PyObject *self);
};
--- 187,191 ----
static int setattr(PyObject *op, char *name, PyObject *v);
static int cmp(PyObject *ob1, PyObject *ob2);
! static PyObject *iter(PyObject *self);
static PyObject *iternext(PyObject *self);
};
|
|
From: <mha...@us...> - 2003-10-25 11:11:30
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test
In directory sc8-pr-cvs1:/tmp/cvs-serv11696
Modified Files:
testall.py testAXScript.py
Log Message:
Make testAXScript reposnsible for registering itself, rather than having
testall do it (or *not* do it when you aren't running via testall!)
Index: testall.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testall.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** testall.py 23 Oct 2003 07:10:02 -0000 1.15
--- testall.py 23 Oct 2003 23:48:28 -0000 1.16
***************
*** 106,110 ****
import testAXScript
- testAXScript.RegisterEngine()
testAXScript.TestAll()
--- 106,109 ----
Index: testAXScript.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testAXScript.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** testAXScript.py 23 Oct 2003 07:09:30 -0000 1.4
--- testAXScript.py 23 Oct 2003 23:48:28 -0000 1.5
***************
*** 30,33 ****
--- 30,34 ----
def TestAll(verbose = 1):
+ RegisterEngine()
TestHost(verbose)
TestCScript(verbose)
|
|
From: <mha...@us...> - 2003-10-25 07:08:45
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/extensions
In directory sc8-pr-cvs1:/tmp/cvs-serv25271/extensions
Modified Files:
PyIEnumVARIANT.cpp
Log Message:
Add support for the Python tp_iter slot for PyIEnumVARIANT
Index: PyIEnumVARIANT.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyIEnumVARIANT.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** PyIEnumVARIANT.cpp 19 Nov 1999 04:03:23 -0000 1.2
--- PyIEnumVARIANT.cpp 23 Oct 2003 02:43:04 -0000 1.3
***************
*** 13,16 ****
--- 13,40 ----
}
+ PyObject *
+ PyIEnumVARIANT::iternext()
+ {
+ IEnumVARIANT *pIEVARIANT = GetI(this);
+ if ( pIEVARIANT == NULL )
+ return NULL;
+
+ VARIANT var;
+ VariantInit(&var);
+ ULONG celtFetched;
+ PY_INTERFACE_PRECALL;
+ HRESULT hr = pIEVARIANT->Next(1, &var, &celtFetched);
+ PY_INTERFACE_POSTCALL;
+ if ( FAILED(hr) )
+ return PyCom_BuildPyException(hr);
+ if (celtFetched==0) {
+ PyErr_SetNone(PyExc_StopIteration);
+ return NULL;
+ }
+ PyObject *ret = PyCom_PyObjectFromVariant(&var);
+ VariantClear(&var);
+ return ret;
+ }
+
/* static */ IEnumVARIANT *PyIEnumVARIANT::GetI(PyObject *self)
{
|
|
From: <mha...@us...> - 2003-10-25 06:34:00
|
Update of /cvsroot/pywin32/pywin32/com/win32com In directory sc8-pr-cvs1:/tmp/cvs-serv16542 Modified Files: __init__.py Log Message: If win32com\gen_py exists as a directory, then use it (previously, it must have existed and had __init__) Index: __init__.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/__init__.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** __init__.py 25 Oct 2003 05:54:50 -0000 1.6 --- __init__.py 25 Oct 2003 06:25:25 -0000 1.7 *************** *** 82,86 **** # If we don't have a special __gen_path__, see if we have a gen_py as a ! # normal module and use that (ie, "win32com\gen_py" may already exist as # a package. if not __gen_path__: --- 82,86 ---- # If we don't have a special __gen_path__, see if we have a gen_py as a ! # normal module and use that (ie, "win32com.gen_py" may already exist as # a package. if not __gen_path__: *************** *** 89,98 **** __gen_path__ = sys.modules["win32com.gen_py"].__path__[0] except ImportError: ! # We used to dynamically create a directory under win32com - ! # but this sucks. Now we create a version specific directory ! # under the user temp directory. ! __gen_path__ = os.path.join( ! win32api.GetTempPath(), "gen_py", ! "%d.%d" % (sys.version_info[0], sys.version_info[1])) # we must have a __gen_path__, but may not have a gen_py module - --- 89,105 ---- __gen_path__ = sys.modules["win32com.gen_py"].__path__[0] except ImportError: ! # If a win32com\gen_py directory already exists, then we use it ! # (gencache doesn't insist it have an __init__, but our __import__ ! # above does! ! __gen_path__ = os.path.abspath( ! os.path.join(win32com.__path__[0], "gen_py")) ! if not os.path.isdir(__gen_path__): ! # We used to dynamically create a directory under win32com - ! # but this sucks. If the dir doesn't already exist, we we ! # create a version specific directory under the user temp ! # directory. ! __gen_path__ = os.path.join( ! win32api.GetTempPath(), "gen_py", ! "%d.%d" % (sys.version_info[0], sys.version_info[1])) # we must have a __gen_path__, but may not have a gen_py module - |
|
From: <mha...@us...> - 2003-10-25 06:01:55
|
Update of /cvsroot/pywin32/pywin32/com/win32com In directory sc8-pr-cvs1:/tmp/cvs-serv12808 Modified Files: __init__.py Log Message: If COM extensions checked for a build path, they would fail. Index: __init__.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/__init__.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** __init__.py 16 Sep 2003 04:57:33 -0000 1.5 --- __init__.py 25 Oct 2003 05:54:50 -0000 1.6 *************** *** 19,22 **** --- 19,23 ---- # live under the main win32com directory. __gen_path__ = '' + __build_path__ = None ### TODO - Load _all_ \\Extensions subkeys - for now, we only read the default ### Modules will work if loaded into "win32comext" path. *************** *** 74,78 **** def __PackageSupportBuildPath__(package_path): # See if we have a special directory for the binaries (for developers) ! if not _frozen: package_path.append(__build_path__) --- 75,79 ---- def __PackageSupportBuildPath__(package_path): # See if we have a special directory for the binaries (for developers) ! if not _frozen and __build_path__: package_path.append(__build_path__) |
|
From: <mha...@us...> - 2003-10-25 06:00:48
|
Update of /cvsroot/pywin32/pywin32/win32/src
In directory sc8-pr-cvs1:/tmp/cvs-serv12477
Modified Files:
PythonService.cpp
Log Message:
* Release the Python thread-state before calling into our servicemanager
entry point.
* indicate that 'Ctrl+C' is used to stop debugging a service.
* When debugging a service, get the messages from the .pyd rather than
the exe (as this is where they now live)
* Leave in an unused debugging macro.
* Add comments indicating that embedding the service name in the EXE
is deprecated (the new functions are better)
Index: PythonService.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PythonService.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** PythonService.cpp 16 Oct 2003 05:41:34 -0000 1.8
--- PythonService.cpp 25 Oct 2003 05:53:01 -0000 1.9
***************
*** 37,40 ****
--- 37,43 ----
BOOL bServiceDebug = FALSE;
+ // Globals
+ HINSTANCE g_hdll = 0; // remains zero in the exe stub.
+
static void ReportAPIError(DWORD msgCode, DWORD errCode = 0);
static void ReportPythonError(DWORD);
***************
*** 43,46 ****
--- 46,55 ----
#include "PythonServiceMessages.h"
+ // Useful for debugging problems that only show themselves when run under the SCM
+ #define LOG_TRACE_MESSAGE(msg) {\
+ LPTSTR lpszStrings[] = {_T(msg), NULL}; \
+ ReportError(MSG_IR1, (LPCTSTR *)lpszStrings, EVENTLOG_INFORMATION_TYPE); \
+ }
+
#ifdef PYSERVICE_BUILD_DLL // The bulk of this file is only used when building the core DLL.
***************
*** 54,58 ****
// Globals
- HINSTANCE g_hdll = 0;
// Will be set to one of SERVICE_WIN32_OWN_PROCESS etc flags.
DWORD g_serviceProcessFlags = 0;
--- 63,66 ----
***************
*** 926,929 ****
--- 934,939 ----
embedded in it, use it, otherwise insist one is passed on the
command line
+ (NOTE: Embedding a resource to specify the service name is
+ deprecated)
*/
TCHAR svcNameBuf[256];
***************
*** 941,945 ****
}
bServiceDebug = TRUE;
! _tprintf(_T("Debugging service %s\n"), svcName);
PythonService_Initialize(NULL, NULL);
PythonService_PrepareToHostSingle(NULL);
--- 951,955 ----
}
bServiceDebug = TRUE;
! _tprintf(_T("Debugging service %s - press Ctrl+C to stop.\n"), svcName);
PythonService_Initialize(NULL, NULL);
PythonService_PrepareToHostSingle(NULL);
***************
*** 1077,1080 ****
--- 1087,1092 ----
// If not error loading, and not an empty string
+ // (NOTE: Embedding a resource to specify the service name is
+ // deprecated)
if (LoadStringA(GetModuleHandle(NULL), RESOURCE_SERVICE_NAME, buf, cchBuf)>1)
// Get out of here now!
***************
*** 1320,1324 ****
// Get the message text, and just print it.
if (FormatMessage(FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_ARGUMENT_ARRAY,
! GetModuleHandle(NULL), code, 0, (LPTSTR)&buffer, 0, (va_list *)inserts)==0) {
_tprintf(_T("%s 0x%X - No message available\nMessage inserts were"), szType, code);
for (int i=0;i<numInserts;i++)
--- 1332,1336 ----
// Get the message text, and just print it.
if (FormatMessage(FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_ARGUMENT_ARRAY,
! g_hdll, code, 0, (LPTSTR)&buffer, 0, (va_list *)inserts)==0) {
_tprintf(_T("%s 0x%X - No message available\nMessage inserts were"), szType, code);
for (int i=0;i<numInserts;i++)
***************
*** 1368,1377 ****
--- 1380,1392 ----
#else // PYSERVICE_BUILD_DLL
// Our EXE entry point.
+
int main(int argc, char **argv)
{
PyObject *module, *f;
+ PyThreadState *threadState;
HMODULE hmod;
FARPROC proc;
Py_Initialize();
+ PyEval_InitThreads();
module = PyImport_ImportModule("servicemanager");
if (!module) goto failed;
***************
*** 1395,1398 ****
--- 1410,1418 ----
goto failed;
}
+ // A little thread-state dance, as our module will attempt to acquire it.
+ threadState = PyThreadState_Swap(NULL);
+ PyThreadState_Swap(threadState);
+ PyEval_ReleaseThread(threadState);
+
typedef int (* FNPythonService_main)(int argc, char **argv);
return ((FNPythonService_main)proc)(argc, argv);
|