Start menu entries have insufficient rights in Windows 7 RC

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
nursoda
Junior Member
Junior Member
Posts: 8
Joined: 2003-02-06, 16:01 UTC
Location: Emmendingen, Germany

Start menu entries have insufficient rights in Windows 7 RC

Post by *nursoda »

Install TC7.5b5 on newly installed W7RC as default (admin) user an add another user to W7RC (doesn't matter whether admin or not). Log in as that new user and check start menu: no "Total Commander" entry visible.

It has been created in "C:\users\<default user>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs" but should be created in "C:\ProgramData\Microsoft\Windows\Start Menu\Programs" instead (for "all users", which should be independent of the setting where shall be INI is saved).

Additionaly, the rights assigned to the "Total Commander" start menu directory are NOT inherited to the three symlinks it contains. So even if one manually moves the start menu directory to the "all users" equivalent of W7 one still has to adapt the symlinks' rights.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48107
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

The TC installer creates Explorer shortcuts via DDE (dynamic data exchange). I have no influence on where the Explorer creates these shortcuts.
Author of Total Commander
https://www.ghisler.com
User avatar
nursoda
Junior Member
Junior Member
Posts: 8
Joined: 2003-02-06, 16:01 UTC
Location: Emmendingen, Germany

Post by *nursoda »

I understand but Links are created in a way users cannot use them.
I think you should check MSDN and use the API designated, at least for W7.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48107
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Unfortunately there seems to be no way to find out the logged-in user from the installer when the installer is started as a different user. Therefore the installer cannot install the links this way in the user's start menu, only in the menu for all users - but that may be not what the user wants.
Author of Total Commander
https://www.ghisler.com
CoolWater
Power Member
Power Member
Posts: 737
Joined: 2003-03-27, 16:33 UTC

Post by *CoolWater »

ghisler(Author) wrote:Unfortunately there seems to be no way to find out the logged-in user from the installer when the installer is started as a different user. Therefore the installer cannot install the links this way in the user's start menu, only in the menu for all users - but that may be not what the user wants.
There is a way to find the logged-in user, at least for windows xp or higher: Get the username for the process explorer.exe:

c++ sample:

Code: Select all

// includes
#include <wtsapi32.h>
#include <psapi.h>

// libs needed or use GetProcAddress():
//   Psapi.lib
//   Wtsapi32.lib

	PWTS_PROCESS_INFO pProcessInfo;
	DWORD ProcessCount = 0;
	
	if (WTSEnumerateProcesses(WTS_CURRENT_SERVER_HANDLE, 0, 1, &pProcessInfo, &ProcessCount))
	{
		for (DWORD CurrentProcess = 0; CurrentProcess < ProcessCount; CurrentProcess++)
		{
			if (stricmp(pProcessInfo[CurrentProcess].pProcessName, "explorer.exe") == 0 &&
				 pProcessInfo[CurrentProcess].pUserSid != NULL)
			{
				SID_NAME_USE snu;
				char szUser[_MAX_PATH];
				DWORD chUser = _MAX_PATH;
				PDWORD pcchUser = &chUser; 
				char szDomain[_MAX_PATH];
				DWORD chDomain = _MAX_PATH;
				PDWORD pcchDomain = &chDomain;
				
				if (::LookupAccountSid(NULL, pProcessInfo[CurrentProcess].pUserSid, szUser, pcchUser, szDomain, pcchDomain, &snu))
				{
					printf("%s\n", szUser);
				}
				else
				{
					printf("Unknown\n");
				}
			}
		}
	}
HTH,
CoolWater
User avatar
karlchen
Power Member
Power Member
Posts: 4603
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Hello, nursoda. Hello, Christian.

Issue:
Startmenu items created inside "%userprofile%\start menu\programs" instead of "%allusersprofile%\start menu\programs".

I can confirm the issue exists. And I can also confirm that the source of the issue seems to be inside Windows itself, because I can reproduce the issue when installing Total Commander, IrfanView and other programmes.

Relevant factor:
The installing user account has not got full administrator privileges.
This will be the case on Vista, Windows7, Server2008 if e.g. an admin user launches the setup without elevated rights.
This will be the case on Windows XP if a power user launches the setup.

Kind regards,
Karl
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48107
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2CoolWater
That looks very promising, thanks! I'm considering to combine the dialogs for start menu items and desktop icon into one dialog, e.g. like this:

Create icons:
[x] in the start menu
[x] on the desktop

(*) Just for this user [username ]
( ) For all users of this system

And the [username ] field could be changed by the user.

What do you think?
Author of Total Commander
https://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48107
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I can confirm the problem with Windows 7. The installer will therefore no longer use DDE in the next version to create the start menu icons.
Author of Total Commander
https://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48107
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

The TC 7.5 installer fixes this problem. Since I didn't get any similar reports, I will move this to "fixed bugs" now.
Author of Total Commander
https://www.ghisler.com
Post Reply