There is an executable file on my Windows machine which I want to protect from unauthorized access. To achieve this, I'd like to write a program/script in C++ that prompts the user for username/password when the exe file is double-clicked; the actual username/passwod is stored on a separate machine with PostgreSQL running. So I want my program to communicate in PHP with the Postgre database...
Now, the problem is that I don't have a clue how to 1) implement the window that asks for user/pass and 2) how to make the program communicate with the database.
Bearing in mind that I have some knowledge of PHP, Postgre, and C++, can somebody possibly offer a solution/code? Also if you think there's an easier way of approaching this, then please advise. Appreciations in advance.
P.S> By the way I haven't dealt with GUI's in C++.
How about just using windows built in function and only allow specific users to access that file?
you can register the file extension in HKEY_CLASS_ROOT which will contain the name of the program to execute when the file is double-clicked in Windows Explorer. But there are other ways to open the file too, so just catching double-clicks is not fullproof. For example I would right click on the file then select Send To-->Notepad shortcut or some other text editor.
Thanks for your reply. I need to do it by using the Postgre database, for a reason that there is no necessity to explain it.
I came up also with another sol'n (which is not C++ related)... to use a batch file in order to, upon execution of the file, redirect the user to a specific html page, asking for username/password. this page uses PHP to connect to Postgre and do the reset... However, in that case I don't know how to make it such that the user will not be allowed to access the file unless the correct username/pass combination is entered.
EDIT: Thanks Ancient Dragon for your reply too. By "double-clicking" I meant trying to execute the file and not necessarily the literal meaning of the term. Sorry for the confusion.