Update of /cvsroot/pywin32/pywin32/com/win32com/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2919
Modified Files:
Tag: py3k
ErrorUtils.cpp PyGatewayBase.cpp PyIUnknown.cpp PyRecord.cpp
PyStorage.cpp PythonCOM.cpp dllmain.cpp oleargs.cpp
Log Message:
Allow to build with UNICODE defined
More changes for Py3k
Index: PyGatewayBase.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyGatewayBase.cpp,v
retrieving revision 1.17.2.1
retrieving revision 1.17.2.2
diff -C2 -d -r1.17.2.1 -r1.17.2.2
*** PyGatewayBase.cpp 29 Aug 2008 08:27:37 -0000 1.17.2.1
--- PyGatewayBase.cpp 13 Sep 2008 04:26:17 -0000 1.17.2.2
***************
*** 14,20 ****
extern PyObject *g_obMissing;
- extern void PyCom_LogF(const char *fmt, ...);
- #define LogF PyCom_LogF
-
#include <malloc.h>
// When building with the 2003 Platform SDK 64-bit compiloer, _MSC_VER is 1400,
--- 14,17 ----
***************
*** 100,104 ****
#ifdef DEBUG_FULL
! LogF("PyGatewayBase: created %s", m_pPyObject ? m_pPyObject->ob_type->tp_name : "<NULL>");
#endif
}
--- 97,101 ----
#ifdef DEBUG_FULL
! PyCom_LogF("PyGatewayBase: created %s", m_pPyObject ? m_pPyObject->ob_type->tp_name : "<NULL>");
#endif
}
***************
*** 108,112 ****
InterlockedDecrement(&cGateways);
#ifdef DEBUG_FULL
! LogF("PyGatewayBase: deleted %s", m_pPyObject ? m_pPyObject->ob_type->tp_name : "<NULL>");
#endif
--- 105,109 ----
InterlockedDecrement(&cGateways);
#ifdef DEBUG_FULL
! PyCom_LogF("PyGatewayBase: deleted %s", m_pPyObject ? m_pPyObject->ob_type->tp_name : "<NULL>");
#endif
***************
*** 139,143 ****
// Only for a special debug build, don't worry about error checking
WideCharToMultiByte(CP_ACP, 0, oleRes, -1, cRes, 256, NULL, NULL);
! LogF("PyGatewayBase::QueryInterface: %s", cRes);
}
#endif
--- 136,140 ----
// Only for a special debug build, don't worry about error checking
WideCharToMultiByte(CP_ACP, 0, oleRes, -1, cRes, 256, NULL, NULL);
! PyCom_LogF("PyGatewayBase::QueryInterface: %s", cRes);
}
#endif
***************
*** 391,395 ****
{
#ifdef DEBUG_FULL
! LogF("PyGatewayBase::GetIDsOfNames");
#endif
--- 388,392 ----
{
#ifdef DEBUG_FULL
! PyCom_LogF("PyGatewayBase::GetIDsOfNames");
#endif
***************
*** 738,742 ****
{
#ifdef DEBUG_FULL
! LogF("PyGatewayBase::Invoke; dispid=%ld", dispid);
#endif
--- 735,739 ----
{
#ifdef DEBUG_FULL
! PyCom_LogF("PyGatewayBase::Invoke; dispid=%ld", dispid);
#endif
***************
*** 778,782 ****
{
#ifdef DEBUG_FULL
! LogF("PyGatewayBase::GetDispID");
#endif
PY_GATEWAY_METHOD;
--- 775,779 ----
{
#ifdef DEBUG_FULL
! PyCom_LogF("PyGatewayBase::GetDispID");
#endif
PY_GATEWAY_METHOD;
***************
*** 801,805 ****
{
#ifdef DEBUG_FULL
! LogF("PyGatewayBase::InvokeEx; dispid=%ld", id);
#endif
--- 798,802 ----
{
#ifdef DEBUG_FULL
! PyCom_LogF("PyGatewayBase::InvokeEx; dispid=%ld", id);
#endif
***************
*** 843,847 ****
{
#ifdef DEBUG_FULL
! LogF("PyGatewayBase::DeleteMemberByName");
#endif
PY_GATEWAY_METHOD;
--- 840,844 ----
{
#ifdef DEBUG_FULL
! PyCom_LogF("PyGatewayBase::DeleteMemberByName");
#endif
PY_GATEWAY_METHOD;
***************
*** 861,865 ****
{
#ifdef DEBUG_FULL
! LogF("PyGatewayBase::DeleteMemberByDispID");
#endif
PY_GATEWAY_METHOD;
--- 858,862 ----
{
#ifdef DEBUG_FULL
! PyCom_LogF("PyGatewayBase::DeleteMemberByDispID");
#endif
PY_GATEWAY_METHOD;
***************
*** 875,879 ****
{
#ifdef DEBUG_FULL
! LogF("PyGatewayBase::GetMemberProperties");
#endif
PY_GATEWAY_METHOD;
--- 872,876 ----
{
#ifdef DEBUG_FULL
! PyCom_LogF("PyGatewayBase::GetMemberProperties");
#endif
PY_GATEWAY_METHOD;
***************
*** 895,899 ****
{
#ifdef DEBUG_FULL
! LogF("PyGatewayBase::GetMemberName");
#endif
PY_GATEWAY_METHOD;
--- 892,896 ----
{
#ifdef DEBUG_FULL
! PyCom_LogF("PyGatewayBase::GetMemberName");
#endif
PY_GATEWAY_METHOD;
***************
*** 912,916 ****
{
#ifdef DEBUG_FULL
! LogF("PyGatewayBase::GetNextDispID");
#endif
PY_GATEWAY_METHOD;
--- 909,913 ----
{
#ifdef DEBUG_FULL
! PyCom_LogF("PyGatewayBase::GetNextDispID");
#endif
PY_GATEWAY_METHOD;
***************
*** 932,936 ****
{
#ifdef DEBUG_FULL
! LogF("PyGatewayBase::GetNameSpaceParent");
#endif
PY_GATEWAY_METHOD;
--- 929,933 ----
{
#ifdef DEBUG_FULL
! PyCom_LogF("PyGatewayBase::GetNameSpaceParent");
#endif
PY_GATEWAY_METHOD;
Index: PyIUnknown.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyIUnknown.cpp,v
retrieving revision 1.12.2.2
retrieving revision 1.12.2.3
diff -C2 -d -r1.12.2.2 -r1.12.2.3
*** PyIUnknown.cpp 7 Sep 2008 02:17:18 -0000 1.12.2.2
--- PyIUnknown.cpp 13 Sep 2008 04:26:17 -0000 1.12.2.3
***************
*** 6,12 ****
#include "PythonCOMServer.h"
- extern void PyCom_LogF(const char *fmt, ...);
- #define LogF PyCom_LogF
-
char *PyIUnknown::szErrMsgObjectReleased = "The COM object has been released.";
--- 6,9 ----
***************
*** 50,54 ****
#ifdef _DEBUG
int numInMap = m_obTrackList ? PyMapping_Length(m_obTrackList) : 0;
! LogF("Cleaning up %d COM objects...", numInMap);
OLECHAR FAR *pythonOb = L"pythonObject";
#endif
--- 47,51 ----
#ifdef _DEBUG
int numInMap = m_obTrackList ? PyMapping_Length(m_obTrackList) : 0;
! PyCom_LogF("Cleaning up %d COM objects...", numInMap);
OLECHAR FAR *pythonOb = L"pythonObject";
#endif
***************
*** 64,68 ****
#ifdef NOPE_DEBUG
const char *relDesc = pLook->m_obj ? "NOT RELEASED" : "released";
! LogF(" object <%s> at 0x%0lx, m_obj at 0x%0lx, ob_refcnt=%d, %s", pLook->ob_type->tp_name, pLook, pLook->m_obj, pLook->ob_refcnt, relDesc);
if ( pLook->m_obj )
{
--- 61,65 ----
#ifdef NOPE_DEBUG
const char *relDesc = pLook->m_obj ? "NOT RELEASED" : "released";
! PyCom_LogF(" object <%s> at 0x%0lx, m_obj at 0x%0lx, ob_refcnt=%d, %s", pLook->ob_type->tp_name, pLook, pLook->m_obj, pLook->ob_refcnt, relDesc);
if ( pLook->m_obj )
{
***************
*** 84,92 ****
if ( PyInstance_Check(ob) )
{
! LogF(" object is a Python class instance of: %s", PyString_AsString(((PyInstanceObject *)ob)->in_class->cl_name));
}
else
{
! LogF(" object is a Python object of type: %s", ob->ob_type->tp_name);
}
}
--- 81,89 ----
if ( PyInstance_Check(ob) )
{
! PyCom_LogF(" object is a Python class instance of: %s", PyString_AsString(((PyInstanceObject *)ob)->in_class->cl_name));
}
else
{
! PyCom_LogF(" object is a Python object of type: %s", ob->ob_type->tp_name);
}
}
***************
*** 110,114 ****
}
#ifdef _DEBUG
! LogF("COM object cleanup complete.");
#endif
}
--- 107,111 ----
}
#ifdef _DEBUG
! PyCom_LogF("COM object cleanup complete.");
#endif
}
***************
*** 144,148 ****
#ifdef _DEBUG_LIFETIMES
! LogF(buf, " SafeRelease(%ld) -> %s at 0x%0lx, IUnknown at 0x%0lx - Release() returned %ld",GetCurrentThreadId(), ob->ob_type->tp_name,ob, ob->m_obj,rcnt);
#endif
ob->m_obj = NULL;
--- 141,145 ----
#ifdef _DEBUG_LIFETIMES
! PyCom_LogF(buf, " SafeRelease(%ld) -> %s at 0x%0lx, IUnknown at 0x%0lx - Release() returned %ld",GetCurrentThreadId(), ob->ob_type->tp_name,ob, ob->m_obj,rcnt);
#endif
ob->m_obj = NULL;
***************
*** 151,155 ****
{
PyEval_RestoreThread(_save);
! LogF(_T("Win32 exception occurred releasing IUnknown at 0x%08x"), ob->m_obj);
ob->m_obj = NULL;
#ifdef _DEBUG
--- 148,152 ----
{
PyEval_RestoreThread(_save);
! PyCom_LogF("Win32 exception occurred releasing IUnknown at 0x%08x", ob->m_obj);
ob->m_obj = NULL;
#ifdef _DEBUG
Index: PyStorage.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyStorage.cpp,v
retrieving revision 1.12
retrieving revision 1.12.2.1
diff -C2 -d -r1.12 -r1.12.2.1
*** PyStorage.cpp 4 Jul 2007 18:40:46 -0000 1.12
--- PyStorage.cpp 13 Sep 2008 04:26:17 -0000 1.12.2.1
***************
*** 254,258 ****
myStgOpenStorageEx = (PFNStgOpenStorageEx)-1;
if (ole32==NULL)
! ole32=GetModuleHandle("Ole32.dll");
if (ole32!=NULL){
FARPROC fp = GetProcAddress(ole32,"StgOpenStorageEx");
--- 254,258 ----
myStgOpenStorageEx = (PFNStgOpenStorageEx)-1;
if (ole32==NULL)
! ole32=GetModuleHandle(_T("Ole32.dll"));
if (ole32!=NULL){
FARPROC fp = GetProcAddress(ole32,"StgOpenStorageEx");
***************
*** 315,319 ****
if (!pfnchecked){
if (ole32==NULL)
! ole32=GetModuleHandle("Ole32.dll");
if (ole32!=NULL)
pfnFmtIdToPropStgName = (PFNFmtIdToPropStgName)GetProcAddress(ole32, "FmtIdToPropStgName");
--- 315,319 ----
if (!pfnchecked){
if (ole32==NULL)
! ole32=GetModuleHandle(_T("Ole32.dll"));
if (ole32!=NULL)
pfnFmtIdToPropStgName = (PFNFmtIdToPropStgName)GetProcAddress(ole32, "FmtIdToPropStgName");
***************
*** 352,356 ****
if (!pfnchecked){
if (ole32==NULL)
! ole32=GetModuleHandle("Ole32.dll");
if (ole32!=NULL)
pfnPropStgNameToFmtId = (PFNPropStgNameToFmtId)GetProcAddress(ole32, "PropStgNameToFmtId");
--- 352,356 ----
if (!pfnchecked){
if (ole32==NULL)
! ole32=GetModuleHandle(_T("Ole32.dll"));
if (ole32!=NULL)
pfnPropStgNameToFmtId = (PFNPropStgNameToFmtId)GetProcAddress(ole32, "PropStgNameToFmtId");
Index: dllmain.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/dllmain.cpp,v
retrieving revision 1.15.4.1
retrieving revision 1.15.4.2
diff -C2 -d -r1.15.4.1 -r1.15.4.2
*** dllmain.cpp 29 Aug 2008 08:27:37 -0000 1.15.4.1
--- dllmain.cpp 13 Sep 2008 04:26:18 -0000 1.15.4.2
***************
*** 185,189 ****
// Do a LoadLibrary, as the Ex version may not always exist
// on Win95.
! HMODULE hMod = GetModuleHandle("ole32.dll");
if (hMod==0) return E_HANDLE;
FARPROC fp = GetProcAddress(hMod, "CoInitializeEx");
--- 185,189 ----
// Do a LoadLibrary, as the Ex version may not always exist
// on Win95.
! HMODULE hMod = GetModuleHandle(_T("ole32.dll"));
if (hMod==0) return E_HANDLE;
FARPROC fp = GetProcAddress(hMod, "CoInitializeEx");
Index: oleargs.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/oleargs.cpp,v
retrieving revision 1.41.2.1
retrieving revision 1.41.2.2
diff -C2 -d -r1.41.2.1 -r1.41.2.2
*** oleargs.cpp 29 Aug 2008 08:27:37 -0000 1.41.2.1
--- oleargs.cpp 13 Sep 2008 04:26:18 -0000 1.41.2.2
***************
*** 6,11 ****
#include "PythonCOM.h"
- extern void PyCom_LogF(const TCHAR *fmt, ...);
-
extern PyObject *PyObject_FromRecordInfo(IRecordInfo *, void *, ULONG);
extern PyObject *PyObject_FromSAFEARRAYRecordInfo(SAFEARRAY *psa);
--- 6,9 ----
Index: PythonCOM.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PythonCOM.cpp,v
retrieving revision 1.52.2.2
retrieving revision 1.52.2.3
diff -C2 -d -r1.52.2.2 -r1.52.2.3
*** PythonCOM.cpp 29 Aug 2008 09:15:38 -0000 1.52.2.2
--- PythonCOM.cpp 13 Sep 2008 04:26:18 -0000 1.52.2.3
***************
*** 74,80 ****
// Error related functions
void GetScodeString(SCODE sc, TCHAR *buf, int bufSize);
! LPCSTR GetScodeRangeString(SCODE sc);
! LPCSTR GetSeverityString(SCODE sc);
! LPCSTR GetFacilityString(SCODE sc);
/* Debug/Test helpers */
--- 74,80 ----
// Error related functions
void GetScodeString(SCODE sc, TCHAR *buf, int bufSize);
! LPCTSTR GetScodeRangeString(SCODE sc);
! LPCTSTR GetSeverityString(SCODE sc);
! LPCTSTR GetFacilityString(SCODE sc);
/* Debug/Test helpers */
***************
*** 98,102 ****
static BOOL bHaveDCOM = -1;
if (bHaveDCOM==-1) {
! HMODULE hMod = GetModuleHandle("ole32.dll");
if (hMod) {
FARPROC fp = GetProcAddress(hMod, "CoInitializeEx");
--- 98,102 ----
static BOOL bHaveDCOM = -1;
if (bHaveDCOM==-1) {
! HMODULE hMod = GetModuleHandle(_T("ole32.dll"));
if (hMod) {
FARPROC fp = GetProcAddress(hMod, "CoInitializeEx");
***************
*** 236,240 ****
{ // scoping
HRESULT (STDAPICALLTYPE *mypfn)(REFCLSID, IUnknown *, DWORD, COSERVERINFO *, ULONG, MULTI_QI *);
! HMODULE hMod = GetModuleHandle("ole32.dll");
if (hMod==0) {
PyCom_BuildInternalPyException("Can not load ole32.dll");
--- 236,240 ----
{ // scoping
HRESULT (STDAPICALLTYPE *mypfn)(REFCLSID, IUnknown *, DWORD, COSERVERINFO *, ULONG, MULTI_QI *);
! HMODULE hMod = GetModuleHandle(_T("ole32.dll"));
if (hMod==0) {
PyCom_BuildInternalPyException("Can not load ole32.dll");
***************
*** 319,323 ****
return NULL;
}
! HMODULE hMod = GetModuleHandle("ole32.dll");
if (hMod==0) return PyCom_BuildInternalPyException("Can not load ole32.dll");
FARPROC fp = GetProcAddress(hMod, "CoInitializeSecurity");
--- 319,323 ----
return NULL;
}
! HMODULE hMod = GetModuleHandle(_T("ole32.dll"));
if (hMod==0) return PyCom_BuildInternalPyException("Can not load ole32.dll");
FARPROC fp = GetProcAddress(hMod, "CoInitializeSecurity");
***************
*** 602,607 ****
if (!PyArg_ParseTuple(args, "k", &scode))
return NULL;
! GetScodeString(scode, buf, sizeof(buf));
! return PyString_FromTCHAR(buf);
// @comm This will obtain the COM Error message for a given HRESULT.
// Internally, PythonCOM uses this function to obtain the description
--- 602,607 ----
if (!PyArg_ParseTuple(args, "k", &scode))
return NULL;
! GetScodeString(scode, buf, sizeof(buf)/sizeof(buf[0]));
! return PyWinObject_FromTCHAR(buf);
// @comm This will obtain the COM Error message for a given HRESULT.
// Internally, PythonCOM uses this function to obtain the description
***************
*** 616,620 ****
if (!PyArg_ParseTuple(args, "k", &scode))
return NULL;
! return Py_BuildValue("z", GetScodeRangeString(scode) );
}
--- 616,620 ----
if (!PyArg_ParseTuple(args, "k", &scode))
return NULL;
! return PyWinObject_FromTCHAR(GetScodeRangeString(scode));
}
***************
*** 626,630 ****
if (!PyArg_ParseTuple(args, "k", &scode))
return NULL;
! return Py_BuildValue("z", GetSeverityString(scode) );
}
--- 626,630 ----
if (!PyArg_ParseTuple(args, "k", &scode))
return NULL;
! return PyWinObject_FromTCHAR(GetSeverityString(scode));
}
***************
*** 636,640 ****
if (!PyArg_ParseTuple(args, "k", &scode))
return NULL;
! return Py_BuildValue("z", GetFacilityString(scode) );
}
--- 636,640 ----
if (!PyArg_ParseTuple(args, "k", &scode))
return NULL;
! return PyWinObject_FromTCHAR(GetFacilityString(scode));
}
***************
*** 1769,1773 ****
// GIL protects us from races here.
if (pfnObjectFromLresult==NULL) {
! HMODULE hmod = LoadLibrary("oleacc.dll");
if (hmod)
pfnObjectFromLresult = (LPFNOBJECTFROMLRESULT)
--- 1769,1773 ----
// GIL protects us from races here.
if (pfnObjectFromLresult==NULL) {
! HMODULE hmod = LoadLibrary(_T("oleacc.dll"));
if (hmod)
pfnObjectFromLresult = (LPFNOBJECTFROMLRESULT)
***************
*** 2086,2090 ****
// Load function pointers.
! HMODULE hModOle32 = GetModuleHandle("ole32.dll");
pfnCoWaitForMultipleHandles = \
(HRESULT (STDAPICALLTYPE *)(DWORD, DWORD, ULONG, LPHANDLE, LPDWORD)) \
--- 2086,2090 ----
// Load function pointers.
! HMODULE hModOle32 = GetModuleHandle(_T("ole32.dll"));
pfnCoWaitForMultipleHandles = \
(HRESULT (STDAPICALLTYPE *)(DWORD, DWORD, ULONG, LPHANDLE, LPDWORD)) \
Index: ErrorUtils.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/ErrorUtils.cpp,v
retrieving revision 1.30.2.2
retrieving revision 1.30.2.3
diff -C2 -d -r1.30.2.2 -r1.30.2.3
*** ErrorUtils.cpp 31 Aug 2008 02:11:04 -0000 1.30.2.2
--- ErrorUtils.cpp 13 Sep 2008 04:26:17 -0000 1.30.2.3
***************
*** 14,20 ****
void GetScodeString(SCODE sc, TCHAR *buf, int bufSize);
! LPCSTR GetScodeRangeString(SCODE sc);
! LPCSTR GetSeverityString(SCODE sc);
! LPCSTR GetFacilityString(SCODE sc);
static PyObject *PyCom_PyObjectFromIErrorInfo(IErrorInfo *, HRESULT errorhr);
--- 14,20 ----
void GetScodeString(SCODE sc, TCHAR *buf, int bufSize);
! LPCTSTR GetScodeRangeString(SCODE sc);
! LPCTSTR GetSeverityString(SCODE sc);
! LPCTSTR GetFacilityString(SCODE sc);
static PyObject *PyCom_PyObjectFromIErrorInfo(IErrorInfo *, HRESULT errorhr);
***************
*** 53,73 ****
PyErr_Clear();
// Not a special exception object - do the best we can.
- PyObject *obException = PyObject_Str(exception);
- PyObject *obValue = PyObject_Str(v);
- char *szException = PyString_AsString(obException);
- char *szValue = PyString_AsString(obValue);
char *szBaseMessage = "Unexpected Python Error: ";
! if (szException==NULL) szException = "<bad exception>";
! if (szValue==NULL) szValue = "<bad exception value>";
! size_t len = strlen(szBaseMessage) + strlen(szException) + 2 + strlen(szValue) + 1;
! // 2 for ": "
! // message could be quite long - be safe.
char *tempBuf = new char[len];
if (tempBuf) {
! strcpy(tempBuf, szBaseMessage);
! strcat(tempBuf, szException);
! strcat(tempBuf, ": ");
! strcat(tempBuf, szValue);
pExcepInfo->bstrDescription = PyWin_String_AsBstr(tempBuf);
} else
pExcepInfo->bstrDescription = SysAllocString(L"memory error allocating exception buffer!");
--- 53,64 ----
PyErr_Clear();
// Not a special exception object - do the best we can.
char *szBaseMessage = "Unexpected Python Error: ";
! char *szException = GetPythonTraceback(exception, v, tb);
! size_t len = strlen(szBaseMessage) + strlen(szException) + 1;
char *tempBuf = new char[len];
if (tempBuf) {
! snprintf(tempBuf, len, "%s%s", szBaseMessage, szException);
pExcepInfo->bstrDescription = PyWin_String_AsBstr(tempBuf);
+ delete [] tempBuf;
} else
pExcepInfo->bstrDescription = SysAllocString(L"memory error allocating exception buffer!");
***************
*** 82,93 ****
// Any other common Python exceptions we should map?
pExcepInfo->scode = E_FAIL;
-
- delete [] tempBuf;
- Py_XDECREF(obException);
- Py_XDECREF(obValue);
}
- Py_XDECREF(tb);
Py_XDECREF(exception);
Py_XDECREF(v);
PyErr_Clear();
}
--- 73,80 ----
// Any other common Python exceptions we should map?
pExcepInfo->scode = E_FAIL;
}
Py_XDECREF(exception);
Py_XDECREF(v);
+ Py_XDECREF(tb);
PyErr_Clear();
}
***************
*** 372,376 ****
{
#ifndef MS_WINCE
! OutputDebugString(pszMessageText);
#else
NKDbgPrintfW(pszMessageText);
--- 359,363 ----
{
#ifndef MS_WINCE
! OutputDebugStringA(pszMessageText);
#else
NKDbgPrintfW(pszMessageText);
***************
*** 390,402 ****
BOOL VLogF_Logger(PyObject *logger, const char *log_method,
! const TCHAR *prefix, const TCHAR *fmt, va_list argptr)
{
// Protected by Python lock
! static TCHAR buff[8196];
size_t buf_len = sizeof(buff) / sizeof(buff[0]);
size_t prefix_len = strlen(prefix);
! assert(prefix_len<100);
! strcpy(buff, prefix);
! wvsprintf(buff+prefix_len, fmt, argptr);
PyObject *exc_typ = NULL, *exc_val = NULL, *exc_tb = NULL;
--- 377,388 ----
BOOL VLogF_Logger(PyObject *logger, const char *log_method,
! const char *prefix, const char *fmt, va_list argptr)
{
// Protected by Python lock
! static char buff[8196];
size_t buf_len = sizeof(buff) / sizeof(buff[0]);
size_t prefix_len = strlen(prefix);
! strncpy(buff, prefix, buf_len);
! vsnprintf(buff+prefix_len, buf_len-prefix_len, fmt, argptr);
PyObject *exc_typ = NULL, *exc_val = NULL, *exc_tb = NULL;
***************
*** 433,446 ****
}
! void VLogF(const TCHAR *fmt, va_list argptr)
{
! static TCHAR buff[8196]; // protected by Python lock
! wvsprintf(buff, fmt, argptr);
PyCom_StreamMessage(buff);
}
! PYCOM_EXPORT void PyCom_LogF(const TCHAR *fmt, ...)
{
va_list marker;
--- 419,432 ----
}
! void VLogF(const char *fmt, va_list argptr)
{
! static char buff[8196]; // protected by Python lock
! vsnprintf(buff, 8196, fmt, argptr);
PyCom_StreamMessage(buff);
}
! void PyCom_LogF(const char *fmt, ...)
{
va_list marker;
***************
*** 590,594 ****
Py_INCREF(Py_None);
}
! PyObject *evalue = Py_BuildValue("isOO", errorhr, scodeStringBuf, obEI, Py_None);
Py_DECREF(obEI);
--- 576,580 ----
Py_INCREF(Py_None);
}
! PyObject *evalue = Py_BuildValue("iNOO", errorhr, PyWinObject_FromTCHAR(scodeStringBuf), obEI, Py_None);
Py_DECREF(obEI);
***************
*** 605,609 ****
TCHAR buf[512];
GetScodeString(hr, buf, sizeof(buf)/sizeof(TCHAR));
! PyObject *obScodeString = PyString_FromTCHAR(buf);
PyObject *evalue;
PyObject *obArg;
--- 591,595 ----
TCHAR buf[512];
GetScodeString(hr, buf, sizeof(buf)/sizeof(TCHAR));
! PyObject *obScodeString = PyWinObject_FromTCHAR(buf);
PyObject *evalue;
PyObject *obArg;
***************
*** 1066,1070 ****
return;
}
! // Next see if this particular error code is registerd as being supplied
// by a specific DLL.
HINSTANCE hi = PyWin_GetErrorMessageModule(hr);
--- 1052,1056 ----
return;
}
! // Next see if this particular error code is registered as being supplied
// by a specific DLL.
HINSTANCE hi = PyWin_GetErrorMessageModule(hr);
***************
*** 1093,1097 ****
}
! LPCSTR GetScodeRangeString(HRESULT hr)
{
struct RANGE_ENTRY
--- 1079,1083 ----
}
! LPCTSTR GetScodeRangeString(HRESULT hr)
{
struct RANGE_ENTRY
***************
*** 1099,1107 ****
HRESULT hrFirst;
HRESULT hrLast;
! LPCSTR lpszName;
};
#define MAKE_RANGE_ENTRY(hrRange) \
{ hrRange##_FIRST, hrRange##_LAST, \
! #hrRange "_FIRST..." #hrRange "_LAST" }
static const RANGE_ENTRY hrRangeTable[] =
--- 1085,1093 ----
HRESULT hrFirst;
HRESULT hrLast;
! LPCTSTR lpszName;
};
#define MAKE_RANGE_ENTRY(hrRange) \
{ hrRange##_FIRST, hrRange##_LAST, \
! _T(#hrRange) _T("_FIRST...") _T(#hrRange) _T("_LAST") }
static const RANGE_ENTRY hrRangeTable[] =
***************
*** 1154,1198 ****
}
! LPCSTR GetSeverityString(HRESULT hr)
{
! static LPCSTR rgszSEVERITY[] =
{
! "SEVERITY_SUCCESS",
! "SEVERITY_ERROR",
};
return rgszSEVERITY[HRESULT_SEVERITY(hr)];
}
! LPCSTR GetFacilityString(HRESULT hr)
{
! static LPCSTR rgszFACILITY[] =
{
! "FACILITY_NULL",
! "FACILITY_RPC",
! "FACILITY_DISPATCH",
! "FACILITY_STORAGE",
! "FACILITY_ITF",
! "FACILITY_ADSI",
! "FACILITY_0x06",
! "FACILITY_WIN32",
! "FACILITY_WINDOWS",
! "FACILITY_SSPI/FACILITY_MQ", // SSPI from ADSERR.H, MQ from mq.h
! "FACILITY_CONTROL",
! "FACILITY_EDK",
! "FACILITY_INTERNET",
! "FACILITY_MEDIASERVER",
! "FACILITY_MSMQ",
! "FACILITY_SETUPAPI",
};
if (HRESULT_FACILITY(hr) >= _countof(rgszFACILITY))
switch (HRESULT_FACILITY(hr)) {
case 0x7FF:
! return "FACILITY_BACKUP";
case 0x800:
! return "FACILITY_EDB";
case 0x900:
! return "FACILITY_MDSI";
default:
! return "<Unknown Facility>";
}
return rgszFACILITY[HRESULT_FACILITY(hr)];
--- 1140,1184 ----
}
! LPCTSTR GetSeverityString(HRESULT hr)
{
! static LPCTSTR rgszSEVERITY[] =
{
! _T("SEVERITY_SUCCESS"),
! _T("SEVERITY_ERROR"),
};
return rgszSEVERITY[HRESULT_SEVERITY(hr)];
}
! LPCTSTR GetFacilityString(HRESULT hr)
{
! static LPCTSTR rgszFACILITY[] =
{
! _T("FACILITY_NULL"),
! _T("FACILITY_RPC"),
! _T("FACILITY_DISPATCH"),
! _T("FACILITY_STORAGE"),
! _T("FACILITY_ITF"),
! _T("FACILITY_ADSI"),
! _T("FACILITY_0x06"),
! _T("FACILITY_WIN32"),
! _T("FACILITY_WINDOWS"),
! _T("FACILITY_SSPI/FACILITY_MQ"), // SSPI from ADSERR.H, MQ from mq.h
! _T("FACILITY_CONTROL"),
! _T("FACILITY_EDK"),
! _T("FACILITY_INTERNET"),
! _T("FACILITY_MEDIASERVER"),
! _T("FACILITY_MSMQ"),
! _T("FACILITY_SETUPAPI"),
};
if (HRESULT_FACILITY(hr) >= _countof(rgszFACILITY))
switch (HRESULT_FACILITY(hr)) {
case 0x7FF:
! return _T("FACILITY_BACKUP");
case 0x800:
! return _T("FACILITY_EDB");
case 0x900:
! return _T("FACILITY_MDSI");
default:
! return _T("<Unknown Facility>");
}
return rgszFACILITY[HRESULT_FACILITY(hr)];
Index: PyRecord.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyRecord.cpp,v
retrieving revision 1.11.4.1
retrieving revision 1.11.4.2
diff -C2 -d -r1.11.4.1 -r1.11.4.2
*** PyRecord.cpp 29 Aug 2008 08:27:37 -0000 1.11.4.1
--- PyRecord.cpp 13 Sep 2008 04:26:17 -0000 1.11.4.2
***************
*** 24,28 ****
static HRESULT (STDAPICALLTYPE *pfnSAGRI)(SAFEARRAY *, IRecordInfo **) = NULL;
if (pfnSAGRI==NULL) {
! HMODULE hmod = GetModuleHandle("oleaut32.dll");
if (hmod==NULL)
return E_NOTIMPL;
--- 24,28 ----
static HRESULT (STDAPICALLTYPE *pfnSAGRI)(SAFEARRAY *, IRecordInfo **) = NULL;
if (pfnSAGRI==NULL) {
! HMODULE hmod = GetModuleHandle(_T("oleaut32.dll"));
if (hmod==NULL)
return E_NOTIMPL;
***************
*** 38,42 ****
static HRESULT (STDAPICALLTYPE *pfnGRIFG)(REFGUID, ULONG, ULONG, LCID, REFGUID, IRecordInfo **) = NULL;
if (pfnGRIFG==NULL) {
! HMODULE hmod = GetModuleHandle("oleaut32.dll");
if (hmod==NULL)
return E_NOTIMPL;
--- 38,42 ----
static HRESULT (STDAPICALLTYPE *pfnGRIFG)(REFGUID, ULONG, ULONG, LCID, REFGUID, IRecordInfo **) = NULL;
if (pfnGRIFG==NULL) {
! HMODULE hmod = GetModuleHandle(_T("oleaut32.dll"));
if (hmod==NULL)
return E_NOTIMPL;
|