Module: WinRM::PSRP::UUID
- Included in:
- Message
- Defined in:
- lib/winrm/psrp/uuid.rb
Overview
UUID helper methods
Instance Method Summary collapse
-
#uuid_to_windows_guid_bytes(uuid) ⇒ Array<byte>
Format a UUID into a GUID compatible byte array for Windows.
Instance Method Details
#uuid_to_windows_guid_bytes(uuid) ⇒ Array<byte>
Format a UUID into a GUID compatible byte array for Windows
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;
31 32 33 34 35 36 |
# File 'lib/winrm/psrp/uuid.rb', line 31 def uuid_to_windows_guid_bytes(uuid) return [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] unless uuid b = uuid.scan(/[0-9a-fA-F]{2}/).map { |x| x.to_i(16) } b[0..3].reverse + b[4..5].reverse + b[6..7].reverse + b[8..15] end |