win32-api 1.0.5-x86-mswin32-60 → 1.0.6-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +10 -0
- data/ext/win32/api.c +23 -13
- data/lib/win32/api.so +0 -0
- data/test/tc_win32_api.rb +6 -1
- metadata +6 -7
- data/ext/extconf.rb +0 -10
data/CHANGES
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
= 1.0.6 - 18-Apr-2008
|
2
|
+
* Added the effective_function_name method. This allows you to see what the
|
3
|
+
actual function name is that was defined, e.g. GetUserNameA vs GetUserNameW.
|
4
|
+
* Replaced an instance of _tcscmp with strcmp. The case in question was always
|
5
|
+
going to be ASCII.
|
6
|
+
* Cleaned up some -W3 warnings.
|
7
|
+
* Added the build_manifest task to the Rakefile, which is automatically run if
|
8
|
+
you're using a version of Ruby built with VC++ 8 or later. This builds a
|
9
|
+
ruby.exe.manifest file (if it doesn't already exist).
|
10
|
+
|
1
11
|
= 1.0.5 - 20-Nov-2007
|
2
12
|
* The API.new method now defaults to "W" (wide character functions) before "A"
|
3
13
|
(ANSI functions) if the $KCODE global variable is set to 'u' (UTF8).
|
data/ext/win32/api.c
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#include <windows.h>
|
3
3
|
|
4
4
|
#define MAX_BUF 1024
|
5
|
-
#define WINDOWS_API_VERSION "1.0.
|
5
|
+
#define WINDOWS_API_VERSION "1.0.6"
|
6
6
|
|
7
7
|
#define _T_VOID 0
|
8
8
|
#define _T_LONG 1
|
@@ -71,7 +71,7 @@ static VALUE callback_init(int argc, VALUE* argv, VALUE self)
|
|
71
71
|
VALUE v_proto, v_return, v_proc;
|
72
72
|
int i;
|
73
73
|
|
74
|
-
rb_scan_args(argc, argv, "11", &v_proto, &v_return);
|
74
|
+
rb_scan_args(argc, argv, "11&", &v_proto, &v_return, &v_proc);
|
75
75
|
|
76
76
|
/* Validate prototype characters */
|
77
77
|
for(i = 0; i < RSTRING(v_proto)->len; i++){
|
@@ -87,14 +87,9 @@ static VALUE callback_init(int argc, VALUE* argv, VALUE self)
|
|
87
87
|
if(NIL_P(v_return) || RARRAY(v_return)->len == 0)
|
88
88
|
v_return = rb_str_new2("L");
|
89
89
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
v_proc = Qnil;
|
94
|
-
|
95
|
-
rb_iv_set(self, "@function", v_proc);
|
96
|
-
rb_iv_set(self, "@prototype", v_proto);
|
97
|
-
rb_iv_set(self, "@return_type", v_return);
|
90
|
+
rb_iv_set(self, "@function", v_proc);
|
91
|
+
rb_iv_set(self, "@prototype", v_proto);
|
92
|
+
rb_iv_set(self, "@return_type", v_return);
|
98
93
|
|
99
94
|
return self;
|
100
95
|
}
|
@@ -148,7 +143,7 @@ static VALUE api_init(int argc, VALUE* argv, VALUE self)
|
|
148
143
|
int i;
|
149
144
|
char* first = "A";
|
150
145
|
char* second = "W";
|
151
|
-
VALUE v_proc, v_proto, v_return, v_dll
|
146
|
+
VALUE v_proc, v_proto, v_return, v_dll;
|
152
147
|
|
153
148
|
rb_scan_args(argc, argv, "13", &v_proc, &v_proto, &v_return, &v_dll);
|
154
149
|
|
@@ -198,7 +193,7 @@ static VALUE api_init(int argc, VALUE* argv, VALUE self)
|
|
198
193
|
fProc = GetProcAddress(hLibrary, TEXT(RSTRING(v_proc)->ptr));
|
199
194
|
|
200
195
|
/* The order of 'A' and 'W' is reversed if $KCODE is set to 'UTF8'. */
|
201
|
-
if(!
|
196
|
+
if(!strcmp(rb_get_kcode(), "UTF8")){
|
202
197
|
first = "W";
|
203
198
|
second = "A";
|
204
199
|
}
|
@@ -223,8 +218,17 @@ static VALUE api_init(int argc, VALUE* argv, VALUE self)
|
|
223
218
|
StringError(GetLastError())
|
224
219
|
);
|
225
220
|
}
|
221
|
+
else{
|
222
|
+
rb_iv_set(self, "@effective_function_name", v_unicode);
|
223
|
+
}
|
224
|
+
}
|
225
|
+
else{
|
226
|
+
rb_iv_set(self, "@effective_function_name", v_ascii);
|
226
227
|
}
|
227
228
|
}
|
229
|
+
else{
|
230
|
+
rb_iv_set(self, "@effective_function_name", v_proc);
|
231
|
+
}
|
228
232
|
|
229
233
|
ptr->function = fProc;
|
230
234
|
|
@@ -508,9 +512,15 @@ void Init_api(){
|
|
508
512
|
/* The name of the DLL that exports the API function */
|
509
513
|
rb_define_attr(cAPI, "dll_name", 1, 0);
|
510
514
|
|
511
|
-
/* The name of the function */
|
515
|
+
/* The name of the function passed to the constructor */
|
512
516
|
rb_define_attr(cAPI, "function_name", 1, 0);
|
513
517
|
|
518
|
+
/* The name of the actual function that is returned by the constructor.
|
519
|
+
* For example, if you passed 'GetUserName' to the constructor, then the
|
520
|
+
* effective function name would be either 'GetUserNameA' or 'GetUserNameW'.
|
521
|
+
*/
|
522
|
+
rb_define_attr(cAPI, "effective_function_name", 1, 0);
|
523
|
+
|
514
524
|
/* The prototype, returned as an array of characters */
|
515
525
|
rb_define_attr(cAPI, "prototype", 1, 0);
|
516
526
|
|
data/lib/win32/api.so
CHANGED
Binary file
|
data/test/tc_win32_api.rb
CHANGED
@@ -16,7 +16,7 @@ class TC_Win32_API < Test::Unit::TestCase
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_version
|
19
|
-
assert_equal('1.0.
|
19
|
+
assert_equal('1.0.6', API::VERSION)
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_call
|
@@ -40,6 +40,11 @@ class TC_Win32_API < Test::Unit::TestCase
|
|
40
40
|
assert_equal('GetCurrentDirectory', @api.function_name)
|
41
41
|
end
|
42
42
|
|
43
|
+
def test_effective_function_name
|
44
|
+
assert_respond_to(@api, :effective_function_name)
|
45
|
+
assert_equal('GetCurrentDirectoryA', @api.effective_function_name)
|
46
|
+
end
|
47
|
+
|
43
48
|
def test_prototype
|
44
49
|
assert_respond_to(@api, :prototype)
|
45
50
|
assert_equal(['L', 'P'], @api.prototype)
|
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.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: x86-mswin32-60
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-04-18 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -25,15 +25,14 @@ extra_rdoc_files:
|
|
25
25
|
- MANIFEST
|
26
26
|
- ext/win32/api.c
|
27
27
|
files:
|
28
|
-
-
|
29
|
-
-
|
30
|
-
- ext/win32/api.c
|
28
|
+
- lib/win32
|
29
|
+
- lib/win32/api.so
|
31
30
|
- test/tc_win32_api.rb
|
32
31
|
- test/tc_win32_api_callback.rb
|
33
|
-
- lib/win32/api.so
|
34
32
|
- README
|
35
33
|
- CHANGES
|
36
34
|
- MANIFEST
|
35
|
+
- ext/win32/api.c
|
37
36
|
has_rdoc: true
|
38
37
|
homepage: http://www.rubyforge.org/projects/win32utils
|
39
38
|
post_install_message:
|
@@ -56,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
55
|
requirements: []
|
57
56
|
|
58
57
|
rubyforge_project: win32utils
|
59
|
-
rubygems_version: 1.
|
58
|
+
rubygems_version: 1.1.1
|
60
59
|
signing_key:
|
61
60
|
specification_version: 2
|
62
61
|
summary: A superior replacement for Win32API
|
data/ext/extconf.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
##########################################################################
|
2
|
-
# extconf.rb
|
3
|
-
#
|
4
|
-
# The Windows::API binary should be built using the Rake task, i.e.
|
5
|
-
# 'rake build' or 'rake install'.
|
6
|
-
##########################################################################
|
7
|
-
require 'mkmf'
|
8
|
-
|
9
|
-
have_func('strncpy_s')
|
10
|
-
create_makefile('win32/api', 'win32')
|