Ejemplo n.º 1
0
void CommandIgnore::PerformCommand(Connection& connection)
{
	HidStatus status;
	HidObjId objId = 0;

	switch (m_procType)
	{
	case EProcTypes::TypeProcessId:
		status = Hid_AttachExcludedState(connection.GetContext(), m_targetProcId, m_inheritType);
		break;
	case EProcTypes::TypeImage:
		status = Hid_AddExcludedImage(connection.GetContext(), m_targetImage.c_str(), m_inheritType, m_applyByDefault, &objId);
		break;
	default:
		throw WException(ERROR_UNKNOWN_COMPONENT, L"Internal error, invalid type for command 'ignore'");
	}

	if (!HID_STATUS_SUCCESSFUL(status))
		throw WException(HID_STATUS_CODE(status), L"Error, command 'ignore' rejected");

	g_stderr << L"Command 'ignore' successful" << endl;
	if (m_procType == EProcTypes::TypeImage)
		g_stdout << L"ruleid:" << objId << endl;
}
Ejemplo n.º 2
0
void CommandUnignore::PerformCommand(Connection& connection)
{
	HidStatus status;

	switch (m_targetType)
	{
	case ETargetIdType::All:
		status = Hid_RemoveAllExcludedImages(connection.GetContext());
		break;
	case ETargetIdType::ProcId:
		status = Hid_RemoveExcludedState(connection.GetContext(), m_targetProcId);
		break;
	case ETargetIdType::RuleId:
		status = Hid_RemoveExcludedImage(connection.GetContext(), m_targetId);
		break;
	default:
		throw WException(ERROR_UNKNOWN_COMPONENT, L"Internal error, invalid type for command 'unignore'");
	}

	if (!HID_STATUS_SUCCESSFUL(status))
		throw WException(HID_STATUS_CODE(status), L"Error, command 'unignore' rejected");

	g_stderr << L"Command 'unignore' successful" << endl;
}