The WMI interface cannot retrieve data of array type
haer
0
Reputation points
I encountered an error while calling the Method of classes in the WMI interface to retrieve array type data from BIOS. My MOF description file contains the following content:
[WMI,
Dynamic,
Provider("WmiProv"),
Locale("MS\\0x409"),
Description("Call BIOS Function through WMI"),
guid("{B66BC8B8-8DE4-4990-B8C8-F73DFF82FF9A}")
]
class OemWMIMethodC
{
[key, read]
string InstanceName;
[read] boolean Active;
[WmiMethodId(1),
Implemented,
read, write,
Description("OEM WMI Function")
] void OemWMIfunC([in, Description("Test2")] uint64 Data, [out, MAX(256)]uint8 u8Output[]);
};
The error message is as follows:
Invoke-CimMethod : Invalid object
At E:\test01.ps1:8 char:10
+ $r = Invoke-CimMethod -InputObject $i -MethodName OemWMIfun -Argu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (OemWMIMethod (I...0C14\EmdWmi_0"):CimInstance) [Invoke-CimMethod], CimExc
eption
+ FullyQualifiedErrorId : HRESULT 0x8004100f,Microsoft.Management.Infrastructure.CimCmdlets.InvokeCimMethodCommand
=== Results ===
[ERROR] Cannot index into a null array.
I ensured through debugging that the Method in the ASL file in the BIOS was executed to the Return (Buffer) step, and I tried to set the buffer size to 256, 80, 64, and 8, but this issue occurred. And when I change the data type defined in MOF from an array of type uin8 to uint64, it can be executed correctly and the data can be obtained. Why is this?
Windows development | Windows Driver Kit (WDK)
Sign in to answer