Thread: Program Key

  1. #1
    Registered User
    Join Date
    Mar 2006
    Location
    USA::Colorado
    Posts
    155

    Program Key

    Hey,

    I'm thinking of adding a registration part to one of my programs. Essentially the program would give a user a certain number, which they would forward to me, and then I would send them an actual activation number based off of the number the client gave me.

    I'm just curious how to generate a computer-specific ID number (probably relating to hard drive or CPU).

    I tried searching for some good C++ examples w/ the winapi and MFC, but I was unable to find any useful ones (most were written in other languages).

    Any help on this subject will be greatly appreciated,

    Thanks,

    Matt
    ~guitarist809~

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Are you prepared to deal with the "I upgraded my x and now your program doesn't work" support questions?

    For each x your program detects and uses as part of the key?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Mar 2006
    Location
    USA::Colorado
    Posts
    155
    I'm actually just trying to prevent people from using my program without permission. I'm only giving it to close friends, however, I don't want some generic "enter password to continue" input that will allow someone to use the program if anybody gives them a activation code.

    I'm planning on giving this program to a friend, he'll give me a hardware number back (or another code that is specific to his computer), and then I can give him an activation code.

    This is not a program that people are going to pay for, so I don't need to worry about upgrades for the program...
    ~guitarist809~

  4. #4
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Quote Originally Posted by guitarist809 View Post
    This is not a program that people are going to pay for, so I don't need to worry about upgrades for the program...
    Upgrades for the hardware, not for your program...
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Seeing as most OS's turn off CPU serial number detection, that's probably not a good candidate for ID's.

    Aside from that, Salem and maxorators points are both valid and relevant: If you use the hard-disk ID as a key, what happens when that user decides to change his/her hard disk for another one?

    You could of course put an encrypted marker in each program saying "This program belongs to <name>" [with a high-grade checksum], that way, if someone leaks it, you know who did it - and it will also act as a preventative measure that the user knows that his/her name is encoded into the application and you can trace it back to the original recipient.

    I personally would be PROUD if one of my personal (non-commercial) applications was to be distributed to such an extent that I can find it on the interweb, but that's me, not you.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    Registered User
    Join Date
    Mar 2006
    Location
    USA::Colorado
    Posts
    155
    Quote Originally Posted by matsp View Post
    Seeing as most OS's turn off CPU serial number detection, that's probably not a good candidate for ID's.

    Aside from that, Salem and maxorators points are both valid and relevant: If you use the hard-disk ID as a key, what happens when that user decides to change his/her hard disk for another one?

    You could of course put an encrypted marker in each program saying "This program belongs to <name>" [with a high-grade checksum], that way, if someone leaks it, you know who did it - and it will also act as a preventative measure that the user knows that his/her name is encoded into the application and you can trace it back to the original recipient.

    I personally would be PROUD if one of my personal (non-commercial) applications was to be distributed to such an extent that I can find it on the interweb, but that's me, not you.

    --
    Mats
    That is an excellent idea! Thanks for the recommendation.

    Thanks for the help,

    Guitarist809
    ~guitarist809~

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > That is an excellent idea! Thanks for the recommendation.
    And if someone gets two copies, does a 'diff', sees that the only difference is say 32 bytes of apparent garbage, clears it on suspicion that it's just a tracking cookie, then you're back to square 1.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  8. #8
    chococoder
    Join Date
    Nov 2004
    Posts
    515
    Quote Originally Posted by guitarist809 View Post
    Hey,
    I tried searching for some good C++ examples w/ the winapi and MFC, but I was unable to find any useful ones (most were written in other languages).

    Matt
    An important part of being a decent programmer is being able to take examples from one language you don't know (or don't know well) and understand how to implement them in another language you do know (well).
    Of course this may involve learning a bit about that other language, but that's part of the fun.

  9. #9
    Registered User
    Join Date
    Mar 2006
    Location
    USA::Colorado
    Posts
    155
    What I'm thinking of doing is adding a username to an online mysql database, having this program connect to it and if a user enters a certian key in the db, it checks for it and then erases it (after putting a "registered" file or something on the main users computer).

    Reformatting = new key i guess =\
    ~guitarist809~

  10. #10
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Then you would have to be ready for people screaming spyware. Or DRM.
    In any case, people don't like systems like this. As long as it works without a hitch and you are ready to take some blame, go right ahead.
    Just make sure to make the message clear - that it uses an internet connection for verification or such. Otherwise people get suspicious.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #11
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Quote Originally Posted by guitarist809 View Post
    I'm just curious how to generate a computer-specific ID number (probably relating to hard drive or CPU).
    Look up GUIDs using the MAC address.

    I think this is all pointless, most likely it will annoy some ligit users while only marginally delaying a pirate.

    You will spend more time protecting the app than the pirate will breaking the protection.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 05-25-2008, 12:31 AM
  2. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  3. Replies: 3
    Last Post: 05-25-2005, 01:50 PM
  4. Registery with api?
    By ismael86 in forum Windows Programming
    Replies: 1
    Last Post: 05-14-2002, 10:28 AM
  5. heeeeeeellllllpppppppp!!!
    By DarkDays in forum C++ Programming
    Replies: 15
    Last Post: 12-09-2001, 09:43 PM