vagrant-unbundled 2.0.3.0 → 2.0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +43 -10
- data/Gemfile.lock +16 -2
- data/README.md +1 -0
- data/bin/vagrant +1 -1
- data/lib/vagrant/action/builtin/handle_box.rb +1 -1
- data/lib/vagrant/action/general/package.rb +1 -1
- data/lib/vagrant/action.rb +3 -1
- data/lib/vagrant/alias.rb +56 -0
- data/lib/vagrant/bundler.rb +1 -1
- data/lib/vagrant/capability_host.rb +1 -1
- data/lib/vagrant/cli.rb +8 -0
- data/lib/vagrant/config/version_base.rb +1 -1
- data/lib/vagrant/environment.rb +7 -1
- data/lib/vagrant/errors.rb +4 -0
- data/lib/vagrant/host.rb +1 -1
- data/lib/vagrant/machine.rb +1 -1
- data/lib/vagrant/machine_index.rb +1 -1
- data/lib/vagrant/plugin/v1/guest.rb +1 -1
- data/lib/vagrant/plugin/v1/host.rb +1 -1
- data/lib/vagrant/plugin/v1/plugin.rb +1 -1
- data/lib/vagrant/plugin/v1/provider.rb +1 -1
- data/lib/vagrant/plugin/v2/guest.rb +1 -1
- data/lib/vagrant/plugin/v2/host.rb +1 -1
- data/lib/vagrant/plugin/v2/plugin.rb +1 -1
- data/lib/vagrant/plugin/v2/provider.rb +1 -1
- data/lib/vagrant/shared_helpers.rb +30 -9
- data/lib/vagrant/util/checkpoint_client.rb +8 -0
- data/lib/vagrant/util/downloader.rb +1 -1
- data/lib/vagrant/util/platform.rb +11 -3
- data/lib/vagrant/util/powershell.rb +17 -1
- data/lib/vagrant/util/safe_exec.rb +1 -1
- data/lib/vagrant/util/ssh.rb +4 -1
- data/lib/vagrant/util/stacked_proc_runner.rb +1 -1
- data/lib/vagrant/util/template_renderer.rb +2 -2
- data/lib/vagrant/vagrantfile.rb +1 -1
- data/lib/vagrant.rb +8 -0
- data/plugins/commands/plugin/gem_helper.rb +1 -1
- data/plugins/commands/powershell/command.rb +2 -2
- data/plugins/commands/powershell/scripts/enable_psremoting.ps1 +1 -1
- data/plugins/communicators/ssh/communicator.rb +10 -1
- data/plugins/communicators/winrm/command_filters/mkdir.rb +4 -2
- data/plugins/communicators/winrm/command_filters/rm.rb +5 -3
- data/plugins/communicators/winrm/command_filters/test.rb +3 -1
- data/plugins/communicators/winrm/command_filters/which.rb +4 -2
- data/plugins/communicators/winrm/communicator.rb +3 -3
- data/plugins/guests/amazon/cap/flavor.rb +1 -1
- data/plugins/guests/coreos/cap/configure_networks.rb +1 -1
- data/plugins/guests/coreos/guest.rb +1 -1
- data/plugins/guests/debian/cap/configure_networks.rb +1 -1
- data/plugins/guests/freebsd/cap/configure_networks.rb +1 -1
- data/plugins/guests/photon/guest.rb +1 -1
- data/plugins/guests/windows/cap/change_host_name.rb +6 -1
- data/plugins/guests/windows/cap/mount_shared_folder.rb +1 -1
- data/plugins/hosts/alt/plugin.rb +1 -1
- data/plugins/hosts/arch/plugin.rb +1 -1
- data/plugins/hosts/gentoo/plugin.rb +1 -1
- data/plugins/hosts/linux/plugin.rb +1 -1
- data/plugins/hosts/redhat/plugin.rb +1 -1
- data/plugins/hosts/slackware/plugin.rb +2 -2
- data/plugins/kernel_v2/config/push.rb +1 -1
- data/plugins/kernel_v2/config/vm.rb +1 -1
- data/plugins/providers/docker/action/compare_synced_folders.rb +1 -1
- data/plugins/providers/virtualbox/action/network.rb +9 -5
- data/plugins/providers/virtualbox/action/network_fix_ipv6.rb +1 -1
- data/plugins/provisioners/chef/config/chef_zero.rb +1 -1
- data/plugins/provisioners/chef/provisioner/chef_solo.rb +2 -2
- data/plugins/provisioners/chef/provisioner/chef_zero.rb +3 -3
- data/plugins/provisioners/puppet/config/puppet.rb +2 -0
- data/plugins/provisioners/puppet/provisioner/puppet.rb +18 -1
- data/plugins/provisioners/salt/config.rb +6 -0
- data/plugins/provisioners/salt/provisioner.rb +11 -1
- data/templates/locales/command_ps.yml +1 -1
- data/templates/locales/en.yml +13 -4
- data/templates/locales/guest_windows.yml +1 -1
- data/templates/locales/providers_docker.yml +1 -1
- data/templates/locales/synced_folder_smb.yml +2 -2
- data/vagrant.gemspec +2 -0
- data/vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-f3daedaac493/vagrant-spec.gemspec +1 -1
- data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/.document +5 -0
- data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/.gitignore +17 -0
- data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/.travis.yml +21 -0
- data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/CHANGELOG.md +209 -0
- data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/Gemfile +4 -0
- data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/LICENSE.txt +78 -0
- data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/README.md +67 -0
- data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/Rakefile +88 -0
- data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/data/public_suffix_list.dat +12440 -0
- data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/domain_name.gemspec +36 -0
- data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/lib/domain_name/etld_data.rb +8474 -0
- data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/lib/domain_name/etld_data.rb.erb +11 -0
- data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/lib/domain_name/punycode.rb +283 -0
- data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/lib/domain_name/version.rb +3 -0
- data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/lib/domain_name.rb +297 -0
- data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/test/helper.rb +17 -0
- data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/test/test_domain_name-punycode.rb +97 -0
- data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/test/test_domain_name.rb +317 -0
- data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/tool/gen_etld_data.rb +63 -0
- data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/CHANGES +13 -0
- data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/LICENSE +201 -0
- data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/MANIFEST +9 -0
- data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/README +48 -0
- data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/Rakefile +42 -0
- data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/certs/djberg96_pub.pem +21 -0
- data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/ffi-win32-extensions.gemspec +25 -0
- data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/lib/ffi/win32/extensions.rb +96 -0
- data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/lib/ffi-win32-extensions.rb +1 -0
- data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/test/test_ffi_extensions.rb +41 -0
- data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/test/test_string_extensions.rb +20 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/CHANGES +235 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/MANIFEST +16 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/README +73 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/Rakefile +49 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/appveyor.yml +50 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/certs/djberg96_pub.pem +21 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32/file/constants.rb +33 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32/file/functions.rb +42 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32/file/structs.rb +54 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32/file.rb +585 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32-file.rb +1 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/test/test_win32_file_link.rb +141 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/test/test_win32_file_misc.rb +16 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/test/test_win32_file_path.rb +282 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/test/test_win32_file_stat.rb +330 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/win32-file.gemspec +33 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/CHANGES +63 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/MANIFEST +18 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/README +47 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/Rakefile +66 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/appveyor.yml +53 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/certs/djberg96_pub.pem +21 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/lib/win32/file/security/constants.rb +149 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/lib/win32/file/security/functions.rb +63 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/lib/win32/file/security/structs.rb +68 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/lib/win32/file/security.rb +963 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/lib/win32-file-security.rb +1 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_acls.rb +34 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_constants.rb +54 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_encryption.rb +90 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_ffi.rb +33 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_ownership.rb +174 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_permissions.rb +88 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_version.rb +14 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/win32-file-security.gemspec +28 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/CHANGES +169 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/MANIFEST +12 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/README +94 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/Rakefile +28 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/appveyor.yml +48 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/certs/djberg96_pub.pem +21 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/lib/win32/file/stat.rb +1008 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/lib/win32/file/windows/constants.rb +94 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/lib/win32/file/windows/functions.rb +68 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/lib/win32/file/windows/structs.rb +196 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/lib/win32-file-stat.rb +1 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/test/test_file_stat.rb +677 -0
- data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/win32-file-stat.gemspec +30 -0
- data/vendor/bundle/ruby/2.5.0/specifications/domain_name-0.5.20180417.gemspec +46 -0
- data/vendor/bundle/ruby/2.5.0/specifications/ffi-win32-extensions-1.0.3.gemspec +38 -0
- data/vendor/bundle/ruby/2.5.0/specifications/win32-file-0.8.1.gemspec +51 -0
- data/vendor/bundle/ruby/2.5.0/specifications/win32-file-security-1.0.10.gemspec +47 -0
- data/vendor/bundle/ruby/2.5.0/specifications/win32-file-stat-1.5.5.gemspec +48 -0
- data/version.txt +1 -1
- metadata +114 -2
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'ffi'
|
2
|
+
|
3
|
+
module Windows
|
4
|
+
module Stat
|
5
|
+
module Constants
|
6
|
+
private
|
7
|
+
|
8
|
+
MAX_PATH = 260
|
9
|
+
MAXDWORD = 0xFFFFFFFF
|
10
|
+
|
11
|
+
# Normally just FFI::Pointer.new(-1).address, but we need JRuby to work, too.
|
12
|
+
INVALID_HANDLE_VALUE = (1<<FFI::Platform::ADDRESS_SIZE)-1
|
13
|
+
|
14
|
+
ERROR_FILE_NOT_FOUND = 2
|
15
|
+
ERROR_NO_MORE_FILES = 18
|
16
|
+
ERROR_INSUFFICIENT_BUFFER = 122
|
17
|
+
|
18
|
+
FILE_TYPE_UNKNOWN = 0x0000
|
19
|
+
FILE_TYPE_DISK = 0x0001
|
20
|
+
FILE_TYPE_CHAR = 0x0002
|
21
|
+
FILE_TYPE_PIPE = 0x0003
|
22
|
+
FILE_TYPE_REMOTE = 0x8000
|
23
|
+
|
24
|
+
FILE_ATTRIBUTE_READONLY = 0x00000001
|
25
|
+
FILE_ATTRIBUTE_HIDDEN = 0x00000002
|
26
|
+
FILE_ATTRIBUTE_SYSTEM = 0x00000004
|
27
|
+
FILE_ATTRIBUTE_DIRECTORY = 0x00000010
|
28
|
+
FILE_ATTRIBUTE_ARCHIVE = 0x00000020
|
29
|
+
FILE_ATTRIBUTE_ENCRYPTED = 0x00000040
|
30
|
+
FILE_ATTRIBUTE_NORMAL = 0x00000080
|
31
|
+
FILE_ATTRIBUTE_TEMPORARY = 0x00000100
|
32
|
+
FILE_ATTRIBUTE_SPARSE_FILE = 0x00000200
|
33
|
+
FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400
|
34
|
+
FILE_ATTRIBUTE_COMPRESSED = 0x00000800
|
35
|
+
FILE_ATTRIBUTE_OFFLINE = 0x00001000
|
36
|
+
|
37
|
+
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 0x00002000
|
38
|
+
|
39
|
+
DRIVE_REMOVABLE = 2
|
40
|
+
DRIVE_CDROM = 5
|
41
|
+
DRIVE_RAMDISK = 6
|
42
|
+
|
43
|
+
NO_ERROR = 0
|
44
|
+
|
45
|
+
OPEN_EXISTING = 3
|
46
|
+
GENERIC_READ = 0x80000000
|
47
|
+
GENERIC_WRITE = 0x40000000
|
48
|
+
GENERIC_EXECUTE = 0x20000000
|
49
|
+
|
50
|
+
FILE_SHARE_READ = 1
|
51
|
+
|
52
|
+
FILE_FLAG_BACKUP_SEMANTICS = 0x02000000
|
53
|
+
FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000
|
54
|
+
IO_REPARSE_TAG_SYMLINK = 0xA000000C
|
55
|
+
|
56
|
+
OWNER_SECURITY_INFORMATION = 1
|
57
|
+
GROUP_SECURITY_INFORMATION = 2
|
58
|
+
DACL_SECURITY_INFORMATION = 4
|
59
|
+
|
60
|
+
SYNCHRONIZE = 0x00100000
|
61
|
+
STANDARD_RIGHTS_REQUIRED = 0x000F0000
|
62
|
+
|
63
|
+
FILE_READ_DATA = 0x0001
|
64
|
+
FILE_WRITE_DATA = 0x0002
|
65
|
+
FILE_APPEND_DATA = 0x0004
|
66
|
+
FILE_READ_EA = 0x0008
|
67
|
+
FILE_WRITE_EA = 0x0008
|
68
|
+
FILE_EXECUTE = 0x0020
|
69
|
+
FILE_READ_ATTRIBUTES = 0x0080
|
70
|
+
FILE_WRITE_ATTRIBUTES = 0x0100
|
71
|
+
|
72
|
+
READ_CONTROL = 0x00020000
|
73
|
+
STANDARD_RIGHTS_READ = READ_CONTROL
|
74
|
+
STANDARD_RIGHTS_WRITE = READ_CONTROL
|
75
|
+
STANDARD_RIGHTS_EXECUTE = READ_CONTROL
|
76
|
+
|
77
|
+
FILE_GENERIC_READ = (STANDARD_RIGHTS_READ|FILE_READ_DATA|FILE_READ_ATTRIBUTES|FILE_READ_EA|SYNCHRONIZE)
|
78
|
+
FILE_GENERIC_WRITE = (STANDARD_RIGHTS_WRITE|FILE_WRITE_DATA|FILE_WRITE_ATTRIBUTES|FILE_WRITE_EA|FILE_APPEND_DATA|SYNCHRONIZE)
|
79
|
+
FILE_GENERIC_EXECUTE = (STANDARD_RIGHTS_EXECUTE|FILE_READ_ATTRIBUTES|FILE_EXECUTE|SYNCHRONIZE)
|
80
|
+
FILE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1FF)
|
81
|
+
|
82
|
+
TOKEN_DUPLICATE = 0x0002
|
83
|
+
TOKEN_IMPERSONATE = 0x0004
|
84
|
+
TOKEN_QUERY = 0x0008
|
85
|
+
|
86
|
+
SecurityImpersonation = 2
|
87
|
+
|
88
|
+
TokenUser = 1
|
89
|
+
TokenGroups = 2
|
90
|
+
|
91
|
+
FileStreamInformation = 22
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'ffi'
|
2
|
+
|
3
|
+
module Windows
|
4
|
+
module Stat
|
5
|
+
module Functions
|
6
|
+
extend FFI::Library
|
7
|
+
|
8
|
+
# Wrapper method for attach_pfunc + private
|
9
|
+
def self.attach_pfunc(*args)
|
10
|
+
attach_function(*args)
|
11
|
+
private args[0]
|
12
|
+
end
|
13
|
+
|
14
|
+
typedef :ulong, :dword
|
15
|
+
typedef :pointer, :ptr
|
16
|
+
typedef :buffer_in, :buf_in
|
17
|
+
typedef :string, :str
|
18
|
+
typedef :long, :ntstatus
|
19
|
+
|
20
|
+
if RUBY_PLATFORM == 'java' && ENV_JAVA['sun.arch.data.model'] == '64'
|
21
|
+
typedef :ulong_long, :handle
|
22
|
+
else
|
23
|
+
typedef :uintptr_t, :handle
|
24
|
+
end
|
25
|
+
|
26
|
+
ffi_convention :stdcall
|
27
|
+
|
28
|
+
ffi_lib :kernel32
|
29
|
+
|
30
|
+
attach_pfunc :CloseHandle, [:handle], :bool
|
31
|
+
attach_pfunc :CreateFile, :CreateFileW, [:buf_in, :dword, :dword, :ptr, :dword, :dword, :handle], :handle
|
32
|
+
attach_pfunc :FindFirstFile, :FindFirstFileW, [:buf_in, :ptr], :handle
|
33
|
+
attach_pfunc :FindClose, [:handle], :bool
|
34
|
+
attach_pfunc :GetCurrentProcess, [], :handle
|
35
|
+
attach_pfunc :GetDiskFreeSpace, :GetDiskFreeSpaceW, [:buf_in, :ptr, :ptr, :ptr, :ptr], :bool
|
36
|
+
attach_pfunc :GetDriveType, :GetDriveTypeW, [:buf_in], :uint
|
37
|
+
attach_pfunc :GetFileInformationByHandle, [:handle, :ptr], :bool
|
38
|
+
attach_pfunc :GetFileType, [:handle], :dword
|
39
|
+
attach_pfunc :GetNamedPipeInfo, [:handle, :ptr, :ptr, :ptr, :ptr], :bool
|
40
|
+
attach_pfunc :OpenProcessToken, [:handle, :dword, :ptr], :bool
|
41
|
+
|
42
|
+
ffi_lib :shlwapi
|
43
|
+
|
44
|
+
attach_pfunc :PathGetDriveNumber, :PathGetDriveNumberW, [:buf_in], :int
|
45
|
+
attach_pfunc :PathIsUNC, :PathIsUNCW, [:buf_in], :bool
|
46
|
+
attach_pfunc :PathStripToRoot, :PathStripToRootW, [:ptr], :bool
|
47
|
+
|
48
|
+
ffi_lib :advapi32
|
49
|
+
|
50
|
+
attach_pfunc :ConvertSidToStringSid, :ConvertSidToStringSidA, [:ptr, :ptr], :bool
|
51
|
+
attach_pfunc :ConvertStringSidToSid, :ConvertStringSidToSidA, [:ptr, :ptr], :bool
|
52
|
+
attach_pfunc :GetFileSecurity, :GetFileSecurityW, [:buf_in, :int, :ptr, :dword, :ptr], :bool
|
53
|
+
attach_pfunc :GetSecurityDescriptorOwner, [:ptr, :ptr, :ptr], :bool
|
54
|
+
attach_pfunc :GetSecurityDescriptorGroup, [:ptr, :ptr, :ptr], :bool
|
55
|
+
attach_pfunc :GetTokenInformation, [:handle, :int, :ptr, :dword, :ptr], :bool
|
56
|
+
attach_pfunc :DuplicateToken, [:handle, :dword, :ptr], :bool
|
57
|
+
attach_pfunc :MapGenericMask, [:ptr, :ptr], :void
|
58
|
+
attach_pfunc :AccessCheck, [:ptr, :handle, :dword, :ptr, :ptr, :ptr, :ptr, :ptr], :bool
|
59
|
+
attach_pfunc :BuildTrusteeWithSid, :BuildTrusteeWithSidW, [:ptr, :ptr], :void
|
60
|
+
attach_pfunc :GetSecurityDescriptorDacl, [:ptr, :ptr, :ptr, :ptr], :bool
|
61
|
+
attach_pfunc :GetEffectiveRightsFromAcl, :GetEffectiveRightsFromAclW, [:ptr, :ptr, :ptr], :dword
|
62
|
+
|
63
|
+
ffi_lib :ntdll
|
64
|
+
|
65
|
+
attach_pfunc :NtQueryInformationFile, [:handle, :pointer, :pointer, :ulong, :int], :ntstatus
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,196 @@
|
|
1
|
+
require_relative 'constants'
|
2
|
+
|
3
|
+
require 'ffi'
|
4
|
+
|
5
|
+
module Windows
|
6
|
+
module Stat
|
7
|
+
module Structs
|
8
|
+
extend FFI::Library
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
class LowHighLarge < FFI::Struct
|
13
|
+
layout(:LowPart, :ulong, :HighPart, :long)
|
14
|
+
end
|
15
|
+
|
16
|
+
class LARGE_INTEGER < FFI::Union
|
17
|
+
layout(:u, LowHighLarge, :QuadPart, :long_long)
|
18
|
+
end
|
19
|
+
|
20
|
+
class FILE_STREAM_INFORMATION < FFI::Struct
|
21
|
+
layout(
|
22
|
+
:NextEntryOffset, :ulong,
|
23
|
+
:StreamNameLength, :ulong,
|
24
|
+
:StreamSize, LARGE_INTEGER,
|
25
|
+
:StreamAllocateSize, LARGE_INTEGER,
|
26
|
+
:StreamName, [:uchar, 256]
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
class IO_STATUS_BLOCK < FFI::Struct
|
31
|
+
layout(
|
32
|
+
:union, Class.new(FFI::Union){ layout(:Status, :long, :Pointer, :pointer) },
|
33
|
+
:Information, :uintptr_t
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
class LowHigh < FFI::Struct
|
38
|
+
layout(:LowPart, :ulong, :HighPart, :ulong)
|
39
|
+
end
|
40
|
+
|
41
|
+
class ULARGE_INTEGER < FFI::Union
|
42
|
+
layout(:u, LowHigh, :QuadPart, :ulong_long)
|
43
|
+
end
|
44
|
+
|
45
|
+
class FILETIME < FFI::Struct
|
46
|
+
layout(:dwLowDateTime, :ulong, :dwHighDateTime, :ulong)
|
47
|
+
end
|
48
|
+
|
49
|
+
class BY_HANDLE_FILE_INFORMATION < FFI::Struct
|
50
|
+
include Windows::Stat::Constants
|
51
|
+
|
52
|
+
layout(
|
53
|
+
:dwFileAttributes, :ulong,
|
54
|
+
:ftCreationTime, FILETIME,
|
55
|
+
:ftLastAccessTime, FILETIME,
|
56
|
+
:ftLastWriteTime, FILETIME,
|
57
|
+
:dwVolumeSerialNumber, :ulong,
|
58
|
+
:nFileSizeHigh, :ulong,
|
59
|
+
:nFileSizeLow, :ulong,
|
60
|
+
:nNumberOfLinks, :ulong,
|
61
|
+
:nFileIndexHigh, :ulong,
|
62
|
+
:nFileIndexLow, :ulong
|
63
|
+
)
|
64
|
+
|
65
|
+
# Return the atime as a number
|
66
|
+
def atime
|
67
|
+
date = ULARGE_INTEGER.new
|
68
|
+
date[:u][:LowPart] = self[:ftLastAccessTime][:dwLowDateTime]
|
69
|
+
date[:u][:HighPart] = self[:ftLastAccessTime][:dwHighDateTime]
|
70
|
+
date[:QuadPart] / 10000000 - 11644473600 # ns, 100-ns since Jan 1, 1601.
|
71
|
+
end
|
72
|
+
|
73
|
+
# Return the ctime as a number
|
74
|
+
def ctime
|
75
|
+
date = ULARGE_INTEGER.new
|
76
|
+
date[:u][:LowPart] = self[:ftCreationTime][:dwLowDateTime]
|
77
|
+
date[:u][:HighPart] = self[:ftCreationTime][:dwHighDateTime]
|
78
|
+
date[:QuadPart] / 10000000 - 11644473600 # ns, 100-ns since Jan 1, 1601.
|
79
|
+
end
|
80
|
+
|
81
|
+
# Return the mtime as a number
|
82
|
+
def mtime
|
83
|
+
date = ULARGE_INTEGER.new
|
84
|
+
date[:u][:LowPart] = self[:ftLastWriteTime][:dwLowDateTime]
|
85
|
+
date[:u][:HighPart] = self[:ftLastWriteTime][:dwHighDateTime]
|
86
|
+
date[:QuadPart] / 10000000 - 11644473600 # ns, 100-ns since Jan 1, 1601.
|
87
|
+
end
|
88
|
+
|
89
|
+
# Return the size as a single number
|
90
|
+
def size
|
91
|
+
(self[:nFileSizeHigh] * (MAXDWORD + 1)) + self[:nFileSizeLow]
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
class WIN32_FIND_DATA < FFI::Struct
|
96
|
+
include Windows::Stat::Constants
|
97
|
+
|
98
|
+
layout(
|
99
|
+
:dwFileAttributes, :ulong,
|
100
|
+
:ftCreationTime, FILETIME,
|
101
|
+
:ftLastAccessTime, FILETIME,
|
102
|
+
:ftLastWriteTime, FILETIME,
|
103
|
+
:nFileSizeHigh, :ulong,
|
104
|
+
:nFileSizeLow, :ulong,
|
105
|
+
:dwReserved0, :ulong,
|
106
|
+
:dwReserved1, :ulong,
|
107
|
+
:cFileName, [:uint8, MAX_PATH*2],
|
108
|
+
:cAlternateFileName, [:uint8, 28]
|
109
|
+
)
|
110
|
+
|
111
|
+
# Return the atime as a number
|
112
|
+
def atime
|
113
|
+
date = ULARGE_INTEGER.new
|
114
|
+
date[:u][:LowPart] = self[:ftLastAccessTime][:dwLowDateTime]
|
115
|
+
date[:u][:HighPart] = self[:ftLastAccessTime][:dwHighDateTime]
|
116
|
+
return 0 if date[:QuadPart]==0
|
117
|
+
date[:QuadPart] / 10000000 - 11644473600 # ns, 100-ns since Jan 1, 1601.
|
118
|
+
end
|
119
|
+
|
120
|
+
# Return the ctime as a number
|
121
|
+
def ctime
|
122
|
+
date = ULARGE_INTEGER.new
|
123
|
+
date[:u][:LowPart] = self[:ftCreationTime][:dwLowDateTime]
|
124
|
+
date[:u][:HighPart] = self[:ftCreationTime][:dwHighDateTime]
|
125
|
+
return 0 if date[:QuadPart]==0
|
126
|
+
date[:QuadPart] / 10000000 - 11644473600 # ns, 100-ns since Jan 1, 1601.
|
127
|
+
end
|
128
|
+
|
129
|
+
# Return the mtime as a number
|
130
|
+
def mtime
|
131
|
+
date = ULARGE_INTEGER.new
|
132
|
+
date[:u][:LowPart] = self[:ftLastWriteTime][:dwLowDateTime]
|
133
|
+
date[:u][:HighPart] = self[:ftLastWriteTime][:dwHighDateTime]
|
134
|
+
return 0 if date[:QuadPart]==0
|
135
|
+
date[:QuadPart] / 10000000 - 11644473600 # ns, 100-ns since Jan 1, 1601.
|
136
|
+
end
|
137
|
+
|
138
|
+
# Return the size as a single number
|
139
|
+
def size
|
140
|
+
(self[:nFileSizeHigh] * (MAXDWORD + 1)) + self[:nFileSizeLow]
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
class SID_AND_ATTRIBUTES < FFI::Struct
|
145
|
+
layout(:Sid, :pointer, :Attributes, :ulong)
|
146
|
+
end
|
147
|
+
|
148
|
+
class TOKEN_GROUP < FFI::Struct
|
149
|
+
layout(
|
150
|
+
:GroupCount, :ulong,
|
151
|
+
:Groups, [SID_AND_ATTRIBUTES, 128]
|
152
|
+
)
|
153
|
+
end
|
154
|
+
|
155
|
+
class TOKEN_USER < FFI::Struct
|
156
|
+
layout(
|
157
|
+
:User, SID_AND_ATTRIBUTES
|
158
|
+
)
|
159
|
+
end
|
160
|
+
|
161
|
+
class GENERIC_MAPPING < FFI::Struct
|
162
|
+
layout(
|
163
|
+
:GenericRead, :ulong,
|
164
|
+
:GenericWrite, :ulong,
|
165
|
+
:GenericExecute, :ulong,
|
166
|
+
:GenericAll, :ulong
|
167
|
+
)
|
168
|
+
end
|
169
|
+
|
170
|
+
class LUID_AND_ATTRIBUTES < FFI::Struct
|
171
|
+
layout(
|
172
|
+
:Luid, LowHigh,
|
173
|
+
:Attributes, :ulong
|
174
|
+
)
|
175
|
+
end
|
176
|
+
|
177
|
+
class PRIVILEGE_SET < FFI::Struct
|
178
|
+
layout(
|
179
|
+
:PrivilegeCount, :ulong,
|
180
|
+
:Control, :ulong,
|
181
|
+
:Privilege, [LUID_AND_ATTRIBUTES, 1]
|
182
|
+
)
|
183
|
+
end
|
184
|
+
|
185
|
+
class TRUSTEE < FFI::Struct
|
186
|
+
layout(
|
187
|
+
:pMultipleTrustee, :pointer,
|
188
|
+
:MultipleTrusteeOperation, :ulong,
|
189
|
+
:TrusteeForm, :ulong,
|
190
|
+
:TrusteeType, :ulong,
|
191
|
+
:ptstrName, :pointer
|
192
|
+
)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require_relative 'win32/file/stat'
|