Sha256: 8b0a41cda9abff9859b1523f20c4e99be0a271d21b965d59646c02e651b8abcc

Contents?: true

Size: 1.48 KB

Versions: 5

Compression:

Stored size: 1.48 KB

Contents

module Windows
  module File
    module Structs
      class FILETIME < FFI::Struct
        layout(:dwLowDateTime, :ulong, :dwHighDateTime, :ulong)
      end

      class SYSTEMTIME < FFI::Struct
        layout(
          :wYear, :ushort,
          :wMonth, :ushort,
          :wDayOfWeek, :ushort,
          :wDay, :ushort,
          :wHour, :ushort,
          :wMinute, :ushort,
          :wSecond, :ushort,
          :wMilliseconds, :ushort
        )

        # Allow a time object or raw numeric in constructor
        def initialize(time = nil)
          super()

          time = Time.at(time) if time.is_a?(Numeric)
          time = time.utc unless time.utc?

          self[:wYear] = time.year
          self[:wMonth] = time.month
          self[:wDayOfWeek] = time.wday
          self[:wDay] = time.day
          self[:wHour] = time.hour
          self[:wMinute] = time.min
          self[:wSecond] = time.sec
          self[:wMilliseconds] = time.nsec / 1000000
        end
      end

      class WIN32_FIND_DATA < FFI::Struct
        layout(
          :dwFileAttributes, :ulong,
          :ftCreationTime, FILETIME,
          :ftLastAccessTime, FILETIME,
          :ftLastWriteTime, FILETIME,
          :nFileSizeHigh, :ulong,
          :nFileSizeLow, :ulong,
          :dwReserved0, :ulong,
          :dwReserved1, :ulong,
          :cFileName, [:uint8, 260*2],
          :cAlternateFileName, [:uint8, 14*2]
        )
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
win32-file-0.8.2 lib/win32/file/structs.rb
vagrant-unbundled-2.1.1.0 vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32/file/structs.rb
vagrant-unbundled-2.0.4.0 vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32/file/structs.rb
win32-file-0.8.1 lib/win32/file/structs.rb
win32-file-0.8.0 lib/win32/file/structs.rb