first commit
This commit is contained in:
79
windows/storage/streams/buffer.go
Normal file
79
windows/storage/streams/buffer.go
Normal file
@ -0,0 +1,79 @@
|
||||
// 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 SignatureBuffer string = "rc(Windows.Storage.Streams.Buffer;{905a0fe0-bc53-11df-8c49-001e4fc686da})"
|
||||
|
||||
type Buffer struct {
|
||||
ole.IUnknown
|
||||
}
|
||||
|
||||
func (impl *Buffer) GetCapacity() (uint32, error) {
|
||||
itf := impl.MustQueryInterface(ole.NewGUID(GUIDIBuffer))
|
||||
defer itf.Release()
|
||||
v := (*IBuffer)(unsafe.Pointer(itf))
|
||||
return v.GetCapacity()
|
||||
}
|
||||
|
||||
func (impl *Buffer) GetLength() (uint32, error) {
|
||||
itf := impl.MustQueryInterface(ole.NewGUID(GUIDIBuffer))
|
||||
defer itf.Release()
|
||||
v := (*IBuffer)(unsafe.Pointer(itf))
|
||||
return v.GetLength()
|
||||
}
|
||||
|
||||
func (impl *Buffer) SetLength(value uint32) error {
|
||||
itf := impl.MustQueryInterface(ole.NewGUID(GUIDIBuffer))
|
||||
defer itf.Release()
|
||||
v := (*IBuffer)(unsafe.Pointer(itf))
|
||||
return v.SetLength(value)
|
||||
}
|
||||
|
||||
const GUIDiBufferFactory string = "71af914d-c10f-484b-bc50-14bc623b3a27"
|
||||
const SignatureiBufferFactory string = "{71af914d-c10f-484b-bc50-14bc623b3a27}"
|
||||
|
||||
type iBufferFactory struct {
|
||||
ole.IInspectable
|
||||
}
|
||||
|
||||
type iBufferFactoryVtbl struct {
|
||||
ole.IInspectableVtbl
|
||||
|
||||
BufferCreate uintptr
|
||||
}
|
||||
|
||||
func (v *iBufferFactory) VTable() *iBufferFactoryVtbl {
|
||||
return (*iBufferFactoryVtbl)(unsafe.Pointer(v.RawVTable))
|
||||
}
|
||||
|
||||
func BufferCreate(capacity uint32) (*Buffer, error) {
|
||||
inspectable, err := ole.RoGetActivationFactory("Windows.Storage.Streams.Buffer", ole.NewGUID(GUIDiBufferFactory))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
v := (*iBufferFactory)(unsafe.Pointer(inspectable))
|
||||
|
||||
var out *Buffer
|
||||
hr, _, _ := syscall.SyscallN(
|
||||
v.VTable().BufferCreate,
|
||||
uintptr(unsafe.Pointer(v)), // this
|
||||
uintptr(capacity), // in uint32
|
||||
uintptr(unsafe.Pointer(&out)), // out Buffer
|
||||
)
|
||||
|
||||
if hr != 0 {
|
||||
return nil, ole.NewError(hr)
|
||||
}
|
||||
|
||||
return out, nil
|
||||
}
|
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
|
||||
}
|
48
windows/storage/streams/datawriter.go
Normal file
48
windows/storage/streams/datawriter.go
Normal file
@ -0,0 +1,48 @@
|
||||
// Code generated by winrt-go-gen. DO NOT EDIT.
|
||||
|
||||
//go:build windows
|
||||
|
||||
//nolint:all
|
||||
package streams
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/go-ole/go-ole"
|
||||
"github.com/saltosystems/winrt-go/windows/foundation"
|
||||
)
|
||||
|
||||
const SignatureDataWriter string = "rc(Windows.Storage.Streams.DataWriter;{64b89265-d341-4922-b38a-dd4af8808c4e})"
|
||||
|
||||
type DataWriter struct {
|
||||
ole.IUnknown
|
||||
}
|
||||
|
||||
func NewDataWriter() (*DataWriter, error) {
|
||||
inspectable, err := ole.RoActivateInstance("Windows.Storage.Streams.DataWriter")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return (*DataWriter)(unsafe.Pointer(inspectable)), nil
|
||||
}
|
||||
|
||||
func (impl *DataWriter) WriteBytes(valueSize uint32, value []uint8) error {
|
||||
itf := impl.MustQueryInterface(ole.NewGUID(GUIDIDataWriter))
|
||||
defer itf.Release()
|
||||
v := (*IDataWriter)(unsafe.Pointer(itf))
|
||||
return v.WriteBytes(valueSize, value)
|
||||
}
|
||||
|
||||
func (impl *DataWriter) DetachBuffer() (*IBuffer, error) {
|
||||
itf := impl.MustQueryInterface(ole.NewGUID(GUIDIDataWriter))
|
||||
defer itf.Release()
|
||||
v := (*IDataWriter)(unsafe.Pointer(itf))
|
||||
return v.DetachBuffer()
|
||||
}
|
||||
|
||||
func (impl *DataWriter) Close() error {
|
||||
itf := impl.MustQueryInterface(ole.NewGUID(foundation.GUIDIClosable))
|
||||
defer itf.Release()
|
||||
v := (*foundation.IClosable)(unsafe.Pointer(itf))
|
||||
return v.Close()
|
||||
}
|
76
windows/storage/streams/ibuffer.go
Normal file
76
windows/storage/streams/ibuffer.go
Normal file
@ -0,0 +1,76 @@
|
||||
// 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 GUIDIBuffer string = "905a0fe0-bc53-11df-8c49-001e4fc686da"
|
||||
const SignatureIBuffer string = "{905a0fe0-bc53-11df-8c49-001e4fc686da}"
|
||||
|
||||
type IBuffer struct {
|
||||
ole.IInspectable
|
||||
}
|
||||
|
||||
type IBufferVtbl struct {
|
||||
ole.IInspectableVtbl
|
||||
|
||||
GetCapacity uintptr
|
||||
GetLength uintptr
|
||||
SetLength uintptr
|
||||
}
|
||||
|
||||
func (v *IBuffer) VTable() *IBufferVtbl {
|
||||
return (*IBufferVtbl)(unsafe.Pointer(v.RawVTable))
|
||||
}
|
||||
|
||||
func (v *IBuffer) GetCapacity() (uint32, error) {
|
||||
var out uint32
|
||||
hr, _, _ := syscall.SyscallN(
|
||||
v.VTable().GetCapacity,
|
||||
uintptr(unsafe.Pointer(v)), // this
|
||||
uintptr(unsafe.Pointer(&out)), // out uint32
|
||||
)
|
||||
|
||||
if hr != 0 {
|
||||
return 0, ole.NewError(hr)
|
||||
}
|
||||
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (v *IBuffer) GetLength() (uint32, error) {
|
||||
var out uint32
|
||||
hr, _, _ := syscall.SyscallN(
|
||||
v.VTable().GetLength,
|
||||
uintptr(unsafe.Pointer(v)), // this
|
||||
uintptr(unsafe.Pointer(&out)), // out uint32
|
||||
)
|
||||
|
||||
if hr != 0 {
|
||||
return 0, ole.NewError(hr)
|
||||
}
|
||||
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (v *IBuffer) SetLength(value uint32) error {
|
||||
hr, _, _ := syscall.SyscallN(
|
||||
v.VTable().SetLength,
|
||||
uintptr(unsafe.Pointer(v)), // this
|
||||
uintptr(value), // in uint32
|
||||
)
|
||||
|
||||
if hr != 0 {
|
||||
return ole.NewError(hr)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
71
windows/storage/streams/idatareader.go
Normal file
71
windows/storage/streams/idatareader.go
Normal file
@ -0,0 +1,71 @@
|
||||
// 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 GUIDIDataReader string = "e2b50029-b4c1-4314-a4b8-fb813a2f275e"
|
||||
const SignatureIDataReader string = "{e2b50029-b4c1-4314-a4b8-fb813a2f275e}"
|
||||
|
||||
type IDataReader struct {
|
||||
ole.IInspectable
|
||||
}
|
||||
|
||||
type IDataReaderVtbl struct {
|
||||
ole.IInspectableVtbl
|
||||
|
||||
GetUnconsumedBufferLength uintptr
|
||||
GetUnicodeEncoding uintptr
|
||||
SetUnicodeEncoding uintptr
|
||||
GetByteOrder uintptr
|
||||
SetByteOrder uintptr
|
||||
GetInputStreamOptions uintptr
|
||||
SetInputStreamOptions uintptr
|
||||
ReadByte uintptr
|
||||
ReadBytes uintptr
|
||||
ReadBuffer uintptr
|
||||
ReadBoolean uintptr
|
||||
ReadGuid uintptr
|
||||
ReadInt16 uintptr
|
||||
ReadInt32 uintptr
|
||||
ReadInt64 uintptr
|
||||
ReadUInt16 uintptr
|
||||
ReadUInt32 uintptr
|
||||
ReadUInt64 uintptr
|
||||
ReadSingle uintptr
|
||||
ReadDouble uintptr
|
||||
ReadString uintptr
|
||||
ReadDateTime uintptr
|
||||
ReadTimeSpan uintptr
|
||||
LoadAsync uintptr
|
||||
DetachBuffer uintptr
|
||||
DetachStream uintptr
|
||||
}
|
||||
|
||||
func (v *IDataReader) VTable() *IDataReaderVtbl {
|
||||
return (*IDataReaderVtbl)(unsafe.Pointer(v.RawVTable))
|
||||
}
|
||||
|
||||
func (v *IDataReader) ReadBytes(valueSize uint32) ([]uint8, error) {
|
||||
var value []uint8 = make([]uint8, valueSize)
|
||||
hr, _, _ := syscall.SyscallN(
|
||||
v.VTable().ReadBytes,
|
||||
uintptr(unsafe.Pointer(v)), // this
|
||||
uintptr(valueSize), // in uint32
|
||||
uintptr(unsafe.Pointer(&value[0])), // out uint8
|
||||
)
|
||||
|
||||
if hr != 0 {
|
||||
return nil, ole.NewError(hr)
|
||||
}
|
||||
|
||||
return value, nil
|
||||
}
|
86
windows/storage/streams/idatawriter.go
Normal file
86
windows/storage/streams/idatawriter.go
Normal file
@ -0,0 +1,86 @@
|
||||
// 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 GUIDIDataWriter string = "64b89265-d341-4922-b38a-dd4af8808c4e"
|
||||
const SignatureIDataWriter string = "{64b89265-d341-4922-b38a-dd4af8808c4e}"
|
||||
|
||||
type IDataWriter struct {
|
||||
ole.IInspectable
|
||||
}
|
||||
|
||||
type IDataWriterVtbl struct {
|
||||
ole.IInspectableVtbl
|
||||
|
||||
GetUnstoredBufferLength uintptr
|
||||
GetUnicodeEncoding uintptr
|
||||
SetUnicodeEncoding uintptr
|
||||
GetByteOrder uintptr
|
||||
SetByteOrder uintptr
|
||||
WriteByte uintptr
|
||||
WriteBytes uintptr
|
||||
WriteBuffer uintptr
|
||||
WriteBufferRange uintptr
|
||||
WriteBoolean uintptr
|
||||
WriteGuid uintptr
|
||||
WriteInt16 uintptr
|
||||
WriteInt32 uintptr
|
||||
WriteInt64 uintptr
|
||||
WriteUInt16 uintptr
|
||||
WriteUInt32 uintptr
|
||||
WriteUInt64 uintptr
|
||||
WriteSingle uintptr
|
||||
WriteDouble uintptr
|
||||
WriteDateTime uintptr
|
||||
WriteTimeSpan uintptr
|
||||
WriteString uintptr
|
||||
MeasureString uintptr
|
||||
StoreAsync uintptr
|
||||
FlushAsync uintptr
|
||||
DetachBuffer uintptr
|
||||
DetachStream uintptr
|
||||
}
|
||||
|
||||
func (v *IDataWriter) VTable() *IDataWriterVtbl {
|
||||
return (*IDataWriterVtbl)(unsafe.Pointer(v.RawVTable))
|
||||
}
|
||||
|
||||
func (v *IDataWriter) WriteBytes(valueSize uint32, value []uint8) error {
|
||||
hr, _, _ := syscall.SyscallN(
|
||||
v.VTable().WriteBytes,
|
||||
uintptr(unsafe.Pointer(v)), // this
|
||||
uintptr(valueSize), // in uint32
|
||||
uintptr(unsafe.Pointer(&value[0])), // in uint8
|
||||
)
|
||||
|
||||
if hr != 0 {
|
||||
return ole.NewError(hr)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *IDataWriter) DetachBuffer() (*IBuffer, error) {
|
||||
var out *IBuffer
|
||||
hr, _, _ := syscall.SyscallN(
|
||||
v.VTable().DetachBuffer,
|
||||
uintptr(unsafe.Pointer(v)), // this
|
||||
uintptr(unsafe.Pointer(&out)), // out IBuffer
|
||||
)
|
||||
|
||||
if hr != 0 {
|
||||
return nil, ole.NewError(hr)
|
||||
}
|
||||
|
||||
return out, nil
|
||||
}
|
Reference in New Issue
Block a user