[MSGINA]
[reactos.git] / reactos / dll / win32 / msgina / gui.c
index 06c5894..4031557 100644 (file)
@@ -259,9 +259,6 @@ DoChangePassword(
     ULONG RequestBufferSize;
     ULONG ResponseBufferSize = 0;
     LPWSTR Ptr;
-    LSA_STRING PackageName;
-    HANDLE LsaHandle = NULL;
-    ULONG AuthenticationPackage = 0;
     BOOL res = FALSE;
     NTSTATUS ProtocolStatus;
     NTSTATUS Status;
@@ -349,29 +346,15 @@ DoChangePassword(
                   RequestBuffer->NewPassword.MaximumLength);
 
     /* Connect to the LSA server */
-    Status = LsaConnectUntrusted(&LsaHandle);
-    if (!NT_SUCCESS(Status))
-    {
-        ERR("LsaConnectUntrusted failed (Status 0x%08lx)\n", Status);
-        goto done;
-    }
-
-    /* Get the authentication package */
-    RtlInitAnsiString((PANSI_STRING)&PackageName,
-                      MSV1_0_PACKAGE_NAME);
-
-    Status = LsaLookupAuthenticationPackage(LsaHandle,
-                                            &PackageName,
-                                            &AuthenticationPackage);
-    if (!NT_SUCCESS(Status))
+    if (!ConnectToLsa(pgContext))
     {
-        ERR("LsaLookupAuthenticationPackage failed (Status 0x%08lx)\n", Status);
-        goto done;
+        ERR("ConnectToLsa() failed\n");
+        return FALSE;
     }
 
     /* Call the authentication package */
-    Status = LsaCallAuthenticationPackage(LsaHandle,
-                                          AuthenticationPackage,
+    Status = LsaCallAuthenticationPackage(pgContext->LsaHandle,
+                                          pgContext->AuthenticationPackage,
                                           RequestBuffer,
                                           RequestBufferSize,
                                           (PVOID*)&ResponseBuffer,
@@ -404,9 +387,6 @@ done:
     if (ResponseBuffer != NULL)
         LsaFreeReturnBuffer(ResponseBuffer);
 
-    if (LsaHandle != NULL)
-        NtClose(LsaHandle);
-
     return res;
 }