Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Byte[] data = new Byte[14096];
- FileInfo file = new FileInfo(Ruta);
- Stream fin = file.OpenRead();
- int iRead = fin.Read(data, 0, 4096);
- fin.Close();
- // Valida si es dll o exe
- if ((data[1] << 8 | data[0]) != 0x5a4d)
- return TipoComponente.VB6;
- // Obtiene dirección para el encabezado de Windows
- int iWinNTHdr = data[63] << 24 | data[62] << 16 | data[61] << 8 | data[60];
- // Valida si es una dirección válida
- if ((data[iWinNTHdr + 3] << 24 | data[iWinNTHdr + 2] << 16 | data[iWinNTHdr + 1] << 8 | data[iWinNTHdr]) != 0x00004550)
- return TipoComponente.VB6;
- Int32 iLightningAddr = iWinNTHdr + 24 + 208;
- Int32 iSum = 0;
- Int32 iTop = iLightningAddr + 8;
- for (int i = iLightningAddr; i < iTop; ++i)
- iSum |= data[i];
- if (iSum == 0)
- return TipoComponente.VB6;
- else
- return TipoComponente.dotNET;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement