WMI – Executing methods on WHEAErrorInjectionMethods results in generic failure/missing parameters?

  com, windows, wmi

I’ll just start off by saying I’m new to the WMI/COM world and windows desktop development in general. I’m running into a problem calling a method on the WHEAErrorInjectionMethods class, and I’ve hit this obstacle trying C++, powershell, and even just trying out the Windows Management Instrumentation Tester (wbemtest.exe a.k.a. "WMI Test Tool"). For now, I’d just like to focus on calling this method in the WMI Test Tool and getting that working as the errors are consistent.

I’m trying to execute the GetErrorInjectionCapabilitiesRtn method which takes 0 input arguments. Microsoft provides a C++ snippet on how to do this: https://docs.microsoft.com/en-us/windows-hardware/drivers/whea/getting-error-injection-capabilities . There are couple of bugs in this source compared to the latest version of the Windows 10 SDK (I’m using version 10.0.19041.0 of the SDK), but given the example I’m inclined to believe it is at least possible to call these methods. I’ve tried this on both on Windows 10 Pro 64-bit 20H2 and also a fresh VM install of W10 Enterprise 20H2 using Hyper-V Manager’s quick create to no success.

The namespace that WHEAErrorInjectionMethods exists in is "rootwmi". I’m signed in under an Administrator account. Here’s a screenshot of my connection config with WMI Test Tool elevated to run as an administrator:

WMI Test Tool Connection Settings

And here’s an image after the connection has been established (I’ve also checked the "Enable All Privileges" option):

WMI Test Tool Established Connection

From here I search for the class ("Open Class…") by typing in "WHEAErrorInjectionMethods" and WMI Test Tool finds it no problem. You can see the "GetErrorInectionCapabilitiesRtn" method in the "Methods" pane.

WHEAErrorInjectionMethods object editor

Clicking on "Instances" reveals just one instance of this class running shown here:

The class instance | Class instance object editor

No methods though so I’m thinking these methods are static but let’s copy the path just in case:


Back on the main page of the WMI Test Tool app after a connection has been established, I chose the "Execute Method…" option and just type in "WHEAErrorInjectionMethods" for the object path and get the method I want to run. Execute!… Fail:

Execute failure – 0x8004102f

Facility: WMI
Description: Invalid method Parameter(s)

That’s weird. There are no input parameters. Okay, let’s try the instance of this class then… different fail? I guess it makes sense though if GetErrorInjectionCapabilitiesRtn is static.

Another failure – 0x80041001

Number: 0x80041001
Facility: WMI
Description: Generic failure

WMI error constants have these listed as WBEM_E_INVALID_METHOD_PARAMETERS and WBEM_E_NOT_FOUND respectively.

The event viewer for WMI-Activity/Operational is not much help:

Id = {00000000-0000-0000-0000-000000000000}; ClientMachine = WINDEV2101EVAL; User = WINDEV2101EVALUser; ClientProcessId = 5008; Component = Unknown; Operation = Start IWbemServices::ExecMethod - rootwmi : WHEAErrorInjectionMethods::GetErrorInjectionCapabilitiesRtn; ResultCode = 0x8004102F; PossibleCause = Unknown

Id = {00000000-0000-0000-0000-000000000000}; ClientMachine = WINDEV2101EVAL; User = WINDEV2101EVALUser; ClientProcessId = 5008; Component = Unknown; Operation = Start IWbemServices::ExecMethod - rootwmi : WHEAErrorInjectionMethods.InstanceName="WHEA_WMI_PROVIDER0"::GetErrorInjectionCapabilitiesRtn; ResultCode = 0x80041001; PossibleCause = Unknown

The "WMI-Activity/Debug" section doesn’t contain anything. "WMI-Activity/Trace" pretty much just mirrors the Operational section, but I can absolutely post those if you think it’ll help.

Anyway, I’ve tried everything that I could think of but there’s got to be something I’m missing here. If you could help in this matter I’d very much appreciate it. Thanks.

Source: Windows Questions