Comments and Discussions

The method of defining a union RegKeyValue just to get something of data type BYTE is rather clumsy. You can use any kind of buffer and cast the address in the call to RegQueryValueEx. The parameter is defined as LPBYTE in order to make the caller aware of the fact that the following parameter lpcbData, specifying the length of the buffer, is understood as "length in bytes". So you could equally well write: