github.com/hspan/go-ole@v0.0.0/com_func.go (about) 1 // +build !windows 2 3 package ole 4 5 import ( 6 "time" 7 "unsafe" 8 ) 9 10 // coInitialize initializes COM library on current thread. 11 // 12 // MSDN documentation suggests that this function should not be called. Call 13 // CoInitializeEx() instead. The reason has to do with threading and this 14 // function is only for single-threaded apartments. 15 // 16 // That said, most users of the library have gotten away with just this 17 // function. If you are experiencing threading issues, then use 18 // CoInitializeEx(). 19 func coInitialize() error { 20 return NewError(E_NOTIMPL) 21 } 22 23 // coInitializeEx initializes COM library with concurrency model. 24 func coInitializeEx(coinit uint32) error { 25 return NewError(E_NOTIMPL) 26 } 27 28 // CoInitialize initializes COM library on current thread. 29 // 30 // MSDN documentation suggests that this function should not be called. Call 31 // CoInitializeEx() instead. The reason has to do with threading and this 32 // function is only for single-threaded apartments. 33 // 34 // That said, most users of the library have gotten away with just this 35 // function. If you are experiencing threading issues, then use 36 // CoInitializeEx(). 37 func CoInitialize(p uintptr) error { 38 return NewError(E_NOTIMPL) 39 } 40 41 // CoInitializeEx initializes COM library with concurrency model. 42 func CoInitializeEx(p uintptr, coinit uint32) error { 43 return NewError(E_NOTIMPL) 44 } 45 46 // CoUninitialize uninitializes COM Library. 47 func CoUninitialize() {} 48 49 // CoTaskMemFree frees memory pointer. 50 func CoTaskMemFree(memptr uintptr) {} 51 52 // CLSIDFromProgID retrieves Class Identifier with the given Program Identifier. 53 // 54 // The Programmatic Identifier must be registered, because it will be looked up 55 // in the Windows Registry. The registry entry has the following keys: CLSID, 56 // Insertable, Protocol and Shell 57 // (https://msdn.microsoft.com/en-us/library/dd542719(v=vs.85).aspx). 58 // 59 // programID identifies the class id with less precision and is not guaranteed 60 // to be unique. These are usually found in the registry under 61 // HKEY_LOCAL_MACHINE\SOFTWARE\Classes, usually with the format of 62 // "Program.Component.Version" with version being optional. 63 // 64 // CLSIDFromProgID in Windows API. 65 func CLSIDFromProgID(progId string) (*GUID, error) { 66 return nil, NewError(E_NOTIMPL) 67 } 68 69 // CLSIDFromString retrieves Class ID from string representation. 70 // 71 // This is technically the string version of the GUID and will convert the 72 // string to object. 73 // 74 // CLSIDFromString in Windows API. 75 func CLSIDFromString(str string) (*GUID, error) { 76 return nil, NewError(E_NOTIMPL) 77 } 78 79 // StringFromCLSID returns GUID formated string from GUID object. 80 func StringFromCLSID(clsid *GUID) (string, error) { 81 return "", NewError(E_NOTIMPL) 82 } 83 84 // IIDFromString returns GUID from program ID. 85 func IIDFromString(progId string) (*GUID, error) { 86 return nil, NewError(E_NOTIMPL) 87 } 88 89 // StringFromIID returns GUID formatted string from GUID object. 90 func StringFromIID(iid *GUID) (string, error) { 91 return "", NewError(E_NOTIMPL) 92 } 93 94 // CreateInstance of single uninitialized object with GUID. 95 func CreateInstance(clsid *GUID, iid *GUID) (*IUnknown, error) { 96 return nil, NewError(E_NOTIMPL) 97 } 98 99 // GetActiveObject retrieves pointer to active object. 100 func GetActiveObject(clsid *GUID, iid *GUID) (*IUnknown, error) { 101 return nil, NewError(E_NOTIMPL) 102 } 103 104 // VariantInit initializes variant. 105 func VariantInit(v *VARIANT) error { 106 return NewError(E_NOTIMPL) 107 } 108 109 // VariantClear clears value in Variant settings to VT_EMPTY. 110 func VariantClear(v *VARIANT) error { 111 return NewError(E_NOTIMPL) 112 } 113 114 // SysAllocString allocates memory for string and copies string into memory. 115 func SysAllocString(v string) *int16 { 116 u := int16(0) 117 return &u 118 } 119 120 // SysAllocStringLen copies up to length of given string returning pointer. 121 func SysAllocStringLen(v string) *int16 { 122 u := int16(0) 123 return &u 124 } 125 126 // SysFreeString frees string system memory. This must be called with SysAllocString. 127 func SysFreeString(v *int16) error { 128 return NewError(E_NOTIMPL) 129 } 130 131 // SysStringLen is the length of the system allocated string. 132 func SysStringLen(v *int16) uint32 { 133 return uint32(0) 134 } 135 136 // CreateStdDispatch provides default IDispatch implementation for IUnknown. 137 // 138 // This handles default IDispatch implementation for objects. It haves a few 139 // limitations with only supporting one language. It will also only return 140 // default exception codes. 141 func CreateStdDispatch(unk *IUnknown, v uintptr, ptinfo *IUnknown) (*IDispatch, error) { 142 return nil, NewError(E_NOTIMPL) 143 } 144 145 // CreateDispTypeInfo provides default ITypeInfo implementation for IDispatch. 146 // 147 // This will not handle the full implementation of the interface. 148 func CreateDispTypeInfo(idata *INTERFACEDATA) (*IUnknown, error) { 149 return nil, NewError(E_NOTIMPL) 150 } 151 152 // copyMemory moves location of a block of memory. 153 func copyMemory(dest unsafe.Pointer, src unsafe.Pointer, length uint32) {} 154 155 // GetUserDefaultLCID retrieves current user default locale. 156 func GetUserDefaultLCID() uint32 { 157 return uint32(0) 158 } 159 160 // GetMessage in message queue from runtime. 161 // 162 // This function appears to block. PeekMessage does not block. 163 func GetMessage(msg *Msg, hwnd uint32, MsgFilterMin uint32, MsgFilterMax uint32) (int32, error) { 164 return int32(0), NewError(E_NOTIMPL) 165 } 166 167 // DispatchMessage to window procedure. 168 func DispatchMessage(msg *Msg) int32 { 169 return int32(0) 170 } 171 172 func GetVariantDate(value uint64) (time.Time, error) { 173 return time.Now(), NewError(E_NOTIMPL) 174 }