Sync up to trunk head.
[reactos.git] / dll / win32 / lsasrv / lsasrv.c
1 /*
2 * PROJECT: Local Security Authority Server DLL
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: dll/win32/lsasrv/lsasrv.c
5 * PURPOSE: Main file
6 * COPYRIGHT: Copyright 2006-2009 Eric Kohl
7 */
8
9 /* INCLUDES ****************************************************************/
10
11 #define WIN32_NO_STATUS
12 #include <windows.h>
13 #define NTOS_MODE_USER
14 #include <ndk/ntndk.h>
15
16 #include "lsasrv.h"
17
18 #include "wine/debug.h"
19
20 WINE_DEFAULT_DEBUG_CHANNEL(lsasrv);
21
22
23 /* FUNCTIONS ***************************************************************/
24
25 NTSTATUS WINAPI
26 LsapInitLsa(VOID)
27 {
28 HANDLE hEvent;
29 DWORD dwError;
30
31 TRACE("LsapInitLsa() called\n");
32
33 /* Start the RPC server */
34 LsarStartRpcServer();
35
36 TRACE("Creating notification event!\n");
37 /* Notify the service manager */
38 hEvent = CreateEventW(NULL,
39 TRUE,
40 FALSE,
41 L"LSA_RPC_SERVER_ACTIVE");
42 if (hEvent == NULL)
43 {
44 dwError = GetLastError();
45 TRACE("Failed to create the notication event (Error %lu)\n", dwError);
46
47 if (dwError == ERROR_ALREADY_EXISTS)
48 {
49 hEvent = OpenEventW(GENERIC_WRITE,
50 FALSE,
51 L"LSA_RPC_SERVER_ACTIVE");
52 if (hEvent != NULL)
53 {
54 ERR("Could not open the notification event!");
55 }
56 }
57 }
58
59 TRACE("Set notification event!\n");
60 SetEvent(hEvent);
61
62 /* NOTE: Do not close the event handle!!!! */
63
64 StartAuthenticationPort();
65
66 return STATUS_SUCCESS;
67 }
68
69
70 void __RPC_FAR * __RPC_USER midl_user_allocate(SIZE_T len)
71 {
72 return RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, len);
73 }
74
75
76 void __RPC_USER midl_user_free(void __RPC_FAR * ptr)
77 {
78 RtlFreeHeap(RtlGetProcessHeap(), 0, ptr);
79 }
80
81 /* EOF */