From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to extract a VI from an executable which has debug mode enabled?

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..

 

0 Kudos
Message 1 of 10
(5,636 Views)

Which LV version?

0 Kudos
Message 2 of 10
(5,622 Views)

8.2.1 or 2013

 

There are 2 situations.

0 Kudos
Message 3 of 10
(5,608 Views)

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.

Message 4 of 10
(5,579 Views)
Before LV12 is pretty easy, I have not tried LV12 or later. I know it is different, I just do not know if it is a little or a lot different.
0 Kudos
Message 5 of 10
(5,577 Views)

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..  🙂

 

0 Kudos
Message 6 of 10
(5,532 Views)

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.

"If you weren't supposed to push it, it wouldn't be a button."
Message 7 of 10
(5,506 Views)

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

0 Kudos
Message 8 of 10
(5,450 Views)

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.

Message 9 of 10
(5,421 Views)

Thanks Hooovahh,

 

The client is trying to retrieve the original code; hence the block diagram.

I'll have to try your application.  🙂

 

Cheers!

 

RayR

0 Kudos
Message 10 of 10
(5,397 Views)