You are here

[Obsolete] Portable Application Template 2.3 released

157 posts / 0 new
Last post
Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
[Obsolete] Portable Application Template 2.3 released

Do not use this. Use the PortableApps.com Launcher instead.

Discussion has moved here:
https://portableapps.com/node/10491

What ist it for?
It helps you to create a clean portable application. This means no traces are left on the host computer and the application doesn't (normally) have to be changed in any way. (Maybe some configuration files)

Where can I get it?
http://www.loncarek.de/downloads/ApplicationPortableTemplate.nsi
use "Save As..." in your browser.
The license and more information could be found at the end of the source.

What to do to make an application portable?
1. You install the application you want to make portable on your computer.
2. You monitor which files, folders, and registry keys are generated. (There are several helper apps for that task).
3. You insert the monitored information into the constants at the beginning.
4. Then create a correct directory structure and compile the script with NSIS. Create an launcher icon.
5. Copy your application to the appropriate APP folder and also the launcher.
6. Run the launcher.
That's it...
It might happen that some applications need some additional handling, but that should be left to intermediate/advanced users as some routines would have to be added.

How does it work?
Existing Application files and folders are renamed. Registry keys saved. Then the files/folders/registry keys of the portable application are applied. Finally the Application is launched.
When the application is closed all files/folders/registry keys are saved within the data directory of the portable application and all original files/folders/registry keys are restored.
One special thing (since version 1.6): The users profile folder is redirected to the portable data directory

Which application can I make portable?
Almost every application as far it does not implement itself too deep in the system. Also some commercial applications could get portable. But then respect the license or offer only the source to others.

What license?
The license is a 2-clause BSD-style license. (see source for details)

What is needed?
In order to compile this script with NSIS you need the following Plugins:
- NewAdvSplash
- Registry
- FindProc
- Dialogs
Last tested with NSIS 2.28

History (since version 1.4):
Discussion/History until version 1.4:
https://portableapps.com/node/2022
1.5
- complete rewrite for intermediate users to understand easier what is going on, as discussed here: https://portableapps.com/node/6229
- integrated readme into source
- files/folders are now renamed -> should improve starting time a lot.
- error handling when backup files/folders exist
1.6
- compile flags added to decrease final launcher filesize
- users profile directory is now redirected to the portable data directory
- added check for non-existant data folders -> automatic creation
1.7
- added automatic creation of missing data directories
- automatic user profile redirection could now be also disabled
1.8
- added optional admin rights checking
- optimized compilation (when some constants are left empty and not commented out.
- minor bugfix
1.9
- when no directories are found a default directory structure is created
- when no EXE is found you are asked to select a folder from which to copy the files
- added possibility to integrate the sources if you want to distribute only the exe, e.g. when creating commercial/shareware applications launchers -> launcher is an installer at the same time
- added switch for INI file to disable the above automatic extraction
- some code optimizations
2.0
- registry keys are now stored in one single file even with multiple registry keys (not compatible to previous versions)
- Overrides setting of REGKEYS if USEREGKEYSFILE is "TRUE" and reads registry keys to process from file "Registry.reg"
- Added "Registry.reg" to source installation
- Added default command line parameters
- removed one possible directroy structure (which did not make sense)
- added GTK and JAVA (or better JRE) support, adjustable via INI
- automatic detection of a "CommonFiles" directory.
2.1
- bug fixes
- possibility to deltet registry keys before applying own (saved) ones
- added RequestExecutionLevel for better VISTA compatibility
2.2
- fixed newadvsplash DLL being left in the temp directory (forgot cleanup)
- changed way of restoring the registry keys (now uses "regedit /s")
- removed sleeps again (commented them out, just in case...)
- removed /D=2 switch when saving registry keys
2.3
- added a lot of "" around the variables, this should fix errors with empty variables
- cleared errors before any registry stuff
- added popup messages when something goes wrong when saving registry keys

Any comments/bug reports are welcome.

someoneabc
Offline
Last seen: 15 years 3 months ago
Joined: 2007-04-05 12:34
Yea!!

Yea, great!! - Thanks for these wonderful Application Templates, I have created several launchers and will go update them. Thanks again!!

Deuce
Offline
Last seen: 14 years 1 month ago
Developer
Joined: 2005-12-24 16:32
Klonk...

you might want to check out this comment from john: here, before you make the USERPROFILE redirection a permanent part of your template.

I had used it in Reg Rapper, but stopped because of this conversation.

Hoep this helps.

Deuce
Portable Software: Just the beginning.

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Thanks

for that information. I didn't know that. I have an idea to solve that:
What about simply saving the original USERPROFILE in a variable. Change it and then in the end restore the original setting???
This should fix the problem shouldn't it?

Simeon
Simeon's picture
Offline
Last seen: 10 years 1 month ago
DeveloperTranslator
Joined: 2006-09-25 15:15
Maybe

But what about the programs you run while your "portable" USERPROFILE variable is active. Other programs wouldn't know about your changes and things still would get messed up.

"There is a computer disease that anybody who works with computers knows about. It's a very serious disease and it interferes completely with the work. The trouble with computers is that you 'play' with them!" - Richard Feynman

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

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
With my own test

with win2K and WinXP this never happened as the environment variable was only changed for the application run by the launcher. During run of the applicaton I opened CMD and did SET. And everything shown was fine.

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Seems like I haven't read the

thread enough.
It is true that when the first launched application starts another one the UserProfile is changed also for this second started application. Maybe I should make this switchable and add an comment on this topic.

rgann
Offline
Last seen: 17 years 6 months ago
Joined: 2007-04-28 14:26
Bug or my configuration error?

I am new to both this topic and to NSIS, so I may be doing thngs incorrectly.

I have an old game (rummy500) that creates rummy500.ini in $WINIR.

The problem I am having, is that when rummy500portable.exe is executed, the program runs normally (creating $windir\rummy500.ini), but when I exit rummy500, the rummy500.ini file is deleted from $windir (as I would
expect), but it is not saved on the removeable media.

I have setup the default directory structure as described in "Portable Application Template v1.6.nsi".

This is my "configuration" section: [Line wraps marked » - RM]

; ##########################################################################
; # Change the following constants depending on the application you want to make
» portable
; ##########################################################################
!define AUTHOR "" ; your name
!define APP "Rummy500" ; insert application name, e.g. "TestApp"
!define VER "0.0.0.0" ; insert version of launcher
!define EXE "Rummy500.exe" ; insert program exe name, e.g. "testapp.exe"
!define PNAME "${App}Portable" ; format of portable name (dirs and filenames)
;!define ICON "${PNAME}.ico" ; comment this line out when default icon should be
» used
;!define SPLASHIMAGE "${PNAME}.jpg" ; comment this line out when no splashscreen
» image should be used
;!define REGKEYS "" ; insert regkeys to use separated by "||", comment out, when
» not used, e.g. HKCU\Software
!define SETTINGSFILES "$WINDIR\Rummy500.ini" ; insert settings files to use
» separated by "||" as stored on the host computer, e.g. "$WINDIR\TEST.INI",
» comment out, when not used
!define SETTINGSDIRS "" ; insert settings directories to use separated by "||" as
» stored on the host computer, e.g. "$PROFILE\TEST", comment out, when not used
!define INI "${PNAME}.ini" ; could be changed when settings for multiple
» applications should be stored in one INI file

More info:
If $WINIR\rummy500.ini exists when rummy500portable.exe is started, a back-up is created
($WINIR\Rummy500.ini-PortBak), and then restored to $WINIR\Rummy500.ini when the program is terminated. This is normal (a far as I can understand the script). But still,
no copy of rummy500.ini is saved.
BTW, I am using NSISPortable v2.25.

So, the question is, is it a bug or my configuration error?

Any help will be appreciated!

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Your configuration is fine

This file is not saved as rummy500.ini but as File1.dat in the settings subdirectory. Is your thumbdrive write enabled? Otherwise it won't work.
What Windows are you running?

rgann
Offline
Last seen: 17 years 6 months ago
Joined: 2007-04-28 14:26
re: Bug or my configuration error?

Hi Klonk,

I have been experimenting with this script by running it from a second
internal hard drive (D:), so there is no write protect issue. This OS is
win98se.

After reading your post, I reset the directory structure (before runnning
rummy500Portable) to:

+-\ Portable.exe (and rummy500.nsi)
  +-\App\
  | +-\Rummy500\ 

After starting rummy500, (and while it is still running), the following is true:
  1. rummy500.ini has been created in $WINDIR
  2. the "removable" media directory structure has had added to it, the sub-
     directories "Data\UserProfile". There is as yet no File1.dat anywhere.
     The "Settings" folder is empty.So now the directories look like this:
     +-\ Portable.exe
       +-\App\
       | +-\Rummy500\ 

After terminating rummy500, rummy500.ini has been removed from $WINDIR, and
File1.dat (or anything else) has NOT been added to Rummy500Portable or any of
its subdirectories.

If it helps you verify the problem, I created a "portable" solitary (the 
standard sol.exe that came with windows98). I used the same directory
structure, and just changed "rummy500" to "sol" in the .nsi configuration
file (in my last post). Sol.exe has the same run characteristics as
rummy500 (.ie it creates "app".ini in $WINDIR).

Before running SolPortable.exe, I removed sol.exe and sol.ini from $WINDIR
so that there would not be any ambiguities.

It (SolPortable.exe) has 'exactly' the same behavior as does rummy500Portable.
It removes the created $WINDIR\sol.ini, but again, it fails to save any-
thing in the "SolPortable" directory structure, although it does create
the empty directories "Data\UserProfile'.

Is there anything I can do to help debug the problem? Do you have any
other questions? Just ask.:puzzled:
Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Please

create a directory \Data\Settings\ in your directory with portable.exe and try again.
(This is the directory where the File1.dat should go).

BTW: I uploaded a new version 1.7 which has the creation of the data structure integrated, i.e. it also creates the \Data\Settings directory if it does not exist yet.

rgann
Offline
Last seen: 17 years 6 months ago
Joined: 2007-04-28 14:26
re: Bug or my configuration error?

Hi Klonk,

You squashed that bug!:smile:
I downloaded v1.61 and went thought the entire test sequences again and
I am happy to report the all is well (well at least with the .ini parts)

I will now try to do some serious portability conversions. They will test more functions of the script.

Thanks for the quick response & fix.

Darn, I see you have already released v1.7, I'll download and do my tests with it.

sbabinea
Offline
Last seen: 17 years 6 months ago
Joined: 2007-05-01 08:55
Check for Local Administrator Access

Added a check for local admin access. This should work..

Constants Section

!define ADMINREQUIRED "1" ; Set to 1 if administrator access is required to run this program. Comment out if not.

Main section (right after Section "Main")

Call CheckAdmin ; Check if Admin rights are required

New Function (put anywhere - right after the Main section is good)

; **************************************************************************
; *  Function: Check if local admin rights are required
; **************************************************************************
Function CheckAdmin
  !ifdef ADMINREQUIRED
    StrCmp ADMINREQUIRED "1" 0 DoneAdmin
    userInfo::getAccountType
    pop $0
    StrCmp $0 "Admin" DoneAdmin
    messageBox MB_OK|MB_ICONEXCLAMATION "You must be logged in as a local administrator!"
    Abort
    DoneAdmin:
  !endif
FunctionEnd

This is mostly from http://nsis.sourceforge.net/Simple_tutorials

-Steve.

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Nice idea, thanks

This will definitely help for those applications which require administartor access. But on the other hand, shouldn't a portable application work also without administrator access??

I haven't checked yet, but I could imagine that writing to some specific registry keys is only possible with administrator rights. Does anyone know for sure??

sbabinea
Offline
Last seen: 17 years 6 months ago
Joined: 2007-05-01 08:55
Yes, certainly.

A truly "portable app" should not require admin access, but there are plenty of software packages out there there were not designed to be portable and do not follow the "rules" of a portable application.

The problem I had (have) is that a particular application required access to the HKLM (HKEY_LOCAL_MACHINE) registry key, which is unwritable by anyone besides a local administrator.

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Added to version 1.8

but implemented a little bit different (checking for value is done differently)

sbabinea
Offline
Last seen: 17 years 6 months ago
Joined: 2007-05-01 08:55
Strengthened "Registry Management" Functionality

Klonk:

In attempting to get my non-portable application working from a USB stick, I added some registry management functionality to your template. It's nearly complete but still has a few problems.

In addition to the registry keys being managed by the REGKEYS constant, which requires you to list the registry keys, I added a REGFILES constant. By using this constant to list the external registry files, the template now contains the ability to manage more registry keys than is allowed by the 1024 character limit in String variables.

Also, this gives the template the ability to replace keywords in the registry files that would be parsed out at runtime, letting the user insert path-specific variables into the registry as required.

For example, in my external registry file I might have

[HKEY_CURRENT_USER\Software\Mindjet\MindManager\6\MyMaps\Folders]
"My Maps"="%USERDATAPATH%\\My Maps\\"

At runtime, the wrapper will replace %USERDATAPATH% with $DATADIR\UserProfile, put the result in RegKey#.reg file, then let the existing template functionality to import those keys as normal.

The variables that the template is currently replacing are:

%DESTPATH% = "$EXEDIR\App\${APP}"
%DATAPATH% = "$DATADIR"
%USERDATAPATH% = "$DATADIR\UserProfile"

I also added the CheckAdmin function from above, which seems to work for me.

I tried not to break existing functionality in the template, but it is not certain that I have succeeded in that.

There are a few outstanding issues with my changes, but one in particular is giving me trouble.

The Registry file parsing works correctly, but in order to maintain a list of keys to add/remove when the installer starts/exits, the script builds a list of "base" registry keys. That part doesn't seem to be completing when there is more than one registry file to parse. I'm not sure why.

The application that I am using to test my modifications requires about 1000 registry keys, 70% are in the HKLM tree. This is probably considered a "large" application for this type of script, but I would still like to see it work.

Anyway, are you interested in these modifications?

-Steve.

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Sounds good,

I'm definitely interested to add such functionality as addition. I was not aware of the limit of 1024 characters which might be filled quite soon (especially with registry keys) but this might be also interesting for configuration files and also directories. I would look over it and try to implement it in an transparent manner.

Just a question: Which application writes 1000 registry keys???
BTW: I released version 1.8 which integrates the admin checking

sbabinea
Offline
Last seen: 17 years 6 months ago
Joined: 2007-05-01 08:55
Email address?

How should I get it to you?

After installing MindJet MindManager, the registry difference was over 2200 keys added! After taking out everything but the "parent" keys, it still comes in to just over 550 keys.

-Steve.

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Wow

please send it to dh2mll [at] web [dot] de
Thanks.
I made some own thoughts and have some ideas about regfiles.

I also have some other stuff in plan which I thought would be handy in distributing launchers for shareware/commercial applications.

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Thanks for your email

I'll check it out and see what makes sense to integrate into the template in my eyes. Maybe I integrate some stuff with version 2.0...

BTW: I released 1.9.

@sbabinea: The new changes won't help you much currently thus there is no need to update for you.

sbabinea
Offline
Last seen: 17 years 6 months ago
Joined: 2007-05-01 08:55
Do you want me to merge the changes?

Do you want me to integrate my changes into version 1.9 of your template? It might save you some time but you will have to slow down with the releases Wink

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
As you like, but it's not really necessary

Now this template includes everything I really wanted.

Your changed are a lot of stuff and I'll see whether I'll implement it or not. Because your changes are very special and I'm not sure whether they are widely needed. Maybe I can find a different way of storing multiple regkeys/files/folders.

The only thing that might happen to this version: some minor bugfixes.

Just one question: in your version of the template you are registering DLLs before launching the application. Why?

wtrabbit
Offline
Last seen: 17 years 6 months ago
Joined: 2007-05-05 18:58
sbabinea's Strengthened "Registry Management" Functionality

@sbabinea: Your modifications of the template are very interesting. I have been having problems creating certain portableapps due to the 1024 char String variable limit.

Is there any chance that I can get a copy of your modified template? It appears that this functionality will be implemented (in one form or another) into ver 2.0, but I would really appreciate the opportunity to study your modified code in order to better my skills. From what I understand after reading your posting, the process of defining registry keys could be done in the standard way (with the 1024 limit) or by defining an external registry file (I would just export the registry changes via Total Uninstall [.reg file]) and simple set that .reg file as the external registry defined in the constants. Correct?

Anyway, please consider letting me have a copy of your template. Thanks.

@Klonk: Just wanted to say thanks for taking the time to create such an excellent NSIS script. You have opened the world of PortableApps to myself and others. You rock!

-wtrabbit

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Thanks wtrabbit,

please do not expect a version 2.0 too soon. I worked almost every day recently on the actual version.

As sbabinea showed it is possible to save/restore mutliple registry keys. One thing should be clear! Copying/saving that much registry keys could take some time!!! There should then be some kind of warning/message IMHO.

sbabinea
Offline
Last seen: 17 years 6 months ago
Joined: 2007-05-01 08:55
Sure thing!

I merged my changes with Klonk's version 1.9.1 and posted it here: http://thebabineaus.com/software/PAT/PAT_sab.nsi

I still haven't gotten my application to work with it yet so there may be more changes Sad

Namely:
- Add support for multiple reg files. Originally I had support, but I took it out so that I could package my reg files using the new INSTALLSOURCES option.
- separate the DLLs to their own constants (have REGDLL1, REGDLL2, REGDLL3 constants instead of 1 REGISTERDLLS constant. This will let me use InstallLib)
- Add support for adding/removing hidden registry keys

If you end up using my version, please do not bother Klonk with problems.. Post a new thread and ask me Smile

-Steve.

chezduong
Offline
Last seen: 5 months 3 weeks ago
Joined: 2006-12-06 04:01
Q and Roadmap

Hi Klonk,

What exactly does this mean?
- added possibility to integrate the sources if you want to distribute only the exe, e.g. when creating commercial/shareware applications launchers -> launcher is an installer at the same time

Also, do you have a roadmap of what other options/improvements/evolutions you have for future versions of PAT?

Thank you and keep up the GREAT work!

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Difficult to explain

This means when INSTALLSOURES is set to true that the sources are compressed and integrated in to the launcher. When running the launcher and the directory structure does not exist yet, i.e. the sources are not there. They will be decompressed automatically.

This is meant only for convenience.

Let's assume the following situation:

You created a great launcher for a shareware application and want to share that launcher. You want also to give the sources (because of some useful information) or a readme.txt.
The only thing you have to give away is the launcher.exe. As soon launcher.exe is started the directory structure is created, the source and readme.txt are copied into the directory tree and the user is asked to select the directory of the locally installed shareware application. Then that application is copied into the directory structure.

It's difficutl to explain. I means to create a launcher that might also be used as some kind of portale apps creator.

For roadmap: Well there is no real roadmap. Currenlty it has everything wanted. It lives from the suggestions of the users. Maybe I'll include some of the changes suggested above.

chezduong
Offline
Last seen: 5 months 3 weeks ago
Joined: 2006-12-06 04:01
Clear now

Thank you. This is clear now.

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Roadmap

The only roadmap I could think of is:
*Change to PAF format as soon it is released (maybe automatically create AppInfo files and directory structure.

rgann
Offline
Last seen: 17 years 6 months ago
Joined: 2007-04-28 14:26
Bug found and suggested fix in versions v1.7 - v1.9

At line 382 (v1.8 ) , after copying the $DATADIR\Settings\File$R8.dat to
the destination directory, the code falls through to copy the existing
host file over the just copied $DATADIR\Settings\File$R8.dat. The net
effect is to run the portable app with the file that existed on the
host instead of with the portable app file.

Insert after line 382 (v1.8 ) or after line 446 (v1.9)
Goto InitFilesLoop

before change

		InitFilesApply:
			IfFileExists "$DATADIR\Settings\File$R8.dat" 0 InitFilesCopy ; only restore when available
				CopyFiles "$DATADIR\Settings\File$R8.dat" "$R9" ; restore file
		InitFilesCopy:
			CopyFiles /SILENT "$R9-PortBak" "$R9" ; copy existing settings file if no portable version exists
	Goto InitFilesLoop

after change

		InitFilesApply:
			IfFileExists "$DATADIR\Settings\File$R8.dat" 0 InitFilesCopy ; only restore when available
				CopyFiles "$DATADIR\Settings\File$R8.dat" "$R9" ; restore file
				Goto InitFilesLoop
		InitFilesCopy:
			CopyFiles /SILENT "$R9-PortBak" "$R9" ; copy existing settings file if no portable version exists
	Goto InitFilesLoop

There may be a better (or prefered) fix, but this does work.

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
You are right, thanks for pointing out

same bug also for folder copying, i.e. forgot copying existing folder if no portable settings exists. fixed that.

New Version 1.9.1 ready for download...

wtrabbit
Offline
Last seen: 17 years 6 months ago
Joined: 2007-05-05 18:58
sbabinea's Strengthened "Registry Management" Functionality

Please see my posting above. Sorry about the double post. Many thanks again!
-wtrabbit

sbabinea
Offline
Last seen: 17 years 6 months ago
Joined: 2007-05-01 08:55
Small bug with version 1.9.1

Klonk:

Lines 328-337 present a small bug. If ADMINREQUIRED is set to true, then even if the logged in user has administrator access the program will abort.

!if "${ADMINREQUIRED}" = "TRUE"
  userInfo::getAccountType
  pop $0
  StrCmp $0 "Admin" InitAdminEnd
    messageBox MB_OK|MB_ICONEXCLAMATION "You must be logged in as a local administrator for this launcher to work!"
    Abort
  InitAdminEnd:
    messageBox MB_OK|MB_ICONEXCLAMATION "You have admin rights!"
    Abort
!endif	

The solution is to delete lines 335-336.

!if "${ADMINREQUIRED}" = "TRUE"
  userInfo::getAccountType
  pop $0
  StrCmp $0 "Admin" InitAdminEnd
    messageBox MB_OK|MB_ICONEXCLAMATION "You must be logged in as a local administrator for this launcher to work!"
    Abort
  InitAdminEnd:
!endif	

-Steve.

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Uups

thanks, I forgot to remove this (had it for testing)
fixed with 1.9.3
I uploaded the corrected version.

sbabinea
Offline
Last seen: 17 years 6 months ago
Joined: 2007-05-01 08:55
Great!

I updated my sources here: http://thebabineaus.com/software/PAT/PAT_sab.nsi

-Steve.

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Thanks

I saw your launcher here: https://portableapps.com/node/6924

This is a good idea to offer others all your changes.
I plan to add support for external configuration files which might contain a list of reg keys and/or a list of files and/or a list of folders. I will support multiple files containing lists.

Therefore I did some code cleanup with version 1.9.4 (no functional change, simple moved some code to a helper function) as preparation for those lists.

Work on the source is slow currently as am around a lot because of my real job.

bgillis
bgillis's picture
Offline
Last seen: 4 years 4 months ago
Joined: 2007-05-11 04:25
JRE (& GTK) file location

Dear Karl,

I made a suggestion to John Haller in order to be more flexible with the use of a GTK or a JRE with a portable application. See it here.

It would be great to include this suggestion in your template!

Kind regards,

Bertrand GILLIS

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
I also think that this would be a vlauable extension

I have to look into it and how it was done for portable Openoffice. JRE portable was integrated into the german portable openoffice. I'll into it how they did it.

There are several ways how to define the JRE or GTK version.
1. set the JRE/GTK directory directly from an portable applications INI file
2. set the JRE/GTK directory from within the PAT source
3. set version number within PAT source and search where it is installed and use that directory structure.

I personally think 3. would be the best solution.

What is an jreportable.ini needed for? Can anyone explain that to me?

bgillis
bgillis's picture
Offline
Last seen: 4 years 4 months ago
Joined: 2007-05-11 04:25
Great!

Karl,

I've already look at OO launcher source code. It takes JRE version directly from a javaportable.ini file. Based on three values extracted from that file, the launcher creates dynamically an xml file used by OO to locate the JRE. That's why I propose to rename the INI file to jreportable.ini instead of javaportable.ini.

Personally, I don't think "solution 3" is the best solution. As a matter of fact you must recompile a new launcher each time you want to use an application with another JRE. I think the best of both world would be:
- set the JRE/GTK version directly from a INI file (read by the launcher)
- search where this version of JRE/GTK is installed and use that directory structure (from the launcher).

That's what I try to explain in my previous post here.

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
OK

I'll allow an INI entry for setting the commonfiles directory (for some own directory structure) and also automatic setting of the commonfiles based where the portable apps EXE could be found. I think this is really best.

The only thing is that creation of an XML file is highly specific to OO. Other applications could require something totally different.

How to handle that case? Or is it simply sufficient to provide a variable to the user to point to a common files directory? I'm not sure how to make use of it in a universal way..

The version number could be obtained from the directory name itself.

BTW: I think it is not a good idea to use JRE and GTK first level priority in your list of directories. (I could support it though)

I think this directory structure would be best:
+-\ Portable.exe
+-\CommonFiles\ \ .exe
+-\CommonFiles\ Portable\
+-\App\
or
+-\ .exe
+-\PortableApps\
+-\CommonFiles\ Portable\
+-\App\
or
+-\ .exe
+-\CommonFiles\ Portable\
| +-\\

bgillis
bgillis's picture
Offline
Last seen: 4 years 4 months ago
Joined: 2007-05-11 04:25
I completely agree...

...with the directory structure.

Unfortunately I don't think it's a good idea to use the directory name to get the JRE/GTK version. Several JRE/GTKs could co-exist within directory "CommonFiles".

For example, Apache Tomcat 5.x needs JRE 1.5 or higher but other applications may need JRE 1.4... and not higher otherwise the application migth not work anymore. Multiple JRE/GTK must then co-exist within directory "CommonFiles".

Then, how will you determine the right JRE/GTKs to use for a specific application ? That's why I introduce the concept of using different level where the jreportable.ini/gtkportable.ini could co-exist.

I know that the creation of an XML file for OO is specific. But if we could have a standard JRE/GTK variable allocation based on a standard JRE/GTK location, it will be a good start for specific customization in NSIS script.

I'd really like to have John Haller's opinion on that.

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Well I thought on a directory

named e.g. CommonFiles\JRE1.6.0_1

Here the version number is totally clear and therefore no need for an additional INI.

I thought: when you create a launcher you could define which version is needed. For example:
!define USEJAVAVERSION "1.6.0_1"

or something similar. Of course there must be a possibility to override that in the portable apps INI (in case of a newer version that might work or is needed with an update)

Still the problem: How should the application know that there is a portable java and where to search for it? Setting registry keys would lead to bigger problem if another application runs that uses JAVA.

My big problem: I currently do not know how java integrates into the system. (the same problem for GTK). But maybe we should discuss that in a separate topic.

bgillis
bgillis's picture
Offline
Last seen: 4 years 4 months ago
Joined: 2007-05-11 04:25
I've just started a new topic

as you suggested it. You can find it here.

I've also tried to answer to your last question: How to know which GTK/JRE an application shoud use and integrate into the system.

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Yikes

I see John is recommending:
?:\PortableApps\OpenOfficePortable\App\Java
?:\PortableApps\CommonFiles\Java

bgillis
bgillis's picture
Offline
Last seen: 4 years 4 months ago
Joined: 2007-05-11 04:25
That's not really an issue...

I've updated my specific topic about JDK/JRE suggestion with detailled directory structure and other relevant information. Please have a look and leave me any comment.

Personnaly I don't think John's directory structure is totally appropriate because it doesn't enable the coexistence of several GTK/JRE with different versions.

?:\PortableApps\OpenOfficePortable\App\Java doesn't need any version number in the directory structure. But I think the other one ?:\PortableApps\CommonFiles\Java needs it to make possible the coexistence of several GTK/JRE with different versions.

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
I decided to remove one

possible directory structure as it didn't make sens anyway. I will release it with version 2.0.

Roadmap: integrate GTK/JAVA support before release of 2.0.

SmithTech
SmithTech's picture
Offline
Last seen: 2 years 7 months ago
Developer
Joined: 2006-11-24 18:06
Suggestion HERE

Suggestion HERE https://portableapps.com/node/6956
would make good addition to Template.

"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)

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
This is a great idea

but I dont' have a clue how to realize that in NSIS.

I integrated that feature in my own application launcher, which is really minimalistic. It just monitors when the application is launched and tries to find out which window ID it uses. But still some applications do not close automatically when sending the WMCLOSE message. Still haven't found out why..

chezduong
Offline
Last seen: 5 months 3 weeks ago
Joined: 2006-12-06 04:01
Problem compiling PAT 1.9.4

Hi Klonk,

I tried compiling PAT 1.9.4, but get the following error in NSIS Portable (v 2.27).

Abort: ""
Invalid command: Dialogs::Folder
Error in script "B:\FotoGraphics\Noiseware\NoisewarePortable.nsi" on line 338 -- aborting creation process

For reference, the changes I have made are quite simple. I have registry injection/cleanup and have commented out almost all the other items as seen below:

!define APP "Noiseware" ; insert application name, e.g. "TestApp"
!define VER "1.1.0.194" ; insert version of launcher
!define EXE "Noiseware.exe" ; insert program exe name, e.g. "testapp.exe"

; ----- Application specific stuff
; insert regkeys to use separated by "||", comment out, when not used,
; e.g. HKCU\Software
!define REGKEYS "HKEY_CURRENT_USER\software\Imagenomic"
; insert settings files to use separated by "||" as stored on the host
; computer, e.g. "$WINDIR\TEST.INI", comment out, when not used
; !define SETTINGSFILES ""
; insert settings directories to use separated by "||" as stored on the
; host computer, e.g. "$PROFILE\TEST", comment out, when not used
; !define SETTINGSDIRS ""
; Require local administrator rights to run the launcher, necessary
; when writing to e.g. HKLM registry key. If not required comment out
; !define ADMINREQUIRED "TRUE"
; Redirect Userprofile folder, comment out when your application calls
; other programs, i.e. to disable automatic redirection. Default value
; "TRUE".
!define REDIRECTUSERPROFILE "TRUE"
; When "TRUE" a launcher is created that contains the sources and
; copies them into the appropriate folder if they do not exist yet.
; !define INSTALLSOURCES "TRUE"

In addition, I have commented out the splashscreen and have turned off the CRCCheck.

For reference, the problem line (338) is below:
Dialogs::Folder "Select installation folder of ${APP} " 'Select the main folder where you installed "${APP}" on your harddrive:' "$PROGRAMFILES" ${VAR_R0}

Would you know what is going on? Thanks. CD

By the way, you and Steve are doing a marvelous job with the PAT/PAL. I am having a very difficult time deciding whether I prefer the idea of compiling my own launchers (PAT) or whether I just want to modify an ini file (PAL)...decisions, decisions, decisions...

Simeon
Simeon's picture
Offline
Last seen: 10 years 1 month ago
DeveloperTranslator
Joined: 2006-09-25 15:15
You are missing a plugin for NSIS

Get it here.
Had the same problem so I knew about the plugin.
“Science is the belief in the ignorance of the experts” - Richard P. Feynman

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

chezduong
Offline
Last seen: 5 months 3 weeks ago
Joined: 2006-12-06 04:01
Thanks Simeon

Great! Works like a charm.

Silly question: Do I need the nsi scripts and the SerialMaker.exe file or are they just examples? I only need the Dialogs.dll and defines.nsh files, right?

Thanks again.

Simeon
Simeon's picture
Offline
Last seen: 10 years 1 month ago
DeveloperTranslator
Joined: 2006-09-25 15:15
Yep

What I did was:
I put the Dialogs.dll into the Plugins folder and the defines.nsh into the Include folder.
The nsi files aare examples and the rest is ignorable.
Wink
“Science is the belief in the ignorance of the experts” - Richard P. Feynman

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

chezduong
Offline
Last seen: 5 months 3 weeks ago
Joined: 2006-12-06 04:01
Thanks!

Thanks!

chezduong
Offline
Last seen: 5 months 3 weeks ago
Joined: 2006-12-06 04:01
PROGRAMPARMS without using ini file

Klonk, would it be possible to define the PROGRAMPARMS variable within the PAT instead of having to use an external ini file? I am thinking of something like the "--vlm-conf" settings of John's VLC Portable launcher...

Thanks. CD

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Well in fact you can add some default

command line options within the constant EXE. But I agree it would be much clearer if a separate constant will be used. I'll add it to the upcoming 2.0 version.

SmithTech
SmithTech's picture
Offline
Last seen: 2 years 7 months ago
Developer
Joined: 2006-11-24 18:06
check my post below "guess

check my post below "guess no one is passing arguments", specifically the strcmp and strcpy debug code.
it allows you to set a default argument and still be able to pass in an argument.

-----------------------------------------------------------------------------------------------
Because they stand on a wall and say nothing is going to hurt you tonight. Not on my watch.

"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)

SmithTech
SmithTech's picture
Offline
Last seen: 2 years 7 months ago
Developer
Joined: 2006-11-24 18:06
Guess No One is passing arguments.

1.4 - 1.9 do not pass arguments.
Just to clarify this is when passing argument from command line or from menu like ASuite, I didn't test with ini file.
Using PortableFirefox as a guide I came up with the following to fix it.

include section:
!include "GetParameters.nsh"

Run app section:
Call GetParameters
Pop $PROGRAMPARMS
;MessageBox MB_OK|MB_ICONEXCLAMATION 'Before compare $PROGRAMPARMS'
;StrCmp $PROGRAMPARMS "" 0 +2
;    StrCpy $PROGRAMPARMS ' portable'
;MessageBox MB_OK|MB_ICONEXCLAMATION 'After compare $PROGRAMPARMS'
;MessageBox MB_OK|MB_ICONEXCLAMATION 'Executing "$PROGRAMDIR\$PROGRAMEXE" $PROGRAMPARMS'
ExecWait '"$PROGRAMDIR\$PROGRAMEXE" $PROGRAMPARMS' $R0 ; run program

SimpleStart Section:
Call GetParameters
Pop $PROGRAMPARMS
Exec '"$PROGRAMDIR\$PROGRAMEXE" $PROGRAMPARMS'; run program

the commented lines are just test code.
you will need the GetParameters.nsh you can copy it from the firefox portable source folder.
-----------------------------------------------------------------------------------------------
Because they stand on a wall and say nothing is going to hurt you tonight. Not on my watch.

"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)

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Strange

in my ow tests it does pass arguments using the code below

include section:
!include "FileFunc.nsh" ; add header for file manipulation
!insertmacro "GetParameters" ; add function for retrieving command line parameters

run app section:
	${GetParameters} $R0 ; obtain eventually provided commandline parameters
		ExecWait "$PROGRAMDIR\$PROGRAMEXE ${EXEPARAMS} $PROGRAMPARMS $R0"

Of course FileFunc.nsh should be available within the NSIS Include directory. In a normal installation it is available.

Could you please test with your installation and tell me whether it works? Thanks for your help.

SmithTech
SmithTech's picture
Offline
Last seen: 2 years 7 months ago
Developer
Joined: 2006-11-24 18:06
I could be wrong but...

It probably does work, however EXEPARAMS is not in the template only PROGRAMPARMS
also if PROGRAMDIR\PROGRAMEXE is the path and executable, and EXEPARAMS is the argument, what is the purpose of PROGRAMPARMS?
I don't believe R0 should be included in the quotes as it isn't part of the command being executed.
I believe the quotes have to be done as in my example above in order to work on win98/95 in case the path has spaces or something, its in the NSIS help.

I'm still new to NSIS so I could be mistaken in any of this but I believe the syntax in my example would be the more appropriate way to do it.

-----------------------------------------------------------------------------------------------
Because they stand on a wall and say nothing is going to hurt you tonight. Not on my watch.

"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)

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Well

EXEPARAMS comes from the upcoming version 2.0 of the template.
With that constant you can define some default parameters which will be used on every launch and cannot be disabled.

The argument consists of ${EXEPARMS} $PROGRAMPARMS and $R0.
And in this case $R0 is executed as an paramter.
Of course I could have used some other ame maybe $CMDPARAMS or whatever. This does not make any difference.
Example:
Lets Assume:
PROGRAMDIR="D:\prog"
PROGRAMEXE="test.exe"
EXEPARAMS="--default"
PROGRAMPARMS="--ini-setting" (is set from within the INI file)
You run the application from the commandline like this launcher.exe --cmdline

Then the call of the application looks like that:
ExecWait "D:\prog\test.exe --default --ini-setting --cmdline"

SmithTech
SmithTech's picture
Offline
Last seen: 2 years 7 months ago
Developer
Joined: 2006-11-24 18:06
Ok, now I understand why you

Ok, now I understand why you are passing multiple parameters.
But I tested Template 1.4.1 and 1.9.4 and neither of them would pass the argument.
It might be because my path has spaces in it? Sorry, should have mentioned that from the beginning.
I found this in the NSIS help....

Note, if the command could have spaces, you should put it in quotes to delimit it from parameters. e.g.: ExecWait '"$INSTDIR\command.exe" parameters'. If you don't put it in quotes it will not work on Windows 9x with or without parameters.

But if you quote it like the example NSIS gives you errors about to many parameters that ExecWait only excepts 2.
Your actually passing it 4 params but quoting it as one single param.

EDIT: OK, I found the actual problem. I'm actually trying to do the same thing you are with EXEPARMS, pass in a default argument.
The problem is that the application I am launching only excepts 1 argument, so setting a default and then trying to pass an argument from the command line causes the application to ignore the second argument, the one from the command line, it will always only recognize the first argument being passed which in the default currently.
I believe you will have the same problem with your new addition of EXEPARMS.
Most applications will only except a certain number of arguments and will ignore the rest. Also if your default argument conflicts with one passed by command line which will the application use? Probably the first which is the default, but this eliminates the ability to pass command line arguments if you have a default set.

-----------------------------------------------------------------------------------------------
Because they stand on a wall and say nothing is going to hurt you tonight. Not on my watch.

"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)

SmithTech
SmithTech's picture
Offline
Last seen: 2 years 7 months ago
Developer
Joined: 2006-11-24 18:06
Just wanted to separate this

Just wanted to separate this from the above since it was getting rather long.

I think a better way to handle the arguments because of the above issues would be..
Command Line arguments override Ini File arguments and
Ini File arguments override default arguments.
Pseudocode Code:
copy defaultargs to argument
copy iniargs to argument (overwrites\overrides)
copy comargs to argument (overwrites\overrides)
execwait exec argument

-----------------------------------------------------------------------------------------------
Because they stand on a wall and say nothing is going to hurt you tonight. Not on my watch.

"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)

SmithTech
SmithTech's picture
Offline
Last seen: 2 years 7 months ago
Developer
Joined: 2006-11-24 18:06
Proposed Code Change

Default Value
StrCpy "$PROGRAMPARMS" "portable" (initialize variable to default value in first code section)

Ini File Value
Current code will overwrite default with ini file value if ini file exists,may need to include check not to override a good value with an empty one if ini file exists but has empty value.

Command Value

Function RunApp
	${GetParameters} $R0 ; obtain eventually provided commandline parameters
	StrCmp $R0 "" 0 +2
	    StrCpy $R0 $PROGRAMPARMS ;
	StrCmp $SECONDLAUNCH "true" RunAppNoWait ; simply start if launched a second time
		; --------------------------------------------------------------------------
		; Start program
		; --------------------------------------------------------------------------
		ExecWait '"$PROGRAMDIR\$PROGRAMEXE" $R0' ; run program
		Goto RunAppEnd
		; --------------------------------------------------------------------------
		; run application without waiting
		; --------------------------------------------------------------------------
	RunAppNoWait:
		Exec '"$PROGRAMDIR\$PROGRAMEXE" $R0' ; run program
	RunAppEnd:
FunctionEnd

I haven't tested this with an ini file, but the default value and command pass work as they should.

-----------------------------------------------------------------------------------------------
Because they stand on a wall and say nothing is going to hurt you tonight. Not on my watch.

"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)

Simeon
Simeon's picture
Offline
Last seen: 10 years 1 month ago
DeveloperTranslator
Joined: 2006-09-25 15:15
Love your sig

Nice movie and especially a VERY NICE Jack Nicholson.
But the others are good too.

"I want the truth!"
"You cant handle the truth!!!!!!!!!"

“Science is the belief in the ignorance of the experts” - Richard P. Feynman

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

SmithTech
SmithTech's picture
Offline
Last seen: 2 years 7 months ago
Developer
Joined: 2006-11-24 18:06
It was a REALLY good movie.

It was a REALLY good movie. I think it was nominated for something like 6 or 8 awards.
I like that particular line though cause it speaks volumes about the Marine Corps and how some people view them.

-----------------------------------------------------------------------------------------------
Because they stand on a wall and say nothing is going to hurt you tonight. Not on my watch.

"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)

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Sounds reasonable.

I'll do it that way.
I also will change the quotes to make sure that exes with spaces in their names could be launched also.
Will be integrated into 2.0.

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Finally version 2.0 is released

now with a bunch of additions (see history in first post)

bgillis
bgillis's picture
Offline
Last seen: 4 years 4 months ago
Joined: 2007-05-11 04:25
Excellent work!

One more suggestion...

Most of the time portable registry keys or portable files (eg. INI files) must be adapted dynamically in order to update directory or file path; in particular, the drive letter of the portable device. How to deal with that kind of requirements ?

These changes could be applied before processing portable registry keys or portable files. A new function call "InitBeforeReg" and/or "InitBeforeFiles" could then be introduced in the section "Main".

And/Or

These changes could be applied after processing portable registry keys or portable files. A new function call "InitAfterReg" and/or "InitAfterFiles" could then be introduced in the section "Main".

I think it's easier to apply changes after than before processing portable registry keys or portable files. As a matter of fact "Before" processing couldn't be applied if someone uses REGKEYS instead of USEREGKEYSFILE.

What's your opinon about this ? How do you suggest to deal with path updates within portable registry keys and portable file entries ?

I've just discovered PortaLaunch. It seems that a lot of enhancements have been added to your original PAT. It would be great to share your ideas and have only one template instead of creating several ones.

SmithTech
SmithTech's picture
Offline
Last seen: 2 years 7 months ago
Developer
Joined: 2006-11-24 18:06
Maybe my template will work for you

My template doesn't have all the functionality of Klonk's but I added a function to change the drive letter to the portable drive letter.
It should work for any file that is stored as text.
Application Launcher Template

-----------------------------------------------------------------------------------------------
Because they stand on a wall and say nothing is going to hurt you tonight. Not on my watch.

"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)

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Are you changing each drive letter?

Ar you changing each driver letter you find or only specfifc ones?

SmithTech
SmithTech's picture
Offline
Last seen: 2 years 7 months ago
Developer
Joined: 2006-11-24 18:06
It will search for every

It will search for every instance of a drive letter and change it.

-----------------------------------------------------------------------------------------------
Because they stand on a wall and say nothing is going to hurt you tonight. Not on my watch.

"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)

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
It would be easier to handle

if only some sign should be replaced, maybe %%PATdrive%% and/or %%PATAppPath%% (maybe also %%PATDataPath%%. But where should it be replaced? In registry keys? in some configuration files? How to determine which configuration files to use? Of course they will have to be modified before start of the application. On the one hand it would be good to modify them when they are copied to the host thus not doing to much write actions on the thumbdrive. On the other hand some apps could be set to access the files on the thumbdrive without need to copy them to the hosts harddrive.

Shouldn't also some envornment variable be set (some applications could use environment variables in their settings which would again help making the application portable

Should this replacement happen automatically? But then not everey drive letter should be replaced just specific ones. But then also the last used drive letter has to be saved somewhere.

What do you think?

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
I was thinking

about that myself. But there should be several values that might be necessary:
At least the driveletter and the path to the application.
But which coding to use to make sure it is not used already. For example %drive% might be used by an application already.

Regarding PortaLaunch: We have slightly different goals. With PortaLaunch all settings are done within an INI file, while in this template all settings are done within the source code. The only big difference I see is the loading of DLLs which I did not implement. Is it needed? Something else I forgot.

BTW: I heard rumours that john is currently creating a launcher that works with INI files (similar to PortaLaunch). Maybe also some other stuff changes.

But nevertheless: If you think a function would be nice (without bloating the template too much) please tell me.

wraithdu
Offline
Last seen: 11 years 5 months ago
Developer
Joined: 2007-06-27 20:22
Bugs / Suggestions for v2.0

I started with NSIS last week and found your template v1.4. Little did I know v2.0 was the latest! Either way I'm up to speed now, and I've found a few minor bugs. In it's default state, v2.0 throws 2 warnings and an error when compiling.

1. The variable ${EXEPARMS} on appx line 641 in the RunApp function is not defined. I just commented out that line and the preceding one.

2. The label CleanRegCleanUp on appx line 742 is not used. This is because if no regfile is used for the regkeys (ie listing reg keys in the source) then this label is never called. I added a superfluous Goto two lines above just to avoid the warning.

3. In the InitINI function, there is a jump to CheckAppsINI (I think) at appx line 232, and the label does not exist. It looks like there are 3 INI file directory locations you are checking in v2.0. In v1.4 there were about 5 maybe? So I don't know if you left these out on purpose and forgot to update the Goto, or what. Either way I just jumped to InitINIEnd to get rid of the error.

As for suggestions -

1. Reinstate a Sleep 50 command after, at least, any ${registry::SaveKey}. I had a problem where the reg keys were not deleted becuase they were still open for saving from the previous command. To be safe, I added Sleep 50 after any registry operation.

2. Consider in the InitReg function deleting ALL reg keys once they have been backed up, and not relying solely on the imported Registry.reg file to do it. The case for this I found was when having a locally installed version of the program and then running the portable version. In some cases regsitry entries that were only used by the native installation were making their way into my portable reg files becuase they were not being deleted first. Case in point is Eraser 5.82. I have some scripts where I call eraserl.exe to do a final cleanup, and it creates just the main HKCU key. On a computer where I had the full version of the program installed, ALL the HKCU keys and values were being migrated back to my portable reg files. I'm picky about my settings being intermingled, so I edited the script to delete all keys after they are backed up...so I can start the portable app from a clean slate.

Great job on this template, really. It was a great help to start learning NSIS and I don't know what I would have done without it at. The learning curve would have been really steep. Keep up the good work!

vbap
Offline
Last seen: 7 years 7 months ago
Joined: 2006-08-28 02:28
Thanks + Another Suggestion

Thanks for the update to 2.0, I have updated my portableapp to use this template and seems to be working OK...

My suggestion:
Include the following line in the template (probably as an option part of runtime switches):

RequestExecutionLevel user

This helps with apps that do not require admin priveleges, but are being run under a Vista Standard account with UAC turned on. If I didn't put this line in, then Vista would always prompt me for admin password, even though admin access is not required for the app (only makes changes to HKCU).

Thanks again.

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Good hint

I have no VISTA thus I did not run into that. I'll add it.

BTW: I uploaded version 2.1.

Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Thanks for bug report

I'll fix them and release a bugfixed version. Regarding the InitReg Function:
Normally If you specify a main key everything should be deleted within that main registry key.
Nevertheless, I'll add an option at the configuration part, where you can specify whether to delete the registry keys.

blawson7
Offline
Last seen: 9 months 4 days ago
Joined: 2007-07-06 11:37
Helper Apps??

I'm new to PortableApps. It's a great idea and I love what is currently available. I'd like to start developing, but do not know what "helper apps" are available to monitor which files, folders, and registry keys are generated.

Thanks a lot!

wraithdu
Offline
Last seen: 11 years 5 months ago
Developer
Joined: 2007-06-27 20:22
I use Regmon and Filemon

I use Regmon and Filemon (Sysinternals), any registry app that can take snapshots and compare them like Registry Workshop, and good old search. This is good for most apps that don't install drivers etc. Some people will suggest an uninstaller program like TotalUninstall (I think?) that can monitor an entire installation and tell you what went where. I don't tend to use it cause I'm not so interested in what is done during installation, as compared to what is done at runtime or while configuring options, ie some reg keys and stuff may be created by the installer but not by the program if just extracted and run, and some reg keys are created by the program at runtime/configuration and not by the installer.

stwum
Offline
Last seen: 3 years 8 months ago
Joined: 2007-06-24 06:53
Problem with EXEPARMS

In version 2.1, line 646 is throwing out errors if EXEPARMS(commandline default parameters) is not defined. To fixed the error, I replaced lines 645, 646 with:

!ifdef EXEPARMS
	!if ! "${EXEPARMS}" = "" ; only do stuff if constant is not empty
	  StrCmp $R0 "" 0 +2
            StrCpy $R0 ${EXEPARMS}
	!endif
!endif
Klonk
Offline
Last seen: 12 years 7 months ago
Joined: 2006-04-21 03:08
Thanks

fixed it

Ttech2
Offline
Last seen: 17 years 3 weeks ago
Joined: 2007-07-15 15:47
Helper Apps?

"2. You monitor which files, folders, and registry keys are generated. (There are several helper apps for that task)."

What are those? And where are they found. Thanks!
BTW: This s really helpful! A template is always good.

Ttech2
Offline
Last seen: 17 years 3 weeks ago
Joined: 2007-07-15 15:47
Java and Delete?

Whats with the Java stuff? Thats optional right?
Also one that I don't understand at all is the delete stuff? Whats that for?

Rochey
Offline
Last seen: 5 years 5 months ago
Joined: 2007-08-07 15:48
Reg problems

I am trying to make a portable version of debugview (from sysinternals). The problem I've got is that debugview writes in 2 places in the registry and I think this is causing my "Registry.reg" file to get deleted for some reason.
I have made a portable version of Tcpview, Portmon and ProcessExplorer and these all run fine (They all only write to one area in the registry).
What I have done is export the debugview registry settings to Registry.reg and also added the dbgview reg settings (second place of reg settings) to this reg file. When I run my portable version of debugview it runs correct the first time (I can also see regisytrybackup.reg in the data folder) but when I shut it down it seems to restore the backed up registry settings but then deletes both reg files in my data directory.

Could someone help me with this please? Has anyone else managed to get multiple reg settings to work?

Cheers Rochey

wraithdu
Offline
Last seen: 11 years 5 months ago
Developer
Joined: 2007-06-27 20:22
Do you use the REGFILES

Do you use the REGFILES section of the template, or the REGKEYS section? I've had no problem with multiple keys using the REGKEYS section. Maybe be a bit more specific as to what keys you're trying to backup/restore. As far as I'm aware, it's just HKCU\Software\Sysinternals\DbgView and HKCU\Software\Sysinternals\DebugView

Rochey
Offline
Last seen: 5 years 5 months ago
Joined: 2007-08-07 15:48
Yes I'm using REGFILES

I'm using the Regfiles section with both the debugview keys that you have said. See with Tcpview, for example, I was using the Regfiles section but it only had "HKCU\software\sysinternals\tcpview" to write when I ran the portable version of it.
I am just wondering whether using Regfiles with multiple keys (in debugviews case 2 keys) doesn't work. Don't suppose you could try and do it to see if you get the same problems, wraithdu?
If not don't suppose you could let me have your version of portable debugview? (it sounds like you have a version already and why re-invent the wheel!)

wraithdu
Offline
Last seen: 11 years 5 months ago
Developer
Joined: 2007-06-27 20:22
I don't have a portable

I don't have a portable version of it actually, I mean it would only take 2 seconds to make it using the template. Why don't you try moving those 2 keys to the REGKEYS section. I've never had a problem doing it that way, and I have used over 8 keys before.

If you still have a problem, I'll give it a try though.

EDIT -
According to the template, the old Registry.reg file is deleted, then a new one is created on shutdown. I don't think the new regfile is being created.

Try changing the ${WordFind} line in the RegFileToStack function to read "+1" instead of "+01". See if that works.

Rochey
Offline
Last seen: 5 years 5 months ago
Joined: 2007-08-07 15:48
I am starting to get

I am starting to get frustrated with this now!!(lol)
wraithdu, I tried using the regkeys section and the first time I ran portabledebugview my settings were created in Registry.reg (I was getting ready to kiss you! ha!). Then when I ran it a second time I had to create my settings again, so I checked the Registry.reg file it created and found that all the data had gone.
I have attached my user settings from the template, could you look at it and tell me is you think this is correct? If it is then I have know idea why it doesn't work
for me. I look forward to hearing from you.
Rochey


; ##########################################################################
; ----- Basic informations
!define AUTHOR "Rochey" ; your name
!define APP "DebugView" ; insert application name, e.g. "TestApp"
!define VER "4.64.0.0" ; insert version of launcher
!define EXE "dbgview.exe" ; insert program exe name, e.g. "testapp.exe"
;!define EXEPARMS "" ; insert some default Parameters

; ----- Application specific stuff
; insert regkeys to use separated by "||", comment out, when not used,
; e.g. HKCU\Software
!define REGKEYS "HKCU\Software\Sysinternals\debugview||HKCU\Software\Sysinternals\dbgview"
; If a file "Registry.reg" within the data directory is found then it is read
; and all parent registry keys are processed as if they'd have been set within
; REGKEYS
; !define USEREGKEYSFILE "TRUE"
; delete alle defined registry keys before own ones are applied (during Init)
!define DELETEREGKEYS "TRUE"
; insert settings files to use separated by "||" as stored on the host
; computer, e.g. "$WINDIR\TEST.INI", comment out, when not used
; !define SETTINGSFILES ""
; insert settings directories to use separated by "||" as stored on the host
; computer, e.g. "$PROFILE\TEST", comment out, when not used
; !define SETTINGSDIRS ""
; Require local administrator rights to run the launcher, necessary when
; writing to e.g. HKLM registry key. If not required comment out
!define ADMINREQUIRED "TRUE"
; Redirect Userprofile folder, comment out when your application calls other
; programs, i.e. to disable automatic redirection. Default value "TRUE".
; !define REDIRECTUSERPROFILE "TRUE"
; When "TRUE" a launcher is created that contains the sources and copies them
; into the appropriate folder if they do not exist yet.
; !define INSTALLSOURCES "TRUE"
; define which GTK version should be used, e.g. 2.0
; !define USEGTKVERSION ""
; define which JAVA version should be used, e.g. 1.6.0_01
; !define USEJAVAVERSION ""

; ----- Normally no need to change anything here
; format of portable name (dirs and filenames)
!define PNAME "${App}Portable"
; comment this line out when default icon should be used
!define ICON "${PNAME}.ico"
; comment this line out when no splashscreen image should be used
; !define SPLASHIMAGE "${PNAME}.jpg"
; could be changed when settings for multiple applications should be stored in
; one INI file
; !define INI "${PNAME}.ini"

wraithdu
Offline
Last seen: 11 years 5 months ago
Developer
Joined: 2007-06-27 20:22
OK Got It

I figured it out. In the original template, when backing up the portabe registry in the CleanReg function, the keys are backed up with the switch /D=2 which means that in the regfile, before a key is restored it is deleted -

[-HKCU\Software\Sysinternals\DbgView]

This is somehow messing up the importing of this file when !DELETEREGKEYS=TRUE because the keys are already deleted.

Remove /D=2 from the ${registry::SaveKey} line in the CleanReg section, and that should clear everything up. About line 763.

Rochey
Offline
Last seen: 5 years 5 months ago
Joined: 2007-08-07 15:48
Cheers for your help

Cheers for your help wraithdu but it still doesn't work with your advice. I think that I am going to have to dig out reg rapper. From what I remember it stores the separate reg keys in different reg files. Plus it's getting late and I'm getting very
frustrated!
I still can't believe that I seem to be the only one with this problem (so I keep thinking that I'm doing something wrong). never mind.
Again cheers for your help wraithdu.
Rochey

Pages

Topic locked