package com

import "github.com/zzl/go-com/com"

Index

Constants

const FAIL = Error(win32.E_FAIL)
const OK = Error(win32.S_OK)

Variables

var MuVtbl sync.Mutex

Functions

func AddImpl

func AddImpl(impl win32.IUnknownInterface) int32

func AddToScope

func AddToScope(value interface{}, scope ...*Scope)

func EnsureThreadCoInitialized

func EnsureThreadCoInitialized()

func Failed

func Failed(hr win32.HRESULT, logFail ...bool) bool

func HresultFromWin32

func HresultFromWin32(err win32.WIN32_ERROR) win32.HRESULT

func InitializeContext

func InitializeContext()

func Malloc

func Malloc(size uintptr) unsafe.Pointer

func MessageLoop

func MessageLoop()

func NewComObj

func NewComObj[T any, PT ComObjConstraint[T]](impl win32.IUnknownInterface) *T

func NewErrorOrNil

func NewErrorOrNil(hr win32.HRESULT) error

func PrintHr

func PrintHr(hr win32.HRESULT)

func QueryInterface

func QueryInterface[T QueryInterfaceResultType](pObj win32.IUnknownObject, scoped bool) T

func SetLastError

func SetLastError(err Error)

func Succeeded

func Succeeded(hr win32.HRESULT, logFail ...bool) bool

func Uninitialize

func Uninitialize()

func UninitializeContext

func UninitializeContext()

func WithScope

func WithScope(action func())

Types

type BStr

type BStr struct {
	// contains filtered or unexported fields
}

func NewBStr

func NewBStr(bs win32.BSTR) *BStr

func NewBStringFromStr

func NewBStringFromStr(str string) *BStr

func (*BStr) Addr

func (this *BStr) Addr() uintptr

func (*BStr) BSTR

func (this *BStr) BSTR() win32.BSTR

func (*BStr) Free

func (this *BStr) Free()

func (*BStr) PBSTR

func (this *BStr) PBSTR() *win32.BSTR

func (*BStr) String

func (this *BStr) String() string

func (*BStr) ToStringAndFree

func (this *BStr) ToStringAndFree() string

type Bstrs

type Bstrs struct {
	// contains filtered or unexported fields
}

func NewBStrs

func NewBStrs() *Bstrs

func (*Bstrs) Add

func (this *Bstrs) Add(str string) *BStr

func (*Bstrs) Dispose

func (this *Bstrs) Dispose()

type ComObjConstraint

type ComObjConstraint[T any] interface {
	ComObjInterface
	*T
}

type ComObjInterface

type ComObjInterface interface {
	AddRef() uintptr
	Release() uintptr

	GetVtbl() *win32.IUnknownVtbl
	GetIUnknownComObj() *IUnknownComObj
	GetSubComObjs() []ComObjInterface
	IID() *syscall.GUID
	AssignPpvObject(ppvObject unsafe.Pointer)
}

type ComObjLifecycleAware

type ComObjLifecycleAware interface {
	OnComObjCreate()
	OnComObjFree()
}

type Context

type Context struct {
	ID  int32 //could be reused
	TID uint32

	LastError *ErrorInfo
	// contains filtered or unexported fields
}

func GetContext

func GetContext() *Context

func (*Context) GetCurrentScope

func (this *Context) GetCurrentScope() *Scope

func (*Context) SetCurrentScope

func (this *Context) SetCurrentScope(s *Scope)

type Disposable

type Disposable interface {
	Dispose()
}

type Error

type Error win32.HRESULT

func NewError

func NewError(hr win32.HRESULT) Error

func (Error) Error

func (me Error) Error() string

func (Error) FAILED

func (me Error) FAILED() bool

func (Error) HRESULT

func (me Error) HRESULT() win32.HRESULT

type ErrorInfo

type ErrorInfo struct {
	Error       Error
	Source      string
	IID         syscall.GUID
	Description string
}

func GetLastErrorInfo

func GetLastErrorInfo() *ErrorInfo

func (*ErrorInfo) String

func (this *ErrorInfo) String() string

type Finalizable

type Finalizable interface {
	Finalize()
}

type IIDProvider

type IIDProvider interface {
	IID() *syscall.GUID
}

type IUnknownComObj

type IUnknownComObj struct {
	LpVtbl *win32.IUnknownVtbl

	Parent *IUnknownComObj
	// contains filtered or unexported fields
}

func (*IUnknownComObj) AddRef

func (this *IUnknownComObj) AddRef() uintptr

func (*IUnknownComObj) AssignPpvObject

func (this *IUnknownComObj) AssignPpvObject(ppvObject unsafe.Pointer)

func (*IUnknownComObj) BuildVtbl

func (this *IUnknownComObj) BuildVtbl(lock bool) *win32.IUnknownVtbl

func (*IUnknownComObj) GetIUnknown

func (this *IUnknownComObj) GetIUnknown() *win32.IUnknown

func (*IUnknownComObj) GetIUnknownComObj

func (this *IUnknownComObj) GetIUnknownComObj() *IUnknownComObj

func (*IUnknownComObj) GetSubComObjs

func (this *IUnknownComObj) GetSubComObjs() []ComObjInterface

func (*IUnknownComObj) GetVtbl

func (this *IUnknownComObj) GetVtbl() *win32.IUnknownVtbl

func (*IUnknownComObj) IID

func (this *IUnknownComObj) IID() *syscall.GUID

func (*IUnknownComObj) IUnknown

func (this *IUnknownComObj) IUnknown() *win32.IUnknown

func (*IUnknownComObj) Impl

func (this *IUnknownComObj) Impl() win32.IUnknownInterface

func (*IUnknownComObj) QueryInterface

func (this *IUnknownComObj) QueryInterface(riid *syscall.GUID, ppvObject unsafe.Pointer) uintptr

func (*IUnknownComObj) Release

func (this *IUnknownComObj) Release() uintptr

func (*IUnknownComObj) SetVtbl

func (this *IUnknownComObj) SetVtbl(vtbl *win32.IUnknownVtbl)

type IUnknownImpl

type IUnknownImpl struct {
	ComObj ComObjInterface
}

func (*IUnknownImpl) AddRef

func (this *IUnknownImpl) AddRef() uint32

func (*IUnknownImpl) AssignPpvObject

func (this *IUnknownImpl) AssignPpvObject(ppvObject unsafe.Pointer, iid ...*syscall.GUID) bool

func (*IUnknownImpl) GetComObj

func (this *IUnknownImpl) GetComObj() ComObjInterface

func (*IUnknownImpl) OnComObjCreate

func (this *IUnknownImpl) OnComObjCreate()

func (*IUnknownImpl) OnComObjFree

func (this *IUnknownImpl) OnComObjFree()

func (*IUnknownImpl) QueryInterface

func (this *IUnknownImpl) QueryInterface(riid *syscall.GUID, ppvObject unsafe.Pointer) win32.HRESULT

func (*IUnknownImpl) Release

func (this *IUnknownImpl) Release() uint32

func (*IUnknownImpl) SetComObj

func (this *IUnknownImpl) SetComObj(obj ComObjInterface)

type Initializable

type Initializable interface {
	Initialize()
}

type Initialized

type Initialized struct {
}

func Initialize

func Initialize() Initialized

func InitializeMt

func InitializeMt() Initialized

func (Initialized) Uninitialize

func (me Initialized) Uninitialize()

type QueryInterfaceResultType

type QueryInterfaceResultType interface {
	IIDProvider
	win32.IUnknownObject
}

type RealObjectAware

type RealObjectAware interface {
	SetRealObject(obj interface{})
}

type Scope

type Scope struct {
	ParentScope *Scope
	// contains filtered or unexported fields
}

func NewScope

func NewScope() *Scope

func (*Scope) Add

func (this *Scope) Add(pUnknown unsafe.Pointer)

func (*Scope) AddArray

func (this *Scope) AddArray(psa *win32.SAFEARRAY)

func (*Scope) AddBstr

func (this *Scope) AddBstr(bstr win32.BSTR)

func (*Scope) AddComPtr

func (this *Scope) AddComPtr(iunknownObj win32.IUnknownObject, addRef ...bool)

func (*Scope) AddVar

func (this *Scope) AddVar(pVar *win32.VARIANT)

func (*Scope) AddVarIfNeeded

func (this *Scope) AddVarIfNeeded(pVar *win32.VARIANT)

func (*Scope) Clear

func (this *Scope) Clear()

func (*Scope) Leave

func (this *Scope) Leave()

type UnknownClass

type UnknownClass struct {
	win32.IUnknown
}

func NewUnknownClass

func NewUnknownClass(pUnk *win32.IUnknown, scoped bool) *UnknownClass

func (*UnknownClass) Dispose

func (this *UnknownClass) Dispose()

type VariantCompatible

type VariantCompatible interface {
	AsVARIANT() *win32.VARIANT
}

Source Files

bstr.go context.go error.go impl.go scope.go types.go utils.go

Directories

PathSynopsis
com/comimpl
Version
v1.5.0 (latest)
Published
Jan 29, 2023
Platform
linux/amd64
Imports
8 packages
Last checked
3 months ago

Tools for package owners.