在DriverEntry主要用于初始化IO管理器创建的驱动对象,和设置AddDevice例程。看看范例就知道了:
PCI设备
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.
--*/
{
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,