summaryrefslogtreecommitdiff
path: root/ext/win32ole
diff options
context:
space:
mode:
authorsuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-15 13:55:47 +0000
committersuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-15 13:55:47 +0000
commit12dc1ffd47cf5e368fb30fe77868b40f8c94c718 (patch)
tree8a3e124c4d67bfb3abf60fe3742457f71c9a617d /ext/win32ole
parent8a4966d133452682086270b719e93fadf69cd266 (diff)
* ext/win32ole/win32ole.c (ole_hresult2msg): get English message first,
instead of system default. [ruby-core:32765] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/win32ole')
-rw-r--r--ext/win32ole/win32ole.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c
index 497607ab67..4649da711a 100644
--- a/ext/win32ole/win32ole.c
+++ b/ext/win32ole/win32ole.c
@@ -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.1"
+#define WIN32OLE_VERSION "1.5.2"
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
@@ -1102,12 +1102,19 @@ ole_hresult2msg(HRESULT hr)
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) {