summaryrefslogtreecommitdiff
path: root/lib/chef/win32
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/win32')
-rw-r--r--lib/chef/win32/api/file.rb6
-rw-r--r--lib/chef/win32/file.rb10
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/chef/win32/api/file.rb b/lib/chef/win32/api/file.rb
index 86b2b942c2..4ea07ad39b 100644
--- a/lib/chef/win32/api/file.rb
+++ b/lib/chef/win32/api/file.rb
@@ -450,6 +450,12 @@ BOOL WINAPI DeviceIoControl(
=end
safe_attach_function :DeviceIoControl, [:HANDLE, :DWORD, :LPVOID, :DWORD, :LPVOID, :DWORD, :LPDWORD, :pointer], :BOOL
+
+#BOOL WINAPI DeleteVolumeMountPoint(
+ #_In_ LPCTSTR lpszVolumeMountPoint
+#);
+ safe_attach_function :DeleteVolumeMountPointW, [:LPCTSTR], :BOOL
+
###############################################
# Helpers
###############################################
diff --git a/lib/chef/win32/file.rb b/lib/chef/win32/file.rb
index e6640caa3c..a577f04acc 100644
--- a/lib/chef/win32/file.rb
+++ b/lib/chef/win32/file.rb
@@ -20,6 +20,7 @@
require 'chef/win32/api/file'
require 'chef/win32/api/security'
require 'chef/win32/error'
+require 'chef/mixin/wstring'
class Chef
module ReservedNames::Win32
@@ -27,6 +28,9 @@ class Chef
include Chef::ReservedNames::Win32::API::File
extend Chef::ReservedNames::Win32::API::File
+ include Chef::Mixin::WideString
+ extend Chef::Mixin::WideString
+
# Creates a symbolic link called +new_name+ for the file or directory
# +old_name+.
#
@@ -176,6 +180,12 @@ class Chef
desired_access, mapping)
end
+ def self.delete_volume_mount_point(mount_point)
+ unless DeleteVolumeMountPointW(wstring(mount_point))
+ Chef::ReservedNames::Win32::Error.raise!
+ end
+ end
+
# ::File compat
class << self
alias :stat :info