1

I want to run from my C++ application the repair for other application - execute programatically what will happen when I manually select repair option for program in Windows->Control Panel->Program.

For remove option, I could just search registry for:

  • KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
  • HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall on a 64-bit machine)

And than use the UninstallString to find which command I have to execute with System() function.

But how to run repair in the similar way? There is no such position in registry for programs like RepairString.

I want to find general method for all programs (of course I mean the programs that left information in registry).

Additional question: is it possible that applications listed by e.g MsiEnumProductsEx don't have their UninstallString registry entry?

p.s. Info about registry entires for remove option I took from great Pat's post:

Is there Uninstall a program batch for windows?

Community
  • 1
  • 1
PolGraphic
  • 3,233
  • 11
  • 51
  • 108
  • 1
    Note that not all programs have a repair option in Control Panel. – Memo Oct 16 '13 at 03:04
  • I know, but I want to run it for the programs that have it. In the most common way. – PolGraphic Oct 16 '13 at 03:16
  • There is no "common" way. Different types of installers (MSI, InstallShield, InstallAware, etc) implement recovery in different ways (if at all), and Windows is unaware of those ways. – Remy Lebeau Oct 16 '13 at 03:39
  • But programs like CCleaner etc. have the functionality to run that repair. I have found that there is something like 'ModifyPath' in registry - maybe it's a good way – PolGraphic Oct 16 '13 at 04:50

2 Answers2

1

If the program was installed with the Microsoft Installer, it is possible to call MSIEXEC with an appropriate set of switches. The switches are documented in the TechNet Docs.

But even if you use this, the repair options differ extremely. And in a lot of cases you can't launch the repair if the original MSI files are no longer available (CD isn't inserted, or the downloaded file is already deleted).

xMRi
  • 14,982
  • 3
  • 26
  • 59
0

Usually installation packages are created using MSI apis http://msdn.microsoft.com/en-us/library/windows/desktop/aa372860(v=vs.85).aspx

WIX is used to write MSI packages. Start with http://wix.tramontana.co.hu/tutorial/getting-started

Balu
  • 2,247
  • 1
  • 18
  • 23