cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Peter_Kosenko
Level 7

Get Group name from standard Security ID?

I need an InstallScript equivalent of the following function for getting the language-specific "User" group NAME from it's standard windows Security Identifier (S-1-5-32-545).

I need to implement it in InstallScript in a software installer. The problem is that depending on than language of the operating system, the name of the "Users" group can be different.

The company does not want to fork the installations to full language editions, since we don't have enough customers in each. However, if we can make small modifications (like permissions in the language of the operating system here), we can get by.

Anyone of any help? Has anyone seen such a thing? What DLL would be called to engage the functionality? Does the function etNameFromSID() even exist outside of C Sharp?

string GetNameFromSID( SecurityIdentifier sid )

{

NTAccount ntAccount = (NTAccount)sid.Translate( typeof( NTAccount ) );

return ntAccount.ToString();

}

.
Labels (1)
0 Kudos
(3) Replies
Peter_Kosenko
Level 7

Here is the Windows API function that is needed. I was having trouble finding it on the Microsoft site, but eventually (with the help of someone else at work), it turned up:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa379166%28v=vs.85%29.aspx
0 Kudos
Peter_Kosenko
Level 7

Unfortunately, I cannot prototype the necessary windows API functions successfully in InstallScript. They don't work. Two are required, plus a struct. Installshield seems to be inadquate to the task of implementing the Windows API in this instance. As someone else pointed out, it does not understand string pointers.

prototype BOOL Advapi32.LookupAccountSidA(POINTER, POINTER, POINTER, POINTER, POINTER, POINTER, POINTER);
prototype BOOL Advapi32.ConvertStringSidToSidA(POINTER,POINTER);
And the second function’s second parameter is a pointer to a SID structure.
0 Kudos
Peter_Kosenko
Level 7

Has anyone actually implemented any code successfully with these functions?
0 Kudos