Can TRegistry write REG_NONE values?

delphi, delphi-xe2

Solution

It is true that `TRegistry` has no direct support for `REG_NONE` values. However, with the protected hack, you can trick it into creating zero-length binary `REG_NONE` values:

type
  TRegistryHack = class(TRegistry);
....
TRegistryHack(Registry).PutData(ValueName, nil, 0, rdUnknown);

You need to use the protected hack to gain access to `PutData` which is a protected member. A cleaner approach would be to use a class helper or true class derived from `TRegistry`, but you get the idea.

Problem

I'm trying to work with the OpenWithProgids key of an extension using TRegistry. I don't see that TRegistry can write these values (which require a type of REG_NONE.) I know that I could just use the API RegSetValueEx function to set these, but I'm wondering if I'm missing something in TRegistry that can do it.

Original source