130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
# File 'lib/puppet/util/windows/com.rb', line 130
def self.[](iface)
Class.new(iface) do
send(:include, Helpers)
def initialize(pointer)
self.pointer = pointer
@vtbl = self.class::VTBL.new(self[:lpVtbl])
end
attr_reader :vtbl
self::VTBL.members.each do |name|
define_method(name) do |*args|
if Puppet::Util::Windows::COM.FAILED((result = @vtbl[name].call(self, *args)))
raise Puppet::Util::Windows::Error.new(_("Failed to call %{klass}::%{name} with HRESULT: %{result}.") % { klass: self, name: name, result: result }, result)
end
result
end
end
layout \
:lpVtbl, :pointer
end
end
|