summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-07 05:13:03 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-07 05:13:03 +0000
commit751bb3cc1504049af8315cb655d2ad1c716a0fb1 (patch)
tree55859cb3fd88136dbfbf52fafbe5f96bf1797ffd
parentcbf16eda1f1e2798f690e136af8e241464c89882 (diff)
downloadruby-751bb3cc1504049af8315cb655d2ad1c716a0fb1.tar.gz
* ext/win32ole/win32ole.c (ole_type_progid, reg_enum_key,
reg_get_val, ole_wc2mb): fix the bug. Thanks, arton. [ruby-dev:31576] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_5@13363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--ext/win32ole/win32ole.c21
-rw-r--r--version.h2
3 files changed, 20 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 3bb6a98edd..64fc6080ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Sep 7 14:12:37 2007 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c (ole_type_progid, reg_enum_key,
+ reg_get_val, ole_wc2mb): fix the bug. Thanks, arton.
+ [ruby-dev:31576]
+
Fri Sep 7 14:02:10 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* process.c (detach_process_watcher): should not pass the pointer
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c
index e8a68380ae..b022a8c674 100644
--- a/ext/win32ole/win32ole.c
+++ b/ext/win32ole/win32ole.c
@@ -78,7 +78,7 @@
#define WC2VSTR(x) ole_wc2vstr((x), TRUE)
-#define WIN32OLE_VERSION "0.7.1"
+#define WIN32OLE_VERSION "0.7.2"
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
@@ -476,8 +476,9 @@ ole_wc2mb(pw)
LPSTR pm;
size = WideCharToMultiByte(cWIN32OLE_cp, 0, pw, -1, NULL, 0, NULL, NULL);
if (size) {
- pm = ALLOC_N(char, size);
+ pm = ALLOC_N(char, size + 1);
WideCharToMultiByte(cWIN32OLE_cp, 0, pw, -1, pm, size, NULL, NULL);
+ pm[size] = '\0';
}
else {
pm = ALLOC_N(char, 1);
@@ -1137,12 +1138,13 @@ reg_enum_key(hkey, i)
HKEY hkey;
DWORD i;
{
- char buf[BUFSIZ];
- DWORD size_buf = sizeof(buf);
+ char buf[BUFSIZ + 1];
+ DWORD size_buf = sizeof(buf) - 1;
FILETIME ft;
LONG err = RegEnumKeyEx(hkey, i, buf, &size_buf,
NULL, NULL, NULL, &ft);
if(err == ERROR_SUCCESS) {
+ buf[BUFSIZ] = '\0';
return rb_str_new2(buf);
}
return Qnil;
@@ -1153,10 +1155,11 @@ reg_get_val(hkey, subkey)
HKEY hkey;
const char *subkey;
{
- char buf[BUFSIZ];
- LONG size_buf = sizeof(buf);
+ char buf[BUFSIZ + 1];
+ LONG size_buf = sizeof(buf) - 1;
LONG err = RegQueryValue(hkey, subkey, buf, &size_buf);
if (err == ERROR_SUCCESS) {
+ buf[BUFSIZ] = '\0';
return rb_str_new2(buf);
}
return Qnil;
@@ -3617,8 +3620,10 @@ ole_type_progid(pTypeInfo)
if (FAILED(hr))
return progid;
hr = ProgIDFromCLSID(&pTypeAttr->guid, &pbuf);
- if (SUCCEEDED(hr))
- progid = WC2VSTR(pbuf);
+ if (SUCCEEDED(hr)) {
+ progid = ole_wc2vstr(pbuf, FALSE);
+ CoTaskMemFree(pbuf);
+ }
OLE_RELEASE_TYPEATTR(pTypeInfo, pTypeAttr);
return progid;
}
diff --git a/version.h b/version.h
index edb700c77e..aba868e51b 100644
--- a/version.h
+++ b/version.h
@@ -2,7 +2,7 @@
#define RUBY_RELEASE_DATE "2007-09-07"
#define RUBY_VERSION_CODE 185
#define RUBY_RELEASE_CODE 20070907
-#define RUBY_PATCHLEVEL 101
+#define RUBY_PATCHLEVEL 102
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8