1 | #ifndef _SUBAUTH_H
|
---|
2 | #define _SUBAUTH_H
|
---|
3 | #if __GNUC__ >=3
|
---|
4 | #pragma GCC system_header
|
---|
5 | #endif
|
---|
6 |
|
---|
7 | #ifdef __cplusplus
|
---|
8 | extern "C" {
|
---|
9 | #endif
|
---|
10 | #ifndef NT_SUCCESS
|
---|
11 | #define NT_SUCCESS(x) ((x)>=0)
|
---|
12 | #define STATUS_SUCCESS 0
|
---|
13 | #endif
|
---|
14 | #define CYPHER_BLOCK_LENGTH 8
|
---|
15 | #define USER_SESSION_KEY_LENGTH (CYPHER_BLOCK_LENGTH*2)
|
---|
16 | #define CLEAR_BLOCK_LENGTH 8
|
---|
17 | #define MSV1_0_PASSTHRU 1
|
---|
18 | #define MSV1_0_GUEST_LOGON 2
|
---|
19 | #define MSV1_0_VALIDATION_LOGOFF_TIME 1
|
---|
20 | #define MSV1_0_VALIDATION_KICKOFF_TIME 2
|
---|
21 | #define MSV1_0_VALIDATION_LOGON_SERVER 4
|
---|
22 | #define MSV1_0_VALIDATION_LOGON_DOMAIN 8
|
---|
23 | #define MSV1_0_VALIDATION_SESSION_KEY 16
|
---|
24 | #define MSV1_0_VALIDATION_USER_FLAGS 32
|
---|
25 | #define MSV1_0_VALIDATION_USER_ID 64
|
---|
26 | #define MSV1_0_SUBAUTH_ACCOUNT_DISABLED 1
|
---|
27 | #define MSV1_0_SUBAUTH_PASSWORD 2
|
---|
28 | #define MSV1_0_SUBAUTH_WORKSTATIONS 4
|
---|
29 | #define MSV1_0_SUBAUTH_LOGON_HOURS 8
|
---|
30 | #define MSV1_0_SUBAUTH_ACCOUNT_EXPIRY 16
|
---|
31 | #define MSV1_0_SUBAUTH_PASSWORD_EXPIRY 32
|
---|
32 | #define MSV1_0_SUBAUTH_ACCOUNT_TYPE 64
|
---|
33 | #define MSV1_0_SUBAUTH_LOCKOUT 128
|
---|
34 | #define NEXT_FREE_ACCOUNT_CONTROL_BIT 131072
|
---|
35 | #define SAM_DAYS_PER_WEEK 7
|
---|
36 | #define SAM_HOURS_PER_WEEK 168
|
---|
37 | #define SAM_MINUTES_PER_WEEK 10080
|
---|
38 | #define STATUS_INVALID_INFO_CLASS 0xC0000003L
|
---|
39 | #define STATUS_NO_SUCH_USER 0xC0000064L
|
---|
40 | #define STATUS_WRONG_PASSWORD 0xC000006AL
|
---|
41 | #define STATUS_PASSWORD_RESTRICTION 0xC000006CL
|
---|
42 | #define STATUS_LOGON_FAILURE 0xC000006DL
|
---|
43 | #define STATUS_ACCOUNT_RESTRICTION 0xC000006EL
|
---|
44 | #define STATUS_INVALID_LOGON_HOURS 0xC000006FL
|
---|
45 | #define STATUS_INVALID_WORKSTATION 0xC0000070L
|
---|
46 | #define STATUS_PASSWORD_EXPIRED 0xC0000071L
|
---|
47 | #define STATUS_ACCOUNT_DISABLED 0xC0000072L
|
---|
48 | #define STATUS_INSUFFICIENT_RESOURCES 0xC000009AL
|
---|
49 | #define STATUS_ACCOUNT_EXPIRED 0xC0000193L
|
---|
50 | #define STATUS_PASSWORD_MUST_CHANGE 0xC0000224L
|
---|
51 | #define STATUS_ACCOUNT_LOCKED_OUT 0xC0000234L
|
---|
52 | #define USER_ACCOUNT_DISABLED 1
|
---|
53 | #define USER_HOME_DIRECTORY_REQUIRED 2
|
---|
54 | #define USER_PASSWORD_NOT_REQUIRED 4
|
---|
55 | #define USER_TEMP_DUPLICATE_ACCOUNT 8
|
---|
56 | #define USER_NORMAL_ACCOUNT 16
|
---|
57 | #define USER_MNS_LOGON_ACCOUNT 32
|
---|
58 | #define USER_INTERDOMAIN_TRUST_ACCOUNT 64
|
---|
59 | #define USER_WORKSTATION_TRUST_ACCOUNT 128
|
---|
60 | #define USER_SERVER_TRUST_ACCOUNT 256
|
---|
61 | #define USER_DONT_EXPIRE_PASSWORD 512
|
---|
62 | #define USER_ACCOUNT_AUTO_LOCKED 1024
|
---|
63 | #define USER_ENCRYPTED_TEXT_PASSWORD_ALLOWED 2048
|
---|
64 | #define USER_SMARTCARD_REQUIRED 4096
|
---|
65 | #define USER_TRUSTED_FOR_DELEGATION 8192
|
---|
66 | #define USER_NOT_DELEGATED 16384
|
---|
67 | #define USER_USE_DES_KEY_ONLY 32768
|
---|
68 | #define USER_DONT_REQUIRE_PREAUTH 65536
|
---|
69 | #define USER_MACHINE_ACCOUNT_MASK 448
|
---|
70 | #define USER_ACCOUNT_TYPE_MASK 472
|
---|
71 | #define USER_ALL_PARAMETERS 2097152
|
---|
72 | #if !defined(_NTDEF_H) && !defined(_NTSECAPI_H)
|
---|
73 | typedef LONG NTSTATUS, *PNTSTATUS;
|
---|
74 | typedef struct _UNICODE_STRING {
|
---|
75 | USHORT Length;
|
---|
76 | USHORT MaximumLength;
|
---|
77 | PWSTR Buffer;
|
---|
78 | } UNICODE_STRING, *PUNICODE_STRING;
|
---|
79 | typedef struct _STRING {
|
---|
80 | USHORT Length;
|
---|
81 | USHORT MaximumLength;
|
---|
82 | PCHAR Buffer;
|
---|
83 | } STRING, *PSTRING;
|
---|
84 | #endif
|
---|
85 | typedef PVOID SAM_HANDLE, *PSAM_HANDLE;
|
---|
86 | typedef struct _OLD_LARGE_INTEGER {
|
---|
87 | ULONG LowPart;
|
---|
88 | LONG HighPart;
|
---|
89 | } OLD_LARGE_INTEGER, *POLD_LARGE_INTEGER;
|
---|
90 | typedef enum _NETLOGON_LOGON_INFO_CLASS {
|
---|
91 | NetlogonInteractiveInformation = 1,NetlogonNetworkInformation,
|
---|
92 | NetlogonServiceInformation,NetlogonGenericInformation,
|
---|
93 | NetlogonInteractiveTransitiveInformation,NetlogonNetworkTransitiveInformation,
|
---|
94 | NetlogonServiceTransitiveInformation
|
---|
95 | } NETLOGON_LOGON_INFO_CLASS;
|
---|
96 | typedef struct _CYPHER_BLOCK {
|
---|
97 | CHAR data[CYPHER_BLOCK_LENGTH];
|
---|
98 | } CYPHER_BLOCK, *PCYPHER_BLOCK;
|
---|
99 | typedef struct _CLEAR_BLOCK {
|
---|
100 | CHAR data[CLEAR_BLOCK_LENGTH];
|
---|
101 | } CLEAR_BLOCK, *PCLEAR_BLOCK;
|
---|
102 | typedef struct _LM_OWF_PASSWORD {
|
---|
103 | CYPHER_BLOCK data[2];
|
---|
104 | } LM_OWF_PASSWORD, *PLM_OWF_PASSWORD;
|
---|
105 | typedef struct _USER_SESSION_KEY {
|
---|
106 | CYPHER_BLOCK data[2];
|
---|
107 | } USER_SESSION_KEY, *PUSER_SESSION_KEY;
|
---|
108 | typedef CLEAR_BLOCK LM_CHALLENGE, *PLM_CHALLENGE;
|
---|
109 | typedef LM_OWF_PASSWORD NT_OWF_PASSWORD, *PNT_OWF_PASSWORD;
|
---|
110 | typedef LM_CHALLENGE NT_CHALLENGE, *PNT_CHALLENGE;
|
---|
111 | typedef struct _LOGON_HOURS {
|
---|
112 | USHORT UnitsPerWeek;
|
---|
113 | PUCHAR LogonHours;
|
---|
114 | } LOGON_HOURS, *PLOGON_HOURS;
|
---|
115 | typedef struct _SR_SECURITY_DESCRIPTOR {
|
---|
116 | ULONG Length;
|
---|
117 | PUCHAR SecurityDescriptor;
|
---|
118 | } SR_SECURITY_DESCRIPTOR, *PSR_SECURITY_DESCRIPTOR;
|
---|
119 | #pragma pack(push,4)
|
---|
120 | typedef struct _USER_ALL_INFORMATION {
|
---|
121 | LARGE_INTEGER LastLogon;
|
---|
122 | LARGE_INTEGER LastLogoff;
|
---|
123 | LARGE_INTEGER PasswordLastSet;
|
---|
124 | LARGE_INTEGER AccountExpires;
|
---|
125 | LARGE_INTEGER PasswordCanChange;
|
---|
126 | LARGE_INTEGER PasswordMustChange;
|
---|
127 | UNICODE_STRING UserName;
|
---|
128 | UNICODE_STRING FullName;
|
---|
129 | UNICODE_STRING HomeDirectory;
|
---|
130 | UNICODE_STRING HomeDirectoryDrive;
|
---|
131 | UNICODE_STRING ScriptPath;
|
---|
132 | UNICODE_STRING ProfilePath;
|
---|
133 | UNICODE_STRING AdminComment;
|
---|
134 | UNICODE_STRING WorkStations;
|
---|
135 | UNICODE_STRING UserComment;
|
---|
136 | UNICODE_STRING Parameters;
|
---|
137 | UNICODE_STRING LmPassword;
|
---|
138 | UNICODE_STRING NtPassword;
|
---|
139 | UNICODE_STRING PrivateData;
|
---|
140 | SR_SECURITY_DESCRIPTOR SecurityDescriptor;
|
---|
141 | ULONG UserId;
|
---|
142 | ULONG PrimaryGroupId;
|
---|
143 | ULONG UserAccountControl;
|
---|
144 | ULONG WhichFields;
|
---|
145 | LOGON_HOURS LogonHours;
|
---|
146 | USHORT BadPasswordCount;
|
---|
147 | USHORT LogonCount;
|
---|
148 | USHORT CountryCode;
|
---|
149 | USHORT CodePage;
|
---|
150 | BOOLEAN LmPasswordPresent;
|
---|
151 | BOOLEAN NtPasswordPresent;
|
---|
152 | BOOLEAN PasswordExpired;
|
---|
153 | BOOLEAN PrivateDataSensitive;
|
---|
154 | } USER_ALL_INFORMATION, *PUSER_ALL_INFORMATION;
|
---|
155 | #pragma pack(pop)
|
---|
156 | typedef struct _MSV1_0_VALIDATION_INFO {
|
---|
157 | LARGE_INTEGER LogoffTime;
|
---|
158 | LARGE_INTEGER KickoffTime;
|
---|
159 | UNICODE_STRING LogonServer;
|
---|
160 | UNICODE_STRING LogonDomainName;
|
---|
161 | USER_SESSION_KEY SessionKey;
|
---|
162 | BOOLEAN Authoritative;
|
---|
163 | ULONG UserFlags;
|
---|
164 | ULONG WhichFields;
|
---|
165 | ULONG UserId;
|
---|
166 | } MSV1_0_VALIDATION_INFO, *PMSV1_0_VALIDATION_INFO;
|
---|
167 | typedef struct _NETLOGON_LOGON_IDENTITY_INFO {
|
---|
168 | UNICODE_STRING LogonDomainName;
|
---|
169 | ULONG ParameterControl;
|
---|
170 | OLD_LARGE_INTEGER LogonId;
|
---|
171 | UNICODE_STRING UserName;
|
---|
172 | UNICODE_STRING Workstation;
|
---|
173 | } NETLOGON_LOGON_IDENTITY_INFO, *PNETLOGON_LOGON_IDENTITY_INFO;
|
---|
174 | typedef struct _NETLOGON_INTERACTIVE_INFO {
|
---|
175 | NETLOGON_LOGON_IDENTITY_INFO Identity;
|
---|
176 | LM_OWF_PASSWORD LmOwfPassword;
|
---|
177 | NT_OWF_PASSWORD NtOwfPassword;
|
---|
178 | } NETLOGON_INTERACTIVE_INFO, *PNETLOGON_INTERACTIVE_INFO;
|
---|
179 | typedef struct _NETLOGON_GENERIC_INFO {
|
---|
180 | NETLOGON_LOGON_IDENTITY_INFO Identity;
|
---|
181 | UNICODE_STRING PackageName;
|
---|
182 | ULONG DataLength;
|
---|
183 | PUCHAR LogonData;
|
---|
184 | } NETLOGON_GENERIC_INFO, *PNETLOGON_GENERIC_INFO;
|
---|
185 | typedef struct _NETLOGON_NETWORK_INFO {
|
---|
186 | NETLOGON_LOGON_IDENTITY_INFO Identity;
|
---|
187 | LM_CHALLENGE LmChallenge;
|
---|
188 | STRING NtChallengeResponse;
|
---|
189 | STRING LmChallengeResponse;
|
---|
190 | } NETLOGON_NETWORK_INFO, *PNETLOGON_NETWORK_INFO;
|
---|
191 | typedef struct _NETLOGON_SERVICE_INFO {
|
---|
192 | NETLOGON_LOGON_IDENTITY_INFO Identity;
|
---|
193 | LM_OWF_PASSWORD LmOwfPassword;
|
---|
194 | NT_OWF_PASSWORD NtOwfPassword;
|
---|
195 | } NETLOGON_SERVICE_INFO, *PNETLOGON_SERVICE_INFO;
|
---|
196 | NTSTATUS NTAPI Msv1_0SubAuthenticationRoutine(NETLOGON_LOGON_INFO_CLASS,PVOID,
|
---|
197 | ULONG,PUSER_ALL_INFORMATION,PULONG,PULONG,
|
---|
198 | PBOOLEAN,PLARGE_INTEGER,PLARGE_INTEGER);
|
---|
199 | NTSTATUS NTAPI Msv1_0SubAuthenticationFilter(NETLOGON_LOGON_INFO_CLASS,PVOID,
|
---|
200 | ULONG,PUSER_ALL_INFORMATION,PULONG,PULONG,
|
---|
201 | PBOOLEAN,PLARGE_INTEGER,PLARGE_INTEGER);
|
---|
202 | NTSTATUS NTAPI Msv1_0SubAuthenticationRoutineGeneric(PVOID,ULONG,PULONG,PVOID*);
|
---|
203 | NTSTATUS NTAPI Msv1_0SubAuthenticationRoutineEx(NETLOGON_LOGON_INFO_CLASS,PVOID,
|
---|
204 | ULONG,PUSER_ALL_INFORMATION,SAM_HANDLE,
|
---|
205 | PMSV1_0_VALIDATION_INFO,PULONG);
|
---|
206 | #ifdef __cplusplus
|
---|
207 | }
|
---|
208 | #endif
|
---|
209 | #endif /* _SUBAUTH_H */
|
---|