Windows NT 4.0 source code leak
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.

162 lines
5.3 KiB

4 years ago
  1. // Debug Information API
  2. // VC++4.0 Read-Only OEM Edition
  3. // Copyright (C) 1993-1995, Microsoft Corp. All Rights Reserved.
  4. #ifndef __DBI_INCLUDED__
  5. #define __DBI_INCLUDED__
  6. #include <windef.h> // for BOOL, BYTE, ULONG, USHORT
  7. #ifndef _CV_INFO_INCLUDED
  8. # include <cvinfo.h>
  9. #endif
  10. #include <stdlib.h>
  11. typedef ULONG INTV; // interface version number
  12. typedef ULONG IMPV; // implementation version number
  13. typedef ULONG SIG; // unique (across PDB instances) signature
  14. typedef ULONG AGE; // no. of times this instance has been updated
  15. typedef BYTE* PB; // pointer to some bytes
  16. typedef LONG CB; // count of bytes
  17. typedef char* SZ; // zero terminated string
  18. typedef char* PCH; // char ptr
  19. typedef USHORT IFILE; // file index
  20. typedef USHORT IMOD; // module index
  21. typedef USHORT ISECT; // section index
  22. typedef USHORT LINE; // line number
  23. typedef LONG OFF; // offset
  24. enum { PreDolphinIntv = 920924, DolphinIntv = 19940309 };
  25. typedef CV_typ_t TI; // type index
  26. struct PDB; // program database
  27. struct DBI; // debug information within the PDB
  28. struct Mod; // a module within the DBI
  29. struct TPI; // type info within the DBI
  30. struct GSI;
  31. typedef struct PDB PDB;
  32. typedef struct DBI DBI;
  33. typedef struct Mod Mod;
  34. typedef struct TPI TPI;
  35. typedef struct GSI GSI;
  36. typedef long EC; // error code
  37. enum PDBErrors {
  38. EC_OK, // -, no problemo
  39. EC_USAGE, // -, invalid parameter or call order
  40. EC_OUT_OF_MEMORY, // -, out of RAM
  41. EC_FILE_SYSTEM, // "pdb name", can't write file, out of disk, etc.
  42. EC_NOT_FOUND, // "pdb name", PDB file not found
  43. EC_INVALID_SIG, // "pdb name", PDB::OpenValidate() and its clients only
  44. EC_INVALID_AGE, // "pdb name", PDB::OpenValidate() and its clients only
  45. EC_PRECOMP_REQUIRED, // "obj name", Mod::AddTypes() only
  46. EC_OUT_OF_TI, // "pdb name", TPI::QueryTiForCVRecord() only
  47. EC_NOT_IMPLEMENTED, // -
  48. EC_V1_PDB, // "pdb name", PDB::Open* only
  49. EC_FORMAT, // accessing pdb with obsolete format
  50. EC_LIMIT,
  51. EC_CORRUPT, // cv info corrupt, recompile mod
  52. EC_MAX
  53. };
  54. #define cbErrMax 1024 /* max. length of error message */
  55. #ifndef PDBCALL
  56. #define PDBCALL __cdecl
  57. #endif
  58. #define PDB_IMPORT_EXPORT(RTYPE) __declspec(dllimport) RTYPE PDBCALL
  59. #define PDBAPI PDB_IMPORT_EXPORT
  60. #define IN /* in parameter, parameters are IN by default */
  61. #define OUT /* out parameter */
  62. // ANSI C Binding
  63. #if __cplusplus
  64. extern "C" {
  65. #endif
  66. PDBAPI( BOOL )
  67. PDBOpenValidate(
  68. SZ szPDB,
  69. SZ szExeDir,
  70. SZ szMode,
  71. SIG sig,
  72. AGE age,
  73. OUT EC* pec,
  74. OUT char szError[cbErrMax],
  75. OUT PDB** pppdb);
  76. PDBAPI( BOOL )
  77. PDBOpen(
  78. SZ szPDB,
  79. SZ szMode,
  80. SIG sigInitial,
  81. OUT EC* pec,
  82. OUT char szError[cbErrMax],
  83. OUT PDB** pppdb);
  84. // a dbi client should never call PDBExportValidateInterface directly - use PDBValidateInterface
  85. PDBAPI( BOOL )
  86. PDBExportValidateInterface(
  87. INTV intv);
  88. __inline BOOL PDBValidateInterface()
  89. {
  90. return PDBExportValidateInterface(PreDolphinIntv);
  91. }
  92. PDBAPI( EC ) PDBQueryLastError(PDB* ppdb, OUT char szError[cbErrMax]);
  93. PDBAPI( INTV ) PDBQueryInterfaceVersion(PDB* ppdb);
  94. PDBAPI( IMPV ) PDBQueryImplementationVersion(PDB* ppdb);
  95. PDBAPI( SZ ) PDBQueryPDBName(PDB* ppdb, OUT char szPDB[_MAX_PATH]);
  96. PDBAPI( SIG ) PDBQuerySignature(PDB* ppdb);
  97. PDBAPI( AGE ) PDBQueryAge(PDB* ppdb);
  98. PDBAPI( BOOL ) PDBOpenDBI(PDB* ppdb, SZ szMode, SZ szTarget, OUT DBI** ppdbi);
  99. PDBAPI( BOOL ) PDBOpenTpi(PDB* ppdb, SZ szMode, OUT TPI** pptpi);
  100. PDBAPI( BOOL ) PDBClose(PDB* ppdb);
  101. PDBAPI( BOOL ) DBIOpenMod(DBI* pdbi, SZ szModule, SZ szFile, OUT Mod** ppmod);
  102. PDBAPI( BOOL ) DBIQueryNextMod(DBI* pdbi, Mod* pmod, Mod** ppmodNext);
  103. PDBAPI( BOOL ) DBIOpenGlobals(DBI* pdbi, OUT GSI **ppgsi);
  104. PDBAPI( BOOL ) DBIOpenPublics(DBI* pdbi, OUT GSI **ppgsi);
  105. PDBAPI( BOOL ) DBIQueryModFromAddr(DBI* pdbi, ISECT isect, OFF off, OUT Mod** ppmod, OUT ISECT* pisect, OUT OFF* poff, OUT CB* pcb);
  106. PDBAPI( BOOL ) DBIQuerySecMap(DBI* pdbi, OUT PB pb, CB* pcb);
  107. PDBAPI( BOOL ) DBIQueryFileInfo(DBI* pdbi, OUT PB pb, CB* pcb);
  108. PDBAPI( BOOL ) DBIClose(DBI* pdbi);
  109. PDBAPI( BOOL ) ModQueryCBName(Mod* pmod, OUT CB* pcb);
  110. PDBAPI( BOOL ) ModQueryName(Mod* pmod, OUT char szName[_MAX_PATH], OUT CB* pcb);
  111. PDBAPI( BOOL ) ModQuerySymbols(Mod* pmod, PB pbSym, CB* pcb);
  112. PDBAPI( BOOL ) ModQueryLines(Mod* pmod, PB pbLines, CB* pcb);
  113. PDBAPI( BOOL ) ModSetPvClient(Mod* pmod, void *pvClient);
  114. PDBAPI( BOOL ) ModGetPvClient(Mod* pmod, OUT void** ppvClient);
  115. PDBAPI( BOOL ) ModQuerySecContrib(Mod* pmod, OUT ISECT* pisect, OUT OFF* poff, OUT CB* pcb, OUT ULONG* pdwCharacteristics);
  116. PDBAPI( BOOL ) ModQueryImod(Mod* pmod, OUT IMOD* pimod);
  117. PDBAPI( BOOL ) ModQueryDBI(Mod* pmod, OUT DBI** ppdbi);
  118. PDBAPI( BOOL ) ModClose(Mod* pmod);
  119. PDBAPI( BOOL ) TypesQueryCVRecordForTi(TPI* ptpi, TI ti, OUT PB pb, IN OUT CB* pcb);
  120. PDBAPI( BOOL ) TypesQueryPbCVRecordForTi(TPI* ptpi, TI ti, OUT PB* ppb);
  121. PDBAPI( TI ) TypesQueryTiMin(TPI* ptpi);
  122. PDBAPI( TI ) TypesQueryTiMac(TPI* ptpi);
  123. PDBAPI( CB ) TypesQueryCb(TPI* ptpi);
  124. PDBAPI( BOOL ) TypesClose(TPI* ptpi);
  125. PDBAPI( PB ) GSINextSym (GSI* pgsi, PB pbSym);
  126. PDBAPI( PB ) GSIHashSym (GSI* pgsi, SZ szName, PB pbSym);
  127. PDBAPI( PB ) GSINearestSym (GSI* pgsi, ISECT isect, OFF off,OUT OFF* pdisp);//currently only supported for publics
  128. PDBAPI( BOOL ) GSIClose(GSI* pgsi);
  129. #if __cplusplus
  130. };
  131. #endif
  132. #define tsNil ((TPI*)0)
  133. #define tiNil ((TI)0)
  134. #define imodNil ((IMOD)(-1))
  135. #define pdbRead "r"
  136. #endif // __DBI_INCLUDED__