A method that determines whether a specified process is x64 (Ntdll determines if a x64 function exists)

Source: Internet
Author: User

[CPP]View PlainCopy 
  1. BOOL iswow64processex (HANDLE hprocess)
  2. {
  3. //If the system is x86, then the process cannot have x64
  4. bool isX86 = false;
  5. #ifndef _win64
  6. isX86 = GetProcAddress (GetModuleHandle (TEXT ("Ntdll")), "ntwow64debuggercall") = = nullptr?  True:false;
  7. #endif
  8. if (isX86)
  9. return FALSE;
  10. //Process architecture is unknown, the system is x64, you can use the Iswow64process function to determine
  11. typedef BOOL (WINAPI *iswow64process) (HANDLE, pbool);
  12. Iswow64process fniswow64process;
  13. BOOL isWow64 = TRUE;
  14. Fniswow64process = (iswow64process) GetProcAddress (GetModuleHandle (TEXT ("kernel32")), "iswow64process");
  15. if (fniswow64process! = nullptr)
  16. Fniswow64process (hprocess, &ISWOW64);
  17. return!iswow64;
  18. }

First use OpenProcess to open the target process, and then pass the handle in the OK.

http://blog.csdn.net/aqtata/article/details/18361209

A method that determines whether a specified process is x64 (Ntdll determines if a x64 function exists)

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.