Brian Desmond's Blog

Inherits Network.Admin
Implements IOneManBand

Shortcut to Lock Computer on Win2k

Tim posted a list of handy Windows keyboard shortcuts. Someone pointed out in his comments that some of these don't work on all versions of Windows, such as Win + L which will lock your machine on XP & 2003, but not 2000.

Fortunately, this particular shortcut is easy enough to fix! Create a new shortcut on your desktop, hard drive, or elsewhere. Set this shortcut to run “rundll32 user32,LockWorkStation”. Once the shortcut is created, right click it, goto properties, click in the Shortcut Key text box, and press Win + L. Win + L will now lock your machine.

EDIT: Raymond Chen tells me I shouldn't be doing this rundll32 trick. I've never had it fail on me, and I don't exactly understand what would cause it to, so all I can say, while this trick works, one of the guru's behind Windows says don't use it., so, use the LockWorkStation entrypoint at your own discretion.

Comments

Ron Krauter said:

You are a bad man! Thanks for the tip.
# December 12, 2003 12:04 AM

Raymond Chen said:

Please don't do this. The LockWorkStation function was not designed to be run via Rundll32. To be run via Rundll32 a function needs to match a very specific function signature, which LockWorkStation doesn't. As a result, the stack is misaligned on return and what happens next is anybody's guess.

I'm severely tempted to fix Longhorn so it enforces the function call signature strictly for Rundll32 - people are abusing it pretty badly.
# December 12, 2003 1:52 AM

dvz said:

Perhaps Raymond or someone could make a constructive suggestion as to what to use instead of rundll32 then.
If something is broken (win2k), and a workaround is found (rundll32), either fix the original problem or get an acceptable workaround. Don't just say "don't do it", and then try to stop people.
Raymond is not addressing the real problem.
# January 15, 2004 4:03 AM

TrackBack said:

# January 15, 2004 11:03 AM

asdf said:

// Use this instead:

#define _WIN32_WINNT 0x0500
#include <windows.h>

int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
LockWorkStation();
return 0;
}
# January 15, 2004 1:12 PM

asdf said:

Also pushing CTRL+ALT+DEL then pushing enter locks your computer in win2k. Which is much easier and faster to type than WINKEY+L in my opinion.
# January 15, 2004 2:00 PM

Ben said:

I tried to create the shortcut and it wouldn't allow me to add the keyboard shortcut "Win + L", but it worked fine. Also, if you are not supposed to do this but it worked, could anything serious go wrong with the system by using the rundll32 shortcut.
# February 6, 2004 2:27 AM

Dave Warren said:

Maybe a valid command line workaround would be a better idea?

As funky as a little bit of code is, that isn't practical for your average end user.

Personally, all I want is to have one of my keyboard keys programmed to lock the workstation. Faster then winkey+L, faster then ctrl-alt-del L, faster then anything else.
# February 16, 2004 4:41 AM

Stevers said:

Microsoft has an article for this procedure, and windows 2000 is in that list. So they obviously see it as ok.

http://support.microsoft.com/?kbid=314969
# February 19, 2004 3:21 PM

NoOneInParticular said:

Clearly Raymond Chen doesn't know what the heck he's talking about since this above link to the microsoft support site essentially recommends rundll32 user32,LockWorkStation.

Then again, MS Support could be wrong too... It wouldn't be the first time.

In any case, nice trick! I like it.
# April 14, 2004 1:39 PM

milbertus said:

I can't speak for anyone else, but I would tend to believe Raymond Chen over Windows Support. Who was it that actually works on Windows again? ;)
# April 23, 2004 10:01 PM

sasi said:

I want to kow how to enable autolock in win2000 profesiional
# May 12, 2004 5:19 AM

Spark said:

Here it is years later and the none-MS recommended way of doing it is still all that's available? Someone wrote a little hack to do it but I tend to be suspicious of things like that.

# January 13, 2010 5:50 PM

Drewfus said:

Spark, try this little hack;

www.pluralsight.com/.../3805.aspx

# February 6, 2010 10:31 PM

Marcus said:

Nice story you got here. It would be great to read a bit more about this theme. Thanks for giving that data.

# February 12, 2010 3:07 AM

Summer Cooper said:

Undoubtfully interesting article u have here. It'd be just great to read something more about this theme. Thanx for sharing this info.

Summer Cooper

<a href="www.waybiz.com/">how to find products</a>

# May 4, 2010 6:50 AM

phone jamming said:

And what about adding some more images?  I don’t want to offend anyone, text is really nice. Just according to the scientists visitors acquire information much more effective if they see certain useful pictures.

Stacy Tayfon

# May 12, 2010 4:23 PM

Lose your head said:

Indeed it is extremely interesting for me to read the article. Thanx for it. I like such themes and anything that is connected to them. I would like to read more soon.

# May 23, 2010 8:37 AM

Indian escorts services said:

Truly nice blog to pay attention to to my thinking. The only question I have, why haven't you you place that article to social bookmarking sites? This should bring pretty big traffic here.

# May 30, 2010 1:33 PM

woman companion said:

Rather good domain to spend some time on reading it to my mind. I have a question, why haven't you you place it to social bookmarking sites? It might bring much traffic to this domain.

# June 17, 2010 4:56 AM

girls brunette said:

Undoubtfully nice post you got here. It would be great to read a bit more concerning such theme. Thanx for giving that info.

Sophie COOPER

# June 24, 2010 12:08 PM

south london escort said:

It is rather interesting for me to read that blog. Thanks for it. I like such topics and everything that is connected to them. I would like to read a bit more soon. By the way, rather good design you have here, but don’t you think it should be changed every few months?

Mary Swingfield

# July 8, 2010 2:24 PM

Avril Smith said:

Pretty nice blog you've got here. Thanks the author for it. I like such topics and everything that is connected to them. I would like to read more soon.

Avril Smith

<a href="kievcityescort.com/">kiev escort service</a>

# September 27, 2010 1:12 AM

London escorts spanish said:

I would like to read more on that blog soon. By the way, pretty nice design this blog has, but don’t you think it should be changed once in a few months?

# October 21, 2010 3:29 AM

Herbal cigarettes said:

"Nice post! GA can also be my greatest earning. However, it’s not a significantly."

--------------------------------------------

my website is  

http://howtobbq.org

Also welcome you!

# November 23, 2010 4:58 AM

Kate Swingfield said:

Wow, rather great post. Where will I get this RSS?

Kate  Swingfield

<a href="www.wirelesscameradetectors.com/">bug sweeping equipment</a>

# November 24, 2010 7:16 PM

Joan Kuree said:

Impressive page. Ready to read more.  

Joan Kuree    

<a href="parisescort.info/">anaelle escorte girl black paris</a>

# December 16, 2010 12:01 PM

ipad stand said:

-----------------------------------------------------------

"Hi. this really is kind of an -unconventional- query , but have other site visitors asked you how get the menu bar to seem like you've got it? I also possess a blog site and am  really looking to alter close to the theme, nonetheless am scared to death to mess with it for fear with the search engines punishing me. I am very new to all of this  ...so i'm just not positive precisely tips on how to try to to it all however. I'll just maintain operating on it one particular day at a time."

# January 4, 2011 4:48 AM

Avril Hakkinen said:

It was extremely interesting for me to read that post. Thanx for it. I like such themes and anything connected to this matter. I would like to read more soon.

Avril Hakkinen

<a href="rome-escort.info/">anita roma escort</a>

# January 5, 2011 6:33 AM

best ipad stand said:

-----------------------------------------------------------

"In looking for sites associated to word wide web internet hosting and particularly comparison internet hosting linux plan net,your internet site arrived up."

# January 9, 2011 3:59 AM

Anete Benedict said:

Rather cool site you've got here. Thanx for it. I like such themes and everything that is connected to them. I definitely want to read more soon.  

Anete Benedict  

<a href="nyescorts.net/">asian massage new york</a>

# January 21, 2011 1:10 PM

Computerist said:

hi.

its impossible set Shortcut Key to "Win + L" key in windows 2000 pro.

how you do it.?

# January 24, 2011 1:55 PM

Avril Simpson said:

Pretty nice place you've got here. Thanx for it. I like such themes and everything connected to them. I definitely want to read more on that blog soon.

Avril Simpson    

<a href="milanescorts.com/">escort milan gfe</a>

# March 10, 2011 4:31 PM

Jane Stone said:

It is rather interesting for me to read that article. Thanks for it. I like such topics and anything that is connected to them. I definitely want to read more soon.        

Jane  Stone      

<a href="rome-escort.info/">escorts girls roma</a>

# March 18, 2011 1:21 PM

nyroc said:

Raymond is CORRECT!!! Notice how Microsoft has removed that page from their servers? Do some research people, dont just use the easy way. Raymond does in fact address the problem when he states that the stack is misaligned upon return. See the following link: blogs.msdn.com/.../58973.aspx

# April 30, 2011 7:04 PM

tryecrot said:

Yes there should realize the opportunity to RSS commentary, quite simply, CMS is another on the blog.

# August 29, 2011 7:54 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)