The AEP that writes the program to its own process

Source: Internet
Author: User

Test program features

Print out the program entry point address of your process.

Combined with the OD loader, the entry point you see is really 0x004014f0, and the program entry point finds

Test program

[CPP]View PlainCopy
  1. @file exam_1_1.c
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. void Fngetprogentry ();
  5. int main (int agrc, char** argv)
  6. {
  7. Fngetprogentry ();
  8. printf ("END, press any key to quit\n");
  9. GetChar ();
  10. return 0;
  11. }
  12. void Fngetprogentry ()
  13. {
  14. #define Pe_signture 0x4550///< "PE"
  15. int* pfileaddressofnewheader = NULL;
  16. int* pcofffileheader = NULL;
  17. int* PAEP = NULL;
  18. const int iaddrpeimgbase = 0x400000;
  19. /// Ioffsetx for offset
  20. /// Icontent for the contents of the address
  21. const INT ioffsetfileaddressofnewheader = (16 * 4-4); ///< The offset of the File address of the new header with respect to the Dosheader
  22. const int ioffsetaeptofileaddressofnewheader = 0x28;
  23. int icontentfileaddressofnewheader = 0;
  24. int ipesignature = 0;
  25. int ioffsetaddressofentrypoint = 0; ///< Program Entry point offset address
  26. Do
  27. {
  28. Pfileaddressofnewheader = (int*) (iaddrpeimgbase + ioffsetfileaddressofnewheader);
  29. Icontentfileaddressofnewheader = *pfileaddressofnewheader; ///< icontentfileaddressofnewheader = 0xd0
  30. Pcofffileheader = (int*) (iaddrpeimgbase + icontentfileaddressofnewheader);
  31. Ipesignature = *pcofffileheader;
  32. if (pe_signture! = ipesignature)
  33. {
  34. printf ("error PE file\n");
  35. }
  36. PAEP = (int*) ((int) Pcofffileheader + ioffsetaeptofileaddressofnewheader);
  37. Ioffsetaddressofentrypoint = Iaddrpeimgbase + *PAEP;
  38. printf ("My address entry point is 0x%x\n", ioffsetaddressofentrypoint);
  39. } while (0);
  40. printf ("END, press any key to quit\n");
  41. }

Run results

http://blog.csdn.net/lostspeed/article/details/49506193

The AEP that writes the program to its own process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.