by Dan East » Jul 31, 2001 @ 1:56pm
Here's a sample using the UUID IOCTL. An example I saw on the web showed that it returns a UNICODE value, but it does not on the iPaq, so you have to convert it.<br>First off, you need to prototype the KernelIoControl function:<br>[fixed]<br>extern "C" BOOL KernelIoControl (<br> DWORD dwIoControlCode,<br> LPVOID lpInBuf,<br> DWORD nInBufSize,<br> LPVOID lpOutBuf,<br> DWORD nOutBufSize,<br> LPDWORD lpBytesReturned );[/fixed]<br><br>Here it is:<br>[fixed]<br>char rgtcAsset[64]; <br>unsigned long Len=sizeof(rgtcAsset);<br>memset(rgtcAsset, 0, Len); <br>if (KernelIoControl(IOCTL_HAL_GET_UUID, NULL, 0, (LPVOID)rgtcAsset, Len, &Len)) {<br> TCHAR buf[64];<br> MultiByteToWideChar(CP_ACP, NULL, rgtcAsset, -1, buf, sizeof(buf)/sizeof(TCHAR));<br><br> //hopefully buf now contains the device's SN.<br>}<br>[/fixed]<br><br>Don't forget to use the IOCTL_HAL_GET_UUID definition in the previous post.<br><br>If anyone would take the time to see if that works with the Casios and HPs it would be very cool...<br><br>Dan East<br>