I'm using NSIS 2.46. Plugin I'm trying to use is HwInfo plug-in (Official Link). The ZIP file comes with some source codes and a DLL file. I put the HwInfo.dll
inside \NSIS\Plugins
directory. When adding a plugin, I'm supposed to !include
the .nsh
file as well, which HwInfo does not supply.
I'm trying to analyze the client's harware before installing-
Function .onInit
HwInfo::GetCpuSpeed
StrCpy $R0 $0
MessageBox MB_OK "You have a $0GHz CPU"
HwInfo::GetSystemMemory
StrCpy $0
MessageBox MB_OK "You have $0MB of RAM"
FunctionEnd
But the line HwInfo::GetCpuSpeed
is 'invalid command'
.
How do I use a plugin without a NSH file? And are there any alternatives?
Solved:
I added !addplugindir "${NSISDIR}\Plugins"
at the very top of this script. This helped detect HwInfo.dll
inside \NSIS\Plugins
directory at compile-time.
Not all plugins have a .nsh file but the wiki page usually tells you how to use a specific plugin.
If you run makensis /V4 yourscript.nsi
it will list all plugins and the functions they export, if your plugin is not on the list it is probably not in the correct directory. Make sure you put it in the correct directory or use !addplugindir
...
I know this question has an accepted answer, but for info for people using NSIS v3.x:
The plugin folder now has two sub-folders, one for ANSI and one for UNICODE, so you'd need to copy your plugins into ${NSISDIR}\Plugins\x86-ansi\
and ${NSISDIR}\Plugins\x86-unicode\
for the ANSI and UNICODE versions of the plugin dlls respectively.
I'm guessing if you use the 64-bit NSIS port, you'd have \x64-ansi\
and \x64-unicode
subfolders too, but I've not checked that specifically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With