win32-api 1.4.5 → 1.4.6

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