-- Location method: Registry key
-- Read a folder path from the Registry.
if not g_InstalledVersion then
local MainKey = HKEY_LOCAL_MACHINE;
local SubKey = SessionVar.Expand("Software\\Crytek\\Crysis 2");
local ValueName = "Install Dir";
local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);
g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", FolderPath);
g_ProductPath = FolderPath .. "Bin32\\Crysis2.exe";
if g_InstalledVersion then
SessionVar.Set("%AppFolder%", FolderPath);