Jump to content

[How To] INF Uninstall Template


ricktendo

Recommended Posts

Thanks Rick. Thanks DM. Just retest all possible syntax in VM after I re-arrange sysoc.inf entry first and

then I test all the uninstall.

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

all tested ok.

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

doesn't work. Entry not removed. Same kind of Error message if click 'Add/rem Windows Components'.

Thanks for all the help. :thumbsup_anim:

Link to comment
Share on other sites

  • 1 year later...

and how to remove registry like this,with define new delete.AddDelReg in a uninstal section

example:

[install section]

AddReg =REGEntries.AddReg

[uninstal section]

AddReg =REGEntries.AddReg,delete.AddDelReg


Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved]
"{AC67E92C-D916-4058-A7B8-0913746592F4}"="HiddenFilesToggle Extension"

also how to delete this


Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\OpenWithProgids]
"SumatraPDF"=hex(0):

when convert to inf and use delete every thing

HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved"

but i want just delete this value {AC67E92C-D916-4058-A7B8-0913746592F4}

Edited by mona
Link to comment
Share on other sites

In your uninstall section you have to change AddReg to DelReg

An to delete onl that guid you can try one of the Append or DelVal numbers

REG_SZ = 0x00000000 (or 0)
REG_BINARY = 0x00000001 (or 1)
Reg_SZ_NOCLOBBER = 0x00000002 (or 2)
REG_BINARY_NOCLOBBER = 0x00000003 (or 3)
REG_MULTI_SZ_APPEND = 0x0001000A
REG_MULTI_SZ = 0x00010000
REG_DWORD = 0x00010001
REG_MULTI_SZ_NOCLOBBER = 0x00010002
REG_DWORD_NOCLOBBER = 0x00010003
REG_MULTI_SZ_DELVAL = 0x00010006
REG_ADDREG_APPEND = 0x00010008
REG_EXPAND_SZ = 0x00020000
REG_EXPAND_SZ_NOCLOBBER = 0x00020002

Link to comment
Share on other sites

Mona, I would use something like this for the uninstall


[Version]
Signature=$Windows NT$

[Optional Components]
MyRegTweaks

[DefaultInstall]
DelReg =REGEntries.DelReg

[MyRegTweaks]
OptionDesc =Registry Entries
Tip =Registry Entries removal
Modes =0,1,2,3
DelReg =REGEntries.DelReg

[REGEntries.DelReg]
HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved,{AC67E92C-D916-4058-A7B8-0913746592F4}
HKCU,Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\OpenWithProgids,SumatraPDF

Link to comment
Share on other sites

@Rick

how can use there value?

seems to hard,if add some example its good,and add it to frist post

@Geej

thanks working,but see this correct or no.some time work some time not work

i install this registry then via inf try to delete it.first time not working but second time working


Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.pdf]
@="SumatraPDF"

for delreg,this correct or no?


HKCR,.pdf,,,SumatraPDF

Link to comment
Share on other sites

for delreg,this correct or no?


HKCR,.pdf,,,SumatraPDF

Correct.

Can also written as


HKCR,.pdf,,0x0,SumatraPDF

as they are basically the same thing.

Usually, just export the .reg key, then convert it to inf using reg2inf. This will ensure the syntax stay correct before you tried to cut down some syntax for uninstalling purpose. Usually I don't manual code the reg inf syntax. I just use the conversion tool to do it for me.

Edited by Geej
Link to comment
Share on other sites

Hi, inf experts!

I have made an attempt to add uninstall to my QTAdressBar addon, but it fails at deleting files and folders, maybe because they are in use when uninstalling.

Original post and addon is here:

Can you take a look ?

Thanks !!

Link to comment
Share on other sites

In the Delete/CopyFiles section you put the filename followed by ,,,1 this will tell windows to delete the file on reboot if it is in use


[Copy.Delete.Files]
Filename.Ext,,,1

CopyFiles

[CopyFiles-section-name]

destination-file1-name(, source-file1-name)(, temporary-file1-name)(,flag)

destination-file2-name(, source-file2-name)(, temporary-file2-name)(,flag)

A list of the names of files to be copied from a source disk to a destination directory. The source disk

and destination directory associated with each file are specified in other sections of the INF file. The

file-list-section name must appear in the CopyFiles item of an Install section.

Note that you can specify the copying of a single file in the CopyFiles item of the Install section itself,

without building a CopyFiles section. To do this, use the special character "@" to force a single file

copy. An example of using the "@" character in a CopyFiles-type item is in the Install section reference

topic. Copying a single file in this way is somewhat limited because the source and destination filenames

must be the same in this case and you cannot use a temporary file.

destination-file-name

Name of the destination file. If no source filename is given, this is also the name of the source file.

source-file-name

Name of the source file. If the source and destination filenames for the file copy operation are the same,

this is not required.

temporary-file-name

Name of a temporary file for the file copy operation. The installer copies the source file but gives it the

temporary file name. The next time the operating system starts, it renames the temporary file to the

destination file name. This is useful for copying files to a destination which is currently open or in use

by Windows.

If the file is not in use by Windows, use flag 8 to force it to use the temporary name. This will only

work if the file already exists in in the target folder. To get around this, first copy the file into the folder,

then use flag 8 to copy it again.

flag

Optional parameter used to perform special actions during the installation process. Multiple flags can be

used by adding the values to create the combined flag. The following valid flags can be used:

Value Meaning
1 On CopyFiles: Warn if user tries to skip file.
1 On DelFiles: If file is in use, queue up delayed delete in wininit.ini. Otherwise an in-use file
will not be deleted.
2 Setup Critical: don't allow user to skip file.
4 Ignore version check and always copy file. This will overwrite a newer file.
8 Force Rename (trick engine into thinking that file is in use). Note: Only happens if file
already exists on target.
16 If file already exists on target, don't copy.
32 Suppress version conflict dialog and don't overwrite newer files.

This example copies three files:

[CopyTheseFilesSec]
file11 ; copies file11
file22,, file23,8 ; copies file22, temporarily naming it file23
file31, file32 ; copies file32 to file31

Link to comment
Share on other sites

thanks for the tip

I also use these commands to delete folders

[Cleanfolder]
"rundll32.exe advpack.dll,DelNodeRunDLL32 ""%16420%\Assembly\GAC_MSIL\QTAddressBar""",8
"rundll32.exe advpack.dll,DelNodeRunDLL32 ""%16420%\Assembly\GAC_MSIL\Interop.SHDocVw""",8
"rundll32.exe advpack.dll,DelNodeRunDLL32 ""%16420%\Assembly\QTAddr3_v2.0.50727_32""",8

Do you know how to execute those on next reboot ?

Edited by mooms
Link to comment
Share on other sites

Add a RunOnce/Ex to LaunchINFSection (new/separate INF section)


[Post.Uninstall]
DelFiles
Etc

BTW it should go like this

[Cleanfolder]
"rundll32.exe advpack.dll,DelNodeRunDLL32 ""%16420%\Assembly\GAC_MSIL\QTAddressBar"",8"
"rundll32.exe advpack.dll,DelNodeRunDLL32 ""%16420%\Assembly\GAC_MSIL\Interop.SHDocVw"",8"
"rundll32.exe advpack.dll,DelNodeRunDLL32 ""%16420%\Assembly\QTAddr3_v2.0.50727_32"",8"

Link to comment
Share on other sites

  • 3 weeks later...

hi

i want run Uninstall.vbs with in inf file.how cam i do it?

i try with RunPostSetupCommands but dont know why not work

%16422%\Utility\someFolder\Uninstall.vbs

also any way Available to auto igonre installed file via inf?

that mean just install none installed file and updated file and auto igonre installed file with same version

Edited by mona
Link to comment
Share on other sites

[RunPre/PostSetupCommand]
cscript //B %16422%\Utility\someFolder\Uninstall.vbs

For the ignore thing try the copyfiles flag sum of 16+32=48

16 If file already exists on target, don't copy.

32 Suppress version conflict dialog and don't overwrite newer files.

[CopyFiles]
Filename.ext,,,48

Link to comment
Share on other sites


[Version]
Signature=$Windows NT$
[Defaultinstall]
CopyFiles = secur
Addreg = secur.addreg
ProfileItems = secure,secure1
[Optional Components]
notepad
[Notepad]
OptionDesc = "T-Clock xp"
Tip = "T-Clock"
Modes = 0,1,2,3
CopyFiles = secur
Addreg = secur.addreg
ProfileItems = secure,secure1
[SourceDisksNames.x86]
1="Notepad2 Install Files","ShowDe.cab",,"i386"
[DestinationDirs]
secur = 16422,"Utility\SecureFolder"

[SourceDisksFiles]
secu1.txt =1
secu2.txt =1
secu3.txt =1
secu4.txt =1
secu5.txt =1
secu6.txt =1
secu7.txt =1
secu8.url =1
[secur]
History.txt,secu1.txt
license.rtf,secu2.txt
ReadMe.rtf,secu3.txt
SecureFolder.exe,secu4.txt
Settings.xml,secu5.txt
Uninstall.vbs,secu6.txt
Update.exe,secu7.txt
Website.url,secu8.url

[secure]
Name = Secure Folder
CmdLine = 16422,"Utility\SecureFolder\SecureFolder.exe",
SubDir = Utility
WorkingDir = 16422,Utility,SecureFolder
InfoTip = "Lock/Unlock with Secure Folder"
[secure1]
Name = Secure Folder,0x00000008,9
CmdLine = 16422,"Utility\SecureFolder",SecureFolder.exe
SubDir = Tools
WorkingDir = 16422,Utility,SecureFolder
InfoTip = "Lock/Unlock with Secure Folder"
[secur.addreg]
HKLM,"%RemoveM%\SecureF","Comments",0,"Lock, Hide and Encrypt folders with password."
HKLM,"%RemoveM%\SecureF","DisplayIcon",0,"%16422%\Utility\SecureFolder\SecureFolder.exe"
HKLM,"%RemoveM%\SecureF","DisplayName",0,"Secure Folder V5.4.0.0"
HKLM,"%RemoveM%\SecureF","DisplayVersion",0,"5.4.0.0"
HKLM,"%RemoveM%\SecureF","NoModify",0x00010001,01,00,00,00
HKLM,"%RemoveM%\SecureF","NoRepair",0x00010001,01,00,00,00
HKLM,"%RemoveM%\SecureF","Publisher",0,"Subin Ninan ™"
HKLM,"%RemoveM%\SecureF","ParentDisplayName",0,"UltraPacK Software V3.2.1"
HKLM,"%RemoveM%\SecureF","ParentKeyName",0,"UltraPack Software"
HKLM,"%RemoveM%\SecureF","UninstallString",0,"rundll32.exe advpack.dll,LaunchINFSection UltrMona.inf,secureuninstall"
HKLM,"%RemoveM%\SecureF","URLInfoAbout",0,"http://sites.google.com/site/securefolders/"
HKLM,"%RemoveM%\SecureF","HelpLink",0,"http://sites.google.com/site/securefolders/"
HKLM,"%RemoveM%\SecureF","URLUpdateInfo",0,"http://www.wincert.net/forum/index.php"
[Strings]
UninsQuestsecure = "Do You Want Uninstall SecureFolder?"
UninsFinalsecure = "SecureFolder was successfully uninstalled!"
RemoveM ="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"

[secureuninstall]
BeginPrompt = BeginUnInsPromptsecure
EndPrompt = EndUnInsPromptsecure
RunPreSetupCommands = Kill.sd:1
DelReg = secur.addreg,0secur.addreg
ProfileItems = SecureFol.DelShortcut,SecureFol.DelShortcut2,secyre.DelShortcut1,Tool.DelShortcut13
RunPostSetupCommands = securdel:1
[Kill.sd]
TASKKILL /F /IM SecureFolder.exe
tskill SecureFolder
TASKKILL /F /IM Update.exe
tskill Update

[securdel]
cscript //B %16422%\Utility\SecureFolder\Uninstall.vbs

[0secur.addreg]
HKLM,"%RemoveM%\SecureF"
HKLM,"%ARPCache%\SecureF"
[SecureFol.DelShortcut]
Name = Secure Folder,0x00000002
SubDir = Utility
[SecureFol.DelShortcut2]
Name = Secure Folder,0x00000003
SubDir = Utility
[secyre.DelShortcut1]
Name = Secure Folder,0x0000000A,9
SubDir = Tools
[Tool.DelShortcut13]
Name = Secure Folder,0x00000003
SubDir = Tools
[BeginUnInsPromptsecure]
Prompt = %UninsQuestsecure%
Title = %UninsTitle%
ButtonType = OKCANC
[EndUnInsPromptsecure]
Prompt = %UninsFinalsecure%

Also about below i try and report


For the ignore thing try the copyfiles flag sum of 16+32=48

Edited by mona
Link to comment
Share on other sites

Two commas after secu4.txt, because you also count the comma before secu4.txt

Try these different RunPost commands

[securdel]
"cscript //B ""%16422%\Utility\SecureFolder\Uninstall.vbs"""
;or
"cmd /c cscript //B ""%16422%\Utility\SecureFolder\Uninstall.vbs"""

Also try RegisterDLLs

[regdll]
11,,cscript.exe,,,"//B ""%16422%\Utility\SecureFolder\Uninstall.vbs"""
;or
11,,cmd.exe,,,"/c cscript //B ""%16422%\Utility\SecureFolder\Uninstall.vbs"""

Link to comment
Share on other sites

i test Four way but not work.also i copy cscript.exe to this folder and drag&drop Uninstall.vbs on it

but not work.just open cmd in Utility\SecureFolder and type Uninstall.vbs and enter work.

also about 16+32=48 i test and work,but i not sure,seems if file Extension has the number it copyied.

file,au3,some-file.au3,,48

also with 48 if the source file newer than destination it not copy new file to destination.

so i searched and found this link so for do this must use 64 ,so 64+48=112 i try but dont work?

SecureFolder.exe,secu4.txt,,112

can you tellme how it work?

Edited by mona
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...