Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

NTFS Security


1 reply to this topic

sgeoghegan

sgeoghegan
  • Members
  • 1 posts

Posted 10 January 2002 - 18:20

How can I set Global read/write access to the <INSTALLDIR> as aprt of the installation process.

The I have found the following for InstallShield 6, how is this done in the windows installer?

//  FUNCTION:   NTFS_Fix  
//
//  Called From: OnFirstUIAfter
//
//  Purpose:    Called only on Windows 2000 (though I don't see why it wouldn't work
//on Windows NT) to fix default NTFS permissions problem on Windows 2000.
//In this example, the target directory permissions are set to
//Full for Everyone.
//
//
//We use Windows 2000 (and Windows NT) built-in command
//cacls for adding the proper permissions.  The command
//for adding User Modify (and thus Write) permissions for
//all files and subdirectories in the TARGETDIR (and the
//TARGETDIR itself) are:
//
//cacls TARGETDIR /T /E /G Users:C
//
//Full access rights for everyone would be:
//
//cacls TARGETDIR /T /E /G Everyone:F
//
//To get this to execute, we have to wrap all this up in an
//NT/Win2000 cmd entry, i.e.
//
//WINSYSDIR ^ cmd.exe /c <string above>
//
//IMPORTANT: Put TARGETDIR in quotes
//
//Note: We don't need to test for whether the
//directory is NTFS or not -- it runs without error
//on FAT directories (though it doesn't do anything)
//
//TBD: Test for FAT32 and see that it works there,
//too.
//
///////////////////////////////////////////////////////////////////////////////

function NTFS_Fix()
STRING szCmd, szCmdArgs;
begin
// if(SYSINFO.WINNT.bWin2000) then // only on Windows 2000  
   szCmd = WINSYSDIR ^ "cmd.exe";
   szCmdArgs = "/c cacls \"" + TARGETDIR + "\" /T /E /G Everyone:F";

   LaunchAppAndWait(szCmd, szCmdArgs, WAIT);
   // Note: Actually, I use a variation of the wonderful HideAppAndWait()
   //  code on InstallSite (<www.installsite.org>) instead of LaunchAppAndWait(),
   //  so I can check and see that the return code is 0.  I use LaunchAppAndWait()
   //  here for wider compatibility.
   //  
   // PS  Thank you Stefan Krueger for all your help!  We InstallShield
   //     developers are in your debt!!!

end;


Leigh Ravenhall

Leigh Ravenhall
  • Members
  • 269 posts

Posted 10 January 2002 - 23:42

Have a look at the LockPermissions table in the MSI help library.