Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

intercept keyboard inputs

hi newbie here, first of all this is a great site. someday i hope to contribute some codes. anyway a question to all. how do you intercept keyboard inputs made by a user. what i want to be able to do is to prevent a user from deleting a file or folder in a given directory. i've searched for spying on a folder and logging the keys that was press, and i've also read something about low-level keyboard hooks. it works great, but only half of my problem was solved. any help would be very much appreciated. thanks.

p.s. if you have the time to email me, please do.
[582 byte] By [kulelat] at [2007-11-11 6:53:48]
# 1 Re: intercept keyboard inputs
files can be deleted in a lot of ways, thus intercepting any key press is not the solution (for example right click in the file in explorer and select Delete)
What are you trying to accomplish here? The only feasable solution is using Windows security
Marco
mstraf at 2007-11-11 17:27:45 >
# 2 Re: intercept keyboard inputs
well basically i want to protect my files (from being deleted or copied). i think i need to lock the folder where my files are. but i dont know how to do that. i've been searching the web but have not found any yet. do you have any idea on this?
kulelat at 2007-11-11 17:28:45 >
# 3 Re: intercept keyboard inputs
where are your files stored and from whom do you want to protect them? A local computer? A network? A web sites? Files installed in a customer's computer?
Marco
mstraf at 2007-11-11 17:29:46 >
# 4 Re: intercept keyboard inputs
i want to protect it from anyone trying to modify it, or delete, copy etc. it resides on a network computer, because employees have access to it, it's clearly visible using windows explorer. i read an article about managing low level keyboard hooks with api, i'm still experimenting on the code. it successfully blocks the key you specify but what about when the user right clicks on a file. also i'm searching how i can retrieve the current directory of the file.

Managing Low-Level Keyboard Hooks with the Windows API http://www.developer.com/net/vb/article.php/1502401
kulelat at 2007-11-11 17:30:51 >
# 5 Re: intercept keyboard inputs
You can set permissions on these files, using Windows Explorer. See following in MSDN:
http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/ServerHelp/87b011ec-b1b4-4baf-8ab0-53147b22a420.mspx
yhilewitz at 2007-11-11 17:31:49 >
# 6 Re: intercept keyboard inputs
If everyone can see those files (I am not helping you hiding anything illegal, do I) it is because they are in a shared folder. Just move them in a private folder, that is not shared, and/or change the permissions to those files to be read/write only by you. If you can't do that, it means that the administrators of your network do not want anyone have protected files, and in that case sorry, but I can't help you.
Marco
PS what are you trying to do will not work, because you will have to install that program in every machine that can access you pc
mstraf at 2007-11-11 17:32:48 >
# 7 Re: intercept keyboard inputs
what i want to do is for them not to be able to copy it, delete or rename the file. becaues it contains a list of sensitive records. anyway thanks for the time. maybe your right. oh and i'm not trying to hide anyting illegal. :P maybe i could think of something... someday... hopefully!
kulelat at 2007-11-11 17:33:49 >
# 8 Re: intercept keyboard inputs
If the file contains sensitive data, then that should NOT be stored in a network computer where everyone can access it! Please contact you manager and/or your IT department to find a solution, ASAP! Sensitive material should be encrypted (in case some stole the computer) and put in a server, in a folder with special permission. This is a IT issue that never should have been assigned to a programme to start with.
Sorry if I sound brusk, but I read too many laptops stolen containing social security numbers, medical records and private information that has never been encrypted...

Marco
mstraf at 2007-11-11 17:34:52 >
# 9 Re: intercept keyboard inputs
i couldn't agree more. although i'm wondering why they assigned it to me. thanks anyway.
kulelat at 2007-11-11 17:35:49 >
# 10 Re: intercept keyboard inputs
probably because they do not have a clue of waht they are doing, or they just want to delegate a problem they do not want to deal with. Time to start looking for another company? :-)
Marco
mstraf at 2007-11-11 17:36:50 >
# 11 Re: intercept keyboard inputs
actually... hehe. it's hard when ur a prog and they expect you (more like tell you) to do tech support. especially when ur doing something very important that losing your concentration will make you forget the logic that took you days to figure out, because there is always someone who doesn't know how to turn the monitor on or something like that. not that im complaining.
kulelat at 2007-11-11 17:37:59 >