diff --git a/Contrib/Library/LibraryLocal/LibraryLocal.cpp b/Contrib/Library/LibraryLocal/LibraryLocal.cpp
index 4f94fab8..dad5b000 100644
--- a/Contrib/Library/LibraryLocal/LibraryLocal.cpp
+++ b/Contrib/Library/LibraryLocal/LibraryLocal.cpp
@@ -109,7 +109,7 @@ int main(int argc, char* argv[])
// Get version
- // DLL
+ // DLL / EXE
if (mode.compare("D") == 0)
{
diff --git a/Contrib/Library/RegTool/RegTool.c b/Contrib/Library/RegTool/RegTool.c
index 7c62d35d..b835d716 100644
--- a/Contrib/Library/RegTool/RegTool.c
+++ b/Contrib/Library/RegTool/RegTool.c
@@ -2,7 +2,7 @@
#define STR_SIZE 1024
-void RunSelf(char cmd, char *file, int x64);
+void RegFile(char cmd, char *file, int x64);
void RegDll(char *file);
void RegTypeLib(char *file);
void DeleteFileOnReboot(char *pszFile);
@@ -32,7 +32,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
{
HKEY rootkey;
- if (SUCCEEDED(RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\NSIS.Library.RegTool.v2", 0, KEY_READ, &rootkey)))
+ if (SUCCEEDED(RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\NSIS.Library.RegTool.v3", 0, KEY_READ, &rootkey)))
{
char keyname[STR_SIZE];
@@ -61,7 +61,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
if (FAILED(RegQueryValueEx(key, valname, NULL, &t, (LPBYTE) file, &l)) || t != REG_SZ)
continue;
- RunSelf(mode[0], file, mode[1] == 'X');
+ RegFile(mode[0], file, mode[1] == 'X');
}
}
@@ -71,7 +71,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
}
RegCloseKey(rootkey);
- RegDeleteKey(HKEY_LOCAL_MACHINE, "Software\\NSIS.Library.RegTool.v2");
+ RegDeleteKey(HKEY_LOCAL_MACHINE, "Software\\NSIS.Library.RegTool.v3");
}
{
@@ -121,17 +121,22 @@ void SafeWow64EnableWow64FsRedirection(BOOL Wow64FsEnableRedirection)
}
}
-void RunSelf(char cmd, char *file, int x64)
+void RegFile(char cmd, char *file, int x64)
{
char self[STR_SIZE];
char cmdline[STR_SIZE];
int ready = 0;
- if (!*file || (cmd != 'D' && cmd != 'T'))
+ if (!*file || (cmd != 'D' && cmd != 'T' && cmd != 'E'))
return;
- if (!x64)
+ if (cmd == 'E')
+ {
+ wsprintf(cmdline, "\"%s\" /regserver", file);
+ ready++;
+ }
+ else if (!x64)
{
if (GetModuleFileName(GetModuleHandle(NULL), self, STR_SIZE))
{
diff --git a/Docs/src/library.but b/Docs/src/library.but
index fd4f11ac..9ce2c5fa 100644
--- a/Docs/src/library.but
+++ b/Docs/src/library.but
@@ -45,7 +45,8 @@ The type of the library
DLL - Dynamic link library (DLL)\\
REGDLL - DLL that has to be registered\\
-TLB - Type library or DLL that contains a type LIBRARY\\
+REGEXE - EXE COM server that has to be registered using /regserver\\
+TLB - Type library or DLL that contains a type library\\
REGDLLTLB - DLL that has to be registered and contains a type library\\
@@ -168,9 +169,10 @@ The UnInstallLib macro allows you to uninstall a library. It sets the error flag
The type of the library
DLL - Dynamic link library (DLL)\\
-REGDLL - DLL that has to be registered\\
-TLB - Type library or DLL that contains a type LIBRARY\\
-REGDLLTLB - DLL that has to be registered and contains a type library\\
+REGDLL - DLL that has to be unregistered\\
+REGEXE - EXE COM server that has to be unregistered using /unregserver\\
+TLB - Type library or DLL that contains a type library\\
+REGDLLTLB - DLL that has to be unregistered and contains a type library\\
\\shared\\
diff --git a/Examples/Library.nsi b/Examples/Library.nsi
index cd21d487..6fcbe9ae 100644
--- a/Examples/Library.nsi
+++ b/Examples/Library.nsi
@@ -17,6 +17,7 @@ XPStyle on
RequestExecutionLevel user
!define TestDLL '"${NSISDIR}\Plugins\LangDLL.dll"'
+!define TestEXE '"${NSISDIR}\makensis.exe"'
Section
@@ -60,6 +61,11 @@ Section
!insertmacro InstallLib REGDLLTLB $0 REBOOT_NOTPROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
!insertmacro InstallLib REGDLLTLB $0 NOREBOOT_NOTPROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
+!insertmacro InstallLib REGEXE $0 REBOOT_PROTECTED ${TestEXE} $INSTDIR\test.exe $INSTDIR
+!insertmacro InstallLib REGEXE $0 NOREBOOT_PROTECTED ${TestEXE} $INSTDIR\test.exe $INSTDIR
+!insertmacro InstallLib REGEXE $0 REBOOT_NOTPROTECTED ${TestEXE} $INSTDIR\test.exe $INSTDIR
+!insertmacro InstallLib REGEXE $0 NOREBOOT_NOTPROTECTED ${TestEXE} $INSTDIR\test.exe $INSTDIR
+
WriteUninstaller $INSTDIR\uninstall.exe
SectionEnd
@@ -114,4 +120,10 @@ Section uninstall
!insertmacro UninstallLib REGDLLTLB SHARED REBOOT_NOTPROTECTED $INSTDIR\test.dll
!insertmacro UninstallLib REGDLLTLB SHARED NOREBOOT_NOTPROTECTED $INSTDIR\test.dll
+!insertmacro UninstallLib REGEXE SHARED NOREMOVE $INSTDIR\test.exe
+!insertmacro UninstallLib REGEXE SHARED REBOOT_PROTECTED $INSTDIR\test.exe
+!insertmacro UninstallLib REGEXE SHARED NOREBOOT_PROTECTED $INSTDIR\test.exe
+!insertmacro UninstallLib REGEXE SHARED REBOOT_NOTPROTECTED $INSTDIR\test.exe
+!insertmacro UninstallLib REGEXE SHARED NOREBOOT_NOTPROTECTED $INSTDIR\test.exe
+
SectionEnd
diff --git a/Include/Library.nsh b/Include/Library.nsh
index 0f6cb19b..e924deb5 100644
--- a/Include/Library.nsh
+++ b/Include/Library.nsh
@@ -111,26 +111,26 @@
;Advance counter
StrCpy $R0 0
- ReadRegDWORD $R0 HKLM "Software\NSIS.Library.RegTool.v2\$__INSTALLLLIB_SESSIONGUID" "count"
+ ReadRegDWORD $R0 HKLM "Software\NSIS.Library.RegTool.v3\$__INSTALLLLIB_SESSIONGUID" "count"
IntOp $R0 $R0 + 1
- WriteRegDWORD HKLM "Software\NSIS.Library.RegTool.v2\$__INSTALLLLIB_SESSIONGUID" "count" "$R0"
+ WriteRegDWORD HKLM "Software\NSIS.Library.RegTool.v3\$__INSTALLLLIB_SESSIONGUID" "count" "$R0"
;------------------------
;Setup RegTool
- ReadRegStr $R3 HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" "NSIS.Library.RegTool.v2"
+ ReadRegStr $R3 HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" "NSIS.Library.RegTool.v3"
StrCpy $R3 $R3 -4 1
IfFileExists $R3 +3
- File /oname=$R2\NSIS.Library.RegTool.v2.$__INSTALLLLIB_SESSIONGUID.exe "${NSISDIR}\Bin\RegTool.bin"
+ File /oname=$R2\NSIS.Library.RegTool.v3.$__INSTALLLLIB_SESSIONGUID.exe "${NSISDIR}\Bin\RegTool.bin"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \
- "NSIS.Library.RegTool.v2" '"$R2\NSIS.Library.RegTool.v2.$__INSTALLLLIB_SESSIONGUID.exe" /S'
+ "NSIS.Library.RegTool.v3" '"$R2\NSIS.Library.RegTool.v3.$__INSTALLLLIB_SESSIONGUID.exe" /S'
;------------------------
;Add RegTool entry
- WriteRegStr HKLM "Software\NSIS.Library.RegTool.v2\$__INSTALLLLIB_SESSIONGUID" "$R0.file" "$R1"
- WriteRegStr HKLM "Software\NSIS.Library.RegTool.v2\$__INSTALLLLIB_SESSIONGUID" "$R0.mode" "${mode}"
+ WriteRegStr HKLM "Software\NSIS.Library.RegTool.v3\$__INSTALLLLIB_SESSIONGUID" "$R0.file" "$R1"
+ WriteRegStr HKLM "Software\NSIS.Library.RegTool.v3\$__INSTALLLLIB_SESSIONGUID" "$R0.mode" "${mode}"
Pop $R3
Pop $R2
@@ -195,7 +195,7 @@
;Validate
!ifndef INSTALLLIB_LIBTYPE_DLL & INSTALLLIB_LIBTYPE_REGDLL & INSTALLLIB_LIBTYPE_TLB & \
- INSTALLLIB_LIBTYPE_REGDLLTLB
+ INSTALLLIB_LIBTYPE_REGDLLTLB & INSTALLLIB_LIBTYPE_REGEXE
!error "InstallLib: Incorrect setting for parameter: libtype"
!endif
@@ -452,7 +452,7 @@
!endif
- !ifdef INSTALLLIB_LIBTYPE_REGDLL | INSTALLLIB_LIBTYPE_TLB | INSTALLLIB_LIBTYPE_REGDLLTLB
+ !ifdef INSTALLLIB_LIBTYPE_REGDLL | INSTALLLIB_LIBTYPE_TLB | INSTALLLIB_LIBTYPE_REGDLLTLB | INSTALLLIB_LIBTYPE_REGEXE
!ifdef INSTALLLIB_INSTALL_REBOOT_PROTECTED | INSTALLLIB_INSTALL_REBOOT_NOTPROTECTED
@@ -486,6 +486,12 @@
!endif
+ !ifdef INSTALLLIB_LIBTYPE_REGEXE
+
+ ExecWait '"$R4" /regserver'
+
+ !endif
+
!ifdef INSTALLLIB_INSTALL_REBOOT_PROTECTED | INSTALLLIB_INSTALL_REBOOT_NOTPROTECTED
"installlib.registerfinish_${INSTALLLIB_UNIQUE}:"
@@ -569,6 +575,10 @@
!insertmacro __InstallLib_Helper_AddRegToolEntry 'T' "$R4" "$R5"
!endif
+ !ifdef INSTALLLIB_LIBTYPE_REGEXE
+ !insertmacro __InstallLib_Helper_AddRegToolEntry 'E' "$R4" "$R5"
+ !endif
+
Return
!endif
@@ -625,7 +635,7 @@
;Validate
!ifndef UNINSTALLLIB_LIBTYPE_DLL & UNINSTALLLIB_LIBTYPE_REGDLL & UNINSTALLLIB_LIBTYPE_TLB & \
- UNINSTALLLIB_LIBTYPE_REGDLLTLB
+ UNINSTALLLIB_LIBTYPE_REGDLLTLB & UNINSTALLLIB_LIBTYPE_REGEXE
!error "UnInstallLib: Incorrect setting for parameter: libtype"
!endif
@@ -745,6 +755,12 @@
!endif
+ !ifdef UNINSTALLLIB_LIBTYPE_REGEXE
+
+ ExecWait '"$R1" /unregserver'
+
+ !endif
+
!ifdef UNINSTALLLIB_LIBTYPE_TLB | UNINSTALLLIB_LIBTYPE_REGDLLTLB
TypeLib::UnRegister $R1