Jump to content

[How To] INF Uninstall Template


ricktendo

Recommended Posts

I wrote this template to create a INF Uninstaller for those small apps that come in zip files and don't have any install/uninstallers. (feel free to ask questions and improve on it any way you like)

;ricktendo64 2007

[Version]
Signature="$CHICAGO$"

;Add this to your [Optional Componenets]
[Add This]
AddReg=Uninstall.AddReg

;Tells the INF what directory & sub-folder the [Program.Files] are located
[DestinationDirs]
Program.Files=16422,%PROG_DIR%

;Adds option to "Add or Remove Programs"
[Uninstall.AddDelReg]
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%PROG_NAME%","DisplayIcon",0,"%16422%\%PROG_DIR%\Program.exe"
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%PROG_NAME%","DisplayName",0,"%PROG_NAME%"
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%PROG_NAME%","DisplayVersion",0,"%VERS%"
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%PROG_NAME%","NoModify",0x10001,01,00,00,00
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%PROG_NAME%","NoRepair",0x10001,01,00,00,00
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%PROG_NAME%","UninstallString",0,"rundll32.exe advpack.dll,LaunchINFSection %MAIN_INF%,Uninstall"

;Uninstall section that will be launched
[Uninstall]
BeginPrompt =BeginUnInsPrompt
RunPreSetupCommands =Close.Program:1 ;<- The ":1" Flag Hides the taskkill.exe CMD window (does not need to be in section name)
DelFiles =Program.Files,PNF.File
DelDirs =Program.Dirs
ProfileItems =Program.DelShortcut
DelReg =Uninstall.AddDelReg
UpdateInis =sysoc.Edit
EndPrompt =EndUnInsPrompt
RunPostSetupCommands=Dir.Delete,Launch.Website
Cleanup =1

;Closes program executable if running before uninstall
[Close.Program]
TASKKILL /F /IM Program.exe
;for XP Home compatibility use
TSKILL Program ;<- tskill fails if you add the file extention (bad example: tskill program.exe)

;Program files to delete, will not work without a DestinationDir
[Program.Files]
Program.exe
Program.ini
ShellExt.dll,,,1 ;The ",1" flag is used if the file is in use, so entries will be added to the registry to delete it on next boot.

;Obsolote PNF file created during Windows Setup (Requires a entry in DestinationDirs example PNF.File=17)
[PNF.File]
addon.PNF

;Deletes Start Menu shortcut using profileitems the secret is the ",0x00000002" flag (also used is 3 and 4)
[Program.DelShortcut]
Name =%PROG_NAME%,0x00000002
SubDir=%SUB_DIR%

;Removes addon entry from sysoc.inf so Cleanup=1 does not break Add/Rem Windows Components
[sysoc.Edit]
%17%\sysoc.inf,Componets,Whatever Is Under [Optional Components]=*

;Deletes Program Folder (will only delete empty folder)
[Program.Dirs]
%16422%/%PROG_DIR%

;Deletes Folders and files in them
[Dir.Delete]
rundll32.exe advpack.dll,DelNodeRunDLL32 %16422%\%PROG_DIR%,<flag>

[Launch.Website]
rundll32.exe url.dll,FileProtocolHandler [url="http://www.ryanvm.net/msfn/"]http://www.ryanvm.net/msfn/[/url]

;Uninstall Prompt
[BeginUnInsPrompt]
Title =%PROG_NAME% Uninstaller
Prompt =Are you sure you want to remove %PROG_NAME% from your computer?
ButtonType=YESNO ;<- YESNO or OKCANC

;Optional End Prompt (not really nessesary just tells you the uninstall was a success.)
[EndUnInsPrompt]
Prompt=%PROG_NAME% was successfully removed from your computer.

;Here you tell the INF what all the variables are (Example: lets say %VAR% so under strings you add VAR=VARIABLE)
[Strings]
MAIN_INF ="Program.inf"
PROG_DIR ="Program Folder"
PROG_NAME="Program Name"
SUB_DIR ="Start Menu Sub"

Link to comment
Share on other sites

  • 6 months later...

Thanks for this nice example.

However I'm still not entierly clear on how to insert a exactly specified directory there. For example working on the IE uninstall ini file, at the very end I would like something like that:

; delete whole IE directory
[files.del.ie]
rundll32.exe advpack.dll,DelNodeRunDLL32 %16422%\%"Internet Explorer"%,<flag>

But it does not work. Could be the commas not welcome there?

Link to comment
Share on other sites

Well, it does not work. Included the file, can you tell me, what I doing wrong?

So, something in the % mean that this is a variable, defined elsewhere. So when I define it just in the place, then it is not need, okay. That is why I had there the add %. The flag I copy directly from your example. And should not be the Internet Explorer path in commas? It does contain a space, so I thought...

And what the 8 at the end does mean?

In the file I include are deleting files made this way:

[DefaultInstall]

DelFiles = files.del.sys

[DestinationDirs]

files.del.sys = 11

[files.del.sys]

actxprxy.dll, 1

asctrls.ocx,,,1

cdfview.dll,,,1

...etc...

But that only delete already known files and files in the defined directory too. When I want to remove whole dir wih bunch of files, well, that is a problem. How can do it, I don't know.

But I would love to be able automatize my cleaning up of windows 2000 SP4 :D

uninstall_IE.zip

Link to comment
Share on other sites

  • 1 month later...

So, a little bump/help? How I delete directory?

Using

[DestinationDirs]

files.del.ie = 16422,Internet Explorer

[files.del.ie]

11,,iexplore.exe, 1

11,,hmmapi.dll, 1

Is possible to delete the files inside of the Internet Explorer dir, however not dirs and not the WHOLE IE directory as I very much want to do so.

When I add this:

rundll32.exe advpack.dll,DelNodeRunDLL32 16422\Internet Explorer

...it does not work as well. Help? :(

PS: rundll32.exe advpack.dll,DelNodeRunDLL32 C:\Program files\Internet Explorer

from commandline it does delete the Internet Explorer dir, even with files inside. Same doest NOT do the shorter version:

rundll32.exe advpack.dll,DelNodeRunDLL32 16422\Internet Explorer

...probably because there is a difference between commandline and commands inside of the inf file... Both versions also does not work at all inside of the inf file :(

Not even using it like this:

[Dir.Delete]

rundll32.exe advpack.dll,DelNodeRunDLL32 C:\Program files\Internet Explorer

Edited by trodas
Link to comment
Share on other sites

  • 2 months later...
  • 5 weeks later...

hello some sofware after frist run create option file or dat file to the some directory i need to create unistall

section for this example in SumatraPDF after frist run create (sumatrapdfprefs.dat)file

in a C:\Documents and Settings\user\Application Data\SumatraPDF

ho to create unistall section for add to inf file for delete thissum.inf.rar

Link to comment
Share on other sites

Just create a new section with that file and add it to DelFiles and DestinationDirs example:

[DestinationDirs]
CopySumraP = 16422,"Utilities\SumatraPDF"
NewSectionName = 16410,"SumatraPDF" ; %userprofile%\Application Data\SumatraPDF

DelFiles = CopySumraP,NewSectionName

[NewSectionName]
sumatrapdfprefs.dat
AnotherFileExample.ext

Dont forget to add it to DestinationDirs, if not DelFiles will not work

Link to comment
Share on other sites

  • 3 months later...

Thanks for very informative post.

I have installed an inf and I am unable to "uninstall".

My inf file contains a part about "uninstall" but I feel unable to use it.

I would be most grateful for some indications as to how to uninstall.

The inf file is attached, but for your convenience, here is the full text of my inf file:

[version]

signature="$CHICAGO$"

Class = MEDIA

[DefaultInstall]

CopyFiles = Util.Files.Sys

AddReg = Util.Add.Reg.Sys

UpdateInis= AddSysIniEntry

[DefaultUnInstall]

DelFiles = Util.Files.Sys

DelReg = Util.Del.Reg.Sys

UpdateInis= DelSysIniEntry

[DestinationDirs]

Util.Files.Sys = 11

[sourceDisksNames]

1="PANA",,1

[sourceDisksFiles]

pdvcodec.dll=1

[util.Files.Sys]

pdvcodec.dll

panadv.inf

[util.Add.Reg.Sys]

HKLM,SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.dvsd,Description,,%*PANA.DeviceDesc%

HKLM,SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.dvsd,Driver,,pdvcodec.dll

HKLM,SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.dvsd,FriendlyName,,%*PANA.DeviceDesc%

[util.Del.Reg.Sys]

HKLM,SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.dvsd,Description

HKLM,SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.dvsd,Driver

HKLM,SYSTEM\CurrentControlSet\Control\MediaResources\icm\vidc.dvsd,FriendlyName

[AddSysIniEntry]

system.ini, drivers32,,"vidc.dvsd=pdvcodec.dll",0

[DelSysIniEntry]

system.ini, drivers32,,"vidc.dvsd=pdvcodec.dll",0

[strings]

*PANA.DeviceDesc="PANA"

pdvcodec.zip

Link to comment
Share on other sites

  • 10 months later...

Thanks for the sample template. :)

I'm trying my hand on a simple addon. So far, encounter problem. It can install and uninstall properly. After uninstalled, the only problem is I got an error message when I tried to launch 'Add/Rem windows components' despite that I have included my inf with the above

[sysoc.Edit] portion and updateinis entry.

I checked sysoc.inf entry after uninstall and the program still listed there:

[Components]
Rota=ocgen.dll,OcEntry,Rota.inf,HIDE,7

Screenshot

http://www.kwikpiks.com/files/66/error.jpg

Can you guy help to check what is wrong with my inf? Rota.inf as below :

[Version]
Signature=$Windows NT$

[Optional Components]
Rota

[DefaultInstall]
CopyFiles =Rota.Files,@Rota.INF
ProfileItems=Rota.AddShortcut
AddReg =Rota.AddReg

[Rota]
OptionDesc ="Rota v0.70"
Tip ="Lossless Jpg Batch Rotator via GUI"
Modes =0,1,2,3
CopyFiles =Rota.Files
ProfileItems=Rota.AddShortcut
AddReg =Rota.AddReg

[SourceDisksNames.x86]
1="Rota Files","Rotav07.cab",,"i386"

[DestinationDirs]
Rota.Files=16422,Rota
DefaultDestDir =17
PNF.File =17

[SourceDisksFiles]
droot.gif=1
readme-e.html=1
readme.html=1
Rota.exe=1
rotadisp.gif=1
rotainf.gif=1
rotainit.gif=1
rotamod.gif=1
rotamode.gif=1
rotanorm.gif=1
rotaopen1.gif=1
rotaopen2.gif=1
rotaro.gif=1
rotarow.gif=1
test1.jpg=1
test1l.jpg=1
test2.jpg=1
test2l.jpg=1
test3.jpg=1
test3l.jpg=1
test4.jpg=1
test4l.jpg=1
test5.jpg=1
test5l.jpg=1
Rota.ini=1

[Rota.Files]
droot.gif
readme-e.html
readme.html
Rota.exe
rotadisp.gif
rotainf.gif
rotainit.gif
rotamod.gif
rotamode.gif
rotanorm.gif
rotaopen1.gif
rotaopen2.gif
rotaro.gif
rotarow.gif
test1.jpg
test1l.jpg
test2.jpg
test2l.jpg
test3.jpg
test3l.jpg
test4.jpg
test4l.jpg
test5.jpg
test5l.jpg
Rota.ini

[Rota.AddShortcut]
Name =Rota
CmdLine =16422,Rota,Rota.exe
SubDir =Rota
WorkingDir=16422,Rota
IfoTip =Loss-less JPEG rotate utility.

[Rota.AddReg]
HKLM,%UNINSTALL%,"Comments",0x0,"Loss-less JPEG rotate utility"
HKLM,%UNINSTALL%","DisplayIcon",0x0,"%16422%\Rota\Rota.exe"
HKLM,%UNINSTALL%,"DisplayName",0x0,"Rota"
HKLM,%UNINSTALL%,"DisplayVersion",0x0,"0.7"
HKLM,%UNINSTALL%,"NoModify",0x10001,01,00,00,00
HKLM,%UNINSTALL%,"NoRepair",0x10001,01,00,00,00
HKLM,%UNINSTALL%,"Publisher",0x0,"TsuruZoh Tachibanaya"
HKLM,%UNINSTALL%,"UninstallString",0x0,"rundll32.exe advpack.dll,LaunchINFSection Rota.inf,Uninstall"
HKLM,%UNINSTALL%,"URLInfoAbout",0x0,"http://park2.wakwak.com/~tsuruzoh/index-e.html"

[UnInstall]
BeginPrompt =BeginUnInsPrompt
RunPreSetupCommands=Close.Rota:1
DelFiles =Rota.Files,PNF.File
DelDirs =Rota.Dirs
DelReg =Obsolete.Reg
ProfileItems =Rota.DelShortcut
UpdateInis =sysoc.Edit
EndPrompt =EndUnInsPrompt
Cleanup =1

[Close.Rota]
TSKILL Rota

[PNF.File]
Rota.PNF

[sysoc.Edit]
%17%\sysoc.inf,Components,Rota=*

[Obsolete.Reg]
HKLM,"%UNINSTALL%\"

[Rota.DelShortcut]
Name =Rota,0x00000002
SubDir=Rota

[Rota.Dirs]
%16422%/Rota

[BeginUnInsPrompt]
Title =Rota 0.7 Uninstall
Prompt =Are you sure you want to completely remove Rota?
ButtonType=YESNO

[EndUnInsPrompt]
Prompt=Rota was successfully removed from your computer.

[Strings]
UNINSTALL="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Rota"

BTW, is this a typo error for the word 'Componets' in post #1? I think it should be Components but better to confirm with you guys.

;ricktendo64 2007
;Removes addon entry from sysoc.inf so Cleanup=1 does not break Add/Rem Windows Components
[sysoc.Edit]
%17%\sysoc.inf,Componets,Whatever Is Under [Optional Components]=*

Link to comment
Share on other sites

Yes its a typo and your INF looks good, I dont see any issues

The thing that fixes the error in add/rem windows components is the entry in sysoc.inf that you add to install it, if you delete your .inf file when you uninstall the program you will also have to delete the entry in sysoc.inf.

Link to comment
Share on other sites

Thanks Rick for the fast 'inspection' and reply. Thanks DaRk MaDnEsS for suggesting alternative. I will try that.

(It is real hardwork to script inf by hand ;) )

Apparently something is wrong (not Rota.inf anymore) that I get this message.

Another thing: If I live with this error and proceed to uninstall another TrueAddon, say BJFrog_UltraISO, this error message issue is gone. But when I compare before and after sysoc.inf entry, a large part of sysoc.inf is removed!. Very strange.

The part that gone from sysoc.inf is: All the rest of [Components] are wipe clean like Winrar,uberpack,CabMak,etc

I'm using HFSLIP.

How many [Components] section are listed in your slipstreamed sysoc.inf?

I have 3 [Components] sections and the portion that was wipe out belongs to 2nd & 3rd [Components] section/entry, leaving only the 1st

part of [Components] intact.

1st part of [Components] happens to list most of original XP Components.

See my screenshot (A picture says a thousands word, I guess)

http://www.kwikpiks.com/files/66/B4AfterSysoc.png

Edited by Geej
Link to comment
Share on other sites

Thanks Rick for the fast 'inspection' and reply. Thanks DaRk MaDnEsS for suggesting alternative. I will try that.

(It is real hardwork to script inf by hand ;) )

Apparently something is wrong (not Rota.inf anymore) that I get this message.

Another thing: If I live with this error and proceed to uninstall another TrueAddon, say BJFrog_UltraISO, this error message issue is gone. But when I compare before and after sysoc.inf entry, a large part of sysoc.inf is removed!. Very strange.

The part that gone from sysoc.inf is: All the rest of [Components] are wipe clean like Winrar,uberpack,CabMak,etc

I'm using HFSLIP.

How many [Components] section are listed in your slipstreamed sysoc.inf?

I have 3 [Components] sections and the portion that was wipe out belongs to 2nd & 3rd [Components] section/entry, leaving only the 1st

part of [Components] intact.

1st part of [Components] happens to list most of original XP Components.

See my screenshot (A picture says a thousands word, I guess)

http://www.kwikpiks.com/files/66/B4AfterSysoc.png

in the original there is 2 sections

i got the windows tools and the second is empty i don't know about Hfslip

but i think it should integrate to the original one

and it seems that Ultra iso addon got a typo also

%17%\sysoc.inf,Componets,UltraISO=*

Link to comment
Share on other sites

I manually re-combined all entries in [Componments] section of sysoc.inf into 1 section only and the rota.inf entry was properly removed. So I guess it is HFslip's handling of new entry to sysoc.inf that is causing the problem.

Thanks for spotting utlraiso problem too. I think it should be

%17%\sysoc.inf,Components,EZSystems=*

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