Reading UUIDs
For the Windows Thin Client to read the UUID from where it is saved in nonvolatile memory, you must call GetUUID. %_WINCEROOT%\Public\Rdp\Oak\Uit\Wbttscmn\Ioctl.cpp contains the GetUUID function. GetUUID in turn calls KernelIoControl for the IOCTL_HAL_GET_UUID.
Then, to handle the call to that function, you must implement the section of code in the OEM Adaptation Layer (OAL) for the CEPC platform. An example of the recommended implementation for any Windows Thin Client device that uses the Remote Desktop (RDP) client can be found at %_WINCEROOT%\Platform\Cepc\Kernel\Hal\Oemoictl.c.
The following procedures show how to make the Windows Thin Client read the UUID and then implement the OAL code for the CEPC platform.
To read a UUID
Implement KernelIoControl. The control code that is specified for reading a UUID is IOCTL_HAL_GET_UUID.
The following code example shows how to make the Windows Thin Client read a UUID.
BOOL GetUUID () { GUID myUUID; BOOL bRetVal; DWORD dwBytesReturned; bRetVal = KernelIoControl (IOCTL_HAL_GET_UUID, NULL, 0, &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; }
To implement the OAL code for the CEPC platform
In the Oemioctl.c file, add code to the OEMIoControl function to handle the IOCTL_HAL_GET_UUID call.
The following code example shows the added code.
BOOL OEMEthInit(EDBG_ADAPTER *pAdapter) { ....... // Save the local mac address. memcpy ((char *)wLocalMAC, pAdapter->Addr.wMAC, sizeof(wLocalMAC)); EdbgOutputDebugString("Debug Ethernet card initialized, MAC Address:%B:%B:%B:%B:%B:%B\r\n", pAdapter->Addr.wMAC[0] & 0x00FF, pAdapter->Addr.wMAC[0] >> 8, pAdapter->Addr.wMAC[1] & 0x00FF, pAdapter->Addr.wMAC[1] >> 8, pAdapter->Addr.wMAC[2] & 0x00FF, pAdapter->Addr.wMAC[2] >> 8 ); ........ } BOOL OEMIoControl (DWORD dwIoControlCode, LPVOID lpInBuf, DWORD nInBufSize, LPVOID lpOutBuf, DWORD nOutBufSize, LPDWORD lpBytesReturned) { BOOL retval = FALSE; DWORD len; DEBUGMSG(0, TEXT("+OEMIoControl %X\r\n"), dwIoControlCode); switch (dwIoControlCode) { case IOCTL_HAL_GET_UUID : if (lpOutBuf && (nOutBufSize >= sizeof(GUID))) { if (lpBytesReturned) { *lpBytesReturned = sizeof(GUID); } // OEMs with unique ID hardware can return the value here. // If the platform does not have any unique ID settings, // Then attempt to use the Kernel Ethernet Debug address if non-zero. if (wLocalMAC[0] | wLocalMAC[1] | wLocalMAC[2]) { memcpy(lpOutBuf, (char *)wLocalMAC, sizeof(GUID)); return TRUE; } else { SetLastError (ERROR_NOT_SUPPORTED); return FALSE; } } else { SetLastError (ERROR_NOT VALID_PARAMETER); return FALSE; } case IOCTL_HAL_GET_DEVICE_INFO: if (nInBufSize == 4) { switch (*(LPDWORD)lpInBuf) { ... } } ... } ... }
See Also
Last updated on Wednesday, April 13, 2005
© 2005 Microsoft Corporation. All rights reserved.