Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Registry commands not doing anything?

Author
Message
Westmere
16
Years of Service
User Offline
Joined: 12th Mar 2010
Location: Germany
Posted: 25th Nov 2011 13:12
I've been fiddling with a registration key system I am trying to rewrite from memory (I used something like this in a very old Delphi-project).
Since I obviously don't want to store the key a user enters in a file in the game's directory since copying that directory to someone else would mean making a completely activated copy. Not good

So my solution is to store the key entered in the registry, for instance at HKLM\Software\Cars Incorporated. This is a simple measure to assure that no key gets copied by someone else by accident. (I use a blacklist for keys I know to have been pirated).

Now here's where my problem comes in: Neither Write String To Registry nor Get Registry$ seem to be doing ANYTHING.
A key I try to write in the registry does not appear, anything I try to read from the registry simply = "".

I did use the forum search and I went through all the tips I found including \, beginning the path with Software instead of HKLM, even launching the program with administrator rights (Win7 64), but nothing seems to work.

Here are two lines I used to experiment, with keys I know to exist when reading and trying to make one:



(I just used blender, because the DBPro install path is not set where it is in examples I found.)


zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 25th Nov 2011 18:44 Edited at: 25th Nov 2011 19:24
This works for me. Hope it helps.


Note that...
- The strings are NOT case-sensitive with regard to Folder & Key Name (Labels); However, they ARE case-sensitive with regard to the string-value of a KEY. I changed the Label,, and 'String Value' of "Registration"/"registration",, "Aa00-Bb00..." etc. to illustrate this.
- Don't use a trailing "\"
- If regedit is open... and you are trying to view a KEY that was written (after regedit was launched) you need to refresh first; by either clicking |View| -> Refresh or by pressing the [F5] key.
- In DBpro,, If you don't preceed with a sync, or double up with two sync commands when there is no loop; you can inadvertently miss information you are intending to show on the display. Why a dual call to sync is sometimesnecessary is briefly mentioned in the DBpro Help under the SYNC command.

Quote: "It is important to note the very first SYNC will only render the back buffer and reveal the contents of that buffer on the second SYNC command, as the system is based on a double buffered refresh."


~ZENassem
Westmere
16
Years of Service
User Offline
Joined: 12th Mar 2010
Location: Germany
Posted: 25th Nov 2011 23:26
Yeah well I know what you say is true. After all I am not working on a 10 liner - the game has grown to over 7000 lines of code (plus lots of my own scripts interpreted by the game), so I am fairly certain I know how to check if something is simply not printed because of a missing SYNC

That said, I have tried your code. Result: A black screen.
Then I changed print regkey$ to print "-"+regkey$+"-" which is a technique I sometimes use to make sure there are no spaces in front or after a text. Or to see if it is "printing" at all
Result: "--" and "--".
Then I tried running THAT code with administrator rights again. It still didn't read the Blender-key but it returned the Aa... key. After that it even returned that key when the program is run without admin rights. So it would appear that admin rights are required for the DBP registry commands to work. It still doesn't read stuff written by other programs, but that's not the problem.

The problems are:
1. I can't order anyone to run my game with admin rights just so they can enter the key
2. The key written doesn't even show up in regedit (wth?)

Is there any solution to work around this? Too bad, IanM's matrix utils don't have registry functions


zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 25th Nov 2011 23:48 Edited at: 26th Nov 2011 00:12
First, I tried to include as many notes in order to help. Not to insult you.

Second, Every line of the code "Works" 100% on my computer (Win7 Home Premium), including the Blender Key. I do test my code before I put it up.

Third, I would try to help you further by suggesting certain things you can check on your computer like "Turning off UAC"... But I fear that you may think I am insulting you again.

There's not much of a problem in requiring users to have admin rights to install and/or run a game. Happens quite often. But If you want another solution... encrypt the key in a config/custom-format file. Use your own method of encoding it, or use a hash key algorithm + Checksum. Matrix1utils contains numerous Hash functions (under Matri1Util_27). Although they're still crackable, it's more secure than the "reg key" method.


Oh and here's an attached screenie including the Blender regkey read.

~ZENassem
Westmere
16
Years of Service
User Offline
Joined: 12th Mar 2010
Location: Germany
Posted: 26th Nov 2011 01:31
Well I did not try to imply that you wanted to insult me, that's what the at the end of the line was for.

I am also fairly sure that you would not post a code you haven't tested. I just reenacted the steps to show what happened on my system.

From what you say I can only guess that it has to do with me using 64 bit and you using a 32 bit version!? Or maybe a different DBPro release with one being buggy? I have upgrade 7.7 RC 7 on mine. You?

The problem is not encrypting it. I have fairly nice routine in place spitting out serial keys in the format XXXX-XXXX-XXXX-XXXX, where each x can be A-Z or 0-9. It uses a combination of counting to make the codes unique, a random number, a checksum and an encryption function of mine. The codes look really, really random and even if you look at a fairly large number of them you probably would have a hard time finding a system.
They still can be validated and would even spit out the number of the key, ranging from 0 up to 99,999,999 - that amount should suffice ^^

That can still be cracked but I am not too worried about that. If someone really wants to crack my game he probably will anyway

I still need a way to activate a legal copy so I use a key-system. If someone copies his directory to someone else, he would also copy they key, thus even by accident an illegal copy could be created. On the other hand that is probably pretty unlikely anyway.

So I will probably settle for saving it to a file for now.

Thank you for your help, even though it didn't spawn a solution.


zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 26th Nov 2011 02:08 Edited at: 26th Nov 2011 02:16
7.7 RC7 Here as well

I picked up on the . That's why I used them as well. I was being a bit facetious.

What if it was a multi-key system? Their software regkey is generated from their email address,, ... both the username and regkey combo are needed. This way... copying the file is not a "one-key" system. Updates are provided via the same type of delivery mechanisms on a limited # and by recertifying email. Not many people will pass the e-mail around, if they want the updates. And catching SHARED e-mails won't be too difficult to spot. Again not bullet-proof but at least a bit of a deterrent without being annoying, like generating off of hardware ID's that can casue problems for users installing on "their" multiple systems, or hardware changes. Just a thought.

~ZENassem
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 29th Nov 2011 13:49
Hmm... Maybe use an online php file... I waz hoping someone might know more about this method... By securing a list of emails in a php file and a list of keys in another and making them match up or something...of even a hashed .dat file...

This is a method I think will wodk so long as security can be maintained... Thanks in advance.

Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 3rd Dec 2011 10:04
Shouldn't the registry entries be this...

With double slashes?

My signature is NOT a moderator plaything! Stop changing it!

Login to post a reply

Server time is: 2026-07-10 03:59:27
Your offset time is: 2026-07-10 03:59:27