H
Hilton
Hi,
Reference:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/retrievedeviceid.asp
Usually this code works well. However I have notice 2 problems:
1. PlatformIDSize usually is 6, but can be 8. When it is 8, the code was
throwing an exception since I only allocated 16 bytes (not 18). If I did
"Min (6, PlatforIDSize), then the UUID was reported as
XXXX-XXXX-XXXX-XXXX-1234-1234-XXXX-XXXX; i.e. "1234" (for example) is
reported twice. If I then change the loop from:
for (int i = PlatformIDOffset;
i < PlatformIDOffset + PlatformIDSize;
i ++ )
to:
int diff = Math.Max (0, dwPlatformIDSize - 6);
dwPlatformIDSize = Math.Min (dwPlatformIDSize, 6);
dwPlatformIDOffset += diff;
for (int i = PlatformIDOffset;
i < PlatformIDOffset + PlatformIDSize;
i ++ )
{
...
}
then the UUID reported is the same as the UUID reported by the OS (via the
shipped utility). Does this make sense? MS's code is wrong. but is mine
correct?
2. I've noticed something else. Sometimes (using MS's original code), all
6 bytes are zero; i.e. UUID ends in 0000-0000-0000. This has gotta be
wrong - right? Will my modification fix this? Has anyone seen these zeroes
who can verify it?
I'm seeing these UUID from users and not my own PDAs so it's tougher to
debug.
Thanks!
Hilton
Reference:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/retrievedeviceid.asp
Usually this code works well. However I have notice 2 problems:
1. PlatformIDSize usually is 6, but can be 8. When it is 8, the code was
throwing an exception since I only allocated 16 bytes (not 18). If I did
"Min (6, PlatforIDSize), then the UUID was reported as
XXXX-XXXX-XXXX-XXXX-1234-1234-XXXX-XXXX; i.e. "1234" (for example) is
reported twice. If I then change the loop from:
for (int i = PlatformIDOffset;
i < PlatformIDOffset + PlatformIDSize;
i ++ )
to:
int diff = Math.Max (0, dwPlatformIDSize - 6);
dwPlatformIDSize = Math.Min (dwPlatformIDSize, 6);
dwPlatformIDOffset += diff;
for (int i = PlatformIDOffset;
i < PlatformIDOffset + PlatformIDSize;
i ++ )
{
...
}
then the UUID reported is the same as the UUID reported by the OS (via the
shipped utility). Does this make sense? MS's code is wrong. but is mine
correct?
2. I've noticed something else. Sometimes (using MS's original code), all
6 bytes are zero; i.e. UUID ends in 0000-0000-0000. This has gotta be
wrong - right? Will my modification fix this? Has anyone seen these zeroes
who can verify it?
I'm seeing these UUID from users and not my own PDAs so it's tougher to
debug.
Thanks!
Hilton