PDA

View Full Version : file permission with CACLS



gomathy
03-12-2008, 01:39 AM
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.

nikhilgupta
03-12-2008, 05:43 AM
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.

gomathy
03-12-2008, 06:02 AM
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.

nikhilgupta
03-12-2008, 06:13 AM
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.

alphacz
03-12-2008, 04:43 PM
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.

gomathy
03-13-2008, 06:01 AM
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:

HBindu
03-13-2008, 10:29 AM
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;