Update of /cvsroot/pywin32/pywin32/com/win32com/src
In directory sc8-pr-cvs1:/tmp/cvs-serv751
Modified Files:
PyStorage.cpp PythonCOM.cpp
Log Message:
Reduce footprint of StgOpenStorageEx, as I will soon be adding #ifdef
wrappers to optionally exclude it from the build.
Index: PyStorage.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyStorage.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** PyStorage.cpp 30 Oct 2003 06:28:28 -0000 1.3
--- PyStorage.cpp 31 Oct 2003 04:34:36 -0000 1.4
***************
*** 7,14 ****
#include "PythonCOMServer.h"
-
- HRESULT (WINAPI *myStgOpenStorageEx)(WCHAR *, DWORD, DWORD, DWORD,
- STGOPTIONS *, void *, REFIID, void **);
-
// @doc
--- 7,10 ----
***************
*** 161,168 ****
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;
--- 157,174 ----
PyObject *pythoncom_StgOpenStorageEx(PyObject *self, PyObject *args)
{
! typedef HRESULT (WINAPI *PFNStgOpenStorageEx)(WCHAR *, DWORD, DWORD, DWORD,
! STGOPTIONS *, void *, REFIID, void **);;
! static PFNStgOpenStorageEx myStgOpenStorageEx = NULL;
! if (myStgOpenStorageEx==NULL) { // Haven't tried to fetch it yet.
! myStgOpenStorageEx = (PFNStgOpenStorageEx)-1;
! HMODULE hmodule=GetModuleHandle("Ole32.dll");
! if (hmodule!=NULL){
! FARPROC fp = GetProcAddress(hmodule,"StgOpenStorageEx");
! if (fp!=NULL)
! myStgOpenStorageEx=(PFNStgOpenStorageEx)fp;
}
+ }
+ if (myStgOpenStorageEx == (PFNStgOpenStorageEx)-1)
+ return PyErr_Format(PyExc_NotImplementedError,"StgOpenStorageEx not supported by this version of Windows");
PyObject *obfname=NULL, *obriid=NULL, *obstgoptions=NULL;
WCHAR *fname;
Index: PythonCOM.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PythonCOM.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** PythonCOM.cpp 30 Oct 2003 06:28:28 -0000 1.24
--- PythonCOM.cpp 31 Oct 2003 04:34:36 -0000 1.25
***************
*** 16,22 ****
#include "PyFactory.h"
- extern HRESULT (WINAPI *myStgOpenStorageEx)(WCHAR *, DWORD, DWORD, DWORD,
- STGOPTIONS *, void *, REFIID, void **);
-
extern int PyCom_RegisterCoreIIDs(PyObject *dict);
--- 16,19 ----
***************
*** 1888,1900 ****
// 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
--- 1885,1888 ----
|