[CDPX] Fix build: move dll imports to NativeMethods (#12544)

This commit is contained in:
Andrey Nekrasov
2021-07-28 17:26:06 +03:00
committed by GitHub
parent 04636339ce
commit 5a97db8992
2 changed files with 9 additions and 8 deletions

View File

@@ -38,21 +38,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
set { Set(ref isBackEnabled, value); }
}
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
private static extern IntPtr LoadLibrary(string dllToLoad);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
private static extern bool FreeLibrary(IntPtr hModule);
public bool IsVideoConferenceBuild
{
get
{
var mfHandle = LoadLibrary("mf.dll");
var mfHandle = NativeMethods.LoadLibrary("mf.dll");
bool mfAvailable = mfHandle != null;
if (mfAvailable)
{
FreeLibrary(mfHandle);
NativeMethods.FreeLibrary(mfHandle);
}
return this != null && File.Exists("modules/VideoConference/VideoConferenceModule.dll") && mfAvailable;