diff options
author | suke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-11-04 12:12:59 +0000 |
---|---|---|
committer | suke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-11-04 12:12:59 +0000 |
commit | e4a65e442737a45016db4a36ffcf3b41df01c707 (patch) | |
tree | 0f6b0bfca6422bc2728b608299acb5870f2fb7c4 /ext/win32ole | |
parent | e42cec58db09dc222c5d145fa4636a4f2da39e1c (diff) | |
download | ruby-e4a65e442737a45016db4a36ffcf3b41df01c707.tar.gz |
ext/win32ole/win32ole.c(typelib_file_from_typelib): search "win16"
entry to get library path.
ext/win32ole/win32ole.c(oletypelib_path): ditto.
ext/win32ole/win32ole.c(ole_typedesc2val): add VT_LPWSTR, VT_LPSTR,
VT_ERROR case.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/win32ole')
-rw-r--r-- | ext/win32ole/win32ole.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c index 5d3747212f..78f78a4b84 100644 --- a/ext/win32ole/win32ole.c +++ b/ext/win32ole/win32ole.c @@ -79,7 +79,7 @@ #define WC2VSTR(x) ole_wc2vstr((x), TRUE) -#define WIN32OLE_VERSION "0.6.1" +#define WIN32OLE_VERSION "0.6.2" typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX) (REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*); @@ -1137,6 +1137,18 @@ reg_get_val(hkey, subkey) } static VALUE +reg_get_typelib_file_path(hkey) + HKEY hkey; +{ + VALUE path = Qnil; + path = reg_get_val(hkey, "win32"); + if (path == Qnil) { + path = reg_get_val(hkey, "win16"); + } + return path; +} + +static VALUE typelib_file_from_clsid(ole) VALUE ole; { @@ -1216,7 +1228,7 @@ typelib_file_from_typelib(ole) break; err = reg_open_vkey(hversion, lang, &hlang); if (err == ERROR_SUCCESS) { - if ((file = reg_get_val(hlang, "win32")) != Qnil) + if ((file = reg_get_typelib_file_path(hlang)) != Qnil) found = TRUE; RegCloseKey(hlang); } @@ -3237,6 +3249,19 @@ ole_typedesc2val(pTypeInfo, pTypeDesc, typedetails) if(typedetails != Qnil) rb_ary_push(typedetails, rb_str_new2("DISPATCH")); return rb_str_new2("DISPATCH"); + case VT_ERROR: + if(typedetails != Qnil) + rb_ary_push(typedetails, rb_str_new2("ERROR")); + return rb_str_new2("ERROR"); + + case VT_LPWSTR: + if(typedetails != Qnil) + rb_ary_push(typedetails, rb_str_new2("LPWSTR")); + return rb_str_new2("LPWSTR"); + case VT_LPSTR: + if(typedetails != Qnil) + rb_ary_push(typedetails, rb_str_new2("LPSTR")); + return rb_str_new2("LPSTR"); default: str = rb_str_new2("Unknown Type "); rb_str_concat(str, rb_fix2str(INT2FIX(pTypeDesc->vt), 10)); @@ -3846,7 +3871,7 @@ oletypelib_path(guid, version) break; err = reg_open_vkey(hkey, lang, &hlang); if (err == ERROR_SUCCESS) { - path = reg_get_val(hlang, "win32"); + path = reg_get_typelib_file_path(hlang); RegCloseKey(hlang); } } @@ -3897,11 +3922,12 @@ foletypelib_ole_classes(self) hr = LoadTypeLibEx(pbuf, REGKIND_NONE, &pTypeLib); SysFreeString(pbuf); if (FAILED(hr)) - ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Failed to LoadTypeLibEx"); + ole_raise(hr, eWIN32OLE_RUNTIME_ERROR, "Failed to LoadTypeLibEx from `%s'", + StringValuePtr(path)); ole_classes_from_typelib(pTypeLib, classes); OLE_RELEASE(pTypeLib); } else { - rb_raise(eWIN32OLE_RUNTIME_ERROR, "fail to get type library path"); + rb_raise(eWIN32OLE_RUNTIME_ERROR, "Failed to get type library path"); } return classes; } |