[原文链接:http://www.moserware.com/2007/11/mz-bsjb-and-joys-of-magic-constants-in.html]
 
covered elsewhere too.

With this knowledge, you could write a very simple program that checked to see if a file was a .NET assembly by looking for a start of " took advantage of this fact.

Now, where can I put "

-------------------------------------

"When I was 10 or so, I thought you could open up a .EXE in a text editor and do meaningful work with it if you only knew some magical secret."

I was thinking exactly the same when I was first introduced to computers. I was opening any file (text or binary) with a text editor and fiddling around.

Btw the compiled .java files, .class files, start with these 4 bytes: 0xCA 0xFE 0xBA 0xBE aka Cafe Babe and ZIP files start with PK.

-------------------------------------

Huseyin: Good point on 0xCAFEBABE and PK. Similar things can be said for WAV, GIF, and other files. I think that Apache's Mimemagic module (and similar modules) looks for these to determine the real file type.

相关文章:

  • 2022-01-02
  • 2021-07-20
  • 2021-08-17
  • 2021-06-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-16
  • 2022-03-06
  • 2022-12-23
  • 2022-12-23
  • 2021-05-29
  • 2022-12-23
  • 2021-06-12
相关资源
相似解决方案