
ecallin1.5524912994140198E12 asked a question.
AddFolderIcon for all users with MSI
Hello,
I've been rewriting an old isntallscript installer into a new MSI and have run into an issue with Icons. We build the start menu shortcuts to go to
the standard location using the Shortcuts View (C:\ProgramData\Microsoft\Windows\Start Menu\Programs\My Company\My Folder\)
And then we use AddFolderIcon to create a folder icon that links to the above path but so that we can assign an icon and the user can click on the icon and go into a folder that lists our applications for that area.
The problem I am running into on Windows 8 specefically and probably 7 as well is that when you run it as a MSI you get an access denied error when it tries to write the folder to the common desktop (C:\users\Public\Desktop) but if I launch the setup.exe with elevate privledges the desktop folder creates properly.
Has anyone come across this or have any suggestions?
I could create the Desktop Icons using the Shortcuts View as well but I have not figured out a way to add a icon to the folders that are built which is required.
Thanks
RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);
RegDBGetKeyValueEx ( "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", "Common Desktop", nvType, svCommonDesktopFolder, nvSize );
szItemName = DESKTOP_SMS;
szCommandLine = ProgramMenuFolder ^ "My Company" ^ "My Folder";
szIconPath = ProgramFilesFolder ^ "My Files\\SMS1.ico";
LongPathToQuote (szCommandLine, TRUE);
// Add the shortcut to the desktop.
nResult = AddFolderIcon (svCommonDesktopFolder, szItemName, szCommandLine, szWorkingDir, szIconPath, nIcon, szShortCutKey, nFlag);
svError = FormatMessage(nResult);
MessageBox(svError,0);