07-24-2014 02:34 PM
It is a curiosity question from a client.
Is it possible to extract a VI from an executable which has debug mode enabled?
Since the block diagram would not be in edit mode.... Is it possible to "peer" into the executable, look at a VI and recover the block diagram? This owuld be for a deleted VI that is part of an executable which had debug mode enabled..
Did anyone try this?
Curious..
07-24-2014 03:09 PM
Which LV version?
07-24-2014 03:41 PM
8.2.1 or 2013
There are 2 situations.
07-24-2014 05:03 PM
Quick test suggests that you can at least look at the block diagram, if it was built with support for debugging. Make sure the INI file is set to allow debugging (DebugServerEnabled=True). Open the version of LabVIEW used to build the application. From the Operate menu, choose "Debug Application or Shared Library..." If LabVIEW is running on the same machine as the application, it will likely pre-fill your application as an option. Connect, then hit Control-E to get the block digram. Worked for me, anyway, under LabVIEW 2012. You probably can't copy/paste elements of the diagram but you can get a screenshot and recreate it.
07-24-2014 05:04 PM
07-25-2014 12:33 PM
Thanks guys,
That's what I had explained to the client. He was hoping to be able to recover the entire code instead of having to recreate it from an image...
It's a shame we cannot save the debug block diagram image as a .png and simply import it into a block diagram and recover the original code.
I guess if debug enabled was selected, then it would be ok for "others" to view or rebuild the code...
This could be a new feature.. 🙂
07-25-2014 03:00 PM
Yes, it is possible. The front panels and the block diagrams are embedded in the .exe; and they can be extracted.
The method of extraction is different for different versions of LV. Prior to LV8, you could simply rename the .exe as a .llb and open it. In LV 2013 it's a bit more complicated.
07-28-2014 03:13 PM
Thanks Paul,
You are right... I forgot that trick. I think the last time I did that was LV7.1. 😮
Can you share how it is done in the more recent versions?
Cheers,
RayR
07-29-2014 08:11 AM
Extract VIs from an EXE? No problem. Even if debugging isn't enabled you can extract VIs, they just won't have block diagrams, and may not have front panels depending on if they were removed in the EXE making process.
Attached is an example project for making an EXE, the EXE itself, and a VI for extracting VIs from the EXE. The code is quite primative and it was just meant to demonstrate how this can be done.
To extract the Main.vi from the Application.exe, run Extract Main.vi from EXE.vi, provide the path to the EXE and the path to where the VI should be saved and then run the VI. This VI will set keys in the INI file for the application, then run th EXE. Then it opens an application reference to the EXE, then opens a VI reference to Main.vi. Then it aborts Main.vi, and extracts it.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
07-29-2014 11:37 AM - edited 07-29-2014 11:38 AM
Thanks Hooovahh,
The client is trying to retrieve the original code; hence the block diagram.
I'll have to try your application. 🙂
Cheers!
RayR