Class: Recls::Ximpl::FileStat::ByHandleInformation
- Inherits:
-
Object
- Object
- Recls::Ximpl::FileStat::ByHandleInformation
- Defined in:
- lib/recls/ximpl/windows.rb
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
Returns a new instance of ByHandleInformation.
75 76 77 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 |
# File 'lib/recls/ximpl/windows.rb', line 75 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.
105 106 107 |
# File 'lib/recls/ximpl/windows.rb', line 105 def file_index @file_index end |
#num_links ⇒ Object (readonly)
Returns the value of attribute num_links.
106 107 108 |
# File 'lib/recls/ximpl/windows.rb', line 106 def num_links @num_links end |
#volume_id ⇒ Object (readonly)
Returns the value of attribute volume_id.
104 105 106 |
# File 'lib/recls/ximpl/windows.rb', line 104 def volume_id @volume_id end |