Class: Recls::Ximpl::FileStat::ByHandleInformation
- Defined in:
- lib/recls/ximpl/windows.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#file_index ⇒ Object
readonly
Returns the value of attribute file_index.
-
#num_links ⇒ Object
readonly
Returns the value of attribute num_links.
-
#volume_id ⇒ Object
readonly
Returns the value of attribute volume_id.
Instance Method Summary collapse
-
#initialize(path) ⇒ ByHandleInformation
constructor
A new instance of ByHandleInformation.
Constructor Details
#initialize(path) ⇒ ByHandleInformation
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/recls/ximpl/windows.rb', line 78 def initialize(path) @volume_id = 0 @file_index = 0 @num_links = 0 # for some reason not forcing this new string causes 'can't modify frozen string (TypeError)' (in Ruby 1.8.x) hFile = CreateFile.call("#{path}", 0, 0, NULL, OPEN_EXISTING, 0, NULL); if INVALID_HANDLE_VALUE != hFile begin bhfi = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] bhfi = bhfi.pack(BHFI_pack_string) if GetFileInformationByHandle.call(hFile, bhfi) bhfi = bhfi.unpack(BHFI_pack_string) @volume_id = bhfi[4] @file_index = (bhfi[8] << 32) | bhfi[9] @num_links = bhfi[7] else end ensure CloseHandle.call(hFile) end end end |
Instance Attribute Details
#file_index ⇒ Object (readonly)
Returns the value of attribute file_index.
108 109 110 |
# File 'lib/recls/ximpl/windows.rb', line 108 def file_index @file_index end |
#num_links ⇒ Object (readonly)
Returns the value of attribute num_links.
109 110 111 |
# File 'lib/recls/ximpl/windows.rb', line 109 def num_links @num_links end |
#volume_id ⇒ Object (readonly)
Returns the value of attribute volume_id.
107 108 109 |
# File 'lib/recls/ximpl/windows.rb', line 107 def volume_id @volume_id end |