new system for DLL/TLB library setup
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3601 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
a1f64d2d4c
commit
4e4b0e8420
12 changed files with 1396 additions and 45 deletions
213
Contrib/Library/LibraryLocal/LibraryLocal.cpp
Normal file
213
Contrib/Library/LibraryLocal/LibraryLocal.cpp
Normal file
|
@ -0,0 +1,213 @@
|
|||
/*
|
||||
|
||||
LibraryLocal - used by the Library.nsh macros
|
||||
Get the version of local DLL and TLB files
|
||||
Written by Joost Verburg
|
||||
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int APIENTRY WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
|
||||
// Parse the command line
|
||||
|
||||
string cmdline;
|
||||
cmdline = lpCmdLine;
|
||||
|
||||
string mode;
|
||||
string filename;
|
||||
string filepath;
|
||||
|
||||
int filefound = 0;
|
||||
|
||||
if (cmdline.length() >= 3)
|
||||
{
|
||||
|
||||
// Get the full path of the local file
|
||||
|
||||
mode = cmdline.substr(0, 1);
|
||||
filename = cmdline.substr(2);
|
||||
|
||||
char buf[MAX_PATH];
|
||||
GetCurrentDirectory(MAX_PATH, buf);
|
||||
filepath = buf;
|
||||
|
||||
if ((filename.substr(0, 1).compare("\\") != 0) && (filename.substr(1, 1).compare(":") != 0)) {
|
||||
|
||||
// Path is relative
|
||||
|
||||
if (filepath.substr(filepath.length() - 1, 1).compare("\\") != 0)
|
||||
filepath.append("\\");
|
||||
|
||||
filepath.append(filename);
|
||||
|
||||
} else if (filename.substr(0, 1).compare("\\") == 0) {
|
||||
|
||||
// Path is relative to current root
|
||||
|
||||
if (filepath.substr(1, 1).compare(":") == 0) {
|
||||
|
||||
// Standard path
|
||||
|
||||
filepath = filepath.substr(0, filepath.find('\\'));
|
||||
filepath.append(filename);
|
||||
|
||||
} else {
|
||||
|
||||
// UNC path
|
||||
|
||||
filepath = filepath.substr(0, filepath.find('\\', filepath.find('\\', 2) + 1));
|
||||
filepath.append(filename);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// Absolute path
|
||||
|
||||
filepath = filename;
|
||||
|
||||
}
|
||||
|
||||
// Validate filename
|
||||
|
||||
WIN32_FIND_DATA wfd;
|
||||
HANDLE hFind = FindFirstFile(filepath.c_str(), &wfd);
|
||||
|
||||
if (hFind != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
filefound = 1;
|
||||
FindClose(hFind);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int versionfound = 0;
|
||||
DWORD low = 0, high = 0;
|
||||
|
||||
if (filefound)
|
||||
{
|
||||
|
||||
// Get version
|
||||
|
||||
// DLL
|
||||
|
||||
if (mode.compare("D") == 0)
|
||||
{
|
||||
|
||||
DWORD versionsize;
|
||||
DWORD temp;
|
||||
|
||||
versionsize = GetFileVersionInfoSize(filepath.c_str(), &temp);
|
||||
|
||||
if (versionsize)
|
||||
{
|
||||
|
||||
void *buf;
|
||||
buf = (void *)GlobalAlloc(GPTR, versionsize);
|
||||
|
||||
if (buf)
|
||||
{
|
||||
|
||||
UINT uLen;
|
||||
VS_FIXEDFILEINFO *pvsf;
|
||||
|
||||
if (GetFileVersionInfo(filepath.c_str(), 0, versionsize, buf) && VerQueryValue(buf, "\\", (void**)&pvsf,&uLen))
|
||||
{
|
||||
high = pvsf->dwFileVersionMS;
|
||||
low = pvsf->dwFileVersionLS;
|
||||
|
||||
versionfound = 1;
|
||||
}
|
||||
|
||||
GlobalFree(buf);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TLB
|
||||
|
||||
if (mode.compare("T") == 0)
|
||||
{
|
||||
|
||||
wchar_t ole_filename[1024];
|
||||
MultiByteToWideChar(CP_ACP, 0, filepath.c_str(), filepath.length() + 1, ole_filename, 1024);
|
||||
|
||||
ITypeLib* typeLib;
|
||||
HRESULT hr;
|
||||
|
||||
hr = LoadTypeLib(ole_filename, &typeLib);
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
|
||||
TLIBATTR* typelibAttr;
|
||||
|
||||
hr = typeLib->GetLibAttr(&typelibAttr);
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
|
||||
high = typelibAttr->wMajorVerNum;
|
||||
low = typelibAttr->wMinorVerNum;
|
||||
|
||||
versionfound = 1;
|
||||
|
||||
}
|
||||
|
||||
typeLib->Release();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Write the version to an NSIS header file
|
||||
|
||||
char appfile[MAX_PATH];
|
||||
GetModuleFileName(0, appfile, MAX_PATH);
|
||||
|
||||
string headerfile;
|
||||
headerfile = appfile;
|
||||
headerfile = headerfile.substr(0, headerfile.rfind('\\'));
|
||||
headerfile.append("\\LibraryLocal.nsh");
|
||||
|
||||
ofstream header(headerfile.c_str(), ofstream::out);
|
||||
|
||||
if (header)
|
||||
{
|
||||
|
||||
if (!filefound)
|
||||
{
|
||||
|
||||
header << "!define LIBRARY_VERSION_FILENOTFOUND" << endl;
|
||||
}
|
||||
else if (!versionfound)
|
||||
{
|
||||
header << "!define LIBRARY_VERSION_NONE" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
header << "!define LIBRARY_VERSION_HIGH " << high << endl;
|
||||
header << "!define LIBRARY_VERSION_LOW " << low << endl;
|
||||
}
|
||||
|
||||
header.close();
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
109
Contrib/Library/LibraryLocal/LibraryLocal.dsp
Normal file
109
Contrib/Library/LibraryLocal/LibraryLocal.dsp
Normal file
|
@ -0,0 +1,109 @@
|
|||
# Microsoft Developer Studio Project File - Name="LibraryLocal" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=LibraryLocal - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "LibraryLocal.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "LibraryLocal.mak" CFG="LibraryLocal - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "LibraryLocal - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "LibraryLocal - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "LibraryLocal - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x413 /d "NDEBUG"
|
||||
# ADD RSC /l 0x413 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /machine:I386 /out:"LibraryLocal.exe"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "LibraryLocal - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x413 /d "_DEBUG"
|
||||
# ADD RSC /l 0x413 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "LibraryLocal - Win32 Release"
|
||||
# Name "LibraryLocal - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LibraryLocal.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
29
Contrib/Library/LibraryLocal/LibraryLocal.dsw
Normal file
29
Contrib/Library/LibraryLocal/LibraryLocal.dsw
Normal file
|
@ -0,0 +1,29 @@
|
|||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "LibraryLocal"=".\LibraryLocal.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
BIN
Contrib/Library/LibraryLocal/LibraryLocal.exe
Normal file
BIN
Contrib/Library/LibraryLocal/LibraryLocal.exe
Normal file
Binary file not shown.
BIN
Contrib/Library/RegTool/RegTool.bin
Normal file
BIN
Contrib/Library/RegTool/RegTool.bin
Normal file
Binary file not shown.
137
Contrib/Library/RegTool/RegTool.nsi
Normal file
137
Contrib/Library/RegTool/RegTool.nsi
Normal file
|
@ -0,0 +1,137 @@
|
|||
; RegTool
|
||||
; Written by Joost Verburg
|
||||
;
|
||||
; This tool is used by the Library.nsh macros to register
|
||||
; dynamic link libraries and type libraries after a reboot.
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Name "RegTool"
|
||||
OutFile "RegTool.bin"
|
||||
SilentInstall silent
|
||||
|
||||
SetCompressor lzma
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Var COMMAND_LINE
|
||||
Var MODE
|
||||
Var FILENAME
|
||||
Var FOLDER
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Section
|
||||
|
||||
Call GetParameters
|
||||
Pop $COMMAND_LINE
|
||||
|
||||
StrCpy $MODE $COMMAND_LINE 1
|
||||
StrCpy $FILENAME $COMMAND_LINE "" 2
|
||||
|
||||
;DLL
|
||||
StrCmp $MODE "D" 0 no_dll
|
||||
|
||||
Push $FILENAME
|
||||
Call GetParent
|
||||
Pop $FOLDER
|
||||
|
||||
SetOutPath $FOLDER
|
||||
RegDLL $FILENAME
|
||||
|
||||
no_dll:
|
||||
|
||||
;TLB
|
||||
StrCmp $MODE "T" 0 no_tlb
|
||||
|
||||
TypeLib::Register $FILENAME
|
||||
|
||||
no_tlb:
|
||||
|
||||
System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1'
|
||||
Delete /REBOOTOK $R0
|
||||
|
||||
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; GetParameters
|
||||
; input, none
|
||||
; output, top of stack (replaces, with e.g. whatever)
|
||||
; modifies no other variables.
|
||||
|
||||
Function GetParameters
|
||||
|
||||
Push $R0
|
||||
Push $R1
|
||||
Push $R2
|
||||
Push $R3
|
||||
|
||||
StrCpy $R2 1
|
||||
StrLen $R3 $CMDLINE
|
||||
|
||||
;Check for quote or space
|
||||
StrCpy $R0 $CMDLINE $R2
|
||||
StrCmp $R0 '"' 0 +3
|
||||
StrCpy $R1 '"'
|
||||
Goto loop
|
||||
StrCpy $R1 " "
|
||||
|
||||
loop:
|
||||
IntOp $R2 $R2 + 1
|
||||
StrCpy $R0 $CMDLINE 1 $R2
|
||||
StrCmp $R0 $R1 get
|
||||
StrCmp $R2 $R3 get
|
||||
Goto loop
|
||||
|
||||
get:
|
||||
IntOp $R2 $R2 + 1
|
||||
StrCpy $R0 $CMDLINE 1 $R2
|
||||
StrCmp $R0 " " get
|
||||
StrCpy $R0 $CMDLINE "" $R2
|
||||
|
||||
Pop $R3
|
||||
Pop $R2
|
||||
Pop $R1
|
||||
Exch $R0
|
||||
|
||||
FunctionEnd
|
||||
|
||||
; GetParent
|
||||
; input, top of stack (e.g. C:\Program Files\Poop)
|
||||
; output, top of stack (replaces, with e.g. C:\Program Files)
|
||||
; modifies no other variables.
|
||||
;
|
||||
; Usage:
|
||||
; Push "C:\Program Files\Directory\Whatever"
|
||||
; Call GetParent
|
||||
; Pop $R0
|
||||
; ; at this point $R0 will equal "C:\Program Files\Directory"
|
||||
|
||||
Function GetParent
|
||||
|
||||
Exch $R0
|
||||
Push $R1
|
||||
Push $R2
|
||||
Push $R3
|
||||
|
||||
StrCpy $R1 0
|
||||
StrLen $R2 $R0
|
||||
|
||||
loop:
|
||||
IntOp $R1 $R1 + 1
|
||||
IntCmp $R1 $R2 get 0 get
|
||||
StrCpy $R3 $R0 1 -$R1
|
||||
StrCmp $R3 "\" get
|
||||
Goto loop
|
||||
|
||||
get:
|
||||
StrCpy $R0 $R0 -$R1
|
||||
|
||||
Pop $R3
|
||||
Pop $R2
|
||||
Pop $R1
|
||||
Exch $R0
|
||||
|
||||
FunctionEnd
|
123
Contrib/Library/TypeLib/TypeLib.cpp
Normal file
123
Contrib/Library/TypeLib/TypeLib.cpp
Normal file
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
|
||||
NSIS plug-in for Type Library Registration/UnRegistration
|
||||
Written by Joost Verburg
|
||||
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include "../../exdll/exdll.h"
|
||||
|
||||
#define NSISFunction(funcname) extern "C" void __declspec(dllexport) funcname(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)
|
||||
|
||||
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Functions
|
||||
|
||||
NSISFunction(Register) {
|
||||
|
||||
EXDLL_INIT();
|
||||
|
||||
char filename[1024];
|
||||
popstring(filename);
|
||||
|
||||
wchar_t ole_filename[1024];
|
||||
MultiByteToWideChar(CP_ACP, 0, filename, 1024, ole_filename, 1024);
|
||||
|
||||
ITypeLib* typeLib;
|
||||
HRESULT hr;
|
||||
|
||||
hr = LoadTypeLib(ole_filename, &typeLib);
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
|
||||
RegisterTypeLib(typeLib, ole_filename, NULL);
|
||||
|
||||
hr = typeLib->Release();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NSISFunction(UnRegister) {
|
||||
|
||||
EXDLL_INIT();
|
||||
|
||||
char filename[1024];
|
||||
popstring(filename);
|
||||
|
||||
wchar_t ole_filename[1024];
|
||||
MultiByteToWideChar(CP_ACP, 0, filename, 1024, ole_filename, 1024);
|
||||
|
||||
ITypeLib* typeLib;
|
||||
HRESULT hr;
|
||||
|
||||
hr = LoadTypeLibEx(ole_filename, REGKIND_NONE, &typeLib);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
|
||||
TLIBATTR* typelibAttr;
|
||||
|
||||
hr = typeLib->GetLibAttr(&typelibAttr);
|
||||
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
|
||||
UnRegisterTypeLib(typelibAttr->guid,
|
||||
typelibAttr->wMajorVerNum,
|
||||
typelibAttr->wMinorVerNum,
|
||||
typelibAttr->lcid,
|
||||
typelibAttr->syskind);
|
||||
|
||||
typeLib->ReleaseTLibAttr(typelibAttr);
|
||||
|
||||
}
|
||||
|
||||
typeLib->Release();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NSISFunction(GetLibVersion) {
|
||||
|
||||
EXDLL_INIT();
|
||||
|
||||
char filename[1024];
|
||||
popstring(filename);
|
||||
|
||||
wchar_t ole_filename[1024];
|
||||
MultiByteToWideChar(CP_ACP, 0, filename, 1024, ole_filename, 1024);
|
||||
|
||||
ITypeLib* typeLib;
|
||||
HRESULT hr;
|
||||
|
||||
hr = LoadTypeLib(ole_filename, &typeLib);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
|
||||
TLIBATTR* typelibAttr;
|
||||
|
||||
hr = typeLib->GetLibAttr(&typelibAttr);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
|
||||
char buf[33];
|
||||
|
||||
itoa (typelibAttr->wMajorVerNum, buf, 10);
|
||||
pushstring(buf);
|
||||
itoa (typelibAttr->wMinorVerNum, buf, 10);
|
||||
pushstring(buf);
|
||||
|
||||
}
|
||||
|
||||
typeLib->Release();
|
||||
|
||||
}
|
||||
|
||||
}
|
109
Contrib/Library/TypeLib/TypeLib.dsp
Normal file
109
Contrib/Library/TypeLib/TypeLib.dsp
Normal file
|
@ -0,0 +1,109 @@
|
|||
# Microsoft Developer Studio Project File - Name="TypeLib" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=TypeLib - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "TypeLib.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "TypeLib.mak" CFG="TypeLib - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "TypeLib - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "TypeLib - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "TypeLib - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TypeLib_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TypeLib_EXPORTS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib delayimp.lib /nologo /entry:"DllMain" /dll /machine:I386 /out:"..\..\..\Plugins\TypeLib.dll" /opt:nowin98 /DELAYLOAD:oleaut32.dll
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "TypeLib - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TypeLib_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TypeLib_EXPORTS" /FR /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib delayimp.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /DELAYLOAD:oleaut32.dll
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "TypeLib - Win32 Release"
|
||||
# Name "TypeLib - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\TypeLib.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
29
Contrib/Library/TypeLib/TypeLib.dsw
Normal file
29
Contrib/Library/TypeLib/TypeLib.dsw
Normal file
|
@ -0,0 +1,29 @@
|
|||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "TypeLib"=.\TypeLib.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
590
Include/Library.nsh
Normal file
590
Include/Library.nsh
Normal file
|
@ -0,0 +1,590 @@
|
|||
/*
|
||||
|
||||
***********************
|
||||
Macro - Install Library
|
||||
***********************
|
||||
|
||||
This macro can be used to install DLL and TLB libraries. It checks for version numbers and Windows file protection,
|
||||
registers the files and can update files on reboot.
|
||||
|
||||
To ask the user for a reboot if required, use the Modern UI with a Finish page or use IfRebootFlag and make your
|
||||
own page or message box.
|
||||
|
||||
Usage:
|
||||
|
||||
!insertmacro InstallLib libtype shared protection localfile destfile tempbasedir
|
||||
|
||||
Parameters:
|
||||
|
||||
libtype 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
|
||||
|
||||
shared Specify whether the library is shared with other applications
|
||||
|
||||
NOTSHARED The library is not shared
|
||||
$VARNAME Variable that is empty when the application is installed for the first time,
|
||||
which is when the shared library count will be increased.
|
||||
|
||||
install Specify the installation method
|
||||
|
||||
REBOOT_PROTECTED * Upgrade the libary on reboot when in use (required for system files).
|
||||
* Upgrade the library if the file is not protected by Windows File Protection.
|
||||
|
||||
NOREBOOT_PROTECTED * Warns the user when the library is in use. The user will have to close
|
||||
applications using the library.
|
||||
* Upgrade the library if the file is not protected by Windows File Protection.
|
||||
|
||||
REBOOT_NOTPROTECTED * Upgrade the libary on reboot when in use (required for system files).
|
||||
* Upgrade the library without checking for Windows File Protection.
|
||||
|
||||
NOREBOOT_NOTPROTECTED * Warns the user when the library is in use. The user will have to close
|
||||
applications using the library.
|
||||
* Upgrade the library without checking for Windows File Protection.
|
||||
|
||||
localfile Location of the library on the compiler system
|
||||
|
||||
destfile Location to store the library on the user's system
|
||||
|
||||
tempbasedir Directory on the user's system to store a temporary file when the system has
|
||||
to be rebooted.
|
||||
|
||||
For Windows 9x/ME support, this directory should be on the same volume as the
|
||||
destination file (destfile).
|
||||
The Windows temp directory could be located on any volume, so you cannot use
|
||||
this directory.
|
||||
|
||||
Notes:
|
||||
|
||||
* If you want to support Windows 9x/ME, you can only use short filenames (8.3).
|
||||
|
||||
* You can only compile scripts using this macro on Windows systems.
|
||||
|
||||
------------------------
|
||||
|
||||
Example:
|
||||
|
||||
Var ALREADY_INSTALLED
|
||||
;Add code here that sets $ALREADY_INSTALLED to a non-zero value if the application is
|
||||
;already installed.
|
||||
|
||||
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED dllname.dll $SYSDIR\dllname.dll $SYSDIR
|
||||
|
||||
|
||||
*************************
|
||||
Macro - Uninstall Library
|
||||
*************************
|
||||
|
||||
This macro can be used to uninstall DLL and TLB libraries. It unregisters files and can remove them on reboot.
|
||||
|
||||
Usage:
|
||||
|
||||
!insertmacro UnInstallLib libtype shared uninstall file
|
||||
|
||||
Parameters:
|
||||
|
||||
libtype 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
|
||||
REGTLB DLL that has to be registered and contains a type library
|
||||
|
||||
shared Specify whether the library is shared with other applications
|
||||
|
||||
NOTSHARED The library is not shared
|
||||
SHARE The library is shared and should be removed if the shared library count
|
||||
indicates that the file is not in use anymore.
|
||||
|
||||
uninstall Specify the uninstallation method
|
||||
|
||||
NOREMOVE The library should not be removed.
|
||||
You should use this option for common or important system files such as the
|
||||
Visual Basic/C++/MFC runtimes.
|
||||
|
||||
REBOOT_PROTECTED * Remove the libary on reboot when in use (required for system files).
|
||||
* Remove the library if the file is not protected by Windows File Protection.
|
||||
|
||||
NOREBOOT_PROTECTED * Warns the user when the library is in use. The user will have to close
|
||||
applications using the library.
|
||||
* Remove the library if the file is not protected by Windows File Protection.
|
||||
|
||||
REBOOT_NOTPROTECTED * Remove the libary on reboot when in use (required for system files).
|
||||
* Remove the library without checking for Windows File Protection.
|
||||
|
||||
NOREBOOT_NOTPROTECTED * Warns the user when the library is in use. The user will have to close
|
||||
applications using the library.
|
||||
* Remove the library without checking for Windows File Protection.
|
||||
|
||||
file Location of the library
|
||||
|
||||
------------------------
|
||||
|
||||
Example:
|
||||
|
||||
!insertmacro UnInstallLib REGDLL SHARED REBOOT_NOTPROTECTED $SYSDIR\dllname.dll
|
||||
|
||||
*/
|
||||
|
||||
!ifndef LIB_INCLUDED
|
||||
|
||||
!define LIB_INCLUDED
|
||||
|
||||
!macro InstallLib libtype shared install localfile destfile tempbasedir
|
||||
|
||||
!verbose push
|
||||
!verbose 3
|
||||
|
||||
Push $R0
|
||||
Push $R1
|
||||
Push $R2
|
||||
Push $R3
|
||||
Push $R4
|
||||
Push $R5
|
||||
|
||||
;------------------------
|
||||
;Define
|
||||
|
||||
!define INSTALLLIB_UNIQUE ${__LINE__}
|
||||
|
||||
!define INSTALLLIB_LIBTYPE_${libtype}
|
||||
!define INSTALLLIB_LIBTYPE_SET INSTALLLIB_LIBTYPE_${libtype}
|
||||
!define INSTALLLIB_SHARED_${shared}
|
||||
!define INSTALLLIB_SHARED_SET INSTALLLIB_SHARED_${shared}
|
||||
!define INSTALLLIB_INSTALL_${install}
|
||||
!define INSTALLLIB_INSTALL_SET INSTALLLIB_INSTALL_${install}
|
||||
|
||||
;------------------------
|
||||
;Validate
|
||||
|
||||
!ifndef INSTALLLIB_LIBTYPE_DLL & INSTALLLIB_LIBTYPE_REGDLL & INSTALLLIB_LIBTYPE_TLB & \
|
||||
INSTALLLIB_LIBTYPE_REGDLLTLB
|
||||
!error "InstallLib: Incorrect setting for parameter: libtype"
|
||||
!endif
|
||||
|
||||
!ifndef INSTALLLIB_INSTALL_REBOOT_PROTECTED & INSTALLLIB_INSTALL_REBOOT_NOTPROTECTED & \
|
||||
INSTALLLIB_INSTALL_NOREBOOT_PROTECTED & INSTALLLIB_INSTALL_NOREBOOT_NOTPROTECTED
|
||||
!error "InstallLib: Incorrect setting for parameter: install"
|
||||
!endif
|
||||
|
||||
;------------------------
|
||||
;Copy the parameters used on run-time to a variable
|
||||
;This allows the usage of variables as parameter
|
||||
|
||||
StrCpy $R4 "${destfile}"
|
||||
StrCpy $R5 "${tempbasedir}"
|
||||
|
||||
;------------------------
|
||||
;Shared library count
|
||||
|
||||
!ifndef INSTALLLIB_SHARED_NOTSHARED
|
||||
|
||||
StrCmp ${shared} "" 0 installlib.noshareddllincrease_${INSTALLLIB_UNIQUE}
|
||||
|
||||
ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R4
|
||||
IntOp $R0 $R0 + 1
|
||||
WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R4 $R0
|
||||
|
||||
installlib.noshareddllincrease_${INSTALLLIB_UNIQUE}:
|
||||
|
||||
!endif
|
||||
|
||||
;------------------------
|
||||
;Check Windows File Protection
|
||||
|
||||
!ifdef INSTALLLIB_INSTALL_REBOOT_PROTECTED | INSTALLLIB_INSTALL_NOREBOOT_PROTECTED
|
||||
|
||||
System::Call "sfc::SfcIsFileProtected(i 0, w R4) i.R0"
|
||||
|
||||
StrCmp $R0 "error" installlib.notprotected_${INSTALLLIB_UNIQUE}
|
||||
StrCmp $R0 "0" installlib.notprotected_${INSTALLLIB_UNIQUE}
|
||||
|
||||
Goto installlib.done_${INSTALLLIB_UNIQUE}
|
||||
|
||||
installlib.notprotected_${INSTALLLIB_UNIQUE}:
|
||||
|
||||
!endif
|
||||
|
||||
;------------------------
|
||||
;Check file
|
||||
|
||||
IfFileExists $R4 0 installlib.copy_${INSTALLLIB_UNIQUE}
|
||||
|
||||
;------------------------
|
||||
;Get version information
|
||||
|
||||
!execute '"${NSISDIR}\Contrib\Library\LibraryLocal\LibraryLocal.exe" D ${LOCALFILE}'
|
||||
!include "${NSISDIR}\Contrib\Library\LibraryLocal\LibraryLocal.nsh"
|
||||
|
||||
!ifdef LIBRARY_VERSION_FILENOTFOUND
|
||||
!error "InstallLib: The library ${LOCALFILE} could not be found."
|
||||
!endif
|
||||
|
||||
!ifndef LIBRARY_VERSION_NONE
|
||||
|
||||
StrCpy $R0 ${LIBRARY_VERSION_HIGH}
|
||||
StrCpy $R1 ${LIBRARY_VERSION_LOW}
|
||||
|
||||
GetDLLVersion $R4 $R2 $R3
|
||||
|
||||
!undef LIBRARY_VERSION_HIGH
|
||||
!undef LIBRARY_VERSION_LOW
|
||||
|
||||
!ifndef INSTALLLIB_LIBTYPE_TLB & INSTALLLIB_LIBTYPE_REGDLLTLB
|
||||
|
||||
IntCmpU $R0 $R2 0 installlib.done_${INSTALLLIB_UNIQUE} installlib.upgrade_${INSTALLLIB_UNIQUE}
|
||||
IntCmpU $R1 $R3 installlib.done_${INSTALLLIB_UNIQUE} installlib.done_${INSTALLLIB_UNIQUE} \
|
||||
installlib.upgrade_${INSTALLLIB_UNIQUE}
|
||||
|
||||
!else
|
||||
|
||||
!execute '"${NSISDIR}\Contrib\LIBRARY\LIBRARYLocal\LibraryLocal.exe" T ${LOCALFILE}'
|
||||
!include "${NSISDIR}\Contrib\LIBRARY\LIBRARYLocal\LibraryLocal.nsh"
|
||||
|
||||
!ifdef LIBRARY_VERSION_FILENOTFOUND
|
||||
!error "InstallLib: The library ${LOCALFILE} could not be found."
|
||||
!endif
|
||||
|
||||
!ifndef LIBRARY_VERSION_NONE
|
||||
|
||||
IntCmpU $R0 $R2 0 installlib.done_${INSTALLLIB_UNIQUE} installlib.upgrade_${INSTALLLIB_UNIQUE}
|
||||
IntCmpU $R1 $R3 0 installlib.done_${INSTALLLIB_UNIQUE} \
|
||||
installlib.upgrade_${INSTALLLIB_UNIQUE}
|
||||
|
||||
!else
|
||||
|
||||
IntCmpU $R0 $R2 0 installlib.done_${INSTALLLIB_UNIQUE} installlib.upgrade_${INSTALLLIB_UNIQUE}
|
||||
IntCmpU $R1 $R3 installlib.done_${INSTALLLIB_UNIQUE} installlib.done_${INSTALLLIB_UNIQUE} \
|
||||
installlib.upgrade_${INSTALLLIB_UNIQUE}
|
||||
|
||||
!endif
|
||||
|
||||
!endif
|
||||
|
||||
!else
|
||||
|
||||
!undef LIBRARY_VERSION_NONE
|
||||
|
||||
!execute '"${NSISDIR}\Contrib\LIBRARY\LIBRARYLocal\LibraryLocal.exe" T ${LOCALFILE}'
|
||||
!include "${NSISDIR}\Contrib\LIBRARY\LIBRARYLocal\LibraryLocal.nsh"
|
||||
|
||||
!endif
|
||||
|
||||
!ifdef INSTALLLIB_LIBTYPE_TLB | INSTALLLIB_LIBTYPE_REGDLLTLB
|
||||
|
||||
!ifndef LIBRARY_VERSION_NONE
|
||||
|
||||
StrCpy $R0 ${LIBRARY_VERSION_HIGH}
|
||||
StrCpy $R1 ${LIBRARY_VERSION_LOW}
|
||||
|
||||
TypeLib::GetLibVersion $R4
|
||||
Pop $R2
|
||||
Pop $R3
|
||||
|
||||
IntCmpU $R0 $R2 0 installlib.register_${INSTALLLIB_UNIQUE} installlib.upgrade_${INSTALLLIB_UNIQUE}
|
||||
IntCmpU $R1 $R3 installlib.register_${INSTALLLIB_UNIQUE} installlib.register_${INSTALLLIB_UNIQUE} \
|
||||
installlib.upgrade_${INSTALLLIB_UNIQUE}
|
||||
|
||||
!undef LIBRARY_VERSION_HIGH
|
||||
!undef LIBRARY_VERSION_LOW
|
||||
|
||||
!else
|
||||
|
||||
!undef LIBRARY_VERSION_NONE
|
||||
|
||||
!endif
|
||||
|
||||
!endif
|
||||
|
||||
;------------------------
|
||||
;Upgrade
|
||||
|
||||
installlib.upgrade_${INSTALLLIB_UNIQUE}:
|
||||
|
||||
;------------------------
|
||||
;Copy
|
||||
|
||||
!ifdef INSTALLLIB_INSTALL_NOREBOOT_PROTECTED | INSTALLLIB_INSTALL_NOREBOOT_NOTPROTECTED
|
||||
|
||||
installlib.copy_${INSTALLLIB_UNIQUE}:
|
||||
|
||||
StrCpy $R0 $R4
|
||||
Call :installlib.file_${INSTALLLIB_UNIQUE}
|
||||
|
||||
!else
|
||||
|
||||
ClearErrors
|
||||
|
||||
StrCpy $R0 $R4
|
||||
Call :installlib.file_${INSTALLLIB_UNIQUE}
|
||||
|
||||
IfErrors 0 installlib.register_${INSTALLLIB_UNIQUE}
|
||||
|
||||
SetOverwrite lastused
|
||||
|
||||
;------------------------
|
||||
;Copy on reboot
|
||||
|
||||
GetTempFileName $R0 $R5
|
||||
Call :installlib.file_${INSTALLLIB_UNIQUE}
|
||||
Rename /REBOOTOK $R0 $R4
|
||||
|
||||
;------------------------
|
||||
;Register on reboot
|
||||
|
||||
!ifdef INSTALLLIB_LIBTYPE_REGDLL | INSTALLLIB_LIBTYPE_REGDLLTLB
|
||||
|
||||
GetTempFileName $R0 $R5
|
||||
File /oname=$R0 "${NSISDIR}\Contrib\Library\RegTool\RegTool.bin"
|
||||
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \
|
||||
"$R4" '"$R0" D $R4'
|
||||
|
||||
!endif
|
||||
|
||||
!ifdef INSTALLLIB_LIBTYPE_TLB | INSTALLLIB_LIBTYPE_REGDLLTLB
|
||||
|
||||
GetTempFileName $R0 $R5
|
||||
File /oname=$R0 "${NSISDIR}\Contrib\Library\RegTool\RegTool.bin"
|
||||
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \
|
||||
"$R4" '"$R0" T $R4'
|
||||
|
||||
!endif
|
||||
|
||||
Goto installlib.done_${INSTALLLIB_UNIQUE}
|
||||
|
||||
installlib.copy_${INSTALLLIB_UNIQUE}:
|
||||
StrCpy $R0 $R4
|
||||
Call :installlib.file_${INSTALLLIB_UNIQUE}
|
||||
|
||||
!endif
|
||||
|
||||
;------------------------
|
||||
;Register
|
||||
|
||||
installlib.register_${INSTALLLIB_UNIQUE}:
|
||||
|
||||
!ifdef INSTALLLIB_LIBTYPE_REGDLL | INSTALLLIB_LIBTYPE_REGDLLTLB
|
||||
|
||||
RegDLL $R4
|
||||
|
||||
!endif
|
||||
|
||||
!ifdef INSTALLLIB_LIBTYPE_TLB | INSTALLLIB_LIBTYPE_REGDLLTLB
|
||||
|
||||
TypeLib::Register $R4
|
||||
|
||||
!endif
|
||||
|
||||
;------------------------
|
||||
;Done
|
||||
|
||||
installlib.done_${INSTALLLIB_UNIQUE}:
|
||||
|
||||
Pop $R5
|
||||
Pop $R4
|
||||
Pop $R3
|
||||
Pop $R2
|
||||
Pop $R1
|
||||
Pop $R0
|
||||
|
||||
;------------------------
|
||||
;End
|
||||
|
||||
Goto installlib.end_${INSTALLLIB_UNIQUE}
|
||||
|
||||
;------------------------
|
||||
;Extract
|
||||
|
||||
!ifdef INSTALLLIB_INSTALL_REBOOT_PROTECTED | INSTALLLIB_INSTALL_REBOOT_NOTPROTECTED
|
||||
|
||||
SetOverwrite try
|
||||
|
||||
installlib.file_${INSTALLLIB_UNIQUE}:
|
||||
File /oname=$R0 "${LOCALFILE}"
|
||||
Return
|
||||
|
||||
installlib.end_${INSTALLLIB_UNIQUE}:
|
||||
|
||||
SetOverwrite lastused
|
||||
|
||||
!else
|
||||
|
||||
SetOverwrite on
|
||||
|
||||
installlib.file_${INSTALLLIB_UNIQUE}:
|
||||
File /oname=$R0 "${LOCALFILE}"
|
||||
Return
|
||||
|
||||
installlib.end_${INSTALLLIB_UNIQUE}:
|
||||
|
||||
SetOverwrite lastused
|
||||
|
||||
!endif
|
||||
|
||||
;------------------------
|
||||
;Undefine
|
||||
|
||||
!undef INSTALLLIB_UNIQUE
|
||||
|
||||
!undef ${INSTALLLIB_LIBTYPE_SET}
|
||||
!undef INSTALLLIB_LIBTYPE_SET
|
||||
!undef ${INSTALLLIB_SHARED_SET}
|
||||
!undef INSTALLLIB_SHARED_SET
|
||||
!undef ${INSTALLLIB_INSTALL_SET}
|
||||
!undef INSTALLLIB_INSTALL_SET
|
||||
|
||||
!verbose pop
|
||||
|
||||
!macroend
|
||||
|
||||
!macro UnInstallLib libtype shared uninstall file
|
||||
|
||||
!verbose push
|
||||
!verbose 3
|
||||
|
||||
Push $R0
|
||||
Push $R1
|
||||
|
||||
;------------------------
|
||||
;Define
|
||||
|
||||
!define UNINSTALLLIB_UNIQUE ${__LINE__}
|
||||
|
||||
!define UNINSTALLLIB_LIBTYPE_${libtype}
|
||||
!define UNINSTALLLIB_LIBTYPE_SET UNINSTALLLIB_LIBTYPE_${libtype}
|
||||
!define UNINSTALLLIB_SHARED_${shared}
|
||||
!define UNINSTALLLIB_SHARED_SET UNINSTALLLIB_SHARED_${shared}
|
||||
!define UNINSTALLLIB_UNINSTALL_${uninstall}
|
||||
!define UNINSTALLLIB_UNINSTALL_SET UNINSTALLLIB_UNINSTALL_${uninstall}
|
||||
|
||||
;------------------------
|
||||
;Validate
|
||||
|
||||
!ifndef UNINSTALLLIB_LIBTYPE_DLL & UNINSTALLLIB_LIBTYPE_REGDLL & UNINSTALLLIB_LIBTYPE_TLB & \
|
||||
UNINSTALLLIB_LIBTYPE_REGDLLTLB
|
||||
!error "UnInstallLib: Incorrect setting for parameter: libtype"
|
||||
!endif
|
||||
|
||||
!ifndef UNINSTALLLIB_SHARED_NOTSHARED & UNINSTALLLIB_SHARED_SHARED
|
||||
!error "UnInstallLib: Incorrect setting for parameter: shared"
|
||||
!endif
|
||||
|
||||
!ifndef UNINSTALLLIB_UNINSTALL_NOREMOVE & UNINSTALLLIB_UNINSTALL_REBOOT_PROTECTED & \
|
||||
UNINSTALLLIB_UNINSTALL_REBOOT_NOTPROTECTED & UNINSTALLLIB_UNINSTALL_NOREBOOT_PROTECTED & \
|
||||
UNINSTALLLIB_UNINSTALL_NOREBOOT_NOTPROTECTED
|
||||
!error "UnInstallLib: Incorrect setting for parameter: uninstall"
|
||||
!endif
|
||||
|
||||
;------------------------
|
||||
;Copy the parameters used on run-time to a variable
|
||||
;This allows the usage of variables as parameter
|
||||
|
||||
StrCpy $R1 "${file}"
|
||||
|
||||
;------------------------
|
||||
;Shared library count
|
||||
|
||||
!ifdef UNINSTALLLIB_SHARED_SHARED
|
||||
|
||||
ReadRegDword $R0 HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
|
||||
StrCmp $R0 "" uninstalllib.remove_${UNINSTALLLIB_UNIQUE}
|
||||
|
||||
IntOp $R0 $R0 - 1
|
||||
IntCmp $R0 0 uninstalllib.shareddllremove_${UNINSTALLLIB_UNIQUE} \
|
||||
uninstalllib.shareddllremove_${UNINSTALLLIB_UNIQUE} uninstalllib.shareddllinuse_${UNINSTALLLIB_UNIQUE}
|
||||
|
||||
uninstalllib.shareddllremove_${UNINSTALLLIB_UNIQUE}:
|
||||
DeleteRegValue HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1
|
||||
!ifndef UNINSTALLLIB_SHARED_SHAREDNOREMOVE
|
||||
Goto uninstalllib.remove_${UNINSTALLLIB_UNIQUE}
|
||||
!endif
|
||||
|
||||
uninstalllib.shareddllinuse_${UNINSTALLLIB_UNIQUE}:
|
||||
WriteRegDWORD HKLM Software\Microsoft\Windows\CurrentVersion\SharedDLLs $R1 $R0
|
||||
Goto uninstalllib.done_${UNINSTALLLIB_UNIQUE}
|
||||
|
||||
!endif
|
||||
|
||||
;------------------------
|
||||
;Remove
|
||||
|
||||
uninstalllib.remove_${UNINSTALLLIB_UNIQUE}:
|
||||
|
||||
!ifndef UNINSTALLLIB_UNINSTALL_NOREMOVE
|
||||
|
||||
;------------------------
|
||||
;Check Windows File Protection
|
||||
|
||||
!ifdef UNINSTALLLIB_UNINSTALL_REBOOT_PROTECTED | UNINSTALLLIB_UNINSTALL_NOREBOOT_PROTECTED
|
||||
|
||||
System::Call "sfc::SfcIsFileProtected(i 0, w $R1) i.R0"
|
||||
|
||||
StrCmp $R0 "error" uninstalllib.notprotected_${UNINSTALLLIB_UNIQUE}
|
||||
StrCmp $R0 "0" uninstalllib.notprotected_${UNINSTALLLIB_UNIQUE}
|
||||
|
||||
Goto uninstalllib.done_${UNINSTALLLIB_UNIQUE}
|
||||
|
||||
uninstalllib.notprotected_${UNINSTALLLIB_UNIQUE}:
|
||||
|
||||
!endif
|
||||
|
||||
;------------------------
|
||||
;Unregister
|
||||
|
||||
!ifdef UNINSTALLLIB_LIBTYPE_REGDLL | UNINSTALLLIB_LIBTYPE_REGDLLTLB
|
||||
|
||||
UnRegDLL $R1
|
||||
|
||||
!endif
|
||||
|
||||
!ifdef INSTALLLIB_LIBTYPE_TLB | UNINSTALLLIB_LIBTYPE_REGDLLTLB
|
||||
|
||||
TypeLib::UnRegister $R1
|
||||
|
||||
!endif
|
||||
|
||||
;------------------------
|
||||
;Delete
|
||||
|
||||
!ifdef UNINSTALLLIB_UNINSTALL_REBOOT_PROTECTED | UNINSTALLLIB_UNINSTALL_REBOOT_NOTPROTECTED
|
||||
|
||||
Delete /REBOOTOK $R1
|
||||
|
||||
!else
|
||||
|
||||
Delete $R1
|
||||
|
||||
!endif
|
||||
|
||||
!endif
|
||||
|
||||
;------------------------
|
||||
;Done
|
||||
|
||||
uninstalllib.done_${UNINSTALLLIB_UNIQUE}:
|
||||
|
||||
Pop $R1
|
||||
Pop $R0
|
||||
|
||||
;------------------------
|
||||
;Undefine
|
||||
|
||||
!undef UNINSTALLLIB_UNIQUE
|
||||
|
||||
!undef ${UNINSTALLLIB_LIBTYPE_SET}
|
||||
!undef UNINSTALLLIB_LIBTYPE_SET
|
||||
!undef ${UNINSTALLLIB_SHARED_SET}
|
||||
!undef UNINSTALLLIB_SHARED_SET
|
||||
!undef ${UNINSTALLLIB_UNINSTALL_SET}
|
||||
!undef UNINSTALLLIB_UNINSTALL_SET
|
||||
|
||||
!verbose pop
|
||||
|
||||
!macroend
|
||||
|
||||
!endif
|
|
@ -1,28 +1,45 @@
|
|||
/*
|
||||
|
||||
NOTE:
|
||||
-----
|
||||
This macro is provided for backwards compatibility with NSIS 2.0 scripts.
|
||||
It's recommended you update your scripts to use the new Library.nsh macros.
|
||||
|
||||
|
||||
Macro - Upgrade DLL File
|
||||
Written by Joost Verburg
|
||||
------------------------
|
||||
|
||||
Parameters:
|
||||
LOCALFILE Location of the new DLL file (on the compiler system)
|
||||
DESTFILE Location of the DLL file that should be upgraded (on the user's system)
|
||||
TEMPBASEDIR Directory on the user's system to store a temporary file when the system has
|
||||
to be rebooted.
|
||||
For Win9x/ME support, this should be on the same volume as DESTFILE.
|
||||
The Windows temp directory could be located on any volume, so you cannot use
|
||||
this directory.
|
||||
|
||||
Define UPGRADEDLL_NOREGISTER if you want to upgrade a DLL that does not have to be registered.
|
||||
|
||||
Notes:
|
||||
|
||||
* If you want to support Windows 9x/ME, you can only use short filenames (8.3).
|
||||
|
||||
* This macro uses the GetDLLVersionLocal command to retrieve the version of local libraries.
|
||||
This command is only supported when compiling on a Windows system.
|
||||
|
||||
------------------------
|
||||
|
||||
Example:
|
||||
|
||||
!insertmacro UpgradeDLL "dllname.dll" "$SYSDIR\dllname.dll" "$SYSDIR"
|
||||
|
||||
*/
|
||||
|
||||
!ifndef UPGRADEDLL_INCLUDED
|
||||
|
||||
!define UPGRADEDLL_INCLUDED
|
||||
|
||||
; Macro - Upgrade DLL File
|
||||
; Written by Joost Verburg
|
||||
; ------------------------
|
||||
;
|
||||
; Parameters:
|
||||
; LOCALFILE - Location of the new DLL file (on the compiler system)
|
||||
; DESTFILE - Location of the DLL file that should be upgraded (on the user's system)
|
||||
; TEMPBASEDIR - Directory on the user's system to store a temporary file when the system has
|
||||
; to be rebooted.
|
||||
; For Win9x support, this should be on the same volume as the DESTFILE!
|
||||
; The Windows temp directory could be located on any volume, so you cannot use
|
||||
; this directory.
|
||||
;
|
||||
; Define UPGRADEDLL_NOREGISTER if you want to upgrade a DLL that does not have to be registered.
|
||||
;
|
||||
; Note: If you want to support Win9x, you can only use short filenames (8.3).
|
||||
;
|
||||
; Example of usage:
|
||||
; !insertmacro UpgradeDLL "dllname.dll" "$SYSDIR\dllname.dll" "$SYSDIR"
|
||||
;
|
||||
|
||||
!macro UpgradeDLL LOCALFILE DESTFILE TEMPBASEDIR
|
||||
|
||||
Push $R0
|
||||
|
@ -32,11 +49,10 @@
|
|||
Push $R4
|
||||
Push $R5
|
||||
|
||||
;------------------------
|
||||
;Unique number for labels
|
||||
|
||||
!define UPGRADEDLL_UNIQUE ${__LINE__}
|
||||
|
||||
SetOverwrite try
|
||||
|
||||
;------------------------
|
||||
;Copy the parameters used on run-time to a variable
|
||||
;This allows the usage of variables as paramter
|
||||
|
@ -45,7 +61,7 @@
|
|||
StrCpy $R5 "${TEMPBASEDIR}"
|
||||
|
||||
;------------------------
|
||||
;Check file and version
|
||||
;Get version information
|
||||
|
||||
IfFileExists $R4 0 upgradedll.copy_${UPGRADEDLL_UNIQUE}
|
||||
|
||||
|
@ -59,9 +75,7 @@
|
|||
upgradedll.upgrade_${UPGRADEDLL_UNIQUE}
|
||||
|
||||
;------------------------
|
||||
;Let's upgrade the DLL!
|
||||
|
||||
SetOverwrite try
|
||||
;Upgrade
|
||||
|
||||
upgradedll.upgrade_${UPGRADEDLL_UNIQUE}:
|
||||
!ifndef UPGRADEDLL_NOREGISTER
|
||||
|
@ -70,7 +84,7 @@
|
|||
!endif
|
||||
|
||||
;------------------------
|
||||
;Try to copy the DLL directly
|
||||
;Copy
|
||||
|
||||
ClearErrors
|
||||
StrCpy $R0 $R4
|
||||
|
@ -78,31 +92,32 @@
|
|||
IfErrors 0 upgradedll.noreboot_${UPGRADEDLL_UNIQUE}
|
||||
|
||||
;------------------------
|
||||
;DLL is in use. Copy it to a temp file and Rename it on reboot.
|
||||
;Copy on reboot
|
||||
|
||||
GetTempFileName $R0 $R5
|
||||
Call :upgradedll.file_${UPGRADEDLL_UNIQUE}
|
||||
Rename /REBOOTOK $R0 $R4
|
||||
|
||||
;------------------------
|
||||
;Register the DLL on reboot
|
||||
;Register on reboot
|
||||
|
||||
!ifndef UPGRADEDLL_NOREGISTER
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \
|
||||
"Register $R4" 'rundll32.exe "$R4",DllRegisterServer'
|
||||
!endif
|
||||
GetTempFileName $R0 $R5
|
||||
File /oname=$R0 "${NSISDIR}\Contrib\Library\RegTool\RegTool.bin"
|
||||
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\RunOnce" \
|
||||
"$R4" '"$R0" D $R4'
|
||||
|
||||
Goto upgradedll.done_${UPGRADEDLL_UNIQUE}
|
||||
|
||||
;------------------------
|
||||
;DLL does not exist - just extract
|
||||
;DLL does not exist
|
||||
|
||||
upgradedll.copy_${UPGRADEDLL_UNIQUE}:
|
||||
StrCpy $R0 $R4
|
||||
Call :upgradedll.file_${UPGRADEDLL_UNIQUE}
|
||||
|
||||
;------------------------
|
||||
;Register the DLL
|
||||
;Register
|
||||
|
||||
upgradedll.noreboot_${UPGRADEDLL_UNIQUE}:
|
||||
!ifndef UPGRADEDLL_NOREGISTER
|
||||
|
@ -127,7 +142,7 @@
|
|||
Goto upgradedll.end_${UPGRADEDLL_UNIQUE}
|
||||
|
||||
;------------------------
|
||||
;Called to extract the DLL
|
||||
;Extract
|
||||
|
||||
upgradedll.file_${UPGRADEDLL_UNIQUE}:
|
||||
File /oname=$R0 "${LOCALFILE}"
|
||||
|
@ -135,13 +150,10 @@
|
|||
|
||||
upgradedll.end_${UPGRADEDLL_UNIQUE}:
|
||||
|
||||
;------------------------
|
||||
;Restore settings
|
||||
|
||||
SetOverwrite lastused
|
||||
|
||||
!undef UPGRADEDLL_UNIQUE
|
||||
SetOverwrite lastused
|
||||
|
||||
!undef UPGRADEDLL_UNIQUE
|
||||
|
||||
!macroend
|
||||
|
||||
!endif
|
||||
!endif
|
||||
|
|
BIN
Plugins/TypeLib.dll
Normal file
BIN
Plugins/TypeLib.dll
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue