windows_com 2.0.2 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bea6d25055bb37d4aa2c16bd5da878bd8917b815
4
- data.tar.gz: ede87f79a9b521ad64dd83a0b022e3ba37952a92
3
+ metadata.gz: 9cd9c67d4242830c8724e54bbcb687ab72c9f156
4
+ data.tar.gz: 9adf8c76beffe573a5787b49b8d81e2c801618b2
5
5
  SHA512:
6
- metadata.gz: 64a0ff1e78884ca62f39e4016cf66cc1be78a26a5e71d61831fa6219c11d4a8473b98f74c38939caba893026d02d927b70757bfecf6a11463207c80a41702be6
7
- data.tar.gz: 2ad4eda66fb2a0ad4759552d02b651a9dbc090c4b40b261cf5941fe3088ca7e91a4c842ccedc26323a29617380d49320562f4a5df71c0a8a77c037d5689d5a3e
6
+ metadata.gz: 47aa923cfadab2b1573e2dfb038ed4a4852cebedbf54a916aadb5bdf5d98bb3ff61affe7c3acd2abd61bbc7140ba36791b0f2624d3570e7fe09f7e0492532e51
7
+ data.tar.gz: 7e434696d7c42f29696e7cbf6668f1d46613caa70e2d96e99c6f1507f87f74aa05f2bcc9118104cf33cc8e68c89d4d2413f9fb960aab6d3544232d80686edb1f
@@ -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 #vptr
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 implementing COM objects on the Ruby/FFI side
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
 
@@ -1,6 +1,6 @@
1
1
  require 'ffi'
2
2
 
3
- WINDOWS_COM_VERSION = '2.0.2'
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
- spec.each { |name, sig|
156
- sig[0].unshift(:pointer) # prepend *this* to FFI func signature
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
- [name, callback(params, ret)]
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 Vtbl meth call
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, params, convention: :stdcall) { |*args|
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: windows_com
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Radoslav Peev