class FFI::WIN32::GUID

msdn.microsoft.com/en-us/library/windows/desktop/aa373931(v=vs.85).aspx typedef struct _GUID {

DWORD Data1;
WORD  Data2;
WORD  Data3;
BYTE  Data4[8];

} GUID;

Public Class Methods

[](s) click to toggle source
    # File lib/puppet/ffi/windows/api_types.rb
230 def self.[](s)
231   raise _('Bad GUID format.') unless s =~ /^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/i
232 
233   new.tap do |guid|
234     guid[:Data1] = s[0, 8].to_i(16)
235     guid[:Data2] = s[9, 4].to_i(16)
236     guid[:Data3] = s[14, 4].to_i(16)
237     guid[:Data4][0] = s[19, 2].to_i(16)
238     guid[:Data4][1] = s[21, 2].to_i(16)
239     s[24, 12].split('').each_slice(2).with_index do |a, i|
240       guid[:Data4][i + 2] = a.join('').to_i(16)
241     end
242   end
243 end

Public Instance Methods

==(other) click to toggle source
    # File lib/puppet/ffi/windows/api_types.rb
245 def ==(other) Windows.memcmp(other, self, size) == 0 end