This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Which one to use LOCALAPPDATA or shfolder.dll?
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Jul 23, 2009
04:20 PM
Which one to use LOCALAPPDATA or shfolder.dll?
Hi,
In my IS MSI project, I need to resolve the current user's profile folder on Vista (and later), such as "C:\Users\user_id\".
I have been using MSI property 'USERPROFILE' and it works until today it failed in another Vista system - it's a big surprise to me though, I thought it should be consistent and persistent among all Vista systems.
Then I did a little bit more research and two of the tried alternatives are working for me:
1) MSI 'LOCALAPPDATA' property, it's simple to call (same as what I did to 'USERPROFILE'), just like
MsiGetProperty (ISMSI_HANDLE ,"LOCALAPPDATA",sDir,nResult);
2) ShFolder.dll, it's also simple enough
UseDLL("shfolder.dll");
SHFolder.SHGetFolderPathA(NULL, CSIDL_PROFILE, NULL, 0, sDir);
UnUseDLL("shfolder.dll");
Can anybody elaborate the differences between the above two? Is one more reliable than the other?
Thanks,
PB
In my IS MSI project, I need to resolve the current user's profile folder on Vista (and later), such as "C:\Users\user_id\".
I have been using MSI property 'USERPROFILE' and it works until today it failed in another Vista system - it's a big surprise to me though, I thought it should be consistent and persistent among all Vista systems.
Then I did a little bit more research and two of the tried alternatives are working for me:
1) MSI 'LOCALAPPDATA' property, it's simple to call (same as what I did to 'USERPROFILE'), just like
MsiGetProperty (ISMSI_HANDLE ,"LOCALAPPDATA",sDir,nResult);
2) ShFolder.dll, it's also simple enough
UseDLL("shfolder.dll");
SHFolder.SHGetFolderPathA(NULL, CSIDL_PROFILE, NULL, 0, sDir);
UnUseDLL("shfolder.dll");
Can anybody elaborate the differences between the above two? Is one more reliable than the other?
Thanks,
PB
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Jul 23, 2009
06:43 PM
Correction:
MsiGetProperty (ISMSI_HANDLE ,"LOCALAPPDATA",sDir,nResult);
actually didn't work! I mistakenly used the same string variable (sDir) with the dll call and put this call after the dll call, so it still contains the value set from the dll call.
So the dll way is the only one I can use now, the only cost is that I have to include ShFolder.dll into my package.
Thanks,
PB
MsiGetProperty (ISMSI_HANDLE ,"LOCALAPPDATA",sDir,nResult);
actually didn't work! I mistakenly used the same string variable (sDir) with the dll call and put this call after the dll call, so it still contains the value set from the dll call.
So the dll way is the only one I can use now, the only cost is that I have to include ShFolder.dll into my package.
Thanks,
PB