Update of /cvsroot/pywin32/pywin32/com/win32com/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5433/com/win32com/src
Modified Files:
PyStorage.cpp PythonCOM.cpp
Log Message:
Add CreateILockBytesOnHGlobal
Remove loading of function pointer for CoResumeClassObjects
Index: PythonCOM.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PythonCOM.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** PythonCOM.cpp 3 Jun 2007 14:53:06 -0000 1.46
--- PythonCOM.cpp 4 Jul 2007 18:40:46 -0000 1.47
***************
*** 51,54 ****
--- 51,56 ----
extern PyObject *pythoncom_ReadClassStm(PyObject *self, PyObject *args);
extern PyObject *pythoncom_CreateStreamOnHGlobal(PyObject *self, PyObject *args);
+ extern PyObject *pythoncom_CreateILockBytesOnHGlobal(PyObject *self, PyObject *args);
+
extern PyObject *pythoncom_GetRecordFromGuids(PyObject *self, PyObject *args);
extern PyObject *pythoncom_GetRecordFromTypeInfo(PyObject *self, PyObject *args);
***************
*** 170,175 ****
IUnknown *punk = NULL;
PyObject *result = NULL;
! int numIIDs = 0;
! int i;
if (!PyArg_ParseTuple(args, "OOiOO:CoCreateInstanceEx",
&obCLSID, // @pyparm <o PyIID>|clsid||Class identifier (CLSID) of the object
--- 172,178 ----
IUnknown *punk = NULL;
PyObject *result = NULL;
! ULONG numIIDs = 0;
! ULONG i;
! Py_ssize_t py_numIIDs;
if (!PyArg_ParseTuple(args, "OOiOO:CoCreateInstanceEx",
&obCLSID, // @pyparm <o PyIID>|clsid||Class identifier (CLSID) of the object
***************
*** 206,211 ****
goto done;
}
! numIIDs = PySequence_Length(obrgiids);
!
iids = new IID[numIIDs];
mqi = new MULTI_QI[numIIDs];
--- 209,218 ----
goto done;
}
! py_numIIDs = PySequence_Length(obrgiids);
! if (py_numIIDs > ULONG_MAX){
! PyErr_Format(PyExc_ValueError, "%u is maximum number of IIDs", ULONG_MAX);
! goto done;
! }
! numIIDs=(ULONG)py_numIIDs;
iids = new IID[numIIDs];
mqi = new MULTI_QI[numIIDs];
***************
*** 390,412 ****
}
- // I cont understand this compiler :-(
- #ifdef _MSC_VER
- #pragma optimize ("", off)
- #endif // _MSC_VER
// @pymethod |pythoncom|CoResumeClassObjects|Called by a server that can register multiple class objects to inform the OLE SCM about all registered classes, and permits activation requests for those class objects.
static PyObject *pythoncom_CoResumeClassObjects(PyObject *self, PyObject *args)
{
- // @comm This is not available on Window95. If it is called on that platform,
- // a E_NOTIMPLEMENTED <o com_error> is raised.
if (!PyArg_ParseTuple(args, ":CoResumeClassObjects"))
return NULL;
- // *** AARG - NOT ON 95!
- HMODULE hMod = GetModuleHandle("ole32.dll");
- if (hMod==0) return PyWin_SetAPIError("GetModuleHandle(\"ole32.dll\")");
- FARPROC fp = GetProcAddress(hMod, "CoResumeClassObjects");
- if (fp==NULL)
- return PyCom_BuildPyException(E_NOTIMPL);
PY_INTERFACE_PRECALL;
! HRESULT hr = (*fp)();
PY_INTERFACE_POSTCALL;
if (FAILED(hr))
--- 397,407 ----
}
// @pymethod |pythoncom|CoResumeClassObjects|Called by a server that can register multiple class objects to inform the OLE SCM about all registered classes, and permits activation requests for those class objects.
static PyObject *pythoncom_CoResumeClassObjects(PyObject *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, ":CoResumeClassObjects"))
return NULL;
PY_INTERFACE_PRECALL;
! HRESULT hr = CoResumeClassObjects();
PY_INTERFACE_POSTCALL;
if (FAILED(hr))
***************
*** 415,421 ****
return Py_None;
}
- #ifdef _MSC_VER
- #pragma optimize ("", on)
- #endif // _MSC_VER
// @pymethod |pythoncom|CoTreatAsClass|Establishes or removes an emulation, in which objects of one class are treated as objects of a different class.
--- 410,413 ----
***************
*** 1795,1798 ****
--- 1787,1792 ----
#endif // MS_WINCE
{ "CreateStreamOnHGlobal", pythoncom_CreateStreamOnHGlobal, 1 }, // @pymeth CreateStreamOnHGlobal|Creates an in-memory stream storage object
+ { "CreateILockBytesOnHGlobal", pythoncom_CreateILockBytesOnHGlobal, 1 }, // @pymeth CreateILockBytesOnHGlobal|Creates an ILockBytes interface based on global memory
+
{ "EnableQuitMessage", pythoncom_EnableQuitMessage, 1 }, // @pymeth EnableQuitMessage|Indicates the thread PythonCOM should post a WM_QUIT message to.
{ "FUNCDESC", Py_NewFUNCDESC, 1}, // @pymeth FUNCDESC|Returns a new <o FUNCDESC> object.
Index: PyStorage.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyStorage.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** PyStorage.cpp 3 Jun 2007 14:53:06 -0000 1.11
--- PyStorage.cpp 4 Jul 2007 18:40:46 -0000 1.12
***************
*** 122,125 ****
--- 122,146 ----
}
+ // @pymethod <o PyILockBytes>|pythoncom|CreateILockBytesOnHGlobal|Creates an ILockBytes interface based on global memory
+ PyObject *pythoncom_CreateILockBytesOnHGlobal(PyObject *self, PyObject *args)
+ {
+ PyObject *obhglobal=Py_None;
+ HGLOBAL hglobal=NULL;
+ BOOL bdelete=TRUE;
+ ILockBytes *pILockBytes=NULL;
+ if (!PyArg_ParseTuple(args, "|Ol:CreateILockBytesOnHGlobal",
+ &obhglobal, // @pyparm <o PyHANDLE>|hGlobal|None|Global memory handle. If None, a new global memory object is allocated.
+ &bdelete)) // @pyparm bool|DeleteOnRelease|True|Indicates if global memory should be freed when interface is released.
+ return NULL;
+ if (!PyWinObject_AsHANDLE(obhglobal, &hglobal))
+ return NULL;
+ PY_INTERFACE_PRECALL;
+ HRESULT hr = CreateILockBytesOnHGlobal(hglobal, bdelete, &pILockBytes);
+ PY_INTERFACE_POSTCALL;
+ if (FAILED(hr))
+ return PyCom_BuildPyException(hr);
+ return PyCom_PyObjectFromIUnknown(pILockBytes, IID_ILockBytes, FALSE);
+ }
+
// @pymethod <o PyIStorage>|pythoncom|StgCreateDocfile|Creates a new compound file storage object using the OLE-provided compound file implementation for the <o PyIStorage> interface.
PyObject *pythoncom_StgCreateDocfile(PyObject *self, PyObject *args)
|