PDA

View Full Version : Path to ProgramMenuFolder?



dgbach
10-20-2003, 02:39 PM
Standard 7.04.
I am trying to get the path to the ProgramMenuFolder for "All Users" but keep getting the path to the logged on user.
A GetMSIProperty of ALLUSERS shows its value as 2.

The FOLDER_PROGRAMS always has the value:
C:\Documents and Settings\dbach\Start Menu\Programs\
when I would expect it to have a value of:
C:\Documents and Settings\All Users\Start Menu\Programs\

After an install, shortcuts are always installed to
C:\Documents and Settings\All Users\Start Menu\Programs\
So it seems something odd is going on.


ALSO ----
I created a simple project using the project wizard with the following script code:

Dlg_SdCustomerInformation:
szMsg = "";
szTitle = "";
nResult = SdCustomerInformation( szTitle, szName, szCompany, nUser );
szDir = ProgramMenuFolder;
if (nResult = BACK) goto Dlg_SdLicense;

Regardless of what is selected on the dialog, the szDir isalways
C:\Documents and Settings\dbach\Start Menu\Programs\
but again, it installs shortcuts to:
C:\Documents and Settings\All Users\Start Menu\Programs\

-Dennis

huntant
10-23-2003, 08:36 AM
With ALLUSERS=2 you will only get the users path if they do not have administrative priviledges. Otherwise you will always get the "All Users" path.



Anthony

dgbach
10-23-2003, 10:06 AM
Thanks for your reply.

Actually, dbach is an administrator on the machine running the install, which is why the shortcuts do get installed into the "all users" path. And that is the issue, ALLUSERS is 2 so with the logon user having admin priviliges and the shortcuts getting installed into "all users", why would the property return the "dbach" path. :confused:

-Dennis

huntant
10-23-2003, 11:08 AM
Since FOLDER_PROGRAMS is an InstallScript property, you need to call the function ProgDefGroupType() to tell the engine which one you want.
The shortcuts are being creating in the "All Users" folder because they are probably using the windows installer property (ProgramMenuFolder).



Anthony

dgbach
10-23-2003, 03:05 PM
Thanks again. That let me specify which group to put them in.
But, I still don't see the "all users" path in the ProgramMenuFoler.
I tried the following:

if (Is (USER_ADMINISTRATOR, szDir) = TRUE) then
// it takes this path
ProgDefGroupType (COMMON);
else
ProgDefGroupType (PERSONAL);
endif;
// I get the 'dbach' path instead of the "All Users"
szDir = ProgramMenuFolder^SHELL_OBJECT_FOLDER;
// Same here
nvSize = 256;
nResult = MsiGetProperty (ISMSI_HANDLE, "ProgramMenuFolder", svName, nvSize);

It seems that ProgramMenuFolder/svName should indicate the "all users" path.:confused:

- Dennis

dgbach
10-23-2003, 03:35 PM
Got it.
The value of ProgramMenuFolder is always set to the 'user' path regarldess of the value of ALLUSERS, unless ALLUSERS is explicitly set in the properties table to a 2. If it is not set in the properties table calling MsiSetProperty(hMSI,"ALLUSERS","2") succeeds as does the MsiGetProperty. It just that this use of MsiSet doesn't do anything to affect the value of ProgramMenuFolder.

Granted the help does say it needs to be defined for what I had been doing to work. However, I was getting the value using MsiGet and I was able to set it with MsiSetProperty. So ... to me, that meant it was defined.

Thanks!

- Dennis