Method: Winhelper.file_system_type_from_handle

Defined in:
lib/filewatch/winhelper.rb

.file_system_type_from_handle(handle, close_handle = true) ⇒ Object



113
114
115
116
117
118
119
120
121
122
# File 'lib/filewatch/winhelper.rb', line 113

def self.file_system_type_from_handle(handle, close_handle = true)
  out = FFI::MemoryPointer.new(:char, 256, true)
  if GetVolumeInformationByHandleW(handle, nil, 0, nil, nil, nil, out, 256) > 0
    char_pointer_to_ruby_string(out)
  else
    "unknown"
  end
ensure
  CloseHandle(handle) if close_handle
end