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
- :
- Location for common data under Vista
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
‎Aug 29, 2007
03:53 PM
Location for common data under Vista
Hi,
in our software, we have a configuration file that is per-machine i.e. we want all the potential users to see the same file and potentially edit it (a monitor utility, that run on behalf the user, can also change it ). Before Vista, the file was located with the program (under Program Files). With Vista, we want to move it elsewhere (as the install creates the file as system and thus is read-only for the user). We used the FOLDER_COMMON_APPDATA directory but we seem to encounter some problem as it is a hidden directory. In the Win 32 API, there seems to be a special path CSIDL_COMMON_DOCUMENTS that should do the trick, but it is not available within InstallScript or the components.
Am I missing something or is there another way to achieve this so the file can be read/write for all users under Vista.
thanks
in our software, we have a configuration file that is per-machine i.e. we want all the potential users to see the same file and potentially edit it (a monitor utility, that run on behalf the user, can also change it ). Before Vista, the file was located with the program (under Program Files). With Vista, we want to move it elsewhere (as the install creates the file as system and thus is read-only for the user). We used the FOLDER_COMMON_APPDATA directory but we seem to encounter some problem as it is a hidden directory. In the Win 32 API, there seems to be a special path CSIDL_COMMON_DOCUMENTS that should do the trick, but it is not available within InstallScript or the components.
Am I missing something or is there another way to achieve this so the file can be read/write for all users under Vista.
thanks
(5) Replies
‎Aug 30, 2007
09:34 AM
CommonAppData corresponds to the folder C:\ProgramData on Vista machines.
CSIDL_COMMON_DOCUMENTS is a path not provided by default. But I believe if you search on this forum, you will find sufficient information to get it working in your installation.
CSIDL_COMMON_DOCUMENTS is a path not provided by default. But I believe if you search on this forum, you will find sufficient information to get it working in your installation.
‎Sep 03, 2007
10:54 PM
I also encountered this issue, and solved it by writing a custom action in C
// Installer helper file
//
// MSI custom actions
// GetCommonDocs: sets MSI property to the value returned by SHGetFolderPath(CSIDL_COMMON_DOCUMENTS)
#include "stdafx.h"
#include
#include "stdtypes.h"
#include
#include "drsetup.h"
#include
#include
#include
#include
#include
char szPath[256], svName[256];
CString messageString, titleString;
void __stdcall GetCommonDocs(MSIHANDLE hWnd)
{
UINT retcode;
if(SUCCEEDED(SHGetFolderPath(NULL,
CSIDL_COMMON_DOCUMENTS|CSIDL_FLAG_CREATE,
NULL,
0,
szPath)))
{
// MessageBox(NULL, szPath, "GetFolder", MB_OK|MB_TASKMODAL);
retcode = MsiSetProperty (hWnd, "COMMON_DOCUMENTS", szPath);
// if ( MsiSetProperty (hWnd, "COMMON_DOCUMENTS", szPath) != ERROR_SUCCESS )
// {
// MessageBox(NULL, "Problem calling MsiSetProperty()", "GetFolder", MB_OK|MB_TASKMODAL);
// }
if (retcode == ERROR_FUNCTION_FAILED )
MessageBox(NULL, "MsiSetProperty() - The function failed.", "GetFolder", MB_OK|MB_TASKMODAL);
if (retcode == ERROR_INVALID_HANDLE )
MessageBox(NULL, "MsiSetProperty() - An invalid or inactive handle was supplied.", "GetFolder", MB_OK|MB_TASKMODAL);
if (retcode == ERROR_FUNCTION_FAILED )
MessageBox(NULL, "MsiSetProperty() - An invalid parameter was passed to the function", "GetFolder", MB_OK|MB_TASKMODAL);
}
else
{
MessageBox(NULL, "ShGetFolderPath Failed", "GetFolder", MB_OK|MB_TASKMODAL);
}
}
// Installer helper file
//
// MSI custom actions
// GetCommonDocs: sets MSI property to the value returned by SHGetFolderPath(CSIDL_COMMON_DOCUMENTS)
#include "stdafx.h"
#include
#include "stdtypes.h"
#include
#include "drsetup.h"
#include
#include
#include
#include
#include
char szPath[256], svName[256];
CString messageString, titleString;
void __stdcall GetCommonDocs(MSIHANDLE hWnd)
{
UINT retcode;
if(SUCCEEDED(SHGetFolderPath(NULL,
CSIDL_COMMON_DOCUMENTS|CSIDL_FLAG_CREATE,
NULL,
0,
szPath)))
{
// MessageBox(NULL, szPath, "GetFolder", MB_OK|MB_TASKMODAL);
retcode = MsiSetProperty (hWnd, "COMMON_DOCUMENTS", szPath);
// if ( MsiSetProperty (hWnd, "COMMON_DOCUMENTS", szPath) != ERROR_SUCCESS )
// {
// MessageBox(NULL, "Problem calling MsiSetProperty()", "GetFolder", MB_OK|MB_TASKMODAL);
// }
if (retcode == ERROR_FUNCTION_FAILED )
MessageBox(NULL, "MsiSetProperty() - The function failed.", "GetFolder", MB_OK|MB_TASKMODAL);
if (retcode == ERROR_INVALID_HANDLE )
MessageBox(NULL, "MsiSetProperty() - An invalid or inactive handle was supplied.", "GetFolder", MB_OK|MB_TASKMODAL);
if (retcode == ERROR_FUNCTION_FAILED )
MessageBox(NULL, "MsiSetProperty() - An invalid parameter was passed to the function", "GetFolder", MB_OK|MB_TASKMODAL);
}
else
{
MessageBox(NULL, "ShGetFolderPath Failed", "GetFolder", MB_OK|MB_TASKMODAL);
}
}
‎Sep 04, 2007
03:11 AM
jlabrie wrote:
Hi,
in our software, we have a configuration file that is per-machine i.e. we want all the potential users to see the same file and potentially edit it (a monitor utility, that run on behalf the user, can also change it ). Before Vista, the file was located with the program (under Program Files). With Vista, we want to move it elsewhere (as the install creates the file as system and thus is read-only for the user). We used the FOLDER_COMMON_APPDATA directory but we seem to encounter some problem as it is a hidden directory. In the Win 32 API, there seems to be a special path CSIDL_COMMON_DOCUMENTS that should do the trick, but it is not available within InstallScript or the components.
Am I missing something or is there another way to achieve this so the file can be read/write for all users under Vista.
thanks
We have the same issue with our software and we used a subfolder named COMPANYNAME under FOLDER_COMMON_APPDATA.
The folder is hidden indeed, but for the case the user needs to access it, we have a shortcut under Start -> All programs -> Program Shortcuts folder. So far it's working great, and I think it's the correct way to go.
Why is it a problem that the folder is hidden, other that the users cannot find it (if they do not have "show hidden files" checked in folder options) ?
‎Sep 04, 2007
01:01 PM
dandraka wrote:
We have the same issue with our software and we used a subfolder named COMPANYNAME under FOLDER_COMMON_APPDATA.
The folder is hidden indeed, but for the case the user needs to access it, we have a shortcut under Start -> All programs -> Program Shortcuts folder. So far it's working great, and I think it's the correct way to go.
Why is it a problem that the folder is hidden, other that the users cannot find it (if they do not have "show hidden files" checked in folder options) ?
We have encountered a situation where we had a problem with the file that is copied there. After an uninstall/reinstall, the file was not copied there for some reason. But, we also have some output files generated at that location where a shortcut is not ideal (the user must find it with the Explorer)