Help with LNK2019 error and DiInstallDriver function

R

Rymfax

I have an application that is installing Drivers to the OS. I was
using the UpdateDriverForPlugAndPlayDevices() function to handle
this. It works fine, but on VISTA I get prompted by Windows Security
if the Driver isn't pre-installed first. To avoid this I want to use
the DiInstallDriver() function which will Pre-Install the driver first
and then install it to any device that uses it.

The problem I'm having is that everytime I try to compile now that
I've added a reference in my code to DiInstallDriver(), I get the
following error:

Error 13 error LNK2019: unresolved external symbol _DiInstallDriverW
referenced in function "private: void __thiscall
ScanHardware::UpdateDriver(class ScanResult *)" (?
UpdateDriver@ScanHardware@@AAEXPAVScanResult@@@Z) ScanHardware.obj
Error 14 fatal error LNK1120: 1 unresolved externals C:\Projects
\UIUHWScan++\Debug\UIUHWScan++.exe 1


For the life of me I can't figure out why it's giving me this error.
The function is in declared in newdev.h and I am including that in
my .cpp file. UpdateDriverForPlugAndPlayDevices() is defined in hte
same newdev.h and works fine.

I don't know if this is happening because DiInstallDriver() is a VISTA
function and I'm building on a XP machine or what, but it is driving
me crazy! Any help would be VERY MUCH appreciated it.

Here's a snippet of what my code looks like:


if(osMajorVersion > 5)
{

if(ForceUpdate) installFlag = DIIRFLAG_FORCE_INF;
installResult = DiInstallDriver(0, inf, installFlag,
&rebootRequired);
} else
{
if(ForceUpdate) installFlag = INSTALLFLAG_FORCE;
installResult =
UpdateDriverForPlugAndPlayDevices(0,hwid,inf,installFlag,&rebootRequired);
}

TIA!
 
L

Larry Smith

Rymfax said:
I have an application that is installing Drivers to the OS. I was
using the UpdateDriverForPlugAndPlayDevices() function to handle
this. It works fine, but on VISTA I get prompted by Windows Security
if the Driver isn't pre-installed first. To avoid this I want to use
the DiInstallDriver() function which will Pre-Install the driver first
and then install it to any device that uses it.

The problem I'm having is that everytime I try to compile now that
I've added a reference in my code to DiInstallDriver(), I get the
following error:

Error 13 error LNK2019: unresolved external symbol _DiInstallDriverW
referenced in function "private: void __thiscall
ScanHardware::UpdateDriver(class ScanResult *)" (?
UpdateDriver@ScanHardware@@AAEXPAVScanResult@@@Z) ScanHardware.obj
Error 14 fatal error LNK1120: 1 unresolved externals C:\Projects
\UIUHWScan++\Debug\UIUHWScan++.exe 1


For the life of me I can't figure out why it's giving me this error.
The function is in declared in newdev.h and I am including that in
my .cpp file. UpdateDriverForPlugAndPlayDevices() is defined in hte
same newdev.h and works fine.

I don't know if this is happening because DiInstallDriver() is a VISTA
function and I'm building on a XP machine or what, but it is driving
me crazy! Any help would be VERY MUCH appreciated it.

Here's a snippet of what my code looks like:


if(osMajorVersion > 5)
{

if(ForceUpdate) installFlag = DIIRFLAG_FORCE_INF;
installResult = DiInstallDriver(0, inf, installFlag,
&rebootRequired);
} else
{
if(ForceUpdate) installFlag = INSTALLFLAG_FORCE;
installResult =
UpdateDriverForPlugAndPlayDevices(0,hwid,inf,installFlag,&rebootRequired);
}

TIA!

Try a Microsoft newsgroup.

None of this is Standard C++; which is what this
newsgroup addresses. See here for some possible
related newsgroups:

http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.9
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top