2016-02-29 27 views
0

我想在我的NSIS 2.46安装程序中创建系统还原点。我搜索了一下,发现SysRestore插件是最好的选择。命令无效:SysRestore :: StartRestorePoint在NSIS中使用SysRestore插件

我从http://nsis.sourceforge.net/SysRestore_plug-in下载了SysRestore.zip,解压缩并将其复制到NSIS的安装文件夹中。但即使是发布的示例(\Examples\SysRestore\example.nsi)也无法正确编译。

日志如下所示:

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 

在我的知识,一个NSIS插件应该提供一个.nsh文件被列入.nsi脚本。包含头将提供有关功能的定义,如SysRestore::StartRestorePoint。所以编译器不会抱怨它。

但是我没有在SysRestore的文件夹中找到.nsh。这个插件有什么问题?或者我的使用中缺少某些内容?

谢谢!

回答

2

您不能仅从解压缩的存档中复制文件夹,因为它使用NSIS 3.x文件结构进行插件。尽管如此,复制文档和示例的文件夹效果并不理想。

使用NSIS 2.x时,请确保将Plugins\x68-ansi\SysRestore.dll复制到%PROGRAMFILES%\NSIS\Plugins

+0

这个答案解决了我的问题,谢谢! – hsluoyz

0

看这个编译时消息,下面几行:

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

SysRestore :: StartRestorePoint不会出现在加载的插件列表。您是否将SysRestore.dll复制到插件文件夹?如果您只是将其提取到其他文件夹,则需要使用!addplugindir并包含该文件夹。