win32-api 1.4.3 → 1.4.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,17 +1,25 @@
1
- = 1.4.3 - 23-Jun-2009
1
+ == 1.4.4 - 18-Aug-2009
2
+ * Fixed a bug where functions that returned a long return type were unsigned
3
+ instead of signed.
4
+ * The Rakefile has been refactored somewhat, including the removal of FFI
5
+ related tasks. Those are now in a separate branch in the repository.
6
+ * The test-unit library is now a development dependency instead of a runtime
7
+ dependency.
8
+
9
+ == 1.4.3 - 23-Jun-2009
2
10
  * Bug fix for mingw.
3
11
  * License now set to Artistic 2.0.
4
12
 
5
- = 1.4.2 - 31-May-2009
13
+ == 1.4.2 - 31-May-2009
6
14
  * Updated the internal StringError() function to better handle the possibility
7
15
  of the English .mui file not being found. Thanks go to Michel Demazure for
8
16
  the spot.
9
17
 
10
- = 1.4.1 - 29-May-2009
18
+ == 1.4.1 - 29-May-2009
11
19
  * Callback handling improvements.
12
20
  * Updated the gemspec description.
13
21
 
14
- = 1.4.0 - 19-Feb-2009
22
+ == 1.4.0 - 19-Feb-2009
15
23
  * Now compatible with Ruby 1.9.x.
16
24
  * In what will go down as, "It seemed like a good idea at the time", I have
17
25
  removed the feature where W (wide) character functions were used first if
@@ -21,7 +29,7 @@
21
29
  * Fixed RF bug #23944 - bad error message for MSVCRT functions that failed
22
30
  to load properly.
23
31
 
24
- = 1.3.0 - 1-Jan-2009
32
+ == 1.3.0 - 1-Jan-2009
25
33
  * Fixed RubyForge bug #23395, which was caused by inadvertently modifying
26
34
  a variable within a loop. This caused callbacks to fail in certain
27
35
  situations.
@@ -34,7 +42,7 @@
34
42
  * Refactored a high iteration test so that it counts as only one test
35
43
  instead of 1000.
36
44
 
37
- = 1.2.2 - 27-Nov-2008
45
+ == 1.2.2 - 27-Nov-2008
38
46
  * Fixed bug in the error message for illegal prototypes and illegal return
39
47
  types where the character in question would come out as empty or garbage.
40
48
  * Passing a bad return type to Win32::API::Callback now raises an error.
@@ -49,14 +57,14 @@
49
57
  * Added tests for the Win32::API::Callback#address method.
50
58
  * Added tests to all Win32::API classes that explicitly check error messages.
51
59
 
52
- = 1.2.1 - 14-Nov-2008
60
+ == 1.2.1 - 14-Nov-2008
53
61
  * Fixed and updated callback handling.
54
62
  * Fixed wide string return handling for pointers and strings.
55
63
  * Added the Win32::API::Callback#address instance method.
56
64
  * All errors are now in English instead of your native language, because
57
65
  that's what Ruby itself does.
58
66
 
59
- = 1.2.0 - 22-Jul-2008
67
+ == 1.2.0 - 22-Jul-2008
60
68
  * Added support for the 'S' (string) prototype and return type. It can be
61
69
  used instead of 'P' (pointer) for const char*.
62
70
  * Some internal refactoring. The attempts to load ANSI and/or Wide character
@@ -65,12 +73,12 @@
65
73
  * Added a couple of gem building Rake tasks.
66
74
  * Added a few more tests.
67
75
 
68
- = 1.1.0 - 12-Jun-2008
76
+ == 1.1.0 - 12-Jun-2008
69
77
  * Added the Windows::API::Function class. This is a subclass of Win32::API
70
78
  meant only for use with raw function pointers.
71
79
  * Some documentation updates in the source and README files.
72
80
 
73
- = 1.0.6 - 18-Apr-2008
81
+ == 1.0.6 - 18-Apr-2008
74
82
  * Added the effective_function_name method. This allows you to see what the
75
83
  actual function name is that was defined, e.g. GetUserNameA vs GetUserNameW.
76
84
  * Replaced an instance of _tcscmp with strcmp. The case in question was always
@@ -80,32 +88,32 @@
80
88
  you're using a version of Ruby built with VC++ 8 or later. This builds a
81
89
  ruby.exe.manifest file (if it doesn't already exist).
82
90
 
83
- = 1.0.5 - 20-Nov-2007
91
+ == 1.0.5 - 20-Nov-2007
84
92
  * The API.new method now defaults to "W" (wide character functions) before "A"
85
93
  (ANSI functions) if the $KCODE global variable is set to 'u' (UTF8).
86
94
  * Minor improvements to the Rakefile.
87
95
 
88
- = 1.0.4 - 26-Oct-2007
96
+ == 1.0.4 - 26-Oct-2007
89
97
  * Fixed a bug where methods that returned pointers ('P') could choke if the
90
98
  resulting pointer was 0 or NULL. In this case, nil is now returned instead.
91
99
  * Tweak to the extconf.rb file that helps the gem build it from source
92
100
  properly.
93
101
 
94
- = 1.0.3 - 28-Sep-2007
102
+ == 1.0.3 - 28-Sep-2007
95
103
  * Fixed a subtle but dangerous copy-on-write bug in the API#call method.
96
104
 
97
- = 1.0.2 - 28-Sep-2007
105
+ == 1.0.2 - 28-Sep-2007
98
106
  * Fixed a bug in an internal struct member that was causing segfaults. Thanks
99
107
  go to Lars Olsson for the spot.
100
108
  * Fixed the 'install' task in the Rakefile. This only affected native builds,
101
109
  not the prebuilt binary.
102
110
  * Added a few more tests.
103
111
 
104
- = 1.0.1 - 27-Sep-2007
112
+ == 1.0.1 - 27-Sep-2007
105
113
  * Functions declared with a void prototype no longer require an explicit nil
106
114
  argument to fulfill the arity requirement. You can still call them with an
107
115
  explicit nil if you wish, however.
108
116
  * Fixed the gemspec for the native build.
109
117
 
110
- = 1.0.0 - 14-Sep-2007
118
+ == 1.0.0 - 14-Sep-2007
111
119
  * Initial release
data/README CHANGED
@@ -96,7 +96,7 @@
96
96
  All Rights Reserved
97
97
 
98
98
  = License
99
- Ruby's
99
+ Artistic 2.0
100
100
 
101
101
  = Authors
102
102
  Daniel J. Berger
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ end
20
20
  desc 'Install the win32-api library (non-gem)'
21
21
  task :install => [:build] do
22
22
  Dir.chdir('ext'){
23
- sh "nmake install"
23
+ sh 'nmake install'
24
24
  }
25
25
  end
26
26
 
@@ -30,17 +30,20 @@ task :install_gem do
30
30
  sh "gem install #{file}"
31
31
  end
32
32
 
33
- desc "Clean any build files for Win32::API"
33
+ desc 'Clean any build files for Win32::API'
34
34
  task :clean do
35
35
  Dir.chdir('ext') do
36
- if File.exists?("api.so") || File.exists?("win32/api.so") ||
37
- File.exists?("api.obj")
36
+ if File.exists?('api.so') || File.exists?('win32/api.so') ||
37
+ File.exists?('api.obj')
38
38
  then
39
- sh "nmake distclean"
40
- rm "win32/api.so" if File.exists?("win32/api.so")
41
- rm "api.so" if File.exists?("api.so")
39
+ sh 'nmake distclean'
40
+ rm 'win32/api.so' if File.exists?('win32/api.so')
41
+ rm 'api.so' if File.exists?('api.so')
42
42
  end
43
43
  end
44
+
45
+ # Cleanup any files generated by the build_binary_gem task
46
+ rm_rf('lib') if File.exists?('lib')
44
47
  end
45
48
 
46
49
  desc "Build Win32::API (but don't install it)"
@@ -52,66 +55,47 @@ task :build => [:clean, :build_manifest] do
52
55
  end
53
56
  end
54
57
 
55
- desc "Build a standard gem"
58
+ desc 'Build a standard gem'
56
59
  task :build_gem => [:clean] do
57
- spec = Gem::Specification.new do |gem|
58
- gem.name = "win32-api"
59
- gem.version = "1.4.3"
60
- gem.authors = ["Daniel J. Berger", "Park Heesob"]
61
- gem.email = "djberg96@gmail.com"
62
- gem.homepage = "http://www.rubyforge.org/projects/win32utils"
63
- gem.rubyforge_project = "win32utils"
64
- gem.platform = Gem::Platform::RUBY
65
- gem.summary = "A superior replacement for Win32API"
66
- gem.has_rdoc = true
67
- gem.test_files = Dir['test/test*']
68
- gem.extensions = ['ext/extconf.rb']
69
- gem.license = 'Artistic 2.0'
70
- files = Dir["ext/win32/api.c"] + Dir["test/*"]
71
- files.delete_if{ |f| f.include?('CVS') }
72
- gem.files = files
73
- gem.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST', 'ext/win32/api.c']
74
- gem.rubyforge_project = 'win32utils'
75
- gem.required_ruby_version = '>= 1.8.2'
76
-
77
- gem.description = <<-EOF
78
- The Win32::API library is meant as a replacement for the Win32API
79
- library that ships as part of the standard library. It contains several
80
- advantages over Win32API, including callback support, raw function
81
- pointers, an additional string type, and more.
82
- EOF
83
- end
84
-
85
- Gem::Builder.new(spec).build
60
+ eval(IO.read('win32-api.gemspec'))
86
61
  end
87
62
 
88
- desc "Build a binary gem"
63
+ desc 'Build a binary gem'
89
64
  task :build_binary_gem => [:build] do
90
65
  mkdir_p 'lib/win32'
91
66
  mv 'ext/win32/api.so', 'lib/win32'
92
- rm_rf 'lib/ffi'
93
- rm_rf 'lib/jruby'
94
67
 
95
68
  task :build_binary_gem => [:clean]
96
69
 
97
70
  spec = Gem::Specification.new do |gem|
98
- gem.name = "win32-api"
99
- gem.version = "1.4.3"
100
- gem.authors = ["Daniel J. Berger", "Park Heesob"]
101
- gem.email = "djberg96@gmail.com"
102
- gem.homepage = "http://www.rubyforge.org/projects/win32utils"
103
- gem.rubyforge_project = "win32utils"
104
- gem.platform = Gem::Platform::CURRENT
105
- gem.summary = "A superior replacement for Win32API"
106
- gem.has_rdoc = true
107
- gem.test_files = Dir['test/test*']
108
- gem.license = 'Artistic 2.0'
109
- files = Dir["lib/win32/api.so"] + Dir["test/*"]
110
- files.delete_if{ |f| f.include?('CVS') }
111
- gem.files = files
112
- gem.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST', 'ext/win32/api.c']
71
+ gem.name = 'win32-api'
72
+ gem.version = '1.4.4'
73
+ gem.authors = ['Daniel J. Berger', 'Park Heesob']
74
+ gem.license = 'Artistic 2.0'
75
+ gem.email = 'djberg96@gmail.com'
76
+ gem.homepage = 'http://www.rubyforge.org/projects/win32utils'
77
+ gem.platform = Gem::Platform::CURRENT
78
+ gem.summary = 'A superior replacement for Win32API'
79
+ gem.has_rdoc = true
80
+ gem.test_files = Dir['test/test*']
81
+
82
+ gem.files = [
83
+ Dir['*'],
84
+ Dir['test/*'],
85
+ 'ext/extconf.rb',
86
+ 'ext/win32/api.c',
87
+ 'lib/win32/api.so'
88
+ ].flatten.reject{ |f| f.include?('CVS') }
89
+
113
90
  gem.rubyforge_project = 'win32utils'
114
91
  gem.required_ruby_version = '>= 1.8.2'
92
+
93
+ gem.extra_rdoc_files = [
94
+ 'README',
95
+ 'CHANGES',
96
+ 'MANIFEST',
97
+ 'ext/win32/api.c'
98
+ ]
115
99
 
116
100
  gem.description = <<-EOF
117
101
  The Win32::API library is meant as a replacement for the Win32API
@@ -124,23 +108,13 @@ task :build_binary_gem => [:build] do
124
108
  Gem::Builder.new(spec).build
125
109
  end
126
110
 
127
- Rake::TestTask.new('test') do |test|
128
- if RUBY_PLATFORM.match('java')
129
- test.libs << 'lib/ffi'
130
- test.test_files = Dir['test/test_win32_api.rb']
131
- else
132
- task :test => [:build]
133
- test.libs << 'ext'
134
- test.libs.delete('lib')
135
- end
136
-
111
+ Rake::TestTask.new(:test) do |test|
112
+ task :test => [:build]
113
+ test.libs << 'ext'
137
114
  test.warning = true
138
115
  test.verbose = true
139
116
  end
140
117
 
141
118
  task :test do
142
- Rake.application[:clean].execute
143
-
144
- Rake::TestTask.new('test_jruby') do |test|
145
- test.warning = true
119
+ Rake.application[:clean].execute
146
120
  end
@@ -17,7 +17,7 @@
17
17
  #endif
18
18
 
19
19
  #define MAX_BUF 1024
20
- #define WINDOWS_API_VERSION "1.4.3"
20
+ #define WINDOWS_API_VERSION "1.4.4"
21
21
 
22
22
  #define _T_VOID 0
23
23
  #define _T_LONG 1
@@ -740,7 +740,7 @@ void *find_callback(VALUE obj,int len)
740
740
  static VALUE api_call(int argc, VALUE* argv, VALUE self){
741
741
  VALUE v_proto, v_args, v_arg, v_return;
742
742
  Win32API* ptr;
743
- unsigned long return_value;
743
+ long return_value;
744
744
  int i = 0;
745
745
  int len;
746
746
 
@@ -823,7 +823,7 @@ static VALUE api_call(int argc, VALUE* argv, VALUE self){
823
823
  v_return = INT2NUM(return_value);
824
824
  break;
825
825
  case _T_LONG:
826
- v_return = ULONG2NUM(return_value);
826
+ v_return = LONG2NUM(return_value);
827
827
  break;
828
828
  case _T_VOID:
829
829
  v_return = Qnil;
@@ -943,6 +943,6 @@ void Init_api(){
943
943
 
944
944
  /* Constants */
945
945
 
946
- /* 1.4.3: The version of this library, returned as a String */
946
+ /* 1.4.4: The version of the win32-api library */
947
947
  rb_define_const(cAPI, "VERSION", rb_str_new2(WINDOWS_API_VERSION));
948
948
  }
@@ -14,13 +14,14 @@ include Win32
14
14
  class TC_Win32_API < Test::Unit::TestCase
15
15
  def setup
16
16
  @buf = 0.chr * 260
17
+ @gfa = API.new('GetFileAttributes', 'S', 'L')
17
18
  @gcd = API.new('GetCurrentDirectory', 'LP')
18
19
  @gle = API.new('GetLastError', 'V', 'L')
19
20
  @str = API.new('strstr', 'PP', 'P', 'msvcrt')
20
21
  end
21
22
 
22
23
  def test_version
23
- assert_equal('1.4.3', API::VERSION)
24
+ assert_equal('1.4.4', API::VERSION)
24
25
  end
25
26
 
26
27
  def test_constructor_basic
@@ -40,6 +41,10 @@ class TC_Win32_API < Test::Unit::TestCase
40
41
  assert_nothing_raised{ @gle.call }
41
42
  assert_nothing_raised{ @gle.call(nil) }
42
43
  end
44
+
45
+ def test_call_returns_negative_value_on_failure
46
+ assert_equal(-1, @gfa.call('C:/foobarbazblah'))
47
+ end
43
48
 
44
49
  def test_dll_name
45
50
  assert_respond_to(@gcd, :dll_name)
@@ -1,24 +1,24 @@
1
- require "rubygems"
1
+ require 'rubygems'
2
2
 
3
3
  spec = Gem::Specification.new do |gem|
4
- gem.name = 'win32-api'
5
- gem.version = '1.4.3'
6
- gem.authors = ['Daniel J. Berger', 'Park Heesob']
7
- gem.email = 'djberg96@gmail.com'
8
- gem.homepage = 'http://www.rubyforge.org/projects/win32utils'
9
- gem.platform = Gem::Platform::RUBY
10
- gem.summary = 'A superior replacement for Win32API'
11
- gem.has_rdoc = true
12
- gem.test_files = Dir['test/test*']
13
- gem.extensions = ['ext/extconf.rb']
14
- gem.files = Dir['**/*'].delete_if{ |f| f.include?('CVS') || f.include?('lib') }
15
- gem.license = 'Artistic 2.0'
4
+ gem.name = 'win32-api'
5
+ gem.version = '1.4.4'
6
+ gem.authors = ['Daniel J. Berger', 'Park Heesob']
7
+ gem.license = 'Artistic 2.0'
8
+ gem.email = 'djberg96@gmail.com'
9
+ gem.homepage = 'http://www.rubyforge.org/projects/win32utils'
10
+ gem.platform = Gem::Platform::RUBY
11
+ gem.summary = 'A superior replacement for Win32API'
12
+ gem.has_rdoc = true
13
+ gem.test_files = Dir['test/test*']
14
+ gem.extensions = ['ext/extconf.rb']
15
+ gem.files = Dir['**/*'].reject{ |f| f.include?('CVS') || f.include?('lib') }
16
16
 
17
- gem.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST', 'ext/win32/api.c']
18
17
  gem.rubyforge_project = 'win32utils'
19
18
  gem.required_ruby_version = '>= 1.8.2'
19
+ gem.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST', 'ext/win32/api.c']
20
20
 
21
- gem.add_dependency('test-unit', '>= 2.0.2')
21
+ gem.add_development_dependency('test-unit', '>= 2.0.2')
22
22
 
23
23
  gem.description = <<-EOF
24
24
  The Win32::API library is meant as a replacement for the Win32API
@@ -28,6 +28,4 @@ spec = Gem::Specification.new do |gem|
28
28
  EOF
29
29
  end
30
30
 
31
- if $0 == __FILE__
32
- Gem::Builder.new(spec).build
33
- end
31
+ Gem::Builder.new(spec).build
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.3
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
@@ -10,12 +10,12 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-06-23 00:00:00 -06:00
13
+ date: 2009-08-18 00:00:00 -06:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: test-unit
18
- type: :runtime
18
+ type: :development
19
19
  version_requirement:
20
20
  version_requirements: !ruby/object:Gem::Requirement
21
21
  requirements:
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  requirements: []
70
70
 
71
71
  rubyforge_project: win32utils
72
- rubygems_version: 1.3.4
72
+ rubygems_version: 1.3.5
73
73
  signing_key:
74
74
  specification_version: 3
75
75
  summary: A superior replacement for Win32API