0001 """General utility functions common to client and server. 0002 0003 This module contains a collection of general purpose utility functions. 0004 """ 0005 import pythoncom 0006 import win32api, win32con 0007 0008 def IIDToInterfaceName(iid): 0009 """Converts an IID to a string interface name. 0010 0011 Used primarily for debugging purposes, this allows a cryptic IID to 0012 be converted to a useful string name. This will firstly look for interfaces 0013 known (ie, registered) by pythoncom. If not known, it will look in the 0014 registry for a registered interface. 0015 0016 iid -- An IID object. 0017 0018 Result -- Always a string - either an interface name, or '<Unregistered interface>' 0019 """ 0020 try: 0021 return pythoncom.ServerInterfaces[iid] 0022 except KeyError: 0023 try: 0024 try: 0025 return win32api.RegQueryValue(win32con.HKEY_CLASSES_ROOT, "Interface\\%s" % iid) 0026 except win32api.error: 0027 pass 0028 except ImportError: 0029 pass 0030 return str(iid) 0031 0032
Generated by PyXR 0.9.4