Documentation ¶
Overview ¶
This package provides WindowsPortableDevice API.
Example ¶
IPortableDeviceManager
gowpd.Initialize() pPortableDeviceManager, err := gowpd.CreatePortableDeviceManager() if err != nil { panic(err) } deviceIDs, err := pPortableDeviceManager.GetDevices()
Warnings not solved
Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" ' unrecognized Warning: .drectve `/FAILIFMISMATCH:"_CRT_STDIO_ISO_WIDE_SPECIFIERS=0" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" ' unrecognized Warning: corrupt .drectve at end of def file
비주얼 스튜디오 에서 빌드시 추가되는 링크 옵션이라고 함. 말그대로 경고 이므로 무시해도 되는 듯 함.
Example (ContentEnumerate) ¶
package main import ( "github.com/rlj1202/go-wpd" "log" ) func RecursiveEnumerate(parentObjectID string, content *gowpd.IPortableDeviceContent) { enum, err := content.EnumObjects(parentObjectID) if err != nil { panic(err) } objectIDs := make([]string, 0) for { tmp, err := enum.Next(10) if err != nil { panic(err) } if len(tmp) == 0 { break } objectIDs = append(objectIDs, tmp...) } for _, objectID := range objectIDs { log.Println(objectID) } for _, objectID := range objectIDs { RecursiveEnumerate(objectID, content) } } func main() { gowpd.Initialize() mng, err := gowpd.CreatePortableDeviceManager() if err != nil { panic(err) } pClientInfo, err := gowpd.CreatePortableDeviceValues() if err != nil { panic(err) } pClientInfo.SetStringValue(gowpd.WPD_CLIENT_NAME, "libgowpd") pClientInfo.SetUnsignedIntegerValue(gowpd.WPD_CLIENT_MAJOR_VERSION, 1) pClientInfo.SetUnsignedIntegerValue(gowpd.WPD_CLIENT_MINOR_VERSION, 0) pClientInfo.SetUnsignedIntegerValue(gowpd.WPD_CLIENT_REVISION, 2) deviceIDs, err := mng.GetDevices() if err != nil { panic(err) } for _, deviceID := range deviceIDs { device, err := gowpd.CreatePortableDevice() if err != nil { panic(err) } err = device.Open(deviceID, pClientInfo) if err != nil { panic(err) } content, err := device.Content() if err != nil { panic(err) } RecursiveEnumerate(gowpd.WPD_DEVICE_OBJECT_ID, content) gowpd.FreeDeviceID(deviceID) } gowpd.Uninitialize() }
Output:
Example (DeleteFromDevice) ¶
gowpd.Initialize() mng, err := gowpd.CreatePortableDeviceManager() if err != nil { panic(err) } devices, err := mng.GetDevices() if err != nil { panic(err) } clientInfo, err := gowpd.CreatePortableDeviceValues() if err != nil { panic(err) } clientInfo.SetStringValue(gowpd.WPD_CLIENT_NAME, "libgowpd") clientInfo.SetUnsignedIntegerValue(gowpd.WPD_CLIENT_MAJOR_VERSION, 1) clientInfo.SetUnsignedIntegerValue(gowpd.WPD_CLIENT_MINOR_VERSION, 0) clientInfo.SetUnsignedIntegerValue(gowpd.WPD_CLIENT_REVISION, 2) // objectID which will be deleted from the device. targetObjectID := "F:\\test.txt" for _, id := range devices { portableDevice, err := gowpd.CreatePortableDevice() if err != nil { panic(err) } err = portableDevice.Open(id, clientInfo) if err != nil { panic(err) } content, err := portableDevice.Content() if err != nil { panic(err) } pObjectsToDelete, err := gowpd.CreatePortableDevicePropVariantCollection() pv := new(gowpd.PropVariant) pv.Init() pv.Set(targetObjectID) err = pObjectsToDelete.Add(pv) if err != nil { panic(err) } results, err := content.Delete(gowpd.PORTABLE_DEVICE_DELETE_NO_RECURSION, pObjectsToDelete) if err != nil { count, err := results.GetCount() if err != nil { panic(err) } log.Printf("Count: %d\n", count) result, err := results.GetAt(0) if err != nil { panic(err) } log.Printf("Type: %d\n", result.GetType()) if result.GetType() == gowpd.VT_ERROR { log.Printf("error: %#x\n", result.GetError()) } panic(err) } pv.Clear() gowpd.FreeDeviceID(id) } mng.Release() gowpd.Uninitialize()
Output:
Example (DeviceEnumerate) ¶
gowpd.Initialize() mng, err := gowpd.CreatePortableDeviceManager() if err != nil { panic(err) } deviceIDs, err := mng.GetDevices() if err != nil { panic(err) } for i, deviceID := range deviceIDs { friendlyName, err := mng.GetDeviceFriendlyName(deviceID) if err != nil { panic(err) } manufacturer, err := mng.GetDeviceManufacturer(deviceID) if err != nil { panic(err) } description, err := mng.GetDeviceDescription(deviceID) if err != nil { panic(err) } log.Printf("[%d]:\n", i) log.Printf("\tName: %s\n", friendlyName) log.Printf("\tManufacturer: %s\n", manufacturer) log.Printf("\tDescription: %s\n", description) gowpd.FreeDeviceID(deviceID) } gowpd.Uninitialize()
Output:
Example (TransferToDevice) ¶
gowpd.Initialize() mng, err := gowpd.CreatePortableDeviceManager() if err != nil { panic(err) } deviceIDs, err := mng.GetDevices() if err != nil { panic(err) } pClientInfo, err := gowpd.CreatePortableDeviceValues() if err != nil { panic(err) } pClientInfo.SetStringValue(gowpd.WPD_CLIENT_NAME, "libgowpd") pClientInfo.SetUnsignedIntegerValue(gowpd.WPD_CLIENT_MAJOR_VERSION, 1) pClientInfo.SetUnsignedIntegerValue(gowpd.WPD_CLIENT_MINOR_VERSION, 0) pClientInfo.SetUnsignedIntegerValue(gowpd.WPD_CLIENT_REVISION, 2) targetDeviceFriendlyName := "SANDISK " // objectId where the file will be transferred under. targetObjectID := "F:\\" for _, id := range deviceIDs { friendlyName, err := mng.GetDeviceFriendlyName(id) if err != nil { panic(err) } if friendlyName != targetDeviceFriendlyName { gowpd.FreeDeviceID(id) continue } pPortableDevice, err := gowpd.CreatePortableDevice() if err != nil { panic(err) } // Establish a connection err = pPortableDevice.Open(id, pClientInfo) if err != nil { panic(err) } // path to selected file to transfer to device. filePath := "E:\\RedLaboratory\\Media\\Picture\\result.png" filePath = "E:\\test.md" // open file as IStream. pFileStream, err := gowpd.SHCreateStreamOnFile(filePath, 0) if err != nil { panic(err) } // acquire properties needed to transfer file to device pObjectProperties, err := gowpd.GetRequiredPropertiesForContentType(gowpd.WPD_CONTENT_TYPE_IMAGE, targetObjectID, filePath, pFileStream) if err != nil { panic(err) } // get stream to device content, err := pPortableDevice.Content() if err != nil { panic(err) } pTempStream, cbTransferSize, err := content.CreateObjectWithPropertiesAndData(pObjectProperties) if err != nil { panic(err) } // convert pTempStream to PortableDeviceDataStream to use more method e.g newly created object id. _pFinalObjectDataStream, err := pTempStream.QueryInterface(gowpd.IID_IPortableDeviceDataStream) if err != nil { panic(err) } pFinalObjectDataStream := (*gowpd.IPortableDeviceDataStream)(_pFinalObjectDataStream) // copy data from pFileStream to pFinalObjectDataStream cbBytesWritten, err := gowpd.StreamCopy((*gowpd.IStream)(_pFinalObjectDataStream), pFileStream, cbTransferSize) if err != nil { panic(err) } // call commit method to notice device that transferring data is finished. err = pFinalObjectDataStream.Commit(0) if err != nil { panic(err) } newlyCreatedObjectID, err := pFinalObjectDataStream.GetObjectID() if err != nil { panic(err) } log.Printf("\"%s\" has been transferred to device successfully: %d\n", newlyCreatedObjectID, cbBytesWritten) // transferring is finished. release the deviceID. gowpd.FreeDeviceID(id) // release device interface too. pPortableDevice.Release() } for _, id := range deviceIDs { gowpd.FreeDeviceID(id) } gowpd.Uninitialize()
Output:
Example (TransferToPC) ¶
gowpd.Initialize() mng, err := gowpd.CreatePortableDeviceManager() if err != nil { panic(err) } deviceIDs, err := mng.GetDevices() if err != nil { panic(err) } clientInfo, err := gowpd.CreatePortableDeviceValues() if err != nil { panic(err) } clientInfo.SetStringValue(gowpd.WPD_CLIENT_NAME, "libgowpd") clientInfo.SetUnsignedIntegerValue(gowpd.WPD_CLIENT_MAJOR_VERSION, 1) clientInfo.SetUnsignedIntegerValue(gowpd.WPD_CLIENT_MINOR_VERSION, 0) clientInfo.SetUnsignedIntegerValue(gowpd.WPD_CLIENT_REVISION, 2) // object ID which will be transferred to PC. targetObjectID := "F:\\test.txt" // location where file will be transferred into. targetDestination := "E:\\test.txt" for _, id := range deviceIDs { portableDevice, err := gowpd.CreatePortableDevice() if err != nil { panic(err) } portableDevice.Open(id, clientInfo) content, err := portableDevice.Content() if err != nil { panic(err) } resources, err := content.Transfer() if err != nil { panic(err) } objectDataStream, optimalTransferSize, err := resources.GetStream(targetObjectID, gowpd.WPD_RESOURCE_DEFAULT, gowpd.STGM_READ) if err != nil { panic(err) } pFinalFileStream, err := gowpd.SHCreateStreamOnFile(targetDestination, gowpd.STGM_CREATE|gowpd.STGM_WRITE) if err != nil { panic(err) } totalBytesWritten, err := gowpd.StreamCopy(pFinalFileStream, objectDataStream, optimalTransferSize) if err != nil { panic(err) } err = pFinalFileStream.Commit(0) if err != nil { panic(err) } log.Printf("Total bytes written: %d\n", totalBytesWritten) gowpd.FreeDeviceID(id) portableDevice.Release() } mng.Release() gowpd.Uninitialize()
Output:
Index ¶
- Constants
- func CoCreateInstance(clsid CLSID, iid IID) (unsafe.Pointer, error)
- func FreeDeviceID(pnpDeviceID PnPDeviceID)
- func GetRequiredPropertiesForAllContentTypes(pObjectProperties *IPortableDeviceValues, parentObjectID, filePath string, ...) error
- func GetRequiredPropertiesForContactContentTypes(pObjectProperties *IPortableDeviceValues) error
- func GetRequiredPropertiesForImageContentTypes(pObjectProperties *IPortableDeviceValues) error
- func GetRequiredPropertiesForMusicContentTypes(pObjectProperties *IPortableDeviceValues) error
- func GetStringValue(pProperties *IPortableDeviceProperties, objectID string, key PropertyKey) (string, error)
- func Initialize() error
- func PropTest()
- func StreamCopy(pDestStream *IStream, pSourceStream *IStream, cbTransferSize uint32) (uint32, error)
- func Uninitialize()
- type CLSCTX
- type CLSID
- type DWORD
- type GUID
- type HRESULT
- type IEnumPortableDeviceObjectIDs
- type IID
- type IPortableDevice
- type IPortableDeviceCapabilities
- type IPortableDeviceContent
- func (pPortableDeviceContent *IPortableDeviceContent) CreateObjectWithPropertiesAndData(pValues *IPortableDeviceValues) (*IStream, uint32, error)
- func (pPortableDeviceContent *IPortableDeviceContent) Delete(options uint32, objectIDs *IPortableDevicePropVariantCollection) (*IPortableDevicePropVariantCollection, error)
- func (pPortableDeviceContent *IPortableDeviceContent) EnumObjects(parentObjectID string) (*IEnumPortableDeviceObjectIDs, error)
- func (pPortableDeviceContent *IPortableDeviceContent) Properties() (*IPortableDeviceProperties, error)
- func (pPortableDeviceContent *IPortableDeviceContent) Transfer() (*IPortableDeviceResources, error)
- type IPortableDeviceDataStream
- type IPortableDeviceEventCallback
- type IPortableDeviceKeyCollection
- type IPortableDeviceManager
- func (pPortableDeviceManager *IPortableDeviceManager) GetDeviceDescription(pnpDeviceID PnPDeviceID) (string, error)
- func (pPortableDeviceManager *IPortableDeviceManager) GetDeviceFriendlyName(pnpDeviceID PnPDeviceID) (string, error)
- func (pPortableDeviceManager *IPortableDeviceManager) GetDeviceManufacturer(pnpDeviceID PnPDeviceID) (string, error)
- func (pPortableDeviceManager *IPortableDeviceManager) GetDevices() ([]PnPDeviceID, error)
- func (pPortableDeviceManager *IPortableDeviceManager) Release()
- type IPortableDevicePropVariantCollection
- func (pPortableDevicePropVariantCollection *IPortableDevicePropVariantCollection) Add(value *PropVariant) error
- func (pPortableDevicePropVariantCollection *IPortableDevicePropVariantCollection) GetAt(index uint32) (*PropVariant, error)
- func (pPortableDevicePropVariantCollection *IPortableDevicePropVariantCollection) GetCount() (uint32, error)
- type IPortableDeviceProperties
- func (pPortableDeviceProperties *IPortableDeviceProperties) GetPropertyAttributes(objectID string, key PropertyKey) (*IPortableDeviceValues, error)
- func (pPortableDeviceProperties *IPortableDeviceProperties) GetValues(objectID string, keys *IPortableDeviceKeyCollection) (*IPortableDeviceValues, error)
- func (pPortableDeviceProperties *IPortableDeviceProperties) SetValues(objectID string, pValues *IPortableDeviceValues) error
- type IPortableDeviceResources
- type IPortableDeviceValues
- func (pPortableDeviceValues *IPortableDeviceValues) GetBoolValue(key PropertyKey) (bool, error)
- func (pPortableDeviceValues *IPortableDeviceValues) GetStringValue(key PropertyKey) (string, error)
- func (pPortableDeviceValues *IPortableDeviceValues) GetUnsignedIntegerValue(key PropertyKey) (uint32, error)
- func (pPortableDeviceValues *IPortableDeviceValues) QueryInterface(iid IID) (unsafe.Pointer, error)
- func (pPortableDeviceValues *IPortableDeviceValues) Release() error
- func (pPortableDeviceValues *IPortableDeviceValues) SetGuidValue(key PropertyKey, value GUID) error
- func (pPortableDeviceValues *IPortableDeviceValues) SetStringValue(key PropertyKey, value string) error
- func (pPortableDeviceValues *IPortableDeviceValues) SetUnsignedIntegerValue(key PropertyKey, value uint32) error
- func (pPortableDeviceValeus *IPortableDeviceValues) SetUnsignedLargeIntegerValue(key PropertyKey, value uint64) error
- type IPropertyStore
- type ISequentialStream
- type IStream
- func (pStream *IStream) Commit(dataFlag uint32) error
- func (pStream *IStream) QueryInterface(iid IID) (unsafe.Pointer, error)
- func (pStream *IStream) Read(buffer []byte) (uint32, error)
- func (pStream *IStream) Stat(statFlags uint32) (*StatStg, error)
- func (pStream *IStream) Write(buffer []byte) (uint32, error)
- type IUnknown
- type PnPDeviceID
- type PropVariant
- type PropertyKey
- type StatStg
- type ULONG
- type VARTYPE
- type WCHAR
Examples ¶
Constants ¶
const ( GENERIC_READ = C.GENERIC_READ & 0xffffffff // 0x80000000 GENERIC_WRITE = C.GENERIC_WRITE & 0xffffffff // 0x40000000 GENERIC_EXECUTE = C.GENERIC_EXECUTE & 0xffffffff // 0x20000000 GENERIC_ALL = C.GENERIC_ALL & 0xffffffff // 0x10000000 )
const ( STATFLAG_DEFAULT = C.STATFLAG_DEFAULT STATFLAG_NONAME = C.STATFLAG_NONAME STATFLAG_NOOPEN = C.STATFLAG_NOOPEN )
const ( STGM_READ = C.STGM_READ STGM_CREATE = C.STGM_CREATE STGM_WRITE = C.STGM_WRITE )
const ( PORTABLE_DEVICE_DELETE_NO_RECURSION uint32 = iota PORTABLE_DEVICE_DELETE_WITH_RECURSION )
const (
WPD_DEVICE_OBJECT_ID string = "DEVICE"
)
Variables ¶
This section is empty.
Functions ¶
func FreeDeviceID ¶
func FreeDeviceID(pnpDeviceID PnPDeviceID)
func GetRequiredPropertiesForAllContentTypes ¶
func GetRequiredPropertiesForAllContentTypes(pObjectProperties *IPortableDeviceValues, parentObjectID, filePath string, pFileStream *IStream) error
Set necessary properties for all content type.
func GetRequiredPropertiesForContactContentTypes ¶
func GetRequiredPropertiesForContactContentTypes(pObjectProperties *IPortableDeviceValues) error
Set properties for contact type.
func GetRequiredPropertiesForImageContentTypes ¶
func GetRequiredPropertiesForImageContentTypes(pObjectProperties *IPortableDeviceValues) error
Set properties for image type.
func GetRequiredPropertiesForMusicContentTypes ¶
func GetRequiredPropertiesForMusicContentTypes(pObjectProperties *IPortableDeviceValues) error
Set properties for music type.
func GetStringValue ¶
func GetStringValue(pProperties *IPortableDeviceProperties, objectID string, key PropertyKey) (string, error)
Reads a string property from the IPortableDeviceProperties interface and returns it as string.
func Initialize ¶
func Initialize() error
func StreamCopy ¶
func StreamCopy(pDestStream *IStream, pSourceStream *IStream, cbTransferSize uint32) (uint32, error)
Copy the data from pSourceStream to pDestStream. cbTransferSize is buffer size temporarily to store data.
func Uninitialize ¶
func Uninitialize()
Types ¶
type CLSCTX ¶
type CLSCTX int
C.CLSCTX
const ( CLSCTX_INPROC_SERVER CLSCTX = 1 << iota CLSCTX_INPROC_HANDLER CLSCTX_LOCAL_SERVER CLSCTX_INPROC_SERVER16 CLSCTX_REMOTE_SERVER CLSCTX_INPROC_HANDLER16 CLSCTX_RESERVED1 CLSCTX_RESERVED2 CLSCTX_RESERVED3 CLSCTX_RESERVED4 CLSCTX_NO_CODE_DOWNLOAD CLSCTX_RESERVED5 CLSCTX_NO_CUSTOM_MARSHAL CLSCTX_ENABLE_CODE_DOWNLOAD CLSCTX_NO_FAILURE_LOG CLSCTX_DISABLE_AAA CLSCTX_ENABLE_AAA CLSCTX_FROM_DEFAULT_CONTEXT CLSCTX_ACTIVATE_32_BIT_SERVER CLSCTX_ACTIVATE_64_BIT_SERVER CLSCTX_ENABLE_CLOAKING CLSCTX_APPCONTAINER CLSCTX_ACTIVATE_AAA_AS_IU CLSCTX_PS_DLL )
type GUID ¶
type GUID int
C.GUID
const ( WPD_CONTENT_TYPE_FUNCTIONAL_OBJECT GUID = iota WPD_CONTENT_TYPE_FOLDER WPD_CONTENT_TYPE_IMAGE WPD_CONTENT_TYPE_DOCUMENT WPD_CONTENT_TYPE_CONTACT WPD_CONTENT_TYPE_CONTACT_GROUP WPD_CONTENT_TYPE_AUDIO WPD_CONTENT_TYPE_VIDEO WPD_CONTENT_TYPE_TELEVISION WPD_CONTENT_TYPE_PLAYLIST WPD_CONTENT_TYPE_MIXED_CONTENT_ALBUM WPD_CONTENT_TYPE_AUDIO_ALBUM WPD_CONTENT_TYPE_IMAGE_ALBUM WPD_CONTENT_TYPE_VIDEO_ALBUM WPD_CONTENT_TYPE_MEMO WPD_CONTENT_TYPE_EMAIL WPD_CONTENT_TYPE_APPOINTMENT WPD_CONTENT_TYPE_TASK WPD_CONTENT_TYPE_PROGRAM WPD_CONTENT_TYPE_GENERIC_FILE WPD_CONTENT_TYPE_CALENDAR WPD_CONTENT_TYPE_GENERIC_MESSAGE WPD_CONTENT_TYPE_NETWORK_ASSOCIATION WPD_CONTENT_TYPE_CERTIFICATE WPD_CONTENT_TYPE_WIRELESS_PROFILE WPD_CONTENT_TYPE_MEDIA_CAST WPD_CONTENT_TYPE_SECTION WPD_CONTENT_TYPE_UNSPECIFIED WPD_CONTENT_TYPE_ALL WPD_OBJECT_FORMAT_EXIF WPD_OBJECT_FORMAT_WMA WPD_OBJECT_FORMAT_VCARD2 )
type HRESULT ¶
type HRESULT uint32
C.HRESULT
const ( S_OK HRESULT = C.S_OK & 0xffffffff // 0x00000000 S_FALSE HRESULT = C.S_FALSE & 0xffffffff // 0x00000001 E_ABORT HRESULT = C.E_ABORT & 0xffffffff // 0x80004004 E_ACCESSDENIED HRESULT = C.E_ACCESSDENIED & 0xffffffff // 0x80070005 E_FAIL HRESULT = C.E_FAIL & 0xffffffff // 0x80004005 E_HANDLE HRESULT = C.E_HANDLE & 0xffffffff // 0x80070006 ERROR_NOT_SUPPORTED HRESULT = C.ERROR_NOT_SUPPORTED & 0xffffffff // 0x80070032 E_INVALIDARG HRESULT = C.E_INVALIDARG & 0xffffffff // 0x80070057 E_NOINTERFACE HRESULT = C.E_NOINTERFACE & 0xffffffff // 0x80004002 E_NOTIMPL HRESULT = C.E_NOTIMPL & 0xffffffff // 0x80004001 E_OUTOFMEMORY HRESULT = C.E_OUTOFMEMORY & 0xffffffff // 0x8007000E E_POINTER HRESULT = C.E_POINTER & 0xffffffff // 0x80004003 E_UNEXPECTED HRESULT = C.E_UNEXPECTED & 0xffffffff // 0x8000FFFF CO_E_NOTINITIALIZED HRESULT = C.CO_E_NOTINITIALIZED & 0xffffffff // 0x800401f0 )
type IEnumPortableDeviceObjectIDs ¶
type IEnumPortableDeviceObjectIDs C.IEnumPortableDeviceObjectIDs
type IPortableDevice ¶
type IPortableDevice C.IPortableDevice
func CreatePortableDevice ¶
func CreatePortableDevice() (*IPortableDevice, error)
func (*IPortableDevice) Content ¶
func (pPortableDevice *IPortableDevice) Content() (*IPortableDeviceContent, error)
func (*IPortableDevice) Open ¶
func (pPortableDevice *IPortableDevice) Open(pnpDeviceID PnPDeviceID, pClientInfo *IPortableDeviceValues) error
func (*IPortableDevice) Release ¶
func (pPortableDevice *IPortableDevice) Release() error
type IPortableDeviceCapabilities ¶
type IPortableDeviceCapabilities C.IPortableDeviceCapabilities
type IPortableDeviceContent ¶
type IPortableDeviceContent C.IPortableDeviceContent
func (*IPortableDeviceContent) CreateObjectWithPropertiesAndData ¶
func (pPortableDeviceContent *IPortableDeviceContent) CreateObjectWithPropertiesAndData(pValues *IPortableDeviceValues) (*IStream, uint32, error)
TODO not finished
func (*IPortableDeviceContent) Delete ¶
func (pPortableDeviceContent *IPortableDeviceContent) Delete(options uint32, objectIDs *IPortableDevicePropVariantCollection) (*IPortableDevicePropVariantCollection, error)
func (*IPortableDeviceContent) EnumObjects ¶
func (pPortableDeviceContent *IPortableDeviceContent) EnumObjects(parentObjectID string) (*IEnumPortableDeviceObjectIDs, error)
TODO not finished parentObjectID: start from it.
func (*IPortableDeviceContent) Properties ¶
func (pPortableDeviceContent *IPortableDeviceContent) Properties() (*IPortableDeviceProperties, error)
func (*IPortableDeviceContent) Transfer ¶
func (pPortableDeviceContent *IPortableDeviceContent) Transfer() (*IPortableDeviceResources, error)
type IPortableDeviceDataStream ¶
type IPortableDeviceDataStream C.IPortableDeviceDataStream
func (*IPortableDeviceDataStream) Commit ¶
func (pPortableDeviceDataStream *IPortableDeviceDataStream) Commit(dataFlags uint32) error
func (*IPortableDeviceDataStream) GetObjectID ¶
func (pPortableDeviceDataStream *IPortableDeviceDataStream) GetObjectID() (string, error)
type IPortableDeviceEventCallback ¶
type IPortableDeviceEventCallback C.IPortableDeviceEventCallback
type IPortableDeviceKeyCollection ¶
type IPortableDeviceKeyCollection C.IPortableDeviceKeyCollection
func CreatePortableDeviceKeyCollection ¶
func CreatePortableDeviceKeyCollection() (*IPortableDeviceKeyCollection, error)
func (*IPortableDeviceKeyCollection) Add ¶
func (pPortableDeviceKeyCollection *IPortableDeviceKeyCollection) Add(key PropertyKey) error
type IPortableDeviceManager ¶
type IPortableDeviceManager C.IPortableDeviceManager
func CreatePortableDeviceManager ¶
func CreatePortableDeviceManager() (*IPortableDeviceManager, error)
func (*IPortableDeviceManager) GetDeviceDescription ¶
func (pPortableDeviceManager *IPortableDeviceManager) GetDeviceDescription(pnpDeviceID PnPDeviceID) (string, error)
func (*IPortableDeviceManager) GetDeviceFriendlyName ¶
func (pPortableDeviceManager *IPortableDeviceManager) GetDeviceFriendlyName(pnpDeviceID PnPDeviceID) (string, error)
func (*IPortableDeviceManager) GetDeviceManufacturer ¶
func (pPortableDeviceManager *IPortableDeviceManager) GetDeviceManufacturer(pnpDeviceID PnPDeviceID) (string, error)
func (*IPortableDeviceManager) GetDevices ¶
func (pPortableDeviceManager *IPortableDeviceManager) GetDevices() ([]PnPDeviceID, error)
func (*IPortableDeviceManager) Release ¶
func (pPortableDeviceManager *IPortableDeviceManager) Release()
type IPortableDevicePropVariantCollection ¶
type IPortableDevicePropVariantCollection C.IPortableDevicePropVariantCollection
func CreatePortableDevicePropVariantCollection ¶
func CreatePortableDevicePropVariantCollection() (*IPortableDevicePropVariantCollection, error)
func (*IPortableDevicePropVariantCollection) Add ¶
func (pPortableDevicePropVariantCollection *IPortableDevicePropVariantCollection) Add(value *PropVariant) error
func (*IPortableDevicePropVariantCollection) GetAt ¶
func (pPortableDevicePropVariantCollection *IPortableDevicePropVariantCollection) GetAt(index uint32) (*PropVariant, error)
func (*IPortableDevicePropVariantCollection) GetCount ¶
func (pPortableDevicePropVariantCollection *IPortableDevicePropVariantCollection) GetCount() (uint32, error)
type IPortableDeviceProperties ¶
type IPortableDeviceProperties C.IPortableDeviceProperties
func (*IPortableDeviceProperties) GetPropertyAttributes ¶
func (pPortableDeviceProperties *IPortableDeviceProperties) GetPropertyAttributes(objectID string, key PropertyKey) (*IPortableDeviceValues, error)
func (*IPortableDeviceProperties) GetValues ¶
func (pPortableDeviceProperties *IPortableDeviceProperties) GetValues(objectID string, keys *IPortableDeviceKeyCollection) (*IPortableDeviceValues, error)
func (*IPortableDeviceProperties) SetValues ¶
func (pPortableDeviceProperties *IPortableDeviceProperties) SetValues(objectID string, pValues *IPortableDeviceValues) error
TODO not finished
type IPortableDeviceResources ¶
type IPortableDeviceResources C.IPortableDeviceResources
func (*IPortableDeviceResources) GetStream ¶
func (pPortableDeviceResources *IPortableDeviceResources) GetStream(objectID string, key PropertyKey, mode uint32) (*IStream, uint32, error)
type IPortableDeviceValues ¶
type IPortableDeviceValues C.IPortableDeviceValues
func CreatePortableDeviceValues ¶
func CreatePortableDeviceValues() (*IPortableDeviceValues, error)
func GetRequiredPropertiesForContentType ¶
func GetRequiredPropertiesForContentType(contentType GUID, parentObjectID, filePath string, pFileStream *IStream) (*IPortableDeviceValues, error)
Return required properties for content type to transfer data. Properties which will be set necessarily are WPD_OBJECT_PARENT_ID, WPD_OBJECT_SIZE, WPD_OBJECT_ORIGINAL_FILE_NAME, WPD_OBJECT_NAME and properties which will be set optionally are WPD_OBJECT_CONTENT_TYPE, WPD_OBJECT_FORMAT.
func (*IPortableDeviceValues) GetBoolValue ¶
func (pPortableDeviceValues *IPortableDeviceValues) GetBoolValue(key PropertyKey) (bool, error)
func (*IPortableDeviceValues) GetStringValue ¶
func (pPortableDeviceValues *IPortableDeviceValues) GetStringValue(key PropertyKey) (string, error)
func (*IPortableDeviceValues) GetUnsignedIntegerValue ¶
func (pPortableDeviceValues *IPortableDeviceValues) GetUnsignedIntegerValue(key PropertyKey) (uint32, error)
func (*IPortableDeviceValues) QueryInterface ¶
func (pPortableDeviceValues *IPortableDeviceValues) QueryInterface(iid IID) (unsafe.Pointer, error)
func (*IPortableDeviceValues) Release ¶
func (pPortableDeviceValues *IPortableDeviceValues) Release() error
func (*IPortableDeviceValues) SetGuidValue ¶
func (pPortableDeviceValues *IPortableDeviceValues) SetGuidValue(key PropertyKey, value GUID) error
func (*IPortableDeviceValues) SetStringValue ¶
func (pPortableDeviceValues *IPortableDeviceValues) SetStringValue(key PropertyKey, value string) error
func (*IPortableDeviceValues) SetUnsignedIntegerValue ¶
func (pPortableDeviceValues *IPortableDeviceValues) SetUnsignedIntegerValue(key PropertyKey, value uint32) error
func (*IPortableDeviceValues) SetUnsignedLargeIntegerValue ¶
func (pPortableDeviceValeus *IPortableDeviceValues) SetUnsignedLargeIntegerValue(key PropertyKey, value uint64) error
type IPropertyStore ¶
type IPropertyStore C.IPropertyStore
type ISequentialStream ¶
type ISequentialStream C.ISequentialStream
type PropVariant ¶
type PropVariant C.PROPVARIANT
func (*PropVariant) Clear ¶
func (prop *PropVariant) Clear()
func (*PropVariant) GetError ¶
func (prop *PropVariant) GetError() uint32
func (*PropVariant) GetType ¶
func (prop *PropVariant) GetType() VARTYPE
func (*PropVariant) Init ¶
func (prop *PropVariant) Init()
func (*PropVariant) Set ¶
func (prop *PropVariant) Set(value interface{}) error
type PropertyKey ¶
type PropertyKey int
C.PROPERTYKEY
const ( WPD_CLIENT_NAME PropertyKey = iota WPD_CLIENT_MAJOR_VERSION WPD_CLIENT_MINOR_VERSION WPD_CLIENT_REVISION WPD_CLIENT_SECURITY_QUALITY_OF_SERVICE WPD_CLIENT_DESIRED_ACCESS WPD_OBJECT_PARENT_ID WPD_OBJECT_NAME WPD_OBJECT_PERSISTENT_UNIQUE_ID WPD_OBJECT_FORMAT WPD_OBJECT_CONTENT_TYPE WPD_OBJECT_SIZE WPD_OBJECT_ORIGINAL_FILE_NAME WPD_PROPERTY_ATTRIBUTE_FORM WPD_PROPERTY_ATTRIBUTE_CAN_READ WPD_PROPERTY_ATTRIBUTE_CAN_WRITE WPD_PROPERTY_ATTRIBUTE_CAN_DELETE WPD_PROPERTY_ATTRIBUTE_DEFAULT_VALUE WPD_PROPERTY_ATTRIBUTE_FAST_PROPERTY WPD_PROPERTY_ATTRIBUTE_RANGE_MIN WPD_PROPERTY_ATTRIBUTE_RANGE_MAX WPD_PROPERTY_ATTRIBUTE_RANGE_STEP WPD_PROPERTY_ATTRIBUTE_ENUMERATION_ELEMENTS WPD_PROPERTY_ATTRIBUTE_REGULAR_EXPRESSION WPD_PROPERTY_ATTRIBUTE_MAX_SIZE WPD_RESOURCE_DEFAULT )
type VARTYPE ¶
type VARTYPE uint16
C.VARENUM
const ( VT_EMPTY VARTYPE = 0 VT_NULL VARTYPE = 1 VT_I2 VARTYPE = 2 VT_I4 VARTYPE = 3 VT_R4 VARTYPE = 4 VT_R8 VARTYPE = 5 VT_CY VARTYPE = 6 VT_DATE VARTYPE = 7 VT_BSTR VARTYPE = 8 VT_DISPATCH VARTYPE = 9 VT_ERROR VARTYPE = 10 VT_BOOL VARTYPE = 11 VT_VARIANT VARTYPE = 12 VT_UNKNOWN VARTYPE = 13 VT_DECIMAL VARTYPE = 14 VT_I1 VARTYPE = 16 VT_UI1 VARTYPE = 17 VT_UI2 VARTYPE = 18 VT_UI4 VARTYPE = 19 VT_I8 VARTYPE = 20 VT_UI8 VARTYPE = 21 VT_INT VARTYPE = 22 VT_UINT VARTYPE = 23 VT_VOID VARTYPE = 24 VT_HRESULT VARTYPE = 25 VT_PTR VARTYPE = 26 VT_SAFEARRAY VARTYPE = 27 VT_CARRAY VARTYPE = 28 VT_USERDEFINED VARTYPE = 29 VT_LPSTR VARTYPE = 30 VT_LPWSTR VARTYPE = 31 VT_RECORD VARTYPE = 36 VT_INT_PTR VARTYPE = 37 VT_UINT_PTR VARTYPE = 38 VT_FILETIME VARTYPE = 64 VT_BLOB VARTYPE = 65 VT_STREAM VARTYPE = 66 VT_STORAGE VARTYPE = 67 VT_STREAMED_OBJECT VARTYPE = 68 VT_STORED_OBJECT VARTYPE = 69 VT_BLOB_OBJECT VARTYPE = 70 VT_CF VARTYPE = 71 VT_CLSID VARTYPE = 72 VT_VERSIONED_STREAM VARTYPE = 73 VT_BSTR_BLOB VARTYPE = 0xfff VT_VECTOR VARTYPE = 0x1000 VT_ARRAY VARTYPE = 0x2000 VT_BYREF VARTYPE = 0x4000 VT_RESERVED VARTYPE = 0x8000 VT_ILLEGAL VARTYPE = 0xffff VT_ILLEGALMASKED VARTYPE = 0xfff VT_TYPEMASK VARTYPE = 0xfff )