in BoostTestAdapter/Utility/DebugHelperNative.cs [187:257]
public static extern SafeFileHandle CreateFile(
string lpFileName, uint dwDesiredAccess, uint dwShareMode, IntPtr lpSecurityAttributes,
uint dwCreationDisposition, uint dwFlagsAndAttributes, IntPtr hTemplateFile);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern SafeFileHandle CreateFileMapping(
SafeFileHandle hFile, IntPtr lpFileMappingAttributes, uint flProtect,
uint dwMaximumSizeHigh, uint dwMaximumSizeLow, string lpName);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool GetFileSizeEx(SafeFileHandle hFile, out long lpFileSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr MapViewOfFile(
SafeFileHandle hFileMappingObject, uint dwDesiredAccess, uint dwFileOffsetHigh,
uint dwFileOffsetLow, UIntPtr dwNumberOfBytesToMap);
[DllImport("Kernel32.dll")]
internal static extern SetErrorFlags SetErrorMode(SetErrorFlags flags);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool UnmapViewOfFile(IntPtr lpBaseAddress);
[DllImport("DbgHelp.dll", SetLastError = true)]
internal static extern Options SymGetOptions();
[DllImport("DbgHelp.dll", SetLastError = true)]
internal static extern uint SymSetOptions(Options options);
[DllImport("DbgHelp.dll", CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false, ThrowOnUnmappableChar = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool SymInitialize(IntPtr handle, [MarshalAs(UnmanagedType.AnsiBStr)] string userSearchPath, [MarshalAs(UnmanagedType.Bool)] bool invadeProcess);
[DllImport("DbgHelp.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool SymCleanup(IntPtr handle);
[DllImport("DbgHelp.dll", CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false, ThrowOnUnmappableChar = true)]
internal static extern ulong SymLoadModuleEx(IntPtr hProcess, IntPtr hFile, string imageName, string moduleName, ulong baseOfDll, uint dllSize, IntPtr dataZero, SymLoadModuleFlags flags);
[DllImport("DbgHelp.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public extern static bool SymUnloadModule64(IntPtr hProcess, ulong baseOfDll);
[DllImport("DbgHelp.dll", CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false, ThrowOnUnmappableChar = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public extern static bool SymFromName(IntPtr hProcess, string SymName, ref SYMBOL_INFO symInfo);
[DllImport("DbgHelp.dll")]
public static extern unsafe void* ImageDirectoryEntryToData(IntPtr pBase, byte mappedAsImage, ushort directoryEntry, uint* size);
[DllImport("dbghelp.dll")]
public static extern IntPtr ImageRvaToVa(IntPtr pNtHeaders, IntPtr pBase, uint rva, IntPtr pLastRvaSection);
#endregion
}
private IntPtr _libHandle;
private ulong _dllBase;
public string LastErrorMessage { get; private set; }
/// <summary>
/// Constructor
/// </summary>
/// <param name="exeName">The executable name</param>
/// <exception cref="Win32Exception"></exception>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "BoostTestAdapter.Utility.DebugHelper+NativeMethods.SymSetOptions(BoostTestAdapter.Utility.DebugHelper+NativeMethods+Options)")]
public DebugHelper(string exeName)
{