Driver for Bulk cam

Apr 1, 2009 at 12:54 PM
Hi there,

We're trying to modify the driver for our own device that uses Bulk as transfer mode. Unfortunately we are not able to connect the device properly without filling in the MessageBox "Unidentified USB Device". We're using WinCE 6 on a FreeScale board.

For auto-connect we added the additional Registry keys so it loads the "webcam.dll" on connect. Now the "DllMain" and the "USBDeviceAttach" entry functions are called like it is been done after filling the MessageBox. Only this time the "ActivateDevice" function (in "USBDeviceAttach") doesn't return a handle but it returns with "NULL" and "GetLastError" told us that the last error was "1" or "ERROR_INVALID_FUNCTION". Only difference now is that the "USBInstallDriver" isn't called at first, because this is only initiated by the MessageBox, but this shouldn't be the problem while this function only adds Registry keys that we already added staticly.

These are the keys we added staticly:

"Drivers\\USB\\LoadClients\\Default\\Default\\14\\Video_Class" - DLL: webcam.dll
"Drivers\\USB\\ClientDrivers\\Video_Class"                               - DLL: webcam.dll
                                                                                                 - Prefix: CAM

We also tried all sorts of casing for "DLL" and "webcam.dll".

Can anyone tell us what could be the difference between connecting automaticcally or with the MessageBox (pop-up window)?

Thanks,

 Luuk

Apr 1, 2009 at 1:58 PM
Oops...solved it by putting the right string as Prefix. It looked like we added "CAM" but actually we added "CAM    ",  padded with invisible characters because we wrote too many bytes during "RegSetValueExW" function. The following call did work for us:

rc = RegSetValueExW( hKeyNewHID,   // Handle to open key
                        TEXT("Prefix"),                // Name of value
                        0,                                    // reserved
                        REG_SZ,                         // Type (string)
                        (BYTE *)TEXT("CAM"),        // DLL name
                        7                     // size in bytes (including the 0 terminating character of 1 byte)
                        );