diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-02 08:07:28 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-02 08:07:28 +0000 |
commit | faeed9b54c7b4085d0c6018d27afe5d755a8eb27 (patch) | |
tree | b3cda042f906c38e214641dc9b77e7aebb898da4 /ext | |
parent | 0672c5fc3212a7b423eb35f706ee75c72632a376 (diff) |
merges r29495 from trunk into ruby_1_9_2.
--
* ext/win32ole/win32ole.c (reg_get_val): expand environment in
the pathname. [Bug #3907]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/win32ole/win32ole.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c index 3a052b6293..d768993856 100644 --- a/ext/win32ole/win32ole.c +++ b/ext/win32ole/win32ole.c @@ -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); |