public unsafe PeDebugDirectory GetDebugDirectory() { ImageDebugDirectory debugDir = new ImageDebugDirectory(); uint pcData = 0; this.SymWriter.GetDebugInfo(ref debugDir, 0, out pcData, IntPtr.Zero); byte[] data = new byte[pcData]; fixed(byte *pb = data) { this.SymWriter.GetDebugInfo(ref debugDir, pcData, out pcData, (IntPtr)pb); } PeDebugDirectory result = new PeDebugDirectory(); result.AddressOfRawData = (uint)debugDir.AddressOfRawData; result.Characteristics = (uint)debugDir.Characteristics; result.Data = data; result.MajorVersion = (ushort)debugDir.MajorVersion; result.MinorVersion = (ushort)debugDir.MinorVersion; result.PointerToRawData = (uint)debugDir.PointerToRawData; result.SizeOfData = (uint)debugDir.SizeOfData; result.TimeDateStamp = (uint)debugDir.TimeDateStamp; result.Type = (uint)debugDir.Type; return(result); }
public unsafe PeDebugDirectory GetDebugDirectory() { ImageDebugDirectory debugDir = new ImageDebugDirectory(); uint dataCount = 0; try { this.symWriter.GetDebugInfo(ref debugDir, 0, out dataCount, IntPtr.Zero); } catch (Exception ex) { throw new PdbWritingException(ex); } // See symwrite.cpp - the data don't depend on the content of metadata tables or IL // // struct RSDSI // { // DWORD dwSig; // "RSDS" // GUID guidSig; // DWORD age; // char szPDB[0]; // zero-terminated UTF8 file name // }; // byte[] data = new byte[dataCount]; fixed(byte *pb = data) { try { this.symWriter.GetDebugInfo(ref debugDir, dataCount, out dataCount, (IntPtr)pb); } catch (Exception ex) { throw new PdbWritingException(ex); } } PeDebugDirectory result = new PeDebugDirectory(); result.AddressOfRawData = (uint)debugDir.AddressOfRawData; result.Characteristics = (uint)debugDir.Characteristics; result.Data = data; result.MajorVersion = (ushort)debugDir.MajorVersion; result.MinorVersion = (ushort)debugDir.MinorVersion; result.PointerToRawData = (uint)debugDir.PointerToRawData; result.SizeOfData = (uint)debugDir.SizeOfData; result.TimeDateStamp = (uint)debugDir.TimeDateStamp; result.Type = (uint)debugDir.Type; return(result); }
public unsafe PeDebugDirectory GetDebugDirectory() { ImageDebugDirectory debugDir = new ImageDebugDirectory(); uint dataCount = 0; try { this.symWriter.GetDebugInfo(ref debugDir, 0, out dataCount, IntPtr.Zero); } catch (Exception ex) { throw new PdbWritingException(ex); } // See symwrite.cpp - the data don't depend on the content of metadata tables or IL // // struct RSDSI // { // DWORD dwSig; // "RSDS" // GUID guidSig; // DWORD age; // char szPDB[0]; // zero-terminated UTF8 file name // }; // byte[] data = new byte[dataCount]; fixed (byte* pb = data) { try { this.symWriter.GetDebugInfo(ref debugDir, dataCount, out dataCount, (IntPtr)pb); } catch (Exception ex) { throw new PdbWritingException(ex); } } PeDebugDirectory result = new PeDebugDirectory(); result.AddressOfRawData = (uint)debugDir.AddressOfRawData; result.Characteristics = (uint)debugDir.Characteristics; result.Data = data; result.MajorVersion = (ushort)debugDir.MajorVersion; result.MinorVersion = (ushort)debugDir.MinorVersion; result.PointerToRawData = (uint)debugDir.PointerToRawData; result.SizeOfData = (uint)debugDir.SizeOfData; result.TimeDateStamp = (uint)debugDir.TimeDateStamp; result.Type = (uint)debugDir.Type; return result; }
public unsafe PeDebugDirectory GetDebugDirectory() { ImageDebugDirectory debugDir = new ImageDebugDirectory(); uint pcData = 0; this.SymWriter.GetDebugInfo(ref debugDir, 0, out pcData, IntPtr.Zero); byte[] data = new byte[pcData]; fixed (byte* pb = data) { this.SymWriter.GetDebugInfo(ref debugDir, pcData, out pcData, (IntPtr)pb); } PeDebugDirectory result = new PeDebugDirectory(); result.AddressOfRawData = (uint)debugDir.AddressOfRawData; result.Characteristics = (uint)debugDir.Characteristics; result.Data = data; result.MajorVersion = (ushort)debugDir.MajorVersion; result.MinorVersion = (ushort)debugDir.MinorVersion; result.PointerToRawData = (uint)debugDir.PointerToRawData; result.SizeOfData = (uint)debugDir.SizeOfData; result.TimeDateStamp = (uint)debugDir.TimeDateStamp; result.Type = (uint)debugDir.Type; return result; }
private uint ComputeSizeOfDebugTable(uint offsetToMetadata) { if (_nativePdbWriter == null) { return 0; } _debugDirectory = _nativePdbWriter.GetDebugDirectory(); _debugDirectory.TimeDateStamp = _ntHeader.TimeDateStamp; _debugDirectory.PointerToRawData = offsetToMetadata + 0x1c; return 0x1c + (uint)_debugDirectory.Data.Length; }