Here is my code that i am working on. Upon running the exe, it asks the user for a temporary password. After that, the screen saver pops up. Upon exiting the screen saver, the console will ask you for the temporary pass that you entered in order to renable the desktop.
So my question is, everything is compiling fine with no errors or warnings, but when i run the program i have a few problems. Everything works up to when the console asks for the password again to initialize the desktop, instead of attempting to verify the correct password, the program just ends.
#include <windows.h>
#include <iostream>
#include <winable.h>
using namespace std;
int rePass(0); //first password
int rePassb(1); //password to compare
int main()
{
cout << "Set Recovery pass: ";
cin >> rePass;
cin.get();
SendMessage(GetDesktopWindow(), WM_SYSCOMMAND, SC_SCREENSAVE, 0); //Start screen saver
//Saftey precaution to prevent instant screen saver disable by accedental mouse movement
BlockInput(1);
Sleep(2000);
BlockInput(0);
//Sloppy idle process until screen saver is disabled
do{
system("PAUSE");
}
while(SC_SCREENSAVE == 1);
Sleep(2000);
EnableWindow(GetDesktopWindow(), 0); //Deactivate desktop
//Tests if the intial password that was set matches the new password entered in order to enable desktop
PassCheck:
cout << "Enter Recovery Pass: ";
cin >> rePassb;
if(rePassb == rePass)
{
cout << "Re-Enabling Windows...";
EnableWindow(GetDesktopWindow(), 1); //Enable desktop if password was entered sucessfully
Sleep(2000);
}
else
{
cout << "Incorrect Password..." << endl << "Enter Recovery Pass: ";
goto PassCheck; //Sends user back up to initial password entry
}
cin.get();
return 0;
}