I'm using a GetDeviceID() function from "GetUuid" Pocket PC 2003 SDK
Sample to obtain an unique device ID and it is working fine so far,
but I've faced a problem using it on an HP iPAQ hx2490 Pocket PC.

As prescribed the GetDeviceID() function makes an
IOCTL_HAL_GET_DEVICEID call with DEVICE_ID.dwSize member set to 0
(zero), to query the actual required size. Then a second call with
the returned required size set results (again) in
ERROR_INSUFFICIENT_BUFFER. Otherwise the function seems to work as
expected If I ignore the ERROR_INSUFFICIENT_BUFFER during that
second IOCTL_HAL_GET_DEVICEID call. Does somebody knows anything
about this issue or may be where I could get HP iPAQ specific info?

--
Stanimir <stanio(_at_)gbg.bg>

RE: IOCTL_HAL_GET_DEVICEID on HP iPAQ hx2490 by Slim

Slim
Mon Jul 24 05:51:01 CDT 2006

yes the units have a change to the coredll. We use C# I can send you the code
that will get it for you
Slim

"Stanimir Stamenkov" wrote:

> I'm using a GetDeviceID() function from "GetUuid" Pocket PC 2003 SDK
> Sample to obtain an unique device ID and it is working fine so far,
> but I've faced a problem using it on an HP iPAQ hx2490 Pocket PC.
>
> As prescribed the GetDeviceID() function makes an
> IOCTL_HAL_GET_DEVICEID call with DEVICE_ID.dwSize member set to 0
> (zero), to query the actual required size. Then a second call with
> the returned required size set results (again) in
> ERROR_INSUFFICIENT_BUFFER. Otherwise the function seems to work as
> expected If I ignore the ERROR_INSUFFICIENT_BUFFER during that
> second IOCTL_HAL_GET_DEVICEID call. Does somebody knows anything
> about this issue or may be where I could get HP iPAQ specific info?
>
> --
> Stanimir <stanio(_at_)gbg.bg>
>

Re: IOCTL_HAL_GET_DEVICEID on HP iPAQ hx2490 by Stanimir

Stanimir
Mon Jul 24 09:58:48 CDT 2006

/Slim/:

> yes the units have a change to the coredll. We use C# I can send you the code
> that will get it for you

Thanks Slim. Would you post it?

Although my application is Win32 one I may make use of the C# code.
I still don't understand why the
KernelIoControl(IOCTL_HAL_GET_DEVICEID, ...) call fails with
ERROR_INSUFFICIENT_BUFFER given the DEVICE_ID.dwSize is properly
initialized with a previous IOCTL_HAL_GET_DEVICEID call [1]:

http://msdn.microsoft.com/library/en-us/wcedsn40/html/cmrefIOCTL_HAL_GET_DEVICEID.asp

--
Stanimir <stanio(_at_)gbg.bg>

Re: IOCTL_HAL_GET_DEVICEID on HP iPAQ hx2490 by Slim

Slim
Mon Jul 24 10:10:03 CDT 2006

The code is a bit large. Here is a link to the complete DLL
http://www.intact.ie/ipaq/DeviceInfo.zip
This has the lot in. using VS2003 but will go to 2005 if you want
Have fun
Slim

"Stanimir Stamenkov" wrote:

> /Slim/:
>
> > yes the units have a change to the coredll. We use C# I can send you the code
> > that will get it for you
>
> Thanks Slim. Would you post it?
>
> Although my application is Win32 one I may make use of the C# code.
> I still don't understand why the
> KernelIoControl(IOCTL_HAL_GET_DEVICEID, ...) call fails with
> ERROR_INSUFFICIENT_BUFFER given the DEVICE_ID.dwSize is properly
> initialized with a previous IOCTL_HAL_GET_DEVICEID call [1]:
>
> http://msdn.microsoft.com/library/en-us/wcedsn40/html/cmrefIOCTL_HAL_GET_DEVICEID.asp
>
> --
> Stanimir <stanio(_at_)gbg.bg>
>

Re: IOCTL_HAL_GET_DEVICEID on HP iPAQ hx2490 by Stanimir

Stanimir
Sat Dec 30 11:00:51 CST 2006

/Stanimir Stamenkov/:

> I'm using a GetDeviceID() function from "GetUuid" Pocket PC 2003 SDK
> Sample to obtain an unique device ID and it is working fine so far,
> but I've faced a problem using it on an HP iPAQ hx2490 Pocket PC.

O.k. I've found the problem. It is in the "GetUuid" sample from
the Pocket PC 2003 SDK itself. After the |GetDeviceID| function has
determined the needed DEVICE_ID structure size and after the second
IOCTL_HAL_GET_DEVICEID call, it makes a bogus check:

fRes = KernelIoControl( IOCTL_HAL_GET_DEVICEID, NULL, 0,
pDevID, wSize, &dwBytesReturned );

if((FALSE == fRes)
|| (ERROR_INSUFFICIENT_BUFFER == GetLastError()) )
return FALSE;

While the 'if' statement should be just:

if(FALSE == fRes)
return FALSE;

Seems the older PPC implementations cleared the last error in a
successful call and that's why it had worked. As far as I know
clearing the the last error is not required if the function has
already indicated a success returning TRUE and that seems to happen
with the implementation in that newer PPC - the last error remains
ERROR_INSUFFICIENT_BUFFER from the previous IOCTL_HAL_GET_DEVICEID call.

--
Stanimir <stanio(_at_)gbg.bg>