⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 memserv.c

📁 PE Monitor是一个小调试器和反汇编器
💻 C
字号:
///////////////////////////////////////////////////////////////////////////////
//
//  FileName    :   MemServ.c
//  Version     :   1.0
//  Author      :   Luo Cong
//  Date        :   2004-09-02 9:59:07
//  Comment     :   
//
///////////////////////////////////////////////////////////////////////////////

#include <windows.h>
#include "MemServ.h"
#include "Misc.h"
#include "PEServ.h"

/**
 * Must call IsPEFile() & Initialize() first!
 */
int ReadCommand(
    /* [in] */ const unsigned long ip,
    /* [in] */ const size_t cmdsize,
    /* [out] */ char *cmd
)
{
    int nRetResult = 0;
    unsigned long ulFileOffset;

    ulFileOffset = RVAToFileOffset(ip - g_ulImageBase);

    if (g_lFileSize < (long)(ulFileOffset + cmdsize))
        goto Exit0;

    if (NULL != cmd)
        memcpy(cmd, &g_FileContents[ulFileOffset], cmdsize);

    nRetResult = 1;
Exit0:
    return nRetResult;
}

/**
 * Must call IsPEFile() & Initialize() first!
 */
int GetDisassemblerRange(
    /* [out] */ unsigned long *pBase,
    /* [out] */ unsigned long *pSize
)
{
    int nRetResult = 0;
    int nRetCode;
    IMAGE_NT_HEADERS nt_header;

    MY_PROCESS_ERROR(pBase);
    MY_PROCESS_ERROR(pSize);

    nRetCode = GetNTHeader(&nt_header);
    MY_PROCESS_ERROR(nRetCode);

    *pBase = nt_header.OptionalHeader.ImageBase +
        nt_header.OptionalHeader.BaseOfCode;

    *pSize = nt_header.OptionalHeader.SizeOfCode;

    nRetResult = 1;
Exit0:
    return nRetResult;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -