Password protecting a .exe file

This is a discussion on Password protecting a .exe file within the C++ Programming forums, part of the General Programming Boards category; What is the easiest way to password protect an executable on Windows? e.g. you double click on the file and ...

  1. #1
    Registered User
    Join Date
    Nov 2005
    Location
    Canada
    Posts
    80

    Password protecting a .exe file

    What is the easiest way to password protect an executable on Windows? e.g. you double click on the file and a box pops up, asking for username/password and if correct then it executes the target.

    Thanks.

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    I don't know of a way to have he operating system do it, I don't believe there is on - so it'd have to be done by the program. Just have that code at the start of your program. If they pass, continue, if not, terminate execution.

  3. #3
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    Then you can just break the password with a hex editor :P. You need to encrpyt it aswell.
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  4. #4
    Madly in anger with you
    Join Date
    Nov 2005
    Posts
    211
    Quote Originally Posted by Blackroot
    Then you can just break the password with a hex editor :P. You need to encrpyt it aswell.
    depends on what and who you are passwording against. chances are they won't even know what a hex editor is, and even if they do, they won't be able to find the actual password string. although string encryption is not all that hard anyways, a simple algorithm is explained here:

    http://www.codeproject.com/cpp/crypt_routine.asp
    Last edited by Bleech; 01-31-2006 at 10:04 PM.

    Intel Core 2 Quad Q6600 @ 2.40 GHz
    3072 MB PC2-5300 DDR2
    2 x 320 GB SATA (640 GB)
    NVIDIA GeForce 8400GS 256 MB PCI-E

  5. #5
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,074
    Quote Originally Posted by sl34k
    depends on what and who you are passwording against. chances are they won't even know what a hex editor is, and even if they do, they won't be able to find the actual password string. although string encryption is not all that hard anyways, a simple algorithm is explained here:

    http://www.codeproject.com/cpp/crypt_routine.asp
    This reminds me of the old Access DB that we used in the company I work in over the winters (which is a very reputable bank you've heard of). They password protected the Back End but getting the password was as easy as right clicking the object and looking at the password event.

    Sure maybe the average computer user couldn't get it, but no matter your business, there is always gonna be someone that knows a thing or two about a thing or two.
    Sent from my iPadŽ

  6. #6
    chococoder
    Join Date
    Nov 2004
    Posts
    515
    There is of course nothing that can't be broken.
    If the password is encrypted a cracker will just change the binary code so the login screen is bypassed completely.

    If the password is retrieved from a remote location (like a database) he can change the program so that the relevant routine always returns the same thing instead of looking it up.

    Etc. etc.

    Just depends on how smart your cracker is.

  7. #7
    Registered User
    Join Date
    Nov 2002
    Posts
    319
    winrar sfx

  8. #8
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,231
    -Use encryption. (The value user enters is not the value that is stored in your exe, and should be converted to it.)

    -Make the password block to set some vars with some known values and then check them in different places in your program.

    -Do not store password outside the exe file. And make sure it is cleaned from the memory after password block. (ex. Max Pain game saves it's parental control pass in registry)

    password block==The code (maybe function) that gets the password from user
    Last edited by siavoshkc; 02-01-2006 at 05:36 AM.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  9. #9
    Registered User
    Join Date
    Nov 2005
    Location
    Canada
    Posts
    80
    Thanks everybody, some good measures of protection indeed!

    How about storing the user/pass in a SQL db (I use a remote PostgreSQL) and reading it upon authentication? How can I program that in C++? Apparently I need to get this so called 'libpqxx' library, but it's a pain installing it on Windows-run machine (like mine); too many manual configs and hence prone to errors. How would you do it (connecting to the SQL server through C++)?

    Thanks again!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  2. File Writing Problem
    By polskash in forum C Programming
    Replies: 3
    Last Post: 02-13-2009, 09:47 AM
  3. Problems passing a file pointer to functions
    By smitchell in forum C Programming
    Replies: 4
    Last Post: 09-30-2008, 02:29 PM
  4. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  5. Simple File encryption
    By caroundw5h in forum C Programming
    Replies: 2
    Last Post: 10-13-2004, 10:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21