cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gomathy
Level 3

file permission with CACLS

Hi,

I am new to installshield. I need to give modify permission to a file in installshield. I tried modifying the permissions in the installshield, but it replaces the existing permissions with the new one. I need to add the modify permissions to the users.

Can anyone help me out to solve this issue?

Thanks in advance.
Gomathy.
Labels (1)
0 Kudos
(6) Replies
nikhilgupta
Level 5

create a custom action to launch cacls command
cacls DirName /E /G Username:F
the /E switch edits the permisson instead of replacing. For more help type cacls at command prompt.
0 Kudos
gomathy
Level 3

Hi,

Thanks for ur suggestion. I know the syntax of CACLS command. But I donno how to include it in the custom action. Which option to choose when i run custom action wizard in installshield.

Gomathy.
0 Kudos
nikhilgupta
Level 5

create a custom action of type exe with path stored in property. Create a property in property manager which has following value.
cacls DirName /E .... etc.
In the custom action specify this property.
0 Kudos
alphacz
Level 5

Make sure your customers are using the NTFS file system; using cacls in a custom action on a FAT32 partition will cause an install failure (obviously). Just one minor issue we hit.
0 Kudos
gomathy
Level 3

Hi,

I have created the property and the custom action. But how can i specify my file name in the command.
My command is
"CACLS C:\Program Files\Application\1.txt /E /G BUILTIN\Users:C"
The installation path could be anything.. the file is placed during installation. How can I specify the file name here?
:confused:
0 Kudos
HBindu
Level 3

You can create a InsallScript Function and execute it through a custom action.

function AddFolderPermissions(hMSI)
STRING szCommandLine;
NUMBER nvSize;
STRING svDir,svExtranetDir;
NUMBER nvResult;

#define PROGRAM WINSYSDIR^"CACLS "

begin
try
//Get InstallDir
nvSize = 256;
nvResult = MsiGetProperty(hMSI, "INSTALLDIR", svDir, nvSize);
svExtranetDir = svDir ^ "TBExtranet";

szCommandLine = "\"" + svExtranetDir + "\" /T /E /G \"TheBooks_WEBUsers\":F";
if (LaunchAppAndWait (PROGRAM,szCommandLine, LAAW_OPTION_MINIMIZED) < 0) then
MessageBox ("Unable to launch cacls program: " + szCommandLine,SEVERE);
endif;

catch
MessageBox("Exception: AddFolderPermissions(hMSI), " + Err.Description + Err.Number, SEVERE);
abort;
endcatch;
end;
0 Kudos