コード例 #1
0
ファイル: pe.cpp プロジェクト: Ge0/rp
std::shared_ptr<CPU> PE::get_cpu(std::ifstream &file)
{
    std::shared_ptr<CPU> cpu;
    CPU::E_CPU cpu_type = CPU::CPU_UNKNOWN;

    cpu_type = extract_information_from_binary(file);

    switch(cpu_type)
    {
        case CPU::CPU_x86:
        {
            cpu = std::make_shared<x86>();
            break;
        }

        case CPU::CPU_x64:
        {
            cpu = std::make_shared<x64>();
            break;
        }

		case CPU::CPU_ARM:
		{
			cpu = std::make_shared<ARM>();
			break;
		}

        default:
            RAISE_EXCEPTION("Cannot determine the CPU type");
    }
    
    return cpu;
}
コード例 #2
0
ファイル: pe.cpp プロジェクト: haofree/rp
CPU* PE::get_cpu(std::ifstream &file)
{
    CPU* cpu(NULL);
    CPU::E_CPU cpu_type = CPU::CPU_UNKNOWN;

    cpu_type = extract_information_from_binary(file);

    switch(cpu_type)
    {
        case CPU::CPU_x86:
        {
            cpu = new (std::nothrow) x86();
            break;
        }

        case CPU::CPU_x64:
        {
            cpu = new (std::nothrow) x64();
            break;
        }

        default:
            RAISE_EXCEPTION("Cannot determine the CPU type");
    }
    
    return cpu;
}