Implement ElfrRegisterEventSourceA.
authorEric Kohl <eric.kohl@reactos.org>
Sun, 17 Jan 2010 15:16:26 +0000 (15:16 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sun, 17 Jan 2010 15:16:26 +0000 (15:16 +0000)
svn path=/trunk/; revision=45123

reactos/base/services/eventlog/rpc.c

index e5e4e4d..e3ef33d 100644 (file)
@@ -29,7 +29,6 @@ DWORD WINAPI RpcThreadRoutine(LPVOID lpParameter)
     }
 
     Status = RpcServerRegisterIf(eventlog_v0_0_s_ifspec, NULL, NULL);
-
     if (Status != RPC_S_OK)
     {
         DPRINT("RpcServerRegisterIf() failed (Status %lx)\n", Status);
@@ -37,7 +36,6 @@ DWORD WINAPI RpcThreadRoutine(LPVOID lpParameter)
     }
 
     Status = RpcServerListen(1, RPC_C_LISTEN_MAX_CALLS_DEFAULT, FALSE);
-
     if (Status != RPC_S_OK)
     {
         DPRINT("RpcServerListen() failed (Status %lx)\n", Status);
@@ -533,8 +531,48 @@ NTSTATUS ElfrRegisterEventSourceA(
     DWORD MinorVersion,
     IELF_HANDLE *LogHandle)
 {
-    UNIMPLEMENTED;
-    return STATUS_NOT_IMPLEMENTED;
+    UNICODE_STRING UNCServerNameW = { 0, 0, NULL };
+    UNICODE_STRING ModuleNameW    = { 0, 0, NULL };
+
+    if (UNCServerName &&
+        !RtlCreateUnicodeStringFromAsciiz(&UNCServerNameW, UNCServerName))
+    {
+        return STATUS_NO_MEMORY;
+    }
+
+    if (ModuleName &&
+        !RtlAnsiStringToUnicodeString(&ModuleNameW, (PANSI_STRING)ModuleName, TRUE))
+    {
+        RtlFreeUnicodeString(&UNCServerNameW);
+        return STATUS_NO_MEMORY;
+    }
+
+    /* RegModuleName must be an empty string */
+    if (RegModuleName->Length > 0)
+    {
+        RtlFreeUnicodeString(&UNCServerNameW);
+        RtlFreeUnicodeString(&ModuleNameW);
+        return STATUS_INVALID_PARAMETER;
+    }
+
+    if ((MajorVersion != 1) || (MinorVersion != 1))
+    {
+        RtlFreeUnicodeString(&UNCServerNameW);
+        RtlFreeUnicodeString(&ModuleNameW);
+        return STATUS_INVALID_PARAMETER;
+    }
+
+    /*FIXME: UNCServerName must specify the server or empty for local */
+
+    /*FIXME: Must verify that caller has write access */
+
+    *LogHandle = ElfCreateEventLogHandle(ModuleNameW.Buffer,
+                                         TRUE);
+
+    RtlFreeUnicodeString(&UNCServerNameW);
+    RtlFreeUnicodeString(&ModuleNameW);
+
+    return STATUS_SUCCESS;
 }