[ADVAPI32]
authorEric Kohl <eric.kohl@reactos.org>
Mon, 24 Sep 2012 15:04:32 +0000 (15:04 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Mon, 24 Sep 2012 15:04:32 +0000 (15:04 +0000)
Implement LsaCreateTrustedDomainEx and LsaEnumerateAccounts.

svn path=/trunk/; revision=57378

reactos/dll/win32/advapi32/advapi32.spec
reactos/dll/win32/advapi32/sec/lsa.c
reactos/include/psdk/ntsecapi.h

index af8b8d5..7801417 100644 (file)
 @ stdcall LsaDelete(ptr)
 @ stdcall LsaDeleteTrustedDomain(ptr ptr)
 @ stdcall LsaEnumerateAccountRights(ptr ptr ptr ptr)
 @ stdcall LsaDelete(ptr)
 @ stdcall LsaDeleteTrustedDomain(ptr ptr)
 @ stdcall LsaEnumerateAccountRights(ptr ptr ptr ptr)
-@ stub LsaEnumerateAccounts
+@ stdcall LsaEnumerateAccounts(ptr ptr ptr long ptr)
 @ stdcall LsaEnumerateAccountsWithUserRight(ptr ptr ptr ptr)
 @ stub LsaEnumeratePrivileges
 @ stdcall LsaEnumeratePrivilegesOfAccount(ptr ptr)
 @ stdcall LsaEnumerateAccountsWithUserRight(ptr ptr ptr ptr)
 @ stub LsaEnumeratePrivileges
 @ stdcall LsaEnumeratePrivilegesOfAccount(ptr ptr)
index 80ee33b..18c8bc5 100644 (file)
@@ -316,10 +316,30 @@ LsaCreateTrustedDomainEx(IN LSA_HANDLE PolicyHandle,
                          IN ACCESS_MASK DesiredAccess,
                          OUT PLSA_HANDLE TrustedDomainHandle)
 {
                          IN ACCESS_MASK DesiredAccess,
                          OUT PLSA_HANDLE TrustedDomainHandle)
 {
-    FIXME("LsaCreateTrustedDomainEx(%p %p %p 0x%08lx %p) stub\n",
+    PLSAPR_TRUSTED_DOMAIN_AUTH_INFORMATION_INTERNAL EncryptedAuthInfo = NULL;
+    NTSTATUS Status;
+
+    TRACE("LsaCreateTrustedDomainEx(%p %p %p 0x%08lx %p) stub\n",
           PolicyHandle, TrustedDomainInformation, AuthenticationInformation,
           DesiredAccess, TrustedDomainHandle);
           PolicyHandle, TrustedDomainInformation, AuthenticationInformation,
           DesiredAccess, TrustedDomainHandle);
-    return STATUS_SUCCESS;
+
+    RpcTryExcept
+    {
+        /* FIXME: Encrypt AuthenticationInformation */
+
+        Status = LsarCreateTrustedDomainEx2((LSAPR_HANDLE)PolicyHandle,
+                                            (PLSAPR_TRUSTED_DOMAIN_INFORMATION_EX)TrustedDomainInformation,
+                                            EncryptedAuthInfo,
+                                            DesiredAccess,
+                                            (PLSAPR_HANDLE)TrustedDomainHandle);
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        Status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return Status;
 }
 
 
 }
 
 
@@ -419,6 +439,50 @@ LsaEnumerateAccountRights(IN LSA_HANDLE PolicyHandle,
 }
 
 
 }
 
 
+/*
+ * @implemented
+ */
+NTSTATUS
+WINAPI
+LsaEnumerateAccounts(IN LSA_HANDLE PolicyHandle,
+                     IN OUT PLSA_ENUMERATION_HANDLE EnumerationContext,
+                     OUT PVOID *Buffer,
+                     IN ULONG PreferedMaximumLength,
+                     OUT PULONG CountReturned)
+{
+    LSAPR_ACCOUNT_ENUM_BUFFER AccountEnumBuffer;
+    NTSTATUS Status;
+
+    TRACE("LsaEnumerateAccounts(%p %p %p %lu %p)\n",
+          PolicyHandle, EnumerationContext, Buffer,
+          PreferedMaximumLength, CountReturned);
+
+    AccountEnumBuffer.EntriesRead = 0;
+    AccountEnumBuffer.Information = NULL;
+
+    RpcTryExcept
+    {
+        Status = LsarEnumerateAccounts((LSAPR_HANDLE)PolicyHandle,
+                                       EnumerationContext,
+                                       &AccountEnumBuffer,
+                                       PreferedMaximumLength);
+
+        *Buffer = AccountEnumBuffer.Information;
+        *CountReturned = AccountEnumBuffer.EntriesRead;
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        if (AccountEnumBuffer.Information != NULL)
+            MIDL_user_free(AccountEnumBuffer.Information);
+
+        Status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return Status;
+}
+
+
 /*
  * @unimplemented
  */
 /*
  * @unimplemented
  */
index 72bb9c7..fd8c521 100644 (file)
@@ -689,6 +689,8 @@ NTSTATUS NTAPI LsaDelete(LSA_HANDLE);
 NTSTATUS NTAPI LsaDeleteTrustedDomain(LSA_HANDLE,PSID);
 NTSTATUS NTAPI LsaDeregisterLogonProcess(HANDLE);
 NTSTATUS NTAPI LsaEnumerateAccountRights(LSA_HANDLE,PSID,PLSA_UNICODE_STRING*,PULONG);
 NTSTATUS NTAPI LsaDeleteTrustedDomain(LSA_HANDLE,PSID);
 NTSTATUS NTAPI LsaDeregisterLogonProcess(HANDLE);
 NTSTATUS NTAPI LsaEnumerateAccountRights(LSA_HANDLE,PSID,PLSA_UNICODE_STRING*,PULONG);
+NTSTATUS NTAPI LsaEnumerateAccounts(LSA_HANDLE,PLSA_ENUMERATION_HANDLE,PVOID*,
+                            ULONG,PULONG);
 NTSTATUS NTAPI LsaEnumerateAccountsWithUserRight(LSA_HANDLE,PLSA_UNICODE_STRING,
                             PVOID*,PULONG);
 NTSTATUS NTAPI LsaEnumeratePrivilegesOfAccount(LSA_HANDLE,PPRIVILEGE_SET*);
 NTSTATUS NTAPI LsaEnumerateAccountsWithUserRight(LSA_HANDLE,PLSA_UNICODE_STRING,
                             PVOID*,PULONG);
 NTSTATUS NTAPI LsaEnumeratePrivilegesOfAccount(LSA_HANDLE,PPRIVILEGE_SET*);