diff options
author | suke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-10-14 11:56:10 +0000 |
---|---|---|
committer | suke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-10-14 11:56:10 +0000 |
commit | b1085abaeb5f19dd76ac5650c9c8ec50c1e4db02 (patch) | |
tree | 45001569b7a2e17af9399f9981a77f57fcb071f2 /ext/win32ole | |
parent | 694826d7e2c75e4960b317a475110903458e3c17 (diff) | |
download | ruby-b1085abaeb5f19dd76ac5650c9c8ec50c1e4db02.tar.gz |
* ext/win32ole/win32ole.c (reg_get_val): expand environment in
the pathname. [Bug #3907]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/win32ole')
-rw-r--r-- | ext/win32ole/win32ole.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c index 70deed3748..497607ab67 100644 --- a/ext/win32ole/win32ole.c +++ b/ext/win32ole/win32ole.c @@ -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.5.0" +#define WIN32OLE_VERSION "1.5.1" typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX) (REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*); @@ -2338,6 +2338,13 @@ reg_get_val(HKEY hkey, const char *subkey) err = RegQueryValueEx(hkey, subkey, NULL, &dwtype, pbuf, &size); if (err == ERROR_SUCCESS) { pbuf[size] = '\0'; + if (dwtype == REG_EXPAND_SZ) { + char* pbuf2 = pbuf; + DWORD len = ExpandEnvironmentStrings(pbuf2, NULL, 0); + pbuf = ALLOC_N(char, len + 1); + ExpandEnvironmentStrings(pbuf2, pbuf, len + 1); + free(pbuf2); + } val = rb_str_new2(pbuf); } free(pbuf); |