Code: Select all
;ricktendo64 2007 [Version] Signature=$Windows NT$ ;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 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 http://www.ryanvm.net/msfn/ ;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"
OSR PDF GUIDE
MSDN PDF GUIDE
How to use "Add Remove Windows Components" to Install/Uninstal
If you want you can also use "Add/Remove Windows Components" to add a Install/Uninstall entry
In your addons entry*.ini ommit HIDE from the [sysoc] edit, this shows your Optional Component's addon name in add/rem comp
Add a "Uninstall=" section to your Optional Component. Optional, you can add IconIndex= followed by the number of your prefered Icon (if anybody knows the DLL that has these icons please let me know, I don't think its moricons.dll)[sysoc]
Code: Select all
[Optional Components] Any Name [Any Name] OptionDesc ="Program Name" ;this will display your program's name in add/rem comp Tip ="Program Info Tip." ;Info tip in add/rem comp Modes =0,1,2,3 AddReg =AddOn.AddReg CopyFiles =AddOn.Files ProfileItems=AddOn.Shortcut Uninstall =Uninstall.Section ;<- ADD THIS IconIndex =20
Now you wont be able to use some of the INF uninstall tricks like RunPost/PreSetupCommands, Begin/EndPrompt. They only work with advpack.dll.
Its pretty straight forward, same as Uninstall above but a little more simple
Code: Select all
[Uninstall.Section] DelFiles =AddOn.Files DelDirs =AddOn.Dirs ProfileItems=AddOn.DelShortcut Etc. Etc.