read physical memory and others

驱动 ReadPhysicalMemory 读写 物理内存 参考代码 win7 64 #pragma warning( disable: 4100 4103 4146 4213)NTSTATUS ReadPhysicalMemory(char *startaddress, UINT_PTR bytestoread, void *output);UINT_PTR KnownPageTableBase = 0;void VirtualAddressToIndexes(QWORD add... 阅读详情

Introduction

This page is an ever-expanding collection of NT information that I accumulate over time. You'll find practical tips as well useless trivia, with new items added at the top of the page.

Named Pipe Directory Listings

Did you know that the device driver that implements named pipes is actually a file system driver? In fact, the driver's name is NPFS.SYS, for "Named Pipe File System". What you might also find surprising is that its possible to obtain a directory listing of the named pipes defined on a system. This fact is not documented, nor is it possible to do this using the Win32 API. Directly using NtQueryDirectoryFile, the native function that the Win32 FindFile APIs rely on, makes it possible to list the pipes. The directory listing NPFS returns also indicates the maximum number of pipe instances set for each pipe and the number of active instances.

To demonstrate the listing of named pipes I've written a program called PipeList. PipeList displays the named pipes on your system, including the number of maximum instances and active instances for each pipe. Full source code is included.

Download PipeList (25KB)

Related tip: You can watch named pipe activity with Filemon by selecting the Drives, Named Pipe menu entry.

 

NT's "/dev/kmem"

Many UNIX afficianados like to point out that UNIX has a flexible file system namespace that allows non-file system devices and psuedo-devices to be accessed through it. The most commonly offered example of this feature is the /dev/kmem file. When an application opens and reads or writes this file (assuming it has permission to do so) it is actually accessing the physical memory of the computer.

What most people don't know is that NT charges its Object Manager subsystem with providing a namespace (see my article on the Object Manager for more information), and the Object Manager allows virtually anything to be mapped as part of it, just like UNIX's file system namespace. And what even fewer people know is that NT has a mechanism that lets an application view (and even modify, with the proper security configuration) a system's physical memory. Its a section (memory mapping) object that is named /Device/PhysicalMemory in NT's namspace (you can verify its existance by using our WinObj tool). An application with sufficient access rights can open the section and map portions of it into its own address space. The result of such a mapping is the creation of a window to physical memory in the application's virtual address map. By default administrators have read-only access to physical memory, but it is possible for an application running as administrator to modify the security attributes so that write access is enabled.

In order to demonstrate the ability to view physical memory, and to give you the opportunity of browsing through your computer's RAM, I've written PhysMem. It is a Win32 console program that will open the physical memory section and dump the contents of regions (in hexadecimal and ASCII) that you specify in a simple command-line interface. Here is what the interface looks like:

Physmem v1.0: physical memory viewerBy Mark RussinovichSysinternals - http://www.Sysinternals.comEnter values in hexadecimal. Enter 'q' to quit.Address: 1000Bytes: 100000001000: 4D 5A 90 00 03 00 00 00 -04 00 00 00 FF FF 00 00 MZ..............00001010: B8 00 00 00 00 00 00 00 -40 00 00 00 00 00 00 00 +...............00001020: 00 00 00 00 00 00 00 00 -00 00 00 00 00 00 00 00 ................00001030: 00 00 00 00 00 00 00 00 -00 00 00 00 80 00 00 00 ................00001040: 0E 1F BA 0E 00 B4 09 CD -21 B8 01 4C CD 21 54 68 ..¦....-.+.L-.Th00001050: 69 73 20 70 72 6F 67 72 -61 6D 20 63 61 6E 6E 6F is program canno00001060: 74 20 62 65 20 72 75 6E -20 69 6E 20 44 4F 53 20 t be run in DOS00001070: 6D 6F 64 65 2E 0D 0D 0A -24 00 00 00 00 00 00 00 mode............00001080: 50 45 00 00 4C 01 06 00 -53 3A 4D 33 00 00 00 00 PE..L...S.M3.......

While you are browsing your memory, some places of interest you might want to take a look at are offset 0x1000, which is where NTLDR is located (you can see its header in the example output above, which states that it can't be run in DOS mode), and 0xF9000-0xFFFFF, which is where ROM BIOS is mapped. You'll likely see strings belonging to the vendor of your computer and sometimes video adapter strings in the BIOS.

The source code for PhysMem is fairly self-explanatory. PhysMem uses the native API to open and map /Device/PhysicalMemory because that name is inaccessible via the Win32 API. It also uses the native APIs (all of which are documented in the Windows NT DDK) to map and unmap views of the section, though this could have been done using Win32.

Download PhysMem (28KB)

Hidden Registry Keys?

A subtle but significant difference between the Win32 API and the Native API (see Inside the Native API for more information on this largely undocumented interface) is the way that names are described. In the Win32 API strings are interpreted as NULL-terminated ANSI (8-bit) or wide character (16-bit) strings. In the Native API names are counted Unicode (16-bit) strings. While this distinction is usually not important, it leaves open an interesting situation: there is a class of names that can be referenced using the Native API, but that cannot be described using the Win32 API.

How is this possible? The answer is that a name which is a counted Unicode string can explicitly include NULL characters (0) as part of the name. For example, "Key/0". To include the NULL at the end the length of the Unicode string is specified as 4. There is absolutely no way to specify this name using the Win32 API since if "Key/0" is passed as a name, the API will determine that the name is "Key" (3 characters in length) because the "/0" indicates the end of the name.

When a key (or any other object with a name such as a named Event, Semaphore or Mutex) is created with such a name any applications using the Win32 API will be unable to open the name, even though they might seem to see it. The program below, RegHide(source code is included), illustrates this point. It creates a key called "HKEY_LOCAL_MACHINE/Software/Sysinternals/Can't touch me!/0" using the Native API, and inside this key it creates a value. Then the program pauses to give you an opportunity to see if you can view the value using any Registry editor you have handy (Regedit, Regedt32 or a third-party Registry editor). Because Regedit and Regedt32 (and likely an third party Registry editor) use the Win32 API, they will see the key listed as a child of Sysinternals, but when you try to open the key you'll get an error. This is because the Registry editor will try to open "Can't touch me!" without the trailing NULL (which is interpreted as the end of the string) and won't find this name. After you've verified this exit the program and this special key will be deleted.

Download RegHide (24KB)

Fault Tolerance on Workstation?

One of the differences I highlighted in my November 1996 Windows NT Magazine article, "Inside the Difference Between Windows NT Workstation and Windows NT Server," was that fault tolerant disk configurations are only available on Server. This is because the Windows NT disk administrative program, Windisk.exe, checks to see if its running on a Workstation, and if so, does not display its Fault Tolerance menu, which contains the entries that are used to create mirrors and parity striped sets.

It turns out that whoever wrote the Workstation Resource Kit program FTEDIT was unaware of Microsoft's official policy on fault tolerance and Workstation: it appears you can use this utility to create mirrors and striped sets with parity on Workstations.

Update: several people have complained that this doesn't work, which isn't surprising since I left out an important step: the Fault-tolerant disk driver must be enabled. If you have an existing volume-set then it is already is, but if you don't, use a Registry editor to set the value of:

HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/FtDisk/Start

to 0. The next time you boot your workstation, the fault-tolerant drives you have created will be functional.


The Native API

NT's native API are services that are core operating system services available to device drivers and user-mode applications. The Win32 subsystem relies heavily on this API, as do many Microsoft Windows NT Resource Kit utilities. There are over 200 system calls in NT's native API and only 21 of them are documented by Microsoft.


Idle Trivia

Did you know that unlike all the other threads in an NT system, the idle-thread executes at an IRQL (interrupt request level) of DISPATCH_LEVEL (rather than PASSIVE_LEVEL)? See Advanced DPCs for more information.

On uniprocessor x86 systems the idle-thread actually performs a HLT (Halt) instruction, which effectively turns the CPU off to everything except for hardware interrupts.


Never-ending Quantum?

In NT, as with most time-sharing operating systems, threads run in turns called quantums. Normally, a thread executes until its quantum runs out. The next time it is scheduled it starts with a full quantum. However, in NT a thread also gets its quantum refreshed every time its thread or process priority is set. This means that a thread can reset its quantum by calling SetThreadPriority (without changing its priority) before its turn runs out. If it continues to do this it will effectively have an infinite quantum. Why does NT do this? Its not clear, but it appears to be a bug.


NTOSKRNL's Main

NTOSKRNL.EXE, the core file of the kernel-mode component of Windows NT, contains the Cache Manager, the Executive, the Kernel, the Security Reference Monitor, the Memory Manager, and the Scheduler, among other things, and is in charge of getting NT up and running. You may be surprised to know that it has a standard main() that is executed when it is loaded by the OSLOADER:

// // NTOSKRNL main // int main( boot parameters ) {     //     // Fire up NT!     //     KiSystemStartup();     return 0; }

Tuning Workstation for Server-like Loads

NT Workstation and NT Server have vastly different performance characteristics due to the internal tuning that the NT operating system, which is identical on both, performs. Most tuning parameters are inaccessible, but a few are located in the Registry. If you are running Server and you double-click on the Server entry of the Services tab in the Control Panel's Network applet, you will get a dialog that lets you determine what type of application you want the machine to be tuned for. Choices let you select between "Minimize Memory Used", "Balance", "Maximize Usage for File Sharing", and "Maximize Usage for Network Applications". This dialog box is not presented on Workstation installations. The various selections actually change the values of two Registry values:

HKLM/SYSTEM/CurrentControlSet/Control/Session Manager/Memory Management/LargeSystemCache

and

HKLM/SYSTEM/CurrentControlSet/Services/LanmanServer/Parameters/Size

This table (which was derived from sessions with Regmon) presents the settings you should select on a Workstation to achieve the same effect you would get using the dialog box were your system a Server.

Tuning TargetLargeSystemCacheSize
Minimize Memory Used01
Balance02
File Sharing 13
Network Applications03
 
MLE 基础学习 Transformer 能解释算法原理、给出必要的数学推导、估算计算与显存成本、描述 GPU 上的执行方式,并讨论真实系统中的 Trade-off需要从四个层次建立知识体系:Mathematical Foundations:为什么设计成这样?能否严格推导?有什么假设与局限?Model Architecture:数据怎样流过 Transformer?不同架构的计算量、参数量和表达能力如何?Hardware and Systems:算子如何映射到 GPU? 阅读详情

相关推荐

jd内存读写驱动操作源码

绝地求生 驱动读写 会的自然懂 c语言 最新驱动源码 调用sys 就可以进行软件保护进程 需要的下载

Read physical memory information from registry

/////////////////////////////////////////////////////////////////////////////  Module://    Read physical memory information from registry//    HKLM/HARDWARE/RESOURCEMAP/System Resources/Physical Memo

1143

手把手教你用STM32CubeMX和HAL库驱动MT6835磁编码器(SPI读取21位角度)

本文详细介绍了如何使用STM32CubeMX和HAL库驱动MT6835磁编码器,通过SPI接口读取21位高精度角度数据。从硬件准备、CubeMX配置到HAL库驱动实现与优化,提供了完整的实战指南,帮助开发者快速掌握磁编码器的应用技巧,适用于机器人关节和精密仪器等高精度场景。

weixin_28716769的博客 439

32位/64位WINDOWS驱动之物理地址读写内存方法4

自写函数 通过PID切换到目标进程环境 计算出物理地址把物理地址映射到当前进程 不使用时需要用ZwUnmapViewOfSection取消映射//转换成 物理地址的方式 读取进程虚拟地址。

a756598009的博客 1723

【黑马点评优化】2-Canel实现多级缓存(Redis+Caffeine)同步

【黑马点评优化】2-Canel实现多级缓存(Redis+Caffeine)同步

m0_52031708的博客 3857

点云入门笔记(一):点云数据及获取

点云概念: 点云是某个坐标系下的点的数据集。点包含了丰富的信息,包括三维坐标 X,Y,Z、颜色、分类值、强度值、时间等等。

wc19862274581的博客 2万+

ReadPhysicalMemoryPtr更快速的方法

ReadPhysicalMemoryPtr更快速的方法

如鹿渴慕泉水的专栏 277

爬取国家统计局最近10年年度数据

一、编码流程 1.目标网址:https://data.stats.gov.cn/easyquery.htm?cn=C01 2.编码思路: (1) 解析左侧指标树,实现4级标签定位 (难点:层层嵌套,下一级指标的xpath路径以上一级指标为基础;不是所有二级指标都含有三和四级指标,需要进行判断) (2) 使用selenium webdriver 点选指标,加载出右侧表格数据 (难点:当指标无法在全局页面显示时,需向下拖动滚动条) (3) 解析右侧数据,实现数据存储 3.使用模块: (1) selenium:解

weixin_39645690的博客 4563

snps usb ip及 vip 使用

usb vip callback 分为 protocol_callback 和 physical_callback, 分别实现不同层级的注错,定义好callback之后 在sequence 中需要的地方注册到相应的组件中。usb_base_test.sv 中会设置 svt_usb_transfer override 为 cust_svt_usb_transfer,改变 isoc transfer 权重,导致报错。不同 out ep 需要指定不同的 FIFO。timescale 需要是 1ps/1ps。

IAN 347

使用DevExpress22.X(Patch)控件库在VisualStudio2022使用C#进行Winform、WPF应用的开发,看这一篇就够了!

写在开头,Dev Express是个十分强大的控件库(下文简称Dev),但碍于其高昂的使用费用,“出于学习目的”,我们一般使用的都是Patch版本(在版权意识日趋加强的当下,不要提那两个字,现在加上那些字,百度都搜不出内容)。

平凡之路 2万+

Educoder | 计算机网络实验-Ping命令与ICMP协议分析

任务描述本关任务:捕获 Ping 程序生成的数据包。相关知识ping命令Ping 程序是一个简单的工具,允许任何人(例如:网络管理员)验证主机是否存在。源主机中的 Ping 程序将数据包发送到目标 IP 地址;如果目标是在线的,则目标主机中的 Ping 程序将会发送响应 Ping 数据包证明他在线,这两个 Ping 数据包都是 ICMP 数据包。在 Unix/Linux,序列号从 0 开始计数,依次递增。而 Windows 中 ping 程序的 ICMP 序列号是没有规律;;。

Mksg_28的博客 7629

虚拟内存 | 原理、硬件地址转换、运行机制与 Linux 应用

……

u013669912的博客 359

芒果YOLOv5改进107:ARConv自适应旋转卷积,全网首发 | 即插即用:以增强其表征能力,从而准确检测方向物体,ICCV顶会论文idea

ARConv自适应旋转卷积,全网首发 | 即插即用:以增强其表征能力,从而准确检测方向物体,ICCV顶会论文idea

包括YOLOv5、YOLOv7、YOLOv8等模型改进 958

大学公开课程资料

计算机和高性能计算相关大学公开课程资料。

weixin_42849849的博客 122

SOI LDMOS器件的Sentaurus TCAD建模与关键电学特性仿真研究

本文研究了SOI LDMOS器件的TCAD建模与电学特性仿真。通过Sentaurus TCAD平台建立了单RESURF结构的SOI LDMOS模型,详细阐述了器件结构原理和RESURF耐压机制。研究采用SDE进行几何定义和掺杂配置,在Sentaurus Device中构建了完整的物理模型体系,包括迁移率、复合和碰撞电离模型。通过系统仿真提取了器件的转移特性、输出特性和击穿特性等关键参数,分析了各参数对性能的影响规律。研究结果为功率半导体器件的仿真建模提供了规范化参考,有助于优化SOI LDMOS的性能设计。

huanghm88的专栏 134

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

计算机复试专业英语实战指南:算法/OS/网络/AI高频表达体系

专业英语在计算机考研复试中本质是学术沟通能力的即时检验,而非孤立词汇记忆。其核心在于理解算法复杂度、并发模型、网络拥塞控制、数据库隔离级别等基础概念背后的原理,并能用英文组织逻辑链——如从‘time complexity’推演至实时性影响,从‘consistency model’关联到用户可感知的stale reads。技术价值体现在精准表达权衡(trade-off)、归因(root cause)与工程取舍(space-time-implementation),广泛应用于复试问答、组会汇报及论文写作场景。本

weixin_34204722的博客 372

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

CPU 缓存 | 原理、映射、一致性

……

u013669912的博客 414

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

What is Docker? (什么是 Docker?)

What is Docker? (什么是 Docker?)

程永强 301

学习进程里停滞区间的生成 | 电报语言研究 —— 习惯层级的习得

……

u013669912的博客 374

世界-语言-动作模型:统一世界建模、语言推理与动作合成

Yi Yang 1,2,†, Zhihong Liu 1,†, Siqi Kou 1,†, Yiyang Chen ¹, Yanzhe Hu³, Jianbo Zhou ⁴, Boyuan Zhao 5, Zhijie Wei 6, Xiao Xia 1, Xueqi Li 2,7, Pengfei Liu 1,2, Zhijie Deng 1,1SJTU, 2SII, HUST, 4SCUT, 5ECUST, 6SHU, 7NJUPT †Equal Contribution, †Corresponding

u013250861的博客 74

历年四级翻译真题及答案

2023年6月 中国政府越来越重视终身教育,发展继续教育是构建终身教育的有效途径,高校作为人才培养的基地,拥有先进理念,丰富教学资源,理应成为继续教育的培养主体。近年来,许多高校努力适应社会需求,与用人单位沟通,探索出一条适应中国国情的继续教育新路,以使继续教育在国家战略中发挥更重大的作用。 The Chinese government attaches progressively more importance to life-long education. Developing continuin

qq_46518480的博客 5923

雅思口语Part1/2/3主题

pursue my hobbies and interests 追求自己的爱好和兴趣。scrolling through social media 刷社交媒体。make better use of my time 更好地利用我的时间。great sense of achievement 强烈的成就感。connect with more people 与更多人联系。complex and detailed 复杂且细致的。every corner of it 它的每一个角落。

flytalei的博客 898

CANN/hcomm HCCL-VM虚拟执行环境

HCCL-VM is a virtual execution environment for high-performance collective communication targeting Huawei Ascend NPU cards. This tool enables the development and functional verification of HCCL collec

gitblog_00459的博客 1092

【保姆级打包】Lena512512 512×512 灰度与彩色图像资源:格式清单与使用指南

Lena512512 灰度与彩色图像资源项目把经典的 Lena 测试图打包在同一份压缩包里,尺寸统一为 512×512 像素:灰度图三种格式(BMP、MAT、PGM),彩色图一种格式(TIFF),全部存放在 `lena.zip` 内。做图像处理课程实验、算法调参或教学演示时,可以直接取用这份标准测试图像,无需自行寻找或生成数据。 ## 这份图像资源适合谁 - **课程学生**:降噪、边缘检测、

gitblog_00419的博客 413

Java Thread Pools — Deep Dive

Java线程池核心原理摘要 线程池作用:解决线程创建开销大、资源耗尽问题,通过复用固定线程、控制并发量、任务队列解耦任务提交与执行。Java提供Executor框架(Java 5+)实现。 核心类层次: Executor → ExecutorService → ThreadPoolExecutor(核心)/ScheduledThreadPoolExecutor(定时) ForkJoinPool:工作窃取,支持并行流和CompletableFuture ThreadPoolExecutor关键参数: core

quwenqian的专栏 389
上一篇: pragma指令简介
下一篇: VC- Project Setting-Debug-Project Option语法解释
iiprogram
博客等级 码龄25年 1068粉丝 1515原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值