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?
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.
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.. 🙂
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.
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?
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.
The client is trying to retrieve the original code; hence the block diagram.
I'll have to try your application. 🙂