PDA

View Full Version : Getting original "Users Documents" folder



NewsArchive
08-08-2011, 03:47 AM
Hi All,

I have an installation script that needs to read and update an INI
file located in the users "MyDocuments" folder. However because the
installation requires Administrator authority, it prompts for the
administrator password on startup and then CSIDL_Personal returns the
administrator document folder and not the user that started the
install.

Is there a way to get the original user MyDocuments folder value?
There may be multiple users on the same computer, so using a common
location to store that information will not work.

Barton Whisler
Prosoft Inc.
Tampa, Florida

NewsArchive
08-08-2011, 03:47 AM
> I have an installation script that needs to read and update an INI
> file located in the users "MyDocuments" folder. However because the
> installation requires Administrator authority, it prompts for the
> administrator password on startup and then CSIDL_Personal returns the
> administrator document folder and not the user that started the
> install.
>
> Is there a way to get the original user MyDocuments folder value?
> There may be multiple users on the same computer, so using a common
> location to store that information will not work.

Barton,

For a Clarion app, the easiest way to handle this is to use our ProPath
templates.

http://www.clarionproseries.com/html/propath.html

You add the templates to your application, check the box that tells ProPath
to manage the application INI and your done.

Since the code that ProPath generates is executing at runtime (not from
within the elevated installer), it will see the correct locations for all
the "per user" CSIDL values.

ProPath can also make it easy for you to manage your data (which should NOT
be under Program Files if your trying to make your application Windows
Vista/ Windows 7 compliant).

Likewise it makes it easy for you to deploy files into per user locations
and do quite a few other useful things.

We did a lot of work there so that you would not have to<g>.

:-)

Charles


--
-------------------------------------------------------------------------------------------------------
Charles Edmonds
www.clarionproseries.com - "Get ProPath, make your Clarion programs ready
for Windows 7 and Vista!"
www.ezchangelog.com - "Free ChangeLog software to manage your projects!"
www.setupcast.com - "A revolutionary new publishing system for software
developers - enhanced for SetupBuilder users!"
www.pagesnip.com - "Print and Save the Web, just the way you want it!"
www.clarionproseries.com - "Serious tools for Clarion Developers"
www.ezround.com - "Round Corner HTML tables with matching Banners, Buttons
and Forms - Now with PNG support!
www.lansrad.com - "Intelligent Solutions for Universal Problems"
www.fotokiss.com - "World's Best Auction Photo Editor"
-------------------------------------------------------------------------------------------------------

NewsArchive
08-08-2011, 03:48 AM
Thanks for the reply but the problem is not in the Clarion application
itself but rather in the installation program. Once in the Clarion
application, no problem.

Does this tool work inside the SetupBuilder program?

Barton

Barton Whisler
Prosoft Inc.
Tampa, Florida

NewsArchive
08-08-2011, 03:48 AM
> Thanks for the reply but the problem is not in the Clarion application
> itself but rather in the installation program. Once in the Clarion
> application, no problem.
>
> Does this tool work inside the SetupBuilder program?

No, it is a Clarion template - works inside the app.

I sent you an E-mail offgroup (but you may not have gotten it) asking what
you were trying to accomplish so that I could see if I had any ideas for
you.

Let me know (one place or the other) and perhaps I can give you some
suggestions.

:-)

Charles




--
-------------------------------------------------------------------------------------------------------
Charles Edmonds
www.clarionproseries.com - "Get ProPath, make your Clarion programs ready
for Windows 7 and Vista!"
www.ezchangelog.com - "Free ChangeLog software to manage your projects!"
www.setupcast.com - "A revolutionary new publishing system for software
developers - enhanced for SetupBuilder users!"
www.pagesnip.com - "Print and Save the Web, just the way you want it!"
www.clarionproseries.com - "Serious tools for Clarion Developers"
www.ezround.com - "Round Corner HTML tables with matching Banners, Buttons
and Forms - Now with PNG support!
www.lansrad.com - "Intelligent Solutions for Universal Problems"
www.fotokiss.com - "World's Best Auction Photo Editor"
-------------------------------------------------------------------------------------------------------

NewsArchive
08-08-2011, 04:06 AM
As Charles asks, why are you trying to do this (what do you need to
accomplish)?

From the SetupBuilder help:

"You should never do any per-USER configuration from an elevated installer.
Only per-MACHINE tasks should be handled from an installation that requests
administrator execution level privileges."

Jane Fleming

NewsArchive
08-08-2011, 04:07 AM
Jane and Charles;

What I am doing is saving the location of the folder last used to
install in and then using that to fill in the default for the next
install. On our customers machines, that works fine because they only
have a copy on one machine (actually just one copy on the network).

However in our office environment, we are running on Windows Server
2008 R2 using RDS to access. Each of our employees are instructed to
install what they are working with into their own "Documents" folder
so as not to interfere with others.

It is not a big deal to tell them to just ignore the normal default
and make sure they select their user/username/documents folder. Just
thought it would be nicer if they did not have to remember<g>.

Barton

Barton Whisler
Prosoft Inc.
Tampa, Florida

NewsArchive
08-08-2011, 04:08 AM
To be honest, I haven't played with 2008R2 RDS.
Guess I need to put that on my list...LOL...

I'm not at all sure I like the wisdom of installing applications into
someone's documents folder.
That said, I tried a little experiment.

If the attached does what you're looking for, I'll upload the scripts.

Jane

NewsArchive
08-08-2011, 04:09 AM
I agree that installing into the Documents folder is not a good
idea<g>. However we are doing this just internally and it's main
purpose was to make sure that what one person is doing does not affect
someone else. Usually the installs are just for testing and it is kind
of hard to test if someone installs a different version<vbg>!

I will test your application this afternoon when a get a chance and
let you know.

Bart

Barton Whisler
Prosoft Inc.
Tampa, Florida

NewsArchive
08-08-2011, 04:09 AM
Jane,

Thanks for all of your effort but that is not doing what my objective
was although suspect that it could be expanded to do so. In my case,
our internal people would be installing into sub folders of their
choice within the "MyDocuments" folder. What my installation does now,
just at a computer level, is to remember what the user selected last
time and then use it again as default for the next time.

I have discussed with my boss and since it works fine for our
customers which is what is important, we are just going to leave it as
is. As far as our internal use, our people will just have to be
careful to change the target folder as needed.<vbg>.

Again thank you very much for your time and effort!

Barton

Barton Whisler
Prosoft Inc.
Tampa, Florida

NewsArchive
08-08-2011, 04:10 AM
Well, Barton, intelligent users is always a good choice :-)

As you see, what my demo does is default to the logged-in user's profile
Documents folder, even with the installer running elevated.

To remember a specific sub-folder within Documents, your app would probably
need to write something to HKEY_Current_User, and then a similar technique
would work.

Anyway, glad you've worked out a strategy.

Jane

NewsArchive
08-08-2011, 04:10 AM
The other question....

If you're JUST installing something per-user, are you installing anything
that requires elevation?

If not, change your installer's manifest to asInvoker and you'll have access
to the user's profile information and CSIDL paths.

jf

NewsArchive
08-08-2011, 04:11 AM
We want to leave the elevated install for customer installs. What we
were hoping to do is accomplish the unusual requirements of our
internal RDS system but not affect the standard customer install.
Since the internal installation is minor, we are going to leave as it
is and tell our people they just have to select the proper folder on
their own.

Barton

Barton Whisler
Prosoft Inc.
Tampa, Florida