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.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +43 -10
  3. data/Gemfile.lock +16 -2
  4. data/README.md +1 -0
  5. data/bin/vagrant +1 -1
  6. data/lib/vagrant/action/builtin/handle_box.rb +1 -1
  7. data/lib/vagrant/action/general/package.rb +1 -1
  8. data/lib/vagrant/action.rb +3 -1
  9. data/lib/vagrant/alias.rb +56 -0
  10. data/lib/vagrant/bundler.rb +1 -1
  11. data/lib/vagrant/capability_host.rb +1 -1
  12. data/lib/vagrant/cli.rb +8 -0
  13. data/lib/vagrant/config/version_base.rb +1 -1
  14. data/lib/vagrant/environment.rb +7 -1
  15. data/lib/vagrant/errors.rb +4 -0
  16. data/lib/vagrant/host.rb +1 -1
  17. data/lib/vagrant/machine.rb +1 -1
  18. data/lib/vagrant/machine_index.rb +1 -1
  19. data/lib/vagrant/plugin/v1/guest.rb +1 -1
  20. data/lib/vagrant/plugin/v1/host.rb +1 -1
  21. data/lib/vagrant/plugin/v1/plugin.rb +1 -1
  22. data/lib/vagrant/plugin/v1/provider.rb +1 -1
  23. data/lib/vagrant/plugin/v2/guest.rb +1 -1
  24. data/lib/vagrant/plugin/v2/host.rb +1 -1
  25. data/lib/vagrant/plugin/v2/plugin.rb +1 -1
  26. data/lib/vagrant/plugin/v2/provider.rb +1 -1
  27. data/lib/vagrant/shared_helpers.rb +30 -9
  28. data/lib/vagrant/util/checkpoint_client.rb +8 -0
  29. data/lib/vagrant/util/downloader.rb +1 -1
  30. data/lib/vagrant/util/platform.rb +11 -3
  31. data/lib/vagrant/util/powershell.rb +17 -1
  32. data/lib/vagrant/util/safe_exec.rb +1 -1
  33. data/lib/vagrant/util/ssh.rb +4 -1
  34. data/lib/vagrant/util/stacked_proc_runner.rb +1 -1
  35. data/lib/vagrant/util/template_renderer.rb +2 -2
  36. data/lib/vagrant/vagrantfile.rb +1 -1
  37. data/lib/vagrant.rb +8 -0
  38. data/plugins/commands/plugin/gem_helper.rb +1 -1
  39. data/plugins/commands/powershell/command.rb +2 -2
  40. data/plugins/commands/powershell/scripts/enable_psremoting.ps1 +1 -1
  41. data/plugins/communicators/ssh/communicator.rb +10 -1
  42. data/plugins/communicators/winrm/command_filters/mkdir.rb +4 -2
  43. data/plugins/communicators/winrm/command_filters/rm.rb +5 -3
  44. data/plugins/communicators/winrm/command_filters/test.rb +3 -1
  45. data/plugins/communicators/winrm/command_filters/which.rb +4 -2
  46. data/plugins/communicators/winrm/communicator.rb +3 -3
  47. data/plugins/guests/amazon/cap/flavor.rb +1 -1
  48. data/plugins/guests/coreos/cap/configure_networks.rb +1 -1
  49. data/plugins/guests/coreos/guest.rb +1 -1
  50. data/plugins/guests/debian/cap/configure_networks.rb +1 -1
  51. data/plugins/guests/freebsd/cap/configure_networks.rb +1 -1
  52. data/plugins/guests/photon/guest.rb +1 -1
  53. data/plugins/guests/windows/cap/change_host_name.rb +6 -1
  54. data/plugins/guests/windows/cap/mount_shared_folder.rb +1 -1
  55. data/plugins/hosts/alt/plugin.rb +1 -1
  56. data/plugins/hosts/arch/plugin.rb +1 -1
  57. data/plugins/hosts/gentoo/plugin.rb +1 -1
  58. data/plugins/hosts/linux/plugin.rb +1 -1
  59. data/plugins/hosts/redhat/plugin.rb +1 -1
  60. data/plugins/hosts/slackware/plugin.rb +2 -2
  61. data/plugins/kernel_v2/config/push.rb +1 -1
  62. data/plugins/kernel_v2/config/vm.rb +1 -1
  63. data/plugins/providers/docker/action/compare_synced_folders.rb +1 -1
  64. data/plugins/providers/virtualbox/action/network.rb +9 -5
  65. data/plugins/providers/virtualbox/action/network_fix_ipv6.rb +1 -1
  66. data/plugins/provisioners/chef/config/chef_zero.rb +1 -1
  67. data/plugins/provisioners/chef/provisioner/chef_solo.rb +2 -2
  68. data/plugins/provisioners/chef/provisioner/chef_zero.rb +3 -3
  69. data/plugins/provisioners/puppet/config/puppet.rb +2 -0
  70. data/plugins/provisioners/puppet/provisioner/puppet.rb +18 -1
  71. data/plugins/provisioners/salt/config.rb +6 -0
  72. data/plugins/provisioners/salt/provisioner.rb +11 -1
  73. data/templates/locales/command_ps.yml +1 -1
  74. data/templates/locales/en.yml +13 -4
  75. data/templates/locales/guest_windows.yml +1 -1
  76. data/templates/locales/providers_docker.yml +1 -1
  77. data/templates/locales/synced_folder_smb.yml +2 -2
  78. data/vagrant.gemspec +2 -0
  79. data/vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-spec-f3daedaac493/vagrant-spec.gemspec +1 -1
  80. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/.document +5 -0
  81. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/.gitignore +17 -0
  82. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/.travis.yml +21 -0
  83. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/CHANGELOG.md +209 -0
  84. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/Gemfile +4 -0
  85. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/LICENSE.txt +78 -0
  86. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/README.md +67 -0
  87. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/Rakefile +88 -0
  88. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/data/public_suffix_list.dat +12440 -0
  89. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/domain_name.gemspec +36 -0
  90. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/lib/domain_name/etld_data.rb +8474 -0
  91. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/lib/domain_name/etld_data.rb.erb +11 -0
  92. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/lib/domain_name/punycode.rb +283 -0
  93. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/lib/domain_name/version.rb +3 -0
  94. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/lib/domain_name.rb +297 -0
  95. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/test/helper.rb +17 -0
  96. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/test/test_domain_name-punycode.rb +97 -0
  97. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/test/test_domain_name.rb +317 -0
  98. data/vendor/bundle/ruby/2.5.0/gems/domain_name-0.5.20180417/tool/gen_etld_data.rb +63 -0
  99. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/CHANGES +13 -0
  100. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/LICENSE +201 -0
  101. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/MANIFEST +9 -0
  102. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/README +48 -0
  103. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/Rakefile +42 -0
  104. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/certs/djberg96_pub.pem +21 -0
  105. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/ffi-win32-extensions.gemspec +25 -0
  106. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/lib/ffi/win32/extensions.rb +96 -0
  107. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/lib/ffi-win32-extensions.rb +1 -0
  108. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/test/test_ffi_extensions.rb +41 -0
  109. data/vendor/bundle/ruby/2.5.0/gems/ffi-win32-extensions-1.0.3/test/test_string_extensions.rb +20 -0
  110. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/CHANGES +235 -0
  111. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/MANIFEST +16 -0
  112. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/README +73 -0
  113. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/Rakefile +49 -0
  114. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/appveyor.yml +50 -0
  115. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/certs/djberg96_pub.pem +21 -0
  116. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32/file/constants.rb +33 -0
  117. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32/file/functions.rb +42 -0
  118. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32/file/structs.rb +54 -0
  119. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32/file.rb +585 -0
  120. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/lib/win32-file.rb +1 -0
  121. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/test/test_win32_file_link.rb +141 -0
  122. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/test/test_win32_file_misc.rb +16 -0
  123. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/test/test_win32_file_path.rb +282 -0
  124. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/test/test_win32_file_stat.rb +330 -0
  125. data/vendor/bundle/ruby/2.5.0/gems/win32-file-0.8.1/win32-file.gemspec +33 -0
  126. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/CHANGES +63 -0
  127. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/MANIFEST +18 -0
  128. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/README +47 -0
  129. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/Rakefile +66 -0
  130. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/appveyor.yml +53 -0
  131. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/certs/djberg96_pub.pem +21 -0
  132. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/lib/win32/file/security/constants.rb +149 -0
  133. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/lib/win32/file/security/functions.rb +63 -0
  134. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/lib/win32/file/security/structs.rb +68 -0
  135. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/lib/win32/file/security.rb +963 -0
  136. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/lib/win32-file-security.rb +1 -0
  137. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_acls.rb +34 -0
  138. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_constants.rb +54 -0
  139. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_encryption.rb +90 -0
  140. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_ffi.rb +33 -0
  141. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_ownership.rb +174 -0
  142. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_permissions.rb +88 -0
  143. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/test/test_win32_file_security_version.rb +14 -0
  144. data/vendor/bundle/ruby/2.5.0/gems/win32-file-security-1.0.10/win32-file-security.gemspec +28 -0
  145. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/CHANGES +169 -0
  146. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/MANIFEST +12 -0
  147. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/README +94 -0
  148. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/Rakefile +28 -0
  149. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/appveyor.yml +48 -0
  150. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/certs/djberg96_pub.pem +21 -0
  151. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/lib/win32/file/stat.rb +1008 -0
  152. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/lib/win32/file/windows/constants.rb +94 -0
  153. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/lib/win32/file/windows/functions.rb +68 -0
  154. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/lib/win32/file/windows/structs.rb +196 -0
  155. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/lib/win32-file-stat.rb +1 -0
  156. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/test/test_file_stat.rb +677 -0
  157. data/vendor/bundle/ruby/2.5.0/gems/win32-file-stat-1.5.5/win32-file-stat.gemspec +30 -0
  158. data/vendor/bundle/ruby/2.5.0/specifications/domain_name-0.5.20180417.gemspec +46 -0
  159. data/vendor/bundle/ruby/2.5.0/specifications/ffi-win32-extensions-1.0.3.gemspec +38 -0
  160. data/vendor/bundle/ruby/2.5.0/specifications/win32-file-0.8.1.gemspec +51 -0
  161. data/vendor/bundle/ruby/2.5.0/specifications/win32-file-security-1.0.10.gemspec +47 -0
  162. data/vendor/bundle/ruby/2.5.0/specifications/win32-file-stat-1.5.5.gemspec +48 -0
  163. data/version.txt +1 -1
  164. metadata +114 -2
@@ -0,0 +1,149 @@
1
+ module Windows
2
+ module File
3
+ module Constants
4
+ SE_DACL_PRESENT = 4
5
+ OWNER_SECURITY_INFORMATION = 1
6
+ GROUP_SECURITY_INFORMATION = 2
7
+ DACL_SECURITY_INFORMATION = 4
8
+ ACCESS_ALLOWED_ACE_TYPE = 0
9
+ ERROR_INSUFFICIENT_BUFFER = 122
10
+ ACL_REVISION2 = 2
11
+ ALLOW_ACE_LENGTH = 62
12
+ OBJECT_INHERIT_ACE = 0x1
13
+ CONTAINER_INHERIT_ACE = 0x2
14
+ INHERIT_ONLY_ACE = 0x8
15
+ MAXDWORD = 0xFFFFFFFF
16
+ TOKEN_QUERY = 0x00000008
17
+ TOKEN_ADJUST_PRIVILEGES = 0x0020
18
+
19
+ ERROR_NOT_SUPPORTED = 50
20
+ ERROR_NO_SECURITY_ON_OBJECT = 1350
21
+
22
+ TokenUser = 1
23
+ TokenGroups = 2
24
+
25
+ SECURITY_DESCRIPTOR_REVISION = 1
26
+ SECURITY_DESCRIPTOR_MIN_LENGTH = 20
27
+
28
+ SE_KERNEL_OBJECT = 6
29
+ SE_FILE_OBJECT = 1
30
+ SE_PRIVILEGE_ENABLED = 0x00000002
31
+ SE_SECURITY_NAME = "SeSecurityPrivilege"
32
+ SE_TAKE_OWNERSHIP_NAME = "SeTakeOwnershipPrivilege"
33
+ SE_BACKUP_NAME = "SeBackupPrivilege"
34
+ SE_RESTORE_NAME = "SeRestorePrivilege"
35
+ SE_CHANGE_NOTIFY_NAME = "SeChangeNotifyPrivilege"
36
+
37
+ ## Security Rights
38
+
39
+ SYNCHRONIZE = 0x100000
40
+ STANDARD_RIGHTS_REQUIRED = 0xf0000
41
+ STANDARD_RIGHTS_READ = 0x20000
42
+ STANDARD_RIGHTS_WRITE = 0x20000
43
+ STANDARD_RIGHTS_EXECUTE = 0x20000
44
+ STANDARD_RIGHTS_ALL = 0x1F0000
45
+ SPECIFIC_RIGHTS_ALL = 0xFFFF
46
+ ACCESS_SYSTEM_SECURITY = 0x1000000
47
+ MAXIMUM_ALLOWED = 0x2000000
48
+ GENERIC_READ = 0x80000000
49
+ GENERIC_WRITE = 0x40000000
50
+ GENERIC_EXECUTE = 0x20000000
51
+ GENERIC_ALL = 0x10000000
52
+ GENERIC_RIGHTS_CHK = 0xF0000000
53
+ REST_RIGHTS_MASK = 0x001FFFFF
54
+ READ_CONTROL = 0x20000
55
+ WRITE_DAC = 0x40000
56
+ WRITE_OWNER = 0x80000
57
+
58
+ FILE_READ_DATA = 1
59
+ FILE_LIST_DIRECTORY = 1
60
+ FILE_WRITE_DATA = 2
61
+ FILE_ADD_FILE = 2
62
+ FILE_APPEND_DATA = 4
63
+ FILE_ADD_SUBDIRECTORY = 4
64
+ FILE_CREATE_PIPE_INSTANCE = 4
65
+ FILE_READ_EA = 8
66
+ FILE_READ_PROPERTIES = 8
67
+ FILE_WRITE_EA = 16
68
+ FILE_WRITE_PROPERTIES = 16
69
+ FILE_EXECUTE = 32
70
+ FILE_TRAVERSE = 32
71
+ FILE_DELETE_CHILD = 64
72
+ FILE_READ_ATTRIBUTES = 128
73
+ FILE_WRITE_ATTRIBUTES = 256
74
+
75
+ FILE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF
76
+
77
+ FILE_GENERIC_READ =
78
+ STANDARD_RIGHTS_READ |
79
+ FILE_READ_DATA |
80
+ FILE_READ_ATTRIBUTES |
81
+ FILE_READ_EA |
82
+ SYNCHRONIZE
83
+
84
+ FILE_GENERIC_WRITE =
85
+ STANDARD_RIGHTS_WRITE |
86
+ FILE_WRITE_DATA |
87
+ FILE_WRITE_ATTRIBUTES |
88
+ FILE_WRITE_EA |
89
+ FILE_APPEND_DATA |
90
+ SYNCHRONIZE
91
+
92
+ FILE_GENERIC_EXECUTE =
93
+ STANDARD_RIGHTS_EXECUTE |
94
+ FILE_READ_ATTRIBUTES |
95
+ FILE_EXECUTE |
96
+ SYNCHRONIZE
97
+
98
+ FILE_SHARE_READ = 1
99
+ FILE_SHARE_WRITE = 2
100
+ FILE_SHARE_DELETE = 4
101
+ FILE_NOTIFY_CHANGE_FILE_NAME = 1
102
+ FILE_NOTIFY_CHANGE_DIR_NAME = 2
103
+ FILE_NOTIFY_CHANGE_ATTRIBUTES = 4
104
+ FILE_NOTIFY_CHANGE_SIZE = 8
105
+ FILE_NOTIFY_CHANGE_LAST_WRITE = 16
106
+ FILE_NOTIFY_CHANGE_LAST_ACCESS = 32
107
+ FILE_NOTIFY_CHANGE_CREATION = 64
108
+ FILE_NOTIFY_CHANGE_SECURITY = 256
109
+ FILE_CASE_SENSITIVE_SEARCH = 1
110
+ FILE_CASE_PRESERVED_NAMES = 2
111
+ FILE_UNICODE_ON_DISK = 4
112
+ FILE_PERSISTENT_ACLS = 8
113
+ FILE_FILE_COMPRESSION = 16
114
+ FILE_VOLUME_QUOTAS = 32
115
+ FILE_SUPPORTS_SPARSE_FILES = 64
116
+ FILE_SUPPORTS_REPARSE_POINTS = 128
117
+ FILE_SUPPORTS_REMOTE_STORAGE = 256
118
+ FILE_VOLUME_IS_COMPRESSED = 0x8000
119
+ FILE_SUPPORTS_OBJECT_IDS = 0x10000
120
+ FILE_SUPPORTS_ENCRYPTION = 0x20000
121
+
122
+ FILE_ENCRYPTABLE = 0
123
+ FILE_IS_ENCRYPTED = 1
124
+ FILE_ROOT_DIR = 3
125
+ FILE_SYSTEM_ATTR = 2
126
+ FILE_SYSTEM_DIR = 4
127
+ FILE_UNKNOWN = 5
128
+ FILE_SYSTEM_NOT_SUPPORT = 6
129
+ FILE_READ_ONLY = 8
130
+
131
+ # Read and execute privileges
132
+ READ = FILE_GENERIC_READ | FILE_EXECUTE
133
+
134
+ # Add privileges
135
+ ADD = 0x001201bf
136
+
137
+ # Delete privileges
138
+ DELETE = 0x00010000
139
+
140
+ # Generic write, generic read, execute and delete privileges
141
+ CHANGE = FILE_GENERIC_WRITE | FILE_GENERIC_READ | FILE_EXECUTE | DELETE
142
+
143
+ # Full security rights - read, write, append, execute, and delete.
144
+ FULL = STANDARD_RIGHTS_ALL | FILE_READ_DATA | FILE_WRITE_DATA |
145
+ FILE_APPEND_DATA | FILE_READ_EA | FILE_WRITE_EA | FILE_EXECUTE |
146
+ FILE_DELETE_CHILD | FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES
147
+ end
148
+ end
149
+ end
@@ -0,0 +1,63 @@
1
+ require 'ffi'
2
+
3
+ module Windows
4
+ module File
5
+ module Functions
6
+ extend FFI::Library
7
+
8
+ private
9
+
10
+ def self.attach_pfunc(*args)
11
+ attach_function(*args)
12
+ private args[0]
13
+ end
14
+
15
+ # For convenience
16
+ typedef :pointer, :ptr
17
+ typedef :buffer_in, :buf_in
18
+ typedef :buffer_out, :buf_out
19
+ typedef :string, :str
20
+ typedef :ulong, :dword
21
+ typedef :uintptr_t, :handle
22
+
23
+ ffi_lib :advapi32
24
+
25
+ attach_pfunc :AddAce, [:ptr, :dword, :dword, :ptr, :dword], :bool
26
+ attach_pfunc :AdjustTokenPrivileges, [:handle, :int, :ptr, :dword, :ptr, :ptr], :bool
27
+ attach_pfunc :CopySid, [:dword, :ptr, :ptr], :bool
28
+ attach_pfunc :EncryptFileW, [:buf_in], :bool
29
+ attach_pfunc :DecryptFileW, [:buf_in, :dword], :bool
30
+ attach_pfunc :FileEncryptionStatusW, [:buf_in, :ptr], :bool
31
+ attach_pfunc :GetAce, [:ptr, :dword, :ptr], :bool
32
+ attach_pfunc :GetFileSecurityW, [:buf_in, :dword, :ptr, :dword, :ptr], :bool
33
+ attach_pfunc :GetLengthSid, [:ptr], :dword
34
+ attach_pfunc :GetSecurityDescriptorControl, [:ptr, :ptr, :ptr], :bool
35
+ attach_pfunc :GetSecurityDescriptorOwner, [:ptr, :ptr, :ptr], :bool
36
+ attach_pfunc :GetSecurityDescriptorGroup, [:ptr, :ptr, :ptr], :bool
37
+ attach_pfunc :GetSecurityDescriptorDacl, [:ptr, :ptr, :ptr, :ptr], :bool
38
+ attach_pfunc :GetSecurityInfo, [:handle, :dword, :dword, :ptr, :ptr, :ptr, :ptr, :ptr], :dword
39
+ attach_pfunc :GetTokenInformation, [:handle, :int, :ptr, :dword, :ptr], :bool
40
+ attach_pfunc :InitializeAcl, [:ptr, :dword, :dword], :bool
41
+ attach_pfunc :InitializeSecurityDescriptor, [:ptr, :dword], :bool
42
+ attach_pfunc :LookupAccountNameW, [:buf_in, :buf_in, :ptr, :ptr, :ptr, :ptr, :ptr], :bool
43
+ attach_pfunc :LookupAccountSidW, [:buf_in, :ptr, :ptr, :ptr, :ptr, :ptr, :ptr], :bool
44
+ attach_pfunc :LookupPrivilegeValueA, [:str, :str, :ptr], :bool
45
+ attach_pfunc :OpenProcessToken, [:handle, :dword, :ptr], :bool
46
+ attach_pfunc :SetFileSecurityW, [:buf_in, :dword, :ptr], :bool
47
+ attach_pfunc :SetSecurityDescriptorDacl, [:ptr, :int, :ptr, :int], :bool
48
+ attach_pfunc :SetSecurityDescriptorOwner, [:ptr, :ptr, :int], :bool
49
+ attach_pfunc :ConvertSidToStringSidA, [:ptr,:ptr] ,:bool
50
+
51
+ ffi_lib :kernel32
52
+
53
+ attach_pfunc :CloseHandle, [:handle], :bool
54
+ attach_pfunc :GetCurrentProcess, [], :handle
55
+ attach_pfunc :GetVolumeInformationW, [:buf_in, :buf_out, :dword, :ptr, :ptr, :ptr, :buf_out, :dword], :bool
56
+
57
+ ffi_lib :shlwapi
58
+
59
+ attach_pfunc :PathStripToRootW, [:buf_in], :bool
60
+ attach_pfunc :PathIsRootW, [:buf_in], :bool
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,68 @@
1
+ require 'ffi'
2
+
3
+ module Windows
4
+ module File
5
+ module Structs
6
+ class ACE_HEADER < FFI::Struct
7
+ layout(
8
+ :AceType, :uchar,
9
+ :AceFlags, :uchar,
10
+ :AceSize, :ushort
11
+ )
12
+ end
13
+
14
+ class ACCESS_ALLOWED_ACE < FFI::Struct
15
+ layout(
16
+ :Header, ACE_HEADER,
17
+ :Mask, :ulong,
18
+ :SidStart, :ulong
19
+ )
20
+ end
21
+
22
+ class ACCESS_ALLOWED_ACE2 < FFI::Struct
23
+ layout(
24
+ :Header, ACE_HEADER,
25
+ :Mask, :ulong,
26
+ :SidStart, :ulong,
27
+ :dummy, [:uchar, 40]
28
+ )
29
+ end
30
+
31
+ class ACL < FFI::Struct
32
+ layout(
33
+ :AclRevision, :uchar,
34
+ :Sbz1, :uchar,
35
+ :AclSize, :ushort,
36
+ :AceCount, :ushort,
37
+ :Sbz2, :ushort
38
+ )
39
+ end
40
+
41
+ class LUID < FFI::Struct
42
+ layout(:LowPart, :ulong, :HighPart, :long)
43
+ end
44
+
45
+ class LUID_AND_ATTRIBUTES < FFI::Struct
46
+ layout(:Luid, LUID, :Attributes, :ulong)
47
+ end
48
+
49
+ class TOKEN_PRIVILEGES < FFI::Struct
50
+ layout(
51
+ :PrivilegeCount, :ulong,
52
+ :Privileges, [LUID_AND_ATTRIBUTES, 1]
53
+ )
54
+ end
55
+
56
+ class SID_AND_ATTRIBUTES < FFI::Struct
57
+ layout(:Sid, :pointer, :Attributes, :ulong)
58
+ end
59
+
60
+ class TOKEN_GROUP < FFI::Struct
61
+ layout(
62
+ :GroupCount, :ulong,
63
+ :Groups, [SID_AND_ATTRIBUTES, 128]
64
+ )
65
+ end
66
+ end
67
+ end
68
+ end