From 8d875a00109e6c908ef8c7af1a0dd274b0ff92cf Mon Sep 17 00:00:00 2001 From: dahall Date: Wed, 19 Aug 2020 20:55:22 -0600 Subject: [PATCH] Completed initial work on DbgHelp library that also includes ImageHlp.dll functions --- PInvoke/DbgHelp/CorrelationReport.md | 277 ++ PInvoke/DbgHelp/DbgHelp.Structs.cs | 481 +-- PInvoke/DbgHelp/DbgHelp.Sym.cs | 4061 ++++++++++++++++++++++++- PInvoke/DbgHelp/DbgHelp.cs | 96 +- PInvoke/DbgHelp/Vanara.PInvoke.DbgHelp.csproj | 32 +- README.md | 1 + UnitTests/PInvoke/DbgHelp/DbgHelpTests.cs | 82 +- 7 files changed, 4567 insertions(+), 463 deletions(-) create mode 100644 PInvoke/DbgHelp/CorrelationReport.md diff --git a/PInvoke/DbgHelp/CorrelationReport.md b/PInvoke/DbgHelp/CorrelationReport.md new file mode 100644 index 00000000..bc29a883 --- /dev/null +++ b/PInvoke/DbgHelp/CorrelationReport.md @@ -0,0 +1,277 @@ +## Correlation report for dbghelp.dll, imagehlp.dll +PInvoke API (methods, structures and constants) imported from Windows DbgHelp.dll. + +### Methods (100% complete, 217 of 217 functions) +Native Method | Native DLL | Header | Managed Method +--- | --- | --- | --- +[BindImageEx](https://www.google.com/search?num=5&q=BindImageEx+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.BindImageEx](https://github.com/dahall/Vanara/search?l=C%23&q=BindImageEx) +[CheckSumMappedFile](https://www.google.com/search?num=5&q=CheckSumMappedFile+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.CheckSumMappedFile](https://github.com/dahall/Vanara/search?l=C%23&q=CheckSumMappedFile) +[EnumDirTree](https://www.google.com/search?num=5&q=EnumDirTree+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.EnumDirTree](https://github.com/dahall/Vanara/search?l=C%23&q=EnumDirTree) +[EnumDirTreeA](https://www.google.com/search?num=5&q=EnumDirTreeA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.EnumDirTree](https://github.com/dahall/Vanara/search?l=C%23&q=EnumDirTree) +[EnumerateLoadedModules](https://www.google.com/search?num=5&q=EnumerateLoadedModules+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.EnumerateLoadedModules](https://github.com/dahall/Vanara/search?l=C%23&q=EnumerateLoadedModules) +[EnumerateLoadedModulesEx](https://www.google.com/search?num=5&q=EnumerateLoadedModulesEx+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.EnumerateLoadedModulesEx](https://github.com/dahall/Vanara/search?l=C%23&q=EnumerateLoadedModulesEx) +[EnumerateLoadedModulesW64](https://www.google.com/search?num=5&q=EnumerateLoadedModulesW64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.EnumerateLoadedModules64](https://github.com/dahall/Vanara/search?l=C%23&q=EnumerateLoadedModules64) +[FindDebugInfoFile](https://www.google.com/search?num=5&q=FindDebugInfoFile+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.FindDebugInfoFile](https://github.com/dahall/Vanara/search?l=C%23&q=FindDebugInfoFile) +[FindDebugInfoFileEx](https://www.google.com/search?num=5&q=FindDebugInfoFileEx+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.FindDebugInfoFileEx](https://github.com/dahall/Vanara/search?l=C%23&q=FindDebugInfoFileEx) +[FindDebugInfoFileExA](https://www.google.com/search?num=5&q=FindDebugInfoFileExA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.FindDebugInfoFileEx](https://github.com/dahall/Vanara/search?l=C%23&q=FindDebugInfoFileEx) +[FindExecutableImage](https://www.google.com/search?num=5&q=FindExecutableImage+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.FindExecutableImage](https://github.com/dahall/Vanara/search?l=C%23&q=FindExecutableImage) +[FindExecutableImageEx](https://www.google.com/search?num=5&q=FindExecutableImageEx+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.FindExecutableImageEx](https://github.com/dahall/Vanara/search?l=C%23&q=FindExecutableImageEx) +[FindExecutableImageExA](https://www.google.com/search?num=5&q=FindExecutableImageExA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.FindExecutableImageEx](https://github.com/dahall/Vanara/search?l=C%23&q=FindExecutableImageEx) +[GetImageConfigInformation](https://www.google.com/search?num=5&q=GetImageConfigInformation+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.GetImageConfigInformation](https://github.com/dahall/Vanara/search?l=C%23&q=GetImageConfigInformation) +[GetImageUnusedHeaderBytes](https://www.google.com/search?num=5&q=GetImageUnusedHeaderBytes+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.GetImageUnusedHeaderBytes](https://github.com/dahall/Vanara/search?l=C%23&q=GetImageUnusedHeaderBytes) +[GetSymLoadError](https://www.google.com/search?num=5&q=GetSymLoadError+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.GetSymLoadError](https://github.com/dahall/Vanara/search?l=C%23&q=GetSymLoadError) +[GetTimestampForLoadedLibrary](https://www.google.com/search?num=5&q=GetTimestampForLoadedLibrary+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.GetTimestampForLoadedLibrary](https://github.com/dahall/Vanara/search?l=C%23&q=GetTimestampForLoadedLibrary) +[ImageAddCertificate](https://www.google.com/search?num=5&q=ImageAddCertificate+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.ImageAddCertificate](https://github.com/dahall/Vanara/search?l=C%23&q=ImageAddCertificate) +[ImageDirectoryEntryToData](https://www.google.com/search?num=5&q=ImageDirectoryEntryToData+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.ImageDirectoryEntryToData](https://github.com/dahall/Vanara/search?l=C%23&q=ImageDirectoryEntryToData) +[ImageDirectoryEntryToDataEx](https://www.google.com/search?num=5&q=ImageDirectoryEntryToDataEx+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.ImageDirectoryEntryToDataEx](https://github.com/dahall/Vanara/search?l=C%23&q=ImageDirectoryEntryToDataEx) +[ImageEnumerateCertificates](https://www.google.com/search?num=5&q=ImageEnumerateCertificates+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.ImageEnumerateCertificates](https://github.com/dahall/Vanara/search?l=C%23&q=ImageEnumerateCertificates) +[ImageGetCertificateData](https://www.google.com/search?num=5&q=ImageGetCertificateData+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.ImageGetCertificateData](https://github.com/dahall/Vanara/search?l=C%23&q=ImageGetCertificateData) +[ImageGetCertificateHeader](https://www.google.com/search?num=5&q=ImageGetCertificateHeader+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.ImageGetCertificateHeader](https://github.com/dahall/Vanara/search?l=C%23&q=ImageGetCertificateHeader) +[ImageGetDigestStream](https://www.google.com/search?num=5&q=ImageGetDigestStream+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.ImageGetDigestStream](https://github.com/dahall/Vanara/search?l=C%23&q=ImageGetDigestStream) +[ImagehlpApiVersion](https://www.google.com/search?num=5&q=ImagehlpApiVersion+site%3Adocs.microsoft.com) | dbghelp.dll | | [Vanara.PInvoke.DbgHelp.ImagehlpApiVersionInternal](https://github.com/dahall/Vanara/search?l=C%23&q=ImagehlpApiVersionInternal) +[ImagehlpApiVersionEx](https://www.google.com/search?num=5&q=ImagehlpApiVersionEx+site%3Adocs.microsoft.com) | dbghelp.dll | | [Vanara.PInvoke.DbgHelp.ImagehlpApiVersionExInternal](https://github.com/dahall/Vanara/search?l=C%23&q=ImagehlpApiVersionExInternal) +[ImageLoad](https://www.google.com/search?num=5&q=ImageLoad+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.ImageLoad](https://github.com/dahall/Vanara/search?l=C%23&q=ImageLoad) +[ImageNtHeader](https://www.google.com/search?num=5&q=ImageNtHeader+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.ImageNtHeader](https://github.com/dahall/Vanara/search?l=C%23&q=ImageNtHeader) +[ImageRemoveCertificate](https://www.google.com/search?num=5&q=ImageRemoveCertificate+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.ImageRemoveCertificate](https://github.com/dahall/Vanara/search?l=C%23&q=ImageRemoveCertificate) +[ImageRvaToSection](https://www.google.com/search?num=5&q=ImageRvaToSection+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.ImageRvaToSection](https://github.com/dahall/Vanara/search?l=C%23&q=ImageRvaToSection) +[ImageRvaToVa](https://www.google.com/search?num=5&q=ImageRvaToVa+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.ImageRvaToVa](https://github.com/dahall/Vanara/search?l=C%23&q=ImageRvaToVa) +[ImageUnload](https://www.google.com/search?num=5&q=ImageUnload+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.ImageUnload](https://github.com/dahall/Vanara/search?l=C%23&q=ImageUnload) +[MakeSureDirectoryPathExists](https://www.google.com/search?num=5&q=MakeSureDirectoryPathExists+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.MakeSureDirectoryPathExists](https://github.com/dahall/Vanara/search?l=C%23&q=MakeSureDirectoryPathExists) +[MapAndLoad](https://www.google.com/search?num=5&q=MapAndLoad+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.MapAndLoad](https://github.com/dahall/Vanara/search?l=C%23&q=MapAndLoad) +[MapDebugInformation](https://www.google.com/search?num=5&q=MapDebugInformation+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.MapDebugInformation](https://github.com/dahall/Vanara/search?l=C%23&q=MapDebugInformation) +[MapFileAndCheckSum](https://www.google.com/search?num=5&q=MapFileAndCheckSumA+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.MapFileAndCheckSum](https://github.com/dahall/Vanara/search?l=C%23&q=MapFileAndCheckSum) +[ReBaseImage](https://www.google.com/search?num=5&q=ReBaseImage+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.ReBaseImage](https://github.com/dahall/Vanara/search?l=C%23&q=ReBaseImage) +[ReBaseImage64](https://www.google.com/search?num=5&q=ReBaseImage64+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.ReBaseImage64](https://github.com/dahall/Vanara/search?l=C%23&q=ReBaseImage64) +[SearchTreeForFile](https://www.google.com/search?num=5&q=SearchTreeForFile+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SearchTreeForFile](https://github.com/dahall/Vanara/search?l=C%23&q=SearchTreeForFile) +[SearchTreeForFileA](https://www.google.com/search?num=5&q=SearchTreeForFileA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SearchTreeForFile](https://github.com/dahall/Vanara/search?l=C%23&q=SearchTreeForFile) +[SetImageConfigInformation](https://www.google.com/search?num=5&q=SetImageConfigInformation+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.SetImageConfigInformation](https://github.com/dahall/Vanara/search?l=C%23&q=SetImageConfigInformation) +[SetSymLoadError](https://www.google.com/search?num=5&q=SetSymLoadError+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SetSymLoadError](https://github.com/dahall/Vanara/search?l=C%23&q=SetSymLoadError) +[SplitSymbols](https://www.google.com/search?num=5&q=SplitSymbols+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.SplitSymbols](https://github.com/dahall/Vanara/search?l=C%23&q=SplitSymbols) +[StackWalk](https://www.google.com/search?num=5&q=StackWalk+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.StackWalk](https://github.com/dahall/Vanara/search?l=C%23&q=StackWalk) +[StackWalk64](https://www.google.com/search?num=5&q=StackWalk64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.StackWalk64](https://github.com/dahall/Vanara/search?l=C%23&q=StackWalk64) +[StackWalkEx](https://www.google.com/search?num=5&q=StackWalkEx+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.StackWalkEx](https://github.com/dahall/Vanara/search?l=C%23&q=StackWalkEx) +[SymAddrIncludeInlineTrace](https://www.google.com/search?num=5&q=SymAddrIncludeInlineTrace+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymAddrIncludeInlineTrace](https://github.com/dahall/Vanara/search?l=C%23&q=SymAddrIncludeInlineTrace) +[SymAddSourceStream](https://www.google.com/search?num=5&q=SymAddSourceStream+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymAddSourceStream](https://github.com/dahall/Vanara/search?l=C%23&q=SymAddSourceStream) +[SymAddSymbol](https://www.google.com/search?num=5&q=SymAddSymbol+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymAddSymbol](https://github.com/dahall/Vanara/search?l=C%23&q=SymAddSymbol) +[SymAddSymbolA](https://www.google.com/search?num=5&q=SymAddSymbolA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymAddSymbol](https://github.com/dahall/Vanara/search?l=C%23&q=SymAddSymbol) +[SymbolServerSetOptionsA](https://www.google.com/search?num=5&q=SymbolServerSetOptionsA+site%3Adocs.microsoft.com) | Symsrv.dll | DbgHelp.h | [Vanara.PInvoke.DbgHelp.SymbolServerSetOptions](https://github.com/dahall/Vanara/search?l=C%23&q=SymbolServerSetOptions) +[SymbolServerSetOptionsW](https://www.google.com/search?num=5&q=SymbolServerSetOptionsW+site%3Adocs.microsoft.com) | Symsrv.dll | DbgHelp.h | [Vanara.PInvoke.DbgHelp.SymbolServerSetOptions](https://github.com/dahall/Vanara/search?l=C%23&q=SymbolServerSetOptions) +[SymCleanup](https://www.google.com/search?num=5&q=SymCleanup+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymCleanup](https://github.com/dahall/Vanara/search?l=C%23&q=SymCleanup) +[SymCompareInlineTrace](https://www.google.com/search?num=5&q=SymCompareInlineTrace+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymCompareInlineTrace](https://github.com/dahall/Vanara/search?l=C%23&q=SymCompareInlineTrace) +[SymDeleteSymbol](https://www.google.com/search?num=5&q=SymDeleteSymbol+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymDeleteSymbol](https://github.com/dahall/Vanara/search?l=C%23&q=SymDeleteSymbol) +[SymDeleteSymbolA](https://www.google.com/search?num=5&q=SymDeleteSymbolA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymDeleteSymbol](https://github.com/dahall/Vanara/search?l=C%23&q=SymDeleteSymbol) +[SymEnumerateModules](https://www.google.com/search?num=5&q=SymEnumerateModules+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumerateModules](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumerateModules) +[SymEnumerateModules64](https://www.google.com/search?num=5&q=SymEnumerateModules64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumerateModules64](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumerateModules64) +[SymEnumerateModulesW64](https://www.google.com/search?num=5&q=SymEnumerateModulesW64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumerateModulesW64](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumerateModulesW64) +[SymEnumLines](https://www.google.com/search?num=5&q=SymEnumLines+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumLines](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumLines) +[SymEnumLinesA](https://www.google.com/search?num=5&q=SymEnumLinesA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumLines](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumLines) +[SymEnumProcesses](https://www.google.com/search?num=5&q=SymEnumProcesses+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumProcesses](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumProcesses) +[SymEnumSourceFiles](https://www.google.com/search?num=5&q=SymEnumSourceFiles+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumSourceFiles](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumSourceFiles) +[SymEnumSourceFilesA](https://www.google.com/search?num=5&q=SymEnumSourceFilesA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumSourceFiles](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumSourceFiles) +[SymEnumSourceFileTokens](https://www.google.com/search?num=5&q=SymEnumSourceFileTokens+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumSourceFileTokens](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumSourceFileTokens) +[SymEnumSourceLines](https://www.google.com/search?num=5&q=SymEnumSourceLines+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumSourceLines](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumSourceLines) +[SymEnumSourceLinesA](https://www.google.com/search?num=5&q=SymEnumSourceLinesA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumSourceLines](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumSourceLines) +[SymEnumSymbols](https://www.google.com/search?num=5&q=SymEnumSymbols+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumSymbols](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumSymbols) +[SymEnumSymbolsA](https://www.google.com/search?num=5&q=SymEnumSymbolsA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumSymbols](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumSymbols) +[SymEnumSymbolsEx](https://www.google.com/search?num=5&q=SymEnumSymbolsEx+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumSymbolsEx](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumSymbolsEx) +[SymEnumSymbolsExA](https://www.google.com/search?num=5&q=SymEnumSymbolsExA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumSymbolsEx](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumSymbolsEx) +[SymEnumSymbolsForAddr](https://www.google.com/search?num=5&q=SymEnumSymbolsForAddr+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumSymbolsForAddr](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumSymbolsForAddr) +[SymEnumSymbolsForAddrA](https://www.google.com/search?num=5&q=SymEnumSymbolsForAddrA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumSymbolsForAddr](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumSymbolsForAddr) +[SymEnumTypes](https://www.google.com/search?num=5&q=SymEnumTypes+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumTypes](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumTypes) +[SymEnumTypesA](https://www.google.com/search?num=5&q=SymEnumTypesA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumTypes](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumTypes) +[SymEnumTypesByName](https://www.google.com/search?num=5&q=SymEnumTypesByName+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumTypesByName](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumTypesByName) +[SymEnumTypesByNameA](https://www.google.com/search?num=5&q=SymEnumTypesByNameA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymEnumTypesByName](https://github.com/dahall/Vanara/search?l=C%23&q=SymEnumTypesByName) +[SymFindDebugInfoFile](https://www.google.com/search?num=5&q=SymFindDebugInfoFile+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymFindDebugInfoFile](https://github.com/dahall/Vanara/search?l=C%23&q=SymFindDebugInfoFile) +[SymFindDebugInfoFileA](https://www.google.com/search?num=5&q=SymFindDebugInfoFileA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymFindDebugInfoFile](https://github.com/dahall/Vanara/search?l=C%23&q=SymFindDebugInfoFile) +[SymFindExecutableImage](https://www.google.com/search?num=5&q=SymFindExecutableImage+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymFindExecutableImage](https://github.com/dahall/Vanara/search?l=C%23&q=SymFindExecutableImage) +[SymFindExecutableImageA](https://www.google.com/search?num=5&q=SymFindExecutableImageA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymFindExecutableImage](https://github.com/dahall/Vanara/search?l=C%23&q=SymFindExecutableImage) +[SymFindFileInPath](https://www.google.com/search?num=5&q=SymFindFileInPath+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymFindFileInPath](https://github.com/dahall/Vanara/search?l=C%23&q=SymFindFileInPath) +[SymFindFileInPathA](https://www.google.com/search?num=5&q=SymFindFileInPathA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymFindFileInPath](https://github.com/dahall/Vanara/search?l=C%23&q=SymFindFileInPath) +[SymFromAddr](https://www.google.com/search?num=5&q=SymFromAddr+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymFromAddr](https://github.com/dahall/Vanara/search?l=C%23&q=SymFromAddr) +[SymFromAddrA](https://www.google.com/search?num=5&q=SymFromAddrA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymFromAddr](https://github.com/dahall/Vanara/search?l=C%23&q=SymFromAddr) +[SymFromIndex](https://www.google.com/search?num=5&q=SymFromIndex+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymFromIndex](https://github.com/dahall/Vanara/search?l=C%23&q=SymFromIndex) +[SymFromIndexA](https://www.google.com/search?num=5&q=SymFromIndexA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymFromIndex](https://github.com/dahall/Vanara/search?l=C%23&q=SymFromIndex) +[SymFromInlineContext](https://www.google.com/search?num=5&q=SymFromInlineContext+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymFromInlineContext](https://github.com/dahall/Vanara/search?l=C%23&q=SymFromInlineContext) +[SymFromInlineContextA](https://www.google.com/search?num=5&q=SymFromInlineContextA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymFromInlineContext](https://github.com/dahall/Vanara/search?l=C%23&q=SymFromInlineContext) +[SymFromName](https://www.google.com/search?num=5&q=SymFromName+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymFromName](https://github.com/dahall/Vanara/search?l=C%23&q=SymFromName) +[SymFromNameA](https://www.google.com/search?num=5&q=SymFromNameA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymFromName](https://github.com/dahall/Vanara/search?l=C%23&q=SymFromName) +[SymFromToken](https://www.google.com/search?num=5&q=SymFromToken+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymFromToken](https://github.com/dahall/Vanara/search?l=C%23&q=SymFromToken) +[SymFromTokenA](https://www.google.com/search?num=5&q=SymFromTokenA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymFromToken](https://github.com/dahall/Vanara/search?l=C%23&q=SymFromToken) +[SymFunctionTableAccess](https://www.google.com/search?num=5&q=SymFunctionTableAccess+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymFunctionTableAccess](https://github.com/dahall/Vanara/search?l=C%23&q=SymFunctionTableAccess) +[SymFunctionTableAccess64](https://www.google.com/search?num=5&q=SymFunctionTableAccess64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymFunctionTableAccess64](https://github.com/dahall/Vanara/search?l=C%23&q=SymFunctionTableAccess64) +[SymFunctionTableAccess64AccessRoutines](https://www.google.com/search?num=5&q=SymFunctionTableAccess64AccessRoutines+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymFunctionTableAccess64AccessRoutines](https://github.com/dahall/Vanara/search?l=C%23&q=SymFunctionTableAccess64AccessRoutines) +[SymGetExtendedOption](https://www.google.com/search?num=5&q=SymGetExtendedOption+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetExtendedOption](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetExtendedOption) +[SymGetFileLineOffsets64](https://www.google.com/search?num=5&q=SymGetFileLineOffsets64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetFileLineOffsets64](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetFileLineOffsets64) +[SymGetHomeDirectory](https://www.google.com/search?num=5&q=SymGetHomeDirectory+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetHomeDirectory](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetHomeDirectory) +[SymGetHomeDirectoryA](https://www.google.com/search?num=5&q=SymGetHomeDirectoryA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetHomeDirectory](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetHomeDirectory) +[SymGetLineFromAddr64](https://www.google.com/search?num=5&q=SymGetLineFromAddr64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetLineFromAddr64](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetLineFromAddr64) +[SymGetLineFromAddrA](https://www.google.com/search?num=5&q=SymGetLineFromAddrA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetLineFromAddr](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetLineFromAddr) +[SymGetLineFromAddrW](https://www.google.com/search?num=5&q=SymGetLineFromAddrW+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetLineFromAddr](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetLineFromAddr) +[SymGetLineFromAddrW64](https://www.google.com/search?num=5&q=SymGetLineFromAddrW64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetLineFromAddrW64](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetLineFromAddrW64) +[SymGetLineFromInlineContext](https://www.google.com/search?num=5&q=SymGetLineFromInlineContext+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetLineFromInlineContext](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetLineFromInlineContext) +[SymGetLineFromInlineContextA](https://www.google.com/search?num=5&q=SymGetLineFromInlineContextA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetLineFromInlineContext](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetLineFromInlineContext) +[SymGetLineFromName](https://www.google.com/search?num=5&q=SymGetLineFromName+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetLineFromName](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetLineFromName) +[SymGetLineFromName64](https://www.google.com/search?num=5&q=SymGetLineFromName64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetLineFromName64](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetLineFromName64) +[SymGetLineFromNameW64](https://www.google.com/search?num=5&q=SymGetLineFromNameW64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetLineFromNameW64](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetLineFromNameW64) +[SymGetLineNext64](https://www.google.com/search?num=5&q=SymGetLineNext64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetLineNext64](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetLineNext64) +[SymGetLineNextA](https://www.google.com/search?num=5&q=SymGetLineNextA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetLineNext](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetLineNext) +[SymGetLineNextW](https://www.google.com/search?num=5&q=SymGetLineNextW+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetLineNext](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetLineNext) +[SymGetLineNextW64](https://www.google.com/search?num=5&q=SymGetLineNextW64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetLineNextW64](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetLineNextW64) +[SymGetLinePrev64](https://www.google.com/search?num=5&q=SymGetLinePrev64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetLinePrev64](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetLinePrev64) +[SymGetLinePrevA](https://www.google.com/search?num=5&q=SymGetLinePrevA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetLinePrev](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetLinePrev) +[SymGetLinePrevW](https://www.google.com/search?num=5&q=SymGetLinePrevW+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetLinePrev](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetLinePrev) +[SymGetLinePrevW64](https://www.google.com/search?num=5&q=SymGetLinePrevW64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetLinePrevW64](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetLinePrevW64) +[SymGetModuleBase](https://www.google.com/search?num=5&q=SymGetModuleBase+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetModuleBase](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetModuleBase) +[SymGetModuleBase64](https://www.google.com/search?num=5&q=SymGetModuleBase64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetModuleBase64](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetModuleBase64) +[SymGetModuleInfo](https://www.google.com/search?num=5&q=SymGetModuleInfo+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetModuleInfo](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetModuleInfo) +[SymGetModuleInfo64](https://www.google.com/search?num=5&q=SymGetModuleInfo64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetModuleInfo64](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetModuleInfo64) +[SymGetModuleInfoA](https://www.google.com/search?num=5&q=SymGetModuleInfoA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetModuleInfo](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetModuleInfo) +[SymGetModuleInfoW64](https://www.google.com/search?num=5&q=SymGetModuleInfoW64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetModuleInfoW64](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetModuleInfoW64) +[SymGetOmaps](https://www.google.com/search?num=5&q=SymGetOmaps+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetOmaps](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetOmaps) +[SymGetOptions](https://www.google.com/search?num=5&q=SymGetOptions+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetOptions](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetOptions) +[SymGetScope](https://www.google.com/search?num=5&q=SymGetScope+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetScope](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetScope) +[SymGetScopeA](https://www.google.com/search?num=5&q=SymGetScopeA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetScope](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetScope) +[SymGetSearchPath](https://www.google.com/search?num=5&q=SymGetSearchPath+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSearchPath](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSearchPath) +[SymGetSearchPathA](https://www.google.com/search?num=5&q=SymGetSearchPathA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSearchPath](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSearchPath) +[SymGetSourceFile](https://www.google.com/search?num=5&q=SymGetSourceFile+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSourceFile](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSourceFile) +[SymGetSourceFileA](https://www.google.com/search?num=5&q=SymGetSourceFileA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSourceFile](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSourceFile) +[SymGetSourceFileChecksum](https://www.google.com/search?num=5&q=SymGetSourceFileChecksum+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSourceFileChecksum](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSourceFileChecksum) +[SymGetSourceFileChecksumA](https://www.google.com/search?num=5&q=SymGetSourceFileChecksumA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSourceFileChecksum](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSourceFileChecksum) +[SymGetSourceFileFromToken](https://www.google.com/search?num=5&q=SymGetSourceFileFromToken+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSourceFileFromToken](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSourceFileFromToken) +[SymGetSourceFileFromTokenA](https://www.google.com/search?num=5&q=SymGetSourceFileFromTokenA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSourceFileFromToken](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSourceFileFromToken) +[SymGetSourceFileToken](https://www.google.com/search?num=5&q=SymGetSourceFileToken+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSourceFileToken](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSourceFileToken) +[SymGetSourceFileTokenA](https://www.google.com/search?num=5&q=SymGetSourceFileTokenA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSourceFileToken](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSourceFileToken) +[SymGetSourceVarFromToken](https://www.google.com/search?num=5&q=SymGetSourceVarFromToken+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSourceVarFromToken](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSourceVarFromToken) +[SymGetSourceVarFromTokenA](https://www.google.com/search?num=5&q=SymGetSourceVarFromTokenA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSourceVarFromToken](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSourceVarFromToken) +[SymGetSymbolFile](https://www.google.com/search?num=5&q=SymGetSymbolFile+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSymbolFile](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSymbolFile) +[SymGetSymbolFileA](https://www.google.com/search?num=5&q=SymGetSymbolFileA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSymbolFile](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSymbolFile) +[SymGetSymFromAddr](https://www.google.com/search?num=5&q=SymGetSymFromAddr+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSymFromAddr](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSymFromAddr) +[SymGetSymFromAddr64](https://www.google.com/search?num=5&q=SymGetSymFromAddr64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSymFromAddr64](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSymFromAddr64) +[SymGetSymFromName](https://www.google.com/search?num=5&q=SymGetSymFromName+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSymFromName](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSymFromName) +[SymGetSymFromName64](https://www.google.com/search?num=5&q=SymGetSymFromName64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSymFromName64](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSymFromName64) +[SymGetSymNext64](https://www.google.com/search?num=5&q=SymGetSymNext64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSymNext64](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSymNext64) +[SymGetSymNextA](https://www.google.com/search?num=5&q=SymGetSymNextA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSymNext](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSymNext) +[SymGetSymNextW](https://www.google.com/search?num=5&q=SymGetSymNextW+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSymNext](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSymNext) +[SymGetSymNextW64](https://www.google.com/search?num=5&q=SymGetSymNextW64+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSymNextW64](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSymNextW64) +[SymGetSymPrev64](https://www.google.com/search?num=5&q=SymGetSymPrev64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSymPrev64](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSymPrev64) +[SymGetSymPrevW](https://www.google.com/search?num=5&q=SymGetSymPrevW+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSymPrev](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSymPrev) +[SymGetSymPrevW64](https://www.google.com/search?num=5&q=SymGetSymPrevW64+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetSymPrevW64](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetSymPrevW64) +[SymGetTypeFromName](https://www.google.com/search?num=5&q=SymGetTypeFromName+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetTypeFromName](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetTypeFromName) +[SymGetTypeFromNameA](https://www.google.com/search?num=5&q=SymGetTypeFromNameA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetTypeFromName](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetTypeFromName) +[SymGetTypeInfo](https://www.google.com/search?num=5&q=SymGetTypeInfo+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetTypeInfo](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetTypeInfo) +[SymGetTypeInfoEx](https://www.google.com/search?num=5&q=SymGetTypeInfoEx+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymGetTypeInfoEx](https://github.com/dahall/Vanara/search?l=C%23&q=SymGetTypeInfoEx) +[SymInitialize](https://www.google.com/search?num=5&q=SymInitialize+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymInitialize](https://github.com/dahall/Vanara/search?l=C%23&q=SymInitialize) +[SymInitializeA](https://www.google.com/search?num=5&q=SymInitializeA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymInitialize](https://github.com/dahall/Vanara/search?l=C%23&q=SymInitialize) +[SymLoadModule](https://www.google.com/search?num=5&q=SymLoadModule+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymLoadModule](https://github.com/dahall/Vanara/search?l=C%23&q=SymLoadModule) +[SymLoadModule64](https://www.google.com/search?num=5&q=SymLoadModule64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymLoadModule64](https://github.com/dahall/Vanara/search?l=C%23&q=SymLoadModule64) +[SymLoadModuleEx](https://www.google.com/search?num=5&q=SymLoadModuleEx+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymLoadModuleEx](https://github.com/dahall/Vanara/search?l=C%23&q=SymLoadModuleEx) +[SymLoadModuleExA](https://www.google.com/search?num=5&q=SymLoadModuleExA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymLoadModuleEx](https://github.com/dahall/Vanara/search?l=C%23&q=SymLoadModuleEx) +[SymMatchFileName](https://www.google.com/search?num=5&q=SymMatchFileName+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymMatchFileName](https://github.com/dahall/Vanara/search?l=C%23&q=SymMatchFileName) +[SymMatchFileNameA](https://www.google.com/search?num=5&q=SymMatchFileNameA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymMatchFileName](https://github.com/dahall/Vanara/search?l=C%23&q=SymMatchFileName) +[SymMatchString](https://www.google.com/search?num=5&q=SymMatchString+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymMatchString](https://github.com/dahall/Vanara/search?l=C%23&q=SymMatchString) +[SymNext](https://www.google.com/search?num=5&q=SymNext+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymNext](https://github.com/dahall/Vanara/search?l=C%23&q=SymNext) +[SymNextA](https://www.google.com/search?num=5&q=SymNextA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymNext](https://github.com/dahall/Vanara/search?l=C%23&q=SymNext) +[SymPrev](https://www.google.com/search?num=5&q=SymPrev+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymPrev](https://github.com/dahall/Vanara/search?l=C%23&q=SymPrev) +[SymPrevA](https://www.google.com/search?num=5&q=SymPrevA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymPrev](https://github.com/dahall/Vanara/search?l=C%23&q=SymPrev) +[SymQueryInlineTrace](https://www.google.com/search?num=5&q=SymQueryInlineTrace+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymQueryInlineTrace](https://github.com/dahall/Vanara/search?l=C%23&q=SymQueryInlineTrace) +[SymRefreshModuleList](https://www.google.com/search?num=5&q=SymRefreshModuleList+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymRefreshModuleList](https://github.com/dahall/Vanara/search?l=C%23&q=SymRefreshModuleList) +[SymRegisterCallback64](https://www.google.com/search?num=5&q=SymRegisterCallback64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymRegisterCallback64](https://github.com/dahall/Vanara/search?l=C%23&q=SymRegisterCallback64) +[SymRegisterCallbackA](https://www.google.com/search?num=5&q=SymRegisterCallbackA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymRegisterCallback](https://github.com/dahall/Vanara/search?l=C%23&q=SymRegisterCallback) +[SymRegisterCallbackW](https://www.google.com/search?num=5&q=SymRegisterCallbackW+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymRegisterCallback](https://github.com/dahall/Vanara/search?l=C%23&q=SymRegisterCallback) +[SymRegisterCallbackW64](https://www.google.com/search?num=5&q=SymRegisterCallbackW64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymRegisterCallbackW64](https://github.com/dahall/Vanara/search?l=C%23&q=SymRegisterCallbackW64) +[SymRegisterFunctionEntryCallback](https://www.google.com/search?num=5&q=SymRegisterFunctionEntryCallback+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymRegisterFunctionEntryCallback](https://github.com/dahall/Vanara/search?l=C%23&q=SymRegisterFunctionEntryCallback) +[SymRegisterFunctionEntryCallback64](https://www.google.com/search?num=5&q=SymRegisterFunctionEntryCallback64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymRegisterFunctionEntryCallback64](https://github.com/dahall/Vanara/search?l=C%23&q=SymRegisterFunctionEntryCallback64) +[SymSearch](https://www.google.com/search?num=5&q=SymSearch+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSearch](https://github.com/dahall/Vanara/search?l=C%23&q=SymSearch) +[SymSearchA](https://www.google.com/search?num=5&q=SymSearchA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSearch](https://github.com/dahall/Vanara/search?l=C%23&q=SymSearch) +[SymSetContext](https://www.google.com/search?num=5&q=SymSetContext+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSetContext](https://github.com/dahall/Vanara/search?l=C%23&q=SymSetContext) +[SymSetExtendedOption](https://www.google.com/search?num=5&q=SymSetExtendedOption+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSetExtendedOption](https://github.com/dahall/Vanara/search?l=C%23&q=SymSetExtendedOption) +[SymSetHomeDirectory](https://www.google.com/search?num=5&q=SymSetHomeDirectory+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSetHomeDirectory](https://github.com/dahall/Vanara/search?l=C%23&q=SymSetHomeDirectory) +[SymSetHomeDirectoryA](https://www.google.com/search?num=5&q=SymSetHomeDirectoryA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSetHomeDirectory](https://github.com/dahall/Vanara/search?l=C%23&q=SymSetHomeDirectory) +[SymSetOptions](https://www.google.com/search?num=5&q=SymSetOptions+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSetOptions](https://github.com/dahall/Vanara/search?l=C%23&q=SymSetOptions) +[SymSetParentWindow](https://www.google.com/search?num=5&q=SymSetParentWindow+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSetParentWindow](https://github.com/dahall/Vanara/search?l=C%23&q=SymSetParentWindow) +[SymSetScopeFromAddr](https://www.google.com/search?num=5&q=SymSetScopeFromAddr+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSetScopeFromAddr](https://github.com/dahall/Vanara/search?l=C%23&q=SymSetScopeFromAddr) +[SymSetScopeFromIndex](https://www.google.com/search?num=5&q=SymSetScopeFromIndex+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSetScopeFromIndex](https://github.com/dahall/Vanara/search?l=C%23&q=SymSetScopeFromIndex) +[SymSetScopeFromInlineContext](https://www.google.com/search?num=5&q=SymSetScopeFromInlineContext+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSetScopeFromInlineContext](https://github.com/dahall/Vanara/search?l=C%23&q=SymSetScopeFromInlineContext) +[SymSetSearchPath](https://www.google.com/search?num=5&q=SymSetSearchPath+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSetSearchPath](https://github.com/dahall/Vanara/search?l=C%23&q=SymSetSearchPath) +[SymSetSearchPathA](https://www.google.com/search?num=5&q=SymSetSearchPathA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSetSearchPath](https://github.com/dahall/Vanara/search?l=C%23&q=SymSetSearchPath) +[SymSrvDeltaName](https://www.google.com/search?num=5&q=SymSrvDeltaName+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSrvDeltaName](https://github.com/dahall/Vanara/search?l=C%23&q=SymSrvDeltaName) +[SymSrvDeltaNameA](https://www.google.com/search?num=5&q=SymSrvDeltaNameA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSrvDeltaName](https://github.com/dahall/Vanara/search?l=C%23&q=SymSrvDeltaName) +[SymSrvGetFileIndexes](https://www.google.com/search?num=5&q=SymSrvGetFileIndexes+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSrvGetFileIndexes](https://github.com/dahall/Vanara/search?l=C%23&q=SymSrvGetFileIndexes) +[SymSrvGetFileIndexesA](https://www.google.com/search?num=5&q=SymSrvGetFileIndexesA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSrvGetFileIndexes](https://github.com/dahall/Vanara/search?l=C%23&q=SymSrvGetFileIndexes) +[SymSrvGetFileIndexInfo](https://www.google.com/search?num=5&q=SymSrvGetFileIndexInfo+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSrvGetFileIndexInfo](https://github.com/dahall/Vanara/search?l=C%23&q=SymSrvGetFileIndexInfo) +[SymSrvGetFileIndexInfoA](https://www.google.com/search?num=5&q=SymSrvGetFileIndexInfoA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSrvGetFileIndexInfo](https://github.com/dahall/Vanara/search?l=C%23&q=SymSrvGetFileIndexInfo) +[SymSrvGetFileIndexString](https://www.google.com/search?num=5&q=SymSrvGetFileIndexString+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSrvGetFileIndexString](https://github.com/dahall/Vanara/search?l=C%23&q=SymSrvGetFileIndexString) +[SymSrvGetFileIndexStringA](https://www.google.com/search?num=5&q=SymSrvGetFileIndexStringA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSrvGetFileIndexString](https://github.com/dahall/Vanara/search?l=C%23&q=SymSrvGetFileIndexString) +[SymSrvGetSupplement](https://www.google.com/search?num=5&q=SymSrvGetSupplement+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSrvGetSupplement](https://github.com/dahall/Vanara/search?l=C%23&q=SymSrvGetSupplement) +[SymSrvGetSupplementA](https://www.google.com/search?num=5&q=SymSrvGetSupplementA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSrvGetSupplement](https://github.com/dahall/Vanara/search?l=C%23&q=SymSrvGetSupplement) +[SymSrvIsStore](https://www.google.com/search?num=5&q=SymSrvIsStore+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSrvIsStore](https://github.com/dahall/Vanara/search?l=C%23&q=SymSrvIsStore) +[SymSrvIsStoreA](https://www.google.com/search?num=5&q=SymSrvIsStoreA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSrvIsStore](https://github.com/dahall/Vanara/search?l=C%23&q=SymSrvIsStore) +[SymSrvStoreFile](https://www.google.com/search?num=5&q=SymSrvStoreFile+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSrvStoreFile](https://github.com/dahall/Vanara/search?l=C%23&q=SymSrvStoreFile) +[SymSrvStoreFileA](https://www.google.com/search?num=5&q=SymSrvStoreFileA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSrvStoreFile](https://github.com/dahall/Vanara/search?l=C%23&q=SymSrvStoreFile) +[SymSrvStoreSupplement](https://www.google.com/search?num=5&q=SymSrvStoreSupplement+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSrvStoreSupplement](https://github.com/dahall/Vanara/search?l=C%23&q=SymSrvStoreSupplement) +[SymSrvStoreSupplementA](https://www.google.com/search?num=5&q=SymSrvStoreSupplementA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymSrvStoreSupplement](https://github.com/dahall/Vanara/search?l=C%23&q=SymSrvStoreSupplement) +[SymUnDName](https://www.google.com/search?num=5&q=SymUnDName+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymUnDName](https://github.com/dahall/Vanara/search?l=C%23&q=SymUnDName) +[SymUnDName64](https://www.google.com/search?num=5&q=SymUnDName64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymUnDName64](https://github.com/dahall/Vanara/search?l=C%23&q=SymUnDName64) +[SymUnloadModule](https://www.google.com/search?num=5&q=SymUnloadModule+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymUnloadModule](https://github.com/dahall/Vanara/search?l=C%23&q=SymUnloadModule) +[SymUnloadModule64](https://www.google.com/search?num=5&q=SymUnloadModule64+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.SymUnloadModule64](https://github.com/dahall/Vanara/search?l=C%23&q=SymUnloadModule64) +[TouchFileTimes](https://www.google.com/search?num=5&q=TouchFileTimes+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.TouchFileTimes](https://github.com/dahall/Vanara/search?l=C%23&q=TouchFileTimes) +[UnDecorateSymbolName](https://www.google.com/search?num=5&q=UnDecorateSymbolName+site%3Adocs.microsoft.com) | dbghelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.UnDecorateSymbolName](https://github.com/dahall/Vanara/search?l=C%23&q=UnDecorateSymbolName) +[UnDecorateSymbolNameA](https://www.google.com/search?num=5&q=UnDecorateSymbolNameA+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.UnDecorateSymbolName](https://github.com/dahall/Vanara/search?l=C%23&q=UnDecorateSymbolName) +[UnMapAndLoad](https://www.google.com/search?num=5&q=UnMapAndLoad+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.UnMapAndLoad](https://github.com/dahall/Vanara/search?l=C%23&q=UnMapAndLoad) +[UnmapDebugInformation](https://www.google.com/search?num=5&q=UnmapDebugInformation+site%3Adocs.microsoft.com) | DbgHelp.dll | dbghelp.h | [Vanara.PInvoke.DbgHelp.UnmapDebugInformation](https://github.com/dahall/Vanara/search?l=C%23&q=UnmapDebugInformation) +[UpdateDebugInfoFile](https://www.google.com/search?num=5&q=UpdateDebugInfoFile+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.UpdateDebugInfoFile](https://github.com/dahall/Vanara/search?l=C%23&q=UpdateDebugInfoFile) +[UpdateDebugInfoFileEx](https://www.google.com/search?num=5&q=UpdateDebugInfoFileEx+site%3Adocs.microsoft.com) | imagehlp.dll | imagehlp.h | [Vanara.PInvoke.ImageHlp.UpdateDebugInfoFileEx](https://github.com/dahall/Vanara/search?l=C%23&q=UpdateDebugInfoFileEx) +### Structures +Native Structure | Header | Managed Structure +--- | --- | --- +[<_DataDirectory>e__FixedBuffer](https://www.google.com/search?num=5&q=<_DataDirectory>e__FixedBuffer+site%3Adocs.microsoft.com) | | [Vanara.PInvoke.DbgHelp.IMAGE_OPTIONAL_HEADER.<_DataDirectory>e__FixedBuffer](https://github.com/dahall/Vanara/search?l=C%23&q=<_DataDirectory>e__FixedBuffer) +[ADDRESS](https://www.google.com/search?num=5&q=ADDRESS+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.ADDRESS](https://github.com/dahall/Vanara/search?l=C%23&q=ADDRESS) +[ADDRESS64](https://www.google.com/search?num=5&q=ADDRESS64+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.ADDRESS64](https://github.com/dahall/Vanara/search?l=C%23&q=ADDRESS64) +[API_VERSION](https://www.google.com/search?num=5&q=API_VERSION+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.API_VERSION](https://github.com/dahall/Vanara/search?l=C%23&q=API_VERSION) +[FPO_DATA](https://www.google.com/search?num=5&q=FPO_DATA+site%3Adocs.microsoft.com) | winnt.h | [Vanara.PInvoke.DbgHelp.FPO_DATA](https://github.com/dahall/Vanara/search?l=C%23&q=FPO_DATA) +[IMAGE_COFF_SYMBOLS_HEADER](https://www.google.com/search?num=5&q=IMAGE_COFF_SYMBOLS_HEADER+site%3Adocs.microsoft.com) | winnt.h | [Vanara.PInvoke.DbgHelp.IMAGE_COFF_SYMBOLS_HEADER](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGE_COFF_SYMBOLS_HEADER) +[IMAGE_DATA_DIRECTORY](https://www.google.com/search?num=5&q=IMAGE_DATA_DIRECTORY+site%3Adocs.microsoft.com) | winnt.h | [Vanara.PInvoke.DbgHelp.IMAGE_DATA_DIRECTORY](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGE_DATA_DIRECTORY) +[IMAGE_DEBUG_DIRECTORY](https://www.google.com/search?num=5&q=IMAGE_DEBUG_DIRECTORY+site%3Adocs.microsoft.com) | winnt.h | [Vanara.PInvoke.DbgHelp.IMAGE_DEBUG_DIRECTORY](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGE_DEBUG_DIRECTORY) +[IMAGE_DEBUG_INFORMATION](https://www.google.com/search?num=5&q=IMAGE_DEBUG_INFORMATION+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.IMAGE_DEBUG_INFORMATION](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGE_DEBUG_INFORMATION) +[IMAGE_EXPORT_DIRECTORY](https://www.google.com/search?num=5&q=IMAGE_EXPORT_DIRECTORY+site%3Adocs.microsoft.com) | winnt.h | [Vanara.PInvoke.DbgHelp.IMAGE_EXPORT_DIRECTORY](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGE_EXPORT_DIRECTORY) +[IMAGE_FILE_HEADER](https://www.google.com/search?num=5&q=IMAGE_FILE_HEADER+site%3Adocs.microsoft.com) | winnt.h | [Vanara.PInvoke.DbgHelp.IMAGE_FILE_HEADER](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGE_FILE_HEADER) +[IMAGE_FUNCTION_ENTRY](https://www.google.com/search?num=5&q=IMAGE_FUNCTION_ENTRY+site%3Adocs.microsoft.com) | winnt.h | [Vanara.PInvoke.DbgHelp.IMAGE_FUNCTION_ENTRY](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGE_FUNCTION_ENTRY) +[IMAGE_LOAD_CONFIG_CODE_INTEGRITY](https://www.google.com/search?num=5&q=IMAGE_LOAD_CONFIG_CODE_INTEGRITY+site%3Adocs.microsoft.com) | winnt.h | [Vanara.PInvoke.DbgHelp.IMAGE_LOAD_CONFIG_CODE_INTEGRITY](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGE_LOAD_CONFIG_CODE_INTEGRITY) +[IMAGE_LOAD_CONFIG_DIRECTORY32](https://www.google.com/search?num=5&q=IMAGE_LOAD_CONFIG_DIRECTORY32+site%3Adocs.microsoft.com) | winnt.h | [Vanara.PInvoke.DbgHelp.IMAGE_LOAD_CONFIG_DIRECTORY32](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGE_LOAD_CONFIG_DIRECTORY32) +[IMAGE_LOAD_CONFIG_DIRECTORY64](https://www.google.com/search?num=5&q=IMAGE_LOAD_CONFIG_DIRECTORY64+site%3Adocs.microsoft.com) | winnt.h | [Vanara.PInvoke.DbgHelp.IMAGE_LOAD_CONFIG_DIRECTORY64](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGE_LOAD_CONFIG_DIRECTORY64) +[IMAGE_NT_HEADERS](https://www.google.com/search?num=5&q=IMAGE_NT_HEADERS+site%3Adocs.microsoft.com) | winnt.h | [Vanara.PInvoke.DbgHelp.IMAGE_NT_HEADERS](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGE_NT_HEADERS) +[IMAGE_OPTIONAL_HEADER](https://www.google.com/search?num=5&q=IMAGE_OPTIONAL_HEADER+site%3Adocs.microsoft.com) | winnt.h | [Vanara.PInvoke.DbgHelp.IMAGE_OPTIONAL_HEADER](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGE_OPTIONAL_HEADER) +[IMAGE_RUNTIME_FUNCTION_ENTRY](https://www.google.com/search?num=5&q=IMAGE_RUNTIME_FUNCTION_ENTRY+site%3Adocs.microsoft.com) | winnt.h | [Vanara.PInvoke.DbgHelp.IMAGE_RUNTIME_FUNCTION_ENTRY](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGE_RUNTIME_FUNCTION_ENTRY) +[IMAGE_SECTION_HEADER](https://www.google.com/search?num=5&q=IMAGE_SECTION_HEADER+site%3Adocs.microsoft.com) | winnt.h | [Vanara.PInvoke.DbgHelp.IMAGE_SECTION_HEADER](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGE_SECTION_HEADER) +[IMAGEHLP_CBA_EVENT](https://www.google.com/search?num=5&q=IMAGEHLP_CBA_EVENT+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.IMAGEHLP_CBA_EVENT](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGEHLP_CBA_EVENT) +[IMAGEHLP_CBA_READ_MEMORY](https://www.google.com/search?num=5&q=IMAGEHLP_CBA_READ_MEMORY+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.IMAGEHLP_CBA_READ_MEMORY](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGEHLP_CBA_READ_MEMORY) +[IMAGEHLP_DEFERRED_SYMBOL_LOAD](https://www.google.com/search?num=5&q=IMAGEHLP_DEFERRED_SYMBOL_LOAD+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.IMAGEHLP_DEFERRED_SYMBOL_LOAD](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGEHLP_DEFERRED_SYMBOL_LOAD) +[IMAGEHLP_DEFERRED_SYMBOL_LOAD64](https://www.google.com/search?num=5&q=IMAGEHLP_DEFERRED_SYMBOL_LOAD64+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.IMAGEHLP_DEFERRED_SYMBOL_LOAD64](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGEHLP_DEFERRED_SYMBOL_LOAD64) +[IMAGEHLP_DEFERRED_SYMBOL_LOADW64](https://www.google.com/search?num=5&q=IMAGEHLP_DEFERRED_SYMBOL_LOADW64+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.IMAGEHLP_DEFERRED_SYMBOL_LOADW64](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGEHLP_DEFERRED_SYMBOL_LOADW64) +[IMAGEHLP_DUPLICATE_SYMBOL64](https://www.google.com/search?num=5&q=IMAGEHLP_DUPLICATE_SYMBOL64+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.IMAGEHLP_DUPLICATE_SYMBOL64](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGEHLP_DUPLICATE_SYMBOL64) +[IMAGEHLP_GET_TYPE_INFO_PARAMS](https://www.google.com/search?num=5&q=IMAGEHLP_GET_TYPE_INFO_PARAMS+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.IMAGEHLP_GET_TYPE_INFO_PARAMS](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGEHLP_GET_TYPE_INFO_PARAMS) +[IMAGEHLP_LINE](https://www.google.com/search?num=5&q=IMAGEHLP_LINE+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.IMAGEHLP_LINE](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGEHLP_LINE) +[IMAGEHLP_LINE64](https://www.google.com/search?num=5&q=IMAGEHLP_LINE64+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.IMAGEHLP_LINE64](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGEHLP_LINE64) +[IMAGEHLP_MODULE](https://www.google.com/search?num=5&q=IMAGEHLP_MODULE+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.IMAGEHLP_MODULE](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGEHLP_MODULE) +[IMAGEHLP_MODULE64](https://www.google.com/search?num=5&q=IMAGEHLP_MODULE64+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.IMAGEHLP_MODULE64](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGEHLP_MODULE64) +[IMAGEHLP_STACK_FRAME](https://www.google.com/search?num=5&q=IMAGEHLP_STACK_FRAME+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.IMAGEHLP_STACK_FRAME](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGEHLP_STACK_FRAME) +[IMAGEHLP_SYMBOL](https://www.google.com/search?num=5&q=IMAGEHLP_SYMBOL+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.IMAGEHLP_SYMBOL](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGEHLP_SYMBOL) +[IMAGEHLP_SYMBOL64](https://www.google.com/search?num=5&q=IMAGEHLP_SYMBOL64+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.IMAGEHLP_SYMBOL64](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGEHLP_SYMBOL64) +[IMAGEHLP_SYMBOLW](https://www.google.com/search?num=5&q=IMAGEHLP_SYMBOLW+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.IMAGEHLP_SYMBOLW](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGEHLP_SYMBOLW) +[IMAGEHLP_SYMBOLW64](https://www.google.com/search?num=5&q=IMAGEHLP_SYMBOLW64+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.IMAGEHLP_SYMBOLW64](https://github.com/dahall/Vanara/search?l=C%23&q=IMAGEHLP_SYMBOLW64) +[KDHELP](https://www.google.com/search?num=5&q=KDHELP+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.KDHELP](https://github.com/dahall/Vanara/search?l=C%23&q=KDHELP) +[KDHELP64](https://www.google.com/search?num=5&q=KDHELP64+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.KDHELP64](https://github.com/dahall/Vanara/search?l=C%23&q=KDHELP64) +[LIST_ENTRY](https://www.google.com/search?num=5&q=LIST_ENTRY+site%3Adocs.microsoft.com) | ntdef.h | [Vanara.PInvoke.DbgHelp.LIST_ENTRY](https://github.com/dahall/Vanara/search?l=C%23&q=LIST_ENTRY) +[LOADED_IMAGE](https://www.google.com/search?num=5&q=LOADED_IMAGE+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.LOADED_IMAGE](https://github.com/dahall/Vanara/search?l=C%23&q=LOADED_IMAGE) +[MISC](https://www.google.com/search?num=5&q=MISC+site%3Adocs.microsoft.com) | | [Vanara.PInvoke.DbgHelp.IMAGE_SECTION_HEADER.MISC](https://github.com/dahall/Vanara/search?l=C%23&q=MISC) +[MODLOAD_CVMISC](https://www.google.com/search?num=5&q=MODLOAD_CVMISC+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.MODLOAD_CVMISC](https://github.com/dahall/Vanara/search?l=C%23&q=MODLOAD_CVMISC) +[MODLOAD_DATA](https://www.google.com/search?num=5&q=MODLOAD_DATA+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.MODLOAD_DATA](https://github.com/dahall/Vanara/search?l=C%23&q=MODLOAD_DATA) +[OMAP](https://www.google.com/search?num=5&q=OMAP+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.OMAP](https://github.com/dahall/Vanara/search?l=C%23&q=OMAP) +[SOURCEFILE](https://www.google.com/search?num=5&q=SOURCEFILE+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.SOURCEFILE](https://github.com/dahall/Vanara/search?l=C%23&q=SOURCEFILE) +[SRCCODEINFO](https://www.google.com/search?num=5&q=SRCCODEINFO+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.SRCCODEINFO](https://github.com/dahall/Vanara/search?l=C%23&q=SRCCODEINFO) +[STACKFRAME](https://www.google.com/search?num=5&q=STACKFRAME+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.STACKFRAME](https://github.com/dahall/Vanara/search?l=C%23&q=STACKFRAME) +[STACKFRAME_EX](https://www.google.com/search?num=5&q=STACKFRAME_EX+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.STACKFRAME_EX](https://github.com/dahall/Vanara/search?l=C%23&q=STACKFRAME_EX) +[STACKFRAME64](https://www.google.com/search?num=5&q=STACKFRAME64+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.STACKFRAME64](https://github.com/dahall/Vanara/search?l=C%23&q=STACKFRAME64) +[SYMBOL_INFO](https://www.google.com/search?num=5&q=SYMBOL_INFO+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.SYMBOL_INFO](https://github.com/dahall/Vanara/search?l=C%23&q=SYMBOL_INFO) +[SYMSRV_INDEX_INFO](https://www.google.com/search?num=5&q=SYMSRV_INDEX_INFO+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.SYMSRV_INDEX_INFO](https://github.com/dahall/Vanara/search?l=C%23&q=SYMSRV_INDEX_INFO) +[TI_FINDCHILDREN_PARAMS](https://www.google.com/search?num=5&q=TI_FINDCHILDREN_PARAMS+site%3Adocs.microsoft.com) | dbghelp.h | [Vanara.PInvoke.DbgHelp.TI_FINDCHILDREN_PARAMS](https://github.com/dahall/Vanara/search?l=C%23&q=TI_FINDCHILDREN_PARAMS) diff --git a/PInvoke/DbgHelp/DbgHelp.Structs.cs b/PInvoke/DbgHelp/DbgHelp.Structs.cs index 652ee63a..856a4f0a 100644 --- a/PInvoke/DbgHelp/DbgHelp.Structs.cs +++ b/PInvoke/DbgHelp/DbgHelp.Structs.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.Runtime.InteropServices; using Vanara.Extensions; using Vanara.InteropServices; @@ -902,7 +903,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/ns-dbghelp-imagehlp_line typedef struct _IMAGEHLP_LINE { DWORD // SizeOfStruct; PVOID Key; DWORD LineNumber; PCHAR FileName; DWORD Address; } IMAGEHLP_LINE, *PIMAGEHLP_LINE; [PInvokeData("dbghelp.h", MSDNShortId = "NS:dbghelp._IMAGEHLP_LINE")] - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct IMAGEHLP_LINE { /// @@ -919,7 +920,7 @@ namespace Vanara.PInvoke public uint LineNumber; /// The name of the file, including the full path. - [MarshalAs(UnmanagedType.LPStr)] public string FileName; + [MarshalAs(UnmanagedType.LPTStr)] public string FileName; /// The address of the first instruction in the line. public uint Address; @@ -938,7 +939,7 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/ns-dbghelp-imagehlp_line64 typedef struct _IMAGEHLP_LINE64 { DWORD // SizeOfStruct; PVOID Key; DWORD LineNumber; PCHAR FileName; DWORD64 Address; } IMAGEHLP_LINE64, *PIMAGEHLP_LINE64; [PInvokeData("dbghelp.h", MSDNShortId = "NS:dbghelp._IMAGEHLP_LINE64")] - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct IMAGEHLP_LINE64 { /// @@ -955,79 +956,7 @@ namespace Vanara.PInvoke public uint LineNumber; /// The name of the file, including the full path. - [MarshalAs(UnmanagedType.LPStr)] public string FileName; - - /// The address of the first instruction in the line. - public ulong Address; - } - - /// Represents a source file line. - /// - /// - /// This structure supersedes the IMAGEHLP_LINE structure. For more information, see Updated Platform Support. - /// IMAGEHLP_LINE is defined as follows in DbgHelp.h. - /// - /// - /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define IMAGEHLP_LINE IMAGEHLP_LINE64 #define PIMAGEHLP_LINE PIMAGEHLP_LINE64 #else typedef struct _IMAGEHLP_LINE { DWORD SizeOfStruct; PVOID Key; DWORD LineNumber; PCHAR FileName; DWORD Address; } IMAGEHLP_LINE, *PIMAGEHLP_LINE; typedef struct _IMAGEHLP_LINEW { DWORD SizeOfStruct; PVOID Key; DWORD LineNumber; PCHAR FileName; DWORD64 Address; } IMAGEHLP_LINEW, *PIMAGEHLP_LINEW; #endif - /// - /// - // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/ns-dbghelp-imagehlp_line typedef struct _IMAGEHLP_LINE { DWORD - // SizeOfStruct; PVOID Key; DWORD LineNumber; PCHAR FileName; DWORD Address; } IMAGEHLP_LINE, *PIMAGEHLP_LINE; - [PInvokeData("dbghelp.h", MSDNShortId = "NS:dbghelp._IMAGEHLP_LINE")] - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] - public struct IMAGEHLP_LINEW - { - /// - /// The size of the structure, in bytes. The caller must set this member to - /// sizeof(IMAGEHLP_LINE64) - /// . - /// - public uint SizeOfStruct; - - /// This member is reserved for use by the operating system. - public IntPtr Key; - - /// The line number in the file. - public uint LineNumber; - - /// The name of the file, including the full path. - [MarshalAs(UnmanagedType.LPStr)] public string FileName; - - /// The address of the first instruction in the line. - public ulong Address; - } - - /// Represents a source file line. - /// - /// - /// This structure supersedes the IMAGEHLP_LINE structure. For more information, see Updated Platform Support. - /// IMAGEHLP_LINE is defined as follows in DbgHelp.h. - /// - /// - /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define IMAGEHLP_LINE IMAGEHLP_LINE64 #define PIMAGEHLP_LINE PIMAGEHLP_LINE64 #else typedef struct _IMAGEHLP_LINE { DWORD SizeOfStruct; PVOID Key; DWORD LineNumber; PCHAR FileName; DWORD Address; } IMAGEHLP_LINE, *PIMAGEHLP_LINE; typedef struct _IMAGEHLP_LINEW { DWORD SizeOfStruct; PVOID Key; DWORD LineNumber; PCHAR FileName; DWORD64 Address; } IMAGEHLP_LINEW, *PIMAGEHLP_LINEW; #endif - /// - /// - // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/ns-dbghelp-imagehlp_linew64 typedef struct _IMAGEHLP_LINEW64 { DWORD - // SizeOfStruct; PVOID Key; DWORD LineNumber; PWSTR FileName; DWORD64 Address; } IMAGEHLP_LINEW64, *PIMAGEHLP_LINEW64; - [PInvokeData("dbghelp.h", MSDNShortId = "NS:dbghelp._IMAGEHLP_LINEW64")] - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - public struct IMAGEHLP_LINEW64 - { - /// - /// The size of the structure, in bytes. The caller must set this member to - /// sizeof(IMAGEHLP_LINE64) - /// . - /// - public uint SizeOfStruct; - - /// This member is reserved for use by the operating system. - public IntPtr Key; - - /// The line number in the file. - public uint LineNumber; - - /// The name of the file, including the full path. - [MarshalAs(UnmanagedType.LPWStr)] public string FileName; + [MarshalAs(UnmanagedType.LPTStr)] public string FileName; /// The address of the first instruction in the line. public ulong Address; @@ -1047,7 +976,7 @@ namespace Vanara.PInvoke // SizeOfStruct; DWORD BaseOfImage; DWORD ImageSize; DWORD TimeDateStamp; DWORD CheckSum; DWORD NumSyms; SYM_TYPE SymType; CHAR // ModuleName[32]; CHAR ImageName[256]; CHAR LoadedImageName[256]; } IMAGEHLP_MODULE, *PIMAGEHLP_MODULE; [PInvokeData("dbghelp.h", MSDNShortId = "NS:dbghelp._IMAGEHLP_MODULE")] - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct IMAGEHLP_MODULE { /// @@ -1155,7 +1084,7 @@ namespace Vanara.PInvoke // DWORD PdbSig; GUID PdbSig70; DWORD PdbAge; BOOL PdbUnmatched; BOOL DbgUnmatched; BOOL LineNumbers; BOOL GlobalSymbols; BOOL // TypeInfo; BOOL SourceIndexed; BOOL Publics; DWORD MachineType; DWORD Reserved; } IMAGEHLP_MODULE64, *PIMAGEHLP_MODULE64; [PInvokeData("dbghelp.h", MSDNShortId = "NS:dbghelp._IMAGEHLP_MODULE64")] - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct IMAGEHLP_MODULE64 { /// @@ -1300,273 +1229,6 @@ namespace Vanara.PInvoke public uint Reserved; } - /// Contains module information. - /// - /// - /// This structure supersedes the IMAGEHLP_MODULE structure. For more information, see Updated Platform Support. - /// IMAGEHLP_MODULE is defined as follows in DbgHelp.h. - /// - /// - /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define IMAGEHLP_MODULE IMAGEHLP_MODULE64 #define PIMAGEHLP_MODULE PIMAGEHLP_MODULE64 #define IMAGEHLP_MODULEW IMAGEHLP_MODULEW64 #define PIMAGEHLP_MODULEW PIMAGEHLP_MODULEW64 #else typedef struct _IMAGEHLP_MODULE { DWORD SizeOfStruct; DWORD BaseOfImage; DWORD ImageSize; DWORD TimeDateStamp; DWORD CheckSum; DWORD NumSyms; SYM_TYPE SymType; CHAR ModuleName[32]; CHAR ImageName[256]; CHAR LoadedImageName[256]; } IMAGEHLP_MODULE, *PIMAGEHLP_MODULE; typedef struct _IMAGEHLP_MODULEW { DWORD SizeOfStruct; DWORD BaseOfImage; DWORD ImageSize; DWORD TimeDateStamp; DWORD CheckSum; DWORD NumSyms; SYM_TYPE SymType; WCHAR ModuleName[32]; WCHAR ImageName[256]; WCHAR LoadedImageName[256]; } IMAGEHLP_MODULEW, *PIMAGEHLP_MODULEW; #endif - /// - /// - // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/ns-dbghelp-imagehlp_module typedef struct _IMAGEHLP_MODULE { DWORD - // SizeOfStruct; DWORD BaseOfImage; DWORD ImageSize; DWORD TimeDateStamp; DWORD CheckSum; DWORD NumSyms; SYM_TYPE SymType; CHAR - // ModuleName[32]; CHAR ImageName[256]; CHAR LoadedImageName[256]; } IMAGEHLP_MODULE, *PIMAGEHLP_MODULE; - [PInvokeData("dbghelp.h", MSDNShortId = "NS:dbghelp._IMAGEHLP_MODULE")] - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - public struct IMAGEHLP_MODULEW - { - /// - /// The size of the structure, in bytes. The caller must set this member to - /// sizeof(IMAGEHLP_MODULE64) - /// . - /// - public uint SizeOfStruct; - - /// The base virtual address where the image is loaded. - public uint BaseOfImage; - - /// The size of the image, in bytes. - public uint ImageSize; - - /// - /// The date and timestamp value. The value is represented in the number of seconds elapsed since midnight (00:00:00), January - /// 1, 1970, Universal Coordinated Time, according to the system clock. The timestamp can be printed using the C run-time (CRT) - /// function ctime. - /// - public uint TimeDateStamp; - - /// The checksum of the image. This value can be zero. - public uint CheckSum; - - /// - /// The number of symbols in the symbol table. The value of this parameter is not meaningful when SymPdb is specified as - /// the value of the SymType parameter. - /// - public uint NumSyms; - - /// - /// The type of symbols that are loaded. This member can be one of the following values. - /// - /// - /// Value - /// Meaning - /// - /// - /// SymCoff - /// COFF symbols. - /// - /// - /// SymCv - /// CodeView symbols. - /// - /// - /// SymDeferred - /// Symbol loading deferred. - /// - /// - /// SymDia - /// DIA symbols. - /// - /// - /// SymExport - /// Symbols generated from a DLL export table. - /// - /// - /// SymNone - /// No symbols are loaded. - /// - /// - /// SymPdb - /// PDB symbols. - /// - /// - /// SymSym - /// .sym file. - /// - /// - /// SymVirtual - /// The virtual module created by SymLoadModuleEx with SLMFLAG_VIRTUAL. - /// - /// - /// - public SYM_TYPE SymType; - - /// The module name. - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] - public string ModuleName; - - /// The image name. The name may or may not contain a full path. - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string ImageName; - - /// The full path and file name of the file from which symbols were loaded. - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string LoadedImageName; - } - - /// Contains module information. - /// - /// - /// This structure supersedes the IMAGEHLP_MODULE structure. For more information, see Updated Platform Support. - /// IMAGEHLP_MODULE is defined as follows in DbgHelp.h. - /// - /// - /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define IMAGEHLP_MODULE IMAGEHLP_MODULE64 #define PIMAGEHLP_MODULE PIMAGEHLP_MODULE64 #define IMAGEHLP_MODULEW IMAGEHLP_MODULEW64 #define PIMAGEHLP_MODULEW PIMAGEHLP_MODULEW64 #else typedef struct _IMAGEHLP_MODULE { DWORD SizeOfStruct; DWORD BaseOfImage; DWORD ImageSize; DWORD TimeDateStamp; DWORD CheckSum; DWORD NumSyms; SYM_TYPE SymType; CHAR ModuleName[32]; CHAR ImageName[256]; CHAR LoadedImageName[256]; } IMAGEHLP_MODULE, *PIMAGEHLP_MODULE; typedef struct _IMAGEHLP_MODULEW { DWORD SizeOfStruct; DWORD BaseOfImage; DWORD ImageSize; DWORD TimeDateStamp; DWORD CheckSum; DWORD NumSyms; SYM_TYPE SymType; WCHAR ModuleName[32]; WCHAR ImageName[256]; WCHAR LoadedImageName[256]; } IMAGEHLP_MODULEW, *PIMAGEHLP_MODULEW; #endif - /// - /// - // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/ns-dbghelp-imagehlp_modulew64 typedef struct _IMAGEHLP_MODULEW64 { - // DWORD SizeOfStruct; DWORD64 BaseOfImage; DWORD ImageSize; DWORD TimeDateStamp; DWORD CheckSum; DWORD NumSyms; SYM_TYPE SymType; - // WCHAR ModuleName[32]; WCHAR ImageName[256]; WCHAR LoadedImageName[256]; WCHAR LoadedPdbName[256]; DWORD CVSig; WCHAR - // *CVData[MAX_PATH 3]; DWORD PdbSig; GUID PdbSig70; DWORD PdbAge; BOOL PdbUnmatched; BOOL DbgUnmatched; BOOL LineNumbers; BOOL - // GlobalSymbols; BOOL TypeInfo; BOOL SourceIndexed; BOOL Publics; DWORD MachineType; DWORD Reserved; } IMAGEHLP_MODULEW64, *PIMAGEHLP_MODULEW64; - [PInvokeData("dbghelp.h", MSDNShortId = "NS:dbghelp._IMAGEHLP_MODULEW64")] - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - public struct IMAGEHLP_MODULEW64 - { - /// - /// The size of the structure, in bytes. The caller must set this member to - /// sizeof(IMAGEHLP_MODULE64) - /// . - /// - public uint SizeOfStruct; - - /// The base virtual address where the image is loaded. - public ulong BaseOfImage; - - /// The size of the image, in bytes. - public uint ImageSize; - - /// - /// The date and timestamp value. The value is represented in the number of seconds elapsed since midnight (00:00:00), January - /// 1, 1970, Universal Coordinated Time, according to the system clock. The timestamp can be printed using the C run-time (CRT) - /// function ctime. - /// - public uint TimeDateStamp; - - /// The checksum of the image. This value can be zero. - public uint CheckSum; - - /// - /// The number of symbols in the symbol table. The value of this parameter is not meaningful when SymPdb is specified as - /// the value of the SymType parameter. - /// - public uint NumSyms; - - /// - /// The type of symbols that are loaded. This member can be one of the following values. - /// - /// - /// Value - /// Meaning - /// - /// - /// SymCoff - /// COFF symbols. - /// - /// - /// SymCv - /// CodeView symbols. - /// - /// - /// SymDeferred - /// Symbol loading deferred. - /// - /// - /// SymDia - /// DIA symbols. - /// - /// - /// SymExport - /// Symbols generated from a DLL export table. - /// - /// - /// SymNone - /// No symbols are loaded. - /// - /// - /// SymPdb - /// PDB symbols. - /// - /// - /// SymSym - /// .sym file. - /// - /// - /// SymVirtual - /// The virtual module created by SymLoadModuleEx with SLMFLAG_VIRTUAL. - /// - /// - /// - public SYM_TYPE SymType; - - /// The module name. - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string ModuleName; - - /// The image name. The name may or may not contain a full path. - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string ImageName; - - /// The full path and file name of the file from which symbols were loaded. - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string LoadedImageName; - - /// The full path and file name of the .pdb file. - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public string LoadedPdbName; - - /// The signature of the CV record in the debug directories. - public uint CVSig; - - /// The contents of the CV record. - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260 * 3)] - public string CVData; - - /// The PDB signature. - public uint PdbSig; - - /// The PDB signature (Visual C/C++ 7.0 and later) - public Guid PdbSig70; - - /// The DBI age of PDB. - public uint PdbAge; - - /// A value that indicates whether the loaded PDB is unmatched. - [MarshalAs(UnmanagedType.Bool)] public bool PdbUnmatched; - - /// A value that indicates whether the loaded DBG is unmatched. - [MarshalAs(UnmanagedType.Bool)] public bool DbgUnmatched; - - /// A value that indicates whether line number information is available. - [MarshalAs(UnmanagedType.Bool)] public bool LineNumbers; - - /// A value that indicates whether symbol information is available. - [MarshalAs(UnmanagedType.Bool)] public bool GlobalSymbols; - - /// A value that indicates whether type information is available. - [MarshalAs(UnmanagedType.Bool)] public bool TypeInfo; - - /// - /// A value that indicates whether the .pdb supports the source server. - /// DbgHelp 6.1 and earlier: This member is not supported. - /// - [MarshalAs(UnmanagedType.Bool)] public bool SourceIndexed; - - /// - /// A value that indicates whether the module contains public symbols. - /// DbgHelp 6.1 and earlier: This member is not supported. - /// - [MarshalAs(UnmanagedType.Bool)] public bool Publics; - - /// - public uint MachineType; - - /// - public uint Reserved; - } - /// Contains the stack frame information. This structure is used with the SymSetContext function. // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/ns-dbghelp-imagehlp_stack_frame typedef struct _IMAGEHLP_STACK_FRAME { // ULONG64 InstructionOffset; ULONG64 ReturnOffset; ULONG64 FrameOffset; ULONG64 StackOffset; ULONG64 BackingStoreOffset; ULONG64 @@ -1639,14 +1301,11 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/ns-dbghelp-imagehlp_symbol typedef struct _IMAGEHLP_SYMBOL { DWORD // SizeOfStruct; DWORD Address; DWORD Size; DWORD Flags; DWORD MaxNameLength; CHAR Name[1]; } IMAGEHLP_SYMBOL, *PIMAGEHLP_SYMBOL; [PInvokeData("dbghelp.h", MSDNShortId = "NS:dbghelp._IMAGEHLP_SYMBOL")] + [VanaraMarshaler(typeof(SafeAnysizeStringMarshaler), "Ansi")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct IMAGEHLP_SYMBOL { - /// - /// The size of the structure, in bytes. The caller must set this member to - /// sizeof(IMAGEHLP_SYMBOL64) - /// . - /// + /// The size of the structure, in bytes. The caller must set this member to sizeof(IMAGEHLP_SYMBOL). public uint SizeOfStruct; /// The virtual address for the symbol. @@ -1673,6 +1332,78 @@ namespace Vanara.PInvoke public string Name; } + /// + /// A marshaler implementation of that pulls a full string from a structure with a last field having + /// one character. + /// + /// The structure type to be marshaled. + /// + public class SafeAnysizeStringMarshaler : IVanaraMarshaler + { + private static readonly Type structType; + private static readonly System.Reflection.FieldInfo fiStr; + private CharSet charSet; + + static SafeAnysizeStringMarshaler() + { + structType = typeof(T); + if (!structType.IsLayoutSequential) + throw new InvalidOperationException("This class can only manange sequential layout structures."); + fiStr = structType.GetOrderedFields().Last(); + if (fiStr.FieldType != typeof(string)) + throw new ArgumentException("The last field must be a string."); + } + + /// Initializes a new instance of the class. + /// + /// The name of the field in that specifies the string length of the last field of . + /// + public SafeAnysizeStringMarshaler(string cookie) + { + charSet = (CharSet)Enum.Parse(typeof(CharSet), cookie); + } + + /// Gets the size of the native data. + /// + /// The size, in bytes, of the base object in memory. This should return the equivalent of the sizeof(X) function in C/C++. + /// + public SizeT GetNativeSize() => Marshal.SizeOf(structType); + + SafeAllocatedMemoryHandle IVanaraMarshaler.MarshalManagedToNative(object managedObject) + { + // Get structure information + if (managedObject is null) return SafeHGlobalHandle.Null; + if (!(managedObject is T value)) + throw new ArgumentException($"{nameof(managedObject)} must be an instance of {structType.Name}."); + + // Get the current value for the last field (or create one if needed) + var strVal = fiStr.GetValue(value) as string ?? string.Empty; + // Determine mem required for current struct and last field value + var chSz = StringHelper.GetCharSize(charSet); + var memSz = GetNativeSize() + chSz * strVal.Length; + // Set structure into allocated mem + var ret = new SafeHGlobalHandle(memSz); + ret.Write(value); + // Set string into mem + StringHelper.Write(strVal, ret, out _, true, charSet, chSz * (strVal.Length + 1)); + + return ret; + } + + object IVanaraMarshaler.MarshalNativeToManaged(IntPtr pNativeData, SizeT allocatedBytes) + { + if (pNativeData == IntPtr.Zero) return null; + + // Move structure and assign string + var value = (T)Marshal.PtrToStructure(pNativeData, typeof(T)); + var strVal = StringHelper.GetString(pNativeData.Offset(Marshal.OffsetOf(typeof(T), fiStr.Name).ToInt32()), charSet); + fiStr.SetValueDirect(__makeref(value), strVal); + + return value; + } + } + + /// Contains symbol information. /// /// @@ -1686,14 +1417,11 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/ns-dbghelp-imagehlp_symbol64 typedef struct _IMAGEHLP_SYMBOL64 { DWORD // SizeOfStruct; DWORD64 Address; DWORD Size; DWORD Flags; DWORD MaxNameLength; CHAR Name[1]; } IMAGEHLP_SYMBOL64, *PIMAGEHLP_SYMBOL64; [PInvokeData("dbghelp.h", MSDNShortId = "NS:dbghelp._IMAGEHLP_SYMBOL64")] - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + [VanaraMarshaler(typeof(SafeAnysizeStringMarshaler), "Ansi")] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct IMAGEHLP_SYMBOL64 { - /// - /// The size of the structure, in bytes. The caller must set this member to - /// sizeof(IMAGEHLP_SYMBOL64) - /// . - /// + /// The size of the structure, in bytes. The caller must set this member to sizeof(IMAGEHLP_SYMBOL64). public uint SizeOfStruct; /// The virtual address for the symbol. @@ -1733,14 +1461,11 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/ns-dbghelp-imagehlp_symbol typedef struct _IMAGEHLP_SYMBOL { DWORD // SizeOfStruct; DWORD Address; DWORD Size; DWORD Flags; DWORD MaxNameLength; CHAR Name[1]; } IMAGEHLP_SYMBOL, *PIMAGEHLP_SYMBOL; [PInvokeData("dbghelp.h", MSDNShortId = "NS:dbghelp._IMAGEHLP_SYMBOL")] + [VanaraMarshaler(typeof(SafeAnysizeStringMarshaler), "Unicode")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct IMAGEHLP_SYMBOLW { - /// - /// The size of the structure, in bytes. The caller must set this member to - /// sizeof(IMAGEHLP_SYMBOL64) - /// . - /// + /// The size of the structure, in bytes. The caller must set this member to sizeof(IMAGEHLP_SYMBOLW). public uint SizeOfStruct; /// The virtual address for the symbol. @@ -1780,14 +1505,11 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/ns-dbghelp-imagehlp_symbolw64 typedef struct _IMAGEHLP_SYMBOLW64 { // DWORD SizeOfStruct; DWORD64 Address; DWORD Size; DWORD Flags; DWORD MaxNameLength; WCHAR Name[1]; } IMAGEHLP_SYMBOLW64, *PIMAGEHLP_SYMBOLW64; [PInvokeData("dbghelp.h", MSDNShortId = "NS:dbghelp._IMAGEHLP_SYMBOLW64")] + [VanaraMarshaler(typeof(SafeAnysizeStringMarshaler), "Unicode")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct IMAGEHLP_SYMBOLW64 { - /// - /// The size of the structure, in bytes. The caller must set this member to - /// sizeof(IMAGEHLP_SYMBOL64) - /// . - /// + /// The size of the structure, in bytes. The caller must set this member to sizeof(IMAGEHLP_SYMBOLW64). public uint SizeOfStruct; /// The virtual address for the symbol. @@ -2690,6 +2412,33 @@ namespace Vanara.PInvoke public uint[] ChildId; } + /// Contains symbol information. + /// + public class SafeIMAGEHLP_SYMBOL : SafeHGlobalStruct + { + /// Initializes a new instance of the class. + /// The character set. + /// Maximum length of the name. + public SafeIMAGEHLP_SYMBOL(int maxNameLen = 261) : base(BaseStructSize + (maxNameLen - 1)) + { + handle.Write((uint)BaseStructSize, 0, Size); + handle.Write((uint)maxNameLen, (int)FieldOffset(nameof(IMAGEHLP_SYMBOL.MaxNameLength)), Size); + } + } + + /// Contains symbol information. + /// + public class SafeIMAGEHLP_SYMBOL64 : SafeHGlobalStruct + { + /// Initializes a new instance of the class. + /// Maximum length of the name. + public SafeIMAGEHLP_SYMBOL64(int maxNameLen = 261) : base(BaseStructSize + (maxNameLen - 1)) + { + handle.Write((uint)BaseStructSize, 0, Size); + handle.Write((uint)maxNameLen, (int)FieldOffset(nameof(IMAGEHLP_SYMBOL64.MaxNameLength)), Size); + } + } + /// Pointer to a LOADED_IMAGE structure. /// public class SafeLOADED_IMAGE : SafeHandle diff --git a/PInvoke/DbgHelp/DbgHelp.Sym.cs b/PInvoke/DbgHelp/DbgHelp.Sym.cs index 0a357f9e..b2fdea30 100644 --- a/PInvoke/DbgHelp/DbgHelp.Sym.cs +++ b/PInvoke/DbgHelp/DbgHelp.Sym.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Text; +using Vanara.InteropServices; namespace Vanara.PInvoke { @@ -158,6 +159,514 @@ namespace Vanara.PInvoke [return: MarshalAs(UnmanagedType.Bool)] public delegate bool PSYM_ENUMSOURCEFILES_CALLBACK(in SOURCEFILE pSourceFile, [In, Optional] IntPtr UserContext); + /// + /// + /// An application-defined callback function used with the SymRegisterFunctionEntryCallback64 function. It is called by the stack + /// walking procedure. + /// + /// + /// The PSYMBOL_FUNCENTRY_CALLBACK64 type defines a pointer to this callback function. + /// SymRegisterFunctionEntryCallbackProc64 is a placeholder for the application-defined function name. + /// + /// + /// A handle to the process that was originally passed to the StackWalk64 function. + /// The address of an instruction for which the callback function should return a function table entry. + /// + /// The user-defined value specified in SymRegisterFunctionEntryCallback64, or NULL. Typically, this parameter is used by an + /// application to pass a pointer to a data structure that lets the callback function establish some context. + /// + /// + /// Return the value NULL if no function table entry is available. + /// + /// On success, return a pointer to an IMAGE_RUNTIME_FUNCTION_ENTRY structure. Refer to the header file WinNT.h for the + /// definition of this function. + /// + /// + /// + /// + /// The structure must be returned in exactly the form it exists in the process being debugged. Some members may be pointers to + /// other locations in the process address space. The ReadProcessMemoryProc64 callback function may be called to retrieve the + /// information at these locations. + /// + /// + /// The calling application gets called through the registered callback function as a result of a call to the StackWalk64 function. + /// The calling application must be prepared for the possible side effects that this can cause. If the application has only one + /// callback function that is being used by multiple threads, then it may be necessary to synchronize some types of data access + /// while in the context of the callback function. + /// + /// + /// This function is similar to the FunctionTableAccessProc64 callback function. The difference is that + /// FunctionTableAccessProc64 returns an IMAGE_FUNCTION_ENTRY structure, while this function returns an + /// IMAGE_RUNTIME_FUNCTION_ENTRY structure. + /// + /// + /// This callback function supersedes the PSYMBOL_FUNCENTRY_CALLBACK callback function. PSYMBOL_FUNCENTRY_CALLBACK is defined as + /// follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define PSYMBOL_FUNCENTRY_CALLBACK PSYMBOL_FUNCENTRY_CALLBACK64 #endif typedef PVOID (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK)( __in HANDLE hProcess, __in DWORD AddrBase, __in_opt PVOID UserContext ); + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nc-dbghelp-psymbol_funcentry_callback PSYMBOL_FUNCENTRY_CALLBACK + // PsymbolFuncentryCallback; PVOID PsymbolFuncentryCallback( HANDLE hProcess, DWORD AddrBase, PVOID UserContext ) {...} + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [PInvokeData("dbghelp.h", MSDNShortId = "NC:dbghelp.PSYMBOL_FUNCENTRY_CALLBACK")] + public delegate IntPtr PSYMBOL_FUNCENTRY_CALLBACK(HPROCESS hProcess, uint AddrBase, IntPtr UserContext); + + /// + /// + /// An application-defined callback function used with the SymRegisterFunctionEntryCallback64 function. It is called by the stack + /// walking procedure. + /// + /// + /// The PSYMBOL_FUNCENTRY_CALLBACK64 type defines a pointer to this callback function. + /// SymRegisterFunctionEntryCallbackProc64 is a placeholder for the application-defined function name. + /// + /// + /// A handle to the process that was originally passed to the StackWalk64 function. + /// The address of an instruction for which the callback function should return a function table entry. + /// + /// The user-defined value specified in SymRegisterFunctionEntryCallback64, or NULL. Typically, this parameter is used by an + /// application to pass a pointer to a data structure that lets the callback function establish some context. + /// + /// + /// Return the value NULL if no function table entry is available. + /// + /// On success, return a pointer to an IMAGE_RUNTIME_FUNCTION_ENTRY structure. Refer to the header file WinNT.h for the + /// definition of this function. + /// + /// + /// + /// + /// The structure must be returned in exactly the form it exists in the process being debugged. Some members may be pointers to + /// other locations in the process address space. The ReadProcessMemoryProc64 callback function may be called to retrieve the + /// information at these locations. + /// + /// + /// The calling application gets called through the registered callback function as a result of a call to the StackWalk64 function. + /// The calling application must be prepared for the possible side effects that this can cause. If the application has only one + /// callback function that is being used by multiple threads, then it may be necessary to synchronize some types of data access + /// while in the context of the callback function. + /// + /// + /// This function is similar to the FunctionTableAccessProc64 callback function. The difference is that + /// FunctionTableAccessProc64 returns an IMAGE_FUNCTION_ENTRY structure, while this function returns an + /// IMAGE_RUNTIME_FUNCTION_ENTRY structure. + /// + /// + /// This callback function supersedes the PSYMBOL_FUNCENTRY_CALLBACK callback function. PSYMBOL_FUNCENTRY_CALLBACK is defined as + /// follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define PSYMBOL_FUNCENTRY_CALLBACK PSYMBOL_FUNCENTRY_CALLBACK64 #endif typedef PVOID (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK)( __in HANDLE hProcess, __in DWORD AddrBase, __in_opt PVOID UserContext ); + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nc-dbghelp-psymbol_funcentry_callback64 PSYMBOL_FUNCENTRY_CALLBACK64 + // PsymbolFuncentryCallback64; PVOID PsymbolFuncentryCallback64( HANDLE hProcess, ULONG64 AddrBase, ULONG64 UserContext ) {...} + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [PInvokeData("dbghelp.h", MSDNShortId = "NC:dbghelp.PSYMBOL_FUNCENTRY_CALLBACK64")] + public delegate IntPtr PSYMBOL_FUNCENTRY_CALLBACK64(HPROCESS hProcess, ulong AddrBase, ulong UserContext); + + /// + /// An application-defined callback function used with the SymRegisterCallback64 function. It is called by the symbol handler. + /// + /// The PSYMBOL_REGISTERED_CALLBACK64 type defines a pointer to this callback function. SymRegisterCallbackProc64 is a + /// placeholder for the application-defined function name. + /// + /// + /// A handle to the process that was originally passed to the SymInitialize function. + /// + /// The callback code. This parameter can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// CBA_DEBUG_INFO 0x10000000 + /// Display verbose information. The CallbackData parameter is a pointer to a string. + /// + /// + /// CBA_DEFERRED_SYMBOL_LOAD_CANCEL 0x00000007 + /// + /// Deferred symbol loading has started. To cancel the symbol load, return TRUE. The CallbackData parameter is a pointer to a + /// IMAGEHLP_DEFERRED_SYMBOL_LOAD64 structure. + /// + /// + /// + /// CBA_DEFERRED_SYMBOL_LOAD_COMPLETE 0x00000002 + /// Deferred symbol load has completed. The CallbackData parameter is a pointer to a IMAGEHLP_DEFERRED_SYMBOL_LOAD64 structure. + /// + /// + /// CBA_DEFERRED_SYMBOL_LOAD_FAILURE 0x00000003 + /// + /// Deferred symbol load has failed. The CallbackData parameter is a pointer to a IMAGEHLP_DEFERRED_SYMBOL_LOAD64 structure. The + /// symbol handler will attempt to load the symbols again if the callback function sets the FileName member of this structure. + /// + /// + /// + /// CBA_DEFERRED_SYMBOL_LOAD_PARTIAL 0x00000020 + /// + /// Deferred symbol load has partially completed. The symbol loader is unable to read the image header from either the image file or + /// the specified module. The CallbackData parameter is a pointer to a IMAGEHLP_DEFERRED_SYMBOL_LOAD64 structure. The symbol handler + /// will attempt to load the symbols again if the callback function sets the FileName member of this structure. DbgHelp 5.1: This + /// value is not supported. + /// + /// + /// + /// CBA_DEFERRED_SYMBOL_LOAD_START 0x00000001 + /// Deferred symbol load has started. The CallbackData parameter is a pointer to a IMAGEHLP_DEFERRED_SYMBOL_LOAD64 structure. + /// + /// + /// CBA_DUPLICATE_SYMBOL 0x00000005 + /// + /// Duplicate symbols were found. This reason is used only in COFF or CodeView format. The CallbackData parameter is a pointer to a + /// IMAGEHLP_DUPLICATE_SYMBOL64 structure. To specify which symbol to use, set the SelectedSymbol member of this structure. + /// + /// + /// + /// CBA_EVENT 0x00000010 + /// + /// Display verbose information. If you do not handle this event, the information is resent through the CBA_DEBUG_INFO event. The + /// CallbackData parameter is a pointer to a IMAGEHLP_CBA_EVENT structure. + /// + /// + /// + /// CBA_READ_MEMORY 0x00000006 + /// + /// The loaded image has been read. The CallbackData parameter is a pointer to a IMAGEHLP_CBA_READ_MEMORY structure. The callback + /// function should read the number of bytes specified by the bytes member into the buffer specified by the buf member, and update + /// the bytesread member accordingly. + /// + /// + /// + /// CBA_SET_OPTIONS 0x00000008 + /// + /// Symbol options have been updated. To retrieve the current options, call the SymGetOptions function. The CallbackData parameter + /// should be ignored. + /// + /// + /// + /// CBA_SRCSRV_EVENT 0x40000000 + /// + /// Display verbose information for source server. If you do not handle this event, the information is resent through the + /// CBA_DEBUG_INFO event. The CallbackData parameter is a pointer to a IMAGEHLP_CBA_EVENT structure. DbgHelp 6.6 and earlier: This + /// value is not supported. + /// + /// + /// + /// CBA_SRCSRV_INFO 0x20000000 + /// + /// Display verbose information for source server. The CallbackData parameter is a pointer to a string. DbgHelp 6.6 and earlier: + /// This value is not supported. + /// + /// + /// + /// CBA_SYMBOLS_UNLOADED 0x00000004 + /// Symbols have been unloaded. The CallbackData parameter should be ignored. + /// + /// + /// + /// + /// Data for the operation. The format of this data depends on the value of the ActionCode parameter. + /// + /// If the callback function was registered with SymRegisterCallbackW64, the data is a Unicode string or data structure. Otherwise, + /// the data uses ANSI format. + /// + /// + /// + /// User-defined value specified in SymRegisterCallback64, or NULL. Typically, this parameter is used by an application to + /// pass a pointer to a data structure that lets the callback function establish some context. + /// + /// + /// To indicate success handling the code, return TRUE. + /// + /// To indicate failure handling the code, return FALSE. If your code does not handle a particular code, you should also + /// return FALSE. (Returning TRUE in this case may have unintended consequences.) + /// + /// + /// + /// + /// The calling application gets called through the registered callback function as a result of another call to one of the symbol + /// handler functions. The calling application must be prepared for the possible side effects that this can cause. If the + /// application has only one callback function that is being used by multiple threads, then care may be necessary to synchronize + /// some types of data access while in the context of the callback function. + /// + /// + /// This callback function supersedes the PSYMBOL_REGISTERED_CALLBACK callback function. PSYMBOL_REGISTERED_CALLBACK is defined as + /// follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define PSYMBOL_REGISTERED_CALLBACK PSYMBOL_REGISTERED_CALLBACK64 #else typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK)( __in HANDLE hProcess, __in ULONG ActionCode, __in_opt PVOID CallbackData, __in_opt PVOID UserContext ); #endif + /// + /// For a more extensive example, read Getting Notifications. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nc-dbghelp-psymbol_registered_callback PSYMBOL_REGISTERED_CALLBACK + // PsymbolRegisteredCallback; BOOL PsymbolRegisteredCallback( HANDLE hProcess, ULONG ActionCode, PVOID CallbackData, PVOID + // UserContext ) {...} + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [PInvokeData("dbghelp.h", MSDNShortId = "NC:dbghelp.PSYMBOL_REGISTERED_CALLBACK")] + [return: MarshalAs(UnmanagedType.Bool)] + public delegate bool PSYMBOL_REGISTERED_CALLBACK(HPROCESS hProcess, CBA ActionCode, IntPtr CallbackData, IntPtr UserContext); + + /// + /// An application-defined callback function used with the SymRegisterCallback64 function. It is called by the symbol handler. + /// + /// The PSYMBOL_REGISTERED_CALLBACK64 type defines a pointer to this callback function. SymRegisterCallbackProc64 is a + /// placeholder for the application-defined function name. + /// + /// + /// A handle to the process that was originally passed to the SymInitialize function. + /// + /// The callback code. This parameter can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// CBA_DEBUG_INFO 0x10000000 + /// Display verbose information. The CallbackData parameter is a pointer to a string. + /// + /// + /// CBA_DEFERRED_SYMBOL_LOAD_CANCEL 0x00000007 + /// + /// Deferred symbol loading has started. To cancel the symbol load, return TRUE. The CallbackData parameter is a pointer to a + /// IMAGEHLP_DEFERRED_SYMBOL_LOAD64 structure. + /// + /// + /// + /// CBA_DEFERRED_SYMBOL_LOAD_COMPLETE 0x00000002 + /// Deferred symbol load has completed. The CallbackData parameter is a pointer to a IMAGEHLP_DEFERRED_SYMBOL_LOAD64 structure. + /// + /// + /// CBA_DEFERRED_SYMBOL_LOAD_FAILURE 0x00000003 + /// + /// Deferred symbol load has failed. The CallbackData parameter is a pointer to a IMAGEHLP_DEFERRED_SYMBOL_LOAD64 structure. The + /// symbol handler will attempt to load the symbols again if the callback function sets the FileName member of this structure. + /// + /// + /// + /// CBA_DEFERRED_SYMBOL_LOAD_PARTIAL 0x00000020 + /// + /// Deferred symbol load has partially completed. The symbol loader is unable to read the image header from either the image file or + /// the specified module. The CallbackData parameter is a pointer to a IMAGEHLP_DEFERRED_SYMBOL_LOAD64 structure. The symbol handler + /// will attempt to load the symbols again if the callback function sets the FileName member of this structure. DbgHelp 5.1: This + /// value is not supported. + /// + /// + /// + /// CBA_DEFERRED_SYMBOL_LOAD_START 0x00000001 + /// Deferred symbol load has started. The CallbackData parameter is a pointer to a IMAGEHLP_DEFERRED_SYMBOL_LOAD64 structure. + /// + /// + /// CBA_DUPLICATE_SYMBOL 0x00000005 + /// + /// Duplicate symbols were found. This reason is used only in COFF or CodeView format. The CallbackData parameter is a pointer to a + /// IMAGEHLP_DUPLICATE_SYMBOL64 structure. To specify which symbol to use, set the SelectedSymbol member of this structure. + /// + /// + /// + /// CBA_EVENT 0x00000010 + /// + /// Display verbose information. If you do not handle this event, the information is resent through the CBA_DEBUG_INFO event. The + /// CallbackData parameter is a pointer to a IMAGEHLP_CBA_EVENT structure. + /// + /// + /// + /// CBA_READ_MEMORY 0x00000006 + /// + /// The loaded image has been read. The CallbackData parameter is a pointer to a IMAGEHLP_CBA_READ_MEMORY structure. The callback + /// function should read the number of bytes specified by the bytes member into the buffer specified by the buf member, and update + /// the bytesread member accordingly. + /// + /// + /// + /// CBA_SET_OPTIONS 0x00000008 + /// + /// Symbol options have been updated. To retrieve the current options, call the SymGetOptions function. The CallbackData parameter + /// should be ignored. + /// + /// + /// + /// CBA_SRCSRV_EVENT 0x40000000 + /// + /// Display verbose information for source server. If you do not handle this event, the information is resent through the + /// CBA_DEBUG_INFO event. The CallbackData parameter is a pointer to a IMAGEHLP_CBA_EVENT structure. DbgHelp 6.6 and earlier: This + /// value is not supported. + /// + /// + /// + /// CBA_SRCSRV_INFO 0x20000000 + /// + /// Display verbose information for source server. The CallbackData parameter is a pointer to a string. DbgHelp 6.6 and earlier: + /// This value is not supported. + /// + /// + /// + /// CBA_SYMBOLS_UNLOADED 0x00000004 + /// Symbols have been unloaded. The CallbackData parameter should be ignored. + /// + /// + /// + /// + /// Data for the operation. The format of this data depends on the value of the ActionCode parameter. + /// + /// If the callback function was registered with SymRegisterCallbackW64, the data is a Unicode string or data structure. Otherwise, + /// the data uses ANSI format. + /// + /// + /// + /// User-defined value specified in SymRegisterCallback64, or NULL. Typically, this parameter is used by an application to + /// pass a pointer to a data structure that lets the callback function establish some context. + /// + /// + /// To indicate success handling the code, return TRUE. + /// + /// To indicate failure handling the code, return FALSE. If your code does not handle a particular code, you should also + /// return FALSE. (Returning TRUE in this case may have unintended consequences.) + /// + /// + /// + /// + /// The calling application gets called through the registered callback function as a result of another call to one of the symbol + /// handler functions. The calling application must be prepared for the possible side effects that this can cause. If the + /// application has only one callback function that is being used by multiple threads, then care may be necessary to synchronize + /// some types of data access while in the context of the callback function. + /// + /// + /// This callback function supersedes the PSYMBOL_REGISTERED_CALLBACK callback function. PSYMBOL_REGISTERED_CALLBACK is defined as + /// follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define PSYMBOL_REGISTERED_CALLBACK PSYMBOL_REGISTERED_CALLBACK64 #else typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK)( __in HANDLE hProcess, __in ULONG ActionCode, __in_opt PVOID CallbackData, __in_opt PVOID UserContext ); #endif + /// + /// For a more extensive example, read Getting Notifications. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nc-dbghelp-psymbol_registered_callback64 PSYMBOL_REGISTERED_CALLBACK64 + // PsymbolRegisteredCallback64; BOOL PsymbolRegisteredCallback64( HANDLE hProcess, ULONG ActionCode, ULONG64 CallbackData, ULONG64 + // UserContext ) {...} + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [PInvokeData("dbghelp.h", MSDNShortId = "NC:dbghelp.PSYMBOL_REGISTERED_CALLBACK64")] + [return: MarshalAs(UnmanagedType.Bool)] + public delegate bool PSYMBOL_REGISTERED_CALLBACK64(HPROCESS hProcess, CBA ActionCode, ulong CallbackData, ulong UserContext); + + /// Callback code for PSYMBOL_REGISTERED_CALLBACK. + [PInvokeData("dbghelp.h", MSDNShortId = "NC:dbghelp.PSYMBOL_REGISTERED_CALLBACK64")] + [Flags] + public enum CBA : uint + { + /// + CBA_CHECK_ARM_MACHINE_THUMB_TYPE_OVERRIDE = 0x80000000, + + /// + CBA_CHECK_ENGOPT_DISALLOW_NETWORK_PATHS = 0x70000000, + + /// + CBA_ENGINE_PRESENT = 0x60000000, + + /// + CBA_UPDATE_STATUS_BAR = 0x50000000, + + /// + CBA_XML_LOG = 0x90000000, + + /// + /// Display verbose information. + /// The CallbackData parameter is a pointer to a string. + /// + CBA_DEBUG_INFO = 0x10000000, + + /// + /// Deferred symbol loading has started. To cancel the symbol load, return TRUE. + /// The CallbackData parameter is a pointer to a IMAGEHLP_DEFERRED_SYMBOL_LOAD64 structure. + /// + CBA_DEFERRED_SYMBOL_LOAD_CANCEL = 0x00000007, + + /// + /// Deferred symbol load has completed. + /// The CallbackData parameter is a pointer to a IMAGEHLP_DEFERRED_SYMBOL_LOAD64 structure. + /// + CBA_DEFERRED_SYMBOL_LOAD_COMPLETE = 0x00000002, + + /// + /// Deferred symbol load has failed. + /// + /// The CallbackData parameter is a pointer to a IMAGEHLP_DEFERRED_SYMBOL_LOAD64 structure. The symbol handler will attempt to + /// load the symbols again if the callback function sets the FileName member of this structure. + /// + /// + CBA_DEFERRED_SYMBOL_LOAD_FAILURE = 0x00000003, + + /// + /// Deferred symbol load has partially completed. The symbol loader is unable to read the image header from either the image + /// file or the specified module. + /// + /// The CallbackData parameter is a pointer to a IMAGEHLP_DEFERRED_SYMBOL_LOAD64 structure. The symbol handler will attempt to + /// load the symbols again if the callback function sets the FileName member of this structure. + /// + /// DbgHelp 5.1: This value is not supported. + /// + CBA_DEFERRED_SYMBOL_LOAD_PARTIAL = 0x00000020, + + /// + /// Deferred symbol load has started. + /// The CallbackData parameter is a pointer to a IMAGEHLP_DEFERRED_SYMBOL_LOAD64 structure. + /// + CBA_DEFERRED_SYMBOL_LOAD_START = 0x00000001, + + /// + /// Duplicate symbols were found. This reason is used only in COFF or CodeView format. + /// + /// The CallbackData parameter is a pointer to a IMAGEHLP_DUPLICATE_SYMBOL64 structure. To specify which symbol to use, set the + /// SelectedSymbol member of this structure. + /// + /// + CBA_DUPLICATE_SYMBOL = 0x00000005, + + /// + /// Display verbose information. If you do not handle this event, the information is resent through the CBA_DEBUG_INFO event. + /// The CallbackData parameter is a pointer to a IMAGEHLP_CBA_EVENT structure. + /// + CBA_EVENT = 0x00000010, + + /// + /// The loaded image has been read. + /// + /// The CallbackData parameter is a pointer to a IMAGEHLP_CBA_READ_MEMORY structure. The callback function should read the + /// number of bytes specified by the bytes member into the buffer specified by the buf member, and update the bytesread member accordingly. + /// + /// + CBA_READ_MEMORY = 0x00000006, + + /// + /// Symbol options have been updated. To retrieve the current options, call the SymGetOptions function. + /// The CallbackData parameter should be ignored. + /// + CBA_SET_OPTIONS = 0x00000008, + + /// + /// Display verbose information for source server. If you do not handle this event, the information is resent through the + /// CBA_DEBUG_INFO event. + /// The CallbackData parameter is a pointer to a IMAGEHLP_CBA_EVENT structure. + /// DbgHelp 6.6 and earlier: This value is not supported. + /// + CBA_SRCSRV_EVENT = 0x40000000, + + /// + /// Display verbose information for source server. + /// The CallbackData parameter is a pointer to a string. + /// DbgHelp 6.6 and earlier: This value is not supported. + /// + CBA_SRCSRV_INFO = 0x20000000, + + /// + /// Symbols have been unloaded. + /// The CallbackData parameter should be ignored. + /// + CBA_SYMBOLS_UNLOADED = 0x00000004, + } + /// Flags for . [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymEnumSourceLines")] [Flags] @@ -179,6 +688,54 @@ namespace Vanara.PInvoke ESLFLAG_INLINE_SITE = 0x00000010, } + /// The directory to be retrieved. + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetHomeDirectory")] + public enum IMAGEHLP_HD_TYPE + { + /// The home directory. + hdBase = 0, + + /// The symbol directory. + hdSym, + + /// The source directory. + hdSrc, + } + + /// The type of symbol file. + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetSymbolFile")] + public enum IMAGEHLP_SF_TYPE + { + /// A .exe or .dll file. + sfImage = 0, + + /// A .dbg file. + sfDbg, + + /// A .pdb file. + sfPdb, + + /// Reserved. + sfMpd, + } + + /// Flags for . + [Flags] + public enum SLMFLAG + { + /// + /// Creates a virtual module named ModuleName at the address specified in BaseOfDll. To add symbols to this module, call the + /// SymAddSymbol function. + /// + SLMFLAG_VIRTUAL = 0x1, + + /// + SLMFLAG_ALT_INDEX = 0x2, + + /// Loads the module but not the symbols for the module. + SLMFLAG_NO_SYMBOLS = 0x4 + } + /// The format of the id parameter. This parameter can be one of the following values. [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymFindFileInPath")] [Flags] @@ -478,6 +1035,51 @@ namespace Vanara.PInvoke SYMOPT_UNDNAME = 0x00000002, } + /// The options that control the behavior of . + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymSearch")] + [Flags] + public enum SYMSEARCH + { + /// Include all symbols and other data in the .pdb files. DbgHelp 6.6 and earlier: This value is not supported. + SYMSEARCH_ALLITEMS = 0X08, + + /// Search only for global symbols. + SYMSEARCH_GLOBALSONLY = 0X04, + + /// For internal use only. + SYMSEARCH_MASKOBJS = 0x01, + + /// Recurse from the top to find all symbols. + SYMSEARCH_RECURSE = 0X02, + } + + /// The flags that control . + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymSrvStoreFile")] + [Flags] + public enum SYMSTOREOPT + { + /// + SYMSTOREOPT_ALT_INDEX = 0x10, + + /// Compress the file. + SYMSTOREOPT_COMPRESS = 0x01, + + /// Overwrite the file if it exists. + SYMSTOREOPT_OVERWRITE = 0x02, + + /// Do not report an error if the file already exists in the symbol store. + SYMSTOREOPT_PASS_IF_EXISTS = 0x40, + + /// Store in File.ptr. + SYMSTOREOPT_POINTER = 0x08, + + /// Return the index only. + SYMSTOREOPT_RETURNINDEX = 0x04, + + /// + SYMSTOREOPT_UNICODE = 0x20, + } + /// Indicates whether the specified address is within an inline frame. /// A handle to a process. This handle must have been previously passed to the SymInitialize function. /// The address. @@ -814,6 +1416,7 @@ namespace Vanara.PInvoke /// Enumerates all modules that have been loaded for the process by the SymLoadModule64 or SymLoadModuleEx function. /// A handle to the process that was originally passed to the SymInitialize function. + /// If set to , force loading a 32-bit module, even on 64-bit systems. /// A list of loaded module names and bases. /// /// @@ -828,14 +1431,14 @@ namespace Vanara.PInvoke /// This function supersedes the SymEnumerateModules function. For more information, see Updated Platform Support. /// [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymEnumerateModules")] - public static IList<(string ModuleName, IntPtr BaseOfDll)> SymEnumerateModules(HPROCESS hProcess) + public static IList<(string ModuleName, IntPtr BaseOfDll)> SymEnumerateModules(HPROCESS hProcess, bool force32bit = false) { var ret = new List<(string, IntPtr)>(); bool success; - if (Vanara.InteropServices.LibHelper.Is64BitProcess) - success = SymEnumerateModulesW64(hProcess, Callback64); - else + if (!LibHelper.Is64BitProcess || force32bit) success = SymEnumerateModules(hProcess, Callback); + else + success = SymEnumerateModulesW64(hProcess, Callback64); if (!success) Win32Error.ThrowLastErrorUnless(Win32Error.ERROR_NOT_FOUND); return ret; @@ -1551,6 +2154,2041 @@ namespace Vanara.PInvoke [MarshalAs(UnmanagedType.LPTStr)] string FileName, [In, Optional] IntPtr id, uint two, uint three, SSRVOPT flags, [MarshalAs(UnmanagedType.LPTStr)] StringBuilder FoundFile, [In, Optional] PFINDFILEINPATHCALLBACK callback, [In, Optional] IntPtr context); + /// Retrieves symbol information for the specified address. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// + /// The address for which a symbol should be located. The address does not have to be on a symbol boundary. If the address comes + /// after the beginning of a symbol and before the end of the symbol, the symbol is found. + /// + /// The displacement from the beginning of the symbol, or zero. + /// + /// A pointer to a SYMBOL_INFO structure that provides information about the symbol. The symbol name is variable in length; + /// therefore this buffer must be large enough to hold the name stored at the end of the SYMBOL_INFO structure. Be sure to + /// set the MaxNameLen member to the number of bytes reserved for the name. + /// + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// Examples + /// For an example, see Retrieving Symbol Information by Address. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symfromaddr BOOL IMAGEAPI SymFromAddr( HANDLE hProcess, + // DWORD64 Address, PDWORD64 Displacement, PSYMBOL_INFO Symbol ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymFromAddr")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymFromAddr(HPROCESS hProcess, ulong Address, out ulong Displacement, ref SYMBOL_INFO Symbol); + + /// Retrieves symbol information for the specified index. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// The base address of the module. + /// A unique value for the symbol. + /// A pointer to a SYMBOL_INFO structure that provides information about the symbol. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symfromindex BOOL IMAGEAPI SymFromIndex( HANDLE hProcess, + // ULONG64 BaseOfDll, DWORD Index, PSYMBOL_INFO Symbol ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymFromIndex")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymFromIndex(HPROCESS hProcess, ulong BaseOfDll, uint Index, ref SYMBOL_INFO Symbol); + + /// Retrieves symbol information for the specified address and inline context. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// + /// The address for which a symbol should be located. The address does not have to be on a symbol boundary. If the address comes + /// after the beginning of a symbol and before the end of the symbol, the symbol is found. + /// + /// The inline context for which a symbol should be located. + /// The displacement from the beginning of the symbol, or zero. + /// + /// A pointer to a SYMBOL_INFO structure that provides information about the symbol. The symbol name is variable in length; + /// therefore this buffer must be large enough to hold the name stored at the end of the SYMBOL_INFO structure. Be sure to + /// set the MaxNameLen member to the number of bytes reserved for the name. + /// + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symfrominlinecontextw BOOL IMAGEAPI SymFromInlineContextW( + // HANDLE hProcess, DWORD64 Address, ULONG InlineContext, PDWORD64 Displacement, PSYMBOL_INFOW Symbol ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymFromInlineContextW")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymFromInlineContext(HPROCESS hProcess, ulong Address, uint InlineContext, out ulong Displacement, ref SYMBOL_INFO Symbol); + + /// Retrieves symbol information for the specified name. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// The name of the symbol to be located. + /// A pointer to a SYMBOL_INFO structure that provides information about the symbol. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// Examples + /// For an example, see Retrieving Symbol Information by Name. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symfromname BOOL IMAGEAPI SymFromName( HANDLE hProcess, + // PCSTR Name, PSYMBOL_INFO Symbol ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymFromName")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymFromName(HPROCESS hProcess, [MarshalAs(UnmanagedType.LPTStr)] string Name, ref SYMBOL_INFO Symbol); + + /// Retrieves symbol information for the specified managed code token. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// The base address of the managed code module. + /// The managed code token. + /// A pointer to a SYMBOL_INFO structure that provides information about the symbol. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symfromtokenw BOOL IMAGEAPI SymFromTokenW( HANDLE hProcess, + // DWORD64 Base, DWORD Token, PSYMBOL_INFOW Symbol ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymFromTokenW")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymFromToken(HPROCESS hProcess, ulong Base, uint Token, ref SYMBOL_INFO Symbol); + + /// Retrieves the function table entry for the specified address. + /// A handle to the process that was originally passed to the SymInitialize function. + /// The base address for which function table information is required. + /// + /// If the function succeeds, the return value is a pointer to the function table entry. + /// If the function fails, the return value is NULL. To retrieve extended error information, call GetLastError. + /// + /// + /// The type of pointer returned is specific to the image from which symbols are loaded. + /// x86: If the image is for an x86 system, this is a pointer to an FPO_DATA structure. + /// x64: If the image is for an x64 system, this is a pointer to an _IMAGE_RUNTIME_FUNCTION_ENTRY structure. + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// This function supersedes the SymFunctionTableAccess function. For more information, see Updated Platform Support. + /// SymFunctionTableAccess is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymFunctionTableAccess SymFunctionTableAccess64 #else PVOID IMAGEAPI SymFunctionTableAccess( __in HANDLE hProcess, __in DWORD AddrBase ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symfunctiontableaccess PVOID IMAGEAPI + // SymFunctionTableAccess( HANDLE hProcess, DWORD AddrBase ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymFunctionTableAccess")] + public static extern IntPtr SymFunctionTableAccess(HPROCESS hProcess, uint AddrBase); + + /// Retrieves the function table entry for the specified address. + /// A handle to the process that was originally passed to the SymInitialize function. + /// The base address for which function table information is required. + /// + /// If the function succeeds, the return value is a pointer to the function table entry. + /// If the function fails, the return value is NULL. To retrieve extended error information, call GetLastError. + /// + /// + /// The type of pointer returned is specific to the image from which symbols are loaded. + /// x86: If the image is for an x86 system, this is a pointer to an FPO_DATA structure. + /// x64: If the image is for an x64 system, this is a pointer to an _IMAGE_RUNTIME_FUNCTION_ENTRY structure. + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// This function supersedes the SymFunctionTableAccess function. For more information, see Updated Platform Support. + /// SymFunctionTableAccess is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymFunctionTableAccess SymFunctionTableAccess64 #else PVOID IMAGEAPI SymFunctionTableAccess( __in HANDLE hProcess, __in DWORD AddrBase ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symfunctiontableaccess64 PVOID IMAGEAPI + // SymFunctionTableAccess64( HANDLE hProcess, DWORD64 AddrBase ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymFunctionTableAccess64")] + public static extern IntPtr SymFunctionTableAccess64(HPROCESS hProcess, ulong AddrBase); + + /// + /// Finds a function table entry or frame pointer omission (FPO) record for an address. + /// Use SymFunctionTableAccess64 instead. + /// + /// A handle to the process that was originally passed to the SymInitialize function. + /// The base address for which function table information is required. + /// Pointer to a read memory callback function. + /// Pointer to a get module base callback function. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symfunctiontableaccess64accessroutines PVOID IMAGEAPI + // SymFunctionTableAccess64AccessRoutines( HANDLE hProcess, DWORD64 AddrBase, PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine, + // PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine ); + [DllImport(Lib_DbgHelp, SetLastError = false, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymFunctionTableAccess64AccessRoutines")] + public static extern IntPtr SymFunctionTableAccess64AccessRoutines(HPROCESS hProcess, ulong AddrBase, [Optional] PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine, + [Optional] PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine); + + /// Gets whether the specified extended symbol option on or off. + /// + /// The extended symbol option to check. The following are valid values. + /// + /// + /// Value + /// Meaning + /// + /// + /// SYMOPT_EX_DISABLEACCESSTIMEUPDATE 0 + /// + /// Turns off explicit updates to the last access time of a symbol that is loaded. By default, DbgHelp updates the last access time + /// of a symbol file that is consumed so that a symbol cache can be maintained by using a least recently used mechanism. + /// + /// + /// + /// + /// The value of the specified symbol option. + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetextendedoption BOOL IMAGEAPI SymGetExtendedOption( + // IMAGEHLP_EXTENDED_OPTIONS option ); + [DllImport(Lib_DbgHelp, SetLastError = false, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetExtendedOption")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetExtendedOption(IMAGEHLP_EXTENDED_OPTIONS option); + + /// Locates line information for the specified module and file name. + /// A handle to the process that was originally passed to the SymInitialize function. + /// + /// The name of the module in which lines are to be located. If this parameter is NULL, the function searches all modules. + /// + /// The name of the file in which lines are to be located. + /// + /// An array of offsets for each line. The offset for the line n is stored in element n-1. Array elements for lines that do not have + /// line information are left unchanged. + /// + /// The size of the Buffer array, in elements. + /// + /// + /// If the function succeeds, the return value is the highest line number found. This value is zero if no line information was found. + /// + /// If the function fails, the return value is LINE_ERROR. To retrieve extended error information, call GetLastError. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetfilelineoffsets64 ULONG IMAGEAPI + // SymGetFileLineOffsets64( HANDLE hProcess, PCSTR ModuleName, PCSTR FileName, PDWORD64 Buffer, ULONG BufferLines ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetFileLineOffsets64")] + public static extern uint SymGetFileLineOffsets64(HPROCESS hProcess, [Optional, MarshalAs(UnmanagedType.LPStr)] string ModuleName, + [MarshalAs(UnmanagedType.LPStr)] string FileName, out ulong Buffer, uint BufferLines); + + /// Retrieves the home directory used by Dbghelp. + /// + /// The directory to be retrieved. This parameter can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// hdBase 0 + /// The home directory. + /// + /// + /// hdSrc 2 + /// The source directory. + /// + /// + /// hdSym 1 + /// The symbol directory. + /// + /// + /// + /// A pointer to a string that receives the directory. + /// The size of the output buffer, in characters. + /// + /// If the function succeeds, the return value is a pointer to the dir parameter. + /// If the function fails, the return value is NULL. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgethomedirectory PCHAR IMAGEAPI SymGetHomeDirectory( + // DWORD type, PSTR dir, size_t size ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetHomeDirectory")] + [return: MarshalAs(UnmanagedType.LPTStr)] + public static extern StrPtrAuto SymGetHomeDirectory(IMAGEHLP_HD_TYPE type, [Out, MarshalAs(UnmanagedType.LPTStr)] StringBuilder dir, SizeT size); + + /// Locates the source line for the specified address. + /// A handle to the process that was originally passed to the SymInitialize function. + /// + /// The address for which a line should be located. It is not necessary for the address to be on a line boundary. If the address + /// appears after the beginning of a line and before the end of the line, the line is found. + /// + /// The displacement in bytes from the beginning of the line, or zero. + /// A pointer to an IMAGEHLP_LINE64 structure. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The caller must allocate the Line buffer properly and fill in the required members of the IMAGEHLP_LINE64 structure before + /// calling SymGetLineFromAddr64. + /// + /// + /// This function returns a pointer to a buffer that may be reused by another function. Therefore, be sure to copy the data returned + /// to another buffer immediately. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetLineFromAddrW64 is defined as + /// follows in Dbghelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetLineFromAddrW64( _In_ HANDLE hProcess, _In_ DWORD64 dwAddr, _Out_ PDWORD pdwDisplacement, _Out_ PIMAGEHLP_LINEW64 Line ); #ifdef DBGHELP_TRANSLATE_TCHAR #define SymGetLineFromAddr64 SymGetLineFromAddrW64 #endif + /// + /// + /// This function supersedes the SymGetLineFromAddr function. For more information, see Updated Platform Support. + /// SymGetLineFromAddr is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetLineFromAddr SymGetLineFromAddr64 #define SymGetLineFromAddrW SymGetLineFromAddrW64 #else BOOL IMAGEAPI SymGetLineFromAddr( _In_ HANDLE hProcess, _In_ DWORD dwAddr, _Out_ PDWORD pdwDisplacement, _Out_ PIMAGEHLP_LINE Line ); BOOL IMAGEAPI SymGetLineFromAddrW( _In_ HANDLE hProcess, _In_ DWORD dwAddr, _Out_ PDWORD pdwDisplacement, _Out_ PIMAGEHLP_LINEW Line ); #endif + /// + /// Examples + /// For an example, see Retrieving Symbol Information by Address. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetlinefromaddr + // BOOL IMAGEAPI SymGetLineFromAddr( HANDLE hProcess, DWORD dwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE Line ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetLineFromAddr")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetLineFromAddr(HPROCESS hProcess, uint dwAddr, out uint pdwDisplacement, ref IMAGEHLP_LINE Line); + + /// Locates the source line for the specified address. + /// A handle to the process that was originally passed to the SymInitialize function. + /// TBD + /// The displacement in bytes from the beginning of the line, or zero. + /// TBD + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The caller must allocate the Line buffer properly and fill in the required members of the IMAGEHLP_LINE64 structure before + /// calling SymGetLineFromAddr64. + /// + /// + /// This function returns a pointer to a buffer that may be reused by another function. Therefore, be sure to copy the data returned + /// to another buffer immediately. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetLineFromAddrW64 is defined as + /// follows in Dbghelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetLineFromAddrW64( _In_ HANDLE hProcess, _In_ DWORD64 dwAddr, _Out_ PDWORD pdwDisplacement, _Out_ PIMAGEHLP_LINEW64 Line ); #ifdef DBGHELP_TRANSLATE_TCHAR #define SymGetLineFromAddr64 SymGetLineFromAddrW64 #endif + /// + /// + /// This function supersedes the SymGetLineFromAddr function. For more information, see Updated Platform Support. + /// SymGetLineFromAddr is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetLineFromAddr SymGetLineFromAddr64 #define SymGetLineFromAddrW SymGetLineFromAddrW64 #else BOOL IMAGEAPI SymGetLineFromAddr( _In_ HANDLE hProcess, _In_ DWORD dwAddr, _Out_ PDWORD pdwDisplacement, _Out_ PIMAGEHLP_LINE Line ); BOOL IMAGEAPI SymGetLineFromAddrW( _In_ HANDLE hProcess, _In_ DWORD dwAddr, _Out_ PDWORD pdwDisplacement, _Out_ PIMAGEHLP_LINEW Line ); #endif + /// + /// Examples + /// For an example, see Retrieving Symbol Information by Address. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetlinefromaddr64 BOOL IMAGEAPI SymGetLineFromAddr64( + // HANDLE hProcess, DWORD64 qwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line64 ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetLineFromAddr64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetLineFromAddr64(HPROCESS hProcess, ulong qwAddr, out uint pdwDisplacement, ref IMAGEHLP_LINE64 Line64); + + /// Locates the source line for the specified address. + /// A handle to the process that was originally passed to the SymInitialize function. + /// TBD + /// The displacement in bytes from the beginning of the line, or zero. + /// TBD + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The caller must allocate the Line buffer properly and fill in the required members of the IMAGEHLP_LINE64 structure before + /// calling SymGetLineFromAddr64. + /// + /// + /// This function returns a pointer to a buffer that may be reused by another function. Therefore, be sure to copy the data returned + /// to another buffer immediately. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetLineFromAddrW64 is defined as + /// follows in Dbghelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetLineFromAddrW64( _In_ HANDLE hProcess, _In_ DWORD64 dwAddr, _Out_ PDWORD pdwDisplacement, _Out_ PIMAGEHLP_LINEW64 Line ); #ifdef DBGHELP_TRANSLATE_TCHAR #define SymGetLineFromAddr64 SymGetLineFromAddrW64 #endif + /// + /// + /// This function supersedes the SymGetLineFromAddr function. For more information, see Updated Platform Support. + /// SymGetLineFromAddr is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetLineFromAddr SymGetLineFromAddr64 #define SymGetLineFromAddrW SymGetLineFromAddrW64 #else BOOL IMAGEAPI SymGetLineFromAddr( _In_ HANDLE hProcess, _In_ DWORD dwAddr, _Out_ PDWORD pdwDisplacement, _Out_ PIMAGEHLP_LINE Line ); BOOL IMAGEAPI SymGetLineFromAddrW( _In_ HANDLE hProcess, _In_ DWORD dwAddr, _Out_ PDWORD pdwDisplacement, _Out_ PIMAGEHLP_LINEW Line ); #endif + /// + /// Examples + /// For an example, see Retrieving Symbol Information by Address. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetlinefromaddr64 BOOL IMAGEAPI SymGetLineFromAddr64( + // HANDLE hProcess, DWORD64 qwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line64 ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetLineFromAddr64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetLineFromAddrW64(HPROCESS hProcess, ulong qwAddr, out uint pdwDisplacement, ref IMAGEHLP_LINE64 Line64); + + /// Locates the source line for the specified inline context. + /// A handle to the process that was originally passed to the SymInitialize function. + /// TBD + /// The inline context. + /// The base address of the module. + /// The displacement in bytes from the beginning of the line, or zero. + /// TBD + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The caller must allocate the Line buffer properly and fill in the required members of the IMAGEHLP_LINE64 structure before + /// calling SymGetLineFromInlineContext. + /// + /// + /// This function returns a pointer to a buffer that may be reused by another function. Therefore, be sure to copy the data returned + /// to another buffer immediately. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetLineFromInlineContext is + /// defined as follows in Dbghelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetLineFromInlineContextW( _In_ HANDLE hProcess, _In_ DWORD64 dwAddr, _In_ ULONG InlineContext, _In_opt_ DWORD64 qwModuleBaseAddress, _Out_ PDWORD pdwDisplacement, _Out_ PIMAGEHLP_LINEW64 Line ); #ifdef DBGHELP_TRANSLATE_TCHAR #define SymGetLineFromInlineContext SymGetLineFromInlineContextW #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetlinefrominlinecontext BOOL IMAGEAPI + // SymGetLineFromInlineContext( HANDLE hProcess, DWORD64 qwAddr, ULONG InlineContext, DWORD64 qwModuleBaseAddress, PDWORD + // pdwDisplacement, PIMAGEHLP_LINE64 Line64 ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetLineFromInlineContext")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetLineFromInlineContext(HPROCESS hProcess, ulong qwAddr, uint InlineContext, [Optional] ulong qwModuleBaseAddress, + out uint pdwDisplacement, ref IMAGEHLP_LINE64 Line64); + + /// Locates a source line for the specified module, file name, and line number. + /// A handle to the process that was originally passed to the SymInitialize function. + /// The name of the module in which a line is to be located. + /// + /// The name of the file in which a line is to be located. If the application has more than one source file with this name, be sure + /// to specify a full path. + /// + /// The line number to be located. + /// The displacement in bytes from the beginning of the line, or zero. + /// A pointer to an IMAGEHLP_LINE64 structure. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The caller must allocate the Line buffer properly and fill in the required members of the IMAGEHLP_LINE64 structure before + /// calling SymGetLineFromName64. + /// + /// + /// Before calling this function, ensure that the symbols are initialized correctly by first calling SymInitialize, SymSetOptions, + /// and SymLoadModule64. + /// + /// + /// This function returns a pointer to a buffer that may be reused by another function. Therefore, be sure to copy the data returned + /// to another buffer immediately. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetLineFromNameW64 is defined as follows + /// in Dbghelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetLineFromNameW64( __in HANDLE hProcess, __in_opt PCWSTR ModuleName, __in_opt PCWSTR FileName, __in DWORD dwLineNumber, __out PLONG plDisplacement, __inout PIMAGEHLP_LINEW64 Line ); #ifdef DBGHELP_TRANSLATE_TCHAR #define SymGetLineFromName64 SymGetLineFromNameW64 #endif + /// + /// + /// This function supersedes the SymGetLineFromName function. For more information, see Updated Platform Support. + /// SymGetLineFromName is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetLineFromName SymGetLineFromName64 #else BOOL IMAGEAPI SymGetLineFromName( __in HANDLE hProcess, __in_opt PCSTR ModuleName, __in_opt PCSTR FileName, __in DWORD dwLineNumber, __out PLONG plDisplacement, __inout PIMAGEHLP_LINE Line ); #endif + /// + /// Examples + /// For an example, see Retrieving Symbol Information by Name. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetlinefromname BOOL IMAGEAPI SymGetLineFromName( HANDLE + // hProcess, PCSTR ModuleName, PCSTR FileName, DWORD dwLineNumber, PLONG plDisplacement, PIMAGEHLP_LINE Line ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetLineFromName")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetLineFromName(HPROCESS hProcess, [MarshalAs(UnmanagedType.LPStr)] string ModuleName, + [MarshalAs(UnmanagedType.LPStr)] string FileName, uint dwLineNumber, out int plDisplacement, ref IMAGEHLP_LINE Line); + + /// Locates a source line for the specified module, file name, and line number. + /// A handle to the process that was originally passed to the SymInitialize function. + /// The name of the module in which a line is to be located. + /// + /// The name of the file in which a line is to be located. If the application has more than one source file with this name, be sure + /// to specify a full path. + /// + /// The line number to be located. + /// The displacement in bytes from the beginning of the line, or zero. + /// A pointer to an IMAGEHLP_LINE64 structure. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The caller must allocate the Line buffer properly and fill in the required members of the IMAGEHLP_LINE64 structure before + /// calling SymGetLineFromName64. + /// + /// + /// Before calling this function, ensure that the symbols are initialized correctly by first calling SymInitialize, SymSetOptions, + /// and SymLoadModule64. + /// + /// + /// This function returns a pointer to a buffer that may be reused by another function. Therefore, be sure to copy the data returned + /// to another buffer immediately. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetLineFromNameW64 is defined as follows + /// in Dbghelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetLineFromNameW64( __in HANDLE hProcess, __in_opt PCWSTR ModuleName, __in_opt PCWSTR FileName, __in DWORD dwLineNumber, __out PLONG plDisplacement, __inout PIMAGEHLP_LINEW64 Line ); #ifdef DBGHELP_TRANSLATE_TCHAR #define SymGetLineFromName64 SymGetLineFromNameW64 #endif + /// + /// + /// This function supersedes the SymGetLineFromName function. For more information, see Updated Platform Support. + /// SymGetLineFromName is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetLineFromName SymGetLineFromName64 #else BOOL IMAGEAPI SymGetLineFromName( __in HANDLE hProcess, __in_opt PCSTR ModuleName, __in_opt PCSTR FileName, __in DWORD dwLineNumber, __out PLONG plDisplacement, __inout PIMAGEHLP_LINE Line ); #endif + /// + /// Examples + /// For an example, see Retrieving Symbol Information by Name. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetlinefromname64 BOOL IMAGEAPI SymGetLineFromName64( + // HANDLE hProcess, PCSTR ModuleName, PCSTR FileName, DWORD dwLineNumber, PLONG plDisplacement, PIMAGEHLP_LINE64 Line ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetLineFromName64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetLineFromName64(HPROCESS hProcess, [MarshalAs(UnmanagedType.LPStr)] string ModuleName, + [MarshalAs(UnmanagedType.LPStr)] string FileName, uint dwLineNumber, out int plDisplacement, ref IMAGEHLP_LINE64 Line); + + /// Locates a source line for the specified module, file name, and line number. + /// A handle to the process that was originally passed to the SymInitialize function. + /// The name of the module in which a line is to be located. + /// + /// The name of the file in which a line is to be located. If the application has more than one source file with this name, be sure + /// to specify a full path. + /// + /// The line number to be located. + /// The displacement in bytes from the beginning of the line, or zero. + /// A pointer to an IMAGEHLP_LINE64 structure. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The caller must allocate the Line buffer properly and fill in the required members of the IMAGEHLP_LINE64 structure before + /// calling SymGetLineFromName64. + /// + /// + /// Before calling this function, ensure that the symbols are initialized correctly by first calling SymInitialize, SymSetOptions, + /// and SymLoadModule64. + /// + /// + /// This function returns a pointer to a buffer that may be reused by another function. Therefore, be sure to copy the data returned + /// to another buffer immediately. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetLineFromNameW64 is defined as follows + /// in Dbghelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetLineFromNameW64( __in HANDLE hProcess, __in_opt PCWSTR ModuleName, __in_opt PCWSTR FileName, __in DWORD dwLineNumber, __out PLONG plDisplacement, __inout PIMAGEHLP_LINEW64 Line ); #ifdef DBGHELP_TRANSLATE_TCHAR #define SymGetLineFromName64 SymGetLineFromNameW64 #endif + /// + /// + /// This function supersedes the SymGetLineFromName function. For more information, see Updated Platform Support. + /// SymGetLineFromName is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetLineFromName SymGetLineFromName64 #else BOOL IMAGEAPI SymGetLineFromName( __in HANDLE hProcess, __in_opt PCSTR ModuleName, __in_opt PCSTR FileName, __in DWORD dwLineNumber, __out PLONG plDisplacement, __inout PIMAGEHLP_LINE Line ); #endif + /// + /// Examples + /// For an example, see Retrieving Symbol Information by Name. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetlinefromnamew64 BOOL IMAGEAPI SymGetLineFromNameW64( + // HANDLE hProcess, PCWSTR ModuleName, PCWSTR FileName, DWORD dwLineNumber, PLONG plDisplacement, PIMAGEHLP_LINEW64 Line ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetLineFromNameW64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetLineFromNameW64(HPROCESS hProcess, [MarshalAs(UnmanagedType.LPWStr)] string ModuleName, + [MarshalAs(UnmanagedType.LPWStr)] string FileName, uint dwLineNumber, out int plDisplacement, ref IMAGEHLP_LINE64 Line); + + /// Retrieves the line information for the next source line. + /// A handle to the process that was originally passed to the SymInitialize function. + /// A pointer to an IMAGEHLP_LINE64 structure that contains the line information. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymGetLineNext64 function requires that the IMAGEHLP_LINE64 structure have valid data, presumably obtained from a + /// call to the SymGetLineFromAddr64 or SymGetLineFromName64 function. This structure receives the line information for the next + /// line in sequence. + /// + /// + /// This function returns a pointer to a buffer that may be reused by another function. Therefore, be sure to copy the data returned + /// to another buffer immediately. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetLineNextW64 is defined as follows in Dbghelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetLineNextW64( __in HANDLE hProcess, __inout PIMAGEHLP_LINEW64 Line #ifdef DBGHELP_TRANSLATE_TCHAR #define SymGetLineNext64 SymGetLineNextW64 #endif + /// + /// + /// This function supersedes the SymGetLineNext function. For more information, see Updated Platform Support. + /// SymGetLineNext is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetLineNext SymGetLineNext64 #else BOOL IMAGEAPI SymGetLineNext( __in HANDLE hProcess, __inout PIMAGEHLP_LINE Line ); BOOL IMAGEAPI SymGetLineNextW( __in HANDLE hProcess, __inout PIMAGEHLP_LINEW Line ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetlinenext BOOL IMAGEAPI SymGetLineNext( HANDLE + // hProcess, PIMAGEHLP_LINE Line ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetLineNext")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetLineNext(HPROCESS hProcess, ref IMAGEHLP_LINE Line); + + /// Retrieves the line information for the next source line. + /// A handle to the process that was originally passed to the SymInitialize function. + /// A pointer to an IMAGEHLP_LINE64 structure that contains the line information. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymGetLineNext64 function requires that the IMAGEHLP_LINE64 structure have valid data, presumably obtained from a + /// call to the SymGetLineFromAddr64 or SymGetLineFromName64 function. This structure receives the line information for the next + /// line in sequence. + /// + /// + /// This function returns a pointer to a buffer that may be reused by another function. Therefore, be sure to copy the data returned + /// to another buffer immediately. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetLineNextW64 is defined as follows in Dbghelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetLineNextW64( __in HANDLE hProcess, __inout PIMAGEHLP_LINEW64 Line #ifdef DBGHELP_TRANSLATE_TCHAR #define SymGetLineNext64 SymGetLineNextW64 #endif + /// + /// + /// This function supersedes the SymGetLineNext function. For more information, see Updated Platform Support. + /// SymGetLineNext is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetLineNext SymGetLineNext64 #else BOOL IMAGEAPI SymGetLineNext( __in HANDLE hProcess, __inout PIMAGEHLP_LINE Line ); BOOL IMAGEAPI SymGetLineNextW( __in HANDLE hProcess, __inout PIMAGEHLP_LINEW Line ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetlinenext64 BOOL IMAGEAPI SymGetLineNext64( HANDLE + // hProcess, PIMAGEHLP_LINE64 Line ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetLineNext64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetLineNext64(HPROCESS hProcess, ref IMAGEHLP_LINE64 Line); + + /// Retrieves the line information for the next source line. + /// A handle to the process that was originally passed to the SymInitialize function. + /// A pointer to an IMAGEHLP_LINE64 structure that contains the line information. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymGetLineNext64 function requires that the IMAGEHLP_LINE64 structure have valid data, presumably obtained from a + /// call to the SymGetLineFromAddr64 or SymGetLineFromName64 function. This structure receives the line information for the next + /// line in sequence. + /// + /// + /// This function returns a pointer to a buffer that may be reused by another function. Therefore, be sure to copy the data returned + /// to another buffer immediately. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetLineNextW64 is defined as follows in Dbghelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetLineNextW64( __in HANDLE hProcess, __inout PIMAGEHLP_LINEW64 Line #ifdef DBGHELP_TRANSLATE_TCHAR #define SymGetLineNext64 SymGetLineNextW64 #endif + /// + /// + /// This function supersedes the SymGetLineNext function. For more information, see Updated Platform Support. + /// SymGetLineNext is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetLineNext SymGetLineNext64 #else BOOL IMAGEAPI SymGetLineNext( __in HANDLE hProcess, __inout PIMAGEHLP_LINE Line ); BOOL IMAGEAPI SymGetLineNextW( __in HANDLE hProcess, __inout PIMAGEHLP_LINEW Line ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetlinenextw64 BOOL IMAGEAPI SymGetLineNextW64( HANDLE + // hProcess, PIMAGEHLP_LINEW64 Line ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetLineNextW64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetLineNextW64(HPROCESS hProcess, ref IMAGEHLP_LINE64 Line); + + /// Retrieves the line information for the previous source line. + /// A handle to the process that was originally passed to the SymInitialize function. + /// A pointer to an IMAGEHLP_LINE64 structure. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymGetLinePrev64 function requires that the IMAGEHLP_LINE64 structure have valid data, presumably obtained from a + /// call to the SymGetLineFromAddr64 or SymGetLineFromName64 function. This structure is filled with the line information for the + /// previous line in sequence. + /// + /// + /// This function returns a pointer to a buffer that may be reused by another function. Therefore, be sure to copy the data returned + /// to another buffer immediately. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetLinePrevW64 is defined as follows in DbgHelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetLinePrevW64( __in HANDLE hProcess, __inout PIMAGEHLP_LINEW64 Line ); #ifdef DBGHELP_TRANSLATE_TCHAR #define SymGetLinePrev64 SymGetLinePrevW64 #endif + /// + /// + /// This function supersedes the SymGetLinePrev function. For more information, see Updated Platform Support. + /// SymGetLinePrev is defined as follows in DbgHelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetLinePrev SymGetLinePrev64 #else BOOL IMAGEAPI SymGetLinePrev( __in HANDLE hProcess, __inout PIMAGEHLP_LINE Line ); BOOL IMAGEAPI SymGetLinePrevW( __in HANDLE hProcess, __inout PIMAGEHLP_LINEW Line ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetlineprev BOOL IMAGEAPI SymGetLinePrev( HANDLE + // hProcess, PIMAGEHLP_LINE Line ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetLinePrev")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetLinePrev(HPROCESS hProcess, ref IMAGEHLP_LINE Line); + + /// Retrieves the line information for the previous source line. + /// A handle to the process that was originally passed to the SymInitialize function. + /// A pointer to an IMAGEHLP_LINE64 structure. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymGetLinePrev64 function requires that the IMAGEHLP_LINE64 structure have valid data, presumably obtained from a + /// call to the SymGetLineFromAddr64 or SymGetLineFromName64 function. This structure is filled with the line information for the + /// previous line in sequence. + /// + /// + /// This function returns a pointer to a buffer that may be reused by another function. Therefore, be sure to copy the data returned + /// to another buffer immediately. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetLinePrevW64 is defined as follows in DbgHelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetLinePrevW64( __in HANDLE hProcess, __inout PIMAGEHLP_LINEW64 Line ); #ifdef DBGHELP_TRANSLATE_TCHAR #define SymGetLinePrev64 SymGetLinePrevW64 #endif + /// + /// + /// This function supersedes the SymGetLinePrev function. For more information, see Updated Platform Support. + /// SymGetLinePrev is defined as follows in DbgHelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetLinePrev SymGetLinePrev64 #else BOOL IMAGEAPI SymGetLinePrev( __in HANDLE hProcess, __inout PIMAGEHLP_LINE Line ); BOOL IMAGEAPI SymGetLinePrevW( __in HANDLE hProcess, __inout PIMAGEHLP_LINEW Line ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetlineprev64 BOOL IMAGEAPI SymGetLinePrev64( HANDLE + // hProcess, PIMAGEHLP_LINE64 Line ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetLinePrev64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetLinePrev64(HPROCESS hProcess, ref IMAGEHLP_LINE64 Line); + + /// Retrieves the line information for the previous source line. + /// A handle to the process that was originally passed to the SymInitialize function. + /// A pointer to an IMAGEHLP_LINE64 structure. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymGetLinePrev64 function requires that the IMAGEHLP_LINE64 structure have valid data, presumably obtained from a + /// call to the SymGetLineFromAddr64 or SymGetLineFromName64 function. This structure is filled with the line information for the + /// previous line in sequence. + /// + /// + /// This function returns a pointer to a buffer that may be reused by another function. Therefore, be sure to copy the data returned + /// to another buffer immediately. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetLinePrevW64 is defined as follows in DbgHelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetLinePrevW64( __in HANDLE hProcess, __inout PIMAGEHLP_LINEW64 Line ); #ifdef DBGHELP_TRANSLATE_TCHAR #define SymGetLinePrev64 SymGetLinePrevW64 #endif + /// + /// + /// This function supersedes the SymGetLinePrev function. For more information, see Updated Platform Support. + /// SymGetLinePrev is defined as follows in DbgHelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetLinePrev SymGetLinePrev64 #else BOOL IMAGEAPI SymGetLinePrev( __in HANDLE hProcess, __inout PIMAGEHLP_LINE Line ); BOOL IMAGEAPI SymGetLinePrevW( __in HANDLE hProcess, __inout PIMAGEHLP_LINEW Line ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetlineprevw64 BOOL IMAGEAPI SymGetLinePrevW64( HANDLE + // hProcess, PIMAGEHLP_LINEW64 Line ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetLinePrevW64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetLinePrevW64(HPROCESS hProcess, ref IMAGEHLP_LINE64 Line); + + /// Retrieves the base address of the module that contains the specified address. + /// A handle to the process that was originally passed to the SymInitialize function. + /// The virtual address that is contained in one of the modules loaded by the SymLoadModule64 function. + /// + /// + /// If the function succeeds, the return value is a nonzero virtual address. The value is the base address of the module containing + /// the address specified by the dwAddr parameter. + /// + /// If the function fails, the return value is zero. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The module table is searched for a module that contains dwAddr. The module is located based on the load address and size of each module. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// This function supersedes the SymGetModuleBase function. For more information, see Updated Platform Support. + /// SymGetModuleBase is defined as follows in DbgHelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetModuleBase SymGetModuleBase64 #else DWORD IMAGEAPI SymGetModuleBase( __in HANDLE hProcess, __in DWORD dwAddr ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetmodulebase DWORD IMAGEAPI SymGetModuleBase( HANDLE + // hProcess, DWORD dwAddr ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetModuleBase")] + public static extern uint SymGetModuleBase(HPROCESS hProcess, uint dwAddr); + + /// Retrieves the base address of the module that contains the specified address. + /// A handle to the process that was originally passed to the SymInitialize function. + /// TBD + /// + /// + /// If the function succeeds, the return value is a nonzero virtual address. The value is the base address of the module containing + /// the address specified by the dwAddr parameter. + /// + /// If the function fails, the return value is zero. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The module table is searched for a module that contains dwAddr. The module is located based on the load address and size of each module. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// This function supersedes the SymGetModuleBase function. For more information, see Updated Platform Support. + /// SymGetModuleBase is defined as follows in DbgHelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetModuleBase SymGetModuleBase64 #else DWORD IMAGEAPI SymGetModuleBase( __in HANDLE hProcess, __in DWORD dwAddr ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetmodulebase64 DWORD64 IMAGEAPI SymGetModuleBase64( + // HANDLE hProcess, DWORD64 qwAddr ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetModuleBase64")] + public static extern ulong SymGetModuleBase64(HPROCESS hProcess, ulong qwAddr); + + /// Retrieves the module information of the specified module. + /// A handle to the process that was originally passed to the SymInitialize function. + /// The virtual address that is contained in one of the modules loaded by the SymLoadModule64 function + /// + /// A pointer to an IMAGEHLP_MODULE64 structure. The SizeOfStruct member must be set to the size of the + /// IMAGEHLP_MODULE64 structure. An invalid value will result in an error. + /// + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The module table is searched for a module that contains the dwAddr. The module is located based on the load address and size of + /// each module. If a valid module is found, the ModuleInfo parameter is filled with the information about the module. + /// + /// + /// The size of the IMAGEHLP_MODULE64 structure used by this function has changed over the years. If a version of DbgHelp.dll is + /// called that is older than the DbgHelp.h used to compile the calling code, then this function may fail with an error code of + /// ERROR_INVALID_PARAMETER. This most commonly occurs when the system version (%WinDir%\System32\DbgHelp.dll) is called. + /// Code that calls the system version of DbgHelp.dll must be compiled using the appropriate SDK for that Windows release or the SDK + /// for a previous release. + /// + /// + /// The recommended model is to redistribute the required version of DbgHelp.dll along with the calling software. This allows the + /// caller to use the most robust versions of DbgHelp.dll as well as a simplifying upgrades. The most recent version of DbgHelp.dll + /// can always be found in the Debugging Tools for Windows package. As a general rule, code that is compiled to work with older + /// versions will always work with newer versions. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetModuleInfoW64 is defined as + /// follows in DbgHelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetModuleInfoW64( __in HANDLE hProcess, __in DWORD64 qwAddr, __out PIMAGEHLP_MODULEW64 ModuleInfo ); #ifdef DBGHELP_TRANSLATE_TCHAR #define SymGetModuleInfo64 SymGetModuleInfoW64 #endif + /// + /// + /// This function supersedes the SymGetModuleInfo function. For more information, see Updated Platform Support. + /// SymGetModuleInfo is defined as follows in DbgHelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetModuleInfo SymGetModuleInfo64 #define SymGetModuleInfoW SymGetModuleInfoW64 #else BOOL IMAGEAPI SymGetModuleInfo( __in HANDLE hProcess, __in DWORD dwAddr, __out PIMAGEHLP_MODULE ModuleInfo ); BOOL IMAGEAPI SymGetModuleInfoW( __in HANDLE hProcess, __in DWORD dwAddr, __out PIMAGEHLP_MODULEW ModuleInfo ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetmoduleinfo BOOL IMAGEAPI SymGetModuleInfo( HANDLE + // hProcess, DWORD dwAddr, PIMAGEHLP_MODULE ModuleInfo ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetModuleInfo")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetModuleInfo(HPROCESS hProcess, uint dwAddr, ref IMAGEHLP_MODULE ModuleInfo); + + /// Retrieves the module information of the specified module. + /// A handle to the process that was originally passed to the SymInitialize function. + /// TBD + /// + /// A pointer to an IMAGEHLP_MODULE64 structure. The SizeOfStruct member must be set to the size of the + /// IMAGEHLP_MODULE64 structure. An invalid value will result in an error. + /// + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The module table is searched for a module that contains the dwAddr. The module is located based on the load address and size of + /// each module. If a valid module is found, the ModuleInfo parameter is filled with the information about the module. + /// + /// + /// The size of the IMAGEHLP_MODULE64 structure used by this function has changed over the years. If a version of DbgHelp.dll is + /// called that is older than the DbgHelp.h used to compile the calling code, then this function may fail with an error code of + /// ERROR_INVALID_PARAMETER. This most commonly occurs when the system version (%WinDir%\System32\DbgHelp.dll) is called. + /// Code that calls the system version of DbgHelp.dll must be compiled using the appropriate SDK for that Windows release or the SDK + /// for a previous release. + /// + /// + /// The recommended model is to redistribute the required version of DbgHelp.dll along with the calling software. This allows the + /// caller to use the most robust versions of DbgHelp.dll as well as a simplifying upgrades. The most recent version of DbgHelp.dll + /// can always be found in the Debugging Tools for Windows package. As a general rule, code that is compiled to work with older + /// versions will always work with newer versions. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetModuleInfoW64 is defined as + /// follows in DbgHelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetModuleInfoW64( __in HANDLE hProcess, __in DWORD64 qwAddr, __out PIMAGEHLP_MODULEW64 ModuleInfo ); #ifdef DBGHELP_TRANSLATE_TCHAR #define SymGetModuleInfo64 SymGetModuleInfoW64 #endif + /// + /// + /// This function supersedes the SymGetModuleInfo function. For more information, see Updated Platform Support. + /// SymGetModuleInfo is defined as follows in DbgHelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetModuleInfo SymGetModuleInfo64 #define SymGetModuleInfoW SymGetModuleInfoW64 #else BOOL IMAGEAPI SymGetModuleInfo( __in HANDLE hProcess, __in DWORD dwAddr, __out PIMAGEHLP_MODULE ModuleInfo ); BOOL IMAGEAPI SymGetModuleInfoW( __in HANDLE hProcess, __in DWORD dwAddr, __out PIMAGEHLP_MODULEW ModuleInfo ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetmoduleinfo64 BOOL IMAGEAPI SymGetModuleInfo64( HANDLE + // hProcess, DWORD64 qwAddr, PIMAGEHLP_MODULE64 ModuleInfo ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetModuleInfo64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetModuleInfo64(HPROCESS hProcess, ulong qwAddr, ref IMAGEHLP_MODULE64 ModuleInfo); + + /// Retrieves the module information of the specified module. + /// A handle to the process that was originally passed to the SymInitialize function. + /// TBD + /// + /// A pointer to an IMAGEHLP_MODULE64 structure. The SizeOfStruct member must be set to the size of the + /// IMAGEHLP_MODULE64 structure. An invalid value will result in an error. + /// + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The module table is searched for a module that contains the dwAddr. The module is located based on the load address and size of + /// each module. If a valid module is found, the ModuleInfo parameter is filled with the information about the module. + /// + /// + /// The size of the IMAGEHLP_MODULE64 structure used by this function has changed over the years. If a version of DbgHelp.dll is + /// called that is older than the DbgHelp.h used to compile the calling code, then this function may fail with an error code of + /// ERROR_INVALID_PARAMETER. This most commonly occurs when the system version (%WinDir%\System32\DbgHelp.dll) is called. + /// Code that calls the system version of DbgHelp.dll must be compiled using the appropriate SDK for that Windows release or the SDK + /// for a previous release. + /// + /// + /// The recommended model is to redistribute the required version of DbgHelp.dll along with the calling software. This allows the + /// caller to use the most robust versions of DbgHelp.dll as well as a simplifying upgrades. The most recent version of DbgHelp.dll + /// can always be found in the Debugging Tools for Windows package. As a general rule, code that is compiled to work with older + /// versions will always work with newer versions. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetModuleInfoW64 is defined as + /// follows in DbgHelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetModuleInfoW64( __in HANDLE hProcess, __in DWORD64 qwAddr, __out PIMAGEHLP_MODULEW64 ModuleInfo ); #ifdef DBGHELP_TRANSLATE_TCHAR #define SymGetModuleInfo64 SymGetModuleInfoW64 #endif + /// + /// + /// This function supersedes the SymGetModuleInfo function. For more information, see Updated Platform Support. + /// SymGetModuleInfo is defined as follows in DbgHelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetModuleInfo SymGetModuleInfo64 #define SymGetModuleInfoW SymGetModuleInfoW64 #else BOOL IMAGEAPI SymGetModuleInfo( __in HANDLE hProcess, __in DWORD dwAddr, __out PIMAGEHLP_MODULE ModuleInfo ); BOOL IMAGEAPI SymGetModuleInfoW( __in HANDLE hProcess, __in DWORD dwAddr, __out PIMAGEHLP_MODULEW ModuleInfo ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetmoduleinfo64 BOOL IMAGEAPI SymGetModuleInfo64( HANDLE + // hProcess, DWORD64 qwAddr, PIMAGEHLP_MODULE64 ModuleInfo ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetModuleInfo64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetModuleInfoW64(HPROCESS hProcess, ulong qwAddr, ref IMAGEHLP_MODULE64 ModuleInfo); + + /// Retrieves the omap tables within a loaded module. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// The base address of the module. + /// + /// An array of address map entries to the new image layout taken from the original layout. For details on the map entries, see the + /// OMAP structure. + /// + /// The number of entries in the OmapTo array. + /// + /// An array of address map entries from the new image layout to the original layout (as described by the debug symbols). For + /// details on the map entries, see the OMAP structure. + /// + /// The number of entries in the OmapFrom array. + /// + /// If the function succeeds, the return value is TRUE. + /// + /// If the function fails (the omap is not found), the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetomaps BOOL IMAGEAPI SymGetOmaps( HANDLE hProcess, + // DWORD64 BaseOfDll, POMAP *OmapTo, PDWORD64 cOmapTo, POMAP *OmapFrom, PDWORD64 cOmapFrom ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetOmaps")] + [return: MarshalAs(UnmanagedType.Bool)] + public static unsafe extern bool SymGetOmaps(HPROCESS hProcess, ulong BaseOfDll, + //[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] out OMAP[] OmapTo, out ulong cOmapTo, + //[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] out OMAP[] OmapFrom, out ulong cOmapFrom); + out OMAP* OmapTo, out ulong cOmapTo, out OMAP* OmapFrom, out ulong cOmapFrom); + + /// Retrieves the current option mask. + /// + /// The function returns the current options that have been set. Zero is a valid value and indicates that all options are turned off. + /// + /// + /// + /// These options can be changed several times while the library is in use by an application. Any option change affects all future + /// calls to the symbol handler. + /// + /// The return value is the combination of the following values that have been set using the SymSetOptions function. + /// + /// + /// SYMOPT_ALLOW_ABSOLUTE_SYMBOLS + /// + /// + /// SYMOPT_ALLOW_ZERO_ADDRESS + /// + /// + /// SYMOPT_AUTO_PUBLICS + /// + /// + /// SYMOPT_CASE_INSENSITIVE + /// + /// + /// SYMOPT_DEBUG + /// + /// + /// SYMOPT_DEFERRED_LOADS + /// + /// + /// SYMOPT_EXACT_SYMBOLS + /// + /// + /// SYMOPT_FAIL_CRITICAL_ERRORS + /// + /// + /// SYMOPT_FAVOR_COMPRESSED + /// + /// + /// SYMOPT_FLAT_DIRECTORY + /// + /// + /// SYMOPT_IGNORE_CVREC + /// + /// + /// SYMOPT_IGNORE_IMAGEDIR + /// + /// + /// SYMOPT_IGNORE_NT_SYMPATH + /// + /// + /// SYMOPT_INCLUDE_32BIT_MODULES + /// + /// + /// SYMOPT_LOAD_ANYTHING + /// + /// + /// SYMOPT_LOAD_LINES + /// + /// + /// SYMOPT_NO_CPP + /// + /// + /// SYMOPT_NO_IMAGE_SEARCH + /// + /// + /// SYMOPT_NO_PROMPTS + /// + /// + /// SYMOPT_NO_PUBLICS + /// + /// + /// SYMOPT_NO_UNQUALIFIED_LOADS + /// + /// + /// SYMOPT_OVERWRITE + /// + /// + /// SYMOPT_PUBLICS_ONLY + /// + /// + /// SYMOPT_SECURE + /// + /// + /// SYMOPT_UNDNAME + /// + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetoptions DWORD IMAGEAPI SymGetOptions(); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetOptions")] + public static extern SYMOPT SymGetOptions(); + + /// Retrieves the scope for the specified index. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// The base address of the module. + /// A unique value for the symbol. + /// A pointer to a SYMBOL_INFO structure. The Scope member contains the scope. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetscope BOOL IMAGEAPI SymGetScope( HANDLE hProcess, + // ULONG64 BaseOfDll, DWORD Index, PSYMBOL_INFO Symbol ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetScope")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetScope(HPROCESS hProcess, ulong BaseOfDll, uint Index, ref SYMBOL_INFO Symbol); + + /// Retrieves the symbol search path for the specified process. + /// A handle to the process that was originally passed to the SymInitialize function. + /// A pointer to the buffer that receives the symbol search path. + /// The size of the SearchPath buffer, in characters. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymGetSearchPath function copies the symbol search path for the specified process into the SearchPath buffer. If the + /// function fails, the contents of the buffer are undefined. + /// + /// To specify a symbol search path for the process, use the SymSetSearchPath function. + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetsearchpath BOOL IMAGEAPI SymGetSearchPath( HANDLE + // hProcess, PSTR SearchPath, DWORD SearchPathLength ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetSearchPath")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetSearchPath(HPROCESS hProcess, [Out, MarshalAs(UnmanagedType.LPTStr)] StringBuilder SearchPath, uint SearchPathLength); + + /// Retrieves the specified source file from the source server. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// The base address of the module. + /// This parameter is unused. + /// The name of the source file. + /// A pointer to a buffer that receives the fully qualified path of the source file. + /// The size of the FilePath buffer, in characters. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// To control which directory receives the source files, use the SymSetHomeDirectory function. + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetsourcefile BOOL IMAGEAPI SymGetSourceFile( HANDLE + // hProcess, ULONG64 Base, PCSTR Params, PCSTR FileSpec, PSTR FilePath, DWORD Size ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetSourceFile")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetSourceFile(HPROCESS hProcess, ulong Base, [Optional, MarshalAs(UnmanagedType.LPTStr)] string Params, + [MarshalAs(UnmanagedType.LPTStr)] string FileSpec, [Out, MarshalAs(UnmanagedType.LPTStr)] StringBuilder FilePath, uint Size); + + /// Retrieves the specified source file checksum from the source server. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// The base address of the module. + /// The name of the source file. + /// On success, points to the checksum type. + /// + /// pointer to a buffer that receives the checksum. If NULL, then when the call returns pActualBytesWritten returns the + /// number of bytes required. + /// + /// The size of the pChecksum buffer, in bytes. + /// Pointer to the actual bytes written in the buffer. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetsourcefilechecksum BOOL IMAGEAPI + // SymGetSourceFileChecksum( HANDLE hProcess, ULONG64 Base, PCSTR FileSpec, DWORD *pCheckSumType, BYTE *pChecksum, DWORD + // checksumSize, DWORD *pActualBytesWritten ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetSourceFileChecksum")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetSourceFileChecksum(HPROCESS hProcess, ulong Base, [MarshalAs(UnmanagedType.LPTStr)] string FileSpec, + out uint pCheckSumType, [Out] IntPtr pChecksum, uint checksumSize, out uint pActualBytesWritten); + + /// Retrieves the source file associated with the specified token from the source server. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// A pointer to the token. + /// This parameter is unused. + /// A pointer to a buffer that receives the fully qualified path of the source file. + /// The size of the FilePath buffer, in characters. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetsourcefilefromtoken BOOL IMAGEAPI + // SymGetSourceFileFromToken( HANDLE hProcess, PVOID Token, PCSTR Params, PSTR FilePath, DWORD Size ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetSourceFileFromToken")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetSourceFileFromToken(HPROCESS hProcess, [In] IntPtr Token, [Optional, MarshalAs(UnmanagedType.LPTStr)] string Params, + [Out, MarshalAs(UnmanagedType.LPTStr)] StringBuilder FilePath, uint Size); + + /// Retrieves token for the specified source file from the source server. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// The base address of the module. + /// The name of the source file. + /// A pointer to a buffer that receives the token. + /// The size of the Token buffer, in bytes. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetsourcefiletoken BOOL IMAGEAPI SymGetSourceFileToken( + // HANDLE hProcess, ULONG64 Base, PCSTR FileSpec, PVOID *Token, DWORD *Size ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetSourceFileToken")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetSourceFileToken(HPROCESS hProcess, ulong Base, [MarshalAs(UnmanagedType.LPTStr)] string FileSpec, out IntPtr Token, out uint Size); + + /// Retrieves the value associated with the specified variable name from the Source Server token. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// A pointer to the token. + /// This parameter is unused. + /// The name of the variable token whose value you want to retrieve. + /// + /// A pointer to a buffer that receives the value associated with the variable token specified in the VarName parameter. + /// + /// The size of the Value buffer, in characters. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetsourcevarfromtoken BOOL IMAGEAPI + // SymGetSourceVarFromToken( HANDLE hProcess, PVOID Token, PCSTR Params, PCSTR VarName, PSTR Value, DWORD Size ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetSourceVarFromToken")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetSourceVarFromToken(HPROCESS hProcess, [In] IntPtr Token, [Optional, MarshalAs(UnmanagedType.LPTStr)] string Params, + [MarshalAs(UnmanagedType.LPTStr)] string VarName, [Out, MarshalAs(UnmanagedType.LPTStr)] StringBuilder Value, uint Size); + + /// Locates a symbol file in the specified symbol path. + /// + /// A handle to the process that was originally passed to the SymInitialize function. + /// + /// If this handle is 0, SymPath cannot be NULL. Use this option to load a symbol file without calling SymInitialize or SymCleanup. + /// + /// + /// + /// The symbol path. If this parameter is NULL or an empty string, the function uses the symbol path set using the + /// SymInitialize or SymSetSearchPath function. + /// + /// The name of the image file. + /// + /// The type of symbol file. This parameter can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// sfImage 0 + /// A .exe or .dll file. + /// + /// + /// sfDbg 1 + /// A .dbg file. + /// + /// + /// sfPdb 2 + /// A .pdb file. + /// + /// + /// sfMpd 3 + /// Reserved. + /// + /// + /// + /// A pointer to a null-terminated string that receives the name of the symbol file. + /// The size of the SymbolFile buffer, in characters. + /// + /// A pointer to a buffer that receives the fully qualified path to the symbol file. This buffer must be at least MAX_PATH characters. + /// + /// The size of the DbgFile buffer, in characters. + /// + /// If the server locates a valid symbol file, it returns TRUE; otherwise, it returns FALSE and GetLastError returns a + /// value that indicates why the symbol file was not returned. + /// + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetsymbolfile BOOL IMAGEAPI SymGetSymbolFile( HANDLE + // hProcess, PCSTR SymPath, PCSTR ImageFile, DWORD Type, PSTR SymbolFile, size_t cSymbolFile, PSTR DbgFile, size_t cDbgFile ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetSymbolFile")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetSymbolFile([Optional] HPROCESS hProcess, [Optional, MarshalAs(UnmanagedType.LPTStr)] string SymPath, + [MarshalAs(UnmanagedType.LPTStr)] string ImageFile, IMAGEHLP_SF_TYPE Type, [Out, MarshalAs(UnmanagedType.LPTStr)] StringBuilder SymbolFile, + SizeT cSymbolFile, [Out, MarshalAs(UnmanagedType.LPTStr)] StringBuilder DbgFile, SizeT cDbgFile); + + /// + /// Locates the symbol for the specified address. + /// Note This function is provided only for compatibility. Applications should use SymFromAddr. + /// + /// A handle to the process that was originally passed to the SymInitialize function. + /// + /// The address for which a symbol is to be located. The address does not have to be on a symbol boundary. If the address comes + /// after the beginning of a symbol and before the end of the symbol (the beginning of the symbol plus the symbol size), the symbol + /// is found. + /// + /// The displacement from the beginning of the symbol, or zero. + /// A pointer to an IMAGEHLP_SYMBOL64 structure. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymGetSymFromAddr64 function locates the symbol for a specified address. The modules are searched for the one the + /// address belongs to. When the module is found, its symbol table is searched for a match. When the symbol is found, the symbol + /// information is copied into the Symbol buffer provided by the caller. The caller must allocate the Symbol buffer properly and + /// fill in the required parameters in the IMAGEHLP_SYMBOL64 structure before calling SymGetSymFromAddr64. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// This function supersedes the SymGetSymFromAddr function. For more information, see Updated Platform Support. + /// SymGetSymFromAddr is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetSymFromAddr SymGetSymFromAddr64 #else BOOL IMAGEAPI SymGetSymFromAddr( __in HANDLE hProcess, __in DWORD dwAddr, __out_opt PDWORD pdwDisplacement, __inout PIMAGEHLP_SYMBOL Symbol ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetsymfromaddr BOOL IMAGEAPI SymGetSymFromAddr( HANDLE + // hProcess, DWORD dwAddr, PDWORD pdwDisplacement, PIMAGEHLP_SYMBOL Symbol ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Ansi)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetSymFromAddr")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetSymFromAddr(HPROCESS hProcess, uint dwAddr, out uint pdwDisplacement, SafeIMAGEHLP_SYMBOL Symbol); + + /// + /// Locates the symbol for the specified address. + /// Note This function is provided only for compatibility. Applications should use SymFromAddr. + /// + /// A handle to the process that was originally passed to the SymInitialize function. + /// TBD + /// The displacement from the beginning of the symbol, or zero. + /// A pointer to an IMAGEHLP_SYMBOL64 structure. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymGetSymFromAddr64 function locates the symbol for a specified address. The modules are searched for the one the + /// address belongs to. When the module is found, its symbol table is searched for a match. When the symbol is found, the symbol + /// information is copied into the Symbol buffer provided by the caller. The caller must allocate the Symbol buffer properly and + /// fill in the required parameters in the IMAGEHLP_SYMBOL64 structure before calling SymGetSymFromAddr64. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// This function supersedes the SymGetSymFromAddr function. For more information, see Updated Platform Support. + /// SymGetSymFromAddr is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetSymFromAddr SymGetSymFromAddr64 #else BOOL IMAGEAPI SymGetSymFromAddr( __in HANDLE hProcess, __in DWORD dwAddr, __out_opt PDWORD pdwDisplacement, __inout PIMAGEHLP_SYMBOL Symbol ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetsymfromaddr64 BOOL IMAGEAPI SymGetSymFromAddr64( + // HANDLE hProcess, DWORD64 qwAddr, PDWORD64 pdwDisplacement, PIMAGEHLP_SYMBOL64 Symbol ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Ansi)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetSymFromAddr64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetSymFromAddr64(HPROCESS hProcess, ulong qwAddr, out ulong pdwDisplacement, SafeIMAGEHLP_SYMBOL64 Symbol); + + /// + /// Locates a symbol for the specified name. + /// Note This function is provided only for compatibility. Applications should use SymFromName. + /// + /// A handle to the process that was originally passed to the SymInitialize function. + /// The symbol name for which a symbol is to be located. + /// A pointer to an IMAGEHLP_SYMBOL64 structure. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymGetSymFromName64 function is used to locate a symbol for a specified name. The name can contain a module prefix + /// that isolates the symbol search to a single module's symbol table. + /// + /// + /// The module prefix is in the form of "module!". The "!" character is the delimiter between the module name and the symbol name. + /// If there is no module prefix, then the search is performed on each module's symbol table in a linear manner, beginning with the + /// first module that is loaded. + /// + /// + /// Using the module prefix is preferable for two reasons. First, the symbol search occurs much faster. Second, when deferred symbol + /// loading is turned on, the search causes symbols to be loaded for each module that is searched. When the symbol is found, the + /// symbol information is copied into the Symbol buffer provided by the caller. The caller must allocate the Symbol buffer properly + /// and fill in the required parameters in the IMAGEHLP_SYMBOL64 structure before calling SymGetSymFromName64. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// This function supersedes the SymGetSymFromName function. For more information, see Updated Platform Support. + /// SymGetSymFromName is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetSymFromName SymGetSymFromName64 #else BOOL IMAGEAPI SymGetSymFromName( __in HANDLE hProcess, __in PCSTR Name, __inout PIMAGEHLP_SYMBOL Symbol ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetsymfromname BOOL IMAGEAPI SymGetSymFromName( HANDLE + // hProcess, PCSTR Name, PIMAGEHLP_SYMBOL Symbol ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Ansi)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetSymFromName")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetSymFromName(HPROCESS hProcess, [MarshalAs(UnmanagedType.LPStr)] string Name, SafeIMAGEHLP_SYMBOL Symbol); + + /// + /// Locates a symbol for the specified name. + /// Note This function is provided only for compatibility. Applications should use SymFromName. + /// + /// A handle to the process that was originally passed to the SymInitialize function. + /// The symbol name for which a symbol is to be located. + /// A pointer to an IMAGEHLP_SYMBOL64 structure. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymGetSymFromName64 function is used to locate a symbol for a specified name. The name can contain a module prefix + /// that isolates the symbol search to a single module's symbol table. + /// + /// + /// The module prefix is in the form of "module!". The "!" character is the delimiter between the module name and the symbol name. + /// If there is no module prefix, then the search is performed on each module's symbol table in a linear manner, beginning with the + /// first module that is loaded. + /// + /// + /// Using the module prefix is preferable for two reasons. First, the symbol search occurs much faster. Second, when deferred symbol + /// loading is turned on, the search causes symbols to be loaded for each module that is searched. When the symbol is found, the + /// symbol information is copied into the Symbol buffer provided by the caller. The caller must allocate the Symbol buffer properly + /// and fill in the required parameters in the IMAGEHLP_SYMBOL64 structure before calling SymGetSymFromName64. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// This function supersedes the SymGetSymFromName function. For more information, see Updated Platform Support. + /// SymGetSymFromName is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetSymFromName SymGetSymFromName64 #else BOOL IMAGEAPI SymGetSymFromName( __in HANDLE hProcess, __in PCSTR Name, __inout PIMAGEHLP_SYMBOL Symbol ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetsymfromname64 BOOL IMAGEAPI SymGetSymFromName64( + // HANDLE hProcess, PCSTR Name, PIMAGEHLP_SYMBOL64 Symbol ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Ansi)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetSymFromName64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetSymFromName64(HPROCESS hProcess, [MarshalAs(UnmanagedType.LPStr)] string Name, SafeIMAGEHLP_SYMBOL64 Symbol); + + /// + /// Retrieves the symbol information for the next symbol. + /// Note This function is provided only for compatibility. Applications should use SymNext. + /// + /// A handle to the process that was originally passed to the SymInitialize function. + /// A pointer to an IMAGEHLP_SYMBOL64 structure. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymGetSymNext64 function requires that the IMAGEHLP_SYMBOL64 structure have valid data, presumably obtained from a + /// call to the SymGetSymFromAddr64 or SymGetSymFromName64 function. This structure is filled with the symbol information for the + /// next symbol in sequence by virtual address. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetSymNextW64 is defined as + /// follows in DbgHelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetSymNextW64( __in HANDLE hProcess, __inout PIMAGEHLP_SYMBOLW64 Symbol ); + /// + /// + /// This function supersedes the SymGetSymNext function. For more information, see Updated Platform Support. + /// SymGetSymNext is defined as follows in DbgHelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetSymNext SymGetSymNext64 #define SymGetSymNextW SymGetSymNextW64 #else BOOL IMAGEAPI SymGetSymNext( __in HANDLE hProcess, __inout PIMAGEHLP_SYMBOL Symbol ); BOOL IMAGEAPI SymGetSymNextW( __in HANDLE hProcess, __inout PIMAGEHLP_SYMBOLW Symbol ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetsymnext BOOL IMAGEAPI SymGetSymNext( HANDLE hProcess, + // PIMAGEHLP_SYMBOL Symbol ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetSymNext")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetSymNext(HPROCESS hProcess, SafeIMAGEHLP_SYMBOL Symbol); + + /// + /// Retrieves the symbol information for the next symbol. + /// Note This function is provided only for compatibility. Applications should use SymNext. + /// + /// A handle to the process that was originally passed to the SymInitialize function. + /// A pointer to an IMAGEHLP_SYMBOL64 structure. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymGetSymNext64 function requires that the IMAGEHLP_SYMBOL64 structure have valid data, presumably obtained from a + /// call to the SymGetSymFromAddr64 or SymGetSymFromName64 function. This structure is filled with the symbol information for the + /// next symbol in sequence by virtual address. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetSymNextW64 is defined as + /// follows in DbgHelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetSymNextW64( __in HANDLE hProcess, __inout PIMAGEHLP_SYMBOLW64 Symbol ); + /// + /// + /// This function supersedes the SymGetSymNext function. For more information, see Updated Platform Support. + /// SymGetSymNext is defined as follows in DbgHelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetSymNext SymGetSymNext64 #define SymGetSymNextW SymGetSymNextW64 #else BOOL IMAGEAPI SymGetSymNext( __in HANDLE hProcess, __inout PIMAGEHLP_SYMBOL Symbol ); BOOL IMAGEAPI SymGetSymNextW( __in HANDLE hProcess, __inout PIMAGEHLP_SYMBOLW Symbol ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetsymnext64 BOOL IMAGEAPI SymGetSymNext64( HANDLE + // hProcess, PIMAGEHLP_SYMBOL64 Symbol ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetSymNext64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetSymNext64(HPROCESS hProcess, SafeIMAGEHLP_SYMBOL64 Symbol); + + /// + /// Retrieves the symbol information for the next symbol. + /// Note This function is provided only for compatibility. Applications should use SymNext. + /// + /// A handle to the process that was originally passed to the SymInitialize function. + /// A pointer to an IMAGEHLP_SYMBOL64 structure. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymGetSymNext64 function requires that the IMAGEHLP_SYMBOL64 structure have valid data, presumably obtained from a + /// call to the SymGetSymFromAddr64 or SymGetSymFromName64 function. This structure is filled with the symbol information for the + /// next symbol in sequence by virtual address. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetSymNextW64 is defined as + /// follows in DbgHelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetSymNextW64( __in HANDLE hProcess, __inout PIMAGEHLP_SYMBOLW64 Symbol ); + /// + /// + /// This function supersedes the SymGetSymNext function. For more information, see Updated Platform Support. + /// SymGetSymNext is defined as follows in DbgHelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetSymNext SymGetSymNext64 #define SymGetSymNextW SymGetSymNextW64 #else BOOL IMAGEAPI SymGetSymNext( __in HANDLE hProcess, __inout PIMAGEHLP_SYMBOL Symbol ); BOOL IMAGEAPI SymGetSymNextW( __in HANDLE hProcess, __inout PIMAGEHLP_SYMBOLW Symbol ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetsymnext64 BOOL IMAGEAPI SymGetSymNext64( HANDLE + // hProcess, PIMAGEHLP_SYMBOL64 Symbol ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetSymNext64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetSymNextW64(HPROCESS hProcess, SafeIMAGEHLP_SYMBOL64 Symbol); + + /// + /// Retrieves the symbol information for the previous symbol. + /// Note This function is provided only for compatibility. Applications should use SymPrev. + /// + /// A handle to the process that was originally passed to the SymInitialize function. + /// A pointer to an IMAGEHLP_SYMBOL64 structure. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymGetSymPrev64 function requires the IMAGEHLP_SYMBOL64 structure to have valid data, presumably obtained from a call + /// to the SymGetSymFromAddr64 or SymGetSymFromName64 function. This structure is filled in with the symbol information for the + /// previous symbol in sequence by virtual address. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetSymPrevW64 is defined as follows in DbgHelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetSymPrevW64( __in HANDLE hProcess, __inout PIMAGEHLP_SYMBOLW64 Symbol ); + /// + /// + /// This function supersedes the SymGetSymPrev function. For more information, see Updated Platform Support. + /// SymGetSymPrev is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetSymPrev SymGetSymPrev64 #define SymGetSymPrevW SymGetSymPrevW64 #else BOOL IMAGEAPI SymGetSymPrev( __in HANDLE hProcess, __inout PIMAGEHLP_SYMBOL Symbol ); BOOL IMAGEAPI SymGetSymPrevW( __in HANDLE hProcess, __inout PIMAGEHLP_SYMBOLW Symbol ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetsymprev BOOL IMAGEAPI SymGetSymPrev( HANDLE hProcess, + // PIMAGEHLP_SYMBOL Symbol ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Unicode)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetSymPrev")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetSymPrev(HPROCESS hProcess, SafeIMAGEHLP_SYMBOL Symbol); + + /// + /// Retrieves the symbol information for the previous symbol. + /// Note This function is provided only for compatibility. Applications should use SymPrev. + /// + /// A handle to the process that was originally passed to the SymInitialize function. + /// A pointer to an IMAGEHLP_SYMBOL64 structure. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymGetSymPrev64 function requires the IMAGEHLP_SYMBOL64 structure to have valid data, presumably obtained from a call + /// to the SymGetSymFromAddr64 or SymGetSymFromName64 function. This structure is filled in with the symbol information for the + /// previous symbol in sequence by virtual address. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetSymPrevW64 is defined as follows in DbgHelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetSymPrevW64( __in HANDLE hProcess, __inout PIMAGEHLP_SYMBOLW64 Symbol ); + /// + /// + /// This function supersedes the SymGetSymPrev function. For more information, see Updated Platform Support. + /// SymGetSymPrev is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetSymPrev SymGetSymPrev64 #define SymGetSymPrevW SymGetSymPrevW64 #else BOOL IMAGEAPI SymGetSymPrev( __in HANDLE hProcess, __inout PIMAGEHLP_SYMBOL Symbol ); BOOL IMAGEAPI SymGetSymPrevW( __in HANDLE hProcess, __inout PIMAGEHLP_SYMBOLW Symbol ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetsymprev64 BOOL IMAGEAPI SymGetSymPrev64( HANDLE + // hProcess, PIMAGEHLP_SYMBOL64 Symbol ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetSymPrev64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetSymPrev64(HPROCESS hProcess, SafeIMAGEHLP_SYMBOL64 Symbol); + + /// + /// Retrieves the symbol information for the previous symbol. + /// Note This function is provided only for compatibility. Applications should use SymPrev. + /// + /// A handle to the process that was originally passed to the SymInitialize function. + /// A pointer to an IMAGEHLP_SYMBOL64 structure. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymGetSymPrev64 function requires the IMAGEHLP_SYMBOL64 structure to have valid data, presumably obtained from a call + /// to the SymGetSymFromAddr64 or SymGetSymFromName64 function. This structure is filled in with the symbol information for the + /// previous symbol in sequence by virtual address. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymGetSymPrevW64 is defined as follows in DbgHelp.h. + /// + /// + /// BOOL IMAGEAPI SymGetSymPrevW64( __in HANDLE hProcess, __inout PIMAGEHLP_SYMBOLW64 Symbol ); + /// + /// + /// This function supersedes the SymGetSymPrev function. For more information, see Updated Platform Support. + /// SymGetSymPrev is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymGetSymPrev SymGetSymPrev64 #define SymGetSymPrevW SymGetSymPrevW64 #else BOOL IMAGEAPI SymGetSymPrev( __in HANDLE hProcess, __inout PIMAGEHLP_SYMBOL Symbol ); BOOL IMAGEAPI SymGetSymPrevW( __in HANDLE hProcess, __inout PIMAGEHLP_SYMBOLW Symbol ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgetsymprev64 BOOL IMAGEAPI SymGetSymPrev64( HANDLE + // hProcess, PIMAGEHLP_SYMBOL64 Symbol ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetSymPrev64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetSymPrevW64(HPROCESS hProcess, SafeIMAGEHLP_SYMBOL64 Symbol); + + /// Retrieves a type index for the specified type name. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// The base address of the module. + /// The name of the type. + /// A pointer to a SYMBOL_INFO structure. The TypeIndex member contains the type index. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// To retrieve information about the type, pass the type index to the SymGetTypeInfo function. + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgettypefromname BOOL IMAGEAPI SymGetTypeFromName( HANDLE + // hProcess, ULONG64 BaseOfDll, PCSTR Name, PSYMBOL_INFO Symbol ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetTypeFromName")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetTypeFromName(HPROCESS hProcess, ulong BaseOfDll, [MarshalAs(UnmanagedType.LPTStr)] string Name, ref SYMBOL_INFO Symbol); + + /// Retrieves type information for the specified type index. For larger queries, use the SymGetTypeInfoEx function. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// The base address of the module. + /// + /// The type index. (A number of functions return a type index in the TypeIndex member of the SYMBOL_INFO structure.) + /// + /// + /// The information type. This parameter can be one of more of the values from the IMAGEHLP_SYMBOL_TYPE_INFO enumeration type. + /// + /// The data. The format of the data depends on the value of the GetType parameter. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// For more details on the type information, see the documentation for the PDB format. + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgettypeinfo BOOL IMAGEAPI SymGetTypeInfo( HANDLE + // hProcess, DWORD64 ModBase, ULONG TypeId, IMAGEHLP_SYMBOL_TYPE_INFO GetType, PVOID pInfo ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetTypeInfo")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetTypeInfo(HPROCESS hProcess, ulong ModBase, uint TypeId, IMAGEHLP_SYMBOL_TYPE_INFO GetType, [Out] IntPtr pInfo); + + /// Retrieves multiple pieces of type information. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// The base address of the module. + /// + /// A pointer to an IMAGEHLP_GET_TYPE_INFO_PARAMS structure that specifies input and output information for the query. + /// + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symgettypeinfoex BOOL IMAGEAPI SymGetTypeInfoEx( HANDLE + // hProcess, DWORD64 ModBase, PIMAGEHLP_GET_TYPE_INFO_PARAMS Params ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymGetTypeInfoEx")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymGetTypeInfoEx(HPROCESS hProcess, ulong ModBase, ref IMAGEHLP_GET_TYPE_INFO_PARAMS Params); + /// Initializes the symbol handler for a process. /// /// @@ -1628,6 +4266,454 @@ namespace Vanara.PInvoke [return: MarshalAs(UnmanagedType.Bool)] public static extern bool SymInitialize(HPROCESS hProcess, [Optional, MarshalAs(UnmanagedType.LPTStr)] string UserSearchPath, [MarshalAs(UnmanagedType.Bool)] bool fInvadeProcess); + /// + /// Loads the symbol table. + /// This function has been superseded by the SymLoadModuleEx function. + /// + /// A handle to the process. This handle must have been previously passed to the SymInitialize function. + /// + /// A handle to the file for the executable image. This argument is used mostly by debuggers, where the debugger passes the file + /// handle obtained from a debugging event. A value of NULL indicates that hFile is not used. + /// + /// + /// The name of the executable image. This name can contain a partial path, a full path, or no path at all. If the file cannot be + /// located by the name provided, the symbol search path is used. + /// + /// + /// A shortcut name for the module. If the pointer value is NULL, the library creates a name using the base name of the + /// symbol file. + /// + /// + /// + /// The load address of the module. If the value is zero, the library obtains the load address from the symbol file. The load + /// address contained in the symbol file is not necessarily the actual load address. Debuggers and other applications having an + /// actual load address should use the real load address when calling this function. + /// + /// If the image is a .pdb file, this parameter cannot be zero. + /// + /// + /// + /// The size of the module, in bytes. If the value is zero, the library obtains the size from the symbol file. The size contained in + /// the symbol file is not necessarily the actual size. Debuggers and other applications having an actual size should use the real + /// size when calling this function. + /// + /// If the image is a .pdb file, this parameter cannot be zero. + /// + /// + /// If the function succeeds, the return value is the base address of the loaded module. + /// If the function fails, the return value is zero. To retrieve extended error information, call GetLastError. + /// If the module is already loaded, the return value is zero and GetLastError returns ERROR_SUCCESS. + /// + /// + /// + /// The symbol handler creates an entry for the module and if the deferred symbol loading option is turned off, an attempt is made + /// to load the symbols. If deferred symbol loading is enabled, the module is marked as deferred and the symbols are not loaded + /// until a reference is made to a symbol in the module. + /// + /// To unload the symbol table, use the SymUnloadModule64 function. + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// This function supersedes the SymLoadModule function. For more information, see Updated Platform Support. + /// SymLoadModule is defined as follows in DbgHelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymLoadModule SymLoadModule64 #else DWORD IMAGEAPI SymLoadModule( __in HANDLE hProcess, __in_opt HANDLE hFile, __in_opt PCSTR ImageName, __in_opt PCSTR ModuleName, __in DWORD BaseOfDll, __in DWORD SizeOfDll ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symloadmodule DWORD IMAGEAPI SymLoadModule( HANDLE + // hProcess, HANDLE hFile, PCSTR ImageName, PCSTR ModuleName, DWORD BaseOfDll, DWORD SizeOfDll ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymLoadModule")] + public static extern uint SymLoadModule(HPROCESS hProcess, [Optional] HFILE hFile, [Optional, MarshalAs(UnmanagedType.LPStr)] string ImageName, + [Optional, MarshalAs(UnmanagedType.LPWStr)] string ModuleName, uint BaseOfDll, uint SizeOfDll); + + /// + /// Loads the symbol table. + /// This function has been superseded by the SymLoadModuleEx function. + /// + /// A handle to the process. This handle must have been previously passed to the SymInitialize function. + /// + /// A handle to the file for the executable image. This argument is used mostly by debuggers, where the debugger passes the file + /// handle obtained from a debugging event. A value of NULL indicates that hFile is not used. + /// + /// + /// The name of the executable image. This name can contain a partial path, a full path, or no path at all. If the file cannot be + /// located by the name provided, the symbol search path is used. + /// + /// + /// A shortcut name for the module. If the pointer value is NULL, the library creates a name using the base name of the + /// symbol file. + /// + /// + /// + /// The load address of the module. If the value is zero, the library obtains the load address from the symbol file. The load + /// address contained in the symbol file is not necessarily the actual load address. Debuggers and other applications having an + /// actual load address should use the real load address when calling this function. + /// + /// If the image is a .pdb file, this parameter cannot be zero. + /// + /// + /// + /// The size of the module, in bytes. If the value is zero, the library obtains the size from the symbol file. The size contained in + /// the symbol file is not necessarily the actual size. Debuggers and other applications having an actual size should use the real + /// size when calling this function. + /// + /// If the image is a .pdb file, this parameter cannot be zero. + /// + /// + /// If the function succeeds, the return value is the base address of the loaded module. + /// If the function fails, the return value is zero. To retrieve extended error information, call GetLastError. + /// If the module is already loaded, the return value is zero and GetLastError returns ERROR_SUCCESS. + /// + /// + /// + /// The symbol handler creates an entry for the module and if the deferred symbol loading option is turned off, an attempt is made + /// to load the symbols. If deferred symbol loading is enabled, the module is marked as deferred and the symbols are not loaded + /// until a reference is made to a symbol in the module. + /// + /// To unload the symbol table, use the SymUnloadModule64 function. + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// This function supersedes the SymLoadModule function. For more information, see Updated Platform Support. + /// SymLoadModule is defined as follows in DbgHelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymLoadModule SymLoadModule64 #else DWORD IMAGEAPI SymLoadModule( __in HANDLE hProcess, __in_opt HANDLE hFile, __in_opt PCSTR ImageName, __in_opt PCSTR ModuleName, __in DWORD BaseOfDll, __in DWORD SizeOfDll ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symloadmodule64 DWORD64 IMAGEAPI SymLoadModule64( HANDLE + // hProcess, HANDLE hFile, PCSTR ImageName, PCSTR ModuleName, DWORD64 BaseOfDll, DWORD SizeOfDll ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymLoadModule64")] + public static extern ulong SymLoadModule64(HPROCESS hProcess, [Optional] HFILE hFile, [Optional, MarshalAs(UnmanagedType.LPStr)] string ImageName, + [Optional, MarshalAs(UnmanagedType.LPStr)] string ModuleName, ulong BaseOfDll, uint SizeOfDll); + + /// Loads the symbol table for the specified module. + /// A handle to the process that was originally passed to the SymInitialize function. + /// + /// A handle to the file for the executable image. This argument is used mostly by debuggers, where the debugger passes the file + /// handle obtained from a debugging event. A value of NULL indicates that hFile is not used. + /// + /// + /// The name of the executable image. This name can contain a partial path, a full path, or no path at all. If the file cannot be + /// located by the name provided, the symbol search path is used. + /// + /// + /// A shortcut name for the module. If the pointer value is NULL, the library creates a name using the base name of the + /// symbol file. + /// + /// + /// + /// The load address of the module. If the value is zero, the library obtains the load address from the symbol file. The load + /// address contained in the symbol file is not necessarily the actual load address. Debuggers and other applications having an + /// actual load address should use the real load address when calling this function. + /// + /// If the image is a .pdb file, this parameter cannot be zero. + /// + /// + /// + /// The size of the module, in bytes. If the value is zero, the library obtains the size from the symbol file. The size contained in + /// the symbol file is not necessarily the actual size. Debuggers and other applications having an actual size should use the real + /// size when calling this function. + /// + /// If the image is a .pdb file, this parameter cannot be zero. + /// + /// + /// A pointer to a MODLOAD_DATA structure that represents headers other than the standard PE header. This parameter is optional and + /// can be NULL. + /// + /// + /// + /// This parameter can be zero or one or more of the following values. If this parameter is zero, the function loads the modules and + /// the symbols for the module. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// SLMFLAG_NO_SYMBOLS 0x4 + /// Loads the module but not the symbols for the module. + /// + /// + /// SLMFLAG_VIRTUAL 0x1 + /// + /// Creates a virtual module named ModuleName at the address specified in BaseOfDll. To add symbols to this module, call the + /// SymAddSymbol function. + /// + /// + /// + /// + /// + /// If the function succeeds, the return value is the base address of the loaded module. + /// If the function fails, the return value is zero. To retrieve extended error information, call GetLastError. + /// If the module is already loaded, the return value is zero and GetLastError returns ERROR_SUCCESS. + /// + /// + /// + /// The symbol handler creates an entry for the module and if the deferred symbol loading option is turned off, an attempt is made + /// to load the symbols. If deferred symbol loading is enabled, the module is marked as deferred and the symbols are not loaded + /// until a reference is made to a symbol in the module. Therefore, you should always call the SymGetModuleInfo64 function after + /// calling SymLoadModuleEx. + /// + /// To unload the symbol table, use the SymUnloadModule64 function. + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// Examples + /// For an example, see Loading a Symbol Module. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symloadmoduleex DWORD64 IMAGEAPI SymLoadModuleEx( HANDLE + // hProcess, HANDLE hFile, PCSTR ImageName, PCSTR ModuleName, DWORD64 BaseOfDll, DWORD DllSize, PMODLOAD_DATA Data, DWORD Flags ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymLoadModuleEx")] + public static extern ulong SymLoadModuleEx(HPROCESS hProcess, [Optional] HFILE hFile, [Optional, MarshalAs(UnmanagedType.LPTStr)] string ImageName, + [Optional, MarshalAs(UnmanagedType.LPTStr)] string ModuleName, ulong BaseOfDll, uint DllSize, in MODLOAD_DATA Data, SLMFLAG Flags); + + /// Loads the symbol table for the specified module. + /// A handle to the process that was originally passed to the SymInitialize function. + /// + /// A handle to the file for the executable image. This argument is used mostly by debuggers, where the debugger passes the file + /// handle obtained from a debugging event. A value of NULL indicates that hFile is not used. + /// + /// + /// The name of the executable image. This name can contain a partial path, a full path, or no path at all. If the file cannot be + /// located by the name provided, the symbol search path is used. + /// + /// + /// A shortcut name for the module. If the pointer value is NULL, the library creates a name using the base name of the + /// symbol file. + /// + /// + /// + /// The load address of the module. If the value is zero, the library obtains the load address from the symbol file. The load + /// address contained in the symbol file is not necessarily the actual load address. Debuggers and other applications having an + /// actual load address should use the real load address when calling this function. + /// + /// If the image is a .pdb file, this parameter cannot be zero. + /// + /// + /// + /// The size of the module, in bytes. If the value is zero, the library obtains the size from the symbol file. The size contained in + /// the symbol file is not necessarily the actual size. Debuggers and other applications having an actual size should use the real + /// size when calling this function. + /// + /// If the image is a .pdb file, this parameter cannot be zero. + /// + /// + /// A pointer to a MODLOAD_DATA structure that represents headers other than the standard PE header. This parameter is optional and + /// can be NULL. + /// + /// + /// + /// This parameter can be zero or one or more of the following values. If this parameter is zero, the function loads the modules and + /// the symbols for the module. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// SLMFLAG_NO_SYMBOLS 0x4 + /// Loads the module but not the symbols for the module. + /// + /// + /// SLMFLAG_VIRTUAL 0x1 + /// + /// Creates a virtual module named ModuleName at the address specified in BaseOfDll. To add symbols to this module, call the + /// SymAddSymbol function. + /// + /// + /// + /// + /// + /// If the function succeeds, the return value is the base address of the loaded module. + /// If the function fails, the return value is zero. To retrieve extended error information, call GetLastError. + /// If the module is already loaded, the return value is zero and GetLastError returns ERROR_SUCCESS. + /// + /// + /// + /// The symbol handler creates an entry for the module and if the deferred symbol loading option is turned off, an attempt is made + /// to load the symbols. If deferred symbol loading is enabled, the module is marked as deferred and the symbols are not loaded + /// until a reference is made to a symbol in the module. Therefore, you should always call the SymGetModuleInfo64 function after + /// calling SymLoadModuleEx. + /// + /// To unload the symbol table, use the SymUnloadModule64 function. + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// Examples + /// For an example, see Loading a Symbol Module. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symloadmoduleex DWORD64 IMAGEAPI SymLoadModuleEx( HANDLE + // hProcess, HANDLE hFile, PCSTR ImageName, PCSTR ModuleName, DWORD64 BaseOfDll, DWORD DllSize, PMODLOAD_DATA Data, DWORD Flags ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymLoadModuleEx")] + public static extern ulong SymLoadModuleEx(HPROCESS hProcess, [Optional] HFILE hFile, [Optional, MarshalAs(UnmanagedType.LPTStr)] string ImageName, + [Optional, MarshalAs(UnmanagedType.LPTStr)] string ModuleName, ulong BaseOfDll, uint DllSize, [In, Optional] IntPtr Data, SLMFLAG Flags); + + /// Compares a string to a file name and path. + /// The file name to be compared to the Match parameter. + /// The string to be compared to the FileName parameter. + /// + /// A pointer to a string buffer that receives a pointer to the location in FileName where matching stopped. For a complete match, + /// this value can be one character before FileName. This value can also be NULL. + /// + /// + /// A pointer to a string buffer that receives a pointer to the location in Match where matching stopped. For a complete match, this + /// value may be one character before Match. This value may be NULL. + /// + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// Because the match string can be a suffix of the complete file name, this function can be used to match a plain file name to a + /// fully qualified file name. + /// + /// + /// Matching begins from the end of both strings and proceeds backward. Matching is case-insensitive and equates a backslash ('') + /// with a forward slash ('/'). + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symmatchfilename BOOL IMAGEAPI SymMatchFileName( PCSTR + // FileName, PCSTR Match, PSTR *FileNameStop, PSTR *MatchStop ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymMatchFileName")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymMatchFileName([MarshalAs(UnmanagedType.LPTStr)] string FileName, [MarshalAs(UnmanagedType.LPTStr)] string Match, + out StrPtrAuto FileNameStop, out StrPtrAuto MatchStop); + + /// Compares the specified string to the specified wildcard expression. + /// The string, such as a symbol name, to be compared to the expression parameter. + /// + /// The wildcard expression to compare to the string parameter. The wildcard expression supports the inclusion of the * and ? + /// characters. * matches any string and ? matches any single character. + /// + /// A variable that indicates whether or not the comparison is to be case sensitive. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symmatchstring BOOL IMAGEAPI SymMatchString( PCSTR string, + // PCSTR expression, BOOL fCase ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymMatchString")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymMatchString([MarshalAs(UnmanagedType.LPTStr)] string @string, [MarshalAs(UnmanagedType.LPTStr)] string expression, + [MarshalAs(UnmanagedType.Bool)] bool fCase); + + /// Retrieves symbol information for the next symbol. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// + /// A pointer to a SYMBOL_INFO structure that provides information about the current symbol. Upon return, the structure contains + /// information about the next symbol. + /// + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// This function requires that the SYMBOL_INFO structure have valid data for the current symbol. The next symbol is the symbol with + /// the virtual address that is next in the sequence. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symnext BOOL IMAGEAPI SymNext( HANDLE hProcess, + // PSYMBOL_INFO si ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymNext")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymNext(HPROCESS hProcess, ref SYMBOL_INFO si); + + /// Retrieves symbol information for the previous symbol. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// + /// A pointer to a SYMBOL_INFO structure that provides information about the current symbol. Upon return, the structure contains + /// information about the previous symbol. + /// + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// This function requires that the SYMBOL_INFO structure have valid data for the current symbol. The previous symbol is the symbol + /// with a virtual address that immediately precedes this symbol. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symprev BOOL IMAGEAPI SymPrev( HANDLE hProcess, + // PSYMBOL_INFO si ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymPrev")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymPrev(HPROCESS hProcess, ref SYMBOL_INFO si); + + /// Queries an inline trace. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// The start address. + /// Contains the context of the start of block. + /// Contains the return address of the start of the current block/ + /// Contains the current address. + /// Address of a DWORD that receives the current context. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// None + /// + /// Either the StartAddress or StartRetAddress parameters must be within the same function scope as the CurAddress parameter. The + /// former indicates a step-over within the same function and the latter indicates a step-over from StartAddress. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symqueryinlinetrace BOOL IMAGEAPI SymQueryInlineTrace( + // HANDLE hProcess, DWORD64 StartAddress, DWORD StartContext, DWORD64 StartRetAddress, DWORD64 CurAddress, LPDWORD CurContext, + // LPDWORD CurFrameIndex ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymQueryInlineTrace")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymQueryInlineTrace(HPROCESS hProcess, ulong StartAddress, uint StartContext, ulong StartRetAddress, ulong CurAddress, + out uint CurContext, out uint CurFrameIndex); + /// Refreshes the module list for the process. /// A handle to a process. This handle must have been previously passed to the SymInitialize function. /// @@ -1652,6 +4738,368 @@ namespace Vanara.PInvoke [return: MarshalAs(UnmanagedType.Bool)] public static extern bool SymRefreshModuleList(HPROCESS hProcess); + /// Registers a callback function for use by the symbol handler. + /// A handle to the process that was originally passed to the SymInitialize function. + /// A SymRegisterCallbackProc64 callback function. + /// + /// A user-defined value or NULL. This value is simply passed to the callback function. Normally, this parameter is used by + /// an application to pass a pointer to a data structure that lets the callback function establish some context. + /// + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymRegisterCallback64 function lets an application register a callback function for use by the symbol handler. The + /// symbol handler calls the registered callback function when there is status or progress information for the application. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymRegisterCallbackW64 is defined as + /// follows in Dbghelp.h. + /// + /// + /// BOOL IMAGEAPI SymRegisterCallbackW64( __in HANDLE hProcess, __in PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction, __in ULONG64 UserContext ); #ifdef DBGHELP_TRANSLATE_TCHAR #define SymRegisterCallback64 SymRegisterCallbackW64 #endif + /// + /// + /// This function supersedes the SymRegisterCallback function. For more information, see Updated Platform Support. + /// SymRegisterCallback is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymRegisterCallback SymRegisterCallback64 #else BOOL IMAGEAPI SymRegisterCallback( __in HANDLE hProcess, __in PSYMBOL_REGISTERED_CALLBACK CallbackFunction, __in_opt PVOID UserContext ); #endif + /// + /// For a more extensive example, read Getting Notifications. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symregistercallback BOOL IMAGEAPI SymRegisterCallback( + // HANDLE hProcess, PSYMBOL_REGISTERED_CALLBACK CallbackFunction, PVOID UserContext ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymRegisterCallback")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymRegisterCallback(HPROCESS hProcess, PSYMBOL_REGISTERED_CALLBACK CallbackFunction, IntPtr UserContext); + + /// Registers a callback function for use by the symbol handler. + /// A handle to the process that was originally passed to the SymInitialize function. + /// A SymRegisterCallbackProc64 callback function. + /// + /// A user-defined value or NULL. This value is simply passed to the callback function. Normally, this parameter is used by + /// an application to pass a pointer to a data structure that lets the callback function establish some context. + /// + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymRegisterCallback64 function lets an application register a callback function for use by the symbol handler. The + /// symbol handler calls the registered callback function when there is status or progress information for the application. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymRegisterCallbackW64 is defined as + /// follows in Dbghelp.h. + /// + /// + /// BOOL IMAGEAPI SymRegisterCallbackW64( __in HANDLE hProcess, __in PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction, __in ULONG64 UserContext ); #ifdef DBGHELP_TRANSLATE_TCHAR #define SymRegisterCallback64 SymRegisterCallbackW64 #endif + /// + /// + /// This function supersedes the SymRegisterCallback function. For more information, see Updated Platform Support. + /// SymRegisterCallback is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymRegisterCallback SymRegisterCallback64 #else BOOL IMAGEAPI SymRegisterCallback( __in HANDLE hProcess, __in PSYMBOL_REGISTERED_CALLBACK CallbackFunction, __in_opt PVOID UserContext ); #endif + /// + /// For a more extensive example, read Getting Notifications. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symregistercallback64 BOOL IMAGEAPI SymRegisterCallback64( + // HANDLE hProcess, PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction, ULONG64 UserContext ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymRegisterCallback64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymRegisterCallback64(HPROCESS hProcess, PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction, ulong UserContext); + + /// Registers a callback function for use by the symbol handler. + /// A handle to the process that was originally passed to the SymInitialize function. + /// A SymRegisterCallbackProc64 callback function. + /// + /// A user-defined value or NULL. This value is simply passed to the callback function. Normally, this parameter is used by + /// an application to pass a pointer to a data structure that lets the callback function establish some context. + /// + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymRegisterCallback64 function lets an application register a callback function for use by the symbol handler. The + /// symbol handler calls the registered callback function when there is status or progress information for the application. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. SymRegisterCallbackW64 is defined as + /// follows in Dbghelp.h. + /// + /// + /// BOOL IMAGEAPI SymRegisterCallbackW64( __in HANDLE hProcess, __in PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction, __in ULONG64 UserContext ); #ifdef DBGHELP_TRANSLATE_TCHAR #define SymRegisterCallback64 SymRegisterCallbackW64 #endif + /// + /// + /// This function supersedes the SymRegisterCallback function. For more information, see Updated Platform Support. + /// SymRegisterCallback is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymRegisterCallback SymRegisterCallback64 #else BOOL IMAGEAPI SymRegisterCallback( __in HANDLE hProcess, __in PSYMBOL_REGISTERED_CALLBACK CallbackFunction, __in_opt PVOID UserContext ); #endif + /// + /// For a more extensive example, read Getting Notifications. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symregistercallbackw64 BOOL IMAGEAPI + // SymRegisterCallbackW64( HANDLE hProcess, PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction, ULONG64 UserContext ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymRegisterCallbackW64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymRegisterCallbackW64(HPROCESS hProcess, PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction, ulong UserContext); + + /// Registers a callback function for use by the stack walking procedure on Alpha computers. + /// A handle to the process that was originally passed to the StackWalk64 function. + /// A SymRegisterFunctionEntryCallbackProc64 callback function. + /// + /// A user-defined value or NULL. This value is simply passed to the callback function. Normally, this parameter is used by + /// an application to pass a pointer to a data structure that lets the callback function establish some context. + /// + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymRegisterFunctionEntryCallback64 function lets an application register a callback function for use by the stack + /// walking procedure. The stack walking procedure calls the registered callback function when it is unable to locate a function + /// table entry for an address. In most cases, the stack walking procedure locates the function table entries in the function table + /// of the image containing the address. However, in situations where the function table entries are not in the image, this callback + /// allows the debugger to provide the function table entry from another source. For example, run-time generated code on Alpha + /// computers can define dynamic function tables to support exception handling and stack tracing. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// This function supersedes the SymRegisterFunctionEntryCallback function. For more information, see Updated Platform + /// Support. SymRegisterFunctionEntryCallback is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymRegisterFunctionEntryCallback SymRegisterFunctionEntryCallback64 #else BOOL IMAGEAPI SymRegisterFunctionEntryCallback( __in HANDLE hProcess, __in PSYMBOL_FUNCENTRY_CALLBACK CallbackFunction, __in_opt PVOID UserContext ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symregisterfunctionentrycallback BOOL IMAGEAPI + // SymRegisterFunctionEntryCallback( HANDLE hProcess, PSYMBOL_FUNCENTRY_CALLBACK CallbackFunction, PVOID UserContext ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymRegisterFunctionEntryCallback")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymRegisterFunctionEntryCallback(HPROCESS hProcess, PSYMBOL_FUNCENTRY_CALLBACK CallbackFunction, IntPtr UserContext); + + /// Registers a callback function for use by the stack walking procedure on Alpha computers. + /// A handle to the process that was originally passed to the StackWalk64 function. + /// A SymRegisterFunctionEntryCallbackProc64 callback function. + /// + /// A user-defined value or NULL. This value is simply passed to the callback function. Normally, this parameter is used by + /// an application to pass a pointer to a data structure that lets the callback function establish some context. + /// + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The SymRegisterFunctionEntryCallback64 function lets an application register a callback function for use by the stack + /// walking procedure. The stack walking procedure calls the registered callback function when it is unable to locate a function + /// table entry for an address. In most cases, the stack walking procedure locates the function table entries in the function table + /// of the image containing the address. However, in situations where the function table entries are not in the image, this callback + /// allows the debugger to provide the function table entry from another source. For example, run-time generated code on Alpha + /// computers can define dynamic function tables to support exception handling and stack tracing. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// This function supersedes the SymRegisterFunctionEntryCallback function. For more information, see Updated Platform + /// Support. SymRegisterFunctionEntryCallback is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymRegisterFunctionEntryCallback SymRegisterFunctionEntryCallback64 #else BOOL IMAGEAPI SymRegisterFunctionEntryCallback( __in HANDLE hProcess, __in PSYMBOL_FUNCENTRY_CALLBACK CallbackFunction, __in_opt PVOID UserContext ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symregisterfunctionentrycallback64 BOOL IMAGEAPI + // SymRegisterFunctionEntryCallback64( HANDLE hProcess, PSYMBOL_FUNCENTRY_CALLBACK64 CallbackFunction, ULONG64 UserContext ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymRegisterFunctionEntryCallback64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymRegisterFunctionEntryCallback64(HPROCESS hProcess, PSYMBOL_FUNCENTRY_CALLBACK64 CallbackFunction, ulong UserContext); + + /// Searches for PDB symbols that meet the specified criteria. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// + /// The base address of the module. If this value is zero and Mask contains an exclamation point (!), the function looks across + /// modules. If this value is zero and Mask does not contain an exclamation point, the function uses the scope established by the + /// SymSetContext function. + /// + /// A unique value for the symbol. + /// + /// The PDB classification. These values are defined in Dbghelp.h in the SymTagEnum enumeration type. For descriptions, see + /// the PDB documentation. + /// + /// + /// A wildcard expression that indicates the names of the symbols to be enumerated. To specify a module name, use the !mod syntax. + /// + /// The address of the symbol. + /// A SymEnumSymbolsProc callback function that receives the symbol information. + /// + /// A user-defined value that is passed to the callback function, or NULL. This parameter is typically used by an application + /// to pass a pointer to a data structure that provides context for the callback function. + /// + /// + /// The options that control the behavior of this function. + /// + /// + /// Value + /// Meaning + /// + /// + /// SYMSEARCH_ALLITEMS 0x08 + /// Include all symbols and other data in the .pdb files. DbgHelp 6.6 and earlier: This value is not supported. + /// + /// + /// SYMSEARCH_GLOBALSONLY 0x04 + /// Search only for global symbols. + /// + /// + /// SYMSEARCH_MASKOBJS 0x01 + /// For internal use only. + /// + /// + /// SYMSEARCH_RECURSE 0x02 + /// Recurse from the top to find all symbols. + /// + /// + /// + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symsearch BOOL IMAGEAPI SymSearch( HANDLE hProcess, ULONG64 + // BaseOfDll, DWORD Index, DWORD SymTag, PCSTR Mask, DWORD64 Address, PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, PVOID + // UserContext, DWORD Options ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymSearch")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymSearch(HPROCESS hProcess, ulong BaseOfDll, [Optional] uint Index, [Optional] uint SymTag, [Optional, MarshalAs(UnmanagedType.LPTStr)] string Mask, + [Optional] ulong Address, PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, [In, Optional] IntPtr UserContext, SYMSEARCH Options); + + /// Sets context information used by the SymEnumSymbols function. This function only works with PDB symbols. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// A pointer to an IMAGEHLP_STACK_FRAME structure that contains frame information. + /// This parameter is ignored. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// If you call SymSetContext to set the context to its current value, the function fails but GetLastError returns ERROR_SUCCESS. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symsetcontext BOOL IMAGEAPI SymSetContext( HANDLE hProcess, + // PIMAGEHLP_STACK_FRAME StackFrame, PIMAGEHLP_CONTEXT Context ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymSetContext")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymSetContext(HPROCESS hProcess, in IMAGEHLP_STACK_FRAME StackFrame, [In, Optional] IntPtr Context); + + /// Turns the specified extended symbol option on or off. + /// + /// The extended symbol option to turn on or off. The following are valid values. + /// + /// + /// Value + /// Meaning + /// + /// + /// SYMOPT_EX_DISABLEACCESSTIMEUPDATE 0 + /// + /// When set to TRUE, turns off explicitly updating the last access time of a symbol that is loaded. By default, DbgHelp updates the + /// last access time of a symbol file that is consumed so that a symbol cache can be maintained by using a least recently used mechanism. + /// + /// + /// + /// + /// The value to set for the specified option, either TRUE or FALSE. + /// The previous value of the specified extended option. + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symsetextendedoption BOOL IMAGEAPI SymSetExtendedOption( + // IMAGEHLP_EXTENDED_OPTIONS option, BOOL value ); + [DllImport(Lib_DbgHelp, SetLastError = false, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymSetExtendedOption")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymSetExtendedOption(IMAGEHLP_EXTENDED_OPTIONS option, [MarshalAs(UnmanagedType.Bool)] bool value); + + /// Sets the home directory used by Dbghelp. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// + /// The home directory. This directory must be writable, otherwise the home directory is the common application directory specified + /// with CSIDL_COMMON_APPDATA. If this parameter is NULL, the function uses the default directory. + /// + /// + /// If the function succeeds, the return value is a pointer to the dir parameter. + /// If the function fails, the return value is NULL. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The default home directory is the directory in which Dbghelp.dll resides. Dbghelp uses this directory as a basis for other + /// directories, such as the default downstream store directory (the sym subdirectory of the home directory). + /// + /// + /// The home directory used for the default symbol store and the source server cache location is stored in the DBGHELP_HOMEDIR + /// environment variable. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symsethomedirectory PCHAR IMAGEAPI SymSetHomeDirectory( + // HANDLE hProcess, PCSTR dir ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymSetHomeDirectory")] + public static extern StrPtrAuto SymSetHomeDirectory([Optional] HPROCESS hProcess, [Optional, MarshalAs(UnmanagedType.LPTStr)] string dir); + /// Sets the options mask. /// /// @@ -1833,9 +5281,533 @@ namespace Vanara.PInvoke [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymSetOptions")] public static extern SYMOPT SymSetOptions(SYMOPT SymOptions); + /// Sets the window that the caller will use to display a user interface. + /// A handle to the window. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symsetparentwindow BOOL IMAGEAPI SymSetParentWindow( HWND + // hwnd ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymSetParentWindow")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymSetParentWindow(HWND hwnd); + + /// Sets the local scope to the symbol that matches the specified address. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// The address. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symsetscopefromaddr BOOL IMAGEAPI SymSetScopeFromAddr( + // HANDLE hProcess, ULONG64 Address ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymSetScopeFromAddr")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymSetScopeFromAddr(HPROCESS hProcess, ulong Address); + + /// Sets the local scope to the symbol that matches the specified index. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// The base address of the module. + /// The unique value for the symbol. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symsetscopefromindex BOOL IMAGEAPI SymSetScopeFromIndex( + // HANDLE hProcess, ULONG64 BaseOfDll, DWORD Index ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymSetScopeFromIndex")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymSetScopeFromIndex(HPROCESS hProcess, ulong BaseOfDll, uint Index); + + /// Sets the local scope to the symbol that matches the specified address and inline context. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// The address. + /// The inline context. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symsetscopefrominlinecontext BOOL IMAGEAPI + // SymSetScopeFromInlineContext( HANDLE hProcess, ULONG64 Address, ULONG InlineContext ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymSetScopeFromInlineContext")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymSetScopeFromInlineContext(HPROCESS hProcess, ulong Address, uint InlineContext); + + /// Sets the search path for the specified process. + /// A handle to the process that was originally passed to the SymInitialize function. + /// The symbol search path. The string can contain multiple paths separated by semicolons. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// The symbol search path can be changed any number of times while the library is in use by an application. The change affects all + /// future calls to the symbol handler. + /// + /// To get the current search path, call the SymGetSearchPath function. + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symsetsearchpath BOOL IMAGEAPI SymSetSearchPath( HANDLE + // hProcess, PCSTR SearchPath ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymSetSearchPath")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymSetSearchPath(HPROCESS hProcess, [MarshalAs(UnmanagedType.LPTStr)] string SearchPath); + /// - /// A managed life-cycle symbol handler for a process which calls at construction and - /// at disposal. + /// Generates the name for a file that describes the relationship between two different versions of the same symbol or image file. + /// Using this feature prevents applications from having to regenerate such information every time they analyze two files. + /// + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// + /// The symbol path. The function uses only the symbol stores described in standard syntax for symbol stores. All other paths are + /// ignored. If this parameter is NULL, the function uses the symbol path set using the SymInitialize or SymSetSearchPath function. + /// + /// The extension for the generated file name. + /// The path of the first version of the symbol or image file. + /// The path of the second version of the symbol or image file. + /// + /// If the function succeeds, the return value is the resulting file name. + /// If the function fails, the return value is NULL. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// This function opens the two specified files, reads the indexing information from the header, and passes this information to the + /// symbol server so it can create the file name. If you specify the Type parameter as "xml", the name is the index of File1, + /// followed by a dash, followed by the index of File2, followed by an .xml extension. For example: + /// + /// 3F3D5C755000-3F3D647621000.xml + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symsrvdeltaname PCSTR IMAGEAPI SymSrvDeltaName( HANDLE + // hProcess, PCSTR SymPath, PCSTR Type, PCSTR File1, PCSTR File2 ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymSrvDeltaName")] + [return: MarshalAs(UnmanagedType.LPTStr)] + public static extern string SymSrvDeltaName(HPROCESS hProcess, [Optional, MarshalAs(UnmanagedType.LPTStr)] string SymPath, + [MarshalAs(UnmanagedType.LPTStr)] string Type, [MarshalAs(UnmanagedType.LPTStr)] string File1, [MarshalAs(UnmanagedType.LPTStr)] string File2); + + /// + /// Retrieves the indexes for the specified .pdb, .dbg, or image file that would be used to store the file. The combination of these + /// values uniquely identifies the file in the symbol server. They can be used when calling the SymFindFileInPath function to search + /// for a file in a symbol store. + /// + /// The name of the file. + /// The first of three identifying parameters. + /// The second of three identifying parameters. + /// The third of three identifying parameters. + /// This parameter is reserved for future use. + /// + /// If the function succeeds, the return value is nonzero. + /// If the function fails, the return value is zero. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symsrvgetfileindexes BOOL IMAGEAPI SymSrvGetFileIndexes( + // PCSTR File, GUID *Id, PDWORD Val1, PDWORD Val2, DWORD Flags ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymSrvGetFileIndexes")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymSrvGetFileIndexes([MarshalAs(UnmanagedType.LPTStr)] string File, out Guid Id, out uint Val1, out uint Val2, uint Flags = 0); + + /// Retrieves the index information for the specified .pdb, .dbg, or image file. + /// The name of the file. + /// A SYMSRV_INDEX_INFO structure that receives the index information. + /// This parameter is reserved for future use. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// This function is not for general use. Those writing utilities for the management of files in symbol server stores may use to + /// this function to predict the relative path the symbol server will look for a file. It is used by srctool.exe to actually + /// populate symbol server stores. It may also be of use to those looking to find the parameters to feed the SymFindFileInPath function. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symsrvgetfileindexinfo BOOL IMAGEAPI + // SymSrvGetFileIndexInfo( PCSTR File, PSYMSRV_INDEX_INFO Info, DWORD Flags ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymSrvGetFileIndexInfo")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymSrvGetFileIndexInfo([MarshalAs(UnmanagedType.LPTStr)] string File, ref SYMSRV_INDEX_INFO Info, uint Flags = 0); + + /// Retrieves the index string for the specified .pdb, .dbg, or image file. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// The path to the symbol server. + /// The name of the file. + /// A pointer to a buffer that receives the index string. + /// The size of the Index buffer, in characters. + /// This parameter is reserved for future use. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// This function is not for general use. Those writing utilities for the management of files in symbol server stores may use to + /// this function to predict the relative path the symbol server will look for a file. It is used by srctool.exe to actually + /// populate symbol server stores. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symsrvgetfileindexstring BOOL IMAGEAPI + // SymSrvGetFileIndexString( HANDLE hProcess, PCSTR SrvPath, PCSTR File, PSTR Index, size_t Size, DWORD Flags ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymSrvGetFileIndexString")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymSrvGetFileIndexString(HPROCESS hProcess, [Optional, MarshalAs(UnmanagedType.LPTStr)] string SrvPath, + [MarshalAs(UnmanagedType.LPTStr)] string File, [Out, MarshalAs(UnmanagedType.LPTStr)] StringBuilder Index, SizeT Size, uint Flags = 0); + + /// Retrieves the specified file from the supplement for a symbol store. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// + /// The symbol path. The function uses only the symbol stores described in standard syntax for symbol stores. All other paths are + /// ignored. If this parameter is NULL, the function uses the symbol path set using the SymInitialize or SymSetSearchPath function. + /// + /// The symbol file associated with the supplemental file. + /// The name of the file. + /// + /// If the function succeeds, the return value is the fully qualified path for the supplemental file. + /// If the function fails, the return value is NULL. To retrieve extended error information, call GetLastError. + /// + /// + /// For more information on supplemental files, see SymSrvStoreSupplement. + /// + /// This function returns a pointer to a buffer that may be reused by another function. Therefore, be sure to copy the data returned + /// to another buffer immediately. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symsrvgetsupplement PCSTR IMAGEAPI SymSrvGetSupplement( + // HANDLE hProcess, PCSTR SymPath, PCSTR Node, PCSTR File ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymSrvGetSupplement")] + [return: MarshalAs(UnmanagedType.LPTStr)] + public static extern string SymSrvGetSupplement(HPROCESS hProcess, [Optional, MarshalAs(UnmanagedType.LPTStr)] string SymPath, + [MarshalAs(UnmanagedType.LPTStr)] string Node, [MarshalAs(UnmanagedType.LPTStr)] string File); + + /// Determines whether the specified path points to a symbol store. + /// + /// The handle of a process that you previously passed to the SymInitialize function. If this parameter is set to NULL, the + /// function determines only whether the store exists; otherwise, the function determines whether the store exists and contains a + /// process entry for the specified process handle. + /// + /// + /// The path to a symbol store. The path can specify the default symbol store (for example, SRV*), point to an HTTP or HTTPS symbol + /// server, or specify a UNC, absolute, or relative path to the store. + /// + /// + /// If the path specifies a symbol store, the function returns TRUE. Otherwise, it returns FALSE. To get extended + /// error information, call the GetLastError function. + /// + /// + /// + /// If the path points to the default symbol store (for example, SRV*) or to an HTTP or HTTPS symbol server, the function assumes + /// the store exists. + /// + /// + /// If there is a proxy computer between the client computer and the server, the version of the SymSrv.dll on the proxy cannot be + /// less than the version that is on the client. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symsrvisstore BOOL IMAGEAPI SymSrvIsStore( HANDLE hProcess, + // PCSTR path ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymSrvIsStore")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymSrvIsStore([Optional] HPROCESS hProcess, [MarshalAs(UnmanagedType.LPTStr)] string path); + + /// Stores a file in the specified symbol store. + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// The symbol store. + /// The name of the file. + /// + /// The flags that control the function. This parameter can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// SYMSTOREOPT_COMPRESS 0x01 + /// Compress the file. + /// + /// + /// SYMSTOREOPT_OVERWRITE 0x02 + /// Overwrite the file if it exists. + /// + /// + /// SYMSTOREOPT_PASS_IF_EXISTS 0x40 + /// Do not report an error if the file already exists in the symbol store. + /// + /// + /// SYMSTOREOPT_POINTER 0x08 + /// Store in File.ptr. + /// + /// + /// SYMSTOREOPT_RETURNINDEX 0x04 + /// Return the index only. + /// + /// + /// + /// + /// + /// If the function succeeds, the return value is a pointer to a null-terminated string that specifies the full-qualified path to + /// the stored file. + /// + /// If the function fails, the return value is NULL. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// This function returns a pointer to a buffer that may be reused by another function. Therefore, be sure to copy the data returned + /// to another buffer immediately. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symsrvstorefile PCSTR IMAGEAPI SymSrvStoreFile( HANDLE + // hProcess, PCSTR SrvPath, PCSTR File, DWORD Flags ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymSrvStoreFile")] + [return: MarshalAs(UnmanagedType.LPTStr)] + public static extern string SymSrvStoreFile(HPROCESS hProcess, [Optional, MarshalAs(UnmanagedType.LPTStr)] string SrvPath, + [MarshalAs(UnmanagedType.LPTStr)] string File, SYMSTOREOPT Flags); + + /// + /// Stores a file in the specified supplement to a symbol store. The file is typically associated with a file in the symbol server. + /// + /// A handle to a process. This handle must have been previously passed to the SymInitialize function. + /// TBD + /// The symbol file associated with the supplemental file. + /// The name of the file. + /// + /// If this parameter is SYMSTOREOPT_COMPRESS, the file is compressed in the symbol store. Currently, there are no other + /// supported values. + /// + /// + /// If the function succeeds, the return value is the fully qualified path for the supplemental file. + /// If the function fails, the return value is NULL. To retrieve extended error information, call GetLastError. + /// + /// + /// An important use for this function is to store delta files. For more information, see SymSrvDeltaName. + /// + /// This function returns a pointer to a buffer that may be reused by another function. Therefore, be sure to copy the data returned + /// to another buffer immediately. + /// + /// + /// The symbol server stores supplemental files with the same extension in a common directory. For example, Sup1.xml would be stored + /// in the following directory: SymPath\supplement<i>Node\xml. + /// + /// + /// The administrator of a store can prevent users from writing supplemental files by creating a read-only file in the root of the + /// store named Supplement. Alternatively, the administrator can create the supplement directory and use ACLs to control access. + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// To call the Unicode version of this function, define DBGHELP_TRANSLATE_TCHAR. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symsrvstoresupplement PCSTR IMAGEAPI SymSrvStoreSupplement( + // HANDLE hProcess, PCSTR SrvPath, PCSTR Node, PCSTR File, DWORD Flags ); + [DllImport(Lib_DbgHelp, SetLastError = true, CharSet = CharSet.Auto)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymSrvStoreSupplement")] + [return: MarshalAs(UnmanagedType.LPTStr)] + public static extern string SymSrvStoreSupplement(HPROCESS hProcess, [Optional, MarshalAs(UnmanagedType.LPTStr)] string SrvPath, + [MarshalAs(UnmanagedType.LPTStr)] string Node, [MarshalAs(UnmanagedType.LPTStr)] string File, SYMSTOREOPT Flags); + + /// + /// Undecorates a decorated C++ symbol name. + /// Applications can also use the UnDecorateSymbolName function. + /// + /// A pointer to an IMAGEHLP_SYMBOL64 structure that specifies the symbol to be undecorated. + /// A pointer to a buffer that receives the undecorated name. + /// The size of the UnDecName buffer, in characters. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// This function supersedes the SymUnDName function. For more information, see Updated Platform Support. SymUnDName + /// is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymUnDName SymUnDName64 #else BOOL IMAGEAPI SymUnDName( __in PIMAGEHLP_SYMBOL sym, __out_ecount(UnDecNameLength) PSTR UnDecName, __in DWORD UnDecNameLength ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symundname BOOL IMAGEAPI SymUnDName( PIMAGEHLP_SYMBOL sym, + // PSTR UnDecName, DWORD UnDecNameLength ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymUnDName")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymUnDName([In] SafeIMAGEHLP_SYMBOL sym, [Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder UnDecName, uint UnDecNameLength); + + /// + /// Undecorates a decorated C++ symbol name. + /// Applications can also use the UnDecorateSymbolName function. + /// + /// A pointer to an IMAGEHLP_SYMBOL64 structure that specifies the symbol to be undecorated. + /// A pointer to a buffer that receives the undecorated name. + /// The size of the UnDecName buffer, in characters. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// This function supersedes the SymUnDName function. For more information, see Updated Platform Support. SymUnDName + /// is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymUnDName SymUnDName64 #else BOOL IMAGEAPI SymUnDName( __in PIMAGEHLP_SYMBOL sym, __out_ecount(UnDecNameLength) PSTR UnDecName, __in DWORD UnDecNameLength ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symundname64 BOOL IMAGEAPI SymUnDName64( PIMAGEHLP_SYMBOL64 + // sym, PSTR UnDecName, DWORD UnDecNameLength ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymUnDName64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymUnDName64([In] SafeIMAGEHLP_SYMBOL64 sym, [Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder UnDecName, uint UnDecNameLength); + + /// Unloads the symbol table. + /// A handle to the process that was originally passed to the SymInitialize function. + /// The base address of the module that is to be unloaded. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// This function supersedes the SymUnloadedModule function. For more information, see Updated Platform Support. + /// SymUnloadedModule is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymUnloadModule SymUnloadModule64 #else BOOL IMAGEAPI SymUnloadModule( __in HANDLE hProcess, __in DWORD BaseOfDll ); #endif + /// + /// Examples + /// For an example, see Unloading a Symbol Module. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symunloadmodule BOOL IMAGEAPI SymUnloadModule( HANDLE + // hProcess, DWORD BaseOfDll ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymUnloadModule")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymUnloadModule(HPROCESS hProcess, uint BaseOfDll); + + /// Unloads the symbol table. + /// A handle to the process that was originally passed to the SymInitialize function. + /// The base address of the module that is to be unloaded. + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError. + /// + /// + /// + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will + /// likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more + /// than one thread to this function. + /// + /// + /// This function supersedes the SymUnloadedModule function. For more information, see Updated Platform Support. + /// SymUnloadedModule is defined as follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define SymUnloadModule SymUnloadModule64 #else BOOL IMAGEAPI SymUnloadModule( __in HANDLE hProcess, __in DWORD BaseOfDll ); #endif + /// + /// Examples + /// For an example, see Unloading a Symbol Module. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-symunloadmodule64 BOOL IMAGEAPI SymUnloadModule64( HANDLE + // hProcess, DWORD64 BaseOfDll ); + [DllImport(Lib_DbgHelp, SetLastError = true, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SymUnloadModule64")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool SymUnloadModule64(HPROCESS hProcess, ulong BaseOfDll); + + /// + /// A managed life-cycle symbol handler for a process which calls at construction and at disposal. /// public class ProcessSymbolHandler : IDisposable { @@ -1876,85 +5848,16 @@ namespace Vanara.PInvoke public ProcessSymbolHandler(HPROCESS hProcess, string UserSearchPath = null, bool fInvadeProcess = true) => SymInitialize(hProc = hProcess, UserSearchPath, fInvadeProcess); + /// Performs an implicit conversion from to . + /// The instance. + /// The resulting instance from the conversion. public static implicit operator HPROCESS(ProcessSymbolHandler h) => h.hProc; /// Deallocates all resources associated with this process handle. - public void Clean() => SymCleanup(hProc); - - /// Deallocates all resources associated with this process handle. - public void Dispose() => Clean(); + public void Dispose() => SymCleanup(hProc); /// Refreshes the module list for the process. public void RefreshModuleList() => SymRefreshModuleList(hProc); } - - /* - SymFindFileInPathProc -SymFromAddr -SymFromIndex -SymFromInlineContext -SymFromName -SymFromToken -SymFunctionTableAccess64 -SymFunctionTableAccess64AccessRoutines -SymGetExtendedOption -SymGetFileLineOffsets64 -SymGetHomeDirectory -SymGetLineFromAddr64 -SymGetLineFromInlineContext -SymGetLineFromName64 -SymGetLineNext64 -SymGetLinePrev64 -SymGetModuleBase64 -SymGetModuleInfo64 -SymGetOmaps -SymGetOptions -SymGetScope -SymGetSearchPath -SymGetSourceFile -SymGetSourceFileChecksum -SymGetSourceFileFromToken -SymGetSourceFileToken -SymGetSourceVarFromToken -SymGetSymbolFile -SymGetSymFromAddr64 -SymGetSymFromName64 -SymGetSymNext64 -SymGetSymPrev64 -SymGetTypeFromName -SymGetTypeInfo -SymGetTypeInfoEx -SymLoadModule64 -SymLoadModuleEx -SymMatchFileName -SymMatchString -SymNext -SymPrev -SymQueryInlineTrace -SymRefreshModuleList -SymRegisterCallback64 -SymRegisterCallbackProc64 -SymRegisterFunctionEntryCallback64 -SymRegisterFunctionEntryCallbackProc64 -SymSearch -SymSetContext -SymSetExtendedOption -SymSetHomeDirectory -SymSetParentWindow -SymSetScopeFromAddr -SymSetScopeFromIndex -SymSetScopeFromInlineContext -SymSetSearchPath -SymSrvDeltaName -SymSrvGetFileIndexes -SymSrvGetFileIndexInfo -SymSrvGetFileIndexString -SymSrvGetSupplement -SymSrvIsStore -SymSrvStoreFile -SymSrvStoreSupplement -SymUnDName64 -SymUnloadModule64 - */ } } \ No newline at end of file diff --git a/PInvoke/DbgHelp/DbgHelp.cs b/PInvoke/DbgHelp/DbgHelp.cs index 0a30faf0..1dd7a09e 100644 --- a/PInvoke/DbgHelp/DbgHelp.cs +++ b/PInvoke/DbgHelp/DbgHelp.cs @@ -460,6 +460,34 @@ namespace Vanara.PInvoke [PInvokeData("dbghelp.h", MSDNShortId = "NC:dbghelp.PTRANSLATE_ADDRESS_ROUTINE64")] public delegate ulong PTRANSLATE_ADDRESS_ROUTINE64(HPROCESS hProcess, HTHREAD hThread, in ADDRESS64 lpaddr); + /// + /// + /// An application-defined callback function used with the StackWalk64 function. It provides address translation for 16-bit addresses. + /// + /// + /// The PTRANSLATE_ADDRESS_ROUTINE64 type defines a pointer to this callback function. TranslateAddressProc64 is a + /// placeholder for the application-defined function name. + /// + /// + /// A handle to the process for which the stack trace is generated. + /// A handle to the thread for which the stack trace is generated. + /// An address to be translated. + /// The function returns the translated address. + /// + /// + /// This callback function supersedes the PTRANSLATE_ADDRESS_ROUTINE callback function. PTRANSLATE_ADDRESS_ROUTINE is defined as + /// follows in Dbghelp.h. + /// + /// + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define PTRANSLATE_ADDRESS_ROUTINE PTRANSLATE_ADDRESS_ROUTINE64 #else typedef DWORD (__stdcall *PTRANSLATE_ADDRESS_ROUTINE)( __in HANDLE hProcess, __in HANDLE hThread, __out LPADDRESS lpaddr ); #endif + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nc-dbghelp-ptranslate_address_routine + // PTRANSLATE_ADDRESS_ROUTINE PtranslateAddressRoutine; DWORD PtranslateAddressRoutine( HANDLE hProcess, HANDLE hThread, LPADDRESS lpaddr ) {...} + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [PInvokeData("dbghelp.h", MSDNShortId = "NC:dbghelp.PTRANSLATE_ADDRESS_ROUTINE")] + public delegate uint PTRANSLATE_ADDRESS_ROUTINE(HPROCESS hProcess, HTHREAD hThread, in ADDRESS lpaddr); + /// The addressing mode. [PInvokeData("dbghelp.h", MSDNShortId = "NS:dbghelp._tagADDRESS64")] public enum ADDRESS_MODE @@ -2250,6 +2278,72 @@ namespace Vanara.PInvoke [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.SetSymLoadError")] public static extern void SetSymLoadError(uint error); + /// Obtains a stack trace. + /// + /// The architecture type of the computer for which the stack trace is generated. This parameter can be one of the following values. + /// + /// + /// Value + /// Meaning + /// + /// + /// IMAGE_FILE_MACHINE_I386 0x014c + /// Intel x86 + /// + /// + /// IMAGE_FILE_MACHINE_IA64 0x0200 + /// Intel Itanium + /// + /// + /// IMAGE_FILE_MACHINE_AMD64 0x8664 + /// x64 (AMD64 or EM64T) + /// + /// + /// + /// A handle to the process for which the stack trace is generated. If the caller supplies a valid callback pointer for the ReadMemoryRoutine parameter, then this value does not have to be a valid process handle. It can be a token that is unique and consistently the same for all calls to the StackWalk64 function. If the symbol handler is used with StackWalk64, use the same process handles for the calls to each function. + /// A handle to the thread for which the stack trace is generated. If the caller supplies a valid callback pointer for the ReadMemoryRoutine parameter, then this value does not have to be a valid thread handle. It can be a token that is unique and consistently the same for all calls to the StackWalk64 function. + /// A pointer to a STACKFRAME64 structure. This structure receives information for the next frame, if the function call succeeds. + /// + /// A pointer to a CONTEXT structure. This parameter is required only when the MachineType parameter is not IMAGE_FILE_MACHINE_I386. However, it is recommended that this parameter contain a valid context record. This allows StackWalk64 to handle a greater variety of situations. + /// This context may be modified, so do not pass a context record that should not be modified. + /// + /// + /// A callback routine that provides memory read services. When the StackWalk64 function needs to read memory from the process's address space, the ReadProcessMemoryProc64 callback is used. + /// If this parameter is NULL, then the function uses a default routine. In this case, the hProcess parameter must be a valid process handle. + /// If this parameter is not NULL, the application should implement and register a symbol handler callback function that handles CBA_READ_MEMORY. + /// + /// + /// A callback routine that provides access to the run-time function table for the process. This parameter is required because the StackWalk64 function does not have access to the process's run-time function table. For more information, see FunctionTableAccessProc64. + /// The symbol handler provides functions that load and access the run-time table. If these functions are used, then SymFunctionTableAccess64 can be passed as a valid parameter. + /// + /// + /// A callback routine that provides a module base for any given virtual address. This parameter is required. For more information, see GetModuleBaseProc64. + /// The symbol handler provides functions that load and maintain module information. If these functions are used, then SymGetModuleBase64 can be passed as a valid parameter. + /// + /// + /// A callback routine that provides address translation for 16-bit addresses. For more information, see TranslateAddressProc64. + /// Most callers of StackWalk64 can safely pass NULL for this parameter. + /// + /// + /// If the function succeeds, the return value is TRUE. + /// If the function fails, the return value is FALSE. Note that StackWalk64 generally does not set the last error code. + /// + /// + /// The StackWalk64 function provides a portable method for obtaining a stack trace. Using the StackWalk64 function is recommended over writing your own function because of all the complexities associated with stack walking on platforms. In addition, there are compiler options that cause the stack to appear differently, depending on how the module is compiled. By using this function, your application has a portable stack trace that continues to work as the compiler and operating system change. + /// The first call to this function will fail if the AddrPC, AddrFrame, and AddrStack members of the STACKFRAME64 structure passed in the StackFrame parameter are not initialized. + /// All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more than one thread to this function. + /// This function supersedes the StackWalk function. For more information, see Updated Platform Support. StackWalk is defined as follows in DbgHelp.h. + /// #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64) #define StackWalk StackWalk64 #else BOOL IMAGEAPI StackWalk( DWORD MachineType, __in HANDLE hProcess, __in HANDLE hThread, __inout LPSTACKFRAME StackFrame, __inout PVOID ContextRecord, __in_opt PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine, __in_opt PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine, __in_opt PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine, __in_opt PTRANSLATE_ADDRESS_ROUTINE TranslateAddress ); #endif + /// + // https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-stackwalk + // BOOL IMAGEAPI StackWalk( DWORD MachineType, HANDLE hProcess, HANDLE hThread, LPSTACKFRAME StackFrame, PVOID ContextRecord, PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine, PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine, PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine, PTRANSLATE_ADDRESS_ROUTINE TranslateAddress ); + [DllImport(Lib_DbgHelp, SetLastError = false, ExactSpelling = true)] + [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.StackWalk")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool StackWalk(IMAGE_FILE_MACHINE MachineType, HPROCESS hProcess, HTHREAD hThread, ref STACKFRAME StackFrame, [In, Out] IntPtr ContextRecord, + [Optional] PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine, [Optional] PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine, + [Optional] PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine, [Optional] PTRANSLATE_ADDRESS_ROUTINE TranslateAddress); + /// Obtains a stack trace. /// /// @@ -2368,7 +2462,7 @@ namespace Vanara.PInvoke // HANDLE hProcess, HANDLE hThread, LPSTACKFRAME64 StackFrame, PVOID ContextRecord, PREAD_PROCESS_MEMORY_ROUTINE64 // ReadMemoryRoutine, PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine, PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine, // PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress ); - [DllImport(Lib_DbgHelp, SetLastError = false, CharSet = CharSet.Auto)] + [DllImport(Lib_DbgHelp, SetLastError = false, ExactSpelling = true)] [PInvokeData("dbghelp.h", MSDNShortId = "NF:dbghelp.StackWalk64")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool StackWalk64(IMAGE_FILE_MACHINE MachineType, HPROCESS hProcess, HTHREAD hThread, ref STACKFRAME64 StackFrame, [In, Out] IntPtr ContextRecord, diff --git a/PInvoke/DbgHelp/Vanara.PInvoke.DbgHelp.csproj b/PInvoke/DbgHelp/Vanara.PInvoke.DbgHelp.csproj index 706cd709..d9f25041 100644 --- a/PInvoke/DbgHelp/Vanara.PInvoke.DbgHelp.csproj +++ b/PInvoke/DbgHelp/Vanara.PInvoke.DbgHelp.csproj @@ -1,21 +1,29 @@  - DbgHelp.dll;ImageHlp.dll + DbgHelp.dll;ImageHlp.dll - PInvoke API (methods, structures and constants) imported from Windows DbgHelp.dll. - $(AssemblyName) - net20;net35;net40;net45;netstandard2.0;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1 - Vanara.PInvoke.DbgHelp - $(AssemblyName) - true - pinvoke;vanara;net-extensions;interop;DbgHelp - + PInvoke API (methods, structures and constants) imported from Windows DbgHelp.dll. + $(AssemblyName) + net20;net35;net40;net45;netstandard2.0;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1 + Vanara.PInvoke.DbgHelp + $(AssemblyName) + true + pinvoke;vanara;net-extensions;interop;DbgHelp + Currently implements: + +Functions +BindImageEx, CheckSumMappedFile, EnumDirTree, EnumDirTreeA, EnumerateLoadedModules, EnumerateLoadedModulesEx, EnumerateLoadedModulesW64, FindDebugInfoFile, FindDebugInfoFileEx, FindDebugInfoFileExA, FindExecutableImage, FindExecutableImageEx, FindExecutableImageExA, GetImageConfigInformation, GetImageUnusedHeaderBytes, GetSymLoadError, GetTimestampForLoadedLibrary, ImageAddCertificate, ImageDirectoryEntryToData, ImageDirectoryEntryToDataEx, ImageEnumerateCertificates, ImageGetCertificateData, ImageGetCertificateHeader, ImageGetDigestStream, ImagehlpApiVersion, ImagehlpApiVersionEx, ImageLoad, ImageNtHeader, ImageRemoveCertificate, ImageRvaToSection, ImageRvaToVa, ImageUnload, MakeSureDirectoryPathExists, MapAndLoad, MapDebugInformation, MapFileAndCheckSum, ReBaseImage, ReBaseImage64, SearchTreeForFile, SearchTreeForFileA, SetImageConfigInformation, SetSymLoadError, SplitSymbols, StackWalk, StackWalk64, StackWalkEx, SymAddrIncludeInlineTrace, SymAddSourceStream, SymAddSymbol, SymAddSymbolA, SymbolServerSetOptionsA, SymbolServerSetOptionsW, SymCleanup, SymCompareInlineTrace, SymDeleteSymbol, SymDeleteSymbolA, SymEnumerateModules, SymEnumerateModules64, SymEnumerateModulesW64, SymEnumLines, SymEnumLinesA, SymEnumProcesses, SymEnumSourceFiles, SymEnumSourceFilesA, SymEnumSourceFileTokens, SymEnumSourceLines, SymEnumSourceLinesA, SymEnumSymbols, SymEnumSymbolsA, SymEnumSymbolsEx, SymEnumSymbolsExA, SymEnumSymbolsForAddr, SymEnumSymbolsForAddrA, SymEnumTypes, SymEnumTypesA, SymEnumTypesByName, SymEnumTypesByNameA, SymFindDebugInfoFile, SymFindDebugInfoFileA, SymFindExecutableImage, SymFindExecutableImageA, SymFindFileInPath, SymFindFileInPathA, SymFromAddr, SymFromAddrA, SymFromIndex, SymFromIndexA, SymFromInlineContext, SymFromInlineContextA, SymFromName, SymFromNameA, SymFromToken, SymFromTokenA, SymFunctionTableAccess, SymFunctionTableAccess64, SymFunctionTableAccess64AccessRoutines, SymGetExtendedOption, SymGetFileLineOffsets64, SymGetHomeDirectory, SymGetHomeDirectoryA, SymGetLineFromAddr64, SymGetLineFromAddrA, SymGetLineFromAddrW, SymGetLineFromAddrW64, SymGetLineFromInlineContext, SymGetLineFromInlineContextA, SymGetLineFromName, SymGetLineFromName64, SymGetLineFromNameW64, SymGetLineNext64, SymGetLineNextA, SymGetLineNextW, SymGetLineNextW64, SymGetLinePrev64, SymGetLinePrevA, SymGetLinePrevW, SymGetLinePrevW64, SymGetModuleBase, SymGetModuleBase64, SymGetModuleInfo, SymGetModuleInfo64, SymGetModuleInfoA, SymGetModuleInfoW64, SymGetOmaps, SymGetOptions, SymGetScope, SymGetScopeA, SymGetSearchPath, SymGetSearchPathA, SymGetSourceFile, SymGetSourceFileA, SymGetSourceFileChecksum, SymGetSourceFileChecksumA, SymGetSourceFileFromToken, SymGetSourceFileFromTokenA, SymGetSourceFileToken, SymGetSourceFileTokenA, SymGetSourceVarFromToken, SymGetSourceVarFromTokenA, SymGetSymbolFile, SymGetSymbolFileA, SymGetSymFromAddr, SymGetSymFromAddr64, SymGetSymFromName, SymGetSymFromName64, SymGetSymNext64, SymGetSymNextA, SymGetSymNextW, SymGetSymNextW64, SymGetSymPrev64, SymGetSymPrevW, SymGetSymPrevW64, SymGetTypeFromName, SymGetTypeFromNameA, SymGetTypeInfo, SymGetTypeInfoEx, SymInitialize, SymInitializeA, SymLoadModule, SymLoadModule64, SymLoadModuleEx, SymLoadModuleExA, SymMatchFileName, SymMatchFileNameA, SymMatchString, SymNext, SymNextA, SymPrev, SymPrevA, SymQueryInlineTrace, SymRefreshModuleList, SymRegisterCallback64, SymRegisterCallbackA, SymRegisterCallbackW, SymRegisterCallbackW64, SymRegisterFunctionEntryCallback, SymRegisterFunctionEntryCallback64, SymSearch, SymSearchA, SymSetContext, SymSetExtendedOption, SymSetHomeDirectory, SymSetHomeDirectoryA, SymSetOptions, SymSetParentWindow, SymSetScopeFromAddr, SymSetScopeFromIndex, SymSetScopeFromInlineContext, SymSetSearchPath, SymSetSearchPathA, SymSrvDeltaName, SymSrvDeltaNameA, SymSrvGetFileIndexes, SymSrvGetFileIndexesA, SymSrvGetFileIndexInfo, SymSrvGetFileIndexInfoA, SymSrvGetFileIndexString, SymSrvGetFileIndexStringA, SymSrvGetSupplement, SymSrvGetSupplementA, SymSrvIsStore, SymSrvIsStoreA, SymSrvStoreFile, SymSrvStoreFileA, SymSrvStoreSupplement, SymSrvStoreSupplementA, SymUnDName, SymUnDName64, SymUnloadModule, SymUnloadModule64, TouchFileTimes, UnDecorateSymbolName, UnDecorateSymbolNameA, UnMapAndLoad, UnmapDebugInformation, UpdateDebugInfoFile, UpdateDebugInfoFileEx + +Structures +ADDRESS, ADDRESS64, API_VERSION, IMAGE_DEBUG_INFORMATION, IMAGEHLP_CBA_EVENT, IMAGEHLP_CBA_READ_MEMORY, IMAGEHLP_DEFERRED_SYMBOL_LOAD, IMAGEHLP_DEFERRED_SYMBOL_LOAD64, IMAGEHLP_DEFERRED_SYMBOL_LOADW64, IMAGEHLP_DUPLICATE_SYMBOL64, IMAGEHLP_GET_TYPE_INFO_PARAMS, IMAGEHLP_LINE, IMAGEHLP_LINE64, IMAGEHLP_MODULE, IMAGEHLP_MODULE64, IMAGEHLP_STACK_FRAME, IMAGEHLP_SYMBOL, IMAGEHLP_SYMBOL64, IMAGEHLP_SYMBOLW, IMAGEHLP_SYMBOLW64, KDHELP, KDHELP64, LOADED_IMAGE, MODLOAD_CVMISC, MODLOAD_DATA, OMAP, SOURCEFILE, SRCCODEINFO, STACKFRAME, STACKFRAME_EX, STACKFRAME64, SYMBOL_INFO, SYMSRV_INDEX_INFO, TI_FINDCHILDREN_PARAMS, LIST_ENTRY, FPO_DATA, IMAGE_RUNTIME_FUNCTION_ENTRY, IMAGE_COFF_SYMBOLS_HEADER, IMAGE_DATA_DIRECTORY, IMAGE_DEBUG_DIRECTORY, IMAGE_EXPORT_DIRECTORY, IMAGE_FILE_HEADER, IMAGE_FUNCTION_ENTRY, IMAGE_LOAD_CONFIG_CODE_INTEGRITY, IMAGE_LOAD_CONFIG_DIRECTORY32, IMAGE_LOAD_CONFIG_DIRECTORY64, IMAGE_NT_HEADERS, IMAGE_OPTIONAL_HEADER, IMAGE_SECTION_HEADER, <_DataDirectory>e__FixedBuffer, MISC + + - - - + + + \ No newline at end of file diff --git a/README.md b/README.md index e9b014fa..6b2ae421 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ comctl32.dll | [Vanara.PInvoke.ComCtl32](https://github.com/dahall/Vanara/blob/m credui.dll | [Vanara.PInvoke.CredUI](https://github.com/dahall/Vanara/blob/master/PInvoke/CredUI/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg?style=flat-square) | [![Nuget](https://img.shields.io/nuget/v/Vanara.PInvoke.CredUI?label=%20&logo=nuget&style=flat-square)![Nuget](https://img.shields.io/nuget/dt/Vanara.PInvoke.CredUI?label=%20&style=flat-square)](https://www.nuget.org/packages/Vanara.PInvoke.CredUI) crypt32.dll, bcrypt.dll, ncrypt.dll, tokenbinding.dll, cryptui.dll, cryptnet.dll, cryptdlg.dll | [Vanara.PInvoke.Cryptography](https://github.com/dahall/Vanara/blob/master/PInvoke/Cryptography/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg?style=flat-square) | [![Nuget](https://img.shields.io/nuget/v/Vanara.PInvoke.Cryptography?label=%20&logo=nuget&style=flat-square)![Nuget](https://img.shields.io/nuget/dt/Vanara.PInvoke.Cryptography?label=%20&style=flat-square)](https://www.nuget.org/packages/Vanara.PInvoke.Cryptography) d2d1.dll, dxgi.dll, dwrite.dll, windowscodecs.dll | [Vanara.PInvoke.Graphics](https://github.com/dahall/Vanara/blob/master/PInvoke/Graphics/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg?style=flat-square) | [![Nuget](https://img.shields.io/nuget/v/Vanara.PInvoke.Graphics?label=%20&logo=nuget&style=flat-square)![Nuget](https://img.shields.io/nuget/dt/Vanara.PInvoke.Graphics?label=%20&style=flat-square)](https://www.nuget.org/packages/Vanara.PInvoke.Graphics) +DbgHelp.dll, ImageHlp.dll | [Vanara.PInvoke.DbgHelp](https://github.com/dahall/Vanara/blob/master/PInvoke/DbgHelp/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg?style=flat-square) | [![Nuget](https://img.shields.io/nuget/v/Vanara.PInvoke.DbgHelp?label=%20&logo=nuget&style=flat-square)![Nuget](https://img.shields.io/nuget/dt/Vanara.PInvoke.DbgHelp?label=%20&style=flat-square)](https://www.nuget.org/packages/Vanara.PInvoke.DbgHelp) DnsApi.dll | [Vanara.PInvoke.DnsApi](https://github.com/dahall/Vanara/blob/master/PInvoke/DnsApi/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg?style=flat-square) | [![Nuget](https://img.shields.io/nuget/v/Vanara.PInvoke.DnsApi?label=%20&logo=nuget&style=flat-square)![Nuget](https://img.shields.io/nuget/dt/Vanara.PInvoke.DnsApi?label=%20&style=flat-square)](https://www.nuget.org/packages/Vanara.PInvoke.DnsApi) dwmapi.dll | [Vanara.PInvoke.DwmApi](https://github.com/dahall/Vanara/blob/master/PInvoke/DwmApi/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg?style=flat-square) | [![Nuget](https://img.shields.io/nuget/v/Vanara.PInvoke.DwmApi?label=%20&logo=nuget&style=flat-square)![Nuget](https://img.shields.io/nuget/dt/Vanara.PInvoke.DwmApi?label=%20&style=flat-square)](https://www.nuget.org/packages/Vanara.PInvoke.DwmApi) gdi32.dll | [Vanara.PInvoke.Gdi32](https://github.com/dahall/Vanara/blob/master/PInvoke/Gdi32/CorrelationReport.md) | ![Coverage](https://img.shields.io/badge/100%25-green.svg?style=flat-square) | [![Nuget](https://img.shields.io/nuget/v/Vanara.PInvoke.Gdi32?label=%20&logo=nuget&style=flat-square)![Nuget](https://img.shields.io/nuget/dt/Vanara.PInvoke.Gdi32?label=%20&style=flat-square)](https://www.nuget.org/packages/Vanara.PInvoke.Gdi32) diff --git a/UnitTests/PInvoke/DbgHelp/DbgHelpTests.cs b/UnitTests/PInvoke/DbgHelp/DbgHelpTests.cs index 47a52e16..003187ee 100644 --- a/UnitTests/PInvoke/DbgHelp/DbgHelpTests.cs +++ b/UnitTests/PInvoke/DbgHelp/DbgHelpTests.cs @@ -16,15 +16,23 @@ namespace Vanara.PInvoke.Tests public class DbgHelpTests { const string imgName = "imagehlp.dll"; + const string testAppName = "TestDbgApp"; + const string testAppPath = TestCaseSources.TempDirWhack + testAppName + ".exe"; + private Process testApp; + private ProcessSymbolHandler hProc; [OneTimeSetUp] public void _Setup() { + testApp = Process.Start(new ProcessStartInfo(testAppPath) { WindowStyle = ProcessWindowStyle.Minimized }); + hProc = new ProcessSymbolHandler(testApp.Handle); } [OneTimeTearDown] public void _TearDown() { + hProc.Dispose(); + testApp.Kill(); } [Test] @@ -93,8 +101,7 @@ namespace Vanara.PInvoke.Tests [Test] public void SymEnumerateModulesTest() { - using var hProc = new ProcessSymbolHandler(Process.GetCurrentProcess().Handle, null, true); - var output = SymEnumerateModules(hProc); + var output = SymEnumerateModules(hProc, true); TestContext.WriteLine($"Count: {output.Count}"); output.WriteValues(); } @@ -102,8 +109,7 @@ namespace Vanara.PInvoke.Tests [Test] public void SymEnumLinesTest() { - using var hProc = new ProcessSymbolHandler(Process.GetCurrentProcess().Handle, null, true); - var (ModuleName, BaseOfDll) = SymEnumerateModules(hProc).Where(t => t.ModuleName == "KERNEL32").First(); + var (_, BaseOfDll) = SymEnumerateModules(hProc, true).First(); var output = SymEnumLines(hProc, unchecked((ulong)BaseOfDll.ToInt64())); TestContext.WriteLine($"Count: {output.Count}"); output.WriteValues(); @@ -112,8 +118,74 @@ namespace Vanara.PInvoke.Tests [Test] public void SymEnumProcessesTest() { - using var hProc = new ProcessSymbolHandler(Process.GetCurrentProcess().Handle); Assert.That(SymEnumProcesses(), Is.Not.Empty); } + + [Test] + public unsafe void SymGetOmapsTest() + { + var (_, BaseOfDll) = SymEnumerateModules(hProc, true).First(); + Assert.That(SymGetOmaps(hProc, unchecked((ulong)BaseOfDll.ToInt64()), out var to, out var cto, out var from, out var cfrom), ResultIs.Successful); + } + + [Test] + public void SymGetSymFromNameTest() + { + using var sym = new SafeIMAGEHLP_SYMBOL(); + Assert.That(SymGetSymFromName(hProc, "strcat", sym), ResultIs.Successful); + sym.Value.WriteValues(); + } + + [Test] + public void SymGetSymFromName64Test() + { + ulong addr = 0; + using (var sym = new SafeIMAGEHLP_SYMBOL64()) + { + Assert.That(SymGetSymFromName64(hProc, "strcat", sym), ResultIs.Successful); + sym.Value.WriteValues(); + Assert.That(sym.Value.Name, Is.EqualTo("strcat")); + addr = sym.Value.Address; + } + + using (var sym = new SafeIMAGEHLP_SYMBOL64()) + { + Assert.That(SymGetSymFromAddr64(hProc, addr, out var displ, sym), ResultIs.Successful); + sym.Value.WriteValues(); + Assert.That(sym.Value.Name, Is.EqualTo("strcat")); + } + } + + [Test] + public void MimicDllExp() + { + Assert.That(MapAndLoad(imgName, null, out var LoadedImage, true, true), ResultIs.Successful); + try + { + var data = ImageDirectoryEntryToData(LoadedImage.MappedAddress, false, IMAGE_DIRECTORY_ENTRY.IMAGE_DIRECTORY_ENTRY_EXPORT, out var cDirSize); // (_IMAGE_EXPORT_DIRECTORY*) + Assert.That(data, ResultIs.ValidHandle); + var ImageExportDirectory = data.ToStructure(cDirSize); + ImageExportDirectory.WriteValues(); + + var addr = ImageRvaToVa(LoadedImage.FileHeader, LoadedImage.MappedAddress, ImageExportDirectory.AddressOfNames, out _); // (uint*) + Assert.That(addr, ResultIs.ValidHandle); + var rnameaddrs = addr.ToArray((int)ImageExportDirectory.NumberOfNames); + + addr = ImageRvaToVa(LoadedImage.FileHeader, LoadedImage.MappedAddress, ImageExportDirectory.AddressOfNameOrdinals, out _); // (uint*) + Assert.That(addr, ResultIs.ValidHandle); + var rordaddrs = addr.ToArray((int)ImageExportDirectory.NumberOfNames); + + for (int i = 0; i < rnameaddrs.Length; i++) + { + var sName = Marshal.PtrToStringAnsi(ImageRvaToVa(LoadedImage.FileHeader, LoadedImage.MappedAddress, rnameaddrs[i], out _)); + var ord = ImageRvaToVa(LoadedImage.FileHeader, LoadedImage.MappedAddress, rordaddrs[i], out _).ToNullableStructure(); + TestContext.WriteLine($"{sName ?? (null)}\t0x{ord ?? 0}"); + } + } + finally + { + UnMapAndLoad(ref LoadedImage); + } + } } } \ No newline at end of file