Errors in "Developer's Toolkit Reference" CodeView Header File

ID Number: Q71766

1.00 | 1.00

MS-DOS | OS/2

docerr

Summary:

The "Microsoft C Developer's Toolkit Reference" on pages 50 and 51

gives an example of a header file used to read CodeView information

from an .EXE file. This example shows the layout of the CodeView

information in the .EXE files, but it has several typographical errors

and omissions.

The errors on page 51 are listed here. Complete sample code with the

changes is given in the sample code section below.

1. In the pbi structure, the uoffset_t type should be an unsigned type

matching the size of an offset on the machine you are working on.

For 16-bit code, use unsigned int; for 32-bit code use an unsigned

long.

2. There are two typedefs of a structure called loe. The loe structure

is actually the lineNbr/offset structure. Label the outer

structures appropriately to the type you are working with.

3. There is a missing closing curly brace in the SSTSRCLINES

structure.

Sample Code

-----------

/* This is page 51 as it should be

*/

// SSTPUBLICS

typedef struct pbi {

unsigned off; /* unsigned not uoffset_t */

unsigned seg;

unsigned type;

unsigned char cbName;

char Name[];

} pbi; // public record type

// SSTTYPES

// SSTCOMPACTED

// SSTSYMBOLS

// SSTSRCLINES

typedef struct {

char cbName; // count of characters in Name

char Name[]; // File Name

unsigned short cLnOff; // count of structures to follow

struct {

unsigned short lineNbr;

unsigned short offset;

}loe; // Line Number Entry

} SrcLine;

// sstSrcLnSeg

typedef struct {

char cbName; // Count of characters in Name

char Name[]; // File Name

_segment Seg;

unsigned short cLnOff; // count of structures to follow

struct {

unsigned short lineNbr;

unsigned short offset;

}loe; // Line Number Entry

} SrcLineSeg;

// sstLibraries

typedef struct {

unsigned char cbLibs;

char Libs[];

} lib[]; // an array of lib names