- SEH-protect LsaClose, LsaDelete and LsaOpenPolicy.
authorEric Kohl <eric.kohl@reactos.org>
Sun, 14 Dec 2008 13:16:16 +0000 (13:16 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sun, 14 Dec 2008 13:16:16 +0000 (13:16 +0000)
- Move the code of LsaOpenPolicy into LsarOpenPolicy and make LsaOpenPolicy call LsarOpenPolicy.

svn path=/trunk/; revision=38078

reactos/dll/win32/advapi32/sec/lsa.c
reactos/dll/win32/lsasrv/lsarpc.c

index ec4cf89..a1795c5 100644 (file)
@@ -78,13 +78,21 @@ PLSAPR_SERVER_NAME_unbind(PLSAPR_SERVER_NAME pszSystemName,
 NTSTATUS WINAPI
 LsaClose(LSA_HANDLE ObjectHandle)
 {
+    NTSTATUS Status;
+
     TRACE("LsaClose(0x%p) called\n", ObjectHandle);
 
-    /* This is our fake handle, don't go too much long way */
-    if (ObjectHandle == (LSA_HANDLE)0xcafe)
-        return STATUS_SUCCESS;
+    _SEH2_TRY
+    {
+        Status = LsarClose((PLSAPR_HANDLE)&ObjectHandle);
+    }
+    _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+    {
+        Status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    _SEH2_END;
 
-    return LsarClose((PLSAPR_HANDLE)&ObjectHandle);
+    return Status;
 }
 
 
@@ -94,9 +102,21 @@ LsaClose(LSA_HANDLE ObjectHandle)
 NTSTATUS WINAPI
 LsaDelete(LSA_HANDLE ObjectHandle)
 {
+    NTSTATUS Status;
+
     TRACE("LsaDelete(0x%p) called\n", ObjectHandle);
 
-    return LsarDelete((LSAPR_HANDLE)ObjectHandle);
+    _SEH2_TRY
+    {
+        Status = LsarDelete((LSAPR_HANDLE)ObjectHandle);
+    }
+    _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+    {
+        Status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    _SEH2_END;
+
+    return Status;
 }
 
 
@@ -365,14 +385,33 @@ LsaOpenPolicy(
     IN ACCESS_MASK DesiredAccess,
     IN OUT PLSA_HANDLE PolicyHandle)
 {
-    TRACE("(%s,%p,0x%08x,%p) stub\n",
+    NTSTATUS Status;
+
+    TRACE("LsaOpenPolicy (%s,%p,0x%08x,%p)\n",
           SystemName?debugstr_w(SystemName->Buffer):"(null)",
           ObjectAttributes, DesiredAccess, PolicyHandle);
 
-    if(PolicyHandle) *PolicyHandle = (LSA_HANDLE)0xcafe;
-    return STATUS_SUCCESS;
+    _SEH2_TRY
+    {
+        *PolicyHandle = NULL;
+
+        Status = LsarOpenPolicy(SystemName->Buffer,
+                                (PLSAPR_OBJECT_ATTRIBUTES)ObjectAttributes,
+                                DesiredAccess,
+                                PolicyHandle);
+    }
+    _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+    {
+        Status = I_RpcMapWin32Status(RpcExceptionCode());
+    }
+    _SEH2_END;
+
+    TRACE("LsaOpenPolicy() done (Status: 0x%08lx)\n", Status);
+
+    return Status;
 }
 
+
 /*
  * @unimplemented
  */
index e5500b1..b97b2da 100644 (file)
@@ -162,8 +162,8 @@ void __RPC_USER LSAPR_HANDLE_rundown(LSAPR_HANDLE hHandle)
 
 
 /* Function 0 */
-NTSTATUS LsarClose(
-    LSAPR_HANDLE *ObjectHandle)
+NTSTATUS
+LsarClose(LSAPR_HANDLE *ObjectHandle)
 {
 #if 0
     PLSAR_POLICY_HANDLE Policy = NULL;
@@ -183,14 +183,24 @@ NTSTATUS LsarClose(
 
     return Status;
 #endif
-    UNIMPLEMENTED;
-    return STATUS_NOT_IMPLEMENTED;
+    NTSTATUS Status = STATUS_NOT_IMPLEMENTED;
+
+    TRACE("LsarClose called!\n");
+
+    /* This is our fake handle, don't go too much long way */
+    if (*ObjectHandle == (LSA_HANDLE)0xcafe)
+        Status = STATUS_SUCCESS;
+
+
+    TRACE("LsarClose done (Status: 0x%08lx)!\n", Status);
+
+    return Status;
 }
 
 
 /* Function 1 */
-NTSTATUS LsarDelete(
-    LSAPR_HANDLE ObjectHandle)
+NTSTATUS
+LsarDelete(LSAPR_HANDLE ObjectHandle)
 {
     /* Deprecated */
     return STATUS_NOT_SUPPORTED;
@@ -252,16 +262,13 @@ NTSTATUS LsarOpenPolicy(
     ACCESS_MASK DesiredAccess,
     LSAPR_HANDLE *PolicyHandle)
 {
-    ERR("LsarOpenPolicy called!\n");
+    TRACE("LsarOpenPolicy called!\n");
 
     *PolicyHandle = (LSAPR_HANDLE)0xcafe;
 
-    ERR("LsarOpenPolicy done!\n");
+    TRACE("LsarOpenPolicy done!\n");
 
     return STATUS_SUCCESS;
-
-//    UNIMPLEMENTED;
-//    return STATUS_NOT_IMPLEMENTED;
 }