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 Discussion / Unique Computer Identifier

Author
Message
Hangar18
17
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 19th Jun 2009 05:41
Is there a command in DB, that will produce a unique serial number for the computer its being run on. i.e. I want a way of ensuring that one access code to play a game on one computer, cannot be used on another computer.
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 19th Jun 2009 06:02
Only way I could think of is to have it register itself online before a trial type deal expires.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 19th Jun 2009 06:16
You can get the mac address, you can also query the user. I think there's a way to even get the hardware info for the hard drive. I'll have to dig around in my notes. Let me see if I can find the link to finding the current user of the machine:

a moment passes....

Found the link. This will only return the user. I'll dig around for the other stuff...

username

Enjoy your day.
Hangar18
17
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 19th Jun 2009 07:01 Edited at: 19th Jun 2009 07:02
@BN2 productions: the problem though is they could copy the game folder onto a memory stick and transfer it to another computer. I need to capture something specific about the computer, save it to a file in the directory, and then each time the program runs, check that the file matches the actual computer.

@Latch: Thanks, a username might be good enough. Do you know if the ADVAPI32.DLL will work in Vista / Windows 7 as it seems to be windows specific. Another thought I had was whether DB can spit out the graphics card name and make, processor unit name and make, and perhaps the monitor resolution (which I know it can, at least for monitor res). A string containing a combination of the graphics card, monitor res & processor unit might be "unique" enough.
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 19th Jun 2009 12:40
Quote: "Windows 7"

You could get the Windows 7 Release Candidate (it is free! and much better than vista). I have been running windows 7 for almost 6 months now, no problems (aside from a single crash on the beta version). Since windows 7 is free you could put it on an extra hard drive or extra hard drive partition and boot it to test out compatability.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 19th Jun 2009 19:31
Quote: "I need to capture something specific about the computer, save it to a file in the directory, and then each time the program runs, check that the file matches the actual computer."


What happens if you delete the file?

TheComet


Make the path of your enemies easier with Waypoint Pro!
Neuro Fuzzy
16
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 19th Jun 2009 20:16
then god help us all

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 19th Jun 2009 20:47
Quote: "What happens if you delete the file?"


If you use build final, then the file COULD be kept internally. Or, as a means of encryption, every file for the program could be put into a single dirblock or fileblock. That way there is only a single file that can only be read by your program (unless they have DBC as well, but if they want to go through all that trouble, then they deserve to crack it)

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th Jun 2009 02:23
@Hangar18
I think each Windows productid or the productkey is unique. You can query that through the registry. Use RegQueryValueEx in the ADVAPI32.DLL . I wrote up a function a while ago. If I find it I'll post it. I don't know if it would work on Windows 7 or Vista. You'd have to test it

Enjoy your day.
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 20th Jun 2009 05:59 Edited at: 20th Jun 2009 06:03
Yeah Latch is right but you can just use REGEDIT to get the information too.



The /E means export data from the registry into the file "C:\CheckComp.reg". The only weird thing is it saves one character as a string... so if you use "READ STRING 1,a$" it'll only extract one character at a time. And those strings are so weird you have to add them to a string using "b$=b$+chr$(asc(a$))". If you use the strings themselves with "b$=b$+a$" the string doesn't work right with MID$. It's a big hassle but it's nice when it works right.

You can use that to extract the ProductID, combine it with your game code, encrypt it, and add it to the windows registry with your own key. When they run the program you extract the ProductID and your own key in the windows registry, decrypt it and check if it's the right game code before they can play.

Making your own key in the windows registry:


Edit: Only been tested in Windows XP.

Hangar18
17
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 21st Jun 2009 15:26
Wow thanks so much for this!

Just wondering if I could trouble you with a couple of questions?

i) I ran the first bit of code and although it ran ok, it was expecting it to create a checkcomp.reg file in the c:/ directory but nothing was there.
ii) will changing the microsoft windows registry result in anti-spyware programs wanting to eliminate it?
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 22nd Jun 2009 02:44 Edited at: 22nd Jun 2009 02:46
Np.

It should of created that... unless the key is in a different place. It may not create the file if the key it's trying to export isn't there. Did you try the rest of that code to see if that worked? I can only confirm that it works in Windows XP (which is what I use). The only way to check if the key is there is run REGEDIT and look for it... just don't delete or change anything (unless their keys that you made yourself).

No. The only time an anti-spyware program would want to delete any keys your programs make is if you make spyware or adware and enough people get so sick of your programs they track down your registry keys to eliminate them. So I'm betting you won't have a problem.

Hangar18
17
Years of Service
User Offline
Joined: 13th Mar 2007
Location:
Posted: 23rd Jun 2009 10:13
Cool Thx. Sorry I cant get back to you on whether it works right now (there isnt enough time in the day to do the day job at the minute, let alone the good stuff like programming), but I will check it out hopefully before the weekend.
Bluestar4
18
Years of Service
User Offline
Joined: 19th Dec 2005
Location: USA
Posted: 24th Jun 2009 22:59
Are you planning on saling it through steam ?

bluestar4~
---Missle Might - Hero Battles - Zillipede --- which do you like the best ?

Login to post a reply

Server time is: 2024-05-20 12:23:08
Your offset time is: 2024-05-20 12:23:08