private void WindowsNativeLoadPdbUsingDia(string pePath, string symbolPath, string localSymbolDirectories) { IDiaDataSource diaSource; Environment.SetEnvironmentVariable("_NT_SYMBOL_PATH", ""); Environment.SetEnvironmentVariable("_NT_ALT_SYMBOL_PATH", ""); try { diaSource = MsdiaComWrapper.GetDiaSource(); diaSource.loadDataForExe(pePath, localSymbolDirectories, IntPtr.Zero); } catch { diaSource = null; } if (diaSource == null) { diaSource = MsdiaComWrapper.GetDiaSource(); diaSource.loadDataForExe(pePath, symbolPath, IntPtr.Zero); } diaSource.openSession(out _session); }
private void WindowsNativeLoadPdbUsingDia(string peOrPdbPath, string symbolPath) { IDiaDataSource diaSource = MsdiaComWrapper.GetDiaSource(); Environment.SetEnvironmentVariable("_NT_SYMBOL_PATH", ""); if (symbolPath == null) { string pdbPath = Path.ChangeExtension(peOrPdbPath, ".pdb"); if (File.Exists(pdbPath)) { peOrPdbPath = pdbPath; } } // load the debug info depending on the file type if (peOrPdbPath.EndsWith(".pdb", StringComparison.OrdinalIgnoreCase)) { diaSource.loadDataFromPdb(peOrPdbPath); } else { diaSource.loadDataForExe(peOrPdbPath, symbolPath, IntPtr.Zero); } diaSource.openSession(out _session); }
private void WindowsNativeLoadPdbUsingDia(string pePath, string symbolPath, string localSymbolDirectories) { IDiaDataSource diaSource = null; Environment.SetEnvironmentVariable("_NT_SYMBOL_PATH", ""); Environment.SetEnvironmentVariable("_NT_ALT_SYMBOL_PATH", ""); if (!string.IsNullOrEmpty(localSymbolDirectories)) { // If we have one or more local symbol directories, we want // to probe them before any other default load behavior. If // this load code path fails, we fill fallback to these // defaults locations in the second load pass below. this.restrictReferenceAndOriginalPathAccess = true; try { diaSource = MsdiaComWrapper.GetDiaSource(); diaSource.loadDataForExe( pePath, localSymbolDirectories, this.loadTrace != null ? this : (object)IntPtr.Zero); } catch { diaSource = null; } } if (diaSource == null) { this.restrictReferenceAndOriginalPathAccess = false; diaSource = MsdiaComWrapper.GetDiaSource(); diaSource.loadDataForExe( pePath, symbolPath, this.loadTrace != null ? this : (object)IntPtr.Zero); } diaSource.openSession(out this.session); }