+static
+ULONG
+GetAccountControl(ULONG Flags)
+{
+ ULONG AccountControl = 0;
+
+ if (Flags & UF_ACCOUNTDISABLE)
+ AccountControl |= USER_ACCOUNT_DISABLED;
+
+ if (Flags & UF_HOMEDIR_REQUIRED)
+ AccountControl |= USER_HOME_DIRECTORY_REQUIRED;
+
+ if (Flags & UF_PASSWD_NOTREQD)
+ AccountControl |= USER_PASSWORD_NOT_REQUIRED;
+
+ if (Flags & UF_LOCKOUT)
+ AccountControl |= USER_ACCOUNT_AUTO_LOCKED;
+
+ if (Flags & UF_DONT_EXPIRE_PASSWD)
+ AccountControl |= USER_DONT_EXPIRE_PASSWORD;
+
+ /* Set account type flags */
+ if (Flags & UF_TEMP_DUPLICATE_ACCOUNT)
+ AccountControl |= USER_TEMP_DUPLICATE_ACCOUNT;
+ else if (Flags & UF_NORMAL_ACCOUNT)
+ AccountControl |= USER_NORMAL_ACCOUNT;
+ else if (Flags & UF_INTERDOMAIN_TRUST_ACCOUNT)
+ AccountControl |= USER_INTERDOMAIN_TRUST_ACCOUNT;
+ else if (Flags & UF_WORKSTATION_TRUST_ACCOUNT)
+ AccountControl |= USER_WORKSTATION_TRUST_ACCOUNT;
+ else if (Flags & UF_SERVER_TRUST_ACCOUNT)
+ AccountControl |= USER_SERVER_TRUST_ACCOUNT;
+
+ return AccountControl;
+}
+
+
+static
+DWORD
+GetPasswordAge(IN PLARGE_INTEGER PasswordLastSet)
+{
+ LARGE_INTEGER SystemTime;
+ ULONG SystemSecondsSince1970;
+ ULONG PasswordSecondsSince1970;
+ NTSTATUS Status;
+
+ Status = NtQuerySystemTime(&SystemTime);
+ if (!NT_SUCCESS(Status))
+ return 0;
+
+ RtlTimeToSecondsSince1970(&SystemTime, &SystemSecondsSince1970);
+ RtlTimeToSecondsSince1970(PasswordLastSet, &PasswordSecondsSince1970);
+
+ return SystemSecondsSince1970 - PasswordSecondsSince1970;
+}
+
+