-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
Milestone
Description
Description
System.Management requires wminet_utils.dll in order to perform must of it's functionality, however this component is missing on some SKUs / architectures of Windows which do not include .NETFramework (eg: ARM64, and others)
runtime/src/libraries/System.Management/src/System/Management/ManagementScope.cs
Lines 308 to 378 in 4486164
string wminet_utilsPath = Path.Combine( | |
netFrameworkInstallRoot, | |
CompatSwitches.DotNetVersion, // The same value is hard coded on Environment.Version and quirks for WMI | |
"wminet_utils.dll"); | |
IntPtr hModule = Interop.Kernel32.LoadLibrary(wminet_utilsPath); | |
if (hModule == IntPtr.Zero) | |
{ | |
// This is unlikely, so having the TypeInitializationException wrapping it is fine. | |
throw new Win32Exception(Marshal.GetLastWin32Error(), SR.Format(SR.LoadLibraryFailed, wminet_utilsPath)); | |
} | |
if (LoadDelegate(ref ResetSecurity_f, hModule, "ResetSecurity") && | |
LoadDelegate(ref SetSecurity_f, hModule, "SetSecurity") && | |
LoadDelegate(ref BlessIWbemServices_f, hModule, "BlessIWbemServices") && | |
LoadDelegate(ref BlessIWbemServicesObject_f, hModule, "BlessIWbemServicesObject") && | |
LoadDelegate(ref GetPropertyHandle_f27, hModule, "GetPropertyHandle") && | |
LoadDelegate(ref WritePropertyValue_f28, hModule, "WritePropertyValue") && | |
LoadDelegate(ref Clone_f12, hModule, "Clone") && | |
LoadDelegate(ref VerifyClientKey_f, hModule, "VerifyClientKey") && | |
LoadDelegate(ref GetQualifierSet_f, hModule, "GetQualifierSet") && | |
LoadDelegate(ref Get_f, hModule, "Get") && | |
LoadDelegate(ref Put_f, hModule, "Put") && | |
LoadDelegate(ref Delete_f, hModule, "Delete") && | |
LoadDelegate(ref GetNames_f, hModule, "GetNames") && | |
LoadDelegate(ref BeginEnumeration_f, hModule, "BeginEnumeration") && | |
LoadDelegate(ref Next_f, hModule, "Next") && | |
LoadDelegate(ref EndEnumeration_f, hModule, "EndEnumeration") && | |
LoadDelegate(ref GetPropertyQualifierSet_f, hModule, "GetPropertyQualifierSet") && | |
LoadDelegate(ref Clone_f, hModule, "Clone") && | |
LoadDelegate(ref GetObjectText_f, hModule, "GetObjectText") && | |
LoadDelegate(ref SpawnDerivedClass_f, hModule, "SpawnDerivedClass") && | |
LoadDelegate(ref SpawnInstance_f, hModule, "SpawnInstance") && | |
LoadDelegate(ref CompareTo_f, hModule, "CompareTo") && | |
LoadDelegate(ref GetPropertyOrigin_f, hModule, "GetPropertyOrigin") && | |
LoadDelegate(ref InheritsFrom_f, hModule, "InheritsFrom") && | |
LoadDelegate(ref GetMethod_f, hModule, "GetMethod") && | |
LoadDelegate(ref PutMethod_f, hModule, "PutMethod") && | |
LoadDelegate(ref DeleteMethod_f, hModule, "DeleteMethod") && | |
LoadDelegate(ref BeginMethodEnumeration_f, hModule, "BeginMethodEnumeration") && | |
LoadDelegate(ref NextMethod_f, hModule, "NextMethod") && | |
LoadDelegate(ref EndMethodEnumeration_f, hModule, "EndMethodEnumeration") && | |
LoadDelegate(ref GetMethodQualifierSet_f, hModule, "GetMethodQualifierSet") && | |
LoadDelegate(ref GetMethodOrigin_f, hModule, "GetMethodOrigin") && | |
LoadDelegate(ref QualifierGet_f, hModule, "QualifierSet_Get") && | |
LoadDelegate(ref QualifierPut_f, hModule, "QualifierSet_Put") && | |
LoadDelegate(ref QualifierDelete_f, hModule, "QualifierSet_Delete") && | |
LoadDelegate(ref QualifierGetNames_f, hModule, "QualifierSet_GetNames") && | |
LoadDelegate(ref QualifierBeginEnumeration_f, hModule, "QualifierSet_BeginEnumeration") && | |
LoadDelegate(ref QualifierNext_f, hModule, "QualifierSet_Next") && | |
LoadDelegate(ref QualifierEndEnumeration_f, hModule, "QualifierSet_EndEnumeration") && | |
LoadDelegate(ref GetCurrentApartmentType_f, hModule, "GetCurrentApartmentType") && | |
LoadDelegate(ref GetDemultiplexedStub_f, hModule, "GetDemultiplexedStub") && | |
LoadDelegate(ref CreateInstanceEnumWmi_f, hModule, "CreateInstanceEnumWmi") && | |
LoadDelegate(ref CreateClassEnumWmi_f, hModule, "CreateClassEnumWmi") && | |
LoadDelegate(ref ExecQueryWmi_f, hModule, "ExecQueryWmi") && | |
LoadDelegate(ref ExecNotificationQueryWmi_f, hModule, "ExecNotificationQueryWmi") && | |
LoadDelegate(ref PutInstanceWmi_f, hModule, "PutInstanceWmi") && | |
LoadDelegate(ref PutClassWmi_f, hModule, "PutClassWmi") && | |
LoadDelegate(ref CloneEnumWbemClassObject_f, hModule, "CloneEnumWbemClassObject") && | |
LoadDelegate(ref ConnectServerWmi_f, hModule, "ConnectServerWmi") && | |
LoadDelegate(ref GetErrorInfo_f, hModule, "GetErrorInfo") && | |
LoadDelegate(ref Initialize_f, hModule, "Initialize")) | |
{ | |
// All required delegates were loaded. | |
Initialize_f(CompatSwitches.AllowIManagementObjectQI); | |
} | |
else | |
{ | |
LoadPlatformNotSupportedDelegates(SR.Format(SR.PlatformNotSupported_FrameworkUpdatedRequired, wminet_utilsPath)); | |
} |