[ADVAPI32]
authorEric Kohl <eric.kohl@reactos.org>
Fri, 28 Sep 2012 22:11:18 +0000 (22:11 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Fri, 28 Sep 2012 22:11:18 +0000 (22:11 +0000)
Implement LsaGetRemoteUserName, LsaQueryDomainInformationPolicy and LsaSetDomainInformationPolicy.

svn path=/trunk/; revision=57416

reactos/dll/win32/advapi32/sec/lsa.c
reactos/include/reactos/idl/lsa.idl

index 7605198..308dbe4 100644 (file)
@@ -688,9 +688,38 @@ LsaGetRemoteUserName(IN PLSA_UNICODE_STRING SystemName OPTIONAL,
                      OUT PLSA_UNICODE_STRING *UserName,
                      OUT PLSA_UNICODE_STRING *DomainName OPTIONAL)
 {
-    FIXME("LsaGetUserName(%p %p %p)\n",
-          SystemName, UserName, DomainName);
-    return STATUS_NOT_IMPLEMENTED;
+    PRPC_UNICODE_STRING UserNameString = NULL;
+    PRPC_UNICODE_STRING DomainNameString = NULL;
+    NTSTATUS Status;
+
+    TRACE("LsaGetRemoteUserName(%s %p %p)\n",
+          SystemName ? debugstr_w(SystemName->Buffer) : "(null)",
+          UserName, DomainName);
+
+    RpcTryExcept
+    {
+        Status = LsarGetUserName((PLSAPR_SERVER_NAME)SystemName,
+                                 &UserNameString,
+                                 (DomainName != NULL) ? &DomainNameString : NULL);
+
+        *UserName = (PLSA_UNICODE_STRING)UserNameString;
+
+        if (DomainName != NULL)
+            *DomainName = (PLSA_UNICODE_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;
 }
 
 
@@ -1227,7 +1256,7 @@ LsaOpenTrustedDomainByName(IN LSA_HANDLE PolicyHandle,
 
 
 /*
- * @unimplemented
+ * @implemented
  */
 NTSTATUS
 WINAPI
@@ -1235,9 +1264,30 @@ LsaQueryDomainInformationPolicy(IN LSA_HANDLE PolicyHandle,
                                 IN POLICY_DOMAIN_INFORMATION_CLASS InformationClass,
                                 OUT PVOID *Buffer)
 {
-    FIXME("LsaQueryDomainInformationPolicy(%p %lu %p) stub\n",
+    PLSAPR_POLICY_DOMAIN_INFORMATION PolicyInformation = NULL;
+    NTSTATUS Status;
+
+    TRACE("LsaQueryDomainInformationPolicy(%p %lu %p)\n",
           PolicyHandle, InformationClass, Buffer);
-    return STATUS_NOT_IMPLEMENTED;
+
+    RpcTryExcept
+    {
+        Status = LsarQueryDomainInformationPolicy((LSAPR_HANDLE)PolicyHandle,
+                                                  InformationClass,
+                                                  &PolicyInformation);
+
+        *Buffer = PolicyInformation;
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        if (PolicyInformation != NULL)
+            MIDL_user_free(PolicyInformation);
+
+        Status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return Status;
 }
 
 
@@ -1621,7 +1671,7 @@ LsaRetrievePrivateData(IN LSA_HANDLE PolicyHandle,
 
 
 /*
- * @unimplemented
+ * @implemented
  */
 NTSTATUS
 WINAPI
@@ -1629,9 +1679,24 @@ LsaSetDomainInformationPolicy(IN LSA_HANDLE PolicyHandle,
                               IN POLICY_DOMAIN_INFORMATION_CLASS InformationClass,
                               IN PVOID Buffer OPTIONAL)
 {
-    FIXME("LsaSetDomainInformationPolicy(%p %d %p) stub\n",
+    NTSTATUS Status;
+
+    TRACE("LsaSetDomainInformationPolicy(%p %d %p)\n",
           PolicyHandle, InformationClass, Buffer);
-    return STATUS_UNSUCCESSFUL;
+
+    RpcTryExcept
+    {
+        Status = LsarSetDomainInformationPolicy((LSAPR_HANDLE)PolicyHandle,
+                                                InformationClass,
+                                                (PLSAPR_POLICY_DOMAIN_INFORMATION)Buffer);
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        Status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return Status;
 }
 
 
index 3edc645..37db6d6 100644 (file)
@@ -936,15 +936,13 @@ cpp_quote("#if _WIN32_WINNT >= 0x0500")
     NTSTATUS __stdcall LsarQueryDomainInformationPolicy(
         [in] LSAPR_HANDLE PolicyHandle,
         [in] POLICY_INFORMATION_CLASS InformationClass,
-        [out] unsigned long *PolicyInformation);
-        /* FIXME: should be [out, switch_is(InformationClass)] PLSAPR_POLICY_INFORMATION *PolicyInformation); */
+        [out, switch_is(InformationClass)] PLSAPR_POLICY_DOMAIN_INFORMATION *PolicyInformation);
 
     /* Function 54 */
     NTSTATUS __stdcall LsarSetDomainInformationPolicy(
         [in] LSAPR_HANDLE PolicyHandle,
         [in] POLICY_INFORMATION_CLASS InformationClass,
-        [in] unsigned long PolicyInformation);
-        /* FIXME: should be [in, switch_is(InformationClass)] PLSAPR_POLICY_INFORMATION PolicyInformation); */
+        [in, switch_is(InformationClass)] PLSAPR_POLICY_DOMAIN_INFORMATION PolicyInformation);
 
     /* Function 55 */
     NTSTATUS __stdcall LsarOpenTrustedDomainByName(