setup-1.7 defaults to "Just me"

Brian Dessent brian@dessent.net
Wed Apr 16 04:53:00 GMT 2008


Corinna Vinschen wrote:

> I just found that, regardless of my privileges, setup-1.7 defaults
> to install for "just me" instead of "all users" while the standard
> setup defaults to "all users".  Why does that happen?

This is very odd.  Setup's is_admin() was returning 0 despite the user
belonging to the administrators group, and debugging revealed that the
cause was the following:

 // Get the group token information
 UCHAR token_info[1024];
 PTOKEN_GROUPS groups = (PTOKEN_GROUPS) token_info;
 DWORD token_info_len = sizeof (token_info);
 status =
   GetTokenInformation (token, TokenGroups, token_info, token_info_len,
			 &token_info_len);
 CloseHandle (token);
 if (!status)
   return 0;

For whatever reason, GetTokenInformation was failing and returning
ERROR_NOACCESS when passed a 1024 byte buffer.  I changed the code to
first call it with NULL to get the desired size, and that seems to have
satisfied it.  I cannot explain why it would object to a 1024 byte
buffer, maybe you have some idea.

I'll install an updated setup-1.7.exe in a moment.

Brian



More information about the Cygwin-apps mailing list