Actually this function *will* never fail but simply return the default! If the buffer is too small, the result is simply truncated. If the file is not found, the default is applied. Both are not necessarily failures but most likely are accepted by people used to this function. Typically, it is *wanted* behaviour that the default is returned if the file, the appname, or the key is missing -- instead of getting an exception. I think nobody ever checked for GetLatestError after this function, as the default's job *is* to get in place in case of any problem. Users would be scared if there is an exception thrown instead of getting the default. So if you insist for sake of OOP, I can throw an exception. But my advise would be *in this particular function* not to throw, for the sake of "expected behaviour". :-)

BTW, yes, this comes from 16 bit times, but in fact is still in use in lots of 32 bit software. ;-)