Пример #1
0
	def notify_protocol(self, handle, protocol, interface, from_hook):
		for (event_id, event_dic) in self.ql.loader.events.items():
			if event_dic['Guid'] == protocol:
				if event_dic['CallbackArgs'] == None:
					# To support smm notification, we use None for CallbackArgs on SmmRegisterProtocolNotify 
					# and updare it here.
					guid = str_to_guid(protocol)
					guid_ptr = self.heap.alloc(guid.sizeof())
					guid.saveTo(self.ql, guid_ptr)
					event_dic['CallbackArgs'] = [guid_ptr, interface, handle]
				# The event was previously registered by 'RegisterProtocolNotify'.
				signal_event(self.ql, event_id)
		return execute_protocol_notifications(self.ql, from_hook)
Пример #2
0
def force_notify_RegisterProtocolNotify(ql: Qiling, address: int, params):
    event_id = params['Event']

    if event_id in ql.loader.events:
        # let's force notify
        event = ql.loader.events[event_id]
        event['Guid'] = params["Protocol"]
        event["Set"] = False

        signal_event(ql, event_id)
        check_and_notify_protocols(ql, True)

        return EFI_SUCCESS

    return EFI_INVALID_PARAMETER
Пример #3
0
        def force_notify_RegisterProtocolNotify(ql: Qiling, address: int, params):
            ql.log.info(f'[force_notify] address = {address:#x}, params = {params}')

            self.ck.visited_oncall = True

            event_id = params['Event']

            if event_id in ql.loader.events:
                event = ql.loader.events[event_id]

                # let's force notify
                event["Set"] = False

                utils.signal_event(ql, event_id)
                utils.execute_protocol_notifications(ql, True)

                return EFI_SUCCESS

            return EFI_INVALID_PARAMETER
Пример #4
0
def InstallProtocolInterface(context, params):
    handle = read_int64(context.ql, params["Handle"])

    if handle == 0:
        handle = context.heap.alloc(1)

    dic = context.protocols.get(handle, {})

    dic[params["Protocol"]] = params["Interface"]
    context.protocols[handle] = dic

    for (event_id, event_dic) in context.ql.loader.events.items():
        if event_dic['Guid'] == params['Protocol']:
            # The event was previously registered by 'RegisterProtocolNotify'.
            signal_event(context.ql, event_id)

    check_and_notify_protocols(context.ql)
    write_int64(context.ql, params["Handle"], handle)

    return EFI_SUCCESS