win32-api 1.5.2-universal-mingw32 → 1.5.3-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40600be0a4b0d43c92a249dd1f508562d7ef399e
4
- data.tar.gz: 7c13f96cb0ef6725dd590f6c93bc643aa54ba709
3
+ metadata.gz: 7e89ec0088d309d7ed30ab87ad2d0b657315af69
4
+ data.tar.gz: 9ac07477f90e4933338077c3e2fd63fff00d81a1
5
5
  SHA512:
6
- metadata.gz: e48d26d32bc1ec16a985313f282f3e8d8589bc8946d3c632b6388fe273d86ca19ab3125cb735704923b6133225f0f9fec3cb1119d5532eaca2dd7c8600eebd17
7
- data.tar.gz: 88912d1a2c5bf6abeb28f5f81bea9064b4faebf3bd9a9ce18a9708a12c09b01793ad7ca4f56de14b3350be5503b103d666f4aa9776cacac98898ca2b10f384a6
6
+ metadata.gz: 9429c396c7ea80685f43117988e8d81a33b0f0559213ff8c014d96739da7fcdb7f42aa1977923020af3a06154d9c4aac82fb41128db66794656462209bc9dc94
7
+ data.tar.gz: b2330025011dbb3963e43529da40dcea113adab9f2839a10f5ff1ea53fd7d448faf8ebf7a16538a64a38c05cf71290dad5083c0d4eec4e04eee2a66cad6bbc0a
data/CHANGES CHANGED
@@ -1,3 +1,9 @@
1
+ == 1.5.3 - 18-Mar-2015
2
+ * Now includes binaries for Ruby 2.2 for both 32 and 64 bit versions.
3
+ * Fixed potential stack corruption caused by callbacks. Thanks go to
4
+ rickerliang for the spot and patch.
5
+ * Some minor updates and additions to the Rakefile.
6
+
1
7
  == 1.5.2 - 11-Oct-2014
2
8
  * Now includes binaries for Ruby 2.1 for both 32 and 64 bit versions.
3
9
  * Some refactoring of the gem:binary task, mostly for me.
data/README CHANGED
@@ -49,6 +49,9 @@
49
49
  use capital letters.
50
50
 
51
51
  = Developer's Notes
52
+ [NOTE: Some of the information below is now out of date, but explains my
53
+ motivation at the time the project was originally created.]
54
+
52
55
  The current Win32API library that ships with the standard library has been
53
56
  slated for removal from Ruby 2.0 and it will not receive any updates in the
54
57
  Ruby 1.8.x branch. I have far too many libraries invested in it to let it
@@ -104,13 +107,20 @@
104
107
  http://www.gittip.com/djberg96/
105
108
 
106
109
  = Future Plans
107
- I really don't have future plans for this library since I believe FFI to
108
- be the preferred C interface going forward. This library will still be
109
- maintained, at least until all of the win32utils libraries have been
110
- converted to use either FFI or an OLE approach.
110
+ I really don't have future plans for this library since you should use FFI
111
+ as your preferred C interface going forward. All of my own projects have
112
+ since been converted to either use FFI or an analogous OLE interface.
113
+
114
+ I will continue to maintain this library as long as there are folks out
115
+ there who are still using it, but I strongly encourage you to convert
116
+ your projects to FFI when possible.
117
+
118
+ = Maintainer Wanted!
119
+ Since I no longer use this project, I would like to turn it over to
120
+ someone who has the skill, time and desire to keep it going.
111
121
 
112
122
  = Copyright
113
- (C) 2003-2014 Daniel J. Berger
123
+ (C) 2003-2015 Daniel J. Berger
114
124
  All Rights Reserved
115
125
 
116
126
  = License
data/Rakefile CHANGED
@@ -30,7 +30,7 @@ task :build_manifest do
30
30
  if version && version.to_i >= 80
31
31
  unless File.exist?(File.join(CONFIG['bindir'], 'ruby.exe.manifest'))
32
32
  Dir.chdir(CONFIG['bindir']) do
33
- sh "mt -inputresource:ruby.exe;2 -out:ruby.exe.manifest"
33
+ sh "mt -nologo -inputresource:ruby.exe;2 -out:ruby.exe.manifest"
34
34
  end
35
35
  end
36
36
  end
@@ -38,7 +38,7 @@ end
38
38
 
39
39
  desc "Build the win32-api library"
40
40
  task :build => [:clean, :build_manifest] do
41
- require 'devkit'
41
+ require 'devkit' if RbConfig::CONFIG['host_os'] =~ /mingw|cygwn/i
42
42
  Dir.chdir('ext') do
43
43
  ruby "extconf.rb"
44
44
  sh make
@@ -60,8 +60,8 @@ namespace 'gem' do
60
60
  end
61
61
 
62
62
  desc 'Build a binary gem'
63
- task :binary, :ruby18, :ruby19, :ruby2_32, :ruby2_64, :ruby21, :ruby21_64 do |task, args|
64
- require 'devkit'
63
+ task :binary, :ruby18, :ruby19, :ruby2_32, :ruby2_64, :ruby21, :ruby21_64, :ruby22, :ruby22_64 do |task, args|
64
+ require 'devkit' if RbConfig::CONFIG['host_os'] =~ /mingw|cygwn/i
65
65
 
66
66
  # These are just what's on my system at the moment. Adjust as needed.
67
67
  args.with_defaults(
@@ -70,7 +70,9 @@ namespace 'gem' do
70
70
  :ruby2_32 => "c:/ruby2/bin/ruby",
71
71
  :ruby2_64 => "c:/ruby264/bin/ruby",
72
72
  :ruby21_32 => "c:/ruby21/bin/ruby",
73
- :ruby21_64 => "c:/ruby21-x64/bin/ruby"
73
+ :ruby21_64 => "c:/ruby21-x64/bin/ruby",
74
+ :ruby22_32 => "c:/ruby22/bin/ruby",
75
+ :ruby22_64 => "c:/ruby22-x64/bin/ruby"
74
76
  )
75
77
 
76
78
  Rake::Task[:clobber].invoke
@@ -94,22 +96,38 @@ namespace 'gem' do
94
96
  }
95
97
 
96
98
  text = <<HERE
97
- case
98
- when RUBY_VERSION =~ /1\\.8/
99
- require File.join(File.dirname(__FILE__), 'ruby18/win32/api')
100
- when RUBY_VERSION =~ /1\\.9/
101
- require File.join(File.dirname(__FILE__), 'ruby19/win32/api')
102
- when RUBY_VERSION =~ /2\\.0/
103
- if RbConfig::CONFIG['arch'] =~ /x64/i
104
- require File.join(File.dirname(__FILE__), 'ruby2_64/win32/api')
99
+ require 'rbconfig'
100
+
101
+ case RbConfig::CONFIG['MAJOR']
102
+ when '1'
103
+ if RbConfig::CONFIG['MINOR'] == '8'
104
+ require File.join(File.dirname(__FILE__), 'ruby18/win32/api')
105
105
  else
106
- require File.join(File.dirname(__FILE__), 'ruby2_32/win32/api')
106
+ require File.join(File.dirname(__FILE__), 'ruby19/win32/api')
107
107
  end
108
- when RUBY_VERSION =~ /2\\.1/
109
- if RbConfig::CONFIG['arch'] =~ /x64/i
110
- require File.join(File.dirname(__FILE__), 'ruby21_64/win32/api')
111
- else
112
- require File.join(File.dirname(__FILE__), 'ruby21_32/win32/api')
108
+ when '2'
109
+ if RbConfig::CONFIG['MINOR'] == '0'
110
+ if RbConfig::CONFIG['arch'] =~ /x64/i
111
+ require File.join(File.dirname(__FILE__), 'ruby2_64/win32/api')
112
+ else
113
+ require File.join(File.dirname(__FILE__), 'ruby2_32/win32/api')
114
+ end
115
+ end
116
+
117
+ if RbConfig::CONFIG['MINOR'] == '1'
118
+ if RbConfig::CONFIG['arch'] =~ /x64/i
119
+ require File.join(File.dirname(__FILE__), 'ruby21_64/win32/api')
120
+ else
121
+ require File.join(File.dirname(__FILE__), 'ruby21_32/win32/api')
122
+ end
123
+ end
124
+
125
+ if RbConfig::CONFIG['MINOR'] == '2'
126
+ if RbConfig::CONFIG['arch'] =~ /x64/i
127
+ require File.join(File.dirname(__FILE__), 'ruby22_64/win32/api')
128
+ else
129
+ require File.join(File.dirname(__FILE__), 'ruby22_32/win32/api')
130
+ end
113
131
  end
114
132
  end
115
133
  HERE
@@ -37,7 +37,7 @@
37
37
 
38
38
 
39
39
  #define MAX_BUF 1024
40
- #define WINDOWS_API_VERSION "1.5.2"
40
+ #define WINDOWS_API_VERSION "1.5.3"
41
41
 
42
42
  #define _T_VOID 0
43
43
  #define _T_LONG 1
@@ -822,7 +822,6 @@ static VALUE api_call(int argc, VALUE* argv, VALUE self){
822
822
  break;
823
823
  case _T_CALLBACK:
824
824
  ActiveCallback = v_arg;
825
- v_proto = rb_iv_get(ActiveCallback, "@prototype");
826
825
  param.params[i] = (LPARAM)NUM2SIZET(rb_iv_get(ActiveCallback, "@address"));;
827
826
  break;
828
827
  case _T_STRING:
@@ -834,14 +833,131 @@ static VALUE api_call(int argc, VALUE* argv, VALUE self){
834
833
  }
835
834
 
836
835
  /* Call the function, get the return value */
837
- #ifdef _WIN64
838
- return_value = ptr->function(param.params[0],param.params[1],param.params[2],param.params[3],param.params[4],
839
- param.params[5],param.params[6],param.params[7],param.params[8],param.params[9],
840
- param.params[10],param.params[11],param.params[12],param.params[13],param.params[14],
841
- param.params[15],param.params[16],param.params[17],param.params[18],param.params[19]);
842
- #else
843
- return_value = ptr->function(param);
844
- #endif
836
+ if(strcmp(StringValuePtr(RARRAY_PTR(v_proto)[0]), "V") == 0 && len == 1)
837
+ {
838
+ return_value = ptr->function();
839
+ }
840
+ else
841
+ {
842
+ switch(len)
843
+ {
844
+ case 0:
845
+ return_value = ptr->function();
846
+ break;
847
+ case 1:
848
+ return_value = ptr->function(param.params[0]);
849
+ break;
850
+ case 2:
851
+ return_value = ptr->function(param.params[0], param.params[1]);
852
+ break;
853
+ case 3:
854
+ return_value = ptr->function(param.params[0], param.params[1],
855
+ param.params[2]);
856
+ break;
857
+ case 4:
858
+ return_value = ptr->function(param.params[0], param.params[1],
859
+ param.params[2], param.params[3]);
860
+ break;
861
+ case 5:
862
+ return_value = ptr->function(param.params[0], param.params[1],
863
+ param.params[2], param.params[3], param.params[4]);
864
+ break;
865
+ case 6:
866
+ return_value = ptr->function(param.params[0], param.params[1],
867
+ param.params[2], param.params[3], param.params[4], param.params[5]);
868
+ break;
869
+ case 7:
870
+ return_value = ptr->function(param.params[0], param.params[1],
871
+ param.params[2], param.params[3], param.params[4], param.params[5],
872
+ param.params[6]);
873
+ break;
874
+ case 8:
875
+ return_value = ptr->function(param.params[0], param.params[1],
876
+ param.params[2], param.params[3], param.params[4], param.params[5],
877
+ param.params[6], param.params[7]);
878
+ break;
879
+ case 9:
880
+ return_value = ptr->function(param.params[0], param.params[1],
881
+ param.params[2], param.params[3], param.params[4], param.params[5],
882
+ param.params[6], param.params[7], param.params[8]);
883
+ break;
884
+ case 10:
885
+ return_value = ptr->function(param.params[0], param.params[1],
886
+ param.params[2], param.params[3], param.params[4], param.params[5],
887
+ param.params[6], param.params[7], param.params[8], param.params[9]);
888
+ break;
889
+ case 11:
890
+ return_value = ptr->function(param.params[0], param.params[1],
891
+ param.params[2], param.params[3], param.params[4], param.params[5],
892
+ param.params[6], param.params[7], param.params[8], param.params[9],
893
+ param.params[10]);
894
+ break;
895
+ case 12:
896
+ return_value = ptr->function(param.params[0], param.params[1],
897
+ param.params[2], param.params[3], param.params[4], param.params[5],
898
+ param.params[6], param.params[7], param.params[8], param.params[9],
899
+ param.params[10], param.params[11]);
900
+ break;
901
+ case 13:
902
+ return_value = ptr->function(param.params[0], param.params[1],
903
+ param.params[2], param.params[3], param.params[4], param.params[5],
904
+ param.params[6], param.params[7], param.params[8], param.params[9],
905
+ param.params[10], param.params[11], param.params[12]);
906
+ break;
907
+ case 14:
908
+ return_value = ptr->function(param.params[0], param.params[1],
909
+ param.params[2], param.params[3], param.params[4], param.params[5],
910
+ param.params[6], param.params[7], param.params[8], param.params[9],
911
+ param.params[10], param.params[11], param.params[12], param.params[13]);
912
+ break;
913
+ case 15:
914
+ return_value = ptr->function(param.params[0], param.params[1],
915
+ param.params[2], param.params[3], param.params[4], param.params[5],
916
+ param.params[6], param.params[7], param.params[8], param.params[9],
917
+ param.params[10], param.params[11], param.params[12], param.params[13],
918
+ param.params[14]);
919
+ break;
920
+ case 16:
921
+ return_value = ptr->function(param.params[0], param.params[1],
922
+ param.params[2], param.params[3], param.params[4], param.params[5],
923
+ param.params[6], param.params[7], param.params[8], param.params[9],
924
+ param.params[10], param.params[11], param.params[12], param.params[13],
925
+ param.params[14], param.params[15]);
926
+ break;
927
+ case 17:
928
+ return_value = ptr->function(param.params[0], param.params[1],
929
+ param.params[2], param.params[3], param.params[4], param.params[5],
930
+ param.params[6], param.params[7], param.params[8], param.params[9],
931
+ param.params[10], param.params[11], param.params[12], param.params[13],
932
+ param.params[14], param.params[15], param.params[16]);
933
+ break;
934
+ case 18:
935
+ return_value = ptr->function(param.params[0], param.params[1],
936
+ param.params[2], param.params[3], param.params[4], param.params[5],
937
+ param.params[6], param.params[7], param.params[8], param.params[9],
938
+ param.params[10], param.params[11], param.params[12], param.params[13],
939
+ param.params[14], param.params[15], param.params[16], param.params[17]);
940
+ break;
941
+ case 19:
942
+ return_value = ptr->function(param.params[0], param.params[1],
943
+ param.params[2], param.params[3], param.params[4], param.params[5],
944
+ param.params[6], param.params[7], param.params[8], param.params[9],
945
+ param.params[10], param.params[11], param.params[12], param.params[13],
946
+ param.params[14], param.params[15], param.params[16], param.params[17],
947
+ param.params[18]);
948
+ break;
949
+ case 20:
950
+ return_value = ptr->function(param.params[0], param.params[1],
951
+ param.params[2], param.params[3], param.params[4], param.params[5],
952
+ param.params[6], param.params[7], param.params[8], param.params[9],
953
+ param.params[10], param.params[11], param.params[12], param.params[13],
954
+ param.params[14], param.params[15], param.params[16], param.params[17],
955
+ param.params[18], param.params[19]);
956
+ break;
957
+ default:
958
+ rb_raise(rb_eArgError,"number of parameters exceed 20!");
959
+ }
960
+ }
845
961
 
846
962
  /* Return the appropriate type based on the return type specified
847
963
  * in the constructor.
@@ -971,6 +1087,6 @@ void Init_api(){
971
1087
 
972
1088
  /* Constants */
973
1089
 
974
- /* 1.5.2: The version of the win32-api library */
1090
+ /* 1.5.3: The version of the win32-api library */
975
1091
  rb_define_const(cAPI, "VERSION", rb_str_new2(WINDOWS_API_VERSION));
976
1092
  }
@@ -1,18 +1,34 @@
1
- case
2
- when RUBY_VERSION =~ /1\.8/
3
- require File.join(File.dirname(__FILE__), 'ruby18/win32/api')
4
- when RUBY_VERSION =~ /1\.9/
5
- require File.join(File.dirname(__FILE__), 'ruby19/win32/api')
6
- when RUBY_VERSION =~ /2\.0/
7
- if RbConfig::CONFIG['arch'] =~ /x64/i
8
- require File.join(File.dirname(__FILE__), 'ruby2_64/win32/api')
1
+ require 'rbconfig'
2
+
3
+ case RbConfig::CONFIG['MAJOR']
4
+ when '1'
5
+ if RbConfig::CONFIG['MINOR'] == '8'
6
+ require File.join(File.dirname(__FILE__), 'ruby18/win32/api')
9
7
  else
10
- require File.join(File.dirname(__FILE__), 'ruby2_32/win32/api')
8
+ require File.join(File.dirname(__FILE__), 'ruby19/win32/api')
11
9
  end
12
- when RUBY_VERSION =~ /2\.1/
13
- if RbConfig::CONFIG['arch'] =~ /x64/i
14
- require File.join(File.dirname(__FILE__), 'ruby21_64/win32/api')
15
- else
16
- require File.join(File.dirname(__FILE__), 'ruby21_32/win32/api')
10
+ when '2'
11
+ if RbConfig::CONFIG['MINOR'] == '0'
12
+ if RbConfig::CONFIG['arch'] =~ /x64/i
13
+ require File.join(File.dirname(__FILE__), 'ruby2_64/win32/api')
14
+ else
15
+ require File.join(File.dirname(__FILE__), 'ruby2_32/win32/api')
16
+ end
17
+ end
18
+
19
+ if RbConfig::CONFIG['MINOR'] == '1'
20
+ if RbConfig::CONFIG['arch'] =~ /x64/i
21
+ require File.join(File.dirname(__FILE__), 'ruby21_64/win32/api')
22
+ else
23
+ require File.join(File.dirname(__FILE__), 'ruby21_32/win32/api')
24
+ end
25
+ end
26
+
27
+ if RbConfig::CONFIG['MINOR'] == '2'
28
+ if RbConfig::CONFIG['arch'] =~ /x64/i
29
+ require File.join(File.dirname(__FILE__), 'ruby22_64/win32/api')
30
+ else
31
+ require File.join(File.dirname(__FILE__), 'ruby22_32/win32/api')
32
+ end
17
33
  end
18
34
  end
@@ -18,7 +18,7 @@ class TC_Win32_API < Test::Unit::TestCase
18
18
  end
19
19
 
20
20
  def test_version
21
- assert_equal('1.5.2', API::VERSION)
21
+ assert_equal('1.5.3', API::VERSION)
22
22
  end
23
23
 
24
24
  def test_constructor_basic
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'win32-api'
5
- spec.version = '1.5.2'
5
+ spec.version = '1.5.3'
6
6
  spec.authors = ['Daniel J. Berger', 'Park Heesob']
7
7
  spec.license = 'Artistic 2.0'
8
8
  spec.email = 'djberg96@gmail.com'
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.5.2
4
+ version: 1.5.3
5
5
  platform: universal-mingw32
6
6
  authors:
7
7
  - Daniel J. Berger
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-11 00:00:00.000000000 Z
12
+ date: 2015-03-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit
@@ -63,6 +63,8 @@ files:
63
63
  - lib/win32/ruby19/win32/api.so
64
64
  - lib/win32/ruby21_32/win32/api.so
65
65
  - lib/win32/ruby21_64/win32/api.so
66
+ - lib/win32/ruby22_32/win32/api.so
67
+ - lib/win32/ruby22_64/win32/api.so
66
68
  - lib/win32/ruby2_32/win32/api.so
67
69
  - lib/win32/ruby2_64/win32/api.so
68
70
  - test/test_win32_api.rb
@@ -89,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
91
  version: '0'
90
92
  requirements: []
91
93
  rubyforge_project:
92
- rubygems_version: 2.2.2
94
+ rubygems_version: 2.4.5
93
95
  signing_key:
94
96
  specification_version: 4
95
97
  summary: A superior replacement for Win32API