win32-file-stat 1.5.0 → 1.5.1

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: 570cfbe24ce0b82de003f94d55e00b53dff39c77
4
- data.tar.gz: 36cebc20ffc58f5ac96b8daad1558cd48a121f3c
3
+ metadata.gz: 75bb3ff1b6a06d263f6c2889c0fb0b65ff58cd3d
4
+ data.tar.gz: 38edc506a14074f9b03ec850dc26d30416e0488c
5
5
  SHA512:
6
- metadata.gz: 6d573af01f22041b8c4b89512865a74e25e93c87a9b3d4450af2e6143a5d405322e506bd26d4ebe12c40e0af64fc218ec481fdce4e87017ba6145727cbd4a813
7
- data.tar.gz: 9208feadbeec27b4add065953b2bc35469bf41fa2bf417a606be7688acf71cd1b80bb4eeb76923e16aeab0ea114da2cc3dc73d2a9fea2af6fb9016860cd3ff72
6
+ metadata.gz: b77bde2136ca2582504014257f2be8bad69f3cd6709cfe94fc47821bbf387597be76e2bb9b3a7542830aabbb8583a9d6651b39879310a18023853201640ae0ea
7
+ data.tar.gz: 870e7223034d3c07928e78ecc259424a2cbf3f714273e3c38d816fde593c9e8f1821773eb48e8fac4c8fc488d9b0f7f890e37e75b93380b5ab3573e0ce7784a7
data/CHANGES CHANGED
@@ -1,3 +1,7 @@
1
+ == 1.5.1 - 8-Dec-2014
2
+ * Added code to work around 64-bit JRuby bug.
3
+ * Some minor refactoring for the get_current_process_sid method.
4
+
1
5
  == 1.5.0 - 10-Nov-2014
2
6
  * Added the #streams method, which shows alt streams for the file.
3
7
  * Use require_relative where appropriate.
@@ -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.0'
61
+ WIN32_FILE_STAT_VERSION = '1.5.1'
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
@@ -564,6 +564,15 @@ class File::Stat
564
564
 
565
565
  private
566
566
 
567
+ # Workaround for bug in 64-big JRuby. Hope to remove it some day.
568
+ def get_ptr_type
569
+ if RUBY_PLATFORM == 'java' && ENV_JAVA['sun.arch.data.model'] == '64'
570
+ :ulong_long
571
+ else
572
+ :uintptr_t
573
+ end
574
+ end
575
+
567
576
  # Allow stringy arguments
568
577
  def string_check(arg)
569
578
  return arg if arg.is_a?(String)
@@ -786,16 +795,16 @@ class File::Stat
786
795
  # Return the sid of the current process.
787
796
  #
788
797
  def get_current_process_sid(token_type)
789
- token = FFI::MemoryPointer.new(:uintptr_t)
798
+ token = FFI::MemoryPointer.new(get_ptr_type)
790
799
  sid = nil
791
800
 
792
- begin
793
- # Get the current process sid
794
- unless OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, token)
795
- raise SystemCallError.new("OpenProcessToken", FFI.errno)
796
- end
801
+ # Get the current process sid
802
+ unless OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, token)
803
+ raise SystemCallError.new("OpenProcessToken", FFI.errno)
804
+ end
797
805
 
798
- token = token.read_pointer.to_i
806
+ begin
807
+ token = token.read_pointer.to_i
799
808
  rlength = FFI::MemoryPointer.new(:pointer)
800
809
 
801
810
  if token_type == TokenUser
@@ -822,7 +831,7 @@ class File::Stat
822
831
 
823
832
  sid = ptr.read_pointer.read_string
824
833
  ensure
825
- CloseHandle(token) if token
834
+ CloseHandle(token)
826
835
  end
827
836
 
828
837
  sid
@@ -851,14 +860,14 @@ class File::Stat
851
860
 
852
861
  # Second attempt, now with the needed size
853
862
  if GetFileSecurity(wfile, flags, security_ptr, size_needed, size_needed_ptr)
854
- token = FFI::MemoryPointer.new(:uintptr_t)
863
+ token = FFI::MemoryPointer.new(get_ptr_type)
855
864
 
856
865
  pflags = TOKEN_IMPERSONATE | TOKEN_QUERY | TOKEN_DUPLICATE | STANDARD_RIGHTS_READ
857
866
 
858
867
  if OpenProcessToken(GetCurrentProcess(), pflags, token)
859
868
  begin
860
869
  token = token.read_pointer.to_i
861
- token2 = FFI::MemoryPointer.new(:uintptr_t)
870
+ token2 = FFI::MemoryPointer.new(get_ptr_type)
862
871
 
863
872
  if DuplicateToken(token, SecurityImpersonation, token2)
864
873
  begin
@@ -12,12 +12,17 @@ module Windows
12
12
  end
13
13
 
14
14
  typedef :ulong, :dword
15
- typedef :uintptr_t, :handle
16
15
  typedef :pointer, :ptr
17
16
  typedef :buffer_in, :buf_in
18
17
  typedef :string, :str
19
18
  typedef :long, :ntstatus
20
19
 
20
+ if RUBY_PLATFORM == 'java' && ENV_JAVA['sun.arch.data.model'] == '64'
21
+ typedef :ulong_long, :handle
22
+ else
23
+ typedef :uintptr_t, :handle
24
+ end
25
+
21
26
  ffi_convention :stdcall
22
27
 
23
28
  ffi_lib :kernel32
@@ -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.0', File::Stat::WIN32_FILE_STAT_VERSION)
57
+ assert_equal('1.5.1', 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.0'
3
+ spec.version = '1.5.1'
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.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
@@ -9,62 +9,62 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-10 00:00:00.000000000 Z
12
+ date: 2014-12-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - '>='
19
19
  - !ruby/object:Gem::Version
20
20
  version: '0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - '>='
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: test-unit
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">="
32
+ - - '>='
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - '>='
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: win32-security
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ">="
46
+ - - '>='
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ">="
53
+ - - '>='
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rake
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ">="
60
+ - - '>='
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ">="
67
+ - - '>='
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  description: |2
@@ -102,12 +102,12 @@ require_paths:
102
102
  - lib
103
103
  required_ruby_version: !ruby/object:Gem::Requirement
104
104
  requirements:
105
- - - ">="
105
+ - - '>='
106
106
  - !ruby/object:Gem::Version
107
107
  version: 1.9.0
108
108
  required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - ">="
110
+ - - '>='
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  requirements: []