MCPcopy Create free account
hub / github.com/mhammond/pywin32 / PyCom_SetCOMErrorFromSimple

Function PyCom_SetCOMErrorFromSimple

com/win32com/src/ErrorUtils.cpp:314–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

312}
313
314HRESULT PyCom_SetCOMErrorFromSimple(HRESULT hr, REFIID riid /* = IID_NULL */, const char *description /* = NULL*/)
315{
316 // fast path...
317 if ( hr == S_OK )
318 return S_OK;
319
320 // If you specify a description you should also specify the IID
321 assert(riid != IID_NULL || description==NULL);
322 // Reset the error info for this thread. "Inside OLE2" says we
323 // can call IErrorInfo with NULL, but the COM documentation doesnt mention it.
324 BSTR bstrDesc = NULL;
325 if (description) bstrDesc = PyWin_String_AsBstr(description);
326
327 EXCEPINFO einfo = {
328 0, // wCode
329 0, // wReserved
330 NULL, // bstrSource
331 bstrDesc, // bstrDescription
332 NULL, // bstrHelpFile
333 0, // dwHelpContext
334 NULL, // pvReserved
335 NULL, // pfnDeferredFillIn
336 hr // scode
337 };
338 HRESULT ret = PyCom_SetCOMErrorFromExcepInfo(&einfo, riid);
339 PyCom_CleanupExcepInfo(&einfo);
340 return ret;
341}
342
343PYCOM_EXPORT HRESULT PyCom_SetCOMErrorFromPyException(REFIID riid /* = IID_NULL */)
344{

Callers 15

invoke_finishFunction · 0.85
NextMethod · 0.85
CloneMethod · 0.85
NextMethod · 0.85
CloneMethod · 0.85
NextMethod · 0.85
CloneMethod · 0.85
CloneMethod · 0.85
CloneMethod · 0.85
NextMethod · 0.85
CloneMethod · 0.85
ReadMethod · 0.85

Calls 3

PyWin_String_AsBstrFunction · 0.85
PyCom_CleanupExcepInfoFunction · 0.85

Tested by

no test coverage detected