Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA COM, NI-SRM not recognised by GRM

Hi,
I know NI-VISA 2.6 setup program also installs VISA COM components. But I think the setup program does not correctly register the NiVisaCom.DLL on the registry. The Global Resource Manager does not recogrise the NI Vendor-specific Resource Maneger because VendorSpecificRMs key under the VISA.GlobalRM registry entry is not created as is. Is this a bug of the setup program? Invoking DllRegisterServer of NiVisaCom.DLL again can fix the problem though.

Also I have found that a call to LockRsrc() method of NISerial coclass from VC++ app causes an access violation. The cause of this I think is that the implementation of LockRsrc() difinitely misunderstands the [out,retval] BSTR* requestedKey parameter as if [in,out]. Therefore
the component is requesting the BSTR initialized prior to call, but the #import-generated wrapper VisaCom.tli (or GlobMgr.tli) does not initialize this parameter prior to call. Therefore a garbage BSTR value can be passed to the [out,retval] parameter. This has normally no problem, but the LockRsrc() does not fill any value on this parameter as 'out' operation when the given BSTR is invalid, so that the _bstr_t(_result) destructor fails into access violation with such as SysFreeString(0xcccccccc). I don't know if other I/O components such as NIGpib has the same problem.

// Wrapper of smart pointer in .TLI file
inline _bstr_t IVisaSession::LockRsrc (
enum AccessMode type,
long lockTimeout,
_bstr_t requestedKey )
{
BSTR _result;
HRESULT _hr = raw_LockRsrc(type, lockTimeout, requestedKey, &_result);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
return _bstr_t(_result, false);
}

Thanks
Makoto Kondo
0 Kudos
Message 1 of 3
(3,611 Views)
Sorry the parameter in problem is 'pAccessKey' and not 'requestedKey', at the last [out,retval] BSTR* in LockRsrc().

Makoto
0 Kudos
Message 2 of 3
(3,611 Views)
Makoto:

Both of these behaviors are bugs in NI-VISA 2.6 and will be fixed in the next NI-VISA release. Since you have valid workarounds for both, we will not be issuing a patch in the meantime.

By the way, the BSTR output problem should never occur for a Visual Basic user or a C++ user who uses CComBstr.

Dan Mondrik
Senior Software Engineer, NI-VISA
National Instruments
0 Kudos
Message 3 of 3
(3,611 Views)