Problems with loading device driver at startup - WM6.1

Our embedded programmer designed the virtual serial port driver wrapper for our mobile equipment, and I populated methods to make it work. The driver works as expected, it simulates a COM port for a USB device that spews NMEA lines (GPS data).

I print WM6 for short, but the OS is WM6.1, if that matters.

The problem that I encountered is that the driver does not load when the device starts only on WM6. The driver was developed for both CE5 and WM6, but in CE5 the driver loads at boot, which indicates a WM6 configuration problem. It may be worth noting that at this moment the driver will load into WM6 and CE5 using the ActivateDevice () method, this is what I have used so far for WM6, a small test application to run the driver so that I can at least test the driver working on WM6.

The registry is already filled with the necessary keys to start the driver. Therefore, the driver should load at startup without any problems. HKEY_LOCAL_MACHINE \ Drivers \ BuiltIn contains an additional key A36D_GPS_COM and is contained in this key.

DeviceArrayIndex: 0

DeviceType: 0

Dll: A36D.dll

Flags: 0

Friendly Name: GPS A36D COM Port

Index: 8

Order: 3

Prefix: COM

Priority: 0

Priority: 256

From what I can say, there are usually two general answers to this question that I have already explored. These ideas were provided to me by the embedded programmer, but I researched how to do this myself.

1) The COM port is already used when the driver tries to load, even if this COM port is ultimately free after the device boots up. I changed the index value in the registry from 1 to 20 and rebooted the device, and the driver does not load on the specified COM port. Therefore, for more thorough testing, I moved another device from COM9 to COM8 and moved my driver to COM9 (using the above registry settings). Another device driver loads quite happily on startup on COM8, but my device driver doesn't load on COM9. I even tried to configure other settings, but it does not load at boot time.

2) Other possible problems and differences between CE5 and WM6 are security. Thus, using the MSDN article http://msdn.microsoft.com/en-us/library/bb737570.aspx I worked on signing and creating XML. Using the preferred key (has not expired), A36D.dll is signed in the visual studio, and the created CAB file for installation is also signed with the same key. The _setup.xml file is created and added to the cabin file so that the signed key is added to the certificate store. The CAB file is again signed with the same key to ensure that it is still valid. In addition, _setup.xml is packaged in its own .CPF file. Both CAB and CPF files add the key to the certificate stores "HKEY_LOCAL_MACHINE \ Comm \ Security \ SystemCertificates", so be aware that this works. As a caution, I installed it in Privileged, Unprivileged, ROOT, and SPC certificate stores. But the device driver still does not load into the device.exe file when the mobile device boots.

Besides the workaround of the launching application that calls ActivateDevice () in the driver, I don’t understand how to load this driver at startup.

I find it very strange that it works in CE5, but not in WM6, I just don’t know anything else that could cause problems.

Does anyone have any additional suggestions that you can try.

All help was appreciated.

+1
source share
2 answers

I am more familiar with Windows CE, but here are a few things:

  • Have you added debug printing to the DllMain function to see if it is called?
  • You checked the dependency break. Could it be that you have a Dll available under CE 5 that is not available in WM6?
+1
source

This is the answer, but not "correct." This is just a job around a download problem. I thought about it a week ago, but did not want to use it as a solution. So we hope this is just a temp fix.

The following code is used to load the driver manually; it is written in C # using C ++ calls. I use C #, so I made a C # project, not C ++. Those using C ++ will surely create this in a C ++ application.

public class LoadDriver { [DllImport("coredll.dll", SetLastError = true)] public extern static IntPtr ActivateDevice(string lpszDevKey, int dwClientInfo); [DllImport("coredll.dll", SetLastError = true)] public static extern void SignalStarted( uint dw); public static void Main(string[] args) { Cursor.Current = Cursors.Default; IntPtr handle = ActivateDevice("Drivers\\BuiltIn\\A36D_GPS_COM", 0); if(handle != IntPtr.Zero) { Console.Write("Success"); } if (args.Length > 0) { try { SignalStarted(uint.Parse(args[0])); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } } 

Now, for this to work, it needs to be started at startup, so I added the necessary registry keys.

 "HKEY_LOCAL_MACHINE/init" Launch62 = A36D_loaddriver.exe Depend62 = "32 00" 

"32 00" means that it loads after the shell32.exe file

Now, when the device starts up, the driver is activated in the device.exe file.

Regarding the issue of registration / registration, this is still being considered.

0
source

All Articles