/// <summary> /// For side by side dlls, the manifest that decribes the binding information is stored as the RT_MANIFEST resource, and it /// is an XML string. This routine returns this. /// </summary> /// <returns></returns> public string GetSxSManfest() { ResourceNode resources = GetResources(); ResourceNode manifest = ResourceNode.GetChild(ResourceNode.GetChild(resources, "RT_MANIFEST"), "1"); if (manifest == null) { return(null); } if (!manifest.IsLeaf && manifest.Children.Count == 1) { manifest = manifest.Children[0]; } PEBuffer buff = AllocBuff(); byte * bytes = manifest.FetchData(0, manifest.DataLength, buff); string ret = null; using (UnmanagedMemoryStream stream = new UnmanagedMemoryStream(bytes, manifest.DataLength)) using (StreamReader textReader = new StreamReader(stream)) ret = textReader.ReadToEnd(); FreeBuff(buff); return(ret); }
/// <summary> /// Gets the File Version Information that is stored as a resource in the PE file. (This is what the /// version tab a file's property page is populated with). /// </summary> public FileVersionInfo GetFileVersionInfo() { ResourceNode resources = GetResources(); ResourceNode versionNode = ResourceNode.GetChild(ResourceNode.GetChild(resources, "Version"), "1"); if (versionNode == null) { return(null); } if (!versionNode.IsLeaf && versionNode.Children.Count == 1) { versionNode = versionNode.Children[0]; } PEBuffer buff = AllocBuff(); byte * bytes = versionNode.FetchData(0, versionNode.DataLength, buff); FileVersionInfo ret = new FileVersionInfo(bytes, versionNode.DataLength); FreeBuff(buff); return(ret); }