Glitch in documentation of SYMBOL_INFO

Posted on

The documentation of the SYMBOL_INFO structure used by dbghelp contains a glitch. As the structure is of variable length, the documentation for SizeOfStruct states:

Size of the structure, in bytes. This member must be set to sizeof(SYMBOL_INFO). Note that the total size of the data is the SizeOfStruct + MaxNameLen - 1. The reason to subtract one is that the first character in the name is accounted for in the size of the structure. 

While this is true for SYMBOL_INFO (the ANSI version), it is wrong for SYMBOL_INFOW (the Unicode version). As MaxNameLen contains the character count rather than the byte count of the Name field, it should read:

Size of the structure, in bytes. This member must be set to sizeof(SYMBOL_INFO). Note that the total size of the data is **SizeOfStruct + ( MaxNameLen - 1 ) * sizeof( TCHAR )**. The reason to subtract one is that the first character in the name is accounted for in the size of the structure. 

I have reported this bug, let’s see how soon it gets fixed…

Update: The documentation has meanwhile been fixed.

« Back to home