win32-api 1.4.3-x86-mswin32-60 → 1.4.4-x86-mswin32-60

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 ADDED
@@ -0,0 +1,120 @@
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rake/testtask'
4
+ require 'rbconfig'
5
+ include Config
6
+
7
+ desc 'Build the ruby.exe.manifest if it does not already exist'
8
+ task :build_manifest do
9
+ version = CONFIG['host_os'].split('_')[1]
10
+
11
+ if version && version.to_i >= 80
12
+ unless File.exist?(File.join(CONFIG['bindir'], 'ruby.exe.manifest'))
13
+ Dir.chdir(CONFIG['bindir']) do
14
+ sh "mt -inputresource:ruby.exe;2 -out:ruby.exe.manifest"
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ desc 'Install the win32-api library (non-gem)'
21
+ task :install => [:build] do
22
+ Dir.chdir('ext'){
23
+ sh 'nmake install'
24
+ }
25
+ end
26
+
27
+ task :install_gem do
28
+ ruby 'win32-api.gemspec'
29
+ file = Dir["*.gem"].first
30
+ sh "gem install #{file}"
31
+ end
32
+
33
+ desc 'Clean any build files for Win32::API'
34
+ task :clean do
35
+ Dir.chdir('ext') do
36
+ if File.exists?('api.so') || File.exists?('win32/api.so') ||
37
+ File.exists?('api.obj')
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')
42
+ end
43
+ end
44
+
45
+ # Cleanup any files generated by the build_binary_gem task
46
+ rm_rf('lib') if File.exists?('lib')
47
+ end
48
+
49
+ desc "Build Win32::API (but don't install it)"
50
+ task :build => [:clean, :build_manifest] do
51
+ Dir.chdir('ext') do
52
+ ruby "extconf.rb"
53
+ sh "nmake"
54
+ mv "api.so", "win32" # For the test suite
55
+ end
56
+ end
57
+
58
+ desc 'Build a standard gem'
59
+ task :build_gem => [:clean] do
60
+ eval(IO.read('win32-api.gemspec'))
61
+ end
62
+
63
+ desc 'Build a binary gem'
64
+ task :build_binary_gem => [:build] do
65
+ mkdir_p 'lib/win32'
66
+ mv 'ext/win32/api.so', 'lib/win32'
67
+
68
+ task :build_binary_gem => [:clean]
69
+
70
+ spec = Gem::Specification.new do |gem|
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
+
90
+ gem.rubyforge_project = 'win32utils'
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
+ ]
99
+
100
+ gem.description = <<-EOF
101
+ The Win32::API library is meant as a replacement for the Win32API
102
+ library that ships as part of the standard library. It contains several
103
+ advantages over Win32API, including callback support, raw function
104
+ pointers, an additional string type, and more.
105
+ EOF
106
+ end
107
+
108
+ Gem::Builder.new(spec).build
109
+ end
110
+
111
+ Rake::TestTask.new(:test) do |test|
112
+ task :test => [:build]
113
+ test.libs << 'ext'
114
+ test.warning = true
115
+ test.verbose = true
116
+ end
117
+
118
+ task :test do
119
+ Rake.application[:clean].execute
120
+ end
data/ext/extconf.rb ADDED
@@ -0,0 +1,11 @@
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
+
11
+ create_makefile('win32/api', 'win32')
data/ext/win32/api.c CHANGED
@@ -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
  }
data/lib/win32/api.so CHANGED
Binary file
@@ -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)
data/win32-api.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ require 'rubygems'
2
+
3
+ spec = Gem::Specification.new do |gem|
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
+
17
+ gem.rubyforge_project = 'win32utils'
18
+ gem.required_ruby_version = '>= 1.8.2'
19
+ gem.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST', 'ext/win32/api.c']
20
+
21
+ gem.add_development_dependency('test-unit', '>= 2.0.2')
22
+
23
+ gem.description = <<-EOF
24
+ The Win32::API library is meant as a replacement for the Win32API
25
+ library that ships as part of the standard library. It contains several
26
+ advantages over Win32API, including callback support, raw function
27
+ pointers, an additional string type, and more.
28
+ EOF
29
+ end
30
+
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: x86-mswin32-60
6
6
  authors:
7
7
  - Daniel J. Berger
@@ -10,7 +10,7 @@ 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
 
@@ -26,14 +26,17 @@ extra_rdoc_files:
26
26
  - MANIFEST
27
27
  - ext/win32/api.c
28
28
  files:
29
- - lib/win32/api.so
29
+ - CHANGES
30
+ - MANIFEST
31
+ - Rakefile
32
+ - README
33
+ - win32-api.gemspec
30
34
  - test/test_win32_api.rb
31
35
  - test/test_win32_api_callback.rb
32
36
  - test/test_win32_api_function.rb
33
- - README
34
- - CHANGES
35
- - MANIFEST
37
+ - ext/extconf.rb
36
38
  - ext/win32/api.c
39
+ - lib/win32/api.so
37
40
  has_rdoc: true
38
41
  homepage: http://www.rubyforge.org/projects/win32utils
39
42
  licenses:
@@ -58,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
61
  requirements: []
59
62
 
60
63
  rubyforge_project: win32utils
61
- rubygems_version: 1.3.4
64
+ rubygems_version: 1.3.5
62
65
  signing_key:
63
66
  specification_version: 3
64
67
  summary: A superior replacement for Win32API