com_func.go 5.2 KB

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