Class: FFI::MemoryPointer
- Defined in:
- lib/puppet/util/windows/api_types.rb
Class Method Summary collapse
-
.from_wide_string(wstr) {|ptr| ... } ⇒ Object
Return a MemoryPointer that points to wide string.
Class Method Details
.from_wide_string(wstr) {|ptr| ... } ⇒ Object
Return a MemoryPointer that points to wide string. This is analogous to the FFI::MemoryPointer.from_string method.
124 125 126 127 128 129 130 131 132 |
# File 'lib/puppet/util/windows/api_types.rb', line 124 def self.from_wide_string(wstr) ptr = FFI::MemoryPointer.new(:uchar, wstr.bytesize + 2) ptr.put_array_of_uchar(0, wstr.bytes.to_a) ptr.put_uint16(wstr.bytesize, 0) yield ptr if block_given? ptr end |