Registry tokens for app dir?

Discuss anything related to JauntePE, the utlimate utility to help you tame non-portable applications. Share your experience about the apps that work with JauntePE, and the apps that don't.
Post Reply
Message
Author
ZergFood
Posts: 34
Joined: Wed Feb 25, 2009 7:29 am
Location: Romania

Registry tokens for app dir?

#1 Post by ZergFood »

I have a question. Say I have an app that installs with a registry key called "Install path" where it uses an absolute path. It won't run without that, it doesn't "automatically" generate from missing registry entries like most apps do, for some inexplicable reason or bad design.

Since this is found in the application's folder, how am I supposed to use reg tokens to tokenize the path? How can I turn the application's folder into a "special folder" (without causing problems with the normal usage of the application)?

NOTE: I do not ask if I can PLACE the app in a special folder. In fact this app is supposed to run from USB stick so it is NOT in a special folder. But I want to tokenize the registry key to point to the app's folder.

How can I do it? Is it possible?

crownixx
Posts: 403
Joined: Sat May 12, 2007 6:26 am

#2 Post by crownixx »

Straight answer for your question
how am I supposed to use reg tokens to tokenize the path?
Reg tokens can only tokenize the default special folder path
How can I turn the application's folder into a "special folder" (in the registry)
There are tokens discuss in readme.html > The Launch Ini. Possible tokens might be %appdrive%, %appdir%, %appbase% and %launchbase% (joby_toss had play the tokens once in here ). If this tokens is possible to be use in the registry, then you have to edit it manually using JPE Regger.

Just my opinions

Why choosing the hard way when there is an easy way. Just do the installation in Special Folder (mostly Program Files folder) and the application folder is automatically in the special folder. Then you can use JPE Tokenizer to tokenize the path automatically. This is why redllar highlight the point (readme.html > Introduction > The Tutorial > first tutorial)
redllar wrote:It's very important for portability reasons that the install-to location be set to the computer's "Program Files" directory. Almost all installers tested have this directory set as the parent directory of the default install location. If not, you need to use whatever means the installer gives you to make sure that a "Program Files" sub-directory is chosen as the install-to location.
ZergFood wrote:In fact this app is supposed to run from USB stick so it is NOT in a special folder
The real fact: this app is suppose to run/install locally but we want to run it portably. To get the high success rate of portablizing an app, the ideal strategy of portablizing is would be to "cheat" the application so that it "think" that it got the registry access, it "think" that it got the filesystem access and it even "think" that itself running in the Program Files folder. But all the application access is actually in the USB stick.

To put this short, sometimes placing the application outside the JauntePE "sandbox" but everything that it needs in the "sandbox" can cause problem when running it. The less problem is to put everything inside the JauntePE "sandbox" and let it run in the complete virtual environment. Hopefully you get the picture

ZergFood
Posts: 34
Joined: Wed Feb 25, 2009 7:29 am
Location: Romania

#3 Post by ZergFood »

Thank you for detailed answer, although I'm still pretty clueless how to proceed, but I understand I have to use %appdir%.

This is all well and good but how do I make the registry use this token? Do I need to redirect a filesystem as well?

For example, say I have the registry key:

Code: Select all

[HKEY_LOCAL_MACHINE\Software\SomeApp]
"Install Path"="xyz"
I can easily edit that with editJPE registry editor and put there (in the virtual registry):

Code: Select all

[HKEY_LOCAL_MACHINE\Software\SomeApp]
"Install Path"="%appdir%"
this is easy but will the registry tokenize this? In other words, what do I need to specify in the .ini to make it work? Do I need to redirect a filesystem as well, and if so, what do I put there? Something like this?

Code: Select all

[FilesystemExclude]
1=*
[FilesystemInclude]
1=%appdir%
[SpecialFolders]
%appdir%=.
I'm totally clueless :?: (I can't test it now, due to some "technical" difficulties... so sorry for maybe asking stupid things)


A very simple example would be very welcome. Thank you :D

crownixx
Posts: 403
Joined: Sat May 12, 2007 6:26 am

#4 Post by crownixx »

Sorry for not replying this question early as i been busy at that time. I'm replying now in case if ZergFood or anyone still interested

Question: Registry tokens for app dir?
Answer: There is no Registry tokens for app dir. Instead, put the application or files in the special folder so that you can use JauntePE Special Folder Tokens in the registry.

Reason:
Why choose complex strategy if there is an easy strategy? JauntePE automatically intercept all the special folder that the application try to access. This automation is useful for making a friendly portable maker. An example situation is let say you wish to portablize Microsoft Word and it create hundred registry keys that contain the "Install Path". It is tedious work for nsis/autoit portable launcher to change the "Install Path" value to app dir for all the keys but in JauntePE, you can leave the existing Microsoft Word "Install Path" (normally Program Files) and JauntePE can handle the path automatically for you.

ZergFood
Posts: 34
Joined: Wed Feb 25, 2009 7:29 am
Location: Romania

#5 Post by ZergFood »

Hey thanks for replying, I've been busy a lot as well. So basically, I have to do something like this?

Code: Select all

[FilesystemExclude]
1=*
[FilesystemInclude]
1=38
[SpecialFolders]
38=..  ; assuming the current dir is the program itself
And then use reg tokens for the 38 (Program Files special folder)?
That would make sense and be easier. Thanks :)

The reason I used ".." which means 1 level up is because the program isn't installed in "Program Files" but in a subfolder in "Program Files" (e.g: C:\Program Files\App1).

crownixx
Posts: 403
Joined: Sat May 12, 2007 6:26 am

#6 Post by crownixx »

Ok, you're getting close now but a bit misconception on the [SpecialFolders] section. Let's take 7-Zip as our example. Assuming we know the application very well: it puts the install path in the registry thus require us to enable both file system redirection & registry redirection as well as RegToken. Begin with:

1st Stage
This is actually the stage in our Tutorial 1. Do the portable install using JPE Quickie. Use _Normal3.ini where the RegTokens is enabled in the configuration. As a result, the special folder path in the portable registry will be automatically tokenize by JauntePE. Below is one of the key that is already tokenize which represent "Program Files\7-Zip\7-zip.dll".
Image
1st stage is enough for newbie. Everything is already taken care of by JauntePE: registry redirection, file system redirection and also the path in the registry. The program should be working normally.

2nd Stage
It is the 2nd step i guess that you want to learn, by optimizing the configuration to be more specific for better performance, and also for gaining satisfaction of portablizing an app since get our hand a bit dirty.

Keep in mind that JauntePE can also handle redirection in subfolder of the special folder. What you did above is not wrong but we can tell JauntePE to be more specified which folder it should be redirected. What i do for optimizing 7-Zip file system is below

Code: Select all

[FilesystemExclude]
1=*
[FilesystemInclude]
1=%38%\7-Zip 
Let's say 7-Zip has only have one registry keys (the same as picture above) that store the install path, then to optimize registry tokens is below. Use JPETokenizer to get the key that contain the special folder path

Code: Select all

[RegistryTokenExclude]
1=*

[RegistryTokenInclude]
1=HKEY_CLASSES_ROOT\CLSID\{23170F69-40C1-278A-1000-000100020000}\InprocServer32\@
That's it on how to handle the path in the registry key. You dont need to change the path into the current directory as what the NSIS launcher did. Just keep the path in the same special folder and JauntePE can handle it automatically.

Regarding the [SpecialFolders] section, it is related with [Filesystem]Data settings. Let say i'm using a new term, Sandbox folder. If i define it...

Code: Select all

[Filesystem]
Data=.\Sandbox
...then all 62 JauntePE special folders will be put into the Sandbox folder. Each of the special folder already have its own directory and you can read more in the documentation. As example, the directory for the portable Program Files will be "Sandbox\ProgramFiles". You can override this default directory by using [SpecialFolders] section.
So if you did...

Code: Select all

[SpecialFolders]
38=..
...it means that the portable Program Files will be up 1 level of the Sandbox folder. For me, i rarely touch this settings except for a certain case for example i override the portable My Document directory out from Sandbox folder so i can easily access it.

ZergFood
Posts: 34
Joined: Wed Feb 25, 2009 7:29 am
Location: Romania

#7 Post by ZergFood »

Yes thanks that was what I meant but I expressed wrong.
I forgot to put

Code: Select all

[Filesystem]
Data=.
in my example heh :)

I also noticed you use '@' for the default value of the key, cool, learn something even when unintentional ;)

Oh and I already knew you can use subfolders but forgot to use it LOL thanks for reminding me.

Cheers! :)

crownixx
Posts: 403
Joined: Sat May 12, 2007 6:26 am

#8 Post by crownixx »

ZergFood wrote: I also noticed you use '@' for the default value of the key, cool, learn something even when unintentional ;)
I didn't know about that too at first time. Actually, the keys are taking care via JPE Logger. Previously, i mentioned about possibility of hundreds registry keys having a special folder path. Use JPE Logger to open the portable .reg file, then all the hundreds registry keys will be put into the clipboard. All you have to do is open the configuration ini and paste :) Life is so easy

Cheers

Post Reply