Solved

installling an INF programatically?

Posted on 2002-06-03
14
633 Views
Last Modified: 2012-08-14
Here's my situation. I have a third party driver which I need to install prior to my application. I
am trying to make this as user friendly as possible, meaning that I would like to eliminate any user
intervention for the driver install. How to I programatically simulate a right click/Install of the
INF file? Points for working example.

Thanks!!
0
Comment
Question by:DrDelphi
  • 3
  • 3
  • 2
  • +4
14 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 7051685
ShellExecute ( NULL, "install", "c:\\path\\myfile.inf", NULL, NULL, SW_HIDE);
0
 
LVL 86

Expert Comment

by:jkr
ID: 7051690
BTW, to elaborate: Check the entries in the registry under HKEY_CLASSES_ROOT\inffile\shell - all the keys represent valid actions for 'ShellExecute()' for an .inf file, and 'Install' is what you want :o)
0
 
LVL 32

Expert Comment

by:jhance
ID: 7051693
In the Windows Platform SDK docs, there is a step-by-step example titled:

Steps of an Installation Program

If you have the MSDN library, it's there.  Otherwise, see:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/setupapi/setupapiovr_02p9.asp
0
 
LVL 6

Author Comment

by:DrDelphi
ID: 7051755
jkr,
  No joy. I neglected to mention that ShellExecute was my first line of attack. It doesn't raise any exceptions, but it doesn't install either.


jhance,
  I have seen this, too. I am just not convinced that I should have to go through all of those steps to install this. And if so, I am not sure if I know what keys to use and which to ignore from the INF file.



Thanks!
0
 
LVL 32

Expert Comment

by:jhance
ID: 7051791
I've done this and I can assure you that all these steps are needed for a proper installation via API calls.  It's not as complicated as it looks.
0
 
LVL 6

Author Comment

by:DrDelphi
ID: 7051821
Jhance,

   You wouldn't happen to have a template that I could follow , would you?

Thanks!
0
 
LVL 32

Expert Comment

by:jhance
ID: 7051839
I think I have one somewhere.  Let me see if I can dig it up.....
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 22

Accepted Solution

by:
ambience earned 100 total points
ID: 7053047
rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 %1

this is the call that rundll makes, maybe you can go directly to setupapi.dll or try using the same as a command-line invokatoin.  I suppose passing 128 instead of 132 is for un-attended installs.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7053228
If you right-click the INF file in the Windows Explorer, doesn't it present to option to Install?  Or if you double-click it, doesn't it run?

If it does, then just use ShellExecute("open"...)

-- Dan
0
 
LVL 6

Author Comment

by:DrDelphi
ID: 7053730
ambience,
  I have been able to verify that what you say is in fact right...but it still keeps insisting on prompting for the file, despite the fact that the file has been copied into the Winnt\System32\Drivers folder. Have you seen anything similar and if so, do you know a workaround? I ned my users to be completely removed from ANY installation processes.

DanRollins,
  See my above comments re:ShellExecute. Thanks!!


0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7054641
>>See my above comments re:ShellExecute.
I Did see this:
>>I neglected to mention that ShellExecute was my first line of attack. It doesn't
>> raise any exceptions, but it doesn't install either.

You neglected to mention what parameters you used and what happened when you tried it.  And you did not answer my queries.  ShellExecute is the best method.  If it does not work, it will be most productive to figure out why it failed and then correct *that* problem.

-- Dan
0
 
LVL 22

Expert Comment

by:ambience
ID: 7055373
>> but it still keeps insisting on prompting for the file

have you specified the complete path to the file, possibly you can try changing the current directory to that folder as a workaround.
0
 
LVL 11

Expert Comment

by:griessh
ID: 7261468
Dear DrDelphi

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "ambience"

comment(s) as an answer.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7332877
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now