Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

346 lines
9.5 KiB

  1. // SAPI.H - Private header file for SAPI
  2. //
  3. // DESCRIPTION
  4. // This file contains types that are private to the SAPI project.
  5. #ifndef _SAPI_INCLUDED_
  6. #define _SAPI_INCLUDED_
  7. typedef HIND HEXR; // A handle to an EXR (exe reference)
  8. typedef HIND HEXG; // A handle to an EXG (exe structure global)
  9. typedef HVOID HST; // A handle to source module table
  10. typedef HVOID HSL; // A handle to source line table
  11. typedef HVOID HFL; // A handle to an instance of a file
  12. #define hmodNull ((HMOD)NULL)
  13. #define hexgNull ((HEXG)NULL)
  14. #define hexrNull ((HEXR)NULL)
  15. #define hexeNull ((HEXE)NULL)
  16. #define hpdsNull ((HPDS)NULL)
  17. #define MDS_INDEX 1L
  18. // The following are defs stolen from CVDEF
  19. #include <stdlib.h>
  20. #define _MAX_CVPATH _MAX_PATH // max. length of full pathname
  21. #define _MAX_CVDRIVE _MAX_DRIVE // max. length of drive component
  22. #define _MAX_CVDIR _MAX_DIR // max. length of path component
  23. #define _MAX_CVFNAME _MAX_FNAME // max. length of file name component
  24. #define _MAX_CVEXT _MAX_EXT // max. length of extension component
  25. typedef SYMTYPE *SYMPTR;
  26. typedef CFLAGSYM *CFLAGPTR;
  27. typedef CONSTSYM *CONSTPTR;
  28. typedef REGSYM *REGPTR;
  29. typedef UDTSYM *UDTPTR;
  30. typedef SEARCHSYM *SEARCHPTR;
  31. typedef BLOCKSYM16 *BLOCKPTR16;
  32. typedef DATASYM16 *DATAPTR16;
  33. typedef PUBSYM16 *PUBPTR16;
  34. typedef LABELSYM16 *LABELPTR16;
  35. typedef BPRELSYM16 *BPRELPTR16;
  36. typedef PROCSYM16 *PROCPTR16;
  37. typedef THUNKSYM16 *THUNKPTR16;
  38. typedef CEXMSYM16 *CEXMPTR16;
  39. typedef VPATHSYM16 *VPATHPTR16;
  40. typedef WITHSYM16 *WITHPTR16;
  41. typedef BLOCKSYM32 *BLOCKPTR32;
  42. typedef DATASYM32 *DATAPTR32;
  43. typedef PUBSYM32 *PUBPTR32;
  44. typedef LABELSYM32 *LABELPTR32;
  45. typedef BPRELSYM32 *BPRELPTR32;
  46. typedef PROCSYM32 *PROCPTR32;
  47. typedef PROCSYMMIPS *PROCPTRMIPS;
  48. typedef THUNKSYM32 *THUNKPTR32;
  49. typedef CEXMSYM32 *CEXMPTR32;
  50. typedef WITHSYM32 *WITHPTR32;
  51. typedef VPATHSYM32 *VPATHPTR32;
  52. typedef BLOCKSYM *BLOCKPTR;
  53. typedef PROCSYM *PROCPTR;
  54. typedef THUNKSYM *THUNKPTR;
  55. typedef WITHSYM *WITHPTR;
  56. // End of CVDEF defines
  57. typedef struct _PDS {
  58. HLLI hlliExe;
  59. HPID hpid;
  60. } PDS; // PiD Struct
  61. typedef PDS * PPDS;
  62. typedef PDS * LPPDS;
  63. typedef union _UFOP {
  64. DWORD lfo;
  65. PVOID lpv;
  66. } UFOP; // Union of long File Offset & Pointer
  67. typedef UFOP *LPUFOP;
  68. typedef struct _ALM {
  69. BOOL fSeq;
  70. WORD btAlign;
  71. WORD cbBlock;
  72. DWORD cb;
  73. LPB pbData;
  74. UFOP rgufop [1];
  75. // WORD cbLast; // After a null terminator, there is a field
  76. // containing the cb of the last align block
  77. } ALM; // ALigned Map
  78. typedef ALM *LPALM;
  79. typedef struct _ULP {
  80. DWORD ib; // Byte offset into the symbol table
  81. DWORD ulId; // Identified (either a uoff or a checksum)
  82. } ULP; // ULong Pair
  83. typedef ULP *LPULP;
  84. typedef struct _SHT {
  85. WORD HashIndex;
  86. WORD ccib; // count of buckets [0..n)
  87. DWORD * rgcib; // count of ULPs in chain i, 0 <= i < n
  88. DWORD * rgib; // offset of start of chain i, 0 <= i < n
  89. LPALM lpalm; // block of ULPs
  90. } SHT; // Symbol Hash Table
  91. typedef SHT *LPSHT;
  92. typedef struct _GST {
  93. LPALM lpalm;
  94. SHT shtName;
  95. SHT shtAddr;
  96. #if CC_CVTYPE32
  97. SymConvertInfo sci;
  98. #endif
  99. } GST; // Global Symbol Table -- Globals, Publics, or Statics
  100. typedef GST *LPGST;
  101. typedef struct _SGC {
  102. WORD seg;
  103. DWORD off;
  104. DWORD cb;
  105. } SGC; // SeGment Contributer
  106. typedef SGC *LPSGC;
  107. typedef struct _SGE {
  108. SGC sgc;
  109. HMOD hmod;
  110. } SGE; // SeGment directory Entry
  111. typedef SGE *LPSGE;
  112. typedef struct _SGD {
  113. WORD csge;
  114. LPSGE lpsge;
  115. } SGD; // SeGment Directory
  116. typedef SGD *LPSGD;
  117. typedef struct _MDS {
  118. HEXG hexg; // EXG parent of MDS list
  119. WORD imds;
  120. DWORD cbSymbols;
  121. LPB symbols;
  122. HST hst;
  123. LSZ name;
  124. DWORD ulhst;
  125. DWORD cbhst;
  126. DWORD ulsym;
  127. WORD csgc;
  128. LPSGC lpsgc;
  129. Mod* pmod; // NB10
  130. #if CC_CVTYPE32
  131. SymConvertInfo sci; // necessary info to keep around while
  132. // loading symbols that need to be
  133. // converted.
  134. #endif
  135. } MDS; // MoDule Information
  136. typedef MDS *PMDS;
  137. typedef MDS *LPMDS;
  138. struct STAB;
  139. typedef struct STAB STAB;
  140. typedef struct _EXG {
  141. BOOL fOmfLoaded:1;
  142. BOOL fOmfMissing:1;
  143. BOOL fOmfSkipped:1;
  144. BOOL fOmfDefered:1;
  145. BOOL fOmfLoading:1;
  146. BOOL fIsPE:1;
  147. BOOL fIsRisc:1;
  148. BOOL fSymConverted:1;
  149. SHE sheLoadStatus; // Load status: defered, startup, etc
  150. SHE sheLoadError; // Load error
  151. LONGLONG llUnload;
  152. LSZ lszName; // File name of exe
  153. LSZ lszModule; // Module name of exe
  154. LSZ lszDebug; // File name for debug info
  155. LSZ lszPdbName; // File name of pdb
  156. LSZ lszAltName; // Alternate name (for KD debugging)
  157. LPB lpbData; // Pointer to raw data for this image (non-PDB)
  158. LPB lpgsi; // GSN Info table
  159. PVOID pvSymMappedBase;
  160. PDB * ppdb;
  161. DBI * pdbi;
  162. TPI * ptpi;
  163. GSI * pgsiPubs; // public symbols
  164. GSI * pgsiGlobs; // globals
  165. LPALM lpalmTypes; // Types table
  166. DWORD citd; // Number of types
  167. DWORD * rgitd; // Array of pointers to types
  168. GST gstPublics;
  169. GST gstGlobals;
  170. GST gstStatics;
  171. STAB * pstabUDTSym;
  172. WORD csgd; // Segment Directory
  173. LPSGD lpsgd;
  174. LPSGE lpsge;
  175. DWORD cMod; // Count of modules (count of sstModule should = sstFileIndex.cmodules)
  176. LPB lpefi; // Pointer to raw file index (for freeing)
  177. WORD * rgiulFile; // List of beginning index of module
  178. // file lists.
  179. WORD * rgculFile; // List of counts of module file lists
  180. DWORD * rgichFile; // Index into string table of file names
  181. DWORD cbFileNames; // Number of bytes in string table of file
  182. // names (lpchFileNames)
  183. LPCH lpchFileNames; // String table of file names
  184. DEBUGDATA debugData; // OSDEBUG4 information pdata/omap/fpo
  185. WORD cRef; // Reference count on this image
  186. LPMDS rgMod; // Array of module contributions.
  187. DWORD LoadAddress; // Bass address for this image
  188. DWORD ulTimeStamp; // Timestamp from the image
  189. DWORD ulCheckSum; // Checksum from the image
  190. WidenTi * pwti; // for converting all of this exe's types
  191. // and syms to 32-bit type indices
  192. } EXG; // EXe structure Global
  193. typedef EXG *PEXG;
  194. typedef EXG * LPEXG;
  195. typedef struct _EXE {
  196. HPDS hpds; // PID of process
  197. HEXG hexg;
  198. DWORD timestamp;
  199. DWORD TargetMachine;
  200. BOOL fIsLoaded;
  201. DWORD LoadAddress;
  202. LPDEBUGDATA pDebugData;
  203. } EXE; // EXE struct
  204. typedef EXE *PEXE;
  205. typedef EXE *LPEXE;
  206. typedef struct _LBS {
  207. ADDR addr;
  208. HMOD tagMod;
  209. SYMPTR tagLoc;
  210. SYMPTR tagLab;
  211. SYMPTR tagProc;
  212. SYMPTR tagThunk;
  213. CEXMPTR16 tagModelMin;
  214. CEXMPTR16 tagModelMax;
  215. } LBS; // LaBel Structure ???
  216. typedef LBS *PLBS;
  217. typedef LBS *LPLBS;
  218. #define NEXTSYM(a,b) ((a) (((LPB) (b)) + ((SYMPTR) (b))->reclen + 2))
  219. // New Source Line table handling and maintenance
  220. typedef struct _OFP {
  221. UOFFSET offStart;
  222. UOFFSET offEnd;
  223. } OFP; // OFset Pair -- used to maintain start/end offset pairs
  224. typedef OFP *LPOFP;
  225. typedef struct OPT {
  226. UOFFSET offStart;
  227. LPOFP lpofp;
  228. } OPT; // Offset Pair Table -- used to maintain start/end offset pairs
  229. typedef OPT *LPOPT;
  230. typedef char * (* CONVERTPROC) (HANDLE, char *);
  231. typedef struct _LINECACHE {
  232. HSF hsf;
  233. DWORD wLine;
  234. ADDR addr;
  235. SHOFF cbLn;
  236. DWORD rgw[2];
  237. BOOL fRet;
  238. WORD rgiLn[2];
  239. } LINECACHE;
  240. extern LINECACHE LineCache;
  241. // hexe <--> hmod map cache
  242. typedef struct _MODCACHE {
  243. HMOD hmod;
  244. HEXE hexe;
  245. HPDS hpds;
  246. } MODCACHE;
  247. extern MODCACHE ModCache;
  248. typedef struct _HSFCACHE {
  249. HSF Hsf;
  250. HMOD Hmod;
  251. } HSFCACHE;
  252. extern HSFCACHE HsfCache;
  253. typedef struct _CXTCACHE {
  254. HMOD hmod;
  255. HGRP hgrp;
  256. HEXE hexe;
  257. HPDS hpds;
  258. WORD seg;
  259. UOFFSET uoffBase;
  260. UOFFSET uoffLim;
  261. } CXTCACHE;
  262. extern CXTCACHE CxtCache;
  263. typedef struct _SLCACHE {
  264. char szFile[ _MAX_CVPATH ];
  265. HEXE hexe;
  266. HMOD hmod;
  267. WORD line;
  268. LPSLP lpslp;
  269. int cslp;
  270. } SLCACHE;
  271. extern SLCACHE SlCache;
  272. typedef struct _ADDRCACHE {
  273. ADDR addr;
  274. DWORD wLine;
  275. int cb;
  276. } ADDRCACHE;
  277. extern ADDRCACHE AddrCache;
  278. //
  279. // Matching criteria for DLL list
  280. //
  281. typedef enum _MATCH_CRIT {
  282. MATCH_FULLPATH, // Match full path
  283. MATCH_FILENAME, // Match filename
  284. MATCH_BASENAME // Match base name (no extension)
  285. } MATCH_CRIT;
  286. #if 0
  287. INT FHOpen (LSZ);
  288. #define FHRead(fh,lpb,cb) (SYReadFar(fh, lpb, cb))
  289. #define FHClose(fh)
  290. #define FHSeek(fh,ib) (SYSeek(fh, ib, SEEK_SET))
  291. #define SYError() assert(FALSE)
  292. #endif
  293. #define cbAlign 0x1000
  294. #define cbAlignType 0xC000
  295. #endif // _SAPI_INCLUDED_