Leaked source code of windows server 2003
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.

1618 lines
58 KiB

  1. // Debug Information API
  2. // Copyright (C) 1993-1996, Microsoft Corp. All Rights Reserved.
  3. #pragma once
  4. #ifndef _VC_VER_INC
  5. #include "..\include\vcver.h"
  6. #endif
  7. #ifndef __PDB_INCLUDED__
  8. #define __PDB_INCLUDED__
  9. typedef int BOOL;
  10. typedef unsigned UINT;
  11. typedef unsigned char BYTE;
  12. typedef unsigned short WORD;
  13. typedef unsigned long DWORD;
  14. typedef unsigned __int64 DWORDLONG;
  15. typedef unsigned short USHORT;
  16. typedef unsigned long ULONG;
  17. typedef ULONG INTV; // interface version number
  18. typedef ULONG IMPV; // implementation version number
  19. typedef ULONG SIG; // unique (across PDB instances) signature
  20. typedef ULONG AGE; // no. of times this instance has been updated
  21. typedef const char* SZ_CONST; // const string
  22. typedef void * PV;
  23. typedef const void * PCV;
  24. #ifdef LNGNM
  25. #define LNGNM_CONST const
  26. #else // LNGNM
  27. #define LNGNM_CONST
  28. #endif // LNGNM
  29. #ifndef GUID_DEFINED
  30. #define GUID_DEFINED
  31. typedef struct _GUID { // size is 16
  32. DWORD Data1;
  33. WORD Data2;
  34. WORD Data3;
  35. BYTE Data4[8];
  36. } GUID;
  37. #endif // !GUID_DEFINED
  38. #ifndef _HRESULT_DEFINED
  39. #define _HRESULT_DEFINED
  40. typedef long HRESULT;
  41. #endif // !_HRESULT_DEFINED
  42. typedef GUID SIG70; // new to 7.0 are 16-byte guid-like signatures
  43. typedef SIG70 * PSIG70;
  44. typedef const SIG70 * PCSIG70;
  45. #ifndef _WCHAR_T_DEFINED
  46. typedef unsigned short wchar_t;
  47. #define _WCHAR_T_DEFINED
  48. #endif
  49. enum {
  50. #ifdef LNGNM
  51. PDBIntv70 = 20001102,
  52. PDBIntv70Dep = 20000406,
  53. #else
  54. PDBIntv70 = 20000301,
  55. #endif
  56. PDBIntv69 = 19990511,
  57. PDBIntv61 = 19980914,
  58. PDBIntv50a = 19970116,
  59. PDBIntv60 = PDBIntv50a,
  60. PDBIntv50 = 19960502,
  61. PDBIntv41 = 920924,
  62. #ifdef LNGNM
  63. PDBIntv = PDBIntv70, // Now we support both 50 & 60, 69 is only an intermediate version
  64. PDBIntvAlt = PDBIntv50,
  65. PDBIntvAlt2 = PDBIntv60,
  66. PDBIntvAlt3 = PDBIntv69,
  67. #else
  68. PDBIntvAlt = PDBIntv50, // Alternate (backward compatible) supported interface
  69. PDBIntvAlt2 = PDBIntv60, // Alternate (backward compatible) supported interface
  70. PDBIntvAlt3 = PDBIntv61,
  71. PDBIntv = PDBIntv69,
  72. #endif
  73. };
  74. enum {
  75. PDBImpvVC2 = 19941610,
  76. PDBImpvVC4 = 19950623,
  77. PDBImpvVC41 = 19950814,
  78. PDBImpvVC50 = 19960307,
  79. PDBImpvVC98 = 19970604,
  80. PDBImpvVC70 = 20000404,
  81. PDBImpvVC70Dep = 19990604, // deprecated vc70 implementation version
  82. #ifdef LNGNM
  83. PDBImpv = PDBImpvVC70,
  84. #else
  85. PDBImpv = PDBImpvVC98,
  86. #endif
  87. };
  88. enum {
  89. niNil = 0,
  90. PDB_MAX_PATH = 260,
  91. cbErrMax = 1024,
  92. };
  93. // cvinfo.h type index, intentionally typedef'ed here to check equivalence.
  94. typedef unsigned short CV_typ16_t;
  95. typedef unsigned long CV_typ_t;
  96. typedef unsigned long CV_pubsymflag_t; // must be same as CV_typ_t.
  97. typedef CV_typ_t TI; // PDB name for type index
  98. typedef CV_typ16_t TI16; // 16-bit version
  99. typedef unsigned long NI; // name index
  100. typedef TI * PTi;
  101. typedef TI16 * PTi16;
  102. typedef BYTE ITSM; // type server map index
  103. typedef ITSM* PITSM;
  104. typedef BOOL (__stdcall *PFNVALIDATEDEBUGINFOFILE) (const char * szFile, ULONG * errcode );
  105. typedef struct _tagSEARCHDEBUGINFO {
  106. DWORD cb; // doubles as version detection
  107. BOOL fMainDebugFile; // indicates "core" or "ancilliary" file
  108. // eg: main.exe has main.pdb and foo.lib->foo.pdb
  109. char * szMod; // exe/dll
  110. char * szLib; // lib if appropriate
  111. char * szObj; // object file
  112. char * *rgszTriedThese; // list of ones that were tried,
  113. // NULL terminated list of LSZ's
  114. char szValidatedFile[PDB_MAX_PATH];// output of validated filename,
  115. PFNVALIDATEDEBUGINFOFILE
  116. pfnValidateDebugInfoFile; // validation function
  117. char * szExe; // exe/dll
  118. } SEARCHDEBUGINFO, *PSEARCHDEBUGINFO;
  119. typedef BOOL ( __stdcall * PfnFindDebugInfoFile) ( PSEARCHDEBUGINFO );
  120. #define PdbInterface struct
  121. PdbInterface PDB; // program database
  122. PdbInterface DBI; // debug information within the PDB
  123. PdbInterface Mod; // a module within the DBI
  124. PdbInterface TPI; // type info within the DBI
  125. PdbInterface GSI; // global symbol info
  126. PdbInterface SO;
  127. PdbInterface Stream; // some named bytestream in the PDB
  128. PdbInterface StreamImage; // some memory mapped stream
  129. PdbInterface NameMap; // name mapping
  130. PdbInterface Enum; // generic enumerator
  131. PdbInterface EnumNameMap; // enumerate names within a NameMap
  132. PdbInterface EnumContrib; // enumerate contributions
  133. PdbInterface Dbg; // misc debug data (FPO, OMAP, etc)
  134. PdbInterface Src; // Src file data
  135. PdbInterface EnumSrc; // Src file enumerator
  136. PdbInterface SrcHash; // Src file hasher
  137. PdbInterface EnumLines;
  138. typedef PdbInterface PDB PDB;
  139. typedef PdbInterface DBI DBI;
  140. typedef PdbInterface Mod Mod;
  141. typedef PdbInterface TPI TPI;
  142. typedef PdbInterface GSI GSI;
  143. typedef PdbInterface SO SO;
  144. typedef PdbInterface Stream Stream;
  145. typedef PdbInterface StreamImage StreamImage;
  146. typedef PdbInterface NameMap NameMap;
  147. typedef PdbInterface Enum Enum;
  148. typedef PdbInterface EnumStreamNames EnumStreamNames;
  149. typedef PdbInterface EnumNameMap EnumNameMap;
  150. typedef PdbInterface EnumContrib EnumContrib;
  151. typedef PdbInterface EnumSyms EnumSyms;
  152. typedef PdbInterface WidenTi WidenTi;
  153. typedef PdbInterface Dbg Dbg;
  154. typedef PdbInterface EnumThunk EnumThunk;
  155. typedef PdbInterface Src Src;
  156. typedef PdbInterface EnumSrc EnumSrc;
  157. typedef PdbInterface SrcHash SrcHash;
  158. typedef SrcHash * PSrcHash;
  159. typedef long EC; // error code
  160. enum PDBErrors {
  161. EC_OK, // -, no problemo
  162. EC_USAGE, // -, invalid parameter or call order
  163. EC_OUT_OF_MEMORY, // -, out of RAM
  164. EC_FILE_SYSTEM, // "pdb name", can't write file, out of disk, etc.
  165. EC_NOT_FOUND, // "pdb name", PDB file not found
  166. EC_INVALID_SIG, // "pdb name", PDB::OpenValidate() and its clients only
  167. EC_INVALID_AGE, // "pdb name", PDB::OpenValidate() and its clients only
  168. EC_PRECOMP_REQUIRED, // "obj name", Mod::AddTypes() only
  169. EC_OUT_OF_TI, // "pdb name", TPI::QueryTiForCVRecord() only
  170. EC_NOT_IMPLEMENTED, // -
  171. EC_V1_PDB, // "pdb name", PDB::Open* only
  172. EC_FORMAT, // accessing pdb with obsolete format
  173. EC_LIMIT,
  174. EC_CORRUPT, // cv info corrupt, recompile mod
  175. EC_TI16, // no 16-bit type interface present
  176. EC_ACCESS_DENIED, // "pdb name", PDB file read-only
  177. EC_ILLEGAL_TYPE_EDIT, // trying to edit types in read-only mode
  178. EC_INVALID_EXECUTABLE, // not recogized as a valid executable
  179. EC_DBG_NOT_FOUND, // A required .DBG file was not found
  180. EC_NO_DEBUG_INFO, // No recognized debug info found
  181. EC_INVALID_EXE_TIMESTAMP, // Invalid timestamp on Openvalidate of exe
  182. EC_CORRUPT_TYPEPOOL, // A corrupted type record was found in a PDB
  183. EC_DEBUG_INFO_NOT_IN_PDB, // returned by OpenValidateX
  184. EC_MAX
  185. };
  186. #if !defined(pure)
  187. #define pure = 0
  188. #endif
  189. #ifndef PDBCALL
  190. #define PDBCALL __cdecl
  191. #endif
  192. #ifdef PDB_SERVER
  193. #define PDB_IMPORT_EXPORT(RTYPE) __declspec(dllexport) RTYPE PDBCALL
  194. #elif defined(PDB_LIBRARY)
  195. #define PDB_IMPORT_EXPORT(RTYPE) RTYPE PDBCALL
  196. #else
  197. #define PDB_IMPORT_EXPORT(RTYPE) __declspec(dllimport) RTYPE PDBCALL
  198. #endif
  199. #define PDBAPI PDB_IMPORT_EXPORT
  200. #ifndef IN
  201. #define IN /* in parameter, parameters are IN by default */
  202. #endif
  203. #ifndef OUT
  204. #define OUT /* out parameter */
  205. #endif
  206. // Type of callback arg to PDB::OpenValidate5
  207. enum POVC
  208. {
  209. povcNotifyDebugDir,
  210. povcNotifyOpenDBG,
  211. povcNotifyOpenPDB,
  212. povcReserved,
  213. povcReadExecutableAt,
  214. povcReadExecutableAtRVA,
  215. povcRestrictRegistry,
  216. povcRestrictSymsrv,
  217. povcRestrictSystemRoot,
  218. povcNotifyMiscPath,
  219. povcReadMiscDebugData,
  220. povcReadCodeViewDebugData,
  221. povcRestrictOriginalPath,
  222. povcRestrictReferencePath,
  223. povcRestrictDBG
  224. };
  225. typedef int (PDBCALL *PDBCALLBACK)();
  226. typedef PDBCALLBACK (PDBCALL *PfnPDBQueryCallback)(void *pvClient, enum POVC povc);
  227. typedef void (PDBCALL *PfnPDBNotifyDebugDir)(void *pvClient, BOOL fExecutable, const struct _IMAGE_DEBUG_DIRECTORY *pdbgdir);
  228. typedef void (PDBCALL *PfnPDBNotifyOpenDBG)(void *pvClient, const wchar_t *wszDbgPath, enum PDBErrors ec, const wchar_t *wszError);
  229. typedef void (PDBCALL *PfnPDBNotifyOpenPDB)(void *pvClient, const wchar_t *wszPdbPath, enum PDBErrors ec, const wchar_t *wszError);
  230. typedef HRESULT (PDBCALL *PfnPDBReadExecutableAt)(void *pvClient, DWORDLONG fo, DWORD cb, void *pv);
  231. typedef HRESULT (PDBCALL *PfnPDBReadExecutableAtRVA)(void *pvClient, DWORD rva, DWORD cb, void *pv);
  232. typedef HRESULT (PDBCALL *PfnPDBRestrictRegistry)(void *pvClient);
  233. typedef HRESULT (PDBCALL *PfnPDBRestrictSymsrv)(void *pvClient);
  234. typedef HRESULT (PDBCALL *PfnPDBRestrictSystemRoot)(void *pvClient);
  235. typedef void (PDBCALL *PfnPDBNotifyMiscPath)(void *pvClient, const wchar_t *wszMiscPath);
  236. typedef HRESULT (PDBCALL *PfnPDBReadCodeViewDebugData)(void *pvClient, DWORD *pcb, void *pv);
  237. typedef HRESULT (PDBCALL *PfnPDBReadMiscDebugData)(void *pvClient, DWORD *pdwTimeStampExe, DWORD *pdwTimeStampDbg, DWORD *pdwSizeOfImage, DWORD *pcb, void *pv);
  238. typedef HRESULT (PDBCALL *PfnPdbRestrictOriginalPath)(void *pvClient);
  239. typedef HRESULT (PDBCALL *PfnPdbRestrictReferencePath)(void *pvClient);
  240. typedef HRESULT (PDBCALL *PfnPdbRestrictDBG) (void *pvClient);
  241. // type of callback arg to PDB::GetRawBytes
  242. typedef BOOL (PDBCALL *PFNfReadPDBRawBytes)(const void *, long);
  243. // WidenTi interface needs a couple of structures to communicate info back
  244. // and forth.
  245. struct OffMap {
  246. ULONG offOld;
  247. ULONG offNew;
  248. };
  249. typedef struct OffMap OffMap;
  250. typedef OffMap * POffMap;
  251. struct SymConvertInfo {
  252. ULONG cbSyms; // size necessary for converting a block
  253. ULONG cSyms; // count of symbols, necessary to allocate
  254. // mpoffOldoffNew array.
  255. BYTE * pbSyms; // block of symbols (output side)
  256. OffMap * rgOffMap; // OffMap rgOffMap[cSyms]
  257. };
  258. typedef struct SymConvertInfo SymConvertInfo;
  259. enum { wtiSymsNB09 = 0, wtiSymsNB10 = 1 };
  260. // Filter values for PDBCopyTo
  261. enum {
  262. copyRemovePrivate = 0x00000001, // remove private debug information
  263. copyCreateNewSig = 0x00000002, // create new signature for target pdb
  264. };
  265. // PDBCopy callback signatures and function pointer types for PDB::CopyTo2 and CopyToW2
  266. //
  267. enum PCC {
  268. pccFilterPublics,
  269. };
  270. #if !defined(__cplusplus)
  271. typedef enum PCC PCC;
  272. #endif // __cplusplus
  273. typedef BOOL (PDBCALL *PDBCOPYCALLBACK)();
  274. typedef PDBCOPYCALLBACK (PDBCALL *PfnPDBCopyQueryCallback)(void *pvClientContext, PCC pcc);
  275. // Return (true, pszNewPublic==NULL) to keep the name as is,
  276. // (true, pszNewPublic!=NULL) changes name to pszNewPublic,
  277. // false to discard public entirely.
  278. //
  279. typedef BOOL (PDBCALL *PfnPDBCopyFilterPublics)(
  280. void * pvClientContext,
  281. DWORD dwFilterFlags,
  282. unsigned int offPublic,
  283. unsigned int sectPublic,
  284. unsigned int grfPublic, // see cvinfo.h, definition of CV_PUBSYMFLAGS_e and
  285. // CV_PUBSYMFLAGS give the format of this bitfield.
  286. const wchar_t * szPublic,
  287. wchar_t ** pszNewPublic
  288. );
  289. enum DBGTYPE {
  290. dbgtypeFPO,
  291. dbgtypeException, // deprecated
  292. dbgtypeFixup,
  293. dbgtypeOmapToSrc,
  294. dbgtypeOmapFromSrc,
  295. dbgtypeSectionHdr,
  296. #if !defined(VER60)
  297. dbgtypeTokenRidMap,
  298. dbgtypeXdata,
  299. dbgtypePdata,
  300. dbgtypeNewFPO,
  301. dbgtypeSectionHdrOrig,
  302. #endif
  303. dbgtypeMax // must be last!
  304. };
  305. typedef enum DBGTYPE DBGTYPE;
  306. // We add a slight bit of structure to dbg blobs so we can record extra
  307. // relevant information there. Generally, the blobs are lifted right out
  308. // of an image, and need some extra info anyway. In the case of Xdata, we
  309. // store RVA base of the Xdata there. This is used to interpret the
  310. // UnwindInfoAddress RVA in the IA64 Pdata entries.
  311. //
  312. enum VerDataBlob {
  313. vdbOne = 1,
  314. vdbXdataCur = vdbOne,
  315. vdbPdataCur = vdbOne,
  316. };
  317. // default blob header
  318. //
  319. typedef struct DbgBlob {
  320. ULONG ver;
  321. ULONG cbHdr;
  322. ULONG cbData;
  323. //BYTE rgbDataBlob[]; // Data follows, but to enable simple embedding,
  324. // don't use a zero-sized array here.
  325. } DbgBlob;
  326. // "store rva of the base and va of image base" blob header
  327. //
  328. typedef struct DbgRvaVaBlob {
  329. ULONG ver;
  330. ULONG cbHdr;
  331. ULONG cbData;
  332. ULONG rvaDataBase;
  333. DWORDLONG vaImageBase;
  334. ULONG ulReserved1; // reserved, must be 0
  335. ULONG ulReserved2; // reserved, must be 0
  336. //BYTE rgbDataBlob[]; // Data follows, but to enable simple embedding,
  337. // don't use a zero-sized array here.
  338. } DbgRvaVaBlob;
  339. // Linker data necessary for relinking an image. Record contains two SZ strings
  340. // off of the end of the record with two offsets from the base
  341. //
  342. enum VerLinkInfo {
  343. vliOne = 1,
  344. vliTwo = 2,
  345. vliCur = vliTwo,
  346. };
  347. struct LinkInfo {
  348. ULONG cb; // size of the whole record. computed as
  349. // sizeof(LinkInfo) + strlen(szCwd) + 1 +
  350. // strlen(szCommand) + 1
  351. ULONG ver; // version of this record (VerLinkInfo)
  352. ULONG offszCwd; // offset from base of this record to szCwd
  353. ULONG offszCommand; // offset from base of this record
  354. ULONG ichOutfile; // index of start of output file in szCommand
  355. ULONG offszLibs; // offset from base of this record to szLibs
  356. // The command includes the full path to the linker, the -re and -out:...
  357. // swithches.
  358. // A sample might look like the following:
  359. // "c:\program files\msdev\bin\link.exe -re -out:debug\foo.exe"
  360. // with ichOutfile being 48.
  361. // the -out switch is guaranteed to be the last item in the command line.
  362. #ifdef __cplusplus
  363. VerLinkInfo Ver() const {
  364. return VerLinkInfo(ver);
  365. }
  366. long Cb() const {
  367. return cb;
  368. }
  369. char * SzCwd() const {
  370. return (char *)((char *)(this) + offszCwd);
  371. }
  372. char * SzCommand() const {
  373. return (char *)((char *)(this) + offszCommand);
  374. }
  375. char * SzOutFile() const {
  376. return SzCommand() + ichOutfile;
  377. }
  378. LinkInfo() :
  379. cb(0), ver(vliCur), offszCwd(0), offszCommand(0), ichOutfile(0)
  380. {
  381. }
  382. char * SzLibs() const {
  383. return (char *)((char *)(this) + offszLibs);
  384. }
  385. #endif
  386. };
  387. #ifdef LNGNM
  388. #ifdef __cplusplus
  389. struct LinkInfoW : public LinkInfo
  390. {
  391. wchar_t* SzCwdW() const {
  392. return (wchar_t *)((wchar_t *)(this) + offszCwd);
  393. }
  394. wchar_t* SzCommandW() const {
  395. return (wchar_t *)((wchar_t *)(this) + offszCommand);
  396. }
  397. wchar_t* SzOutFileW() const {
  398. return SzCommandW() + ichOutfile;
  399. }
  400. wchar_t* SzLibsW() const {
  401. return (wchar_t *)((wchar_t *)(this) + offszLibs);
  402. }
  403. };
  404. #else
  405. typedef struct LinkInfo LinkInfoW;
  406. #endif // __cplusplus
  407. typedef LinkInfoW * PLinkInfoW;
  408. #endif // LNGNM
  409. typedef struct LinkInfo LinkInfo;
  410. typedef LinkInfo * PLinkInfo;
  411. //
  412. // Source (Src) info
  413. //
  414. // This is the source file server for virtual and real source code.
  415. // It is structured as an index on the object file name concatenated
  416. // with
  417. enum SrcVer {
  418. srcverOne = 19980827,
  419. };
  420. enum SrcCompress {
  421. srccompressNone,
  422. srccompressRLE,
  423. srccompressHuffman,
  424. srccompressLZ,
  425. };
  426. #ifdef LNGNM
  427. struct tagSrcHeader {
  428. #else
  429. struct SrcHeader {
  430. #endif
  431. unsigned long cb; // record length
  432. unsigned long ver; // header version
  433. unsigned long sig; // CRC of the data for uniqueness w/o full compare
  434. unsigned long cbSource; // count of bytes of the resulting source
  435. unsigned char srccompress;// compression algorithm used
  436. union {
  437. unsigned char grFlags;
  438. struct {
  439. unsigned char fVirtual : 1; // file is a virtual file (injected)
  440. unsigned char pad : 7; // must be zero
  441. };
  442. };
  443. #ifndef LNGNM
  444. unsigned char szNames[1]; // file names (szFile "\0" szObj "\0" szVirtual,
  445. // as in: "f.cpp" "\0" "f.obj" "\0" "*inj:1:f.obj")
  446. // in the case of non-virtual files, szVirtual is
  447. // the same as szFile.
  448. #endif
  449. };
  450. #ifdef LNGNM
  451. struct SrcHeader : public tagSrcHeader
  452. {
  453. unsigned char szNames[1]; // see comment above
  454. };
  455. struct SrcHeaderW : public tagSrcHeader
  456. {
  457. wchar_t szNames[1]; // see comment above
  458. };
  459. typedef struct SrcHeaderW SrcHeaderW;
  460. typedef SrcHeaderW * PSrcHeaderW;
  461. typedef const SrcHeaderW * PCSrcHeaderW;
  462. //cassert(offsetof(SrcHeader,szNames) == sizeof(tagSrcHeader));
  463. //cassert(offsetof(SrcHeaderW,szNames) == sizeof(tagSrcHeader));
  464. #endif // LNGNM
  465. typedef struct SrcHeader SrcHeader;
  466. typedef SrcHeader * PSrcHeader;
  467. typedef const SrcHeader * PCSrcHeader;
  468. // header used for storing the info and for output to clients who are reading
  469. //
  470. struct SrcHeaderOut {
  471. unsigned long cb; // record length
  472. unsigned long ver; // header version
  473. unsigned long sig; // CRC of the data for uniqueness w/o full compare
  474. unsigned long cbSource; // count of bytes of the resulting source
  475. unsigned long niFile;
  476. unsigned long niObj;
  477. unsigned long niVirt;
  478. unsigned char srccompress;// compression algorithm used
  479. union {
  480. unsigned char grFlags;
  481. struct {
  482. unsigned char fVirtual : 1; // file is a virtual file (injected)
  483. unsigned char pad : 7; // must be zero
  484. };
  485. };
  486. short sPad;
  487. union {
  488. void * pvReserved1;
  489. __int64 pv64Reserved2;
  490. };
  491. };
  492. typedef struct SrcHeaderOut SrcHeaderOut;
  493. typedef SrcHeaderOut * PSrcHeaderOut;
  494. typedef const SrcHeaderOut *PCSrcHeaderOut;
  495. struct SrcHeaderBlock {
  496. __int32 ver;
  497. __int32 cb;
  498. struct {
  499. DWORD dwLowDateTime;
  500. DWORD dwHighDateTime;
  501. } ft;
  502. __int32 age;
  503. BYTE rgbPad[44];
  504. };
  505. typedef struct SrcHeaderBlock SrcHeaderBlock;
  506. #ifdef __cplusplus
  507. struct IStream;
  508. // C++ Binding
  509. PdbInterface PDB { // program database
  510. enum {
  511. intv = PDBIntv,
  512. #if defined(LNGNM)
  513. intvVC70Dep = PDBIntv70Dep, // deprecated
  514. #endif
  515. intvAlt = PDBIntvAlt,
  516. intvAlt2 = PDBIntvAlt2,
  517. intvAlt3 = PDBIntvAlt3,
  518. };
  519. static PDBAPI(BOOL)
  520. OpenValidate(
  521. LNGNM_CONST char *szPDB,
  522. LNGNM_CONST char *szPath,
  523. LNGNM_CONST char *szMode,
  524. SIG sig,
  525. AGE age,
  526. OUT EC* pec,
  527. OUT char szError[cbErrMax],
  528. OUT PDB **pppdb);
  529. static PDBAPI(BOOL)
  530. OpenValidateEx(
  531. LNGNM_CONST char *szPDB,
  532. LNGNM_CONST char *szPathOrig,
  533. LNGNM_CONST char *szSearchPath,
  534. LNGNM_CONST char *szMode,
  535. SIG sig,
  536. AGE age,
  537. OUT EC *pec,
  538. OUT char szError[cbErrMax],
  539. OUT PDB **pppdb);
  540. static PDBAPI(BOOL)
  541. Open(
  542. LNGNM_CONST char *szPDB,
  543. LNGNM_CONST char *szMode,
  544. SIG sigInitial,
  545. OUT EC *pec,
  546. OUT char szError[cbErrMax],
  547. OUT PDB **pppdb);
  548. static PDBAPI(BOOL)
  549. OpenValidate2(
  550. LNGNM_CONST char *szPDB,
  551. LNGNM_CONST char *szPath,
  552. LNGNM_CONST char *szMode,
  553. SIG sig,
  554. AGE age,
  555. long cbPage,
  556. OUT EC *pec,
  557. OUT char szError[cbErrMax],
  558. OUT PDB **pppdb);
  559. static PDBAPI(BOOL)
  560. OpenValidateEx2(
  561. LNGNM_CONST char *szPDB,
  562. LNGNM_CONST char *szPathOrig,
  563. LNGNM_CONST char *szSearchPath,
  564. LNGNM_CONST char *szMode,
  565. SIG sig,
  566. AGE age,
  567. long cbPage,
  568. OUT EC* pec,
  569. OUT char szError[cbErrMax],
  570. OUT PDB **pppdb);
  571. static PDBAPI(BOOL)
  572. OpenEx(
  573. LNGNM_CONST char *szPDB,
  574. LNGNM_CONST char *szMode,
  575. SIG sigInitial,
  576. long cbPage,
  577. OUT EC *pec,
  578. OUT char szError[cbErrMax],
  579. OUT PDB **pppdb);
  580. static PDBAPI(BOOL)
  581. OpenValidate3(
  582. const char *szExecutable,
  583. const char *szSearchPath,
  584. OUT EC *pec,
  585. OUT char szError[cbErrMax],
  586. OUT char szDbgPath[PDB_MAX_PATH],
  587. OUT DWORD *pfo,
  588. OUT DWORD *pcb,
  589. OUT PDB **pppdb);
  590. static PDBAPI(BOOL)
  591. OpenValidate4(
  592. const wchar_t *wszPDB,
  593. const char *szMode,
  594. PCSIG70 pcsig70,
  595. SIG sig,
  596. AGE age,
  597. OUT EC *pec,
  598. OUT wchar_t *wszError,
  599. size_t cchErrMax,
  600. OUT PDB **pppdb);
  601. static PDBAPI(BOOL) OpenInStream(
  602. IStream *pIStream,
  603. const char *szMode,
  604. OUT EC *pec,
  605. OUT wchar_t *wszError,
  606. size_t cchErrMax,
  607. OUT PDB **pppdb);
  608. static PDBAPI(BOOL) ExportValidateInterface(INTV intv);
  609. static PDBAPI(BOOL) ExportValidateImplementation(IMPV impv);
  610. static PDBAPI(IMPV) QueryImplementationVersionStatic();
  611. static PDBAPI(INTV) QueryInterfaceVersionStatic();
  612. virtual INTV QueryInterfaceVersion() pure;
  613. virtual IMPV QueryImplementationVersion() pure;
  614. virtual EC QueryLastError(OUT char szError[cbErrMax]) pure;
  615. virtual char*QueryPDBName(OUT char szPDB[PDB_MAX_PATH]) pure;
  616. virtual SIG QuerySignature() pure;
  617. virtual AGE QueryAge() pure;
  618. virtual BOOL CreateDBI(const char* szTarget, OUT DBI** ppdbi) pure;
  619. virtual BOOL OpenDBI(const char* szTarget, const char* szMode, OUT DBI** ppdbi ) pure;
  620. virtual BOOL OpenTpi(const char* szMode, OUT TPI** pptpi) pure;
  621. virtual BOOL Commit() pure;
  622. virtual BOOL Close() pure;
  623. virtual BOOL OpenStream(const char* szStream, OUT Stream** ppstream) pure;
  624. virtual BOOL GetEnumStreamNameMap(OUT Enum** ppenum) pure;
  625. virtual BOOL GetRawBytes(PFNfReadPDBRawBytes pfnfSnarfRawBytes) pure;
  626. virtual IMPV QueryPdbImplementationVersion() pure;
  627. virtual BOOL OpenDBIEx(const char* szTarget, const char* szMode, OUT DBI** ppdbi, PfnFindDebugInfoFile pfn=0) pure;
  628. virtual BOOL CopyTo(const char *szDst, DWORD dwCopyFilter, DWORD dwReserved) pure;
  629. //
  630. // support for source file data
  631. //
  632. virtual BOOL OpenSrc(OUT Src** ppsrc) pure;
  633. virtual EC QueryLastErrorExW(OUT wchar_t *wszError, size_t cchMax) pure;
  634. virtual wchar_t *QueryPDBNameExW(OUT wchar_t *wszPDB, size_t cchMax) pure;
  635. virtual BOOL QuerySignature2(PSIG70 psig70) pure;
  636. virtual BOOL CopyToW(const wchar_t *szDst, DWORD dwCopyFilter, DWORD dwReserved) pure;
  637. virtual BOOL fIsSZPDB() const pure;
  638. // Implemented only on 7.0 and above versions.
  639. //
  640. virtual BOOL OpenStreamW(const wchar_t * szStream, OUT Stream** ppstream) pure;
  641. // Implemented in both 6.0 and 7.0 builds
  642. virtual BOOL CopyToW2(
  643. const wchar_t * szDst,
  644. DWORD dwCopyFilter,
  645. PfnPDBCopyQueryCallback pfnCallBack,
  646. void * pvClientContext
  647. ) pure;
  648. inline BOOL ValidateInterface()
  649. {
  650. return ExportValidateInterface(intv);
  651. }
  652. static PDBAPI(BOOL)
  653. Open2W(
  654. const wchar_t *wszPDB,
  655. const char *szMode,
  656. OUT EC *pec,
  657. OUT wchar_t *wszError,
  658. size_t cchErrMax,
  659. OUT PDB **pppdb);
  660. static PDBAPI(BOOL)
  661. OpenEx2W(
  662. const wchar_t *wszPDB,
  663. const char *szMode,
  664. long cbPage,
  665. OUT EC *pec,
  666. OUT wchar_t *wszError,
  667. size_t cchErrMax,
  668. OUT PDB **pppdb);
  669. static PDBAPI(BOOL)
  670. OpenValidate5(
  671. const wchar_t *wszExecutable,
  672. const wchar_t *wszSearchPath,
  673. void *pvClient,
  674. PfnPDBQueryCallback pfnQueryCallback,
  675. OUT EC *pec,
  676. OUT wchar_t *wszError,
  677. size_t cchErrMax,
  678. OUT PDB **pppdb);
  679. };
  680. // Review: a stream directory service would be more appropriate
  681. // than Stream::Delete, ...
  682. PdbInterface Stream {
  683. virtual long QueryCb() pure;
  684. virtual BOOL Read(long off, void* pvBuf, long* pcbBuf) pure;
  685. virtual BOOL Write(long off, void* pvBuf, long cbBuf) pure;
  686. virtual BOOL Replace(void* pvBuf, long cbBuf) pure;
  687. virtual BOOL Append(void* pvBuf, long cbBuf) pure;
  688. virtual BOOL Delete() pure;
  689. virtual BOOL Release() pure;
  690. virtual BOOL Read2(long off, void* pvBuf, long cbBuf) pure;
  691. virtual BOOL Truncate(long cb) pure;
  692. };
  693. PdbInterface StreamImage {
  694. static PDBAPI(BOOL) open(Stream* pstream, long cb, OUT StreamImage** ppsi);
  695. virtual long size() pure;
  696. virtual void* base() pure;
  697. virtual BOOL noteRead(long off, long cb, OUT void** ppv) pure;
  698. virtual BOOL noteWrite(long off, long cb, OUT void** ppv) pure;
  699. virtual BOOL writeBack() pure;
  700. virtual BOOL release() pure;
  701. };
  702. PdbInterface DBI { // debug information
  703. enum { intv = PDBIntv };
  704. virtual IMPV QueryImplementationVersion() pure;
  705. virtual INTV QueryInterfaceVersion() pure;
  706. virtual BOOL OpenMod(const char* szModule, const char* szFile, OUT Mod** ppmod) pure;
  707. virtual BOOL DeleteMod(const char* szModule) pure;
  708. virtual BOOL QueryNextMod(Mod* pmod, Mod** ppmodNext) pure;
  709. virtual BOOL OpenGlobals(OUT GSI **ppgsi) pure;
  710. virtual BOOL OpenPublics(OUT GSI **ppgsi) pure;
  711. virtual BOOL AddSec(USHORT isect, USHORT flags, long off, long cb) pure;
  712. #if defined(LNGNM) && (_MSC_VER >= 1300)
  713. //__declspec(deprecated)
  714. #endif
  715. virtual BOOL QueryModFromAddr(USHORT isect, long off, OUT Mod** ppmod,
  716. OUT USHORT* pisect, OUT long* poff, OUT long* pcb) pure;
  717. virtual BOOL QuerySecMap(OUT BYTE* pb, long* pcb) pure;
  718. virtual BOOL QueryFileInfo(OUT BYTE* pb, long* pcb) pure;
  719. virtual void DumpMods() pure;
  720. virtual void DumpSecContribs() pure;
  721. virtual void DumpSecMap() pure;
  722. virtual BOOL Close() pure;
  723. virtual BOOL AddThunkMap(long* poffThunkMap, unsigned nThunks, long cbSizeOfThunk,
  724. struct SO* psoSectMap, unsigned nSects,
  725. USHORT isectThunkTable, long offThunkTable) pure;
  726. virtual BOOL AddPublic(const char* szPublic, USHORT isect, long off) pure;
  727. virtual BOOL getEnumContrib(OUT Enum** ppenum) pure;
  728. virtual BOOL QueryTypeServer( ITSM itsm, OUT TPI** pptpi ) pure;
  729. virtual BOOL QueryItsmForTi( TI ti, OUT ITSM* pitsm ) pure;
  730. virtual BOOL QueryNextItsm( ITSM itsm, OUT ITSM *inext ) pure;
  731. virtual BOOL QueryLazyTypes() pure;
  732. virtual BOOL SetLazyTypes( BOOL fLazy ) pure; // lazy is default and can only be turned off
  733. virtual BOOL FindTypeServers( OUT EC* pec, OUT char szError[cbErrMax] ) pure;
  734. virtual void DumpTypeServers() pure;
  735. virtual BOOL OpenDbg(DBGTYPE dbgtype, OUT Dbg **ppdbg) pure;
  736. virtual BOOL QueryDbgTypes(OUT DBGTYPE *pdbgtype, OUT long* pcDbgtype) pure;
  737. // apis to support EnC work
  738. virtual BOOL QueryAddrForSec(OUT USHORT* pisect, OUT long* poff,
  739. USHORT imod, long cb, DWORD dwDataCrc, DWORD dwRelocCrc) pure;
  740. virtual BOOL QuerySupportsEC() pure;
  741. virtual BOOL QueryPdb( OUT PDB** pppdb ) pure;
  742. virtual BOOL AddLinkInfo(IN PLinkInfo ) pure;
  743. virtual BOOL QueryLinkInfo(PLinkInfo, OUT long * pcb) pure;
  744. // new to vc6
  745. virtual AGE QueryAge() const pure;
  746. virtual void * QueryHeader() const pure;
  747. virtual void FlushTypeServers() pure;
  748. virtual BOOL QueryTypeServerByPdb(const char* szPdb, OUT ITSM* pitsm) pure;
  749. #ifdef LNGNM // Long filename support
  750. virtual BOOL OpenModW(const wchar_t* szModule, const wchar_t* szFile, OUT Mod** ppmod) pure;
  751. virtual BOOL DeleteModW(const wchar_t* szModule) pure;
  752. virtual BOOL AddPublicW(const wchar_t* szPublic, USHORT isect, long off, CV_pubsymflag_t cvpsf =0) pure;
  753. virtual BOOL QueryTypeServerByPdbW( const wchar_t* szPdb, OUT ITSM* pitsm ) pure;
  754. virtual BOOL AddLinkInfoW(IN PLinkInfoW ) pure;
  755. virtual BOOL AddPublic2(const char* szPublic, USHORT isect, long off, CV_pubsymflag_t cvpsf =0) pure;
  756. virtual USHORT QueryMachineType() const pure;
  757. virtual void SetMachineType(USHORT wMachine) pure;
  758. virtual void RemoveDataForRva( ULONG rva, ULONG cb ) pure;
  759. virtual bool FStripped() const pure;
  760. virtual BOOL QueryModFromAddr2(USHORT isect, long off, OUT Mod** ppmod,
  761. OUT USHORT* pisect, OUT long* poff, OUT long* pcb,
  762. OUT ULONG * pdwCharacteristics) pure;
  763. #else
  764. virtual bool FStripped() const pure;
  765. #endif
  766. };
  767. PdbInterface Mod { // info for one module within DBI
  768. enum { intv = PDBIntv };
  769. virtual INTV QueryInterfaceVersion() pure;
  770. virtual IMPV QueryImplementationVersion() pure;
  771. virtual BOOL AddTypes(BYTE* pbTypes, long cb) pure;
  772. virtual BOOL AddSymbols(BYTE* pbSym, long cb) pure;
  773. virtual BOOL AddPublic(const char* szPublic, USHORT isect, long off) pure;
  774. virtual BOOL AddLines(const char* szSrc, USHORT isect, long offCon, long cbCon, long doff,
  775. USHORT lineStart, BYTE* pbCoff, long cbCoff) pure;
  776. virtual BOOL AddSecContrib(USHORT isect, long off, long cb, ULONG dwCharacteristics) pure;
  777. virtual BOOL QueryCBName(OUT long* pcb) pure;
  778. virtual BOOL QueryName(OUT char szName[PDB_MAX_PATH], OUT long* pcb) pure;
  779. virtual BOOL QuerySymbols(BYTE* pbSym, long* pcb) pure;
  780. virtual BOOL QueryLines(BYTE* pbLines, long* pcb) pure;
  781. virtual BOOL SetPvClient(void *pvClient) pure;
  782. virtual BOOL GetPvClient(OUT void** ppvClient) pure;
  783. virtual BOOL QueryFirstCodeSecContrib(OUT USHORT* pisect, OUT long* poff, OUT long* pcb, OUT ULONG* pdwCharacteristics) pure;
  784. //
  785. // Make all users of this api use the real one, as this is exactly what it was
  786. // supposed to query in the first place
  787. //
  788. #define QuerySecContrib QueryFirstCodeSecContrib
  789. virtual BOOL QueryImod(OUT USHORT* pimod) pure;
  790. virtual BOOL QueryDBI(OUT DBI** ppdbi) pure;
  791. virtual BOOL Close() pure;
  792. virtual BOOL QueryCBFile(OUT long* pcb) pure;
  793. virtual BOOL QueryFile(OUT char szFile[PDB_MAX_PATH], OUT long* pcb) pure;
  794. virtual BOOL QueryTpi(OUT TPI** pptpi) pure; // return this Mod's Tpi
  795. // apis to support EnC work
  796. virtual BOOL AddSecContribEx(USHORT isect, long off, long cb, ULONG dwCharacteristics, DWORD dwDataCrc, DWORD dwRelocCrc) pure;
  797. virtual BOOL QueryItsm(OUT USHORT* pitsm) pure;
  798. virtual BOOL QuerySrcFile(OUT char szFile[PDB_MAX_PATH], OUT long* pcb) pure;
  799. virtual BOOL QuerySupportsEC() pure;
  800. virtual BOOL QueryPdbFile(OUT char szFile[PDB_MAX_PATH], OUT long* pcb) pure;
  801. virtual BOOL ReplaceLines(BYTE* pbLines, long cb) pure;
  802. #ifdef LNGNM
  803. // V7 line number support
  804. virtual bool GetEnumLines( EnumLines** ppenum ) pure;
  805. virtual bool QueryLineFlags( OUT DWORD* pdwFlags ) pure; // what data is present?
  806. virtual bool QueryFileNameInfo(
  807. IN DWORD fileId, // source file identifier
  808. OUT wchar_t* szFilename, // file name string
  809. IN OUT DWORD* pccFilename, // length of string
  810. OUT DWORD* pChksumType, // type of chksum
  811. OUT BYTE* pbChksum, // pointer to buffer for chksum data
  812. IN OUT DWORD* pcbChksum // number of bytes of chksum (in/out)
  813. ) pure;
  814. // Long filenames support
  815. virtual BOOL AddPublicW(const wchar_t* szPublic, USHORT isect, long off, CV_pubsymflag_t cvpsf =0) pure;
  816. virtual BOOL AddLinesW(const wchar_t* szSrc, USHORT isect, long offCon, long cbCon, long doff,
  817. ULONG lineStart, BYTE* pbCoff, long cbCoff) pure;
  818. virtual BOOL QueryNameW(OUT wchar_t szName[PDB_MAX_PATH], OUT long* pcb) pure;
  819. virtual BOOL QueryFileW(OUT wchar_t szFile[PDB_MAX_PATH], OUT long* pcb) pure;
  820. virtual BOOL QuerySrcFileW(OUT wchar_t szFile[PDB_MAX_PATH], OUT long* pcb) pure;
  821. virtual BOOL QueryPdbFileW(OUT wchar_t szFile[PDB_MAX_PATH], OUT long* pcb) pure;
  822. virtual BOOL AddPublic2(const char* szPublic, USHORT isect, long off, CV_pubsymflag_t cvpsf =0) pure;
  823. virtual BOOL InsertLines(BYTE* pbLines, long cb) pure;
  824. #endif
  825. };
  826. PdbInterface TPI { // type info
  827. enum { intv = PDBIntv };
  828. virtual INTV QueryInterfaceVersion() pure;
  829. virtual IMPV QueryImplementationVersion() pure;
  830. virtual BOOL QueryTi16ForCVRecord(BYTE* pb, OUT TI16* pti) pure;
  831. virtual BOOL QueryCVRecordForTi16(TI16 ti, OUT BYTE* pb, IN OUT long* pcb) pure;
  832. virtual BOOL QueryPbCVRecordForTi16(TI16 ti, OUT BYTE** ppb) pure;
  833. virtual TI16 QueryTi16Min() pure;
  834. virtual TI16 QueryTi16Mac() pure;
  835. virtual long QueryCb() pure;
  836. virtual BOOL Close() pure;
  837. virtual BOOL Commit() pure;
  838. virtual BOOL QueryTi16ForUDT(LNGNM_CONST char *sz, BOOL fCase, OUT TI16* pti) pure;
  839. virtual BOOL SupportQueryTiForUDT() pure;
  840. // the new versions that truly take 32-bit types
  841. virtual BOOL fIs16bitTypePool() pure;
  842. virtual BOOL QueryTiForUDT(LNGNM_CONST char *sz, BOOL fCase, OUT TI* pti) pure;
  843. virtual BOOL QueryTiForCVRecord(BYTE* pb, OUT TI* pti) pure;
  844. virtual BOOL QueryCVRecordForTi(TI ti, OUT BYTE* pb, IN OUT long* pcb) pure;
  845. virtual BOOL QueryPbCVRecordForTi(TI ti, OUT BYTE** ppb) pure;
  846. virtual TI QueryTiMin() pure;
  847. virtual TI QueryTiMac() pure;
  848. virtual BOOL AreTypesEqual( TI ti1, TI ti2 ) pure;
  849. virtual BOOL IsTypeServed( TI ti ) pure;
  850. #ifdef LNGNM
  851. virtual BOOL QueryTiForUDTW(const wchar_t *wcs, BOOL fCase, OUT TI* pti) pure;
  852. #endif
  853. };
  854. PdbInterface GSI {
  855. enum { intv = PDBIntv };
  856. virtual INTV QueryInterfaceVersion() pure;
  857. virtual IMPV QueryImplementationVersion() pure;
  858. virtual BYTE* NextSym(BYTE* pbSym) pure;
  859. virtual BYTE* HashSym(const char* szName, BYTE* pbSym) pure;
  860. virtual BYTE* NearestSym(USHORT isect, long off, OUT long* pdisp) pure; //currently only supported for publics
  861. virtual BOOL Close() pure;
  862. virtual BOOL getEnumThunk(USHORT isect, long off, OUT EnumThunk** ppenum) pure;
  863. virtual unsigned long OffForSym(BYTE *pbSym) pure;
  864. virtual BYTE* SymForOff(unsigned long off) pure;
  865. #ifdef LNGNM
  866. virtual BYTE* HashSymW(const wchar_t *wcsName, BYTE* pbSym) pure;
  867. #endif
  868. virtual BOOL getEnumByAddr(EnumSyms **ppEnum) pure;
  869. };
  870. PdbInterface NameMap {
  871. static PDBAPI(BOOL) open(PDB* ppdb, BOOL fWrite, OUT NameMap** ppnm);
  872. virtual BOOL close() pure;
  873. virtual BOOL reinitialize() pure;
  874. virtual BOOL getNi(const char* sz, OUT NI* pni) pure;
  875. virtual BOOL getName(NI ni, OUT const char** psz) pure;
  876. virtual BOOL getEnumNameMap(OUT Enum** ppenum) pure;
  877. virtual BOOL contains(const char* sz, OUT NI* pni) pure;
  878. virtual BOOL commit() pure;
  879. virtual BOOL isValidNi(NI ni) pure;
  880. #ifdef LNGNM
  881. virtual BOOL getNiW(const wchar_t* sz, OUT NI* pni) pure;
  882. virtual BOOL getNameW(NI ni, OUT wchar_t* szName, IN OUT size_t * pcch) pure;
  883. virtual BOOL containsW(const wchar_t *sz, OUT NI* pni) pure;
  884. virtual BOOL containsUTF8(const char* sz, OUT NI* pni) pure;
  885. virtual BOOL getNiUTF8(const char *sz, OUT NI* pni) pure;
  886. virtual BOOL getNameA(NI ni, OUT const char ** psz) pure;
  887. virtual BOOL getNameW2(NI ni, OUT const wchar_t ** pwsz) pure;
  888. #endif
  889. };
  890. #define __ENUM_INCLUDED__
  891. PdbInterface Enum {
  892. virtual void release() pure;
  893. virtual void reset() pure;
  894. virtual BOOL next() pure;
  895. };
  896. PdbInterface EnumNameMap : Enum {
  897. virtual void get(OUT const char** psz, OUT NI* pni) pure;
  898. };
  899. PdbInterface EnumContrib : Enum {
  900. virtual void get(OUT USHORT* pimod, OUT USHORT* pisect, OUT long* poff, OUT long* pcb, OUT ULONG* pdwCharacteristics) pure;
  901. virtual void getCrcs(OUT DWORD* pcrcData, OUT DWORD* pcrcReloc ) pure;
  902. virtual bool fUpdate(IN long off, IN long cb) pure;
  903. virtual BOOL prev() pure;
  904. virtual BOOL clone( OUT EnumContrib **ppEnum ) pure;
  905. virtual BOOL locate( IN long isect, IN long off ) pure;
  906. };
  907. PdbInterface EnumThunk: Enum {
  908. virtual void get( OUT USHORT* pisect, OUT long* poff, OUT long* pcb ) pure;
  909. };
  910. PdbInterface EnumSyms : Enum {
  911. virtual void get( BYTE** ppbSym ) pure;
  912. virtual BOOL prev() pure;
  913. virtual BOOL clone( OUT EnumSyms **ppEnum ) pure;
  914. virtual BOOL locate( IN long isect, IN long off ) pure;
  915. };
  916. struct CV_Line_t;
  917. struct CV_Column_t;
  918. PdbInterface EnumLines: public Enum
  919. {
  920. //
  921. // Blocks of lines are always in offset order, lines within blocks are also ordered by offset
  922. //
  923. virtual bool getLines(
  924. OUT DWORD* fileId, // id for the filename
  925. OUT DWORD* poffset, // offset part of address
  926. OUT WORD* pseg, // segment part of address
  927. OUT DWORD* pcb, // count of bytes of code described by this block
  928. IN OUT DWORD* pcLines, // number of lines (in/out)
  929. OUT CV_Line_t* pLines // pointer to buffer for line info
  930. ) = 0;
  931. virtual bool getLinesColumns(
  932. OUT DWORD* fileId, // id for the filename
  933. OUT DWORD* poffset, // offset part of address
  934. OUT WORD* pseg, // segment part of address
  935. OUT DWORD* pcb, // count of bytes of code described by this block
  936. IN OUT DWORD* pcLines, // number of lines (in/out)
  937. OUT CV_Line_t* pLines, // pointer to buffer for line info
  938. OUT CV_Column_t*pColumns // pointer to buffer for column info
  939. ) = 0;
  940. virtual bool clone(
  941. OUT EnumLines **ppEnum // return pointer to the clone
  942. ) = 0;
  943. };
  944. //
  945. // interface to use to widen type indices from 16 to 32 bits
  946. // and store the results in a new location.
  947. //
  948. PdbInterface WidenTi {
  949. public:
  950. static PDBAPI(BOOL)
  951. fCreate (
  952. WidenTi *&,
  953. unsigned cTypeInitialCache =256,
  954. BOOL fNB10Syms =wtiSymsNB09
  955. );
  956. virtual void
  957. release() pure;
  958. virtual BYTE /* TYPTYPE */ *
  959. pTypeWidenTi ( TI ti16, BYTE /* TYPTYPE */ * ) pure;
  960. virtual BYTE /* SYMTYPE */ *
  961. pSymWidenTi ( BYTE /* SYMTYPE */ * ) pure;
  962. virtual BOOL
  963. fTypeWidenTiNoCache ( BYTE * pbTypeDst, BYTE * pbTypeSrc, long & cbDst ) pure;
  964. virtual BOOL
  965. fSymWidenTiNoCache ( BYTE * pbSymDst, BYTE * pbSymSrc, long & cbDst ) pure;
  966. virtual BOOL
  967. fTypeNeedsWidening ( BYTE * pbType ) pure;
  968. virtual BOOL
  969. fSymNeedsWidening ( BYTE * pbSym ) pure;
  970. virtual BOOL
  971. freeRecord ( void * ) pure;
  972. // symbol block converters/query. symbols start at doff from pbSymIn,
  973. // converted symbols will go at sci.pbSyms + doff, cbSyms are all including
  974. // doff.
  975. virtual BOOL
  976. fQuerySymConvertInfo (
  977. SymConvertInfo & sciOut,
  978. BYTE * pbSym,
  979. long cbSym,
  980. int doff =0
  981. ) pure;
  982. virtual BOOL
  983. fConvertSymbolBlock (
  984. SymConvertInfo & sciOut,
  985. BYTE * pbSymIn,
  986. long cbSymIn,
  987. int doff =0
  988. ) pure;
  989. };
  990. // interface for managing Dbg data
  991. PdbInterface Dbg {
  992. // close Dbg Interface
  993. virtual BOOL Close() pure;
  994. // return number of elements (NOT bytes)
  995. virtual long QuerySize() pure;
  996. // reset enumeration index
  997. virtual void Reset() pure;
  998. // skip next celt elements (move enumeration index)
  999. virtual BOOL Skip(ULONG celt) pure;
  1000. // query next celt elements into user-supplied buffer
  1001. virtual BOOL QueryNext(ULONG celt, OUT void *rgelt) pure;
  1002. // search for an element and fill in the entire struct given a field.
  1003. // Only supported for the following debug types and fields:
  1004. // DBG_FPO 'ulOffStart' field of FPO_DATA
  1005. // DBG_FUNC 'StartingAddress' field of IMAGE_FUNCTION_ENTRY
  1006. // DBG_OMAP 'rva' field of OMAP
  1007. virtual BOOL Find(IN OUT void *pelt) pure;
  1008. // remove debug data
  1009. virtual BOOL Clear() pure;
  1010. // append celt elements
  1011. virtual BOOL Append(ULONG celt, const void *rgelt) pure;
  1012. // replace next celt elements
  1013. virtual BOOL ReplaceNext(ULONG celt, const void *rgelt) pure;
  1014. // create a clone of this interface
  1015. virtual BOOL Clone( Dbg** ppDbg ) pure;
  1016. };
  1017. PdbInterface Src {
  1018. // close and commit the changes (when open for write)
  1019. virtual bool
  1020. Close() pure;
  1021. // add a source file or file-ette
  1022. virtual bool
  1023. Add(IN PCSrcHeader psrcheader, IN const void * pvData) pure;
  1024. // remove a file or file-ette or all of the injected code for
  1025. // one particular compiland (using the object file name)
  1026. virtual bool
  1027. Remove(IN SZ_CONST szFile) pure;
  1028. // query and copy the header/control data to the output buffer
  1029. virtual bool
  1030. QueryByName(IN SZ_CONST szFile, OUT PSrcHeaderOut psrcheaderOut) const pure;
  1031. // copy the file data (the size of the buffer is in the SrcHeaderOut
  1032. // structure) to the output buffer.
  1033. virtual bool
  1034. GetData(IN PCSrcHeaderOut pcsrcheader, OUT void * pvData) const pure;
  1035. // create an enumerator to traverse all of the files included
  1036. // in the mapping.
  1037. virtual bool
  1038. GetEnum(OUT EnumSrc ** ppenum) const pure;
  1039. // Get the header block (master header) of the Src data.
  1040. // Includes age, time stamp, version, and size of the master stream
  1041. virtual bool
  1042. GetHeaderBlock(SrcHeaderBlock & shb) const pure;
  1043. #ifdef LNGNM
  1044. virtual bool RemoveW(IN wchar_t *wcsFile) pure;
  1045. virtual bool QueryByNameW(IN wchar_t *wcsFile, OUT PSrcHeaderOut psrcheaderOut) const pure;
  1046. virtual bool AddW(IN PCSrcHeaderW psrcheader, IN const void * pvData) pure;
  1047. #endif
  1048. };
  1049. PdbInterface EnumSrc : Enum {
  1050. virtual void get(OUT PCSrcHeaderOut * ppcsrcheader) pure;
  1051. };
  1052. PdbInterface SrcHash {
  1053. // Various types we need
  1054. //
  1055. // Tri-state return type
  1056. //
  1057. enum TriState {
  1058. tsYes,
  1059. tsNo,
  1060. tsMaybe,
  1061. };
  1062. // Hash identifier
  1063. //
  1064. enum HID {
  1065. hidNone,
  1066. hidMD5,
  1067. hidMax,
  1068. };
  1069. // Define machine independent types for storage of HashID and size_t
  1070. //
  1071. typedef __int32 HashID_t;
  1072. typedef unsigned __int32 CbHash_t;
  1073. // Create a SrcHash object with the usual two-stage construction technique
  1074. //
  1075. static PDBAPI(bool)
  1076. FCreateSrcHash(OUT PSrcHash &);
  1077. // Accumulate more bytes into the hash
  1078. //
  1079. virtual bool
  1080. FHashBuffer(IN PCV pvBuf, IN size_t cbBuf) pure;
  1081. // Query the hash id
  1082. //
  1083. virtual HashID_t
  1084. HashID() const pure;
  1085. // Query the size of the hash
  1086. //
  1087. virtual CbHash_t
  1088. CbHash() const pure;
  1089. // Copy the hash bytes to the client buffer
  1090. //
  1091. virtual void
  1092. GetHash(OUT PV pvHash, IN CbHash_t cbHash) const pure;
  1093. // Verify the incoming hash against a target buffer of bytes
  1094. // returning a yes it matches, no it doesn't, or indeterminate.
  1095. //
  1096. virtual TriState
  1097. TsVerifyHash(
  1098. IN HID,
  1099. IN CbHash_t cbHash,
  1100. IN PCV pvHash,
  1101. IN size_t cbBuf,
  1102. IN PCV pvBuf
  1103. ) pure;
  1104. // Reset this object to pristine condition
  1105. //
  1106. virtual bool
  1107. FReset() pure;
  1108. // Close off and release this object
  1109. //
  1110. virtual void
  1111. Close() pure;
  1112. };
  1113. #endif // __cplusplus
  1114. // ANSI C Binding
  1115. #if __cplusplus
  1116. extern "C" {
  1117. #endif
  1118. typedef BOOL (PDBCALL *PfnPDBOpen)(
  1119. LNGNM_CONST char *,
  1120. LNGNM_CONST char *,
  1121. SIG,
  1122. EC *,
  1123. char [cbErrMax],
  1124. PDB **);
  1125. PDBAPI(BOOL)
  1126. PDBOpen(
  1127. LNGNM_CONST char *szPDB,
  1128. LNGNM_CONST char *szMode,
  1129. SIG sigInitial,
  1130. OUT EC *pec,
  1131. OUT char szError[cbErrMax],
  1132. OUT PDB **pppdb);
  1133. PDBAPI(BOOL)
  1134. PDBOpenEx(
  1135. LNGNM_CONST char *szPDB,
  1136. LNGNM_CONST char *szMode,
  1137. SIG sigInitial,
  1138. long cbPage,
  1139. OUT EC *pec,
  1140. OUT char szError[cbErrMax],
  1141. OUT PDB **pppdb);
  1142. PDBAPI(BOOL)
  1143. PDBOpen2W(
  1144. const wchar_t *wszPDB,
  1145. const char *szMode,
  1146. OUT EC *pec,
  1147. OUT wchar_t *wszError,
  1148. size_t cchErrMax,
  1149. OUT PDB **pppdb);
  1150. PDBAPI(BOOL)
  1151. PDBOpenEx2W(
  1152. const wchar_t *wszPDB,
  1153. const char *szMode,
  1154. long cbPage,
  1155. OUT EC *pec,
  1156. OUT wchar_t *wszError,
  1157. size_t cchErrMax,
  1158. OUT PDB **pppdb);
  1159. PDBAPI(BOOL)
  1160. PDBOpenValidate(
  1161. LNGNM_CONST char *szPDB,
  1162. LNGNM_CONST char *szPath,
  1163. LNGNM_CONST char *szMode,
  1164. SIG sig,
  1165. AGE age,
  1166. OUT EC* pec,
  1167. OUT char szError[cbErrMax],
  1168. OUT PDB **pppdb);
  1169. PDBAPI(BOOL)
  1170. PDBOpenValidateEx(
  1171. LNGNM_CONST char *szPDB,
  1172. LNGNM_CONST char *szPathOrig,
  1173. LNGNM_CONST char *szSearchPath,
  1174. LNGNM_CONST char *szMode,
  1175. SIG sig,
  1176. AGE age,
  1177. OUT EC *pec,
  1178. OUT char szError[cbErrMax],
  1179. OUT PDB **pppdb);
  1180. PDBAPI(BOOL)
  1181. PDBOpenValidate2(
  1182. LNGNM_CONST char *szPDB,
  1183. LNGNM_CONST char *szPath,
  1184. LNGNM_CONST char *szMode,
  1185. SIG sig,
  1186. AGE age,
  1187. long cbPage,
  1188. OUT EC *pec,
  1189. OUT char szError[cbErrMax],
  1190. OUT PDB **pppdb);
  1191. PDBAPI(BOOL)
  1192. PDBOpenValidateEx2(
  1193. LNGNM_CONST char *szPDB,
  1194. LNGNM_CONST char *szPathOrig,
  1195. LNGNM_CONST char *szSearchPath,
  1196. LNGNM_CONST char *szMode,
  1197. SIG sig,
  1198. AGE age,
  1199. long cbPage,
  1200. OUT EC* pec,
  1201. OUT char szError[cbErrMax],
  1202. OUT PDB **pppdb);
  1203. PDBAPI(BOOL)
  1204. PDBOpenValidate3(
  1205. const char *szExecutable,
  1206. const char *szSearchPath,
  1207. OUT EC *pec,
  1208. OUT char szError[cbErrMax],
  1209. OUT char szDbgPath[PDB_MAX_PATH],
  1210. OUT DWORD *pfo,
  1211. OUT DWORD *pcb,
  1212. OUT PDB **pppdb);
  1213. PDBAPI(BOOL)
  1214. PDBOpenValidate4(
  1215. const wchar_t *wszPDB,
  1216. const char *szMode,
  1217. PCSIG70 pcsig70,
  1218. SIG sig,
  1219. AGE age,
  1220. OUT EC *pec,
  1221. OUT wchar_t *wszError,
  1222. size_t cchErrMax,
  1223. OUT PDB **pppdb);
  1224. PDBAPI(BOOL)
  1225. PDBOpenValidate5(
  1226. const wchar_t *wszExecutable,
  1227. const wchar_t *wszSearchPath,
  1228. void *pvClient,
  1229. PfnPDBQueryCallback pfnQueryCallback,
  1230. OUT EC *pec,
  1231. OUT wchar_t *wszError,
  1232. size_t cchErrMax,
  1233. OUT PDB **pppdb);
  1234. // a dbi client should never call PDBExportValidateInterface directly - use PDBValidateInterface
  1235. PDBAPI(BOOL)
  1236. PDBExportValidateInterface(
  1237. INTV intv);
  1238. __inline BOOL PDBValidateInterface(void)
  1239. {
  1240. return PDBExportValidateInterface(PDBIntv);
  1241. }
  1242. typedef BOOL (PDBCALL *PfnPDBExportValidateInterface)(INTV);
  1243. __inline BOOL PDBValidateInterfacePfn(PfnPDBExportValidateInterface pfn)
  1244. {
  1245. return (*pfn)(PDBIntv);
  1246. }
  1247. PDBAPI(EC) PDBQueryLastError(PDB *ppdb, OUT char szError[cbErrMax]);
  1248. PDBAPI(INTV) PDBQueryInterfaceVersion(PDB* ppdb);
  1249. PDBAPI(IMPV) PDBQueryImplementationVersion(PDB* ppdb);
  1250. PDBAPI(char*) PDBQueryPDBName(PDB* ppdb, OUT char szPDB[PDB_MAX_PATH]);
  1251. PDBAPI(SIG) PDBQuerySignature(PDB* ppdb);
  1252. PDBAPI(BOOL) PDBQuerySignature2(PDB* ppdb, PSIG70 psig70);
  1253. PDBAPI(AGE) PDBQueryAge(PDB* ppdb);
  1254. PDBAPI(BOOL) PDBCreateDBI(PDB* ppdb, const char* szTarget, OUT DBI** ppdbi);
  1255. PDBAPI(BOOL) PDBOpenDBIEx(PDB* ppdb, const char* szMode, const char* szTarget, OUT DBI** ppdbi, PfnFindDebugInfoFile pfn);
  1256. PDBAPI(BOOL) PDBOpenDBI(PDB* ppdb, const char* szMode, const char* szTarget, OUT DBI** ppdbi);
  1257. PDBAPI(BOOL) PDBOpenTpi(PDB* ppdb, const char* szMode, OUT TPI** pptpi);
  1258. PDBAPI(BOOL) PDBCommit(PDB* ppdb);
  1259. PDBAPI(BOOL) PDBClose(PDB* ppdb);
  1260. PDBAPI(BOOL) PDBOpenStream(PDB* ppdb, const char* szStream, OUT Stream** ppstream);
  1261. PDBAPI(BOOL) PDBCopyTo(PDB *ppdb, const char *szTargetPdb, DWORD dwCopyFilter, DWORD dwReserved);
  1262. PDBAPI(BOOL) PDBCopyToW(PDB *ppdb, const wchar_t *szTargetPdb, DWORD dwCopyFilter, DWORD dwReserved);
  1263. PDBAPI(BOOL) PDBfIsSZPDB(PDB *ppdb);
  1264. PDBAPI(BOOL) PDBCopyToW2(PDB *ppdb, const wchar_t *szTargetPdb, DWORD dwCopyFilter, PfnPDBCopyQueryCallback pfnCallBack, void * pvClientContext);
  1265. PDBAPI(INTV) DBIQueryInterfaceVersion(DBI* pdbi);
  1266. PDBAPI(IMPV) DBIQueryImplementationVersion(DBI* pdbi);
  1267. PDBAPI(BOOL) DBIOpenMod(DBI* pdbi, const char* szModule, const char* szFile, OUT Mod** ppmod);
  1268. PDBAPI(BOOL) DBIDeleteMod(DBI* pdbi, const char* szModule);
  1269. PDBAPI(BOOL) DBIQueryNextMod(DBI* pdbi, Mod* pmod, Mod** ppmodNext);
  1270. PDBAPI(BOOL) DBIOpenGlobals(DBI* pdbi, OUT GSI **ppgsi);
  1271. PDBAPI(BOOL) DBIOpenPublics(DBI* pdbi, OUT GSI **ppgsi);
  1272. PDBAPI(BOOL) DBIAddSec(DBI* pdbi, USHORT isect, USHORT flags, long off, long cb);
  1273. PDBAPI(BOOL) DBIAddPublic(DBI* pdbi, const char* szPublic, USHORT isect, long off);
  1274. PDBAPI(BOOL) DBIQueryModFromAddr(DBI* pdbi, USHORT isect, long off, OUT Mod** ppmod, OUT USHORT* pisect, OUT long* poff, OUT long* pcb);
  1275. #ifdef LNGNM
  1276. PDBAPI(BOOL) DBIQueryModFromAddr2(DBI* pdbi, USHORT isect, long off, OUT Mod** ppmod, OUT USHORT* pisect, OUT long* poff, OUT long* pcb, OUT ULONG *pdwCharacteristics);
  1277. #endif
  1278. PDBAPI(BOOL) DBIQuerySecMap(DBI* pdbi, OUT BYTE* pb, long* pcb);
  1279. PDBAPI(BOOL) DBIQueryFileInfo(DBI* pdbi, OUT BYTE* pb, long* pcb);
  1280. PDBAPI(BOOL) DBIQuerySupportsEC(DBI* pdbi);
  1281. PDBAPI(void) DBIDumpMods(DBI* pdbi);
  1282. PDBAPI(void) DBIDumpSecContribs(DBI* pdbi);
  1283. PDBAPI(void) DBIDumpSecMap(DBI* pdbi);
  1284. PDBAPI(BOOL) DBIClose(DBI* pdbi);
  1285. PDBAPI(BOOL) DBIAddThunkMap(DBI* pdbi, long* poffThunkMap, unsigned nThunks, long cbSizeOfThunk,
  1286. struct SO* psoSectMap, unsigned nSects, USHORT isectThunkTable, long offThunkTable);
  1287. PDBAPI(BOOL) DBIGetEnumContrib(DBI* pdbi, OUT Enum** ppenum);
  1288. PDBAPI(BOOL) DBIQueryTypeServer(DBI* pdbi, ITSM itsm, OUT TPI** pptpi );
  1289. PDBAPI(BOOL) DBIQueryItsmForTi(DBI* pdbi, TI ti, OUT ITSM* pitsm );
  1290. PDBAPI(BOOL) DBIQueryNextItsm(DBI* pdbi, ITSM itsm, OUT ITSM *inext );
  1291. PDBAPI(BOOL) DBIQueryLazyTypes(DBI* pdbi);
  1292. PDBAPI(BOOL) DBIFindTypeServers( DBI* pdbi, OUT EC* pec, OUT char szError[cbErrMax] );
  1293. PDBAPI(BOOL) DBIOpenDbg(DBI* pdbi, DBGTYPE dbgtype, OUT Dbg **ppdbg);
  1294. PDBAPI(BOOL) DBIQueryDbgTypes(DBI* pdbi, OUT DBGTYPE *pdbgtype, OUT long* pcDbgtype);
  1295. PDBAPI(BOOL) DBIAddLinkInfo(DBI* pdbi, IN PLinkInfo);
  1296. PDBAPI(BOOL) DBIQueryLinkInfo(DBI* pdbi, PLinkInfo, IN OUT long * pcb);
  1297. PDBAPI(BOOL) DBIFStripped(DBI* pdbi);
  1298. PDBAPI(INTV) ModQueryInterfaceVersion(Mod* pmod);
  1299. PDBAPI(IMPV) ModQueryImplementationVersion(Mod* pmod);
  1300. PDBAPI(BOOL) ModAddTypes(Mod* pmod, BYTE* pbTypes, long cb);
  1301. PDBAPI(BOOL) ModAddSymbols(Mod* pmod, BYTE* pbSym, long cb);
  1302. PDBAPI(BOOL) ModAddPublic(Mod* pmod, const char* szPublic, USHORT isect, long off);
  1303. PDBAPI(BOOL) ModAddLines(Mod* pmod, const char* szSrc, USHORT isect, long offCon, long cbCon, long doff,
  1304. USHORT lineStart, BYTE* pbCoff, long cbCoff);
  1305. PDBAPI(BOOL) ModAddSecContrib(Mod * pmod, USHORT isect, long off, long cb, ULONG dwCharacteristics);
  1306. PDBAPI(BOOL) ModQueryCBName(Mod* pmod, OUT long* pcb);
  1307. PDBAPI(BOOL) ModQueryName(Mod* pmod, OUT char szName[PDB_MAX_PATH], OUT long* pcb);
  1308. PDBAPI(BOOL) ModQuerySymbols(Mod* pmod, BYTE* pbSym, long* pcb);
  1309. PDBAPI(BOOL) ModQueryLines(Mod* pmod, BYTE* pbLines, long* pcb);
  1310. PDBAPI(BOOL) ModSetPvClient(Mod* pmod, void *pvClient);
  1311. PDBAPI(BOOL) ModGetPvClient(Mod* pmod, OUT void** ppvClient);
  1312. PDBAPI(BOOL) ModQuerySecContrib(Mod* pmod, OUT USHORT* pisect, OUT long* poff, OUT long* pcb, OUT ULONG* pdwCharacteristics);
  1313. PDBAPI(BOOL) ModQueryFirstCodeSecContrib(Mod* pmod, OUT USHORT* pisect, OUT long* poff, OUT long* pcb, OUT ULONG* pdwCharacteristics);
  1314. PDBAPI(BOOL) ModQueryImod(Mod* pmod, OUT USHORT* pimod);
  1315. PDBAPI(BOOL) ModQueryDBI(Mod* pmod, OUT DBI** ppdbi);
  1316. PDBAPI(BOOL) ModClose(Mod* pmod);
  1317. PDBAPI(BOOL) ModQueryCBFile(Mod* pmod, OUT long* pcb);
  1318. PDBAPI(BOOL) ModQueryFile(Mod* pmod, OUT char szFile[PDB_MAX_PATH], OUT long* pcb);
  1319. PDBAPI(BOOL) ModQuerySrcFile(Mod* pmod, OUT char szFile[PDB_MAX_PATH], OUT long* pcb);
  1320. PDBAPI(BOOL) ModQueryPdbFile(Mod* pmod, OUT char szFile[PDB_MAX_PATH], OUT long* pcb);
  1321. PDBAPI(BOOL) ModQuerySupportsEC(Mod* pmod);
  1322. PDBAPI(BOOL) ModQueryTpi(Mod* pmod, OUT TPI** pptpi);
  1323. PDBAPI(BOOL) ModReplaceLines(Mod* pmod, BYTE* pbLines, long cb);
  1324. PDBAPI(INTV) TypesQueryInterfaceVersion(TPI* ptpi);
  1325. PDBAPI(IMPV) TypesQueryImplementationVersion(TPI* ptpi);
  1326. // can't use the same api's for 32-bit TIs.
  1327. PDBAPI(BOOL) TypesQueryTiForCVRecordEx(TPI* ptpi, BYTE* pb, OUT TI* pti);
  1328. PDBAPI(BOOL) TypesQueryCVRecordForTiEx(TPI* ptpi, TI ti, OUT BYTE* pb, IN OUT long* pcb);
  1329. PDBAPI(BOOL) TypesQueryPbCVRecordForTiEx(TPI* ptpi, TI ti, OUT BYTE** ppb);
  1330. PDBAPI(TI) TypesQueryTiMinEx(TPI* ptpi);
  1331. PDBAPI(TI) TypesQueryTiMacEx(TPI* ptpi);
  1332. PDBAPI(long) TypesQueryCb(TPI* ptpi);
  1333. PDBAPI(BOOL) TypesClose(TPI* ptpi);
  1334. PDBAPI(BOOL) TypesCommit(TPI* ptpi);
  1335. PDBAPI(BOOL) TypesQueryTiForUDTEx(TPI* ptpi, LNGNM_CONST char *sz, BOOL fCase, OUT TI* pti);
  1336. PDBAPI(BOOL) TypesSupportQueryTiForUDT(TPI*);
  1337. PDBAPI(BOOL) TypesfIs16bitTypePool(TPI*);
  1338. // Map all old ones to new ones for new compilands.
  1339. #define TypesQueryTiForCVRecord TypesQueryTiForCVRecordEx
  1340. #define TypesQueryCVRecordForTi TypesQueryCVRecordForTiEx
  1341. #define TypesQueryPbCVRecordForTi TypesQueryPbCVRecordForTiEx
  1342. #define TypesQueryTiMin TypesQueryTiMinEx
  1343. #define TypesQueryTiMac TypesQueryTiMacEx
  1344. #define TypesQueryTiForUDT TypesQueryTiForUDTEx
  1345. PDBAPI(BOOL) TypesAreTypesEqual( TPI* ptpi, TI ti1, TI ti2 );
  1346. PDBAPI(BOOL) TypesIsTypeServed( TPI* ptpi, TI ti );
  1347. PDBAPI(BYTE*) GSINextSym (GSI* pgsi, BYTE* pbSym);
  1348. PDBAPI(BYTE*) GSIHashSym (GSI* pgsi, const char* szName, BYTE* pbSym);
  1349. PDBAPI(BYTE*) GSINearestSym (GSI* pgsi, USHORT isect, long off,OUT long* pdisp);//currently only supported for publics
  1350. PDBAPI(BOOL) GSIClose(GSI* pgsi);
  1351. PDBAPI(unsigned long) GSIOffForSym( GSI* pgsi, BYTE* pbSym );
  1352. PDBAPI(BYTE*) GSISymForOff( GSI* pgsi, unsigned long off );
  1353. PDBAPI(long) StreamQueryCb(Stream* pstream);
  1354. PDBAPI(BOOL) StreamRead(Stream* pstream, long off, void* pvBuf, long* pcbBuf);
  1355. PDBAPI(BOOL) StreamWrite(Stream* pstream, long off, void* pvBuf, long cbBuf);
  1356. PDBAPI(BOOL) StreamReplace(Stream* pstream, void* pvBuf, long cbBuf);
  1357. PDBAPI(BOOL) StreamAppend(Stream* pstream, void* pvBuf, long cbBuf);
  1358. PDBAPI(BOOL) StreamDelete(Stream* pstream);
  1359. PDBAPI(BOOL) StreamTruncate(Stream* pstream, long cb);
  1360. PDBAPI(BOOL) StreamRelease(Stream* pstream);
  1361. PDBAPI(BOOL) StreamImageOpen(Stream* pstream, long cb, OUT StreamImage** ppsi);
  1362. PDBAPI(void*) StreamImageBase(StreamImage* psi);
  1363. PDBAPI(long) StreamImageSize(StreamImage* psi);
  1364. PDBAPI(BOOL) StreamImageNoteRead(StreamImage* psi, long off, long cb, OUT void** ppv);
  1365. PDBAPI(BOOL) StreamImageNoteWrite(StreamImage* psi, long off, long cb, OUT void** ppv);
  1366. PDBAPI(BOOL) StreamImageWriteBack(StreamImage* psi);
  1367. PDBAPI(BOOL) StreamImageRelease(StreamImage* psi);
  1368. PDBAPI(BOOL) NameMapOpen(PDB* ppdb, BOOL fWrite, OUT NameMap** ppnm);
  1369. PDBAPI(BOOL) NameMapClose(NameMap* pnm);
  1370. PDBAPI(BOOL) NameMapReinitialize(NameMap* pnm);
  1371. PDBAPI(BOOL) NameMapGetNi(NameMap* pnm, const char* sz, OUT NI* pni);
  1372. PDBAPI(BOOL) NameMapGetName(NameMap* pnm, NI ni, OUT const char** psz);
  1373. PDBAPI(BOOL) NameMapGetEnumNameMap(NameMap* pnm, OUT Enum** ppenum);
  1374. PDBAPI(BOOL) NameMapCommit(NameMap* pnm);
  1375. PDBAPI(void) EnumNameMapRelease(EnumNameMap* penum);
  1376. PDBAPI(void) EnumNameMapReset(EnumNameMap* penum);
  1377. PDBAPI(BOOL) EnumNameMapNext(EnumNameMap* penum);
  1378. PDBAPI(void) EnumNameMapGet(EnumNameMap* penum, OUT const char** psz, OUT NI* pni);
  1379. PDBAPI(void) EnumContribRelease(EnumContrib* penum);
  1380. PDBAPI(void) EnumContribReset(EnumContrib* penum);
  1381. PDBAPI(BOOL) EnumContribNext(EnumContrib* penum);
  1382. PDBAPI(void) EnumContribGet(EnumContrib* penum, OUT USHORT* pimod, OUT USHORT* pisect, OUT long* poff, OUT long* pcb, OUT ULONG* pdwCharacteristics);
  1383. PDBAPI(void) EnumContribGetCrcs(EnumContrib* penum, OUT DWORD* pcrcData, OUT DWORD* pcrcReloc);
  1384. PDBAPI(BOOL) EnumContribfUpdate(EnumContrib* penum, IN long off, IN long cb);
  1385. PDBAPI(SIG) SigForPbCb(BYTE* pb, size_t cb, SIG sig);
  1386. PDBAPI(void) TruncStFromSz(char *stDst, const char *szSrc, size_t cbSrc);
  1387. PDBAPI(BOOL) DbgClose(Dbg *pdbg);
  1388. PDBAPI(long) DbgQuerySize(Dbg *pdbg);
  1389. PDBAPI(void) DbgReset(Dbg *pdbg);
  1390. PDBAPI(BOOL) DbgSkip(Dbg *pdbg, ULONG celt);
  1391. PDBAPI(BOOL) DbgQueryNext(Dbg *pdbg, ULONG celt, OUT void *rgelt);
  1392. PDBAPI(BOOL) DbgFind(Dbg *pdbg, IN OUT void *pelt);
  1393. PDBAPI(BOOL) DbgClear(Dbg *pdbg);
  1394. PDBAPI(BOOL) DbgAppend(Dbg *pdbg, ULONG celt, const void *rgelt);
  1395. PDBAPI(BOOL) DbgReplaceNext(Dbg *pdbg, ULONG celt, const void *rgelt);
  1396. #if __cplusplus
  1397. };
  1398. #endif
  1399. struct SO {
  1400. long off;
  1401. USHORT isect;
  1402. unsigned short pad;
  1403. };
  1404. #ifndef cbNil
  1405. #define cbNil ((long)-1)
  1406. #endif
  1407. #define tsNil ((TPI*)0)
  1408. #define tiNil ((TI)0)
  1409. #define imodNil ((USHORT)(-1))
  1410. #define pdbWrite "w"
  1411. #define pdbRead "r"
  1412. #define pdbGetTiOnly "i"
  1413. #define pdbGetRecordsOnly "c"
  1414. #define pdbFullBuild "f"
  1415. #define pdbTypeAppend "a"
  1416. #define pdbRepro "z"
  1417. #define pdbFSCompress "C"
  1418. #endif // __PDB_INCLUDED__