summaryrefslogtreecommitdiff
path: root/lib/chef/win32
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/win32
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/win32')
-rw-r--r--lib/chef/win32/api/system.rb14
-rw-r--r--lib/chef/win32/version.rb8
2 files changed, 20 insertions, 2 deletions
diff --git a/lib/chef/win32/api/system.rb b/lib/chef/win32/api/system.rb
index 60f381aa5a..a58c0f38f4 100644
--- a/lib/chef/win32/api/system.rb
+++ b/lib/chef/win32/api/system.rb
@@ -186,6 +186,20 @@ int WINAPI GetSystemMetrics(
=end
safe_attach_function :GetSystemMetrics, [:int], :int
+=begin
+LRESULT WINAPI SendMessageTimeout(
+ _In_ HWND hWnd,
+ _In_ UINT Msg,
+ _In_ WPARAM wParam,
+ _In_ LPARAM lParam,
+ _In_ UINT fuFlags,
+ _In_ UINT uTimeout,
+ _Out_opt_ PDWORD_PTR lpdwResult
+);
+=end
+ safe_attach_function :SendMessageTimeoutW, [:HWND, :UINT, :WPARAM, :LPARAM, :UINT, :UINT, :PDWORD_PTR], :LRESULT
+ safe_attach_function :SendMessageTimeoutA, [:HWND, :UINT, :WPARAM, :LPARAM, :UINT, :UINT, :PDWORD_PTR], :LRESULT
+
end
end
end
diff --git a/lib/chef/win32/version.rb b/lib/chef/win32/version.rb
index 233e31fe76..d2138289f5 100644
--- a/lib/chef/win32/version.rb
+++ b/lib/chef/win32/version.rb
@@ -23,6 +23,10 @@ require 'wmi-lite/wmi'
class Chef
module ReservedNames::Win32
class Version
+ class << self
+ include Chef::ReservedNames::Win32::API::System
+ end
+
include Chef::ReservedNames::Win32::API::Macros
include Chef::ReservedNames::Win32::API::System
@@ -33,12 +37,12 @@ class Chef
private
def self.get_system_metrics(n_index)
- Win32API.new('user32', 'GetSystemMetrics', 'I', 'I').call(n_index)
+ GetSystemMetrics(n_index)
end
def self.method_name_from_marketing_name(marketing_name)
"#{marketing_name.gsub(/\s/, '_').gsub(/\./, '_').downcase}?"
- # "#{marketing_name.gsub(/\s/, '_').gsub(//, '_').downcase}?"
+ # "#{marketing_name.gsub(/\s/, '_').gsub(//, '_').downcase}?"
end
public