class Puppet::FFI::Windows::APITypes::Puppet::FFI::Windows::APITypes::FFI::MemoryPointer

Public Class Methods

from_wide_string(wstr) { |ptr| ... } click to toggle source

Return a MemoryPointer that points to wide string. This is analogous to the FFI::MemoryPointer.from_string method.

    # File lib/puppet/ffi/windows/api_types.rb
126 def self.from_wide_string(wstr)
127   ptr = FFI::MemoryPointer.new(:uchar, wstr.bytesize + 2)
128   ptr.put_array_of_uchar(0, wstr.bytes.to_a)
129   ptr.put_uint16(wstr.bytesize, 0)
130 
131   yield ptr if block_given?
132 
133   ptr
134 end