none
unable to load NDIS minort driver RRS feed

  • Question

  • Dear All,

              I am new to WinCE Driver Development we are working for wifi driver, we have just created a NDIS DriverEntry function with a printf statement and we have build it in Debug mode. driver DLL was not loading.

    the following is plotform.reg file entries

    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\ABC]
        "Dll" = "abc.dll"
        "Order" = dword:1B
        "Prefix" = "PWL"
        "Index"=dword:2
       
    [HKEY_LOCAL_MACHINE\Comm\ABC]
    	"DisplayName"="PWL"
    	"Group"="NDIS"
    	"ImagePath"="abc.dll"	

    this following are Debug messages while loading DLL

    553 PID:400002 TID:9e0006 OSAXST1: >>> Loading Module 'abc.dll' (0x9E43F3E0) at address 0xEDFD0000-0xEDFD5000 in Process 'NK.EXE' (0x8819FAD0)
    PB Debugger Loaded symbols for 'C:\WINCE700\OSDESIGNS\abc.DLL'
       8580 PID:400002 TID:9e0006 NDIS DriverEntry.....
    
       8582 PID:400002 TID:9e0006 Warning! Kernel DLL 'abc.dll' is registered for thread creation/deletion notification.  To improve performance if you dont need thread notifications call DisableThreadLibraryCalls from inside 
       8583 PID:400002 TID:9e0006 ERROR! DEVMGR: Failed to load 'Drivers\BuiltIn\abc'. dwStatus=0x1
       8584 PID:400002 TID:9e0006 OSAXST1: <<< Unloading Module 'abc.dll' (0x9E43F3E0) at address 0xEDFD0000-0xEDFD5000 in Process 'NK.EXE' (0x8819FAD0)
    PB Debugger Unloaded symbols for 'C:\WINCE700\OSDESIGNS\abc.DLL'

    Can you please tell how to solve this one.

    Thursday, September 10, 2015 5:14 AM

All replies

  • First do what the warning tells you to do ;-) and call DisableThreadLibraryCalls in the driver entry

    BOOL WINAPI DllEntry(HANDLE hinstDll, ULONG Reason, LPVOID Reserved)
    {
        switch(Reason)
        {
        case DLL_PROCESS_ATTACH:
            RETAILREGISTERZONES((HMODULE)hinstDll);
            DEBUGMSG(ZONE_FUNCTION, (TEXT("DllMain(): dll attach.\r\n")));
            // don't need thread attach/detach messages
            DisableThreadLibraryCalls ((HMODULE)hinstDll);
            break;
    
        case DLL_PROCESS_DETACH:
            DEBUGMSG(ZONE_FUNCTION, (TEXT("DllMain(): dll detach.\r\n")));
            break;
        }
        return TRUE;
    }
    

    Set a breakpoint at the DriverEntry function which is the first entry point for NDIS to call. Then step through the code and see what goes wrong. enabling more log zones also helps,



    Good Luck,

    Erwin Zwart, eMVP
    Check out my blog: http://guruce.com/blog
    GuruCE
    Microsoft Embedded Partner
    http://guruce.com
    Consultancy, training and development services.

    Thursday, September 10, 2015 6:31 AM
  • Thanks for reply

    I did not add any functionality, first i am trying to load DLL

    NDIS_STATUS DriverEntry(
    	IN  PDRIVER_OBJECT      DriverObject,
        IN  PUNICODE_STRING     RegistryPath
    )
    {	
    	NDIS_STATUS            Status = NDIS_STATUS_FAILURE ;
    
            DEBUGMSG(TRUE,(TEXT("NDIS DriverEntry.....\n\r")));
    	
    	return 1;
    }



    • Edited by vamsikolla Thursday, September 10, 2015 7:35 AM
    Thursday, September 10, 2015 7:34 AM
  • Return NDIS_STATUS_SUCCESS(0x0 ndis.h)

    Good Luck,

    Erwin Zwart, eMVP
    Check out my blog: http://guruce.com/blog
    GuruCE
    Microsoft Embedded Partner
    http://guruce.com
    Consultancy, training and development services.


    • Edited by Erwin Zwart Thursday, September 10, 2015 7:49 AM
    Thursday, September 10, 2015 7:49 AM
  • after changing return statement also no success below are debug messages

    8272 PID:400002 TID:9e0006 OSAXST1: >>> Loading Module 'abc.dll' (0x9E43EED4) at address 0xEDFD0000-0xEDFD5000 in Process 'NK.EXE' (0x8819FAD0)
    PB Debugger Loaded symbols for 'C:\WINCE700\OSDESIGNS\abc.DLL'
       8274 PID:400002 TID:9e0006 NDIS DriverEntry.....
    
       8276 PID:400002 TID:9e0006 OSAXST1: <<< Unloading Module 'abc.dll' (0x9E43EED4) at address 0xEDFD0000-0xEDFD5000 in Process 'NK.EXE' (0x8819FAD0)
    PB Debugger Unloaded symbols for 'C:\WINCE700\OSDESIGNS\abc.DLL'
       8277 PID:400002 TID:9e0006 ERROR! DEVMGR: Failed to load 'Drivers\BuiltIn\abc'. dwStatus=0x2

    Thursday, September 10, 2015 9:22 AM
  • I am afraid you need to do more then that.

    In the driver entry you'll need to register the miniport driver: example/pseudo:

    NDIS_STATUS DriverEntry()
    {
        NDIS_STATUS                         Status;
        NDIS_MINIPORT_DRIVER_CHARACTERISTICS MPChar;
        
        NdisZeroMemory(&MPChar, sizeof(MPChar));
    
        MPChar.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_DRIVER_CHARACTERISTICS,
        MPChar.Header.Size = sizeof(NDIS_MINIPORT_DRIVER_CHARACTERISTICS);
        MPChar.Header.Revision = NDIS_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_1;
    
        MPChar.MajorNdisVersion             = MP_NDIS_MAJOR_VERSION;
        MPChar.MinorNdisVersion             = MP_NDIS_MINOR_VERSION;
        MPChar.MajorDriverVersion           = NIC_MAJOR_DRIVER_VERSION;
        MPChar.MinorDriverVersion           = NIC_MINOR_DRIVER_VERISON;
    
        MPChar.SetOptionsHandler = MpSetOptions;
        
        MPChar.InitializeHandlerEx          = MPInitialize;
        :
        :
        :
    
        MPChar.ShutdownHandlerEx            = MPShutdown;
        MPChar.CheckForHangHandlerEx        = MPCheckForHang;
        MPChar.ResetHandlerEx               = MPReset;
        
        Status = NdisMRegisterMiniportDriver(DriverObject,
                                             RegistryPath,
                                             (PNDIS_HANDLE)MiniportDriverContext,
                                             &MPChar,
                                             &NdisMiniportDriverHandle);
        
      
    
        return Status;
    }

    After the miniport is registered it (NDIS) will call the Initialize function (in this case MPInitialize which needs to return success as well I think...) 

    Check the sample drivers in \public\common\oak\drivers\netcard for complete(r) samples


    Good Luck,

    Erwin Zwart, eMVP
    Check out my blog: http://guruce.com/blog
    GuruCE
    Microsoft Embedded Partner
    http://guruce.com
    Consultancy, training and development services.

    • Proposed as answer by Keshava GN Thursday, September 10, 2015 10:07 AM
    Thursday, September 10, 2015 9:36 AM