Would this be possible to do with an inf uninstaller?

Discuss & post Update Pack addons here.
Post Reply
User avatar
Mrs Peel
The Dominatrix Recoded
Posts: 1344
Joined: Tue Jan 17, 2006 2:02 am
Location: Aotearoa
Contact:

Would this be possible to do with an inf uninstaller?

Post by Mrs Peel » Mon Aug 27, 2007 7:11 am

Hiya addon guru's and inf magicians, I have a couple of questions for y'all....

Firstly....

Is there any way that I can use the inf file to generate a filename based upon a windoze user variable?

An example of this is that one of my addons I am trying to rebuild with an uninstaller, when you run the program for the first time it creates a sub-directory in the program root called "Username Data Files". In order for my uninstaller to work with the DelDir directive, it would need to know what this exact folder name is, so I am trying to find a way to use a system variable in my installer and uninstaller which would represent this:

1. Create directory name: "%user% Data Files"
2. Copy files to that generated directory name

I know that VB scripting has the possibility to find out the name of the current user profile and insert their profile name as a variable, but all the peeps I have spoken to so far say it would not be possible to do this with an inf file unless it was able to call on a batch file which located and inserted this information. Batch files are a total mystery to me, so I hope there is another way.

Secondly....

A handful of my addons are storing data in the userprofile app data, which I personally like to delete on uninstall BUT I am aware that many users would not want their app data to be deleted in case they want to reinstall the program again later and wish to retain those settings.

So, I am wondering if there is any way possible with an inf-uninstall that there could be a two-stage uninstaller process which would go something like this:

1st Prompt: "Do you really want to remove the program XYZ Application?" (Y/N)
2nd Prompt: "Do you wish to delete the settings in your application data folder?" (Y/N)

I am probably being overly hopeful that an inf file can perform such complex tasks, but I thought I would just ask anyway since there are so many clever members here who know way more about this stuff than I can get my brain around.

Thanks for reading.

User avatar
ricktendo64
Posts: 3213
Joined: Mon May 22, 2006 12:27 am
Location: Honduras

Re: Would this be possible to do with an inf uninstaller?

Post by ricktendo64 » Mon Aug 27, 2007 11:16 am

Mrs Peel wrote:Secondly....

A handful of my addons are storing data in the userprofile app data, which I personally like to delete on uninstall BUT I am aware that many users would not want their app data to be deleted in case they want to reinstall the program again later and wish to retain those settings.

So, I am wondering if there is any way possible with an inf-uninstall that there could be a two-stage uninstaller process which would go something like this:

1st Prompt: "Do you really want to remove the program XYZ Application?" (Y/N)
2nd Prompt: "Do you wish to delete the settings in your application data folder?" (Y/N)
Yes there can be a two stage uninstaller, you can do RunPost/PreSetupCommands to launch another inf section with only BeginPrompt asking if you want to do additional tasks such as delete other settings example:

Code: Select all

[UninstallSection]
BeginPrompt         =BeginUnInsPrompt
RunPreSetupCommands =Close.Program:1,Un.Register.Program
DelFiles            =Program.Files,PNF.File
DelReg              =Obsolete.Reg
ProfileItems        =Program.DelShortcut
UpdateInis          =sysoc.Edit,Localized.Shortcuts
EndPrompt           =EndUnInsPrompt
RunPostSetupCommands=Run.Prompt2
Cleanup             =1

[Run.Prompt2]
RUNDLL32 advpack.dll,LaunchINFSection %INF_FILE%,Prompt2.Section

[Prompt2.Section]
BeginPrompt=BeginSecPrompt
DelFiles= ;etc, etc.

; Uninstall prompt
[BeginUnInsPrompt]
Title     =%PROG_NAME% Uninstaller
Prompt    =Are you sure you want to uninstall the %PROG_NAME% from your computer?
ButtonType=OKCANC

; Second Prompt
[BeginSecPrompt]
Prompt    =Do you want to delete the %PROG_NAME% settings also?
ButtonType=YESNO

; Uninstall complete popup
[EndUnInsPrompt]
Prompt=Congratulations! the %PROG_NAME% was uninstalled successfully.
EDIT: I think for the problem with the "%user% Data Files" you should go the 8.3 Dosnames way.
I've used examples like this in my [Strings] section to CopyFiles to and also to add ProfileItems

Code: Select all

Name=Program Shortcut Name
SubDir=PROGRA~1\WINDOW~4\SHARED~1
If one of the CMD experts on RyanVM (like odyn1982) can figure out a universal 8.3 filename for your "%user% Data Files" folder then you can use that in your Strings section to copy files to the generated forlder.

Note: the folder must exist for copyfiles and the 8.3 dosname to work. Maybe if you use RunPreSetupCommands to MD (make dir) "%user% Data Files" then use copyfiles and the 8.3 dosname as the subdir.

Code: Select all

[DestinationDirs]
Prog.Files=16422,DOSNAME~1

User avatar
Mrs Peel
The Dominatrix Recoded
Posts: 1344
Joined: Tue Jan 17, 2006 2:02 am
Location: Aotearoa
Contact:

Post by Mrs Peel » Mon Aug 27, 2007 7:27 pm

Thanks for the reply. This RunPostSetupCommands makes good sense to me, so I will have a fiddle with it on one of the addons I am rebuilding and report back to let you know how it goes. Cheers.

Post Reply