Bug 1797301 - Move Utility process to check preloading failures r=nika

Differential Revision: https://phabricator.services.mozilla.com/D160686
This commit is contained in:
Alexandre Lissy 2022-11-02 09:54:54 +00:00
Родитель 5c49227af4
Коммит 994d8a149b
2 изменённых файлов: 7 добавлений и 6 удалений

Просмотреть файл

@ -18,6 +18,7 @@
# include "WMFUtils.h"
# include "mozilla/sandboxTarget.h"
# include "mozilla/ipc/UtilityProcessImpl.h"
#endif // defined(XP_WIN) && defined(MOZ_SANDBOX)
#ifdef MOZ_WIDGET_ANDROID
@ -69,20 +70,20 @@ void UtilityAudioDecoderParent::GenericPreloadForSandbox() {
#if defined(MOZ_SANDBOX) && defined(OS_WIN)
// Preload AV dlls so we can enable Binary Signature Policy
// to restrict further dll loads.
::LoadLibraryW(L"mozavcodec.dll");
::LoadLibraryW(L"mozavutil.dll");
UtilityProcessImpl::LoadLibraryOrCrash(L"mozavcodec.dll");
UtilityProcessImpl::LoadLibraryOrCrash(L"mozavutil.dll");
#endif // defined(MOZ_SANDBOX) && defined(OS_WIN)
}
/* static */
void UtilityAudioDecoderParent::WMFPreloadForSandbox() {
#if defined(MOZ_SANDBOX) && defined(OS_WIN)
::LoadLibraryW(L"mfplat.dll");
::LoadLibraryW(L"mf.dll");
UtilityProcessImpl::LoadLibraryOrCrash(L"mfplat.dll");
UtilityProcessImpl::LoadLibraryOrCrash(L"mf.dll");
# if defined(DEBUG)
// WMF Shutdown on debug build somehow requires this
::LoadLibraryW(L"ole32.dll");
UtilityProcessImpl::LoadLibraryOrCrash(L"ole32.dll");
# endif // defined(DEBUG)
auto rv = wmf::MediaFoundationInitializer::HasInitialized();

Просмотреть файл

@ -46,7 +46,7 @@ bool UtilityProcessImpl::Init(int aArgc, char* aArgv[]) {
// We delay load winmm.dll so that its dependencies don't interfere with COM
// initialization when win32k is locked down. We need to load it before we
// lower the sandbox in processes where the policy will prevent loading.
::LoadLibraryW(L"winmm.dll");
LoadLibraryOrCrash(L"winmm.dll");
if (*sandboxingKind == SandboxingKind::GENERIC_UTILITY) {
// Preload audio generic libraries required for ffmpeg only