1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/win32ole/win32ole.c: use WIN32OLEQueryInterfaceError when failed

to query com interface.
* ext/win32ole/win32ole_event.c: ditto.
* ext/win32ole/win32ole_method.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
suke 2017-11-18 02:53:39 +00:00
parent 8840b033fb
commit 3c0cf7856a
3 changed files with 15 additions and 15 deletions

View file

@ -26,7 +26,7 @@
const IID IID_IMultiLanguage2 = {0xDCCFC164, 0x2B38, 0x11d2, {0xB7, 0xEC, 0x00, 0xC0, 0x4F, 0x8F, 0x5D, 0x9A}};
#endif
#define WIN32OLE_VERSION "1.8.7"
#define WIN32OLE_VERSION "1.8.8"
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
@ -2073,12 +2073,12 @@ fole_s_const_load(int argc, VALUE *argv, VALUE self)
hr = pole->pDispatch->lpVtbl->GetTypeInfo(pole->pDispatch,
0, lcid, &pTypeInfo);
if(FAILED(hr)) {
ole_raise(hr, rb_eRuntimeError, "failed to GetTypeInfo");
ole_raise(hr, eWIN32OLEQueryInterfaceError, "failed to GetTypeInfo");
}
hr = pTypeInfo->lpVtbl->GetContainingTypeLib(pTypeInfo, &pTypeLib, &index);
if(FAILED(hr)) {
OLE_RELEASE(pTypeInfo);
ole_raise(hr, rb_eRuntimeError, "failed to GetContainingTypeLib");
ole_raise(hr, eWIN32OLEQueryInterfaceError, "failed to GetContainingTypeLib");
}
OLE_RELEASE(pTypeInfo);
if(!RB_TYPE_P(klass, T_NIL)) {
@ -3324,7 +3324,7 @@ fole_each(VALUE self)
if (FAILED(hr)) {
VariantClear(&result);
ole_raise(hr, eWIN32OLERuntimeError, "failed to get IEnum Interface");
ole_raise(hr, eWIN32OLEQueryInterfaceError, "failed to get IEnum Interface");
}
if (V_VT(&result) == VT_UNKNOWN) {
@ -3340,7 +3340,7 @@ fole_each(VALUE self)
}
if (FAILED(hr) || !pEnum) {
VariantClear(&result);
ole_raise(hr, rb_eRuntimeError, "failed to get IEnum Interface");
ole_raise(hr, eWIN32OLEQueryInterfaceError, "failed to get IEnum Interface");
}
VariantClear(&result);
@ -3534,7 +3534,7 @@ fole_type(VALUE self)
hr = pole->pDispatch->lpVtbl->GetTypeInfo( pole->pDispatch, 0, lcid, &pTypeInfo );
if(FAILED(hr)) {
ole_raise(hr, rb_eRuntimeError, "failed to GetTypeInfo");
ole_raise(hr, eWIN32OLEQueryInterfaceError, "failed to GetTypeInfo");
}
type = ole_type_from_itypeinfo(pTypeInfo);
OLE_RELEASE(pTypeInfo);
@ -3568,7 +3568,7 @@ fole_typelib(VALUE self)
hr = pole->pDispatch->lpVtbl->GetTypeInfo(pole->pDispatch,
0, lcid, &pTypeInfo);
if(FAILED(hr)) {
ole_raise(hr, rb_eRuntimeError, "failed to GetTypeInfo");
ole_raise(hr, eWIN32OLEQueryInterfaceError, "failed to GetTypeInfo");
}
vtlib = ole_typelib_from_itypeinfo(pTypeInfo);
OLE_RELEASE(pTypeInfo);
@ -3615,7 +3615,7 @@ fole_query_interface(VALUE self, VALUE str_iid)
hr = pole->pDispatch->lpVtbl->QueryInterface(pole->pDispatch, &iid,
&p);
if(FAILED(hr)) {
ole_raise(hr, eWIN32OLERuntimeError,
ole_raise(hr, eWIN32OLEQueryInterfaceError,
"failed to get interface `%s'",
StringValuePtr(str_iid));
}
@ -3856,7 +3856,7 @@ fole_method_help(VALUE self, VALUE cmdname)
pole = oledata_get_struct(self);
hr = typeinfo_from_ole(pole, &pTypeInfo);
if(FAILED(hr))
ole_raise(hr, rb_eRuntimeError, "failed to get ITypeInfo");
ole_raise(hr, eWIN32OLEQueryInterfaceError, "failed to get ITypeInfo");
obj = create_win32ole_method(pTypeInfo, cmdname);

View file

@ -942,7 +942,7 @@ ev_advise(int argc, VALUE *argv, VALUE self)
&p);
if (FAILED(hr)) {
OLE_RELEASE(pTypeInfo);
ole_raise(hr, rb_eRuntimeError,
ole_raise(hr, eWIN32OLEQueryInterfaceError,
"failed to query IConnectionPointContainer");
}
pContainer = p;
@ -953,7 +953,7 @@ ev_advise(int argc, VALUE *argv, VALUE self)
OLE_RELEASE(pContainer);
if (FAILED(hr)) {
OLE_RELEASE(pTypeInfo);
ole_raise(hr, rb_eRuntimeError, "failed to query IConnectionPoint");
ole_raise(hr, eWIN32OLEQueryInterfaceError, "failed to query IConnectionPoint");
}
pIEV = EVENTSINK_Constructor();
pIEV->m_iid = iid;
@ -961,7 +961,7 @@ ev_advise(int argc, VALUE *argv, VALUE self)
(IUnknown*)pIEV,
&dwCookie);
if (FAILED(hr)) {
ole_raise(hr, rb_eRuntimeError, "Advise Error");
ole_raise(hr, eWIN32OLEQueryInterfaceError, "Advise Error");
}
TypedData_Get_Struct(self, struct oleeventdata, &oleevent_datatype, poleev);

View file

@ -83,7 +83,7 @@ ole_method_sub(VALUE self, ITypeInfo *pOwnerTypeInfo, ITypeInfo *pTypeInfo, VALU
VALUE method = Qnil;
hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
if (FAILED(hr)) {
ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
ole_raise(hr, eWIN32OLEQueryInterfaceError, "failed to GetTypeAttr");
}
for(i = 0; i < pTypeAttr->cFuncs && method == Qnil; i++) {
hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, i, &pFuncDesc);
@ -148,7 +148,7 @@ olemethod_from_typeinfo(VALUE self, ITypeInfo *pTypeInfo, VALUE name)
VALUE method = Qnil;
hr = OLE_GET_TYPEATTR(pTypeInfo, &pTypeAttr);
if (FAILED(hr)) {
ole_raise(hr, eWIN32OLERuntimeError, "failed to GetTypeAttr");
ole_raise(hr, eWIN32OLEQueryInterfaceError, "failed to GetTypeAttr");
}
method = ole_method_sub(self, 0, pTypeInfo, name);
if (method != Qnil) {
@ -308,7 +308,7 @@ ole_method_return_type(ITypeInfo *pTypeInfo, UINT method_index)
hr = pTypeInfo->lpVtbl->GetFuncDesc(pTypeInfo, method_index, &pFuncDesc);
if (FAILED(hr))
ole_raise(hr, eWIN32OLERuntimeError, "failed to GetFuncDesc");
ole_raise(hr, eWIN32OLEQueryInterfaceError, "failed to GetFuncDesc");
type = ole_typedesc2val(pTypeInfo, &(pFuncDesc->elemdescFunc.tdesc), Qnil);
pTypeInfo->lpVtbl->ReleaseFuncDesc(pTypeInfo, pFuncDesc);