You are here

NSIS Portable Help Needed

33 posts / 0 new
Last post
ZachHudock
ZachHudock's picture
Offline
Last seen: 1 year 2 months ago
Developer
Joined: 2006-12-06 18:07
NSIS Portable Help Needed

Edit3: Installer works correctly, the launcher issue was fixed, and a development test 3 was posted here.

Edit2: Installer works correctly, and a development test 2 was posted here.

Edit: Launcher code removed, I think it works correctly now, and a development test was posted here.

BuddhaChu
BuddhaChu's picture
Offline
Last seen: 7 years 5 months ago
Joined: 2006-11-18 10:26
Have you looked at the other NSISPortable

Have you looked at the NSIS Portable that's already available on Smithtech's site since it doesn't need admin rights (AFAIK) and then make a more current version of that? (no need to reinvent the wheel). It doesn't backup keys in HKLM. Besides, the keys you're worried about are for the file associations which don't matter since you can drag/drop onto the NSIS GUI to compile or use the "Open" dialog.

Smithtech's version only backs up the following reg keys (and their subkeys):

[HKEY_CURRENT_USER\Software\NSIS]
[HKEY_CURRENT_USER\Software\NSIS\MRU]
[HKEY_CURRENT_USER\Software\NSIS\Symbols]

It seems the users setting were moved from HKLM to HKCU is version 2.24 and newer of NSIS. what version are you trying to make portable?

Read about that in this thread.

Cancer Survivors -- Remember the fight, celebrate the victory!
Help control the rugrat population -- have yourself spayed or neutered!

Patrick Patience
Offline
Last seen: 4 years 3 months ago
DeveloperModerator
Joined: 2007-02-20 19:26
If There Is

If there is admin rights, he wants to delete the keys, which is the proper thing to do. The reason he's reinventing is because there's are new registry techniques John implemented in 7-Zip Portable that are faster and have better crash handling.

ZachHudock
ZachHudock's picture
Offline
Last seen: 1 year 2 months ago
Developer
Joined: 2006-12-06 18:07
I have the newest version,

I have the newest version, 2.34, and on install it creates the keys in both HKLM and HKCU.

It creates the settings keys in both locations, which is why i need the code to handle both. The file associations aren't a big deal, but since settings are kept in both locations, it would be best to clean them ALL if it can be done.

The developer formerly known as ZGitRDun8705

BuddhaChu
BuddhaChu's picture
Offline
Last seen: 7 years 5 months ago
Joined: 2006-11-18 10:26
I agree on cleaning up all

I agree on cleaning up all registry keys created, but do all of them NEED to be created for the app to function? I say "no" since I installed the latest version of NSIS over the top of the one in Smithtech's version and it ran fine (only using HKCU keys).

Point being why not try just creating the HKCU keys and see if the app works (I already tested it and it does). The launcher on closing could then save the HKCU settings to \Data\settings and delete the HKLM keys (if the user has admin rights and they get created). HKLM keys are used for "All users" settings in my experience which aren't needed in this case.

Cancer Survivors -- Remember the fight, celebrate the victory!
Help control the rugrat population -- have yourself spayed or neutered!

Patrick Patience
Offline
Last seen: 4 years 3 months ago
DeveloperModerator
Joined: 2007-02-20 19:26
But

What is the HKLM keys are created by the application as soon as it's run? I'm not sure if it is, but if the app does create them then we'll have to try to clean them up.

BuddhaChu
BuddhaChu's picture
Offline
Last seen: 7 years 5 months ago
Joined: 2006-11-18 10:26
yeah

I said that.

The launcher on closing could then save the HKCU settings to \Data\settings and delete the HKLM keys (if the user has admin rights and they get created).

Cancer Survivors -- Remember the fight, celebrate the victory!
Help control the rugrat population -- have yourself spayed or neutered!

Patrick Patience
Offline
Last seen: 4 years 3 months ago
DeveloperModerator
Joined: 2007-02-20 19:26
Oh Sorry

I misunderstood.

SmithTech
SmithTech's picture
Offline
Last seen: 1 year 11 months ago
Developer
Joined: 2006-11-24 18:06
Examples

I don't know about the user rights code, I haven't needed to use it yet.
I'm still learning myself.

As for the reg keys, you can define them as a "||" delimited string and then loop through them to do what you need to.

!define REGKEYS "HKLM\SOFTWARE\Classes\.nsh||\
HKLM\SOFTWARE\Classes\.nsi||\
HKLM\SOFTWARE\Classes\NSIS.Header||\
HKLM\SOFTWARE\Classes\NSIS.Script||"

The loop code can be found in my Template, as well as the Portable Application Template in the forums.
My template is much less complicated as it doesn't encompass as much so you may want to start with it first.

"Because they stand on a wall and say, 'Nothing is going to hurt you tonight. Not on my watch.'" (A Few Good Men)
Coincidence is God's way of remaining anonymous.(Albert Einstein)

rab040ma
Offline
Last seen: 4 months 3 weeks ago
Joined: 2007-08-27 13:35
makensisw.exe

All I ever use is makensisw.exe. It looks like it doesn't do much in HKLM and barely anything in CU. Would it make sense to consider just that?

If the portablized version handles parameters, you could put it in SendTo and have it compile scripts pretty easily ... or perhaps have it set up as a "run" add-on for Notepad++.

I didn't look at the CL version; maybe it does even less with the registry.

MC

ZachHudock
ZachHudock's picture
Offline
Last seen: 1 year 2 months ago
Developer
Joined: 2006-12-06 18:07
I was gonna make a full

I was gonna make a full package at first, then later make a package just using makensisw.exe. I figured with the full package, new users that want to take a crack at developing could have examples and documentation available.

The developer formerly known as ZGitRDun8705

John T. Haller
John T. Haller's picture
Offline
Last seen: 7 hours 32 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
I have one

Oddly, I have an 85% finished NSIS Portable as well. I can post it and someone else can finish/maintain it if they'd like.

Sometimes, the impossible can become possible, if you're awesome!

ZachHudock
ZachHudock's picture
Offline
Last seen: 1 year 2 months ago
Developer
Joined: 2006-12-06 18:07
I'll take a look at

I'll take a look at it....i'll try to merge our work together and after i get the registry stuff fully sorted, upload a dev test package.

The developer formerly known as ZGitRDun8705

wraithdu
Offline
Last seen: 10 years 9 months ago
Developer
Joined: 2007-06-27 20:22
Thought I'd throw my 2c in

Thought I'd throw my 2c in here. NSIS, for as long as I've been using it, has not touched HKLM unless it is installed. Simply running the app only modifies HKCU.

I've got a launcher as well using Klonk's PAT.

ZachHudock
ZachHudock's picture
Offline
Last seen: 1 year 2 months ago
Developer
Joined: 2006-12-06 18:07
That could be the case.

That could be the case. I'll double check everything tonight and try to finish up this package.

The developer formerly known as ZGitRDun8705

NTPro
Offline
Last seen: 15 years 2 months ago
Joined: 2008-02-22 13:45
any news on this package as

any news on this package as I'm really interested..

ZachHudock
ZachHudock's picture
Offline
Last seen: 1 year 2 months ago
Developer
Joined: 2006-12-06 18:07
I'm still waiting for John

I'm still waiting for John to send me his package so I can compare/merge code.

The developer formerly known as ZGitRDun8705

NTPro
Offline
Last seen: 15 years 2 months ago
Joined: 2008-02-22 13:45
wow, thanks for the fast

wow, thanks for the fast reply
hope you get it soon
will keep on checking here then.

ZachHudock
ZachHudock's picture
Offline
Last seen: 1 year 2 months ago
Developer
Joined: 2006-12-06 18:07
The HKLM stuff I was

The HKLM stuff I was discussing before does not need to be handled, those keys are only created by the NSIS installer, so are not needed in this case.

I have a new issue though, see the updated main post for details.

The developer formerly known as ZGitRDun8705

wraithdu
Offline
Last seen: 10 years 9 months ago
Developer
Joined: 2007-06-27 20:22
Command = FindFirst

If you're sure there's only going to be one REG file in that directory, it's pretty easy.

FindFirst $0 $1 "$INSTDIR\Data\settings\*.reg"
FindClose $0

4.9.5.9 FindFirst

user_var(handle output) user_var(filename output) filespec

Performs a search for 'filespec', placing the first file found in filename_output (a user variable). It also puts the handle of the search into handle_output (also a user variable). If no files are found, both outputs are set to empty, and the error flag is set. Best used with FindNext and FindClose. Note that the filename output is without path.
ZachHudock
ZachHudock's picture
Offline
Last seen: 1 year 2 months ago
Developer
Joined: 2006-12-06 18:07
THANK YOU!

Thanks, that worked great after I actually read how the function works.

I haven't had a chance to test SmithTech's on multiple PCs to see if there are multiple settings files created, I'm hoping it's only 1 though. If anyone else wants to test his and report your results, I can try to incorporate that into my launcher so settings stay saved.

The developer formerly known as ZGitRDun8705

wraithdu
Offline
Last seen: 10 years 9 months ago
Developer
Joined: 2007-06-27 20:22
If there is more than one

If there is more than one REG file created, you can use the FindNext command and it will find the next file. It will return an empty string when no more files are found.

This is interesting for you though, cause you'll have to merge the files Wink So I hope this is not the case. An idea if that arises though, would be to import all the individual files into the registry, then export them into your own single file. The possible registry keys should be known from SmithTech's launcher source, so it shouldn't be too much trouble. Just be sure to clear out then restore any existing reg keys before running that procedure though.

ZachHudock
ZachHudock's picture
Offline
Last seen: 1 year 2 months ago
Developer
Joined: 2006-12-06 18:07
That's a good idea if there

That's a good idea if there are multiple files, i'll have to keep that in mind depending on what I figure out about those files. It'll make for one hell of a messy PRE-INSTALL CODE section though.

The developer formerly known as ZGitRDun8705

wraithdu
Offline
Last seen: 10 years 9 months ago
Developer
Joined: 2007-06-27 20:22
Another idea

One more idea that may solve both situations is to have the installer launch SmithTech's program (if it is detected), thus importing the reg settings. Then export what you want and kill (or have the user manually close) SmithTech's program (by closing/killing NSIS). Then you can just wipe out his whole directory and install clean.

You should be able to detect SmithTech's launcher by pulling some kind of version info from the launcher EXE using the MoreInfo plugin (included with NSIS) -

http://nsis.sourceforge.net/MoreInfo_plug-in

ZachHudock
ZachHudock's picture
Offline
Last seen: 1 year 2 months ago
Developer
Joined: 2006-12-06 18:07
That seems a bit more

That seems a bit more complicated than moving and renaming a file lol.

The developer formerly known as ZGitRDun8705

wraithdu
Offline
Last seen: 10 years 9 months ago
Developer
Joined: 2007-06-27 20:22
Agreed, but if you have to

Agreed, but if you have to deal with several REG files, it may be easier. Ehh, just an idea Smile

Simeon
Simeon's picture
Offline
Last seen: 9 years 5 months ago
DeveloperTranslator
Joined: 2006-09-25 15:15
Smithtechs NSIS

has only one reg file.
But switching from his version to the new one causes leftovers in the registry Sad

"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate

ZachHudock
ZachHudock's picture
Offline
Last seen: 1 year 2 months ago
Developer
Joined: 2006-12-06 18:07
It shouldn't with Dev Test

It shouldn't with Dev Test 2, I set it up to properly handle the previous reg settings....maybe there's some file's i missed in the app dir, but the registry should be handled correctly now.

The developer formerly known as ZGitRDun8705

Simeon
Simeon's picture
Offline
Last seen: 9 years 5 months ago
DeveloperTranslator
Joined: 2006-09-25 15:15
Sorry

It does.
Even with DevTest2.
I run a fresh copy of Smithtechs version, installed yours over it and run yours.

"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate

ZachHudock
ZachHudock's picture
Offline
Last seen: 1 year 2 months ago
Developer
Joined: 2006-12-06 18:07
Post over in my Dev Test 2

Post over in my Dev Test 2 page....what does it leave behind?

The developer formerly known as ZGitRDun8705

Simeon
Simeon's picture
Offline
Last seen: 9 years 5 months ago
DeveloperTranslator
Joined: 2006-09-25 15:15
ill do that

its weird as I thought I would be clean but then it wasent and then it was and now it isn't any more.

"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate

Simeon
Simeon's picture
Offline
Last seen: 9 years 5 months ago
DeveloperTranslator
Joined: 2006-09-25 15:15
I'd use

this

		ExecWait $EXECSTRING
		
	CheckRunning:
		Sleep 1000
		FindProcDLL::FindProc "${DEFAULTEXE}"                  
		StrCmp $R0 "1" CheckRunning

	CheckRunningMakensisw:
		Sleep 1000
		FindProcDLL::FindProc "makensisw.exe"                  
		StrCmp $R0 "1" CheckRunning
		
	CheckRunningzip2exe:
		Sleep 1000
		FindProcDLL::FindProc "zip2exe.exe"                  
		StrCmp $R0 "1" CheckRunning
		
	CheckRunningMakensis:
		Sleep 1000
		FindProcDLL::FindProc "makensis.exe"                  
		StrCmp $R0 "1" CheckRunning
;=== Put the settings file back
	Sleep 500
	CLean-Registry-Code
	Goto TheEnd

but I dont know the other method. So maybe the other one is better but the one I have is the one John uses in Sumatra Smile

"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate

NTPro
Offline
Last seen: 15 years 2 months ago
Joined: 2008-02-22 13:45
oh man, great work! don't

oh man, great work!
don't check for a few days and devtest 3 is up and running Smile
gonna give it a shot

Log in or register to post comments