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.

1617 lines
34 KiB

  1. //
  2. // defines for symbol file searching
  3. //
  4. #include <cmnutil.hpp>
  5. // this private API is in msdia20-msvcrt.lib
  6. HRESULT
  7. __cdecl
  8. CompareRE(
  9. const wchar_t* pStr,
  10. const wchar_t* pRE,
  11. BOOL fCase
  12. );
  13. #define SYMBOL_PATH "_NT_SYMBOL_PATH"
  14. #define ALTERNATE_SYMBOL_PATH "_NT_ALT_SYMBOL_PATH"
  15. #define SYMBOL_SERVER "_NT_SYMBOL_SERVER"
  16. #define SYMSRV_PROXY "_NT_SYMBOL_PROXY"
  17. #define SYMSRV "SYMSRV"
  18. #define WINDIR "windir"
  19. #define DBGHELP_TOKEN "DBGHELP_TOKEN"
  20. #define HASH_MODULO 253
  21. #define OMAP_SYM_EXTRA 1024
  22. #define CPP_EXTRA 2
  23. #define OMAP_SYM_STRINGS (OMAP_SYM_EXTRA * 256)
  24. #define TMP_SYM_LEN 4096
  25. // Possibly truncates and sign-extends a value to 64 bits.
  26. #define EXTEND64(Val) ((ULONG64)(LONG64)(LONG)(Val))
  27. //
  28. // structures
  29. //
  30. typedef struct _LOADED_MODULE {
  31. PENUMLOADED_MODULES_CALLBACK EnumLoadedModulesCallback32;
  32. PENUMLOADED_MODULES_CALLBACK64 EnumLoadedModulesCallback64;
  33. PVOID Context;
  34. } LOADED_MODULE, *PLOADED_MODULE;
  35. #define SYMF_DUPLICATE 0x80000000
  36. typedef struct _SYMBOL_ENTRY {
  37. struct _SYMBOL_ENTRY *Next;
  38. DWORD Size;
  39. DWORD Flags;
  40. DWORD64 Address;
  41. LPSTR Name;
  42. ULONG NameLength;
  43. ULONG Segment;
  44. ULONG64 Offset;
  45. ULONG TypeIndex;
  46. ULONG64 ModBase;
  47. ULONG Register;
  48. } SYMBOL_ENTRY, *PSYMBOL_ENTRY;
  49. typedef struct _SECTION_START {
  50. ULONG64 Offset;
  51. DWORD Size;
  52. DWORD Flags;
  53. } SECTION_START, *PSECTION_START;
  54. //
  55. // source file and line number information
  56. //
  57. typedef struct _SOURCE_LINE {
  58. DWORD64 Addr;
  59. DWORD Line;
  60. } SOURCE_LINE, *PSOURCE_LINE;
  61. typedef struct _SOURCE_ENTRY {
  62. struct _SOURCE_ENTRY *Next;
  63. struct _SOURCE_ENTRY *Prev;
  64. DWORD64 MinAddr;
  65. DWORD64 MaxAddr;
  66. LPSTR File;
  67. DWORD Lines;
  68. PSOURCE_LINE LineInfo;
  69. ULONG ModuleId;
  70. } SOURCE_ENTRY, *PSOURCE_ENTRY;
  71. //
  72. // Error values for failed symbol load
  73. //
  74. #define SYMLOAD_OK 0x0000
  75. #define SYMLOAD_PDBUNMATCHED 0x0001
  76. #define SYMLOAD_PDBNOTFOUND 0x0002
  77. #define SYMLOAD_DBGNOTFOUND 0x0003
  78. #define SYMLOAD_OTHERERROR 0x0004
  79. #define SYMLOAD_OUTOFMEMORY 0x0005
  80. #define SYMLOAD_HEADERPAGEDOUT 0x0006
  81. #define SYMLOAD_PDBERRORMASK 0xff00
  82. #define SYMLOAD_DEFERRED 0x80000000
  83. //
  84. // module flags
  85. //
  86. #define MIF_DEFERRED_LOAD 0x00000001
  87. #define MIF_NO_SYMBOLS 0x00000002
  88. #define MIF_ROM_IMAGE 0x00000004
  89. #define MIF_NO_SIG 0x00000008
  90. #define MIF_MISMATCHED_SIG 0x00000010
  91. // Virtual Symbol
  92. typedef struct _VIRTUAL_SYMBOL {
  93. CHAR name[MAX_SYM_NAME + 1];
  94. DWORD64 addr;
  95. DWORD size;
  96. } VIRTUAL_SYMBOL, *PVIRTUAL_SYMBOL;
  97. // for ImageSrc and PdbSrc elements
  98. typedef enum {
  99. srcNone = 0,
  100. srcSearchPath,
  101. srcImagePath,
  102. srcDbgPath,
  103. srcSymSrv,
  104. srcCVRec,
  105. srcHandle,
  106. srcMemory
  107. };
  108. typedef struct {
  109. DWORD rvaBeginAddress;
  110. DWORD rvaEndAddress;
  111. DWORD rvaPrologEndAddress;
  112. DWORD rvaExceptionHandler;
  113. DWORD rvaHandlerData;
  114. } IMGHLP_RVA_FUNCTION_DATA, *PIMGHLP_RVA_FUNCTION_DATA;
  115. typedef struct _MODULE_ENTRY {
  116. LIST_ENTRY ListEntry;
  117. ULONG64 BaseOfDll;
  118. ULONG DllSize;
  119. ULONG TimeDateStamp;
  120. ULONG CheckSum;
  121. USHORT MachineType;
  122. CHAR ModuleName[64];
  123. CHAR AliasName[64];
  124. PSTR ImageName;
  125. PSTR LoadedImageName;
  126. PSTR LoadedPdbName;
  127. ULONG ImageType;
  128. ULONG ImageSrc;
  129. ULONG PdbSrc;
  130. PSYMBOL_ENTRY symbolTable;
  131. LPSTR SymStrings;
  132. PSYMBOL_ENTRY NameHashTable[HASH_MODULO];
  133. ULONG numsyms;
  134. ULONG MaxSyms;
  135. ULONG StringSize;
  136. SYM_TYPE SymType;
  137. SYM_TYPE lSymType; // indicates the type of symbols that we attempted to load
  138. PDB * pdb;
  139. DBI * dbi;
  140. GSI * gsi;
  141. GSI * globals;
  142. TPI * ptpi;
  143. PIMAGE_SECTION_HEADER SectionHdrs;
  144. ULONG NumSections;
  145. PFPO_DATA pFpoData; // pointer to fpo data (x86)
  146. PFPO_DATA pFpoDataOmap; // pointer to fpo data (x86)
  147. PIMGHLP_RVA_FUNCTION_DATA pExceptionData; // pointer to pdata (risc)
  148. PVOID pPData; // pdata acquired from pdb
  149. PVOID pXData; // xdata acquired from pdb
  150. ULONG dwEntries; // # of fpo or pdata recs
  151. ULONG cPData; // number of pdb pdata entries
  152. ULONG cXData; // number of pdb xdata entries
  153. ULONG cbPData; // size of pdb xdata blob
  154. ULONG cbXData; // size of pdb xdata blob
  155. POMAP pOmapFrom; // pointer to omap data
  156. ULONG cOmapFrom; // count of omap entries
  157. POMAP pOmapTo; // pointer to omap data
  158. ULONG cOmapTo; // count of omap entries
  159. SYMBOL_ENTRY TmpSym; // used only for pdb symbols
  160. SYMBOL_ENTRY vsTmpSym; // used only by virtual symbols
  161. SYMBOL_INFO si; // used for dia symbols
  162. UCHAR siName[2048]; // must be contiguous with si
  163. SYMBOL_INFO vssi; // used only by virtual symbols
  164. UCHAR vssiName[2048]; // must be contiguous with vssi
  165. ULONG Flags;
  166. HANDLE hFile;
  167. PIMAGE_SECTION_HEADER OriginalSectionHdrs;
  168. ULONG OriginalNumSections;
  169. PSOURCE_ENTRY SourceFiles;
  170. PSOURCE_ENTRY SourceFilesTail;
  171. HANDLE hProcess;
  172. ULONG64 InProcImageBase;
  173. BOOL fInProcHeader;
  174. DWORD dsExceptions;
  175. Mod *mod;
  176. USHORT imod;
  177. PBYTE pPdbSymbols;
  178. DWORD cbPdbSymbols;
  179. ULONG SymLoadError;
  180. ULONG code; // used to pass back info to wrappers
  181. PVOID dia;
  182. CHAR SrcFile[_MAX_PATH + 1];
  183. DWORD CallerFlags;
  184. MODLOAD_DATA mld;
  185. PVOID CallerData;
  186. PVIRTUAL_SYMBOL vs; // virtual symbol list
  187. DWORD cvs; // number of virtual symbols
  188. BOOL processed; // this flag is used for multi-pass module searches
  189. LONG cGlobals;
  190. BOOL loaded; // indicates if symbols were loaded
  191. PBYTE stSrcSrv;
  192. DWORD cbSrcSrv;
  193. ULONG pdbdataAge;
  194. ULONG pdbdataSig;
  195. GUID pdbdataGuid;
  196. DWORD cvSig;
  197. BOOL fLines;
  198. BOOL fSymbols;
  199. BOOL fTypes;
  200. BOOL fPdbUnmatched;
  201. BOOL fDbgUnmatched;
  202. CVDD CVRec;
  203. SRCCODEINFO sci;
  204. } MODULE_ENTRY, *PMODULE_ENTRY;
  205. typedef struct _SOURCE_HINT {
  206. struct _SOURCE_HINT *next;
  207. LPSTR filename;
  208. PMODULE_ENTRY mi;
  209. } SOURCE_HINT, *PSOURCE_HINT;
  210. typedef VOID DBG_CONTEXT, *PDBG_CONTEXT;
  211. #ifdef USE_CACHE
  212. #define CACHE_BLOCK 40
  213. #define CACHE_SIZE CACHE_BLOCK*CACHE_BLOCK
  214. typedef struct _DIA_LARGE_DATA {
  215. BOOL Used;
  216. ULONG Index;
  217. ULONG LengthUsed;
  218. CHAR Bytes[500];
  219. } DIA_LARGE_DATA, *PDIA_LARGE_DATA;
  220. #define DIACH_ULVAL 0
  221. #define DIACH_ULLVAL 1
  222. #define DIACH_PLVAL 2
  223. typedef struct _DIA_CACHE_DATA {
  224. ULONG type;
  225. union {
  226. ULONG ulVal;
  227. ULONGLONG ullVal;
  228. PDIA_LARGE_DATA plVal;
  229. };
  230. } DIA_CACHE_DATA, *PDIA_CACHE_DATA;
  231. typedef struct _DIA_CACHE_ENTRY {
  232. ULONG Age;
  233. union {
  234. struct {
  235. ULONG TypeId;
  236. IMAGEHLP_SYMBOL_TYPE_INFO DataType;
  237. } s;
  238. ULONGLONG SearchId;
  239. };
  240. ULONGLONG Module;
  241. DIA_CACHE_DATA Data;
  242. } DIA_CACHE_ENTRY, *PDIA_CACHE_ENTRY;
  243. #endif // USE_CACHE
  244. typedef struct _PROCESS_ENTRY {
  245. LIST_ENTRY ListEntry;
  246. LIST_ENTRY ModuleList;
  247. PLIST_ENTRY NextModule;
  248. ULONG cRefs;
  249. HANDLE hProcess;
  250. DWORD pid;
  251. LPSTR SymbolSearchPath;
  252. PSYMBOL_REGISTERED_CALLBACK pCallbackFunction32;
  253. PSYMBOL_REGISTERED_CALLBACK64 pCallbackFunction64;
  254. ULONG64 CallbackUserContext;
  255. PSYMBOL_FUNCENTRY_CALLBACK pFunctionEntryCallback32;
  256. PSYMBOL_FUNCENTRY_CALLBACK64 pFunctionEntryCallback64;
  257. ULONG64 FunctionEntryUserContext;
  258. PIMAGEHLP_CONTEXT pContext;
  259. IMAGEHLP_STACK_FRAME StackFrame;
  260. PMODULE_ENTRY ipmi;
  261. #ifdef USE_CACHE
  262. DIA_LARGE_DATA DiaLargeData[2*CACHE_BLOCK];
  263. DIA_CACHE_ENTRY DiaCache[CACHE_SIZE];
  264. #endif // USE_CACHE
  265. PSOURCE_HINT SourceHints; // list of prevously found source files and modules
  266. } PROCESS_ENTRY, *PPROCESS_ENTRY;
  267. #if 1
  268. typedef struct _IMGHLP_DEBUG_DATA {
  269. DWORD SizeOfStruct;
  270. PPROCESS_ENTRY pe;
  271. PCHAR SymbolPath;
  272. ULONG64 InProcImageBase;
  273. ULONG64 ImageBaseFromImage;
  274. DWORD SizeOfImage;
  275. DWORD CheckSum;
  276. DWORD TimeDateStamp;
  277. DWORD Characteristics;
  278. USHORT Machine;
  279. CHAR ImageFilePath[MAX_PATH + 1];
  280. CHAR OriginalImageFileName[MAX_PATH + 1]; // Retrieved from the .dbg file for cases when we only have a file handle...
  281. HANDLE ImageFileHandle;
  282. PVOID ImageMap;
  283. USHORT iohMagic;
  284. CHAR DbgFilePath[MAX_PATH + 1];
  285. CHAR OriginalDbgFileName[MAX_PATH + 1];
  286. HANDLE DbgFileHandle;
  287. PVOID DbgFileMap;
  288. DWORD DbgTimeDateStamp;
  289. DWORD PdbAge;
  290. DWORD PdbSignature;
  291. BOOL PdbRSDS;
  292. GUID PdbGUID;
  293. CHAR PdbFileName[NB_PATH_SIZE + 1 ];
  294. CHAR PdbReferencePath[MAX_PATH + 1];
  295. ULONG ImageType;
  296. ULONG ImageSrc;
  297. ULONG PdbSrc;
  298. PCHAR pMappedCv;
  299. PCHAR pMappedCoff;
  300. // PCHAR pMappedExportDirectory;
  301. PCHAR pMappedDbgFunction; // PIMAGE_FUNCTION_ENTRY from the .dbg file
  302. PVOID pFpo;
  303. PVOID pPData; // PIMAGE_RUNTIME_FUNCTION_ENTRY from the image.
  304. PVOID pXData;
  305. POMAP pOmapTo;
  306. POMAP pOmapFrom;
  307. PIMAGE_SECTION_HEADER pImageSections;
  308. PIMAGE_SECTION_HEADER pDbgSections;
  309. PIMAGE_SECTION_HEADER pOriginalSections;
  310. PIMAGE_SECTION_HEADER pCurrentSections;
  311. DWORD ddva; // only used by MapDebugInformation - virtual addr of debug dirs
  312. DWORD cdd; // only used by MapDebugInformation - number of debug dirs
  313. // ULONG NumberOfPdataFunctionEntries;
  314. ULONG cFpo;
  315. ULONG cPData;
  316. ULONG cbPData;
  317. ULONG cXData;
  318. ULONG cbXData;
  319. ULONG cOmapTo;
  320. ULONG cOmapFrom;
  321. ULONG cImageSections;
  322. ULONG cDbgSections;
  323. ULONG cOriginalSections;
  324. ULONG cCurrentSections;
  325. ULONG cMappedCv;
  326. ULONG cMappedCoff;
  327. ULONG ImageAlign;
  328. BOOL fPE64;
  329. BOOL fROM;
  330. BOOL fCoffMapped;
  331. BOOL fCvMapped;
  332. BOOL fFpoMapped;
  333. BOOL fPDataMapped;
  334. BOOL fXDataMapped;
  335. BOOL fOmapToMapped;
  336. BOOL fOmapFromMapped;
  337. BOOL fCurrentSectionsMapped;
  338. BOOL fInProcHeader;
  339. BOOL fTryAgain;
  340. HANDLE hProcess;
  341. CHAR ImageName[MAX_PATH + 1];
  342. DWORD dsExports;
  343. DWORD dsCoff;
  344. DWORD dsCV;
  345. DWORD dsMisc;
  346. DWORD dsFPO;
  347. DWORD dsOmapTo;
  348. DWORD dsOmapFrom;
  349. DWORD dsExceptions;
  350. LONG cGlobals; // amount of global symbols found
  351. union {
  352. IMAGE_EXPORT_DIRECTORY expdir;
  353. LONGLONG makeitQWordAlign; // this address is deref'd
  354. };
  355. DWORD fNeedImage;
  356. PVOID dia;
  357. DWORD flags;
  358. PMODULE_DATA md;
  359. DWORD64 oExports;
  360. DWORD cExports;
  361. PMODLOAD_DATA mld;
  362. BOOL fDbgTried;
  363. DWORD CallerFlags;
  364. char FoundPdb[MAX_PATH + 1];
  365. DWORD LoadInfo;
  366. DWORD error;
  367. ULONG pdbdataAge;
  368. ULONG pdbdataSig;
  369. GUID pdbdataGuid;
  370. BOOL fLines;
  371. BOOL fSymbols;
  372. BOOL fTypes;
  373. BOOL fPdbUnmatched;
  374. BOOL fDbgUnmatched;
  375. } IMGHLP_DEBUG_DATA, *PIMGHLP_DEBUG_DATA;
  376. #ifndef _WIN64
  377. typedef struct {
  378. PIMGHLP_DEBUG_DATA idd;
  379. } PIDI_HEADER, *PPIDI_HEADER;
  380. typedef struct {
  381. PIDI_HEADER hdr;
  382. IMAGE_DEBUG_INFORMATION idi;
  383. } PIDI, *PPIDI;
  384. #endif
  385. #endif
  386. // for returning from functions
  387. inline
  388. unsigned int
  389. error(
  390. DWORD err
  391. )
  392. {
  393. SetLastError(err);
  394. return 0;
  395. }
  396. // debug trace facility
  397. int
  398. WINAPIV
  399. _pprint(
  400. PPROCESS_ENTRY ProcessEntry,
  401. LPSTR Format,
  402. ...
  403. );
  404. int
  405. WINAPIV
  406. _peprint(
  407. PPROCESS_ENTRY ProcessEntry,
  408. LPSTR Format,
  409. ...
  410. );
  411. int
  412. WINAPIV
  413. _dprint(
  414. LPSTR format,
  415. ...
  416. );
  417. int
  418. WINAPIV
  419. _eprint(
  420. LPSTR Format,
  421. ...
  422. );
  423. #define option(a) (g.SymOptions & a)
  424. #define dprint (option(SYMOPT_DEBUG) || g.hLog)&&_dprint
  425. #define eprint (option(SYMOPT_DEBUG) || g.hLog)&&_eprint
  426. #define cprint _dprint
  427. #define dtrace (option(SYMOPT_DEBUG) || g.hLog)&&_dprint
  428. #define etrace (option(SYMOPT_DEBUG) || g.hLog)&&_eprint
  429. #define pprint (option(SYMOPT_DEBUG) || g.hLog)&&_pprint
  430. #define peprint (option(SYMOPT_DEBUG) || g.hLog)&&_peprint
  431. #define pcprint _pprint
  432. BOOL
  433. WINAPIV
  434. evtprint(
  435. PPROCESS_ENTRY pe,
  436. DWORD severity,
  437. DWORD code,
  438. PVOID object,
  439. LPSTR format,
  440. ...
  441. );
  442. BOOL
  443. traceAddr(
  444. DWORD64 addr
  445. );
  446. BOOL
  447. traceName(
  448. PCHAR name
  449. );
  450. BOOL
  451. traceSubName(
  452. PCHAR name
  453. );
  454. // for use with cvtype.h
  455. typedef SYMTYPE *SYMPTR;
  456. __inline
  457. DWORD64
  458. GetIP(
  459. PPROCESS_ENTRY pe
  460. )
  461. {
  462. return pe->StackFrame.InstructionOffset;
  463. }
  464. typedef struct _PDB_INFO {
  465. CHAR Signature[4]; // "NBxx"
  466. ULONG Offset; // always zero
  467. ULONG sig;
  468. ULONG age;
  469. CHAR PdbName[_MAX_PATH];
  470. } PDB_INFO, *PPDB_INFO;
  471. #define n_name N.ShortName
  472. #define n_zeroes N.Name.Short
  473. #define n_nptr N.LongName[1]
  474. #define n_offset N.Name.Long
  475. //
  476. // internal prototypes
  477. //
  478. void
  479. InitModuleEntry(
  480. PMODULE_ENTRY mi
  481. );
  482. PMODULE_ENTRY
  483. GetModFromAddr(
  484. PPROCESS_ENTRY pe,
  485. IN DWORD64 addr
  486. );
  487. DWORD_PTR
  488. GetPID(
  489. HANDLE hProcess
  490. );
  491. DWORD
  492. GetProcessModules(
  493. HANDLE hProcess,
  494. PGET_MODULE cbGetModule,
  495. PVOID Context
  496. );
  497. VOID
  498. FreeModuleEntry(
  499. PPROCESS_ENTRY pe,
  500. PMODULE_ENTRY mi
  501. );
  502. void
  503. ClearModuleFlags(
  504. PPROCESS_ENTRY pe
  505. );
  506. char *
  507. SymbolStatus(
  508. PMODULE_ENTRY mi,
  509. int indent
  510. );
  511. BOOL
  512. PrepRE4Srch(
  513. PCSTR in,
  514. PSTR out
  515. );
  516. BOOL
  517. ValidGuid(
  518. GUID *guid
  519. );
  520. BOOL
  521. GuidIsDword(
  522. GUID *guid
  523. );
  524. PPROCESS_ENTRY
  525. FindProcessEntry(
  526. HANDLE hProcess
  527. );
  528. PPROCESS_ENTRY
  529. FindFirstProcessEntry(
  530. );
  531. VOID
  532. GetSymName(
  533. PIMAGE_SYMBOL Symbol,
  534. PUCHAR StringTable,
  535. LPSTR s,
  536. DWORD size
  537. );
  538. BOOL
  539. ProcessOmapSymbol(
  540. PMODULE_ENTRY mi,
  541. PSYMBOL_ENTRY sym
  542. );
  543. DWORD64
  544. ConvertOmapFromSrc(
  545. PMODULE_ENTRY mi,
  546. DWORD64 addr,
  547. LPDWORD bias
  548. );
  549. DWORD64
  550. ConvertOmapToSrc(
  551. PMODULE_ENTRY mi,
  552. DWORD64 addr,
  553. LPDWORD bias,
  554. BOOL fBackup
  555. );
  556. POMAP
  557. GetOmapFromSrcEntry(
  558. PMODULE_ENTRY mi,
  559. DWORD64 addr
  560. );
  561. VOID
  562. DumpOmapForModule(
  563. PMODULE_ENTRY mi
  564. );
  565. VOID
  566. ProcessOmapForModule(
  567. PMODULE_ENTRY mi,
  568. PIMGHLP_DEBUG_DATA idd
  569. );
  570. BOOL
  571. LoadCoffSymbols(
  572. HANDLE hProcess,
  573. PMODULE_ENTRY mi,
  574. PIMGHLP_DEBUG_DATA idd
  575. );
  576. BOOL
  577. LoadCodeViewSymbols(
  578. HANDLE hProcess,
  579. PMODULE_ENTRY mi,
  580. PIMGHLP_DEBUG_DATA idd
  581. );
  582. ULONG
  583. LoadExportSymbols(
  584. PMODULE_ENTRY mi,
  585. PIMGHLP_DEBUG_DATA idd
  586. );
  587. PMODULE_ENTRY
  588. GetModuleForPC(
  589. PPROCESS_ENTRY ProcessEntry,
  590. DWORD64 dwPcAddr,
  591. BOOL ExactMatch
  592. );
  593. PSYMBOL_INFO
  594. GetSymFromAddr(
  595. DWORD64 dwAddr,
  596. PDWORD64 pqwDisplacement,
  597. PMODULE_ENTRY mi
  598. );
  599. PSYMBOL_INFO
  600. GetSymFromAddrByTag(
  601. DWORD64 dwAddr,
  602. DWORD SymTag,
  603. PDWORD64 pqwDisplacement,
  604. PMODULE_ENTRY mi
  605. );
  606. PSYMBOL_INFO
  607. GetSymFromToken(
  608. PMODULE_ENTRY mi,
  609. DWORD token
  610. );
  611. PSYMBOL_ENTRY
  612. cvGetSymFromAddr(
  613. DWORD64 dwAddr,
  614. PDWORD64 pqwDisplacement,
  615. PMODULE_ENTRY mi
  616. );
  617. LPSTR
  618. StringDup(
  619. LPSTR str
  620. );
  621. DWORD
  622. ComputeHash(
  623. LPSTR lpname,
  624. ULONG cb
  625. );
  626. PSYMBOL_INFO
  627. FindSymbolByName(
  628. PPROCESS_ENTRY pe,
  629. PMODULE_ENTRY mi,
  630. LPSTR SymName
  631. );
  632. PFPO_DATA
  633. SwSearchFpoData(
  634. DWORD key,
  635. PFPO_DATA base,
  636. DWORD num
  637. );
  638. PIMGHLP_RVA_FUNCTION_DATA
  639. GetFunctionEntryFromDebugInfo (
  640. PPROCESS_ENTRY ProcessEntry,
  641. DWORD64 ControlPc
  642. );
  643. PIMAGE_IA64_RUNTIME_FUNCTION_ENTRY
  644. LookupFunctionEntryIa64 (
  645. HANDLE hProcess,
  646. DWORD64 ControlPc
  647. );
  648. _PIMAGE_RUNTIME_FUNCTION_ENTRY
  649. LookupFunctionEntryAmd64 (
  650. HANDLE hProcess,
  651. DWORD64 ControlPc
  652. );
  653. BOOL
  654. LoadedModuleEnumerator(
  655. HANDLE hProcess,
  656. LPSTR ModuleName,
  657. DWORD64 ImageBase,
  658. DWORD ImageSize,
  659. PLOADED_MODULE lm
  660. );
  661. LPSTR
  662. symfmt(
  663. LPSTR DstName,
  664. LPSTR SrcName,
  665. ULONG Length
  666. );
  667. BOOL
  668. MatchSymName(
  669. LPSTR matchName,
  670. LPSTR symName
  671. );
  672. BOOL
  673. strcmpre(
  674. PCSTR pStr,
  675. PCSTR pRE,
  676. BOOL fCase
  677. );
  678. BOOL
  679. SympConvertAnsiModule32ToUnicodeModule32(
  680. PIMAGEHLP_MODULE A_Symbol32,
  681. PIMAGEHLP_MODULEW W_Symbol32
  682. );
  683. BOOL
  684. SympConvertUnicodeModule32ToAnsiModule32(
  685. PIMAGEHLP_MODULEW W_Symbol32,
  686. PIMAGEHLP_MODULE A_Symbol32
  687. );
  688. BOOL
  689. SympConvertAnsiModule64ToUnicodeModule64(
  690. PIMAGEHLP_MODULE64 A_Symbol64,
  691. PIMAGEHLP_MODULEW64 W_Symbol64
  692. );
  693. BOOL
  694. SympConvertUnicodeModule64ToAnsiModule64(
  695. PIMAGEHLP_MODULEW64 W_Symbol64,
  696. PIMAGEHLP_MODULE64 A_Symbol64
  697. );
  698. PSYMBOL_ENTRY
  699. si2se(
  700. PSYMBOL_INFO si,
  701. PSYMBOL_ENTRY se
  702. );
  703. PSYMBOL_INFO
  704. se2si(
  705. PSYMBOL_ENTRY se,
  706. PSYMBOL_INFO si
  707. );
  708. PIMAGEHLP_SYMBOL
  709. se2sym(
  710. PSYMBOL_ENTRY se,
  711. PIMAGEHLP_SYMBOL sym
  712. );
  713. PIMAGEHLP_SYMBOL64
  714. se2lsym(
  715. PSYMBOL_ENTRY se,
  716. PIMAGEHLP_SYMBOL64 lsym
  717. );
  718. PIMAGEHLP_SYMBOL
  719. si2sym(
  720. PSYMBOL_INFO si,
  721. PIMAGEHLP_SYMBOL sym
  722. );
  723. PIMAGEHLP_SYMBOL64
  724. si2lsym(
  725. PSYMBOL_INFO si,
  726. PIMAGEHLP_SYMBOL64 lsym
  727. );
  728. PSYMBOL_INFO
  729. si2si(
  730. PSYMBOL_INFO trg,
  731. PSYMBOL_INFO src
  732. );
  733. PIMAGEHLP_SYMBOL
  734. lsym2sym(
  735. PIMAGEHLP_SYMBOL64 lsym,
  736. PIMAGEHLP_SYMBOL sym
  737. );
  738. PIMAGEHLP_SYMBOL64
  739. sym2lsym(
  740. PIMAGEHLP_SYMBOL sym,
  741. PIMAGEHLP_SYMBOL64 lsym
  742. );
  743. PIMAGEHLP_LINE
  744. lline2line(
  745. PIMAGEHLP_LINE64 lline,
  746. PIMAGEHLP_LINE line
  747. );
  748. PIMAGEHLP_LINE64
  749. line2lline(
  750. PIMAGEHLP_LINE line,
  751. PIMAGEHLP_LINE64 lline
  752. );
  753. PMODULE_ENTRY
  754. FindModule(
  755. HANDLE hModule,
  756. PPROCESS_ENTRY ProcessEntry,
  757. LPSTR ModuleName,
  758. BOOL fLoad
  759. );
  760. LPSTR
  761. SymUnDNameInternal(
  762. LPSTR UnDecName,
  763. DWORD UnDecNameLength,
  764. LPSTR DecName,
  765. DWORD MaxDecNameLength,
  766. DWORD MachineType,
  767. BOOL IsPublic
  768. );
  769. BOOL
  770. sci2lline(
  771. PMODULE_ENTRY mi,
  772. PSRCCODEINFO sci,
  773. PIMAGEHLP_LINE64 line64);
  774. void sciInit(PSRCCODEINFO sci);
  775. BOOL
  776. GetLineFromAddr(
  777. PPROCESS_ENTRY pe,
  778. PMODULE_ENTRY mi,
  779. DWORD64 Addr,
  780. PDWORD Displacement,
  781. PSRCCODEINFO sci
  782. );
  783. PSOURCE_HINT
  784. FindSourceFileInHintList(
  785. PPROCESS_ENTRY pe,
  786. char *filename
  787. );
  788. // used by GetLineFromName
  789. enum {
  790. mName, // only file name must match
  791. mFullPath, // must match the full path
  792. mBestMatch // get the closest possible match
  793. };
  794. BOOL
  795. GetLineFromName(
  796. PPROCESS_ENTRY pe,
  797. PMODULE_ENTRY mi,
  798. LPSTR FileName,
  799. DWORD LineNumber,
  800. PLONG Displacement,
  801. PSRCCODEINFO sci,
  802. DWORD method
  803. );
  804. BOOL
  805. AddLinesForCoff(
  806. PMODULE_ENTRY mi,
  807. PIMAGE_SYMBOL allSymbols,
  808. DWORD numberOfSymbols,
  809. PIMAGE_LINENUMBER LineNumbers
  810. );
  811. BOOL
  812. AddLinesForOmfSourceModule(
  813. PMODULE_ENTRY mi,
  814. BYTE *Base,
  815. OMFSourceModule *OmfSrcMod,
  816. PVOID PdbModule
  817. );
  818. PSOURCE_ENTRY
  819. FindNextSourceEntryForFile(
  820. PMODULE_ENTRY mi,
  821. LPSTR File,
  822. PSOURCE_ENTRY SearchFrom
  823. );
  824. PSOURCE_ENTRY
  825. FindPrevSourceEntryForFile(
  826. PMODULE_ENTRY mi,
  827. LPSTR File,
  828. PSOURCE_ENTRY SearchFrom
  829. );
  830. BOOL
  831. __stdcall
  832. ReadInProcMemory(
  833. HANDLE hProcess,
  834. DWORD64 addr,
  835. PVOID buf,
  836. DWORD bytes,
  837. DWORD *bytesread
  838. );
  839. BOOL
  840. GetPData(
  841. HANDLE hp,
  842. PMODULE_ENTRY mi
  843. );
  844. BOOL
  845. GetXData(
  846. HANDLE hp,
  847. PMODULE_ENTRY mi
  848. );
  849. PVOID
  850. GetXDataFromBase(
  851. HANDLE hp,
  852. DWORD64 base,
  853. ULONG* size
  854. );
  855. PVOID
  856. GetUnwindInfoFromSymbols(
  857. HANDLE hProcess,
  858. DWORD64 ModuleBase,
  859. ULONG UnwindInfoAddress,
  860. ULONG* Size
  861. );
  862. // symbols.c
  863. char *
  864. TokenFromSymbolPath(
  865. char *path,
  866. char *token,
  867. int size
  868. );
  869. BOOL
  870. CreateSymbolPath(
  871. int pass,
  872. char *base,
  873. char *iext,
  874. char *node,
  875. char *ext,
  876. char *path,
  877. size_t size
  878. );
  879. BOOL
  880. DoEnumCallback(
  881. PPROCESS_ENTRY pe,
  882. PSYMBOL_INFO pSymInfo,
  883. ULONG SymSize,
  884. PROC EnumCallback,
  885. PVOID UserContext,
  886. BOOL Use64,
  887. BOOL UsesUnicode
  888. );
  889. #ifdef __cpluspluss
  890. extern "C" {
  891. #endif
  892. BOOL
  893. MatchSymbolName(
  894. PSYMBOL_ENTRY sym,
  895. LPSTR SymName
  896. );
  897. // flags parameter to LoadSymbols
  898. #define LS_QUALIFIED 0x1
  899. #define LS_LOAD_LINES 0x2
  900. #define LS_JUST_TEST 0x4
  901. #define LS_FAIL_IF_LOADED 0x8
  902. // flags indicate Next or Previous for many functions
  903. #define NP_NEXT 1
  904. #define NP_PREV -1
  905. BOOL
  906. DoSymbolCallback (
  907. PPROCESS_ENTRY ProcessEntry,
  908. ULONG CallbackType,
  909. IN PMODULE_ENTRY mi,
  910. PIMAGEHLP_DEFERRED_SYMBOL_LOAD64 idsl64,
  911. LPSTR FileName
  912. );
  913. BOOL
  914. DoCallback(
  915. PPROCESS_ENTRY pe,
  916. ULONG type,
  917. PVOID data
  918. );
  919. BOOL
  920. IsCallback(
  921. PPROCESS_ENTRY pe
  922. );
  923. BOOL
  924. wcs2ansi(
  925. PWSTR pwsz,
  926. PSTR psz,
  927. DWORD pszlen
  928. );
  929. BOOL
  930. ansi2wcs(
  931. PCSTR psz,
  932. PWSTR pwsz,
  933. DWORD pwszlen
  934. );
  935. PWSTR AnsiToUnicode(PSTR);
  936. PSTR UnicodeToAnsi(PWSTR);
  937. void
  938. RemoveSourceForModuleFromHintList(
  939. PPROCESS_ENTRY pe,
  940. PMODULE_ENTRY mi
  941. );
  942. ULONG
  943. GetAddressFromOffset(
  944. PMODULE_ENTRY mi,
  945. ULONG section,
  946. ULONG64 Offset,
  947. PULONG64 pAddress
  948. );
  949. VOID
  950. AddSourceEntry(
  951. PMODULE_ENTRY mi,
  952. PSOURCE_ENTRY Src
  953. );
  954. // from vsym.c
  955. BOOL
  956. vsAddSymbol(
  957. PMODULE_ENTRY mi,
  958. PCSTR name,
  959. DWORD64 addr,
  960. DWORD size
  961. );
  962. BOOL
  963. vsDeleteSymbol(
  964. PMODULE_ENTRY mi,
  965. PCSTR name,
  966. DWORD64 addr
  967. );
  968. BOOL
  969. _vsEnumSymbols(
  970. PMODULE_ENTRY mi
  971. );
  972. BOOL
  973. vsMatchSymbol(
  974. PVIRTUAL_SYMBOL vs,
  975. PCSTR name,
  976. DWORD64 addr
  977. );
  978. PVIRTUAL_SYMBOL
  979. vsGetSymbol(
  980. PMODULE_ENTRY mi,
  981. PCSTR name,
  982. DWORD64 addr
  983. );
  984. __inline
  985. PVIRTUAL_SYMBOL
  986. vsBlankSymbol(
  987. PMODULE_ENTRY mi
  988. )
  989. {
  990. return vsGetSymbol(mi, NULL, 0);
  991. }
  992. BOOL
  993. vsGetSymbols(
  994. IN PPROCESS_ENTRY pe,
  995. IN PMODULE_ENTRY mi,
  996. IN PCSTR mask,
  997. IN DWORD64 addr,
  998. IN PROC callback,
  999. IN PVOID context,
  1000. IN BOOL use64,
  1001. IN BOOL unicode
  1002. );
  1003. __inline
  1004. BOOL
  1005. vsEnumSymbols(
  1006. IN PPROCESS_ENTRY pe,
  1007. IN PMODULE_ENTRY mi,
  1008. IN PCSTR mask,
  1009. IN PROC callback,
  1010. IN PVOID context,
  1011. IN BOOL use64,
  1012. IN BOOL unicode
  1013. )
  1014. {
  1015. return vsGetSymbols(pe, mi, mask, 0, callback, context, use64, unicode);
  1016. }
  1017. __inline
  1018. BOOL
  1019. vsEnumSymbolsForAddr(
  1020. IN PPROCESS_ENTRY pe,
  1021. IN PMODULE_ENTRY mi,
  1022. IN DWORD64 addr,
  1023. IN PROC callback,
  1024. IN PVOID context,
  1025. IN BOOL use64,
  1026. IN BOOL unicode
  1027. )
  1028. {
  1029. return vsGetSymbols(pe, mi, NULL, addr, callback, context, use64, unicode);
  1030. }
  1031. PSYMBOL_INFO
  1032. vsFindSymbolByName(
  1033. PPROCESS_ENTRY pe,
  1034. PMODULE_ENTRY mi,
  1035. LPSTR SymName
  1036. );
  1037. PSYMBOL_INFO
  1038. vsGetSymNextPrev(
  1039. PMODULE_ENTRY mi,
  1040. DWORD64 addr,
  1041. BOOL direction
  1042. );
  1043. PSYMBOL_INFO
  1044. vsGetSymFromAddr(
  1045. PMODULE_ENTRY mi,
  1046. DWORD64 addr,
  1047. PDWORD64 disp
  1048. );
  1049. PSYMBOL_ENTRY
  1050. vsGetSymEntryFromAddr(
  1051. PMODULE_ENTRY mi,
  1052. DWORD64 addr,
  1053. PDWORD64 disp
  1054. );
  1055. // from dia.c
  1056. BOOL diaInit();
  1057. void diaCleanup();
  1058. void
  1059. diaRelease(
  1060. PVOID dia
  1061. );
  1062. LONG
  1063. diaCountGlobals(
  1064. PMODULE_ENTRY mi
  1065. );
  1066. BOOL
  1067. diaGetPdb(
  1068. PIMGHLP_DEBUG_DATA idd
  1069. );
  1070. BOOL
  1071. diaReadStream(
  1072. PMODULE_ENTRY mi,
  1073. char *stream,
  1074. PBYTE *buf,
  1075. DWORD *size
  1076. );
  1077. BOOL
  1078. diaEnumSourceFiles(
  1079. IN PMODULE_ENTRY mi,
  1080. IN PCHAR mask,
  1081. IN PSYM_ENUMSOURCFILES_CALLBACK cbSrcFiles,
  1082. IN PVOID context
  1083. );
  1084. BOOL
  1085. diaGetSymbolsByTag(
  1086. PPROCESS_ENTRY pe,
  1087. PMODULE_ENTRY mi,
  1088. PCSTR name,
  1089. DWORD64 addr,
  1090. DWORD tag,
  1091. PROC callback,
  1092. PVOID context,
  1093. BOOL use64,
  1094. BOOL unicode,
  1095. DWORD flags
  1096. );
  1097. PSYMBOL_INFO
  1098. diaGetSymFromToken(
  1099. PMODULE_ENTRY mi,
  1100. DWORD token
  1101. );
  1102. BOOL
  1103. diaGetPData(
  1104. PMODULE_ENTRY mi
  1105. );
  1106. BOOL
  1107. diaGetXData(
  1108. PMODULE_ENTRY mi
  1109. );
  1110. PSYMBOL_INFO
  1111. diaFindSymbolByName(
  1112. PPROCESS_ENTRY pe,
  1113. PMODULE_ENTRY mi,
  1114. LPSTR SymName
  1115. );
  1116. BOOL
  1117. diaEnumerateSymbols(
  1118. IN PPROCESS_ENTRY pe,
  1119. IN PMODULE_ENTRY mi,
  1120. IN PCSTR mask,
  1121. IN PROC callback,
  1122. IN PVOID UserContext,
  1123. IN BOOL Use64,
  1124. IN BOOL CallBackUsesUnicode
  1125. );
  1126. BOOL
  1127. diaEnumSymForAddr(
  1128. IN PPROCESS_ENTRY pe,
  1129. IN PMODULE_ENTRY mi,
  1130. IN DWORD64 addr,
  1131. IN PROC callback,
  1132. IN PVOID context,
  1133. IN BOOL use64,
  1134. IN BOOL unicode
  1135. );
  1136. PSYMBOL_INFO
  1137. diaGetSymFromAddr(
  1138. PMODULE_ENTRY mi,
  1139. DWORD64 addr,
  1140. PDWORD64 disp
  1141. );
  1142. PSYMBOL_INFO
  1143. diaGetSymFromAddrByTag(
  1144. PMODULE_ENTRY mi,
  1145. DWORD64 addr,
  1146. DWORD tag,
  1147. PDWORD64 disp
  1148. );
  1149. BOOL
  1150. diaEnumLines(
  1151. IN PPROCESS_ENTRY pe,
  1152. IN PMODULE_ENTRY mi,
  1153. IN PCSTR obj,
  1154. IN PCSTR file,
  1155. IN PSYM_ENUMLINES_CALLBACK cb,
  1156. IN PVOID context
  1157. );
  1158. BOOL
  1159. diaGetLineFromAddr(
  1160. PMODULE_ENTRY mi,
  1161. DWORD64 addr,
  1162. PDWORD displacement,
  1163. PSRCCODEINFO sci
  1164. );
  1165. BOOL
  1166. diaGetLineNextPrev(
  1167. PMODULE_ENTRY mi,
  1168. PIMAGEHLP_LINE64 line,
  1169. DWORD direction
  1170. );
  1171. #define diaGetLineNext(mi, line) diaGetLineNextPrev(mi, line, NP_NEXT);
  1172. #define diaGetLinePrev(mi, line) diaGetLineNextPrev(mi, line, NP_PREV);
  1173. BOOL
  1174. diaGetLineFromName(
  1175. PMODULE_ENTRY mi,
  1176. LPSTR filename,
  1177. DWORD linenumber,
  1178. PLONG displacement,
  1179. PSRCCODEINFO sci,
  1180. DWORD method
  1181. );
  1182. PSYMBOL_INFO
  1183. diaGetSymNextPrev(
  1184. PMODULE_ENTRY mi,
  1185. DWORD64 addr,
  1186. int direction
  1187. );
  1188. DWORD
  1189. diaVersion(
  1190. VOID
  1191. );
  1192. BOOL
  1193. diaSetModFromIP(
  1194. PPROCESS_ENTRY pe
  1195. );
  1196. HRESULT
  1197. diaGetSymbolInfo(
  1198. IN HANDLE hProcess,
  1199. IN DWORD64 ModBase,
  1200. IN ULONG TypeId,
  1201. IN IMAGEHLP_SYMBOL_TYPE_INFO GetType,
  1202. OUT PVOID pInfo
  1203. );
  1204. BOOL
  1205. diaGetTiForUDT(
  1206. PMODULE_ENTRY ModuleEntry,
  1207. LPSTR name,
  1208. PSYMBOL_INFO psi
  1209. );
  1210. BOOL
  1211. diaEnumUDT(
  1212. PMODULE_ENTRY ModuleEntry,
  1213. LPSTR name,
  1214. PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,
  1215. PVOID EnumContext
  1216. );
  1217. BOOL
  1218. diaGetFrameData(
  1219. IN HANDLE Process,
  1220. IN ULONGLONG Offset,
  1221. OUT interface IDiaFrameData** FrameData
  1222. );
  1223. BOOL
  1224. InitOutputString(
  1225. PCHAR sz
  1226. );
  1227. BOOL
  1228. TestOutputString(
  1229. PCHAR sz
  1230. );
  1231. // symmod.c
  1232. DWORD64
  1233. LoadModule(
  1234. IN HANDLE hp,
  1235. IN PSTR ImageName,
  1236. IN PSTR ModuleName,
  1237. IN DWORD64 BaseOfDll,
  1238. IN DWORD DllSize,
  1239. IN HANDLE hFile,
  1240. IN PMODLOAD_DATA data,
  1241. IN DWORD flags
  1242. );
  1243. BOOL
  1244. GetModule(
  1245. HANDLE hp,
  1246. LPSTR ModuleName,
  1247. DWORD64 ImageBase,
  1248. DWORD ImageSize,
  1249. PVOID Context
  1250. );
  1251. BOOL
  1252. GetDebugData(
  1253. PIMGHLP_DEBUG_DATA idd
  1254. );
  1255. BOOL
  1256. LoadSymbols(
  1257. HANDLE hp,
  1258. PMODULE_ENTRY mi,
  1259. DWORD flags
  1260. );
  1261. PIMGHLP_DEBUG_DATA
  1262. GetIDD(
  1263. HANDLE hFile,
  1264. LPSTR FileName,
  1265. LPSTR SymbolPath,
  1266. ULONG64 ImageBase,
  1267. DWORD dwFlags
  1268. );
  1269. BOOL
  1270. ExtMatch(
  1271. char *fname,
  1272. char *ext
  1273. );
  1274. __inline BOOL IsPdb(LPSTR fname)
  1275. {
  1276. return ExtMatch(fname, ".pdb");
  1277. }
  1278. __inline BOOL IsDbg(LPSTR fname)
  1279. {
  1280. return ExtMatch(fname, ".dbg");
  1281. }
  1282. PIMGHLP_DEBUG_DATA
  1283. InitIDD(
  1284. HANDLE hProcess,
  1285. HANDLE FileHandle,
  1286. LPSTR FileName,
  1287. LPSTR SymbolPath,
  1288. ULONG64 ImageBase,
  1289. DWORD SizeOfImage,
  1290. PMODLOAD_DATA mld,
  1291. DWORD CallerFlags,
  1292. ULONG dwFlags
  1293. );
  1294. PIMGHLP_DEBUG_DATA
  1295. InitDebugData(
  1296. VOID
  1297. );
  1298. void
  1299. ReleaseDebugData(
  1300. PIMGHLP_DEBUG_DATA,
  1301. DWORD
  1302. );
  1303. BOOL
  1304. IsImageMachineType64(
  1305. DWORD MachineType
  1306. );
  1307. ULONG
  1308. ReadImageData(
  1309. IN HANDLE hprocess,
  1310. IN ULONG64 ul,
  1311. IN ULONG64 addr,
  1312. OUT LPVOID buffer,
  1313. IN ULONG size
  1314. );
  1315. PVOID
  1316. MapItRO(
  1317. HANDLE FileHandle
  1318. );
  1319. // servers.c
  1320. void
  1321. symsrvClose(
  1322. VOID
  1323. );
  1324. BOOL
  1325. symsrvPath(
  1326. LPCSTR path
  1327. );
  1328. DWORD
  1329. symsrvGetFile(
  1330. IN PPROCESS_ENTRY pe,
  1331. IN LPCSTR ServerInfo,
  1332. IN LPCSTR FileName,
  1333. IN GUID *id,
  1334. IN DWORD two,
  1335. IN DWORD three,
  1336. OUT LPSTR FilePath
  1337. );
  1338. DWORD
  1339. symsrvGetFileMultiIndex(
  1340. IN PPROCESS_ENTRY pe,
  1341. IN LPCSTR ServerInfo,
  1342. IN LPCSTR FileName,
  1343. IN DWORD index1,
  1344. IN DWORD index2,
  1345. IN DWORD two,
  1346. IN DWORD three,
  1347. OUT LPSTR FilePath
  1348. );
  1349. void
  1350. symsrvClose(
  1351. VOID
  1352. );
  1353. void
  1354. symsrvSetOptions(
  1355. ULONG_PTR options,
  1356. ULONG64 data
  1357. );
  1358. void
  1359. symsrvSetCallback(
  1360. BOOL state
  1361. );
  1362. void
  1363. symsrvSetPrompts(
  1364. VOID
  1365. );
  1366. void symsrvSetDownstreamStore(
  1367. char *dir
  1368. );
  1369. BOOL
  1370. srcsrvInit(
  1371. HANDLE hp
  1372. );
  1373. BOOL
  1374. srcsrvCallback(
  1375. UINT_PTR action,
  1376. DWORD64 data,
  1377. DWORD64 context
  1378. );
  1379. #define gfnSrcSrvInit (g.fnSrcSrvInit)&&g.fnSrcSrvInit
  1380. #define gfnSrcSrvSetOptions (g.fnSrcSrvSetOptions)&&g.fnSrcSrvSetOptions
  1381. #define gfnSrcSrvGetOptions (g.fnSrcSrvGetOptions)&&g.fnSrcSrvGetOptions
  1382. #define gfnSrcSrvLoadModule (g.fnSrcSrvLoadModule)&&g.fnSrcSrvLoadModule
  1383. #define gfnSrcSrvUnloadModule (g.fnSrcSrvUnloadModule)&&g.fnSrcSrvUnloadModule
  1384. #define gfnSrcSrvCleanup (g.fnSrcSrvCleanup)&&g.fnSrcSrvCleanup
  1385. #define gfnSrcSrvRegisterCallback (g.fnSrcSrvRegisterCallback)&&g.fnSrcSrvRegisterCallback
  1386. #define gfnSrcSrvGetFile (g.fnSrcSrvGetFile)&&g.fnSrcSrvGetFile
  1387. #ifdef __cpluspluss
  1388. }
  1389. #endif