GetModuleFileNameW returns different path than GetCurrentDirectoryW (subst)

722 views Asked by At

I have created a subst drive like the following:

G:\ => F:\projects\projectname\

When I call GetModuleFileNameW

GetModuleFileNameW(GetModuleHandleW(nullptr), buffer2, MAX_PATH);

It returns the Module path using the original path, Ex:

F:\projects\projectname\projectname.exe

Despite me running the solution and project from the subst drive location.

However, if I make a call to GetCurrentDirectoryW

GetCurrentDirectoryW(MAX_PATH, buffer3);

It ends up returning the correct path, Ex:

G:\projectname.exe

How can I get GetModuleFileNameW to return the subst path rather than the original path?

0

There are 0 answers