plugeth/vendor/github.com/go-ole/go-ole/iinspectable_windows.go
Kurkó Mihály 05ade19302 dashboard: CPU, memory, diskIO and traffic on the footer (#15950)
* dashboard: footer, deep state update

* dashboard: resolve asset path

* dashboard: prevent state update on every reconnection

* dashboard: fix linter issue

* dashboard, cmd: minor UI fix, include commit hash

* dashboard: gitCommit renamed to commit

* dashboard: move the geth version to the right, make commit optional

* dashboard: memory, traffic and CPU on footer

* dashboard: fix merge

* dashboard: CPU, diskIO on footer

* dashboard: rename variables, use group declaration

* dashboard: docs
2018-01-23 22:51:04 +02:00

73 lines
1.4 KiB
Go

// +build windows
package ole
import (
"bytes"
"encoding/binary"
"reflect"
"syscall"
"unsafe"
)
func (v *IInspectable) GetIids() (iids []*GUID, err error) {
var count uint32
var array uintptr
hr, _, _ := syscall.Syscall(
v.VTable().GetIIds,
3,
uintptr(unsafe.Pointer(v)),
uintptr(unsafe.Pointer(&count)),
uintptr(unsafe.Pointer(&array)))
if hr != 0 {
err = NewError(hr)
return
}
defer CoTaskMemFree(array)
iids = make([]*GUID, count)
byteCount := count * uint32(unsafe.Sizeof(GUID{}))
slicehdr := reflect.SliceHeader{Data: array, Len: int(byteCount), Cap: int(byteCount)}
byteSlice := *(*[]byte)(unsafe.Pointer(&slicehdr))
reader := bytes.NewReader(byteSlice)
for i := range iids {
guid := GUID{}
err = binary.Read(reader, binary.LittleEndian, &guid)
if err != nil {
return
}
iids[i] = &guid
}
return
}
func (v *IInspectable) GetRuntimeClassName() (s string, err error) {
var hstring HString
hr, _, _ := syscall.Syscall(
v.VTable().GetRuntimeClassName,
2,
uintptr(unsafe.Pointer(v)),
uintptr(unsafe.Pointer(&hstring)),
0)
if hr != 0 {
err = NewError(hr)
return
}
s = hstring.String()
DeleteHString(hstring)
return
}
func (v *IInspectable) GetTrustLevel() (level uint32, err error) {
hr, _, _ := syscall.Syscall(
v.VTable().GetTrustLevel,
2,
uintptr(unsafe.Pointer(v)),
uintptr(unsafe.Pointer(&level)),
0)
if hr != 0 {
err = NewError(hr)
}
return
}