Jump to content
Excelsior Forums
Sign in to follow this  
eLeB

How to prevent to register more than 2 same programs?

Recommended Posts

Hello again, :D

When i choose install without remove previous installation, two or more can be seen that the program is installed.

and then uninstall one, other one still exists in the registry.

I thinks it as inconvenience that can be serious.

if installation packaged without create registry, even warning dialog doesn't appear.

How can i remove previous registry? or prevent this problems?

Thanks for reading.

Share this post


Link to post
Share on other sites

Sorry for the delay with the answer.

Due to security reason, if the registry key existed before installation it won't be removed at uninstallation. It means that there is no "regular" way to clear registry if application has been installed without removing previous installation.

Please take into account, that only registry key isn't removed. All registry values created at installation time will be removed at uninstallation.

Currently there is no option to disable several installation of the same package.

As a workaround you can export your project into NSIS scripts and adjust the handler of corresponding warning dialog.

1. Select "File -> Export to NSIS" in the main menu to create NSIS scripts.

2. Open the generated "*.nsi" file and find the string

MessageBox MB_YESNO "$(MSG_PREV_INST_FOUND)" IDYES L_DoInstall

3. Replace this string by the following one

MessageBox MB_OK|MB_ICONSTOP "$(MSG_PREV_INST_FOUND)"

4. In each "*_Lng*.nsh" file find a line containing "MSG_PREV_INST_FOUND" and remove the end of this line since "$\r$\n$\r$\n". Please keep a closing quotation mark.

For example, the English message string:

${LangFileString} MSG_PREV_INST_FOUND "Previous installation of $(^Name) was found.$\r$\nIt is recommended to remove it before installing this version.$\r$\n$\r$\nDo you wish to continue without removing the previous installation?"

Should be truncated to the

${LangFileString} MSG_PREV_INST_FOUND "Previous installation of $(^Name) was found.$\r$\nIt is recommended to remove it before installing this version."

5. Compile modified scripts by the NSIS compiler.

May be it will be better to use Excelsior Delivery 2.2 and export your project to MSI. By default, generated Windows Installer setup package does not allow to install the same application twice.

1. Select "File -> Export to WiX" in the main menu to create WiX source code and produce Windows Installer setup package.

Share this post


Link to post
Share on other sites

Thanks for your answer.

It's so good to me. especially, Export to NSIS were nicely solve my problems.

but i didn't change message box and text. because Export to NSIS doesn't have any registry problems.

In my cases, i have some curiosity about excelsior.

i did make batch file to solve this problems. and added it as 'run always' in package. for example,

@echo off

reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Tester_1" /f

reg delete "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Tester_1" /f

it works, but this had a problems that uninstallation cannot remove registry at once.

so, i tried to add callback dll in uninstall setting. it hadn't success yet.

how about it?

p.s

If add a fuction that 'Uninstaller appearance' in step 3, it will be very usefull to the person who can't use C++.

Thanks.

Share this post


Link to post
Share on other sites

It is nice to see that "Export to NSIS" has helped to solve the issue.

To say the truth, I haven't understood the last question about "Run always" action.

Would you please to give us more details.

What version of Excelsior Installer/Delivery do you use?

What issue do you want to solve using the "Run always" action?

What happened?

What were you expecting to happen?

Thank you in advance.

Share this post


Link to post
Share on other sites

Excelsior Delivery 2.1 :lol:

To solve issue I had use batch file at 'Step 3 Post-install actions' to remove unnessary registry.

it had successfully remove extra registry after installation, but had to remove remain registry after uninstallation.

that's why i think about 'Uninstaller appearance at Step 3'. if supported this i can handle uninstallation like installation.

Of course 'Export to NISS' solve the issue, but but it had a problem. that shortcut icon images disappeared.

Thanks for your reading again.

Share this post


Link to post
Share on other sites

Thank you very much for clarification.

You are right, it is good idea to launch at uninstall time a exe- and bat- files as well as a DLL.

We have added this feature in our list of requested features.

By the way, we are working on the extension of callback DLL. New callback function will be provided to a callback DLL. Callback DLL can request Excelsior Delivery to modify System registry and environment variables using this new function. All such modifications will be automatically removed at uninstall time.

For example, the following callback DLL insert the path to the "bin" subfolder of main installation folder into %PATH% environment variable.

install.c

 
#include "excelsiorInstallerAPI.h"

#define XDS_BIN_DIR    L"\\bin"

ExcelsiorCallback eit;

void __declspec(dllexport)__stdcall InitExcelsiorCallback (ExcelsiorCallback ecb)
{ 
   eit = ecb;
}


int __declspec(dllexport)__stdcall PreInstall (char* installation_folder_name)
{
   eiParamProperty_t instPath = {EIPROP_INSTALLPATH, NULL};
   wchar_t *wcsPath;
   int wsize, status;

   wsize = eit(EICMD_PROPERTY_GET_SIZE, instPath.name, 0);
   if (wsize == 0)
       return 1;

   wsize += wcslen(XDS_BIN_DIR);
   wcsPath = (wchar_t*) malloc(wsize * sizeof(wchar_t)); 

   instPath.value = wcsPath;
   wsize = eit(EICMD_PROPERTY_GET_VALUE, &instPath, wsize);
   if (wsize == 0) {
       free(wcsPath);
       return 1;
   }

   wcscat(wcsPath, XDS_BIN_DIR); 
   status = eit(EICMD_ENVVAR_ADD_PATH, wcsPath, 0);

   free(wcsPath);

   return status;
}

excelsiorInstallerAPI.h

typedef struct eiParamProperty_t
{
   wchar_t * name;
   wchar_t * value;
} eiParamProperty_t;

typedef int (__stdcall * ExcelsiorCallback)(int uiCmd, void *pParam, unsigned long nParam);

//
// Returns length of the property value (in 'wchar_t').
//
//   pParam - 'wchar_t *' - property name (EIPROP_*)
//   nParam - 0
//   Return - the required buffer size, in wchar_t, including the terminating null character or 
//          - 0 if the property is not defined.
//
#define EICMD_PROPERTY_GET_SIZE    0x0001

//
// Returns property value.
//
//   pParam - 'eiParamProperty_t *':
//             - 'name'      - property name (EIPROP_*)
//             - 'value'     - buffer to receive value
//   nParam - size, in wchar_t, of the buffer 'pParam.value'
//   Return - the number of wchar_t written to the buffer including the terminating 
//            null character or 
//          - 0 if the property is not defined.
#define EICMD_PROPERTY_GET_VALUE    0x0002

//
// Add new path to PATH environment variable. 
// At uninstall time the first occurence of the given path will be removed
// from PATH environment variable.
//
//   pParam - 'wchar_t *' - path
//   nParam - 0
//   Return - EIRES_OK or 
//          - EIRES_ERROR if it does not succeed
//
#define EICMD_ENVVAR_ADD_PATH    0x0106

If you are interested in this feature I can give you a version of Excelsior Delivery with the draft of this feature. Your opinion will help us to make this feature better.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×