Sha256: 6ba804fa0f8a938fa5395683028f0512c3731866c22ef0857e42c08470f62a59

Contents?: true

Size: 1 KB

Versions: 11

Compression:

Stored size: 1 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 :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 :QueryDosDeviceA, [:buffer_in, :buffer_out, :ulong], :ulong

      ffi_lib :shlwapi

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sys-filesystem-1.2.0 lib/sys/windows/sys/filesystem/functions.rb
sys-filesystem-1.1.9 lib/sys/windows/sys/filesystem/functions.rb
sys-filesystem-1.1.8 lib/sys/windows/sys/filesystem/functions.rb
sys-filesystem-1.1.7 lib/sys/windows/sys/filesystem/functions.rb
sys-filesystem-1.1.6 lib/sys/windows/sys/filesystem/functions.rb
sys-filesystem-1.1.5 lib/sys/windows/sys/filesystem/functions.rb
sys-filesystem-1.1.4 lib/windows/sys/filesystem/functions.rb
sys-filesystem-1.1.3 lib/windows/sys/filesystem/functions.rb
sys-filesystem-1.1.2 lib/windows/sys/filesystem/functions.rb
sys-filesystem-1.1.1 lib/windows/sys/filesystem/functions.rb
sys-filesystem-1.1.0 lib/windows/sys/filesystem/functions.rb