Wrong File Path in AppUP Client

Wrong File Path in AppUP Client

The DirectX function FindMediaFileCch(... ) is fine to launch application in Windows. However it gets the wrong path result when launch application in Intel AppUp client. The problem maybe in the function GetModuleFileName( NULL, strExePath, MAX_PATH ); inside the FindMediaFileCch(... ). It returns the path of executable file of AppUp Client instead of the path of actual application. This will cause reading file error in DirectX for games. How to solve this incompatible problem?
12 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.


There are many ways to handle this, one would be to store your media path in a registry key on the local system. The problem you are seeing is likely related to the startup path and working path being different than what you expected.

This link may also be of use: http://appdeveloper.intel.com/en-us/article/troubleshooting-validation-failures

I read the article. The function of FindMediaFileCch is to give a file name and find its path. This function returns error result in Intel's AppUp.

It returns C:\Program Files\Intel\Media\myprofile.ini

The right one should be C:\Program Files\MyCompany\MyProgram\Media\myprofile.ini

It is a trick to get my working path inside the my program.

To store media path in a registry key cannot work in program itself but in installation.

Hello Chang-li,
We are building a DirectX game as well and we are facing the same problem. I have a utility function that searches for all the media from a media folder in the root directory and returns a file path GetMediaFile( char* file, char path[] ). Now when we launch the program from the start menu everything works fine but when we launch it from the app store the program does not launch. We have tried all the trouble shooting steps mentioned on this page http://appdeveloper.intel.com/en-us/article/troubleshooting-validation-failures but we are not able to solve the problem. If you have been able to fix the problem you were facing can you please share some information on how to fix it.
Thank you


1) You mean that we need to store the installation path [via some code in MSI installer] into a registry variable, using custom actions - if that's the way you recommend.
2) Whenever our app is launched we need to read the value of the registry key, and thus get the proper installation path.

1) Do you see a problem with the above approach?

Notes and request,
I have not yet tried this myself but on reading through the various texts on Google I feel that the above mentioned approach ought to work...However, I would like to know if I am overlooking something.

Please let me know.

Hi all,

I do not think adding path to registration key is a good solution.
Developers may face this problem in almost any C++ apps for AppUp.
Here is my solution:

Modify below function in all cases

GetModuleFileName( NULL, strExePath, MAX_PATH )


HANDLE hProcess = GetCurrentProcess();
GetModuleFileNameEx( hProcess, NULL, strExePath, MAX_PATH );

Hope this help.



Either Chang's or my solution will work. It is up to your preference. Please let me know if you get stuck.

GetModuleFileName( NULL, strExePath, MAX_PATH ) is getting the path of the executable file of the current process. See http://msdn.microsoft.com/en-us/library/ms683197%28VS.85%29.aspx. Is its behavior being modified when the app is launched by the AppUp Client?

Hey Chang-li,

Thanks a lot for that info. We spent about two days trying to solve this issue, now it has been resolved. There are a lot of threads about this issue but none of them have a concrete solution. Moderators, please make this thread sticky.

Thanks ww8520. I referenced your post on another thread:


Hi Brian, thanks for quoting me in the other thread but all the credits should go to Chang since he mentioned it first in comment #5.

Actually mine was a question and request for clarification from the SDK developers if you can rely it to them. I have been using GetModuleFileName(NULL) all over my codes to locate my data/dll/resource files. Chang's comment #5 seems to indicate that GetModuleFileName(NULL) is broken when his app is launched from the AppUp Client and he has to resort to use GetCurrentProcess/GetModuleFileNameEx to get around the problem. If GetModuleFileName's behavior is changed in AppUp Client, many apps will be broken. It's a big problem. That's why I asked for clarification.

Thank you Chang!

Leave a Comment

Please sign in to add a comment. Not a member? Join today