[IOU] Add WPP tracing to IOU bus driver.
[mirror/winof/.git] / core / iou / kernel / iou_driver.c
index a062767..3586e27 100644 (file)
 \r
 #include <complib/cl_types.h>\r
 #include "iou_driver.h"\r
+#if defined(EVENT_TRACING)\r
+#ifdef offsetof\r
+#undef offsetof\r
+#endif\r
+#include "iou_driver.tmh"\r
+#endif\r
 #include "iou_pnp.h"\r
 #include <complib/cl_init.h>\r
 \r
 \r
 iou_globals_t  iou_globals = {\r
-       IOU_DBG_ERROR,\r
        NULL\r
 };\r
 \r
+uint32_t               g_iou_dbg_level = TRACE_LEVEL_ERROR;\r
+uint32_t               g_iou_dbg_flags = 0x00000fff;\r
 \r
 static NTSTATUS\r
 __read_registry(\r
@@ -106,7 +113,7 @@ __read_registry(
 {\r
        NTSTATUS                                        status;\r
        /* Remember the terminating entry in the table below. */\r
-       RTL_QUERY_REGISTRY_TABLE        table[2];\r
+       RTL_QUERY_REGISTRY_TABLE        table[3];\r
        UNICODE_STRING                          param_path;\r
 \r
        IOU_ENTER( IOU_DBG_DRV );\r
@@ -117,7 +124,7 @@ __read_registry(
        param_path.Buffer = cl_zalloc( param_path.MaximumLength );\r
        if( !param_path.Buffer )\r
        {\r
-               IOU_TRACE_EXIT( IOU_DBG_ERROR, \r
+               IOU_PRINT_EXIT( TRACE_LEVEL_ERROR,IOU_DBG_ERROR,\r
                        ("Failed to allocate parameters path buffer.\n") );\r
                return STATUS_INSUFFICIENT_RESOURCES;\r
        }\r
@@ -134,15 +141,24 @@ __read_registry(
        /* Setup the table entries. */\r
        table[0].Flags = RTL_QUERY_REGISTRY_DIRECT;\r
        table[0].Name = L"DebugFlags";\r
-       table[0].EntryContext = &iou_globals.dbg_lvl;\r
+       table[0].EntryContext = &g_iou_dbg_level;\r
        table[0].DefaultType = REG_DWORD;\r
-       table[0].DefaultData = &iou_globals.dbg_lvl;\r
+       table[0].DefaultData = &g_iou_dbg_level;\r
        table[0].DefaultLength = sizeof(ULONG);\r
 \r
+       table[1].Flags = RTL_QUERY_REGISTRY_DIRECT;\r
+       table[1].Name = L"DebugFlags";\r
+       table[1].EntryContext = &g_iou_dbg_flags;\r
+       table[1].DefaultType = REG_DWORD;\r
+       table[1].DefaultData = &g_iou_dbg_flags;\r
+       table[1].DefaultLength = sizeof(ULONG);\r
        /* Have at it! */\r
-       status = RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE, \r
+       status = RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE,\r
                param_path.Buffer, table, NULL, NULL );\r
 \r
+       if( g_iou_dbg_flags & IOU_DBG_ERR )\r
+               g_iou_dbg_flags |= CL_DBG_ERROR;\r
+\r
        cl_free( param_path.Buffer );\r
        IOU_EXIT( IOU_DBG_DRV );\r
        return status;\r
@@ -185,6 +201,9 @@ iou_unload(
        IN                              DRIVER_OBJECT                           *p_driver_obj )\r
 {\r
        IOU_ENTER( IOU_DBG_DRV );\r
+#if defined(EVENT_TRACING)\r
+       WPP_CLEANUP( p_drv_obj );\r
+#endif\r
 \r
        UNUSED_PARAM( p_driver_obj );\r
 \r
@@ -203,10 +222,14 @@ DriverEntry(
 \r
        IOU_ENTER( IOU_DBG_DRV );\r
 \r
+#if defined(EVENT_TRACING)\r
+       WPP_INIT_TRACING( p_drv_obj, p_registry_path );\r
+#endif\r
+\r
        status = CL_INIT;\r
        if( !NT_SUCCESS(status) )\r
        {\r
-               IOU_TRACE_EXIT( IOU_DBG_ERROR,\r
+               IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
                        ("cl_init returned %08X.\n", status) );\r
                return status;\r
        }\r
@@ -219,7 +242,7 @@ DriverEntry(
        if( !NT_SUCCESS(status) )\r
        {\r
                CL_DEINIT;\r
-               IOU_TRACE_EXIT( IOU_DBG_ERROR, \r
+               IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR,\r
                        ("__read_registry returned %08x.\n", status) );\r
                return status;\r
        }\r