Hi Guys,
I'm trying to make an installer and I've found several problems at the moment... I'll list them all here:
1) I am wanting to make an installer that installs to a random location under their main C:\ folder, a 10 character random folder name for example:
C:\s92koroope\main\fileshere.txt
I can't for the life of me figure out how to make a random function in nsis...
2) I know there is code to check if they have UAC enabled, but is it possible to offer a way to disable it?
3) How can I detect if they have windows firewall enabled, how do I add exceptions to the firewall?
4) How do I detect if windows thinks they have an antivirus installed (if they do I want to show a popup message)
5) I am also wanting to detect if the following are installed, if they aren't installed it needs to download and install them...
Visual C++ 2008 SP1 Redistributable Package (x86)
Visual C++ 2012 SP1 Redistributable Package (x86)
.NET Framework 3.5
.NET Framework 4.0
.NET Framework 4.5
6) As part of the above, I want it to make sure DirectX9 SDK is forcefully updated, rather than an old version of directx 9 being installed
Thanks very much! 🙂
Random folder location, disable uac, firewall exception... more
3 posts
You could try ${StdUtils.Rand}, for example:Originally Posted by TheOnlyLeader View Post1) I am wanting to make an installer that installs to a random location under their main C:\ folder, a 10 character random folder name for example:
C:\s92koroope\main\fileshere.txt
I can't for the life of me figure out how to make a random function in nsis...
Why would you want to do this? If an application could simply disable UAC, this would break the whole concept of UAC. I guess an application running with "Admin" rights could still do it - maybe by emulating user mouse/keyboard inputs - but is it a good idea?Originally Posted by TheOnlyLeader View Post2) I know there is code to check if they have UAC enabled, but is it possible to offer a way to disable it?
Look at Firewall plug-in:Originally Posted by TheOnlyLeader View Post3) How can I detect if they have windows firewall enabled, how do I add exceptions to the firewall?
Windows 10 introduces a new API to allow applications to interact with the A/V software:Originally Posted by TheOnlyLeader View Post4) How do I detect if windows thinks they have an antivirus installed (if they do I want to show a popup message)
AMSI reference pages contain descriptions of the enumerations, COM interfaces, and other programming elements of the AMSI API.
Not sure there is something like that in earlier Windows versions...
I usually do detect those via Registry 😉Originally Posted by TheOnlyLeader View Post5) I am also wanting to detect if the following are installed, if they aren't installed it needs to download and install them...
Visual C++ 2008 SP1 Redistributable Package (x86)
Visual C++ 2012 SP1 Redistributable Package (x86)
.NET Framework 3.5
.NET Framework 4.0
.NET Framework 4.5
Visual C++ Runtime:
ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\VisualStudio\12.0\VC\Runtimes\x86" "Installed"
ReadRegDWORD $1 HKLM "SOFTWARE\Microsoft\VisualStudio\12.0\VC\Runtimes\x86" "Major"
ReadRegDWORD $2 HKLM "SOFTWARE\Microsoft\VisualStudio\12.0\VC\Runtimes\x86" "Bld"
.NET Framework:
ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" "Release"
You can simply run the DirectX installer in a mode that works without user interaction. It will install DirectX, if it is not installed yet; it will update the existing DirectX installation, if the installed version is older; and, otherwise, it does nothing.Originally Posted by TheOnlyLeader View Post6) As part of the above, I want it to make sure DirectX9 SDK is forcefully updated, rather than an old version of directx 9 being installed
See also:
3) with one of the firewall plugins, 4) with WmiInspector plugin
2) 5) 6) through appropriate reg keys; do your googling to know which
1) the easy way is:
Edit: come to think of it, it's easy enough to use GetTempFileName to produce longer strings without ns prefix, although they're not truly random (it will be e.g. e91e92...).
2) 5) 6) through appropriate reg keys; do your googling to know which
1) the easy way is:
GetTempFileName $0
Delete $0
${GetBaseName} "$0" $0 # FileFunc.nsh
CreateDirectory "C:\$0\main" This will produce 5-char folder names in ns*** format. It that's not acceptable, you'll need to cook something with either NsRandom/StdUtils plugin or one of these.Edit: come to think of it, it's easy enough to use GetTempFileName to produce longer strings without ns prefix, although they're not truly random (it will be e.g. e91e92...).
StrCpy $1 ""
# repeat as many times as desired:
GetTempFileName $0
Delete $0
${GetBaseName} "$0" $0
StrCpy $0 $0 "" -3 # remove "ns"
StrCpy $1 "$1$0"
MessageBox MB_OK "string: $1"