PC Review


Reply
Thread Tools Rate Thread

Automatic logon lost password?

 
 
jeremy_ho@my-deja.com
Guest
Posts: n/a
 
      21st Sep 2005
Today I have a complain that the administrator account is asking for
the password, they do not know the password and do not have a keyboard
to type it in.

I was wondering if anyone has run into this problem, everything worked
flawlessly until this incident.

I do have some code to shutdown the computer with power button pressed,
I wonder if it has anything to do with this, because occasionally this
code would only log you off, not shut down the computer.

Here is the code involved

m_shutdown_msg = RegisterWindowMessage(WM_SYSTEM_SHUTDOWN);
SendMessage(HWND_BROADCAST, m_shutdown_msg, 0, 0);

Sleep(1000);

//change privilege and then force shutdown
HANDLE hProcessHandle = GetCurrentProcess();
HANDLE hTokenHandle;
TOKEN_PRIVILEGES NewPriv;

OpenProcessToken(hProcessHandle, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
&hTokenHandle);

NewPriv.PrivilegeCount = 1;
NewPriv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

LookupPrivilegeValue("", SE_SHUTDOWN_NAME,
&NewPriv.Privileges[0].Luid); //look up privileges

AdjustTokenPrivileges(hTokenHandle, FALSE, &NewPriv, 0, NULL, NULL);
//adjust with new token

ExitWindowsEx(EWX_POWEROFF| EWX_FORCE, 0); //turn off (force = does
not ask programs to save data)

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lost my logon password fingernprint logon still working M.Sathish Kumar Windows Vista Administration 1 28th Apr 2008 09:50 PM
Automatic Logon & Password Jay Somerset Windows Vista Installation 2 23rd Nov 2007 05:06 PM
Password Expired with Automatic Logon =?Utf-8?B?Sm9lIEI=?= Windows XP Embedded 3 12th Apr 2007 08:17 AM
Automatic logon with current username and password Andrew Bryce, Sr. Microsoft Windows 2000 Registry 1 9th Sep 2005 08:20 PM
XP to W2K server: Automatic logon/password nkjg Windows XP Networking 0 31st Mar 2004 09:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:58 PM.