module Chef::ReservedNames::Win32::API

def safe_attach_function(win32_func, *args)

defined which when called, raises a helpful exception to the end-user.
function into the calling module. If this fails a dummy method is
Attempts to use FFI's attach_function method to link a native Win32
def safe_attach_function(win32_func, *args)
  attach_function(win32_func.to_sym, *args)
rescue FFI::NotFoundError
  define_method(win32_func.to_sym) do |*margs|
    raise Chef::Exceptions::Win32APIFunctionNotImplemented, "This version of Windows does not implement the Win32 function [#{win32_func}]."
  end
end