Merge pull request #45 from mholt/master
Implement CallMethod for calling WMI class methods
diff --git a/wmi.go b/wmi.go
index 528d0cf..107529d 100644
--- a/wmi.go
+++ b/wmi.go
@@ -364,7 +364,7 @@
}
defer prop.Clear()
- if prop.Value() == nil {
+ if prop.VT == 0x1 { //VT_NULL
continue
}
@@ -466,7 +466,7 @@
}
f.Set(fArr)
}
- case reflect.Uint8:
+ case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
safeArray := prop.ToArray()
if safeArray != nil {
arr := safeArray.ToValueArray()
@@ -477,6 +477,17 @@
}
f.Set(fArr)
}
+ case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
+ safeArray := prop.ToArray()
+ if safeArray != nil {
+ arr := safeArray.ToValueArray()
+ fArr := reflect.MakeSlice(f.Type(), len(arr), len(arr))
+ for i, v := range arr {
+ s := fArr.Index(i)
+ s.SetInt(reflect.ValueOf(v).Int())
+ }
+ f.Set(fArr)
+ }
default:
return &ErrFieldMismatch{
StructType: of.Type(),