Delphi / Object Pascal · Exception

ERegistryException Exception

What does ERegistryException Exception mean in Delphi / Object Pascal?

Raised by TRegistry when a registry operation fails: creating a subkey without KEY_CREATE_SUB_KEY access, reading a value without KEY_READ access or with the wrong data type, reading binary data into a buffer too small to hold it, or writing a value without KEY_WRITE access.

ERegistryException ExceptionDelphi (VCL)

Condition

Raised by TRegistry when a registry operation fails: creating a subkey without KEY_CREATE_SUB_KEY access, reading a value without KEY_READ access or with the wrong data type, reading binary data into a buffer too small to hold it, or writing a value without KEY_WRITE access.

Fix

Run with, or request, the correct registry security access for the keys involved, check the actual stored data type with GetDataType before reading, and size buffers for binary reads using GetDataSize first rather than guessing.

Related exception