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 (ole_invoke): pass WIN32OLE_RECORD variant

by reference when invoke OLE methods at first.

* ext/win32ole/win32ole.c (olerecord_set_ivar): release
  IRecordInfo interface before setting another IRecordInfo interface.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
suke 2014-07-30 12:35:15 +00:00
parent f29dae3541
commit 1889a5b274
2 changed files with 20 additions and 6 deletions

View file

@ -1,3 +1,11 @@
Wed Jul 30 21:29:39 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* ext/win32ole/win32ole.c (ole_invoke): pass WIN32OLE_RECORD variant
by reference when invoke OLE methods at first.
* ext/win32ole/win32ole.c (olerecord_set_ivar): release
IRecordInfo interface before setting another IRecordInfo interface.
Wed Jul 30 13:17:35 2014 Koichi Sasada <ko1@atdot.net>
* gc.c: remove unused macros.

View file

@ -143,7 +143,7 @@ const IID IID_IMultiLanguage2 = {0xDCCFC164, 0x2B38, 0x11d2, {0xB7, 0xEC, 0x00,
#define WC2VSTR(x) ole_wc2vstr((x), TRUE)
#define WIN32OLE_VERSION "1.6.6"
#define WIN32OLE_VERSION "1.6.7"
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
@ -3460,7 +3460,9 @@ set_argv(VARIANTARG* realargs, unsigned int beg, unsigned int end)
rb_ary_clear(argv);
while (end-- > beg) {
rb_ary_push(argv, ole_variant2val(&realargs[end]));
VariantClear(&realargs[end]);
if (V_VT(&realargs[end]) != VT_RECORD) {
VariantClear(&realargs[end]);
}
}
return argv;
}
@ -3585,8 +3587,6 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
if (rb_obj_is_kind_of(param, cWIN32OLE_VARIANT)) {
Data_Get_Struct(param, struct olevariantdata, pvar);
VariantCopy(&op.dp.rgvarg[n], &(pvar->var));
} else if (rb_obj_is_kind_of(param, cWIN32OLE_RECORD)) {
ole_rec2variant(param, &op.dp.rgvarg[n]);
} else {
ole_val2variant(param, &realargs[n]);
V_VT(&op.dp.rgvarg[n]) = VT_VARIANT | VT_BYREF;
@ -3642,7 +3642,9 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
}
for(i = cNamedArgs; i < op.dp.cArgs; i++) {
n = op.dp.cArgs - i + cNamedArgs - 1;
VariantClear(&op.dp.rgvarg[n]);
if (V_VT(&op.dp.rgvarg[n]) != VT_RECORD) {
VariantClear(&op.dp.rgvarg[n]);
}
}
}
@ -3678,6 +3680,9 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
param = rb_ary_entry(paramS, i-cNamedArgs);
if (rb_obj_is_kind_of(param, cWIN32OLE_VARIANT)) {
ole_val2variant(param, &realargs[n]);
} else if ( rb_obj_is_kind_of(param, cWIN32OLE_RECORD) &&
V_VT(&realargs[n]) == VT_RECORD ) {
olerecord_set_ivar(param, V_RECORDINFO(&realargs[n]), V_RECORD(&realargs[n]));
}
}
set_argv(realargs, cNamedArgs, op.dp.cArgs);
@ -9286,8 +9291,9 @@ olerecord_set_ivar(VALUE obj, IRecordInfo *pri, void *prec)
struct olerecorddata *pvar;
Data_Get_Struct(obj, struct olerecorddata, pvar);
OLE_ADDREF(pri);
OLE_RELEASE(pvar->pri);
pvar->pri = pri;
OLE_ADDREF(pvar->pri);
hr = pri->lpVtbl->GetName(pri, &bstr);
if (SUCCEEDED(hr)) {