Пример #1
0
        public static void WriteRsDsSignature(Stream pdbStream, RsDsSignature signature)
        {
            BinaryReader br = new BinaryReader(pdbStream);
            BinaryWriter bw = new BinaryWriter(pdbStream);

            // Look for all blocks starting with the PDB Version (20000404) and replace the Age and GUID four bytes later
            int replacementCount = 0;

            for (long position = PdbBlockSize; position + PdbBlockSize < pdbStream.Length; position += PdbBlockSize)
            {
                pdbStream.Seek(position, SeekOrigin.Begin);
                uint startingValue = br.ReadUInt32();
                if (startingValue == PdbVersion)
                {
                    br.ReadUInt32();

                    // Read existing valuesand seek back  [debuggability]
                    //uint age = br.ReadUInt32();
                    //Guid binaryGuid = new Guid(br.ReadBytes(16));
                    //pdbStream.Seek(-20, SeekOrigin.Current);

                    bw.Write(signature.Age);
                    bw.Write(signature.Guid.ToByteArray());
                    replacementCount++;
                }
            }

            if (replacementCount == 0)
            {
                throw new BadImageFormatException($"PDB Stream didn't contain expected marker {PdbVersion} on any blocks.");
            }
        }
Пример #2
0
 public static void WriteRsDsSignature(string pdbFilePath, RsDsSignature signature)
 {
     using (FileStream stream = new FileStream(pdbFilePath, FileMode.Open, FileAccess.ReadWrite, FileShare.None))
     {
         WriteRsDsSignature(stream, signature);
     }
 }
Пример #3
0
        public static string GetSymbolCachePdbPath(string binaryFilePath)
        {
            RsDsSignature signature = ReadRsDsSignature(binaryFilePath);

            if (signature == null)
            {
                return(null);
            }

            string pdbFileName = Path.GetFileNameWithoutExtension(binaryFilePath) + ".pdb";

            return(Path.Combine(SymbolCache.Path, pdbFileName, signature.ToString(), pdbFileName));
        }