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.

105 lines
3.0 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // File: imagehelp.h
  4. // Copyright (C) 1994-1997 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This file is a re-director for IMAGEHLP.DLL. Rather than linking directly
  8. // with the DLL (which may not exist on Win 95 systems), this class will
  9. // dynamically load IMAGEHLP.DLL and then provide certain functions from it.
  10. // The functions currently available are those that I found immediately
  11. // useful, so this is not a complete list of IMAGEHLP functionality.
  12. //
  13. //-----------------------------------------------------------------------------
  14. #ifndef ESPUTIL_IMAGEHLP_H
  15. #define ESPUTIL_IMAGEHLP_H
  16. class LTAPIENTRY CImageHelp
  17. {
  18. public:
  19. CImageHelp();
  20. BOOL ImagehlpAvailable(void);
  21. BOOL EnumerateLoadedModules(HANDLE, PENUMLOADED_MODULES_CALLBACK, void *);
  22. PIMAGE_NT_HEADERS ImageNtHeader(LPVOID);
  23. LPAPI_VERSION ImagehlpApiVersion(void);
  24. BOOL StackWalk(
  25. DWORD MachineType,
  26. HANDLE hProcess,
  27. HANDLE hThread,
  28. LPSTACKFRAME StackFrame,
  29. LPVOID ContextRecord,
  30. PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine,
  31. PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine,
  32. PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine,
  33. PTRANSLATE_ADDRESS_ROUTINE TranslateAddress
  34. );
  35. BOOL SymGetModuleInfo(
  36. IN HANDLE hProcess,
  37. IN DWORD dwAddr,
  38. OUT PIMAGEHLP_MODULE ModuleInfo
  39. );
  40. LPVOID SymFunctionTableAccess(
  41. HANDLE hProcess,
  42. DWORD AddrBase
  43. );
  44. BOOL SymGetSymFromAddr(
  45. IN HANDLE hProcess,
  46. IN DWORD dwAddr,
  47. OUT PDWORD pdwDisplacement,
  48. OUT PIMAGEHLP_SYMBOL Symbol
  49. );
  50. BOOL SymInitialize(
  51. IN HANDLE hProcess,
  52. IN LPSTR UserSearchPath,
  53. IN BOOL fInvadeProcess
  54. );
  55. BOOL SymUnDName(
  56. IN PIMAGEHLP_SYMBOL sym, // Symbol to undecorate
  57. OUT LPSTR UnDecName, // Buffer to store undecorated name in
  58. IN DWORD UnDecNameLength // Size of the buffer
  59. );
  60. DWORD SymLoadModule(
  61. IN HANDLE hProcess,
  62. IN HANDLE hFile,
  63. IN PSTR ImageName,
  64. IN PSTR ModuleName,
  65. IN DWORD BaseOfDll,
  66. IN DWORD SizeOfDll
  67. );
  68. DWORD UnDecorateSymbolName(
  69. LPSTR DecoratedName, // Name to undecorate
  70. LPSTR UnDecoratedName, // If NULL, it will be allocated
  71. DWORD UndecoratedLength, // The maximym length
  72. DWORD Flags // See IMAGEHLP.H
  73. );
  74. DWORD SymGetOptions(void);
  75. DWORD SymSetOptions(DWORD);
  76. PIMAGE_NT_HEADERS CheckSumMappedFile(
  77. LPVOID BaseAddress,
  78. DWORD FileLength,
  79. LPDWORD HeaderSum,
  80. LPDWORD CheckSum
  81. );
  82. BOOL MakeSureDirectoryPathExists(const TCHAR *);
  83. private:
  84. void LoadImageHelp(void);
  85. };
  86. #endif