first commit
This commit is contained in:
65
windows/storage/streams/datareader.go
Normal file
65
windows/storage/streams/datareader.go
Normal file
@ -0,0 +1,65 @@
|
||||
// Code generated by winrt-go-gen. DO NOT EDIT.
|
||||
|
||||
//go:build windows
|
||||
|
||||
//nolint:all
|
||||
package streams
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"github.com/go-ole/go-ole"
|
||||
)
|
||||
|
||||
const SignatureDataReader string = "rc(Windows.Storage.Streams.DataReader;{e2b50029-b4c1-4314-a4b8-fb813a2f275e})"
|
||||
|
||||
type DataReader struct {
|
||||
ole.IUnknown
|
||||
}
|
||||
|
||||
func (impl *DataReader) ReadBytes(valueSize uint32) ([]uint8, error) {
|
||||
itf := impl.MustQueryInterface(ole.NewGUID(GUIDIDataReader))
|
||||
defer itf.Release()
|
||||
v := (*IDataReader)(unsafe.Pointer(itf))
|
||||
return v.ReadBytes(valueSize)
|
||||
}
|
||||
|
||||
const GUIDiDataReaderStatics string = "11fcbfc8-f93a-471b-b121-f379e349313c"
|
||||
const SignatureiDataReaderStatics string = "{11fcbfc8-f93a-471b-b121-f379e349313c}"
|
||||
|
||||
type iDataReaderStatics struct {
|
||||
ole.IInspectable
|
||||
}
|
||||
|
||||
type iDataReaderStaticsVtbl struct {
|
||||
ole.IInspectableVtbl
|
||||
|
||||
DataReaderFromBuffer uintptr
|
||||
}
|
||||
|
||||
func (v *iDataReaderStatics) VTable() *iDataReaderStaticsVtbl {
|
||||
return (*iDataReaderStaticsVtbl)(unsafe.Pointer(v.RawVTable))
|
||||
}
|
||||
|
||||
func DataReaderFromBuffer(buffer *IBuffer) (*DataReader, error) {
|
||||
inspectable, err := ole.RoGetActivationFactory("Windows.Storage.Streams.DataReader", ole.NewGUID(GUIDiDataReaderStatics))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
v := (*iDataReaderStatics)(unsafe.Pointer(inspectable))
|
||||
|
||||
var out *DataReader
|
||||
hr, _, _ := syscall.SyscallN(
|
||||
v.VTable().DataReaderFromBuffer,
|
||||
uintptr(unsafe.Pointer(v)), // this
|
||||
uintptr(unsafe.Pointer(buffer)), // in IBuffer
|
||||
uintptr(unsafe.Pointer(&out)), // out DataReader
|
||||
)
|
||||
|
||||
if hr != 0 {
|
||||
return nil, ole.NewError(hr)
|
||||
}
|
||||
|
||||
return out, nil
|
||||
}
|
Reference in New Issue
Block a user