LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
VGA_CD-ROM

Get LabVIEW RTE version of an already-built EXE

Status: New

As part of a review of a shipping product, I want to make sure that all of our LabVIEW-built executables are using the same version of LabVIEW so that we also only have to ship one version of the LabVIEW Run-Time Engine. Everyone I've talked to has given me advice on things to change at export time, build time, or even run-time to know the version of LabVIEW it was built in (e.g. the App.Version property), but what if I want to know the version of an EXE I have already built?

Here are the methods I've tried so far:
1. I created a set of VIs that does it crudely by reading the EXE file in as if it were a text file, finding mention of lvrt.dll, and then scanning back a few hundred bytes to try and find a version X.Y token in there. (Of course this could be done in any language, not just LV). This solution can be automated for my product release's review process, but it would be prone to failure if the EXE format changes or my assumptions aren't correct. I wrapped the solution in one that searches our installation directories for all EXEs and returns all LV EXEs with versions (as they are detected here) and all non-LV EXEs so I can verify that my tool is not giving false negatives on LabVIEW-based executables.

Parse EXE as text for Version

 

(See attached .zip file for my LV implementation)


2. Run the EXE on a machine with no LV RTE and read the version from the error popup that you get when it launches. Obviously this requires user interaction, and requires launching the executable.
3. Install all LV RTE versions you think the EXE most likely requires. If it launches without incident and stays in memory, you can use Process Explorer to figure out what libraries it has loaded and see which version of LV RTE was called (since the lvrt.dll will be under "<NISHARREDDIR>\LabVIEW Run-Time\<Version>"). Obviously this isn't easily automated either, and requires launching the executable.
4. I tried using Dependency Walker to see what lvrt.dll dependency was found, but it didn't show me anything useful. I'm guessing it's dynamically loaded somehow, and DepWalker can't tell me?

What I'd really like are two things:
1. An LV Invoke Method like "Get VI Version" and "Get VI Editor Version" that works on built applications -- "Get App Version" with the same types of inputs and outputs as (file path input, string version output and U32 version output). An added output to determine platform and/or bitness would be nice, too.

2. An LV RTE property that tells me the Run-Time version in the file's properties. I could potentially automate checking of this via .NET calls or something like that

GetAppVersion.png

 

Embed_LVRTE_Version_into_EXE.png

7 Comments
VGA_CD-ROM
Active Participant

The image about searching through the EXE file as a string got reduced too small and I can't edit it.. reposting it here, although it's kind of obvious what I'm doing.

 

Thanks,

Vijay

 

Parse_EXE_for_LVRTE_Version2.png

 

 

Active Participant

Why not use the function they ship with LV (and mysteriously refuse to expose in the palettes)?

 

http://digital.ni.com/public.nsf/allkb/935BA7FB426305398625711E0055F1FA?OpenDocument

VGA_CD-ROM
Active Participant

I'm trying to find out the EXE's LabVIEW RTE version, not the EXE's FileVersion.

Hooovahh
Proven Zealot

I agree with this idea, and thought it might be a duplicate but can't find it at the moment.  Another way I have found that works a little better (but not much), is to extract the EXE using 7-zip, navigate to the EXE\.rsrc\RCDATA\ folder and look at the files that are small (less then 1kb).  One of them will be the version of LabVIEW it was built with as text.  This likely doesn't work for all LabVIEW built EXEs just recent ones (likely 2009 and newer)

 

There could be a bootstrap like EXE written in a different language, that looks into the file, determines what version it uses, then looks at the system and understands what versions are installed, and then prompt the user if it is not able to run the LabVIEW EXE, or run it if it can.

MarcoMauri
Active Participant

Hi, good idea!

As a side note: to find out the Labview version using Dependency Walker you need to profile the exe since the DLL is dynamically loaded.

 

Marco

freemason
Active Participant

VGA,

can you attach your .zip of LV implementation

VGA_CD-ROM
Active Participant

Sorry, I forgot to do that. I don't know how to attach them now, so the best I could come up with was taking the most basic part of the implementation and expanding each subVI, and turning that result into an LV 2012 code snippet. I'm sure there's a better way, though. Ignore the missing subVI popups when you load it, obviously, and turn each box below into the subVI that it replaces...

Find_EXE_LV_Version.png