PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

retrieving owner's name

Does anyone know (or have a code snippet) how to retrieve the owner's name from the registry? The Nutcracker is having problems generating a device key on upgraded iPaqs, and on MIPS I can't use this approach at all, so I am planning to use the owner's name to protect The Nutcracker (I know it's not waterproof, but it keeps at least neighbour software exchanges at a distance).
And another question; will the same approach still work with PPC2002? I'm having more problems with PPC2002 everyday...
Well, I don't have info on the actual struct that is used to store the info, but it is at:
HKEY_CURRENT_USER/ControlPanelOwner/Owner

After a quick check on my iPaq with a certain top-secret project of mine, I see the owner name starts at the first byte of the struct, and of course is in UNICODE. It looks like it is NULL terminated, because all padding bytes after it are zero, but that may not be true for all devices. The Company Name starts at 0x48, Address at 0x90, Home Phone at 0x204, and email at 0x236.

For the iPaq, by far the best solution is to get the device serial number. It is the only hardware that I know of (after extensive searching) that has the serial number burnt into the device in a software-accessable manner. Compaq has a small SDK to access that info on their website, or you can use a KernelIoControl call with IOCTL_HAL_GET_DEVICEID.

Dan East
The device ID solution for the iPaq does not seem to work on some devices that are flashed by Microsoft. So I intend to switch over to the owner name approach completely. I have to do that anyway, since I don't think there is a way to distuinguish an iPaq from a new Jornada with ARM processor...
If you use Compaq's API (specifically CPQInfoGetSerialNo), it will fail on non-iPaq hardware. I had someone verify that on HP PPC 2002 hardware, and several other devices. I guess the question then is does that function fail on those MS upgraded iPaqs, or does it return an incorrect value? Can you point me to someone that has one of those devices that I can give a diagnostic program to?

Dan East
My e-mail is dead at the moment, but I can send you the address of the French webmaster that did the nice review. He has an iPaq that was flashed by Microsoft (the OS says it's PocketPC2002, v1.32), wich has button problems and reports a device ID of 0. He will probably be willing to run your diagnostics app.
Are you on MSN Messenger?

Dan East
Nope, just ICQ: 9500700.
ICQ won't work with my Proxy server, and after installing it on my other desktop PC it wouldn't let me login with my ICQ number or even send me my password - so screw it. You can just instant message me.

Dan East
Dan,

OK, right now I have the following code in place (please forgive me, I'm exceptionally bad at windows stuff):

Code:

HKEY key;
unsigned char* buffer = new unsigned char[4096];
unsigned short* b = (unsigned short*)buffer;
unsigned long size = 4096;
RegOpenKeyEx( HKEY_CURRENT_USER, L"ControlPanelOwner", 0, 0, &key );
RegQueryValueEx( key, L"Owner", NULL, NULL, buffer, &size );
RegCloseKey( key );
// some processing on buffer to create key code
delete buffer;


Would this get the owner name to my buffer, or am I doing something wrong? I'm especially in doubt about things like keys, values, that sort of stuff... Should I add the 'Owner' thing to the string that I used to open the key?

- Jacco.
The code is right, but you aren't specifying the whole key path. The value you want is
HKEY_CURRENT_USER\ControlPanel\Owner\Owner:

[fixed]RegOpenKeyEx( HKEY_CURRENT_USER, L"ControlPanel\\Owner", 0, 0, &key );
RegQueryValueEx( key, L"Owner", NULL, NULL, buffer, &size );[/fixed]

Dan East
Thanks a lot. :) I'll try it tonight.
OK, code for this is going to be in EasyCE 1.5. That way everyone can protect his software properly the Easy way. :)
You mean EasyCE 2 ;D
No, it's an incremental update, not a rewrite. If I would ever build an EasyCE that comes as a baseclass that you can derive from and that has things like a resolution independent canvas and so on, I would call it EasyCE 2.0. This time, I simply added stuff that should have been in EasyCE already, like the PIXEL define, the tgaloader, a sprite class, relative paths etc. Quite useful, should take away the initial burden of platform specific stuff that you need to know to code for WindowsCE. And that's precisely what EasyCE is supposed to do. It should allow you to code, without the hassle, just the fun. :)