Jump to content

[How To] INF Uninstall Template


ricktendo

Recommended Posts

  • 2 months later...

Triple quotes are nothing but quoting a quote so it shows up, if you want a quote to actually come out you wrap it in quotes

We can thank code65536 for these delnoderundll32 flags:

Delete Folder
1 // delete the directory only if it's empty
2 // don't delete any sub-dirs; delete only the files
4 // don't delete the dir itself
8 // delete UNC [network] paths

Base question...no idea

Link to comment
Share on other sites

Triple quotes are nothing but quoting a quote so it shows up, if you want a quote to actually come out you wrap it in quotes

We can thank code65536 for these delnoderundll32 flags:

Delete Folder

1

Edited by shiner
Link to comment
Share on other sites

those flags are for advpack, not setupapi, setuapi and here http://msdn.microsof...v=vs.85%29.aspx

ocgen.dll, I know uses setuapi + advpack, I think it is still in 90% is based on SetupApi, as well as almost always in all microsoft inf, using the 32 flags, I believe and this

0x00000004 (COPYFLG_NOVERSIONCHECK)

Ignore file versions and write over existing files in the destination directory. This flag and the next two are mutually exclusive. This flag is irrelevant to digitally signed INF files.

0x00000008 (COPYFLG_FORCE_FILE_IN_USE)

Force file-in-use behavior: do not copy over an existing file of the same name if it is currently open. Instead, copy the given source file with a temporary name so that it can be renamed and used when the next restart occurs.

0x00000020 (COPYFLG_NO_VERSION_DIALOG)

Do not write over a file in the destination directory with the source file if the existing file is newer than the source file.

This flag is irrelevant to digitally signed INF files. If a driver package is digitally signed, Windows installs the package as a whole and does not selectively omit files in the package based on other versions already present on the computer.

Ciao.

Edited by OnePiece
Link to comment
Share on other sites

To Rick, Kels, Geej, or anyone else who wants to chip in,

I have begun studying infs and I have a few questions.

1. What is the deal with triple quotes? Why do some strings need triple quotes? Is there any understandable documentation on when these are needed?

2. I peeked at some of Geej's infs (unlocker and RunWith Params). Geej initiates the install by using advpack.dll LaunchInfSection, so those infs have a Default Install section and an Install section. What instances require such a method to launch an inf? (This appears to indicate that advpack.dll can do something that setupapi.dll can't. Is there any digestable documentation on the differences between advpack.dll and setupapi.dll, perhaps a table comparing what one can do that the other cannot and vice versa?)

3.

The only flag I have seen is "8". What does it mean, and are there any other flags?

4. When using RegShot, in the Version section, it always has:

Class=Base

What is that for? I notice that most of Ricks infs don't have this in the version section. I googled it but I only got something about firewire.

5.I had another question, but I forgot it at the moment.

Anyway, I have googled all this things, but what I have found and read didn't help much. So any insights would be appreciated.

[DefaultInstall] is use for normal installation when user right-click on the inf and select "Install".

See your default registry entry in

HKEY_CLASSES_ROOT\inffile\shell\Install\command

and

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\inffile\shell\Install\command

Then from my inf, advpack.dll is initiated as [DefaultInstall] is using setupapi.dll which does does not support certain directives.

For my inf, using advpack.dll can let me use the following below directives that setupapi.dll doesn't support.

BeginPrompt

EndPrompt

RunPreSetupCommands

RunPostSetupCommands

SmartReboot

DelDirs

Cleanup=1

CheckAdminRights

One thing advpack.dll that I know of is that it doesn't support RegisterDlls.

RegisterDlls is supported thru setupapi.dll (for normal installation) and [Optional Components] (for Setup).

To register some dll files via Advpack.dll, I normally use RunPreSetupCommands and/or RunPostSetupCommands.

RunPreSetupCommands/RunPostSetupCommands is useful if you wish to run a batch command. However note that path with space generally requires you to triple quote the whole string in inf as cmd does not interpret correctly file path with space.

This generally does not happen with syntax that are use in by the registry. The registry will interpret correctly file path with space correctly w/o quoting the whole string.

Having said that, you still need to quote it if file path is a command that takes some command parameter(s). Usually regtoinf converter will that care of these when you convert .reg to .inf

I have googled some links that you can read further... hope it is useful for learning inf.

Class=class-name info, some info here: http://www.osronline...format_2fzm.htm

INF DefaultInstall Section : http://www.osronline...format_33ea.htm

Advanced INF: http://www.mdgx.com/INF_web/

INF Directives : http://msdn.microsof...v=VS.85%29.aspx

You can also check how inf parse certain characters in inf via batch command. Test_RunPreSetupCommands.inf template as follow:

[Version]
Signature=$Windows NT$
[DefaultInstall]
RegisterDLLs=Start.Register
[Start.Register]
11,,rundll32.exe,,,"advpack.dll,LaunchINFSection %1%\%infname%.inf,Install"
[Install]
RunPreSetupCommands=TESTBatchString
[TESTBatchString]
; view how cmd parse " % ! ^ characters in inf ...
cmd /c """Echo Basically any strings with space need to triple quote"""&& Echo. && pause
cmd /c """Echo This is to generate a literal ^"" dblquote on console box """&& Echo. && pause
cmd /c """Echo Output 1 syntax %%""" && Echo. && pause && ::output as %
cmd /c """Echo Output 2 syntax %%%%""" && Echo. && pause && ::output is %%
cmd /c """Echo Output 3 syntax %%systemroot%%""" && Echo. && pause && ::output as C:\WINDOWS
cmd /c """Echo Output 4 syntax ^%%systemroot^%%""" && Echo. && pause && ::output as %systemroot%
cmd /c """Echo Output 5 Exclamation mark syntax !""" && Echo. && pause && ::output as !
cmd /c """Echo Output 6 caret syntax ^^""" && Echo. && pause && ::output as ^
cmd /c """Echo Output 7 single quote syntax '""" && Echo. && pause && ::output as '
[Strings]
infname=Test_RunPreSetupCommands

It appears I know a lot. Actually not so. There are a few challenges that I still do not know such as

-creating services solely using inf (w/o pre/post setup command via sc.exe). If anyone has sample ddon for services, let me know.

-Installing printer software drivers such that it appears in "Printers and Faxes" menu. Perhaps dopdf?

So far no one has create an inf addon for printer-driver type.

-hardware device installation. Obviously this is a whole new world of inf when it comes to device driver. Too complex to learn...giveup. :)

Let share inf knowledge whenever we can :)

INF is useful if you are fedup with svcpack installation that doesn't install exactly the way you want it.

Perhaps it launches the program or a website after installation, creating unwanted shortcut, etc. While generally can by further process via some script, it takes up additional disk space.

I have no regrets learning inf. It solves a lot of unattended installation headache that /whatever-switch generally comes with.

Link to comment
Share on other sites

Geej,

Thank you very much for your answer. I have read most of the documentation at osronline and mgdx a few times and been through the MS documentation a few times as well.

I have found that for software installation, I actually learn more by opening up other addon maker's infs and going through them. The structure and directives are not that hard to follow.

If I run into a problem in the future, I will post here again.

Thanks again to Rick, onepiece, Geej.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...