GetCodeInfo

Version 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 four 32-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 four 32-bit values that contains such infor-mation as the location and size 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.  
2 Specifies the length of the segment in the file (in bytes). Zero means 64K.  
4 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 moveable or fixed. When this bit is set to 1, the segment is moveable. Otherwise, it is fixed.
  5 Is not returned.
  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–11 Is not returned.
  12–15 Is not returned.
6 Specifies the total amount of memory allocated for the segment. This amount may exceed the actual size of the segment. Zero means 65,536.