diff options
Diffstat (limited to 'assets/Win32API.rb')
-rw-r--r-- | assets/Win32API.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/assets/Win32API.rb b/assets/Win32API.rb new file mode 100644 index 0000000..b448457 --- /dev/null +++ b/assets/Win32API.rb @@ -0,0 +1,27 @@ +$VERBOSE = nil +class Win32Fun + def initialize(dll, func, arg_spec, ret_spec) + @dll = dll + @func = func + @arg_spec = arg_spec + @ret_spec = ret_spec + end + def call(*args) + method = @dll + "_" + @func + if self.class.private_method_defined? method + return self.send method, args + elsif Win32NativeAPI.respond_to? method + return Win32NativeAPI.send method, args[0] + else + puts "fixme: " + @dll + "." + @func + return 0 + end + end + private +end + +module Win32API + def self.new(dll, func, arg_spec, ret_spec) + return Win32Fun.new(dll, func, arg_spec, ret_spec) + end +end |