win32-api 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +23 -17
- data/MANIFEST +9 -9
- data/README +71 -71
- data/ext/win32/api.c +5 -2
- data/test/tc_win32_api.rb +1 -1
- metadata +6 -13
data/CHANGES
CHANGED
@@ -1,18 +1,24 @@
|
|
1
|
-
= 1.0.
|
2
|
-
* Fixed a
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
*
|
16
|
-
|
17
|
-
= 1.0.
|
1
|
+
= 1.0.4 - 26-Oct-2007
|
2
|
+
* Fixed a bug where methods that returned pointers ('P') could choke if the
|
3
|
+
resulting pointer was 0 or NULL. In this case, nil is now returned instead.
|
4
|
+
* Tweak to the extconf.rb file that helps the gem build it from source
|
5
|
+
properly.
|
6
|
+
|
7
|
+
= 1.0.3 - 28-Sep-2007
|
8
|
+
* Fixed a subtle but dangerous copy-on-write bug in the API#call method.
|
9
|
+
|
10
|
+
= 1.0.2 - 28-Sep-2007
|
11
|
+
* Fixed a bug in an internal struct member that was causing segfaults. Thanks
|
12
|
+
go to Lars Olsson for the spot.
|
13
|
+
* Fixed the 'install' task in the Rakefile. This only affected native builds,
|
14
|
+
not the prebuilt binary.
|
15
|
+
* Added a few more tests.
|
16
|
+
|
17
|
+
= 1.0.1 - 27-Sep-2007
|
18
|
+
* Functions declared with a void prototype no longer require an explicit nil
|
19
|
+
argument to fulfill the arity requirement. You can still call them with an
|
20
|
+
explicit nil if you wish, however.
|
21
|
+
* Fixed the gemspec for the native build.
|
22
|
+
|
23
|
+
= 1.0.0 - 14-Sep-2007
|
18
24
|
* Initial release
|
data/MANIFEST
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
CHANGES
|
2
|
-
MANIFEST
|
3
|
-
README
|
4
|
-
Rakefile
|
5
|
-
win32-api.gemspec
|
6
|
-
ext/extconf.rb
|
7
|
-
ext/win32/api.c
|
8
|
-
test/tc_win32_api_callback.rb
|
9
|
-
test/tc_win32_api.rb
|
1
|
+
* CHANGES
|
2
|
+
* MANIFEST
|
3
|
+
* README
|
4
|
+
* Rakefile
|
5
|
+
* win32-api.gemspec
|
6
|
+
* ext/extconf.rb
|
7
|
+
* ext/win32/api.c
|
8
|
+
* test/tc_win32_api_callback.rb
|
9
|
+
* test/tc_win32_api.rb
|
data/README
CHANGED
@@ -1,72 +1,72 @@
|
|
1
|
-
= Description
|
2
|
-
This is a drop-in replacement for the Win32API library currently part of
|
3
|
-
Ruby's standard library.
|
4
|
-
|
5
|
-
= Synopsis
|
6
|
-
require 'win32/api'
|
7
|
-
include Win32
|
8
|
-
|
9
|
-
buf = 0.chr * 260
|
10
|
-
len = [@buf.length].pack('L')
|
11
|
-
|
12
|
-
GetUserName = API.new('GetUserName', 'PP', 'I', 'advapi32')
|
13
|
-
GetUserName.call(buf, len)
|
14
|
-
|
15
|
-
puts buf.strip
|
16
|
-
|
17
|
-
= Differences between win32-api and Win32API
|
18
|
-
* Argument order change. The DLL name is now last, not first.
|
19
|
-
* Removed the 'N' and 'n'. Always use 'L' for longs now.
|
20
|
-
* Sensible default arguments for the prototype, return type and DLL name.
|
21
|
-
* Reader methods for the function name, prototype, return type and DLL.
|
22
|
-
* Removed the support for lower case prototype and return types. Always
|
23
|
-
use capital letters.
|
24
|
-
|
25
|
-
= Developer's Notes
|
26
|
-
The current Win32API library that ships with the standard library has been
|
27
|
-
slated for removal from Ruby 2.0 and it will not receive any updates in the
|
28
|
-
Ruby 1.8.x branch. I have far too many libraries invested in it to let it
|
29
|
-
die at this point.
|
30
|
-
|
31
|
-
In addition, the current Win32API library was written in the bad old Ruby
|
32
|
-
1.6.x days, which means it doesn't use the newer allocation framework.
|
33
|
-
There were several other refactorings that I felt it needed to more closely
|
34
|
-
match how it was actually being used in practice.
|
35
|
-
|
36
|
-
The first order of business was changing the order of the arguments. By
|
37
|
-
moving the DLL name from first to last, I was able to provide reasonable
|
38
|
-
default arguments for the prototype, return type and the DLL. Only the
|
39
|
-
function name is required now.
|
40
|
-
|
41
|
-
There was a laundry list of other refactorings that were needed: sensical
|
42
|
-
instance variable names with proper accessors, removing support for lower
|
43
|
-
case prototype and return value characters that no one used in practice,
|
44
|
-
better naming conventions, the addition of RDoc ready comments and,
|
45
|
-
especially, callback support.
|
46
|
-
|
47
|
-
Most importantly, we can now add, modify and fix any features that we feel
|
48
|
-
best benefit our end users.
|
49
|
-
|
50
|
-
= Documentation
|
51
|
-
The source file contains inline RDoc documentation. If you installed
|
52
|
-
this file as a gem, then you have the docs.
|
53
|
-
|
54
|
-
= Warranty
|
55
|
-
This package is provided "as is" and without any express or
|
56
|
-
implied warranties, including, without limitation, the implied
|
57
|
-
warranties of merchantability and fitness for a particular purpose.
|
58
|
-
|
59
|
-
= Known Bugs
|
60
|
-
None that I'm aware of. Please submit any bug reports to the project page
|
61
|
-
at http://www.rubyforge.org/projects/win32utils.
|
62
|
-
|
63
|
-
= Copyright
|
64
|
-
(C) 2003-2007 Daniel J. Berger
|
65
|
-
All Rights Reserved
|
66
|
-
|
67
|
-
= License
|
68
|
-
Ruby's
|
69
|
-
|
70
|
-
= Authors
|
71
|
-
Daniel J. Berger
|
1
|
+
= Description
|
2
|
+
This is a drop-in replacement for the Win32API library currently part of
|
3
|
+
Ruby's standard library.
|
4
|
+
|
5
|
+
= Synopsis
|
6
|
+
require 'win32/api'
|
7
|
+
include Win32
|
8
|
+
|
9
|
+
buf = 0.chr * 260
|
10
|
+
len = [@buf.length].pack('L')
|
11
|
+
|
12
|
+
GetUserName = API.new('GetUserName', 'PP', 'I', 'advapi32')
|
13
|
+
GetUserName.call(buf, len)
|
14
|
+
|
15
|
+
puts buf.strip
|
16
|
+
|
17
|
+
= Differences between win32-api and Win32API
|
18
|
+
* Argument order change. The DLL name is now last, not first.
|
19
|
+
* Removed the 'N' and 'n'. Always use 'L' for longs now.
|
20
|
+
* Sensible default arguments for the prototype, return type and DLL name.
|
21
|
+
* Reader methods for the function name, prototype, return type and DLL.
|
22
|
+
* Removed the support for lower case prototype and return types. Always
|
23
|
+
use capital letters.
|
24
|
+
|
25
|
+
= Developer's Notes
|
26
|
+
The current Win32API library that ships with the standard library has been
|
27
|
+
slated for removal from Ruby 2.0 and it will not receive any updates in the
|
28
|
+
Ruby 1.8.x branch. I have far too many libraries invested in it to let it
|
29
|
+
die at this point.
|
30
|
+
|
31
|
+
In addition, the current Win32API library was written in the bad old Ruby
|
32
|
+
1.6.x days, which means it doesn't use the newer allocation framework.
|
33
|
+
There were several other refactorings that I felt it needed to more closely
|
34
|
+
match how it was actually being used in practice.
|
35
|
+
|
36
|
+
The first order of business was changing the order of the arguments. By
|
37
|
+
moving the DLL name from first to last, I was able to provide reasonable
|
38
|
+
default arguments for the prototype, return type and the DLL. Only the
|
39
|
+
function name is required now.
|
40
|
+
|
41
|
+
There was a laundry list of other refactorings that were needed: sensical
|
42
|
+
instance variable names with proper accessors, removing support for lower
|
43
|
+
case prototype and return value characters that no one used in practice,
|
44
|
+
better naming conventions, the addition of RDoc ready comments and,
|
45
|
+
especially, callback support.
|
46
|
+
|
47
|
+
Most importantly, we can now add, modify and fix any features that we feel
|
48
|
+
best benefit our end users.
|
49
|
+
|
50
|
+
= Documentation
|
51
|
+
The source file contains inline RDoc documentation. If you installed
|
52
|
+
this file as a gem, then you have the docs.
|
53
|
+
|
54
|
+
= Warranty
|
55
|
+
This package is provided "as is" and without any express or
|
56
|
+
implied warranties, including, without limitation, the implied
|
57
|
+
warranties of merchantability and fitness for a particular purpose.
|
58
|
+
|
59
|
+
= Known Bugs
|
60
|
+
None that I'm aware of. Please submit any bug reports to the project page
|
61
|
+
at http://www.rubyforge.org/projects/win32utils.
|
62
|
+
|
63
|
+
= Copyright
|
64
|
+
(C) 2003-2007 Daniel J. Berger
|
65
|
+
All Rights Reserved
|
66
|
+
|
67
|
+
= License
|
68
|
+
Ruby's
|
69
|
+
|
70
|
+
= Authors
|
71
|
+
Daniel J. Berger
|
72
72
|
Park Heesob
|
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.4"
|
6
6
|
|
7
7
|
#define _T_VOID 0
|
8
8
|
#define _T_LONG 1
|
@@ -453,7 +453,10 @@ static VALUE api_call(int argc, VALUE* argv, VALUE self){
|
|
453
453
|
v_return = Qnil;
|
454
454
|
break;
|
455
455
|
case _T_POINTER:
|
456
|
-
|
456
|
+
if(!return_value)
|
457
|
+
v_return = Qnil;
|
458
|
+
else
|
459
|
+
v_return = rb_str_new2((TCHAR*)return_value);
|
457
460
|
break;
|
458
461
|
default:
|
459
462
|
v_return = INT2NUM(0);
|
data/test/tc_win32_api.rb
CHANGED
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.4
|
3
|
-
specification_version:
|
2
|
+
rubygems_version: 0.9.4
|
3
|
+
specification_version: 1
|
4
4
|
name: win32-api
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date: 2007-10-
|
6
|
+
version: 1.0.4
|
7
|
+
date: 2007-10-29 00:00:00 -07:00
|
8
8
|
summary: A superior replacement for Win32API
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -16,22 +16,15 @@ autorequire:
|
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|
18
18
|
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 1.8.0
|
24
24
|
version:
|
25
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
26
|
-
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: "0"
|
30
|
-
version:
|
31
25
|
platform: ruby
|
32
26
|
signing_key:
|
33
|
-
cert_chain:
|
34
|
-
|
27
|
+
cert_chain:
|
35
28
|
post_install_message:
|
36
29
|
authors:
|
37
30
|
- Daniel J. Berger
|