| 19 | |
| 20 | |
| 21 | class IGlobalInterfaceTable(IUnknown): |
| 22 | _iid_ = GUID("{00000146-0000-0000-C000-000000000046}") |
| 23 | _methods_ = [ |
| 24 | STDMETHOD( |
| 25 | HRESULT, |
| 26 | "RegisterInterfaceInGlobal", |
| 27 | [POINTER(IUnknown), POINTER(GUID), POINTER(DWORD)], |
| 28 | ), |
| 29 | STDMETHOD(HRESULT, "RevokeInterfaceFromGlobal", [DWORD]), |
| 30 | STDMETHOD( |
| 31 | HRESULT, |
| 32 | "GetInterfaceFromGlobal", |
| 33 | [DWORD, POINTER(GUID), POINTER(POINTER(IUnknown))], |
| 34 | ), |
| 35 | ] |
| 36 | |
| 37 | def RegisterInterfaceInGlobal(self, obj, interface=IUnknown): |
| 38 | cookie = DWORD() |
| 39 | self.__com_RegisterInterfaceInGlobal(obj, interface._iid_, cookie) |
| 40 | return cookie.value |
| 41 | |
| 42 | def GetInterfaceFromGlobal(self, cookie, interface=IUnknown): |
| 43 | ptr = POINTER(interface)() |
| 44 | self.__com_GetInterfaceFromGlobal(cookie, interface._iid_, ptr) |
| 45 | return ptr |
| 46 | |
| 47 | def RevokeInterfaceFromGlobal(self, cookie): |
| 48 | self.__com_RevokeInterfaceFromGlobal(cookie) |
| 49 | |
| 50 | |
| 51 | # It was a pain to get this CLSID: it's neither in the registry, nor |