Re: Unable to load custom driver on WinCE 6




<mecha083@xxxxxxxxx> wrote in message news:da9c83d9-1ea1-45ac-b901-63175f49c047@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,
I'm trying to make and load a simple DLL on WinCE 6 by following the
guide at http://msdn.microsoft.com/en-us/library/aa459176.aspx .

The target device is actually a i.MX27 ADS evaluation board. I've
managed to build a working WinCE 6 image with the BSP provided by
Freescale.

This is what I did so far:
- I've made a subproject at PB project to include the simple DLL
(following the guide from the MSDN link above).
- The MyDriver DLL subproject compiled without errors.
- I've ran dumpbin -exports mydriver.dll to check the export
functions. The export functions matched the screenshot in the MSDN
link.
- At the target device, the mydriver.dll file is in the Windows
directory.
- At the target device, the registry entry at "Drivers" directory is
correct. Below is the registry entry.
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Sample]
"Dll" = "mydriver.Dll"
"Prefix" = "DEM"
"Index" = dword:1
"Order" = dword:0
"FriendlyName" = "Demo Driver"
"Ioctl" = dword:0
- At the target device, there is no entry pertaining mydriver.dll in
the Drivers > Active directory like the screenshot shown. Therefore,
the driver is loaded.
- I wrote a simple application to load the driver dynamically
following an example from the web (using ActivateDeviceEx() API).
GetLastError() return 0x0000002 and handle value is 0. Below is the
function:

void LoadDriver(void)
{
HANDLE hDriverShell = INVALID_HANDLE_VALUE;
BOOL RetVal = FALSE;

if( hDriverShell == INVALID_HANDLE_VALUE )
{
hDriverShell = ActivateDeviceEx(_T("Drivers\\BuiltIn\
\Sample"), NULL, 0, NULL);

if ((hDriverShell != INVALID_HANDLE_VALUE) && (hDriverShell !=
0))
{
RetVal = TRUE;
}
else
{
// Note: the driver may have succeded to load if the
handle is zero
//RETAILMSG( 1, (TEXT("Failed to activate driver %d\n"),
GetLastError() ));
RetVal = FALSE;
}
}
}

What should I do to load the driver successfully on WinCE 6?

Thanks.


Are you correctly exporting the necessary functions from the DLL? Show us which ones are present, ie the dumpbin output

See here for the exports applicable to you:

http://msdn.microsoft.com/en-us/library/aa930506.aspx

Did you forget to put a DllMain in your dll?


Next, the builtin key will load the driver for you at boot time, you do not need to use ActivateDeviceEx to start it.
The order is rather low (0), this will not affect use by activatedevice though.

BTW ActivateDeviceEx returns NULL on failure, not INVALID_HANDLE_VALUE. CreateFile is the only one that uses INVALID_HANDLE_VALUE, yes the inconsistency is irritating.

- It is also possible that the driver is loaded then unload immediately if DEM_Init fails. Put a RETAILMSG in there to see if it gets called.

All of that said it may be as simple as this:
Prove that mydriver.dll is in your image (is it part of the ce.bib file in the release dir?) -OR- is RELFSD part of your image and KITL is connected?

Geoff
--

.



Relevant Pages

  • Re: Do you tell me how to generate the usbser.dll for PB6?
    ... I am going to find a way to generate the dll from lib file. ... Please note that the 1118/206 is the USB device's PID/VID. ... then it want to load the dll file in the ... // Attempt to load client driver based on registry settings ...
    (microsoft.public.windowsce.platbuilder)
  • Unable to load custom driver on WinCE 6
    ... I'm trying to make and load a simple DLL on WinCE 6 by following the ... At the target device, the mydriver.dll file is in the Windows ... I wrote a simple application to load the driver dynamically ...
    (microsoft.public.windowsce.embedded)
  • Re: "No .rel file found for module "
    ... about your dll, assuming it has gotten far enough to attempt to load it. ... I thought maybe it was the registry data too, ... The driver is straight from freescale and is supposedly good, ...
    (microsoft.public.windowsce.app.development)
  • Re: Spot the geeks doubt
    ... LoadDriver() does not actually load a driver for your application, ... are not supported for the DLL that you loaded. ... Microsoft WEP Gold-level Member ...
    (microsoft.public.windowsce.platbuilder)
  • Re: White progress bar during startup
    ... Loaded driver \WINDOWS\system32\ntoskrnl.exe ... Did not load driver ACPI Uniprocessor PC ... Did not load driver Audio Codecs ...
    (microsoft.public.windowsxp.help_and_support)