Thread: Program Password

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    5

    Program Password

    Hi, im trying to write a program in c++ that will load say, every time the a user wants to use Real Player and ask them for a password.Real Player should never load if the user doesnt get the password right!

    Im definitly sure that system commands should be used somewhere in the code, but i dont know how to implement it. Thank in advance.

  2. #2
    Registered User
    Join Date
    Mar 2004
    Posts
    494
    You will probably need to have some Real Player code or know how real player launches when you hit the shortcut. After this you can use that to code it so real player launches only when the user enters the correct password and this in turn allows real player or maybe windows to execute the launch command for real player. In either case you will have to find out what makes real player launch. Just my idea, dont know if im right in anyway so dont hold to it.
    When no one helps you out. Call google();

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Your code needs to be basically at the level of a virus scanner - where it can validate every single attempt to run a program.

    Unless your users are naive, and its a simple matter of renaming the existing realplayer.exe to say secretplayer.exe and then calling your program realplayer.exe, most people will simply figure out how to bypass your code.
    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.

  4. #4
    Registered User Finchie_88's Avatar
    Join Date
    Aug 2004
    Posts
    154
    Here is interesting idea. Could you make the custom application start when the computer boots up, so that it runs in the background. Then you get the program that you write to wait for a thread from the real player application, so that unless your program is closed first people have to get the password rite. It's just an idea that I had, ofcourse there are still ways round it, but with a little development there could be some potential


  5. #5
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Code:
    Your code needs to be basically at the level of a virus scanner - where it can validate every single attempt to run a program.
    System-wide shell hook? Or is there a better way?
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  6. #6
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    You coulld just create an accounts where running these programs isn't allowed and one where they are.
    As for creating a program; A system wide hook of CreateProcess is probably the best since I think shell functions eventually call that function.
    Another idea would be to encrypt the target program using the password and have the password checker decrypt and run it.

  7. #7
    Attack hamster fuh's Avatar
    Join Date
    Dec 2002
    Posts
    176
    Stand in front of the computer and ask for the password everytime someone tries to open RealPlayer.

    On a more serious note, I agree with Salem. Just move realplayer to some hidden directory in the computer and make a program that asks for a password and name it realplayer.exe. If they enter the correct password open the real realplayer.

    Hey, that sounds cool! Real realplayer, real realplayer, real realplayer, real realplayer, real realplayer, real realplayer, real realplayer, real realplayer, real realplayer, real realplayer... Hehehe.
    Stupid things pop singers say

    "I get to go to lots of overseas places, like Canada."
    - Britney Spears

    "I love what you've done with the place!"
    -Jessica Simpson upon meeting the Secretary of Interior during tour of the White House

  8. #8
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    A System wide hook would be an option for this sort of thing, but it may be overkill. Another option would be to have a process run in the background, and enumerate all processes. If realplayer.exe is running, then you could terminate the process unless the user enters in a password.

    A system wide hook of CreateProcess is probably the best since I think shell functions eventually call that function.
    Actually, the functions you need to hook are CreateProcessA() and CreateProcessW(). Hooking API functions are tricky. It took me a long long time before I finally figured out how to do it.

  9. #9
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    I agree with Quantum1024's idea. To exand, here is a step by step guide.
    1. Set up a new user account
    2. Change the security on the realplayer.exe file so that only the new user account has read access.
    3. On the advanced options for the shortcut, check the Run with different credentials option.
    4. When the shortcut is invoked the user will be prompted for a user name and password. If they supply incorrect credentials, a permission denied error is shown.

    I just tried this solution and it appears to work well (on XP). It requires no code and should be a lot more secure than the other alternatives. On the downside, the new account may not be able to access files in the user's My Documents folder and the new account could be used to defeat auditing (probably not a concern in most cases).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  2. insufficient memory for tsr
    By manmohan in forum C Programming
    Replies: 8
    Last Post: 01-02-2004, 09:48 AM
  3. Date program starts DOS's date
    By jrahhali in forum C++ Programming
    Replies: 1
    Last Post: 11-24-2003, 05:23 PM
  4. Beginner needs help with password program
    By dnottus in forum C++ Programming
    Replies: 6
    Last Post: 04-22-2002, 06:46 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM