Hello,
I have Motorola_CoreScanner_Driver_(64bit)_v2.05.0004 and Motorola_Scanner_SDK_(64bit)_v2.04.0012 installed on my computer.
As you may know in Program Files\Motorola Scanner\Scanner SDK\Scanner SDK\Sample Applications\bin there are two SampleSDK applications, one written in C++ second in C# - issue applies to both of them.
consider a scenario:
- scanner is pluged in to USB port (mine is LS 2208)
- start ScannerSDK application ( no matter which one C++ or C#)
- press 'Discover Scanners' button
in the Log I get folowing output
1. OPEN SCANNERS - Command Success.
2. REGISTER_FOR_ALL_EVENTS - Command Success.
3. GET_SCANNERS - Command Failed. Error:103
when then (having application still running) I plug out the scanner and plug it in again it is detected and added to 'Select Scanner' combo box.
2 new entries come up in the Log:
4. Scanner Detached Event Fired
5. Scanner Attached Event Fired
Any consecutive click on 'Discover Scanners' button ends with:
6. OPEN SCANNERS - Command Failed. Error:200 (this one is understandable, as it is already open)
7. REGISTER_FOR_ALL_EVENTS - Command Success.
8. GET_SCANNERS - Command Failed. Error:103 (I always get error 103)
I installed 32bit version on my old 32bit laptop - same issue
After compiling SampleSDK app and quick round of debugging I found the issue lays in bolded line.
long CScannerCommands::cmdDiscover(BSTR * outXml,long *Status)
{
HRESULT hr = S_FALSE;
SHORT NumScan=0;
SAFEARRAY* pSA = NULL;
SAFEARRAYBOUND bound[1];
bound[0].lLbound = 0;
bound[0].cElements = 255;
pSA = SafeArrayCreate(VT_I2, 1, bound);
hr = ScannerInterface->GetScanners(&NumScan,pSA,outXml,Status);
////OutputDebugStringW(*outXml);
return hr;
}
GetScanners always returns 103 in Status.
According to CoreScanner developers guide 103 is described as Invalid buffer pointer ( ERROR_INVALID_BUFFER_POINTER).
Floowing this hint I changed VT_I2 in line pSA = SafeArrayCreate(VT_I2, 1, bound); to VT_I4, VT_I8, VT_INT with same result - always getting 103
I came to the conclusion that there might be a bug in ICoreScanner COM component.
Is there a solution or workaround to this issue?
I need to have GetScanners function working, forcing user of my app to plug out and in the scanner to make it detected is not an option.
Regards