PDA

View Full Version : Setting Users permissions



GIANGI
11-02-2005, 12:26 PM
I'm using Installshield 11.
I need to set permission for the data folders of my setup.
I would like to enable all users to have full controls on the folders created with my setup.
I have tried to use "Permissions" windows setting the group "users" and setting "full control" for this group.
Using the name "Users" is Ok for English language of Windows but on other languages it doesn't work (for example in german version) because some languages doesn't have the group "users".
And if I use a wrong name the setup fails so I can't use a gropu name that I presume could not exist (for example use "users" and "benutzer" because if exists "users" doesn't exist "benutzer").
Any suggestion?

MichaelHlavinka
11-02-2005, 12:28 PM
I have similar requirement. I use a C++ custom action to determine the name of the "Users" group on the system based on the SID.

trevrobwhite
11-03-2005, 08:27 AM
Have you tried setting 'everyone' in the Permissions table, that's what I currently do.

Alternatively there is a good bit on InstallScript code in installsite where you can run GrantFullAccess on a directory or part of the registry.

GIANGI
11-03-2005, 08:31 AM
Thanks. I'm trying both ways. I'm creating a function in a c++ function and I have read about "Everyone" that is recognized in all languages.

trevrobwhite
11-03-2005, 08:37 AM
Is there any chance you would be willing to post such a executable should you get around to doing one, as I would find it most useful.

Thanks.

MichaelHlavinka
11-14-2005, 11:16 AM
This code will set a private property "LocalizedUsersGroup" to the localized name of the Users group in a DLL custom action function:


//
// Set the LocalizedUsersGroup property to the name of the BUILTIN
// Users group S-1-5-32-545.
SID_IDENTIFIER_AUTHORITY SIDAuthNT = SECURITY_NT_AUTHORITY;
PSID pUsersSid;
BOOL bSuccess = AllocateAndInitializeSid(&SIDAuthNT, 2,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_USERS, 0, 0, 0, 0, 0, 0,
&pUsersSid);
if (!bSuccess)
return ERROR_INSTALL_FAILURE;

std::basic_string<TCHAR> strName(1, _T('\0')), strReferencedDomainName(1, _T('\0'));
DWORD cbName = 0, cbReferencedDomainName = 0;
SID_NAME_USE eUse;
LookupAccountSid(NULL, pUsersSid, &strName[0], &cbName,
&strReferencedDomainName[0],
&cbReferencedDomainName, &eUse);
strName.resize(cbName++);
strReferencedDomainName.resize(cbName++);
bSuccess = LookupAccountSid(NULL, pUsersSid, &strName[0],
&cbName,
&strReferencedDomainName[0],
&cbReferencedDomainName, &eUse);
FreeSid(pUsersSid);
if (!bSuccess)
return ERROR_INSTALL_FAILURE;
MsiSetProperty(hInstall, _T("LocalizedUsersGroup"), strName.c_str());

Hope this helps. Sorry if the formatting turns out poor.

GIANGI
11-14-2005, 11:22 AM
Thanks to everyone.