Pārlūkot izejas kodu

LoginAPI: Properly handle ERROR_ACCOUNT_DISABLED

Tal Aloni 8 gadi atpakaļ
vecāks
revīzija
d34565f080

+ 5 - 4
SMBLibrary/Enums/Win32Error.cs

@@ -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,
     }
 }

+ 2 - 0
SMBLibrary/Win32/Authentication/LoginAPI.cs

@@ -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);
             }
         }