Add RegistryRef.

This is to encapsulate the common operations of dealing with registry
references.