win32-file-stat 1.5.3 → 1.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7764a39e8f403c83d964b00692f7b73601145333
4
- data.tar.gz: 5226d81304b3962ecfce5b62169cb162ce1b2450
3
+ metadata.gz: 23250fff2376ccd7a6065cdcae48c6e81c07df90
4
+ data.tar.gz: a9a131d44a673112885963b6d29073ad92c11d48
5
5
  SHA512:
6
- metadata.gz: 55089202def036b4a370e22ec1e22f3b123528707f74384cdfd61ed60c130cd516dde0f1f92413d43fb5e062f78f3a96dc929f27ed8a4f7d419f638a72e1d210
7
- data.tar.gz: 33a8579a2ebe3fe232d7e9145d43024469d8e8d7ad1738257f9232f43476472514220990606f520eed33fb737298b8e7bd55fb11c6061fa87fffaa0697e40394
6
+ metadata.gz: 5f891648fed03bc03c47810ba2e556d24cb1575791dcc4c305ce704cc9495f8116fd22d7e16c382af8cb537ff9f7302628bf5828604fd0168c5a89cdcf58d431
7
+ data.tar.gz: a493ed6f9733b4cd62e23918bc6dfa495666c42b9fc47044198ab46e498341da68cf4576aa60ff63872c402bd404db23a9af570c58119d4412a4de816b1022cd
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGES CHANGED
@@ -1,3 +1,9 @@
1
+ == 1.5.4 - 7-Jun-2016
2
+ * It was possible that an internal FFI function (GetTokenInformation) could
3
+ fail if the buffer size wasn't large enough. That has been fixed. Thanks
4
+ go to ferfebles and Michael Lowell Roberts for the spot.
5
+ * Added an appveyor.yml file.
6
+
1
7
  == 1.5.3 - 25-May-2016
2
8
  * This gem is now signed.
3
9
  * The local helper file has been replaced by ffi-win32-extensions, which
data/MANIFEST CHANGED
@@ -1,8 +1,10 @@
1
+ * appveyor.yml
1
2
  * CHANGES
2
- * README
3
3
  * MANIFEST
4
4
  * Rakefile
5
+ * README
5
6
  * win32-file-stat.gemspec
7
+ * certs/djberg96_pub.pem
6
8
  * lib/win32/file/stat.rb
7
9
  * lib/win32/file/windows/constants.rb
8
10
  * lib/win32/file/windows/functions.rb
data/README CHANGED
@@ -79,7 +79,7 @@
79
79
  http://www.gittip.com/djberg96/
80
80
 
81
81
  == Copyright
82
- (C) 2003-2015, Daniel J. Berger, All Rights Reserved.
82
+ (C) 2003-2016, Daniel J. Berger, All Rights Reserved.
83
83
 
84
84
  == License
85
85
  Artistic 2.0
@@ -0,0 +1,48 @@
1
+ version: '{build}'
2
+ branches:
3
+ only:
4
+ - ffi2
5
+ skip_tags: true
6
+ clone_depth: 10
7
+ environment:
8
+ matrix:
9
+ - ruby_version: 193
10
+ ruby_dir: 1.9.1
11
+ - ruby_version: 200
12
+ ruby_dir: 2.0.0
13
+ - ruby_version: 200-x64
14
+ ruby_dir: 2.0.0
15
+ - ruby_version: 21
16
+ ruby_dir: 2.1.0
17
+ - ruby_version: 21-x64
18
+ ruby_dir: 2.1.0
19
+ - ruby_version: 22
20
+ ruby_dir: 2.2.0
21
+ - ruby_version: 22-x64
22
+ ruby_dir: 2.2.0
23
+ install:
24
+ - ps: >-
25
+ $env:path = "C:\Ruby" + $env:ruby_version + "\bin;" + $env:path
26
+
27
+ $tpath = "C:\Ruby" + $env:ruby_version + "\lib\ruby\" + $env:ruby_dir + "\test"
28
+
29
+ if ((test-path $tpath) -eq $True){ rm -recurse -force $tpath }
30
+
31
+ gem update --system > $null
32
+
33
+ if ((gem query -i ffi-win32-extensions) -eq $False){ gem install ffi-win32-extensions --no-document }
34
+
35
+ if ((gem query -i win32-security) -eq $False){ gem install win32-security --no-document }
36
+
37
+ if ((gem query -i test-unit -v ">= 3.0") -eq $False){ gem install test-unit --no-document }
38
+ cache:
39
+ - C:\Ruby193\lib\ruby\gems\1.9.1
40
+ - C:\Ruby200\lib\ruby\gems\2.0.0
41
+ - C:\Ruby200-x64\lib\ruby\gems\2.0.0
42
+ - C:\Ruby21\lib\ruby\gems\2.1.0
43
+ - C:\Ruby21-x64\lib\ruby\gems\2.1.0
44
+ - C:\Ruby22\lib\ruby\gems\2.2.0
45
+ - C:\Ruby22-x64\lib\ruby\gems\2.2.0
46
+ build: off
47
+ test_script:
48
+ - cmd: rake
@@ -58,7 +58,7 @@ class File::Stat
58
58
  attr_reader :streams
59
59
 
60
60
  # The version of the win32-file-stat library
61
- WIN32_FILE_STAT_VERSION = '1.5.3'
61
+ WIN32_FILE_STAT_VERSION = '1.5.4'
62
62
 
63
63
  # Creates and returns a File::Stat object, which encapsulate common status
64
64
  # information for File objects on MS Windows sytems. The information is
@@ -815,22 +815,29 @@ class File::Stat
815
815
 
816
816
  begin
817
817
  token = token.read_pointer.to_i
818
- rlength = FFI::MemoryPointer.new(:pointer)
818
+ rlength = FFI::MemoryPointer.new(:ulong)
819
819
 
820
820
  if token_type == TokenUser
821
- buf = 0.chr * 512
821
+ info = TOKEN_USER.new
822
822
  else
823
- buf = TOKEN_GROUP.new
823
+ info = TOKEN_GROUP.new
824
824
  end
825
825
 
826
- unless GetTokenInformation(token, token_type, buf, buf.size, rlength)
827
- raise SystemCallError.new("GetTokenInformation", FFI.errno)
826
+ bool = GetTokenInformation(token, token_type, info, info.size, rlength)
827
+
828
+ if !bool && FFI.errno == ERROR_INSUFFICIENT_BUFFER
829
+ info = FFI::MemoryPointer.new(rlength.read_ulong)
830
+ rlength.clear
831
+ bool = GetTokenInformation(token, token_type, info, info.size, rlength)
832
+ info = TOKEN_USER.new(info) if bool
828
833
  end
829
834
 
835
+ raise SystemCallError.new('GetTokenInformation', FFI.errno) unless bool
836
+
830
837
  if token_type == TokenUser
831
- tsid = buf[FFI.type_size(:pointer)*2, (rlength.read_ulong - FFI.type_size(:pointer)*2)]
838
+ tsid = info[:User][:Sid]
832
839
  else
833
- tsid = buf[:Groups][0][:Sid]
840
+ tsid = info[:Groups][0][:Sid]
834
841
  end
835
842
 
836
843
  ptr = FFI::MemoryPointer.new(:string)
@@ -152,6 +152,12 @@ module Windows
152
152
  )
153
153
  end
154
154
 
155
+ class TOKEN_USER < FFI::Struct
156
+ layout(
157
+ :User, SID_AND_ATTRIBUTES
158
+ )
159
+ end
160
+
155
161
  class GENERIC_MAPPING < FFI::Struct
156
162
  layout(
157
163
  :GenericRead, :ulong,
@@ -54,7 +54,7 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
54
54
  end
55
55
 
56
56
  test "version is set to expected value" do
57
- assert_equal('1.5.3', File::Stat::WIN32_FILE_STAT_VERSION)
57
+ assert_equal('1.5.4', File::Stat::WIN32_FILE_STAT_VERSION)
58
58
  end
59
59
 
60
60
  test "constructor does not modify argument" do
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'win32-file-stat'
3
- spec.version = '1.5.3'
3
+ spec.version = '1.5.4'
4
4
  spec.authors = ['Daniel J. Berger', 'Park Heesob']
5
5
  spec.license = 'Artistic 2.0'
6
6
  spec.email = 'djberg96@gmail.com'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win32-file-stat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
@@ -31,7 +31,7 @@ cert_chain:
31
31
  EJYzxdPOrx2n6NYR3Hk+vHP0U7UBSveI6+qx+ndQYaeyCn+GRX2PKS9h66YF/Q1V
32
32
  tGSHgAmcLlkdGgan182qsE/4kKM=
33
33
  -----END CERTIFICATE-----
34
- date: 2016-05-26 00:00:00.000000000 Z
34
+ date: 2016-06-07 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: ffi
@@ -117,6 +117,7 @@ extra_rdoc_files:
117
117
  - CHANGES
118
118
  - MANIFEST
119
119
  files:
120
+ - appveyor.yml
120
121
  - certs
121
122
  - certs/djberg96_pub.pem
122
123
  - CHANGES
metadata.gz.sig CHANGED
Binary file