How to get Program Files folder path (not Program Files (x86)) from 32bit WOW process?

前端 未结 6 2379
我寻月下人不归
我寻月下人不归 2021-02-19 05:42

I need to get the path to the native (rather than the WOW) program files directory from a 32bit WOW process.

When I pass CSIDL_PROGRAM_FILES (or CSIDL_PROGRAM_FILESX86)

6条回答
  •  名媛妹妹
    2021-02-19 06:12

    I appreciate all the help and, especially, the warnings in this thread. However, I really do need this path and this is how I got it in the end:

    (error checking removed for clarity, use at your own risk, etc)

    WCHAR szNativeProgramFilesFolder[MAX_PATH];
    ExpandEnvironmentStrings(L"%ProgramW6432%", 
                           szNativeProgramFilesFolder, 
                           ARRAYSIZE(szNativeProgramFilesFolder);
    

提交回复
热议问题