[ADVAPI32]
authorEric Kohl <eric.kohl@reactos.org>
Sat, 22 Sep 2012 09:23:38 +0000 (09:23 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 22 Sep 2012 09:23:38 +0000 (09:23 +0000)
Implement LsaGetUserName and LsaOpenTrustedDomain.

svn path=/trunk/; revision=57361

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

index 4356819..af8b8d5 100644 (file)
 @ stdcall LsaOpenPolicy(ptr ptr long ptr)
 @ stub LsaOpenPolicySce
 @ stdcall LsaOpenSecret(ptr ptr long ptr)
 @ stdcall LsaOpenPolicy(ptr ptr long ptr)
 @ stub LsaOpenPolicySce
 @ stdcall LsaOpenSecret(ptr ptr long ptr)
-@ stub LsaOpenTrustedDomain
+@ stdcall LsaOpenTrustedDomain(ptr ptr long ptr)
 @ stdcall LsaOpenTrustedDomainByName(ptr ptr long ptr)
 @ stdcall LsaQueryDomainInformationPolicy(ptr long ptr)
 @ stdcall LsaQueryForestTrustInformation(ptr ptr ptr)
 @ stdcall LsaOpenTrustedDomainByName(ptr ptr long ptr)
 @ stdcall LsaQueryDomainInformationPolicy(ptr long ptr)
 @ stdcall LsaQueryForestTrustInformation(ptr ptr ptr)
index 218d648..80ee33b 100644 (file)
@@ -547,12 +547,40 @@ LsaGetSystemAccessAccount(IN LSA_HANDLE AccountHandle,
  */
 NTSTATUS
 WINAPI
  */
 NTSTATUS
 WINAPI
-LsaGetUserName(PUNICODE_STRING *UserName,
-               PUNICODE_STRING *DomainName)
+LsaGetUserName(OUT PUNICODE_STRING *UserName,
+               OUT PUNICODE_STRING *DomainName OPTIONAL)
 {
 {
-    FIXME("LsaGetUserName(%p %p) stub\n",
+    PRPC_UNICODE_STRING UserNameString = NULL;
+    PRPC_UNICODE_STRING DomainNameString = NULL;
+    NTSTATUS Status;
+
+    TRACE("LsaGetUserName(%p %p)\n",
           UserName, DomainName);
           UserName, DomainName);
-    return STATUS_NOT_IMPLEMENTED;
+
+    RpcTryExcept
+    {
+        Status = LsarGetUserName(NULL,
+                                 &UserNameString,
+                                 (DomainName != NULL) ? &DomainNameString : NULL);
+
+        *UserName = (PUNICODE_STRING)UserNameString;
+
+        if (DomainName != NULL)
+            *DomainName = (PUNICODE_STRING)DomainNameString;
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        if (UserNameString != NULL)
+            MIDL_user_free(UserNameString);
+
+        if (DomainNameString != NULL)
+            MIDL_user_free(DomainNameString);
+
+        Status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return Status;
 }
 
 
 }
 
 
@@ -918,6 +946,38 @@ LsaOpenSecret(IN LSA_HANDLE PolicyHandle,
 }
 
 
 }
 
 
+/*
+ * @implemented
+ */
+NTSTATUS
+WINAPI
+LsaOpenTrustedDomain(IN LSA_HANDLE PolicyHandle,
+                     IN PSID TrustedDomainSid,
+                     IN ACCESS_MASK DesiredAccess,
+                     OUT PLSA_HANDLE TrustedDomainHandle)
+{
+    NTSTATUS Status;
+
+    TRACE("LsaOpenTrustedDomain(%p %p 0x%08lx %p)\n",
+          PolicyHandle, TrustedDomainSid, DesiredAccess, TrustedDomainHandle);
+
+    RpcTryExcept
+    {
+        Status = LsarOpenTrustedDomain((LSAPR_HANDLE)PolicyHandle,
+                                       (PRPC_SID)TrustedDomainSid,
+                                       DesiredAccess,
+                                       (PLSAPR_HANDLE)TrustedDomainHandle);
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        Status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return Status;
+}
+
+
 /*
  * @implemented
  */
 /*
  * @implemented
  */
index ef36bcc..72bb9c7 100644 (file)
@@ -679,18 +679,19 @@ NTSTATUS NTAPI LsaCallAuthenticationPackage(HANDLE,ULONG,PVOID,ULONG,PVOID*,
 NTSTATUS NTAPI LsaClearAuditLog(LSA_HANDLE);
 NTSTATUS NTAPI LsaClose(LSA_HANDLE);
 NTSTATUS NTAPI LsaConnectUntrusted(PHANDLE);
 NTSTATUS NTAPI LsaClearAuditLog(LSA_HANDLE);
 NTSTATUS NTAPI LsaClose(LSA_HANDLE);
 NTSTATUS NTAPI LsaConnectUntrusted(PHANDLE);
-NTSTATUS NTAPI LsaCreateAccount(LSA_HANDLE, PSID, ACCESS_MASK, PLSA_HANDLE);
-NTSTATUS NTAPI LsaCreateSecret(LSA_HANDLE, PLSA_UNICODE_STRING, ACCESS_MASK, PLSA_HANDLE);
-NTSTATUS NTAPI LsaCreateTrustedDomain(LSA_HANDLE, PLSA_TRUST_INFORMATION,
-                            ACCESS_MASK, PLSA_HANDLE);
-NTSTATUS NTAPI LsaCreateTrustedDomainEx(LSA_HANDLE, PTRUSTED_DOMAIN_INFORMATION_EX,
-                            PTRUSTED_DOMAIN_AUTH_INFORMATION, ACCESS_MASK, PLSA_HANDLE);
+NTSTATUS NTAPI LsaCreateAccount(LSA_HANDLE,PSID,ACCESS_MASK,PLSA_HANDLE);
+NTSTATUS NTAPI LsaCreateSecret(LSA_HANDLE,PLSA_UNICODE_STRING,ACCESS_MASK,PLSA_HANDLE);
+NTSTATUS NTAPI LsaCreateTrustedDomain(LSA_HANDLE,PLSA_TRUST_INFORMATION,
+                            ACCESS_MASK,PLSA_HANDLE);
+NTSTATUS NTAPI LsaCreateTrustedDomainEx(LSA_HANDLE,PTRUSTED_DOMAIN_INFORMATION_EX,
+                            PTRUSTED_DOMAIN_AUTH_INFORMATION,ACCESS_MASK,PLSA_HANDLE);
+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 LsaEnumerateAccountsWithUserRight(LSA_HANDLE,PLSA_UNICODE_STRING,
                             PVOID*,PULONG);
 NTSTATUS NTAPI LsaDeleteTrustedDomain(LSA_HANDLE,PSID);
 NTSTATUS NTAPI LsaDeregisterLogonProcess(HANDLE);
 NTSTATUS NTAPI LsaEnumerateAccountRights(LSA_HANDLE,PSID,PLSA_UNICODE_STRING*,PULONG);
 NTSTATUS NTAPI LsaEnumerateAccountsWithUserRight(LSA_HANDLE,PLSA_UNICODE_STRING,
                             PVOID*,PULONG);
-NTSTATUS NTAPI LsaEnumeratePrivilegesOfAccount(LSA_HANDLE, PPRIVILEGE_SET*);
+NTSTATUS NTAPI LsaEnumeratePrivilegesOfAccount(LSA_HANDLE,PPRIVILEGE_SET*);
 NTSTATUS NTAPI LsaEnumerateTrustedDomains(LSA_HANDLE,PLSA_ENUMERATION_HANDLE,
                             PVOID*,ULONG,PULONG);
 NTSTATUS NTAPI LsaEnumerateTrustedDomainsEx(LSA_HANDLE,PLSA_ENUMERATION_HANDLE,
 NTSTATUS NTAPI LsaEnumerateTrustedDomains(LSA_HANDLE,PLSA_ENUMERATION_HANDLE,
                             PVOID*,ULONG,PULONG);
 NTSTATUS NTAPI LsaEnumerateTrustedDomainsEx(LSA_HANDLE,PLSA_ENUMERATION_HANDLE,
@@ -698,6 +699,7 @@ NTSTATUS NTAPI LsaEnumerateTrustedDomainsEx(LSA_HANDLE,PLSA_ENUMERATION_HANDLE,
 NTSTATUS NTAPI LsaFreeMemory(PVOID);
 NTSTATUS NTAPI LsaFreeReturnBuffer(PVOID);
 NTSTATUS NTAPI LsaGetSystemAccessAccount(LSA_HANDLE, PULONG);
 NTSTATUS NTAPI LsaFreeMemory(PVOID);
 NTSTATUS NTAPI LsaFreeReturnBuffer(PVOID);
 NTSTATUS NTAPI LsaGetSystemAccessAccount(LSA_HANDLE, PULONG);
+NTSTATUS NTAPI LsaGetUserName(PUNICODE_STRING*,PUNICODE_STRING*);
 NTSTATUS NTAPI LsaLogonUser(HANDLE,PLSA_STRING,SECURITY_LOGON_TYPE,ULONG,PVOID,
                             ULONG,PTOKEN_GROUPS,PTOKEN_SOURCE,PVOID*,PULONG,
                             PLUID,PHANDLE,PQUOTA_LIMITS,PNTSTATUS);
 NTSTATUS NTAPI LsaLogonUser(HANDLE,PLSA_STRING,SECURITY_LOGON_TYPE,ULONG,PVOID,
                             ULONG,PTOKEN_GROUPS,PTOKEN_SOURCE,PVOID*,PULONG,
                             PLUID,PHANDLE,PQUOTA_LIMITS,PNTSTATUS);
@@ -706,17 +708,18 @@ NTSTATUS NTAPI LsaLookupNames(LSA_HANDLE,ULONG,PLSA_UNICODE_STRING,
                             PLSA_REFERENCED_DOMAIN_LIST*,PLSA_TRANSLATED_SID*);
 NTSTATUS NTAPI LsaLookupNames2(LSA_HANDLE,ULONG,ULONG,PLSA_UNICODE_STRING,
                             PLSA_REFERENCED_DOMAIN_LIST*,PLSA_TRANSLATED_SID2*);
                             PLSA_REFERENCED_DOMAIN_LIST*,PLSA_TRANSLATED_SID*);
 NTSTATUS NTAPI LsaLookupNames2(LSA_HANDLE,ULONG,ULONG,PLSA_UNICODE_STRING,
                             PLSA_REFERENCED_DOMAIN_LIST*,PLSA_TRANSLATED_SID2*);
-NTSTATUS NTAPI LsaLookupPrivilegeName(LSA_HANDLE, PLUID, PLSA_UNICODE_STRING*);
-NTSTATUS NTAPI LsaLookupPrivilegeValue(LSA_HANDLE, PLSA_UNICODE_STRING, PLUID);
+NTSTATUS NTAPI LsaLookupPrivilegeName(LSA_HANDLE,PLUID,PLSA_UNICODE_STRING*);
+NTSTATUS NTAPI LsaLookupPrivilegeValue(LSA_HANDLE,PLSA_UNICODE_STRING,PLUID);
 NTSTATUS NTAPI LsaLookupSids(LSA_HANDLE,ULONG,PSID*,
                             PLSA_REFERENCED_DOMAIN_LIST*,PLSA_TRANSLATED_NAME*);
 ULONG NTAPI LsaNtStatusToWinError(NTSTATUS);
 NTSTATUS NTAPI LsaLookupSids(LSA_HANDLE,ULONG,PSID*,
                             PLSA_REFERENCED_DOMAIN_LIST*,PLSA_TRANSLATED_NAME*);
 ULONG NTAPI LsaNtStatusToWinError(NTSTATUS);
-NTSTATUS NTAPI LsaOpenAccount(LSA_HANDLE, PSID, ACCESS_MASK, PLSA_HANDLE);
+NTSTATUS NTAPI LsaOpenAccount(LSA_HANDLE,PSID,ACCESS_MASK,PLSA_HANDLE);
 NTSTATUS NTAPI LsaOpenPolicy(PLSA_UNICODE_STRING,PLSA_OBJECT_ATTRIBUTES,
                             ACCESS_MASK,PLSA_HANDLE);
 NTSTATUS NTAPI LsaOpenSecret(LSA_HANDLE, PLSA_UNICODE_STRING, ACCESS_MASK, PLSA_HANDLE);
 NTSTATUS NTAPI LsaOpenPolicy(PLSA_UNICODE_STRING,PLSA_OBJECT_ATTRIBUTES,
                             ACCESS_MASK,PLSA_HANDLE);
 NTSTATUS NTAPI LsaOpenSecret(LSA_HANDLE, PLSA_UNICODE_STRING, ACCESS_MASK, PLSA_HANDLE);
-NTSTATUS NTAPI LsaOpenTrustedDomainByName(LSA_HANDLE, PLSA_UNICODE_STRING,
-                            ACCESS_MASK, PLSA_HANDLE);
+NTSTATUS NTAPI LsaOpenTrustedDomain(LSA_HANDLE,PSID,ACCESS_MASK,PLSA_HANDLE);
+NTSTATUS NTAPI LsaOpenTrustedDomainByName(LSA_HANDLE,PLSA_UNICODE_STRING,
+                            ACCESS_MASK,PLSA_HANDLE);
 NTSTATUS NTAPI LsaQueryDomainInformationPolicy(LSA_HANDLE,
                             POLICY_DOMAIN_INFORMATION_CLASS,PVOID*);
 NTSTATUS NTAPI LsaQueryInformationPolicy(LSA_HANDLE,POLICY_INFORMATION_CLASS,PVOID*);
 NTSTATUS NTAPI LsaQueryDomainInformationPolicy(LSA_HANDLE,
                             POLICY_DOMAIN_INFORMATION_CLASS,PVOID*);
 NTSTATUS NTAPI LsaQueryInformationPolicy(LSA_HANDLE,POLICY_INFORMATION_CLASS,PVOID*);
@@ -738,8 +741,8 @@ NTSTATUS NTAPI LsaSetDomainInformationPolicy(LSA_HANDLE,
 NTSTATUS NTAPI LsaSetInformationPolicy(LSA_HANDLE,POLICY_INFORMATION_CLASS, PVOID);
 NTSTATUS NTAPI LsaSetLocalInformationPolicy(LSA_HANDLE,
                             POLICY_LOCAL_INFORMATION_CLASS,PVOID);
 NTSTATUS NTAPI LsaSetInformationPolicy(LSA_HANDLE,POLICY_INFORMATION_CLASS, PVOID);
 NTSTATUS NTAPI LsaSetLocalInformationPolicy(LSA_HANDLE,
                             POLICY_LOCAL_INFORMATION_CLASS,PVOID);
-NTSTATUS NTAPI LsaSetSecret(LSA_HANDLE, PLSA_UNICODE_STRING, PLSA_UNICODE_STRING);
-NTSTATUS NTAPI LsaSetSystemAccessAccount(LSA_HANDLE, ULONG);
+NTSTATUS NTAPI LsaSetSecret(LSA_HANDLE,PLSA_UNICODE_STRING,PLSA_UNICODE_STRING);
+NTSTATUS NTAPI LsaSetSystemAccessAccount(LSA_HANDLE,ULONG);
 NTSTATUS NTAPI LsaSetTrustedDomainInformation(LSA_HANDLE,PSID,
                             TRUSTED_INFORMATION_CLASS,PVOID);
 NTSTATUS NTAPI LsaSetTrustedDomainInfoByName(LSA_HANDLE,PLSA_UNICODE_STRING,
 NTSTATUS NTAPI LsaSetTrustedDomainInformation(LSA_HANDLE,PSID,
                             TRUSTED_INFORMATION_CLASS,PVOID);
 NTSTATUS NTAPI LsaSetTrustedDomainInfoByName(LSA_HANDLE,PLSA_UNICODE_STRING,