def get_open_data(base, prog_id): try: k = Key(open_at=r'Software\Classes\%s' % prog_id, root=base) except WindowsError as err: if err.errno == winerror.ERROR_FILE_NOT_FOUND: return None, None with k: return k.get(sub_key=r'shell\open\command'), k.get(sub_key='DefaultIcon'), k.get_mui_string('FriendlyTypeName') or k.get()
def get_open_data(base, prog_id): try: k = Key(open_at=r'Software\Classes\%s' % prog_id, root=base) except WindowsError as err: if err.errno == winerror.ERROR_FILE_NOT_FOUND: return None, None, None with k: cmd = k.get(sub_key=r'shell\open\command') if cmd: parts = cmd.split() if parts[-1] == '/dde' and '%1' not in cmd: cmd = ' '.join(parts[:-1]) + ' "%1"' return cmd, k.get(sub_key='DefaultIcon'), k.get_mui_string('FriendlyTypeName') or k.get()