QBasic Password program on Windows startup

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
User avatar
Pete
Site Admin
Posts: 887
Joined: Sun Dec 07, 2003 9:10 pm
Location: Candor, NY
Contact:

QBasic Password program on Windows startup

Post by Pete »

Here's another question for you guys to answer:
eraserx wrote:Hello Mr Berg,

Thank you very much for your help.

Isnt there a solution to my problem in QBasic? Because it will be a good exercise for me to make a password program for startup. I am not as good as you in QB programming and I thought that you could help me.

How can we make such a program in QB? I will wait for your helps.

Regards.
My response:
Pete wrote:Pete Berg
to eraserx
The problem is that you'd be running a DOS program in Windows 98. So no matter what, there's always a way to get out of the DOS prompt window. Your brother could press CTRL+ALT+DELETE to go to the close program window, or press the Windows key and have the start menu pop up and show the desktop. There are many other ways to get around this too. It would be very easy to circumvent.

Of course, if you're able to block all these loopholes (disable CTRL+ALT+DELETE, the Windows key, etc.,) you might be able to work.

-Pete
And his response.
eraserx wrote: Hello Mr Berg,

First off all, thanks for your answers. But I made a mistake in asking you for the password program. I wrote "a program for startup" but in fact I meant "a program at bootup". Sorry for this.

Now I made the correction. So How can we write the program in QB then
?

I hope I am not disturbing you.

Regards.
Any ideas?
Last edited by Pete on Mon Oct 24, 2005 2:05 pm, edited 1 time in total.
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

Put it in autoexec.bat.. if he's on Windows 2k or later, he's out of luck.
I have left this dump.
User avatar
Xerol
Veteran
Posts: 81
Joined: Tue Jan 04, 2005 6:27 pm
Location: Timonium, MD
Contact:

Post by Xerol »

Well, to get it at bootup, if it's Win98 or previous (he didn't say which OS he was running) you could just throw the compiled program into Autoexec.bat. In QB, you can create custom ON KEY events to trap ctrl-alt-del (which would just end up going back to the PW program again anyway), alt-tab, ctrl-break, ctrl-esc(which is the same as the Start key), etc. But, by running it in the autoexec.bat prior to loading windows, there's only 2 ways out of it:

1) Remove it from autoexec.bat AFTER you're logged in. If you shut down the computer whenever you're not using it, you shouldn't have to worry about this.
2) Use F* (not sure about the number, i think it's F6) to change to "line-by-line" autoexec.bat execution. Whoever was using it would just be able to skip over the program. Or if they bypassed autoexec altogether.

As far as the program itself goes, I'd say just do something like the following:

Code: Select all

'Insert ON KEY events here; I'd have to look it up to see the syntax. Basically you'd set keys for ctrl-alt-del, ctrl-break, and every other event you want to 'trap'. Then you'd call ON KEY(n) (where n = the key number you defined; I think custom keys start at 15) and send it to a dummy gosub.

10 input "Password:", z$
if z$ <> "password" then
 print "Invalid password."
 attempts = attempts + 1
 if attempts = 5 then print "Hack attempt detected. Locking Computer.": do: loop
 goto 10
else
 print "Correct password!"
 end
end if

I'd have to look up the syntax again for how to set custom keys (I haven't used them since GWBasic).
If you need music composed in MP3, WAV, or MIDI format, please contact me via email.

Xerol's Music - Updated Regularly!
madcrow
Newbie
Posts: 4
Joined: Thu Oct 20, 2005 1:30 pm

Post by madcrow »

Hmm... This reminds me of my big qbasic project that I did ages ago... It was a user account system for DOS that gave people home directories and custom autoexec.bat-type stuff. It was an ugly kludge of a qbasic program and a bunch of BAT files, but it worked...
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} »

The thing is that with all windows there is a way to bypass the autoexec.bat file. I have tried it... you just have to use the boot menu, and choose interactive startup or safe mode (or, if he was really evil, he would re-install your OS like thieves do).

The only way to do this is to set a password from the BIOs screen when it first starts up. A boot-level password prompy will stop him if he is computer illeterate though... at least, it PROBABLY will... just make sure you have the boot menu disabled.
Image
User avatar
Xerol
Veteran
Posts: 81
Joined: Tue Jan 04, 2005 6:27 pm
Location: Timonium, MD
Contact:

Post by Xerol »

Nathan1993 wrote:The thing is that with all windows there is a way to bypass the autoexec.bat file. I have tried it... you just have to use the boot menu, and choose interactive startup or safe mode (or, if he was really evil, he would re-install your OS like thieves do).
Yes, I did mention that, although the "best" way to bypass it would be to set it into item-by-item mode, and only choose to not execute the password protection program.
If you need music composed in MP3, WAV, or MIDI format, please contact me via email.

Xerol's Music - Updated Regularly!
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} »

Xerol wrote:
Nathan1993 wrote:The thing is that with all windows there is a way to bypass the autoexec.bat file. I have tried it... you just have to use the boot menu, and choose interactive startup or safe mode (or, if he was really evil, he would re-install your OS like thieves do).
Yes, I did mention that, although the "best" way to bypass it would be to set it into item-by-item mode, and only choose to not execute the password protection program.
Item by item mode is interactive startup, as I stated. Mcrap just calls it an interactive startup.
Image
User avatar
OlafTheGreat
Newbie
Posts: 1
Joined: Mon Oct 24, 2005 9:52 pm

Post by OlafTheGreat »

I made one of these once. What I did to make it come up at startup was name it C:\WIN.EXE
Then I had it run C:\WINDOWS\system32\WIN.COM if the password was correct. I am running XP. The only problem I had with it was when I tried to have mouse support for it.
Post Reply