Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. Byte[] data = new Byte[14096];
  2. FileInfo file = new FileInfo(Ruta);
  3. Stream fin = file.OpenRead();
  4. int iRead = fin.Read(data, 0, 4096);
  5. fin.Close();
  6.  
  7. // Valida si es dll o exe
  8. if ((data[1] << 8 | data[0]) != 0x5a4d)
  9. return TipoComponente.VB6;
  10.  
  11. // Obtiene dirección para el encabezado de Windows
  12. int iWinNTHdr = data[63] << 24 | data[62] << 16 | data[61] << 8 | data[60];
  13.  
  14. // Valida si es una dirección válida
  15. if ((data[iWinNTHdr + 3] << 24 | data[iWinNTHdr + 2] << 16 | data[iWinNTHdr + 1] << 8 | data[iWinNTHdr]) != 0x00004550)
  16. return TipoComponente.VB6;
  17.  
  18. Int32 iLightningAddr = iWinNTHdr + 24 + 208;
  19. Int32 iSum = 0;
  20. Int32 iTop = iLightningAddr + 8;
  21.  
  22. for (int i = iLightningAddr; i < iTop; ++i)
  23. iSum |= data[i];
  24.  
  25. if (iSum == 0)
  26. return TipoComponente.VB6;
  27. else
  28. return TipoComponente.dotNET;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement