NSIS Calling Plugin functions from uninstaller - plugins

In my NSIS installer I have the !include StrFunc.nsh as well as others and call the ${StrCase} function fine when needed.
But I now need to call the ${StrCase} function in my uninstaller but every time I try and call it, it does not compile.
Question is how do I get plugins imported into my uninstaller so I can reference their functions?
I have tried ${un.StrCase} and I have also tried !include un.StrFunc.nsh
But still no luck.
Does someone have a working example they can show me so I can understand and how these are mean to work.
TIA
Andy

The documentation for StrFunc.nsh says
3.2 How To Use Commands In Uninstall Sections and Functions
Commands with Uninstall Sections and Functions support have "Un" before
the words inside curly brackets "{}".
Example:
${UnStrStr}
A complete example with both Install and Uninstall Commands:
------------------------------------------------------------
!include "StrFunc.nsh"
${StrStr} # Supportable for Install Sections and Functions
${UnStrStr} # Supportable for Uninstall Sections and Functions
Section
${StrStr} $0 "OK! Now what?" "wh"
SectionEnd
Section Uninstall
${UnStrStr} $0 "OK! Now what?" "wh"
SectionEnd

Related

NetBeans IDE: Resolve Missing Native Build Tools

I am trying to install Fortran in my Windows 10 laptop.
I followed step-by-step this tutorial.
On the last step I am promted to run the following piece of code:
program testfortran
implicit none
print*,'Hello world '
end program testfortran
However a Resolve Missing Native Build Tools window pops-up: it seems that the Make command field is empty.
To be more specific at the bottom of this window there is a message that Tolls marked with * are required. There are three such fields:
(1)C++ compiler to which is attributed the message C:\MinGW\bin\g++.exe
(2)Fortran compiler to which is attributed the message C:\MinGW\bin\gfortran.exe
(3) Make command which is empty (it comes with a red *)
What should I write inside the Make command field?
P.S. All I want is Fortran 90/95 installed on my Windows 10 laptop. I try to do this with step-by-step tutorials because installing software is not exactly what I am good at. So any alternatives would be welcome.
MinGW comes with the mingw32-make program (or it can be installed by mingw-get install mingw32-make). So you should use
C:\MinGW\bin\mingw32-make.exe

How to Install an NSIS Executable Silently For All Users

I have an NSIS installer executable which I would like to install silently for all users. I know I can pass the /S argument to do a silent install. The problem is that the default option for the installer is to install only for the current user. How can I change this option from the command line:
installer.exe /S
NSIS itself just supports /S, /NCRC and /D=c:\override\default\installdir\, everything else is up the author.
If the custom page from your screenshot was created with MultiUser.nsh and the author defined MULTIUSER_INSTALLMODE_COMMANDLINE then you could use installer.exe /AllUsers /S, otherwise you have to ask the author of the installer if they are checking for a specific command line switch.
If it turns out there is no way to do it then you would have to look into UI automation...
It turns out that for this particular installer you can pass:
/ALLUSERS=1
ALLUSERS is a standard MSI property. I did not find any documentation for this property in NSIS, so it looks like the developers of this particular installer added this.

Installing a driver (.inf) file from command line

I am working in Windows 8.1.
I need to install a driver file (.inf file) from command line. Which command do I need to use?
I know I have many other method for installing a .inf file, but I must install this from command line.
Please help me
Thanks in advance...
Granger's comment works in Windows 7 too. According to MS, PnPUtil (PnPUtil.exe) is included in every version of Windows, starting with Windows Vista.
It is useful for device drivers that do not have default install (right-click "Install" does not work for them).
pnputil -i -a <driverinf>
The default way for device drivers is:
pnputil -i -a <driverinf>
Legacy Drivers canĀ“t be installed with pnputil and have to use LaunchINFSectionEx-Call
I tested the following and it works with several drivers from Windows 2000 up to Windows 10, 2012R2, 2016, 2019.
rundll32.exe advpack.dll,LaunchINFSectionEx ykmd.inf,Yubico64_Install.NT,,4,N
Pay attention to use the correct section
The correct section of the inf-File must be used, when there is no [DefaultInstall]-Section. This lacks in most answers. Look it up in your drivers inf-File and use the correct section (in my example "Yubico64_Install.NT"). Using the wrong section wont prompt an error. Im my example I use Quiet mode, no UI (4) and Never reboot (N) to install the driver automated via GPO. All options are documented in detail here:
https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa768006(v%3Dvs.85)
There are many variants ... and many complications with newer versions of Windows.
But for starters, try something like this:
rundll32.exe advpack.dll,LaunchINFSectionEx myinf.inf,,c:\temp\mydata.cab,36
http://www.msfn.org/board/topic/104891-how-can-i-install-a-inf-file-from-the-command-line/
http://msdn.microsoft.com/en-us/library/aa768006%28v=vs.85%29.aspx
Programmatic driver install via .inf causing reboot
Note: beware older links that suggest "setupapi" instead of "advpack". You definitely want advpack.dll.

Strange issue with MinGW make command (with muParser)?

I'm having the strangest issue while trying to build and install muParser on my windows machine. As suggested by the installation guide, I just cd into the build folder, and run
make -f makefile.mingw
This should be all well and good standard procedure. However, I can't make sense of the output from the command:
if not exist obj\gcc_static_rel mkdir obj\gcc_static_rel
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Chase\Desktop\muparser_v2_0_0\muparser_v2_0_0\build>
Now... at this point, I'm really confused. Because according to the title of the command prompt window, I'm still INSIDE the make command. So, I type "exit" at the "prompt"
g++ -c -o obj\gcc_static_rel\muParser_lib_muParser.o -DNDEBUG -O2 -D_WIN32 - I..\include -MTobj\gcc_static_rel\muParser_lib_muParser.o - MFobj\gcc_static_rel\muParser_lib_muParser.o.d -MD -MP ../src/muParser.cpp
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Chase\Desktop\muparser_v2_0_0\muparser_v2_0_0\build>
The command appears to "step" through it's next function. I continue to type exit at the "prompt" and the command appears to continue stepping until it's done. However, after exiting completely, I can't see any results and it appears nothing's actually been done.
Also, this doesn't have anything to do with the command prompt. I even wrote a python script to cd into the directory and call make, and the output still displayed a windows-style command prompt - complete with the copyright Microsoft line etc., and waited for an input. I typed exit the same way until the process exited back to python.
Now, I might be going insane, but I'm really confused. Asking on the forums yielded no help, the only response is that "the windows build should be working."
Does anyone know what's going on???
I downloaded the muParser package and tried to build it. I got the same strange behaviour from make as you did. Then I realised I only had MSYS-make installed, not MinGW-make (the first one is intended for use in the MSYS shell, the second one for use in the Windows cmd shell).
Unfortunately, installing and using mingw32-make gave a different error, but googling that lead me to this page, where it was suggested to rename sh.exe in the MSYS directory. After doing that, running mingw32-make -f makefile.mingw succesfully built (the static version of) the library.
The other method you and shellter are using of running ./configure; make in the MSYS shell, also fails to build the example for me. It does build the dll version of the library in this case, instead of the static version; perhaps this is why the example fails to build.
(You might want to add a tag for 'make' or 'gmake', that should boost the number of eyes looking at your problem).
Looking at the makefile.mingw, I'm surprised to see statements like '-if not exist ..', that is .bat file syntax.
I ran ./configure ; make and it got past the error messages you mention, but I'm seeing a bunch of error messages like undefined reference to mu::ParserError: , so I'm probably missing libraries to make it work completely. I'll have to leave it at that, and hope that it helps you. Note that I didn't use make -f makefile.mingw. After using configure, make just picked up the newly created Makefile, and it worked (excepting the library problems ;-)
(When you say forums, did you mean the mingw forums? If not, try looking around here. The search functionality is pretty good.)
I hope this helps.

Compiling WWW::Curl on ActivePerl

I'm trying (desperately) to build / install the newest version of WWW::Curl onto my activeperl box (I'll explain in a moment why I don't use the PPM)
I had to make some modifications as per the instructions found here:
http://cpansearch.perl.org/src/SZBALINT/WWW-Curl-4.15/README.Win32
I also had to change the following line:
From:
open(H_IN, "-|" "gcc", "$curl_h") and $has_cpp++;
To:
open(H_IN, "gcc $curl_h") and $has_cpp++;
I finally got perl Makefile.PL to work but now, when I run nmake, I get the following:
Missing right curly or square bracket at -e line 1, at end of line
Execution of -e aborted due to compilation errors.
NMAKE: fatal error U1077: 'C;|windows\system32\cmd.exe' : return code '0xff'
Stop.
Now, the reason I'm trying to compile this rather than using the PPM supplied by u.winnipeg is because the that PPM doesn't seem to support SSL transaction (I get "libcurl: ssl disabled") Now, if anyone can show me how to get ssl to run on this PPM, I'm more than happy to use it.
Thank you very much in advance
I presume the original was
open(H_IN, "-|", "gcc", "$curl_h")
The reason you have to change that in because noone got around to implementing feature in Windows. Change it to
open(H_IN, qq{gcc "$curl_h" |})
Use the right name and syntax for your compiler.
Well, I finally figured it out, thanks to everyone who responded. There were a bunch of things I had to change.
Using http://cpansearch.perl.org/src/SZBALINT/WWW-Curl-4.15/README.Win32 as a guide:
The open cmd as I did above worked fine. However, I did use the advice returned by ikegami, reinierpost, and mob.
Using nmake /n (as advised by socket puppet), it printed out all of the perl statements which were being executed. I took this output and placed it into a .bat file and corrected the perl syntax.
I changed all instances of
pm_to_blib({{#ARGV}
to
pm_to_blib({#ARGV}
(it is disturbing these were returned)
Then, I had to link the libcurl libraries to each line instantiating g++, which were not linked correctly. After I added these references, everything else went smoothly.
These were added:
C:\lc\curl\lib\libcurl.a C:\lc\curl\lib\libcurldll.a
Now, WWW::Curl is happily running on my system.
As for using the PPM version, it is exactly because of SSL I had to upgrade. The newest version of WWW::Curl is 4.15 the ppm version is (I believe) 3.02.
First, many people don't know that you can use ppm to install MinGW to use cpan to install modules.
Second, if the libcurl provided by your module doesn't do SSL, you can try and replace it with a suitable SSL version from the download page. This might well fail, but you might also be lucky.