(This is a corrected post of the prev same post)
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] B
STR* pAccessKey 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