Adding a DllMain Entry Point to the NDIS Miniport Driver Core Functions (Windows Embedded CE 6.0)

1/6/2010

Windows Embedded CE NDIS miniport drivers require a DllMain entry point.

To add the DllMain entry point to the NDIS miniport driver core functions

  1. In %_WINCEROOT%\Platform\%_TGTPLAT%\Drivers\CENDISMiniport, open Mp_main.c, and at the end of the file add a DllMain entry point.

    The following code example shows an NDIS miniport DLL entry point.

    #ifdef UNDER_CE
    
    //
    // Standard Windows DLL entrypoint.
    // Since Windows Embedded CE NDIS miniports are implemented as DLLs, a DLL entrypoint is
    // needed.
    //
    
    BOOL __stdcall
    DllEntry(
      HANDLE hDLL,
      DWORD dwReason,
      LPVOID lpReserved
    )
    {
    
        switch (dwReason) {
        case DLL_PROCESS_ATTACH:
            DEBUGREGISTER(hDLL);
            DEBUGMSG(ZONE_INIT, (TEXT("NE2000: DLL_PROCESS_ATTACH\n")));
            DisableThreadLibraryCalls((HMODULE) hDLL);
            break;
        case DLL_PROCESS_DETACH:
            DEBUGMSG(ZONE_INIT, (TEXT("NE2000: DLL_PROCESS_DETACH\n")));
            break;
        }
        return TRUE;
    }
    
    #endif
    
  2. From the IDE Build menu, choose Open Build Release Directory.

  3. Navigate to the directory containing your Windows Embedded CE NDIS miniport driver.

    Be sure your NDIS miniport driver is in %_WINCEROOT%\Platform\%_TGTPLAT%\Drivers\CENDISMiniport.

  4. Build the Windows Embedded CE NDIS miniport driver with the Build tool.

    For more information about the Build tool, see Build Tool. Microsoft recommends using the -c parameter with the Build tool to delete all object files.

See Also

Tasks

How to Migrate a Windows-based Desktop NDIS Miniport Driver to Windows Embedded CE