Installing device driver

I have created a device driver for PPC that I install and setup registry entries for in HLM\Drivers\BuiltIn.

Under PPC 2003, my device driver DLL gets loaded at boot time. If I go into he remote process viewer and view device.exe, my dll shows up in the list.

OTOH, on a WMv5 device, the dll does not show up under device.exe until my application calls RegisterDevice.

Is there a way on WMv5 to get my device driver DLL pre-loaded since it doesn't seem that BuiltIn works like it use to

What limitations are there for loading device dlls On one particular device, The RegisterDevice call fails with a rc=2 (NOT FOUND) even though the DLL is in \Windows just like on devices where it works. I've been told that an rc=2 could mean, in this instance, that there wasn't enough room.

Thanks.


Answer this question

Installing device driver

  • Mike New

    There are a couple of ways to get a privileged cert. Microsoft suggests you enter the Mobile2Market program.

    To get into the M2M program you need to email the Mobile2Market team first. Then you will need to go pick up your cert from a group like Geotrust or Verisign. The cert will work for all devices that are part of the Mobile2Market program. This includes most WM 5.0 devices in North America. If your device is not part of the M2M program you will need to get the privileged cert from the OEM.

    Good luck!



  • HarryG

    Hi Mark,

    I tried the procedure mentioned by you in the post.Unfortunately I still get an rc = 2 (NOT_FOUND) when I try to call ActivateDevice or RegisterDevice.Any help would be really appreciated. Listed below is a gist of what I have tried to do :

    1) Created a Stream Driver,prefix PKT,using the driver wizard.it implements all 10 of the functions required.

    2)The primary use of the driver is to capture and filter any TCP/UDP packets coming into the mobile device using the NDIS api.

    3)I have tried adding the registry entries under HKLM\Drivers\BuiltIn\PKT

    4)The architecture is 3-tiered, packet driver dll,high level functions dll,exe.

    5)Test program ran a few times on the O2 WinCE 5.0 device(s) (without signing),I was able to debug the app etc and all of a sudden it started failing on the registerdevice call.

    6)Now inspite of having signed the executables(all 3 with the sdkpriviledgedDeveloper.pfx) and having installed the SdkCerts.cab file I am still unable to get past the rc = NOT_FOUND.

    HELP!!!

    regards,

    Mayank.


  • Joe_MS

    Hi Rob

    Ok, It seams we definitly have an issue with the device security policy.

    You're basically doing the right thing. But you're step 2 (Installing the SDK Root Certs) is wrong. You need to install the SdkCerts.cab file found in the WM 5.0 SDK (or VS 2005 provided file).
    Reference: http://msdn.microsoft.com/library/default.asp url=/library/en-us/mobilesdk5/html/moconPreparingDeviceForDevelopment.asp

    Have you tried to contact the device manufacter / mobile operator of the affected device

    Regards
    Michael

  • Gianni1962PiacenzaIT

    Hi Rob

    The basic Driver Model did not change in WM 5.0. So your registry setting should work fine.

    With Windows Mobile 5.0 Pocket PC devices now do implement the same security model as the Smartphone devices always had.

    The loading of the driver will fail if it does not comply with the devices security policy. With the default security policy enabled, drivers must be signed with a privileged certificate the device trusts (M2M privileged).

    I suspect that your driver is not signed. This would explain why it doesn't load.

    More details on the WM 5.0 Security Model can be found here:
    http://msdn.microsoft.com/library/default.asp url=/library/en-us/mobilesdk5/html/wce51conWindowsMobileDeviceSecurityModel.asp

    Let me know if this solves the problem.

    Regards
    Michael


  • Juniorscone

    Sometimes RegisterDevice() will fail. But it is not a signing problem. It's caused by address space collision.

    The most important thing you should know is all base addresses of the same dll will be the same in all processes in WinCE.
    Before you call RegisterDevice(), your device dll maybe has been loaded in other process, or your device dll depends on other dlls which has been loaded in other process.
    For example, mydev.dll has been loaded in myapp.exe and its base address is 00f40000. To make sure mydev.dll can be loaded in device.exe, the same address space in device.exe should be free.
    Sometimes, especially for phone device, there are many device driver dlls. Each driver will use some space to save its data. That means 00f40000 maybe has been used.
    If RegisterDevice() failed, you can call VirtualQuery() in device.exe to determine whether this address has been used.

    The solutions are:
    1. Load your dll as early as possible. Then your dll can be loaded in higher address.
    2. Find processes which loaded dlls whose base addresses are less than 02000000. Kill them.

  • codesergeant

    That worked! Signing the dll with the SDK privilege developer pfx and installing the root certs using the SdkCerts.cab, my device driver loads at boot time and I am able to run my application and call RegisterDevice. I guess the other devices that worked had a lower security setting.

    Thanks for the help in getting this far.

    Now, what is the process for getting a real Cert I don't want one specific to a device manufacturer because I want my driver to work on multiple vendor devices.
    I guess a 3rd party cert would be what we need. I see that there are already multipurpose root certs on the devices. What purposes does a cert need for a device driver that implements the stream interface Code signing Privileged What else

    Thanks again for the help.

  • CarlosAcosta

    Hi,
    I can once load the passthru driver example on the WM 5.0 pocket emulator. But i can't load the driver now. I don't change the code of the driver.

    Cant i use the same SDK privilege certificate more as one time maybe for difference driver on the same device

    regards

  • tfif

    Thanks I will check into that.

    One thing I didn't mention is that I'm having a problem on one manufacturer's device. Devices from other manufacturers and running on the emulator work fine.

    I say they work fine but really not as expected. On PPC 2003, the driver dll is listed under device.exe in the remote process viewer from the time the device is reset. On WMv5, the driver dll is not present until an app calls RegisterDevice.

    It's only on the one device that I get a failing RegisterDevice.

    Thanks.

  • PrimeTime

    ok, here is what I have found.

    Neither my real device driver dll nor my test device driver dll loads on the one device. They work fine on the emulator as well as several devices from different manufacturers. Neither dll gets preloaded at boot on any device like we have seen with PPC 2003.

    I have looked at the the security information you linked to and tried signing my dll but that didn't seem to help. Here is what I did:

    1) Followed the instructions at http://msdn.microsoft.com/library/default.asp url=/library/en-us/mobilesdk5/html/mob5tskSigningApplicationsForDistribution.asp on setting up my project to sign my dll. I used the SDKSamplePrivDeveloper.pfx in the WMv5 SDK to sign my dll. I rebuilt the dll with signing and copied it to the device.

    2) I copied the SDKSamplePrivDeveloper.cer to my device and clicked on it. I went into the Settings->System->Certiicates and found the TEST USE ONLY certificate under Root.

    3) I added my registry entries to HLM\Drivers\BuiltIn specifying the dll name, prefix, order, and index.

    4) I reset the device, checked the device.exe process with the remote process viewer and my dll was not there.

    5) Ran my application which does a RegisterDevice. It failed with a rc=2 the same as before.

    Just for grins, I copied the SecurityOff.cpf file from the WMv5 SDK and ran it. My app was able to load the device driver dll successfully...once. After reset, I had to run the cpf file again to run my app again.

    I also tried to query the device's security policy using the xml at http://msdn.microsoft.com/library/default.asp url=/library/en-us/mobilesdk5/html/wccondeterminingsecuritypoliciesrolesondevice.asp. I got
    "Config failed (0x80070005): Access is denied."

    What am I missing Am I doing the correct things Is there anything else I can try or is this device too tightly closed off

    Thanks.

  • Richard Lyon

    I also have a small sample driver dll which I can load via RegisterDevice. It is not signed but I can register it. However, it too is not loaded, or doesn't show up under device.exe, after boot. It only shows up after calling RegisterDevice.

    So I'm thinking that it's not the security policy which is preventing me from loading my real device driver on this one device.

    I'd also like to know why neither are loaded at boot time.

  • Installing device driver