Friday, 7 October 2011

NSIS installer for 64-bit Windows

Here are some tips for creating (32-bit) NSIS installer which installs 64-bit application on 64-bit Windows.

There is no 64-bit NSIS Installer (yet) so only 32-bit version will be running on 64-bit host which means that 32-bit redirection will take place: by default its Installation Directory is "C:\Program Files (x86)" and it reads/writes only from HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node portion of the registry. This is not what we want so we need to enable access to native Win64 directories/registry for our Installer.

Our installer, as 32-bit application, will probably be used both for 32-bit and 64-bit installations. It therefore needs to be able to determine architecture of the CPU it runs on. x64 plug-in offers macro RunningX64 which returns true if installer is running on 64-bit Windows (under WoW64 emulation):

setup.nsi:
!include x64.nsh
...
${If} ${RunningX64}
   DetailPrint "Installer running on 64-bit host"
${EndIf}

Once we've detected 64-bit host, we need to:
  • set "C:\Program Files" as Installation Directory - use $PROGRAMFILES64 instead of $PROGRAMFILES
  • enable access to 64-bit registry - use SetRegView NSIS command

setup.nsi:
!include x64.nsh

;set initial value for $INSTDIR
InstallDir "$PROGRAMFILES\${MY_COMPANY}\${MY_APP}"
...
${If} ${RunningX64}
   DetailPrint "Installer running on 64-bit host"
   ; disable registry redirection (enable access to 64-bit portion of registry)
   SetRegView 64
   ; change install dir
   StrCpy $INSTDIR "$PROGRAMFILES64\${MY_COMPANY}\${MY_APP}"
${EndIf}

If installer needs to detect whether some 64-bit process is running, use FindProcDLL plug-in (there are couple of versions available but I found only this one - FindProcDLL_mod_by_hnedka.7z - working for me; please have a look at this forum thread). Download this archived file, unpack it and copy FindProcDLL.dll to your ..\NSIS\Plugins directory.

setup.nsi:
${If} ${RunningX64}
   FindProcDLL::FindProc "Some64BitProcess.exe"
   ${If} $R0 == 1
      DetailPrint "FindProcDLL::FindProc() returned 1 (process is running)"
   ${ElseIf} $R0 == 0
      DetailPrint "FindProcDLL::FindProc() returned 0 (process is not running)"
   ${Else}
      DetailPrint "FindProcDLL::FindProc() returned unexpected value"
   ${Endif}
${Else}
...

7 comments:

Unknown said...

If you need to install either a 32-bit or 64-bit file, you can do this:

${If} ${RunningX64}
File "/oname=MyFile.exe" "files\MyFile64.exe"
${Else}
File "files\MyFile.exe"
${EndIf}

If you need to register a DLL, you can do this:

${If} ${RunningX64}
ExecWait 'regsvr32.exe /s "$INSTDIR\MyDLL.dll"'
${Else}
RegDLL "$INSTDIR\MyDLL.dll"
${EndIf}

(Or use Library.nsh)

Linards said...

This is just 0,01 % of the whole story. Biggest pain is to compile / debug excisting script.

Leads Seller said...

**SELLING SSN+DOB FULLZ**

CONTACT
Telegram > @leadsupplier
ICQ > 752822040
Email > leads.sellers1212@gmail.com

>>1$ each without DL/ID number
>>2$ each with DL
>>5$ each for premium (also included relative info)

*Will reduce price if buying in bulk
*Hope for a long term business

FORMAT OF LEADS/FULLZ/PROS

->FULL NAME
->SSN
->DATE OF BIRTH
->DRIVING LICENSE NUMBER WITH EXPIRY DATE
->COMPLETE ADDRESS
->PHONE NUMBER, EMAIL, I.P ADDRESS
->EMPLOYMENT DETAILS
->REALTIONSHIP DETAILS
->MORTGAGE INFO
->BANK ACCOUNT DETAILS

>Fresh Leads for tax returns & w-2 form filling
>Payment mode BTC, ETH, LTC, PayPal, USDT & PERFECT MONEY

''OTHER GADGETS PROVIDING''

>SSN+DOB Fullz
>CC with CVV
>Photo ID's
>Dead Fullz
>Carding Tutorials
>Hacking Tutorials
>SMTP Linux Root
>DUMPS with pins track 1 and 2
>Sock Tools
>Server I.P's
>HQ Emails with passwords

Email > leads.sellers1212@gmail.com
Telegram > @leadsupplier
ICQ > 752822040

THANK YOU

SCRUITNIZE said...

HIRE A CYBER SECURITY SPECIALIST / CRYPTANALYST

I’m Cyber Security Professional and do all kinds of related works and give 100% satisfaction and confidential to my clients

I am providing services to my valuable clients:-

* Crypto currency i.e. BTC / ETH / XRP
* Paypal Acc
* Bank Transfer
* Credit cards
* Spamming
* Carding
* Virus/Rate
* Private Root Scanner
* Private WHM Scanner

Contact details: scruitnizes@gmail.com

micheal pan said...

BE SMART AND BECOME RICH IN LESS THAN 3DAYS....It all depends on how fast 
you can be to get the new PROGRAMMED blank ATM card that is capable of
hacking into any ATM machine,anywhere in the world. I got to know about 
this BLANK ATM CARD when I was searching for job online about a month 
ago..It has really changed my life for good and now I can say I'm rich and 
I can never be poor again. The least money I get in a day with it is about 
$50,000.(fifty thousand USD) Every now and then I keeping pumping money 
into my account. Though is illegal,there is no risk of being caught 
,because it has been programmed in such a way that it is not traceable,it 
also has a technique that makes it impossible for the CCTVs to detect 
you..For details on how to get yours today, email the hackers on : (
atmmachinehackers1@gmail.com ). Tell your 
loved once too, and start to live large. That's the simple testimony of how 
my life changed for good...Love you all ...the email address again is ;
atmmachinehackers1@gmail.com

phillipsgrey said...

Here at Pot City Herbs Community , You can easily get various strains such as : Sour diesel , Lemon haze , Blue cookies , Blue Cookies Strain ,
Blue Cookies Strain Review , Platinum kush , Banana kush
Gelato #4 , Afghani strain , Wedding cake strain , Wedding crasher strain ,
Blue dream strain , Amnesia haze , purple Animal cookies strain
Gorilla glue #33, Purple punch strain, Strawnana Strain , Granddaddy purple,
Purple haze strain , Thin mints Cookies strain, Hindu Kush strain
blueberry headband strain ,Northern lights strain , White widows strain ,True OG
Silver haze strain, Big Bud Strain , Jack Herrer , American Dream , OG Kush.

BLUE COOKIES STRAIN

Wickr Me : Budboos
Email: Budboos@protonmail.com
Text/Call: +15672460706
Visit: Potcityherbs.com

NoveltyDMVExperts said...


Driving license test has always been hard for everyone to make it through but novelty DMV experts has put in place the best and easier ways for you to obtain a a drivers license of any country and Class from home without any stress with just a Click away . Fake driver license , How to get a fake drivers license that works , how to get a fake drivers license from the dmv , Fake license , FAKE DRIVER LICENSE
Buy fake driving license online , Fake drivers license , how to get a fake drivers license that works , fake driving, fake driving school, fake driving school full
fakedrivingschool .