Hi all,
Currently I use boxedapp without source code within version 3.3.30 in C++ Builder XE2
I use the below simple function to load my application into memory and run.
void __fastcall TForm4::LoadAppToMemory(TStream* AppStream, String TargetAppPath){
THandle MyHandle ;
THandleStream * HandleStream;
MyHandle = BoxedAppSDK_CreateVirtualFile(TargetAppPath.w_str(), GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, 0, 0);
HandleStream = new THandleStream(MyHandle);
AppStream->Position = 0;
HandleStream->CopyFrom(AppStream,AppStream->Size);
delete HandleStream;
CloseHandle((void *)MyHandle);
WinExec(AnsiString(TargetAppPath).c_str(), SW_SHOW);
}
And how I use the function is like follow :
LoadAppToMemory(MyAppStream, DirPath + AppName);
LoadAppToMemory(MyAppStream, DirPath + AppName);
My problem is:
if DirPath is an actual path like "C:\\", it works well
if DirPath is a virtual path like "Q:\\" and I use different AppName, it works well, too.
But when DirPath is a virtual path and I use the same AppName, for example:
LoadAppToMemory(MyAppStream, "Q:\\test.exe");
LoadAppToMemory(MyAppStream, "Q:\\test.exe");
It shows error "Stream read error" in second time.
I have tried to create a virtual folder at advance like BoxedAppSDK_CreateVirtualDirectory(VirtualFolder.w_str(),NULL) but still meet the same problem.
Any help will be appreciated.
Thanks,
Willy
