none
WEC7: Who starts my NDIS? RRS feed

  • Question

  • Hello everybody,
    I have a Problem regarding the startup of my Ethernet drivers. In my System is a custom driver that will be started by NDIS and then starts all the Ethernet drivers automatically. On my WinCE5 system the NDIS is started after the PCIBusEnumerator is done. That works fine.

    Till now, so during the migration to WEC7 I always used "ndisconfig" to start NDIS manually (the drivers were on a SD-Card). That works fine as well. Now I tried to integrate the drivers in my NK.bin and so they are available since startup. And that’s the Problem, because NDIS seems to start really early, especially before the PCI Bus is enumerated. So, NDIS starts my custom driver stuff, that starts the Ethernet drivers but the PCI device isn’t ready yet. In the end it leads into a crash of the Ethernet drivers.
    I cannot find something in the registry that says how early or in which order the NDIS is started. Has anyone an idea? Who starts my NDIS?

    Thank you!
    Best Regards
    Chris

    Wednesday, December 11, 2013 6:35 AM

Answers

  • Hi,

    I am assuming DriverEntry is getting called before PCI enumerations are completed.

    You may use several approaches:

    1. Use events to stall DriverEntry processing. Once PCI device handling is complete set the events.

    2. Use this workaround:- NDIS typically reads the adapter instance registry entry and uses Group=NDIS to figure out the presence of an NDIS driver. Comment this out in the registry and during the init phase of the driver before DriverEntry (if anything like Init()) add the registry entry(using registry APIs). When you do this and call NdisRegisterAdapter , Ndis will trigger the call to DriverEntry for you.

    For example:

    [HKEY_LOCAL_MACHINE\Comm\NE20001]
      DisplayName="NE2000 Compatible Ethernet Driver"
      Group ="NDIS"
      ImagePath="NE2000.DLL"

    Comment the Group entry above , add the entry in the driver while doing Init()/PCI related stuff. Delete the entry on exit/power down.

    Of course the above is a workaround.

    Regards,

    Balaji.


    • Edited by balajitrv1 Wednesday, December 11, 2013 9:59 AM
    • Marked as answer by Chris_Hm Thursday, December 12, 2013 1:42 PM
    Wednesday, December 11, 2013 9:50 AM

All replies

  • Hi,

    I am assuming DriverEntry is getting called before PCI enumerations are completed.

    You may use several approaches:

    1. Use events to stall DriverEntry processing. Once PCI device handling is complete set the events.

    2. Use this workaround:- NDIS typically reads the adapter instance registry entry and uses Group=NDIS to figure out the presence of an NDIS driver. Comment this out in the registry and during the init phase of the driver before DriverEntry (if anything like Init()) add the registry entry(using registry APIs). When you do this and call NdisRegisterAdapter , Ndis will trigger the call to DriverEntry for you.

    For example:

    [HKEY_LOCAL_MACHINE\Comm\NE20001]
      DisplayName="NE2000 Compatible Ethernet Driver"
      Group ="NDIS"
      ImagePath="NE2000.DLL"

    Comment the Group entry above , add the entry in the driver while doing Init()/PCI related stuff. Delete the entry on exit/power down.

    Of course the above is a workaround.

    Regards,

    Balaji.


    • Edited by balajitrv1 Wednesday, December 11, 2013 9:59 AM
    • Marked as answer by Chris_Hm Thursday, December 12, 2013 1:42 PM
    Wednesday, December 11, 2013 9:50 AM
  • Hello Balaji,

    The first idea seems to be the easiest way to solve my problem, but I just don’t know when the PCI device handling is done.

    I picked your second idea and added an executable to my Autorun that add all the Ethernet parameters to the registry. That has the advantage, that I can load different drivers without building a new platform.

    Thanks for the brainstorming! ;)

    Chris
    Thursday, December 12, 2013 1:42 PM