Solved

installling an INF programatically?

Posted on 2002-06-03
14
639 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

752 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