Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can TRegistry write REG_NONE values?

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.

like image 956
MarkF Avatar asked Oct 08 '22 04:10

MarkF


1 Answers

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.

like image 161
David Heffernan Avatar answered Oct 13 '22 10:10

David Heffernan