Problem embedded exe to run like Engima Virtual Box or BoxedApp Packer??

68 views
Skip to first unread message

Jens Eckervogt

unread,
Nov 24, 2016, 5:08:13 PM11/24/16
to Haxe
Hello guys,

I would like to know about embedded data.zip into executable like any Converter or Embedding application or Application Virtualization.

I have packed SimpleOpenGLView into data.zip:
SimpleOpenGLView.exe
manifest
assets/openfl.png

And I try with Haxe cpp into exe.

package;

import cpp.Lib;
import haxe.Resource;
import haxe.io.Bytes;
import haxe.io.BytesInput;
import haxe.zip.Reader;
import haxe.zip.Entry;
import sys.io.Process;

/**
 * ...
 * @author Jens Eckervogt
 */

class Main
{
   
   
static function main()
   
{
       
var bytes = haxe.Resource.getBytes("DataZip");
        trace
(bytes.getString(0, bytes.length));
       
// Run exe from embedded data.zip
       
var bytesInput = new BytesInput(bytes);
       
var reader = new Reader(bytesInput);
       
var entries:List<Entry> = reader.read();
       
//trace(entries.toString());
       
       
//Listing to SimpleOpenGLView.exe
       
var embeddedExeFromDataZip = "SimpleOpenGLView.exe";
       
for(entry in entries)
       
{
           
var filename = entry.fileName;
           
switch (entry.fileName)
           
{
               
case "SimpleOpenGLView.exe":
                   
var p = new Process(entry.fileName, []);
                    trace
("exitcode: " + p.exitCode());
                   
                    p
.close();
           
}
       
}
   
}
}

And i add -resource assets/data.zip@DataZip

and compile it and try it:
Output:
But it doesn't open SimpleOpenGLView from embedded zip

Main.hx:21: PK♥♦¶ <- Just test if bytes into string = OK!
Error : Process creation failure : SimpleOpenGLView.exe <- Oh no it doesn't support for application virtualization :(

Error message: Process creation failure doesn't know embedded executable from exe

How do I fix like real alternative of BoxedApp Packer or Engima Virtual Box?

Because I want build own program like Virtual Box or Packer

Thanks for answer

JLM

unread,
Nov 25, 2016, 4:36:25 AM11/25/16
to Haxe
I don't think that this is currently supported.... but....

Not exactly what you want but have you considered Cppia, it's like a string version of haxe cpp code, you can compile haxe to cppia really quickly and you can then run the code inside a haxe hxcpp shell. ( I am sure you could zip the script if you wanted ).

cpp.cppia.Host.runFile('data.cppia');

You can find a tutorials in the Haxe Cookbook

http://code.haxe.org/category/other/working-with-cppia/


It's fairly easy to load and run scripts, especially if your using NME since it's also a project of Hugh, for instance take a look at Acadnme, which is a hxcpp shell that includes NME main engine which you can install on your phone.
 https://github.com/nmehost/acadnme

and then you can compile your application code to cppia on your computer and telll it to upload to your phone directly.

'N' below represent the digits found on the Android Acadnme(v1.0) app top left corner.

haxelib run nme cppia --deploy=NNN.NNN.NNN.NNN


Obviously your limited to phones you can do the same stuff on your desktop. Compile and upload to device typically takes a couple of seconds and suspect some form of zip is used as it's all pretty fast.

Reply all
Reply to author
Forward
0 new messages