PDA

View Full Version : Creating a Folder in \users\username\appdata\local



NewsArchive
11-15-2012, 01:27 AM
I am trying to create folder for use with RDP for each user.

I created a runtime variable %_LOCAL_USER%
Then I set %_LOCAL_USER% to the folder I want to create
Set Variable %_LOCAL_USER% to "%_CSIDL_LOCAL_APPDATA%\garagepartner"

Create the folder
Create Folder "%_LOCAL_USER%"

Message display shows c:\users\deekal\appdata\local\garagepartner

But no joy, the folder is not created

Dan Scott
Garage Partner Pro/Invoice Partner
www.garagepartner.com

NewsArchive
11-15-2012, 01:27 AM
Never mind, I fixed it, but don't know how <g>

Dan

NewsArchive
11-15-2012, 01:28 AM
Dan,

>
> Never mind, I fixed it, but don't know how <g>
>

You should NEVER do this from the elevated running installer because you are
doing it in the wrong user context ;-)

An application that is running elevated ("requireAdministrator" manifested)
should not write to any per-user location (e.g. LOCAL_APPDATA). Only
"asInvoker" applications are allowed to handle it.

Because a typical installation program always has to run with administrator
execution level privileges, you can't write to the correct user profile.

Let us assume, you have a "JoeUser" Standard User account under Windows 7 or
Windows 8. Installation applications always run elevated -- an elevated
process is usually one that has been launched by someone with a Full
Administrator Token and runs with High Integrity Level Privileges
(administrator execution level privileges). If "JoeUser" starts the
installation, UAC determines that the Current User does not have a token of
sufficiently high Integrity Level and the Credentials Prompt asks the user
to provide a username and password of someone who has sufficient rights.
Windows will then create the necessary token for that user and uses it to
elevate the process so you can now continue with the installation. Please
note that you are on a completely different profile after the elevation.
You have switched from the "JoeUser" profile to the "Administrator" profile!
In other words, you do not create the folder under the "JoeUser"
LOCAL_APPDATA folder tree but under the Administrators LOCAL_APPDATA.

What you can do is the following: you create a simple "asInvoker" helper
application with SetupBuilder (or Clarion, or Visual Studio, or whatever).
This helper application can write to the "correct" LOCAL_APPDATA -- you
start that helper from your elevated running installer with the "Launch
non-elevated under UAC" Run Program option.

Or even better, write to LOCAL_APPDATA directly from your own (asInvoker
manifested) application.

It is recommended to handle all per-user actions from your own "asInvoker"
manifested application. For example, if you have to install per-user data,
install it to a common location and as a "first run" action of your main
application, copy the data from the common location into a per-user
location.

Friedrich

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

--Helping You Build Better Installations
--SetupBuilder "point. click. ship"
--Create Windows 8 ready installations in minutes
--Comodo Code Signing and SSL Certificate Partner

NewsArchive
11-16-2012, 01:24 AM
Friedrich

Wow, let me read and digest all this.

Thanks

Dan