cliprdr

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

cliprdr_windows.go

dataobject.go

Index

Constants

View Source
const (
	CB_MONITOR_READY         = 0x0001
	CB_FORMAT_LIST           = 0x0002
	CB_FORMAT_LIST_RESPONSE  = 0x0003
	CB_FORMAT_DATA_REQUEST   = 0x0004
	CB_FORMAT_DATA_RESPONSE  = 0x0005
	CB_TEMP_DIRECTORY        = 0x0006
	CB_CLIP_CAPS             = 0x0007
	CB_FILECONTENTS_REQUEST  = 0x0008
	CB_FILECONTENTS_RESPONSE = 0x0009
	CB_LOCK_CLIPDATA         = 0x000A
	CB_UNLOCK_CLIPDATA       = 0x000B
)
View Source
const (
	CB_RESPONSE_OK   = 0x0001
	CB_RESPONSE_FAIL = 0x0002
	CB_ASCII_NAMES   = 0x0004
)
View Source
const (
	FILECONTENTS_SIZE  = 0x00000001
	FILECONTENTS_RANGE = 0x00000002
)
View Source
const (
	/* CLIPRDR_GENERAL_CAPABILITY.generalFlags */
	CB_USE_LONG_FORMAT_NAMES     = 0x00000002
	CB_STREAM_FILECLIP_ENABLED   = 0x00000004
	CB_FILECLIP_NO_FILE_PATHS    = 0x00000008
	CB_CAN_LOCK_CLIPDATA         = 0x00000010
	CB_HUGE_FILE_SUPPORT_ENABLED = 0x00000020
)
View Source
const (
	/* CLIPRDR_GENERAL_CAPABILITY.version */
	CB_CAPS_VERSION_1 = 0x00000001
	CB_CAPS_VERSION_2 = 0x00000002
)
View Source
const (
	FD_CLSID      = 0x00000001
	FD_SIZEPOINT  = 0x00000002
	FD_ATTRIBUTES = 0x00000004
	FD_CREATETIME = 0x00000008
	FD_ACCESSTIME = 0x00000010
	FD_WRITESTIME = 0x00000020
	FD_FILESIZE   = 0x00000040
	FD_PROGRESSUI = 0x00004000
	FD_LINKUI     = 0x00008000
)
View Source
const (
	CB_FORMAT_HTML             = 0xD010
	CB_FORMAT_PNG              = 0xD011
	CB_FORMAT_JPEG             = 0xD012
	CB_FORMAT_GIF              = 0xD013
	CB_FORMAT_TEXTURILIST      = 0xD014
	CB_FORMAT_GNOMECOPIEDFILES = 0xD015
	CB_FORMAT_MATECOPIEDFILES  = 0xD016
)
View Source
const (
	CFSTR_SHELLIDLIST         = "Shell IDList Array"
	CFSTR_SHELLIDLISTOFFSET   = "Shell Object Offsets"
	CFSTR_NETRESOURCES        = "Net Resource"
	CFSTR_FILECONTENTS        = "FileContents"
	CFSTR_FILENAMEA           = "FileName"
	CFSTR_FILENAMEMAPA        = "FileNameMap"
	CFSTR_FILEDESCRIPTORA     = "FileGroupDescriptor"
	CFSTR_INETURLA            = "UniformResourceLocator"
	CFSTR_SHELLURL            = CFSTR_INETURLA
	CFSTR_FILENAMEW           = "FileNameW"
	CFSTR_FILENAMEMAPW        = "FileNameMapW"
	CFSTR_FILEDESCRIPTORW     = "FileGroupDescriptorW"
	CFSTR_INETURLW            = "UniformResourceLocatorW"
	CFSTR_PRINTERGROUP        = "PrinterFriendlyName"
	CFSTR_INDRAGLOOP          = "InShellDragLoop"
	CFSTR_PASTESUCCEEDED      = "Paste Succeeded"
	CFSTR_PERFORMEDDROPEFFECT = "Performed DropEffect"
	CFSTR_PREFERREDDROPEFFECT = "Preferred DropEffect"
)
View Source
const (
	CF_TEXT         = 1
	CF_BITMAP       = 2
	CF_METAFILEPICT = 3
	CF_SYLK         = 4
	CF_DIF          = 5
	CF_TIFF         = 6
	CF_OEMTEXT      = 7
	CF_DIB          = 8
	CF_PALETTE      = 9
	CF_PENDATA      = 10
	CF_RIFF         = 11
	CF_WAVE         = 12
	CF_UNICODETEXT  = 13
	CF_ENHMETAFILE  = 14
	CF_HDROP        = 15
	CF_LOCALE       = 16
	CF_DIBV5        = 17
	CF_MAX          = 18
)
View Source
const (
	WM_CLIPRDR_MESSAGE = (w32.WM_USER + 156)
	OLE_SETCLIPBOARD   = 1
)
View Source
const (
	/* File attribute flags */
	FILE_SHARE_READ   = 0x00000001
	FILE_SHARE_WRITE  = 0x00000002
	FILE_SHARE_DELETE = 0x00000004

	FILE_ATTRIBUTE_READONLY            = 0x00000001
	FILE_ATTRIBUTE_HIDDEN              = 0x00000002
	FILE_ATTRIBUTE_SYSTEM              = 0x00000004
	FILE_ATTRIBUTE_DIRECTORY           = 0x00000010
	FILE_ATTRIBUTE_ARCHIVE             = 0x00000020
	FILE_ATTRIBUTE_DEVICE              = 0x00000040
	FILE_ATTRIBUTE_NORMAL              = 0x00000080
	FILE_ATTRIBUTE_TEMPORARY           = 0x00000100
	FILE_ATTRIBUTE_SPARSE_FILE         = 0x00000200
	FILE_ATTRIBUTE_REPARSE_POINT       = 0x00000400
	FILE_ATTRIBUTE_COMPRESSED          = 0x00000800
	FILE_ATTRIBUTE_OFFLINE             = 0x00001000
	FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 0x00002000
	FILE_ATTRIBUTE_ENCRYPTED           = 0x00004000
	FILE_ATTRIBUTE_INTEGRITY_STREAM    = 0x00008000
	FILE_ATTRIBUTE_VIRTUAL             = 0x00010000
	FILE_ATTRIBUTE_NO_SCRUB_DATA       = 0x00020000
	FILE_ATTRIBUTE_EA                  = 0x00040000
)
View Source
const (
	S_OK                 = 0x00000000
	E_UNEXPECTED         = 0x8000FFFF
	E_NOTIMPL            = 0x80004001
	E_OUTOFMEMORY        = 0x8007000E
	E_INVALIDARG         = 0x80070057
	E_NOINTERFACE        = 0x80004002
	E_POINTER            = 0x80004003
	E_HANDLE             = 0x80070006
	E_ABORT              = 0x80004004
	E_FAIL               = 0x80004005
	E_ACCESSDENIED       = 0x80070005
	E_PENDING            = 0x8000000A
	E_ADVISENOTSUPPORTED = 0x80040003
	E_FORMATETC          = 0x80040064
	CO_E_CLASSSTRING     = 0x800401F3
)
View Source
const (
	TYMED_NULL     = 0x0
	TYMED_HGLOBAL  = 0x1
	TYMED_FILE     = 0x2
	TYMED_ISTREAM  = 0x4
	TYMED_ISTORAGE = 0x8
	TYMED_GDI      = 0x10
	TYMED_MFPICT   = 0x20
	TYMED_ENHMF    = 0x40
)
View Source
const (
	STREAM_SEEK_SET = 0
	STREAM_SEEK_CUR = 1
	STREAM_SEEK_END = 2
)
View Source
const (
	STATFLAG_DEFAULT = 0
	STATFLAG_NONAME  = 1
	STATFLAG_NOOPEN  = 2
)
View Source
const (
	STG_E_INSUFFICIENTMEMORY = 0x80030008
	STG_E_INVALIDFLAG        = 0x800300FF
)
View Source
const (
	STGTY_STORAGE   = 1
	STGTY_STREAM    = 2
	STGTY_LOCKBYTES = 3
	STGTY_PROPERTY  = 4
)
View Source
const (
	LOCK_WRITE     = 1
	LOCK_EXCLUSIVE = 2
	LOCK_ONLYONCE  = 4
)
View Source
const (
	GENERIC_READ    = 0x80000000
	GENERIC_WRITE   = 0x40000000
	GENERIC_EXECUTE = 0x20000000
)
View Source
const (
	CB_CAPSTYPE_GENERAL = 0x0001
)
View Source
const (
	CB_CAPSTYPE_GENERAL_LEN = 12
)
View Source
const DVASPECT_CONTENT = 0x1

Variables

View Source
var (
	IID_IDataObject    = win.GUID{0x10e, 0, 0, [8]byte{0xc0, 0, 0, 0, 0, 0, 0, 0x46}}
	IID_IUnknown       = win.GUID{0x000, 0, 0, [8]byte{0xc0, 0, 0, 0, 0, 0, 0, 0x46}}
	IID_IEnumFORMATETC = win.GUID{0x103, 0, 0, [8]byte{0xc0, 0, 0, 0, 0, 0, 0, 0x46}}
	IID_IStream        = win.GUID{0x00c, 0, 0, [8]byte{0xc0, 0, 0, 0, 0, 0, 0, 0x46}}
)

Functions

func ClipWatcher

func ClipWatcher(c *CliprdrClient)

func CloseClipboard

func CloseClipboard() bool

func CountClipboardFormats

func CountClipboardFormats() int32

func EmptyClipboard

func EmptyClipboard() bool

func EnumClipboardFormats

func EnumClipboardFormats(formatId uint32) uint32

func GetClipboardData

func GetClipboardData(formatId uint32) string

func GetClipboardFormatName

func GetClipboardFormatName(id uint32) string

func GetFileInfo

func GetFileInfo(sys interface{}) (uint32, []byte, uint32, uint32)

func GetFileNames

func GetFileNames() []string

func GlobalLock

func GlobalLock(hMem uintptr) uintptr

func GlobalSize

func GlobalSize(hMem uintptr) win.SIZE_T

func GlobalUnlock

func GlobalUnlock(hMem uintptr)

func HmemAlloc

func HmemAlloc(data []byte) uintptr

func IsClipboardFormatAvailable

func IsClipboardFormatAvailable(id uint32) bool

func IsClipboardOwner

func IsClipboardOwner(h win.HWND) bool

func OleIsCurrentClipboard

func OleIsCurrentClipboard(dataObject *IDataObject) bool

func OleSetClipboard

func OleSetClipboard(dataObject *IDataObject) bool

func OpenClipboard

func OpenClipboard(hwnd uintptr) bool

func RegisterClipboardFormat

func RegisterClipboardFormat(format string) uint32

func SetClipboardData

func SetClipboardData(formatId uint32, hmem uintptr) bool

Types

type ClipboardFormats

type ClipboardFormats uint16

type CliprdrCapabilitiesPDU

type CliprdrCapabilitiesPDU struct {
	CCapabilitiesSets uint16                        `struc:"little,sizeof=CapabilitySets"`
	Pad1              uint16                        `struc:"little"`
	CapabilitySets    []CliprdrGeneralCapabilitySet `struc:"little"`
}

type CliprdrCapabilitySets

type CliprdrCapabilitySets struct {
	CapabilitySetType uint16 `struc:"little"`
	LengthCapability  uint16 `struc:"little"`
	Version           uint32 `struc:"little"`
	GeneralFlags      uint32 `struc:"little"`
}

type CliprdrClient

type CliprdrClient struct {
	Files []FileDescriptor

	Control
	// contains filtered or unexported fields
}

func NewCliprdrClient

func NewCliprdrClient() *CliprdrClient

func (*CliprdrClient) GetType

func (c *CliprdrClient) GetType() (string, uint32)

func (*CliprdrClient) Process

func (c *CliprdrClient) Process(s []byte)

func (*CliprdrClient) Send

func (c *CliprdrClient) Send(s []byte) (int, error)

func (*CliprdrClient) Sender

func (c *CliprdrClient) Sender(f core.ChannelSender)

type CliprdrCtrlClipboardData

type CliprdrCtrlClipboardData struct {
	ClipDataId uint32
}

lock or unlock

type CliprdrFileContentsRequest

type CliprdrFileContentsRequest struct {
	StreamId      uint32 `struc:"little"`
	Lindex        uint32 `struc:"little"`
	DwFlags       uint32 `struc:"little"`
	NPositionLow  uint32 `struc:"little"`
	NPositionHigh uint32 `struc:"little"`
	CbRequested   uint32 `struc:"little"`
	ClipDataId    uint32 `struc:"little"`
}

file contents

func FileContentsSizeRequest

func FileContentsSizeRequest(i uint32) *CliprdrFileContentsRequest

type CliprdrFileContentsResponse

type CliprdrFileContentsResponse struct {
	StreamId      uint32
	CbRequested   uint32
	RequestedData []byte
}

func (*CliprdrFileContentsResponse) Unpack

func (resp *CliprdrFileContentsResponse) Unpack(b []byte)

type CliprdrFormat

type CliprdrFormat struct {
	FormatId   uint32
	FormatName string
}

format list

func GetFormatList

func GetFormatList(hwnd uintptr) []CliprdrFormat

type CliprdrFormatDataRequest

type CliprdrFormatDataRequest struct {
	RequestedFormatId uint32
}

format data

type CliprdrFormatDataResponse

type CliprdrFormatDataResponse struct {
	RequestedFormatData []byte
}

type CliprdrFormatList

type CliprdrFormatList struct {
	NumFormats uint32
	Formats    []CliprdrFormat
}

type CliprdrGeneralCapabilitySet

type CliprdrGeneralCapabilitySet struct {
	CapabilitySetType   uint16 `struc:"little"`
	CapabilitySetLength uint16 `struc:"little"`
	Version             uint32 `struc:"little"`
	GeneralFlags        uint32 `struc:"little"`
}

type CliprdrMonitorReady

type CliprdrMonitorReady struct {
}

type CliprdrPDUHeader

type CliprdrPDUHeader struct {
	MsgType  uint16 `struc:"little"`
	MsgFlags uint16 `struc:"little"`
	DataLen  uint32 `struc:"little"`
}

func NewCliprdrPDUHeader

func NewCliprdrPDUHeader(mType, flags uint16, ln uint32) *CliprdrPDUHeader

type CliprdrTempDirectory

type CliprdrTempDirectory struct {
	SzTempDir []byte `struc:"[260]byte"`
}

temp dir

type Control

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

func (*Control) SendCliprdrMessage

func (c *Control) SendCliprdrMessage()

type DROPFILES

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

type DataInstance

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

func (*DataInstance) AddRef

func (i *DataInstance) AddRef() uintptr

func (*DataInstance) DAdvise

func (i *DataInstance) DAdvise(formatEtc *FORMATETC, advf uint32, pAdvSink uintptr, pdwConnection *uint32) uintptr

func (*DataInstance) DUnadvise

func (i *DataInstance) DUnadvise(dwDirection uint32) uintptr

func (*DataInstance) EnumDAdvise

func (i *DataInstance) EnumDAdvise(ppenumAdvise uintptr) uintptr

func (*DataInstance) EnumFormatEtc

func (i *DataInstance) EnumFormatEtc(dwDirection uint32, ppenumFormatEtc **IEnumFORMATETC) uintptr

func (*DataInstance) GetCanonicalFormatEtc

func (i *DataInstance) GetCanonicalFormatEtc(informatEtc, outformatEtc *FORMATETC) uintptr

func (*DataInstance) GetData

func (i *DataInstance) GetData(formatEtc *FORMATETC, medium *STGMEDIUM) uintptr

func (*DataInstance) GetDataHere

func (i *DataInstance) GetDataHere(formatEtc *FORMATETC, medium *STGMEDIUM) uintptr

func (*DataInstance) QueryGetData

func (i *DataInstance) QueryGetData(formatEtc *FORMATETC) uintptr

func (*DataInstance) QueryInterface

func (i *DataInstance) QueryInterface(riid win.REFGUID, ppvObject *uintptr) uintptr

func (*DataInstance) Release

func (i *DataInstance) Release() uintptr

func (*DataInstance) SetData

func (i *DataInstance) SetData(formatEtc *FORMATETC, medium *STGMEDIUM, r bool) uintptr

type DwFlags

type DwFlags uint32

type EnumInstance

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

func (*EnumInstance) AddRef

func (i *EnumInstance) AddRef() uintptr

func (*EnumInstance) Clone

func (i *EnumInstance) Clone(ppEnum **IEnumFORMATETC) uintptr

func (*EnumInstance) Next

func (i *EnumInstance) Next(celt uint32, rgelt *FORMATETC, pceltFetched *uint32) uintptr

func (*EnumInstance) QueryInterface

func (i *EnumInstance) QueryInterface(riid win.REFGUID, ppvObject *uintptr) uintptr

func (*EnumInstance) Release

func (i *EnumInstance) Release() uintptr

func (*EnumInstance) Reset

func (i *EnumInstance) Reset() uintptr

func (*EnumInstance) Skip

func (i *EnumInstance) Skip(celt uint32) uintptr

type FORMATETC

type FORMATETC struct {
	CFormat        uint32
	DvTargetDevice uintptr
	Aspect         uint32
	Index          int32
	Tymed          uint32
}

type FileDescriptor

type FileDescriptor struct {
	Flags          uint32   `struc:"little"`
	Clsid          [16]byte `struc:"little"`
	Sizel          [8]byte  `struc:"little"`
	Pointl         [8]byte  `struc:"little"`
	FileAttributes uint32   `struc:"little"`
	CreationTime   [8]byte  `struc:"little"`
	LastAccessTime [8]byte  `struc:"little"`
	LastWriteTime  []byte   `struc:"[8]byte"` //8
	FileSizeHigh   uint32   `struc:"little"`
	FileSizeLow    uint32   `struc:"little"`
	FileName       []byte   `struc:"[512]byte"`
}

type FileGroupDescriptor

type FileGroupDescriptor struct {
	CItems uint32           `struc:"little"`
	Fgd    []FileDescriptor `struc:"sizefrom=CItems"`
}

func (*FileGroupDescriptor) Unpack

func (f *FileGroupDescriptor) Unpack(b []byte) error

type GeneralFlags

type GeneralFlags uint32

type HRESULT

type HRESULT uintptr

func (HRESULT) Error

func (hr HRESULT) Error() string

type IDataObject

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

func CreateDataObject

func CreateDataObject(c *CliprdrClient) *IDataObject

func OleGetClipboard

func OleGetClipboard() *IDataObject

func (*IDataObject) EnumFormatEtc

func (obj *IDataObject) EnumFormatEtc(direction uint32, pIEnumFORMATETC **IEnumFORMATETC) error

func (*IDataObject) GetData

func (obj *IDataObject) GetData(formatEtc *FORMATETC, medium *STGMEDIUM) error

func (*IDataObject) GetDataHere

func (obj *IDataObject) GetDataHere(formatEtc *FORMATETC, medium *STGMEDIUM) error

func (*IDataObject) QueryGetData

func (obj *IDataObject) QueryGetData(formatEtc *FORMATETC) error

func (*IDataObject) Release

func (obj *IDataObject) Release() error

type IEnumFORMATETC

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

func (*IEnumFORMATETC) Next

func (obj *IEnumFORMATETC) Next(formatEtc []FORMATETC, celtFetched *uint32) error

func (*IEnumFORMATETC) Release

func (obj *IEnumFORMATETC) Release() error

type ISequentialStreamVtbl

type ISequentialStreamVtbl struct {
	Read  uintptr
	Write uintptr
	// contains filtered or unexported fields
}

type IStream

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

func (*IStream) Close

func (obj *IStream) Close() error

func (*IStream) Read

func (obj *IStream) Read(buffer []byte) (int, error)

func (*IStream) Release

func (obj *IStream) Release() error

type IStreamVtbl

type IStreamVtbl struct {
	ISequentialStreamVtbl
	Seek         uintptr
	SetSize      uintptr
	CopyTo       uintptr
	Commit       uintptr
	Revert       uintptr
	LockRegion   uintptr
	UnlockRegion uintptr
	Stat         uintptr
	Clone        uintptr
}

type IUnknown

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

func (*IUnknown) Release

func (obj *IUnknown) Release() error

type LARGE_INTEGER

type LARGE_INTEGER struct {
	QuadPart int64
}

func (*LARGE_INTEGER) HighPart

func (l *LARGE_INTEGER) HighPart() *int32

func (*LARGE_INTEGER) LowPart

func (l *LARGE_INTEGER) LowPart() *uint32

type MsgFlags

type MsgFlags uint16

type MsgType

type MsgType uint16

type STATSTG

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

type STGMEDIUM

type STGMEDIUM struct {
	Tymed          uint32
	UnionMember    uintptr
	PUnkForRelease *IUnknown
}

func (STGMEDIUM) Bytes

func (m STGMEDIUM) Bytes() ([]byte, error)

func (STGMEDIUM) Release

func (m STGMEDIUM) Release()

func (STGMEDIUM) Stream

func (m STGMEDIUM) Stream() (*IStream, error)

type StreamInstance

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

func (*StreamInstance) AddRef

func (i *StreamInstance) AddRef() uintptr

func (*StreamInstance) Clone

func (i *StreamInstance) Clone(ppstm **IStream) uintptr

func (*StreamInstance) Commit

func (i *StreamInstance) Commit(grfCommitFlags uint32) uintptr

func (*StreamInstance) CopyTo

func (i *StreamInstance) CopyTo(pstm *IStream, cb ULARGE_INTEGER, cbRead, cbWritten *ULARGE_INTEGER) uintptr

func (*StreamInstance) LockRegion

func (i *StreamInstance) LockRegion(libOffset, cb ULARGE_INTEGER, dwLockType uint32) uintptr

func (*StreamInstance) QueryInterface

func (i *StreamInstance) QueryInterface(riid win.REFGUID, ppvObject *uintptr) uintptr

func (*StreamInstance) Read

func (i *StreamInstance) Read(pv uintptr, cb uint32, cbRead *uint32) uintptr

func (*StreamInstance) Release

func (i *StreamInstance) Release() uintptr

func (*StreamInstance) Revert

func (i *StreamInstance) Revert() uintptr

func (*StreamInstance) Seek

func (i *StreamInstance) Seek(dlibMove LARGE_INTEGER, dwOrigin uint32, plibNewPosition *ULARGE_INTEGER) uintptr

func (*StreamInstance) SetSize

func (i *StreamInstance) SetSize(libNewSize ULARGE_INTEGER) uintptr

func (*StreamInstance) Stat

func (i *StreamInstance) Stat(pstatstg *STATSTG, grfStatFlag uint32) uintptr

func (*StreamInstance) UnlockRegion

func (i *StreamInstance) UnlockRegion(libOffset, cb ULARGE_INTEGER, dwLockType uint32) uintptr

func (*StreamInstance) Write

func (i *StreamInstance) Write(pv uintptr, cb uint32, cbWritten *uint32) uintptr

type ULARGE_INTEGER

type ULARGE_INTEGER struct {
	QuadPart uint64
}

func (*ULARGE_INTEGER) HighPart

func (l *ULARGE_INTEGER) HighPart() *uint32

func (*ULARGE_INTEGER) LowPart

func (l *ULARGE_INTEGER) LowPart() *uint32

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL