LoginAPI: Properly handle ERROR_ACCOUNT_DISABLED

This commit is contained in:
Tal Aloni 2017-01-19 00:23:22 +02:00
parent 14cae2a68c
commit d34565f080
2 changed files with 7 additions and 4 deletions

View file

@ -8,9 +8,10 @@ namespace SMBLibrary
ERROR_ACCESS_DENIED = 0x0005,
ERROR_SHARING_VIOLATION = 0x0020,
ERROR_DISK_FULL = 0x0070,
ERROR_LOGON_FAILURE = 0x0000052E,
ERROR_ACCOUNT_RESTRICTION = 0x0000052F,
ERROR_LOGON_TYPE_NOT_GRANTED = 0x00000569,
NERR_NetNameNotFound = 0x00000906
ERROR_LOGON_FAILURE = 0x052E,
ERROR_ACCOUNT_RESTRICTION = 0x052F,
ERROR_ACCOUNT_DISABLED = 0x0533,
ERROR_LOGON_TYPE_NOT_GRANTED = 0x0569,
NERR_NetNameNotFound = 0x0906,
}
}

View file

@ -45,6 +45,7 @@ namespace SMBLibrary.Authentication.Win32
{
uint error = (uint)Marshal.GetLastWin32Error();
if (error == (uint)Win32Error.ERROR_ACCOUNT_RESTRICTION ||
error == (uint)Win32Error.ERROR_ACCOUNT_DISABLED ||
error == (uint)Win32Error.ERROR_LOGON_FAILURE ||
error == (uint)Win32Error.ERROR_LOGON_TYPE_NOT_GRANTED)
{
@ -69,6 +70,7 @@ namespace SMBLibrary.Authentication.Win32
{
uint error = (uint)Marshal.GetLastWin32Error();
return (error == (uint)Win32Error.ERROR_ACCOUNT_RESTRICTION ||
error == (uint)Win32Error.ERROR_ACCOUNT_DISABLED ||
error == (uint)Win32Error.ERROR_LOGON_TYPE_NOT_GRANTED);
}
}