diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ext/win32ole/win32ole.c | 7 | ||||
-rw-r--r-- | test/win32ole/test_win32ole_typelib.rb | 6 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 19 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Thu Oct 14 20:50:51 2010 Masaki Suketa <masaki.suketa@nifty.ne.jp> + + * ext/win32ole/win32ole.c (reg_get_val): expand environment in + the pathname. [Bug #3907] + Thu Oct 14 04:16:41 2010 NARUSE, Yui <naruse@ruby-lang.org> * numeric.c (ruby_float_step): fix Numeric#step with infinity unit 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); diff --git a/test/win32ole/test_win32ole_typelib.rb b/test/win32ole/test_win32ole_typelib.rb index 389a5e6fea..09a7f32c88 100644 --- a/test/win32ole/test_win32ole_typelib.rb +++ b/test/win32ole/test_win32ole_typelib.rb @@ -46,6 +46,12 @@ if defined?(WIN32OLE_TYPELIB) } end + # #Bug:3907 [ruby-dev:42338] + def test_initialize_with_REG_EXPAND_SZ + tlib = WIN32OLE_TYPELIB.new("Disk Management Snap-In Object Library") + assert_instance_of(WIN32OLE_TYPELIB, tlib) + end + def test_guid tlib = WIN32OLE_TYPELIB.new("Microsoft Shell Controls And Automation") assert_equal("{50A7E9B0-70EF-11D1-B75A-00A0C90564FE}", tlib.guid) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 76 +#define RUBY_PATCHLEVEL 77 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 |