Thanx in advance, yuval
> When I create a new file in winXP after logging in as the
> administrator, and then I re-login as a different user and
> try to update the file - the attempt fails.
As it should be. The admin owns the file. Noone else can alter the admin's
files.
> I am looking for a component (or source code) that would allow
> to change files properties that are under the "Security" category
If you create the file in code using the CreateFile() function, then you can
specify security rights for it. CreateFile() has an lpSecurityAttributes
parameter for that. Provide a SECURITY_ATTRIBUTES structure that contains a
SECURITY_DESCRIPTOR pointing to a NULL DACL. Then the file will be be
accessible to all users. For example:
SECURITY_DESCRIPTOR sd;
InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
SetSecurityDescriptorDacl(&sd, TRUE, NULL, FALSE);
SECURITY_ATTRIBUTES sa = {0};
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.lpSecurityDescriptor = &sd;
sa.bInheritHandle = FALSE;
HANDLE hFile = CreateFile(..., &sa, ...);
Gambit
Thanx again :)
"Remy Lebeau (TeamB)" <no....@no.spam.com> wrote in message
news:4491aa9d$3...@newsgroups.borland.com...
> So my question is actually whether winXP offers an equivalent way
> to do that from within the source code (update security attributes of
> an exiting file that was created by the Admin).
Look at the SetSecurityInfo() function. You would have to call it under the
context of the admin's account in order for the settings to be updatable.
Gambit