PDA

View Full Version : CSIDL_COMMON_APPDATA vs CSIDL_COMMON_DOCUMENTS



NewsArchive
05-11-2007, 08:39 AM
What are the pros and cons of one or the other for storing my common data.

A while back I made the decision to us _DOCUMENTS but perhaps I should
reconsider.

Lynn Howard
www.linkedsoftware.com

NewsArchive
05-11-2007, 08:43 AM
Hi Lynn,

Here is an interesting SetupBuilder related posting on the Microsoft MSDN
forum:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1213890&SiteID=1

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 6
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
05-12-2007, 04:21 AM
Thanks Friedrich!

Very interesting and a nice plug for SetupBuilder by Matt.

It seems my old way (C:\myprogram) would work with Vista but would not be
Vista Certified. I take it that I would get a warning each time the program
is run but not a complete show stopper. Is this correct?

I plan to use _Common_Documents because the folder is visible as opposed to
_Common_AppData. Am I correct here? That is Matt's solution.

All very confusing but thank goodness for SetupBuilder!

Lynn

NewsArchive
05-12-2007, 04:21 AM
I read the referenced article as well.

I thought I knew what I was doing yesterday but today I'm not so sure!

Mike

NewsArchive
05-12-2007, 04:22 AM
> I thought I knew what I was doing yesterday but today I'm not so sure!

Welcome to Vista!


Here is my take on it all:

You have to decide if the user needs DIRECT access to the data or not.

If it is a spreadsheet (or something like that where the user needs to be
able to use a File Dialog to browse to and open the file), then you do NOT
want to put it in CSIDL_COMMON_APPDATA. In a case like that, then
CSIDL_Common_Documents would be a better choice.



CSIDL_COMMON_APPDATA is a "hidden" folder and there is no way a user can
map to it without turning on the show hidden files option.



If the data is to be accessed by YOUR PROGRAM, then CSIDL_COMMON_APPDATA is
a great place (and the right one) to put it because it prevents casual
browsing and direct interaction with the data by the user.


Does that make sense?


Charles


--
-------------------------------------------------------------------------------------------------------
Charles Edmonds

www.clarionproseries.com - "Serious imaging tools for Clarion Developers"
www.ezround.com - "Round Corner HTML tables with matching Banners, Buttons
and Forms!"
www.lansrad.com - "Intelligent Solutions for Universal Problems"
www.fotokiss.com - "World's Best Auction Photo Editor"
-------------------------------------------------------------------------------------------------------

NewsArchive
05-12-2007, 04:22 AM
Thanks Charles.

So _Documents is more like what we are used to and _AppData gives you
protection from users playing with the data.

I'm not sure I want the extra protection because from time to time (in a
support call for example) I ask them to manipulate the data. _Documents
would make that easier.

I am leaning toward _Documents. Am I exposing myself to a new can of worms?

Still scratching my head.

Lynn Howard

NewsArchive
05-12-2007, 04:22 AM
> So _Documents is more like what we are used to and _AppData gives you
> protection from users playing with the data.

That's how I understand it.


> I'm not sure I want the extra protection because from time to time (in a
> support call for example) I ask them to manipulate the data. _Documents
> would make that easier.
>
> I am leaning toward _Documents. Am I exposing myself to a new can of worms?

LOL - only Microsoft knows for sure and they are not telling!<g>

_Documents (on XP) maps to:

C:\Documents and Settings\All Users\Documents

This is the folder where you see:

Shared Music
Shared Video
Shared Pictures

If you create a new folder there called MyApp, then right-click on it and
select Sharing and Security, then you can go to the Sharing tab and check
the box that says "Share this folder on the network" and "Allow users to
change my files".

Then if you go to another PC on the lan and open Internet Explorer you can
enter \\machine_name and you will see "MyApp" in the shared assets.

Access to the folder works perfectly (at least from what I can see here).


Good luck!

;-)

Charles


--
-------------------------------------------------------------------------------------------------------
Charles Edmonds

www.clarionproseries.com - "Serious imaging tools for Clarion Developers"
www.ezround.com - "Round Corner HTML tables with matching Banners, Buttons
and Forms!"
www.lansrad.com - "Intelligent Solutions for Universal Problems"
www.fotokiss.com - "World's Best Auction Photo Editor"
-------------------------------------------------------------------------------------------------------

NewsArchive
05-12-2007, 04:23 AM
Sooooo....

For files that my program will access and I want all users of a particular
computer to be able to access.......

But the users themselves will have no interaction with I use
"CSIDL_COMMON_APPDATA".

That the users CAN have access to (forbackup, copy or launch) I use
"CSIDL_COMMON_DOCUMENTS".


Mike

NewsArchive
05-12-2007, 04:23 AM
> For files that my program will access and I want all users of a particular
> computer to be able to access.......
>
> But the users themselves will have no interaction with I use
> "CSIDL_COMMON_APPDATA".
>
> That the users CAN have access to (forbackup, copy or launch) I use
> "CSIDL_COMMON_DOCUMENTS".

That is my take on it Mike.

I don't know if the "CSIDL_COMMON_APPDATA" would be accessible from another
PC on the LAN via the app or not.

So far (in my tests) you can see the folder - but not access it even if it
is shared.

I haven't tried accessing it in an app (with mapping via CSIDL) yet.

But at least the "CSIDL_COMMON_DOCUMENTS" works fine.

HTH,

Charles




--
-------------------------------------------------------------------------------------------------------
Charles Edmonds

www.clarionproseries.com - "Serious imaging tools for Clarion Developers"
www.ezround.com - "Round Corner HTML tables with matching Banners, Buttons
and Forms!"
www.lansrad.com - "Intelligent Solutions for Universal Problems"
www.fotokiss.com - "World's Best Auction Photo Editor"
-------------------------------------------------------------------------------------------------------

NewsArchive
05-12-2007, 04:24 AM
> CSIDL_Common_Documents would be a better choice.

One more note:

If the data is personal to the user (and not all users on the machine) you
can just use CSIDL_PERSONAL.

So (to sum it up) this might be a good logical set to use:

CSIDL_PERSONAL - data for the current user only.

CSIDL_COMMON_DOCUMENTS - data shared between users on the machine.

CSIDL_COMMON_DOCUMENTS (with Network Share enabled) - data shared between
users on the machine AND other machines on the LAN.

CSIDL_COMMON_APPDATA - data that belongs to the app and is protected from
non-administrator users.

Note: On my machines, while you can share this folder on the LAN (as
above) and it WILL appear in the list of shared assets - it is still
inaccessible from browsing with Windows Explorer.


So like I said before: Welcome to Vista<g>


Charles



--
-------------------------------------------------------------------------------------------------------
Charles Edmonds

www.clarionproseries.com - "Serious imaging tools for Clarion Developers"
www.ezround.com - "Round Corner HTML tables with matching Banners, Buttons
and Forms!"
www.lansrad.com - "Intelligent Solutions for Universal Problems"
www.fotokiss.com - "World's Best Auction Photo Editor"

NewsArchive
05-12-2007, 04:24 AM
Thanks Charles!

Mike

NewsArchive
05-12-2007, 04:25 AM
Along this same subject line, U use this WINAPI call to get a temporary file
directory...

GetTempPath(511, GLO:TempFileDirectory) = 0

Is there a corresponding CSIDL...... equate I can use in WinEvent to get the
directory?

Perhaps I might consider using

CSIDL_COMMON_DOCUMENTS\MyFolder\TEMP

Michael Brooks

NewsArchive
05-12-2007, 04:25 AM
> CSIDL_COMMON_DOCUMENTS\MyFolder\TEMP

WinEvent has a function called: ds_GetTempPath

I just use that in the app.

In your Clarion ProScan (and ProSeries utilities) there is also a call you
can make to PS_GetTempPath()


HTH,

Charles

--
-------------------------------------------------------------------------------------------------------
Charles Edmonds

www.clarionproseries.com - "Serious imaging tools for Clarion Developers"
www.ezround.com - "Round Corner HTML tables with matching Banners, Buttons
and Forms!"
www.lansrad.com - "Intelligent Solutions for Universal Problems"
www.fotokiss.com - "World's Best Auction Photo Editor"
-------------------------------------------------------------------------------------------------------

NewsArchive
05-12-2007, 04:25 AM
Great....that's what I'll use.

MDB