Search code examples
delphiwindows-7registryantivirus

Registry "forgetting" values


My software stores some values in HKCU\Software\mysoftware which has never been a problem. However, I now also store some values in HKCU\Software\mysoftware\Licenses - ie a subdirectory of the existing data. However, 24 hours later those values simply disappear.

I put logging in my software to check it wasn't deleting the keys and there are no log entries, which is quite expected as the software isn't even running. Somebody suggested using process viewer (from Microsoft) which can trace registry events: however, that gave up working (too many events, even though I'm only watching HKCU\Software\mysoftware registry events) so I'm still no closer to finding what is deleting those keys!

I use Avast! anti-virus which somebody else suggested could be a culprit. The actual keys are of the form REG_SZ with "[keyname]=[base64string]". Nothing fancy, around 150 characters. A few hours after the software is closed I can use registry editor to see those values. But sometime later, they're gone! I rarely reboot.

So what else could be deleting the keys?

UPDATE

Here's the Delphi 6 code:

procedure XXX;
var
    registry : TRegistry;
    code : string;
begin
    try
        registry := TRegistry.Create;
        if registry.OpenKey(REGISTRY_ROOT, true) then begin
            code := [...a base64 string, around 150 chars on average...];
            registry.WriteString(simname, code);
        end;
    finally
        FreeAndNil(registry);
    end;
end;

Solution

  • Still no closer to finding a solution; however, all I can think of (suggested elsewhere) is that it's the anti-virus confining the application to a sandbox, though there's no notification of such.