VMware Horizon Community
FelipeGarcia
Contributor
Contributor

Using SetfilesystemIsolation to set a folder isolation mode to merged does not work

Hi,

In  a thinapped application wherein the default isolation mode set in  Package.ini is WriteCopy, I am trying to dynamically set the isolation  mode of a folder to merged (in order to select the folder to output the  data in some computers in which the thinapped application is to be  deployed and which exhibit a different directory tree as the rest of the  computers).

In  order to do this I have used the API Function SetfilesystemIsolation in  a vbs script, using as a model an example that I found here or in a  similar forum. The Script is the following:

Dim DIRECTORY, objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")

DIRECTORY=GetEnvironmentVariable("MERGEDFOLDER")


Function OnFirstSandboxOwner

If Not objFSO.FolderExists (Directory) Then
   Directory = objFSO.CreateFolder (Directory)
End If

SetfilesystemIsolation Directory, 2

End Function

wherein  MERGEDFOLDER is an environment variable and the value 2 in  SetfilesystemIsolation corresponds to the merged mode. The CreateFolder  command merely creates the folder if it does not exist.

If  I use this script to set the IsolatioMode to Full by modifying the  script to include "SetfilesystemIsolation Directory, 3" instead of  "SetfilesystemIsolation Directory, 2", it works as expected and the  Folder is opened in full isolation mode. However, whenever I try to use  the merged isolation mode employing the same script with the value "2",  it simply does not work and it is opened as WriteCopy. I have tried with  different folders and in different computers without success.

Does anyone has an idea of what am I doing wrong?

Thank you very much in advance!

Kind regards,

Felipe

0 Kudos
6 Replies
FelipeGarcia
Contributor
Contributor

Hi,

Could someone please tell me whether they have successfully used SetfilesystemIsolation in a VBScript?

I would just like to know whether the problem described in the message starting this thread is a bug of Thinapp or a problem of the script I have written.

To specify in more detail in which manner the SetfilesystemIsolation command does not work for me when trying to set with it the isolation mode of a folder, the files created by the virtual application in this folder are visible in the physical environment, but with a zero byte size, and at the same time the files are correctly created in the virtual environment and can be seen in the corresponding folder within the sandox. Therefore, it appears that the command is having some effect in an otherwise "WriteCopy" set folder. However, not the expected effect.

Thank you very much for your help!

Felipe

0 Kudos
shrivastavaa
Enthusiast
Enthusiast

>>the files created by the virtual application in this folder are visible in the physical environment, but with a zero byte size, and at the same time the files are correctly created in the virtual environment and can be seen in the corresponding folder within the sandox. Therefore, it appears that the command is having some effect in an otherwise "WriteCopy" set folder. However, not the expected effect.

I have not see the SDK code yet; but based on your description;

If you can see the file created virtually in native/physical environment; than it means the isolation mode is merged; regarding seeing file size as zero; it could be a bug at our end (no confirmation though). What happen when you try to open that file from native/physical environment. I guess you should be able to open them. (FYI API which shows file information and API which opens them are different, so if there is a bug in the API which shows the file name and its size etc, you'll see wrong values but will be able to open that if same bug is not there in API to create/open file )

If you can open it; I would say that the command is having its effect but because of some bug; some where in ThinApp; you are not seeing correct size.

Thanks

Aditya

Ziegenfus
Contributor
Contributor

I am currently out of the office. I have limited email access and will get back to you as soon as possible.

Regards,

Stephen Ziegenfus

Systems Administrator

Balch & Bingham LLP

1901 Sixth Avenue North

Suite 1500

Birmingham, AL 35203

(205) 488-5401

www.balch.com

0 Kudos
FelipeGarcia
Contributor
Contributor

Thanks for the reply, Aditya.

This strange behaviour with the zero-size file creation in the native/physical environment must have been a particular problem of the project in the specific circumstances that it was at that time. I have not managed to reproduce it: not in a "clean" project, with nothing but the script (a capture without making any changes, and activating the virtual command window) and not even in the project wherein it happened (I have made several changes to it since then). I can say from the tests I made when it happened that the zero value files in the native/physical environment were indeed of zero value and I got an error when I tried to open them (the real copy with context was in the sandbox). What could have cause this behaviour is beyond my understanding. But anyway, I guess it does not matter since it was a problem in a very specific situation. Sorry to have raised this point of zero-size file creation here without having properly tested it in a clean project.

However, with the "clean" project, I do still have the problem that setting the folder isolation to merged does not work. The script works without a problem when I set the isolation to Full (3) and hides within the virtual environment all the documents in the corresponding folder of the physical environment, but it fails to work when I define the isolation as Merged (2) in a default WriteCopy project. I find it difficult to understand what mistake can be present in the script so that it works with one isolation mode and not with the other.

Anyway, this question is now only for getting to know whether I made a mistake or there was some bug or limitation that I could not change, since it was a rather puzzling behaviour which confused me and made me try all kind of crazy options to detect the error. But as I say, today I am done with the project and I am going on holidays, so I have decided to use an "adhoc" solution and set the merged files manually for the different possible situations and re-compiling the project. Neither elegant nor flexible, but it works, and it is something that needs to get done today.

Thanks again!

Felipe

0 Kudos
shrivastavaa
Enthusiast
Enthusiast

Per my understanding, if same code works for 1 isolation mode, it should work for another mode as well. If not than it *may* be a issue with us.

One thing I am not sure is, wheteher it is possible to reduce the isolation mode dynamically usng script. By reduce I mean read/write permission granted to a mode. Merged > WriteCopy > Full.

Can you try setting a folder isolation mode to writecopy (Using script); which initially is set to "Full isolation". Let me know if that works?

FelipeGarcia
Contributor
Contributor

First of all my apologies for the late reply, but I am on holiday and I have rarely access to the internet.

Thank you very much for your reply, Shrivastavaa. You were right: I have tried to set the isolation mode of a folder (initially set to Full) to Writecopy using a script, and the folder keeps being fully isolated and the folder and files existing in the native environment do not appear in the virtual environment. I guess it works in the same manner as when applications are linked, wherein the most restrictive isolation mode is selected.

However, i tend to believe this is a bug, because, besides greatly limiting the function of the script command SetfilesystemIsolation, it would simply make no sense to have the possibility to use a value of 2 corresponding to a merged mode with this command if it is supposed to work in the manner it currently does. By this I mean that if a "SetfilesystemIsolation Directory, 2" can be defined in a script for setting the isolation mode of a directory to merged, it should be possible to use it in a case wherein the directory was originally set to a more restrictive isolation mode (i.e. either full or writecopy). But with the present behaviour this is simply not possible. Furthermore, in the manual, the example provided when describing this command is precisely to set the temp folder to merged isolation mode and it is indicated that if this command is used in conjunction with an environment variable in order to define the directory, there is the danger that the user can abuse it in order to access to a folder which was originally intented to be in a restricted isolation mode.

In short, everything hints to the fact that even if the command works as you assume (thanks again for sharing this idea), this should not be the behaviour that the command has and should be considered a bug. Don't you agree?

P.S. I am the rest of August on holidays, so there can be some delay in my replies.

0 Kudos