forked from cerc-io/plugeth
05ade19302
* 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
34 lines
720 B
Go
34 lines
720 B
Go
// +build windows
|
|
|
|
package ole
|
|
|
|
import (
|
|
"unsafe"
|
|
)
|
|
|
|
func safeArrayFromByteSlice(slice []byte) *SafeArray {
|
|
array, _ := safeArrayCreateVector(VT_UI1, 0, uint32(len(slice)))
|
|
|
|
if array == nil {
|
|
panic("Could not convert []byte to SAFEARRAY")
|
|
}
|
|
|
|
for i, v := range slice {
|
|
safeArrayPutElement(array, int64(i), uintptr(unsafe.Pointer(&v)))
|
|
}
|
|
return array
|
|
}
|
|
|
|
func safeArrayFromStringSlice(slice []string) *SafeArray {
|
|
array, _ := safeArrayCreateVector(VT_BSTR, 0, uint32(len(slice)))
|
|
|
|
if array == nil {
|
|
panic("Could not convert []string to SAFEARRAY")
|
|
}
|
|
// SysAllocStringLen(s)
|
|
for i, v := range slice {
|
|
safeArrayPutElement(array, int64(i), uintptr(unsafe.Pointer(SysAllocStringLen(v))))
|
|
}
|
|
return array
|
|
}
|