Implement LogonUserA.
Modified: trunk/reactos/lib/advapi32/misc/logon.c
_____
Modified: trunk/reactos/lib/advapi32/misc/logon.c
--- trunk/reactos/lib/advapi32/misc/logon.c 2005-08-27 09:55:27 UTC
(rev 17567)
+++ trunk/reactos/lib/advapi32/misc/logon.c 2005-08-27 14:56:17 UTC
(rev 17568)
@@ -1,5 +1,4 @@
-/* $Id$
- *
+/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/advapi32/misc/logon.c
@@ -131,17 +130,70 @@
/*
- * @unimplemented
+ * @implemented
*/
BOOL STDCALL
-LogonUserA (LPSTR lpszUsername,
- LPSTR lpszDomain,
- LPSTR lpszPassword,
- DWORD dwLogonType,
- DWORD dwLogonProvider,
- PHANDLE phToken)
+LogonUserA(LPSTR lpszUsername,
+ LPSTR lpszDomain,
+ LPSTR lpszPassword,
+ DWORD dwLogonType,
+ DWORD dwLogonProvider,
+ PHANDLE phToken)
{
- return FALSE;
+ UNICODE_STRING UserName;
+ UNICODE_STRING Domain;
+ UNICODE_STRING Password;
+ NTSTATUS Status;
+ BOOL ret = FALSE;
+
+ UserName.Buffer = NULL;
+ Domain.Buffer = NULL;
+ Password.Buffer = NULL;
+
+ Status = RtlCreateUnicodeStringFromAsciiz(&UserName,
+ lpszUsername);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastError(RtlNtStatusToDosError(Status));
+ goto UsernameDone;
+ }
+
+ Status = RtlCreateUnicodeStringFromAsciiz(&Domain,
+ lpszDomain);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastError(RtlNtStatusToDosError(Status));
+ goto DomainDone;
+ }
+
+ Status = RtlCreateUnicodeStringFromAsciiz(&Password,
+ lpszPassword);
+ if (!NT_SUCCESS(Status))
+ {
+ SetLastError(RtlNtStatusToDosError(Status));
+ goto PasswordDone;
+ }
+
+ ret = LogonUserW(UserName.Buffer,
+ Domain.Buffer,
+ Password.Buffer,
+ dwLogonType,
+ dwLogonProvider,
+ phToken);
+
+ if (Password.Buffer != NULL)
+ RtlFreeUnicodeString(&Password);
+
+PasswordDone:
+ if (Domain.Buffer != NULL)
+ RtlFreeUnicodeString(&Domain);
+
+DomainDone:
+ if (UserName.Buffer != NULL)
+ RtlFreeUnicodeString(&UserName);
+
+UsernameDone:
+ return ret;
}