InterviewSolution
Saved Bookmarks
| 1. |
Solve : Detect PE Format Methology? |
|
Answer» Hello, MZy Bad Spelling More seriously, Quote All Windows executable files begin with a MS-DOS executable stub, so we first test for a valid MS-DOS executable using information from the MS-DOS program header that is present in every executable file. We then check for markers for a 16 bit or 32 bit Windows executable or for a virtual device driver (VXD). If we establish the file is a Windows executable we look for information that determines whether the file is an application or is a DLL. A review of the MS-DOS, Windows NE (16 bit) and PE (32 bit) executable file formats leads us to note the following: See here (where I got the above) and much more including a flow chart. http://www.delphidabbler.com/articles?article=8 and here http://www.google.co.uk/search?source=ig&hl=en&q=detect+windows+executable&btnG=Google+Search&meta= Ok great information, just an other quick question is the "magic" number that stated PE on the second line of the program ? Thanks Al968Quote from: al968 on September 09, 2007, 04:45:17 PM is the "magic" number that stated PE on the second line of the program ? The Windows header's offset in the file is given by the long word at offset $3C. Don't know what you mean by "line" in this context. here's a little perl snippet you can use to get file header. I only tested on a exe file. you can follow the rest of what contrex has posted to get PE headers...may or may not work though. Code: [Select]use warnings; my $file = "c:/someapplication.exe"; my $success = 0; my $hex; if (open(FH, $file)) { binmode(FH); my $bin; sysread(FH,$bin,20); close(FH); $hex = uc(UNPACK("H*",$bin)); } print $hex; |
|