Lookup.vbs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. ' Create the SymGuard.Application object
  2. ' (this is designed to be safely cached in an ASP Application object variable)
  3. Dim app
  4. Set app = CreateObject("SymGuard.Application")
  5. ' Declare input values
  6. Dim strSymbolPath, strModuleName, strImageBase, strImageSize
  7. ' strSymbolPath = "\\allegiance\props\2006\Symbols"
  8. strSymbolPath = "C:\temp"
  9. strModuleName = "Allegiance" ' Get from XML
  10. strImageBase = "00400000" ' Get from XML
  11. strImageSize = "001D8000" ' Get from XML
  12. ' Create a SymGuard.Module object (may take a while)
  13. Dim module
  14. Set module = app.LoadModule(strSymbolPath, strModuleName, strImageBase, strImageSize)
  15. ' Display the properties of the module or symbol file
  16. WScript.Echo "SymbolPath = " & module.SymbolPath
  17. WScript.Echo "ModuleName = " & module.ModuleName
  18. WScript.Echo "ImageBase = &H" & Hex(module.ImageBase)
  19. WScript.Echo "ImageSize = &H" & Hex(module.ImageSize)
  20. WScript.Echo "TimeDateStamp = " & module.TimeDateStamp
  21. WScript.Echo "CheckSum = &H" & Hex(module.CheckSum)
  22. WScript.Echo "SymbolCount = &H" & Hex(module.SymbolCount)
  23. WScript.Echo "SymbolType = " & module.SymbolType
  24. WScript.Echo "ImageName = " & module.ImageName
  25. WScript.Echo "LoadedImageName = " & module.LoadedImageName
  26. ' Set the path-formatting options
  27. module.BuildPathBase = "D:\fedsrc" ' Gets stripped from beginning
  28. ' module.SourcePathBase = "\\oblivion0\builds\2006\CD2\Src" ' Gets prepended to beginning
  29. ' Find the symbol information for an address
  30. Dim strAddr
  31. strAddr = "00426297" ' Get from XML
  32. ' Display the symbol information for several addresses
  33. DisplaySymAddress module, "00426297" ' Get from XML
  34. DisplaySymAddress module, "0042117B" ' Get from XML
  35. DisplaySymAddress module, "0041F271" ' Get from XML
  36. DisplaySymAddress module, "004C9CC1" ' Get from XML
  37. DisplaySymAddress module, "004C9F50" ' Get from XML
  38. DisplaySymAddress module, "004A6610" ' Get from XML
  39. DisplaySymAddress module, "004A680A" ' Get from XML
  40. DisplaySymAddress module, "004AB998" ' Get from XML
  41. DisplaySymAddress module, "004757DF" ' Get from XML
  42. DisplaySymAddress module, "004A2DF8" ' Get from XML
  43. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  44. ' Displays all the known symbol information for the symbol at the specified
  45. ' address within the specified module.
  46. '
  47. Sub DisplaySymAddress(module, addr)
  48. ' Find the symbol information for the specified address
  49. Dim sym
  50. Set sym = module.GetSymbolFromAddress(addr)
  51. ' Display the properties of the symbol information object
  52. WScript.Echo " " & module.ModuleName & "!" & Hex(sym.Address) & " " & sym.Name & " " & sym.DecoratedName
  53. If Len(sym.SourceFileName) And sym.LineNumber Then
  54. WScript.Echo " " & sym.SourceFileName & "(" & sym.LineNumber & ")"
  55. WScript.Echo " BytesFromSymbol = " & sym.BytesFromSymbol
  56. WScript.Echo " BytesFromLine = " & sym.BytesFromLine
  57. End If
  58. End Sub