By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,971 Members | 1,732 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,971 IT Pros & Developers. It's quick & easy.

Help with LNK2019 error and DiInstallDriver function

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.