Solved

installling an INF programatically?

Posted on 2002-06-03
14
631 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

762 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

19 Experts available now in Live!

Get 1:1 Help Now