[1166] | 1 | /**
|
---|
| 2 | * This file has no copyright assigned and is placed in the Public Domain.
|
---|
| 3 | * This file is part of the mingw-w64 runtime package.
|
---|
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
---|
| 5 | */
|
---|
| 6 | #ifndef _NTSUBAUTH_
|
---|
| 7 | #define _NTSUBAUTH_
|
---|
| 8 |
|
---|
| 9 | #ifdef __cplusplus
|
---|
| 10 | extern "C" {
|
---|
| 11 | #endif
|
---|
| 12 |
|
---|
| 13 | #if (!defined(_NTDEF_)) && (!defined(_NTSECAPI_))
|
---|
| 14 |
|
---|
| 15 | #if !defined (_NTDEF_) && !defined (_NTSTATUS_PSDK)
|
---|
| 16 | #define _NTSTATUS_PSDK
|
---|
| 17 | typedef LONG NTSTATUS,*PNTSTATUS;
|
---|
| 18 | #endif
|
---|
| 19 |
|
---|
| 20 | #ifndef __UNICODE_STRING_DEFINED
|
---|
| 21 | #define __UNICODE_STRING_DEFINED
|
---|
| 22 | typedef struct _UNICODE_STRING {
|
---|
| 23 | USHORT Length;
|
---|
| 24 | USHORT MaximumLength;
|
---|
| 25 | PWSTR Buffer;
|
---|
| 26 | } UNICODE_STRING,*PUNICODE_STRING;
|
---|
| 27 | #endif
|
---|
| 28 |
|
---|
| 29 | #ifndef __STRING_DEFINED
|
---|
| 30 | #define __STRING_DEFINED
|
---|
| 31 | typedef struct _STRING {
|
---|
| 32 | USHORT Length;
|
---|
| 33 | USHORT MaximumLength;
|
---|
| 34 | PCHAR Buffer;
|
---|
| 35 | } STRING,*PSTRING;
|
---|
| 36 | #endif
|
---|
| 37 | #endif
|
---|
| 38 |
|
---|
| 39 | #ifndef _NTDEF_
|
---|
| 40 |
|
---|
| 41 | typedef struct _OLD_LARGE_INTEGER {
|
---|
| 42 | ULONG LowPart;
|
---|
| 43 | LONG HighPart;
|
---|
| 44 | } OLD_LARGE_INTEGER,*POLD_LARGE_INTEGER;
|
---|
| 45 |
|
---|
| 46 | #define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0)
|
---|
| 47 | #endif
|
---|
| 48 |
|
---|
| 49 | #ifndef _NTSAM_SAM_HANDLE_
|
---|
| 50 | typedef PVOID SAM_HANDLE,*PSAM_HANDLE;
|
---|
| 51 | #define _NTSAM_SAM_HANDLE_
|
---|
| 52 | #endif
|
---|
| 53 | #ifndef _NTSAM_USER_ACCOUNT_FLAGS_
|
---|
| 54 |
|
---|
| 55 | #define USER_ACCOUNT_DISABLED (0x00000001)
|
---|
| 56 | #define USER_HOME_DIRECTORY_REQUIRED (0x00000002)
|
---|
| 57 | #define USER_PASSWORD_NOT_REQUIRED (0x00000004)
|
---|
| 58 | #define USER_TEMP_DUPLICATE_ACCOUNT (0x00000008)
|
---|
| 59 | #define USER_NORMAL_ACCOUNT (0x00000010)
|
---|
| 60 | #define USER_MNS_LOGON_ACCOUNT (0x00000020)
|
---|
| 61 | #define USER_INTERDOMAIN_TRUST_ACCOUNT (0x00000040)
|
---|
| 62 | #define USER_WORKSTATION_TRUST_ACCOUNT (0x00000080)
|
---|
| 63 | #define USER_SERVER_TRUST_ACCOUNT (0x00000100)
|
---|
| 64 | #define USER_DONT_EXPIRE_PASSWORD (0x00000200)
|
---|
| 65 | #define USER_ACCOUNT_AUTO_LOCKED (0x00000400)
|
---|
| 66 | #define USER_ENCRYPTED_TEXT_PASSWORD_ALLOWED (0x00000800)
|
---|
| 67 | #define USER_SMARTCARD_REQUIRED (0x00001000)
|
---|
| 68 | #define USER_TRUSTED_FOR_DELEGATION (0x00002000)
|
---|
| 69 | #define USER_NOT_DELEGATED (0x00004000)
|
---|
| 70 | #define USER_USE_DES_KEY_ONLY (0x00008000)
|
---|
| 71 | #define USER_DONT_REQUIRE_PREAUTH (0x00010000)
|
---|
| 72 | #define USER_PASSWORD_EXPIRED (0x00020000)
|
---|
| 73 | #define USER_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION (0x00040000)
|
---|
| 74 | #define USER_NO_AUTH_DATA_REQUIRED (0x00080000)
|
---|
| 75 | #define NEXT_FREE_ACCOUNT_CONTROL_BIT (USER_NO_AUTH_DATA_REQUIRED << 1)
|
---|
| 76 |
|
---|
| 77 | #define USER_MACHINE_ACCOUNT_MASK (USER_INTERDOMAIN_TRUST_ACCOUNT | USER_WORKSTATION_TRUST_ACCOUNT | USER_SERVER_TRUST_ACCOUNT)
|
---|
| 78 | #define USER_ACCOUNT_TYPE_MASK (USER_TEMP_DUPLICATE_ACCOUNT | USER_NORMAL_ACCOUNT | USER_MACHINE_ACCOUNT_MASK)
|
---|
| 79 | #define USER_COMPUTED_ACCOUNT_CONTROL_BITS (USER_ACCOUNT_AUTO_LOCKED | USER_PASSWORD_EXPIRED)
|
---|
| 80 |
|
---|
| 81 | #define SAM_DAYS_PER_WEEK (7)
|
---|
| 82 | #define SAM_HOURS_PER_WEEK (24*SAM_DAYS_PER_WEEK)
|
---|
| 83 | #define SAM_MINUTES_PER_WEEK (60*SAM_HOURS_PER_WEEK)
|
---|
| 84 |
|
---|
| 85 | typedef struct _LOGON_HOURS {
|
---|
| 86 | USHORT UnitsPerWeek;
|
---|
| 87 | PUCHAR LogonHours;
|
---|
| 88 | } LOGON_HOURS,*PLOGON_HOURS;
|
---|
| 89 |
|
---|
| 90 | typedef struct _SR_SECURITY_DESCRIPTOR {
|
---|
| 91 | ULONG Length;
|
---|
| 92 | PUCHAR SecurityDescriptor;
|
---|
| 93 | } SR_SECURITY_DESCRIPTOR,*PSR_SECURITY_DESCRIPTOR;
|
---|
| 94 |
|
---|
| 95 | #define _NTSAM_USER_ACCOUNT_FLAG_
|
---|
| 96 | #endif
|
---|
| 97 | #ifndef _NTSAM_USER_ALL_INFO_
|
---|
| 98 | #include "pshpack4.h"
|
---|
| 99 | typedef struct _USER_ALL_INFORMATION {
|
---|
| 100 | LARGE_INTEGER LastLogon;
|
---|
| 101 | LARGE_INTEGER LastLogoff;
|
---|
| 102 | LARGE_INTEGER PasswordLastSet;
|
---|
| 103 | LARGE_INTEGER AccountExpires;
|
---|
| 104 | LARGE_INTEGER PasswordCanChange;
|
---|
| 105 | LARGE_INTEGER PasswordMustChange;
|
---|
| 106 | UNICODE_STRING UserName;
|
---|
| 107 | UNICODE_STRING FullName;
|
---|
| 108 | UNICODE_STRING HomeDirectory;
|
---|
| 109 | UNICODE_STRING HomeDirectoryDrive;
|
---|
| 110 | UNICODE_STRING ScriptPath;
|
---|
| 111 | UNICODE_STRING ProfilePath;
|
---|
| 112 | UNICODE_STRING AdminComment;
|
---|
| 113 | UNICODE_STRING WorkStations;
|
---|
| 114 | UNICODE_STRING UserComment;
|
---|
| 115 | UNICODE_STRING Parameters;
|
---|
| 116 | UNICODE_STRING LmPassword;
|
---|
| 117 | UNICODE_STRING NtPassword;
|
---|
| 118 | UNICODE_STRING PrivateData;
|
---|
| 119 | SR_SECURITY_DESCRIPTOR SecurityDescriptor;
|
---|
| 120 | ULONG UserId;
|
---|
| 121 | ULONG PrimaryGroupId;
|
---|
| 122 | ULONG UserAccountControl;
|
---|
| 123 | ULONG WhichFields;
|
---|
| 124 | LOGON_HOURS LogonHours;
|
---|
| 125 | USHORT BadPasswordCount;
|
---|
| 126 | USHORT LogonCount;
|
---|
| 127 | USHORT CountryCode;
|
---|
| 128 | USHORT CodePage;
|
---|
| 129 | BOOLEAN LmPasswordPresent;
|
---|
| 130 | BOOLEAN NtPasswordPresent;
|
---|
| 131 | BOOLEAN PasswordExpired;
|
---|
| 132 | BOOLEAN PrivateDataSensitive;
|
---|
| 133 | } USER_ALL_INFORMATION,*PUSER_ALL_INFORMATION;
|
---|
| 134 | #include "poppack.h"
|
---|
| 135 | #define _NTSAM_USER_ALL_INFO_
|
---|
| 136 | #endif
|
---|
| 137 | #ifndef _NTSAM_SAM_USER_PARMS_
|
---|
| 138 | #define USER_ALL_PARAMETERS 0x00200000
|
---|
| 139 | #define _NTSAM_SAM_USER_PARMS_
|
---|
| 140 | #endif
|
---|
| 141 |
|
---|
| 142 | #define CLEAR_BLOCK_LENGTH 8
|
---|
| 143 |
|
---|
| 144 | typedef struct _CLEAR_BLOCK {
|
---|
| 145 | CHAR data[CLEAR_BLOCK_LENGTH];
|
---|
| 146 | } CLEAR_BLOCK;
|
---|
| 147 |
|
---|
| 148 | typedef CLEAR_BLOCK *PCLEAR_BLOCK;
|
---|
| 149 |
|
---|
| 150 | #define CYPHER_BLOCK_LENGTH 8
|
---|
| 151 |
|
---|
| 152 | typedef struct _CYPHER_BLOCK {
|
---|
| 153 | CHAR data[CYPHER_BLOCK_LENGTH];
|
---|
| 154 | } CYPHER_BLOCK;
|
---|
| 155 | typedef CYPHER_BLOCK *PCYPHER_BLOCK;
|
---|
| 156 | typedef struct _LM_OWF_PASSWORD {
|
---|
| 157 | CYPHER_BLOCK data[2];
|
---|
| 158 | } LM_OWF_PASSWORD;
|
---|
| 159 | typedef LM_OWF_PASSWORD *PLM_OWF_PASSWORD;
|
---|
| 160 | typedef CLEAR_BLOCK LM_CHALLENGE;
|
---|
| 161 | typedef LM_CHALLENGE *PLM_CHALLENGE;
|
---|
| 162 | typedef LM_OWF_PASSWORD NT_OWF_PASSWORD;
|
---|
| 163 | typedef NT_OWF_PASSWORD *PNT_OWF_PASSWORD;
|
---|
| 164 | typedef LM_CHALLENGE NT_CHALLENGE;
|
---|
| 165 | typedef NT_CHALLENGE *PNT_CHALLENGE;
|
---|
| 166 | #define USER_SESSION_KEY_LENGTH (CYPHER_BLOCK_LENGTH *2)
|
---|
| 167 |
|
---|
| 168 | typedef struct _USER_SESSION_KEY {
|
---|
| 169 | CYPHER_BLOCK data[2];
|
---|
| 170 | } USER_SESSION_KEY;
|
---|
| 171 | typedef USER_SESSION_KEY *PUSER_SESSION_KEY;
|
---|
| 172 |
|
---|
| 173 | typedef enum _NETLOGON_LOGON_INFO_CLASS {
|
---|
| 174 | NetlogonInteractiveInformation = 1,NetlogonNetworkInformation,NetlogonServiceInformation,NetlogonGenericInformation,
|
---|
| 175 | NetlogonInteractiveTransitiveInformation,NetlogonNetworkTransitiveInformation,NetlogonServiceTransitiveInformation
|
---|
| 176 | } NETLOGON_LOGON_INFO_CLASS;
|
---|
| 177 |
|
---|
| 178 | typedef struct _NETLOGON_LOGON_IDENTITY_INFO {
|
---|
| 179 | UNICODE_STRING LogonDomainName;
|
---|
| 180 | ULONG ParameterControl;
|
---|
| 181 | OLD_LARGE_INTEGER LogonId;
|
---|
| 182 | UNICODE_STRING UserName;
|
---|
| 183 | UNICODE_STRING Workstation;
|
---|
| 184 | } NETLOGON_LOGON_IDENTITY_INFO,*PNETLOGON_LOGON_IDENTITY_INFO;
|
---|
| 185 |
|
---|
| 186 | typedef struct _NETLOGON_INTERACTIVE_INFO {
|
---|
| 187 | NETLOGON_LOGON_IDENTITY_INFO Identity;
|
---|
| 188 | LM_OWF_PASSWORD LmOwfPassword;
|
---|
| 189 | NT_OWF_PASSWORD NtOwfPassword;
|
---|
| 190 | } NETLOGON_INTERACTIVE_INFO,*PNETLOGON_INTERACTIVE_INFO;
|
---|
| 191 |
|
---|
| 192 | typedef struct _NETLOGON_SERVICE_INFO {
|
---|
| 193 | NETLOGON_LOGON_IDENTITY_INFO Identity;
|
---|
| 194 | LM_OWF_PASSWORD LmOwfPassword;
|
---|
| 195 | NT_OWF_PASSWORD NtOwfPassword;
|
---|
| 196 | } NETLOGON_SERVICE_INFO,*PNETLOGON_SERVICE_INFO;
|
---|
| 197 |
|
---|
| 198 | typedef struct _NETLOGON_NETWORK_INFO {
|
---|
| 199 | NETLOGON_LOGON_IDENTITY_INFO Identity;
|
---|
| 200 | LM_CHALLENGE LmChallenge;
|
---|
| 201 | STRING NtChallengeResponse;
|
---|
| 202 | STRING LmChallengeResponse;
|
---|
| 203 | } NETLOGON_NETWORK_INFO,*PNETLOGON_NETWORK_INFO;
|
---|
| 204 |
|
---|
| 205 | typedef struct _NETLOGON_GENERIC_INFO {
|
---|
| 206 | NETLOGON_LOGON_IDENTITY_INFO Identity;
|
---|
| 207 | UNICODE_STRING PackageName;
|
---|
| 208 | ULONG DataLength;
|
---|
| 209 | PUCHAR LogonData;
|
---|
| 210 | } NETLOGON_GENERIC_INFO,*PNETLOGON_GENERIC_INFO;
|
---|
| 211 |
|
---|
| 212 | #define MSV1_0_PASSTHRU 0x01
|
---|
| 213 | #define MSV1_0_GUEST_LOGON 0x02
|
---|
| 214 |
|
---|
| 215 | NTSTATUS NTAPI Msv1_0SubAuthenticationRoutine(NETLOGON_LOGON_INFO_CLASS LogonLevel,PVOID LogonInformation,ULONG Flags,PUSER_ALL_INFORMATION UserAll,PULONG WhichFields,PULONG UserFlags,PBOOLEAN Authoritative,PLARGE_INTEGER LogoffTime,PLARGE_INTEGER KickoffTime);
|
---|
| 216 |
|
---|
| 217 | typedef struct _MSV1_0_VALIDATION_INFO {
|
---|
| 218 | LARGE_INTEGER LogoffTime;
|
---|
| 219 | LARGE_INTEGER KickoffTime;
|
---|
| 220 | UNICODE_STRING LogonServer;
|
---|
| 221 | UNICODE_STRING LogonDomainName;
|
---|
| 222 | USER_SESSION_KEY SessionKey;
|
---|
| 223 | BOOLEAN Authoritative;
|
---|
| 224 | ULONG UserFlags;
|
---|
| 225 | ULONG WhichFields;
|
---|
| 226 | ULONG UserId;
|
---|
| 227 | } MSV1_0_VALIDATION_INFO,*PMSV1_0_VALIDATION_INFO;
|
---|
| 228 |
|
---|
| 229 | #define MSV1_0_VALIDATION_LOGOFF_TIME 0x00000001
|
---|
| 230 | #define MSV1_0_VALIDATION_KICKOFF_TIME 0x00000002
|
---|
| 231 | #define MSV1_0_VALIDATION_LOGON_SERVER 0x00000004
|
---|
| 232 | #define MSV1_0_VALIDATION_LOGON_DOMAIN 0x00000008
|
---|
| 233 | #define MSV1_0_VALIDATION_SESSION_KEY 0x00000010
|
---|
| 234 | #define MSV1_0_VALIDATION_USER_FLAGS 0x00000020
|
---|
| 235 | #define MSV1_0_VALIDATION_USER_ID 0x00000040
|
---|
| 236 |
|
---|
| 237 | #define MSV1_0_SUBAUTH_ACCOUNT_DISABLED 0x00000001
|
---|
| 238 | #define MSV1_0_SUBAUTH_PASSWORD 0x00000002
|
---|
| 239 | #define MSV1_0_SUBAUTH_WORKSTATIONS 0x00000004
|
---|
| 240 | #define MSV1_0_SUBAUTH_LOGON_HOURS 0x00000008
|
---|
| 241 | #define MSV1_0_SUBAUTH_ACCOUNT_EXPIRY 0x00000010
|
---|
| 242 | #define MSV1_0_SUBAUTH_PASSWORD_EXPIRY 0x00000020
|
---|
| 243 | #define MSV1_0_SUBAUTH_ACCOUNT_TYPE 0x00000040
|
---|
| 244 | #define MSV1_0_SUBAUTH_LOCKOUT 0x00000080
|
---|
| 245 |
|
---|
| 246 | NTSTATUS NTAPI Msv1_0SubAuthenticationRoutineEx(NETLOGON_LOGON_INFO_CLASS LogonLevel,PVOID LogonInformation,ULONG Flags,PUSER_ALL_INFORMATION UserAll,SAM_HANDLE UserHandle,PMSV1_0_VALIDATION_INFO ValidationInfo,PULONG ActionsPerformed);
|
---|
| 247 | NTSTATUS NTAPI Msv1_0SubAuthenticationRoutineGeneric(PVOID SubmitBuffer,ULONG SubmitBufferLength,PULONG ReturnBufferLength,PVOID *ReturnBuffer);
|
---|
| 248 | NTSTATUS NTAPI Msv1_0SubAuthenticationFilter(NETLOGON_LOGON_INFO_CLASS LogonLevel,PVOID LogonInformation,ULONG Flags,PUSER_ALL_INFORMATION UserAll,PULONG WhichFields,PULONG UserFlags,PBOOLEAN Authoritative,PLARGE_INTEGER LogoffTime,PLARGE_INTEGER KickoffTime);
|
---|
| 249 |
|
---|
| 250 | #define STATUS_SUCCESS ((NTSTATUS)0x00000000)
|
---|
| 251 | #define STATUS_INVALID_INFO_CLASS ((NTSTATUS)0xC0000003)
|
---|
| 252 | #define STATUS_NO_SUCH_USER ((NTSTATUS)0xC0000064)
|
---|
| 253 | #define STATUS_WRONG_PASSWORD ((NTSTATUS)0xC000006A)
|
---|
| 254 | #define STATUS_PASSWORD_RESTRICTION ((NTSTATUS)0xC000006C)
|
---|
| 255 | #define STATUS_LOGON_FAILURE ((NTSTATUS)0xC000006D)
|
---|
| 256 | #define STATUS_ACCOUNT_RESTRICTION ((NTSTATUS)0xC000006E)
|
---|
| 257 | #define STATUS_INVALID_LOGON_HOURS ((NTSTATUS)0xC000006F)
|
---|
| 258 | #define STATUS_INVALID_WORKSTATION ((NTSTATUS)0xC0000070)
|
---|
| 259 | #define STATUS_PASSWORD_EXPIRED ((NTSTATUS)0xC0000071)
|
---|
| 260 | #define STATUS_ACCOUNT_DISABLED ((NTSTATUS)0xC0000072)
|
---|
| 261 | #define STATUS_INSUFFICIENT_RESOURCES ((NTSTATUS)0xC000009A)
|
---|
| 262 | #define STATUS_ACCOUNT_EXPIRED ((NTSTATUS)0xC0000193)
|
---|
| 263 | #define STATUS_PASSWORD_MUST_CHANGE ((NTSTATUS)0xC0000224)
|
---|
| 264 | #define STATUS_ACCOUNT_LOCKED_OUT ((NTSTATUS)0xC0000234)
|
---|
| 265 | #ifdef __cplusplus
|
---|
| 266 | }
|
---|
| 267 | #endif
|
---|
| 268 | #endif
|
---|