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
125 def self.from_wide_string(wstr)
126   ptr = FFI::MemoryPointer.new(:uchar, wstr.bytesize + 2)
127   ptr.put_array_of_uchar(0, wstr.bytes.to_a)
128   ptr.put_uint16(wstr.bytesize, 0)
129 
130   yield ptr if block_given?
131 
132   ptr
133 end