anchor.diff:          | null -> def
           | _ -> res
   
  -    let GetExeHash (exePath:string):string =
  -        string (exePath.ToUpperInvariant().GetHashCode())
  +    let GetProfiles() = 
  +        let profKey = Registry.CurrentUser.OpenSubKey(mmProfRoot)
  +        match profKey with 
  +        | null -> []
  +        | _ -> 
  +            let profiles = profKey.GetSubKeyNames()
  +            List.ofArray profiles
  +                    
  +    let Load (exePath:string):CoreTypes.RunConfig = 
  +        let exePath = exePath.Trim()
   
  -    let Load (exePath:string):CoreTypes.RunConfig = 
  -        let exehash = GetExeHash exePath
  -        let profRoot = mmRoot + "\\Profiles\\" + exehash
  +        let conf = 
  +            // Search all profiles for a subkey that has the exe as its ExePath
  +            let targetProfile = 
  +                let profiles = GetProfiles()
  +                profiles |> List.tryPick (fun pName -> 
  +                                let profRoot = mmProfHiveRoot @@ pName
  +                                let pExePath = Regget(profRoot, RegKeys.ProfExePath, "") :?> string |> (fun s -> s.Trim())
  +                                if pExePath <> "" && pExePath.Equals(exePath, StringComparison.InvariantCultureIgnoreCase) then 
  +                                    Some(profRoot)
  +                                else None)
   
  -        let dwordAsBool dw = 
  -            if (int dw > 0) then true else false
  +            let dwordAsBool dw = 
  +                if (int dw > 0) then true else false
   
  -        log.Info "Searching for configuration data under key %A for executable %A" profRoot exePath
  +            let profPath = 
  +                match targetProfile with
  +                | None -> 
  +                    log.Info "No profile subkey located in %A for executable %A; using defaults" mmProfHiveRoot exePath
  +                    // if this defaults key is missing, then we just use the hardcoded defaults below
  +                    mmProfHiveDefaultsKey
  +                | Some profPath -> profPath
   
  -        { 
  -            CoreTypes.RunConfig.DocRoot = Regget(mmRoot,RegKeys.DocRoot,"") :?> string
  -            RunModeFull = dwordAsBool ( Regget(profRoot,RegKeys.ProfRunModeFull, 1) :?> int )
  -            InputProfile = Regget(profRoot,RegKeys.ProfInputProfile, "") :?> string
  -            SnapshotProfile = Regget(profRoot,RegKeys.ProfSnapshotProfile, "") :?> string
  -        }
  +            { 
  +                CoreTypes.RunConfig.DocRoot = Regget(mmHiveRoot,RegKeys.DocRoot,"") :?> string
  +                CoreTypes.RunConfig.RunModeFull = dwordAsBool ( Regget(profPath,RegKeys.ProfRunModeFull, 1) :?> int )
  +                CoreTypes.RunConfig.InputProfile = Regget(profPath,RegKeys.ProfInputProfile, "") :?> string
  +                CoreTypes.RunConfig.SnapshotProfile = Regget(profPath,RegKeys.ProfSnapshotProfile, "") :?> string
  +            }
   
  -
  +        conf        
  
positive.code: module RegConfig =
      let private log = Logging.GetLogger("RegConfig")
  
      let private mmRoot = @"HKEY_CURRENT_USER\Software\ModelMod"
  
      let private Regget(key,value,def) =
          let res = Registry.GetValue(key, value, def)
  
negative.code: ﻿namespace ModelMod
  
  open System
  open System.IO
  open Microsoft.Win32
  
  module RegKeys = 
      let DocRoot = "DocRoot"
      let ProfExePath = "ExePath"
      let ProfRunModeFull = "RunModeFull"
      let ProfSnapshotProfile = "SnapshotProfile"
      let ProfInputProfile = "InputProfile"
  