0
votes

I want to create system restore points in my NSIS 2.46 installer. I googled around and found SysRestore plug-in is the best choice.

I downloaded the SysRestore.zip from http://nsis.sourceforge.net/SysRestore_plug-in, unzipped it and copied it to the installation folder of NSIS. But even the shipped example (\Examples\SysRestore\example.nsi) can't compile correctly.

The log is shown below:

MakeNSIS v2.46 - Copyright 1995-2009 Contributors
See the file COPYING for license details.
Credits can be found in the Users Manual.

Processing config: 
Processing plugin dlls: "C:\Program Files (x86)\NSIS\Plugins\*.dll"
 - AdvSplash::show
 - Banner::destroy
 - Banner::getWindow
 - Banner::show
 - BgImage::AddImage
 - BgImage::AddText
 - BgImage::Clear
 - BgImage::Destroy
 - BgImage::Redraw
 - BgImage::SetBg
 - BgImage::SetReturn
 - BgImage::Sound
 - Dialer::AttemptConnect
 - Dialer::AutodialHangup
 - Dialer::AutodialOnline
 - Dialer::AutodialUnattended
 - Dialer::GetConnectedState
 - InstallOptions::dialog
 - InstallOptions::initDialog
 - InstallOptions::show
 - LangDLL::LangDialog
 - Math::Script
 - NSISdl::download
 - NSISdl::download_quiet
 - Splash::show
 - StartMenu::Init
 - StartMenu::Select
 - StartMenu::Show
 - System::Alloc
 - System::Call
 - System::Copy
 - System::Free
 - System::Get
 - System::Int64Op
 - System::Store
 - TypeLib::GetLibVersion
 - TypeLib::Register
 - TypeLib::UnRegister
 - UserInfo::GetAccountType
 - UserInfo::GetName
 - UserInfo::GetOriginalAccountType
 - VPatch::GetFileCRC32
 - VPatch::GetFileMD5
 - VPatch::vpatchfile
 - nsDialogs::Create
 - nsDialogs::CreateControl
 - nsDialogs::CreateItem
 - nsDialogs::CreateTimer
 - nsDialogs::GetUserData
 - nsDialogs::KillTimer
 - nsDialogs::OnBack
 - nsDialogs::OnChange
 - nsDialogs::OnClick
 - nsDialogs::OnNotify
 - nsDialogs::SelectFileDialog
 - nsDialogs::SelectFolderDialog
 - nsDialogs::SetRTL
 - nsDialogs::SetUserData
 - nsDialogs::Show
 - nsExec::Exec
 - nsExec::ExecToLog
 - nsExec::ExecToStack

!define: "MUI_INSERT_NSISCONF"=""

Changing directory to: "C:\Users\Administrator\Downloads\SysRestore\Examples\SysRestore"

Processing script file: "C:\Users\Administrator\Downloads\SysRestore\Examples\SysRestore\example.nsi"
Name: "System Restore Example"
OutFile: "Example.exe"
InstallDir: "$PROGRAMFILES\$(^Name)\"
ShowInstDetails: Show
ShowUninstDetails: Show
Page: Directory
Page: InstFiles
UninstPage: UninstConfirm
UninstPage: InstFiles
Var: "Error"
Section: "install"
SetOverwrite: try
StrCpy $Error "0" () ()
DetailPrint: "Setting System Restore point..."
Invalid command: SysRestore::StartRestorePoint
Error in script "C:\Users\Administrator\Downloads\SysRestore\Examples\SysRestore\example.nsi" on line 20 -- aborting creation process

In my knowledge, a NSIS plug-in should provide a .nsh file to be included in the .nsi script. The include header will provide the definitions about the functions like SysRestore::StartRestorePoint. So the compiler won't complain about it.

But I didn't find a .nsh in the folder of SysRestore. What's wrong with this plug-in? Or there's something missing in my usage?

Thanks!

2

2 Answers

2
votes

You can't just copy the folders from the extracted archive, since it uses a NSIS 3.x file structure for plugins. Copying the folders for documentation and examples is fine though.

When using NSIS 2.x, make sure that Plugins\x68-ansi\SysRestore.dll is copied to %PROGRAMFILES%\NSIS\Plugins.

0
votes

Look at this compile time message, and the following lines:

Processing plugin dlls: "C:\Program Files (x86)\NSIS\Plugins\*.dll"

SysRestore::StartRestorePoint doesn't appear in the list of loaded plugins. Did you copy SysRestore.dll to the Plugins folder? If you just extracted it to a different folder, then you need to use !addplugindir and include that folder.