LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA is generated INF that can't be installed in Win10

Nobody blames Microsoft just as you can’t blame NI for the fact that enhanced security measures in modern OS’ make their 25 years ago developed VISA USB RAW access a pain in your ass for you. In order to get the necessary certifications that allow governments and universities around the world to even install Windows on their machines, they had to ramp up the security model of their OS. 
If you really want someone blamed you should look at the oscilloscope manufacturer, for choosing a proprietary USB communication protocol to communicate with their T&M device instead of USB TMC, which exists about as long as the VISA USB RAW interface.

When developing a proprietary USB protocol device you also should provide a documented user space DLL interface to the device driver which can be interfaced with according DLL interfaces such as the Call Library Node in LabVIEW. They thought to be smart and use VISA USB RAW, which at that time may have looked indeed very promising.

- Single driver development for supporting LabVIEW on Windows, Mac and Linux.

- Just publish the protocol documentation and let the community do that development work.

- As it’s a community project it’s their task to do maintenance.

- etc.

 

Then came the reality that requires device drivers nowadays to be signed. NI can’t sign them for you as that is against the whole idea of having to sign a binary executable file to proof it was created by the person or entity who signed it.

 

Yes the INF file is not really a binary but it's technically a device driver nevertheless since it claims a hardware resource.

 

“But the oscilloscope software still can communicate with the device!” That’s because it uses its own device driver that is of course properly signed. And LabVIEW could use that too:

+ if the manufacturer had documented the user space DLL interface to it

+ if someone would have developed a VI library using Call Library Nodes to interface to that DLL.

 

The entire USB driver stack is different for these two approaches. The only common thing between them on the PC side is the actual USB connector and controller chip itself.

Rolf Kalbermatter
My Blog
0 Kudos
Message 21 of 34
(396 Views)

As I have already said several times, I have documentation from the manufacturer, it is SCPI standard.
With Windows 7 you can use the example from NI "USB-RAW" to write the commands from the documentation and get the expected answers.
But under Windows 10 Labview does not find the visa resource without installing the .inf file which is dreated by the NI VISA Wizzard.
However, as far as I can see, this does not specify any drivers to be install, and one wonders why NI goes this way to recognize a device

[Version]
Signature=$WINDOWS NT$
Class=visaUsbDevice
ClassGUID={A3330EDF-239D-4206-833B-1D58952613D5}
Provider=%Vendor0%
DriverVer=03/15/2024,1.0.0.0
CatalogFile=hds242.cat

[DestinationDirs]

[SourceDisksNames]

[SourceDisksFiles]

;===========================================================================
; Class Installer
;===========================================================================

[ClassInstall32]
AddReg=AddClass_AddReg

[AddClass_AddReg]
HKR,,,0,%DeviceClassString%
HKR,,Icon,,"-20"

;===========================================================================

[Manufacturer]
%Vendor1%=USBList,NTx86,NTamd64

[USBList.NTx86]
%USB\VID_5345&PID_1234.DeviceDesc%=WinUsb_Inst, USB\VID_5345&PID_1234

[USBList.NTamd64]
%USB\VID_5345&PID_1234.DeviceDesc%=WinUsb_Inst, USB\VID_5345&PID_1234

[WinUsb_Inst]
Include = winusb.inf
Needs = WINUSB.NT

[WinUsb_Inst.hw]
AddReg=WinUsb_Inst_HW_AddReg

[WinUsb_Inst.Services]
Addservice = WinUsb, 0x00000002, WinUsb_AddService

[WinUsb_AddService]
DisplayName = %WinUsb_Service_DisplayName%
ServiceType = %SERVICE_KERNEL_DRIVER%
StartType = %SERVICE_DEMAND_START%
ErrorControl = %SERVICE_ERROR_NORMAL%
ServiceBinary = %12%\WinUSB.sys

[WinUsb_Inst_HW_AddReg]
HKR,,DeviceInterfaceGUIDs, 0x10000,"{761ED34A-CCFA-416b-94BB-33486DB1F5D5}"

[Strings]
Vendor0="oscilloscope"
Vendor1="oscilloscope"
USB\VID_5345&PID_1234.DeviceDesc="oscilloscope"
DeviceClassString="NI-VISA USB Devices"
WinUsb_Service_DisplayName="WinUSB Driver"

SERVICE_BOOT_START = 0x0
SERVICE_SYSTEM_START = 0x1
SERVICE_AUTO_START = 0x2
SERVICE_DEMAND_START = 0x3
SERVICE_DISABLED = 0x4

SERVICE_KERNEL_DRIVER = 0x1
SERVICE_ERROR_IGNORE = 0x0
SERVICE_ERROR_NORMAL = 0x1
SERVICE_ERROR_SEVERE = 0x2
SERVICE_ERROR_CRITICAL = 0x3

0 Kudos
Message 22 of 34
(378 Views)

And as I said several times too, you need to sign the driver (INF file) in order to be able to install it. VISA (and LabVIEW) can't see hardware for which the according driver has not been installed in Windows. And Windows won't install a driver that is not signed. And no VISA can NOT interface to the proprietary driver that the software from the manufacturer uses as it has absolutely no idea about the software interface that driver provides.

 

It's not NI that goes this way to recognize a device. It is Microsoft Windows that does it. In order for a device driver to be installable in Windows, there needs to be an INF file that describes the Manufacturer and Device IDs of the device and which device drivers it should use. VISA installs its own USB RAW device drivers which are indeed signed, otherwise Windows would never let the NI installer install those device drivers, but that is only the protocol filter handler that does the translation between the USB low level OS driver and NI VISA.

Your INF file is a device driver too as far as Windows is concerned, as it specifies that any device with a specific VID and PID should be installed as NI VISA device and should be connected with the VISA provided filter device driver. The fact that the VISA filter driver is signed and installed does not preclude the according INF file from having to be signed too, since it does alter the OS device driver stack to connect some specific hardware with some specific device driver, altering the kernel environment of Windows. NI did not decide that device drivers need to be signed for modern Windows versions. At the time they developed the VISA USB RAW method, nobody was even considering that device driver signing ever will be a possibility, let alone be an unavoidable fact of life. If they had known that this will be required at some point, they would for sure have abandoned the idea of implementing VISA USB RAW right at that point!

 

That's the reality and you can jump high and low and claim that NI should make it work differently but they can't and won't! If they will do anything at all about it, it is to remove the USB RAW capability in the near future from VISA, since it simply has gotten unsupportable with modern OS developments.

 

If you want your VISA USB RAW driver to work without having to sign it, you need to stay with Windows 7. It is as simple as that. It's the increased security of Windows 8 and 10 that makes this required, and there is simply nothing NI could do about it to make it go away for you.

Rolf Kalbermatter
My Blog
0 Kudos
Message 23 of 34
(371 Views)

This is also the next problem, there are numerous instructions on how to sign a driver with a personal test certificate. Unfortunately, these reports are not up-to-date enough if they are older than a year, because the method no longer works or because the tools are no longer so easy to download, if you then look for tools on mysterious sites, this does no service to security, by the time you have tested them you are days older.
So here we go again, even if it still doesn't arrive this time. There is the NI VISA Wizzard, instead of referring to cumbersome outdated descriptions, why doesn't the Wizzard do this work, you could take a test certificate for personal use or refer to one that you have ordered, just as an idea, why does the Wizzard exist?

0 Kudos
Message 24 of 34
(364 Views)

@lutz1410 wrote:

 

There is the NI VISA Wizzard, instead of referring to cumbersome outdated descriptions, why doesn't the Wizzard do this work, you could take a test certificate for personal use or refer to one that you have ordered, just as an idea, why does the Wizzard exist?


You already answered that question yourself. By the time the wizard would be released with these methods, they would be outdated and not work anymore!

 

When the wizard was originally released, these things all were not an issue, since drivers couldn't even be signed even if you wanted to. Later they could be signed but it was not required. Then they needed to be signed but the tools were proprietary. They were available for download through installing Windows SDKs and such, but NI can't just take Microsoft software and add them at will to their own products. Every single file and executable they want to use in such a way needs a proper license agreement with Microsoft, where umpteen lawyers need to have their piss over it, and by the time everything is finally agreed and signed, the tool is already outdated or even obsoleted.

 

Even if you created such a tool, and made it available on your own servers together with the according executables from Microsoft without a proper license agreement with Microsoft, you are in fact violating Microsoft copyright. It's not likely that Microsoft would care or even get to know about it in your case, but NI does not have that luxury of being under the radar of Microsoft lawyers. And to make matters even more interesting, there are jurisdictions such as in Germany, where any lawyer can send out a letter to anyone they feel is violating copyright or trademark and similar and request them to pay lots of money to them for their trouble to search for such violations and write an invoice and send it to them. Microsoft would not even get anything in these cases, despite the lawyer claiming to work in the interest of Microsoft.

Rolf Kalbermatter
My Blog
0 Kudos
Message 25 of 34
(357 Views)

Now that I was able to create a private certificate and have the .inf and corresponding .cat file signed, I thought everything would work now.
Unfortunately there is an error message when installing the .inf file "a problem occurred while adding the driver to memory"
Does anyone know what the problem is again

0 Kudos
Message 26 of 34
(289 Views)

Did you add the self signed certificate to your Windows certificate store?

Simply signing a device driver is not enough, Windows needs to be able to verify the chain of trust to a known root certificate. By installing your own certificate in the certificate store you make it your own personal root certificate.

 

But that is soon not enough. Microsoft wants all device drivers to need to be counter signed by their DevCenter. That means you will have to first sign it with a real certificate and not just a normal one but an Extended Validation certificate that costs easily double of a normal one, run the entire driver through their driver test suite and then submit the signed driver with the test report to them after which they counter sign it and then send it back to you. If you ever change anything on that Inf file you can do it all over again.

Rolf Kalbermatter
My Blog
0 Kudos
Message 27 of 34
(278 Views)

you ask if I have loaded the certificate to the store, my understanding otherwise the signtool.exe does not work, because I have specified the path from the store there, I have saved it in the "privatCertStor", I wanted to save it first in the computer account instead of in the user account, but the signtool did not accept that, but maybe I made mistakes, I tried it umpteen times.
It then worked directly in the user account.

Or are you talking about something else that I have overlooked?


Microsoft's measures to make the OS more stable are praiseworthy and good. It also makes sense for the commercial distribution of measuring devices and the associated drivers.
But what about small laboratories that have automated their measuring device and now have to work with Windows 10 or people who tinker with something privately and create a driver to try something out. There must be a backdoor for this so that the OS displays the driver as unsigned but then accepts it. Because great ideas start small and then it becomes a business and you can also pay for certificates.
If ideas are nipped in the bud now, the future doesn't look good. If Bill Gates had been given these hurdles in his garage to develop his first OS, there would be no Microsoft today

Fortunately, you can still choose the virtual com port for your own developments

 

0 Kudos
Message 28 of 34
(268 Views)

@lutz1410 wrote:

 

If ideas are nipped in the bud now, the future doesn't look good. If Bill Gates had been given these hurdles in his garage to develop his first OS, there would be no Microsoft today


He also didn’t have internet to easily find every possible information at a key press of the still to be invented Windows computer. And this same internet makes your computer a target under continuous attack. 

Every advantage also has its disadvantage(s).

 

And no, signtool refers to certificates in your personal certificate store to sign the driver or executable with, but your personal certificate store is not where Windows looks for root certificates! That would be very stupid to do as root certificates have a completely different function than your personal ones.

 

You may even have to convert your certificate first. The one in your personal store contains both the public and private cryptography key. Root certificates are supposed to only contain the public key. Not quite sure you can import your PFX certificate just like that into the root certificate store.

Rolf Kalbermatter
My Blog
0 Kudos
Message 29 of 34
(248 Views)

what does this line mean?
c:\tmp\x64\signtool sign /debug /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /v /s PrivateCertStore /n contoso.com(test) "mydriver.cat"

because the command derived from the NI knowledge base does not work
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YH1PCAW&l=de-DE
c:\MSWDK\x64\signtool sign /f C:\Temp\ContosoTest.cer C:\Temp\mydriver.cat

I then get this message
C:\TEMP>c:\MSWDK\x64\signtool sign /f C:\Temp\ContosoTest.cer C:\Temp\mydriver.cat
SignTool Error: No file digest algorithm specified. Please specify the digest algorithm with the /fd flag. Using /fd SHA256 is recommended and more secure than SHA1. Calling signtool with /fd sha1 is equivalent to the previous behavior. In order to select the hash algorithm used in the signing certificate's signature, use the /fd certHash option.

after a lot of searching I executed the above command and got thhis message

The following certificates were considered:
Issued to: Contoso.com(Test)
Issued by: Contoso.com(Test)
Expires: Sun Jan 01 00:59:59 2040
SHA1 hash: 6B488F30737BA62FCB4B0705FBFC9B06B48157D9

After EKU filter, 1 certs were left.
After expiry filter, 1 certs were left.
After Subject Name filter, 1 certs were left.
After Private Key filter, 1 certs were left.
The following certificate was selected:
Issued to: Contoso.com(Test)
Issued by: Contoso.com(Test)
Expires: Sun Jan 01 00:59:59 2040
SHA1 hash: 6B488F30737BA62FCB4B0705FBFC9B06B48157D9

Done Adding Additional Store
Successfully signed: mydriver.cat

Number of files successfully Signed: 1
Number of warnings: 0
Number of errors: 0


that means it is signed or not, when I look at the certificates with MMC.exe on my computer, it is installed, double-click on the certificate and select the storage location
If this is wrong I would be happy if someone tells me what is wrong and where I can find info on how to do it right, that my assumptions are stupid doesn't help much

0 Kudos
Message 30 of 34
(239 Views)