コード例 #1
0
int PPPoEDiscoveryLayer::getTagCount()
{
	if (m_TagCount != -1)
		return m_TagCount;

	m_TagCount = 0;
	PPPoEDiscoveryLayer::PPPoETag* curTag = getFirstTag();
	while (curTag != NULL)
	{
		m_TagCount++;
		curTag = getNextTag(curTag);
	}

	return m_TagCount;
}
コード例 #2
0
int main(int argc, char* argv[])
{
    try
    {
        std::string src = argv[0];
        if (argc == 2)
        {
            src = argv[1];
        }

        auto file = std::make_unique<MMFile>(src.c_str(), MMOpenMode::read);
        auto peBase = file->getPtr();

        std::shared_ptr<Image> image = std::make_shared<PEImage>();
        image->loadImage(peBase, 0x0);

        uint8_t* debug_info;
        size_t debug_info_size;
        image->getSectionPointer(".debug_info", debug_info, debug_info_size);
        printf("Using source: %s\n", src.c_str());
        printf("Section %p (%X)\n", debug_info, debug_info_size);

        auto dwarfReader = std::make_shared<DwarfReader>(image);

        auto nothing = [](const DwarfTag& a, ptrdiff_t level){ 
            //printf("ASDASDASDASD\n\n\n");
            return true;
        };
        for (size_t index = 0; index < dwarfReader->getCompilationUnitCount(); ++index)
        {
            auto compUnit = dwarfReader->getCompilationUnit(index);
            auto compUnitTag = compUnit.getFirstTag();
            compUnitTag.forAllTagsAndChildren(nothing);
            system("pause");
        }

        system("pause");
    }
    catch (const std::exception& e)
    {
        MessageBoxA(NULL, e.what(), "Exception caught", MB_ICONEXCLAMATION);
    }
}