It isnt possible to get the user password, however you can validate it using the follow api call
const int LOGON32_LOGON_INTERACTIVE = 2;
const int LOGON32_PROVIDER_DEFAULT = 0;
[DllImport("advapi32.dll", SetLastError=true)]
private static extern bool LogonUser(String lpszUsername, String lpszDomain, String lpszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken);
private void DoLogonCheck(string userName, string domainName, string password)
{
IntPtr phToken = IntPtr.Zero;
bool logonRes = LogonUser(
userName,
domainName,
password,
LOGON32_LOGON_INTERACTIVE,
LOGON32_PROVIDER_DEFAULT,
ref phToken);
if (logonRes)
{
Console.WriteLine("Good logon with username : {0}", userName)
}
else
{
Console.WriteLine("Bad logon with username : {0}", userName)
}
}
I use a similar piece of code to validate that the user true user is sat in front of the machine and not that they have left it unlocked.