mumble_exe: when using a versioned root, set the CWD to it. #2838

Merged
merged 1 commit into from Feb 11, 2017

Projects

None yet

1 participant

@mkrautz
Member
mkrautz commented Feb 11, 2017

Previously, we always used the directory holding mumble.exe
as the working directory.

This commit changes that to use the versioned root directory
as the working directory -- if we're using one.
When not using a versioned root directory, the old behavior
is kept intact.

This is primarily done to work around mumble-voip/mumble#2837,
where, when loading mumble_app.dll, the search order for ucrtbase.dll
seems to be using the "Standard Search Order for Desktop Applications"
instead of the "Alternate Search ORder for Desktop Applications", as it
should when we specify LOAD_WITH_ALTERED_SEARCH_PATH to LoadLibraryEx.

For context, see the following MSDN page:
https://msdn.microsoft.com/en-us/library/ms682586.aspx

Changing the working directory to the versioned root path allows
the Universal CRT to be correctly loaded -- via step 5 of the "Standard
Search Order for Desktop Applications" if SafeDllSearchMode is on --
despite this weird behavior from the system.

@mkrautz mkrautz requested review from Kissaki and hacst Feb 11, 2017
@mkrautz mkrautz mumble_exe: when using a versioned root, set the CWD to it.
Previously, we always used the directory holding mumble.exe
as the working directory.

This commit changes that to use the versioned root directory
as the working directory -- if we're using one.
When not using a versioned root directory, the old behavior
is kept intact.

This is primarily done to work around mumble-voip/mumble#2837,
where, when loading mumble_app.dll on Windows 7, the search order
for ucrtbase.dll seems to be using the "Standard Search Order for
Desktop Applications" instead of the "Alternate Search Order for
Desktop Applications", as it should when we specify
LOAD_WITH_ALTERED_SEARCH_PATH to LoadLibraryEx.

For context, see the following MSDN page:
https://msdn.microsoft.com/en-us/library/ms682586.aspx

Changing the working directory to the versioned root path allows
the Universal CRT to be correctly loaded -- via step 5 of the "Standard
Search Order for Desktop Applications" if SafeDllSearchMode is on --
despite this weird behavior from the system.

Works around mumble-voip/mumble#2837

MS Connect issue:
https://connect.microsoft.com/VisualStudio/feedback/details/3121208
03cfe38
@mkrautz mkrautz merged commit 289d0d4 into mumble-voip:master Feb 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment