$ALLAPPDATA$ does not equal %ALLUSERSPROFILE% in Windows XP

Got a problem you cannot solve? Try here.
Post Reply
Ristogod
Posts: 15
Joined: Wed May 15, 2013 2:13 pm

$ALLAPPDATA$ does not equal %ALLUSERSPROFILE% in Windows XP

Post by Ristogod »

I have this issue where I am using IA to place a database file in the $ALLAPPDATA$ location. My application uses the Windows Environment variable %ALLUSERSPROFILE% to find this same location at runtime. This works great in Vista/7 and above. However in Windows XP the locations do not match and therefore my application cannot find the database file.

$ALLAPPDATA$ evaluates to C:\Documents and Settings\All Users\Application Data
%ALLUSERSPROFILE% evaluates to C:\Documents and Settings\All Users

How do I get these values to be the same through the installer?
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: $ALLAPPDATA$ does not equal %ALLUSERSPROFILE% in Windows

Post by FrancescoT »

Dear User,

The default value of AllUsersProfile environment variable depends on the operating system.
In Windows XP the default value of AllUsersProfile environment variable is C:\Documents and Settings\All Users, while on Windows Vista & Windows 7 it is C:\ProgramData.

On Windows Vista & Windows 7 "ALLAPPDATA" belongs to "ProgramData" as well (while on Windows XP is a sub-folder of C:\Documents and Settings\All Users).

Unfortunately, there isn't too much to do.

I may suggest you to store the Path location (...using the way that you prefer) during your package installation and then, to acquire it with your application at runtime.

Of course, this will require to update your application behavior.

Regards.
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Ristogod
Posts: 15
Joined: Wed May 15, 2013 2:13 pm

Re: $ALLAPPDATA$ does not equal %ALLUSERSPROFILE% in Windows

Post by Ristogod »

But that is exactly my point. You are stating that IA should be resolving ALLAPPDATA to C:\Documents and Settings\All Users, instead what we are seeing while trialing this software is that it is resolving to C:\Documents and Settings\All Users\Application Data. It is adding that extra folder name Application Data, which is unexpected. So it's not even doing what you say it should be doing.

This is not an XP vs. Vista/7 issue. It's an issue of variables not returning the expected values.
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: $ALLAPPDATA$ does not equal %ALLUSERSPROFILE% in Windows

Post by FrancescoT »

Dear User,

No, I said the opposite;

"On Windows Vista & Windows 7 "ALLAPPDATA" belongs to "ProgramData" as well (while on Windows XP is a sub-folder of C:\Documents and Settings\All Users)."

So it means; ... on Win XP ALLAPPDATA will be resolved as " C:\Documents and Settings\All Users\Application Data"

The above behavior is caused by the differences that exist with Vista or higher OSes to handle common folder locations.
Please refer to ShellApi documentation for more details;
http://msdn.microsoft.com/en-us/library ... s.85).aspx

I may also suggest to have a look at (... where an user have posted your same question);
http://stackoverflow.com/questions/1902 ... users-path


Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Ristogod
Posts: 15
Joined: Wed May 15, 2013 2:13 pm

Re: $ALLAPPDATA$ does not equal %ALLUSERSPROFILE% in Windows

Post by Ristogod »

You keep stating that on XP ALLAPPDATA resolves to C:\Documents and Settings\All Users. Yet when I run the installer, it instead dumps the contents to C:\Documents and Settings\All Users\Application Data. Those aren't the same locations. Why does it put stuff in the Application Data folder within?

On Windows 7 it doesn't add another folder called Application Data into the ALLAPPDATA location. If it did it would be C:\ProgramData\Application Data.

All I'm saying is that your ALLAPPDATA variable matches the Windows Environment variable %ALLUSERSPROFILE% exactly on Windows 7, but differs on Windows XP. I would expect them both to match.

Again, this is not a XP vs Windows 7 issue. I realize that each OS has it's own values. Which is why I depend on the variables and why I would hope that ALLAPPDATA and ALLUSERSPROFILE would match equally when used on the same OS.
Ristogod
Posts: 15
Joined: Wed May 15, 2013 2:13 pm

Re: $ALLAPPDATA$ does not equal %ALLUSERSPROFILE% in Windows

Post by Ristogod »

Here is another person having the same issue:

http://www.experts-exchange.com/OS/Micr ... 62190.html

This further demonstrates my point. It also raises a question as to whether or not IA will change the ALLAPPDATA location based on the language? If I am using French, will IA resolve ALLAPPDATA to C:\Documents and Settings\All Users\Application Data(en Francais)\ on Windows XP?
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: $ALLAPPDATA$ does not equal %ALLUSERSPROFILE% in Windows

Post by FrancescoT »

Dear User,

I try to repeat what I said because seems that I am not able to be clear enough.

I DID NOT SAY THAT on XP ALLAPPDATA resolves to C:\Documents and Settings\All Users

BUT INSTEAD I SAID THAT on XP ALLAPPDATA resolves to C:\Documents and Settings\All Users\Application Data

The "ALLAPPDATA" variable that IA creates when you add the system folder "Application Data Directory", it is the value returned by the SHELL API function passing the "CSIDL_COMMON_APPDATA" flag. This has nothing to do with the Windows Environment variable %ALLUSERSPROFILE%, but the SHELL API function uses internally the value of %ALLUSERSPROFILE% to format out the returned value.

In order to finally repeat once again, this Microsoft Function resolves the path returned for the "CSIDL_COMMON_APPDATA" as follow;

ON WIN XP = C:\Documents and Settings\All Users\Application Data
ON WIN 7 = C:\ProgramData

The above SHELL Folder Paths are language independent and the returned values are the real folder names.
The ones displayed in Explorer are only localized names (... aliases) of the real System Path.
For more details please refer to MSDN documentation.

"You can see the "real" names by opening up the cmd prompt and running dir /a within your profile directory."

Anyway, these folders are localized to the target OS when displayed by the "Destination" dialog if uses the Shell Tree control.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Post Reply