implemented RFE #2315740 - Library support for ActiveX exe /regserver
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5776 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
4c87ec9e83
commit
39b7d36352
5 changed files with 57 additions and 22 deletions
|
@ -109,7 +109,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
// Get version
|
// Get version
|
||||||
|
|
||||||
// DLL
|
// DLL / EXE
|
||||||
|
|
||||||
if (mode.compare("D") == 0)
|
if (mode.compare("D") == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#define STR_SIZE 1024
|
#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 RegDll(char *file);
|
||||||
void RegTypeLib(char *file);
|
void RegTypeLib(char *file);
|
||||||
void DeleteFileOnReboot(char *pszFile);
|
void DeleteFileOnReboot(char *pszFile);
|
||||||
|
@ -32,7 +32,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||||
{
|
{
|
||||||
HKEY rootkey;
|
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];
|
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)
|
if (FAILED(RegQueryValueEx(key, valname, NULL, &t, (LPBYTE) file, &l)) || t != REG_SZ)
|
||||||
continue;
|
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);
|
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 self[STR_SIZE];
|
||||||
char cmdline[STR_SIZE];
|
char cmdline[STR_SIZE];
|
||||||
|
|
||||||
int ready = 0;
|
int ready = 0;
|
||||||
|
|
||||||
if (!*file || (cmd != 'D' && cmd != 'T'))
|
if (!*file || (cmd != 'D' && cmd != 'T' && cmd != 'E'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!x64)
|
if (cmd == 'E')
|
||||||
|
{
|
||||||
|
wsprintf(cmdline, "\"%s\" /regserver", file);
|
||||||
|
ready++;
|
||||||
|
}
|
||||||
|
else if (!x64)
|
||||||
{
|
{
|
||||||
if (GetModuleFileName(GetModuleHandle(NULL), self, STR_SIZE))
|
if (GetModuleFileName(GetModuleHandle(NULL), self, STR_SIZE))
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,8 @@ The type of the library
|
||||||
|
|
||||||
DLL - Dynamic link library (DLL)\\<br\\>
|
DLL - Dynamic link library (DLL)\\<br\\>
|
||||||
REGDLL - DLL that has to be registered\\<br\\>
|
REGDLL - DLL that has to be registered\\<br\\>
|
||||||
TLB - Type library or DLL that contains a type LIBRARY\\<br\\>
|
REGEXE - EXE COM server that has to be registered using /regserver\\<br\\>
|
||||||
|
TLB - Type library or DLL that contains a type library\\<br\\>
|
||||||
REGDLLTLB - DLL that has to be registered and contains a type library\\<br\\>
|
REGDLLTLB - DLL that has to be registered and contains a type library\\<br\\>
|
||||||
|
|
||||||
|
|
||||||
|
@ -168,9 +169,10 @@ The UnInstallLib macro allows you to uninstall a library. It sets the error flag
|
||||||
The type of the library
|
The type of the library
|
||||||
|
|
||||||
DLL - Dynamic link library (DLL)\\<br\\>
|
DLL - Dynamic link library (DLL)\\<br\\>
|
||||||
REGDLL - DLL that has to be registered\\<br\\>
|
REGDLL - DLL that has to be unregistered\\<br\\>
|
||||||
TLB - Type library or DLL that contains a type LIBRARY\\<br\\>
|
REGEXE - EXE COM server that has to be unregistered using /unregserver\\<br\\>
|
||||||
REGDLLTLB - DLL that has to be registered and contains a type library\\<br\\>
|
TLB - Type library or DLL that contains a type library\\<br\\>
|
||||||
|
REGDLLTLB - DLL that has to be unregistered and contains a type library\\<br\\>
|
||||||
|
|
||||||
|
|
||||||
\\<b\\>shared\\</b\\>
|
\\<b\\>shared\\</b\\>
|
||||||
|
|
|
@ -17,6 +17,7 @@ XPStyle on
|
||||||
RequestExecutionLevel user
|
RequestExecutionLevel user
|
||||||
|
|
||||||
!define TestDLL '"${NSISDIR}\Plugins\LangDLL.dll"'
|
!define TestDLL '"${NSISDIR}\Plugins\LangDLL.dll"'
|
||||||
|
!define TestEXE '"${NSISDIR}\makensis.exe"'
|
||||||
|
|
||||||
Section
|
Section
|
||||||
|
|
||||||
|
@ -60,6 +61,11 @@ Section
|
||||||
!insertmacro InstallLib REGDLLTLB $0 REBOOT_NOTPROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
!insertmacro InstallLib REGDLLTLB $0 REBOOT_NOTPROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||||
!insertmacro InstallLib REGDLLTLB $0 NOREBOOT_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
|
WriteUninstaller $INSTDIR\uninstall.exe
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
@ -114,4 +120,10 @@ Section uninstall
|
||||||
!insertmacro UninstallLib REGDLLTLB SHARED REBOOT_NOTPROTECTED $INSTDIR\test.dll
|
!insertmacro UninstallLib REGDLLTLB SHARED REBOOT_NOTPROTECTED $INSTDIR\test.dll
|
||||||
!insertmacro UninstallLib REGDLLTLB SHARED NOREBOOT_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
|
SectionEnd
|
||||||
|
|
|
@ -111,26 +111,26 @@
|
||||||
;Advance counter
|
;Advance counter
|
||||||
|
|
||||||
StrCpy $R0 0
|
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
|
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
|
;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
|
StrCpy $R3 $R3 -4 1
|
||||||
IfFileExists $R3 +3
|
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" \
|
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
|
;Add RegTool entry
|
||||||
|
|
||||||
WriteRegStr HKLM "Software\NSIS.Library.RegTool.v2\$__INSTALLLLIB_SESSIONGUID" "$R0.file" "$R1"
|
WriteRegStr HKLM "Software\NSIS.Library.RegTool.v3\$__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.mode" "${mode}"
|
||||||
|
|
||||||
Pop $R3
|
Pop $R3
|
||||||
Pop $R2
|
Pop $R2
|
||||||
|
@ -195,7 +195,7 @@
|
||||||
;Validate
|
;Validate
|
||||||
|
|
||||||
!ifndef INSTALLLIB_LIBTYPE_DLL & INSTALLLIB_LIBTYPE_REGDLL & INSTALLLIB_LIBTYPE_TLB & \
|
!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"
|
!error "InstallLib: Incorrect setting for parameter: libtype"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
@ -452,7 +452,7 @@
|
||||||
|
|
||||||
!endif
|
!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
|
!ifdef INSTALLLIB_INSTALL_REBOOT_PROTECTED | INSTALLLIB_INSTALL_REBOOT_NOTPROTECTED
|
||||||
|
|
||||||
|
@ -486,6 +486,12 @@
|
||||||
|
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
!ifdef INSTALLLIB_LIBTYPE_REGEXE
|
||||||
|
|
||||||
|
ExecWait '"$R4" /regserver'
|
||||||
|
|
||||||
|
!endif
|
||||||
|
|
||||||
!ifdef INSTALLLIB_INSTALL_REBOOT_PROTECTED | INSTALLLIB_INSTALL_REBOOT_NOTPROTECTED
|
!ifdef INSTALLLIB_INSTALL_REBOOT_PROTECTED | INSTALLLIB_INSTALL_REBOOT_NOTPROTECTED
|
||||||
|
|
||||||
"installlib.registerfinish_${INSTALLLIB_UNIQUE}:"
|
"installlib.registerfinish_${INSTALLLIB_UNIQUE}:"
|
||||||
|
@ -569,6 +575,10 @@
|
||||||
!insertmacro __InstallLib_Helper_AddRegToolEntry 'T' "$R4" "$R5"
|
!insertmacro __InstallLib_Helper_AddRegToolEntry 'T' "$R4" "$R5"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
!ifdef INSTALLLIB_LIBTYPE_REGEXE
|
||||||
|
!insertmacro __InstallLib_Helper_AddRegToolEntry 'E' "$R4" "$R5"
|
||||||
|
!endif
|
||||||
|
|
||||||
Return
|
Return
|
||||||
|
|
||||||
!endif
|
!endif
|
||||||
|
@ -625,7 +635,7 @@
|
||||||
;Validate
|
;Validate
|
||||||
|
|
||||||
!ifndef UNINSTALLLIB_LIBTYPE_DLL & UNINSTALLLIB_LIBTYPE_REGDLL & UNINSTALLLIB_LIBTYPE_TLB & \
|
!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"
|
!error "UnInstallLib: Incorrect setting for parameter: libtype"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
@ -745,6 +755,12 @@
|
||||||
|
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
!ifdef UNINSTALLLIB_LIBTYPE_REGEXE
|
||||||
|
|
||||||
|
ExecWait '"$R1" /unregserver'
|
||||||
|
|
||||||
|
!endif
|
||||||
|
|
||||||
!ifdef UNINSTALLLIB_LIBTYPE_TLB | UNINSTALLLIB_LIBTYPE_REGDLLTLB
|
!ifdef UNINSTALLLIB_LIBTYPE_TLB | UNINSTALLLIB_LIBTYPE_REGDLLTLB
|
||||||
|
|
||||||
TypeLib::UnRegister $R1
|
TypeLib::UnRegister $R1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue