1 /***********************************************************************\ 2 * subauth.d * 3 * * 4 * Windows API header module * 5 * * 6 * Translated from MinGW Windows headers * 7 * * 8 * Placed into public domain * 9 \***********************************************************************/ 10 module windows.subauth; 11 nothrow: 12 private import windows.ntdef, windows.windef; 13 14 /+ 15 alias LONG NTSTATUS; 16 alias NTSTATUS* PNTSTATUS; 17 +/ 18 19 enum : ULONG { 20 MSV1_0_PASSTHRU = 1, 21 MSV1_0_GUEST_LOGON = 2 22 } 23 24 // USER_ALL_INFORMATION.WhichFields (Undocumented) 25 const ULONG 26 MSV1_0_VALIDATION_LOGOFF_TIME = 1, 27 MSV1_0_VALIDATION_KICKOFF_TIME = 2, 28 MSV1_0_VALIDATION_LOGON_SERVER = 4, 29 MSV1_0_VALIDATION_LOGON_DOMAIN = 8, 30 MSV1_0_VALIDATION_SESSION_KEY = 16, 31 MSV1_0_VALIDATION_USER_FLAGS = 32, 32 MSV1_0_VALIDATION_USER_ID = 64; 33 34 // ?ActionsPerformed? (Undocumented) 35 const MSV1_0_SUBAUTH_ACCOUNT_DISABLED = 1; 36 const MSV1_0_SUBAUTH_PASSWORD = 2; 37 const MSV1_0_SUBAUTH_WORKSTATIONS = 4; 38 const MSV1_0_SUBAUTH_LOGON_HOURS = 8; 39 const MSV1_0_SUBAUTH_ACCOUNT_EXPIRY = 16; 40 const MSV1_0_SUBAUTH_PASSWORD_EXPIRY = 32; 41 const MSV1_0_SUBAUTH_ACCOUNT_TYPE = 64; 42 const MSV1_0_SUBAUTH_LOCKOUT = 128; 43 44 const NEXT_FREE_ACCOUNT_CONTROL_BIT = 131072; 45 46 const SAM_DAYS_PER_WEEK = 7; 47 const SAM_HOURS_PER_WEEK = 168; 48 const SAM_MINUTES_PER_WEEK = 10080; 49 50 enum : NTSTATUS { 51 STATUS_SUCCESS = 0, 52 STATUS_INVALID_INFO_CLASS = 0xC0000003, 53 STATUS_NO_SUCH_USER = 0xC0000064, 54 STATUS_WRONG_PASSWORD = 0xC000006A, 55 STATUS_PASSWORD_RESTRICTION = 0xC000006C, 56 STATUS_LOGON_FAILURE = 0xC000006D, 57 STATUS_ACCOUNT_RESTRICTION = 0xC000006E, 58 STATUS_INVALID_LOGON_HOURS = 0xC000006F, 59 STATUS_INVALID_WORKSTATION = 0xC0000070, 60 STATUS_PASSWORD_EXPIRED = 0xC0000071, 61 STATUS_ACCOUNT_DISABLED = 0xC0000072, 62 STATUS_INSUFFICIENT_RESOURCES = 0xC000009A, 63 STATUS_ACCOUNT_EXPIRED = 0xC0000193, 64 STATUS_PASSWORD_MUST_CHANGE = 0xC0000224, 65 STATUS_ACCOUNT_LOCKED_OUT = 0xC0000234 66 } 67 68 // Note: undocumented in MSDN 69 // USER_ALL_INFORMATION.UserAccountControl 70 const ULONG 71 USER_ACCOUNT_DISABLED = 1, 72 USER_HOME_DIRECTORY_REQUIRED = 2, 73 USER_PASSWORD_NOT_REQUIRED = 4, 74 USER_TEMP_DUPLICATE_ACCOUNT = 8, 75 USER_NORMAL_ACCOUNT = 16, 76 USER_MNS_LOGON_ACCOUNT = 32, 77 USER_INTERDOMAIN_TRUST_ACCOUNT = 64, 78 USER_WORKSTATION_TRUST_ACCOUNT = 128, 79 USER_SERVER_TRUST_ACCOUNT = 256, 80 USER_DONT_EXPIRE_PASSWORD = 512, 81 USER_ACCOUNT_AUTO_LOCKED = 1024, 82 USER_ENCRYPTED_TEXT_PASSWORD_ALLOWED = 2048, 83 USER_SMARTCARD_REQUIRED = 4096, 84 USER_TRUSTED_FOR_DELEGATION = 8192, 85 USER_NOT_DELEGATED = 16384, 86 USER_USE_DES_KEY_ONLY = 32768, 87 USER_DONT_REQUIRE_PREAUTH = 65536, 88 89 USER_MACHINE_ACCOUNT_MASK = 448, 90 USER_ACCOUNT_TYPE_MASK = 472, 91 USER_ALL_PARAMETERS = 2097152; 92 93 /+ 94 struct UNICODE_STRING { 95 USHORT Length; 96 USHORT MaximumLength; 97 PWSTR Buffer; 98 } 99 alias UNICODE_STRING* PUNICODE_STRING; 100 101 struct STRING { 102 USHORT Length; 103 USHORT MaximumLength; 104 PCHAR Buffer; 105 } 106 alias STRING* PSTRING; 107 +/ 108 109 mixin DECLARE_HANDLE!("SAM_HANDLE"); 110 alias SAM_HANDLE* PSAM_HANDLE; 111 112 struct OLD_LARGE_INTEGER { 113 ULONG LowPart; 114 LONG HighPart; 115 } 116 alias OLD_LARGE_INTEGER* POLD_LARGE_INTEGER; 117 118 enum NETLOGON_LOGON_INFO_CLASS { 119 NetlogonInteractiveInformation = 1, 120 NetlogonNetworkInformation, 121 NetlogonServiceInformation, 122 NetlogonGenericInformation, 123 NetlogonInteractiveTransitiveInformation, 124 NetlogonNetworkTransitiveInformation, 125 NetlogonServiceTransitiveInformation 126 } 127 128 129 const CYPHER_BLOCK_LENGTH = 8; 130 const USER_SESSION_KEY_LENGTH = CYPHER_BLOCK_LENGTH * 2; 131 const CLEAR_BLOCK_LENGTH = 8; 132 133 struct CYPHER_BLOCK { 134 CHAR[CYPHER_BLOCK_LENGTH] data; 135 } 136 alias CYPHER_BLOCK* PCYPHER_BLOCK; 137 138 struct CLEAR_BLOCK { 139 CHAR[CLEAR_BLOCK_LENGTH] data; 140 } 141 alias CLEAR_BLOCK* PCLEAR_BLOCK; 142 143 struct LM_OWF_PASSWORD { 144 CYPHER_BLOCK[2] data; 145 } 146 alias LM_OWF_PASSWORD* PLM_OWF_PASSWORD; 147 148 struct USER_SESSION_KEY { 149 CYPHER_BLOCK[2] data; 150 } 151 alias USER_SESSION_KEY* PUSER_SESSION_KEY; 152 153 alias CLEAR_BLOCK LM_CHALLENGE; 154 alias LM_CHALLENGE* PLM_CHALLENGE; 155 156 alias LM_OWF_PASSWORD NT_OWF_PASSWORD; 157 alias NT_OWF_PASSWORD* PNT_OWF_PASSWORD; 158 alias LM_CHALLENGE NT_CHALLENGE; 159 alias NT_CHALLENGE* PNT_CHALLENGE; 160 161 struct LOGON_HOURS { 162 USHORT UnitsPerWeek; 163 PUCHAR LogonHours; 164 } 165 alias LOGON_HOURS* PLOGON_HOURS; 166 167 struct SR_SECURITY_DESCRIPTOR { 168 ULONG Length; 169 PUCHAR SecurityDescriptor; 170 } 171 alias SR_SECURITY_DESCRIPTOR* PSR_SECURITY_DESCRIPTOR; 172 173 align(4): 174 struct USER_ALL_INFORMATION { 175 LARGE_INTEGER LastLogon; 176 LARGE_INTEGER LastLogoff; 177 LARGE_INTEGER PasswordLastSet; 178 LARGE_INTEGER AccountExpires; 179 LARGE_INTEGER PasswordCanChange; 180 LARGE_INTEGER PasswordMustChange; 181 UNICODE_STRING UserName; 182 UNICODE_STRING FullName; 183 UNICODE_STRING HomeDirectory; 184 UNICODE_STRING HomeDirectoryDrive; 185 UNICODE_STRING ScriptPath; 186 UNICODE_STRING ProfilePath; 187 UNICODE_STRING AdminComment; 188 UNICODE_STRING WorkStations; 189 UNICODE_STRING UserComment; 190 UNICODE_STRING Parameters; 191 UNICODE_STRING LmPassword; 192 UNICODE_STRING NtPassword; 193 UNICODE_STRING PrivateData; 194 SR_SECURITY_DESCRIPTOR SecurityDescriptor; 195 ULONG UserId; 196 ULONG PrimaryGroupId; 197 ULONG UserAccountControl; 198 ULONG WhichFields; 199 LOGON_HOURS LogonHours; 200 USHORT BadPasswordCount; 201 USHORT LogonCount; 202 USHORT CountryCode; 203 USHORT CodePage; 204 BOOLEAN LmPasswordPresent; 205 BOOLEAN NtPasswordPresent; 206 BOOLEAN PasswordExpired; 207 BOOLEAN PrivateDataSensitive; 208 } 209 alias USER_ALL_INFORMATION* PUSER_ALL_INFORMATION; 210 align: 211 212 struct MSV1_0_VALIDATION_INFO { 213 LARGE_INTEGER LogoffTime; 214 LARGE_INTEGER KickoffTime; 215 UNICODE_STRING LogonServer; 216 UNICODE_STRING LogonDomainName; 217 USER_SESSION_KEY SessionKey; 218 BOOLEAN Authoritative; 219 ULONG UserFlags; 220 ULONG WhichFields; 221 ULONG UserId; 222 } 223 alias MSV1_0_VALIDATION_INFO* PMSV1_0_VALIDATION_INFO; 224 225 struct NETLOGON_LOGON_IDENTITY_INFO { 226 UNICODE_STRING LogonDomainName; 227 ULONG ParameterControl; 228 OLD_LARGE_INTEGER LogonId; 229 UNICODE_STRING UserName; 230 UNICODE_STRING Workstation; 231 } 232 alias NETLOGON_LOGON_IDENTITY_INFO* PNETLOGON_LOGON_IDENTITY_INFO; 233 234 struct NETLOGON_INTERACTIVE_INFO { 235 NETLOGON_LOGON_IDENTITY_INFO Identity; 236 LM_OWF_PASSWORD LmOwfPassword; 237 NT_OWF_PASSWORD NtOwfPassword; 238 } 239 alias NETLOGON_INTERACTIVE_INFO* PNETLOGON_INTERACTIVE_INFO; 240 241 struct NETLOGON_GENERIC_INFO { 242 NETLOGON_LOGON_IDENTITY_INFO Identity; 243 UNICODE_STRING PackageName; 244 ULONG DataLength; 245 PUCHAR LogonData; 246 } 247 alias NETLOGON_GENERIC_INFO* PNETLOGON_GENERIC_INFO; 248 249 struct NETLOGON_NETWORK_INFO { 250 NETLOGON_LOGON_IDENTITY_INFO Identity; 251 LM_CHALLENGE LmChallenge; 252 STRING NtChallengeResponse; 253 STRING LmChallengeResponse; 254 } 255 alias NETLOGON_NETWORK_INFO* PNETLOGON_NETWORK_INFO; 256 257 struct NETLOGON_SERVICE_INFO { 258 NETLOGON_LOGON_IDENTITY_INFO Identity; 259 LM_OWF_PASSWORD LmOwfPassword; 260 NT_OWF_PASSWORD NtOwfPassword; 261 } 262 alias NETLOGON_SERVICE_INFO* PNETLOGON_SERVICE_INFO; 263 264 extern (Windows) { 265 NTSTATUS Msv1_0SubAuthenticationRoutine(NETLOGON_LOGON_INFO_CLASS,PVOID, 266 ULONG,PUSER_ALL_INFORMATION,PULONG,PULONG, 267 PBOOLEAN,PLARGE_INTEGER,PLARGE_INTEGER); 268 NTSTATUS Msv1_0SubAuthenticationFilter(NETLOGON_LOGON_INFO_CLASS,PVOID, 269 ULONG,PUSER_ALL_INFORMATION,PULONG,PULONG, 270 PBOOLEAN,PLARGE_INTEGER,PLARGE_INTEGER); 271 NTSTATUS Msv1_0SubAuthenticationRoutineGeneric(PVOID,ULONG,PULONG,PVOID*); 272 NTSTATUS Msv1_0SubAuthenticationRoutineEx(NETLOGON_LOGON_INFO_CLASS,PVOID, 273 ULONG,PUSER_ALL_INFORMATION,SAM_HANDLE, 274 PMSV1_0_VALIDATION_INFO,PULONG); 275 }