зеркало из https://github.com/github/ruby.git
* 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
This commit is contained in:
Родитель
694826d7e2
Коммит
b1085abaeb
|
@ -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 07:35:07 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* file.c (DEVT2NUM): added. Size of dev_t is depend on the
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
Загрузка…
Ссылка в новой задаче