From da0ee9b66b05e52f3494181c74042e3c40d4f3a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 17 Jan 2016 01:01:56 +0100
Subject: ntdll: Move RegisterTraceGuids from advapi32 to ntdll.

---
 dlls/advapi32/advapi32.spec |  4 +--
 dlls/advapi32/eventlog.c    | 64 -------------------------------------------
 dlls/ntdll/misc.c           | 67 +++++++++++++++++++++++++++++++++++++++++++++
 dlls/ntdll/ntdll.spec       |  2 ++
 4 files changed, 71 insertions(+), 66 deletions(-)

diff --git a/dlls/advapi32/advapi32.spec b/dlls/advapi32/advapi32.spec
index 36f176b..88f7fee 100644
--- a/dlls/advapi32/advapi32.spec
+++ b/dlls/advapi32/advapi32.spec
@@ -661,8 +661,8 @@
 @ stdcall RegisterServiceCtrlHandlerExA(str ptr ptr)
 @ stdcall RegisterServiceCtrlHandlerExW(wstr ptr ptr)
 @ stdcall RegisterServiceCtrlHandlerW(wstr ptr)
-@ stdcall RegisterTraceGuidsA(ptr ptr ptr long ptr str str ptr)
-@ stdcall RegisterTraceGuidsW(ptr ptr ptr long ptr wstr wstr ptr)
+@ stdcall RegisterTraceGuidsA(ptr ptr ptr long ptr str str ptr) ntdll.EtwRegisterTraceGuidsA
+@ stdcall RegisterTraceGuidsW(ptr ptr ptr long ptr wstr wstr ptr) ntdll.EtwRegisterTraceGuidsW
 # @ stub RemoveTraceCallback
 # @ stub RemoveUsersFromEncryptedFile
 @ stdcall ReportEventA(long long long long ptr long long ptr ptr)
diff --git a/dlls/advapi32/eventlog.c b/dlls/advapi32/eventlog.c
index 7839fc4..93c164d 100644
--- a/dlls/advapi32/eventlog.c
+++ b/dlls/advapi32/eventlog.c
@@ -742,70 +742,6 @@ BOOL WINAPI ReportEventW( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dw
 }
 
 /******************************************************************************
- * RegisterTraceGuidsW [ADVAPI32.@]
- *
- * Register an event trace provider and the event trace classes that it uses
- * to generate events.
- *
- * PARAMS
- *  RequestAddress     [I]   ControlCallback function
- *  RequestContext     [I]   Optional provider-defined context
- *  ControlGuid        [I]   GUID of the registering provider
- *  GuidCount          [I]   Number of elements in the TraceGuidReg array
- *  TraceGuidReg       [I/O] Array of TRACE_GUID_REGISTRATION structures
- *  MofImagePath       [I]   not supported, set to NULL
- *  MofResourceName    [I]   not supported, set to NULL
- *  RegistrationHandle [O]   Provider's registration handle
- *
- * RETURNS
- *  Success: ERROR_SUCCESS
- *  Failure: System error code
- *
- * FIXME
- *  Stub.
- */
-ULONG WINAPI RegisterTraceGuidsW( WMIDPREQUEST RequestAddress,
-                PVOID RequestContext, LPCGUID ControlGuid, ULONG GuidCount,
-                PTRACE_GUID_REGISTRATION TraceGuidReg, LPCWSTR MofImagePath,
-                LPCWSTR MofResourceName, PTRACEHANDLE RegistrationHandle )
-{
-    FIXME("(%p, %p, %s, %u, %p, %s, %s, %p): stub\n", RequestAddress, RequestContext,
-          debugstr_guid(ControlGuid), GuidCount, TraceGuidReg, debugstr_w(MofImagePath),
-          debugstr_w(MofResourceName), RegistrationHandle);
-
-    if (TraceGuidReg)
-    {
-        ULONG i;
-        for (i = 0; i < GuidCount; i++)
-        {
-            FIXME("  register trace class %s\n", debugstr_guid(TraceGuidReg[i].Guid));
-            TraceGuidReg[i].RegHandle = (HANDLE)0xdeadbeef;
-        }
-    }
-    *RegistrationHandle = (TRACEHANDLE)0xdeadbeef;
-    return ERROR_SUCCESS;
-}
-
-/******************************************************************************
- * RegisterTraceGuidsA [ADVAPI32.@]
- *
- * See RegisterTraceGuidsW.
- *
- * FIXME
- *  Stub.
- */
-ULONG WINAPI RegisterTraceGuidsA( WMIDPREQUEST RequestAddress,
-                PVOID RequestContext, LPCGUID ControlGuid, ULONG GuidCount,
-                PTRACE_GUID_REGISTRATION TraceGuidReg, LPCSTR MofImagePath,
-                LPCSTR MofResourceName, PTRACEHANDLE RegistrationHandle )
-{
-    FIXME("(%p, %p, %s, %u, %p, %s, %s, %p): stub\n", RequestAddress, RequestContext,
-          debugstr_guid(ControlGuid), GuidCount, TraceGuidReg, debugstr_a(MofImagePath),
-          debugstr_a(MofResourceName), RegistrationHandle);
-    return ERROR_SUCCESS;
-}
-
-/******************************************************************************
  * StartTraceW [ADVAPI32.@]
  *
  * Register and start an event trace session
diff --git a/dlls/ntdll/misc.c b/dlls/ntdll/misc.c
index 2cfa900..6d49882 100644
--- a/dlls/ntdll/misc.c
+++ b/dlls/ntdll/misc.c
@@ -27,6 +27,9 @@
 #include <sys/utsname.h>
 #endif
 
+#include "windows.h"
+#include "wmistr.h"
+#include "evntrace.h"
 #include "wine/library.h"
 #include "wine/debug.h"
 #include "ntdll_misc.h"
@@ -335,3 +338,67 @@ BOOL WINAPI WinSqmIsOptedIn(void)
     FIXME("() stub\n");
     return FALSE;
 }
+
+/*********************************************************************
+ *                  EtwRegisterTraceGuidsW   (NTDLL.@)
+ *
+ * Register an event trace provider and the event trace classes that it uses
+ * to generate events.
+ *
+ * PARAMS
+ *  RequestAddress     [I]   ControlCallback function
+ *  RequestContext     [I]   Optional provider-defined context
+ *  ControlGuid        [I]   GUID of the registering provider
+ *  GuidCount          [I]   Number of elements in the TraceGuidReg array
+ *  TraceGuidReg       [I/O] Array of TRACE_GUID_REGISTRATION structures
+ *  MofImagePath       [I]   not supported, set to NULL
+ *  MofResourceName    [I]   not supported, set to NULL
+ *  RegistrationHandle [O]   Provider's registration handle
+ *
+ * RETURNS
+ *  Success: ERROR_SUCCESS
+ *  Failure: System error code
+ *
+ * FIXME
+ *  Stub.
+ */
+ULONG WINAPI EtwRegisterTraceGuidsW( WMIDPREQUEST RequestAddress,
+                PVOID RequestContext, LPCGUID ControlGuid, ULONG GuidCount,
+                PTRACE_GUID_REGISTRATION TraceGuidReg, LPCWSTR MofImagePath,
+                LPCWSTR MofResourceName, PTRACEHANDLE RegistrationHandle )
+{
+    FIXME("(%p, %p, %s, %u, %p, %s, %s, %p): stub\n", RequestAddress, RequestContext,
+          debugstr_guid(ControlGuid), GuidCount, TraceGuidReg, debugstr_w(MofImagePath),
+          debugstr_w(MofResourceName), RegistrationHandle);
+
+    if (TraceGuidReg)
+    {
+        ULONG i;
+        for (i = 0; i < GuidCount; i++)
+        {
+            FIXME("  register trace class %s\n", debugstr_guid(TraceGuidReg[i].Guid));
+            TraceGuidReg[i].RegHandle = (HANDLE)0xdeadbeef;
+        }
+    }
+    *RegistrationHandle = (TRACEHANDLE)0xdeadbeef;
+    return ERROR_SUCCESS;
+}
+
+/*********************************************************************
+ *                  EtwRegisterTraceGuidsA   (NTDLL.@)
+ *
+ * See EtwRegisterTraceGuidsW.
+ *
+ * FIXME
+ *  Stub.
+ */
+ULONG WINAPI EtwRegisterTraceGuidsA( WMIDPREQUEST RequestAddress,
+                PVOID RequestContext, LPCGUID ControlGuid, ULONG GuidCount,
+                PTRACE_GUID_REGISTRATION TraceGuidReg, LPCSTR MofImagePath,
+                LPCSTR MofResourceName, PTRACEHANDLE RegistrationHandle )
+{
+    FIXME("(%p, %p, %s, %u, %p, %s, %s, %p): stub\n", RequestAddress, RequestContext,
+          debugstr_guid(ControlGuid), GuidCount, TraceGuidReg, debugstr_a(MofImagePath),
+          debugstr_a(MofResourceName), RegistrationHandle);
+    return ERROR_SUCCESS;
+}
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 4e49709..2b5c6cf 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -41,6 +41,8 @@
 # @ stub DbgUiStopDebugging
 @ stub DbgUiWaitStateChange
 @ stdcall DbgUserBreakPoint()
+@ stdcall EtwRegisterTraceGuidsA(ptr ptr ptr long ptr str str ptr)
+@ stdcall EtwRegisterTraceGuidsW(ptr ptr ptr long ptr wstr wstr ptr)
 # @ stub KiFastSystemCall
 # @ stub KiFastSystemCallRet
 # @ stub KiIntSystemCall
-- 
2.6.4

