Skip to content

Commit

Permalink
Fix UWP compilation
Browse files Browse the repository at this point in the history
Avoid some forbidden calls which are not necessary. We link directly with the
installed DLL.
  • Loading branch information
robUx4 authored and lu-zero committed May 30, 2023
1 parent 61ac4d2 commit 9c62ec9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mfx_driver_store_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ DriverStoreLoader::~DriverStoreLoader(void)

bool DriverStoreLoader::GetDriverStorePath(wchar_t * path, DWORD dwPathSize, mfxU32 deviceID)
{
#if !defined(MEDIASDK_UWP_DISPATCHER)
if (path == NULL || dwPathSize == 0)
{
return false;
Expand Down Expand Up @@ -176,6 +177,7 @@ bool DriverStoreLoader::GetDriverStorePath(wchar_t * path, DWORD dwPathSize, mfx
}
}
}
#endif // MEDIASDK_UWP_DISPATCHER

DISPATCHER_LOG_INFO(("DriverStore path isn't found\n"));
return false;
Expand Down
4 changes: 4 additions & 0 deletions src/mfx_library_iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ void MFXLibraryIterator::Release(void)

} // void MFXLibraryIterator::Release(void)

#if !defined(MEDIASDK_UWP_DISPATCHER)
DECLSPEC_NOINLINE HMODULE GetThisDllModuleHandle()
{
HMODULE hDll = NULL;
Expand All @@ -168,6 +169,7 @@ DECLSPEC_NOINLINE HMODULE GetThisDllModuleHandle()
reinterpret_cast<LPCWSTR>(&GetThisDllModuleHandle), &hDll);
return hDll;
}
#endif

// wchar_t* sImplPath must be allocated with size not less then msdk_disp_path_len
bool GetImplPath(int storageID, wchar_t* sImplPath)
Expand All @@ -180,13 +182,15 @@ bool GetImplPath(int storageID, wchar_t* sImplPath)
case MFX_APP_FOLDER:
hModule = 0;
break;
#if !defined(MEDIASDK_UWP_DISPATCHER)
case MFX_PATH_MSDK_FOLDER:
hModule = GetThisDllModuleHandle();
HMODULE exeModule = GetModuleHandleW(NULL);
//It should works only if Dispatcher is linked with Dynamic Linked Library
if (!hModule || !exeModule || hModule == exeModule)
return false;
break;
#endif
}

DWORD nSize = 0;
Expand Down

0 comments on commit 9c62ec9

Please sign in to comment.