INF: GetCodeInfo() Documented Incorrectly

ID Number: Q67650

3.00

WINDOWS

docerr

Summary:

Pages 4-159 and 4-160 in the "Microsoft Windows Software Development

Kit Reference Volume 1" incorrectly documents the GetCodeInfo()

function. Below is the corrected documentation for this function.

More Information:

GetCodeInfo [3.0]

Syntax void GetCodeInfo(lpProc, lpSegInfo)

This function retrieves a pointer to an array of 16-bit values

containing information about the code segment that contains the

function pointed to by the lpProc parameter.

Parameter Type/Description

--------- ----------------

lpProc FARPROC Is the address of the function in the segment for

which information is to be retrieved. Instead of a

segment:offset address, this value can also be in the form

of a module handle and segment number. The GetModuleHandle

function returns the handle of a named module.

lpSegInfo LPVOID Points to an array of eight 16-bit values that

will be filled with information about the code segment.

See the following 'Comments' section for a description of

the values in this array.

Return Value None.

Comments The lpSegInfo parameter points to an array of eight

16-bit values that contains such information as the

location, size, and handle of the segment and its

attributes. The following list describes each of these

values:

Offset Description

------ -----------

0 Specifies the logical-sector offset (in bytes) to the

contents of the segment data, relative to the beginning of

the file. Zero means no file data is available.

1 Specifies the length of the segment in the file (in bytes).

Zero means 64K.

2 Contains flags which specify attributes of the segment. The

following list describes these flags:

Bit Meaning

--- -------

0-2 Specifies the segment type. If bit 0 is set to 1, the

segment is a data segment. Otherwise, the segment is

a code segment.

3 Specifies whether segment data is iterated. When this

bit set to 1, the segment data is iterated.

4 Specifies whether the segment is movable or fixed.

When this bit is set to 1, the segment is movable.

Otherwise, it is fixed.

5-6 Is not returned.

7 Specifies whether the segment is a read-only data

segment or an execute-only code segment. If this bit

is set to 1 and the segment is a code segment, the

segment is an execute-only segment. If this bit is

set to zero and the segment is a data segment, it is

a read-only segment.

8 Specifies whether the segment has associated

relocation information. If this bit is set to 1, the

segment has relocation information. Otherwise, the

segment does not have relocation information.

9 Specifies whether the segment has debugging

information. If this bit is set to 1, the segment has

debugging information. Otherwise, the segment does

not have debugging information.

10-15 Is not returned.

3 Specifies the total amount of memory allocated for the

segment. This amount may exceed the actual size of the

segment. Zero means 65,536.

4 Contains the handle of the segment. Zero means the segment is

not loaded.

5 Contains the shift count to turn logical sector into byte

offset in the file.

6-7 Reserved.