NDIS driver not loading. DLL_PREOCESS_DETACH called - Windows CE

This is a discussion on NDIS driver not loading. DLL_PREOCESS_DETACH called - Windows CE ; Hi, I am working on a NDIS driver project for WinCE 3.0 and .NET. Currently I am testing on WinCE 3.0 ,PPC 2002(Toshiba e740). At this point I think the details of our driver project is irrelevant coz we are ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: NDIS driver not loading. DLL_PREOCESS_DETACH called

  1. NDIS driver not loading. DLL_PREOCESS_DETACH called

    Hi,
    I am working on a NDIS driver project for WinCE 3.0 and .NET.
    Currently I am testing on WinCE 3.0 ,PPC 2002(Toshiba e740).
    At this point I think the details of our driver project is irrelevant
    coz we are failing in the first step , ie unable to get NDIS to load
    our driver dll.The driver dll is a pretty basic one and was designed
    using the sample drivers like irsir in plat builder.So I do have a
    Dllmain and DriverEntry.
    On doing some debug message logging, we find that we get a
    DLL_PROCESS_ATTACH
    and
    DLL_PROCESS_DETACH immediately after.

    Driverentry is not even entered.

    Registry entries are the std ones,

    ; IrLan registry settings
    [HKEY_LOCAL_MACHINE\Comm\IRLAN]
    "DisplayName"="IrLan"
    "Group"="NDIS"
    "ImagePath"="irlan.dll"

    [HKEY_LOCAL_MACHINE\Comm\IRLAN\Linkage]
    "Route"=multi_sz:"IRLAN1"

    [HKEY_LOCAL_MACHINE\Comm\IRLAN1]
    "DisplayName"="IrLan"
    "Group"="NDIS"
    "ImagePath"="irlan.dll"

    [HKEY_LOCAL_MACHINE\Comm\IRLAN1\Parms]
    "BusNumber"=dword:0
    "BusType"=dword:0

    What r the possible causes for the failure? I am almost sure that our
    code is correct(we used the same code for H/PC under Win CE
    2.11).Could it be NDIS libraries that we used to re build the dll?We
    used the libraries provided by plat builder.
    Any help would be jus great..
    thanks

  2. Re: NDIS driver not loading. DLL_PREOCESS_DETACH called

    An NDIS driver not getting loaded is usually the result of the driver
    using NdisXxx() functions that are not available on the target
    platform.

    The NDIS docs describe various functions that are or are not supported
    on Windows 95/98/ME/NT/2K/XP/CE.

    Try to comment out most of your code and see if the driver gets
    loaded. Then use more and more code until your driver doesn't get
    loaded anymore.

    Maybe CE can also output some debug messages in a checked build when
    the driver gets loaded (e.g. "unable to resolve external XYZ" or
    alike).

    HTH, Stephan
    MVP - Windows DDK
    ---
    On 26 Apr 2004 20:50:20 -0700, malavikas@rediffmail.com (moonjoor)
    wrote:

    >Hi,
    >I am working on a NDIS driver project for WinCE 3.0 and .NET.
    >Currently I am testing on WinCE 3.0 ,PPC 2002(Toshiba e740).
    >At this point I think the details of our driver project is irrelevant
    >coz we are failing in the first step , ie unable to get NDIS to load
    >our driver dll.The driver dll is a pretty basic one and was designed
    >using the sample drivers like irsir in plat builder.So I do have a
    >Dllmain and DriverEntry.
    >On doing some debug message logging, we find that we get a
    >DLL_PROCESS_ATTACH
    >and
    >DLL_PROCESS_DETACH immediately after.
    >
    >Driverentry is not even entered.
    >
    >Registry entries are the std ones,
    >
    > ; IrLan registry settings
    > [HKEY_LOCAL_MACHINE\Comm\IRLAN]
    > "DisplayName"="IrLan"
    > "Group"="NDIS"
    > "ImagePath"="irlan.dll"
    >
    > [HKEY_LOCAL_MACHINE\Comm\IRLAN\Linkage]
    > "Route"=multi_sz:"IRLAN1"
    >
    > [HKEY_LOCAL_MACHINE\Comm\IRLAN1]
    > "DisplayName"="IrLan"
    > "Group"="NDIS"
    > "ImagePath"="irlan.dll"
    >
    > [HKEY_LOCAL_MACHINE\Comm\IRLAN1\Parms]
    > "BusNumber"=dword:0
    > "BusType"=dword:0
    >
    >What r the possible causes for the failure? I am almost sure that our
    >code is correct(we used the same code for H/PC under Win CE
    >2.11).Could it be NDIS libraries that we used to re build the dll?We
    >used the libraries provided by plat builder.
    >Any help would be jus great..
    >thanks


  3. Re: NDIS driver not loading. DLL_PREOCESS_DETACH called

    Thanks for that info.
    I took your suggestion and wrote a minimal driver code to see if it
    was getting loaded.
    This is what my code looks like..
    -------------------------------------
    main.c
    ------
    #include "main.h"


    //BOOL WINAPI
    BOOL __stdcall DllMain(
    HANDLE hInstDll,
    DWORD Op,
    LPVOID lpvReserved
    )
    {
    switch (Op)
    {
    case DLL_PROCESS_ATTACH:

    //some debug logging info
    break;

    case DLL_PROCESS_DETACH:

    // some debug logging info
    break;

    case DLL_THREAD_ATTACH:
    //some debug logging info
    break;

    case DLL_THREAD_DETACH:
    //some debug logging info
    break;

    default:
    //some debug logging info
    break;
    }

    return (TRUE);
    }


    /*

    Function: DriverEntry

    Description: Register the driver's entry points with NDIS.

    Arguments:

    pDriverObject - The driver object being initialized.

    pRegistryPath - Registry path of the driver.

    Returns:

    NDIS_STATUS - Status returned by NdisMRegisterMiniport.

    Comments:

    Mark the DriverEntry function to run once during initialization
    and then
    it is discardable.

    --*/

    NDIS_STATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN
    PUNICODE_STRING
    RegistryPath)
    {
    NDIS_STATUS Status;
    NDIS_MINIPORT_CHARACTERISTICS sample;
    NDIS_HANDLE hNdisWrapper;

    // Initialize the wrapper.
    NdisMInitializeWrapper(&hNdisWrapper, DriverObject, RegistryPath,
    NULL);
    // Clear NetDVBChar
    NdisZeroMemory(&sample, sizeof(NDIS_MINIPORT_CHARACTERISTICS));
    // Initialize the Miniport characteristics for the call to

    sample.MajorNdisVersion = NDIS_MAJOR_VERSION; // 3, 4
    sample.MinorNdisVersion = NDIS_MINOR_VERSION; // 0
    sample.CheckForHangHandler = NULL;
    sample.HaltHandler = NULL;
    sample.InitializeHandler = NULL;
    sample.QueryInformationHandler = NULL;
    sample.ResetHandler =NULL; // optional
    sample.SendHandler = NULL;
    sample.SetInformationHandler =NULL;
    sample.TransferDataHandler = NULL;

    Status = NdisMRegisterMiniport(hNdisWrapper, &sample,
    sizeof(sample));

    if (Status != NDIS_STATUS_SUCCESS)
    { // Terminate the wrapper.
    NdisTerminateWrapper(hNdisWrapper, NULL);
    }
    return Status;
    }

    main.h
    ------
    #include
    #include
    #include
    #include
    #include

    #include
    #include
    #define NDIS_MAJOR_VERSION 0x04
    #define NDIS_MINOR_VERSION 0x00

    --------------------------------------------------------------end of
    code
    And I am still unable to get this driver loaded.
    The ndis.lib and ndis.h files are from ppc2002(arm) sdk.
    And the device I am using for testing is also ppc 2002(arm).
    What am I doing wrong?
    Also to check if the driver is getting loaded I am using remote
    process viewer on evc. Is this a definite way to making sure of this
    fact?
    Thanks


    Stephan Wolf wrote in message news:...
    > An NDIS driver not getting loaded is usually the result of the driver
    > using NdisXxx() functions that are not available on the target
    > platform.
    >
    > The NDIS docs describe various functions that are or are not supported
    > on Windows 95/98/ME/NT/2K/XP/CE.
    >
    > Try to comment out most of your code and see if the driver gets
    > loaded. Then use more and more code until your driver doesn't get
    > loaded anymore.
    >
    > Maybe CE can also output some debug messages in a checked build when
    > the driver gets loaded (e.g. "unable to resolve external XYZ" or
    > alike).
    >
    > HTH, Stephan
    > MVP - Windows DDK
    > ---
    > On 26 Apr 2004 20:50:20 -0700, malavikas@rediffmail.com (moonjoor)
    > wrote:
    >
    > >Hi,
    > >I am working on a NDIS driver project for WinCE 3.0 and .NET.
    > >Currently I am testing on WinCE 3.0 ,PPC 2002(Toshiba e740).
    > >At this point I think the details of our driver project is irrelevant
    > >coz we are failing in the first step , ie unable to get NDIS to load
    > >our driver dll.The driver dll is a pretty basic one and was designed
    > >using the sample drivers like irsir in plat builder.So I do have a
    > >Dllmain and DriverEntry.
    > >On doing some debug message logging, we find that we get a
    > >DLL_PROCESS_ATTACH
    > >and
    > >DLL_PROCESS_DETACH immediately after.
    > >
    > >Driverentry is not even entered.
    > >
    > >Registry entries are the std ones,
    > >
    > > ; IrLan registry settings
    > > [HKEY_LOCAL_MACHINE\Comm\IRLAN]
    > > "DisplayName"="IrLan"
    > > "Group"="NDIS"
    > > "ImagePath"="irlan.dll"
    > >
    > > [HKEY_LOCAL_MACHINE\Comm\IRLAN\Linkage]
    > > "Route"=multi_sz:"IRLAN1"
    > >
    > > [HKEY_LOCAL_MACHINE\Comm\IRLAN1]
    > > "DisplayName"="IrLan"
    > > "Group"="NDIS"
    > > "ImagePath"="irlan.dll"
    > >
    > > [HKEY_LOCAL_MACHINE\Comm\IRLAN1\Parms]
    > > "BusNumber"=dword:0
    > > "BusType"=dword:0
    > >
    > >What r the possible causes for the failure? I am almost sure that our
    > >code is correct(we used the same code for H/PC under Win CE
    > >2.11).Could it be NDIS libraries that we used to re build the dll?We
    > >used the libraries provided by plat builder.
    > >Any help would be jus great..
    > >thanks


  4. Re: NDIS driver not loading. DLL_PREOCESS_DETACH called

    Umm, I do not have a DllMain() in any of my NDIS drivers. And they do
    compile/run for/on CE as well.

    Stephan

  5. Re: NDIS driver not loading. DLL_PREOCESS_DETACH called

    I believe that you must define and export a DriverEntry function. NDIS calls
    that entry point explicitly instead of DllMain (which is ignored...).

    I think that the Platform Builder docs describe this.

    Thomas F. Divine
    http://www.rawether.net

    "Stephan Wolf" wrote in message
    news:gsc1905b4bjvdv2u2fts43b7sptsgngvu5@4ax.com...
    > Umm, I do not have a DllMain() in any of my NDIS drivers. And they do
    > compile/run for/on CE as well.
    >
    > Stephan




  6. Re: NDIS driver not loading. DLL_PREOCESS_DETACH called

    Yup, correct (now that you are saying.... CE requires a .DEF file
    for device drivers (which are actually *user-mode* DLLs under CE).
    NDIS drivers need the following entry in the .DEF file:

    EXPORTS DriverEntry

    That might be the reason the OP's driver won't load.

    Stephan
    ---
    On Thu, 29 Apr 2004 09:58:19 -0400, "Thomas F. Divine [DDK MVP]"
    wrote:

    >I believe that you must define and export a DriverEntry function. NDIS calls
    >that entry point explicitly instead of DllMain (which is ignored...).
    >
    >I think that the Platform Builder docs describe this.
    >
    >Thomas F. Divine
    >http://www.rawether.net
    >
    >"Stephan Wolf" wrote in message
    >news:gsc1905b4bjvdv2u2fts43b7sptsgngvu5@4ax.com...
    >> Umm, I do not have a DllMain() in any of my NDIS drivers. And they do
    >> compile/run for/on CE as well.
    >>
    >> Stephan


  7. Re: NDIS driver not loading. DLL_PREOCESS_DETACH called

    The DEF file did the trick.
    My driver loads now,
    Thanks guys,
    really appreciate ur help

    Stephan Wolf wrote in message news:...
    > Yup, correct (now that you are saying.... CE requires a .DEF file
    > for device drivers (which are actually *user-mode* DLLs under CE).
    > NDIS drivers need the following entry in the .DEF file:
    >
    > EXPORTS DriverEntry
    >
    > That might be the reason the OP's driver won't load.
    >
    > Stephan
    > ---
    > On Thu, 29 Apr 2004 09:58:19 -0400, "Thomas F. Divine [DDK MVP]"
    > wrote:
    >
    > >I believe that you must define and export a DriverEntry function. NDIS calls
    > >that entry point explicitly instead of DllMain (which is ignored...).
    > >
    > >I think that the Platform Builder docs describe this.
    > >
    > >Thomas F. Divine
    > >http://www.rawether.net
    > >
    > >"Stephan Wolf" wrote in message
    > >news:gsc1905b4bjvdv2u2fts43b7sptsgngvu5@4ax.com...
    > >> Umm, I do not have a DllMain() in any of my NDIS drivers. And they do
    > >> compile/run for/on CE as well.
    > >>
    > >> Stephan


+ Reply to Thread