win32-api 1.4.1-x86-mswin32-60 → 1.4.2-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,8 @@
1
+ = 1.4.2 - 31-May-2009
2
+ * Updated the internal StringError() function to better handle the possibility
3
+ of the English .mui file not being found. Thanks go to Michel Demazure for
4
+ the spot.
5
+
1
6
  = 1.4.1 - 29-May-2009
2
7
  * Callback handling improvements.
3
8
  * Updated the gemspec description.
data/ext/win32/api.c CHANGED
@@ -17,7 +17,7 @@
17
17
  #endif
18
18
 
19
19
  #define MAX_BUF 1024
20
- #define WINDOWS_API_VERSION "1.4.1"
20
+ #define WINDOWS_API_VERSION "1.4.2"
21
21
 
22
22
  #define _T_VOID 0
23
23
  #define _T_LONG 1
@@ -60,7 +60,7 @@ char* StringError(DWORD dwError){
60
60
  static char buf[MAX_PATH];
61
61
  DWORD dwLen;
62
62
 
63
- /* Assume ASCII error messages from the Windows API */
63
+ // Assume ASCII error messages from the Windows API
64
64
  dwLen = FormatMessageA(
65
65
  FORMAT_MESSAGE_ALLOCATE_BUFFER |
66
66
  FORMAT_MESSAGE_FROM_SYSTEM |
@@ -73,8 +73,31 @@ char* StringError(DWORD dwError){
73
73
  NULL
74
74
  );
75
75
 
76
- if(!dwLen)
77
- rb_raise(cAPIError, "Attempt to format message failed");
76
+ /* It appears that Windows doesn't necessarily ship with the DLL
77
+ * required to always use English error messages. Check for error
78
+ * ERROR_MUI_FILE_NOT_FOUND (15100), and try again if necessary.
79
+ */
80
+ if(!dwLen && GetLastError() == 15100){
81
+ dwLen = FormatMessageA(
82
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |
83
+ FORMAT_MESSAGE_FROM_SYSTEM |
84
+ FORMAT_MESSAGE_IGNORE_INSERTS,
85
+ NULL,
86
+ dwError,
87
+ 0,
88
+ (LPSTR)&lpMsgBuf,
89
+ 0,
90
+ NULL
91
+ );
92
+ }
93
+
94
+ if(!dwLen){
95
+ rb_raise(
96
+ cAPIError,
97
+ "Attempt to format message failed (error = '%d')",
98
+ GetLastError()
99
+ );
100
+ }
78
101
 
79
102
  memset(buf, 0, MAX_PATH);
80
103
 
@@ -921,6 +944,6 @@ void Init_api(){
921
944
 
922
945
  /* Constants */
923
946
 
924
- /* 1.4.1: The version of this library, returned as a String */
947
+ /* 1.4.2: The version of this library, returned as a String */
925
948
  rb_define_const(cAPI, "VERSION", rb_str_new2(WINDOWS_API_VERSION));
926
949
  }
data/lib/win32/api.so CHANGED
Binary file
@@ -20,7 +20,7 @@ class TC_Win32_API < Test::Unit::TestCase
20
20
  end
21
21
 
22
22
  def test_version
23
- assert_equal('1.4.1', API::VERSION)
23
+ assert_equal('1.4.2', API::VERSION)
24
24
  end
25
25
 
26
26
  def test_constructor_basic
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win32-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: x86-mswin32-60
6
6
  authors:
7
7
  - Daniel J. Berger
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-05-29 00:00:00 -06:00
13
+ date: 2009-05-31 00:00:00 -06:00
14
14
  default_executable:
15
15
  dependencies: []
16
16