[前][次][番号順一覧][スレッド一覧]

ruby-changes:17502

From: suke <ko1@a...>
Date: Fri, 15 Oct 2010 22:57:57 +0900 (JST)
Subject: [ruby-changes:17502] Ruby:r29507 (trunk): * ext/win32ole/win32ole.c (ole_hresult2msg): get English message first,

suke	2010-10-15 22:55:47 +0900 (Fri, 15 Oct 2010)

  New Revision: 29507

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29507

  Log:
    * ext/win32ole/win32ole.c (ole_hresult2msg): get English message first, 
      instead of system default. [ruby-core:32765]

  Modified files:
    trunk/ChangeLog
    trunk/ext/win32ole/win32ole.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 29506)
+++ ChangeLog	(revision 29507)
@@ -1,3 +1,8 @@
+Fri Oct 15 22:54:46 2010  Masaki Suketa <masaki.suketa@n...>
+
+	* ext/win32ole/win32ole.c (ole_hresult2msg): get English message first, 
+	  instead of system default. [ruby-core:32765]
+
 Fri Oct 15 22:47:31 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* include/ruby/ruby.h (VALUE): prefer long over uintptr_t,
Index: ext/win32ole/win32ole.c
===================================================================
--- ext/win32ole/win32ole.c	(revision 29506)
+++ ext/win32ole/win32ole.c	(revision 29507)
@@ -143,7 +143,7 @@
 
 #define WC2VSTR(x) ole_wc2vstr((x), TRUE)
 
-#define WIN32OLE_VERSION "1.5.1"
+#define WIN32OLE_VERSION "1.5.2"
 
 typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
     (REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
@@ -1102,12 +1102,19 @@
     char strhr[100];
     sprintf(strhr, "    HRESULT error code:0x%08x\n      ", (unsigned)hr);
     msg = rb_str_new2(strhr);
-
     dwCount = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
                             FORMAT_MESSAGE_FROM_SYSTEM |
                             FORMAT_MESSAGE_IGNORE_INSERTS,
-                            NULL, hr, cWIN32OLE_lcid,
+                            NULL, hr, 
+                            MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
                             (LPTSTR)&p_msg, 0, NULL);
+    if (dwCount == 0) {
+        dwCount = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+                                FORMAT_MESSAGE_FROM_SYSTEM |
+                                FORMAT_MESSAGE_IGNORE_INSERTS,
+                                NULL, hr, cWIN32OLE_lcid,
+                                (LPTSTR)&p_msg, 0, NULL);
+    }
     if (dwCount > 0) {
 	term = p_msg + strlen(p_msg);
 	while (p_msg < term) {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]