[SOLVED] Virtual Directory Bug in 3.3.3.0 ?

Questions, Support, etc.

[SOLVED] Virtual Directory Bug in 3.3.3.0 ?

Postby nennenpow on Thu Jun 28, 2012 8:51 am

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
nennenpow
 
Posts: 2
Joined: Thu Jun 28, 2012 8:29 am

Re: Virtual Directory Bug in 3.3.3.0 ?

Postby Artem A. Razin on Thu Jun 28, 2012 10:21 am

Hello,

[quote="nennenpow"]
LoadAppToMemory(MyAppStream, "Q:\\test.exe");
LoadAppToMemory(MyAppStream, "Q:\\test.exe");

It shows error "Stream read error" in second time.
[/quote]

Is it possible to see in the Debugger, why / where the exception is thrown?

Also, what if to change CREATE_NEW to CREATE_ALWAYS?

Thank you.
Artem A. Razin
Site Admin
 
Posts: 749
Joined: Mon Jul 28, 2008 5:04 pm
Location: St.Petersburg, Russia

Re: Virtual Directory Bug in 3.3.3.0 ?

Postby nennenpow on Thu Jun 28, 2012 12:37 pm

Hello,

Thanks for reply!

After I change CREATE_NEW to CREATE_ALWAYS the problem is solved!
It is clear I used the wrong dwCreationDisposition... (Then I don't know why it raised no error when using actual path...)

Anyway, I still report you the exception line.

HandleStream->CopyFrom(AppStream,AppStream->Size);
And the only error message is "Stream read error"

Thank you so much!

Willy
nennenpow
 
Posts: 2
Joined: Thu Jun 28, 2012 8:29 am

Re: [SOLVED] Virtual Directory Bug in 3.3.3.0 ?

Postby Artem A. Razin on Fri Jun 29, 2012 8:39 am

Hello,

You're welcome :)

Thank you!
Artem A. Razin
Site Admin
 
Posts: 749
Joined: Mon Jul 28, 2008 5:04 pm
Location: St.Petersburg, Russia


Return to BoxedApp SDK

cron