0

I need to get icons from .exe and .dll file streams directly without temporary files. This file stream is obtained from the MSI package "Icon" table. I was able to successfully extract Icon from ".ico" file stream from the MSI package "Icon" table with this code:

public static Icon BytesToIcon(byte[] bytes)
{
    using (MemoryStream ms = new MemoryStream(bytes))
    {
     return new Icon(ms);
    }
}

but I have no clue of how I could read icons from .exe and .dll file streams directly. Please help me to look into right direction.

The question is about reading Icons from Byte[] fileStream. There is no file. And the goal is to read Icons from that stream without temporary files. Other similar question is about "Icon.ExtractAssociatedIcon(filePath)" It is not suitable for me because there is no file path.

Vadim K.
  • 331
  • 3
  • 9
  • this is not a duplicate, please correct – Vadim K. Aug 13 '15 at 21:54
  • 2
    Voting to reopen this one unless someone convinces me that it is actually a duplicate. – Maximillian Laumeister Aug 14 '15 at 01:04
  • @MaximillianLaumeister The answer tells him to look at the `Icon` class, which has an [`Icon(stream)`](https://msdn.microsoft.com/en-us/library/5t18ykxb.aspx) constructor. The difference between constructor A and constructor B is not enough to warrant a new question. – durron597 Aug 23 '15 at 05:37
  • MaximillianLaumeister, you did not understand the question. Read carefully. Your reasoning is totally incorrect. The answer to my question I have found already and it has no connection with Icon constructors. The answer is here: [link](http://stackoverflow.com/questions/32047517/how-to-extract-icons-from-exe-or-dll-byte-array-memory-stream/32047648#32047648) – Vadim K. Aug 23 '15 at 08:39

0 Answers0