summaryrefslogtreecommitdiff
path: root/lib/chef/win32
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2015-08-26 14:22:18 -0700
committerKartik Null Cating-Subramanian <ksubramanian@chef.io>2015-08-27 11:54:50 -0400
commit5a863dc4331799b5876edcf5fdc31666f47888d6 (patch)
treec4cb5054c7869735b64bf35859d14684703c8eba /lib/chef/win32
parent652b582c1ca7ceabe57cdf6b170fe97f4d661584 (diff)
downloadchef-5a863dc4331799b5876edcf5fdc31666f47888d6.tar.gz
Convert SetVolumeMountPoint to use ffi
Diffstat (limited to 'lib/chef/win32')
-rw-r--r--lib/chef/win32/api/file.rb6
-rw-r--r--lib/chef/win32/file.rb7
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/chef/win32/api/file.rb b/lib/chef/win32/api/file.rb
index 4ea07ad39b..c48e992882 100644
--- a/lib/chef/win32/api/file.rb
+++ b/lib/chef/win32/api/file.rb
@@ -456,6 +456,12 @@ BOOL WINAPI DeviceIoControl(
#);
safe_attach_function :DeleteVolumeMountPointW, [:LPCTSTR], :BOOL
+#BOOL WINAPI SetVolumeMountPoint(
+ #_In_ LPCTSTR lpszVolumeMountPoint,
+ #_In_ LPCTSTR lpszVolumeName
+#);
+ safe_attach_function :SetVolumeMountPointW, [:LPCTSTR, :LPCTSTR], :BOOL
+
###############################################
# Helpers
###############################################
diff --git a/lib/chef/win32/file.rb b/lib/chef/win32/file.rb
index a577f04acc..f62f9333f5 100644
--- a/lib/chef/win32/file.rb
+++ b/lib/chef/win32/file.rb
@@ -186,6 +186,13 @@ class Chef
end
end
+ def self.set_volume_mount_point(mount_point, name)
+ unless SetVolumeMountPointW(wstring(mount_point), wstring(name))
+ Chef::ReservedNames::Win32::Error.raise!
+ end
+ end
+
+
# ::File compat
class << self
alias :stat :info