Sha256: 443c63762e737dda67fc68c22064076d230a16b8c72c9f20a289d21204e9e096

Contents?: true

Size: 1.23 KB

Versions: 7

Compression:

Stored size: 1.23 KB

Contents

require 'ffi'

module Sys
  class Filesystem
    module Functions
      extend FFI::Library
      ffi_lib :kernel32

      # Make FFI functions private
      module FFI::Library
        def attach_pfunc(*args)
          attach_function(*args)
          private args[0]
        end
      end

      attach_pfunc :DeleteVolumeMountPointA, [:string], :bool
      attach_pfunc :GetDiskFreeSpaceW, [:buffer_in, :pointer, :pointer, :pointer, :pointer], :bool
      attach_pfunc :GetDiskFreeSpaceExW, [:buffer_in, :pointer, :pointer, :pointer], :bool
      attach_pfunc :GetLogicalDriveStringsA, [:ulong, :pointer], :ulong

      attach_pfunc :GetVolumeInformationA,
        [:buffer_in, :pointer, :ulong, :pointer, :pointer, :pointer, :pointer, :ulong],
        :bool

      attach_pfunc :GetVolumeInformationW,
        [:buffer_in, :pointer, :ulong, :pointer, :pointer, :pointer, :pointer, :ulong],
        :bool

      attach_pfunc :GetVolumeNameForVolumeMountPointW, [:buffer_in, :buffer_in, :ulong], :bool
      attach_pfunc :QueryDosDeviceA, [:buffer_in, :buffer_out, :ulong], :ulong
      attach_pfunc :SetVolumeMountPointW, [:buffer_in, :buffer_in], :bool

      ffi_lib :shlwapi

      attach_pfunc :PathStripToRootW, [:pointer], :bool
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sys-filesystem-1.4.1 lib/sys/windows/sys/filesystem/functions.rb
sys-filesystem-1.4.0 lib/sys/windows/sys/filesystem/functions.rb
sys-filesystem-1.3.4 lib/sys/windows/sys/filesystem/functions.rb
sys-filesystem-1.3.3 lib/sys/windows/sys/filesystem/functions.rb
sys-filesystem-1.3.2 lib/sys/windows/sys/filesystem/functions.rb
sys-filesystem-1.3.1 lib/sys/windows/sys/filesystem/functions.rb
sys-filesystem-1.3.0 lib/sys/windows/sys/filesystem/functions.rb