News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

how to lock keyboard

Started by ossama, November 24, 2007, 05:22:33 PM

Previous topic - Next topic

ossama

hi,
is there source code in masm show how to make the keyboard do not repond to any keypress ,until the user inters a password to unlock it,
thank you

ossama

sorry for the typing mistakes, i am writting a program that will not let the user use his computer until he/she enters a password (to unlnock the keyboard and the mouse), is is possible to do this?

codmajik

Yeh it's possible.

Create a Keyboard Hook with
             invoke SetWindowsHook,WH_KEYBOARD,...........

eat-up all special purpose keys [Alt, Ctrl, WinKey, Menu Key, even function keys].
                        ie. Don't call the "CallNextHookEx" API

Unload Keyboad hook
                        invoke UnhookWindowsHook,..........

I wrote a sample in vb6  4yrs ago for my internet cafe billing system
i would convert the code to masm and post it

MichaelW

ossama,

Let me get this straight, you want to create a program that when run on someone else’s multi-tasking system will interfere with there ability to use the system, even for other tasks. How is this going to accomplish anything good?

codmajik,

And you want to help him do it. I was actually hoping that this thread would just quietly die.
eschew obfuscation

donkey

Hi MichaelW,

Well, I can see at least 1 practical application, it can allow you to quickly lock your computer if you are running Win9x or Win2K, the lock ([WinLogo] + L) combination only works on XP or better and as you know logging off then back on a system without fast user switching can be a pain. As codmajik posted, this is a simple Windows hook program and ossama should be able to muddle through it without farming code from others.

http://msdn2.microsoft.com/en-us/library/ms644960.aspx
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Mark Jones

There could be many legitimate uses for a keyboard lock, and there could also be even more illegitimate ones. I'll just wait to see what Steve has to say. :bg

What ever happened to the physical keyboard lock on the front of the PC? How about creating Users in Windows and just pressing <CTRL-ALT-DEL> then <Enter> to lock the workstation? And there are already many free softwares out there that can lock up the keyboard outside of these instances, and if that isn't strong enough security, a hardware solution could be used. Then again, if anyone is keeping information that valuable on their PC, then it shouldn't be running Windows...
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

MichaelW

I have no problem with code that is intended to prevent others from using your computer. My problem is with code that takes over someone else’s system and interferes with them using it. If the intention is to prevent/deter unauthorized use of the program, then locking the keyboard is obviously a bad way to accomplish that.
eschew obfuscation

ossama

hello all, i was offline these days, it is my studies,any way, this program that i am writing is for a cybercafe billing system, i am writting a client program (installed on client computer) that will unlock the keyborad (maybe mouse too) until the owner of the cybercafe unlock his computer, (sorry for my bad english),so i am not writting a virus or some thing else  :cheekygreen:

ossama

thnx codmajik for the info, i will read msdn (i have msdn 2005) about windows hooks,and i wait you for your source code (masm version).

sinsi

Light travels faster than sound, that's why some people seem bright until you hear them.

u

cybercafes here ever since 1998 use a "Shell", and locking is remotely controlled by the server-computer. (Passwords were later introduced only for prepaid subscribers) But there you simply replace Explorer.exe and make hooks to prevent IE/Firefox from running external apps.
http://www.keokitrask.com/EDL/CyberCafe.htm seems free and good, btw

On Win98SE, I used to simply put c:\explorer.exe, that was a simple dialog-box that launched c:\windows\explorer.exe and exited only when the password was typed. This will be the easiest solution, I think - simply stop explorer.exe and wait for the pass to run it again.
Please use a smaller graphic in your signature.

ossama

thnx Ultrano , but about the CTRL+ALT+Del combination , it will show the task manager (i am working in xp sp2) whch then can be used to execute the explorer.exe again

Mark Jones

There are ways to disable this capability in windows, I forget what it is at the moment (probably a registry edit), but you could easily find the answer using Google.
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

ossama

Ultrano : i have seen the software that you give me (cybercafe), yes it locks the keybord, and does not let the user do CTRL+ALT+DEL combination, the win key does not work,  ....
is there a source code showing how to do like that (in masm)

Ehtyar

I wrote one of these for college, as everyone in the class knew the password to every computer (different logins with same password). It worked for a while until someone realized the power button still worked :S

Ehtyar.