Getmodulefilenameex traversal a workaround to get 64bit program path failure (win7-64-bit)

Source: Internet
Author: User

Questions:The 32-bit program calls the Getmodulefilenameex () traversal on a 64-bit system to get the full path of the 64-bit process to fail with the resulting path empty.

According to the official statement:

The results use of the following table to convert paths.

Windows $ = Getmodulefilenameex ()
Windows XP x32 = Getprocessimagefilename ()
Windows XP x64 = Getprocessimagefilename ()
Windows Vista = Queryfullprocessimagename ()
Windows 7 = Queryfullprocessimagename ()

Note:if You is not aware the API Getprocessimagefilename () returns a kernel DOS device path. You can use the following API to map the device paths to a Win32 format.

However, it is important to note that getmodulefilename in 64bit is not correct, with 32 to fill 64 result is empty.

I can be accurately obtained under the Win7 of 32bit, 64bit Win7 can't get what they want. As shown in the following:




Recommended with Vista NEW: Queryfullprocessimagename (), results into:



Another search all over the network did not search the function of the sample, and then lazy also had to write their own ~ ~

DWORD size = MAX_PATH;
Char Sexename[max_path] = {0};
Queryfullprocessimagename (hprocess, 0, Sexename, &size);
Of course with Getprocessimagefilename get better, just code a bit long, lazy write.


Getmodulefilenameex traversal a workaround to get 64bit program path failure (win7-64-bit)

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.