| // +build windows |
| |
| package ole |
| |
| import ( |
| "syscall" |
| "unsafe" |
| ) |
| |
| type ITypeInfo struct { |
| IUnknown |
| } |
| |
| type ITypeInfoVtbl struct { |
| IUnknownVtbl |
| GetTypeAttr uintptr |
| GetTypeComp uintptr |
| GetFuncDesc uintptr |
| GetVarDesc uintptr |
| GetNames uintptr |
| GetRefTypeOfImplType uintptr |
| GetImplTypeFlags uintptr |
| GetIDsOfNames uintptr |
| Invoke uintptr |
| GetDocumentation uintptr |
| GetDllEntry uintptr |
| GetRefTypeInfo uintptr |
| AddressOfMember uintptr |
| CreateInstance uintptr |
| GetMops uintptr |
| GetContainingTypeLib uintptr |
| ReleaseTypeAttr uintptr |
| ReleaseFuncDesc uintptr |
| ReleaseVarDesc uintptr |
| } |
| |
| func (v *ITypeInfo) VTable() *ITypeInfoVtbl { |
| return (*ITypeInfoVtbl)(unsafe.Pointer(v.RawVTable)) |
| } |
| |
| func (v *ITypeInfo) GetTypeAttr() (tattr *TYPEATTR, err error) { |
| hr, _, _ := syscall.Syscall( |
| uintptr(v.VTable().GetTypeAttr), |
| 2, |
| uintptr(unsafe.Pointer(v)), |
| uintptr(unsafe.Pointer(&tattr)), |
| 0) |
| if hr != 0 { |
| err = NewError(hr) |
| } |
| return |
| } |