Documentation ¶
Overview ¶
Package shobjidl provides component object model bindings for the Windows Shell.
Index ¶
- type IPersist
- type IPersistStream
- type IPersistStreamVtbl
- type IPersistVtbl
- type ISequentialStream
- type ISequentialStreamVtbl
- type IShellLink
- func (v *IShellLink) GetDescription() (description string, err error)
- func (v *IShellLink) GetPath() (path string, err error)
- func (v *IShellLink) PersistStream() (*IPersistStream, error)
- func (v *IShellLink) SetDescription(description string) error
- func (v *IShellLink) SetPath(path string) error
- func (v *IShellLink) VTable() *IShellLinkVtbl
- type IShellLinkVtbl
- type IStream
- type IStreamVtbl
- type StreamBuffer
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPersist ¶
type IPersist struct {
ole.IUnknown
}
IPersist represents the component object model interface for peristable objects.
func (*IPersist) GetClassID ¶
GetClassID retrieves the class identifier of the class that is capable of manipulating the object's data.
https://docs.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-ipersist-getclassid
func (*IPersist) VTable ¶
func (v *IPersist) VTable() *IPersistVtbl
VTable returns the component object model virtual function table for the object.
type IPersistStream ¶
type IPersistStream struct {
IPersist
}
IPersistStream represents the component object model interface for marshaling binary representations of objects.
func (*IPersistStream) GetSizeMax ¶
func (v *IPersistStream) GetSizeMax() (size uint64, err error)
GetSizeMax returns the number of bytes needed to store a copy of the object.
https://docs.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-ipersiststream-getsizemax
func (*IPersistStream) IsDirty ¶
func (v *IPersistStream) IsDirty() (bool, error)
IsDirty returns true if the object holds unsaved data.
https://docs.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-ipersiststream-isdirty
func (*IPersistStream) Load ¶
func (v *IPersistStream) Load(stream *IStream) error
Load copies data from stream into v.
https://docs.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-ipersiststream-load
func (*IPersistStream) Save ¶
func (v *IPersistStream) Save(stream *IStream) error
Save copies data from v into stream.
https://docs.microsoft.com/en-us/windows/win32/api/objidl/nf-objidl-ipersiststream-save
func (*IPersistStream) VTable ¶
func (v *IPersistStream) VTable() *IPersistStreamVtbl
VTable returns the component object model virtual function table for the object.
type IPersistStreamVtbl ¶
type IPersistStreamVtbl struct { IPersistVtbl IsDirty uintptr Load uintptr Save uintptr GetSizeMax uintptr }
IPersistStreamVtbl represents the component object model virtual function table for the IPersistStream interface.
type IPersistVtbl ¶
type IPersistVtbl struct { ole.IUnknownVtbl GetClassID uintptr }
IPersistVtbl represents the component object model virtual function table for the IPersist interface.
type ISequentialStream ¶
type ISequentialStream struct {
ole.IUnknown
}
ISequentialStream represents the component object model interface for marshaling binary representations of objects.
func (*ISequentialStream) VTable ¶
func (v *ISequentialStream) VTable() *ISequentialStreamVtbl
VTable returns the component object model virtual function table for the object.
type ISequentialStreamVtbl ¶
ISequentialStreamVtbl represents the component object model virtual function table for the ISequentialStream interface.
type IShellLink ¶
type IShellLink struct {
ole.IUnknown
}
IShellLink represents the component object model interface for manipulation of shell links. It implements the IShellLinkW interface.
Example ¶
package main import ( "fmt" "github.com/gentlemanautomaton/winshell/shobjidl" "github.com/scjalliance/comshim" ) func main() { // Make sure COM is initialized for the duration of the work comshim.Add(1) defer comshim.Done() // Prepare a new IShellLink COM instance link, err := shobjidl.NewIShellLink() if err != nil { panic(err) } defer link.Release() // Set the path used by the shortcut if err := link.SetPath(`C:\Users`); err != nil { panic(err) } // Ask the link for an IPersistStream COM interface that we can use // to serialize its data stream, err := link.PersistStream() if err != nil { panic(err) } defer stream.Release() // Write the link's data to an in-memory buffer buf := shobjidl.NewStreamBuffer() if err := stream.Save(buf.IStream()); err != nil { panic(err) } // Write the link data to a file //ioutil.WriteFile("test.lnk", buf.Bytes(), 0644) fmt.Printf("Success") }
Output: Success
func NewIShellLink ¶
func NewIShellLink() (*IShellLink, error)
NewIShellLink creates a new instance of an IShellLink object.
func (*IShellLink) GetDescription ¶
func (v *IShellLink) GetDescription() (description string, err error)
GetDescription retrieves the description of the shell link.
func (*IShellLink) GetPath ¶
func (v *IShellLink) GetPath() (path string, err error)
GetPath retrieves the path of the shell link.
func (*IShellLink) PersistStream ¶
func (v *IShellLink) PersistStream() (*IPersistStream, error)
PersistStream returns an implementation of the IPersistStream interface, which can be used to retrieve a binary representation of the shell link.
It is the callers responsibility to call Release on the returned object when finished with it.
func (*IShellLink) SetDescription ¶
func (v *IShellLink) SetDescription(description string) error
SetDescription sets the description of the shell link.
func (*IShellLink) SetPath ¶
func (v *IShellLink) SetPath(path string) error
SetPath sets the path of the shell link.
func (*IShellLink) VTable ¶
func (v *IShellLink) VTable() *IShellLinkVtbl
VTable returns the component object model virtual function table for the object.
type IShellLinkVtbl ¶
type IShellLinkVtbl struct { ole.IUnknownVtbl GetPath uintptr GetIDList uintptr SetIDList uintptr GetDescription uintptr SetDescription uintptr GetWorkingDirectory uintptr SetWorkingDirectory uintptr GetArguments uintptr SetArguments uintptr GetHotkey uintptr SetHotkey uintptr GetShowCmd uintptr SetShowCmd uintptr GetIconLocation uintptr SetIconLocation uintptr SetRelativePath uintptr Resolve uintptr SetPath uintptr }
IShellLinkVtbl represents the component object model virtual function table for the IShellLinkW interface.
type IStream ¶
type IStream struct {
ISequentialStream
}
IStream represents the component object model interface for marshaling binary representations of objects.
func (*IStream) VTable ¶
func (v *IStream) VTable() *IStreamVtbl
VTable returns the component object model virtual function table for the object.
type IStreamVtbl ¶
type IStreamVtbl struct { ISequentialStreamVtbl Seek uintptr SetSize uintptr CopyTo uintptr Commit uintptr Revert uintptr LockRegion uintptr UnlockRegion uintptr Stat uintptr Clone uintptr }
IStreamVtbl represents the component object model virtual function table for the IStream interface.
type StreamBuffer ¶
type StreamBuffer struct {
// contains filtered or unexported fields
}
StreamBuffer is an in-memory implementation of a COM IStream.
func NewStreamBuffer ¶
func NewStreamBuffer() *StreamBuffer
NewStreamBuffer returns a stream buffer that implement IStream.
func (*StreamBuffer) Bytes ¶
func (b *StreamBuffer) Bytes() []byte
Bytes returns the content of the stream buffer.
func (*StreamBuffer) IStream ¶
func (b *StreamBuffer) IStream() *IStream
IStream returns a component object model representation of the stream.