Implement LsarCreateAccount.

svn path=/trunk/; revision=56452
This commit is contained in:
Eric Kohl 2012-04-29 22:09:35 +00:00
parent a450c4e88d
commit a087b26b8c
3 changed files with 61 additions and 4 deletions

View file

@ -27,7 +27,7 @@ add_library(lsasrv SHARED ${SOURCE})
set_module_type(lsasrv win32dll ENTRYPOINT 0 UNICODE)
target_link_libraries(lsasrv wine ${PSEH_LIB})
add_importlibs(lsasrv rpcrt4 msvcrt kernel32 ntdll)
add_importlibs(lsasrv rpcrt4 msvcrt kernel32 advapi32 ntdll)
add_pch(lsasrv lsasrv.h)
add_dependencies(lsasrv psdk)
add_cd_file(TARGET lsasrv DESTINATION reactos/system32 FOR all)

View file

@ -310,8 +310,65 @@ NTSTATUS WINAPI LsarCreateAccount(
ACCESS_MASK DesiredAccess,
LSAPR_HANDLE *AccountHandle)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
LSAPR_HANDLE AccountsHandle;
LSAPR_HANDLE Account;
LPWSTR SidString;
NTSTATUS Status;
/* Validate the PolicyHandle */
Status = LsapValidateDbObject(PolicyHandle,
LsaDbPolicyObject,
POLICY_CREATE_ACCOUNT);
if (!NT_SUCCESS(Status))
{
ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
return Status;
}
/* Open the Accounts object */
AccountsHandle = LsapCreateDbObject(PolicyHandle,
L"Accounts",
TRUE,
LsaDbContainerObject,
0);
if (AccountsHandle == NULL)
{
ERR("LsapCreateDbObject (Accounts) failed\n");
return STATUS_UNSUCCESSFUL;
}
/* Create SID string */
if (!ConvertSidToStringSid((PSID)AccountSid,
&SidString))
{
ERR("ConvertSidToStringSid failed\n");
return STATUS_UNSUCCESSFUL;
}
/* Create the Account object */
Account = LsapCreateDbObject(AccountsHandle,
SidString,
FALSE,
LsaDbAccountObject,
DesiredAccess);
if (Account != NULL)
{
/* Set the Sid attribute */
Status = LsapSetObjectAttribute((PLSA_DB_OBJECT)Account,
L"Sid",
(PVOID)AccountSid,
GetLengthSid(AccountSid));
if (NT_SUCCESS(Status))
{
*AccountHandle = Account;
}
}
LocalFree(SidString);
LsapCloseDbObject(AccountsHandle);
return STATUS_SUCCESS;
}

View file

@ -17,8 +17,8 @@
#include <ndk/rtlfuncs.h>
#include <ndk/setypes.h>
#include <ntsecapi.h>
#include <sddl.h>
#include <string.h>