The following function iterates through all the assemblies in the current application domain, and extracts the directory of the assembly which ends with mscorlib.dll

function FrameworkPath: string;
var
  LAssemblies: array of Assembly;
  LAssembly: Assembly;
begin
  LAssemblies := AppDomain.CurrentDomain.GetAssemblies;
  for LAssembly in LAssemblies do
    if LAssembly.Location.ToLower.EndsWith('mscorlib.dll') then
      begin
        Result := Path.GetDirectoryName(LAssembly.Location);
        exit;
      end;
  raise Exception.Create('Unable to locate framework path!');
end;