From: JY on
Hi,

I want to invoke a driver installation from within my MFC application, and
for which I plan to use APIs like SetupCopyOEMInf() et al.

My question is to do this on Win 7 and Win Vista, how do I raise the
permission levels to permit me to do this? I've had a brief look at the UAC
documentation in MSDN, but am not sure which Privilege constant to use. I
need an approach to work on both Win 7 and Vista.

TIA,
JY
From: Tom Serface on
This article might help you:

http://msdn.microsoft.com/en-us/magazine/cc163486.aspx

Tom

"JY" <sd(a)nospamgroup.com> wrote in message
news:0C37610B-B1A4-4E56-BD08-DB205DB355E2(a)microsoft.com...
> Hi,
>
> I want to invoke a driver installation from within my MFC application, and
> for which I plan to use APIs like SetupCopyOEMInf() et al.
>
> My question is to do this on Win 7 and Win Vista, how do I raise the
> permission levels to permit me to do this? I've had a brief look at the
> UAC
> documentation in MSDN, but am not sure which Privilege constant to use. I
> need an approach to work on both Win 7 and Vista.
>
> TIA,
> JY

From: Alexander Grigoriev on
The application itself needs to be started under unrestricted Administrator
account.

"JY" <sd(a)nospamgroup.com> wrote in message
news:0C37610B-B1A4-4E56-BD08-DB205DB355E2(a)microsoft.com...
> Hi,
>
> I want to invoke a driver installation from within my MFC application, and
> for which I plan to use APIs like SetupCopyOEMInf() et al.
>
> My question is to do this on Win 7 and Win Vista, how do I raise the
> permission levels to permit me to do this? I've had a brief look at the
> UAC
> documentation in MSDN, but am not sure which Privilege constant to use. I
> need an approach to work on both Win 7 and Vista.
>
> TIA,
> JY


From: Joseph M. Newcomer on
First: you should probably not be doing this. Drivers are installed when the hardware is
detected.

Second: if you don't have hardware, what is the driver doing?

Third: This will require privileges, which means that for a large number of potential
customers, these privileges will not be available, and the product will fail. If the
driver has no hardware, the driver should be installed by the normal install procedure
that installs your app, not by executable code in the app itself. Administratively, this
solves the problem, because in secure sites, the administrator gets to make the decision
about the installation.

Fourth: if a program came up and asked me about installing a driver, I would know that it
was a piece of malware.
joe

On Thu, 21 Jan 2010 03:58:05 -0800, JY <sd(a)nospamgroup.com> wrote:

>Hi,
>
>I want to invoke a driver installation from within my MFC application, and
>for which I plan to use APIs like SetupCopyOEMInf() et al.
>
>My question is to do this on Win 7 and Win Vista, how do I raise the
>permission levels to permit me to do this? I've had a brief look at the UAC
>documentation in MSDN, but am not sure which Privilege constant to use. I
>need an approach to work on both Win 7 and Vista.
>
>TIA,
>JY
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: David Ching on
"Joseph M. Newcomer" <newcomer(a)flounder.com> wrote in message
news:ad3hl5l0u9decvt68kjikjk81l39nk5fgk(a)4ax.com...
> First: you should probably not be doing this. Drivers are installed when
> the hardware is
> detected.
>
> Second: if you don't have hardware, what is the driver doing?
>
> Third: This will require privileges, which means that for a large number
> of potential
> customers, these privileges will not be available, and the product will
> fail. If the
> driver has no hardware, the driver should be installed by the normal
> install procedure
> that installs your app, not by executable code in the app itself.
> Administratively, this
> solves the problem, because in secure sites, the administrator gets to
> make the decision
> about the installation.
>
> Fourth: if a program came up and asked me about installing a driver, I
> would know that it
> was a piece of malware.

Many hardware devices come with software utilities that copy the driver from
the downloaded installer or CD media into the driver cache. That's what
SetupCopyOEMInf() file does. That way if the user chooses to install the
software prior to plugging the device, when they do install the device, PnP
detects the driver in the cache and seemlessly activates it. MS encourages
this behavior; they want to make it a seemless experience whether the user
plugs the device first or installs the software first.

It also makes it possible for the administrator to preload the software and
driver prior to deploying the PC to the end user in a corporation so that
when the end user does get the hardware and plugs it, no Admin privilege is
required to install any drivers.

In short, what the OP is asking for is a MS recommended pattern.

-- David