Advertisement
waliedassar

Funny PE Header Processing

May 26th, 2012
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. //http://waleedassar.blogspot.com
  2. //http://www.twitter.com/waleedassar
  3. //N.B the following is total crap!!!!!!!!
  4.  
  5. //p is a pointer to PE header and fileSize is PE file size.
  6. int i=0;
  7. bool found=false;
  8. while(i+3 < fileSize)
  9. {
  10.     if(p[i]=='P' && p[i+1]=='E' && p[i+2]==0 && p[i+3]==0)
  11.     {     found=true;  break; }
  12.     i++;
  13. }
  14. if(found)
  15. {
  16. //The real NT_FILE_HEADER is assumed to have been found here.
  17. //continue processing PE file
  18. }
  19. else
  20. {
  21.     //file is rejected
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement