none
When is function driver of a statically enumerated device loaded? RRS feed

  • Question

  • When is function driver of a statically enumerated device loaded?

    The discussion below applies only to KMDF drivers for Windows Phone8.1

    I'm studying a sample driver package with a software-only bus driver(sample_bus.sys, whose start type is SERVICE_SYSTEM_START (0x01)) and one statically enumerated child driver(sample_child.sys, whose start type is SERVICE_DEMAND_START (0x3)).

    In the bus driver, a PDO for the child device is created. But I cannot figure out when the function driver(sample_child.sys) for the child device is loaded(I guess the funcion driver for the child device is loaded by PNP)

    So the question is: which function(s) below "trigger" the loading of function driver of child device(sample_child.sys)?

    Follwing is sample code of the bus driver(sample_bus.sys); error checking code is removed for simplicity

    deviceInit = WdfPdoInitAllocate( device );

    status = WdfPdoInitAssignDeviceID( deviceInit, &str); //Device ID

    status = WdfPdoInitAddHardwareID( deviceInit, &str ); //Hardware

    IDWDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE( &pdoAttributes, SAMPLE_DRIVER_DATA );

    pdoAttributes.EvtCleanupCallback = SampleDriverFdoCleanupChildDevice;

    pdoAttributes.SynchronizationScope = WdfSynchronizationScopeDevice;

    status = WdfDeviceInitRegisterPnpStateChangeCallback( deviceInit, WdfDevStatePnpStarted, SampleBusFdoChildStarted,

    StateNotificationEnterState );

    status = WdfDeviceCreate( &deviceInit, &pdoAttributes, &childDevice );

    status = WdfFdoAddStaticChild( device, childDevice );




    Saturday, January 31, 2015 5:13 PM

Answers

  • If you think about this the driver for the PDO is loaded in response to the system learning that there is a new PDO in the stack.  Given that it is WdfFdoAddStaticChild that will trigger the load.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com

    Saturday, January 31, 2015 5:32 PM

All replies

  • If you think about this the driver for the PDO is loaded in response to the system learning that there is a new PDO in the stack.  Given that it is WdfFdoAddStaticChild that will trigger the load.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com

    Saturday, January 31, 2015 5:32 PM
  • The enumeration of the child will run asynchronously, in a separate PnP thread

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Saturday, January 31, 2015 7:11 PM
    Moderator