win32-api 1.4.5-x86-mswin32-60 → 1.4.6-x86-mswin32-60
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +132 -125
- data/MANIFEST +9 -9
- data/README +101 -103
- data/Rakefile +105 -120
- data/ext/win32/api.c +946 -948
- data/lib/win32/api.so +0 -0
- data/test/test_win32_api.rb +140 -140
- data/test/test_win32_api_callback.rb +74 -74
- data/test/test_win32_api_function.rb +66 -66
- data/win32-api.gemspec +29 -31
- metadata +16 -8
- data/ext/extconf.rb +0 -11
data/CHANGES
CHANGED
@@ -1,125 +1,132 @@
|
|
1
|
-
== 1.4.
|
2
|
-
*
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
*
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
*
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
*
|
43
|
-
to
|
44
|
-
|
45
|
-
|
46
|
-
*
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
*
|
53
|
-
|
54
|
-
|
55
|
-
*
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
*
|
60
|
-
|
61
|
-
|
62
|
-
*
|
63
|
-
|
64
|
-
*
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
* Added
|
70
|
-
*
|
71
|
-
|
72
|
-
|
73
|
-
== 1.2.
|
74
|
-
*
|
75
|
-
|
76
|
-
*
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
*
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
*
|
91
|
-
|
92
|
-
*
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
*
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
*
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
*
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
*
|
117
|
-
|
118
|
-
== 1.0.
|
119
|
-
*
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
1
|
+
== 1.4.6 - 9-Feb-2010
|
2
|
+
* Fixed a warning that showed up with MinGW/gcc caused by an unnecessary
|
3
|
+
pointer dereference.
|
4
|
+
* Some updates to the Rakefile and gemspec. Gem building is now handled via
|
5
|
+
Rake tasks.
|
6
|
+
* Minor updates to the test suite.
|
7
|
+
|
8
|
+
== 1.4.5 - 24-Aug-2009
|
9
|
+
* Reverted the change in 1.4.4. We need unsigned longs in a few cases.
|
10
|
+
Consequently, you should upgrade windows-pr to 1.0.8 or later because
|
11
|
+
some return values were set to -1 instead of 0xFFFFFFFF as they are now.
|
12
|
+
* Updated one test to validate return value from failed function.
|
13
|
+
|
14
|
+
== 1.4.4 - 18-Aug-2009
|
15
|
+
* Fixed a bug where functions that returned a long return type were unsigned
|
16
|
+
instead of signed.
|
17
|
+
* The Rakefile has been refactored somewhat, including the removal of FFI
|
18
|
+
related tasks. Those are now in a separate branch in the repository.
|
19
|
+
* The test-unit library is now a development dependency instead of a runtime
|
20
|
+
dependency.
|
21
|
+
|
22
|
+
== 1.4.3 - 23-Jun-2009
|
23
|
+
* Bug fix for mingw.
|
24
|
+
* License now set to Artistic 2.0.
|
25
|
+
|
26
|
+
== 1.4.2 - 31-May-2009
|
27
|
+
* Updated the internal StringError() function to better handle the possibility
|
28
|
+
of the English .mui file not being found. Thanks go to Michel Demazure for
|
29
|
+
the spot.
|
30
|
+
|
31
|
+
== 1.4.1 - 29-May-2009
|
32
|
+
* Callback handling improvements.
|
33
|
+
* Updated the gemspec description.
|
34
|
+
|
35
|
+
== 1.4.0 - 19-Feb-2009
|
36
|
+
* Now compatible with Ruby 1.9.x.
|
37
|
+
* In what will go down as, "It seemed like a good idea at the time", I have
|
38
|
+
removed the feature where W (wide) character functions were used first if
|
39
|
+
your $KCODE environment variable was set to "UTF8". It caused too many
|
40
|
+
headaches in practice, especially amongst Rails users. You must now always
|
41
|
+
explicitly specify 'W' in the constructor if that's what you want.
|
42
|
+
* Fixed RF bug #23944 - bad error message for MSVCRT functions that failed
|
43
|
+
to load properly.
|
44
|
+
|
45
|
+
== 1.3.0 - 1-Jan-2009
|
46
|
+
* Fixed RubyForge bug #23395, which was caused by inadvertently modifying
|
47
|
+
a variable within a loop. This caused callbacks to fail in certain
|
48
|
+
situations.
|
49
|
+
* Added the Win32::API::LoadLibraryError and Win32::API::PrototypeError classes
|
50
|
+
to provide more fine grained handling of possible error conditions in the
|
51
|
+
constructor. These are both subclasses of Win32::API::Error.
|
52
|
+
* Removed the Win32::API::CallbackError class.
|
53
|
+
* Changed the upper limit on prototypes from 16 to 20. It turns out that
|
54
|
+
there are actually Windows functions with more than 16 prototypes.
|
55
|
+
* Refactored a high iteration test so that it counts as only one test
|
56
|
+
instead of 1000.
|
57
|
+
|
58
|
+
== 1.2.2 - 27-Nov-2008
|
59
|
+
* Fixed bug in the error message for illegal prototypes and illegal return
|
60
|
+
types where the character in question would come out as empty or garbage.
|
61
|
+
* Passing a bad return type to Win32::API::Callback now raises an error.
|
62
|
+
* Updated the error message for illegal return types to say, "Illegal return
|
63
|
+
type" instead of "Illegal prototype" as it did previously.
|
64
|
+
* The error message for a bad function name passed to Win32::API.new now
|
65
|
+
matches JRuby's FFI error message.
|
66
|
+
* Improved the handling of msvcrt functions with regards to skipping 'A'
|
67
|
+
and 'W' checks. Previously it was checking against the literal string
|
68
|
+
'msvcrt'. Now it checks against any string that starts with 'msvcr'.
|
69
|
+
* Added test-unit 2.x as a prerequisite.
|
70
|
+
* Added tests for the Win32::API::Callback#address method.
|
71
|
+
* Added tests to all Win32::API classes that explicitly check error messages.
|
72
|
+
|
73
|
+
== 1.2.1 - 14-Nov-2008
|
74
|
+
* Fixed and updated callback handling.
|
75
|
+
* Fixed wide string return handling for pointers and strings.
|
76
|
+
* Added the Win32::API::Callback#address instance method.
|
77
|
+
* All errors are now in English instead of your native language, because
|
78
|
+
that's what Ruby itself does.
|
79
|
+
|
80
|
+
== 1.2.0 - 22-Jul-2008
|
81
|
+
* Added support for the 'S' (string) prototype and return type. It can be
|
82
|
+
used instead of 'P' (pointer) for const char*.
|
83
|
+
* Some internal refactoring. The attempts to load ANSI and/or Wide character
|
84
|
+
versions of functions are skipped for MSVCRT functions, since they do not
|
85
|
+
exist. This eliminates some unnecessary LoadLibrary() calls.
|
86
|
+
* Added a couple of gem building Rake tasks.
|
87
|
+
* Added a few more tests.
|
88
|
+
|
89
|
+
== 1.1.0 - 12-Jun-2008
|
90
|
+
* Added the Windows::API::Function class. This is a subclass of Win32::API
|
91
|
+
meant only for use with raw function pointers.
|
92
|
+
* Some documentation updates in the source and README files.
|
93
|
+
|
94
|
+
== 1.0.6 - 18-Apr-2008
|
95
|
+
* Added the effective_function_name method. This allows you to see what the
|
96
|
+
actual function name is that was defined, e.g. GetUserNameA vs GetUserNameW.
|
97
|
+
* Replaced an instance of _tcscmp with strcmp. The case in question was always
|
98
|
+
going to be ASCII.
|
99
|
+
* Cleaned up some -W3 warnings.
|
100
|
+
* Added the build_manifest task to the Rakefile, which is automatically run if
|
101
|
+
you're using a version of Ruby built with VC++ 8 or later. This builds a
|
102
|
+
ruby.exe.manifest file (if it doesn't already exist).
|
103
|
+
|
104
|
+
== 1.0.5 - 20-Nov-2007
|
105
|
+
* The API.new method now defaults to "W" (wide character functions) before "A"
|
106
|
+
(ANSI functions) if the $KCODE global variable is set to 'u' (UTF8).
|
107
|
+
* Minor improvements to the Rakefile.
|
108
|
+
|
109
|
+
== 1.0.4 - 26-Oct-2007
|
110
|
+
* Fixed a bug where methods that returned pointers ('P') could choke if the
|
111
|
+
resulting pointer was 0 or NULL. In this case, nil is now returned instead.
|
112
|
+
* Tweak to the extconf.rb file that helps the gem build it from source
|
113
|
+
properly.
|
114
|
+
|
115
|
+
== 1.0.3 - 28-Sep-2007
|
116
|
+
* Fixed a subtle but dangerous copy-on-write bug in the API#call method.
|
117
|
+
|
118
|
+
== 1.0.2 - 28-Sep-2007
|
119
|
+
* Fixed a bug in an internal struct member that was causing segfaults. Thanks
|
120
|
+
go to Lars Olsson for the spot.
|
121
|
+
* Fixed the 'install' task in the Rakefile. This only affected native builds,
|
122
|
+
not the prebuilt binary.
|
123
|
+
* Added a few more tests.
|
124
|
+
|
125
|
+
== 1.0.1 - 27-Sep-2007
|
126
|
+
* Functions declared with a void prototype no longer require an explicit nil
|
127
|
+
argument to fulfill the arity requirement. You can still call them with an
|
128
|
+
explicit nil if you wish, however.
|
129
|
+
* Fixed the gemspec for the native build.
|
130
|
+
|
131
|
+
== 1.0.0 - 14-Sep-2007
|
132
|
+
* Initial release
|
data/MANIFEST
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
* CHANGES
|
2
|
-
* MANIFEST
|
3
|
-
* README
|
4
|
-
* Rakefile
|
5
|
-
* win32-api.gemspec
|
6
|
-
* ext/extconf.rb
|
7
|
-
* ext/win32/api.c
|
8
|
-
* test/test_win32_api.rb
|
9
|
-
* test/test_win32_api_callback.rb
|
1
|
+
* CHANGES
|
2
|
+
* MANIFEST
|
3
|
+
* README
|
4
|
+
* Rakefile
|
5
|
+
* win32-api.gemspec
|
6
|
+
* ext/extconf.rb
|
7
|
+
* ext/win32/api.c
|
8
|
+
* test/test_win32_api.rb
|
9
|
+
* test/test_win32_api_callback.rb
|
10
10
|
* test/test_win32_api_function.rb
|
data/README
CHANGED
@@ -1,103 +1,101 @@
|
|
1
|
-
= Description
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
= Synopsis
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
= Differences between win32-api and Win32API
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
Daniel J. Berger
|
103
|
-
Park Heesob
|
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
|
+
# Typical example - Get user name
|
10
|
+
buf = 0.chr * 260
|
11
|
+
len = [buf.length].pack('L')
|
12
|
+
|
13
|
+
GetUserName = API.new('GetUserName', 'PP', 'I', 'advapi32')
|
14
|
+
GetUserName.call(buf, len)
|
15
|
+
|
16
|
+
puts buf.strip
|
17
|
+
|
18
|
+
# Callback example - Enumerate windows
|
19
|
+
EnumWindows = API.new('EnumWindows', 'KP', 'L', 'user32')
|
20
|
+
GetWindowText = API.new('GetWindowText', 'LPI', 'I', 'user32')
|
21
|
+
EnumWindowsProc = API::Callback.new('LP', 'I'){ |handle, param|
|
22
|
+
buf = "\0" * 200
|
23
|
+
GetWindowText.call(handle, buf, 200);
|
24
|
+
puts buf.strip unless buf.strip.empty?
|
25
|
+
buf.index(param).nil? ? true : false
|
26
|
+
}
|
27
|
+
|
28
|
+
EnumWindows.call(EnumWindowsProc, 'UEDIT32')
|
29
|
+
|
30
|
+
# Raw function pointer example - System beep
|
31
|
+
LoadLibrary = API.new('LoadLibrary', 'P', 'L')
|
32
|
+
GetProcAddress = API.new('GetProcAddress', 'LP', 'L')
|
33
|
+
|
34
|
+
hlib = LoadLibrary.call('user32')
|
35
|
+
addr = GetProcAddress.call(hlib, 'MessageBeep')
|
36
|
+
func = Win32::API::Function.new(addr, 'L', 'L')
|
37
|
+
func.call(0)
|
38
|
+
|
39
|
+
= Differences between win32-api and Win32API
|
40
|
+
* This library has callback support
|
41
|
+
* This library supports raw function pointers.
|
42
|
+
* This library supports a separate string type for const char* (S).
|
43
|
+
* Argument order change. The DLL name is now last, not first.
|
44
|
+
* Removed the 'N' and 'n' prototypes. Always use 'L' for longs now.
|
45
|
+
* Sensible default arguments for the prototype, return type and DLL name.
|
46
|
+
* Reader methods for the function name, effective function name, prototype,
|
47
|
+
return type and DLL.
|
48
|
+
* Removed the support for lower case prototype and return types. Always
|
49
|
+
use capital letters.
|
50
|
+
|
51
|
+
= Developer's Notes
|
52
|
+
The current Win32API library that ships with the standard library has been
|
53
|
+
slated for removal from Ruby 2.0 and it will not receive any updates in the
|
54
|
+
Ruby 1.8.x branch. I have far too many libraries invested in it to let it
|
55
|
+
die at this point.
|
56
|
+
|
57
|
+
In addition, the current Win32API library was written in the bad old Ruby
|
58
|
+
1.6.x days, which means it doesn't use the newer allocation framework.
|
59
|
+
There were several other refactorings that I felt it needed to more closely
|
60
|
+
match how it was actually being used in practice.
|
61
|
+
|
62
|
+
The first order of business was changing the order of the arguments. By
|
63
|
+
moving the DLL name from first to last, I was able to provide reasonable
|
64
|
+
default arguments for the prototype, return type and the DLL. Only the
|
65
|
+
function name is required now.
|
66
|
+
|
67
|
+
There was a laundry list of other refactorings that were needed: sensical
|
68
|
+
instance variable names with proper accessors, removing support for lower
|
69
|
+
case prototype and return value characters that no one used in practice,
|
70
|
+
better naming conventions, the addition of RDoc ready comments and,
|
71
|
+
especially, callback and raw function pointer support.
|
72
|
+
|
73
|
+
Most importantly, we can now add, modify and fix any features that we feel
|
74
|
+
best benefit our end users.
|
75
|
+
|
76
|
+
= Documentation
|
77
|
+
The source file contains inline RDoc documentation. If you installed
|
78
|
+
this file as a gem, then you have the docs. Run "gem server" and point
|
79
|
+
your browser at http://localhost:8808 to see them.
|
80
|
+
|
81
|
+
= Warranty
|
82
|
+
This package is provided "as is" and without any express or
|
83
|
+
implied warranties, including, without limitation, the implied
|
84
|
+
warranties of merchantability and fitness for a particular purpose.
|
85
|
+
|
86
|
+
= Known Issues
|
87
|
+
Possible callback issues when dealing with multi-threaded applications.
|
88
|
+
|
89
|
+
Please submit any bug reports to the project page at
|
90
|
+
http://www.rubyforge.org/projects/win32utils.
|
91
|
+
|
92
|
+
= Copyright
|
93
|
+
(C) 2003-2010 Daniel J. Berger
|
94
|
+
All Rights Reserved
|
95
|
+
|
96
|
+
= License
|
97
|
+
Artistic 2.0
|
98
|
+
|
99
|
+
= Authors
|
100
|
+
Daniel J. Berger
|
101
|
+
Park Heesob
|