-#define WIN32_NO_STATUS
-#include <windows.h>
-#define NTOS_MODE_USER
-#include <ndk/ntndk.h>
+/*
+ * PROJECT: Local Security Authority Server DLL
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: dll/win32/lsasrv/lsasrv.c
+ * PURPOSE: Main file
+ * COPYRIGHT: Copyright 2006-2009 Eric Kohl
+ */
-#define NDEBUG
-#include <debug.h>
+/* INCLUDES ****************************************************************/
-VOID LsarStartRpcServer(VOID);
+#include "lsasrv.h"
+WINE_DEFAULT_DEBUG_CHANNEL(lsasrv);
-NTSTATUS STDCALL
+
+/* FUNCTIONS ***************************************************************/
+
+NTSTATUS WINAPI
LsapInitLsa(VOID)
{
HANDLE hEvent;
+ DWORD dwError;
- DPRINT("LsapInitLsa() called\n");
+ TRACE("LsapInitLsa() called\n");
+ /* Initialize the well known SIDs */
+ LsapInitSids();
+
+ /* Start the RPC server */
LsarStartRpcServer();
- hEvent = OpenEventW(EVENT_MODIFY_STATE,
- FALSE,
- L"Global\\SECURITY_SERVICES_STARTED");
- if (hEvent != NULL)
+ TRACE("Creating notification event!\n");
+ /* Notify the service manager */
+ hEvent = CreateEventW(NULL,
+ TRUE,
+ FALSE,
+ L"LSA_RPC_SERVER_ACTIVE");
+ if (hEvent == NULL)
{
- SetEvent(hEvent);
- CloseHandle(hEvent);
+ dwError = GetLastError();
+ TRACE("Failed to create the notication event (Error %lu)\n", dwError);
+
+ if (dwError == ERROR_ALREADY_EXISTS)
+ {
+ hEvent = OpenEventW(GENERIC_WRITE,
+ FALSE,
+ L"LSA_RPC_SERVER_ACTIVE");
+ if (hEvent == NULL)
+ {
+ ERR("Could not open the notification event (Error %lu)\n", GetLastError());
+ return STATUS_UNSUCCESSFUL;
+ }
+ }
}
+
+ TRACE("Set notification event!\n");
+ SetEvent(hEvent);
+
+ /* NOTE: Do not close the event handle!!!! */
+
+ StartAuthenticationPort();
+
return STATUS_SUCCESS;
}
+
+NTSTATUS WINAPI
+ServiceInit(VOID)
+{
+ TRACE("ServiceInit() called\n");
+ return STATUS_SUCCESS;
+}
+
+
void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len)
{
return RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, len);
RtlFreeHeap(RtlGetProcessHeap(), 0, ptr);
}
-
/* EOF */