windows_com 2.0.2 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/RELNOTES.md +7 -3
- data/lib/windows_com/common.rb +17 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cd9c67d4242830c8724e54bbcb687ab72c9f156
|
4
|
+
data.tar.gz: 9adf8c76beffe573a5787b49b8d81e2c801618b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47aa923cfadab2b1573e2dfb038ed4a4852cebedbf54a916aadb5bdf5d98bb3ff61affe7c3acd2abd61bbc7140ba36791b0f2624d3570e7fe09f7e0492532e51
|
7
|
+
data.tar.gz: 7e434696d7c42f29696e7cbf6668f1d46613caa70e2d96e99c6f1507f87f74aa05f2bcc9118104cf33cc8e68c89d4d2413f9fb960aab6d3544232d80686edb1f
|
data/RELNOTES.md
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
# Release Notes
|
2
2
|
|
3
|
+
## 2.1.0
|
4
|
+
|
5
|
+
`COMVtbl_` doesn't prepend `this` pointers to vtbl specs
|
6
|
+
|
3
7
|
## 2.0.2
|
4
8
|
|
5
|
-
Implement the ability to trace COM call arguments (set WINDOWS_COM_TRACE_CALL_ARGS)
|
9
|
+
Implement the ability to trace COM call arguments (set `WINDOWS_COM_TRACE_CALL_ARGS`)
|
6
10
|
|
7
11
|
## 2.0.1
|
8
12
|
|
9
|
-
Allow COMInterface_ instances to be passed to code expecting pointers without calling
|
13
|
+
Allow `COMInterface_` instances to be passed to code expecting pointers without calling `#vptr`
|
10
14
|
|
11
15
|
## 2.0.0
|
12
16
|
|
13
|
-
- Add COMCallback module for
|
17
|
+
- Add `COMCallback` module for __implementing__ COM objects in Ruby
|
14
18
|
- enhance some bound FFI structs with useful methods
|
15
19
|
- improve code
|
16
20
|
|
data/lib/windows_com/common.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'ffi'
|
2
2
|
|
3
|
-
WINDOWS_COM_VERSION = '2.0
|
3
|
+
WINDOWS_COM_VERSION = '2.1.0'
|
4
4
|
|
5
5
|
WINDOWS_COM_OLE_INIT = true unless defined?(WINDOWS_COM_OLE_INIT)
|
6
6
|
|
@@ -152,10 +152,15 @@ module WindowsCOM
|
|
152
152
|
|
153
153
|
module COMVtbl_
|
154
154
|
def self.[](parent_vtbl, spec)
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
155
|
+
=begin
|
156
|
+
IUnknown::Vtbl::Spec example (*this* ptr is NOT included in spec signature):
|
157
|
+
|
158
|
+
{
|
159
|
+
QueryInterface: [[:pointer, :pointer], :long],
|
160
|
+
AddRef: [[], :ulong],
|
161
|
+
Release: [[], :ulong]
|
162
|
+
}
|
163
|
+
=end
|
159
164
|
Class.new(FFI::Struct) {
|
160
165
|
const_set :ParentVtbl, parent_vtbl
|
161
166
|
|
@@ -165,7 +170,9 @@ module WindowsCOM
|
|
165
170
|
|
166
171
|
layout_args = self::Spec.map { |name, sig|
|
167
172
|
params, ret = sig
|
168
|
-
[
|
173
|
+
ffi_params = [:pointer, *params] # prepend *this* ptr to FFI func signature
|
174
|
+
|
175
|
+
[name, callback(ffi_params, ret)]
|
169
176
|
}
|
170
177
|
layout_args.flatten!
|
171
178
|
layout(*layout_args)
|
@@ -192,7 +199,7 @@ module WindowsCOM
|
|
192
199
|
|
193
200
|
self::Vtbl.members.each { |name, sig|
|
194
201
|
define_method(name) { |*args|
|
195
|
-
args.unshift(@vptr) # prepend *this* for
|
202
|
+
args.unshift(@vptr) # prepend *this* ptr for FFI func call
|
196
203
|
|
197
204
|
STDERR.puts [:vt_call, self.class, name, args].inspect if
|
198
205
|
WINDOWS_COM_TRACE_CALL_ARGS
|
@@ -237,10 +244,11 @@ module WindowsCOM
|
|
237
244
|
@vtbl = self.class::Vtbl.new
|
238
245
|
@vtbl.members.each { |name|
|
239
246
|
params, ret = @vtbl.class::Spec[name]
|
247
|
+
ffi_params = [:pointer, *params] # prepend *this* ptr to FFI func signature
|
240
248
|
|
241
249
|
@vtbl[name] = instance_variable_set("@__ffi_func__#{name}",
|
242
|
-
FFI::Function.new(ret,
|
243
|
-
args.shift # remove *this* for Ruby meth call
|
250
|
+
FFI::Function.new(ret, ffi_params, convention: :stdcall) { |*args|
|
251
|
+
args.shift # remove *this* ptr for Ruby meth call
|
244
252
|
|
245
253
|
STDERR.puts [:rb_call, self.class, name, args].inspect if
|
246
254
|
WINDOWS_COM_TRACE_CALL_ARGS
|