PocketMatrix forums

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

Creating Serial Numbers / Hardware Keys

Hello all,
I'm just starting to develop the code for "registering" my new game with a customer, I'd like to have is based on somthing that is hardware based....

I've a few questions:

is there somthing I can "lookup" on ppc2000/2002 devices thats unique? and if so how?

if I then get this first key, how should I create the second? some simple code here would be good!

once I have to second key, where should I store it? registry? file?

I'm assuming i should check the two keys match everytime I run the application?

-any help in this area would be a great help!
For PPC 2002 (and all iPaqs) you can use the hardware serial number:

Code:

PDEVICE_ID DeviceID;
unsigned char buffer[1024];
DWORD Len;

DeviceID = (PDEVICE_ID)buffer;
DeviceID->dwSize = sizeof(buffer);
Len = sizeof(buffer);

KernelIoControl(IOCTL_HAL_GET_DEVICEID,NULL,0,DeviceID,Len,&Len;);


For PPC 2000, only the iPaq supports Electronic Serial Numbers. For all other PPC 2000 devices you have to invent your own scheme. Generate a Product ID based off of the owner info or generate a random ID, etc.

Dan East
mmm, what about algo's for creating the second key? ideas?
You could probably use something relatively simple, because to be honest, it won't really do anything. Cracks completly bypass the whole registration scheme (which I assume is the intent of the question) and every program put forth has (eventually) been cracked. I am speaking from experience too.
What will this key do? If its to let the game actually run, what happens when someone gets a new ppc? I think basing it off the username would be best. The idea behind copyprotection is not to make it hard for the user to use his program, just make it difficult to simply beam it over to a friends. If you had multiple pirated games it would be a pain to keep changing your name. Any person who REALLY wants to pirate your game will, dont do anything thats too harsh just to stop the casual pirates at the expense of the actual paying customers.
Basing it of the purchase e-mail address is a good thing. Then if a serial is leaked then they have to give out the e-mail address used when purchasing the first version. And then if you find a leaked serial then you can just check your purchase dB and get the address of the one who leaked it.

Could be quite efficient I guess...

Unless your product is cracked.
Conan · 18 Dec 2002, 10:42 UTC — registration code
You have to bear in mind that if you want to use automatic registration via Handango etc that your code has to fit their requirements. I can assure you that after a few months of giving out reg codes you will be happy to automate.

ShareIt! are great because they provide source to build a windows dll which plugs in to their reg system. The source is available in lots of languages.

( I get slightly more registrations from ShareIt than from Handango which means more people coming from download.com and zdnet etc than from the direct store.
If you get a new device, you ask for a new serial, simple.

Do the automated system, please. When I buy a program, I want to use it, not wait anywhere from hours to days before actually trying it. I, and most people, are instant gratification, espiecally if bought online :P

Don't go head over heels trying to add protection though, a cracked version WILL be released either way. But just add stuff to stop most of the casual pirates that try to share with their friends.
Get a new device ask for a new serial?? Simple?? No way is that simple. ESPECIALLY with companys that go up and down all the time. There are many companys who created great games who are no longer in buisness. Its a hassel if you have to mail the company for a new serial, atleast id be very aggervated if i had to.

DillRye
Well, your in the minority there for sure. They have automated systems for the serials in most case, but if having to goto a webpage when the rare time comes that you buy a new device is a hassle, well then your lazy. No one has had big issues with a new serial for a new device yet.
Aside from someone writing a key gen program, or cracking the software, a hardware based serial number is the best way to go! The only problem I can see is having to dish out the numbers..... unless it can be done with the retailer i.e handango, or somthing....

It all depends on the qaulity of the software!
Annoying Snails Master · 20 Dec 2002, 03:45 UTC
do what MS does. When you install, have it send the HW number and the program id to you. this way the program ID can only be used with one device... untill someone cracks it :(
Yeah... but that would be a pain since the PPC would need to be connected to the Internet and the proper code implemented.
The original Rayman protection has NOT been defeated yet, whether because it's too hard, or no one's really cared. However, you saw how hard that was to register for many people.

Rayman Ultimate used a device generated serial, so that doesn't count.

Basically, you can have a very complicated reg scheme, but a crack will pass it every time, unless you do an online method, which would be very inconvenient. Reviews slagged the original Rayman from their method.

A couple serial-based programs were very tough, but eventually released. I'd be willing to get more into this in a private message if wanted, as we don't need another warez thread :P
It took 8 months to crack DEXplor, and only then because I left a vulnerability in that I didn't want to spend time working on and delay the initial release. It was more important for me to provide the community with DEXplor than spend too much time trying to prevent warez users from not having it.

Most "cracking" is done using a hex editor and changing various bytes to 0. This can be used to fall through conditional logic branches because an opcode of 0 is no operation. So if you have something like "If not registered GoTo here" then replacing that conditional branch with a 0x00 will cause it to fall through and not branch when unregistered. Obviously you can reverse your logic to require a cracker with more experience (If Registered Goto here). Again, the idea isn't to make it completely hack-proof, but to protect against the trivial hacks requiring no skill and the simplest of software tools (hex editor).

Another example is a MessageBox. If you have a message box that pops up and asks the user to register, then a hacker can simply find that string and replace the first character with a 0 byte. The Win23 MessageBox routine will not display anything if it is passed a zero length string, so the whole message goes away. You can use a basic cipher on your strings to prevent them from being hacked in this manner.

These are simple things a programmer can do to make it much more difficult for a kiddie-hacker to crack. Basically what I did with DEXplor is require at least some degree of intelligence to crack it. And even then they had to create a separate key gen program that works with the hacked version, so they still have to generate and use a key, making it a cumbersome process. A warez user certainly can't just copy the cracked version onto their device and use it. They have to do some contortions first.

Finally, most warez people will not buy the software regardless. Yes, they are very good at coming up with excuses and flawed logic based on the premise that they somehow help software development. While I, as much as any other developer, would like to prevent warez users from having access to something they don't deserve and didn't contribute to (ie purchase), in the end it costs me very little money. Most of them either can't afford the software in the first place, do not have the moral integrity to do what is right, or don't have the intelligence to realize that the only reason programmers are able to work full-time developing new and cutting-edge Pocket PC software is because they get reimbursed by consumers (if their product is worthy).

What comes around goes around, so they will get theirs in the end. I've decided I'm not going to invest undue amounts of time with elaborate protection, because my time is much better spent creating productive and new things for the benefit of the community. [steps down off of soap box]

Oh, if a single post is made to this thread exhorting warez in any way, I will delete the post and see that the poster is banned immediately. If I want to waste my time arguing about warez I will go to the warez community. They can stay in their illegitimate place, which is out of the public light that the rest of us enjoy.

Dan East
Your code above does not compile Dan?
You're probably not including the file that defines DEVICE_ID, the IO code, etc. Just paste this in:
Code:

typedef struct _DEVICE_ID {
DWORD dwSize;
DWORD dwPresetIDOffset;
DWORD dwPresetIDBytes;
DWORD dwPlatformIDOffset;
DWORD dwPlatformIDBytes;
} DEVICE_ID, *PDEVICE_ID;

#define IOCTL_HAL_GET_DEVICEID 0x1010054

extern "C" BOOL KernelIoControl (
DWORD dwIoControlCode,
LPVOID lpInBuf,
DWORD nInBufSize,
LPVOID lpOutBuf,
DWORD nOutBufSize,
LPDWORD lpBytesReturned );


Dan East
Guest · 27 Dec 2002, 20:53 UTC — Is it worth to spend much time protecting the software?
I have noticed that there is not much difference in number of copies sold between PocketPC software that is well protected against piracy and the one that is not protected at all...
...except with protected software less people are able to use the software that are not entitled to it.

Dan East
If I pay for something, I expect it not to be a hassel afterwords. I dont pay money for the copy protection, I pay it for the game. This whole copy protection thing is getting way out of hand and aggervates me greatly. Someone who is going to pirate your game is going to find any way they can. There not going to just decided to go buy it instead(unless theres some gotta have feature like online play). If I buy a music cd, I EXPECT to be able to copy the songs from different cd's to one compilation one for my listening enjoyment.

Anyhow, I dont have any pirated stuff on my PPC, I am definatly not arguing toward the warez side. Just the consumer side.
Excuse my French, but you guys have a lot of balls to get into this after what Dan said at the end of his last post on page one. :/
Moose I dont think you see the point, and for someone who read Dan's long post, you didnt read the other ones well. This isnt about warez at all, Warez=BAD No arguments about that. Just about copy protection and how far you should go......

Funniest thing is, my friends and I often install cracks onto games we own so they dont have to use the cds.
mmmm, you seem to be getting the point, ish....

We need some sort of protection!

It needs to be as secure as we can get it!

It needs to be simple in design!
&
It needs to be least intrusive to the end user as possible!

-B
And that's exactly what the hardware serial number gives you! yahoo! The world is at peace again!