251{
262
263
265
266
269 {
270 ERR(
"GetAccountDomainSid() failed (Status 0x%08lx)\n",
Status);
272 }
273
274
277 {
278 TRACE(
"SamIConnect() failed (Status 0x%08lx)\n",
Status);
279 goto done;
280 }
281
282
285 {
286 ERR(
"SamrOpenDomain failed (Status %08lx)\n",
Status);
287 goto done;
288 }
289
290 Names[0].Length = UserName->Length;
291 Names[0].MaximumLength = UserName->MaximumLength;
292 Names[0].Buffer = UserName->Buffer;
293
294
297 {
298 ERR(
"SamrLookupNamesInDomain failed (Status %08lx)\n",
Status);
300
301 goto done;
302 }
303
304
306 {
307 ERR(
"Account is not a user account!\n");
309 goto done;
310 }
311
312
317 &UserHandle);
319 {
320 ERR(
"SamrOpenUser failed (Status %08lx)\n",
Status);
321 goto done;
322 }
323
326 {
327 ERR(
"SamrQueryInformationUser failed (Status %08lx)\n",
Status);
328 goto done;
329 }
330
332
333
335 {
338 {
339 ERR(
"MsvpCheckPassword failed (Status %08lx)\n",
Status);
340 goto done;
341 }
342 }
343
344
346 {
347
349 {
350 ERR(
"Account disabled!\n");
353 goto done;
354 }
355
356
358 {
359 ERR(
"Account locked!\n");
362 goto done;
363 }
364
365
367 {
368 ERR(
"Account expired!\n");
371 goto done;
372 }
373
374
376 {
377 ERR(
"Password expired!\n");
380 else
382
384 goto done;
385 }
386
387
389 {
390 ERR(
"Invalid logon hours!\n");
393 goto done;
394 }
395
396
398 {
399 ERR(
"Invalid workstation!\n");
402 goto done;
403 }
404 }
405done:
407 {
408 *UserHandlePtr = UserHandle;
410 *UserInfoPtr = UserInfo;
411 }
412 else
413 {
416
417 if (UserHandle !=
NULL)
419
422 }
423
426
427 if (DomainHandle !=
NULL)
429
430 if (ServerHandle !=
NULL)
432
434}
unsigned long long UINT64
NTSTATUS __stdcall SamrOpenDomain(SAMPR_HANDLE ServerHandle, ACCESS_MASK DesiredAccess, PRPC_SID DomainId, SAMPR_HANDLE *DomainHandle)
VOID NTAPI SamIFree_SAMPR_ULONG_ARRAY(PSAMPR_ULONG_ARRAY Ptr)
NTSTATUS __stdcall SamrCloseHandle(SAMPR_HANDLE *SamHandle)
NTSTATUS NTAPI SamIConnect(PSAMPR_SERVER_NAME ServerName, SAMPR_HANDLE *ServerHandle, ACCESS_MASK DesiredAccess, BOOLEAN Trusted)
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
NTSTATUS NTAPI SamrLookupNamesInDomain(IN SAMPR_HANDLE DomainHandle, IN ULONG Count, IN RPC_UNICODE_STRING Names[], OUT PSAMPR_ULONG_ARRAY RelativeIds, OUT PSAMPR_ULONG_ARRAY Use)
VOID NTAPI SamIFree_SAMPR_USER_INFO_BUFFER(PSAMPR_USER_INFO_BUFFER Ptr, USER_INFORMATION_CLASS InformationClass)
NTSTATUS NTAPI SamrOpenUser(IN SAMPR_HANDLE DomainHandle, IN ACCESS_MASK DesiredAccess, IN ULONG UserId, OUT SAMPR_HANDLE *UserHandle)
NTSTATUS NTAPI SamrQueryInformationUser(IN SAMPR_HANDLE UserHandle, IN USER_INFORMATION_CLASS UserInformationClass, OUT PSAMPR_USER_INFO_BUFFER *Buffer)
_IRQL_requires_same_ _In_ PLSA_STRING _In_ SECURITY_LOGON_TYPE _In_ ULONG _In_ ULONG _In_opt_ PTOKEN_GROUPS _In_ PTOKEN_SOURCE _Out_ PVOID _Out_ PULONG _Inout_ PLUID _Out_ PHANDLE _Out_ PQUOTA_LIMITS _Out_ PNTSTATUS SubStatus
NTSTATUS NTAPI NtQuerySystemTime(OUT PLARGE_INTEGER SystemTime)
#define USER_READ_GENERAL
#define USER_PASSWORD_NOT_REQUIRED
#define USER_READ_PREFERENCES
#define USER_READ_ACCOUNT
#define SAM_SERVER_LOOKUP_DOMAIN
#define SAM_SERVER_CONNECT
#define USER_ACCOUNT_AUTO_LOCKED
#define USER_ACCOUNT_DISABLED
#define STATUS_INVALID_LOGON_HOURS
#define STATUS_ACCOUNT_DISABLED
#define STATUS_NO_SUCH_USER
#define STATUS_PASSWORD_MUST_CHANGE
#define STATUS_PASSWORD_EXPIRED
#define STATUS_INVALID_WORKSTATION
#define STATUS_ACCOUNT_EXPIRED
#define STATUS_ACCOUNT_LOCKED_OUT
#define STATUS_ACCOUNT_RESTRICTION
static bool MsvpCheckWorkstations(_In_ PRPC_UNICODE_STRING WorkStations, _In_ PWSTR ComputerName)
static NTSTATUS GetAccountDomainSid(_In_ PRPC_SID *Sid)
static NTSTATUS MsvpCheckPassword(_In_ PLSA_SAM_PWD_DATA UserPwdData, _In_ PSAMPR_USER_INFO_BUFFER UserInfo)
static bool MsvpCheckLogonHours(_In_ PSAMPR_LOGON_HOURS LogonHours, _In_ LARGE_INTEGER LogonTime)
SAMPR_USER_ALL_INFORMATION All
#define DOMAIN_USER_RID_ADMIN