guid
import "github.com/TheManticoreProject/Manticore/windows/guid"
Index
- Constants
- type GUID
- func FromFormatB(data string) (*GUID, error)
- func FromFormatD(data string) (*GUID, error)
- func FromFormatN(data string) (*GUID, error)
- func FromFormatP(data string) (*GUID, error)
- func FromFormatX(data string) (*GUID, error)
- func FromString(data string) (*GUID, error)
- func NewGUID() *GUID
- func (guid *GUID) Equal(other *GUID) bool
- func (guid *GUID) FromRawBytes(data []byte)
- func (guid *GUID) ToBytes() []byte
- func (guid *GUID) ToFormatB() string
- func (guid *GUID) ToFormatD() string
- func (guid *GUID) ToFormatN() string
- func (guid *GUID) ToFormatP() string
- func (guid *GUID) ToFormatX() string
Constants
const (
GUID_FORMAT_N_REGEX = "^[0-9a-f]{32}$"
GUID_FORMAT_D_REGEX = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
GUID_FORMAT_B_REGEX = "^\\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\}$"
GUID_FORMAT_P_REGEX = "^\\([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\)$"
GUID_FORMAT_X_REGEX = "^\\{0x[0-9a-f]{8},0x[0-9a-f]{4},0x[0-9a-f]{4},\\{0x[0-9a-f]{2},0x[0-9a-f]{2},0x[0-9a-f]{2},0x[0-9a-f]{2},0x[0-9a-f]{2},0x[0-9a-f]{2},0x[0-9a-f]{2},0x[0-9a-f]{2}\\}\\}$"
)
type GUID
GUID represents a globally unique identifier (GUID). It consists of five fields: A, B, C, D, and E, which are used to store the components of the GUID.
Fields: - A: A 32-bit unsigned integer representing the first part of the GUID. - B: A 16-bit unsigned integer representing the second part of the GUID. - C: A 16-bit unsigned integer representing the third part of the GUID. - D: A 16-bit unsigned integer representing the fourth part of the GUID. - E: A 64-bit unsigned integer representing the fifth part of the GUID.
type GUID struct {
A uint32
B uint16
C uint16
D uint16
E uint64
}
func FromFormatB
func FromFormatB(data string) (*GUID, error)
FromFormatB parses a GUID from a string in the format B: {00000000-0000-0000-0000-000000000000}
The function takes a string and parses it into a GUID.
Parameters: - data: A string containing the GUID in the format B.
Returns: - A pointer to the parsed GUID. - An error if the string is not a valid GUID in the format B.
func FromFormatD
func FromFormatD(data string) (*GUID, error)
FromFormatD parses a GUID from a string in the format D: 00000000-0000-0000-0000-000000000000
The function takes a string and parses it into a GUID.
Parameters: - data: A string containing the GUID in the format D.
Returns: - A pointer to the parsed GUID. - An error if the string is not a valid GUID in the format D.
func FromFormatN
func FromFormatN(data string) (*GUID, error)
FromFormatN parses a GUID from a string in the format N: 00000000000000000000000000000000
The function takes a string and parses it into a GUID.
Parameters: - data: A string containing the GUID in the format N.
Returns: - A pointer to the parsed GUID. - An error if the string is not a valid GUID in the format N.
func FromFormatP
func FromFormatP(data string) (*GUID, error)
FromFormatP parses a GUID from a string in the format P: (00000000-0000-0000-0000-000000000000)
The function takes a string and parses it into a GUID.
Parameters: - data: A string containing the GUID in the format P.
Returns: - A pointer to the parsed GUID. - An error if the string is not a valid GUID in the format P.
func FromFormatX
func FromFormatX(data string) (*GUID, error)
FromFormatX parses a GUID from a string in the format X: {0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
The function takes a string and parses it into a GUID.
Parameters: - data: A string containing the GUID in the format X.
Returns: - A pointer to the parsed GUID. - An error if the string is not a valid GUID in the format X.
func FromString
func FromString(data string) (*GUID, error)
FromString parses a GUID from a string.
The function takes a string and parses it into a GUID.
Parameters: - data: A string containing the GUID.
Returns: - A pointer to the parsed GUID. - An error if the string is not a valid GUID.
func NewGUID
func NewGUID() *GUID
NewGUID generates a new random GUID.
The function creates a new GUID by generating random values for each of its five fields: - A: A 32-bit unsigned integer. - B: A 16-bit unsigned integer. - C: A 16-bit unsigned integer. - D: A 16-bit unsigned integer. - E: A 64-bit unsigned integer.
Returns: - A pointer to a newly generated GUID.
func (*GUID) Equal
func (guid *GUID) Equal(other *GUID) bool
Equal checks if two GUIDs are equal.
The function compares the two GUIDs and returns true if they are equal, false otherwise.
func (*GUID) FromRawBytes
func (guid *GUID) FromRawBytes(data []byte)
FromRawBytes parses a GUID from a raw byte array.
The function takes a byte array and assigns the values to the GUID fields.
Parameters: - data: A byte array containing the raw bytes of the GUID.
Returns: - A pointer to the parsed GUID.
func (*GUID) ToBytes
func (guid *GUID) ToBytes() []byte
ToBytes returns the raw byte array representation of the GUID.
The function converts the GUID into a byte array.
Returns: - A byte array containing the raw bytes of the GUID.
func (*GUID) ToFormatB
func (guid *GUID) ToFormatB() string
ToFormatB returns the GUID in the format B: {00000000-0000-0000-0000-000000000000}
The function converts the GUID into a string in the format B.
Returns: - A string containing the GUID in the format B.
func (*GUID) ToFormatD
func (guid *GUID) ToFormatD() string
ToFormatD returns the GUID in the format D: 00000000-0000-0000-0000-000000000000
The function converts the GUID into a string in the format D.
Returns: - A string containing the GUID in the format D.
func (*GUID) ToFormatN
func (guid *GUID) ToFormatN() string
ToFormatN returns the GUID in the format N: 00000000000000000000000000000000
The function converts the GUID into a string in the format N.
Returns: - A string containing the GUID in the format N.
func (*GUID) ToFormatP
func (guid *GUID) ToFormatP() string
ToFormatP returns the GUID in the format P: (00000000-0000-0000-0000-000000000000)
The function converts the GUID into a string in the format P.
Returns: - A string containing the GUID in the format P.
func (*GUID) ToFormatX
func (guid *GUID) ToFormatX() string
ToFormatX returns the GUID in the format X: {0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
The function converts the GUID into a string in the format X.
Returns: - A string containing the GUID in the format X.