You are here

[Solved] How do portable apps use default registry settings?

3 posts / 0 new
Last post
XJDHDR
Offline
Last seen: 1 week 1 day ago
Joined: 2014-12-31 09:15
[Solved] How do portable apps use default registry settings?

Greetings

I have been attempting to make a game I play portable using the PortableApps Launcher Generator and this website's documentation. The only thing I really need to do to make the game portable is to redirect some registry accesses.

I eventually managed to create a launcher which I thought was what I needed. Unfortunately, I have been having problems running the game and I have narrowed them down to the initial registry settings. Basically, when the game is installed, the installer creates some registry entries which have to be present for the game to run properly.

I have seen that some of the portable apps I have looked at have registry keys stored in the App/DefaultData/Settings folder that are presumably integrated into the Data/Settings folder's registry but I couldn't find anything in the documentation concerning this. I attempted to create a registry file in the App/DefaultData/Settings folder that looked the same as how other portable apps had it but the keys from that file are not being stored in the Data/Settings folder's registry file.

This is the contents of the App/DefaultData/Settings registry file:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Westwood\Emperor]
"Name"="Emperor"
"InstallPath"="C:\\Westwood\\Emperor\\Emperor.EXE"
"FolderPath"="C:\\Users\\Admin\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Westwood\\Emperor - Battle For Dune"
"HTMLPath"="C:\\Westwood\\Emperor\\Data\\HTML"
"SKU"=dword:00001f00
"Version"=dword:00010009

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Westwood\Emperor\URL]
"Ladder"="http://battleclans.westwood.com/cgi-bin/cgiclient?rosetta&request=do_ladder&LANGCODE=0&SKU=7936&embedded=1"
"LadderX"="http://battleclans.westwood.com/cgi-bin/cgiclient?rosetta&request=do_ladder&LANGCODE=0&SKU=7936"
"NetStatus"="http://battleclans.westwood.com/cgi-bin/cgiclient?rosetta&request=do_netstatus&LANGCODE=0&SKU=7936&embedded=1"
"NetStatusX"="http://battleclans.westwood.com/cgi-bin/cgiclient?rosetta&request=do_netstatus&LANGCODE=0&SKU=7936"
"Signup"="http://games2.westwood.com/cgi-bin/cgiclient?register&request=expand_template&Template=newreg_menu.html&LANGCODE=0&embedded=1&SKU=7936"
"SignupX"="http://games2.westwood.com/cgi-bin/cgiclient?register&request=expand_template&Template=newreg_menu.html&LANGCODE=0"
"BattleClans"="http://battleclans.westwood.com/cgi-bin/cgiclient?dunesquad&request=expand_template&Template=index.html&SKU=7936&LANGCODE=0&embedded=1"
"BattleClansX"="http://battleclans.westwood.com/cgi-bin/cgiclient?dunesquad&request=expand_template&Template=index.html&SKU=7936&LANGCODE=0"
"News"="http://battleclans.westwood.com/cgi-bin/cgiclient?rosetta&request=do_news&LANGCODE=0&SKU=7936&embedded=1"
"NewsX"="http://battleclans.westwood.com/cgi-bin/cgiclient?rosetta&request=do_news&LANGCODE=0&SKU=7936"
"Insider"="http://games2.westwood.com/cgi-bin/cgiclient?register_insider&request=expand_template&Template=dune_insider_login.html&LANGCODE=0"
"InsiderX"="http://games2.westwood.com/cgi-bin/cgiclient?register_insider&request=expand_template&Template=dune_insider_login.html&LANGCODE=0"

This is the contents of the Data/Settings registry file after opening the game's Portable Apps launcher:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Westwood\Emperor]

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Westwood\Emperor\Options]

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Westwood\Emperor\Options\Game]
"AutoSaveName"="AutoSave"
"GameSpeed"="6"
"Insider"=""
"IntroPlayed"="0"
"MouseSpeed"="100"
"ScrollRate"="5"
"ShowTargetLines"="1"
"Tooltips"="1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Westwood\Emperor\Options\Graphics]
"GraphicsLOD"="0"
"ColorDepth"="16"
"Shadows"="0"
"ModelLOD"="0"
"TextureLOD"="0"
"TerrainLOD"="0"
"EffectLOD"="0"
"ScreenWidth"="640"
"ScreenHeight"="480"
"MultiTexture"="1"
"HardwareTL"="1"
"AltDevice"="0"
"ShadowQuality"="0"
"LimitFrameRate"="0"
"LimitTo16BitTex"="0"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Westwood\Emperor\Options\Movies]
"MovieListCount"="0"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Westwood\Emperor\Options\Multiplayer]
"AutoLoginChoice"="NoAutoRadioButton"
"FilterLanguage"="1"
"Persona"=" - - "
"Server"=" - - "
"House"="0"
"SubHouse1"="3"
"SubHouse2"="5"
"HasSetQM"="0"
"LastLoginNickname"=""
"ServerListCount"="0"
"Locale"="0"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Westwood\Emperor\Options\Network]
"SocketNumber"="0"
"DestinationNetwork"="0"
"NetworkCard"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Westwood\Emperor\Options\Sound]
"Sound"="1"
"MusicVolume"="45"
"SoundVolume"="80"
"VoiceVolume"="80"

As you can see, the registry keys from the DefaultData registry file are not being saved into the Data registry file.

If it helps, here are, I think, the relevant entries in my Launcher's INI file:
[Activate]
Registry=true

[RegistryKeys]
EmpBfD=HKLM\SOFTWARE\Wow6432Node\Westwood\Emperor

[RegistryValueWrite]
HKLM\SOFTWARE\Wow6432Node\Westwood\Emperor\InstallPath=REG_SZ:%PAL:AppDir%\Emperor\Emperor.EXE
HKLM\SOFTWARE\Wow6432Node\Westwood\Emperor\FolderPath=REG_SZ:%PAL:AppDir%\Start Menu\Westwood\Emperor - Battle For Dune
HKLM\SOFTWARE\Wow6432Node\Westwood\Emperor\HTMLPath=REG_SZ:%PAL:AppDir%\Emperor\Data\HTML

On a side note, I have three registry keys in my Launcher INI that are supposed to be edited every time the launcher is run. I don't, however, see these keys being stored in the Data folder's registry file. Is this supposed to be happening or is this another problem that needs to be fixed?

Help will be greatly appreciated.

Mortisanti
Offline
Last seen: 7 years 6 days ago
Joined: 2015-01-22 11:17
Possible Help

I think one of your issues is that, in order to use [RegistryValueWrite] to write to HKLM, you need to have Admin privileges; you can force the launcher to run as admin by adding the line RunAsAdmin=force under [Launch] in your launcher.ini (unless you've already done that).

I've recently been tinkering with portability. So far I just "finished" a portable version of RCT2 Triple Thrill Pack. I say "finished" because I would like to figure out if it's possible to have the game run with HKCU registry keys instead of HKLM (to avoid running as Admin). In order to run the game, it needed to write a few keys to the registry; the version I made portable is a Steam version, and oddly enough when you run the game through Steam, it writes GOG.com registry keys along with infogrames keys, almost like a no-CD crack. If you would like to take a look at my launcher.ini, here's a link to the paste: http://pastebin.com/4F2nTfrF.

Keep looking into:
https://portableapps.com/manuals/PortableApps.comLauncher/topics/registr...
and
https://portableapps.com/manuals/PortableApps.comLauncher/ref/launcher.i...
if needed.

XJDHDR
Offline
Last seen: 1 week 1 day ago
Joined: 2014-12-31 09:15
Solution discovered

I eventually found the reason my registry settings weren't working. First, I was actually doing everything correctly in my OP. The registry file I created was correct, the launcher INI was correctly configured and the registry file is placed in the location I mentioned. The problem was actually the game itself. When you type the game's serial key into the setup program, the program stores that key in your registry. However, the setup program encodes that key in an unknown manner using a number of pieces of data, one of which is the location you installed the game. When you run the game, it does some sort of test on that encoded serial key in the registry and the game crashes if the test fails. This is why I was having problems. I didn't install the game to the PortableApps folder I created for it and so the serial was not encoded correctly.

@Mortisanti
I'm not sure if you are still trying to finish your portable RCT2 project but I was actually trying to do the same thing with the game in my OP (Emperor: Batlle for Dune). A few months ago, I started seriously researching exactly what you wanted here: converting the game's HKLM registry access to HKCU and found the way to do it.

I gave an explanation here:
https://portableapps.com/node/55549#comment-230875

Log in or register to post comments