Click here to Skip to main content
15,881,455 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
Hello everyone!
i am wondering how would i go about unlocking(not locking) my computer using windows credentials.
i have read that i would need to run some sort of service to do this.
how would i do so?
i know this is a pretty vague question but i have searched all over CP but haven't really found much.
i had the idea to setup an automated lock/unlocking app, it would lock the computer at the specified time and unlock at another specified time(like an hour after it locked it self).
now i can easily lock my pc through a P/invoke statement of the LockWorkStation(); method.
but i want to unlock the work station(from what i have read on the subject i will have to use the windows credential service)
i would also like to know how to read keystrokes when the computer is locked.
yes i know that is a iffy topic but i am curious(i promise i won't do anything bad with this knowledge)
oh and this is kinda of off topic but how do i find out what version of C# i am using?
thanks for all of your help in advance,
masterCodeon
Posted
Updated 31-Dec-14 9:40am
v2
Comments
Sergey Alexandrovich Kryukov 31-Dec-14 15:40pm    
First question you should ask, first of all, yourself: why?
And who is supposed to trigger such unlock, and why?
—SA
MasterCodeon 31-Dec-14 15:42pm    
i had for automation purposes.
think of this scenario:
its 12:00, lunch time. I want my app i am making to lock my pc and after an hour(or whatever amount of time i specify it will then unlock the computer automatically. that way, come 1:00 i don't have to type my password and log back in, my app will do that for me(i am kind of lazy that way)
Sergey Alexandrovich Kryukov 31-Dec-14 15:44pm    
Remotely or just at the local workstation? Do you understand the security issues with that?
—SA
MasterCodeon 31-Dec-14 15:48pm    
just the local computer.
and this is just for my personal use, yes i do understand the security issues with that but this is only for my personal use, not for a professional environment.
Sergey Alexandrovich Kryukov 31-Dec-14 16:14pm    
I don't think you are trying to help yourself. You just want to compromise safety, reduce your control, not really saving your time. Don't you just want to do a tricky exercise? I don't see why it would be interesting.
—SA

1 solution

You cannot write an application to unlock the console. There is no API function you can call to do this. This is for security reasons.

Also, you cannot log keystrokes while the desktop is locked. This is because your application is running under one desktop (the users) and the lock screen is a different desktop. Again, this is for security reasons.

Keystrokes are not broadcast to all desktop sessions. They are only ever sent to the desktop that is visible.

Basically, Windows has these features specifically to prevent you from doing what you want to do - for security reasons.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 31-Dec-14 22:53pm    
Agree, 5ed.
—SA
Snesh Prajapati 1-Jan-15 12:18pm    
Well said. Thanks.
MasterCodeon 2-Jan-15 9:33am    
well what if i ran this app i am proposing as a service in the lock desktop session?
Dave Kreskowiak 2-Jan-15 10:21am    
Again, the services run under a desktop separate desktop, separate from the lock screen and separate from the one the user sees. Keyboard and mouse input are never seen by the services desktop so no, you can't do it from a service either.
MasterCodeon 2-Jan-15 9:38am    
i reason this:
if hackers can physically destroy your machine from anywhere in the world(and keep in mind that machines they are destroying are running windows which has all this claimed security) why can't i do i much more simple task of unlocking my computer from a background app?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900