Update of /cvsroot/pywin32/pywin32/com/win32com/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15525
Modified Files:
ErrorUtils.cpp
Log Message:
When formatting a COM error message, check if the HRESULT has been
registered as being supplied by a specific DLL, and if so, use it.
Index: ErrorUtils.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/ErrorUtils.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** ErrorUtils.cpp 26 Jan 2005 02:27:54 -0000 1.24
--- ErrorUtils.cpp 28 Feb 2005 00:08:36 -0000 1.25
***************
*** 1172,1175 ****
--- 1172,1189 ----
return;
}
+ // Next see if this particular error code is registerd as being supplied
+ // by a specific DLL.
+ HINSTANCE hi = PyWin_GetErrorMessageModule(hr);
+ if (hi) {
+ numCopied = ::FormatMessage(FORMAT_MESSAGE_FROM_HMODULE, hi, hr, 0, buf, bufSize, NULL );
+ if (numCopied>0) {
+ if (numCopied<bufSize) {
+ // trim trailing crap
+ if (numCopied>2 && (buf[numCopied-2]=='\n'||buf[numCopied-2]=='\r'))
+ buf[numCopied-2] = '\0';
+ }
+ return;
+ }
+ }
// else look for it in the table
|