I am trying to extract data from MSNdis_CurrentPacketFilter, my code is as follows:
ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\WMI",
"SELECT NdisCurrentPacketFilter FROM MSNdis_CurrentPacketFilter");
foreach (ManagementObject queryObj in searcher.Get())
{
uint obj = (uint)queryObj["NdisCurrentPacketFilter"];
Int32 i32 = (Int32)obj;
}
As you can see, I drop the received object from NdisCurrentPacketFilter twice , which begs the question: why ??
If I try to apply it directly to int, for example:
Int32 i32 = (Int32)queryObj["NdisCurrentPacketFilter"];
He throws out InvalidCastException. Why is this?
source
share