Reading a UUID (Windows Embedded CE 6.0)

1/5/2010

To read the UUID value from where it is saved in nonvolatile memory, you must do several things.

First, you must call the function GetUUID. The Ioctl.cpp file in %_WINCEROOT%\Public\Rdp\Oak\Uit\Wbttscmn\ contains the GetUUID function. GetUUID calls KernelIoControl to obtain the UUID, returned by IOCTL_HAL_GET_DEVICE_INFO.

Then, to handle the call to that function, you must implement the section of code in the OEM Adaptation Layer (OAL) for the thin client's hardware reference design. The hardware reference design can be either the CEPC platform, or it can be the specific reference platform for your thin client operating system.

For more information about how to implement an OAL, see Providing System Information and OEMIoControl.

The following procedure shows you how to read the UUID from the OAL and then output the UUID value for the CEPC platform.

To read a UUID

  • Call KernelIoControl to retrieve the UUID value from the OAL. The control code that you must specify for reading a UUID is IOCTL_HAL_GET_DEVICE_INFO.

    The following code example reads a UUID from the OAL and then outputs the UUID value.

    BOOL GetUUID () 
    {
      GUID myUUID;
      BOOL bRetVal;
      DWORD dwBytesReturned;
      UINT32 spiValue = SPI_GETUUID;
    
      bRetVal = KernelIoControl (IOCTL_HAL_GET_DEVICE_INFO, spiValue,
          sizeof(spiValue), &myUUID, sizeof (myUUID), &dwBytesReturned);
      if (!bRetVal) 
      {
        RETAILMSG(1, TEXT("KernelIoControl call failed!\r\n"));
        return FALSE;
      }
    
      RETAILMSG(
        1,
        TEXT("UUID: %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X\r\n"),
        myUUID.Data1,
        myUUID.Data2,
        myUUID.Data3,
        myUUID.Data4[0],
        myUUID.Data4[1],
        myUUID.Data4[2],
        myUUID.Data4[3],
        myUUID.Data4[4],
        myUUID.Data4[5],
        myUUID.Data4[6],
        myUUID.Data4[7]);
    
      return TRUE;
    }
    

See Also

Concepts

Assign a UUID to a Thin Client