_Must_inspect_result_
NTSTATUS
FxTraceInitialize(
    VOID
)

/*++

Routine Description:

    This routine initializes the frameworks tracing.

    It must be called early on in the frameworks DriverEntry
    initialization.

Arguments:

    None

Returns:

    NTSTATUS code

--*/
{
    //
    // Initialize the tracing package.
    //
    WPP_INIT_TRACING(NULL, NULL);

    return STATUS_SUCCESS;
}
NTSTATUS DriverEntry(IN PDRIVER_OBJECT  DriverObject,
                     IN PUNICODE_STRING RegistryPath)
{
    NTSTATUS               status = STATUS_SUCCESS;
    WDF_DRIVER_CONFIG      config;
    WDF_OBJECT_ATTRIBUTES  attributes;

    WPP_INIT_TRACING(DriverObject, RegistryPath);

    TraceEvents(TRACE_LEVEL_INFORMATION, DBG_INIT,
        "Virtio-Serial driver started...built on %s %s\n", __DATE__, __TIME__);

    WDF_DRIVER_CONFIG_INIT(&config,VIOSerialEvtDeviceAdd);
    config.DriverPoolTag  = VIOSERIAL_DRIVER_MEMORY_TAG;

    WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
    attributes.EvtCleanupCallback = VIOSerialEvtDriverContextCleanup;

    status = WdfDriverCreate(DriverObject,
                             RegistryPath,
                             &attributes,
                             &config,
                             WDF_NO_HANDLE);

    if (!NT_SUCCESS(status)) {
        TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT,
           "WdfDriverCreate failed - 0x%x\n", status);
        WPP_CLEANUP(DriverObject);
        return status;
    }

    TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "<-- %s\n", __FUNCTION__);
    return status;
}
BOOL WINAPI
DllMain(
    HINSTANCE ModuleHandle,
    DWORD Reason,
    PVOID Reserved
    )
{
    UNREFERENCED_PARAMETER(ModuleHandle);
    UNREFERENCED_PARAMETER(Reserved);

    if (DLL_PROCESS_ATTACH == Reason) {
#ifndef WPP_MACRO_USE_KM_VERSION_FOR_UM
        WPP_INIT_TRACING(NFCCX_TRACING_ID);
#endif
        EventRegisterMicrosoft_Windows_NFC_ClassExtension();
        TraceLoggingRegister(g_hNfcCxProvider);
    }
    else if (DLL_PROCESS_DETACH == Reason) {
#ifndef WPP_MACRO_USE_KM_VERSION_FOR_UM
        WPP_CLEANUP();
#endif
        EventUnregisterMicrosoft_Windows_NFC_ClassExtension();
        TraceLoggingUnregister(g_hNfcCxProvider);
    }

    return TRUE;
}
//Installable driver initialization entry point. This entry point is called directly by the I/O system.
//
NTSTATUS DriverEntry (_In_ PDRIVER_OBJECT pDriverObject, _In_ PUNICODE_STRING pszRegistryPath)
{
    NTSTATUS               status = STATUS_SUCCESS;
    WDF_DRIVER_CONFIG      config;
    WDF_OBJECT_ATTRIBUTES  attributes;


    // Initialize WPP Tracing
    WPP_INIT_TRACING(pDriverObject, pszRegistryPath);

    TraceInfo(DBG_INIT, "(%!FUNC!) Enter -Sample Built %s %s\n", __DATE__, __TIME__);

    WDF_DRIVER_CONFIG_INIT(&config, HidFx2EvtDeviceAdd);

    // Register a cleanup callback so that we can call WPP_CLEANUP when  the framework driver object is deleted during driver unload.
    WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
    attributes.EvtCleanupCallback = HidFx2EvtDriverContextCleanup;

    // Create a framework driver object to represent our driver.
    status = WdfDriverCreate(pDriverObject,
                             pszRegistryPath,
                             &attributes,      // Driver Attributes
                             &config,          // Driver Config Info
                             WDF_NO_HANDLE
                            );
    if (!NT_SUCCESS(status)) 
    {
        TraceErr(DBG_INIT, "(%!FUNC!)WdfDriverCreate failed with status %!STATUS!\n", status);
        WPP_CLEANUP(pDriverObject);
    }

    TraceVerbose(DBG_INIT, "(%!FUNC!) Exit\n");
    return status;
}
NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject,
    IN PUNICODE_STRING RegistryPath)
{
    NTSTATUS status;
    WDF_DRIVER_CONFIG config;
    WDF_OBJECT_ATTRIBUTES attributes;

    // Initialize the WPP tracing.
    WPP_INIT_TRACING(DriverObject, RegistryPath);

    Trace(TRACE_LEVEL_VERBOSE, "[%s] -->", __FUNCTION__);

    // Register a cleanup callback so that we can call WPP_CLEANUP when
    // the framework driver object is deleted during driver unload.
    WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
    attributes.EvtCleanupCallback = VioCryptDriverContextCleanup;

    WDF_DRIVER_CONFIG_INIT(&config, VioCryptDeviceAdd);

    status = WdfDriverCreate(DriverObject, RegistryPath, &attributes,
        &config, WDF_NO_HANDLE);

    if (!NT_SUCCESS(status))
    {
        Trace(TRACE_LEVEL_ERROR, "[%s] WdfDriverCreate failed: status %X", __FUNCTION__, status);
        WPP_CLEANUP(DriverObject);
    }

    Trace(TRACE_LEVEL_VERBOSE, "[%s] -->", __FUNCTION__);

    return status;
}
NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject,
                     IN PUNICODE_STRING RegistryPath)
{
    NTSTATUS status;
    WDF_DRIVER_CONFIG config;
    WDF_OBJECT_ATTRIBUTES attributes;

    // Initialize WPP tracing.
    WPP_INIT_TRACING(DriverObject, RegistryPath);

    TraceEvents(TRACE_LEVEL_VERBOSE, DBG_INIT, "--> %!FUNC!");

    // Register a cleanup callback so that we can call WPP_CLEANUP when
    // the framework driver object is deleted during driver unload.
    WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
    attributes.EvtCleanupCallback = PVPanicEvtDriverContextCleanup;

    WDF_DRIVER_CONFIG_INIT(&config, PVPanicEvtDeviceAdd);

    status = WdfDriverCreate(DriverObject, RegistryPath, &attributes,
        &config, WDF_NO_HANDLE);

    if (!NT_SUCCESS(status))
    {
        TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT,
            "WdfDriverCreate failed: %!STATUS!", status);
        WPP_CLEANUP(DriverObject);
    }
    else
    {
        TraceEvents(TRACE_LEVEL_VERBOSE, DBG_INIT, "<-- %!FUNC!");
    }

    return status;
}
Exemple #7
0
/////////////////////////////////////////////////////////////////////////
//
// DllMain
//
// This is the main DLL Entry Point.
//
// Parameters:
//      hInstance  - Handle to the DLL module
//      dwReason   - Indicates why the DLL entry point is being called
//      lpReserved - Additional information based on dwReason
//
// Return Values:
//      TRUE  = initialization succeeds
//      FALSE = initialization fails
//
/////////////////////////////////////////////////////////////////////////
extern "C" BOOL WINAPI DllMain(HINSTANCE    hInstance,
                               DWORD        dwReason,
                               LPVOID       lpReserved)
{
    (lpReserved);

    switch (dwReason)
    {
        case DLL_PROCESS_ATTACH:
            // Initialize tracing
            WPP_INIT_TRACING(MYDRIVER_TRACING_ID);
            DisableThreadLibraryCalls(hInstance);
            break;

        case DLL_PROCESS_DETACH:
            // Cleanup tracing.
            WPP_CLEANUP();
            _AtlModule.Term();
            break;

        default:
            break;
    }

    // Call the ATL module class so it can initialize
    return _AtlModule.DllMain(dwReason, lpReserved); 
}
VOID                                                                                                                         
ImScsiTracingInit(                                                                                                            
              __in PVOID pArg1,                                                                                  
              __in PVOID pArg2
             )                                                                                                            
{                                                                                                                            
    WPP_INIT_TRACING(pArg1, pArg2);
}                                                     // End ImScsiTracingInit().
NTSTATUS DriverEntry(IN PDRIVER_OBJECT  DriverObject,
                     IN PUNICODE_STRING RegistryPath)
{
    NTSTATUS               status = STATUS_SUCCESS;
    WDF_DRIVER_CONFIG      config;
    WDF_OBJECT_ATTRIBUTES  attributes;
    WDFDRIVER              Driver;
    PDRIVER_CONTEXT        Context;

#if (NTDDI_VERSION > NTDDI_WIN7)
    ExInitializeDriverRuntime(DrvRtPoolNxOptIn);
#endif
    WPP_INIT_TRACING(DriverObject, RegistryPath);

    TraceEvents(TRACE_LEVEL_INFORMATION, DBG_INIT,
        "Virtio-Serial driver started...built on %s %s\n", __DATE__, __TIME__);

    WDF_DRIVER_CONFIG_INIT(&config,VIOSerialEvtDeviceAdd);
    config.DriverPoolTag  = VIOSERIAL_DRIVER_MEMORY_TAG;

    WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, DRIVER_CONTEXT);
    attributes.EvtCleanupCallback = VIOSerialEvtDriverContextCleanup;

    status = WdfDriverCreate(DriverObject,
                             RegistryPath,
                             &attributes,
                             &config,
                             &Driver);

    if (!NT_SUCCESS(status)) {
        TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT,
           "WdfDriverCreate failed - 0x%x\n", status);
        WPP_CLEANUP(DriverObject);
        return status;
    }

    Context = GetDriverContext(Driver);

    // create a lookaside list used for allocating WRITE_BUFFER_ENTRY
    // structures by all devices
    status = WdfLookasideListCreate(WDF_NO_OBJECT_ATTRIBUTES,
                                    sizeof(WRITE_BUFFER_ENTRY),
                                    NonPagedPool,
                                    WDF_NO_OBJECT_ATTRIBUTES,
                                    VIOSERIAL_DRIVER_MEMORY_TAG,
                                    &Context->WriteBufferLookaside);
    if (!NT_SUCCESS(status))
    {
        TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT,
            "WdfLookasideListCreate failed - 0x%x\n", status);
        return status;
    }

    TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "<-- %s\n", __FUNCTION__);
    return status;
}
int __cdecl _tmain(int argc, TCHAR** argv)
{
	WPP_INIT_TRACING(_T("ndasportcmd"));

	int ret = Run(argc, argv);

	WPP_CLEANUP();

	return ret;
}
Exemple #11
0
NTSTATUS
#pragma prefast(suppress:__WARNING_DRIVER_FUNCTION_TYPE, "thanks, i know this already")
DriverEntry(
    _In_ PDRIVER_OBJECT  DriverObject,
    _In_ PUNICODE_STRING RegistryPath
    )
{
    /*WDF_DRIVER_CONFIG_INIT(&driverConfig, OnDeviceAdd);*/
	NTSTATUS               status = STATUS_SUCCESS;
	WDF_DRIVER_CONFIG      driverConfig;
	WDF_OBJECT_ATTRIBUTES  driverAttributes;
	WDFDRIVER fxDriver;

	WPP_INIT_TRACING(DriverObject, RegistryPath);

	FuncEntry(TRACE_FLAG_WDFLOADING);

	WDF_DRIVER_CONFIG_INIT(&driverConfig, OnDeviceAdd);
	driverConfig.DriverPoolTag = SPBT_POOL_TAG;

	WDF_OBJECT_ATTRIBUTES_INIT(&driverAttributes);
	driverAttributes.EvtCleanupCallback = OnDriverCleanup;

	//
	// Create a framework driver object to represent our driver.
	//

	status = WdfDriverCreate(DriverObject,
		RegistryPath,
		&driverAttributes,
		&driverConfig,
		&fxDriver
		);

	if (!NT_SUCCESS(status))
	{
		Trace(
			TRACE_LEVEL_ERROR,
			TRACE_FLAG_WDFLOADING,
			"Error creating WDF driver object - %!STATUS!",
			status);
		goto exit;
	}

	Trace(
		TRACE_LEVEL_VERBOSE,
		TRACE_FLAG_WDFLOADING,
		"Created WDF driver object");

exit:

	FuncExit(TRACE_FLAG_WDFLOADING);

	return status;
}
BOOL
WINAPI
DllMain(
    HINSTANCE ModuleHandle,
    DWORD Reason,
    PVOID Reserved
   )
/*++

  Routine Description:

    This is the entry point and exit point for the I/O trace driver.  This 
    does very little as the I/O trace driver has minimal global data.

    This method initializes tracing.

  Arguments:

    ModuleHandle - the DLL handle for this module.

    Reason - the reason this entry point was called.

    Reserved - unused

  Return Value:

    TRUE

--*/
{

    UNREFERENCED_PARAMETER( ModuleHandle );

    if (DLL_PROCESS_ATTACH == Reason)
    {
        //
        // Initialize tracing.
        //

        WPP_INIT_TRACING(MYDRIVER_TRACING_ID);

    }
    else if (DLL_PROCESS_DETACH == Reason)
    {
        //
        // Cleanup tracing.
        //

        WPP_CLEANUP();
    }

    return _AtlModule.DllMain(Reason, Reserved); 
;
}
BOOL
WINAPI
DllMain(
    HINSTANCE ModuleHandle,
    DWORD Reason,
    PVOID /* Reserved */
   )
/*++

  Routine Description:

    This is the entry point and exit point for the I/O trace driver.  This 
    does very little as the I/O trace driver has minimal global data.

    This method initializes tracing, and saves the module handle away in a 
    global variable so that it can be referenced should the COM registration
    code (Dll[Un]RegisterServer) be called.

  Arguments:

    ModuleHandle - the DLL handle for this module.

    Reason - the reason this entry point was called.

    Reserved - unused

  Return Value:

    TRUE

--*/
{
    UNREFERENCED_PARAMETER(ModuleHandle);
    
    if (DLL_PROCESS_ATTACH == Reason)
    {
        //
        // Initialize tracing.
        //

        WPP_INIT_TRACING(MYDRIVER_TRACING_ID);
    }
    else if (DLL_PROCESS_DETACH == Reason)
    {
        //
        // Cleanup tracing.
        //

        WPP_CLEANUP();
    }

    return TRUE;
}
Exemple #14
0
_Use_decl_annotations_
NTSTATUS DriverEntry (
    DRIVER_OBJECT* DriverObjectPtr,
    UNICODE_STRING* RegistryPathPtr
    )
{
    PAGED_CODE();

    //
    // Initialize logging
    //
    {
        WPP_INIT_TRACING(DriverObjectPtr, RegistryPathPtr);
        RECORDER_CONFIGURE_PARAMS recorderConfigureParams;
        RECORDER_CONFIGURE_PARAMS_INIT(&recorderConfigureParams);
        WppRecorderConfigure(&recorderConfigureParams);
#if DBG
        WPP_RECORDER_LEVEL_FILTER(BSC_TRACING_VERBOSE) = TRUE;
#endif // DBG
    }

    NTSTATUS status;

    WDFDRIVER wdfDriver;
    {
        WDF_DRIVER_CONFIG wdfDriverConfig;
        WDF_DRIVER_CONFIG_INIT(&wdfDriverConfig, OnDeviceAdd);
        wdfDriverConfig.DriverPoolTag = BCM_I2C_POOL_TAG;
        wdfDriverConfig.EvtDriverUnload = OnDriverUnload;

        status = WdfDriverCreate(
                DriverObjectPtr,
                RegistryPathPtr,
                WDF_NO_OBJECT_ATTRIBUTES,
                &wdfDriverConfig,
                &wdfDriver);
        if (!NT_SUCCESS(status)) {
            BSC_LOG_ERROR(
                "Failed to create WDF driver object. (DriverObjectPtr = %p, RegistryPathPtr = %p)",
                DriverObjectPtr,
                RegistryPathPtr);
            return status;
        }
    }

    NT_ASSERT(NT_SUCCESS(status));
    return STATUS_SUCCESS;
}
Exemple #15
0
NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
{
	NTSTATUS Status;
	WDF_DRIVER_CONFIG Config;

	WPP_INIT_TRACING(DriverObject, RegistryPath);

	UsbChief_DbgPrint(DEBUG_CONFIG, ("starting\n"));
	WDF_DRIVER_CONFIG_INIT(&Config, UsbChief_EvtDeviceAdd);
	Status = WdfDriverCreate(DriverObject, RegistryPath,
		WDF_NO_OBJECT_ATTRIBUTES, &Config, WDF_NO_HANDLE);
	if (!NT_SUCCESS(Status)) {
		UsbChief_DbgPrint(0, ("WdfDriverCreate failed: 0x%08x\n", Status));
		return Status;
	}
	return STATUS_SUCCESS;
}
Exemple #16
0
NTSTATUS
DriverEntry(
    IN PDRIVER_OBJECT  DriverObject,
    IN PUNICODE_STRING RegistryPath
    )
{
    WDF_DRIVER_CONFIG       config;
    NTSTATUS                status;
    WDF_OBJECT_ATTRIBUTES   attributes;

    WPP_INIT_TRACING( DriverObject, RegistryPath );

    KdPrint(("DriverEntry of Step5\n"));

    WDF_DRIVER_CONFIG_INIT(&config, EvtDeviceAdd);

    //
    // Register a cleanup callback so that we can call WPP_CLEANUP when
    // the framework driver object is deleted during driver unload.
    //
    WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
    attributes.EvtCleanupCallback = EvtDriverContextCleanup;

    status = WdfDriverCreate(DriverObject,
                        RegistryPath,
                        &attributes,
                        &config,
                        WDF_NO_HANDLE
                        );

    if (!NT_SUCCESS(status)) {
        KdPrint(("WdfDriverCreate failed %!STATUS!\n", status));
        //
        // Cleanup tracing here because DriverContextCleanup will not be called
        // as we have failed to create WDFDRIVER object itself.
        // Please note that if your return failure from DriverEntry after the
        // WDFDRIVER object is created successfully, you don't have to
        // call WPP cleanup because in those cases DriverContextCleanup
        // will be executed when the framework deletes the DriverObject.
        //
        WPP_CLEANUP(DriverObject);
    }

    return status;
}
//------------------------------------------------------------------------------
// Function: DriverEntry
//
// This routine is the driver initialization entry point.
//
// Arguments:
//      DriverObject: IN: Pointer to the driver object created by the I/O manager
//      RegistryPath: IN: Pointer to the driver specific registry key
//
// Return Value:
//      NTSTATUS code
//------------------------------------------------------------------------------
NTSTATUS
DriverEntry(
    _In_  PDRIVER_OBJECT  DriverObject,
    _In_  PUNICODE_STRING RegistryPath
    )
{
    WDF_DRIVER_CONFIG DriverConfig;
    NTSTATUS Status = STATUS_SUCCESS;

    //
    // Initialize WPP Tracing
    //
    WPP_INIT_TRACING(DriverObject, NULL);

    SENSOR_FunctionEnter();

    DriverConfig.DriverPoolTag = SENSORV2_POOL_TAG_COMBO;

    //
    // Initialize the driver configuration structure.
    //
    WDF_DRIVER_CONFIG_INIT(&DriverConfig, OnDeviceAdd);
    DriverConfig.EvtDriverUnload = OnDriverUnload;

    //
    // Create a framework driver object to represent our driver.
    //
    Status = WdfDriverCreate(DriverObject,
                             RegistryPath,
                             WDF_NO_OBJECT_ATTRIBUTES,
                             &DriverConfig,
                             WDF_NO_HANDLE);

    if (!NT_SUCCESS(Status))
    {
        TraceError("COMBO %!FUNC! WdfDriverCreate failed: %!STATUS!", Status);
        goto Exit;
    }

Exit:
    SENSOR_FunctionExit(Status);

    return Status;
}
void ParaNdis_DebugInitialize(PVOID DriverObject,PVOID RegistryPath)
{
	NDIS_STRING usRegister, usDeregister, usPrint;
	PVOID pr, pd;
	BOOLEAN res;
	WPP_INIT_TRACING(DriverObject, RegistryPath);

	NdisAllocateSpinLock(&CrashLock);
	KeInitializeCallbackRecord(&CallbackRecord);
	ParaNdis_PrepareBugCheckData();
	NdisInitUnicodeString(&usPrint, L"vDbgPrintEx");
	NdisInitUnicodeString(&usRegister, L"KeRegisterBugCheckReasonCallback");
	NdisInitUnicodeString(&usDeregister, L"KeDeregisterBugCheckReasonCallback");
	pd = MmGetSystemRoutineAddress(&usPrint);
	if (pd) PrintProcedure = (vDbgPrintExType)pd;
	pr = MmGetSystemRoutineAddress(&usRegister);
	pd = MmGetSystemRoutineAddress(&usDeregister);
	if (pr && pd)
	{
		BugCheckRegisterCallback = (KeRegisterBugCheckReasonCallbackType)pr;
		BugCheckDeregisterCallback = (KeDeregisterBugCheckReasonCallbackType)pd;
	}
	res = BugCheckRegisterCallback(&CallbackRecord, ParaNdis_OnBugCheck, KbCallbackSecondaryDumpData, "NetKvm");
	DPrintf(0, ("[%s] Crash callback %sregistered", __FUNCTION__, res ? "" : "NOT "));

#ifdef OVERRIDE_DEBUG_BREAK
	if (sizeof(PVOID) == sizeof(ULONG))
	{
		UCHAR replace[5] = {0xe9,0,0,0,0};
		ULONG replacement;
		NDIS_STRING usDbgBreakPointName;
		NdisInitUnicodeString(&usDbgBreakPointName, L"DbgBreakPoint");
		pDbgBreakPoint = (PUCHAR)MmGetSystemRoutineAddress(&usDbgBreakPointName);
		if (pDbgBreakPoint)
		{
			DPrintf(0, ("Replacing original BP handler at %p", pDbgBreakPoint));
			replacement = RtlPointerToOffset(pDbgBreakPoint + 5, AnotherDbgBreak);
			RtlCopyMemory(replace + 1, &replacement, sizeof(replacement));
			RtlCopyMemory(DbgBreakPointChunk, pDbgBreakPoint, sizeof(DbgBreakPointChunk));
			RtlCopyMemory(pDbgBreakPoint, replace, sizeof(replace));
		}
	}
#endif
}
Exemple #19
0
BOOL
WINAPI
DllMain(
    HINSTANCE hInstance,
    DWORD dwReason,
    LPVOID lpReserved
    )
{
    if (dwReason == DLL_PROCESS_ATTACH) {
        WPP_INIT_TRACING(MYDRIVER_TRACING_ID);
        
        g_hInstance = hInstance;
        DisableThreadLibraryCalls(hInstance);

    } else if (dwReason == DLL_PROCESS_DETACH) {
        WPP_CLEANUP();
    }

    return _AtlModule.DllMain(dwReason, lpReserved);
}
NTSTATUS
DriverEntry(
    IN PDRIVER_OBJECT  DriverObject,
    IN PUNICODE_STRING RegistryPath)
{
    NTSTATUS              status = STATUS_SUCCESS;
    WDF_DRIVER_CONFIG     config;
    WDF_OBJECT_ATTRIBUTES attributes;
    WDFDRIVER             driver;

#if (NTDDI_VERSION > NTDDI_WIN7)
    ExInitializeDriverRuntime(DrvRtPoolNxOptIn);
#endif
    WPP_INIT_TRACING(DriverObject, RegistryPath);

    TraceEvents(TRACE_LEVEL_INFORMATION, DBG_INIT,
        "Virtio-input driver started...built on %s %s\n", __DATE__, __TIME__);

    WDF_DRIVER_CONFIG_INIT(&config,VIOInputEvtDeviceAdd);
    config.DriverPoolTag  = VIOINPUT_DRIVER_MEMORY_TAG;

    WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
    attributes.EvtCleanupCallback = VIOInputEvtDriverContextCleanup;

    status = WdfDriverCreate(DriverObject,
                             RegistryPath,
                             &attributes,
                             &config,
                             &driver);

    if (!NT_SUCCESS(status))
    {
        TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT,
           "WdfDriverCreate failed - 0x%x\n", status);
        WPP_CLEANUP(DriverObject);
        return status;
    }

    TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "<-- %s\n", __FUNCTION__);
    return status;
}
NTSTATUS DriverEntry(IN PDRIVER_OBJECT  DriverObject,IN PUNICODE_STRING RegistryPath) {
	NTSTATUS				status;
	WDF_DRIVER_CONFIG		config;
    WDF_OBJECT_ATTRIBUTES	attributes;
	
#if defined(_DEBUG) || defined(DBG)
//	if (TRUE == KdRefreshDebuggerNotPresent())
//		return STATUS_UNSUCCESSFUL;// For the time being, don't load the driver if no debugger is attached
//	DbgBreakPoint();
	if (FALSE == KdRefreshDebuggerNotPresent())
		DbgBreakPoint();
#endif
	
    // Initialize WPP Tracing
    WPP_INIT_TRACING( DriverObject, RegistryPath );
	WPP_FLAG_LEVEL_ENABLED(MYDRIVER_ALL_INFO, TRACE_LEVEL_VERBOSE);

	TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_DRIVER, "UsbCfgCtrl>> DriverEntry " __DATE__ " " __TIME__ "\r\n");

    // Register a cleanup callback so that we can call WPP_CLEANUP when the framework driver object is deleted during driver unload.
    WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
	attributes.EvtCleanupCallback = [](IN WDFOBJECT DriverObject) {
		TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_DRIVER, "%!FUNC! Entry");
		// Stop WPP Tracing
		WPP_CLEANUP(WdfDriverWdmGetDriverObject((WDFDRIVER)DriverObject));
	};

	WDF_DRIVER_CONFIG_INIT(&config, UsbCfgDevice::CreateDevice);// UsbCfgCtrlEvtDeviceAdd);

    status = WdfDriverCreate(DriverObject, RegistryPath, &attributes, &config, WDF_NO_HANDLE);
    if (NT_FAILED(status)) {
        TraceEvents(TRACE_LEVEL_ERROR, TRACE_DRIVER, "WdfDriverCreate failed %!STATUS!\r\n", status);
        WPP_CLEANUP(DriverObject);
        return status;
    }

    TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_DRIVER, "%!FUNC! Exit\r\n");

    return status;
}
// This routine is the driver initialization entry point.
NTSTATUS
DriverEntry(
    _In_  PDRIVER_OBJECT  DriverObject, // Pointer to the driver object created by the I/O manager
    _In_  PUNICODE_STRING RegistryPath // Pointer to the driver specific registry key
    )
{
    WDF_DRIVER_CONFIG DriverConfig;
    NTSTATUS Status = STATUS_SUCCESS;

    // Initialize WPP Tracing
    WPP_INIT_TRACING(DriverObject, NULL);

    SENSOR_FunctionEnter();

    DriverConfig.DriverPoolTag = SENSOR_POOL_TAG_PEDOMETER;

    // Initialize the driver configuration structure.
    WDF_DRIVER_CONFIG_INIT(&DriverConfig, PedometerDevice::OnDeviceAdd);
    DriverConfig.EvtDriverUnload = OnDriverUnload;

    // Create a framework driver object to represent our driver.
    Status = WdfDriverCreate(DriverObject,
                             RegistryPath,
                             WDF_NO_OBJECT_ATTRIBUTES,
                             &DriverConfig,
                             WDF_NO_HANDLE);

    if (!NT_SUCCESS(Status))
    {
        TraceError("PED %!FUNC! WdfDriverCreate failed: %!STATUS!", Status);
        goto Exit;
    }

Exit:
    SENSOR_FunctionExit(Status);
    
    return Status;
}
// DLL Entry Point
extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
    hInstance;

    if(dwReason == DLL_PROCESS_ATTACH)
    {
        //
        // Initialize tracing.
        //

        WPP_INIT_TRACING(MYDRIVER_TRACING_ID);
    }
    else if(dwReason == DLL_PROCESS_DETACH)
    {
        //
        // Cleanup tracing.
        //

        WPP_CLEANUP();
    }
    
    return _AtlModule.DllMain(dwReason, lpReserved); 
}
NTSTATUS DriverEntry(
                      IN PDRIVER_OBJECT   DriverObject,
                      IN PUNICODE_STRING  RegistryPath
                      )
{
    WDF_DRIVER_CONFIG      config;
    NTSTATUS               status;
    WDFDRIVER              driver;
    WDF_OBJECT_ATTRIBUTES  attrib;

    WPP_INIT_TRACING( DriverObject, RegistryPath );

    TraceEvents(TRACE_LEVEL_WARNING, DBG_HW_ACCESS, "Balloon driver, built on %s %s\n",
            __DATE__, __TIME__);

    WDF_OBJECT_ATTRIBUTES_INIT(&attrib);
    attrib.EvtCleanupCallback = EvtDriverContextCleanup;

    WDF_DRIVER_CONFIG_INIT(&config, BalloonDeviceAdd);

    status =  WdfDriverCreate(
                      DriverObject,
                      RegistryPath,
                      &attrib,
                      &config,
                      &driver);
    if(!NT_SUCCESS(status))
    {
        TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,"WdfDriverCreate failed with status 0x%08x\n", status);
        WPP_CLEANUP(DriverObject);
        return status;
    }

    TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP,"<-- %s\n", __FUNCTION__);

    return status;
}
Exemple #25
0
NTSTATUS
DriverEntry(
    _In_ PDRIVER_OBJECT  DriverObject,
    _In_ PUNICODE_STRING RegistryPath
    )
/*++

Routine Description:

    Driver initialization entry point. This entry point is called directly by 
    the I/O system.

Arguments:

    DriverObject - pointer to the driver object

    RegistryPath - pointer to a unicode string representing the path to the 
                   driver-specific key in the registry.

Return Value:

    An NTSTATUS value representing success or failure of the function.
    
--*/
{
    NTSTATUS            status = STATUS_SUCCESS;
    WDF_DRIVER_CONFIG   config;
    WDF_OBJECT_ATTRIBUTES attributes;

    WPP_INIT_TRACING(RegistryPath->Buffer);

    //
    // Initiialize driver config to control the attributes that are global to
    // the driver. Note that framework by default provides a driver unload 
    // routine. If DriverEntry creates any resources that require clean-up in
    // driver unload, you can manually override the default by supplying a 
    // pointer to the EvtDriverUnload callback in the config structure. In 
    // general xxx_CONFIG_INIT macros are provided to initialize most commonly
    // used members.
    //
    WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
    attributes.EvtCleanupCallback = SingleCompEvtDriverCleanup;
    WDF_DRIVER_CONFIG_INIT(
        &config,
        SingleCompEvtDeviceAdd
        );

    //
    // Create a framework driver object to represent our driver.
    //
    status = WdfDriverCreate(DriverObject,
                             RegistryPath,
                             &attributes, // Driver Attributes
                             &config,     // Driver Config Info
                             WDF_NO_HANDLE
                             );

    if (FALSE == NT_SUCCESS(status)) {
        KdPrint( ("WdfDriverCreate failed with status 0x%x\n", status));
        WPP_CLEANUP();
    }

    return status;
}
Exemple #26
0
NTSTATUS
DriverEntry(
    _In_    PDRIVER_OBJECT        DriverObject,
    _In_    PUNICODE_STRING       RegistryPath
    )
{
    NDIS_STATUS                 Status = NDIS_STATUS_FAILURE;
    NDIS_MINIPORT_DRIVER_CHARACTERISTICS    MChars;
    ULONG                       ndisVersion;

    if (FailDriverEntry)
    {
        DbgPrint("FAILING DRIVER ENTRY\n");
        return NDIS_STATUS_FAILURE;
    }

    #if DOT11_TRACE_ENABLED
        WPP_INIT_TRACING(DriverObject, RegistryPath);
    #endif

    MpTrace(COMP_INIT_PNP, DBG_SERIOUS, (__DATE__ " " __TIME__ " DriverEntry called!\n"));

    do
    {
        //
        // Identify the appropriate read/write lock API
        //
        Status = MpDetermineRWLockType();
        if (Status != NDIS_STATUS_SUCCESS)
        {
            MpTrace(COMP_INIT_PNP, DBG_SERIOUS, ("Failed to determine type of read/write lock to use. Status = 0x%x\n", Status));
            break;
        }
    
        NdisZeroMemory(&MChars, sizeof(NDIS_MINIPORT_DRIVER_CHARACTERISTICS));

        //
        // Set the type and version of this structure. We select the appropriate version &
        // driver functionality based on NDIS version.
        //
        ndisVersion = NdisGetVersion();
        if (ndisVersion <= MP_NDIS_VERSION_NEEDS_COMPATIBILITY)
        {
            // NDIS Version 6.0
            MChars.Header.Type      = NDIS_OBJECT_TYPE_MINIPORT_DRIVER_CHARACTERISTICS;
            MChars.Header.Size      = NDIS_SIZEOF_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_1;
            MChars.Header.Revision  = NDIS_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_1;
            
            MChars.MajorNdisVersion = MP_MAJOR_NDIS_VERSION;
            MChars.MinorNdisVersion = 0;
        }
        else
        {
            // NDIS Version 6.2
            MChars.Header.Type      = NDIS_OBJECT_TYPE_MINIPORT_DRIVER_CHARACTERISTICS;
            MChars.Header.Size      = NDIS_SIZEOF_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_2;
            MChars.Header.Revision  = NDIS_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_2;
            
            MChars.MajorNdisVersion = MP_MAJOR_NDIS_VERSION;
            MChars.MinorNdisVersion = MP_MINOR_NDIS_VERSION;
        }
        
        MChars.MajorDriverVersion = HW11_MAJOR_DRIVER_VERSION;
        MChars.MinorDriverVersion = HW11_MINOR_DRIVER_VERSION;

        //
        // Init/PnP handlers
        //
        MChars.InitializeHandlerEx      = MPInitialize;
        MChars.RestartHandler           = MPRestart;
        MChars.PauseHandler             = MPPause;
        MChars.ShutdownHandlerEx        = MPAdapterShutdown;
        MChars.DevicePnPEventNotifyHandler  = MPDevicePnPEvent;
        MChars.HaltHandlerEx            = MPHalt;
        MChars.UnloadHandler            = DriverUnload;
        
        //
        // Query/Set/Method requests handlers
        //
        MChars.OidRequestHandler        = MPOidRequest;
        MChars.CancelOidRequestHandler  = MPCancelOidRequest;

        //
        // Set optional miniport services handler
        //
        MChars.SetOptionsHandler        = MPSetOptions;
        
        //
        // Send/Receive handlers
        //
        MChars.SendNetBufferListsHandler    = MPSendNetBufferLists;
        MChars.CancelSendHandler            = MPCancelSendNetBufferLists;
        MChars.ReturnNetBufferListsHandler  = MPReturnNetBufferLists;
        
        //
        // Fault handling handlers
        //
        MChars.CheckForHangHandlerEx        = MPCheckForHang;
        MChars.ResetHandlerEx               = MPReset;

        //
        // Direct OID request handlers
        //
        MChars.DirectOidRequestHandler          = MPDirectOidRequest;
        MChars.CancelDirectOidRequestHandler    = MPCancelDirectOidRequest;
        
        //
        // Register the miniport driver with NDIS
        //
        Status = NdisMRegisterMiniportDriver(
                    DriverObject,
                    RegistryPath,
                    GlobalDriverContext,
                    &MChars,
                    &GlobalDriverHandle
                    );
        if (Status != NDIS_STATUS_SUCCESS)
        {
            MpTrace(COMP_INIT_PNP, DBG_SERIOUS, ("Failed to register miniport with NDIS. Status = 0x%x\n", Status));
            break;
        }

#if DBG
#if !DOT11_TRACE_ENABLED
        //
        // Read debug mask from registry
        //
        MpReadGlobalDebugMask(GlobalDriverHandle);
#endif
#endif

    }
    while (FALSE);
    
    if (Status != NDIS_STATUS_SUCCESS)
    {
        #if DOT11_TRACE_ENABLED
            WPP_CLEANUP(DriverObject);
        #endif
    }

    return(Status);
}
Exemple #27
0
int APIENTRY wWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPWSTR    lpCmdLine,
                     int       nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

	MSG msg = {};
	HACCEL hAccelTable = NULL;

	auto result = function_contract_hresult(
		[&] () -> unique_hresult
		{
			WPP_INIT_TRACING(SCANNER_TRACING_ID);
			ON_UNWIND_AUTO([&]{
				WPP_CLEANUP();
			});

			TRACE_SCOPE("commandline: %ls", lpCmdLine);

			unique_winerror winerror;
			unique_hresult hr;

			hr.reset(CoInitialize(NULL)).throw_if();
			ON_UNWIND_AUTO([&]{CoUninitialize();});

			std::wstring title;
			std::wstring className;
			lib::wr::unique_close_window window;

#if 1
			typedef
				lib::wr::unique_cotask_factory<WCHAR[]>::type
			unique_cotask_wstr;

			auto helloRange = lib::rng::make_range(L"hello");
			unique_cotask_wstr output;
			std::tie(winerror, output) = unique_cotask_wstr::make(helloRange.size());
			winerror.throw_if();
			stdext::checked_array_iterator< WCHAR* > checked_begin(output->begin(), output->size());
			std::copy(helloRange.begin(), helloRange.end(), checked_begin);

			typedef
				lib::wr::unique_local_factory<std::wstring[]>::type
			unique_local_strings;
			unique_local_strings strings;
			std::tie(winerror, strings) = unique_local_strings::make(2);
			winerror.throw_if();

			unique_cotask_wstr cotaskTitle;
			std::tie(winerror, cotaskTitle) = lib::wr::LoadStdString<unique_cotask_wstr>(hInstance, IDS_APP_TITLE);
			winerror.throw_if();

			auto string = lib::rng::copy<UNICODE_STRING>(helloRange);
			auto stringRange = lib::rng::make_range(string);
			auto unicodeTitle = lib::rng::copy<UNICODE_STRING>(lib::rng::make_range_raw(title));
			stringRange = lib::rng::make_range(unicodeTitle);
#endif

			title = lib::wr::LoadStdString(hInstance, IDS_APP_TITLE);
			className = lib::wr::LoadStdString(hInstance, IDC_SCANNER);

			// Perform application initialization:
			std::tie(winerror, window) = CreateMainWindow(hInstance, className.c_str(), title.c_str(), nCmdShow);
			winerror.throw_if();

			if (!window)
			{
				return hresult_cast(E_UNEXPECTED);
			}

			hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_SCANNER));

			// Main message loop:
			while (GetMessage(&msg, NULL, 0, 0))
			{
				if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
				{
					TranslateMessage(&msg);
					DispatchMessage(&msg);
				}
			}

			return hr;
		}
	);
	return SUCCEEDED(result) ? (int) msg.wParam : FALSE;
}
NTSTATUS
DriverEntry(
    IN PDRIVER_OBJECT  DriverObject,
    IN PUNICODE_STRING RegistryPath
    )
/*++

Routine Description:

    Driver initialization entry point.
    This entry point is called directly by the I/O system.

Arguments:

    DriverObject - pointer to the driver object

    RegistryPath - pointer to a unicode string representing the path,
                   to driver-specific key in the registry.

Return Value:

    NTSTATUS    - if the status value is not STATUS_SUCCESS,
                        the driver will get unloaded immediately.

--*/
{
	KdPrint(("Entry DriverEntry Routine"));
    NTSTATUS            status = STATUS_SUCCESS;
    WDF_DRIVER_CONFIG   config;
    WDF_OBJECT_ATTRIBUTES attributes;

    //
    // Initialize WDF WPP tracing.
    //
    WPP_INIT_TRACING( DriverObject, RegistryPath );

    //
    // TraceEvents function is mapped to DoTraceMessage provided by
    // WPP by using a directive in the sources file.
    //
    TraceEvents(TRACE_LEVEL_INFORMATION, DBG_INIT,
                "Pci9656 Sample - Driver Framework Edition.");

    //
    // Initialize the Driver Config structure.
    //
    WDF_DRIVER_CONFIG_INIT( &config, PLxEvtDeviceAdd );

    //
    // Register a cleanup callback so that we can call WPP_CLEANUP when
    // the framework driver object is deleted during driver unload.
    //
    WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
    attributes.EvtCleanupCallback = PlxEvtDriverContextCleanup;

    status = WdfDriverCreate( DriverObject,
                              RegistryPath,
                              &attributes,
                              &config,
                              WDF_NO_HANDLE);

    if (!NT_SUCCESS(status)) {
        TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
                    "WdfDriverCreate failed with status %!STATUS!", status);
        //
        // Cleanup tracing here because DriverContextCleanup will not be called
        // as we have failed to create WDFDRIVER object itself.
        // Please note that if your return failure from DriverEntry after the
        // WDFDRIVER object is created successfully, you don't have to
        // call WPP cleanup because in those cases DriverContextCleanup
        // will be executed when the framework deletes the DriverObject.
        //
        WPP_CLEANUP(DriverObject);
    }

	KdPrint(("Leave DriverEntry Routine"));
    return status;
}
Exemple #29
0
NTSTATUS
DriverEntry(
    PDRIVER_OBJECT  DriverObject,
    PUNICODE_STRING RegistryPath
    )
/*++

Routine Description:
    DriverEntry initializes the driver and is the first routine called by the
    system after the driver is loaded.

Parameters Description:

    DriverObject - represents the instance of the function driver that is loaded
    into memory. DriverEntry must initialize members of DriverObject before it
    returns to the caller. DriverObject is allocated by the system before the
    driver is loaded, and it is released by the system after the system unloads
    the function driver from memory.

    RegistryPath - represents the driver specific path in the Registry.
    The function driver can use the path to store driver related data between
    reboots. The path does not store hardware instance specific data.

Return Value:

    STATUS_SUCCESS if successful,
    STATUS_UNSUCCESSFUL otherwise.

--*/
{
    WDF_DRIVER_CONFIG       config;
    NTSTATUS                status;
    WDF_OBJECT_ATTRIBUTES   attributes;
    UNICODE_STRING          funcName;

    //
    // Initialize WPP Tracing
    //
    WPP_INIT_TRACING( DriverObject, RegistryPath );

    TraceEvents(TRACE_LEVEL_INFORMATION, DBG_INIT,
                       "OSRUSBFX2 Driver Sample - Driver Framework Edition.\n");

    TraceEvents(TRACE_LEVEL_INFORMATION, DBG_INIT,
                "Built %s %s\n", __DATE__, __TIME__);

    //
    // IRP activity ID functions are available on some versions, save them into
    // globals (or NULL if not available)
    //
    RtlInitUnicodeString(&funcName, L"IoGetActivityIdIrp");
    g_pIoGetActivityIdIrp = (PFN_IO_GET_ACTIVITY_ID_IRP) (ULONG_PTR)
        MmGetSystemRoutineAddress(&funcName);

    //
    // The Device interface property set is available on some version, save it
    // into globals (or NULL if not available)
    //
    RtlInitUnicodeString(&funcName, L"IoSetDeviceInterfacePropertyData");
    g_pIoSetDeviceInterfacePropertyData = (PFN_IO_SET_DEVICE_INTERFACE_PROPERTY_DATA) (ULONG_PTR)
        MmGetSystemRoutineAddress(&funcName);

    //
    // Register with ETW (unified tracing)
    // 
    EventRegisterOSRUSBFX2();

    //
    // Initiialize driver config to control the attributes that
    // are global to the driver. Note that framework by default
    // provides a driver unload routine. If you create any resources
    // in the DriverEntry and want to be cleaned in driver unload,
    // you can override that by manually setting the EvtDriverUnload in the
    // config structure. In general xxx_CONFIG_INIT macros are provided to
    // initialize most commonly used members.
    //

    WDF_DRIVER_CONFIG_INIT(
        &config,
        OsrFxEvtDeviceAdd
        );

    //
    // Register a cleanup callback so that we can call WPP_CLEANUP when
    // the framework driver object is deleted during driver unload.
    //
    WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
    attributes.EvtCleanupCallback = OsrFxEvtDriverContextCleanup;

    //
    // Create a framework driver object to represent our driver.
    //
    status = WdfDriverCreate(
        DriverObject,
        RegistryPath,
        &attributes, // Driver Object Attributes
        &config,          // Driver Config Info
        WDF_NO_HANDLE // hDriver
        );

    if (!NT_SUCCESS(status)) {

        TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT,
                "WdfDriverCreate failed with status 0x%x\n", status);
        //
        // Cleanup tracing here because DriverContextCleanup will not be called
        // as we have failed to create WDFDRIVER object itself.
        // Please note that if your return failure from DriverEntry after the
        // WDFDRIVER object is created successfully, you don't have to
        // call WPP cleanup because in those cases DriverContextCleanup
        // will be executed when the framework deletes the DriverObject.
        //
        WPP_CLEANUP(DriverObject);
        EventUnregisterOSRUSBFX2();
    }

    return status;
}
Exemple #30
0
NTSTATUS
DriverEntry(
    _In_ PDRIVER_OBJECT  DriverObject,
    _In_ PUNICODE_STRING RegistryPath
    )
/*++

Routine Description:
    DriverEntry initializes the driver and is the first routine called by the
    system after the driver is loaded. DriverEntry specifies the other entry
    points in the function driver, such as EvtDevice and DriverUnload.

Parameters Description:

    DriverObject - represents the instance of the function driver that is loaded
    into memory. DriverEntry must initialize members of DriverObject before it
    returns to the caller. DriverObject is allocated by the system before the
    driver is loaded, and it is released by the system after the system unloads
    the function driver from memory.

    RegistryPath - represents the driver specific path in the Registry.
    The function driver can use the path to store driver related data between
    reboots. The path does not store hardware instance specific data.

Return Value:

    STATUS_SUCCESS if successful,
    STATUS_UNSUCCESSFUL otherwise.

--*/
{
    WDF_DRIVER_CONFIG config;
    NTSTATUS status;
    WDF_OBJECT_ATTRIBUTES attributes;

    //
    // Initialize WPP Tracing
    //
    WPP_INIT_TRACING( DriverObject, RegistryPath );

    TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_DRIVER, "%!FUNC! Entry");

    //
    // Register a cleanup callback so that we can call WPP_CLEANUP when
    // the framework driver object is deleted during driver unload.
    //
    WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
    attributes.EvtCleanupCallback = SmplDeviceEvtDriverContextCleanup;

    WDF_DRIVER_CONFIG_INIT(&config,
                           SmplDeviceEvtDeviceAdd
                           );

    status = WdfDriverCreate(DriverObject,
                             RegistryPath,
                             &attributes,
                             &config,
                             WDF_NO_HANDLE
                             );

    if (!NT_SUCCESS(status)) {
        TraceEvents(TRACE_LEVEL_ERROR, TRACE_DRIVER, "WdfDriverCreate failed %!STATUS!", status);
        WPP_CLEANUP(DriverObject);
        return status;
    }

    TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_DRIVER, "%!FUNC! Exit");

    return status;
}