protected internal static async Task <string> GetNameAsync(LocationCalculator calc, Stream stream, uint nameRVA) { var fileOffset = calc.RVAToOffset(nameRVA); stream.Seek(fileOffset.ToInt64(), SeekOrigin.Begin); var result = await stream.ReadStringAsync().ConfigureAwait(false); return(result); }
private static async Task <ushort[]> BuildFunctionOrdinalsAsync(LocationCalculator calc, Stream stream, IMAGE_EXPORT_DIRECTORY directory) { var offset = calc.RVAToOffset(directory.AddressOfNameOrdinals).ToInt64(); stream.Seek(offset, SeekOrigin.Begin); var results = new ushort[directory.NumberOfNames]; for (var i = 0; i < directory.NumberOfNames; i++) { results[i] = await stream.ReadUInt16Async().ConfigureAwait(false); } return(results); }
private static async Task <string> BuildNameAsync(LocationCalculator calc, Stream stream, IMAGE_EXPORT_DIRECTORY directory) { var builder = new StringBuilder(256); var offset = calc.RVAToOffset(directory.Name).ToInt64(); stream.Seek(offset, SeekOrigin.Begin); while (true) { int value = await stream.ReadByteAsync().ConfigureAwait(false); if (value <= 0) { break; } var c = (char)value; builder.Append(c); } return(builder.ToString()); }