none
NdisIMInitializeDeviceInstanceEx failed Proplem with developping NDIS Intermediate Drivers via USB RRS feed

  • Question

  • Hi all,

       I am developping a NDIS Intermediate Driver via USB cable. My device is WINCE6.0 . 

       Here is some point code:

       In function:USBDeviceAttach()

       1.NdisRegisterAdapter is called.  return NDIS_STATUS_SUCCESS

       In function:DriverEntry(IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING   pRegistryPath)

       2.NdisMInitializeWrapper is called. It seems to be OK,get ghNdisIntermediateHandle successfully.

       3.NdisIMRegisterLayeredMiniport is called,return NDIS_STATUS_SUCCESS.

       so far,everything looks good.

       but next step,function NdisIMInitializeDeviceInstanceEx return 1.

       4.if(NdisIMInitializeDeviceInstanceEx(

            ghNdisIntermediateHandle,

            &guniRegistryPath,

            NULL

            ) != NDIS_STATUS_SUCCESS))

        {

            RETAILMSG(1, (TEXT("\r\n(kwanvin) NdisIMInitializeDeviceInstanceEx fail %ld"),status));

            return status;

        }

     

         Could anyone tell me what is going on here?  I checked the description of this function in msdn, the return values for this function is either NDIS_STATUS_SUCCESS(0x00000000L) or NDIS_STATUS_NOT_ACCEPTED(0x00010003L) ,but Here I got the return value is 1. Why is that happening?  Any advices is welcome.


    • Edited by Kwanvin Monday, August 13, 2012 7:10 AM
    Monday, August 13, 2012 7:07 AM

All replies

  • Hi Kwanvin,

    Are you calling NdisIMInitializeDeviceInstanceEx from DriverEntry?. 

    This Link http://msdn.microsoft.com/en-us/library/windows/hardware/ff552164(v=vs.85).aspx suggests that the above function should be called from

    ProtocolBindAdapter function.

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    An NDIS intermediate driver should call NdisIMInitializeDeviceInstanceEx from its ProtocolBindAdapter function, thereby controlling when NDIS calls the driver'sMiniportInitialize function to set up the driver's virtual network adapter. A failure to call NdisIMInitializeDeviceInstanceEx or NdisIMInitializeDeviceInstance from an NDIS intermediate driver effectively prevents that driver from loading itself successfully. Such a driver cannot make its virtual network adapter operational for still higher level protocols unless its MiniportInitialize function runs.

    Before it calls NdisIMInitializeDeviceInstanceEx, the intermediate driver's ProtocolBindAdapter function must make a successful call to NdisOpenAdapter

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Anything like that exists in your code?

    Regards,

    Balaji.

    Tuesday, August 14, 2012 4:34 AM
  •    

         Sorry for replying so late,I just came back to work from vacation. 

     

          yes,I read this before. http://msdn.microsoft.com/en-us/library/windows/hardware/ff552164(v=vs.85).aspx 

          It seems quite different with my sample code. There is no any call of function ProtocolBindAdapter in my code.

          I will try that later. Thanks for your reply!

      

    Thursday, August 30, 2012 9:15 AM