WinCE 取得平台信息和UUID以及重启

#include <pkfuncs.h>

//重启
void Reboot()
{
 KernelIoControl(IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL);
}

// 得到UUID:
void IoControlGetUUID(TCHAR *wzUUID)
{
  UINT8 u8ArrUUID[16];   
 DWORD nOutBufSize = sizeof(u8ArrUUID);
 DWORD dwBytesReturned = 0;
 if(KernelIoControl(IOCTL_HAL_GET_UUID, NULL , NULL, &u8ArrUUID, nOutBufSize, &dwBytesReturned))
 {
  TCHAR *wzBuffer = (TCHAR *)malloc(MAX_PATH*sizeof(TCHAR));
  memset(wzBuffer,0,MAX_PATH*sizeof(TCHAR));
  wsprintf( wzBuffer, L"UUID = %02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X%02X-%02X%02X%02X%02X",
   u8ArrUUID[0], u8ArrUUID[1], u8ArrUUID[2], u8ArrUUID[3], u8ArrUUID[4], u8ArrUUID[5], u8ArrUUID[6],
   u8ArrUUID[7], u8ArrUUID[8], u8ArrUUID[9], u8ArrUUID[10], u8ArrUUID[11], u8ArrUUID[12], u8ArrUUID[13],
   u8ArrUUID[14], u8ArrUUID[15]);
  wcscat(wzUUID, wzBuffer);
  free(wzBuffer);
 }
}

// 得到平台信息
void IoControlGetPlatformInfo(TCHAR *wzPlatformInfo)
{
 PROCESSOR_INFO pi;
 DWORD nOutBufSize = sizeof(pi);
 DWORD dwBytesReturned = 0;
 if(KernelIoControl(IOCTL_PROCESSOR_INFORMATION, NULL , NULL, &pi, nOutBufSize, &dwBytesReturned))
 {
  wcscat(wzPlatformInfo, L"Platform: ");
  wcscat(wzPlatformInfo, pi.szVendor);
  wcscat(wzPlatformInfo, L" ");
  wcscat(wzPlatformInfo, pi.szProcessorName);
  wcscat(wzPlatformInfo, L"\r\n");
 }
}

 

上一篇:Monkey测试的策略和分析


下一篇:分布式ID | 这六种分布式ID生成方法,总有一款适合你