Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CRegKey::QueryBinaryValue

 

Call this method to retrieve the binary data for a specified value name.


      LONG QueryBinaryValue(
   LPCTSTR pszValueName,
   void* pValue,
   ULONG* pnBytes 
) throw( );

pszValueName

Pointer to a null-terminated string containing the name of the value to query.

pValue

Pointer to a buffer that receives the value's data.

pnBytes

Pointer to a variable that specifies the size, in bytes, of the buffer pointed to by the pValue parameter. When the method returns, this variable contains the size of the data copied to the buffer.

If the method succeeds, ERROR_SUCCESS is returned. If the method fails to read a value, it returns a nonzero error code defined in WINERROR.H. If the data referenced is not of type REG_BINARY, ERROR_INVALID_DATA is returned.

This method makes use of RegQueryValueEx and confirms that the correct type of data is returned. See RegQueryValueEx for more details.

System_CAPS_security Security Note

This method allows the caller to specify any registry location, potentially reading data which cannot be trusted. Also, the RegQueryValueEx function used by this method does not explicitly handle strings which are NULL terminated. Both conditions should be checked for by the calling code.

Show: