Monir-SitesPower wrote:
> The setup program of my application is written in Delphi 5, the setup
> program will create a shared file, so some other programs (written by me
> using Delphi 5) will use that shared file.

The first thing to do is to no try to write your own installer. It's 
nothing personal, but you're probably going to do it wrong. There are 
installation tools out there that already know how to get everything 
right, including permissions and uninstallers. I recommend Inno Setup.

> In Vista, I run the setup as administrator (By manually check the related
> box in its properties) and it will create the shared file, and after that,
> when I write-click on the file to open its properties, I find the "Users"
> Group is missing, I found "Administrators" and "SYSTEM". 

You shouldn't have to change the file properties of your installer just 
to make it run as Administrator. The OS will usually detect that a 
program is an installer and prompt the user for the admin password 
automatically.

Regarding the file permissions, what directory did you create the file 
in? It should simply inherit the permissions of its containing folder.

> My question is how can I programmatically add a "Users" group to the shared
> file? So other users and programs on the same machine can read and change
> the shared file.

Your shared file should go in a program-specific subfolder of the 
Program Files\Common Files folder. The permissions on that folder 
shouldn't need to change since everyone already has access to that folder.

To find out exactly where that folder is on the target machine, use the 
ShGetFolderPath API function. I demonstrate how to call that in Delphi 
on my Web site:

http://www.cs.wisc.edu/~rkennedy/my-documents

Apparently, none of the links on that page work, so you can't get to the 
MSDN pages from there to fnd the list of CSIDL values. The one you need 
is CSIDL_PROGRAM_FILES_COMMON.

Of course, you already know how to use that function, or one like it, 
since that's how you're finding out where the Program Files folder is 
anyway, and what it's really named.

-- 
Rob
_______________________________________________
Delphi mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to