468,292 Members | 1,847 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,292 developers. It's quick & easy.

Help with LNK2019 error and DiInstallDriver function

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,insta llFlag,&rebootRequired);
}

TIA!

Apr 11 '07 #1
1 3467
Rymfax wrote:
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,insta llFlag,&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-lit...t.html#faq-5.9

Apr 11 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Hadi | last post: by
3 posts views Thread by Chris B | last post: by
2 posts views Thread by hazizpour | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.