Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the type GUID?

Tags:

winapi

delphi

I'm translating a C++ Windows API to a delphi *.pas file.

I have this C Struct returned by a function

typedef struct _WLAN_HOSTED_NETWORK_STATUS {
  WLAN_HOSTED_NETWORK_STATE      HostedNetworkState;
  GUID                           IPDeviceID;
  DOT11_MAC_ADDRESS              wlanHostedNetworkBSSID;
  DOT11_PHY_TYPE                 dot11PhyType;
  ULONG                          ulChannelFrequency;
  DWORD                          dwNumberOfPeers;
  WLAN_HOSTED_NETWORK_PEER_STATE PeerList[1];
} WLAN_HOSTED_NETWORK_STATUS, *PWLAN_HOSTED_NETWORK_STATUS;

I translated to this:

type
_WLAN_HOSTED_NETWORK_STATUS = record 
  HostedNetworkState : WLAN_HOSTED_NETWORK_STATE;
  IPDeviceID : GUID;
  wlanHostedNetworkBSSID : DOT11_MAC_ADDRESS;
  dot11PhyType : DOT11_PHY_TYPE;
  ulChannelFrequency : ULONG;
  dwNumberOfPeers : DWORD;
  PeerList : Array [0..1] of WLAN_HOSTED_NETWORK_PEER_STATE;
end;
WLAN_HOSTED_NETWORK_STATUS = _WLAN_HOSTED_NETWORK_STATUS;
PWLAN_HOSTED_NETWORK_STATUS = _WLAN_HOSTED_NETWORK_STATUS;

but I not found on MSDN reference what is this GUID type of IPDeviceID it is a primitive type? how do I hold this value?

like image 482
Vitim.us Avatar asked Feb 20 '12 14:02

Vitim.us


People also ask

What type is GUID in C#?

Remarks. A GUID is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever a unique identifier is required. Such an identifier has a very low probability of being duplicated.

What is an example of a GUID?

A GUID can be used for people, cars, files, webpages, colors, anything. With regular registration numbers, you start counting at 1 and numbers can overlap. Social Security Number 123-45-6789 is different from ISBN 123456789 which is different from barcode 123456789.

What is GUID data type in SQL?

The globally unique identifier (GUID) data type in SQL Server is represented by the uniqueidentifier data type, which stores a 16-byte binary value. A GUID is a binary number, and its main use is as an identifier that must be unique in a network that has many computers at many sites.

How many types of GUIDs are there?

Types and variants of GUIDs There are five different versions of GUIDs, most of which follow the RFC 4122 specification.

What does GUID stand for?

Global Unique Identification number show sources.


2 Answers

The Delphi equivalent is TGUID.

The Delphi documentation contains some examples of how to use this type and its associated helper function.

like image 155
David Heffernan Avatar answered Sep 20 '22 07:09

David Heffernan


GUID structure, also known as UUID, is a widely used 128-bit value type which represents globally unique identifiers.

typedef struct _GUID {
  DWORD Data1;
  WORD  Data2;
  WORD  Data3;
  BYTE  Data4[8];
} GUID;

A quick check reveals that Delphi already has this type, named TGuid in module System.

like image 20
hamstergene Avatar answered Sep 18 '22 07:09

hamstergene