summaryrefslogtreecommitdiff
path: root/lib/chef/provider/env
diff options
context:
space:
mode:
authorsersut <serdar@opscode.com>2014-06-18 17:00:23 -0700
committerClaire McQuin <claire@getchef.com>2014-06-19 15:29:24 -0700
commitf4fc9dfa580997369952e9d26da2bb63dc9d569d (patch)
tree76f9393a0a0139113e047cbb78ef8eb3d10f94d3 /lib/chef/provider/env
parentd8592902ae09980552f8dd57abe9ed9c76851445 (diff)
downloadchef-f4fc9dfa580997369952e9d26da2bb63dc9d569d.tar.gz
Use FFI binders to attach :SendMessageTimeout instead of Win32API in order to disable annoying message of:
DL is deprecated, please use Fiddle
Diffstat (limited to 'lib/chef/provider/env')
-rw-r--r--lib/chef/provider/env/windows.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/chef/provider/env/windows.rb b/lib/chef/provider/env/windows.rb
index d0c136451f..a5f4b8148e 100644
--- a/lib/chef/provider/env/windows.rb
+++ b/lib/chef/provider/env/windows.rb
@@ -17,13 +17,14 @@
#
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
- require 'Win32API'
+ require 'chef/win32/api/system'
end
class Chef
class Provider
class Env
class Windows < Chef::Provider::Env
+ include Chef::ReservedNames::Win32::API::System
def create_env
obj = env_obj(@new_resource.key_name)
@@ -73,10 +74,8 @@ class Chef
SMTO_NOTIMEOUTIFNOTHUNG = 0x0008
def broadcast_env_change
- result = 0
flags = SMTO_BLOCK | SMTO_ABORTIFHUNG | SMTO_NOTIMEOUTIFNOTHUNG
- @send_message ||= Win32API.new('user32', 'SendMessageTimeout', 'LLLPLLP', 'L')
- @send_message.call(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 'Environment', flags, 5000, result)
+ SendMessageTimeoutA(HWND_BROADCAST, WM_SETTINGCHANGE, 0, FFI::MemoryPointer.from_string('Environment').address, flags, 5000, nil)
end
end
end