当前位置: 首页>>代码示例>>C++>>正文


C++ Tracer::ReBuildMemoryMap方法代码示例

本文整理汇总了C++中Tracer::ReBuildMemoryMap方法的典型用法代码示例。如果您正苦于以下问题:C++ Tracer::ReBuildMemoryMap方法的具体用法?C++ Tracer::ReBuildMemoryMap怎么用?C++ Tracer::ReBuildMemoryMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tracer的用法示例。


在下文中一共展示了Tracer::ReBuildMemoryMap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ps_base_address

//////////////////////////////////////////////////////////////////////////////////////////////////////////
// ps_base_address()
//
// search through all loaded modules for a string match and return it's base address.
//
bool ps_base_address (char *module, DWORD *address, DWORD *size)
{
    map <DWORD,t_Debugger_memory*>::const_iterator  it;
    
    dbg.ReBuildMemoryMap();

    // determine the base address of the executable section for the loaded module.
    for (it = dbg.MemoryMap.begin(); it != dbg.MemoryMap.end(); ++it)
    {
        // match the module name.
        if (stricmp(it->second->Name.c_str(), module) != 0)
            continue;

        // ensure we found the correct section.
        if ((it->second->basics.Protect & PAGE_EXECUTE)           ||
            (it->second->basics.Protect & PAGE_EXECUTE_READ)      ||
            (it->second->basics.Protect & PAGE_EXECUTE_READWRITE) ||
            (it->second->basics.Protect & PAGE_EXECUTE_WRITECOPY))
        {
            // module executable section found.
            *address = it->second->address;
            *size    = it->second->basics.RegionSize;
            return true;
        }
    }

    return false;
}
开发者ID:melbcat,项目名称:idc_public_script,代码行数:33,代码来源:main.cpp

示例2: main


//.........这里部分代码省略.........
                    }
                    break;

                // detach from debuggee.
                case 'd':
                    if (!dbg.pDebugActiveProcessStop || !dbg.pDebugSetProcessKillOnExit)
                    {
                        printf("\ndetaching is not possible on the current os ... request ignored.\n");
                        break;
                    }

                    main_terminate = true;
                    printf("\nclosing any open recorder and detaching ...\n");

                    if (recorder_mode != NOT_RECORDING)
                    {
                        fclose(recorder);

                        if (reg_enum_flag)
                            fclose(recorder_regs);
                    }

                    dbg.detach();

                    break;

                // display available options.
                case 'h':
                    ps_commands();
                    break;
                
                // display memory map for executable sections of each module.
                case 'm':
                    dbg.ReBuildMemoryMap();

                    printf("\n---------- MODULE LIST ----------\n");

                    for (it = dbg.MemoryMap.begin(); it != dbg.MemoryMap.end(); ++it)
                    {
                        // determine the correct section)
                        if ((it->second->basics.Protect & PAGE_EXECUTE)           ||
                            (it->second->basics.Protect & PAGE_EXECUTE_READ)      ||
                            (it->second->basics.Protect & PAGE_EXECUTE_READWRITE) ||
                            (it->second->basics.Protect & PAGE_EXECUTE_WRITECOPY))
                        {
                            // module executable section found.
                            printf("module %08x %s\n", it->second->address, it->second->Name.c_str());
                        }
                    }

                    printf("\nstalking:\n");

                    for (node *cursor = bp_modules; cursor != NULL; cursor = cursor->next)
                        printf("%08x - %08x [%08x] %s\n", cursor->base, cursor->base + cursor->size, cursor->size, cursor->name);

                    printf("---------- MODULE LIST ----------\n\n");

                    break;

                // quit program.
                case 'q':   
                    main_terminate = true;
                    printf("\nclosing any open recorder and quiting ...\n");

                    if (recorder_mode != NOT_RECORDING)
                    {
开发者ID:melbcat,项目名称:idc_public_script,代码行数:67,代码来源:main.cpp


注:本文中的Tracer::ReBuildMemoryMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。