Class: Chef::ReservedNames::Win32::File::Info
- Defined in:
- lib/chef/win32/file/info.rb
Overview
Objects of class Chef::ReservedNames::Win32::File::Stat encapsulate common status information for Chef::ReservedNames::Win32::File objects. The information is recorded at the moment the Chef::ReservedNames::Win32::File::Stat object is created; changes made to the file after that point will not be reflected.
Constant Summary
Constants included from API::File
API::File::FILE_ANY_ACCESS, API::File::FILE_ATTRIBUTE_ARCHIVE, API::File::FILE_ATTRIBUTE_COMPRESSED, API::File::FILE_ATTRIBUTE_DEVICE, API::File::FILE_ATTRIBUTE_DIRECTORY, API::File::FILE_ATTRIBUTE_ENCRYPTED, API::File::FILE_ATTRIBUTE_HIDDEN, API::File::FILE_ATTRIBUTE_NORMAL, API::File::FILE_ATTRIBUTE_NOT_CONTENT_INDEXED, API::File::FILE_ATTRIBUTE_OFFLINE, API::File::FILE_ATTRIBUTE_READONLY, API::File::FILE_ATTRIBUTE_REPARSE_POINT, API::File::FILE_ATTRIBUTE_SPARSE_FILE, API::File::FILE_ATTRIBUTE_SYSTEM, API::File::FILE_ATTRIBUTE_TEMPORARY, API::File::FILE_ATTRIBUTE_VIRTUAL, API::File::FILE_DEVICE_8042_PORT, API::File::FILE_DEVICE_ACPI, API::File::FILE_DEVICE_BATTERY, API::File::FILE_DEVICE_BEEP, API::File::FILE_DEVICE_BIOMETRIC, API::File::FILE_DEVICE_BLUETOOTH, API::File::FILE_DEVICE_BUS_EXTENDER, API::File::FILE_DEVICE_CD_ROM, API::File::FILE_DEVICE_CD_ROM_FILE_SYSTEM, API::File::FILE_DEVICE_CHANGER, API::File::FILE_DEVICE_CONTROLLER, API::File::FILE_DEVICE_CRYPT_PROVIDER, API::File::FILE_DEVICE_DATALINK, API::File::FILE_DEVICE_DFS, API::File::FILE_DEVICE_DFS_FILE_SYSTEM, API::File::FILE_DEVICE_DFS_VOLUME, API::File::FILE_DEVICE_DISK, API::File::FILE_DEVICE_DISK_FILE_SYSTEM, API::File::FILE_DEVICE_DVD, API::File::FILE_DEVICE_FILE_SYSTEM, API::File::FILE_DEVICE_FIPS, API::File::FILE_DEVICE_FULLSCREEN_VIDEO, API::File::FILE_DEVICE_INFINIBAND, API::File::FILE_DEVICE_INPORT_PORT, API::File::FILE_DEVICE_KEYBOARD, API::File::FILE_DEVICE_KS, API::File::FILE_DEVICE_KSEC, API::File::FILE_DEVICE_MAILSLOT, API::File::FILE_DEVICE_MASS_STORAGE, API::File::FILE_DEVICE_MIDI_IN, API::File::FILE_DEVICE_MIDI_OUT, API::File::FILE_DEVICE_MODEM, API::File::FILE_DEVICE_MOUSE, API::File::FILE_DEVICE_MT_COMPOSITE, API::File::FILE_DEVICE_MT_TRANSPORT, API::File::FILE_DEVICE_MULTI_UNC_PROVIDER, API::File::FILE_DEVICE_NAMED_PIPE, API::File::FILE_DEVICE_NETWORK, API::File::FILE_DEVICE_NETWORK_BROWSER, API::File::FILE_DEVICE_NETWORK_FILE_SYSTEM, API::File::FILE_DEVICE_NETWORK_REDIRECTOR, API::File::FILE_DEVICE_NULL, API::File::FILE_DEVICE_PARALLEL_PORT, API::File::FILE_DEVICE_PHYSICAL_NETCARD, API::File::FILE_DEVICE_PMI, API::File::FILE_DEVICE_PRINTER, API::File::FILE_DEVICE_SCANNER, API::File::FILE_DEVICE_SCREEN, API::File::FILE_DEVICE_SERENUM, API::File::FILE_DEVICE_SERIAL_MOUSE_PORT, API::File::FILE_DEVICE_SERIAL_PORT, API::File::FILE_DEVICE_SMARTCARD, API::File::FILE_DEVICE_SMB, API::File::FILE_DEVICE_SOUND, API::File::FILE_DEVICE_STREAMS, API::File::FILE_DEVICE_TAPE, API::File::FILE_DEVICE_TAPE_FILE_SYSTEM, API::File::FILE_DEVICE_TERMSRV, API::File::FILE_DEVICE_TRANSPORT, API::File::FILE_DEVICE_UNKNOWN, API::File::FILE_DEVICE_VDM, API::File::FILE_DEVICE_VIDEO, API::File::FILE_DEVICE_VIRTUAL_DISK, API::File::FILE_DEVICE_VMBUS, API::File::FILE_DEVICE_WAVE_IN, API::File::FILE_DEVICE_WAVE_OUT, API::File::FILE_DEVICE_WPD, API::File::FILE_FLAG_BACKUP_SEMANTICS, API::File::FILE_FLAG_DELETE_ON_CLOSE, API::File::FILE_FLAG_FIRST_PIPE_INSTANCE, API::File::FILE_FLAG_NO_BUFFERING, API::File::FILE_FLAG_OPEN_NO_RECALL, API::File::FILE_FLAG_OPEN_REPARSE_POINT, API::File::FILE_FLAG_OVERLAPPED, API::File::FILE_FLAG_POSIX_SEMANTICS, API::File::FILE_FLAG_RANDOM_ACCESS, API::File::FILE_FLAG_SEQUENTIAL_SCAN, API::File::FILE_FLAG_WRITE_THROUGH, API::File::FILE_NAME_NORMALIZED, API::File::FILE_NAME_OPENED, API::File::FILE_READ_ACCESS, API::File::FILE_SHARE_READ, API::File::FILE_SPECIAL_ACCESS, API::File::FILE_WRITE_ACCESS, API::File::FSCTL_GET_REPARSE_POINT, API::File::INVALID_FILE_ATTRIBUTES, API::File::INVALID_HANDLE_VALUE, API::File::IO_REPARSE_TAG_CSV, API::File::IO_REPARSE_TAG_DFS, API::File::IO_REPARSE_TAG_DFSR, API::File::IO_REPARSE_TAG_HSM, API::File::IO_REPARSE_TAG_HSM2, API::File::IO_REPARSE_TAG_MOUNT_POINT, API::File::IO_REPARSE_TAG_SIS, API::File::IO_REPARSE_TAG_SYMLINK, API::File::IO_REPARSE_TAG_WIM, API::File::MAXIMUM_REPARSE_DATA_BUFFER_SIZE, API::File::MAX_PATH, API::File::METHOD_BUFFERED, API::File::METHOD_DIRECT_FROM_HARDWARE, API::File::METHOD_DIRECT_TO_HARDWARE, API::File::METHOD_IN_DIRECT, API::File::METHOD_NEITHER, API::File::METHOD_OUT_DIRECT, API::File::OPEN_EXISTING, API::File::SYMBOLIC_LINK_FLAG_DIRECTORY
Constants included from API::System
API::System::PRODUCT_BUSINESS, API::System::PRODUCT_BUSINESS_N, API::System::PRODUCT_CLUSTER_SERVER, API::System::PRODUCT_DATACENTER_SERVER, API::System::PRODUCT_DATACENTER_SERVER_CORE, API::System::PRODUCT_DATACENTER_SERVER_CORE_V, API::System::PRODUCT_DATACENTER_SERVER_V, API::System::PRODUCT_ENTERPRISE, API::System::PRODUCT_ENTERPRISE_E, API::System::PRODUCT_ENTERPRISE_N, API::System::PRODUCT_ENTERPRISE_SERVER, API::System::PRODUCT_ENTERPRISE_SERVER_CORE, API::System::PRODUCT_ENTERPRISE_SERVER_CORE_V, API::System::PRODUCT_ENTERPRISE_SERVER_IA64, API::System::PRODUCT_ENTERPRISE_SERVER_V, API::System::PRODUCT_HOME_BASIC, API::System::PRODUCT_HOME_BASIC_E, API::System::PRODUCT_HOME_BASIC_N, API::System::PRODUCT_HOME_PREMIUM, API::System::PRODUCT_HOME_PREMIUM_E, API::System::PRODUCT_HOME_PREMIUM_N, API::System::PRODUCT_HOME_PREMIUM_SERVER, API::System::PRODUCT_HOME_SERVER, API::System::PRODUCT_HYPERV, API::System::PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT, API::System::PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING, API::System::PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY, API::System::PRODUCT_PROFESSIONAL, API::System::PRODUCT_PROFESSIONAL_E, API::System::PRODUCT_PROFESSIONAL_N, API::System::PRODUCT_SB_SOLUTION_SERVER, API::System::PRODUCT_SERVER_FOR_SMALLBUSINESS, API::System::PRODUCT_SERVER_FOR_SMALLBUSINESS_V, API::System::PRODUCT_SERVER_FOUNDATION, API::System::PRODUCT_SMALLBUSINESS_SERVER, API::System::PRODUCT_SOLUTION_EMBEDDEDSERVER, API::System::PRODUCT_STANDARD_SERVER, API::System::PRODUCT_STANDARD_SERVER_CORE, API::System::PRODUCT_STANDARD_SERVER_CORE_V, API::System::PRODUCT_STANDARD_SERVER_V, API::System::PRODUCT_STARTER, API::System::PRODUCT_STARTER_E, API::System::PRODUCT_STARTER_N, API::System::PRODUCT_STORAGE_ENTERPRISE_SERVER, API::System::PRODUCT_STORAGE_EXPRESS_SERVER, API::System::PRODUCT_STORAGE_STANDARD_SERVER, API::System::PRODUCT_STORAGE_WORKGROUP_SERVER, API::System::PRODUCT_ULTIMATE, API::System::PRODUCT_ULTIMATE_E, API::System::PRODUCT_ULTIMATE_N, API::System::PRODUCT_UNDEFINED, API::System::PRODUCT_WEB_SERVER, API::System::PRODUCT_WEB_SERVER_CORE, API::System::SM_SERVERR2, API::System::VER_NT_DOMAIN_CONTROLLER, API::System::VER_NT_SERVER, API::System::VER_NT_WORKSTATION, API::System::VER_SUITE_BACKOFFICE, API::System::VER_SUITE_BLADE, API::System::VER_SUITE_COMPUTE_SERVER, API::System::VER_SUITE_DATACENTER, API::System::VER_SUITE_EMBEDDEDNT, API::System::VER_SUITE_ENTERPRISE, API::System::VER_SUITE_PERSONAL, API::System::VER_SUITE_SINGLEUSERTS, API::System::VER_SUITE_SMALLBUSINESS, API::System::VER_SUITE_SMALLBUSINESS_RESTRICTED, API::System::VER_SUITE_STORAGE_SERVER, API::System::VER_SUITE_TERMINAL, API::System::VER_SUITE_WH_SERVER
Constants included from API::Security
API::Security::ACCESS_ALLOWED_ACE_TYPE, API::Security::ACCESS_ALLOWED_CALLBACK_ACE_TYPE, API::Security::ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE, API::Security::ACCESS_ALLOWED_COMPOUND_ACE_TYPE, API::Security::ACCESS_ALLOWED_OBJECT_ACE_TYPE, API::Security::ACCESS_DENIED_ACE_TYPE, API::Security::ACCESS_DENIED_CALLBACK_ACE_TYPE, API::Security::ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE, API::Security::ACCESS_DENIED_OBJECT_ACE_TYPE, API::Security::ACCESS_MAX_MS_ACE_TYPE, API::Security::ACCESS_MAX_MS_OBJECT_ACE_TYPE, API::Security::ACCESS_MAX_MS_V2_ACE_TYPE, API::Security::ACCESS_MAX_MS_V3_ACE_TYPE, API::Security::ACCESS_MAX_MS_V4_ACE_TYPE, API::Security::ACCESS_MAX_MS_V5_ACE_TYPE, API::Security::ACCESS_MIN_MS_ACE_TYPE, API::Security::ACCESS_MIN_MS_OBJECT_ACE_TYPE, API::Security::ACCESS_SYSTEM_SECURITY, API::Security::ACL_REVISION, API::Security::ACL_REVISION1, API::Security::ACL_REVISION2, API::Security::ACL_REVISION3, API::Security::ACL_REVISION4, API::Security::ACL_REVISION_DS, API::Security::CONTAINER_INHERIT_ACE, API::Security::DACL_SECURITY_INFORMATION, API::Security::DELETE, API::Security::FAILED_ACCESS_ACE_FLAG, API::Security::FILE_ADD_FILE, API::Security::FILE_ADD_SUBDIRECTORY, API::Security::FILE_ALL_ACCESS, API::Security::FILE_APPEND_DATA, API::Security::FILE_CREATE_PIPE_INSTANCE, API::Security::FILE_DELETE_CHILD, API::Security::FILE_EXECUTE, API::Security::FILE_GENERIC_EXECUTE, API::Security::FILE_GENERIC_READ, API::Security::FILE_GENERIC_WRITE, API::Security::FILE_LIST_DIRECTORY, API::Security::FILE_READ_ATTRIBUTES, API::Security::FILE_READ_DATA, API::Security::FILE_READ_EA, API::Security::FILE_TRAVERSE, API::Security::FILE_WRITE_ATTRIBUTES, API::Security::FILE_WRITE_DATA, API::Security::FILE_WRITE_EA, API::Security::GENERIC_ALL, API::Security::GENERIC_EXECUTE, API::Security::GENERIC_READ, API::Security::GENERIC_WRITE, API::Security::GROUP_SECURITY_INFORMATION, API::Security::INHERITED_ACE, API::Security::INHERIT_ONLY_ACE, API::Security::LABEL_SECURITY_INFORMATION, API::Security::MAXDWORD, API::Security::MAX_ACL_REVISION, API::Security::MIN_ACL_REVISION, API::Security::NO_PROPAGATE_INHERIT_ACE, API::Security::OBJECT_INHERIT_ACE, API::Security::OWNER_SECURITY_INFORMATION, API::Security::PROTECTED_DACL_SECURITY_INFORMATION, API::Security::PROTECTED_SACL_SECURITY_INFORMATION, API::Security::READ_CONTROL, API::Security::SACL_SECURITY_INFORMATION, API::Security::SECURITY_DESCRIPTOR_MIN_LENGTH, API::Security::SECURITY_DESCRIPTOR_REVISION, API::Security::SECURITY_DESCRIPTOR_REVISION1, API::Security::SE_DACL_AUTO_INHERITED, API::Security::SE_DACL_AUTO_INHERIT_REQ, API::Security::SE_DACL_DEFAULTED, API::Security::SE_DACL_PRESENT, API::Security::SE_DACL_PROTECTED, API::Security::SE_GROUP_DEFAULTED, API::Security::SE_OBJECT_TYPE, API::Security::SE_OWNER_DEFAULTED, API::Security::SE_PRIVILEGE_ENABLED, API::Security::SE_PRIVILEGE_ENABLED_BY_DEFAULT, API::Security::SE_PRIVILEGE_REMOVED, API::Security::SE_PRIVILEGE_USED_FOR_ACCESS, API::Security::SE_PRIVILEGE_VALID_ATTRIBUTES, API::Security::SE_RM_CONTROL_VALID, API::Security::SE_SACL_AUTO_INHERITED, API::Security::SE_SACL_AUTO_INHERIT_REQ, API::Security::SE_SACL_DEFAULTED, API::Security::SE_SACL_PRESENT, API::Security::SE_SACL_PROTECTED, API::Security::SE_SELF_RELATIVE, API::Security::SID_NAME_USE, API::Security::SPECIFIC_RIGHTS_ALL, API::Security::STANDARD_RIGHTS_ALL, API::Security::STANDARD_RIGHTS_EXECUTE, API::Security::STANDARD_RIGHTS_READ, API::Security::STANDARD_RIGHTS_REQUIRED, API::Security::STANDARD_RIGHTS_WRITE, API::Security::SUCCESSFUL_ACCESS_ACE_FLAG, API::Security::SYNCHRONIZE, API::Security::SYSTEM_ALARM_ACE_TYPE, API::Security::SYSTEM_ALARM_CALLBACK_ACE_TYPE, API::Security::SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE, API::Security::SYSTEM_ALARM_OBJECT_ACE_TYPE, API::Security::SYSTEM_AUDIT_ACE_TYPE, API::Security::SYSTEM_AUDIT_CALLBACK_ACE_TYPE, API::Security::SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE, API::Security::SYSTEM_AUDIT_OBJECT_ACE_TYPE, API::Security::SYSTEM_MANDATORY_LABEL_ACE_TYPE, API::Security::TOKEN_ADJUST_DEFAULT, API::Security::TOKEN_ADJUST_GROUPS, API::Security::TOKEN_ADJUST_PRIVILEGES, API::Security::TOKEN_ADJUST_SESSIONID, API::Security::TOKEN_ALL_ACCESS, API::Security::TOKEN_ASSIGN_PRIMARY, API::Security::TOKEN_DUPLICATE, API::Security::TOKEN_IMPERSONATE, API::Security::TOKEN_QUERY, API::Security::TOKEN_QUERY_SOURCE, API::Security::TOKEN_READ, API::Security::UNPROTECTED_DACL_SECURITY_INFORMATION, API::Security::UNPROTECTED_SACL_SECURITY_INFORMATION, API::Security::VALID_INHERIT_FLAGS, API::Security::WRITE_DAC, API::Security::WRITE_OWNER
Instance Method Summary collapse
- #creation_time ⇒ Object (also: #ctime)
- #index ⇒ Object
- #initialize(file_name) ⇒ Info constructor
-
#ino ⇒ Object
we’re faking it here, but this is in the spirit of ino in *nix.
- #last_access_time ⇒ Object (also: #atime)
- #last_write_time ⇒ Object (also: #mtime)
- #links ⇒ Object
-
#parse_time(file_time_struct) ⇒ Object
given a
Chef::ReservedNames::Win32::API::File::FILETIME
structure convert into a RubyTime
object. - #size ⇒ Object
- #volume_serial_number ⇒ Object
Methods included from API::File
CTL_CODE, #encode_path, #file_handle, #file_search_handle, #path_prepender, #retrieve_file_info, #symlink_file_handle
Constructor Details
#initialize(file_name) ⇒ Info
35 36 37 38 |
# File 'lib/chef/win32/file/info.rb', line 35 def initialize(file_name) raise Errno::ENOENT, file_name unless ::File.exist?(file_name) @file_info = retrieve_file_info(file_name) end |
Instance Method Details
#creation_time ⇒ Object Also known as: ctime
52 53 54 |
# File 'lib/chef/win32/file/info.rb', line 52 def creation_time parse_time(@file_info[:ft_creation_time]) end |
#index ⇒ Object
44 45 46 |
# File 'lib/chef/win32/file/info.rb', line 44 def index make_uint64(@file_info[:n_file_index_low], @file_info[:n_file_index_high]) end |
#ino ⇒ Object
we’re faking it here, but this is in the spirit of ino in *nix
from MSDN:
“The identifier (low and high parts) and the volume serial number uniquely identify a file on a single computer. To determine whether two open handles represent the same file, combine the identifier and the volume serial number for each file and compare them.”“
83 84 85 |
# File 'lib/chef/win32/file/info.rb', line 83 def ino volume_serial_number + index end |
#last_access_time ⇒ Object Also known as: atime
48 49 50 |
# File 'lib/chef/win32/file/info.rb', line 48 def last_access_time parse_time(@file_info[:ft_last_access_time]) end |
#last_write_time ⇒ Object Also known as: mtime
56 57 58 |
# File 'lib/chef/win32/file/info.rb', line 56 def last_write_time parse_time(@file_info[:ft_last_write_time]) end |
#links ⇒ Object
60 61 62 |
# File 'lib/chef/win32/file/info.rb', line 60 def links @file_info[:n_number_of_links] end |
#parse_time(file_time_struct) ⇒ Object
given a Chef::ReservedNames::Win32::API::File::FILETIME
structure convert into a Ruby Time
object.
91 92 93 94 |
# File 'lib/chef/win32/file/info.rb', line 91 def parse_time(file_time_struct) wtime_to_time(make_uint64(file_time_struct[:dw_low_date_time], file_time_struct[:dw_high_date_time])) end |
#size ⇒ Object
64 65 66 |
# File 'lib/chef/win32/file/info.rb', line 64 def size make_uint64(@file_info[:n_file_size_low], @file_info[:n_file_size_high]) end |
#volume_serial_number ⇒ Object
40 41 42 |
# File 'lib/chef/win32/file/info.rb', line 40 def volume_serial_number @file_info[:dw_volume_serial_number] end |