You are here

[SOLVED] NSIS How PortableApps Work

15 posts / 0 new
Last post
PaperProjects
Offline
Last seen: 10 years 6 months ago
Joined: 2012-09-17 18:28
[SOLVED] NSIS How PortableApps Work

I don't think this was posted before (brief search), but I want to know how PortableApps work before I get started, and not just the really general stuff. First, I saw some other guide online, and it says that a portable launcher runs the program, and then copies all it's user data back to the PortableApps directory. I don't know if this is true, or if PortableApps virtualizes everything like ThinApp.

If the former is true, doesn't that mean that theoretically all PortableApps would require administrator rights, since Nullsoft requires administrator rights to write to the registry and to program files etc? Wouldn't that also mean that if closed incorrectly by shutting down there will be traces left on the computer? I think the question about the admin rights is the most important because that's one of the primary reasons people use portable applications is in environments without the sufficient rights. Does portableapps copy the data WHILE it's running or after it closes?

Also, how do programs run like that. If you try to run Firefox straight from some flash drive without a launcher or other dependencies then it won't run. How does the PortableApps launcher trick Firefox into thinking that it's in the Program Files and that it's registry keys are next to it without virtualizing?

Pyromaniac
Pyromaniac's picture
Offline
Last seen: 9 years 2 weeks ago
Developer
Joined: 2008-09-30 19:18
No admin rights needed

A portable app launcher will copy all settings (or creates default data if it's needed) from your Data folder into the appropriate place for the app to read and modify. Then it waits until the app closes, then it copies all the settings (files, folders and registry values) back into the Data folder and removes traces from the computer the portable app ran on. Some apps are a little more complicated in how they handle settings, but this is generally how it goes.

The only portable apps that require administrative rights are those that require it in the non-portable version as well (such as SmartDefrag or other administrator tools) that write to the registry or need special permissions, etc.

Also, have you tried running Firefox (not the portable version) from your flash drive? It works fine, just not portably.

PaperProjects
Offline
Last seen: 10 years 6 months ago
Joined: 2012-09-17 18:28
Re: No admin rights needed

Therefore, it would be impossible to create PortableApps out of applications that won't run without registry and local dependencies. So what PortableApps does is copy the dependencies to the Program files and registry, then copy them back to the Data folder. Wouldn't that require that the C:\ disk have enough space for the dependencies and that you have administrator rights to write to the registry and Program Files?

-PaperProjects Professional

Aluísio A. S. G.
Offline
Last seen: 7 years 9 months ago
DeveloperTranslator
Joined: 2010-11-09 17:43
Only data; user hive

We don't move the whole app, just the user's data, and then only when there's no way to change the path where the app looks for these data.
As for the Registry, we usually don't need to write to the machine hive, just to the user hive.

Previously known as kAlug.

Pyromaniac
Pyromaniac's picture
Offline
Last seen: 9 years 2 weeks ago
Developer
Joined: 2008-09-30 19:18
I mistyped

I meant to say "that write to the HKLM registry". HKCU/HKU/HKCR are all handle-able without admin rights.

John T. Haller
John T. Haller's picture
Online
Last seen: 36 min 57 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Settings

We don't copy dependencies. Only settings. And only when an app has no other method of redirecting them to the drive (like a command line switch or environment variable). As all apps that are unable to be redirecting and have to use the registry keep their settings within HKCU, it's not an issue. The only apps we allow to require admin rights are the ones that require them to function (generally system utilities like registry cleaners, defragmenters, etc). PA.c Format apps are not permitted to write to the Program Files or Windows directories, even temporarily.

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

tapsklaps
Offline
Last seen: 5 years 6 months ago
Developer
Joined: 2010-10-17 08:11
conflicting response

John T. Haller wrote:

PA.c Format apps are not permitted to write to the Program Files or Windows directories, even temporarily.

Curiously, you have denied the temporary writing of data to the Windows folder in my post with the subject Paste of *.dll files in the system folder system32 of the Windows OS. Because with my proposed code

[FilesMove]
xyz.dll=C:\Windows\system32

will only temporarily written data in the Windows folder C: \ WINDOWS \ system32.

So your answer is clearly contradictory.

John T. Haller
John T. Haller's picture
Online
Last seen: 36 min 57 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Not Allowed

I said both there and here that writing in Windows is not permitted.

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

tapsklaps
Offline
Last seen: 5 years 6 months ago
Developer
Joined: 2010-10-17 08:11
mistranslation

Obviously I have misunderstand the meaning of "even temporarily". Apology!

PaperProjects
Offline
Last seen: 10 years 6 months ago
Joined: 2012-09-17 18:28
Re: Settings

I think I get it now. HKLM can be written to the HKU, and if a program cannot already run off of a flash drive non portably, then it won't work as a PortableApp. Not that it's legal, but as an easy example, Microsoft Office requires multiple dependencies and therefore is impossible to run as a portableapp because you can't simply run it off a flash drive. Thanks for your help everyone! Correct me I'm wrong.

-PaperProjects Professional

John T. Haller
John T. Haller's picture
Online
Last seen: 36 min 57 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Other Reason

Microsoft Office is technically and legally locked to a specific PC using DRM, which is also why you can't run it off a flash drive.

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

PaperProjects
Offline
Last seen: 10 years 6 months ago
Joined: 2012-09-17 18:28
Re: Other Reason

Sorry, bad example. I'll be seeing what you mean by environment variables today and taking Chrome (non portable) from my Program Files to a different computer and seeing if it works there.

-PaperProjects Professional

John T. Haller
John T. Haller's picture
Online
Last seen: 36 min 57 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
It Won't

Chrome (non-portable) stores all its settings in APPDATA. If you move your Chrome directory from one PC to another, it's just like running it fresh on that second PC without any of your settings.

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

PaperProjects
Offline
Last seen: 10 years 6 months ago
Joined: 2012-09-17 18:28
Re: It Won't

I know, I just tested it today. If you say that PortableApps (PA) copies settings to the correct directories, then copies it back, how come running Firefox Portable on a computer that has Firefox installed won't mess up any Profiles, appdata, etc. My other guide talked about "unsafe" PAs messing up the installed software.

Also, you know about those applications that will automatically create a folder in "My Documents"? When it's a PA, how would you change it so it doesn't create it's folder in Documents, but rather in the Data folder without having to close the PA down and have it copy.

Wouldn't you also be able to see a new folder in the Appdata when running a PortableApp (running Firefox Portable will result in a new AppData folder called "Mozilla"?)? Or does PortableApps move the AppData folder in realtime so there isn't a chance to see the new AppData folder. I found an example of a "Minecraft Portable" batch file (this is not actually Minecraft and affiliated with Minecraft).

|||||||||||||||||||||||||||||||||
SET APPDATA=%CD%\AppData
Start "Minecraft" Minecraft.exe
|||||||||||||||||||||||||||||||||

I think what it's saying is that it's moving the Minecraft AppData in real time to a portable "AppData" location next to Minecraft.exe (Correct me if I'm wrong...). Do PAs kinda work like that?

*I not sure if this kind of batch file will work with more complicated programs like chrome, or firefox.

-PaperProjects Professional

John T. Haller
John T. Haller's picture
Online
Last seen: 36 min 57 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Multiple Methods

We use multiple methods and are way beyond batch files. We use the PA.c Launcher which is documented here: https://portableapps.com/manuals/PortableApps.comLauncher/

As mentioned, we use environment variables and command line options where available. Firefox, we use the -profile switch to direct it to a profile on the portable device (instead of using the local one). But Firefox also makes registry entries and leaves some blank directories behind, so we clean those up when Firefox exits. In addition, the paths for settings get messed up as you move Firefox from one PC to another, so we adjust the paths within prefs.js automatically. On top of all that, Firefox's extensions management system needs to have paths updated in a SQLite database, so we have our launcher do that, too.

We don't permit any apps on PortableApps.com that are unsafe nor do we permit apps whose settings aren't portable, who leave bits behind on the local machine, or who interfere with local apps. We're the only portable software site that has a full set of rules and guidelines ( https://portableapps.com/about/what_is_a_portable_app ) and sticks to them, only offering real, truly portable software.

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

Log in or register to post comments