Memory, is a complex module in Programing, especially on Windows.

This time, I use cpp with win windows api{

VirtualQueryEx();         //Get the available memory page(block)

ReadProcessMemory();  //Read the specific memory

LookupPrivilegeValue(); //Get the avalible Privileges in windows

AdjustTokenPrivileges();//Enable or disable privilege for specific process

}

Now, we skip the step of getting privilege, and directly talking about the detail of reading memories.

At first, we should understand that we cannot directly read memory at once by giving a big number of memory required.

Normally, we should make a loop to record the detail of every pages(blocks) of memory [VirtualQueryEx()] and Read them [ReadProcessMemory()].

  1. while (true)
  2. {
  3. if (VirtualQueryEx(hProcess, (LPVOID)cur_addr, &meminf, dwInfoSize) == )
  4. break;
  5. if (!(meminf.State == MEM_COMMIT || meminf.State == MEM_IMAGE || meminf.State == MEM_MAPPED))
  6. {
  7. cur_addr = (DWORD)meminf.BaseAddress + meminf.RegionSize;
  8. continue;
  9. }
  10. if ((dbg = ReadProcessMemory(hProcess, (LPCVOID)meminf.BaseAddress, memget, meminf.RegionSize, &ReadSize)) == false)
  11. cout << "Failed to read memory at address:" << meminf.BaseAddress << endl;
  12. else
  13. memget += meminf.RegionSize;
  14. cur_addr = (DWORD)meminf.BaseAddress + eminf.RegionSize;
  15. }

A log about Reading the memroy of Other Process in C++/WIN API--ReadProcessMemory()的更多相关文章

  1. dgango 报错: Timeout when reading response headers from daemon process

    问题: image = np.asarray(bytearray(f.read()), dtype="uint8")cv2_img = cv2.imdecode(image, cv ...

  2. Unity添加自定义快捷键——UGUI快捷键

    在Editor下监听按键有以下几种方式: 自定义菜单栏功能: using UnityEngine; using UnityEditor; public static class MyMenuComma ...

  3. java打印Jni层log

    在eclipse上新建jni工程可以参考:http://www.cnblogs.com/ashitaka/p/5953708.html 要在java层打印c的log必须引入这个头文件的宏定义: #if ...

  4. Android NDK 开发(三)--常见错误锦集合Log的使用【转】

    转载请注明出处:http://blog.csdn.net/allen315410/article/details/41826511  Android NDK开发经常因某些因素会出现一些意想不到的错误, ...

  5. Understanding postgresql.conf : log*

    After loooong pause, adding next (well, second) post to the “series“. This time, I'd like to describ ...

  6. Reading or Writing to Another Processes Memory in C# z

    http://www.jarloo.com/reading-and-writing-to-memory/ Declarations [Flags] public enum ProcessAccessF ...

  7. SQL Server Log文件对磁盘的写操作大小是多少

    原文:SQL Server Log文件对磁盘的写操作大小是多少 SQL Server 数据库有三种文件类型,分别是数据文件.次要数据文件和日志文件,其中日志文件包含着用于恢复数据库的所有日志信息,SQ ...

  8. 大数据框架对比:Hadoop、Storm、Samza、Spark和Flink--容错机制(ACK,RDD,基于log和状态快照),消息处理at least once,exactly once两个是关键

    分布式流处理是对无边界数据集进行连续不断的处理.聚合和分析.它跟MapReduce一样是一种通用计算,但我们期望延迟在毫秒或者秒级别.这类系统一般采用有向无环图(DAG). DAG是任务链的图形化表示 ...

  9. RAC 性能分析 - 'log file sync' 等待事件

    简介 本文主要讨论 RAC 数据库中的'log file sync' 等待事件.RAC 数据库中的'log file sync' 等待事件要比单机数据库中的'log file sync' 等待事件复杂 ...

随机推荐

  1. Glide 小知识点

  2. JS 日期格式化

    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"& ...

  3. 4.3.5 使用Http:// (Https://)协议连接到ActiveMQ 2015年9月28日

    用到的几点地方: 1.服务器端 ActiveMQ的文件activemq.xml中,预先要定义好有关本协议http的传输连接器格式,抓图如下: 2.    然后,开启Eclipse环境,在publish ...

  4. sql语句格式化数字(前面补0)、替换字符串

    以下是详细分析: 1.select power(10,3)得到1000(即:10的3次方) 2.select cast(1000+33 as varchar) 将1000转换类型(即:将int转化成v ...

  5. 移动混合开发之android文件管理新建文件和删除文件

    今天经过一天超过8小时的实践,有很多CSS上的细节需要注意: 1, /*注意是对before的操作*/ .content ul li .icon-check-empty:before{ display ...

  6. window下安装pip工具,再利用pip安装工具来安装其他的python包

    1.在安装pip前,请确认你window系统中已经安装好了python,和easy_install工具,如果系统安装成功,easy_install在目录C:\Python27\Scripts 下面,如 ...

  7. 堆排序C++实现

    /* * heapsort.cpp * * Created on: 2016年3月30日 * Author: Lv_Lang */ //堆排序 #include <iostream> us ...

  8. Linux内核分析——理解进程调度时机跟踪分析进程调度与进程切换的过程

    20135125陈智威 +原创作品转载请注明出处 +<Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 实验 ...

  9. Unable to run app in Simulator

    xcode6 beta出现 “Unable to run app in Simulator” 错误提示,之前一直用着好好的,重启xcode就可以了. xcode6 beta出现 “Unable to ...

  10. MVC OF UEditor 图片上传- 额外参数 笔记

    最近正巧需要用到UEditor ,因为需求,.需要把上传的图片数据上传到阿里云的OSS与记录图片相关信息到MS SQL中 . 不得已只能翻UEditor的实现代码>_<痛苦. 备忘笔记: ...