[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.setup

Granting folder access to users at install time

Steve Barker

5/17/2007 9:31:00 AM

Hi,

I've written an installer for a .NET application, which creates folders on
the userâ??s hard drive, specific to our application. Since the installer runs
under administrative rights, standard users do not have permission to write
to these folders once the installation has finished (and administrator rights
are surrendered). Can I perform a custom action during my installer to ensure
that once the installer has finished, standard users will be able to write to
certain folders?

Thanks in advance,

Steve.

9 Answers

jacky kwok

5/18/2007 1:46:00 AM

0

Steve Barker wrote:
> Hi,
>
> I've written an installer for a .NET application, which creates folders on
> the userâ??s hard drive, specific to our application. Since the installer runs
> under administrative rights, standard users do not have permission to write
> to these folders once the installation has finished (and administrator rights
> are surrendered). Can I perform a custom action during my installer to ensure
> that once the installer has finished, standard users will be able to write to
> certain folders?
>
> Thanks in advance,
>
> Steve.
>

Of cause you can do so.

Just use the
"System.IO.DirectoryInfo.SetAccessControl" Method (for dotnet2 or above)

There is example in
"http://msdn2.microsoft.com/en-us/library/system.io.directoryinfo.setaccesscontrol.....

--
Jacky Kwok
jacky@alumni_DOT_cuhk_DOT_edu_DOT_hk

Steve Barker

5/18/2007 10:43:00 AM

0

Hi Jacky,

Are you suggesting that I build the code into an executable that can be ran
as a custom action at install time? This should work, since in theory the
executable will be ran as administrator at install time.

I've tried this as follows:

* I've compiled a simple executable (Setter.exe) that sets permissions to a
directory.
* I've written an installer for my application, which includes the primary
output from Setter.exe.
* In the "Commit" phase of my installer, I've added Setter.
* When the application has almost finished installing, I get an error:
"Could not find file 'C:\program files\ABC\DEF\Setter.InstallState'."

Clearly there is some problem with the launch conditions, but I'm not sure
what!

Thanks in advance,

Steve.

"jacky kwok" wrote:

> Steve Barker wrote:
> > Hi,
> >
> > I've written an installer for a .NET application, which creates folders on
> > the userâ??s hard drive, specific to our application. Since the installer runs
> > under administrative rights, standard users do not have permission to write
> > to these folders once the installation has finished (and administrator rights
> > are surrendered). Can I perform a custom action during my installer to ensure
> > that once the installer has finished, standard users will be able to write to
> > certain folders?
> >
> > Thanks in advance,
> >
> > Steve.
> >
>
> Of cause you can do so.
>
> Just use the
> "System.IO.DirectoryInfo.SetAccessControl" Method (for dotnet2 or above)
>
> There is example in
> "http://msdn2.microsoft.com/en-us/library/system.io.directoryinfo.setaccesscontrol.....
>
> --
> Jacky Kwok
> jacky@alumni_DOT_cuhk_DOT_edu_DOT_hk
>

Phil Wilson

5/18/2007 6:59:00 PM

0

1) That's not a LaunchCondition error, it's because a Commit custom action
expects there to have been an Install custom action. They all kind of work
together using the installstate file as a repository.

2) That custom action won't necessarily run as administrator on Vista
because of UAC, even if you are an administrator.
--
Phil Wilson
[Microsoft MVP Windows Installer]
"Steve Barker" <stevebarker@nospam.nospam> wrote in message
news:4F099710-D59C-4788-A1DA-90C2507C4E74@microsoft.com...
> Hi Jacky,
>
> Are you suggesting that I build the code into an executable that can be
> ran
> as a custom action at install time? This should work, since in theory the
> executable will be ran as administrator at install time.
>
> I've tried this as follows:
>
> * I've compiled a simple executable (Setter.exe) that sets permissions to
> a
> directory.
> * I've written an installer for my application, which includes the primary
> output from Setter.exe.
> * In the "Commit" phase of my installer, I've added Setter.
> * When the application has almost finished installing, I get an error:
> "Could not find file 'C:\program files\ABC\DEF\Setter.InstallState'."
>
> Clearly there is some problem with the launch conditions, but I'm not sure
> what!
>
> Thanks in advance,
>
> Steve.
>
> "jacky kwok" wrote:
>
>> Steve Barker wrote:
>> > Hi,
>> >
>> > I've written an installer for a .NET application, which creates folders
>> > on
>> > the user's hard drive, specific to our application. Since the installer
>> > runs
>> > under administrative rights, standard users do not have permission to
>> > write
>> > to these folders once the installation has finished (and administrator
>> > rights
>> > are surrendered). Can I perform a custom action during my installer to
>> > ensure
>> > that once the installer has finished, standard users will be able to
>> > write to
>> > certain folders?
>> >
>> > Thanks in advance,
>> >
>> > Steve.
>> >
>>
>> Of cause you can do so.
>>
>> Just use the
>> "System.IO.DirectoryInfo.SetAccessControl" Method (for dotnet2 or above)
>>
>> There is example in
>> "http://msdn2.microsoft.com/en-us/library/system.io.directoryinfo.setaccesscontrol.....
>>
>> --
>> Jacky Kwok
>> jacky@alumni_DOT_cuhk_DOT_edu_DOT_hk
>>


jacky kwok

5/21/2007 6:36:00 AM

0

Steve Barker wrote:
> Hi Jacky,
>
> Are you suggesting that I build the code into an executable that can be ran
> as a custom action at install time? This should work, since in theory the
> executable will be ran as administrator at install time.
>
> I've tried this as follows:
>
> * I've compiled a simple executable (Setter.exe) that sets permissions to a
> directory.
> * I've written an installer for my application, which includes the primary
> output from Setter.exe.
> * In the "Commit" phase of my installer, I've added Setter.
> * When the application has almost finished installing, I get an error:
> "Could not find file 'C:\program files\ABC\DEF\Setter.InstallState'."
>
> Clearly there is some problem with the launch conditions, but I'm not sure
> what!
>
> Thanks in advance,
>
> Steve.
>

Steve:

I think your problem is that
you did not set the property "InstallerClass" of your CustomAction to
"false".

As your description, your customaction is an executeable(.exe). The
property "InstallerClass" should be set to "false".


--
Jacky Kwok
jacky@alumni_DOT_cuhk_DOT_edu_DOT_hk

Steve Barker

5/21/2007 10:34:00 AM

0

Hi guys! Thanks for your advice!

Jacky: Yes, you were right! I'd forgotten to set InstallerClass to false.
That works a treat now! Thanks very much.

Phil: I just tried my test installer on a clean Vista machine (using VM
Ware) and logged on as a standard user. When the installer asked for
aministrator rights, I entered them and the installer ran fine. Not only
that, but the simple executable (that sets folder permissions) I launched as
a custom action worked correctly too, and granted permissions that were
available to the user after the installation completed. Under what conditions
would this approach not work, do you think?

Many thanks,

Steve.



"jacky kwok" wrote:

> Steve Barker wrote:
> > Hi Jacky,
> >
> > Are you suggesting that I build the code into an executable that can be ran
> > as a custom action at install time? This should work, since in theory the
> > executable will be ran as administrator at install time.
> >
> > I've tried this as follows:
> >
> > * I've compiled a simple executable (Setter.exe) that sets permissions to a
> > directory.
> > * I've written an installer for my application, which includes the primary
> > output from Setter.exe.
> > * In the "Commit" phase of my installer, I've added Setter.
> > * When the application has almost finished installing, I get an error:
> > "Could not find file 'C:\program files\ABC\DEF\Setter.InstallState'."
> >
> > Clearly there is some problem with the launch conditions, but I'm not sure
> > what!
> >
> > Thanks in advance,
> >
> > Steve.
> >
>
> Steve:
>
> I think your problem is that
> you did not set the property "InstallerClass" of your CustomAction to
> "false".
>
> As your description, your customaction is an executeable(.exe). The
> property "InstallerClass" should be set to "false".
>
>
> --
> Jacky Kwok
> jacky@alumni_DOT_cuhk_DOT_edu_DOT_hk
>

Steve Barker

5/21/2007 12:10:00 PM

0

Following on from my last post...

Ah! Time to throw a spanner in the works. I've just realised that the code
to grant permissions only runs under .NET 2.0, where as I need to use this
approach in an existing .NET 1.1 project as well as a new .NET 2.0 project.
At the moment, upgrading the existing project to 2.0 is out of the question,
so I'm going to need an approach that will allow me to use this fix with a
..NET 1.1 application.

I have a two questions:

1) Is there any equivalent .NET 1.1 code that achieves the same as
DirectoryInfo.SetAccessControl() in .NET 2.0? I suspect notâ?¦

2) If not, how can I get an installer created for .NET 1.1 (using VS 2003)
to install the .NET 2.0 Framework instead of the .NET 1.1 Framework? (The
..NET 1.1 code will run under .NET 2.0 as far as I can tell.) Sadly,
overwriting the dotnetfx.exe component in the installer with the 2.0 version
doesnâ??t really work. The installer does launch the .NET 2.0 installer, but it
doe not smoothly revert back to the application installer afterwards.

Any ideas?

Thanks,

Steve.


"jacky kwok" wrote:

> Steve Barker wrote:
> > Hi Jacky,
> >
> > Are you suggesting that I build the code into an executable that can be ran
> > as a custom action at install time? This should work, since in theory the
> > executable will be ran as administrator at install time.
> >
> > I've tried this as follows:
> >
> > * I've compiled a simple executable (Setter.exe) that sets permissions to a
> > directory.
> > * I've written an installer for my application, which includes the primary
> > output from Setter.exe.
> > * In the "Commit" phase of my installer, I've added Setter.
> > * When the application has almost finished installing, I get an error:
> > "Could not find file 'C:\program files\ABC\DEF\Setter.InstallState'."
> >
> > Clearly there is some problem with the launch conditions, but I'm not sure
> > what!
> >
> > Thanks in advance,
> >
> > Steve.
> >
>
> Steve:
>
> I think your problem is that
> you did not set the property "InstallerClass" of your CustomAction to
> "false".
>
> As your description, your customaction is an executeable(.exe). The
> property "InstallerClass" should be set to "false".
>
>
> --
> Jacky Kwok
> jacky@alumni_DOT_cuhk_DOT_edu_DOT_hk
>

jacky kwok

5/22/2007 1:56:00 AM

0

Steve Barker wrote:
> Following on from my last post...
>
> Ah! Time to throw a spanner in the works. I've just realised that the code
> to grant permissions only runs under .NET 2.0, where as I need to use this
> approach in an existing .NET 1.1 project as well as a new .NET 2.0 project.
> At the moment, upgrading the existing project to 2.0 is out of the question,
> so I'm going to need an approach that will allow me to use this fix with a
> .NET 1.1 application.
>
> I have a two questions:
>
> 1) Is there any equivalent .NET 1.1 code that achieves the same as
> DirectoryInfo.SetAccessControl() in .NET 2.0? I suspect notâ?¦
>
> 2) If not, how can I get an installer created for .NET 1.1 (using VS 2003)
> to install the .NET 2.0 Framework instead of the .NET 1.1 Framework? (The
> .NET 1.1 code will run under .NET 2.0 as far as I can tell.) Sadly,
> overwriting the dotnetfx.exe component in the installer with the 2.0 version
> doesnâ??t really work. The installer does launch the .NET 2.0 installer, but it
> doe not smoothly revert back to the application installer afterwards.
>
> Any ideas?
>
> Thanks,
>
> Steve.
>

1. No, there is no management API in Dotnet1.1 supports NTFS security.

You need to use Windows API. You need many functions
"SetFileSecurity","SetSecurityDescriptorDacl","AddAccessAllowedAceEx",....
and many complex structures
"SECURITY_DESCRIPTOR","ACL_SIZE_INFORMATION","ACL",....

All them are painful stuff. After Dotnet2, I have completely forgot them.



2. If you can install Dotnet2 framework to run the dotnet1.x app. You
can try to use VS2005 to create the installer and the customaction to
set folder security. Select the Dotnet2 framework as the pre-requisite.

Then, directly adding your Dotnet 1.x executeable files in the installer
project.


--
Jacky Kwok
jacky@alumni_DOT_cuhk_DOT_edu_DOT_hk

Roger Smith

8/31/2012 10:08:00 AM

0

On Aug 28, 10:21 am, Yoorg...@Jurgis.net wrote:
> On Tue, 28 Aug 2012 05:55:29 -0400, NoBody <NoB...@nowhere.com> wrote:
> >>Bush Alone added $9 Trillion.
>
> >In eight years.  In only three years Obama is only -2T behind.
>
> Name a policy NOT related to Bush/GOP policy that Obama has
> independently caused to add to that debt.
>
> It's a trick question, Nuwussy.  He hasn't any.
>
> THe CONTINUATION of the root causes of the national debacle is ONGOING
> and continues to be "Bush/GOP" related as long as the publicly stated
> position of McConnell and Boehner is to: "Impede, block, obstruct and
> filibuster" ALL attempts at economic recovery.
>
> Despite that publicly stated (being carried out) policy of
> Republicans----Obama has managed to take us out of the hole, create
> jobs and recovery for 30+ months.
>
> What you are too chickeshit to address-----"how much would we have
> accomplished had Boner and McConnell (and the GOP generally) HELPED"??
>
> You ain't got the balls to answer.



No! No! No!

This is how it goes.

The Republican Congress are why Clinton created a surplus, but it
wasn't why the same Republican Congress caused the first four years of
Bush to expand the civil service payroll by 25%, nobody knows why.

Lately things have gone to shit, but that's because Obama is in
charge, not because of the Republican Congress.

That's because the Republicans are helpless, gutless weanies who fear
Obama.

And also had difficulty admitting that when he ordered Seal Team 6 to
kill his fellow Muslim Osama.


The fact of the matter is that nobody wants Hope and Change now a
days. They want the stuff the US had in 2008.

Bail outs with no strings like TARP, and raving morons saying "It's
all because of deregulation!"


It's good that Romney doesn't like Obamacare. But he loved
Romneycare.

Now, you cannot tell me that Romneycare was like Obamacare! That's
why Mitt doesn't like it. He also hates gun control too!

The Massachusetts health care insurance reform law, St. 2006, c.58,
informally referred to as Romneycare, enacted in 2006, mandates that
nearly every resident of Massachusetts obtain a state-government-
regulated minimum level of healthcare insurance coverage and provides
free health care insurance for residents earning less than 150% of the
federal poverty level (FPL).The bill aimed to cover 95% of the state's
500,000 uninsured within a three year period.[4] The law was amended
significantly in 2008 and twice in 2010 and major revisions related to
health care industry price controls were introduced in the
Massachusetts legislature in May 2012 that passed in August 2012.

Among its many effects, the law and its amendments established an
independent public authority, the Commonwealth Health Insurance
Connector Authority, also known as the Health Connector. Among other
roles, the Connector acts as an insurance broker to offer private
insurance plans to residents. The reform legislation also included tax
penalties on residents for failing to obtain an insurance plan and tax
penalties on employers for failing to offer an insurance plan to
employees. In 2007 Massachusetts tax filers who failed to enroll in a
health insurance plan which was deemed affordable for them lost the
$219 personal exemption on their income tax. Beginning in 2008, the
penalty became pegged to 50% of the lowest monthly premium for
insurance available from the Connector Authority.






First.Post

8/31/2012 12:21:00 PM

0

On Fri, 31 Aug 2012 03:08:12 -0700 (PDT), "Kyle Bodine Jr."
<agamemnon48a@yahoo.com> 174.118.15.211
Paul Ryan <garekmolo@ymail.com> 174.118.15.211
Bruce <cy_purvis@excite.com> 174.118.15.211
Scales of Justice <caseyterry5959@yahoo.com> 174.118.15.211
The IRS pvt.wilhelm@hotmail.com 174.118.15.211
Herbert Walker Bush
<random_chaotic@yahoo.com> 174.118.15.211
Adrian adrastea2050@live.com 174.118.15.211
American pvt.wilhelm@hotmail.com 174.118.15.211
Anne Brown adrastea2050@live.com 174.118.15.211
Aubrey Cole caseyterry5959@yahoo.com 174.118.15.211
Bachmann Fan garekmolo@ymail.com 174.118.15.211
Bastian Schweinsteiger pvt.wilhelm@hotmail.com 174.118.15.211
Billy Carl pvt.wilhelm@hotmail.com 174.118.15.211
Billy Duke agamemnon48a@yahoo.com 174.118.15.211
Black Walter Williams random_chaotic@yahoo.com 174.118.15.211
Bob Dole igorelarianov@ymail.com 174.118.15.211
Bobby The Brain pvt.wilhelm@hotmail.com 174.118.15.211
Brock Norton garekmolo@ymail.com 174.118.15.211
Bruce Woodman adrastea2050@live.com 174.118.15.211
Buck cy_purvis@excite.com 174.118.15.211
C igorelarianov@ymail.com 174.118.15.211
Carl igorelarianov@ymail.com 174.118.15.211
Chip Hendry chaotica666@live.com 174.118.15.211
Classical Economist adrastea2050@live.com 174.118.15.211
Conservative Values caseyterry5959@yahoo.com 174.118.15.211
Darrell Jones caseyterry5959@yahoo.com 174.118.15.211
Derek Sanderson chaotica666@live.com 174.118.15.211
Dick Steele cy_purvis@excite.com 174.118.15.211
Ed ed.carpenter@ymail.com 174.118.15.211
Eddie ed.carpenter@ymail.com 174.118.15.211
Ethan igorelarianov@ymail.com 174.118.15.211
evangelist garekmolo@ymail.com 174.118.15.211
Friedrich August Hayek agamemnon48a@yahoo.com 174.118.15.211
G. Norquist caseyterry5959@yahoo.com 174.118.15.211
Ganymede OV igorelarianov@ymail.com 174.118.15.211
Gary Rock Jones random_chaotic@yahoo.com 174.118.15.211
George Lincoln Rockwell igorelarianov@ymail.com 174.118.15.211
Gip pvt.wilhelm@hotmail.com 174.118.15.211
God Fearing US Christian garekmolo@ymail.com 174.118.15.211
GOP (Grand Old Pedophile) Trailer Trash With A Gun Ready To Spree
Shoot! chaotica666@live.com 174.118.15.211
Gord Brown andrewranger01@gmail.com 174.118.15.211
Gordie Howe andrewranger01@gmail.com 174.118.15.211
Harcourt Fenton \ Harry\ Mudd igorelarianov@ymail.com 174.118.15.211
Heinrich pvt.wilhelm@hotmail.com 174.118.15.211
Herbert agamemnon48a@yahoo.com 174.118.15.211
Herman caseyterry5959@yahoo.com 174.118.15.211
Homer Cain adrastea2050@live.com 174.118.15.211
Hunter Gibson Jr. garekmolo@ymail.com 174.118.15.211
Hymie Glick garekmolo@ymail.com 174.118.15.211
Igor Blinov igorelarianov@ymail.com 174.118.15.211
Jak Walker garekmolo@ymail.com 174.118.15.211
Jerry Tex caseyterry5959@yahoo.com 174.118.15.211
Jimmy Bly adrastea2050@live.com 174.118.15.211
Joe Warren ed.carpenter@ymail.com 174.118.15.211
John Hunter adrastea2050@live.com 174.118.15.211
Jonesie caseyterry5959@yahoo.com 174.118.15.211
Justice agamemnon48a@yahoo.com 174.118.15.211
Lars igorelarianov@ymail.com 174.118.15.211
Libertarian garekmolo@ymail.com 174.118.15.211
Ludwig Von Squawk garekmolo@ymail.com 174.118.15.211
Mel Fury adrastea2050@live.com 174.118.15.211
Mel Fury agamemnon48a@yahoo.com 174.118.15.211
Michael pvt.wilhelm@hotmail.com 174.118.15.211
Mike Gabriel random_chaotic@yahoo.com 174.118.15.211
Murph agamemnon48a@yahoo.com 174.118.15.211
Panama John agamemnon48a@yahoo.com 174.118.15.211
R. Clom agamemnon48a@yahoo.com 174.118.15.211
Rabbi Steinberg garekmolo@ymail.com 174.118.15.211
Ray adrastea2050@live.com 174.118.15.211
Red Sifferdi random_chaotic@yahoo.com 174.118.15.211
Republican Jesus igorelarianov@ymail.com 174.118.15.211
Reverend Haggard chaotica666@live.com 174.118.15.211
Rich caseyterry5959@yahoo.com 174.118.15.211
Richard Breen garekmolo@ymail.com 174.118.15.211
Ricky Ricardo honda900f@excite.com 174.118.15.211
Right Wing Netcop On Welfare garekmolo@ymail.com 174.118.15.211
Right Wing Realist caseyterry5959@yahoo.com 174.118.15.211
Rocco Siffredi random_chaotic@yahoo.com 174.118.15.211
Rock Quarry agamemnon48a@yahoo.com 174.118.15.211
Roger Ramjet garekmolo@ymail.com 174.118.15.211
Roger Waters chaotica666@live.com 174.118.15.211
Ross John s Gay Friend ed.carpenter@ymail.com 174.118.15.211
Roy Bean caseyterry5959@yahoo.com 174.118.15.211
Roy Rocque ed.carpenter@ymail.com 174.118.15.211
Rush luvr pvt.wilhelm@hotmail.com 174.118.15.211
Ryan Brown chaotica666@live.com 174.118.15.211
Ryerson andrewranger01@gmail.com 174.118.15.211
Sarah Palin agamemnon48a@yahoo.com 174.118.15.211
Tessa adrastea2050@live.com 174.118.15.211
The Donald caseyterry5959@yahoo.com 174.118.15.211
The Real Orion igorelarianov@ymail.com 174.118.15.211
The Right View adrastea2050@live.com 174.118.15.211
Unemployed Limbaugh Minion igorelarianov@ymail.com 174.118.15.211
Walter chaotica666@live.com 174.118.15.211
White Boy pvt.wilhelm@hotmail.com 174.118.15.211
Your Friend Ric cy_purvis@excite.com 174.118.15.211
Changed Nyms Again and Wrote:

More Canuck Babble.

Time to change your nym again dickless.
If you had any real valid point to make you wouldn't be posting under
a different nym every five minutes would you you gutless pile of
canuck moose shit?
You fool no one with your stupid little games and no one falls for
your Follow ups to alt flame rednecks crap.

Canadian liberals: 100 times dumber than even the most uneducated
American liberal.