Sample Code
Windows Driver Samples/ WDF Hybrid 1394 Virtual Device Sample Driver/ C++/ kmdf/ kmdf_vdev.c/
/*++ Copyright (c) Microsoft Corporation Module Name: kmdf_vdev.cpp Abstract: Entry file for the kmdf component of the 1394 virtual device hybrid driver sample. --*/ #include "kmdf_vdev.h" #include "kmdf_vdev.tmh" // autogenerated for WPP tracing #ifdef ALLOC_PRAGMA #pragma alloc_text(INIT, DriverEntry) #endif NTSTATUS DriverEntry ( IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath) /*++ Routine Description: Installable 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: STATUS_SUCCESS if successful, STATUS_UNSUCCESSFUL otherwise. --*/ { NTSTATUS ntStatus = STATUS_SUCCESS; WDF_DRIVER_CONFIG config; WDF_OBJECT_ATTRIBUTES attributes; WPP_INIT_TRACING(DriverObject, RegistryPath); Enter(); DoTraceLevelMessage(TRACE_LEVEL_INFORMATION, TRACE_FLAG_DRIVER, "1394VDev Hybrid Sample\n"); // // Register a cleanup callback function (which calls WPP_CLEANUP) // for the framework driver object. The framework will call // the cleanup callback function when it deletes the driver object, // before the driver is unloaded. // WDF_OBJECT_ATTRIBUTES_INIT(&attributes); attributes.EvtCleanupCallback = kmdf1394_EvtDriverCleanup; // // Initialize the Driver Config structure.. // WDF_DRIVER_CONFIG_INIT (&config, kmdf1394_EvtDeviceAdd); // // Create a WDFDRIVER object. // ntStatus = WdfDriverCreate ( DriverObject, RegistryPath, &attributes, &config, WDF_NO_HANDLE); if (!NT_SUCCESS (ntStatus)) { DoTraceLevelMessage(TRACE_LEVEL_ERROR, TRACE_FLAG_DRIVER, "WdfDriverCreate failed with status %!STATUS!\n", ntStatus); ExitS(ntStatus); WPP_CLEANUP(DriverObject); } else { ExitS(ntStatus); } return ntStatus; } // DriverEntry void kmdf1394_EvtDriverCleanup( IN WDFOBJECT WdfDriver ) /*++ Routine Description: Free all the resources allocated in DriverEntry. Arguments: Driver - handle to a WDF Driver object. Return Value: VOID. --*/ { DoTraceLevelMessage(TRACE_LEVEL_INFORMATION, TRACE_FLAG_DRIVER, "kmdf1394_EvtDriverCleanup: WdfDriver 0x%p", WdfDriver); // // Stop WPP Tracing // WPP_CLEANUP(WdfDriverWdmGetDriverObject((WDFDRIVER)WdfDriver)); return; }
Our Services
-
What our customers say about us?
Read our customer testimonials to find out why our clients keep returning for their projects.
View Testimonials