summaryrefslogtreecommitdiff
path: root/assets/Win32API.rb
blob: b44845769134d1107d5826bc21a581df1dc5f4fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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